add conn_hdl to all BLECharacteristic callback to support multiple prph connections
- added optional conn_hdl to getCccd(), indicateEnabled(), notifyEnabled() - added optional conn_hdl to all indicate() and notify() data function
This commit is contained in:
1 parent
0386062314
commit
5768575c42
15 files changed
+103
-93
No files matched your search
@@ -85,19 +85,18 @@ static uint16_t crc16(const uint8_t* data_p, uint8_t length)
|
||||
return crc;
|
||||
}
|
||||
|
||||
static void bledfu_control_wr_authorize_cb(BLECharacteristic* chr, ble_gatts_evt_write_t* request)
|
||||
static void bledfu_control_wr_authorize_cb(uint16_t conn_hdl, BLECharacteristic* chr, ble_gatts_evt_write_t* request)
|
||||
{
|
||||
if ( (request->handle == chr->handles().value_handle) &&
|
||||
(request->op != BLE_GATTS_OP_PREP_WRITE_REQ) &&
|
||||
(request->op != BLE_GATTS_OP_EXEC_WRITE_REQ_NOW) &&
|
||||
(request->op != BLE_GATTS_OP_EXEC_WRITE_REQ_CANCEL))
|
||||
{
|
||||
uint16_t conn_hdl = Bluefruit.connHandle();
|
||||
BLEConnection* conn = Bluefruit.Connection(conn_hdl);
|
||||
|
||||
ble_gatts_rw_authorize_reply_params_t reply = { .type = BLE_GATTS_AUTHORIZE_TYPE_WRITE };
|
||||
|
||||
if ( !chr->notifyEnabled() )
|
||||
if ( !chr->notifyEnabled(conn_hdl) )
|
||||
{
|
||||
reply.params.write.gatt_status = BLE_GATT_STATUS_ATTERR_CPS_CCCD_CONFIG_ERROR;
|
||||
sd_ble_gatts_rw_authorize_reply(conn_hdl, &reply);
|
||||
|
||||
Reference in new issue
Block a user