@@ -181,7 +181,7 @@ bool BLEClient::secureConnection() {
181181
182182#if defined(CONFIG_NIMBLE_ENABLED)
183183 int retryCount = 1 ;
184- BLETaskData taskData (const_cast <BLEClient*>(this ), BLE_HS_ENOTCONN);
184+ BLETaskData taskData (const_cast <BLEClient *>(this ), BLE_HS_ENOTCONN);
185185 m_pTaskData = &taskData;
186186
187187 do {
@@ -452,8 +452,8 @@ bool BLEClient::connect(BLEAddress address, uint8_t type, uint32_t timeoutMs) {
452452 errRc = ::esp_ble_gattc_open (
453453 m_gattc_if,
454454 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???
457457 );
458458 if (errRc != ESP_OK) {
459459 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) {
866866 * When a service is found or there is none left or there was an error
867867 * the API will call this and report findings.
868868 */
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) {
871870 log_d (" Service Discovered >> status: %d handle: %d" , error->status , (error->status == 0 ) ? service->start_handle : -1 );
872871
873- BLETaskData *pTaskData = (BLETaskData*)arg;
874- BLEClient *client = (BLEClient*)pTaskData->m_pInstance ;
872+ BLETaskData *pTaskData = (BLETaskData *)arg;
873+ BLEClient *client = (BLEClient *)pTaskData->m_pInstance ;
875874
876875 if (error->status == BLE_HS_ENOTCONN) {
877876 log_e (" << Service Discovered; Disconnected" );
@@ -880,13 +879,13 @@ int BLEClient::serviceDiscoveredCB(uint16_t conn_handle, const struct ble_gatt_e
880879 }
881880
882881 // Make sure the service discovery is for this device
883- if (client->getConnId () != conn_handle){
882+ if (client->getConnId () != conn_handle) {
884883 return 0 ;
885884 }
886885
887- if (error->status == 0 ) {
886+ if (error->status == 0 ) {
888887 // Found a service - add it to the vector
889- BLERemoteService* pRemoteService = new BLERemoteService (client, service);
888+ BLERemoteService * pRemoteService = new BLERemoteService (client, service);
890889 client->m_servicesMap .insert (std::pair<std::string, BLERemoteService *>(pRemoteService->getUUID ().toString ().c_str (), pRemoteService));
891890 client->m_servicesMapByInstID .insert (std::pair<BLERemoteService *, uint16_t >(pRemoteService, service->start_handle ));
892891 return 0 ;
@@ -1018,7 +1017,8 @@ int BLEClient::handleGAPEvent(struct ble_gap_event *event, void *arg) {
10181017 return 0 ;
10191018 } // BLE_GAP_EVENT_CONNECT
10201019
1021- case BLE_GAP_EVENT_TERM_FAILURE: {
1020+ case BLE_GAP_EVENT_TERM_FAILURE:
1021+ {
10221022 if (client->m_conn_id != event->term_failure .conn_handle ) {
10231023 return 0 ;
10241024 }
@@ -1030,7 +1030,7 @@ int BLEClient::handleGAPEvent(struct ble_gap_event *event, void *arg) {
10301030 ble_gap_terminate (event->term_failure .conn_handle , BLE_ERR_REM_USER_CONN_TERM);
10311031 }
10321032 return 0 ;
1033- } // BLE_GAP_EVENT_TERM_FAILURE
1033+ } // BLE_GAP_EVENT_TERM_FAILURE
10341034
10351035 case BLE_GAP_EVENT_NOTIFY_RX:
10361036 {
@@ -1071,7 +1071,9 @@ int BLEClient::handleGAPEvent(struct ble_gap_event *event, void *arg) {
10711071
10721072 if (characteristic->second ->m_notifyCallback != nullptr ) {
10731073 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+ );
10751077 }
10761078 break ;
10771079 }
@@ -1234,7 +1236,7 @@ int BLEClient::disconnect(uint8_t reason) {
12341236 log_d (" >> disconnect()" );
12351237 int rc = 0 ;
12361238
1237- if (isConnected ()) {
1239+ if (isConnected ()) {
12381240 rc = ble_gap_terminate (m_conn_id, reason);
12391241 if (rc != 0 && rc != BLE_HS_ENOTCONN && rc != BLE_HS_EALREADY) {
12401242 m_lastErr = rc;
@@ -1246,23 +1248,23 @@ int BLEClient::disconnect(uint8_t reason) {
12461248
12471249 log_d (" << disconnect()" );
12481250 return rc;
1249- } // disconnect
1251+ } // disconnect
12501252
12511253bool BLEClientCallbacks::onConnParamsUpdateRequest (BLEClient *pClient, const ble_gap_upd_params *params) {
12521254 log_d (" BLEClientCallbacks" , " onConnParamsUpdateRequest: default" );
12531255 return true ;
12541256}
12551257
1256- uint32_t BLEClientCallbacks::onPassKeyRequest (){
1258+ uint32_t BLEClientCallbacks::onPassKeyRequest () {
12571259 log_d (" onPassKeyRequest: default: 123456" );
12581260 return 123456 ;
12591261}
12601262
1261- void BLEClientCallbacks::onAuthenticationComplete (ble_gap_conn_desc* desc){
1263+ void BLEClientCallbacks::onAuthenticationComplete (ble_gap_conn_desc * desc) {
12621264 log_d (" onAuthenticationComplete: default" );
12631265}
12641266
1265- bool BLEClientCallbacks::onConfirmPIN (uint32_t pin){
1267+ bool BLEClientCallbacks::onConfirmPIN (uint32_t pin) {
12661268 log_d (" onConfirmPIN: default: true" );
12671269 return true ;
12681270}
0 commit comments