You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • So you intend to call jswrap_ESP32_get_Char_Value when the ESP32 asks Espruino for the data inside a characteristic?

    Rather than:

     jsvObjectIteratorNew(&serviceIt,services­Data);
        while(jsvObjectIteratorHasValue(&service­It)){
            serviceKey = jsvObjectIteratorGetKey(&serviceIt);
            if(jsvIsEqual(serviceKey,serviceUUID)){
             ...
    

    You could just use:

    serviceData = jsvSkipName(jsvFindChildFromVar(services­Data, serviceUUID, false));
    if (serviceData) {
    

    However one problem you have is UUIDs can be defined in different ways, eg 0xABCD, "ABCD", "AbCd" - so maybe what you're doing is better - but use bleVarToUUID and then compare the raw UUIDs, rather than using jsvIsEqual.

    you do say the ESP32 uses handles though? IMO it would probably be faster/easier to have a separate list of handle vs. value in execInfo.hiddenRoot instead? It might come in handy in other places - for instance I think notifications so something like that already?

About

Avatar for Gordon @Gordon started