You are reading a single comment by @ddm and its replies. Click here to read the full conversation.
  • The way to expose BLE services on nRF devices is to use NRF.setServices (cf. doc).

    It is possible to set broadcast: true for broadcasting but not notify: true. The fix to make it available is pretty straightforward:

    @ jswrap_bluetooth.c:1420 @ void jswrap_nrf_bluetooth_setServices(JsVar *data) {
           memset(&char_md, 0, sizeof(char_md));
           if (jsvGetBoolAndUnLock(jsvObjectGetChild(c­harVar, "broadcast", 0)))
             char_md.char_props.broadcast = 1;
           if (jsvGetBoolAndUnLock(jsvObjectGetChild(c­harVar, "notify", 0)))
             char_md.char_props.notify = 1;
           if (jsvGetBoolAndUnLock(jsvObjectGetChild(c­harVar, "readable", 0)))
             char_md.char_props.read = 1;
           if (jsvGetBoolAndUnLock(jsvObjectGetChild(c­harVar, "writable", 0))) {
    

    With the above fix, it is possible to set a characteristic to NOTIFY like so:

    NRF.setServices({
      0x0000: {
        0x0001: {
          value : "Hello",
          maxLen : 5,
          readable : true,
          notify : true
        }
      }
    });
    

    However, what would be the best way to update the characteristic's value? Calling NRF.setServices repeatedly does not seem to be the way to go.

About

Avatar for ddm @ddm started