- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Looking, for example, at hello_client.c leatt_regNotificationCb() registers a callback handler. The handler has parameters (int len, int attr_len, UINT8 *data).
In that callback, how can I distinguish which of the multiple slaves issued the notification? Perhaps there's a getter function equivalent to blecm_SetPtrConMux()? but I can't find it.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In hello_client everything is tracked via connection handles. When a device is first encountered in the connection_up callback, the handle is used to store all pertinent data.
The connection handle can be retrieved as below:
UINT16 con_handle = emconinfo_getConnHandle();
This handle is used to reference and dereference the connection mux index via:
blecm_FindConMux(con_handle);
blecm_DelConMux(connection_mux_index);
blecm_FindFreeConMux();
These connection mux indices are used to dereference hello_client.dev_info:
This is where all information specific to that device is stored. And, optionally, stored to NVRAM.
In connection up, the handle is used to reference data about that slave. After connection up, the handle can be used to dereference data about the slave. So from within your notification handler, you should be able to call emconinfo_getConnHandle(); and pull the necessary data from hello_client.dev_info.
What should also work is to pull the slave's address via:
UINT8 *p_remote_addr | = (UINT8 *)emconninfo_getPeerAddr(); |
If you call something like this from within the notification handler, you should be able to pull the sender's address.
Jacob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In hello_client everything is tracked via connection handles. When a device is first encountered in the connection_up callback, the handle is used to store all pertinent data.
The connection handle can be retrieved as below:
UINT16 con_handle = emconinfo_getConnHandle();
This handle is used to reference and dereference the connection mux index via:
blecm_FindConMux(con_handle);
blecm_DelConMux(connection_mux_index);
blecm_FindFreeConMux();
These connection mux indices are used to dereference hello_client.dev_info:
This is where all information specific to that device is stored. And, optionally, stored to NVRAM.
In connection up, the handle is used to reference data about that slave. After connection up, the handle can be used to dereference data about the slave. So from within your notification handler, you should be able to call emconinfo_getConnHandle(); and pull the necessary data from hello_client.dev_info.
What should also work is to pull the slave's address via:
UINT8 *p_remote_addr | = (UINT8 *)emconninfo_getPeerAddr(); |
If you call something like this from within the notification handler, you should be able to pull the sender's address.
Jacob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Exactly what I needed. Thank you!