use for event types

This commit is contained in:
Matthias Ringwald 2016-01-30 23:58:36 +01:00
parent a481587475
commit 5611a760af
46 changed files with 291 additions and 292 deletions

View File

@ -348,7 +348,7 @@ for the connection MTU with *gatt_client_get_mtu*.
GATT queries cannot be interleaved. Therefore, you can check if you can
perform a GATT query on a particular connection using
*gatt_client_is_ready*. As a result to a GATT query, zero to many
*le_event*s are returned before a *GATT_QUERY_COMPLETE* event
*le_event*s are returned before a *GATT_EVENT_QUERY_COMPLETE* event
completes the query.
For more details on the available GATT queries, please consult

View File

@ -667,11 +667,11 @@ registered callback, as shown in Listing [below](#lst:SDPClientRFCOMM).
sdp_query_rfcomm_service_event_t * ve;
switch (event->type){
case SDP_QUERY_RFCOMM_SERVICE:
case SDP_EVENT_QUERY_RFCOMM_SERVICE:
ve = (sdp_query_rfcomm_service_event_t*) event;
printf("Service name: '%s', RFCOMM port %u\n", ve->service_name, ve->channel_nr);
break;
case SDP_QUERY_COMPLETE:
case SDP_EVENT_QUERY_COMPLETE:
report_found_services();
printf("Client query response done with status %d. \n", ce->status);
break;
@ -824,13 +824,13 @@ Resolving (IR) key. After an LE connection gets established, BTstack
automatically tries to resolve the address of this device. During this
lookup, BTstack will emit the following events:
- *SM_IDENTITY_RESOLVING_STARTED* to mark the start of a lookup,
- *SM_EVENT_IDENTITY_RESOLVING_STARTED* to mark the start of a lookup,
and later:
- *SM_IDENTITY_RESOLVING_SUCCEEDED* on lookup success, or
- *SM_EVENT_IDENTITY_RESOLVING_SUCCEEDED* on lookup success, or
- *SM_IDENTITY_RESOLVING_FAILED* on lookup failure.
- *SM_EVENT_IDENTITY_RESOLVING_FAILED* on lookup failure.
### Bonding process
@ -851,16 +851,16 @@ Depending on the authentication requirements, available OOB data, and
the enabled STK generation methods, BTstack will request feedback from
the app in the form of an event:
- *SM_PASSKEY_INPUT_NUMBER*: request user to input a passkey
- *SM_EVENT_PASSKEY_INPUT_NUMBER*: request user to input a passkey
- *SM_PASSKEY_DISPLAY_NUMBER*: show a passkey to the user
- *SM_EVENT_PASSKEY_DISPLAY_NUMBER*: show a passkey to the user
- *SM_JUST_WORKS_REQUEST*: request a user to accept a Just Works
- *SM_EVENT_JUST_WORKS_REQUEST*: request a user to accept a Just Works
pairing
To stop the bonding process, *sm_bonding_decline* should be called.
Otherwise, *sm_just_works_confirm* or *sm_passkey_input* can be
called.
After the bonding process, *SM_PASSKEY_DISPLAY_CANCEL* is emitted to
After the bonding process, *SM_EVENT_PASSKEY_DISPLAY_CANCEL* is emitted to
update the user interface.

View File

@ -77,14 +77,14 @@ void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint
}
break;
case SDP_QUERY_COMPLETE:
case SDP_EVENT_QUERY_COMPLETE:
// data: event(8), len(8), status(8)
printf("SDP_QUERY_COMPLETE, status %u\n", packet[2]);
printf("SDP_EVENT_QUERY_COMPLETE, status %u\n", packet[2]);
break;
case SDP_QUERY_RFCOMM_SERVICE:
case SDP_EVENT_QUERY_RFCOMM_SERVICE:
// data: event(8), len(8), rfcomm channel(8), name(var)
printf("SDP_QUERY_RFCOMM_SERVICE, rfcomm channel %u, name '%s'\n", packet[2], (const char*)&packet[3]);
printf("SDP_EVENT_QUERY_RFCOMM_SERVICE, rfcomm channel %u, name '%s'\n", packet[2], (const char*)&packet[3]);
break;
default:

View File

@ -99,13 +99,13 @@ static void app_packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *
static void ancs_callback(uint8_t packet_type, uint8_t *packet, uint16_t size){
const char * attribute_name;
switch (packet[0]){
case ANCS_CLIENT_CONNECTED:
case ANCS_EVENT_CLIENT_CONNECTED:
printf("ANCS Client: Connected\n");
break;
case ANCS_CLIENT_DISCONNECTED:
case ANCS_EVENT_CLIENT_DISCONNECTED:
printf("ANCS Client: Disconnected\n");
break;
case ANCS_CLIENT_NOTIFICATION:
case ANCS_EVENT_CLIENT_NOTIFICATION:
attribute_name = ancs_client_attribute_name_for_id(ancs_client_notification_event_get_attribute_id(packet));
if (!attribute_name) break;
printf("Notification: %s - %s\n", attribute_name, ancs_client_notification_event_get_text(packet));

View File

@ -67,7 +67,7 @@ static void packet_handler (uint8_t packet_type, uint8_t *packet, uint16_t size)
gap_dedicated_bonding(remote, 1);
}
break;
case GAP_DEDICATED_BONDING_COMPLETED:
case GAP_EVENT_DEDICATED_BONDING_COMPLETED:
printf("GAP Dedicated Bonding Complete, status %u\n", packet[2]);
default:
break;

View File

@ -196,7 +196,7 @@ static void packet_handler (uint8_t packet_type, uint8_t *packet, uint16_t size)
continue_bonding();
break;
case GAP_DEDICATED_BONDING_COMPLETED:
case GAP_EVENT_DEDICATED_BONDING_COMPLETED:
// data: event(8), len(8), status (8), bd_addr(48)
printf("GAP Dedicated Bonding Complete, status %u\n", packet[2]);
bt_flip_addr(addr, &packet[3]);

View File

@ -59,7 +59,7 @@
/* @section GAP LE setup for receiving advertisements
*
* @text GAP LE advertisements are received as custom HCI events of the
* GAP_LE_ADVERTISING_REPORT type. To receive them, you'll need to register
* GAP_LE_EVENT_ADVERTISING_REPORT type. To receive them, you'll need to register
* the HCI packet handler, as shown in Listing GAPLEAdvSetup.
*/
@ -218,7 +218,7 @@ static void dump_advertisement_data(uint8_t * adv_data, uint8_t adv_size){
*
* @text The HCI packet handler has to start the scanning,
* and to handle received advertisements. Advertisements are received
* as HCI event packets of the GAP_LE_ADVERTISING_REPORT type,
* as HCI event packets of the GAP_LE_EVENT_ADVERTISING_REPORT type,
* see Listing GAPLEAdvPacketHandler.
*/
@ -236,7 +236,7 @@ static void handle_hci_event(uint8_t packet_type, uint8_t *packet, uint16_t size
le_central_start_scan();
}
break;
case GAP_LE_ADVERTISING_REPORT:{
case GAP_LE_EVENT_ADVERTISING_REPORT:{
int pos = 2;
uint8_t event_type = packet[pos++];
uint8_t address_type = packet[pos++];

View File

@ -164,12 +164,12 @@ static void handle_gatt_client_event(uint8_t packet_type, uint8_t *packet, uint1
switch(state){
case TC_W4_SERVICE_RESULT:
switch(packet[0]){
case GATT_SERVICE_QUERY_RESULT:
case GATT_EVENT_SERVICE_QUERY_RESULT:
extract_service(&battery_service, packet);
printf("Battery service found:\n");
dump_service(&battery_service);
break;
case GATT_QUERY_COMPLETE:
case GATT_EVENT_QUERY_COMPLETE:
if (!packet[4]){
printf("Battery service not found. Restart scan.\n");
state = TC_W4_SCAN_RESULT;
@ -187,12 +187,12 @@ static void handle_gatt_client_event(uint8_t packet_type, uint8_t *packet, uint1
case TC_W4_CHARACTERISTIC_RESULT:
switch(packet[0]){
case GATT_CHARACTERISTIC_QUERY_RESULT:
case GATT_EVENT_CHARACTERISTIC_QUERY_RESULT:
printf("Battery level characteristic found:\n");
extract_characteristic(&config_characteristic, packet);
dump_characteristic(&config_characteristic);
break;
case GATT_QUERY_COMPLETE:
case GATT_EVENT_QUERY_COMPLETE:
state = TC_W4_BATTERY_DATA;
printf("\nConfigure battery level characteristic for notify.");
gatt_client_write_client_characteristic_configuration(gc_id, gc_handle, &config_characteristic, GATT_CLIENT_CHARACTERISTICS_CONFIGURATION_NOTIFICATION);
@ -202,14 +202,14 @@ static void handle_gatt_client_event(uint8_t packet_type, uint8_t *packet, uint1
}
break;
case TC_W4_BATTERY_DATA:
if (packet[0] == GATT_QUERY_COMPLETE){
if (packet[0] == GATT_EVENT_QUERY_COMPLETE){
if (packet[4] != 0){
printf("\nNotification is not possible: ");
error_code(packet[4]);
}
break;
}
if (packet[0] != GATT_NOTIFICATION) break;
if (packet[0] != GATT_EVENT_NOTIFICATION) break;
printf("\nBattery Data:\n");
dump_characteristic_value(&packet[8], READ_BT_16(packet, 6));
break;
@ -253,7 +253,7 @@ static void handle_hci_event(uint8_t packet_type, uint16_t channel, uint8_t *pac
le_central_set_scan_parameters(0,0x0030, 0x0030);
le_central_start_scan();
break;
case GAP_LE_ADVERTISING_REPORT:
case GAP_LE_EVENT_ADVERTISING_REPORT:
if (state != TC_W4_SCAN_RESULT) return;
fill_advertising_report_from_packet(&report, packet);
// stop scanning, and connect to the device

View File

@ -198,7 +198,7 @@ static void handle_hci_event(uint8_t packet_type, uint16_t channel, uint8_t *pac
le_central_set_scan_parameters(0,0x0030, 0x0030);
le_central_start_scan();
break;
case GAP_LE_ADVERTISING_REPORT:
case GAP_LE_EVENT_ADVERTISING_REPORT:
fill_advertising_report_from_packet(&report, packet);
// stop scanning, and connect to the device
le_central_stop_scan();
@ -261,25 +261,25 @@ void handle_gatt_client_event(uint8_t packet_type, uint8_t *packet, uint16_t siz
le_service_t service;
le_characteristic_t characteristic;
switch(packet[0]){
case GATT_SERVICE_QUERY_RESULT:\
case GATT_EVENT_SERVICE_QUERY_RESULT:\
extract_service(&service, packet);
dump_service(&service);
services[service_count++] = service;
break;
case GATT_CHARACTERISTIC_QUERY_RESULT:
case GATT_EVENT_CHARACTERISTIC_QUERY_RESULT:
extract_characteristic(&characteristic, packet);
dump_characteristic(&characteristic);
break;
case GATT_QUERY_COMPLETE:
case GATT_EVENT_QUERY_COMPLETE:
if (search_services){
// GATT_QUERY_COMPLETE of search services
// GATT_EVENT_QUERY_COMPLETE of search services
service_index = 0;
printf("\nGATT browser - CHARACTERISTIC for SERVICE ");
printUUID128(service.uuid128); printf("\n");
search_services = 0;
gatt_client_discover_characteristics_for_service(gc_id, gc_handle, &services[service_index]);
} else {
// GATT_QUERY_COMPLETE of search characteristics
// GATT_EVENT_QUERY_COMPLETE of search characteristics
if (service_index < service_count) {
service = services[service_index++];
printf("\nGATT browser - CHARACTERISTIC for SERVICE ");

View File

@ -187,7 +187,7 @@ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *pack
break;
}
break;
case ATT_MTU_EXCHANGE_COMPLETE:
case ATT_EVENT_MTU_EXCHANGE_COMPLETE:
mtu = READ_BT_16(packet, 4) - 3;
printf("ATT MTU = %u\n", mtu);
test_data_len = mtu - 3;

View File

@ -324,7 +324,7 @@ static void handle_sdp_client_query_result(uint8_t packet_type, uint8_t *packet,
char *str;
switch (packet[0]){
case SDP_QUERY_ATTRIBUTE_VALUE:
case SDP_EVENT_QUERY_ATTRIBUTE_VALUE:
// Handle new SDP record
if (sdp_query_attribute_byte_event_get_record_id(packet) != record_id) {
record_id = sdp_query_attribute_byte_event_get_record_id(packet);
@ -408,7 +408,7 @@ static void handle_sdp_client_query_result(uint8_t packet_type, uint8_t *packet,
}
break;
case SDP_QUERY_COMPLETE:
case SDP_EVENT_QUERY_COMPLETE:
fprintf(stderr, "General query done with status %d.\n", sdp_query_complete_event_get_status(packet));
break;

View File

@ -83,8 +83,8 @@ static void assertBuffer(int size){
* @text As with the previous example, you must register a
* callback, i.e. query handler, with the SPD parser, as shown in
* Listing SDPClientInit. Via this handler, the SDP client will receive events:
* - SDP_QUERY_ATTRIBUTE_VALUE containing the results of the query in chunks,
* - SDP_QUERY_COMPLETE reporting the status and the end of the query.
* - SDP_EVENT_QUERY_ATTRIBUTE_VALUE containing the results of the query in chunks,
* - SDP_EVENT_QUERY_COMPLETE reporting the status and the end of the query.
*/
/* LISTING_START(SDPClientInit): SDP client setup */
@ -167,7 +167,7 @@ static void handle_sdp_client_query_result(uint8_t packet_type, uint8_t *packet,
char *str;
switch (packet[0]){
case SDP_QUERY_ATTRIBUTE_VALUE:
case SDP_EVENT_QUERY_ATTRIBUTE_VALUE:
// handle new record
if (sdp_query_attribute_byte_event_get_record_id(packet) != record_id){
record_id = sdp_query_attribute_byte_event_get_record_id(packet);
@ -256,7 +256,7 @@ static void handle_sdp_client_query_result(uint8_t packet_type, uint8_t *packet,
}
}
break;
case SDP_QUERY_COMPLETE:
case SDP_EVENT_QUERY_COMPLETE:
printf("General query done with status %d.\n\n", sdp_query_complete_event_get_status(packet));
break;
}

View File

@ -73,8 +73,8 @@ static const int attribute_value_buffer_size = sizeof(attribute_value);
* @text SDP is based on L2CAP. To receive SDP query events you must register a
* callback, i.e. query handler, with the SPD parser, as shown in
* Listing SDPClientInit. Via this handler, the SDP client will receive the following events:
* - SDP_QUERY_ATTRIBUTE_VALUE containing the results of the query in chunks,
* - SDP_QUERY_COMPLETE indicating the end of the query and the status
* - SDP_EVENT_QUERY_ATTRIBUTE_VALUE containing the results of the query in chunks,
* - SDP_EVENT_QUERY_COMPLETE indicating the end of the query and the status
*/
/* LISTING_START(SDPClientInit): SDP client setup */
@ -146,7 +146,7 @@ static void assertBuffer(int size){
/* LISTING_START(HandleSDPQUeryResult): Handling query result chunks. */
static void handle_sdp_client_query_result(uint8_t packet_type, uint8_t *packet, uint16_t size){
switch (packet[0]){
case SDP_QUERY_ATTRIBUTE_VALUE:
case SDP_EVENT_QUERY_ATTRIBUTE_VALUE:
// handle new record
if (sdp_query_attribute_byte_event_get_record_id(packet) != record_id){
record_id = sdp_query_attribute_byte_event_get_record_id(packet);
@ -161,7 +161,7 @@ static void handle_sdp_client_query_result(uint8_t packet_type, uint8_t *packet,
de_dump_data_element(attribute_value);
}
break;
case SDP_QUERY_COMPLETE:
case SDP_EVENT_QUERY_COMPLETE:
printf("General query done with status %d.\n\n", sdp_query_complete_event_get_status(packet));
exit(0);
break;

View File

@ -110,11 +110,11 @@ static void report_found_services(void){
static void handle_query_rfcomm_event(uint8_t packet_type, uint8_t *packet, uint16_t size, void * context){
switch (packet[0]){
case SDP_QUERY_RFCOMM_SERVICE:
case SDP_EVENT_QUERY_RFCOMM_SERVICE:
store_found_service(sdp_query_rfcomm_service_event_get_name(packet),
sdp_query_rfcomm_service_event_get_rfcomm_channel(packet));
break;
case SDP_QUERY_COMPLETE:
case SDP_EVENT_QUERY_COMPLETE:
report_found_services();
break;
}

View File

@ -163,11 +163,11 @@ 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, void * context){
switch (packet[0]){
case SDP_QUERY_RFCOMM_SERVICE:
case SDP_EVENT_QUERY_RFCOMM_SERVICE:
handle_found_service(sdp_query_rfcomm_service_event_get_name(packet),
sdp_query_rfcomm_service_event_get_rfcomm_channel(packet));
break;
case SDP_QUERY_COMPLETE:
case SDP_EVENT_QUERY_COMPLETE:
if (state != W4_SDP_COMPLETE){
printf("Requested SPP Service %s not found \n", spp_service_name_prefix);
break;

View File

@ -728,7 +728,7 @@ static void send_rfcomm_create_channel_failed(void * connection, bd_addr_t addr,
// data: event(8), len(8), status(8), service_record_handle(32)
static void sdp_emit_service_registered(void *connection, uint32_t handle, uint8_t status) {
uint8_t event[7];
event[0] = SDP_SERVICE_REGISTERED;
event[0] = SDP_EVENT_SERVICE_REGISTERED;
event[1] = sizeof(event) - 2;
event[2] = status;
bt_store_32(event, 3, handle);
@ -761,7 +761,7 @@ btstack_linked_list_gatt_client_helper_t * daemon_get_gatt_client_helper(uint16_
static void send_gatt_query_complete(connection_t * connection, uint16_t handle, uint8_t status){
// @format H1
uint8_t event[5];
event[0] = GATT_QUERY_COMPLETE;
event[0] = GATT_EVENT_QUERY_COMPLETE;
event[1] = 3;
bt_store_16(event, 2, handle);
event[4] = status;
@ -772,7 +772,7 @@ static void send_gatt_query_complete(connection_t * connection, uint16_t handle,
static void send_gatt_mtu_event(connection_t * connection, uint16_t handle, uint16_t mtu){
uint8_t event[6];
int pos = 0;
event[pos++] = GATT_MTU;
event[pos++] = GATT_EVENT_MTU;
event[pos++] = sizeof(event) - 2;
bt_store_16(event, pos, handle);
pos += 2;
@ -1575,8 +1575,8 @@ static void rfcomm_packet_handler(uint8_t packet_type, uint16_t channel, uint8_t
static void handle_sdp_rfcomm_service_result(uint8_t packet_type, uint8_t *packet, uint16_t size, void * context){
switch (packet[0]){
case SDP_QUERY_RFCOMM_SERVICE:
case SDP_QUERY_COMPLETE:
case SDP_EVENT_QUERY_RFCOMM_SERVICE:
case SDP_EVENT_QUERY_COMPLETE:
// already HCI Events, just forward them
hci_dump_packet(HCI_EVENT_PACKET, 0, packet, size);
socket_connection_send_packet(context, HCI_EVENT_PACKET, 0, packet, size);
@ -1597,7 +1597,7 @@ static void handle_sdp_client_query_result(uint8_t packet_type, uint8_t *packet,
int event_len;
switch (packet[0]){
case SDP_QUERY_ATTRIBUTE_BYTE:
case SDP_EVENT_QUERY_ATTRIBUTE_BYTE:
sdp_client_assert_buffer(sdp_query_attribute_byte_event_get_attribute_length(packet));
attribute_value[sdp_query_attribute_byte_event_get_data_offset(packet)] = sdp_query_attribute_byte_event_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)){
@ -1605,7 +1605,7 @@ static void handle_sdp_client_query_result(uint8_t packet_type, uint8_t *packet,
int event_len = 1 + 3 * 2 + sdp_query_attribute_byte_event_get_attribute_length(packet);
uint8_t event[event_len];
event[0] = SDP_QUERY_ATTRIBUTE_VALUE;
event[0] = SDP_EVENT_QUERY_ATTRIBUTE_VALUE;
bt_store_16(event, 1, sdp_query_attribute_byte_event_get_record_id(packet));
bt_store_16(event, 3, sdp_query_attribute_byte_event_get_attribute_id(packet));
bt_store_16(event, 5, (uint16_t)sdp_query_attribute_byte_event_get_attribute_length(packet));
@ -1614,7 +1614,7 @@ static void handle_sdp_client_query_result(uint8_t packet_type, uint8_t *packet,
socket_connection_send_packet(sdp_client_query_connection, SDP_CLIENT_PACKET, 0, event, event_len);
}
break;
case SDP_QUERY_COMPLETE:
case SDP_EVENT_QUERY_COMPLETE:
event_len = packet[1] + 2;
hci_dump_packet(HCI_EVENT_PACKET, 0, packet, event_len);
socket_connection_send_packet(sdp_client_query_connection, HCI_EVENT_PACKET, 0, packet, event_len);
@ -1759,17 +1759,17 @@ static void handle_gatt_client_event(uint8_t packet_type, uint8_t * packet, uint
// only handle GATT Events
switch(packet[0]){
case GATT_SERVICE_QUERY_RESULT:
case GATT_INCLUDED_SERVICE_QUERY_RESULT:
case GATT_NOTIFICATION:
case GATT_INDICATION:
case GATT_CHARACTERISTIC_QUERY_RESULT:
case GATT_ALL_CHARACTERISTIC_DESCRIPTORS_QUERY_RESULT:
case GATT_CHARACTERISTIC_DESCRIPTOR_QUERY_RESULT:
case GATT_LONG_CHARACTERISTIC_DESCRIPTOR_QUERY_RESULT:
case GATT_CHARACTERISTIC_VALUE_QUERY_RESULT:
case GATT_LONG_CHARACTERISTIC_VALUE_QUERY_RESULT:
case GATT_QUERY_COMPLETE:
case GATT_EVENT_SERVICE_QUERY_RESULT:
case GATT_EVENT_INCLUDED_SERVICE_QUERY_RESULT:
case GATT_EVENT_NOTIFICATION:
case GATT_EVENT_INDICATION:
case GATT_EVENT_CHARACTERISTIC_QUERY_RESULT:
case GATT_EVENT_ALL_CHARACTERISTIC_DESCRIPTORS_QUERY_RESULT:
case GATT_EVENT_CHARACTERISTIC_DESCRIPTOR_QUERY_RESULT:
case GATT_EVENT_LONG_CHARACTERISTIC_DESCRIPTOR_QUERY_RESULT:
case GATT_EVENT_CHARACTERISTIC_VALUE_QUERY_RESULT:
case GATT_EVENT_LONG_CHARACTERISTIC_VALUE_QUERY_RESULT:
case GATT_EVENT_QUERY_COMPLETE:
break;
default:
return;
@ -1786,8 +1786,8 @@ static void handle_gatt_client_event(uint8_t packet_type, uint8_t * packet, uint
// daemon doesn't track which connection subscribed to this particular handle, so we just notify all connections
switch(packet[0]){
case GATT_NOTIFICATION:
case GATT_INDICATION:{
case GATT_EVENT_NOTIFICATION:
case GATT_EVENT_INDICATION:{
hci_dump_packet(HCI_EVENT_PACKET, 0, packet, size);
btstack_linked_item_t *it;
@ -1810,18 +1810,18 @@ static void handle_gatt_client_event(uint8_t packet_type, uint8_t * packet, uint
switch(packet[0]){
case GATT_SERVICE_QUERY_RESULT:
case GATT_INCLUDED_SERVICE_QUERY_RESULT:
case GATT_CHARACTERISTIC_QUERY_RESULT:
case GATT_CHARACTERISTIC_VALUE_QUERY_RESULT:
case GATT_CHARACTERISTIC_DESCRIPTOR_QUERY_RESULT:
case GATT_ALL_CHARACTERISTIC_DESCRIPTORS_QUERY_RESULT:
case GATT_EVENT_SERVICE_QUERY_RESULT:
case GATT_EVENT_INCLUDED_SERVICE_QUERY_RESULT:
case GATT_EVENT_CHARACTERISTIC_QUERY_RESULT:
case GATT_EVENT_CHARACTERISTIC_VALUE_QUERY_RESULT:
case GATT_EVENT_CHARACTERISTIC_DESCRIPTOR_QUERY_RESULT:
case GATT_EVENT_ALL_CHARACTERISTIC_DESCRIPTORS_QUERY_RESULT:
hci_dump_packet(HCI_EVENT_PACKET, 0, packet, size);
socket_connection_send_packet(connection, HCI_EVENT_PACKET, 0, packet, size);
break;
case GATT_LONG_CHARACTERISTIC_VALUE_QUERY_RESULT:
case GATT_LONG_CHARACTERISTIC_DESCRIPTOR_QUERY_RESULT:
case GATT_EVENT_LONG_CHARACTERISTIC_VALUE_QUERY_RESULT:
case GATT_EVENT_LONG_CHARACTERISTIC_DESCRIPTOR_QUERY_RESULT:
offset = READ_BT_16(packet, 6);
length = READ_BT_16(packet, 8);
gatt_client_helper->characteristic_buffer[0] = packet[0]; // store type (characteristic/descriptor)
@ -1830,7 +1830,7 @@ static void handle_gatt_client_event(uint8_t packet_type, uint8_t * packet, uint
memcpy(&gatt_client_helper->characteristic_buffer[10 + offset], &packet[10], length);
break;
case GATT_QUERY_COMPLETE:{
case GATT_EVENT_QUERY_COMPLETE:{
gatt_client_helper->active_connection = NULL;
if (gatt_client_helper->characteristic_length){
// send re-combined long characteristic value or long characteristic descriptor value

View File

@ -155,7 +155,7 @@ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *pack
le_peripheral_todos |= SET_ADVERTISEMENT_ENABLED;
break;
case GAP_LE_ADVERTISING_REPORT: {
case GAP_LE_EVENT_ADVERTISING_REPORT: {
if (bleAdvertismentCallback) {
BLEAdvertisement advertisement(packet);
(*bleAdvertismentCallback)(&advertisement);
@ -222,8 +222,8 @@ static void gatt_client_callback(uint8_t packet_type, uint8_t * packet, uint16_t
// if (hci) event is not 4-byte aligned, event->handle causes crash
// workaround: check event type, assuming GATT event types are contagious
if (packet[0] < GATT_QUERY_COMPLETE) return;
if (packet[0] > GATT_MTU) return;
if (packet[0] < GATT_EVENT_QUERY_COMPLETE) return;
if (packet[0] > GATT_EVENT_MTU) return;
uint16_t con_handle = READ_BT_16(packet, 2);
uint8_t status;
@ -233,7 +233,7 @@ static void gatt_client_callback(uint8_t packet_type, uint8_t * packet, uint16_t
BLEDevice device(con_handle);
switch(packet[0]){
case GATT_SERVICE_QUERY_RESULT:
case GATT_EVENT_SERVICE_QUERY_RESULT:
if (gattServiceDiscoveredCallback) {
le_service_t service;
extract_service(&service, packet);
@ -241,7 +241,7 @@ static void gatt_client_callback(uint8_t packet_type, uint8_t * packet, uint16_t
(*gattServiceDiscoveredCallback)(BLE_STATUS_OK, &device, &bleService);
}
break;
case GATT_CHARACTERISTIC_QUERY_RESULT:
case GATT_EVENT_CHARACTERISTIC_QUERY_RESULT:
if (gattCharacteristicDiscoveredCallback){
le_characteristic_t characteristic;
extract_characteristic(&characteristic, packet);
@ -249,7 +249,7 @@ static void gatt_client_callback(uint8_t packet_type, uint8_t * packet, uint16_t
(*gattCharacteristicDiscoveredCallback)(BLE_STATUS_OK, &device, &bleCharacteristic);
}
break;
case GATT_QUERY_COMPLETE:
case GATT_EVENT_QUERY_COMPLETE:
status = READ_BT_16(packet, 4);
switch (gattAction){
case gattActionWrite:
@ -271,7 +271,7 @@ static void gatt_client_callback(uint8_t packet_type, uint8_t * packet, uint16_t
break;
};
break;
case GATT_NOTIFICATION:
case GATT_EVENT_NOTIFICATION:
if (gattCharacteristicNotificationCallback) {
value_handle = READ_BT_16(packet, 4);
value_length = READ_BT_16(packet, 6);
@ -279,7 +279,7 @@ static void gatt_client_callback(uint8_t packet_type, uint8_t * packet, uint16_t
(*gattCharacteristicNotificationCallback)(&device, value_handle, value, value_length);
}
break;
case GATT_INDICATION:
case GATT_EVENT_INDICATION:
if (gattCharacteristicIndicationCallback) {
value_handle = READ_BT_16(packet, 4);
value_length = READ_BT_16(packet, 6);
@ -287,7 +287,7 @@ static void gatt_client_callback(uint8_t packet_type, uint8_t * packet, uint16_t
(*gattCharacteristicIndicationCallback)(&device, value_handle, value, value_length);
}
break;
case GATT_CHARACTERISTIC_VALUE_QUERY_RESULT:
case GATT_EVENT_CHARACTERISTIC_VALUE_QUERY_RESULT:
if (gattCharacteristicReadCallback) {
value_handle = READ_BT_16(packet, 4);
value_length = READ_BT_16(packet, 6);

View File

@ -75,13 +75,13 @@ void loop(void){
void ancs_callback(uint8_t packet_type, uint8_t *packet, uint16_t size){
const char * attribute_name;
switch (packet[0]){
case ANCS_CLIENT_CONNECTED:
case ANCS_EVENT_CLIENT_CONNECTED:
Serial.println("ANCS Client: Connected");
break;
case ANCS_CLIENT_DISCONNECTED:
case ANCS_EVENT_CLIENT_DISCONNECTED:
Serial.println("ANCS Client: Disconnected");
break;
case ANCS_CLIENT_NOTIFICATION:
case ANCS_EVENT_CLIENT_NOTIFICATION:
attribute_name = ancs_client_attribute_name_for_id(ancs_client_notification_event_get_attribute_id(packet));
if (!attribute_name) break;
Serial.print("Notification: ");

View File

@ -164,7 +164,7 @@ static void ancs_chunk_parser_handle_byte(uint8_t data){
break;
case W4_ATTRIBUTE_COMPLETE:
ancs_notification_buffer[ancs_bytes_received] = 0;
notify_client_text(ANCS_CLIENT_NOTIFICATION);
notify_client_text(ANCS_EVENT_CLIENT_NOTIFICATION);
ancs_bytes_received = 0;
ancs_bytes_needed = 1;
chunk_parser_state = W4_ATTRIBUTE_ID;
@ -229,7 +229,7 @@ static void handle_gatt_client_event(uint8_t packet_type, uint8_t *packet, uint1
return;
case HCI_EVENT_DISCONNECTION_COMPLETE:
notify_client_simple(ANCS_CLIENT_DISCONNECTED);
notify_client_simple(ANCS_EVENT_CLIENT_DISCONNECTED);
return;
default:
@ -244,11 +244,11 @@ static void handle_gatt_client_event(uint8_t packet_type, uint8_t *packet, uint1
switch(tc_state){
case TC_W4_SERVICE_RESULT:
switch(packet[0]){
case GATT_SERVICE_QUERY_RESULT:
case GATT_EVENT_SERVICE_QUERY_RESULT:
extract_service(&ancs_service, packet);
ancs_service_found = 1;
break;
case GATT_QUERY_COMPLETE:
case GATT_EVENT_QUERY_COMPLETE:
if (!ancs_service_found){
printf("ANCS Service not found");
tc_state = TC_IDLE;
@ -265,7 +265,7 @@ static void handle_gatt_client_event(uint8_t packet_type, uint8_t *packet, uint1
case TC_W4_CHARACTERISTIC_RESULT:
switch(packet[0]){
case GATT_CHARACTERISTIC_QUERY_RESULT:
case GATT_EVENT_CHARACTERISTIC_QUERY_RESULT:
extract_characteristic(&characteristic, packet);
if (memcmp(characteristic.uuid128, ancs_notification_source_uuid, 16) == 0){
printf("ANCS Notification Source Characterisic found\n");
@ -286,7 +286,7 @@ static void handle_gatt_client_event(uint8_t packet_type, uint8_t *packet, uint1
break;
}
break;
case GATT_QUERY_COMPLETE:
case GATT_EVENT_QUERY_COMPLETE:
printf("ANCS Characteristcs count %u\n", ancs_characteristcs);
tc_state = TC_W4_NOTIFICATION_SOURCE_SUBSCRIBED;
gatt_client_write_client_characteristic_configuration(gc_id, gc_handle, &ancs_notification_source_characteristic,
@ -298,7 +298,7 @@ static void handle_gatt_client_event(uint8_t packet_type, uint8_t *packet, uint1
break;
case TC_W4_NOTIFICATION_SOURCE_SUBSCRIBED:
switch(packet[0]){
case GATT_QUERY_COMPLETE:
case GATT_EVENT_QUERY_COMPLETE:
printf("ANCS Notification Source subscribed\n");
tc_state = TC_W4_DATA_SOURCE_SUBSCRIBED;
gatt_client_write_client_characteristic_configuration(gc_id, gc_handle, &ancs_data_source_characteristic,
@ -310,17 +310,17 @@ static void handle_gatt_client_event(uint8_t packet_type, uint8_t *packet, uint1
break;
case TC_W4_DATA_SOURCE_SUBSCRIBED:
switch(packet[0]){
case GATT_QUERY_COMPLETE:
case GATT_EVENT_QUERY_COMPLETE:
printf("ANCS Data Source subscribed\n");
tc_state = TC_SUBSCRIBED;
notify_client_simple(ANCS_CLIENT_CONNECTED);
notify_client_simple(ANCS_EVENT_CLIENT_CONNECTED);
break;
default:
break;
}
break;
case TC_SUBSCRIBED:
if (packet[0] != GATT_NOTIFICATION && packet[0] != GATT_INDICATION ) break;
if (packet[0] != GATT_EVENT_NOTIFICATION && packet[0] != GATT_EVENT_INDICATION ) break;
value_handle = READ_BT_16(packet, 4);
value_length = READ_BT_16(packet, 6);

View File

@ -100,7 +100,7 @@ static void att_handle_value_indication_notify_client(uint8_t status, uint16_t c
uint8_t event[7];
int pos = 0;
event[pos++] = ATT_HANDLE_VALUE_INDICATION_COMPLETE;
event[pos++] = ATT_EVENT_HANDLE_VALUE_INDICATION_COMPLETE;
event[pos++] = sizeof(event) - 2;
event[pos++] = status;
bt_store_16(event, pos, client_handle);
@ -116,7 +116,7 @@ static void att_emit_mtu_event(uint16_t handle, uint16_t mtu){
uint8_t event[6];
int pos = 0;
event[pos++] = ATT_MTU_EXCHANGE_COMPLETE;
event[pos++] = ATT_EVENT_MTU_EXCHANGE_COMPLETE;
event[pos++] = sizeof(event) - 2;
bt_store_16(event, pos, handle);
pos += 2;
@ -182,24 +182,24 @@ static void att_event_packet_handler (uint8_t packet_type, uint16_t channel, uin
att_server_state = ATT_SERVER_IDLE;
break;
case SM_IDENTITY_RESOLVING_STARTED:
log_info("SM_IDENTITY_RESOLVING_STARTED");
case SM_EVENT_IDENTITY_RESOLVING_STARTED:
log_info("SM_EVENT_IDENTITY_RESOLVING_STARTED");
att_ir_lookup_active = 1;
break;
case SM_IDENTITY_RESOLVING_SUCCEEDED:
case SM_EVENT_IDENTITY_RESOLVING_SUCCEEDED:
att_ir_lookup_active = 0;
att_ir_le_device_db_index = READ_BT_16(packet, 11);
log_info("SM_IDENTITY_RESOLVING_SUCCEEDED id %u", att_ir_le_device_db_index);
log_info("SM_EVENT_IDENTITY_RESOLVING_SUCCEEDED id %u", att_ir_le_device_db_index);
att_run();
break;
case SM_IDENTITY_RESOLVING_FAILED:
log_info("SM_IDENTITY_RESOLVING_FAILED");
case SM_EVENT_IDENTITY_RESOLVING_FAILED:
log_info("SM_EVENT_IDENTITY_RESOLVING_FAILED");
att_ir_lookup_active = 0;
att_ir_le_device_db_index = -1;
att_run();
break;
case SM_AUTHORIZATION_RESULT: {
case SM_EVENT_AUTHORIZATION_RESULT: {
if (packet[4] != att_client_addr_type) break;
bt_flip_addr(event_address, &packet[5]);
if (memcmp(event_address, att_client_address, 6) != 0) break;

View File

@ -509,7 +509,7 @@ static void emit_event_to_all_subclients_new(uint8_t * packet, uint16_t size){
static void emit_gatt_complete_event(gatt_client_t * peripheral, uint8_t status){
// @format H1
uint8_t packet[5];
packet[0] = GATT_QUERY_COMPLETE;
packet[0] = GATT_EVENT_QUERY_COMPLETE;
packet[1] = 3;
bt_store_16(packet, 2, peripheral->handle);
packet[4] = status;
@ -519,7 +519,7 @@ static void emit_gatt_complete_event(gatt_client_t * peripheral, uint8_t status)
static void emit_gatt_service_query_result_event(gatt_client_t * peripheral, uint16_t start_group_handle, uint16_t end_group_handle, uint8_t * uuid128){
// @format HX
uint8_t packet[24];
packet[0] = GATT_SERVICE_QUERY_RESULT;
packet[0] = GATT_EVENT_SERVICE_QUERY_RESULT;
packet[1] = sizeof(packet) - 2;
bt_store_16(packet, 2, peripheral->handle);
///
@ -532,7 +532,7 @@ static void emit_gatt_service_query_result_event(gatt_client_t * peripheral, uin
static void emit_gatt_included_service_query_result_event(gatt_client_t * peripheral, uint16_t include_handle, uint16_t start_group_handle, uint16_t end_group_handle, uint8_t * uuid128){
// @format HX
uint8_t packet[26];
packet[0] = GATT_INCLUDED_SERVICE_QUERY_RESULT;
packet[0] = GATT_EVENT_INCLUDED_SERVICE_QUERY_RESULT;
packet[1] = sizeof(packet) - 2;
bt_store_16(packet, 2, peripheral->handle);
///
@ -548,7 +548,7 @@ static void emit_gatt_characteristic_query_result_event(gatt_client_t * peripher
uint16_t properties, uint8_t * uuid128){
// @format HY
uint8_t packet[28];
packet[0] = GATT_CHARACTERISTIC_QUERY_RESULT;
packet[0] = GATT_EVENT_CHARACTERISTIC_QUERY_RESULT;
packet[1] = sizeof(packet) - 2;
bt_store_16(packet, 2, peripheral->handle);
///
@ -564,7 +564,7 @@ static void emit_gatt_all_characteristic_descriptors_result_event(
gatt_client_t * peripheral, uint16_t descriptor_handle, uint8_t * uuid128){
// @format HZ
uint8_t packet[22];
packet[0] = GATT_ALL_CHARACTERISTIC_DESCRIPTORS_QUERY_RESULT;
packet[0] = GATT_EVENT_ALL_CHARACTERISTIC_DESCRIPTORS_QUERY_RESULT;
packet[1] = sizeof(packet) - 2;
bt_store_16(packet, 2, peripheral->handle);
///
@ -692,36 +692,36 @@ static uint8_t * setup_long_characteristic_value_packet(uint8_t type, uint16_t c
// @note assume that value is part of an l2cap buffer - overwrite parts of the HCI/L2CAP/ATT packet (4/4/3) bytes
static void report_gatt_notification(uint16_t con_handle, uint16_t value_handle, uint8_t * value, int length){
uint8_t * packet = setup_characteristic_value_packet(GATT_NOTIFICATION, con_handle, value_handle, value, length);
uint8_t * packet = setup_characteristic_value_packet(GATT_EVENT_NOTIFICATION, con_handle, value_handle, value, length);
emit_event_to_all_subclients_new(packet, characteristic_value_event_header_size + length);
}
// @note assume that value is part of an l2cap buffer - overwrite parts of the HCI/L2CAP/ATT packet (4/4/3) bytes
static void report_gatt_indication(uint16_t con_handle, uint16_t value_handle, uint8_t * value, int length){
uint8_t * packet = setup_characteristic_value_packet(GATT_INDICATION, con_handle, value_handle, value, length);
uint8_t * packet = setup_characteristic_value_packet(GATT_EVENT_INDICATION, con_handle, value_handle, value, length);
emit_event_to_all_subclients_new(packet, characteristic_value_event_header_size + length);
}
// @note assume that value is part of an l2cap buffer - overwrite parts of the HCI/L2CAP/ATT packet (4/4/3) bytes
static void report_gatt_characteristic_value(gatt_client_t * peripheral, uint16_t attribute_handle, uint8_t * value, uint16_t length){
uint8_t * packet = setup_characteristic_value_packet(GATT_CHARACTERISTIC_VALUE_QUERY_RESULT, peripheral->handle, attribute_handle, value, length);
uint8_t * packet = setup_characteristic_value_packet(GATT_EVENT_CHARACTERISTIC_VALUE_QUERY_RESULT, peripheral->handle, attribute_handle, value, length);
emit_event_new(peripheral->subclient_id, packet, characteristic_value_event_header_size + length);
}
// @note assume that value is part of an l2cap buffer - overwrite parts of the HCI/L2CAP/ATT packet (4/4/3) bytes
static void report_gatt_long_characteristic_value_blob(gatt_client_t * peripheral, uint16_t attribute_handle, uint8_t * blob, uint16_t blob_length, int value_offset){
uint8_t * packet = setup_long_characteristic_value_packet(GATT_LONG_CHARACTERISTIC_VALUE_QUERY_RESULT, peripheral->handle, attribute_handle, value_offset, blob, blob_length);
uint8_t * packet = setup_long_characteristic_value_packet(GATT_EVENT_LONG_CHARACTERISTIC_VALUE_QUERY_RESULT, peripheral->handle, attribute_handle, value_offset, blob, blob_length);
if (!packet) return;
emit_event_new(peripheral->subclient_id, packet, blob_length + long_characteristic_value_event_header_size);
}
static void report_gatt_characteristic_descriptor(gatt_client_t * peripheral, uint16_t descriptor_handle, uint8_t *value, uint16_t value_length, uint16_t value_offset){
uint8_t * packet = setup_characteristic_value_packet(GATT_CHARACTERISTIC_DESCRIPTOR_QUERY_RESULT, peripheral->handle, descriptor_handle, value, value_length);
uint8_t * packet = setup_characteristic_value_packet(GATT_EVENT_CHARACTERISTIC_DESCRIPTOR_QUERY_RESULT, peripheral->handle, descriptor_handle, value, value_length);
emit_event_new(peripheral->subclient_id, packet, value_length + 8);
}
static void report_gatt_long_characteristic_descriptor(gatt_client_t * peripheral, uint16_t descriptor_handle, uint8_t *blob, uint16_t blob_length, uint16_t value_offset){
uint8_t * packet = setup_long_characteristic_value_packet(GATT_LONG_CHARACTERISTIC_DESCRIPTOR_QUERY_RESULT, peripheral->handle, descriptor_handle, value_offset, blob, blob_length);
uint8_t * packet = setup_long_characteristic_value_packet(GATT_EVENT_LONG_CHARACTERISTIC_DESCRIPTOR_QUERY_RESULT, peripheral->handle, descriptor_handle, value_offset, blob, blob_length);
if (!packet) return;
emit_event_new(peripheral->subclient_id, packet, blob_length + long_characteristic_value_event_header_size);
}
@ -1089,7 +1089,7 @@ static void gatt_client_att_packet_handler(uint8_t packet_type, uint16_t handle,
case P_W4_SERVICE_QUERY_RESULT:
report_gatt_services(peripheral, packet, size);
trigger_next_service_query(peripheral, get_last_result_handle_from_service_list(packet, size));
// GATT_QUERY_COMPLETE is emitted by trigger_next_xxx when done
// GATT_EVENT_QUERY_COMPLETE is emitted by trigger_next_xxx when done
break;
default:
break;
@ -1105,12 +1105,12 @@ static void gatt_client_att_packet_handler(uint8_t packet_type, uint16_t handle,
case P_W4_ALL_CHARACTERISTICS_OF_SERVICE_QUERY_RESULT:
report_gatt_characteristics(peripheral, packet, size);
trigger_next_characteristic_query(peripheral, get_last_result_handle_from_characteristics_list(packet, size));
// GATT_QUERY_COMPLETE is emitted by trigger_next_xxx when done, or by ATT_ERROR
// GATT_EVENT_QUERY_COMPLETE is emitted by trigger_next_xxx when done, or by ATT_ERROR
break;
case P_W4_CHARACTERISTIC_WITH_UUID_QUERY_RESULT:
report_gatt_characteristics(peripheral, packet, size);
trigger_next_characteristic_query(peripheral, get_last_result_handle_from_characteristics_list(packet, size));
// GATT_QUERY_COMPLETE is emitted by trigger_next_xxx when done, or by ATT_ERROR
// GATT_EVENT_QUERY_COMPLETE is emitted by trigger_next_xxx when done, or by ATT_ERROR
break;
case P_W4_INCLUDED_SERVICE_QUERY_RESULT:
{
@ -1136,7 +1136,7 @@ static void gatt_client_att_packet_handler(uint8_t packet_type, uint16_t handle,
}
trigger_next_included_service_query(peripheral, get_last_result_handle_from_included_services_list(packet, size));
// GATT_QUERY_COMPLETE is emitted by trigger_next_xxx when done
// GATT_EVENT_QUERY_COMPLETE is emitted by trigger_next_xxx when done
break;
}
case P_W4_READ_CLIENT_CHARACTERISTIC_CONFIGURATION_QUERY_RESULT:
@ -1166,7 +1166,7 @@ static void gatt_client_att_packet_handler(uint8_t packet_type, uint16_t handle,
swap128(&packet[1], uuid128);
report_gatt_included_service_uuid128(peripheral, peripheral->start_group_handle, uuid128);
trigger_next_included_service_query(peripheral, peripheral->start_group_handle);
// GATT_QUERY_COMPLETE is emitted by trigger_next_xxx when done
// GATT_EVENT_QUERY_COMPLETE is emitted by trigger_next_xxx when done
break;
}
case P_W4_READ_CHARACTERISTIC_VALUE_RESULT:
@ -1191,14 +1191,14 @@ static void gatt_client_att_packet_handler(uint8_t packet_type, uint16_t handle,
uint8_t pair_size = 4;
int i;
uint16_t start_group_handle;
uint16_t end_group_handle= 0xffff; // asserts GATT_QUERY_COMPLETE is emitted if no results
uint16_t end_group_handle= 0xffff; // asserts GATT_EVENT_QUERY_COMPLETE is emitted if no results
for (i = 1; i<size; i+=pair_size){
start_group_handle = READ_BT_16(packet,i);
end_group_handle = READ_BT_16(packet,i+2);
emit_gatt_service_query_result_event(peripheral, start_group_handle, end_group_handle, peripheral->uuid128);
}
trigger_next_service_by_uuid_query(peripheral, end_group_handle);
// GATT_QUERY_COMPLETE is emitted by trigger_next_xxx when done
// GATT_EVENT_QUERY_COMPLETE is emitted by trigger_next_xxx when done
break;
}
case ATT_FIND_INFORMATION_REPLY:
@ -1211,7 +1211,7 @@ static void gatt_client_att_packet_handler(uint8_t packet_type, uint16_t handle,
report_gatt_all_characteristic_descriptors(peripheral, &packet[2], size-2, pair_size);
trigger_next_characteristic_descriptor_query(peripheral, last_descriptor_handle);
// GATT_QUERY_COMPLETE is emitted by trigger_next_xxx when done
// GATT_EVENT_QUERY_COMPLETE is emitted by trigger_next_xxx when done
break;
}
@ -1241,14 +1241,14 @@ static void gatt_client_att_packet_handler(uint8_t packet_type, uint16_t handle,
case P_W4_READ_BLOB_RESULT:
report_gatt_long_characteristic_value_blob(peripheral, peripheral->attribute_handle, &packet[1], received_blob_length, peripheral->attribute_offset);
trigger_next_blob_query(peripheral, P_W2_SEND_READ_BLOB_QUERY, received_blob_length);
// GATT_QUERY_COMPLETE is emitted by trigger_next_xxx when done
// GATT_EVENT_QUERY_COMPLETE is emitted by trigger_next_xxx when done
break;
case P_W4_READ_BLOB_CHARACTERISTIC_DESCRIPTOR_RESULT:
report_gatt_long_characteristic_descriptor(peripheral, peripheral->attribute_handle,
&packet[1], received_blob_length,
peripheral->attribute_offset);
trigger_next_blob_query(peripheral, P_W2_SEND_READ_BLOB_CHARACTERISTIC_DESCRIPTOR_QUERY, received_blob_length);
// GATT_QUERY_COMPLETE is emitted by trigger_next_xxx when done
// GATT_EVENT_QUERY_COMPLETE is emitted by trigger_next_xxx when done
break;
default:
break;
@ -1269,20 +1269,20 @@ static void gatt_client_att_packet_handler(uint8_t packet_type, uint16_t handle,
case P_W4_PREPARE_WRITE_RESULT:{
peripheral->attribute_offset = READ_BT_16(packet, 3);
trigger_next_prepare_write_query(peripheral, P_W2_PREPARE_WRITE, P_W2_EXECUTE_PREPARED_WRITE);
// GATT_QUERY_COMPLETE is emitted by trigger_next_xxx when done
// GATT_EVENT_QUERY_COMPLETE is emitted by trigger_next_xxx when done
break;
}
case P_W4_PREPARE_WRITE_CHARACTERISTIC_DESCRIPTOR_RESULT:{
peripheral->attribute_offset = READ_BT_16(packet, 3);
trigger_next_prepare_write_query(peripheral, P_W2_PREPARE_WRITE_CHARACTERISTIC_DESCRIPTOR, P_W2_EXECUTE_PREPARED_WRITE_CHARACTERISTIC_DESCRIPTOR);
// GATT_QUERY_COMPLETE is emitted by trigger_next_xxx when done
// GATT_EVENT_QUERY_COMPLETE is emitted by trigger_next_xxx when done
break;
}
case P_W4_PREPARE_RELIABLE_WRITE_RESULT:{
if (is_value_valid(peripheral, packet, size)){
peripheral->attribute_offset = READ_BT_16(packet, 3);
trigger_next_prepare_write_query(peripheral, P_W2_PREPARE_RELIABLE_WRITE, P_W2_EXECUTE_PREPARED_WRITE);
// GATT_QUERY_COMPLETE is emitted by trigger_next_xxx when done
// GATT_EVENT_QUERY_COMPLETE is emitted by trigger_next_xxx when done
break;
}
peripheral->gatt_client_state = P_W2_CANCEL_PREPARED_WRITE_DATA_MISMATCH;

View File

@ -240,28 +240,28 @@ uint8_t gatt_client_get_mtu(uint16_t handle, uint16_t * mtu);
int gatt_client_is_ready(uint16_t handle);
/**
* @brief Discovers all primary services. For each found service, an le_service_event_t with type set to GATT_SERVICE_QUERY_RESULT will be generated and passed to the registered callback. The gatt_complete_event_t, with type set to GATT_QUERY_COMPLETE, marks the end of discovery.
* @brief Discovers all primary services. For each found service, an le_service_event_t with type set to GATT_EVENT_SERVICE_QUERY_RESULT will be generated and passed to the registered callback. The gatt_complete_event_t, with type set to GATT_EVENT_QUERY_COMPLETE, marks the end of discovery.
*/
uint8_t gatt_client_discover_primary_services(uint16_t gatt_client_id, uint16_t con_handle);
/**
* @brief Discovers a specific primary service given its UUID. This service may exist multiple times. For each found service, an le_service_event_t with type set to GATT_SERVICE_QUERY_RESULT will be generated and passed to the registered callback. The gatt_complete_event_t, with type set to GATT_QUERY_COMPLETE, marks the end of discovery.
* @brief Discovers a specific primary service given its UUID. This service may exist multiple times. For each found service, an le_service_event_t with type set to GATT_EVENT_SERVICE_QUERY_RESULT will be generated and passed to the registered callback. The gatt_complete_event_t, with type set to GATT_EVENT_QUERY_COMPLETE, marks the end of discovery.
*/
uint8_t gatt_client_discover_primary_services_by_uuid16(uint16_t gatt_client_id, uint16_t con_handle, uint16_t uuid16);
uint8_t gatt_client_discover_primary_services_by_uuid128(uint16_t gatt_client_id, uint16_t con_handle, const uint8_t * uuid);
/**
* @brief Finds included services within the specified service. For each found included service, an le_service_event_t with type set to GATT_INCLUDED_SERVICE_QUERY_RESULT will be generated and passed to the registered callback. The gatt_complete_event_t with type set to GATT_QUERY_COMPLETE, marks the end of discovery. Information about included service type (primary/secondary) can be retrieved either by sending an ATT find information request for the returned start group handle (returning the handle and the UUID for primary or secondary service) or by comparing the service to the list of all primary services.
* @brief Finds included services within the specified service. For each found included service, an le_service_event_t with type set to GATT_EVENT_INCLUDED_SERVICE_QUERY_RESULT will be generated and passed to the registered callback. The gatt_complete_event_t with type set to GATT_EVENT_QUERY_COMPLETE, marks the end of discovery. Information about included service type (primary/secondary) can be retrieved either by sending an ATT find information request for the returned start group handle (returning the handle and the UUID for primary or secondary service) or by comparing the service to the list of all primary services.
*/
uint8_t gatt_client_find_included_services_for_service(uint16_t gatt_client_id, uint16_t con_handle, le_service_t *service);
/**
* @brief Discovers all characteristics within the specified service. For each found characteristic, an le_characteristics_event_t with type set to GATT_CHARACTERISTIC_QUERY_RESULT will be generated and passed to the registered callback. The gatt_complete_event_t with type set to GATT_QUERY_COMPLETE, marks the end of discovery.
* @brief Discovers all characteristics within the specified service. For each found characteristic, an le_characteristics_event_t with type set to GATT_EVENT_CHARACTERISTIC_QUERY_RESULT will be generated and passed to the registered callback. The gatt_complete_event_t with type set to GATT_EVENT_QUERY_COMPLETE, marks the end of discovery.
*/
uint8_t gatt_client_discover_characteristics_for_service(uint16_t gatt_client_id, uint16_t con_handle, le_service_t *service);
/**
* @brief The following four functions are used to discover all characteristics within the specified service or handle range, and return those that match the given UUID. For each found characteristic, an le_characteristic_event_t with type set to GATT_CHARACTERISTIC_QUERY_RESULT will be generated and passed to the registered callback. The gatt_complete_event_t with type set to GATT_QUERY_COMPLETE, marks the end of discovery.
* @brief The following four functions are used to discover all characteristics within the specified service or handle range, and return those that match the given UUID. For each found characteristic, an le_characteristic_event_t with type set to GATT_EVENT_CHARACTERISTIC_QUERY_RESULT will be generated and passed to the registered callback. The gatt_complete_event_t with type set to GATT_EVENT_QUERY_COMPLETE, marks the end of discovery.
*/
uint8_t gatt_client_discover_characteristics_for_handle_range_by_uuid16(uint16_t gatt_client_id, uint16_t con_handle, uint16_t start_handle, uint16_t end_handle, uint16_t uuid16);
uint8_t gatt_client_discover_characteristics_for_handle_range_by_uuid128(uint16_t gatt_client_id, uint16_t con_handle, uint16_t start_handle, uint16_t end_handle, uint8_t * uuid);
@ -269,24 +269,24 @@ uint8_t gatt_client_discover_characteristics_for_service_by_uuid16 (uint16_t gat
uint8_t gatt_client_discover_characteristics_for_service_by_uuid128(uint16_t gatt_client_id, uint16_t con_handle, le_service_t *service, uint8_t * uuid128);
/**
* @brief Discovers attribute handle and UUID of a characteristic descriptor within the specified characteristic. For each found descriptor, an le_characteristic_descriptor_event_t with type set to GATT_ALL_CHARACTERISTIC_DESCRIPTORS_QUERY_RESULT will be generated and passed to the registered callback. The gatt_complete_event_t with type set to GATT_QUERY_COMPLETE, marks the end of discovery.
* @brief Discovers attribute handle and UUID of a characteristic descriptor within the specified characteristic. For each found descriptor, an le_characteristic_descriptor_event_t with type set to GATT_EVENT_ALL_CHARACTERISTIC_DESCRIPTORS_QUERY_RESULT will be generated and passed to the registered callback. The gatt_complete_event_t with type set to GATT_EVENT_QUERY_COMPLETE, marks the end of discovery.
*/
uint8_t gatt_client_discover_characteristic_descriptors(uint16_t gatt_client_id, uint16_t con_handle, le_characteristic_t *characteristic);
/**
* @brief Reads the characteristic value using the characteristic's value handle. If the characteristic value is found, an le_characteristic_value_event_t with type set to GATT_CHARACTERISTIC_VALUE_QUERY_RESULT will be generated and passed to the registered callback. The gatt_complete_event_t with type set to GATT_QUERY_COMPLETE, marks the end of read.
* @brief Reads the characteristic value using the characteristic's value handle. If the characteristic value is found, an le_characteristic_value_event_t with type set to GATT_EVENT_CHARACTERISTIC_VALUE_QUERY_RESULT will be generated and passed to the registered callback. The gatt_complete_event_t with type set to GATT_EVENT_QUERY_COMPLETE, marks the end of read.
*/
uint8_t gatt_client_read_value_of_characteristic(uint16_t gatt_client_id, uint16_t con_handle, le_characteristic_t *characteristic);
uint8_t gatt_client_read_value_of_characteristic_using_value_handle(uint16_t gatt_client_id, uint16_t con_handle, uint16_t characteristic_value_handle);
/**
* @brief Reads the characteric value of all characteristics with the uuid. For each found, an le_characteristic_value_event_t with type set to GATT_CHARACTERISTIC_VALUE_QUERY_RESULT will be generated and passed to the registered callback. The gatt_complete_event_t with type set to GATT_QUERY_COMPLETE, marks the end of read.
* @brief Reads the characteric value of all characteristics with the uuid. For each found, an le_characteristic_value_event_t with type set to GATT_EVENT_CHARACTERISTIC_VALUE_QUERY_RESULT will be generated and passed to the registered callback. The gatt_complete_event_t with type set to GATT_EVENT_QUERY_COMPLETE, marks the end of read.
*/
uint8_t gatt_client_read_value_of_characteristics_by_uuid16(uint16_t gatt_client_id, uint16_t con_handle, uint16_t start_handle, uint16_t end_handle, uint16_t uuid16);
uint8_t gatt_client_read_value_of_characteristics_by_uuid128(uint16_t gatt_client_id, uint16_t con_handle, uint16_t start_handle, uint16_t end_handle, uint8_t * uuid128);
/**
* @brief Reads the long characteristic value using the characteristic's value handle. The value will be returned in several blobs. For each blob, an le_characteristic_value_event_t with type set to GATT_CHARACTERISTIC_VALUE_QUERY_RESULT and updated value offset will be generated and passed to the registered callback. The gatt_complete_event_t with type set to GATT_QUERY_COMPLETE, mark the end of read.
* @brief Reads the long characteristic value using the characteristic's value handle. The value will be returned in several blobs. For each blob, an le_characteristic_value_event_t with type set to GATT_EVENT_CHARACTERISTIC_VALUE_QUERY_RESULT and updated value offset will be generated and passed to the registered callback. The gatt_complete_event_t with type set to GATT_EVENT_QUERY_COMPLETE, mark the end of read.
*/
uint8_t gatt_client_read_long_value_of_characteristic(uint16_t gatt_client_id, uint16_t con_handle, le_characteristic_t *characteristic);
uint8_t gatt_client_read_long_value_of_characteristic_using_value_handle(uint16_t gatt_client_id, uint16_t con_handle, uint16_t characteristic_value_handle);
@ -310,32 +310,32 @@ uint8_t gatt_client_write_value_of_characteristic_without_response(uint16_t gatt
uint8_t gatt_client_signed_write_without_response(uint16_t gatt_client_id, uint16_t con_handle, uint16_t handle, uint16_t message_len, uint8_t * message);
/**
* @brief Writes the characteristic value using the characteristic's value handle. The gatt_complete_event_t with type set to GATT_QUERY_COMPLETE, marks the end of write. The write is successfully performed, if the event's status field is set to 0.
* @brief Writes the characteristic value using the characteristic's value handle. The gatt_complete_event_t with type set to GATT_EVENT_QUERY_COMPLETE, marks the end of write. The write is successfully performed, if the event's status field is set to 0.
*/
uint8_t gatt_client_write_value_of_characteristic(uint16_t gatt_client_id, uint16_t con_handle, uint16_t characteristic_value_handle, uint16_t length, uint8_t * data);
uint8_t gatt_client_write_long_value_of_characteristic(uint16_t gatt_client_id, uint16_t con_handle, uint16_t characteristic_value_handle, uint16_t length, uint8_t * data);
uint8_t gatt_client_write_long_value_of_characteristic_with_offset(uint16_t gatt_client_id, uint16_t con_handle, uint16_t characteristic_value_handle, uint16_t offset, uint16_t length, uint8_t * data);
/**
* @brief Writes of the long characteristic value using the characteristic's value handle. It uses server response to validate that the write was correctly received. The gatt_complete_event_t with type set to GATT_QUERY_COMPLETE marks the end of write. The write is successfully performed, if the event's status field is set to 0.
* @brief Writes of the long characteristic value using the characteristic's value handle. It uses server response to validate that the write was correctly received. The gatt_complete_event_t with type set to GATT_EVENT_QUERY_COMPLETE marks the end of write. The write is successfully performed, if the event's status field is set to 0.
*/
uint8_t gatt_client_reliable_write_long_value_of_characteristic(uint16_t gatt_client_id, uint16_t con_handle, uint16_t characteristic_value_handle, uint16_t length, uint8_t * data);
/**
* @brief Reads the characteristic descriptor using its handle. If the characteristic descriptor is found, an le_characteristic_descriptor_event_t with type set to GATT_CHARACTERISTIC_DESCRIPTOR_QUERY_RESULT will be generated and passed to the registered callback. The gatt_complete_event_t with type set to GATT_QUERY_COMPLETE, marks the end of read.
* @brief Reads the characteristic descriptor using its handle. If the characteristic descriptor is found, an le_characteristic_descriptor_event_t with type set to GATT_EVENT_CHARACTERISTIC_DESCRIPTOR_QUERY_RESULT will be generated and passed to the registered callback. The gatt_complete_event_t with type set to GATT_EVENT_QUERY_COMPLETE, marks the end of read.
*/
uint8_t gatt_client_read_characteristic_descriptor(uint16_t gatt_client_id, uint16_t con_handle, le_characteristic_descriptor_t * descriptor);
uint8_t gatt_client_read_characteristic_descriptor_using_descriptor_handle(uint16_t gatt_client_id, uint16_t con_handle, uint16_t descriptor_handle);
/**
* @brief Reads the long characteristic descriptor using its handle. It will be returned in several blobs. For each blob, an le_characteristic_descriptor_event_t with type set to GATT_CHARACTERISTIC_DESCRIPTOR_QUERY_RESULT will be generated and passed to the registered callback. The gatt_complete_event_t with type set to GATT_QUERY_COMPLETE, marks the end of read.
* @brief Reads the long characteristic descriptor using its handle. It will be returned in several blobs. For each blob, an le_characteristic_descriptor_event_t with type set to GATT_EVENT_CHARACTERISTIC_DESCRIPTOR_QUERY_RESULT will be generated and passed to the registered callback. The gatt_complete_event_t with type set to GATT_EVENT_QUERY_COMPLETE, marks the end of read.
*/
uint8_t gatt_client_read_long_characteristic_descriptor(uint16_t gatt_client_id, uint16_t con_handle, le_characteristic_descriptor_t * descriptor);
uint8_t gatt_client_read_long_characteristic_descriptor_using_descriptor_handle(uint16_t gatt_client_id, uint16_t con_handle, uint16_t descriptor_handle);
uint8_t gatt_client_read_long_characteristic_descriptor_using_descriptor_handle_with_offset(uint16_t gatt_client_id, uint16_t con_handle, uint16_t descriptor_handle, uint16_t offset);
/**
* @brief Writes the characteristic descriptor using its handle. The gatt_complete_event_t with type set to GATT_QUERY_COMPLETE, marks the end of write. The write is successfully performed, if the event's status field is set to 0.
* @brief Writes the characteristic descriptor using its handle. The gatt_complete_event_t with type set to GATT_EVENT_QUERY_COMPLETE, marks the end of write. The write is successfully performed, if the event's status field is set to 0.
*/
uint8_t gatt_client_write_characteristic_descriptor(uint16_t gatt_client_id, uint16_t con_handle, le_characteristic_descriptor_t * descriptor, uint16_t length, uint8_t * data);
uint8_t gatt_client_write_characteristic_descriptor_using_descriptor_handle(uint16_t gatt_client_id, uint16_t con_handle, uint16_t descriptor_handle, uint16_t length, uint8_t * data);

View File

@ -582,7 +582,7 @@ static void sm_address_resolution_start_lookup(uint8_t addr_type, uint16_t handl
sm_address_resolution_test = 0;
sm_address_resolution_mode = mode;
sm_address_resolution_context = context;
sm_notify_client_base(SM_IDENTITY_RESOLVING_STARTED, handle, addr_type, addr);
sm_notify_client_base(SM_EVENT_IDENTITY_RESOLVING_STARTED, handle, addr_type, addr);
}
int sm_address_resolution_lookup(uint8_t address_type, bd_addr_t address){
@ -791,26 +791,26 @@ static void sm_trigger_user_response(sm_connection_t * sm_conn){
case PK_RESP_INPUT:
if (sm_conn->sm_role){
setup->sm_user_response = SM_USER_RESPONSE_PENDING;
sm_notify_client_base(SM_PASSKEY_INPUT_NUMBER, sm_conn->sm_handle, sm_conn->sm_peer_addr_type, sm_conn->sm_peer_address);
sm_notify_client_base(SM_EVENT_PASSKEY_INPUT_NUMBER, sm_conn->sm_handle, sm_conn->sm_peer_addr_type, sm_conn->sm_peer_address);
} else {
sm_notify_client_passkey(SM_PASSKEY_DISPLAY_NUMBER, sm_conn->sm_handle, sm_conn->sm_peer_addr_type, sm_conn->sm_peer_address, READ_NET_32(setup->sm_tk, 12));
sm_notify_client_passkey(SM_EVENT_PASSKEY_DISPLAY_NUMBER, sm_conn->sm_handle, sm_conn->sm_peer_addr_type, sm_conn->sm_peer_address, READ_NET_32(setup->sm_tk, 12));
}
break;
case PK_INIT_INPUT:
if (sm_conn->sm_role){
sm_notify_client_passkey(SM_PASSKEY_DISPLAY_NUMBER, sm_conn->sm_handle, sm_conn->sm_peer_addr_type, sm_conn->sm_peer_address, READ_NET_32(setup->sm_tk, 12));
sm_notify_client_passkey(SM_EVENT_PASSKEY_DISPLAY_NUMBER, sm_conn->sm_handle, sm_conn->sm_peer_addr_type, sm_conn->sm_peer_address, READ_NET_32(setup->sm_tk, 12));
} else {
setup->sm_user_response = SM_USER_RESPONSE_PENDING;
sm_notify_client_base(SM_PASSKEY_INPUT_NUMBER, sm_conn->sm_handle, sm_conn->sm_peer_addr_type, sm_conn->sm_peer_address);
sm_notify_client_base(SM_EVENT_PASSKEY_INPUT_NUMBER, sm_conn->sm_handle, sm_conn->sm_peer_addr_type, sm_conn->sm_peer_address);
}
break;
case OK_BOTH_INPUT:
setup->sm_user_response = SM_USER_RESPONSE_PENDING;
sm_notify_client_base(SM_PASSKEY_INPUT_NUMBER, sm_conn->sm_handle, sm_conn->sm_peer_addr_type, sm_conn->sm_peer_address);
sm_notify_client_base(SM_EVENT_PASSKEY_INPUT_NUMBER, sm_conn->sm_handle, sm_conn->sm_peer_addr_type, sm_conn->sm_peer_address);
break;
case JUST_WORKS:
setup->sm_user_response = SM_USER_RESPONSE_PENDING;
sm_notify_client_base(SM_JUST_WORKS_REQUEST, sm_conn->sm_handle, sm_conn->sm_peer_addr_type, sm_conn->sm_peer_address);
sm_notify_client_base(SM_EVENT_JUST_WORKS_REQUEST, sm_conn->sm_handle, sm_conn->sm_peer_addr_type, sm_conn->sm_peer_address);
break;
case OOB:
// client already provided OOB data, let's skip notification.
@ -975,10 +975,10 @@ static void sm_address_resolution_handle_event(address_resolution_event_t event)
switch (event){
case ADDRESS_RESOLUTION_SUCEEDED:
sm_notify_client_index(SM_IDENTITY_RESOLVING_SUCCEEDED, handle, sm_address_resolution_addr_type, sm_address_resolution_address, matched_device_id);
sm_notify_client_index(SM_EVENT_IDENTITY_RESOLVING_SUCCEEDED, handle, sm_address_resolution_addr_type, sm_address_resolution_address, matched_device_id);
break;
case ADDRESS_RESOLUTION_FAILED:
sm_notify_client_base(SM_IDENTITY_RESOLVING_FAILED, handle, sm_address_resolution_addr_type, sm_address_resolution_address);
sm_notify_client_base(SM_EVENT_IDENTITY_RESOLVING_FAILED, handle, sm_address_resolution_addr_type, sm_address_resolution_address);
break;
}
}
@ -2177,7 +2177,7 @@ static void sm_packet_handler(uint8_t packet_type, uint16_t handle, uint8_t *pac
// notify client to hide shown passkey
if (setup->sm_stk_generation_method == PK_INIT_INPUT){
sm_notify_client_base(SM_PASSKEY_DISPLAY_CANCEL, sm_conn->sm_handle, sm_conn->sm_peer_addr_type, sm_conn->sm_peer_address);
sm_notify_client_base(SM_EVENT_PASSKEY_DISPLAY_CANCEL, sm_conn->sm_handle, sm_conn->sm_peer_addr_type, sm_conn->sm_peer_address);
}
// handle user cancel pairing?
@ -2438,14 +2438,14 @@ void sm_authorization_decline(uint16_t handle){
sm_connection_t * sm_conn = sm_get_connection_for_handle(handle);
if (!sm_conn) return; // wrong connection
sm_conn->sm_connection_authorization_state = AUTHORIZATION_DECLINED;
sm_notify_client_authorization(SM_AUTHORIZATION_RESULT, sm_conn->sm_handle, sm_conn->sm_peer_addr_type, sm_conn->sm_peer_address, 0);
sm_notify_client_authorization(SM_EVENT_AUTHORIZATION_RESULT, sm_conn->sm_handle, sm_conn->sm_peer_addr_type, sm_conn->sm_peer_address, 0);
}
void sm_authorization_grant(uint16_t handle){
sm_connection_t * sm_conn = sm_get_connection_for_handle(handle);
if (!sm_conn) return; // wrong connection
sm_conn->sm_connection_authorization_state = AUTHORIZATION_GRANTED;
sm_notify_client_authorization(SM_AUTHORIZATION_RESULT, sm_conn->sm_handle, sm_conn->sm_peer_addr_type, sm_conn->sm_peer_address, 1);
sm_notify_client_authorization(SM_EVENT_AUTHORIZATION_RESULT, sm_conn->sm_handle, sm_conn->sm_peer_addr_type, sm_conn->sm_peer_address, 1);
}
// GAP Bonding API

View File

@ -393,21 +393,20 @@
* @param status
* @param service_record_handle
*/
#define SDP_SERVICE_REGISTERED 0x90
#define SDP_EVENT_SERVICE_REGISTERED 0x90
/**
* @format 1
* @param status
*/
#define SDP_QUERY_COMPLETE 0x91
#define SDP_EVENT_QUERY_COMPLETE 0x91
/**
* @format 1T
* @param rfcomm_channel
* @param name
* @brief SDP_QUERY_RFCOMM_SERVICE 0x92
*/
#define SDP_QUERY_RFCOMM_SERVICE 0x92
#define SDP_EVENT_QUERY_RFCOMM_SERVICE 0x92
/**
* @format 22221
@ -417,7 +416,7 @@
* @param data_offset
* @param data
*/
#define SDP_QUERY_ATTRIBUTE_BYTE 0x93
#define SDP_EVENT_QUERY_ATTRIBUTE_BYTE 0x93
/**
* @format 22LV
@ -426,7 +425,7 @@
* @param attribute_length
* @param attribute_value
*/
#define SDP_QUERY_ATTRIBUTE_VALUE 0x94
#define SDP_EVENT_QUERY_ATTRIBUTE_VALUE 0x94
/**
* @format 224
@ -435,28 +434,28 @@
* @param record_handle
* @note Not provided by daemon, only used for internal testing
*/
#define SDP_QUERY_SERVICE_RECORD_HANDLE 0x95
#define SDP_EVENT_QUERY_SERVICE_RECORD_HANDLE 0x95
/**
* @format H1
* @param handle
* @param status
*/
#define GATT_QUERY_COMPLETE 0xA0
#define GATT_EVENT_QUERY_COMPLETE 0xA0
/**
* @format HX
* @param handle
* @param service
*/
#define GATT_SERVICE_QUERY_RESULT 0xA1
#define GATT_EVENT_SERVICE_QUERY_RESULT 0xA1
/**
* @format HY
* @param handle
* @param characteristic
*/
#define GATT_CHARACTERISTIC_QUERY_RESULT 0xA2
#define GATT_EVENT_CHARACTERISTIC_QUERY_RESULT 0xA2
/**
* @format H2X
@ -464,14 +463,14 @@
* @param include_handle
* @param service
*/
#define GATT_INCLUDED_SERVICE_QUERY_RESULT 0xA3
#define GATT_EVENT_INCLUDED_SERVICE_QUERY_RESULT 0xA3
/**
* @format HZ
* @param handle
* @param characteristic_descriptor
*/
#define GATT_ALL_CHARACTERISTIC_DESCRIPTORS_QUERY_RESULT 0xA4
#define GATT_EVENT_ALL_CHARACTERISTIC_DESCRIPTORS_QUERY_RESULT 0xA4
/**
* @format H2LV
@ -480,7 +479,7 @@
* @param value_length
* @param value
*/
#define GATT_CHARACTERISTIC_VALUE_QUERY_RESULT 0xA5
#define GATT_EVENT_CHARACTERISTIC_VALUE_QUERY_RESULT 0xA5
/**
* @format H22LV
@ -490,7 +489,7 @@
* @param value_length
* @param value
*/
#define GATT_LONG_CHARACTERISTIC_VALUE_QUERY_RESULT 0xA6
#define GATT_EVENT_LONG_CHARACTERISTIC_VALUE_QUERY_RESULT 0xA6
/**
* @format H2LV
@ -499,7 +498,7 @@
* @param value_length
* @param value
*/
#define GATT_NOTIFICATION 0xA7
#define GATT_EVENT_NOTIFICATION 0xA7
/**
* @format H2LV
@ -508,7 +507,7 @@
* @param value_length
* @param value
*/
#define GATT_INDICATION 0xA8
#define GATT_EVENT_INDICATION 0xA8
/**
* @format H2LV
@ -516,7 +515,7 @@
* @param descriptor_length
* @param descriptor
*/
#define GATT_CHARACTERISTIC_DESCRIPTOR_QUERY_RESULT 0xA9
#define GATT_EVENT_CHARACTERISTIC_DESCRIPTOR_QUERY_RESULT 0xA9
/**
* @format H2LV
@ -525,24 +524,24 @@
* @param descriptor_length
* @param descriptor
*/
#define GATT_LONG_CHARACTERISTIC_DESCRIPTOR_QUERY_RESULT 0xAA
#define GATT_EVENT_LONG_CHARACTERISTIC_DESCRIPTOR_QUERY_RESULT 0xAA
/**
* @format H2
* @param handle
* @param MTU
*/
#define GATT_MTU 0xAB
#define GATT_EVENT_MTU 0xAB
/**
* @format H2
* @param handle
* @param MTU
*/
#define ATT_MTU_EXCHANGE_COMPLETE 0xB5
#define ATT_EVENT_MTU_EXCHANGE_COMPLETE 0xB5
// data: event(8), len(8), status (8), hci_handle (16), attribute_handle (16)
#define ATT_HANDLE_VALUE_INDICATION_COMPLETE 0xB6
#define ATT_EVENT_HANDLE_VALUE_INDICATION_COMPLETE 0xB6
// data: event(8), len(8), status (8), bnep service uuid (16)
@ -566,7 +565,7 @@
* @param addr_type
* @param address
*/
#define SM_JUST_WORKS_REQUEST 0xD0
#define SM_EVENT_JUST_WORKS_REQUEST 0xD0
/**
* @format H1B
@ -574,7 +573,7 @@
* @param addr_type
* @param address
*/
#define SM_JUST_WORKS_CANCEL 0xD1
#define SM_EVENT_JUST_WORKS_CANCEL 0xD1
/**
* @format H1B4
@ -583,7 +582,7 @@
* @param address
* @param passkey
*/
#define SM_PASSKEY_DISPLAY_NUMBER 0xD2
#define SM_EVENT_PASSKEY_DISPLAY_NUMBER 0xD2
/**
* @format H1B
@ -591,7 +590,7 @@
* @param addr_type
* @param address
*/
#define SM_PASSKEY_DISPLAY_CANCEL 0xD3
#define SM_EVENT_PASSKEY_DISPLAY_CANCEL 0xD3
/**
* @format H1B421
@ -599,7 +598,7 @@
* @param addr_type
* @param address
*/
#define SM_PASSKEY_INPUT_NUMBER 0xD4
#define SM_EVENT_PASSKEY_INPUT_NUMBER 0xD4
/**
* @format H1B
@ -607,7 +606,7 @@
* @param addr_type
* @param address
*/
#define SM_PASSKEY_INPUT_CANCEL 0xD5
#define SM_EVENT_PASSKEY_INPUT_CANCEL 0xD5
/**
* @format H1B
@ -615,7 +614,7 @@
* @param addr_type
* @param address
*/
#define SM_IDENTITY_RESOLVING_STARTED 0xD6
#define SM_EVENT_IDENTITY_RESOLVING_STARTED 0xD6
/**
* @format H1B
@ -623,7 +622,7 @@
* @param addr_type
* @param address
*/
#define SM_IDENTITY_RESOLVING_FAILED 0xD7
#define SM_EVENT_IDENTITY_RESOLVING_FAILED 0xD7
/**
* @format H1B2
@ -632,7 +631,7 @@
* @param address
* @param le_device_db_index
*/
#define SM_IDENTITY_RESOLVING_SUCCEEDED 0xD8
#define SM_EVENT_IDENTITY_RESOLVING_SUCCEEDED 0xD8
/**
* @format H1B
@ -640,7 +639,7 @@
* @param addr_type
* @param address
*/
#define SM_AUTHORIZATION_REQUEST 0xD9
#define SM_EVENT_AUTHORIZATION_REQUEST 0xD9
/**
* @format H1B1
@ -649,15 +648,15 @@
* @param address
* @param authorization_result
*/
#define SM_AUTHORIZATION_RESULT 0xDA
#define SM_EVENT_AUTHORIZATION_RESULT 0xDA
// GAP
// data: event(8), len(8), hci_handle (16), security_level (8)
#define GAP_SECURITY_LEVEL 0xE0
#define GAP_EVENT_SECURITY_LEVEL 0xE0
// data: event(8), len(8), status (8), bd_addr(48)
#define GAP_DEDICATED_BONDING_COMPLETED 0xE1
#define GAP_EVENT_DEDICATED_BONDING_COMPLETED 0xE1
/**
* @format 11B1JV
@ -668,7 +667,7 @@
* @param data_length
* @param data
*/
#define GAP_LE_ADVERTISING_REPORT 0xE2
#define GAP_LE_EVENT_ADVERTISING_REPORT 0xE2
#define HCI_EVENT_HSP_META 0xE8
@ -713,7 +712,7 @@
* @format H
* @param handle
*/
#define ANCS_CLIENT_CONNECTED 0xF0
#define ANCS_EVENT_CLIENT_CONNECTED 0xF0
/**
* @format H2T
@ -721,13 +720,13 @@
* @param attribute_id
* @param text
*/
#define ANCS_CLIENT_NOTIFICATION 0xF1
#define ANCS_EVENT_CLIENT_NOTIFICATION 0xF1
/**
* @format H
* @param handle
*/
#define ANCS_CLIENT_DISCONNECTED 0xF2
#define ANCS_EVENT_CLIENT_DISCONNECTED 0xF2
// #define HCI_EVENT_HFP_META 0xxx
// #define HCI_EVENT_GATT_META 0xxx

View File

@ -418,21 +418,21 @@ static hfp_connection_t * connection_doing_sdp_query = NULL;
static void handle_query_rfcomm_event(uint8_t packet_type, uint8_t *packet, uint16_t size, void * context){
hfp_connection_t * connection = connection_doing_sdp_query;
if ( connection->state != HFP_W4_SDP_QUERY_COMPLETE) return;
if ( connection->state != HFP_W4_SDP_EVENT_QUERY_COMPLETE) return;
switch (packet[0]){
case SDP_QUERY_RFCOMM_SERVICE:
case SDP_EVENT_QUERY_RFCOMM_SERVICE:
if (!connection) {
log_error("handle_query_rfcomm_event alloc connection for RFCOMM port %u failed", sdp_query_rfcomm_service_event_get_rfcomm_channel(packet));
return;
}
connection->rfcomm_channel_nr = sdp_query_rfcomm_service_event_get_rfcomm_channel(packet);
break;
case SDP_QUERY_COMPLETE:
case SDP_EVENT_QUERY_COMPLETE:
connection_doing_sdp_query = NULL;
if (connection->rfcomm_channel_nr > 0){
connection->state = HFP_W4_RFCOMM_CONNECTED;
log_info("HFP: SDP_QUERY_COMPLETE context %p, addr %s, state %d", connection, bd_addr_to_str( connection->remote_addr), connection->state);
log_info("HFP: SDP_EVENT_QUERY_COMPLETE context %p, addr %s, state %d", connection, bd_addr_to_str( connection->remote_addr), connection->state);
rfcomm_create_channel(connection->remote_addr, connection->rfcomm_channel_nr, NULL);
break;
}
@ -1295,7 +1295,7 @@ void hfp_establish_service_level_connection(bd_addr_t bd_addr, uint16_t service_
return;
case HFP_IDLE:
memcpy(context->remote_addr, bd_addr, 6);
context->state = HFP_W4_SDP_QUERY_COMPLETE;
context->state = HFP_W4_SDP_EVENT_QUERY_COMPLETE;
connection_doing_sdp_query = context;
context->service_uuid = service_uuid;
sdp_query_rfcomm_channel_and_name_for_uuid(context->remote_addr, service_uuid);

View File

@ -297,7 +297,7 @@ typedef enum {
typedef enum {
HFP_IDLE = 0, //0
HFP_SDP_QUERY_RFCOMM_CHANNEL,
HFP_W4_SDP_QUERY_COMPLETE,
HFP_W4_SDP_EVENT_QUERY_COMPLETE,
HFP_W4_RFCOMM_CONNECTED,
HFP_EXCHANGE_SUPPORTED_FEATURES,

View File

@ -97,7 +97,7 @@ static uint8_t ag_support_custom_commands = 0;
typedef enum {
HSP_IDLE,
HSP_SDP_QUERY_RFCOMM_CHANNEL,
HSP_W4_SDP_QUERY_COMPLETE,
HSP_W4_SDP_EVENT_QUERY_COMPLETE,
HSP_W4_RFCOMM_CONNECTED,
HSP_W4_RING_ANSWER,
HSP_W4_USER_ACTION,
@ -367,7 +367,7 @@ static void hsp_run(void){
switch (hsp_state){
case HSP_SDP_QUERY_RFCOMM_CHANNEL:
hsp_state = HSP_W4_SDP_QUERY_COMPLETE;
hsp_state = HSP_W4_SDP_EVENT_QUERY_COMPLETE;
printf("Start SDP query %s, 0x%02x\n", bd_addr_to_str(remote), SDP_HSP);
sdp_query_rfcomm_channel_and_name_for_uuid(remote, SDP_HSP);
break;
@ -627,11 +627,11 @@ 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){
switch (event->type){
case SDP_QUERY_RFCOMM_SERVICE:
case SDP_EVENT_QUERY_RFCOMM_SERVICE:
channel_nr = sdp_query_rfcomm_service_event_get_rfcomm_channel(packet);
printf("** Service name: '%s', RFCOMM port %u\n", sdp_query_rfcomm_service_event_get_name(packet), channel_nr);
break;
case SDP_QUERY_COMPLETE:
case SDP_EVENT_QUERY_COMPLETE:
if (channel_nr > 0){
hsp_state = HSP_W4_RFCOMM_CONNECTED;
printf("RFCOMM create channel. state %d\n", HSP_W4_RFCOMM_CONNECTED);

View File

@ -92,7 +92,7 @@ static uint8_t hs_outgoing_connection = 0;
typedef enum {
HSP_IDLE,
HSP_SDP_QUERY_RFCOMM_CHANNEL,
HSP_W4_SDP_QUERY_COMPLETE,
HSP_W4_SDP_EVENT_QUERY_COMPLETE,
HSP_W4_RFCOMM_CONNECTED,
HSP_W4_USER_ACTION,
HSP_W2_CONNECT_SCO,
@ -328,7 +328,7 @@ static void hsp_run(void){
switch (hsp_state){
case HSP_SDP_QUERY_RFCOMM_CHANNEL:
hsp_state = HSP_W4_SDP_QUERY_COMPLETE;
hsp_state = HSP_W4_SDP_EVENT_QUERY_COMPLETE;
sdp_query_rfcomm_channel_and_name_for_uuid(remote, SDP_Headset_AG);
break;
@ -575,11 +575,11 @@ 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){
switch (packet[0]){
case SDP_QUERY_RFCOMM_SERVICE:
case SDP_EVENT_QUERY_RFCOMM_SERVICE:
channel_nr = sdp_query_rfcomm_service_event_get_rfcomm_channel(packet);
printf("** Service name: '%s', RFCOMM port %u\n", sdp_query_rfcomm_service_event_get_name(packet), channel_nr);
break;
case SDP_QUERY_COMPLETE:
case SDP_EVENT_QUERY_COMPLETE:
if (channel_nr > 0){
hsp_state = HSP_W4_RFCOMM_CONNECTED;
printf("RFCOMM create channel.\n");

View File

@ -118,7 +118,7 @@ void sdp_parser_register_callback(void (*sdp_callback)(uint8_t packet_type, uint
static void emit_value_byte(uint8_t event_byte){
uint8_t event[11];
event[0] = SDP_QUERY_ATTRIBUTE_VALUE;
event[0] = SDP_EVENT_QUERY_ATTRIBUTE_VALUE;
event[1] = 9;
bt_store_16(event, 2, record_counter);
bt_store_16(event, 4, attribute_id);
@ -254,7 +254,7 @@ void sdp_parser_handle_service_search(uint8_t * data, uint16_t total_count, uint
record_handle = READ_NET_32(data, i*4);
record_counter++;
uint8_t event[10];
event[0] = SDP_QUERY_SERVICE_RECORD_HANDLE;
event[0] = SDP_EVENT_QUERY_SERVICE_RECORD_HANDLE;
event[1] = 8;
bt_store_16(event, 2, total_count);
bt_store_16(event, 4, record_counter);
@ -266,7 +266,7 @@ void sdp_parser_handle_service_search(uint8_t * data, uint16_t total_count, uint
void sdp_parser_handle_done(uint8_t status){
uint8_t event[3];
event[0] = SDP_QUERY_COMPLETE;
event[0] = SDP_EVENT_QUERY_COMPLETE;
event[1] = 1;
event[2] = status;
(*sdp_query_callback)(HCI_EVENT_PACKET, event, sizeof(event));

View File

@ -98,7 +98,7 @@ static void dummy_notify_app(uint8_t packet_type, uint8_t *packet, uint16_t size
static void emit_service(void){
uint8_t event[3+SDP_SERVICE_NAME_LEN+1];
event[0] = SDP_QUERY_RFCOMM_SERVICE;
event[0] = SDP_EVENT_QUERY_RFCOMM_SERVICE;
event[1] = sdp_service_name_len + 1;
event[2] = sdp_rfcomm_channel_nr;
memcpy(&event[3], sdp_service_name, sdp_service_name_len);
@ -258,7 +258,7 @@ static void handleServiceNameData(uint32_t attribute_value_length, uint32_t data
static void handle_sdp_parser_event(uint8_t packet_type, uint8_t *packet, uint16_t size){
switch (packet[0]){
case SDP_QUERY_SERVICE_RECORD_HANDLE:
case SDP_EVENT_QUERY_SERVICE_RECORD_HANDLE:
// handle service without a name
if (sdp_rfcomm_channel_nr){
emit_service();
@ -268,7 +268,7 @@ static void handle_sdp_parser_event(uint8_t packet_type, uint8_t *packet, uint16
sdp_rfcomm_channel_nr = 0;
sdp_service_name[0] = 0;
break;
case SDP_QUERY_ATTRIBUTE_VALUE:
case SDP_EVENT_QUERY_ATTRIBUTE_VALUE:
// 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),
// sdp_query_attribute_byte_event_get_data_offset(packet), sdp_query_attribute_byte_event_get_data(packet));
@ -290,7 +290,7 @@ static void handle_sdp_parser_event(uint8_t packet_type, uint8_t *packet, uint16
return;
}
break;
case SDP_QUERY_COMPLETE:
case SDP_EVENT_QUERY_COMPLETE:
// handle service without a name
if (sdp_rfcomm_channel_nr){
emit_service();

View File

@ -821,7 +821,7 @@ void le_handle_advertisement_report(uint8_t *packet, int size){
uint8_t data_length = packet[offset + 8];
uint8_t event_size = 10 + data_length;
int pos = 0;
event[pos++] = GAP_LE_ADVERTISING_REPORT;
event[pos++] = GAP_LE_EVENT_ADVERTISING_REPORT;
event[pos++] = event_size;
memcpy(&event[pos], &packet[offset], 1+1+6); // event type + address type + address
offset += 8;
@ -3048,7 +3048,7 @@ void hci_emit_security_level(hci_con_handle_t con_handle, gap_security_level_t l
log_info("hci_emit_security_level %u for handle %x", level, con_handle);
uint8_t event[5];
int pos = 0;
event[pos++] = GAP_SECURITY_LEVEL;
event[pos++] = GAP_EVENT_SECURITY_LEVEL;
event[pos++] = sizeof(event) - 2;
bt_store_16(event, 2, con_handle);
pos += 2;
@ -3061,7 +3061,7 @@ void hci_emit_dedicated_bonding_result(bd_addr_t address, uint8_t status){
log_info("hci_emit_dedicated_bonding_result %u ", status);
uint8_t event[9];
int pos = 0;
event[pos++] = GAP_DEDICATED_BONDING_COMPLETED;
event[pos++] = GAP_EVENT_DEDICATED_BONDING_COMPLETED;
event[pos++] = sizeof(event) - 2;
event[pos++] = status;
bt_flip_addr( &event[pos], address);

View File

@ -921,7 +921,7 @@ static void l2cap_event_handler(uint8_t *packet, uint16_t size){
}
break;
case GAP_SECURITY_LEVEL:
case GAP_EVENT_SECURITY_LEVEL:
handle = READ_BT_16(packet, 2);
log_info("l2cap - security level update");
btstack_linked_list_iterator_init(&it, &l2cap_channels);

View File

@ -149,15 +149,15 @@ static void handle_ble_client_event(uint8_t packet_type, uint8_t *packet, uint16
le_characteristic_t characteristic;
le_characteristic_descriptor_t descriptor;
switch (packet[0]){
case GATT_QUERY_COMPLETE:
case GATT_EVENT_QUERY_COMPLETE:
status = packet[4];
gatt_query_complete = 1;
if (status){
gatt_query_complete = 0;
printf("GATT_QUERY_COMPLETE failed with status 0x%02X\n", status);
printf("GATT_EVENT_QUERY_COMPLETE failed with status 0x%02X\n", status);
}
break;
case GATT_SERVICE_QUERY_RESULT:
case GATT_EVENT_SERVICE_QUERY_RESULT:
service.start_group_handle = READ_BT_16(packet, 4);
service.end_group_handle = READ_BT_16(packet, 6);
service.uuid16 = 0;
@ -168,7 +168,7 @@ static void handle_ble_client_event(uint8_t packet_type, uint8_t *packet, uint16
services[result_index++] = service;
result_counter++;
break;
case GATT_INCLUDED_SERVICE_QUERY_RESULT:
case GATT_EVENT_INCLUDED_SERVICE_QUERY_RESULT:
service.start_group_handle = READ_BT_16(packet, 6);
service.end_group_handle = READ_BT_16(packet, 8);
service.uuid16 = 0;
@ -179,7 +179,7 @@ static void handle_ble_client_event(uint8_t packet_type, uint8_t *packet, uint16
included_services[result_index++] = service;
result_counter++;
break;
case GATT_CHARACTERISTIC_QUERY_RESULT:
case GATT_EVENT_CHARACTERISTIC_QUERY_RESULT:
characteristic.start_handle = READ_BT_16(packet, 4);
characteristic.value_handle = READ_BT_16(packet, 6);
characteristic.end_handle = READ_BT_16(packet, 8);
@ -192,7 +192,7 @@ static void handle_ble_client_event(uint8_t packet_type, uint8_t *packet, uint16
characteristics[result_index++] = characteristic;
result_counter++;
break;
case GATT_ALL_CHARACTERISTIC_DESCRIPTORS_QUERY_RESULT:
case GATT_EVENT_ALL_CHARACTERISTIC_DESCRIPTORS_QUERY_RESULT:
descriptor.handle = READ_BT_16(packet, 4);
swap128(&packet[6], descriptor.uuid128);
if (sdp_has_blueooth_base_uuid(descriptor.uuid128)){
@ -201,14 +201,14 @@ static void handle_ble_client_event(uint8_t packet_type, uint8_t *packet, uint16
descriptors[result_index++] = descriptor;
result_counter++;
break;
case GATT_CHARACTERISTIC_VALUE_QUERY_RESULT:
case GATT_CHARACTERISTIC_DESCRIPTOR_QUERY_RESULT:
case GATT_EVENT_CHARACTERISTIC_VALUE_QUERY_RESULT:
case GATT_EVENT_CHARACTERISTIC_DESCRIPTOR_QUERY_RESULT:
CHECK_EQUAL(short_value_length, READ_BT_16(packet, 6));
CHECK_EQUAL_ARRAY((uint8_t*)short_value, &packet[8], short_value_length);
result_counter++;
break;
case GATT_LONG_CHARACTERISTIC_VALUE_QUERY_RESULT:
case GATT_LONG_CHARACTERISTIC_DESCRIPTOR_QUERY_RESULT:
case GATT_EVENT_LONG_CHARACTERISTIC_VALUE_QUERY_RESULT:
case GATT_EVENT_LONG_CHARACTERISTIC_DESCRIPTOR_QUERY_RESULT:
verify_blob(READ_BT_16(packet, 8), READ_BT_16(packet, 6), &packet[10]);
result_counter++;
break;

View File

@ -51,7 +51,7 @@ static void handle_hci_event(uint8_t packet_type, uint16_t channel, uint8_t *pac
le_central_start_scan();
break;
case GAP_LE_ADVERTISING_REPORT:{
case GAP_LE_EVENT_ADVERTISING_REPORT:{
advertisement_received = 1;
memcpy(advertisement_packet, packet, size);

View File

@ -117,7 +117,7 @@ int sm_cmac_ready(void){
return 1;
}
void sm_cmac_start(sm_key_t k, uint8_t opcode, uint16_t attribute_handle, uint16_t message_len, uint8_t * message, uint32_t sign_counter, void (*done_handler)(uint8_t hash[8])){
//sm_notify_client(SM_IDENTITY_RESOLVING_SUCCEEDED, sm_central_device_addr_type, sm_central_device_address, 0, sm_central_device_matched);
//sm_notify_client(SM_EVENT_IDENTITY_RESOLVING_SUCCEEDED, sm_central_device_addr_type, sm_central_device_address, 0, sm_central_device_matched);
}
int sm_le_device_index(uint16_t handle ){
return -1;

View File

@ -208,7 +208,7 @@ void sdp_query_rfcomm_register_callback(void(*sdp_app_callback)(uint8_t packet_t
static void sdp_query_complete_response(uint8_t status){
uint8_t event[3];
event[0] = SDP_QUERY_COMPLETE;
event[0] = SDP_EVENT_QUERY_COMPLETE;
event[1] = 1;
event[2] = status;
(*registered_sdp_app_callback)(HCI_EVENT_PACKET, event, sizeof(event), registered_sdp_app_context);
@ -217,7 +217,7 @@ static void sdp_query_complete_response(uint8_t status){
static void sdp_query_rfcomm_service_response(uint8_t status){
int sdp_service_name_len = strlen(sdp_rfcomm_service_name);
uint8_t event[3+SDP_SERVICE_NAME_LEN+1];
event[0] = SDP_QUERY_RFCOMM_SERVICE;
event[0] = SDP_EVENT_QUERY_RFCOMM_SERVICE;
event[1] = sdp_service_name_len + 1;
event[2] = sdp_rfcomm_channel_nr;
memcpy(&event[3], sdp_rfcomm_service_name, sdp_service_name_len);

View File

@ -353,7 +353,7 @@ static void app_packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *
printf("Disconnected from handle 0x%04x\n", aHandle);
break;
case SM_PASSKEY_INPUT_NUMBER:
case SM_EVENT_PASSKEY_INPUT_NUMBER:
// store peer address for input
printf("\nGAP Bonding: Enter 6 digit passkey: '");
fflush(stdout);
@ -361,30 +361,30 @@ static void app_packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *
ui_digits_for_passkey = 6;
break;
case SM_PASSKEY_DISPLAY_NUMBER:
case SM_EVENT_PASSKEY_DISPLAY_NUMBER:
printf("\nGAP Bonding: Display Passkey '%06u\n", READ_BT_32(packet, 11));
break;
case SM_PASSKEY_DISPLAY_CANCEL:
case SM_EVENT_PASSKEY_DISPLAY_CANCEL:
printf("\nGAP Bonding: Display cancel\n");
break;
case SM_JUST_WORKS_REQUEST:
case SM_EVENT_JUST_WORKS_REQUEST:
// auto-authorize connection if requested
sm_just_works_confirm(READ_BT_16(packet, 2));
printf("Just Works request confirmed\n");
break;
case SM_AUTHORIZATION_REQUEST:
case SM_EVENT_AUTHORIZATION_REQUEST:
// auto-authorize connection if requested
sm_authorization_grant(READ_BT_16(packet, 2));
break;
case GAP_LE_ADVERTISING_REPORT:
case GAP_LE_EVENT_ADVERTISING_REPORT:
handle_advertising_event(packet, size);
break;
case SM_IDENTITY_RESOLVING_SUCCEEDED:
case SM_EVENT_IDENTITY_RESOLVING_SUCCEEDED:
bt_flip_addr(event_address, &packet[5]);
// skip already detected pts
if (memcmp(event_address, current_pts_address, 6) == 0) break;
@ -442,7 +442,7 @@ static void handle_gatt_client_event(uint8_t packet_type, uint8_t *packet, uint1
uint8_t status;
switch(packet[0]){
case GATT_SERVICE_QUERY_RESULT:
case GATT_EVENT_SERVICE_QUERY_RESULT:
switch (central_state){
case CENTRAL_W4_PRIMARY_SERVICES:
case CENTRAL_ENTER_SERVICE_UUID_4_DISCOVER_CHARACTERISTICS:
@ -460,7 +460,7 @@ static void handle_gatt_client_event(uint8_t packet_type, uint8_t *packet, uint1
break;
}
break;
case GATT_INCLUDED_SERVICE_QUERY_RESULT:
case GATT_EVENT_INCLUDED_SERVICE_QUERY_RESULT:
value_handle = READ_BT_16(packet, 4);
extract_service(&service, &packet[6]);
printf("Included Service at 0x%004x: ", value_handle);
@ -468,7 +468,7 @@ static void handle_gatt_client_event(uint8_t packet_type, uint8_t *packet, uint1
printUUID(service.uuid128, service.uuid16);
printf("\n");
break;
case GATT_CHARACTERISTIC_QUERY_RESULT:
case GATT_EVENT_CHARACTERISTIC_QUERY_RESULT:
extract_characteristic(&characteristic, packet);
switch (central_state) {
case CENTRAL_W4_NAME_QUERY_COMPLETE:
@ -509,7 +509,7 @@ static void handle_gatt_client_event(uint8_t packet_type, uint8_t *packet, uint1
break;
}
break;
case GATT_ALL_CHARACTERISTIC_DESCRIPTORS_QUERY_RESULT: {
case GATT_EVENT_ALL_CHARACTERISTIC_DESCRIPTORS_QUERY_RESULT: {
uint16_t descriptor_handle = READ_BT_16(packet, 4);
uint8_t uuid128[16];
swap128(&packet[6], uuid128);
@ -522,7 +522,7 @@ static void handle_gatt_client_event(uint8_t packet_type, uint8_t *packet, uint1
}
break;
}
case GATT_CHARACTERISTIC_VALUE_QUERY_RESULT:
case GATT_EVENT_CHARACTERISTIC_VALUE_QUERY_RESULT:
value_handle = READ_BT_16(packet, 4);
value_length = READ_BT_16(packet, 6);
value = &packet[8];
@ -616,7 +616,7 @@ static void handle_gatt_client_event(uint8_t packet_type, uint8_t *packet, uint1
break;
}
break;
case GATT_LONG_CHARACTERISTIC_VALUE_QUERY_RESULT:
case GATT_EVENT_LONG_CHARACTERISTIC_VALUE_QUERY_RESULT:
value = &packet[10];
value_offset = READ_BT_16(packet, 6);
value_length = READ_BT_16(packet, 8);
@ -624,7 +624,7 @@ static void handle_gatt_client_event(uint8_t packet_type, uint8_t *packet, uint1
printf("Value (offset %02u): ", value_offset);
printf_hexdump(value, value_length);
break;
case GATT_CHARACTERISTIC_DESCRIPTOR_QUERY_RESULT:
case GATT_EVENT_CHARACTERISTIC_DESCRIPTOR_QUERY_RESULT:
value_handle = READ_BT_16(packet, 4);
value_length = READ_BT_16(packet, 6);
value = &packet[8];
@ -653,7 +653,7 @@ static void handle_gatt_client_event(uint8_t packet_type, uint8_t *packet, uint1
break;
}
break;
case GATT_LONG_CHARACTERISTIC_DESCRIPTOR_QUERY_RESULT:
case GATT_EVENT_LONG_CHARACTERISTIC_DESCRIPTOR_QUERY_RESULT:
value = &packet[10];
value_offset = READ_BT_16(packet, 6);
value_length = READ_BT_16(packet, 8);
@ -661,11 +661,11 @@ static void handle_gatt_client_event(uint8_t packet_type, uint8_t *packet, uint1
printf_hexdump(value, value_length);
break;
case GATT_QUERY_COMPLETE:
case GATT_EVENT_QUERY_COMPLETE:
status = packet[4];
if (status){
central_state = CENTRAL_IDLE;
printf("GATT_QUERY_COMPLETE: %s 0x%02x\n",
printf("GATT_EVENT_QUERY_COMPLETE: %s 0x%02x\n",
att_error_string_for_code(status), status);
break;
}
@ -768,14 +768,14 @@ static void handle_gatt_client_event(uint8_t packet_type, uint8_t *packet, uint1
break;
}
break;
case GATT_NOTIFICATION:
case GATT_EVENT_NOTIFICATION:
value_handle = READ_BT_16(packet, 4);
value_length = READ_BT_16(packet, 6);
value = &packet[8];
printf("Notification handle 0x%04x, value: ", value_handle);
printf_hexdump(value, value_length);
break;
case GATT_INDICATION:
case GATT_EVENT_INDICATION:
value_handle = READ_BT_16(packet, 4);
value_length = READ_BT_16(packet, 6);
value = &packet[8];

View File

@ -580,12 +580,12 @@ static void app_packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *
att_write_queue_init();
break;
case SM_JUST_WORKS_REQUEST:
printf("SM_JUST_WORKS_REQUEST\n");
case SM_EVENT_JUST_WORKS_REQUEST:
printf("SM_EVENT_JUST_WORKS_REQUEST\n");
sm_just_works_confirm(READ_BT_16(packet, 2));
break;
case SM_PASSKEY_INPUT_NUMBER:
case SM_EVENT_PASSKEY_INPUT_NUMBER:
// display number
master_addr_type = packet[4];
bt_flip_addr(event_address, &packet[5]);
@ -595,22 +595,22 @@ static void app_packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *
ui_digits_for_passkey = 6;
break;
case SM_PASSKEY_DISPLAY_NUMBER:
case SM_EVENT_PASSKEY_DISPLAY_NUMBER:
// display number
printf("\nGAP Bonding %s (%u): Display Passkey '%06u\n", bd_addr_to_str(master_address), master_addr_type, READ_BT_32(packet, 11));
break;
case SM_PASSKEY_DISPLAY_CANCEL:
case SM_EVENT_PASSKEY_DISPLAY_CANCEL:
printf("\nGAP Bonding %s (%u): Display cancel\n", bd_addr_to_str(master_address), master_addr_type);
break;
case SM_AUTHORIZATION_REQUEST:
case SM_EVENT_AUTHORIZATION_REQUEST:
// auto-authorize connection if requested
sm_authorization_grant(READ_BT_16(packet, 2));
break;
case ATT_HANDLE_VALUE_INDICATION_COMPLETE:
printf("ATT_HANDLE_VALUE_INDICATION_COMPLETE status %u\n", packet[2]);
case ATT_EVENT_HANDLE_VALUE_INDICATION_COMPLETE:
printf("ATT_EVENT_HANDLE_VALUE_INDICATION_COMPLETE status %u\n", packet[2]);
break;
default:

View File

@ -287,7 +287,7 @@ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *pack
show_usage();
}
break;
case GAP_DEDICATED_BONDING_COMPLETED:
case GAP_EVENT_DEDICATED_BONDING_COMPLETED:
printf("GAP Dedicated Bonding Complete, status %u\n", packet[2]);
break;
@ -397,11 +397,11 @@ 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){
switch (packet[0]){
case SDP_QUERY_RFCOMM_SERVICE:
case SDP_EVENT_QUERY_RFCOMM_SERVICE:
handle_found_service(sdp_query_rfcomm_service_event_get_name(packet),
sdp_query_rfcomm_service_event_get_rfcomm_channel(packet));
break;
case SDP_QUERY_COMPLETE:
case SDP_EVENT_QUERY_COMPLETE:
printf("SDP SPP Query complete\n");
break;
default:

View File

@ -141,11 +141,11 @@ 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){
switch (event->type){
case SDP_QUERY_RFCOMM_SERVICE:
case SDP_EVENT_QUERY_RFCOMM_SERVICE:
channel_nr = sdp_query_rfcomm_service_event_get_name(packet);
printf("** Service name: '%s', RFCOMM port %u\n", sdp_query_rfcomm_service_event_get_rfcomm_channel(packet), channel_nr);
break;
case SDP_QUERY_COMPLETE:
case SDP_EVENT_QUERY_COMPLETE:
if (channel_nr > 0) {
printf("RFCOMM create channel.\n");
rfcomm_create_channel_internal(NULL, remote, channel_nr);

View File

@ -115,7 +115,7 @@ static void test_attribute_value_event(const uint8_t * event){
static int attributeOffset = 0;
static int attributeLength = 0;
CHECK_EQUAL(event[0], SDP_QUERY_ATTRIBUTE_VALUE);
CHECK_EQUAL(event[0], SDP_EVENT_QUERY_ATTRIBUTE_VALUE);
// record ids are sequential
if (sdp_query_attribute_byte_event_get_record_id(event) != recordId){
@ -144,7 +144,7 @@ static void test_attribute_value_event(const uint8_t * event){
static void handle_sdp_parser_event(uint8_t packet_type, uint8_t *packet, uint16_t size){
switch (packet[0]){
case SDP_QUERY_ATTRIBUTE_VALUE:
case SDP_EVENT_QUERY_ATTRIBUTE_VALUE:
test_attribute_value_event(packet);
// handle new record
@ -156,7 +156,7 @@ static void handle_sdp_parser_event(uint8_t packet_type, uint8_t *packet, uint16
attribute_value[sdp_query_attribute_byte_event_get_data_offset(packet)] = sdp_query_attribute_byte_event_get_data(packet);
break;
case SDP_QUERY_COMPLETE:
case SDP_EVENT_QUERY_COMPLETE:
printf("General query done with status %d.\n", sdp_query_complete_event_get_status(packet));
break;
}

View File

@ -92,7 +92,7 @@ void sdp_query_rfcomm_init();
void handle_query_rfcomm_event(uint8_t packet_type, uint8_t *packet, uint16_t size, void * context){
switch (packet[0]){
case SDP_QUERY_RFCOMM_SERVICE:
case SDP_EVENT_QUERY_RFCOMM_SERVICE:
channel_nr[service_index] = sdp_query_rfcomm_service_event_get_rfcomm_channel(packet);
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);
@ -100,7 +100,7 @@ void handle_query_rfcomm_event(uint8_t packet_type, uint8_t *packet, uint16_t si
// printf("CALLBACK: Service name: '%s', RFCOMM port %u, service index %d\n", service_name[service_index], channel_nr[service_index], service_index);
service_index++;
break;
case SDP_QUERY_COMPLETE:
case SDP_EVENT_QUERY_COMPLETE:
// printf("CALLBACK: Client query response done. \n");
break;
}

View File

@ -58,7 +58,7 @@ static void test_attribute_value_event(const uint8_t * event){
static int attributeOffset = 0;
static int attributeLength = 0;
CHECK_EQUAL(event[0], SDP_QUERY_ATTRIBUTE_VALUE);
CHECK_EQUAL(event[0], SDP_EVENT_QUERY_ATTRIBUTE_VALUE);
// record ids are sequential
// printf("sdp_query_attribute_byte_event_get_record_id(event) %d",sdp_query_attribute_byte_event_get_record_id(event));
@ -89,7 +89,7 @@ static void test_attribute_value_event(const uint8_t * event){
static void handle_sdp_parser_event(uint8_t packet_type, uint8_t *packet, uint16_t size){
switch (packet[0]){
case SDP_QUERY_ATTRIBUTE_VALUE:
case SDP_EVENT_QUERY_ATTRIBUTE_VALUE:
test_attribute_value_event(packet);
// handle new record
@ -101,7 +101,7 @@ static void handle_sdp_parser_event(uint8_t packet_type, uint8_t *packet, uint16
attribute_value[sdp_query_attribute_byte_event_get_data_offset(packet)] = sdp_query_attribute_byte_event_get_data(packet);
break;
case SDP_QUERY_COMPLETE:
case SDP_EVENT_QUERY_COMPLETE:
printf("General query done with status %d.\n", sdp_query_complete_event_get_status(packet));
break;
}

View File

@ -43,11 +43,11 @@ static uint8_t sdp_test_record_list[] = {
static void handle_sdp_parser_event(uint8_t packet_type, uint8_t *packet, uint16_t size){
static uint32_t record_handle = sdp_test_record_list[0];
switch (packet[0]){
case SDP_QUERY_SERVICE_RECORD_HANDLE:
case SDP_EVENT_QUERY_SERVICE_RECORD_HANDLE:
CHECK_EQUAL(sdp_query_service_record_handle_event_get_record_handle(packet), record_handle);
record_handle++;
break;
case SDP_QUERY_COMPLETE:
case SDP_EVENT_QUERY_COMPLETE:
printf("General query done with status %d.\n", sdp_query_complete_event_get_status(packet));
break;
}

View File

@ -126,27 +126,27 @@ void app_packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *packet,
switch (packet_type) {
case HCI_EVENT_PACKET:
switch (packet[0]) {
case SM_PASSKEY_INPUT_NUMBER:
case SM_EVENT_PASSKEY_INPUT_NUMBER:
// store peer address for input
printf("\nGAP Bonding: Enter 6 digit passkey: '");
fflush(stdout);
break;
case SM_PASSKEY_DISPLAY_NUMBER:
case SM_EVENT_PASSKEY_DISPLAY_NUMBER:
printf("\nGAP Bonding: Display Passkey '%06u\n", READ_BT_32(packet, 11));
break;
case SM_PASSKEY_DISPLAY_CANCEL:
case SM_EVENT_PASSKEY_DISPLAY_CANCEL:
printf("\nGAP Bonding: Display cancel\n");
break;
case SM_JUST_WORKS_REQUEST:
case SM_EVENT_JUST_WORKS_REQUEST:
// auto-authorize connection if requested
sm_just_works_confirm(READ_BT_16(packet, 2));
printf("Just Works request confirmed\n");
break;
case SM_AUTHORIZATION_REQUEST:
case SM_EVENT_AUTHORIZATION_REQUEST:
// auto-authorize connection if requested
sm_authorization_grant(READ_BT_16(packet, 2));
break;

View File

@ -204,13 +204,13 @@ def create_events(events):
fout.write(hfile_header_begin)
for event_type, event_name, format, args in events:
if not event_name in [
'SDP_QUERY_COMPLETE',
'SDP_QUERY_RFCOMM_SERVICE',
'SDP_QUERY_ATTRIBUTE_BYTE',
'SDP_QUERY_SERVICE_RECORD_HANDLE',
'ANCS_CLIENT_CONNECTED',
'ANCS_CLIENT_NOTIFICATION',
'ANCS_CLIENT_DISCONNECTED']:
'SDP_EVENT_QUERY_COMPLETE',
'SDP_EVENT_QUERY_RFCOMM_SERVICE',
'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)
length_name = ''