mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-14 10:21:49 +00:00
use printUUID128 from utils.c
This commit is contained in:
parent
085cabc211
commit
af5cd647e5
21
ble/att.c
21
ble/att.c
@ -58,23 +58,6 @@ static void hexdump2(void const *data, int size){
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
static void printUUID128(const uint8_t * uuid){
|
||||
int i;
|
||||
for (i=15; i >= 0 ; i--){
|
||||
printf("%02X", uuid[i]);
|
||||
switch (i){
|
||||
case 4:
|
||||
case 6:
|
||||
case 8:
|
||||
case 10:
|
||||
printf("-");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int is_Bluetooth_Base_UUID(uint8_t const *uuid){
|
||||
if (memcmp(&uuid[0], &bluetooth_base_uuid[0], 12)) return 0;
|
||||
if (memcmp(&uuid[14], &bluetooth_base_uuid[14], 2)) return 0;
|
||||
@ -226,6 +209,7 @@ void att_set_write_callback(att_write_callback_t callback){
|
||||
void att_dump_attributes(void){
|
||||
att_iterator_t it;
|
||||
att_iterator_init(&it);
|
||||
uint8_t uuid128[16];
|
||||
while (att_iterator_has_next(&it)){
|
||||
att_iterator_fetch_next(&it);
|
||||
if (it.handle == 0) {
|
||||
@ -234,7 +218,8 @@ void att_dump_attributes(void){
|
||||
}
|
||||
printf("Handle: 0x%04x, flags: 0x%04x, uuid: ", it.handle, it.flags);
|
||||
if (it.flags & ATT_PROPERTY_UUID128){
|
||||
printUUID128(it.uuid);
|
||||
swap128(it.uuid, uuid128);
|
||||
printUUID128(uuid128);
|
||||
} else {
|
||||
printf("%04x", READ_BT_16(it.uuid, 0));
|
||||
}
|
||||
|
@ -114,6 +114,19 @@ static uint16_t l2cap_max_mtu_for_handle(uint16_t handle){
|
||||
}
|
||||
// END Helper Functions
|
||||
|
||||
static le_command_status_t att_find_by_type_value_request(uint16_t request_type, uint16_t attribute_group_type, uint16_t peripheral_handle, uint16_t start_handle, uint16_t end_handle, uint8_t * uuid128){
|
||||
if (!l2cap_can_send_conectionless_packet_now()) return BLE_PERIPHERAL_BUSY;
|
||||
|
||||
uint8_t request[23];
|
||||
request[0] = request_type;
|
||||
bt_store_16(request, 1, start_handle);
|
||||
bt_store_16(request, 3, end_handle);
|
||||
bt_store_16(request, 5, attribute_group_type);
|
||||
swap128(uuid128, &request[7]);
|
||||
|
||||
l2cap_send_connectionless(peripheral_handle, L2CAP_CID_ATTRIBUTE_PROTOCOL, request, sizeof(request));
|
||||
return BLE_PERIPHERAL_OK;
|
||||
}
|
||||
|
||||
static le_command_status_t att_read_by_type_or_group_request(uint16_t request_type, uint16_t attribute_group_type, uint16_t peripheral_handle, uint16_t start_handle, uint16_t end_handle){
|
||||
if (!l2cap_can_send_conectionless_packet_now()) return BLE_PERIPHERAL_BUSY;
|
||||
@ -124,7 +137,7 @@ static le_command_status_t att_read_by_type_or_group_request(uint16_t request_ty
|
||||
bt_store_16(request, 1, start_handle);
|
||||
bt_store_16(request, 3, end_handle);
|
||||
bt_store_16(request, 5, attribute_group_type);
|
||||
|
||||
|
||||
l2cap_send_connectionless(peripheral_handle, L2CAP_CID_ATTRIBUTE_PROTOCOL, request, sizeof(request));
|
||||
return BLE_PERIPHERAL_OK;
|
||||
}
|
||||
@ -140,6 +153,20 @@ static le_command_status_t att_read_request(uint16_t request_type, int16_t perip
|
||||
return BLE_PERIPHERAL_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static le_command_status_t send_gatt_services_request(le_peripheral_t *peripheral){
|
||||
return att_read_by_type_or_group_request(ATT_READ_BY_GROUP_TYPE_REQUEST, GATT_PRIMARY_SERVICE_UUID, peripheral->handle, peripheral->start_group_handle, peripheral->end_group_handle);
|
||||
}
|
||||
|
||||
static le_command_status_t send_gatt_services_by_uuid_request(le_peripheral_t *peripheral){
|
||||
return att_find_by_type_value_request(ATT_FIND_BY_TYPE_VALUE_REQUEST, GATT_PRIMARY_SERVICE_UUID, peripheral->handle, peripheral->start_group_handle, peripheral->end_group_handle, peripheral->uuid128);
|
||||
}
|
||||
|
||||
static le_command_status_t send_gatt_included_service_uuid_request(le_peripheral_t *peripheral){
|
||||
return att_read_request(ATT_READ_REQUEST, peripheral->handle, peripheral->start_included_service_handle);
|
||||
}
|
||||
|
||||
static le_command_status_t send_gatt_included_service_request(le_peripheral_t *peripheral){
|
||||
return att_read_by_type_or_group_request(ATT_READ_BY_TYPE_REQUEST, GATT_INCLUDE_SERVICE_UUID, peripheral->handle, peripheral->start_group_handle, peripheral->end_group_handle);
|
||||
}
|
||||
@ -148,13 +175,6 @@ static le_command_status_t send_gatt_characteristic_request(le_peripheral_t *per
|
||||
return att_read_by_type_or_group_request(ATT_READ_BY_TYPE_REQUEST, GATT_CHARACTERISTICS_UUID, peripheral->handle, peripheral->start_group_handle, peripheral->end_group_handle);
|
||||
}
|
||||
|
||||
static le_command_status_t send_gatt_services_request(le_peripheral_t *peripheral){
|
||||
return att_read_by_type_or_group_request(ATT_READ_BY_GROUP_TYPE_REQUEST, GATT_PRIMARY_SERVICE_UUID, peripheral->handle, peripheral->start_group_handle, peripheral->end_group_handle);
|
||||
}
|
||||
|
||||
static le_command_status_t send_gatt_included_service_uuid_request(le_peripheral_t *peripheral){
|
||||
return att_read_request(ATT_READ_REQUEST, peripheral->handle, peripheral->start_included_service_handle);
|
||||
}
|
||||
|
||||
static inline void send_gatt_complete_event(le_peripheral_t * peripheral, uint8_t type, uint8_t status){
|
||||
le_peripheral_event_t event;
|
||||
@ -299,28 +319,31 @@ static void handle_peripheral_list(){
|
||||
case P_W2_SEND_SERVICE_QUERY:
|
||||
status = send_gatt_services_request(peripheral);
|
||||
if (status != BLE_PERIPHERAL_OK) break;
|
||||
|
||||
peripheral->state = P_W4_SERVICE_QUERY_RESULT;
|
||||
break;
|
||||
|
||||
case P_W2_SEND_SERVICE_BY_SERVICE_UUID_QUERY:
|
||||
status = send_gatt_services_by_uuid_request(peripheral);
|
||||
if (status != BLE_PERIPHERAL_OK) break;
|
||||
peripheral->state = P_W4_SERVICE_BY_SERVICE_UUID_RESULT;
|
||||
break;
|
||||
|
||||
case P_W2_SEND_CHARACTERISTIC_QUERY:
|
||||
// printf("send characteristic query\n");
|
||||
|
||||
status = send_gatt_characteristic_request(peripheral);
|
||||
if (status != BLE_PERIPHERAL_OK) break;
|
||||
|
||||
peripheral->state = P_W4_CHARACTERISTIC_QUERY_RESULT;
|
||||
break;
|
||||
|
||||
case P_W2_SEND_INCLUDED_SERVICE_QUERY:
|
||||
status = send_gatt_included_service_request(peripheral);
|
||||
if (status != BLE_PERIPHERAL_OK) break;
|
||||
|
||||
peripheral->state = P_W4_INCLUDED_SERVICE_QUERY_RESULT;
|
||||
break;
|
||||
|
||||
case P_W2_SEND_INCLUDED_SERVICE_UUID_QUERY:
|
||||
printf("send included service UUID query\n");
|
||||
status = send_gatt_included_service_uuid_request(peripheral);
|
||||
if (status != BLE_PERIPHERAL_OK) break;
|
||||
|
||||
peripheral->state = P_W4_INCLUDED_SERVICE_UUID_QUERY_RESULT;
|
||||
break;
|
||||
|
||||
@ -410,43 +433,59 @@ le_command_status_t le_central_disconnect(le_peripheral_t *context){
|
||||
|
||||
le_command_status_t le_central_get_services(le_peripheral_t *peripheral){
|
||||
if (peripheral->state != P_CONNECTED) return BLE_PERIPHERAL_IN_WRONG_STATE;
|
||||
|
||||
printf("le_central_get_services ready to send\n");
|
||||
|
||||
peripheral->start_group_handle = 0x0001;
|
||||
peripheral->end_group_handle = 0xffff;
|
||||
|
||||
peripheral->state = P_W2_SEND_SERVICE_QUERY;
|
||||
|
||||
gatt_client_run();
|
||||
return BLE_PERIPHERAL_OK;
|
||||
}
|
||||
|
||||
|
||||
le_command_status_t le_central_get_service_by_service_uuid16(le_peripheral_t *peripheral, uint16_t uuid16){
|
||||
if (peripheral->state != P_CONNECTED) return BLE_PERIPHERAL_IN_WRONG_STATE;
|
||||
peripheral->start_group_handle = 0x0001;
|
||||
peripheral->end_group_handle = 0xffff;
|
||||
peripheral->state = P_W2_SEND_SERVICE_BY_SERVICE_UUID_QUERY;
|
||||
sdp_normalize_uuid((uint8_t*) &peripheral->uuid128, uuid16);
|
||||
|
||||
gatt_client_run();
|
||||
return BLE_PERIPHERAL_OK;
|
||||
}
|
||||
|
||||
le_command_status_t le_central_get_service_by_service_uuid128(le_peripheral_t *peripheral, uint8_t * uuid128){
|
||||
if (peripheral->state != P_CONNECTED) return BLE_PERIPHERAL_IN_WRONG_STATE;
|
||||
peripheral->start_group_handle = 0x0001;
|
||||
peripheral->end_group_handle = 0xffff;
|
||||
memcpy(peripheral->uuid128, uuid128, 16);
|
||||
|
||||
peripheral->state = P_W2_SEND_SERVICE_BY_SERVICE_UUID_QUERY;
|
||||
|
||||
gatt_client_run();
|
||||
return BLE_PERIPHERAL_OK;
|
||||
}
|
||||
|
||||
le_command_status_t le_central_get_characteristics_for_service(le_peripheral_t *peripheral, le_service_t *service){
|
||||
if (peripheral->state != P_CONNECTED) return BLE_PERIPHERAL_IN_WRONG_STATE;
|
||||
// printf("le_central_get_characteristics_for_service ready to send\n");
|
||||
|
||||
peripheral->start_group_handle = service->start_group_handle;
|
||||
peripheral->end_group_handle = service->end_group_handle;
|
||||
|
||||
peripheral->state = P_W2_SEND_CHARACTERISTIC_QUERY;
|
||||
|
||||
gatt_client_run();
|
||||
return BLE_PERIPHERAL_OK;
|
||||
}
|
||||
|
||||
le_command_status_t le_central_get_included_services_for_service(le_peripheral_t *peripheral, le_service_t *service){
|
||||
if (peripheral->state != P_CONNECTED) return BLE_PERIPHERAL_IN_WRONG_STATE;
|
||||
|
||||
// printf("le_central_get_included_services_for_service %02x , %02x \n", service->start_group_handle, service->end_group_handle);
|
||||
|
||||
peripheral->start_group_handle = service->start_group_handle;
|
||||
peripheral->end_group_handle = service->end_group_handle;
|
||||
|
||||
peripheral->state = P_W2_SEND_INCLUDED_SERVICE_QUERY;
|
||||
|
||||
gatt_client_run();
|
||||
return BLE_PERIPHERAL_OK;
|
||||
}
|
||||
|
||||
|
||||
void test_client();
|
||||
|
||||
static void gatt_client_run(){
|
||||
@ -605,24 +644,6 @@ static void att_client_report_error(uint8_t * packet, uint16_t size){
|
||||
printf("ATT_ERROR_REPORT handle 0x%04x, error: %u - %s\n", handle, error_code, error);
|
||||
}
|
||||
|
||||
|
||||
static void printUUID128(const uint8_t * uuid){
|
||||
int i;
|
||||
for (i=15; i >= 0 ; i--){
|
||||
printf("%02X", uuid[i]);
|
||||
switch (i){
|
||||
case 4:
|
||||
case 6:
|
||||
case 8:
|
||||
case 10:
|
||||
printf("-");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static uint16_t get_last_result_handle(uint8_t * packet, uint16_t size){
|
||||
uint8_t attr_length = packet[1];
|
||||
uint8_t handle_offset = 0;
|
||||
@ -655,7 +676,7 @@ static void report_gatt_services(le_peripheral_t * peripheral, uint8_t * packet,
|
||||
service.uuid16 = READ_BT_16(packet, i+4);
|
||||
sdp_normalize_uuid((uint8_t*) &service.uuid128, service.uuid16);
|
||||
} else {
|
||||
memcpy(service.uuid128, &packet[i+4], uuid_length);
|
||||
swap128(&packet[i+4], service.uuid128);
|
||||
}
|
||||
event.service = service;
|
||||
(*le_central_callback)((le_central_event_t*)&event);
|
||||
@ -680,7 +701,7 @@ static void report_gatt_characteristics(le_peripheral_t * peripheral, uint8_t *
|
||||
characteristic.uuid16 = READ_BT_16(packet,i+5);
|
||||
sdp_normalize_uuid((uint8_t*) &characteristic.uuid128, characteristic.uuid16);
|
||||
} else {
|
||||
memcpy(characteristic.uuid128, &packet[i+5], uuid_length);
|
||||
swap128(&packet[i+5], characteristic.uuid128);
|
||||
}
|
||||
|
||||
event.characteristic = characteristic;
|
||||
@ -726,6 +747,10 @@ static inline void trigger_next_service_query(le_peripheral_t * peripheral, uint
|
||||
trigger_next_query(peripheral, last_result_handle, P_W2_SEND_SERVICE_QUERY, GATT_SERVICE_QUERY_COMPLETE);
|
||||
}
|
||||
|
||||
static inline void trigger_next_service_by_uuid_query(le_peripheral_t * peripheral, uint16_t last_result_handle){
|
||||
trigger_next_query(peripheral, last_result_handle, P_W2_SEND_SERVICE_BY_SERVICE_UUID_QUERY, GATT_SERVICE_QUERY_COMPLETE);
|
||||
}
|
||||
|
||||
static inline void trigger_next_characteristic_query(le_peripheral_t * peripheral, uint16_t last_result_handle){
|
||||
trigger_next_query(peripheral, last_result_handle, P_W2_SEND_CHARACTERISTIC_QUERY, GATT_CHARACTERISTIC_QUERY_COMPLETE);
|
||||
}
|
||||
@ -790,14 +815,38 @@ static void att_packet_handler(uint8_t packet_type, uint16_t handle, uint8_t *pa
|
||||
break;
|
||||
case ATT_READ_RESPONSE:
|
||||
switch (peripheral->state){
|
||||
case P_W4_INCLUDED_SERVICE_UUID_QUERY_RESULT:
|
||||
report_gatt_included_service(peripheral, &packet[1], 0);
|
||||
case P_W4_INCLUDED_SERVICE_UUID_QUERY_RESULT: {
|
||||
uint8_t uuid128[16];
|
||||
swap128(&packet[1], uuid128);
|
||||
report_gatt_included_service(peripheral, uuid128, 0);
|
||||
trigger_next_included_service_query(peripheral, peripheral->start_group_handle);
|
||||
break;
|
||||
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case ATT_FIND_INFORMATION_REPLY:
|
||||
{
|
||||
uint8_t pair_size = 4;
|
||||
le_service_t service;
|
||||
le_service_event_t event;
|
||||
event.type = GATT_SERVICE_QUERY_RESULT;
|
||||
|
||||
int i;
|
||||
for (i = 1; i<size; i+=pair_size){
|
||||
service.start_group_handle = READ_BT_16(packet,i);
|
||||
service.end_group_handle = READ_BT_16(packet,i+2);
|
||||
memcpy(service.uuid128, peripheral->uuid128, 16);
|
||||
|
||||
event.service = service;
|
||||
(*le_central_callback)((le_central_event_t*)&event);
|
||||
}
|
||||
|
||||
trigger_next_service_query(peripheral, service.end_group_handle);
|
||||
break;
|
||||
}
|
||||
case ATT_ERROR_RESPONSE:
|
||||
// printf("ATT_ERROR_RESPONSE error %u, state %u\n", packet[4], peripheral->state);
|
||||
switch (packet[4]){
|
||||
@ -817,6 +866,9 @@ static void att_packet_handler(uint8_t packet_type, uint16_t handle, uint8_t *pa
|
||||
peripheral->state = P_CONNECTED;
|
||||
send_gatt_complete_event(peripheral, GATT_INCLUDED_SERVICE_QUERY_COMPLETE, 0);
|
||||
|
||||
case P_W4_SERVICE_BY_SERVICE_UUID_RESULT:
|
||||
peripheral->state = P_CONNECTED;
|
||||
send_gatt_complete_event(peripheral, GATT_SERVICE_QUERY_COMPLETE, 0);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
@ -901,6 +953,8 @@ static void dump_peripheral_state(peripheral_state_t p_state){
|
||||
case P_W4_CHARACTERISTIC_QUERY_RESULT:printf("P_W4_CHARACTERISTIC_QUERY_RESULT"); break;
|
||||
case P_W2_SEND_INCLUDED_SERVICE_QUERY:printf("P_W2_SEND_INCLUDED_SERVICE_QUERY"); break;
|
||||
case P_W4_INCLUDED_SERVICE_QUERY_RESULT:printf("P_W4_INCLUDED_SERVICE_QUERY_RESULT"); break;
|
||||
default:
|
||||
break;
|
||||
};
|
||||
printf("\n");
|
||||
}
|
||||
@ -939,7 +993,10 @@ typedef enum {
|
||||
|
||||
TC_W2_SERVICE_REQUEST,
|
||||
TC_W4_SERVICE_RESULT,
|
||||
|
||||
|
||||
TC_W2_SERVICE_BY_UUID_REQUEST,
|
||||
TC_W4_SERVICE_BY_UUID_RESULT,
|
||||
|
||||
TC_W2_CHARACTERISTIC_REQUEST,
|
||||
TC_W4_CHARACTERISTIC_RESULT,
|
||||
|
||||
@ -981,6 +1038,12 @@ void test_client(){
|
||||
tc_state = TC_W4_SERVICE_RESULT;
|
||||
break;
|
||||
|
||||
case TC_W2_SERVICE_BY_UUID_REQUEST:
|
||||
status = le_central_get_service_by_service_uuid16(&test_device, 0x1800);
|
||||
if (status != BLE_PERIPHERAL_OK) return;
|
||||
tc_state = TC_W4_SERVICE_BY_UUID_RESULT;
|
||||
break;
|
||||
|
||||
case TC_W2_CHARACTERISTIC_REQUEST:
|
||||
if (service_index >= service_count){
|
||||
tc_state = TC_W2_INCLUDED_SERVICE_REQUEST;
|
||||
@ -1061,6 +1124,16 @@ static void handle_le_central_event(le_central_event_t * event){
|
||||
|
||||
case GATT_SERVICE_QUERY_RESULT:
|
||||
service = ((le_service_event_t *) event)->service;
|
||||
|
||||
if (tc_state == TC_W4_SERVICE_BY_UUID_RESULT){
|
||||
printf(" *** found service *** uuid %02x, start group handle %02x, end group handle %02x",
|
||||
service.uuid16, service.start_group_handle, service.end_group_handle);
|
||||
|
||||
tc_state = TC_W2_CHARACTERISTIC_REQUEST;
|
||||
test_client();
|
||||
break;
|
||||
}
|
||||
|
||||
services[service_count++] = service;
|
||||
test_client();
|
||||
break;
|
||||
@ -1068,7 +1141,6 @@ static void handle_le_central_event(le_central_event_t * event){
|
||||
case GATT_SERVICE_QUERY_COMPLETE:
|
||||
peripheral_event = (le_peripheral_event_t*) event;
|
||||
// tc_state = TC_W2_CHARACTERISTIC_REQUEST;
|
||||
tc_state = TC_W2_INCLUDED_SERVICE_REQUEST;
|
||||
int i;
|
||||
for (i = 0; i < service_count; i++){
|
||||
printf(" *** found service *** uuid %02x, start group handle %02x, end group handle %02x",
|
||||
@ -1076,7 +1148,7 @@ static void handle_le_central_event(le_central_event_t * event){
|
||||
printf("\n");
|
||||
}
|
||||
test_client();
|
||||
|
||||
tc_state = TC_W2_INCLUDED_SERVICE_REQUEST;
|
||||
break;
|
||||
|
||||
case GATT_CHARACTERISTIC_QUERY_RESULT:
|
||||
|
@ -78,6 +78,8 @@ typedef enum {
|
||||
|
||||
P_W2_SEND_SERVICE_QUERY,
|
||||
P_W4_SERVICE_QUERY_RESULT,
|
||||
P_W2_SEND_SERVICE_BY_SERVICE_UUID_QUERY,
|
||||
P_W4_SERVICE_BY_SERVICE_UUID_RESULT,
|
||||
|
||||
P_W2_SEND_CHARACTERISTIC_QUERY,
|
||||
P_W4_CHARACTERISTIC_QUERY_RESULT,
|
||||
@ -111,10 +113,11 @@ typedef struct le_peripheral{
|
||||
bd_addr_t address;
|
||||
uint16_t handle;
|
||||
uint16_t mtu;
|
||||
|
||||
uint8_t uuid128[16];
|
||||
|
||||
uint16_t start_group_handle;
|
||||
uint16_t end_group_handle;
|
||||
|
||||
|
||||
uint16_t start_included_service_handle;
|
||||
uint16_t end_included_service_handle;
|
||||
} le_peripheral_t;
|
||||
@ -165,6 +168,11 @@ le_command_status_t le_central_disconnect(le_peripheral_t *context);
|
||||
le_command_status_t le_central_get_services(le_peripheral_t *context);
|
||||
// { type (8), le_peripheral_t *context, le_service * }
|
||||
|
||||
|
||||
//TODO: define uuid type
|
||||
le_command_status_t le_central_get_service_by_service_uuid16(le_peripheral_t *context, uint16_t uuid16);
|
||||
le_command_status_t le_central_get_service_by_service_uuid128(le_peripheral_t *context, uint8_t * uuid);
|
||||
|
||||
// returns characteristics, no inlcuded services
|
||||
le_command_status_t le_central_get_characteristics_for_service(le_peripheral_t *context, le_service_t *service);
|
||||
// { type (8), le_peripheral_t *context, service_handle, le_characteristic *}
|
||||
@ -175,6 +183,7 @@ le_command_status_t le_central_get_characteristics_for_service(le_peripheral_t *
|
||||
le_command_status_t le_central_get_included_services_for_service(le_peripheral_t *context, le_service_t *service);
|
||||
// { type (8), le_peripheral_t *context, le_service * }
|
||||
|
||||
|
||||
le_command_status_t le_central_read_value_of_characteristic(le_peripheral_t *context, uint16_t characteristic_handle);
|
||||
le_command_status_t le_central_write_value_of_characteristic(le_peripheral_t *context, uint16_t characteristic_handle, int length, uint8_t * data);
|
||||
le_command_status_t le_central_subscribe_to_characteristic(le_peripheral_t *context, uint16_t characteristic_handle);
|
||||
|
@ -228,6 +228,8 @@ extern "C" {
|
||||
#define GATT_SERVICE_QUERY_COMPLETE 0xA3
|
||||
#define GATT_CHARACTERISTIC_QUERY_RESULT 0xA4
|
||||
#define GATT_CHARACTERISTIC_QUERY_COMPLETE 0xA5
|
||||
#define GATT_INCLUDED_SERVICE_QUERY_RESULT 0xA6
|
||||
#define GATT_INCLUDED_SERVICE_QUERY_COMPLETE 0xA7
|
||||
|
||||
// data: event(8), len(8), status (8), hci_handle (16), attribute_handle (16)
|
||||
#define ATT_HANDLE_VALUE_INDICATION_COMPLETE 0xAF
|
||||
|
@ -131,7 +131,7 @@ void swap64(uint8_t src[8], uint8_t dst[8]);
|
||||
void swap128(uint8_t src[16], uint8_t dst[16]);
|
||||
|
||||
void hexdump(void *data, int size);
|
||||
void printUUID(uint8_t *uuid);
|
||||
void printUUID128(uint8_t *uuid);
|
||||
void print_key(const char * name, sm_key_t key);
|
||||
|
||||
// @deprecated please use more convenient bd_addr_to_str
|
||||
|
@ -582,7 +582,7 @@ static int de_traversal_dump_data(uint8_t * element, de_type_t de_type, de_size_
|
||||
de_traverse_sequence(element, de_traversal_dump_data, (void *)&indent);
|
||||
} else if (de_type == DE_UUID && de_size == DE_SIZE_128) {
|
||||
printf(", value: ");
|
||||
printUUID(element+1);
|
||||
printUUID128(element+1);
|
||||
printf("\n");
|
||||
} else if (de_type == DE_STRING) {
|
||||
int len = 0;
|
||||
|
@ -112,8 +112,8 @@ void print_key(const char * name, sm_key_t key){
|
||||
hexdump(key, 16);
|
||||
}
|
||||
|
||||
void printUUID(uint8_t *uuid) {
|
||||
log_info("%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
|
||||
void printUUID128(uint8_t *uuid) {
|
||||
printf("%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
|
||||
uuid[0], uuid[1], uuid[2], uuid[3], uuid[4], uuid[5], uuid[6], uuid[7],
|
||||
uuid[8], uuid[9], uuid[10], uuid[11], uuid[12], uuid[13], uuid[14], uuid[15]);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user