mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-01-26 12:35:25 +00:00
gap_le_advertisements: fix endianess for services with UUID128 in advertisement
This commit is contained in:
parent
300c1ba48b
commit
2b60490204
@ -134,6 +134,7 @@ static char * flags[] = {
|
||||
static void dump_advertisement_data(uint8_t * adv_data, uint8_t adv_size){
|
||||
ad_context_t context;
|
||||
bd_addr_t address;
|
||||
uint8_t uuid_128[16];
|
||||
for (ad_iterator_init(&context, adv_size, adv_data) ; ad_iterator_has_more(&context) ; ad_iterator_next(&context)){
|
||||
uint8_t data_type = ad_iterator_get_data_type(&context);
|
||||
uint8_t size = ad_iterator_get_data_len(&context);
|
||||
@ -171,7 +172,8 @@ static void dump_advertisement_data(uint8_t * adv_data, uint8_t adv_size){
|
||||
case 0x06: // Incomplete List of 128-bit Service Class UUIDs
|
||||
case 0x07: // Complete List of 128-bit Service Class UUIDs
|
||||
case 0x15: // List of 128-bit Service Solicitation UUIDs
|
||||
printf("%s", uuid128_to_str(data));
|
||||
reverse_128(data, uuid_128);
|
||||
printf("%s", uuid128_to_str(uuid_128));
|
||||
break;
|
||||
case 0x08: // Shortened Local Name
|
||||
case 0x09: // Complete Local Name
|
||||
|
@ -191,17 +191,19 @@ void log_info_key(const char * name, sm_key_t key){
|
||||
// hexdump(key, 16);
|
||||
}
|
||||
|
||||
// UUIDs are stored in big endian, similar to bd_addr_t
|
||||
|
||||
// Bluetooth Base UUID: 00000000-0000-1000-8000- 00805F9B34FB
|
||||
const uint8_t sdp_bluetooth_base_uuid[] = { 0x00, 0x00, 0x00, 0x00, /* - */ 0x00, 0x00, /* - */ 0x10, 0x00, /* - */
|
||||
const uint8_t bluetooth_base_uuid[] = { 0x00, 0x00, 0x00, 0x00, /* - */ 0x00, 0x00, /* - */ 0x10, 0x00, /* - */
|
||||
0x80, 0x00, /* - */ 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB };
|
||||
|
||||
void uuid_add_bluetooth_prefix(uint8_t *uuid, uint32_t shortUUID){
|
||||
memcpy(uuid, sdp_bluetooth_base_uuid, 16);
|
||||
memcpy(uuid, bluetooth_base_uuid, 16);
|
||||
big_endian_store_32(uuid, 0, shortUUID);
|
||||
}
|
||||
|
||||
int uuid_has_bluetooth_prefix(uint8_t * uuid128){
|
||||
return memcmp(&uuid128[4], &sdp_bluetooth_base_uuid[4], 12) == 0;
|
||||
return memcmp(&uuid128[4], &bluetooth_base_uuid[4], 12) == 0;
|
||||
}
|
||||
|
||||
static char uuid128_to_str_buffer[32+4+1];
|
||||
|
Loading…
x
Reference in New Issue
Block a user