@@ -207,6 +207,7 @@ int NimBLECharacteristic::handleGapEvent(uint16_t conn_handle, uint16_t attr_han
207207{
208208 const ble_uuid_t *uuid;
209209 int rc;
210+ struct ble_gap_conn_desc desc;
210211 NimBLECharacteristic* pCharacteristic = (NimBLECharacteristic*)arg;
211212
212213 NIMBLE_LOGD (LOG_TAG, " Characteristic %s %s event" , pCharacteristic->getUUID ().toString ().c_str (),
@@ -219,7 +220,10 @@ int NimBLECharacteristic::handleGapEvent(uint16_t conn_handle, uint16_t attr_han
219220 // If the packet header is only 8 bytes this is a follow up of a long read
220221 // so we don't want to call the onRead() callback again.
221222 if (ctxt->om ->om_pkthdr_len > 8 ) {
223+ rc = ble_gap_conn_find (conn_handle, &desc);
224+ assert (rc == 0 );
222225 pCharacteristic->m_pCallbacks ->onRead (pCharacteristic);
226+ pCharacteristic->m_pCallbacks ->onRead (pCharacteristic, &desc);
223227 }
224228
225229 portENTER_CRITICAL (&pCharacteristic->m_valMux );
@@ -249,10 +253,11 @@ int NimBLECharacteristic::handleGapEvent(uint16_t conn_handle, uint16_t attr_han
249253 len += next->om_len ;
250254 next = SLIST_NEXT (next, om_next);
251255 }
252-
256+ rc = ble_gap_conn_find (conn_handle, &desc);
257+ assert (rc == 0 );
253258 pCharacteristic->setValue (buf, len);
254259 pCharacteristic->m_pCallbacks ->onWrite (pCharacteristic);
255-
260+ pCharacteristic-> m_pCallbacks -> onWrite (pCharacteristic, &desc);
256261 return 0 ;
257262 }
258263 default :
@@ -524,6 +529,14 @@ void NimBLECharacteristicCallbacks::onRead(NimBLECharacteristic* pCharacteristic
524529 NIMBLE_LOGD (" NimBLECharacteristicCallbacks" , " onRead: default" );
525530} // onRead
526531
532+ /* *
533+ * @brief Callback function to support a read request.
534+ * @param [in] pCharacteristic The characteristic that is the source of the event.
535+ * @param [in] desc The connection description struct that is associated with the peer that performed the read.
536+ */
537+ void NimBLECharacteristicCallbacks::onRead (NimBLECharacteristic* pCharacteristic, ble_gap_conn_desc* desc) {
538+ NIMBLE_LOGD (" NimBLECharacteristicCallbacks" , " onRead: default" );
539+ } // onRead
527540
528541/* *
529542 * @brief Callback function to support a write request.
@@ -533,6 +546,14 @@ void NimBLECharacteristicCallbacks::onWrite(NimBLECharacteristic* pCharacteristi
533546 NIMBLE_LOGD (" NimBLECharacteristicCallbacks" , " onWrite: default" );
534547} // onWrite
535548
549+ /* *
550+ * @brief Callback function to support a write request.
551+ * @param [in] pCharacteristic The characteristic that is the source of the event.
552+ * @param [in] desc The connection description struct that is associated with the peer that performed the write.
553+ */
554+ void NimBLECharacteristicCallbacks::onWrite (NimBLECharacteristic* pCharacteristic, ble_gap_conn_desc* desc) {
555+ NIMBLE_LOGD (" NimBLECharacteristicCallbacks" , " onWrite: default" );
556+ } // onWrite
536557
537558/* *
538559 * @brief Callback function to support a Notify request.
0 commit comments