You are reading a single comment by @ChristianW and its replies. Click here to read the full conversation.
  • Let's say I have a Puck/Pixl/MDBT42Q collecting data in a queue.
    Before any overflow happens this data should be polled via BLE by another system as BLE central.

    So as BLE peripheral I use NRF.setServices() to create some Service/Characteristics for pushing out data.

    The thing is: How can I know if the central actually read the data so I can remove it from my queue?

    For the other direction onWrite is a synchronous API for writing data back, but for reading there is only:

    • notify: true and/or
    • indicate: true which is documented as notify + ACK.

    But how does it work?
    As peripheral I am supposed to call NRF.updateServices() and set a new value.
    But how can I detect if this value was successfully read by the connected central?
    How often should I call updateService() in case the queue got filled up a bit and there are N items waiting?

    My current idea is a multipart API:

    • use onWrite so the central can request the next item
    • in return the requested item is presented via updateServices()

    If the queue entries have some kind of timestamp or sequence number I can assume that all previous entries are read already and safely remove them.

    What do you think?

About

Avatar for ChristianW @ChristianW started