Does Obniz support Notify on the periferal side of BLE?



  • I have a question about BLE.
    Does Obniz support Notify on the periferal side of BLE?



  • Hi みやかわ,

    We have developed it and testing now.
    I think, it will release in one or two week.

    When it release, I will tell you in this thread.



  • Hi みやかわ,

    obniz sdk version 1.9.5 released and it includes BLE notifications.
    The document is here

    You can use like this.
    Don't forget to set CCCD descriptor (0x2902).

    
    var characteristic = new obniz.ble.characteristic({
      uuid: 'FFF1',
      data: [0x0e, 0x00],
      properties : ["read","write","notify"],  // add notify properties
      descriptors: [
        {
          uuid: '2902', //CCCD
          data: [0x00, 0x00],  //2byte
        }, 
      ],
    });
    
    var service = new obniz.ble.service({
      uuid: 'FFF0',
      characteristics: [characteristic],
    });
    obniz.ble.peripheral.addService(service);
    
    
    // after central connected
    characteristic.notify();
    
    

    If you want to notify when someone change value,

    
    characteristic.onwritefromremote = function(address, newvalue){
       characteristic.notify();
    }
    
    


  • Hi, Kido( @kido ).

    Thank you for adding BLE notification.
    I actually tried BLE notification.
    As a result, it worked!!
    Thank you!!


Log in to reply
 

SUGGESTED TOPICS