3

I've recently implemented a BLE notifications system on an ESP32 board. My system has a specific service uuid and a specific characteristic uuid. I've set the notify property to the characteristic:

    characteristic = service->createCharacteristic(
    UUID,
    BLECharacteristic::PROPERTY_READ |
    BLECharacteristic::PROPERTY_WRITE |
    BLECharacteristic::PROPERTY_NOTIFY
);

When I log the characteristic's properties into Chrome dev tools, the "notify" property appears to be "true":

Notify:               true

But, when I use the startNotifications() on my characteristic I get this error message:

Uncaught (in promise) DOMException: GATT Error: Not supported.

This is the code I use :

try {
    this.batteryLevelCharacteristic.startNotifications()
    .then(characteristic => {
        characteristic.addEventListener('characteristicvaluechanged',
                                handleCharacteristicValueChanged);
        console.log('Notifications have been started.');
    });
  } catch(e) {
    console.log(e);
  }

I don't really understand the error... any idea ? :(

Thanks in advance !

NB : I use chrome Version 87.0.4280.88 on macOS Catalina 10.15.7

0 Answers0