@@ -181,7 +181,7 @@ bool BLEClient::secureConnection() {
181
181
182
182
#if defined(CONFIG_NIMBLE_ENABLED)
183
183
int retryCount = 1 ;
184
- BLETaskData taskData (const_cast <BLEClient*>(this ), BLE_HS_ENOTCONN);
184
+ BLETaskData taskData (const_cast <BLEClient *>(this ), BLE_HS_ENOTCONN);
185
185
m_pTaskData = &taskData;
186
186
187
187
do {
@@ -452,8 +452,8 @@ bool BLEClient::connect(BLEAddress address, uint8_t type, uint32_t timeoutMs) {
452
452
errRc = ::esp_ble_gattc_open (
453
453
m_gattc_if,
454
454
getPeerAddress ().getNative (), // address
455
- (esp_ble_addr_type_t )type, // Note: This was added on 2018-04-03 when the latest ESP-IDF was detected to have changed the signature.
456
- 1 // direct connection <-- maybe needs to be changed in case of direct indirect connection???
455
+ (esp_ble_addr_type_t )type, // Note: This was added on 2018-04-03 when the latest ESP-IDF was detected to have changed the signature.
456
+ 1 // direct connection <-- maybe needs to be changed in case of direct indirect connection???
457
457
);
458
458
if (errRc != ESP_OK) {
459
459
log_e (" esp_ble_gattc_open: rc=%d %s" , errRc, GeneralUtils::errorToString (errRc));
@@ -866,12 +866,11 @@ bool BLEClient::connect(BLEAddress address, uint8_t type, uint32_t timeoutMs) {
866
866
* When a service is found or there is none left or there was an error
867
867
* the API will call this and report findings.
868
868
*/
869
- int BLEClient::serviceDiscoveredCB (uint16_t conn_handle, const struct ble_gatt_error *error, const struct ble_gatt_svc *service, void *arg)
870
- {
869
+ int BLEClient::serviceDiscoveredCB (uint16_t conn_handle, const struct ble_gatt_error *error, const struct ble_gatt_svc *service, void *arg) {
871
870
log_d (" Service Discovered >> status: %d handle: %d" , error->status , (error->status == 0 ) ? service->start_handle : -1 );
872
871
873
- BLETaskData *pTaskData = (BLETaskData*)arg;
874
- BLEClient *client = (BLEClient*)pTaskData->m_pInstance ;
872
+ BLETaskData *pTaskData = (BLETaskData *)arg;
873
+ BLEClient *client = (BLEClient *)pTaskData->m_pInstance ;
875
874
876
875
if (error->status == BLE_HS_ENOTCONN) {
877
876
log_e (" << Service Discovered; Disconnected" );
@@ -880,13 +879,13 @@ int BLEClient::serviceDiscoveredCB(uint16_t conn_handle, const struct ble_gatt_e
880
879
}
881
880
882
881
// Make sure the service discovery is for this device
883
- if (client->getConnId () != conn_handle){
882
+ if (client->getConnId () != conn_handle) {
884
883
return 0 ;
885
884
}
886
885
887
- if (error->status == 0 ) {
886
+ if (error->status == 0 ) {
888
887
// Found a service - add it to the vector
889
- BLERemoteService* pRemoteService = new BLERemoteService (client, service);
888
+ BLERemoteService * pRemoteService = new BLERemoteService (client, service);
890
889
client->m_servicesMap .insert (std::pair<std::string, BLERemoteService *>(pRemoteService->getUUID ().toString ().c_str (), pRemoteService));
891
890
client->m_servicesMapByInstID .insert (std::pair<BLERemoteService *, uint16_t >(pRemoteService, service->start_handle ));
892
891
return 0 ;
@@ -1018,7 +1017,8 @@ int BLEClient::handleGAPEvent(struct ble_gap_event *event, void *arg) {
1018
1017
return 0 ;
1019
1018
} // BLE_GAP_EVENT_CONNECT
1020
1019
1021
- case BLE_GAP_EVENT_TERM_FAILURE: {
1020
+ case BLE_GAP_EVENT_TERM_FAILURE:
1021
+ {
1022
1022
if (client->m_conn_id != event->term_failure .conn_handle ) {
1023
1023
return 0 ;
1024
1024
}
@@ -1030,7 +1030,7 @@ int BLEClient::handleGAPEvent(struct ble_gap_event *event, void *arg) {
1030
1030
ble_gap_terminate (event->term_failure .conn_handle , BLE_ERR_REM_USER_CONN_TERM);
1031
1031
}
1032
1032
return 0 ;
1033
- } // BLE_GAP_EVENT_TERM_FAILURE
1033
+ } // BLE_GAP_EVENT_TERM_FAILURE
1034
1034
1035
1035
case BLE_GAP_EVENT_NOTIFY_RX:
1036
1036
{
@@ -1071,7 +1071,9 @@ int BLEClient::handleGAPEvent(struct ble_gap_event *event, void *arg) {
1071
1071
1072
1072
if (characteristic->second ->m_notifyCallback != nullptr ) {
1073
1073
log_d (" Invoking callback for notification on characteristic %s" , characteristic->second ->toString ().c_str ());
1074
- characteristic->second ->m_notifyCallback (characteristic->second , event->notify_rx .om ->om_data , event->notify_rx .om ->om_len , !event->notify_rx .indication );
1074
+ characteristic->second ->m_notifyCallback (
1075
+ characteristic->second , event->notify_rx .om ->om_data , event->notify_rx .om ->om_len , !event->notify_rx .indication
1076
+ );
1075
1077
}
1076
1078
break ;
1077
1079
}
@@ -1234,7 +1236,7 @@ int BLEClient::disconnect(uint8_t reason) {
1234
1236
log_d (" >> disconnect()" );
1235
1237
int rc = 0 ;
1236
1238
1237
- if (isConnected ()) {
1239
+ if (isConnected ()) {
1238
1240
rc = ble_gap_terminate (m_conn_id, reason);
1239
1241
if (rc != 0 && rc != BLE_HS_ENOTCONN && rc != BLE_HS_EALREADY) {
1240
1242
m_lastErr = rc;
@@ -1246,23 +1248,23 @@ int BLEClient::disconnect(uint8_t reason) {
1246
1248
1247
1249
log_d (" << disconnect()" );
1248
1250
return rc;
1249
- } // disconnect
1251
+ } // disconnect
1250
1252
1251
1253
bool BLEClientCallbacks::onConnParamsUpdateRequest (BLEClient *pClient, const ble_gap_upd_params *params) {
1252
1254
log_d (" BLEClientCallbacks" , " onConnParamsUpdateRequest: default" );
1253
1255
return true ;
1254
1256
}
1255
1257
1256
- uint32_t BLEClientCallbacks::onPassKeyRequest (){
1258
+ uint32_t BLEClientCallbacks::onPassKeyRequest () {
1257
1259
log_d (" onPassKeyRequest: default: 123456" );
1258
1260
return 123456 ;
1259
1261
}
1260
1262
1261
- void BLEClientCallbacks::onAuthenticationComplete (ble_gap_conn_desc* desc){
1263
+ void BLEClientCallbacks::onAuthenticationComplete (ble_gap_conn_desc * desc) {
1262
1264
log_d (" onAuthenticationComplete: default" );
1263
1265
}
1264
1266
1265
- bool BLEClientCallbacks::onConfirmPIN (uint32_t pin){
1267
+ bool BLEClientCallbacks::onConfirmPIN (uint32_t pin) {
1266
1268
log_d (" onConfirmPIN: default: true" );
1267
1269
return true ;
1268
1270
}
0 commit comments