You are reading a single comment by @ThomasVikström and its replies. Click here to read the full conversation.
  • Sorry, but I'm again a bit stuck with BLE, my issue is actually same/similar as this one, but that's 2 years old and perhaps for another device than Bangle.

    As posted here, I've been able to connect and transmit data from an Arduino-device (Nicla Sense ME), but the Arduino-program crashes with an ambigous message "Out of memory" when I want to transmit data from more sensors, this even if only approx. 50% of the memory is used. As this is for me very challenging to troubleshoot, I thought I'd instead use this Arduino-code, that is transmitting to a WebBLE dashboard. The web dashboard works fine.

    However, when trying to connect from Bangle, a connection is established, but I initially got CCCD Handle not found. The Arduino advertising code is using this BLEFloatCharacteristic temperatureCharacteristic("19b10000-2001­-537e-4f6c-d104768a1214", BLERead); where I've from BLEProperty.h found out that BLERead = 0x02. Thus I tried using the same on the Bangle side:

        ch.handle_cccd = 0x02;
        return ch.startNotifications();
    

    but I'm still not receiving any data. nRFConnect is very seldom able to connect to the Nicla-device, but the few times it has been, I've not seen anything related to this cccd-handle.

    To further troubleshoot, I've tried to replace BLERead with 0x00 on the Arduino-side and use same cccd-handle on Bangle, did not help, a connection is established but no data is flowing.

    I also dived in the WebBLE-dashboard JS-code to understand how that works, and on line 11 below (line 450 in the dashboard code) this same BLERead property is used. But as said, when I'm using the same concept in the Bangle-code, I'm not getting anywhere.
    I've also tried many other permutations, too many to list here, but either I get "CCCD handle not found" or no data.

        // Set up the characteristics
        for (const sensor of sensors) {
          msg('characteristic ' + sensor + "...");
          NiclaSenseME[sensor].characteristic = await service.getCharacteristic(NiclaSenseME[s­ensor].uuid);
          // Set up notification
          if (NiclaSenseME[sensor].properties.include­s("BLENotify")) {
            NiclaSenseME[sensor].characteristic.addE­ventListener('characteristicvaluechanged­', function (event) { handleIncoming(NiclaSenseME[sensor], event.target.value); });
            await NiclaSenseME[sensor].characteristic.star­tNotifications();
          }
          // Set up polling for read
          if (NiclaSenseME[sensor].properties.include­s("BLERead")) {
            NiclaSenseME[sensor].polling = setInterval(function () {
              NiclaSenseME[sensor].characteristic.read­Value().then(function (data) { handleIncoming(NiclaSenseME[sensor], data); })
            }
              , 500);
          }
    
About