mirror of
https://github.com/h2zero/esp-nimble-cpp.git
synced 2024-12-22 19:10:46 +01:00
Resync to arduino master
This commit is contained in:
parent
6c0e6a2b2c
commit
725807b619
4 changed files with 33 additions and 6 deletions
|
@ -198,6 +198,15 @@ uint8_t* NimBLECharacteristic::getData() {
|
|||
} // getData
|
||||
|
||||
|
||||
/**
|
||||
* @brief Retrieve the the current data length of the characteristic.
|
||||
* @return The length of the current characteristic data.
|
||||
*/
|
||||
size_t NimBLECharacteristic:: getDataLength() {
|
||||
return m_value.getLength();
|
||||
}
|
||||
|
||||
|
||||
int NimBLECharacteristic::handleGapEvent(uint16_t conn_handle, uint16_t attr_handle,
|
||||
struct ble_gatt_access_ctxt *ctxt,
|
||||
void *arg)
|
||||
|
@ -637,4 +646,4 @@ void NimBLECharacteristicCallbacks::onStatus(NimBLECharacteristic* pCharacterist
|
|||
NIMBLE_LOGD("NimBLECharacteristicCallbacks", "onStatus: default");
|
||||
} // onStatus
|
||||
|
||||
#endif /* CONFIG_BT_ENABLED */
|
||||
#endif /* CONFIG_BT_ENABLED */
|
||||
|
|
|
@ -97,6 +97,7 @@ public:
|
|||
NimBLEUUID getUUID();
|
||||
std::string getValue();
|
||||
uint8_t* getData();
|
||||
size_t getDataLength();
|
||||
|
||||
void indicate();
|
||||
void notify(bool is_notification = true);
|
||||
|
@ -191,4 +192,4 @@ public:
|
|||
virtual void onStatus(NimBLECharacteristic* pCharacteristic, Status s, int code);
|
||||
};
|
||||
#endif /* CONFIG_BT_ENABLED */
|
||||
#endif /*MAIN_NIMBLECHARACTERISTIC_H_*/
|
||||
#endif /*MAIN_NIMBLECHARACTERISTIC_H_*/
|
||||
|
|
|
@ -443,7 +443,7 @@ void NimBLEDevice::stopAdvertising() {
|
|||
ble_hs_cfg.sm_mitm = 0;
|
||||
ble_hs_cfg.sm_sc = 1;
|
||||
ble_hs_cfg.sm_our_key_dist = 1;
|
||||
ble_hs_cfg.sm_their_key_dist = 1;
|
||||
ble_hs_cfg.sm_their_key_dist = 3;
|
||||
|
||||
ble_hs_cfg.store_status_cb = ble_store_util_status_rr; /*TODO: Implement handler for this*/
|
||||
|
||||
|
|
|
@ -226,7 +226,8 @@ uint32_t NimBLEServer::getConnectedCount() {
|
|||
NIMBLE_LOGD(LOG_TAG, ">> handleGapEvent: %s",
|
||||
NimBLEUtils::gapEventToString(event->type));
|
||||
int rc = 0;
|
||||
|
||||
struct ble_gap_conn_desc desc;
|
||||
|
||||
switch(event->type) {
|
||||
|
||||
case BLE_GAP_EVENT_CONNECT: {
|
||||
|
@ -311,9 +312,25 @@ uint32_t NimBLEServer::getConnectedCount() {
|
|||
return 0;
|
||||
} // BLE_GAP_EVENT_CONN_UPDATE
|
||||
|
||||
case BLE_GAP_EVENT_REPEAT_PAIRING: {
|
||||
/* We already have a bond with the peer, but it is attempting to
|
||||
* establish a new secure link. This app sacrifices security for
|
||||
* convenience: just throw away the old bond and accept the new link.
|
||||
*/
|
||||
|
||||
/* Delete the old bond. */
|
||||
rc = ble_gap_conn_find(event->repeat_pairing.conn_handle, &desc);
|
||||
assert(rc == 0);
|
||||
ble_store_util_delete_peer(&desc.peer_id_addr);
|
||||
|
||||
/* Return BLE_GAP_REPEAT_PAIRING_RETRY to indicate that the host should
|
||||
* continue with the pairing operation.
|
||||
*/
|
||||
return BLE_GAP_REPEAT_PAIRING_RETRY;
|
||||
} // BLE_GAP_EVENT_REPEAT_PAIRING
|
||||
|
||||
case BLE_GAP_EVENT_ENC_CHANGE: {
|
||||
struct ble_gap_conn_desc desc;
|
||||
int rc = ble_gap_conn_find(event->conn_update.conn_handle, &desc);
|
||||
rc = ble_gap_conn_find(event->conn_update.conn_handle, &desc);
|
||||
if(rc != 0) {
|
||||
return BLE_ATT_ERR_INVALID_HANDLE;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue