• I have a few characteristics that wait for a device to connect and subscribe to the notifications. If the connected device hasn't subscribed to notifications, there is no reason to update the characteristic. As far as I can tell, the only event we can subscribe to currently for characteristics is onWrite, as well as more general BLE connection and security events. Is there currently any way to accomplish this that I have missed? If not, any idea how much effort it would be to implement?

  • There wasn't a way, but I just added one:


    So if you use a cutting edge build (or 2v15 when released), you can now do:

      0xBCDE : {
        0xABCD : {
          value : "Hello", // optional
          maxLen : 5, // optional (otherwise is length of initial value)
          readable : true,   // optional, default is false
          notify : true,   // optional, default is false
          onWriteDesc : function(evt) {
            console.log("Notifications enabled = ", evt.data[0]&1);

    I kept it quite broad as this seems like quite a niche thing, and this way it's more flexible.

    https://www.oreilly.com/library/view/get­ting-started-with/9781491900550/ch04.htm­l says:

    A CCCD’s value is nothing more than a two-bit bitfield, with one bit corresponding to notifications and the other to indications

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview

Event on notification status change for ble characteristics

Posted by Avatar for ingaugglor @ingaugglor