@@ -372,39 +372,27 @@ class SMDeviceCentral : public SMDevice {
372
372
return ;
373
373
}
374
374
375
- /* parse the advertising payload, looking for a discoverable device */
376
- for (uint8_t i = 0 ; i < params->advertisingDataLen ; ++i) {
377
- /* The advertising payload is a collection of key/value records where
378
- * byte 0: length of the record excluding this byte
379
- * byte 1: The key, it is the type of the data
380
- * byte [2..N] The value. N is equal to byte0 - 1 */
381
- const uint8_t record_length = params->advertisingData [i];
382
- if (record_length == 0 ) {
383
- continue ;
384
- }
385
-
386
- /* connect to the same device that connected to us */
387
- if (memcmp (params->peerAddr , _peer_address, sizeof (_peer_address)) == 0 ) {
388
-
389
- ble_error_t error = _ble.gap ().connect (
390
- params->peerAddr , params->addressType ,
391
- NULL , NULL
392
- );
393
-
394
- if (error) {
395
- printf (" Error during Gap::connect %d\r\n " , error);
396
- return ;
397
- }
375
+ /* connect to the same device that connected to us */
376
+ if (memcmp (params->peerAddr , _peer_address, sizeof (_peer_address)) == 0 ) {
398
377
399
- /* we may have already scan events waiting
400
- * to be processed so we need to remember
401
- * that we are already connecting and ignore them */
402
- _is_connecting = true ;
378
+ ble_error_t error = _ble. gap (). connect (
379
+ params-> peerAddr , params-> addressType ,
380
+ NULL , NULL
381
+ ) ;
403
382
383
+ if (error) {
384
+ printf (" Error during Gap::connect %d\r\n " , error);
404
385
return ;
405
386
}
406
387
407
- i += record_length;
388
+ printf (" Connecting... " );
389
+
390
+ /* we may have already scan events waiting
391
+ * to be processed so we need to remember
392
+ * that we are already connecting and ignore them */
393
+ _is_connecting = true ;
394
+
395
+ return ;
408
396
}
409
397
};
410
398
0 commit comments