add connHandle() for client char
This commit is contained in:
1 parent
74b032b880
commit
f74c723af7
3 files changed
+18
-2
No files matched your search
@@ -93,6 +93,11 @@ void BLEClientCharacteristic::useAdaCallback(bool enabled)
|
||||
_use_AdaCallback = enabled;
|
||||
}
|
||||
|
||||
uint16_t BLEClientCharacteristic::connHandle(void)
|
||||
{
|
||||
return _service->connHandle();
|
||||
}
|
||||
|
||||
uint16_t BLEClientCharacteristic::valueHandle(void)
|
||||
{
|
||||
return _chr.handle_value;
|
||||
|
||||
@@ -61,6 +61,7 @@ class BLEClientCharacteristic
|
||||
|
||||
void begin(BLEClientService* parent_svc = NULL);
|
||||
|
||||
uint16_t connHandle(void);
|
||||
uint16_t valueHandle(void);
|
||||
uint8_t properties(void);
|
||||
BLEClientService& parentService(void);
|
||||
@@ -93,7 +94,7 @@ class BLEClientCharacteristic
|
||||
|
||||
BLEClientService* _service;
|
||||
notify_cb_t _notify_cb;
|
||||
bool _use_AdaCallback; // whether callback is invoked in seperated task with AdaCallback
|
||||
bool _use_AdaCallback; // whether callback is invoked in separated task with AdaCallback
|
||||
|
||||
AdaMsg _adamsg;
|
||||
|
||||
|
||||
@@ -467,6 +467,8 @@ void AdafruitBluefruit::_ble_handler(ble_evt_t* evt)
|
||||
// conn handle has fixed offset regardless of event type
|
||||
const uint16_t evt_conn_hdl = evt->evt.common_evt.conn_handle;
|
||||
|
||||
LOG_LV2(BLE, "Conn Handle = %d", evt_conn_hdl);
|
||||
|
||||
// GAP handler
|
||||
Gap._eventHandler(evt);
|
||||
|
||||
@@ -650,7 +652,15 @@ void AdafruitBluefruit::_ble_handler(ble_evt_t* evt)
|
||||
}
|
||||
|
||||
// Central Event Handler
|
||||
if (_central_enabled) Central._event_handler(evt);
|
||||
if (_central_enabled)
|
||||
{
|
||||
// Skip if not central connection
|
||||
if (evt_conn_hdl != _conn_hdl ||
|
||||
evt_conn_hdl == BLE_CONN_HANDLE_INVALID)
|
||||
{
|
||||
Central._event_handler(evt);
|
||||
}
|
||||
}
|
||||
|
||||
// Discovery Event Handler
|
||||
if ( Discovery.begun() ) Discovery._event_handler(evt);
|
||||
|
||||
Reference in new issue
Block a user