forked from h2zero/esp-nimble-cpp
Fix client connect return code handling, add disconnect timer.
* Handle the return codes from ble_gap_connect to take proper actions for different codes. * Improve client event handling to accomodate delayed PDU responses. * Use connection ID as a replacement for the isConnected flag. Also check if a task is waiting for results instead of the waitingToConnect flag. * Adds a disconnect timer so that calling disconnect will start a timer for the connection supervision timeout time + a small delay. When this expires it will reset the host if a disconnect event does not occur in this time. This is added as a workaround for the occasional situation when the controller does not send an event after the disconnect command.
This commit is contained in:
+3
-3
@@ -84,16 +84,16 @@ private:
|
||||
const struct ble_gatt_error *error,
|
||||
const struct ble_gatt_svc *service,
|
||||
void *arg);
|
||||
static void dcTimerCb(ble_npl_event *event);
|
||||
bool retrieveServices(const NimBLEUUID *uuid_filter = nullptr);
|
||||
|
||||
NimBLEAddress m_peerAddress;
|
||||
uint16_t m_conn_id;
|
||||
bool m_isConnected;
|
||||
bool m_waitingToConnect;
|
||||
bool m_deleteCallbacks;
|
||||
int32_t m_connectTimeout;
|
||||
NimBLEClientCallbacks* m_pClientCallbacks;
|
||||
ble_task_data_t *m_pTaskData;
|
||||
ble_task_data_t* m_pTaskData;
|
||||
ble_npl_callout m_dcTimer;
|
||||
|
||||
std::vector<NimBLERemoteService*> m_servicesVector;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user