Skip to content

Getting BLERemoteService from BLERemoteCharacteristic #3367

Closed
@coogle

Description

@coogle

Sorry for not following the standard bug report template here..

What I'm trying to do is use an ESP32 to connect/get some notification data / disconnect / go on to next device for N number of identical BLE servers and I'm having problems because of accessors in the API being set to private.

What I want to do is this:

  1. Connect to a BLE Server, register for notifications for a characteristic provided
  2. Listen to the characteristic notifications (it's a data stream) until I've captured the data I need
    2a) Parse out the relevant data from the capture, store in a struct for that device ID
  3. Disconnect from the BLE Server
  4. Connect to the next, identical BLE server, and repeat.

The problem I'm running into is that the BLERemoteCharacteristic::registerForNotify callback is unnecessarily limited because not only does it not make room to pass in any sort of context void *, but what it does pass in doesn't let you figure it out which device this notification came from.

One easy solution here would be to make BLERemoteCharacteristic::getRemoteService() public instead of private. This way, from within the callback you could call characteristic->getRemoteService()->getClient()->getPeerAddress() and get the address of the device sending the notification.

At the end of the day what I'd like to do is be able to tell from within a characteristic callback what device sent the notification.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions