mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-02-21 12:40:42 +00:00
example: fix advertisement_contains_name in le client examples
This commit is contained in:
parent
57ff2ef16c
commit
5d81be334f
@ -127,8 +127,8 @@ static void test_track_data(le_cbm_connection_t * context, int bytes_transferred
|
||||
/* LISTING_END(tracking): Tracking throughput */
|
||||
|
||||
|
||||
// returns 1 if name is found in advertisement
|
||||
static int advertisement_report_contains_name(const char * name, uint8_t * advertisement_report){
|
||||
// returns true if name is found in advertisement
|
||||
static bool advertisement_report_contains_name(const char * name, uint8_t * advertisement_report){
|
||||
// get advertisement from report event
|
||||
const uint8_t * adv_data = gap_event_advertising_report_get_data(advertisement_report);
|
||||
uint8_t adv_len = gap_event_advertising_report_get_data_length(advertisement_report);
|
||||
@ -145,8 +145,8 @@ static int advertisement_report_contains_name(const char * name, uint8_t * adver
|
||||
case BLUETOOTH_DATA_TYPE_COMPLETE_LOCAL_NAME:
|
||||
// compare prefix
|
||||
if (data_size < name_len) break;
|
||||
if (memcmp(data, name, name_len) == 0) return 1;
|
||||
return 1;
|
||||
if (memcmp(data, name, name_len) == 0) return true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -181,8 +181,8 @@ static void le_streamer_client_request_to_send(le_streamer_connection_t * connec
|
||||
gatt_client_request_to_write_without_response(&connection->write_without_response_request, connection_handle);
|
||||
}
|
||||
|
||||
// returns 1 if name is found in advertisement
|
||||
static int advertisement_contains_name(const char * name, uint8_t adv_len, const uint8_t * adv_data){
|
||||
// returns true if name is found in advertisement
|
||||
static bool advertisement_contains_name(const char * name, uint8_t adv_len, const uint8_t * adv_data){
|
||||
// get advertisement from report event
|
||||
uint16_t name_len = (uint8_t) strlen(name);
|
||||
|
||||
@ -198,12 +198,12 @@ static int advertisement_contains_name(const char * name, uint8_t adv_len, const
|
||||
// compare prefix
|
||||
if (data_size < name_len) break;
|
||||
if (memcmp(data, name, name_len) == 0) return 1;
|
||||
return 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
static void handle_gatt_client_event(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
|
||||
|
Loading…
x
Reference in New Issue
Block a user