• Hi people!
    I wanna build a application where an extension (Chrome browser) sends data to the BangleJs (via Bluetooth GATT). The extension successfully writes a value to the RX Characteristic of BangleJS. But how can my BangleJs read the value of this RX characteristic?

    I searched several hours through the tutorials, api reference and in general, but couldn't find any example or snippet that answers my question.

  • There is onWrite event, see
    here https://gist.github.com/fanoush/04d0777f99bb4d153aa1a40aa218db55#file-desay-jseval-js-L11

    this is example of simple service that allows executing js code and passes back the output (but one can put anything else into handleLine method like e.g. AT commands parser)

  • You might also be talking about writing to the UART RX characteristic ("6e400002-b5a3-f393-e0a9-e50e24dcca9e")...

    If that's the case then you're writing direct into the Bangle's REPL by default. So if you write JS followed by a newline then it'll just get executed. If you want to avoid that then you can move the REPL out the way, but I'd recommend just creating your own characteristic with:

    https://www.espruino.com/Reference#l_NRF_setServices

  • I have to thank you @fanoush and @Gordon!
    Finally I created my own GATT service and GATT characteristic. Totally missed the function
    setServices(). :D

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

How can the BangleJs read its own Bluetooth GATT Characteristic?

Posted by Avatar for immrn @immrn

Actions