mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-28 19:20:54 +00:00
ancs: fix demo. add SM events. Update to MODULE_event_... scheme
This commit is contained in:
parent
c6a2767bed
commit
72b5080138
@ -83,7 +83,6 @@ const uint8_t adv_data[] = {
|
|||||||
uint8_t adv_data_len = sizeof(adv_data);
|
uint8_t adv_data_len = sizeof(adv_data);
|
||||||
|
|
||||||
static void app_packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
|
static void app_packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
|
||||||
sm_event_t * sm_event;
|
|
||||||
switch (packet_type) {
|
switch (packet_type) {
|
||||||
case HCI_EVENT_PACKET:
|
case HCI_EVENT_PACKET:
|
||||||
switch (packet[0]) {
|
switch (packet[0]) {
|
||||||
@ -92,14 +91,12 @@ static void app_packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *
|
|||||||
printf("ANCS Client Demo ready.\n");
|
printf("ANCS Client Demo ready.\n");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SM_JUST_WORKS_REQUEST:
|
case SM_EVENT_JUST_WORKS_REQUEST:
|
||||||
sm_event = (sm_event_t *) packet;
|
sm_just_works_confirm(sm_event_just_works_request_get_handle(packet));
|
||||||
sm_just_works_confirm(sm_event->addr_type, sm_event->address);
|
|
||||||
printf("Just Works Confirmed.\n");
|
printf("Just Works Confirmed.\n");
|
||||||
break;
|
break;
|
||||||
case SM_PASSKEY_DISPLAY_NUMBER:
|
case SM_EVENT_PASSKEY_DISPLAY_NUMBER:
|
||||||
sm_event = (sm_event_t *) packet;
|
printf("Passkey display: %06u.\n", sm_event_passkey_display_number_get_passkey(packet));
|
||||||
printf("Passkey display: %06u.\n", sm_event->passkey);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -116,9 +113,9 @@ static void ancs_callback(uint8_t packet_type, uint8_t *packet, uint16_t size){
|
|||||||
printf("ANCS Client: Disconnected\n");
|
printf("ANCS Client: Disconnected\n");
|
||||||
break;
|
break;
|
||||||
case ANCS_EVENT_CLIENT_NOTIFICATION:
|
case ANCS_EVENT_CLIENT_NOTIFICATION:
|
||||||
attribute_name = ancs_client_attribute_name_for_id(ancs_client_notification_event_get_attribute_id(packet));
|
attribute_name = ancs_client_attribute_name_for_id(ancs_event_client_notification_get_attribute_id(packet));
|
||||||
if (!attribute_name) break;
|
if (!attribute_name) break;
|
||||||
printf("Notification: %s - %s\n", attribute_name, ancs_client_notification_event_get_text(packet));
|
printf("Notification: %s - %s\n", attribute_name, ancs_event_client_notification_get_text(packet));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -326,17 +326,17 @@ static void handle_sdp_client_query_result(uint8_t packet_type, uint8_t *packet,
|
|||||||
switch (packet[0]){
|
switch (packet[0]){
|
||||||
case SDP_EVENT_QUERY_ATTRIBUTE_VALUE:
|
case SDP_EVENT_QUERY_ATTRIBUTE_VALUE:
|
||||||
// Handle new SDP record
|
// Handle new SDP record
|
||||||
if (sdp_query_attribute_byte_event_get_record_id(packet) != record_id) {
|
if (sdp_event_query_attribute_byte_get_record_id(packet) != record_id) {
|
||||||
record_id = sdp_query_attribute_byte_event_get_record_id(packet);
|
record_id = sdp_event_query_attribute_byte_get_record_id(packet);
|
||||||
printf("SDP Record: Nr: %d\n", record_id);
|
printf("SDP Record: Nr: %d\n", record_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sdp_query_attribute_byte_event_get_attribute_length(packet) <= attribute_value_buffer_size) {
|
if (sdp_event_query_attribute_byte_get_attribute_length(packet) <= attribute_value_buffer_size) {
|
||||||
attribute_value[sdp_query_attribute_byte_event_get_data_offset(packet)] = sdp_query_attribute_byte_event_get_data(packet);
|
attribute_value[sdp_event_query_attribute_byte_get_data_offset(packet)] = sdp_event_query_attribute_byte_get_data(packet);
|
||||||
|
|
||||||
if ((uint16_t)(sdp_query_attribute_byte_event_get_data_offset(packet)+1) == sdp_query_attribute_byte_event_get_attribute_length(packet)) {
|
if ((uint16_t)(sdp_event_query_attribute_byte_get_data_offset(packet)+1) == sdp_event_query_attribute_byte_get_attribute_length(packet)) {
|
||||||
|
|
||||||
switch(sdp_query_attribute_byte_event_get_attribute_id(packet)) {
|
switch(sdp_event_query_attribute_byte_get_attribute_id(packet)) {
|
||||||
case SDP_ServiceClassIDList:
|
case SDP_ServiceClassIDList:
|
||||||
if (de_get_element_type(attribute_value) != DE_DES) break;
|
if (de_get_element_type(attribute_value) != DE_DES) break;
|
||||||
for (des_iterator_init(&des_list_it, attribute_value); des_iterator_has_more(&des_list_it); des_iterator_next(&des_list_it)) {
|
for (des_iterator_init(&des_list_it, attribute_value); des_iterator_has_more(&des_list_it); des_iterator_next(&des_list_it)) {
|
||||||
@ -347,7 +347,7 @@ static void handle_sdp_client_query_result(uint8_t packet_type, uint8_t *packet,
|
|||||||
case SDP_PANU:
|
case SDP_PANU:
|
||||||
case SDP_NAP:
|
case SDP_NAP:
|
||||||
case SDP_GN:
|
case SDP_GN:
|
||||||
printf("SDP Attribute 0x%04x: BNEP PAN protocol UUID: %04x\n", sdp_query_attribute_byte_event_get_attribute_id(packet), uuid);
|
printf("SDP Attribute 0x%04x: BNEP PAN protocol UUID: %04x\n", sdp_event_query_attribute_byte_get_attribute_id(packet), uuid);
|
||||||
bnep_remote_uuid = uuid;
|
bnep_remote_uuid = uuid;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -358,11 +358,11 @@ static void handle_sdp_client_query_result(uint8_t packet_type, uint8_t *packet,
|
|||||||
case 0x0100:
|
case 0x0100:
|
||||||
case 0x0101:
|
case 0x0101:
|
||||||
str = get_string_from_data_element(attribute_value);
|
str = get_string_from_data_element(attribute_value);
|
||||||
printf("SDP Attribute: 0x%04x: %s\n", sdp_query_attribute_byte_event_get_attribute_id(packet), str);
|
printf("SDP Attribute: 0x%04x: %s\n", sdp_event_query_attribute_byte_get_attribute_id(packet), str);
|
||||||
free(str);
|
free(str);
|
||||||
break;
|
break;
|
||||||
case 0x0004: {
|
case 0x0004: {
|
||||||
printf("SDP Attribute: 0x%04x\n", sdp_query_attribute_byte_event_get_attribute_id(packet));
|
printf("SDP Attribute: 0x%04x\n", sdp_event_query_attribute_byte_get_attribute_id(packet));
|
||||||
|
|
||||||
for (des_iterator_init(&des_list_it, attribute_value); des_iterator_has_more(&des_list_it); des_iterator_next(&des_list_it)) {
|
for (des_iterator_init(&des_list_it, attribute_value); des_iterator_has_more(&des_list_it); des_iterator_next(&des_list_it)) {
|
||||||
uint8_t *des_element;
|
uint8_t *des_element;
|
||||||
@ -404,12 +404,12 @@ static void handle_sdp_client_query_result(uint8_t packet_type, uint8_t *packet,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "SDP attribute value buffer size exceeded: available %d, required %d\n", attribute_value_buffer_size, sdp_query_attribute_byte_event_get_attribute_length(packet));
|
fprintf(stderr, "SDP attribute value buffer size exceeded: available %d, required %d\n", attribute_value_buffer_size, sdp_event_query_attribute_byte_get_attribute_length(packet));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SDP_EVENT_QUERY_COMPLETE:
|
case SDP_EVENT_QUERY_COMPLETE:
|
||||||
fprintf(stderr, "General query done with status %d.\n", sdp_query_complete_event_get_status(packet));
|
fprintf(stderr, "General query done with status %d.\n", sdp_event_query_complete_get_status(packet));
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -169,22 +169,22 @@ static void handle_sdp_client_query_result(uint8_t packet_type, uint8_t *packet,
|
|||||||
switch (packet[0]){
|
switch (packet[0]){
|
||||||
case SDP_EVENT_QUERY_ATTRIBUTE_VALUE:
|
case SDP_EVENT_QUERY_ATTRIBUTE_VALUE:
|
||||||
// handle new record
|
// handle new record
|
||||||
if (sdp_query_attribute_byte_event_get_record_id(packet) != record_id){
|
if (sdp_event_query_attribute_byte_get_record_id(packet) != record_id){
|
||||||
record_id = sdp_query_attribute_byte_event_get_record_id(packet);
|
record_id = sdp_event_query_attribute_byte_get_record_id(packet);
|
||||||
printf("\n---\nRecord nr. %u\n", record_id);
|
printf("\n---\nRecord nr. %u\n", record_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
assertBuffer(sdp_query_attribute_byte_event_get_attribute_length(packet));
|
assertBuffer(sdp_event_query_attribute_byte_get_attribute_length(packet));
|
||||||
|
|
||||||
attribute_value[sdp_query_attribute_byte_event_get_data_offset(packet)] = sdp_query_attribute_byte_event_get_data(packet);
|
attribute_value[sdp_event_query_attribute_byte_get_data_offset(packet)] = sdp_event_query_attribute_byte_get_data(packet);
|
||||||
if ((uint16_t)(sdp_query_attribute_byte_event_get_data_offset(packet)+1) == sdp_query_attribute_byte_event_get_attribute_length(packet)){
|
if ((uint16_t)(sdp_event_query_attribute_byte_get_data_offset(packet)+1) == sdp_event_query_attribute_byte_get_attribute_length(packet)){
|
||||||
|
|
||||||
/* LISTING_RESUME */
|
/* LISTING_RESUME */
|
||||||
/* @text The Service Class ID List is a Data Element Sequence (DES) of UUIDs.
|
/* @text The Service Class ID List is a Data Element Sequence (DES) of UUIDs.
|
||||||
* The BNEP PAN protocol UUID is within this list.
|
* The BNEP PAN protocol UUID is within this list.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
switch(sdp_query_attribute_byte_event_get_attribute_id(packet)){
|
switch(sdp_event_query_attribute_byte_get_attribute_id(packet)){
|
||||||
// 0x0001 "Service Class ID List"
|
// 0x0001 "Service Class ID List"
|
||||||
case SDP_ServiceClassIDList:
|
case SDP_ServiceClassIDList:
|
||||||
if (de_get_element_type(attribute_value) != DE_DES) break;
|
if (de_get_element_type(attribute_value) != DE_DES) break;
|
||||||
@ -196,7 +196,7 @@ static void handle_sdp_client_query_result(uint8_t packet_type, uint8_t *packet,
|
|||||||
case PANU_UUID:
|
case PANU_UUID:
|
||||||
case NAP_UUID:
|
case NAP_UUID:
|
||||||
case GN_UUID:
|
case GN_UUID:
|
||||||
printf(" ** Attribute 0x%04x: BNEP PAN protocol UUID: %04x\n", sdp_query_attribute_byte_event_get_attribute_id(packet), uuid);
|
printf(" ** Attribute 0x%04x: BNEP PAN protocol UUID: %04x\n", sdp_event_query_attribute_byte_get_attribute_id(packet), uuid);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -209,7 +209,7 @@ static void handle_sdp_client_query_result(uint8_t packet_type, uint8_t *packet,
|
|||||||
// 0x0101 "Service Description"
|
// 0x0101 "Service Description"
|
||||||
case 0x0101:
|
case 0x0101:
|
||||||
str = get_string_from_data_element(attribute_value);
|
str = get_string_from_data_element(attribute_value);
|
||||||
printf(" ** Attribute 0x%04x: %s\n", sdp_query_attribute_byte_event_get_attribute_id(packet), str);
|
printf(" ** Attribute 0x%04x: %s\n", sdp_event_query_attribute_byte_get_attribute_id(packet), str);
|
||||||
free(str);
|
free(str);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -220,7 +220,7 @@ static void handle_sdp_client_query_result(uint8_t packet_type, uint8_t *packet,
|
|||||||
* and another DES with the BNEP UUID and the the BNEP version.
|
* and another DES with the BNEP UUID and the the BNEP version.
|
||||||
*/
|
*/
|
||||||
case SDP_ProtocolDescriptorList:{
|
case SDP_ProtocolDescriptorList:{
|
||||||
printf(" ** Attribute 0x%04x: ", sdp_query_attribute_byte_event_get_attribute_id(packet));
|
printf(" ** Attribute 0x%04x: ", sdp_event_query_attribute_byte_get_attribute_id(packet));
|
||||||
|
|
||||||
uint16_t l2cap_psm = 0;
|
uint16_t l2cap_psm = 0;
|
||||||
uint16_t bnep_version = 0;
|
uint16_t bnep_version = 0;
|
||||||
@ -257,7 +257,7 @@ static void handle_sdp_client_query_result(uint8_t packet_type, uint8_t *packet,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SDP_EVENT_QUERY_COMPLETE:
|
case SDP_EVENT_QUERY_COMPLETE:
|
||||||
printf("General query done with status %d.\n\n", sdp_query_complete_event_get_status(packet));
|
printf("General query done with status %d.\n\n", sdp_event_query_complete_get_status(packet));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* LISTING_RESUME */
|
/* LISTING_RESUME */
|
||||||
|
@ -148,21 +148,21 @@ static void handle_sdp_client_query_result(uint8_t packet_type, uint8_t *packet,
|
|||||||
switch (packet[0]){
|
switch (packet[0]){
|
||||||
case SDP_EVENT_QUERY_ATTRIBUTE_VALUE:
|
case SDP_EVENT_QUERY_ATTRIBUTE_VALUE:
|
||||||
// handle new record
|
// handle new record
|
||||||
if (sdp_query_attribute_byte_event_get_record_id(packet) != record_id){
|
if (sdp_event_query_attribute_byte_get_record_id(packet) != record_id){
|
||||||
record_id = sdp_query_attribute_byte_event_get_record_id(packet);
|
record_id = sdp_event_query_attribute_byte_get_record_id(packet);
|
||||||
printf("\n---\nRecord nr. %u\n", record_id);
|
printf("\n---\nRecord nr. %u\n", record_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
assertBuffer(sdp_query_attribute_byte_event_get_attribute_length(packet));
|
assertBuffer(sdp_event_query_attribute_byte_get_attribute_length(packet));
|
||||||
|
|
||||||
attribute_value[sdp_query_attribute_byte_event_get_data_offset(packet)] = sdp_query_attribute_byte_event_get_data(packet);
|
attribute_value[sdp_event_query_attribute_byte_get_data_offset(packet)] = sdp_event_query_attribute_byte_get_data(packet);
|
||||||
if ((uint16_t)(sdp_query_attribute_byte_event_get_data_offset(packet)+1) == sdp_query_attribute_byte_event_get_attribute_length(packet)){
|
if ((uint16_t)(sdp_event_query_attribute_byte_get_data_offset(packet)+1) == sdp_event_query_attribute_byte_get_attribute_length(packet)){
|
||||||
printf("Attribute 0x%04x: ", sdp_query_attribute_byte_event_get_attribute_id(packet));
|
printf("Attribute 0x%04x: ", sdp_event_query_attribute_byte_get_attribute_id(packet));
|
||||||
de_dump_data_element(attribute_value);
|
de_dump_data_element(attribute_value);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SDP_EVENT_QUERY_COMPLETE:
|
case SDP_EVENT_QUERY_COMPLETE:
|
||||||
printf("General query done with status %d.\n\n", sdp_query_complete_event_get_status(packet));
|
printf("General query done with status %d.\n\n", sdp_event_query_complete_get_status(packet));
|
||||||
exit(0);
|
exit(0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -111,8 +111,8 @@ static void report_found_services(void){
|
|||||||
static void handle_query_rfcomm_event(uint8_t packet_type, uint8_t *packet, uint16_t size){
|
static void handle_query_rfcomm_event(uint8_t packet_type, uint8_t *packet, uint16_t size){
|
||||||
switch (packet[0]){
|
switch (packet[0]){
|
||||||
case SDP_EVENT_QUERY_RFCOMM_SERVICE:
|
case SDP_EVENT_QUERY_RFCOMM_SERVICE:
|
||||||
store_found_service(sdp_query_rfcomm_service_event_get_name(packet),
|
store_found_service(sdp_event_query_rfcomm_service_get_name(packet),
|
||||||
sdp_query_rfcomm_service_event_get_rfcomm_channel(packet));
|
sdp_event_query_rfcomm_service_get_rfcomm_channel(packet));
|
||||||
break;
|
break;
|
||||||
case SDP_EVENT_QUERY_COMPLETE:
|
case SDP_EVENT_QUERY_COMPLETE:
|
||||||
report_found_services();
|
report_found_services();
|
||||||
|
@ -164,8 +164,8 @@ static void handle_found_service(const char * name, uint8_t port){
|
|||||||
static void handle_query_rfcomm_event(uint8_t packet_type, uint8_t *packet, uint16_t size){
|
static void handle_query_rfcomm_event(uint8_t packet_type, uint8_t *packet, uint16_t size){
|
||||||
switch (packet[0]){
|
switch (packet[0]){
|
||||||
case SDP_EVENT_QUERY_RFCOMM_SERVICE:
|
case SDP_EVENT_QUERY_RFCOMM_SERVICE:
|
||||||
handle_found_service(sdp_query_rfcomm_service_event_get_name(packet),
|
handle_found_service(sdp_event_query_rfcomm_service_get_name(packet),
|
||||||
sdp_query_rfcomm_service_event_get_rfcomm_channel(packet));
|
sdp_event_query_rfcomm_service_get_rfcomm_channel(packet));
|
||||||
break;
|
break;
|
||||||
case SDP_EVENT_QUERY_COMPLETE:
|
case SDP_EVENT_QUERY_COMPLETE:
|
||||||
if (state != W4_SDP_COMPLETE){
|
if (state != W4_SDP_COMPLETE){
|
||||||
|
@ -1669,18 +1669,18 @@ static void handle_sdp_client_query_result(uint8_t packet_type, uint8_t *packet,
|
|||||||
|
|
||||||
switch (packet[0]){
|
switch (packet[0]){
|
||||||
case SDP_EVENT_QUERY_ATTRIBUTE_BYTE:
|
case SDP_EVENT_QUERY_ATTRIBUTE_BYTE:
|
||||||
sdp_client_assert_buffer(sdp_query_attribute_byte_event_get_attribute_length(packet));
|
sdp_client_assert_buffer(sdp_event_query_attribute_byte_get_attribute_length(packet));
|
||||||
attribute_value[sdp_query_attribute_byte_event_get_data_offset(packet)] = sdp_query_attribute_byte_event_get_data(packet);
|
attribute_value[sdp_event_query_attribute_byte_get_data_offset(packet)] = sdp_event_query_attribute_byte_get_data(packet);
|
||||||
if ((uint16_t)(sdp_query_attribute_byte_event_get_data_offset(packet)+1) == sdp_query_attribute_byte_event_get_attribute_length(packet)){
|
if ((uint16_t)(sdp_event_query_attribute_byte_get_data_offset(packet)+1) == sdp_event_query_attribute_byte_get_attribute_length(packet)){
|
||||||
hexdump(attribute_value, sdp_query_attribute_byte_event_get_attribute_length(packet));
|
hexdump(attribute_value, sdp_event_query_attribute_byte_get_attribute_length(packet));
|
||||||
|
|
||||||
int event_len = 1 + 3 * 2 + sdp_query_attribute_byte_event_get_attribute_length(packet);
|
int event_len = 1 + 3 * 2 + sdp_event_query_attribute_byte_get_attribute_length(packet);
|
||||||
uint8_t event[event_len];
|
uint8_t event[event_len];
|
||||||
event[0] = SDP_EVENT_QUERY_ATTRIBUTE_VALUE;
|
event[0] = SDP_EVENT_QUERY_ATTRIBUTE_VALUE;
|
||||||
little_endian_store_16(event, 1, sdp_query_attribute_byte_event_get_record_id(packet));
|
little_endian_store_16(event, 1, sdp_event_query_attribute_byte_get_record_id(packet));
|
||||||
little_endian_store_16(event, 3, sdp_query_attribute_byte_event_get_attribute_id(packet));
|
little_endian_store_16(event, 3, sdp_event_query_attribute_byte_get_attribute_id(packet));
|
||||||
little_endian_store_16(event, 5, (uint16_t)sdp_query_attribute_byte_event_get_attribute_length(packet));
|
little_endian_store_16(event, 5, (uint16_t)sdp_event_query_attribute_byte_get_attribute_length(packet));
|
||||||
memcpy(&event[7], attribute_value, sdp_query_attribute_byte_event_get_attribute_length(packet));
|
memcpy(&event[7], attribute_value, sdp_event_query_attribute_byte_get_attribute_length(packet));
|
||||||
hci_dump_packet(SDP_CLIENT_PACKET, 0, event, event_len);
|
hci_dump_packet(SDP_CLIENT_PACKET, 0, event, event_len);
|
||||||
socket_connection_send_packet(sdp_client_query_connection, SDP_CLIENT_PACKET, 0, event, event_len);
|
socket_connection_send_packet(sdp_client_query_connection, SDP_CLIENT_PACKET, 0, event, event_len);
|
||||||
}
|
}
|
||||||
|
@ -58,162 +58,582 @@ extern "C" {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get field status from event sdp_query_complete_event
|
* @brief Get field status from event sdp_event_service_registered
|
||||||
* @param Event packet
|
* @param Event packet
|
||||||
* @return status
|
* @return status
|
||||||
* @note: btstack_type 1
|
* @note: btstack_type 1
|
||||||
*/
|
*/
|
||||||
static inline uint8_t sdp_query_complete_event_get_status(const uint8_t * event){
|
static inline uint8_t sdp_event_service_registered_get_status(const uint8_t * event){
|
||||||
return event[2];
|
return event[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get field rfcomm_channel from event sdp_query_rfcomm_service_event
|
* @brief Get field service_record_handle from event sdp_event_service_registered
|
||||||
|
* @param Event packet
|
||||||
|
* @return service_record_handle
|
||||||
|
* @note: btstack_type 4
|
||||||
|
*/
|
||||||
|
static inline uint32_t sdp_event_service_registered_get_service_record_handle(const uint8_t * event){
|
||||||
|
return little_endian_read_32(event, 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get field status from event sdp_event_query_complete
|
||||||
|
* @param Event packet
|
||||||
|
* @return status
|
||||||
|
* @note: btstack_type 1
|
||||||
|
*/
|
||||||
|
static inline uint8_t sdp_event_query_complete_get_status(const uint8_t * event){
|
||||||
|
return event[2];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get field rfcomm_channel from event sdp_event_query_rfcomm_service
|
||||||
* @param Event packet
|
* @param Event packet
|
||||||
* @return rfcomm_channel
|
* @return rfcomm_channel
|
||||||
* @note: btstack_type 1
|
* @note: btstack_type 1
|
||||||
*/
|
*/
|
||||||
static inline uint8_t sdp_query_rfcomm_service_event_get_rfcomm_channel(const uint8_t * event){
|
static inline uint8_t sdp_event_query_rfcomm_service_get_rfcomm_channel(const uint8_t * event){
|
||||||
return event[2];
|
return event[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get field name from event sdp_query_rfcomm_service_event
|
* @brief Get field name from event sdp_event_query_rfcomm_service
|
||||||
* @param Event packet
|
* @param Event packet
|
||||||
* @return name
|
* @return name
|
||||||
* @note: btstack_type T
|
* @note: btstack_type T
|
||||||
*/
|
*/
|
||||||
static inline const char * sdp_query_rfcomm_service_event_get_name(const uint8_t * event){
|
static inline const char * sdp_event_query_rfcomm_service_get_name(const uint8_t * event){
|
||||||
return (const char *) &event[3];
|
return (const char *) &event[3];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get field record_id from event sdp_query_attribute_byte_event
|
* @brief Get field record_id from event sdp_event_query_attribute_byte
|
||||||
* @param Event packet
|
* @param Event packet
|
||||||
* @return record_id
|
* @return record_id
|
||||||
* @note: btstack_type 2
|
* @note: btstack_type 2
|
||||||
*/
|
*/
|
||||||
static inline uint16_t sdp_query_attribute_byte_event_get_record_id(const uint8_t * event){
|
static inline uint16_t sdp_event_query_attribute_byte_get_record_id(const uint8_t * event){
|
||||||
return little_endian_read_16(event, 2);
|
return little_endian_read_16(event, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get field attribute_id from event sdp_query_attribute_byte_event
|
* @brief Get field attribute_id from event sdp_event_query_attribute_byte
|
||||||
* @param Event packet
|
* @param Event packet
|
||||||
* @return attribute_id
|
* @return attribute_id
|
||||||
* @note: btstack_type 2
|
* @note: btstack_type 2
|
||||||
*/
|
*/
|
||||||
static inline uint16_t sdp_query_attribute_byte_event_get_attribute_id(const uint8_t * event){
|
static inline uint16_t sdp_event_query_attribute_byte_get_attribute_id(const uint8_t * event){
|
||||||
return little_endian_read_16(event, 4);
|
return little_endian_read_16(event, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get field attribute_length from event sdp_query_attribute_byte_event
|
* @brief Get field attribute_length from event sdp_event_query_attribute_byte
|
||||||
* @param Event packet
|
* @param Event packet
|
||||||
* @return attribute_length
|
* @return attribute_length
|
||||||
* @note: btstack_type 2
|
* @note: btstack_type 2
|
||||||
*/
|
*/
|
||||||
static inline uint16_t sdp_query_attribute_byte_event_get_attribute_length(const uint8_t * event){
|
static inline uint16_t sdp_event_query_attribute_byte_get_attribute_length(const uint8_t * event){
|
||||||
return little_endian_read_16(event, 6);
|
return little_endian_read_16(event, 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get field data_offset from event sdp_query_attribute_byte_event
|
* @brief Get field data_offset from event sdp_event_query_attribute_byte
|
||||||
* @param Event packet
|
* @param Event packet
|
||||||
* @return data_offset
|
* @return data_offset
|
||||||
* @note: btstack_type 2
|
* @note: btstack_type 2
|
||||||
*/
|
*/
|
||||||
static inline uint16_t sdp_query_attribute_byte_event_get_data_offset(const uint8_t * event){
|
static inline uint16_t sdp_event_query_attribute_byte_get_data_offset(const uint8_t * event){
|
||||||
return little_endian_read_16(event, 8);
|
return little_endian_read_16(event, 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get field data from event sdp_query_attribute_byte_event
|
* @brief Get field data from event sdp_event_query_attribute_byte
|
||||||
* @param Event packet
|
* @param Event packet
|
||||||
* @return data
|
* @return data
|
||||||
* @note: btstack_type 1
|
* @note: btstack_type 1
|
||||||
*/
|
*/
|
||||||
static inline uint8_t sdp_query_attribute_byte_event_get_data(const uint8_t * event){
|
static inline uint8_t sdp_event_query_attribute_byte_get_data(const uint8_t * event){
|
||||||
return event[10];
|
return event[10];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get field total_count from event sdp_query_service_record_handle_event
|
* @brief Get field record_id from event sdp_event_query_attribute_value
|
||||||
* @param Event packet
|
* @param Event packet
|
||||||
* @return total_count
|
* @return record_id
|
||||||
* @note: btstack_type 2
|
* @note: btstack_type 2
|
||||||
*/
|
*/
|
||||||
static inline uint16_t sdp_query_service_record_handle_event_get_total_count(const uint8_t * event){
|
static inline uint16_t sdp_event_query_attribute_value_get_record_id(const uint8_t * event){
|
||||||
return little_endian_read_16(event, 2);
|
return little_endian_read_16(event, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get field record_index from event sdp_query_service_record_handle_event
|
* @brief Get field attribute_id from event sdp_event_query_attribute_value
|
||||||
* @param Event packet
|
|
||||||
* @return record_index
|
|
||||||
* @note: btstack_type 2
|
|
||||||
*/
|
|
||||||
static inline uint16_t sdp_query_service_record_handle_event_get_record_index(const uint8_t * event){
|
|
||||||
return little_endian_read_16(event, 4);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Get field record_handle from event sdp_query_service_record_handle_event
|
|
||||||
* @param Event packet
|
|
||||||
* @return record_handle
|
|
||||||
* @note: btstack_type 4
|
|
||||||
*/
|
|
||||||
static inline uint32_t sdp_query_service_record_handle_event_get_record_handle(const uint8_t * event){
|
|
||||||
return little_endian_read_32(event, 6);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Get field handle from event ancs_client_connected_event
|
|
||||||
* @param Event packet
|
|
||||||
* @return handle
|
|
||||||
* @note: btstack_type H
|
|
||||||
*/
|
|
||||||
static inline hci_con_handle_t ancs_client_connected_event_get_handle(const uint8_t * event){
|
|
||||||
return little_endian_read_16(event, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Get field handle from event ancs_client_notification_event
|
|
||||||
* @param Event packet
|
|
||||||
* @return handle
|
|
||||||
* @note: btstack_type H
|
|
||||||
*/
|
|
||||||
static inline hci_con_handle_t ancs_client_notification_event_get_handle(const uint8_t * event){
|
|
||||||
return little_endian_read_16(event, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Get field attribute_id from event ancs_client_notification_event
|
|
||||||
* @param Event packet
|
* @param Event packet
|
||||||
* @return attribute_id
|
* @return attribute_id
|
||||||
* @note: btstack_type 2
|
* @note: btstack_type 2
|
||||||
*/
|
*/
|
||||||
static inline uint16_t ancs_client_notification_event_get_attribute_id(const uint8_t * event){
|
static inline uint16_t sdp_event_query_attribute_value_get_attribute_id(const uint8_t * event){
|
||||||
return little_endian_read_16(event, 4);
|
return little_endian_read_16(event, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get field text from event ancs_client_notification_event
|
* @brief Get field attribute_length from event sdp_event_query_attribute_value
|
||||||
* @param Event packet
|
* @param Event packet
|
||||||
* @return text
|
* @return attribute_length
|
||||||
* @note: btstack_type T
|
* @note: btstack_type L
|
||||||
*/
|
*/
|
||||||
static inline const char * ancs_client_notification_event_get_text(const uint8_t * event){
|
static inline int sdp_event_query_attribute_value_get_attribute_length(const uint8_t * event){
|
||||||
return (const char *) &event[6];
|
return little_endian_read_16(event, 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get field handle from event ancs_client_disconnected_event
|
* @brief Get field attribute_value from event sdp_event_query_attribute_value
|
||||||
|
* @param Event packet
|
||||||
|
* @return attribute_value
|
||||||
|
* @note: btstack_type V
|
||||||
|
*/
|
||||||
|
static inline const uint8_t * sdp_event_query_attribute_value_get_attribute_value(const uint8_t * event){
|
||||||
|
return &event[8];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get field total_count from event sdp_event_query_service_record_handle
|
||||||
|
* @param Event packet
|
||||||
|
* @return total_count
|
||||||
|
* @note: btstack_type 2
|
||||||
|
*/
|
||||||
|
static inline uint16_t sdp_event_query_service_record_handle_get_total_count(const uint8_t * event){
|
||||||
|
return little_endian_read_16(event, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get field record_index from event sdp_event_query_service_record_handle
|
||||||
|
* @param Event packet
|
||||||
|
* @return record_index
|
||||||
|
* @note: btstack_type 2
|
||||||
|
*/
|
||||||
|
static inline uint16_t sdp_event_query_service_record_handle_get_record_index(const uint8_t * event){
|
||||||
|
return little_endian_read_16(event, 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get field record_handle from event sdp_event_query_service_record_handle
|
||||||
|
* @param Event packet
|
||||||
|
* @return record_handle
|
||||||
|
* @note: btstack_type 4
|
||||||
|
*/
|
||||||
|
static inline uint32_t sdp_event_query_service_record_handle_get_record_handle(const uint8_t * event){
|
||||||
|
return little_endian_read_32(event, 6);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get field handle from event sm_event_just_works_request
|
||||||
* @param Event packet
|
* @param Event packet
|
||||||
* @return handle
|
* @return handle
|
||||||
* @note: btstack_type H
|
* @note: btstack_type H
|
||||||
*/
|
*/
|
||||||
static inline hci_con_handle_t ancs_client_disconnected_event_get_handle(const uint8_t * event){
|
static inline hci_con_handle_t sm_event_just_works_request_get_handle(const uint8_t * event){
|
||||||
|
return little_endian_read_16(event, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get field addr_type from event sm_event_just_works_request
|
||||||
|
* @param Event packet
|
||||||
|
* @return addr_type
|
||||||
|
* @note: btstack_type 1
|
||||||
|
*/
|
||||||
|
static inline uint8_t sm_event_just_works_request_get_addr_type(const uint8_t * event){
|
||||||
|
return event[4];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get field address from event sm_event_just_works_request
|
||||||
|
* @param Event packet
|
||||||
|
* @param Pointer to storage for address
|
||||||
|
* @note: btstack_type B
|
||||||
|
*/
|
||||||
|
static inline void sm_event_just_works_request_get_address(const uint8_t * event, bd_addr_t address){
|
||||||
|
swap48(&event[5], address);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get field handle from event sm_event_just_works_cancel
|
||||||
|
* @param Event packet
|
||||||
|
* @return handle
|
||||||
|
* @note: btstack_type H
|
||||||
|
*/
|
||||||
|
static inline hci_con_handle_t sm_event_just_works_cancel_get_handle(const uint8_t * event){
|
||||||
|
return little_endian_read_16(event, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get field addr_type from event sm_event_just_works_cancel
|
||||||
|
* @param Event packet
|
||||||
|
* @return addr_type
|
||||||
|
* @note: btstack_type 1
|
||||||
|
*/
|
||||||
|
static inline uint8_t sm_event_just_works_cancel_get_addr_type(const uint8_t * event){
|
||||||
|
return event[4];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get field address from event sm_event_just_works_cancel
|
||||||
|
* @param Event packet
|
||||||
|
* @param Pointer to storage for address
|
||||||
|
* @note: btstack_type B
|
||||||
|
*/
|
||||||
|
static inline void sm_event_just_works_cancel_get_address(const uint8_t * event, bd_addr_t address){
|
||||||
|
swap48(&event[5], address);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get field handle from event sm_event_passkey_display_number
|
||||||
|
* @param Event packet
|
||||||
|
* @return handle
|
||||||
|
* @note: btstack_type H
|
||||||
|
*/
|
||||||
|
static inline hci_con_handle_t sm_event_passkey_display_number_get_handle(const uint8_t * event){
|
||||||
|
return little_endian_read_16(event, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get field addr_type from event sm_event_passkey_display_number
|
||||||
|
* @param Event packet
|
||||||
|
* @return addr_type
|
||||||
|
* @note: btstack_type 1
|
||||||
|
*/
|
||||||
|
static inline uint8_t sm_event_passkey_display_number_get_addr_type(const uint8_t * event){
|
||||||
|
return event[4];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get field address from event sm_event_passkey_display_number
|
||||||
|
* @param Event packet
|
||||||
|
* @param Pointer to storage for address
|
||||||
|
* @note: btstack_type B
|
||||||
|
*/
|
||||||
|
static inline void sm_event_passkey_display_number_get_address(const uint8_t * event, bd_addr_t address){
|
||||||
|
swap48(&event[5], address);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get field passkey from event sm_event_passkey_display_number
|
||||||
|
* @param Event packet
|
||||||
|
* @return passkey
|
||||||
|
* @note: btstack_type 4
|
||||||
|
*/
|
||||||
|
static inline uint32_t sm_event_passkey_display_number_get_passkey(const uint8_t * event){
|
||||||
|
return little_endian_read_32(event, 11);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get field handle from event sm_event_passkey_display_cancel
|
||||||
|
* @param Event packet
|
||||||
|
* @return handle
|
||||||
|
* @note: btstack_type H
|
||||||
|
*/
|
||||||
|
static inline hci_con_handle_t sm_event_passkey_display_cancel_get_handle(const uint8_t * event){
|
||||||
|
return little_endian_read_16(event, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get field addr_type from event sm_event_passkey_display_cancel
|
||||||
|
* @param Event packet
|
||||||
|
* @return addr_type
|
||||||
|
* @note: btstack_type 1
|
||||||
|
*/
|
||||||
|
static inline uint8_t sm_event_passkey_display_cancel_get_addr_type(const uint8_t * event){
|
||||||
|
return event[4];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get field address from event sm_event_passkey_display_cancel
|
||||||
|
* @param Event packet
|
||||||
|
* @param Pointer to storage for address
|
||||||
|
* @note: btstack_type B
|
||||||
|
*/
|
||||||
|
static inline void sm_event_passkey_display_cancel_get_address(const uint8_t * event, bd_addr_t address){
|
||||||
|
swap48(&event[5], address);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get field handle from event sm_event_passkey_input_number
|
||||||
|
* @param Event packet
|
||||||
|
* @return handle
|
||||||
|
* @note: btstack_type H
|
||||||
|
*/
|
||||||
|
static inline hci_con_handle_t sm_event_passkey_input_number_get_handle(const uint8_t * event){
|
||||||
|
return little_endian_read_16(event, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get field addr_type from event sm_event_passkey_input_number
|
||||||
|
* @param Event packet
|
||||||
|
* @return addr_type
|
||||||
|
* @note: btstack_type 1
|
||||||
|
*/
|
||||||
|
static inline uint8_t sm_event_passkey_input_number_get_addr_type(const uint8_t * event){
|
||||||
|
return event[4];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get field address from event sm_event_passkey_input_number
|
||||||
|
* @param Event packet
|
||||||
|
* @param Pointer to storage for address
|
||||||
|
* @note: btstack_type B
|
||||||
|
*/
|
||||||
|
static inline void sm_event_passkey_input_number_get_address(const uint8_t * event, bd_addr_t address){
|
||||||
|
swap48(&event[5], address);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get field handle from event sm_event_passkey_input_cancel
|
||||||
|
* @param Event packet
|
||||||
|
* @return handle
|
||||||
|
* @note: btstack_type H
|
||||||
|
*/
|
||||||
|
static inline hci_con_handle_t sm_event_passkey_input_cancel_get_handle(const uint8_t * event){
|
||||||
|
return little_endian_read_16(event, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get field addr_type from event sm_event_passkey_input_cancel
|
||||||
|
* @param Event packet
|
||||||
|
* @return addr_type
|
||||||
|
* @note: btstack_type 1
|
||||||
|
*/
|
||||||
|
static inline uint8_t sm_event_passkey_input_cancel_get_addr_type(const uint8_t * event){
|
||||||
|
return event[4];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get field address from event sm_event_passkey_input_cancel
|
||||||
|
* @param Event packet
|
||||||
|
* @param Pointer to storage for address
|
||||||
|
* @note: btstack_type B
|
||||||
|
*/
|
||||||
|
static inline void sm_event_passkey_input_cancel_get_address(const uint8_t * event, bd_addr_t address){
|
||||||
|
swap48(&event[5], address);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get field handle from event sm_event_identity_resolving_started
|
||||||
|
* @param Event packet
|
||||||
|
* @return handle
|
||||||
|
* @note: btstack_type H
|
||||||
|
*/
|
||||||
|
static inline hci_con_handle_t sm_event_identity_resolving_started_get_handle(const uint8_t * event){
|
||||||
|
return little_endian_read_16(event, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get field addr_type from event sm_event_identity_resolving_started
|
||||||
|
* @param Event packet
|
||||||
|
* @return addr_type
|
||||||
|
* @note: btstack_type 1
|
||||||
|
*/
|
||||||
|
static inline uint8_t sm_event_identity_resolving_started_get_addr_type(const uint8_t * event){
|
||||||
|
return event[4];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get field address from event sm_event_identity_resolving_started
|
||||||
|
* @param Event packet
|
||||||
|
* @param Pointer to storage for address
|
||||||
|
* @note: btstack_type B
|
||||||
|
*/
|
||||||
|
static inline void sm_event_identity_resolving_started_get_address(const uint8_t * event, bd_addr_t address){
|
||||||
|
swap48(&event[5], address);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get field handle from event sm_event_identity_resolving_failed
|
||||||
|
* @param Event packet
|
||||||
|
* @return handle
|
||||||
|
* @note: btstack_type H
|
||||||
|
*/
|
||||||
|
static inline hci_con_handle_t sm_event_identity_resolving_failed_get_handle(const uint8_t * event){
|
||||||
|
return little_endian_read_16(event, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get field addr_type from event sm_event_identity_resolving_failed
|
||||||
|
* @param Event packet
|
||||||
|
* @return addr_type
|
||||||
|
* @note: btstack_type 1
|
||||||
|
*/
|
||||||
|
static inline uint8_t sm_event_identity_resolving_failed_get_addr_type(const uint8_t * event){
|
||||||
|
return event[4];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get field address from event sm_event_identity_resolving_failed
|
||||||
|
* @param Event packet
|
||||||
|
* @param Pointer to storage for address
|
||||||
|
* @note: btstack_type B
|
||||||
|
*/
|
||||||
|
static inline void sm_event_identity_resolving_failed_get_address(const uint8_t * event, bd_addr_t address){
|
||||||
|
swap48(&event[5], address);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get field handle from event sm_event_identity_resolving_succeeded
|
||||||
|
* @param Event packet
|
||||||
|
* @return handle
|
||||||
|
* @note: btstack_type H
|
||||||
|
*/
|
||||||
|
static inline hci_con_handle_t sm_event_identity_resolving_succeeded_get_handle(const uint8_t * event){
|
||||||
|
return little_endian_read_16(event, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get field addr_type from event sm_event_identity_resolving_succeeded
|
||||||
|
* @param Event packet
|
||||||
|
* @return addr_type
|
||||||
|
* @note: btstack_type 1
|
||||||
|
*/
|
||||||
|
static inline uint8_t sm_event_identity_resolving_succeeded_get_addr_type(const uint8_t * event){
|
||||||
|
return event[4];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get field address from event sm_event_identity_resolving_succeeded
|
||||||
|
* @param Event packet
|
||||||
|
* @param Pointer to storage for address
|
||||||
|
* @note: btstack_type B
|
||||||
|
*/
|
||||||
|
static inline void sm_event_identity_resolving_succeeded_get_address(const uint8_t * event, bd_addr_t address){
|
||||||
|
swap48(&event[5], address);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get field le_device_db_index from event sm_event_identity_resolving_succeeded
|
||||||
|
* @param Event packet
|
||||||
|
* @return le_device_db_index
|
||||||
|
* @note: btstack_type 2
|
||||||
|
*/
|
||||||
|
static inline uint16_t sm_event_identity_resolving_succeeded_get_le_device_db_index(const uint8_t * event){
|
||||||
|
return little_endian_read_16(event, 11);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get field handle from event sm_event_authorization_request
|
||||||
|
* @param Event packet
|
||||||
|
* @return handle
|
||||||
|
* @note: btstack_type H
|
||||||
|
*/
|
||||||
|
static inline hci_con_handle_t sm_event_authorization_request_get_handle(const uint8_t * event){
|
||||||
|
return little_endian_read_16(event, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get field addr_type from event sm_event_authorization_request
|
||||||
|
* @param Event packet
|
||||||
|
* @return addr_type
|
||||||
|
* @note: btstack_type 1
|
||||||
|
*/
|
||||||
|
static inline uint8_t sm_event_authorization_request_get_addr_type(const uint8_t * event){
|
||||||
|
return event[4];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get field address from event sm_event_authorization_request
|
||||||
|
* @param Event packet
|
||||||
|
* @param Pointer to storage for address
|
||||||
|
* @note: btstack_type B
|
||||||
|
*/
|
||||||
|
static inline void sm_event_authorization_request_get_address(const uint8_t * event, bd_addr_t address){
|
||||||
|
swap48(&event[5], address);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get field handle from event sm_event_authorization_result
|
||||||
|
* @param Event packet
|
||||||
|
* @return handle
|
||||||
|
* @note: btstack_type H
|
||||||
|
*/
|
||||||
|
static inline hci_con_handle_t sm_event_authorization_result_get_handle(const uint8_t * event){
|
||||||
|
return little_endian_read_16(event, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get field addr_type from event sm_event_authorization_result
|
||||||
|
* @param Event packet
|
||||||
|
* @return addr_type
|
||||||
|
* @note: btstack_type 1
|
||||||
|
*/
|
||||||
|
static inline uint8_t sm_event_authorization_result_get_addr_type(const uint8_t * event){
|
||||||
|
return event[4];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get field address from event sm_event_authorization_result
|
||||||
|
* @param Event packet
|
||||||
|
* @param Pointer to storage for address
|
||||||
|
* @note: btstack_type B
|
||||||
|
*/
|
||||||
|
static inline void sm_event_authorization_result_get_address(const uint8_t * event, bd_addr_t address){
|
||||||
|
swap48(&event[5], address);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get field authorization_result from event sm_event_authorization_result
|
||||||
|
* @param Event packet
|
||||||
|
* @return authorization_result
|
||||||
|
* @note: btstack_type 1
|
||||||
|
*/
|
||||||
|
static inline uint8_t sm_event_authorization_result_get_authorization_result(const uint8_t * event){
|
||||||
|
return event[11];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get field handle from event ancs_event_client_connected
|
||||||
|
* @param Event packet
|
||||||
|
* @return handle
|
||||||
|
* @note: btstack_type H
|
||||||
|
*/
|
||||||
|
static inline hci_con_handle_t ancs_event_client_connected_get_handle(const uint8_t * event){
|
||||||
|
return little_endian_read_16(event, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get field handle from event ancs_event_client_notification
|
||||||
|
* @param Event packet
|
||||||
|
* @return handle
|
||||||
|
* @note: btstack_type H
|
||||||
|
*/
|
||||||
|
static inline hci_con_handle_t ancs_event_client_notification_get_handle(const uint8_t * event){
|
||||||
|
return little_endian_read_16(event, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get field attribute_id from event ancs_event_client_notification
|
||||||
|
* @param Event packet
|
||||||
|
* @return attribute_id
|
||||||
|
* @note: btstack_type 2
|
||||||
|
*/
|
||||||
|
static inline uint16_t ancs_event_client_notification_get_attribute_id(const uint8_t * event){
|
||||||
|
return little_endian_read_16(event, 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get field text from event ancs_event_client_notification
|
||||||
|
* @param Event packet
|
||||||
|
* @return text
|
||||||
|
* @note: btstack_type T
|
||||||
|
*/
|
||||||
|
static inline const char * ancs_event_client_notification_get_text(const uint8_t * event){
|
||||||
|
return (const char *) &event[6];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get field handle from event ancs_event_client_disconnected
|
||||||
|
* @param Event packet
|
||||||
|
* @return handle
|
||||||
|
* @note: btstack_type H
|
||||||
|
*/
|
||||||
|
static inline hci_con_handle_t ancs_event_client_disconnected_get_handle(const uint8_t * event){
|
||||||
return little_endian_read_16(event, 2);
|
return little_endian_read_16(event, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -423,10 +423,10 @@ static void handle_query_rfcomm_event(uint8_t packet_type, uint8_t *packet, uint
|
|||||||
switch (packet[0]){
|
switch (packet[0]){
|
||||||
case SDP_EVENT_QUERY_RFCOMM_SERVICE:
|
case SDP_EVENT_QUERY_RFCOMM_SERVICE:
|
||||||
if (!connection) {
|
if (!connection) {
|
||||||
log_error("handle_query_rfcomm_event alloc connection for RFCOMM port %u failed", sdp_query_rfcomm_service_event_get_rfcomm_channel(packet));
|
log_error("handle_query_rfcomm_event alloc connection for RFCOMM port %u failed", sdp_event_query_rfcomm_service_get_rfcomm_channel(packet));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
connection->rfcomm_channel_nr = sdp_query_rfcomm_service_event_get_rfcomm_channel(packet);
|
connection->rfcomm_channel_nr = sdp_event_query_rfcomm_service_get_rfcomm_channel(packet);
|
||||||
break;
|
break;
|
||||||
case SDP_EVENT_QUERY_COMPLETE:
|
case SDP_EVENT_QUERY_COMPLETE:
|
||||||
connection_doing_sdp_query = NULL;
|
connection_doing_sdp_query = NULL;
|
||||||
@ -436,7 +436,7 @@ static void handle_query_rfcomm_event(uint8_t packet_type, uint8_t *packet, uint
|
|||||||
rfcomm_create_channel(connection->remote_addr, connection->rfcomm_channel_nr, NULL);
|
rfcomm_create_channel(connection->remote_addr, connection->rfcomm_channel_nr, NULL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
log_info("rfcomm service not found, status %u.", sdp_query_complete_event_get_status(packet));
|
log_info("rfcomm service not found, status %u.", sdp_event_query_complete_get_status(packet));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -628,8 +628,8 @@ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *pack
|
|||||||
static void handle_query_rfcomm_event(uint8_t packet_type, uint8_t *packet, uint16_t size, void * context){
|
static void handle_query_rfcomm_event(uint8_t packet_type, uint8_t *packet, uint16_t size, void * context){
|
||||||
switch (event->type){
|
switch (event->type){
|
||||||
case SDP_EVENT_QUERY_RFCOMM_SERVICE:
|
case SDP_EVENT_QUERY_RFCOMM_SERVICE:
|
||||||
channel_nr = sdp_query_rfcomm_service_event_get_rfcomm_channel(packet);
|
channel_nr = sdp_event_query_rfcomm_service_get_rfcomm_channel(packet);
|
||||||
printf("** Service name: '%s', RFCOMM port %u\n", sdp_query_rfcomm_service_event_get_name(packet), channel_nr);
|
printf("** Service name: '%s', RFCOMM port %u\n", sdp_event_query_rfcomm_service_get_name(packet), channel_nr);
|
||||||
break;
|
break;
|
||||||
case SDP_EVENT_QUERY_COMPLETE:
|
case SDP_EVENT_QUERY_COMPLETE:
|
||||||
if (channel_nr > 0){
|
if (channel_nr > 0){
|
||||||
@ -639,9 +639,9 @@ static void handle_query_rfcomm_event(uint8_t packet_type, uint8_t *packet, uint
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
hsp_ag_reset_state();
|
hsp_ag_reset_state();
|
||||||
printf("Service not found, status %u.\n", sdp_query_complete_event_get_status(packet));
|
printf("Service not found, status %u.\n", sdp_event_query_complete_get_status(packet));
|
||||||
if (sdp_query_complete_event_get_status(packet)){
|
if (sdp_event_query_complete_get_status(packet)){
|
||||||
emit_event(HSP_SUBEVENT_AUDIO_CONNECTION_COMPLETE, sdp_query_complete_event_get_status(packet));
|
emit_event(HSP_SUBEVENT_AUDIO_CONNECTION_COMPLETE, sdp_event_query_complete_get_status(packet));
|
||||||
} else {
|
} else {
|
||||||
emit_event(HSP_SUBEVENT_AUDIO_CONNECTION_COMPLETE, SDP_SERVICE_NOT_FOUND);
|
emit_event(HSP_SUBEVENT_AUDIO_CONNECTION_COMPLETE, SDP_SERVICE_NOT_FOUND);
|
||||||
}
|
}
|
||||||
|
@ -576,8 +576,8 @@ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *pack
|
|||||||
static void handle_query_rfcomm_event(uint8_t packet_type, uint8_t *packet, uint16_t size){
|
static void handle_query_rfcomm_event(uint8_t packet_type, uint8_t *packet, uint16_t size){
|
||||||
switch (packet[0]){
|
switch (packet[0]){
|
||||||
case SDP_EVENT_QUERY_RFCOMM_SERVICE:
|
case SDP_EVENT_QUERY_RFCOMM_SERVICE:
|
||||||
channel_nr = sdp_query_rfcomm_service_event_get_rfcomm_channel(packet);
|
channel_nr = sdp_event_query_rfcomm_service_get_rfcomm_channel(packet);
|
||||||
printf("** Service name: '%s', RFCOMM port %u\n", sdp_query_rfcomm_service_event_get_name(packet), channel_nr);
|
printf("** Service name: '%s', RFCOMM port %u\n", sdp_event_query_rfcomm_service_get_name(packet), channel_nr);
|
||||||
break;
|
break;
|
||||||
case SDP_EVENT_QUERY_COMPLETE:
|
case SDP_EVENT_QUERY_COMPLETE:
|
||||||
if (channel_nr > 0){
|
if (channel_nr > 0){
|
||||||
@ -587,7 +587,7 @@ static void handle_query_rfcomm_event(uint8_t packet_type, uint8_t *packet, uint
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
hsp_hs_reset_state();
|
hsp_hs_reset_state();
|
||||||
printf("Service not found, status %u.\n", sdp_query_complete_event_get_status(packet));
|
printf("Service not found, status %u.\n", sdp_event_query_complete_get_status(packet));
|
||||||
exit(0);
|
exit(0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -267,20 +267,20 @@ static void handle_sdp_parser_event(uint8_t packet_type, uint8_t *packet, uint16
|
|||||||
break;
|
break;
|
||||||
case SDP_EVENT_QUERY_ATTRIBUTE_VALUE:
|
case SDP_EVENT_QUERY_ATTRIBUTE_VALUE:
|
||||||
// log_info("handle_sdp_parser_event [ AID, ALen, DOff, Data] : [%x, %u, %u] BYTE %02x",
|
// log_info("handle_sdp_parser_event [ AID, ALen, DOff, Data] : [%x, %u, %u] BYTE %02x",
|
||||||
// ve->attribute_id, sdp_query_attribute_byte_event_get_attribute_length(packet),
|
// ve->attribute_id, sdp_event_query_attribute_byte_get_attribute_length(packet),
|
||||||
// sdp_query_attribute_byte_event_get_data_offset(packet), sdp_query_attribute_byte_event_get_data(packet));
|
// sdp_event_query_attribute_byte_get_data_offset(packet), sdp_event_query_attribute_byte_get_data(packet));
|
||||||
switch (sdp_query_attribute_byte_event_get_attribute_id(packet)){
|
switch (sdp_event_query_attribute_byte_get_attribute_id(packet)){
|
||||||
case SDP_ProtocolDescriptorList:
|
case SDP_ProtocolDescriptorList:
|
||||||
// find rfcomm channel
|
// find rfcomm channel
|
||||||
handleProtocolDescriptorListData(sdp_query_attribute_byte_event_get_attribute_length(packet),
|
handleProtocolDescriptorListData(sdp_event_query_attribute_byte_get_attribute_length(packet),
|
||||||
sdp_query_attribute_byte_event_get_data_offset(packet),
|
sdp_event_query_attribute_byte_get_data_offset(packet),
|
||||||
sdp_query_attribute_byte_event_get_data(packet));
|
sdp_event_query_attribute_byte_get_data(packet));
|
||||||
break;
|
break;
|
||||||
case 0x0100:
|
case 0x0100:
|
||||||
// get service name
|
// get service name
|
||||||
handleServiceNameData(sdp_query_attribute_byte_event_get_attribute_length(packet),
|
handleServiceNameData(sdp_event_query_attribute_byte_get_attribute_length(packet),
|
||||||
sdp_query_attribute_byte_event_get_data_offset(packet),
|
sdp_event_query_attribute_byte_get_data_offset(packet),
|
||||||
sdp_query_attribute_byte_event_get_data(packet));
|
sdp_event_query_attribute_byte_get_data(packet));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// give up
|
// give up
|
||||||
|
@ -398,8 +398,8 @@ static void handle_found_service(char * name, uint8_t port){
|
|||||||
static void handle_query_rfcomm_event(uint8_t packet_type, uint8_t *packet, uint16_t size, void * context){
|
static void handle_query_rfcomm_event(uint8_t packet_type, uint8_t *packet, uint16_t size, void * context){
|
||||||
switch (packet[0]){
|
switch (packet[0]){
|
||||||
case SDP_EVENT_QUERY_RFCOMM_SERVICE:
|
case SDP_EVENT_QUERY_RFCOMM_SERVICE:
|
||||||
handle_found_service(sdp_query_rfcomm_service_event_get_name(packet),
|
handle_found_service(sdp_event_query_rfcomm_service_get_name(packet),
|
||||||
sdp_query_rfcomm_service_event_get_rfcomm_channel(packet));
|
sdp_event_query_rfcomm_service_get_rfcomm_channel(packet));
|
||||||
break;
|
break;
|
||||||
case SDP_EVENT_QUERY_COMPLETE:
|
case SDP_EVENT_QUERY_COMPLETE:
|
||||||
printf("SDP SPP Query complete\n");
|
printf("SDP SPP Query complete\n");
|
||||||
|
@ -142,8 +142,8 @@ static void packet_handler(void * connection, uint8_t packet_type, uint16_t chan
|
|||||||
void handle_query_rfcomm_event(uint8_t packet_type, uint8_t *packet, uint16_t size, void * context){
|
void handle_query_rfcomm_event(uint8_t packet_type, uint8_t *packet, uint16_t size, void * context){
|
||||||
switch (event->type){
|
switch (event->type){
|
||||||
case SDP_EVENT_QUERY_RFCOMM_SERVICE:
|
case SDP_EVENT_QUERY_RFCOMM_SERVICE:
|
||||||
channel_nr = sdp_query_rfcomm_service_event_get_name(packet);
|
channel_nr = sdp_event_query_rfcomm_service_get_name(packet);
|
||||||
printf("** Service name: '%s', RFCOMM port %u\n", sdp_query_rfcomm_service_event_get_rfcomm_channel(packet), channel_nr);
|
printf("** Service name: '%s', RFCOMM port %u\n", sdp_event_query_rfcomm_service_get_rfcomm_channel(packet), channel_nr);
|
||||||
break;
|
break;
|
||||||
case SDP_EVENT_QUERY_COMPLETE:
|
case SDP_EVENT_QUERY_COMPLETE:
|
||||||
if (channel_nr > 0) {
|
if (channel_nr > 0) {
|
||||||
|
@ -118,27 +118,27 @@ static void test_attribute_value_event(const uint8_t * event){
|
|||||||
CHECK_EQUAL(event[0], SDP_EVENT_QUERY_ATTRIBUTE_VALUE);
|
CHECK_EQUAL(event[0], SDP_EVENT_QUERY_ATTRIBUTE_VALUE);
|
||||||
|
|
||||||
// record ids are sequential
|
// record ids are sequential
|
||||||
if (sdp_query_attribute_byte_event_get_record_id(event) != recordId){
|
if (sdp_event_query_attribute_byte_get_record_id(event) != recordId){
|
||||||
recordId++;
|
recordId++;
|
||||||
}
|
}
|
||||||
CHECK_EQUAL(sdp_query_attribute_byte_event_get_record_id(event), recordId);
|
CHECK_EQUAL(sdp_event_query_attribute_byte_get_record_id(event), recordId);
|
||||||
|
|
||||||
// is attribute value complete
|
// is attribute value complete
|
||||||
if (sdp_query_attribute_byte_event_get_attribute_id(event) != attributeId ){
|
if (sdp_event_query_attribute_byte_get_attribute_id(event) != attributeId ){
|
||||||
if (attributeLength > 0){
|
if (attributeLength > 0){
|
||||||
CHECK_EQUAL(attributeLength, attributeOffset+1);
|
CHECK_EQUAL(attributeLength, attributeOffset+1);
|
||||||
}
|
}
|
||||||
attributeId = sdp_query_attribute_byte_event_get_attribute_id(event);
|
attributeId = sdp_event_query_attribute_byte_get_attribute_id(event);
|
||||||
attributeOffset = 0;
|
attributeOffset = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// count attribute value bytes
|
// count attribute value bytes
|
||||||
if (sdp_query_attribute_byte_event_get_data_offset(event) != attributeOffset){
|
if (sdp_event_query_attribute_byte_get_data_offset(event) != attributeOffset){
|
||||||
attributeOffset++;
|
attributeOffset++;
|
||||||
}
|
}
|
||||||
attributeLength = sdp_query_attribute_byte_event_get_attribute_length(event);
|
attributeLength = sdp_event_query_attribute_byte_get_attribute_length(event);
|
||||||
|
|
||||||
CHECK_EQUAL(sdp_query_attribute_byte_event_get_data_offset(event), attributeOffset);
|
CHECK_EQUAL(sdp_event_query_attribute_byte_get_data_offset(event), attributeOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -148,16 +148,16 @@ static void handle_sdp_parser_event(uint8_t packet_type, uint8_t *packet, uint16
|
|||||||
test_attribute_value_event(packet);
|
test_attribute_value_event(packet);
|
||||||
|
|
||||||
// handle new record
|
// handle new record
|
||||||
if (sdp_query_attribute_byte_event_get_record_id(packet) != record_id){
|
if (sdp_event_query_attribute_byte_get_record_id(packet) != record_id){
|
||||||
record_id = sdp_query_attribute_byte_event_get_record_id(packet);
|
record_id = sdp_event_query_attribute_byte_get_record_id(packet);
|
||||||
}
|
}
|
||||||
// buffer data
|
// buffer data
|
||||||
assertBuffer(sdp_query_attribute_byte_event_get_attribute_length(packet));
|
assertBuffer(sdp_event_query_attribute_byte_get_attribute_length(packet));
|
||||||
attribute_value[sdp_query_attribute_byte_event_get_data_offset(packet)] = sdp_query_attribute_byte_event_get_data(packet);
|
attribute_value[sdp_event_query_attribute_byte_get_data_offset(packet)] = sdp_event_query_attribute_byte_get_data(packet);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case SDP_EVENT_QUERY_COMPLETE:
|
case SDP_EVENT_QUERY_COMPLETE:
|
||||||
printf("General query done with status %d.\n", sdp_query_complete_event_get_status(packet));
|
printf("General query done with status %d.\n", sdp_event_query_complete_get_status(packet));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -93,9 +93,9 @@ void sdp_query_rfcomm_init();
|
|||||||
void handle_query_rfcomm_event(uint8_t packet_type, uint8_t *packet, uint16_t size, void * context){
|
void handle_query_rfcomm_event(uint8_t packet_type, uint8_t *packet, uint16_t size, void * context){
|
||||||
switch (packet[0]){
|
switch (packet[0]){
|
||||||
case SDP_EVENT_QUERY_RFCOMM_SERVICE:
|
case SDP_EVENT_QUERY_RFCOMM_SERVICE:
|
||||||
channel_nr[service_index] = sdp_query_rfcomm_service_event_get_rfcomm_channel(packet);
|
channel_nr[service_index] = sdp_event_query_rfcomm_service_get_rfcomm_channel(packet);
|
||||||
service_name[service_index] = (char*) malloc(SDP_SERVICE_NAME_LEN+1);
|
service_name[service_index] = (char*) malloc(SDP_SERVICE_NAME_LEN+1);
|
||||||
strncpy(service_name[service_index], sdp_query_rfcomm_service_event_get_name(packet), SDP_SERVICE_NAME_LEN);
|
strncpy(service_name[service_index], sdp_event_query_rfcomm_service_get_name(packet), SDP_SERVICE_NAME_LEN);
|
||||||
service_name[service_index][SDP_SERVICE_NAME_LEN] = 0;
|
service_name[service_index][SDP_SERVICE_NAME_LEN] = 0;
|
||||||
// printf("CALLBACK: Service name: '%s', RFCOMM port %u, service index %d\n", service_name[service_index], channel_nr[service_index], service_index);
|
// printf("CALLBACK: Service name: '%s', RFCOMM port %u, service index %d\n", service_name[service_index], channel_nr[service_index], service_index);
|
||||||
service_index++;
|
service_index++;
|
||||||
|
@ -61,29 +61,29 @@ static void test_attribute_value_event(const uint8_t * event){
|
|||||||
CHECK_EQUAL(event[0], SDP_EVENT_QUERY_ATTRIBUTE_VALUE);
|
CHECK_EQUAL(event[0], SDP_EVENT_QUERY_ATTRIBUTE_VALUE);
|
||||||
|
|
||||||
// record ids are sequential
|
// record ids are sequential
|
||||||
// printf("sdp_query_attribute_byte_event_get_record_id(event) %d",sdp_query_attribute_byte_event_get_record_id(event));
|
// printf("sdp_event_query_attribute_byte_get_record_id(event) %d",sdp_event_query_attribute_byte_get_record_id(event));
|
||||||
|
|
||||||
if (sdp_query_attribute_byte_event_get_record_id(event) != recordId){
|
if (sdp_event_query_attribute_byte_get_record_id(event) != recordId){
|
||||||
recordId++;
|
recordId++;
|
||||||
}
|
}
|
||||||
CHECK_EQUAL(sdp_query_attribute_byte_event_get_record_id(event), recordId);
|
CHECK_EQUAL(sdp_event_query_attribute_byte_get_record_id(event), recordId);
|
||||||
|
|
||||||
// is attribute value complete
|
// is attribute value complete
|
||||||
if (sdp_query_attribute_byte_event_get_attribute_id(event) != attributeId ){
|
if (sdp_event_query_attribute_byte_get_attribute_id(event) != attributeId ){
|
||||||
if (attributeLength > 0){
|
if (attributeLength > 0){
|
||||||
CHECK_EQUAL(attributeLength, attributeOffset+1);
|
CHECK_EQUAL(attributeLength, attributeOffset+1);
|
||||||
}
|
}
|
||||||
attributeId = sdp_query_attribute_byte_event_get_attribute_id(event);
|
attributeId = sdp_event_query_attribute_byte_get_attribute_id(event);
|
||||||
attributeOffset = 0;
|
attributeOffset = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// count attribute value bytes
|
// count attribute value bytes
|
||||||
if (sdp_query_attribute_byte_event_get_data_offset(event) != attributeOffset){
|
if (sdp_event_query_attribute_byte_get_data_offset(event) != attributeOffset){
|
||||||
attributeOffset++;
|
attributeOffset++;
|
||||||
}
|
}
|
||||||
attributeLength = sdp_query_attribute_byte_event_get_attribute_length(event);
|
attributeLength = sdp_event_query_attribute_byte_get_attribute_length(event);
|
||||||
|
|
||||||
CHECK_EQUAL(sdp_query_attribute_byte_event_get_data_offset(event), attributeOffset);
|
CHECK_EQUAL(sdp_event_query_attribute_byte_get_data_offset(event), attributeOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -93,16 +93,16 @@ static void handle_sdp_parser_event(uint8_t packet_type, uint8_t *packet, uint16
|
|||||||
test_attribute_value_event(packet);
|
test_attribute_value_event(packet);
|
||||||
|
|
||||||
// handle new record
|
// handle new record
|
||||||
if (sdp_query_attribute_byte_event_get_record_id(packet) != record_id){
|
if (sdp_event_query_attribute_byte_get_record_id(packet) != record_id){
|
||||||
record_id = sdp_query_attribute_byte_event_get_record_id(packet);
|
record_id = sdp_event_query_attribute_byte_get_record_id(packet);
|
||||||
}
|
}
|
||||||
// buffer data
|
// buffer data
|
||||||
assertBuffer(sdp_query_attribute_byte_event_get_attribute_length(packet));
|
assertBuffer(sdp_event_query_attribute_byte_get_attribute_length(packet));
|
||||||
attribute_value[sdp_query_attribute_byte_event_get_data_offset(packet)] = sdp_query_attribute_byte_event_get_data(packet);
|
attribute_value[sdp_event_query_attribute_byte_get_data_offset(packet)] = sdp_event_query_attribute_byte_get_data(packet);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case SDP_EVENT_QUERY_COMPLETE:
|
case SDP_EVENT_QUERY_COMPLETE:
|
||||||
printf("General query done with status %d.\n", sdp_query_complete_event_get_status(packet));
|
printf("General query done with status %d.\n", sdp_event_query_complete_get_status(packet));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@ static void handle_sdp_parser_event(uint8_t packet_type, uint8_t *packet, uint16
|
|||||||
record_handle++;
|
record_handle++;
|
||||||
break;
|
break;
|
||||||
case SDP_EVENT_QUERY_COMPLETE:
|
case SDP_EVENT_QUERY_COMPLETE:
|
||||||
printf("General query done with status %d.\n", sdp_query_complete_event_get_status(packet));
|
printf("General query done with status %d.\n", sdp_event_query_complete_get_status(packet));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -203,15 +203,9 @@ def create_events(events):
|
|||||||
fout.write(copyright)
|
fout.write(copyright)
|
||||||
fout.write(hfile_header_begin)
|
fout.write(hfile_header_begin)
|
||||||
for event_type, event_name, format, args in events:
|
for event_type, event_name, format, args in events:
|
||||||
if not event_name in [
|
parts = event_name.split("_")
|
||||||
'SDP_EVENT_QUERY_COMPLETE',
|
if not parts[0] in [ 'SDP', 'ANCS', 'SM']:
|
||||||
'SDP_EVENT_QUERY_RFCOMM_SERVICE',
|
continue
|
||||||
'SDP_EVENT_QUERY_ATTRIBUTE_BYTE',
|
|
||||||
'SDP_EVENT_QUERY_SERVICE_RECORD_HANDLE',
|
|
||||||
'ANCS_EVENT_CLIENT_CONNECTED',
|
|
||||||
'ANCS_EVENT_CLIENT_NOTIFICATION',
|
|
||||||
'ANCS_EVENT_CLIENT_DISCONNECTED']:
|
|
||||||
continue
|
|
||||||
event_name = format_function_name(event_name)
|
event_name = format_function_name(event_name)
|
||||||
length_name = ''
|
length_name = ''
|
||||||
offset = 2
|
offset = 2
|
||||||
|
Loading…
x
Reference in New Issue
Block a user