Merge branch 'master' into develop
This commit is contained in:
6 files changed
+123
-18
No files matched your search
@@ -112,11 +112,25 @@ void BLEGatt::_eventHandler(ble_evt_t* evt)
|
||||
BLECharacteristic* chr = _server.chr_list[i];
|
||||
uint16_t req_handle = BLE_GATT_HANDLE_INVALID;
|
||||
|
||||
// BLE_GATTS_OP_EXEC_WRITE_REQ_NOW has no handle, uuid only command op
|
||||
bool exec_write_now = false;
|
||||
|
||||
switch (evt_id)
|
||||
{
|
||||
case BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST:
|
||||
{
|
||||
// Handle has the same offset for read & write request
|
||||
req_handle = evt->evt.gatts_evt.params.authorize_request.request.read.handle;
|
||||
|
||||
if ( evt->evt.gatts_evt.params.authorize_request.type == BLE_GATTS_AUTHORIZE_TYPE_WRITE )
|
||||
{
|
||||
ble_gatts_evt_write_t * wr_req = &evt->evt.gatts_evt.params.authorize_request.request.write;
|
||||
if ( wr_req->op == BLE_GATTS_OP_EXEC_WRITE_REQ_NOW )
|
||||
{
|
||||
exec_write_now = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case BLE_GATTS_EVT_WRITE:
|
||||
@@ -127,7 +141,8 @@ void BLEGatt::_eventHandler(ble_evt_t* evt)
|
||||
}
|
||||
|
||||
// invoke characteristic handler if matched
|
||||
if ((req_handle != BLE_GATT_HANDLE_INVALID) && (req_handle == chr->handles().value_handle || req_handle == chr->handles().cccd_handle ))
|
||||
if ( exec_write_now ||
|
||||
((req_handle != BLE_GATT_HANDLE_INVALID) && (req_handle == chr->handles().value_handle || req_handle == chr->handles().cccd_handle)) )
|
||||
{
|
||||
chr->_eventHandler(evt);
|
||||
|
||||
|
||||
Reference in new issue
Block a user