mirror of
https://github.com/h2zero/esp-nimble-cpp.git
synced 2024-11-22 05:00:55 +01:00
Remove asserts in NimBLECharacteristic read/write.
This commit is contained in:
parent
bc7bfe8278
commit
792359b510
2 changed files with 6 additions and 7 deletions
|
@ -266,7 +266,7 @@ int NimBLECharacteristic::handleGapEvent(uint16_t conn_handle, uint16_t attr_han
|
||||||
NIMBLE_LOGW(LOG_TAG, "Conn_handle (%d) is above the maximum value (%d)", conn_handle, BLE_HCI_LE_CONN_HANDLE_MAX);
|
NIMBLE_LOGW(LOG_TAG, "Conn_handle (%d) is above the maximum value (%d)", conn_handle, BLE_HCI_LE_CONN_HANDLE_MAX);
|
||||||
return BLE_ATT_ERR_INVALID_HANDLE;
|
return BLE_ATT_ERR_INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ble_uuid_t *uuid;
|
const ble_uuid_t *uuid;
|
||||||
int rc;
|
int rc;
|
||||||
NimBLEConnInfo peerInfo;
|
NimBLEConnInfo peerInfo;
|
||||||
|
@ -279,8 +279,7 @@ int NimBLECharacteristic::handleGapEvent(uint16_t conn_handle, uint16_t attr_han
|
||||||
if(ble_uuid_cmp(uuid, &pCharacteristic->getUUID().getNative()->u) == 0){
|
if(ble_uuid_cmp(uuid, &pCharacteristic->getUUID().getNative()->u) == 0){
|
||||||
switch(ctxt->op) {
|
switch(ctxt->op) {
|
||||||
case BLE_GATT_ACCESS_OP_READ_CHR: {
|
case BLE_GATT_ACCESS_OP_READ_CHR: {
|
||||||
rc = ble_gap_conn_find(conn_handle, &peerInfo.m_desc);
|
ble_gap_conn_find(conn_handle, &peerInfo.m_desc);
|
||||||
assert(rc == 0);
|
|
||||||
|
|
||||||
// If the packet header is only 8 bytes this is a follow up of a long read
|
// If the packet header is only 8 bytes this is a follow up of a long read
|
||||||
// so we don't want to call the onRead() callback again.
|
// so we don't want to call the onRead() callback again.
|
||||||
|
@ -316,8 +315,8 @@ int NimBLECharacteristic::handleGapEvent(uint16_t conn_handle, uint16_t attr_han
|
||||||
len += next->om_len;
|
len += next->om_len;
|
||||||
next = SLIST_NEXT(next, om_next);
|
next = SLIST_NEXT(next, om_next);
|
||||||
}
|
}
|
||||||
rc = ble_gap_conn_find(conn_handle, &peerInfo.m_desc);
|
|
||||||
assert(rc == 0);
|
ble_gap_conn_find(conn_handle, &peerInfo.m_desc);
|
||||||
pCharacteristic->setValue(buf, len);
|
pCharacteristic->setValue(buf, len);
|
||||||
pCharacteristic->m_pCallbacks->onWrite(pCharacteristic, peerInfo);
|
pCharacteristic->m_pCallbacks->onWrite(pCharacteristic, peerInfo);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -12,8 +12,8 @@ friend class NimBLEClient;
|
||||||
friend class NimBLECharacteristic;
|
friend class NimBLECharacteristic;
|
||||||
friend class NimBLEDescriptor;
|
friend class NimBLEDescriptor;
|
||||||
|
|
||||||
ble_gap_conn_desc m_desc;
|
ble_gap_conn_desc m_desc{};
|
||||||
NimBLEConnInfo() { m_desc = {}; }
|
NimBLEConnInfo(){};
|
||||||
NimBLEConnInfo(ble_gap_conn_desc desc) { m_desc = desc; }
|
NimBLEConnInfo(ble_gap_conn_desc desc) { m_desc = desc; }
|
||||||
public:
|
public:
|
||||||
/** @brief Gets the over-the-air address of the connected peer */
|
/** @brief Gets the over-the-air address of the connected peer */
|
||||||
|
|
Loading…
Reference in a new issue