Пример #1
0
    //% blockId=eddystone_advertise_url block="bluetooth advertise url %url|with power %power|connectable %connectable"
    //% parts=bluetooth weight=11 blockGap=8
    //% help=bluetooth/advertise-url blockExternalInputs=1
    void advertiseUrl(String url, int power, bool connectable) {
#if CONFIG_ENABLED(MICROBIT_BLE_EDDYSTONE_URL)
        power = min(MICROBIT_BLE_POWER_LEVELS-1, max(0, power));
        int8_t level = CALIBRATED_POWERS[power];
        uBit.bleManager.advertiseEddystoneUrl(MSTR(url), level, connectable);
        uBit.bleManager.setTransmitPower(power);
#endif
    }
Пример #2
0
/** speichert eine zuweisung ID=num1,num2,..,num-x in einem varset
 */
int parse_variable_assignment_int(int vset, int line, int *p )
{
    int key, ch;
    int varname = m_create(20,1);

    while(1) {

	if( cut_id( line, p, varname ) < 0 ) break; /* no more vars */
	key = v_lookup(vset, MSTR(varname) ); 
        if( key < 0 ) break;
	v_kclr(key);
	do {
	    if( (ch=cut_id( line, p, varname )) < 0 ) goto leave_err;
	    v_kset(key, MSTR(varname), -1 ); 
	} while( ch == ',' );

    }
    m_free(varname);    
    return 0;

 leave_err:
    m_free(varname);
    return -1;
}
Пример #3
0
	void TSugarExporter::BuildSugarInterface(INode* _maxNode, const STRING_TYPE& _sugarsDirectory, const TEggExporter& _eggExporter)
	{
		// Keeping track of the max node
		m_maxNode = _maxNode;

		// Sugar location
		m_sugarsDirectory = _sugarsDirectory;

		// The associated sugar exporter
		m_eggExporter = &_eggExporter;

		// Fetch the node's name
		m_nodeName = convertToString(MSTR(m_maxNode->GetName()));
		m_hashID = convertToString(std::hash<std::string>()(m_nodeName));

		// Output file name
		m_outputFile = m_sugarsDirectory + "/" + m_hashID + ".sugar";
	}
Пример #4
0
 //%
 void uartWriteString(String data) {
     startUartService();
 	uart->send(MSTR(data));
 }    
Пример #5
0
 //% help=bluetooth/on-uart-data-received
 //% weight=18 blockId=bluetooth_on_data_received block="bluetooth|on data received %delimiters=serial_delimiter_conv"
 void onUartDataReceived(String delimiters, Action body) {
   startUartService();
   uart->eventOn(MSTR(delimiters));
   registerWithDal(MICROBIT_ID_BLE_UART, MICROBIT_UART_S_EVT_DELIM_MATCH, body);
 }
Пример #6
0
 //%
 String uartReadUntil(String del) {
     startUartService();
     return PSTR(uart->readUntil(MSTR(del)));
 }    
Пример #7
0
void guiMenu_OnLang ( void )
{
  int i = IupGetInt ( guiMenu, IUP_VALUE );
  IupSetAttribute ( guiData, MSTR ( guiData_Load ),
                    appLang->a[ LNG_LOAD         ].a );
  IupSetAttribute ( guiData, MSTR ( guiData_Apply ),
                    appLang->a[ LNG_APPLY        ].a );
  IupSetAttribute ( guiData, MSTR ( guiData_Reset ),
                    appLang->a[ LNG_RESET        ].a );
  IupSetAttribute ( guiData, MSTR ( guiData_Save ),
                    appLang->a[ LNG_SAVE         ].a );

  if ( i == guiMenu_Hacks || i == guiMenu_Codes )
  {
    IupSetAttribute ( guiData, MSTR ( guiData_Add ),
                      appLang->a[ LNG_ADD          ].a );
    IupSetAttribute ( guiData, MSTR ( guiData_Ins ),
                      appLang->a[ LNG_INSERT       ].a );
    IupSetAttribute ( guiData, MSTR ( guiData_Shu ),
                      appLang->a[ LNG_SHIFT_UP     ].a );
    IupSetAttribute ( guiData, MSTR ( guiData_ShuNB ),
                      appLang->a[ LNG_SHIFT_UP__NB_     ].a );
    IupSetAttribute ( guiData, MSTR ( guiData_Shd ),
                      appLang->a[ LNG_SHIFT_DOWN   ].a );
    IupSetAttribute ( guiData, MSTR ( guiData_ShdNB ),
                      appLang->a[ LNG_SHIFT_DOWN__NB_   ].a );
    IupSetAttribute ( guiData, MSTR ( guiData_Shl ),
                      appLang->a[ LNG_SHIFT_LEFT   ].a );
    IupSetAttribute ( guiData, MSTR ( guiData_Shr ),
                      appLang->a[ LNG_SHIFT_RIGHT  ].a );
    IupSetAttribute ( guiData, MSTR ( guiData_Rem ),
                      appLang->a[ LNG_REMOVE       ].a );
  }
  else
  {
    IupSetAttribute ( guiData, MSTR ( guiData_Add ), NULL );
  }

#ifndef EMULATOR
  IupSetAttribute ( guiMenu, MSTR ( guiMenu_Org ),
                    appLang->a[ LNG_ORGANISATION ].a );
  IupSetAttribute ( guiMenu, MSTR ( guiMenu_Pfm ),
                    appLang->a[ LNG_PLATFORM     ].a );
  IupSetAttribute ( guiMenu, MSTR ( guiMenu_Tar ),
                    appLang->a[ LNG_TARGET       ].a );
#endif
  IupSetAttribute ( guiMenu, MSTR ( guiMenu_Pro ),
                    appLang->a[ LNG_PROFILE      ].a );
  IupSetAttribute ( guiMenu, MSTR ( guiMenu_Qry ),
                    appLang->a[ LNG_SEARCH       ].a );
  IupSetAttribute ( guiMenu, MSTR ( guiMenu_Res ),
                    appLang->a[ LNG_RESULTS      ].a );
  IupSetAttribute ( guiMenu, MSTR ( guiMenu_Med ),
                    appLang->a[ LNG_EDITOR       ].a );
  IupSetAttribute ( guiMenu, MSTR ( guiMenu_Hacks ),
                    appLang->a[ LNG_HACKS        ].a );
  IupSetAttribute ( guiMenu, MSTR ( guiMenu_Hack ),
                    appLang->a[ LNG_HACK         ].a );
  IupSetAttribute ( guiMenu, MSTR ( guiMenu_Codes ),
                    appLang->a[ LNG_CODES        ].a );
  IupSetAttribute ( guiMenu, MSTR ( guiMenu_Code ),
                    appLang->a[ LNG_CODE         ].a );
  IupSetAttribute ( guiMenu, MSTR ( guiMenu_About ),
                    appLang->a[ LNG_ABOUT        ].a );
}