diff --git a/example/gatt_battery_query.c b/example/gatt_battery_query.c index 6ed97e55e..d38d93844 100644 --- a/example/gatt_battery_query.c +++ b/example/gatt_battery_query.c @@ -230,7 +230,7 @@ static void hci_event_handler(uint8_t packet_type, uint16_t channel, uint8_t *pa break; case HCI_EVENT_LE_META: // wait for connection complete - if (packet[2] != HCI_SUBEVENT_LE_CONNECTION_COMPLETE) break; + if (hci_event_le_meta_get_subevent_code(packet) != HCI_SUBEVENT_LE_CONNECTION_COMPLETE) break; if (state != TC_W4_CONNECT) return; connection_handle = hci_subevent_le_connection_complete_get_connection_handle(packet); // initialize gatt client context with handle, and add it to the list of active clients diff --git a/example/gatt_browser.c b/example/gatt_browser.c index 94beaa317..5dc23acae 100644 --- a/example/gatt_browser.c +++ b/example/gatt_browser.c @@ -191,7 +191,7 @@ static void handle_hci_event(uint8_t packet_type, uint16_t channel, uint8_t *pac break; case HCI_EVENT_LE_META: // wait for connection complete - if (packet[2] != HCI_SUBEVENT_LE_CONNECTION_COMPLETE) break; + if (hci_event_le_meta_get_subevent_code(packet) != HCI_SUBEVENT_LE_CONNECTION_COMPLETE) break; connection_handler = hci_subevent_le_connection_complete_get_connection_handle(packet); // query primary services gatt_client_discover_primary_services(handle_gatt_client_event, connection_handler); diff --git a/example/le_streamer.c b/example/le_streamer.c index 9675c2d4b..9ae982f9c 100644 --- a/example/le_streamer.c +++ b/example/le_streamer.c @@ -168,10 +168,10 @@ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *pack le_notification_enabled = 0; break; case HCI_EVENT_LE_META: - switch (packet[2]) { + switch (hci_event_le_meta_get_subevent_code(packet)) { case HCI_SUBEVENT_LE_CONNECTION_COMPLETE: test_data_len = ATT_DEFAULT_MTU - 3; - connection_handle = little_endian_read_16(packet, 4); + connection_handle = hci_subevent_le_connection_complete_get_connection_handle(packet); // min con interval 20 ms // gap_request_connection_parameter_update(connection_handle, 0x10, 0x18, 0, 0x0048); // printf("Connected, requesting conn param update for handle 0x%04x\n", connection_handle); diff --git a/platform/daemon/example/le_scan.c b/platform/daemon/example/le_scan.c index 41d8a08f5..252c1e2ff 100644 --- a/platform/daemon/example/le_scan.c +++ b/platform/daemon/example/le_scan.c @@ -63,7 +63,7 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe } break; case HCI_EVENT_LE_META: - switch (packet[2]) { + switch (hci_event_le_meta_get_subevent_code(packet)) { case HCI_SUBEVENT_LE_ADVERTISING_REPORT: printf("\n- ADV: "); printf_hexdump(packet, size); diff --git a/test/gatt_client/le_central.c b/test/gatt_client/le_central.c index b0db94410..8272169b7 100644 --- a/test/gatt_client/le_central.c +++ b/test/gatt_client/le_central.c @@ -61,7 +61,7 @@ static void handle_hci_event(uint8_t packet_type, uint16_t channel, uint8_t *pac } case HCI_EVENT_LE_META: // wait for connection complete - if (packet[2] != HCI_SUBEVENT_LE_CONNECTION_COMPLETE) break; + if (hci_event_le_meta_get_subevent_code(packet) != HCI_SUBEVENT_LE_CONNECTION_COMPLETE) break; connected = 1; break; case HCI_EVENT_DISCONNECTION_COMPLETE: diff --git a/test/pts/ble_central_test.c b/test/pts/ble_central_test.c index b1ff4c92a..fbff3e82a 100644 --- a/test/pts/ble_central_test.c +++ b/test/pts/ble_central_test.c @@ -338,7 +338,7 @@ static void app_packet_handler (uint8_t packet_type, uint16_t channel, uint8_t * break; case HCI_EVENT_LE_META: - switch (packet[2]) { + switch (hci_event_le_meta_get_subevent_code(packet)) { case HCI_SUBEVENT_LE_CONNECTION_COMPLETE: handle = little_endian_read_16(packet, 4); printf("Connection complete, handle 0x%04x\n", handle); diff --git a/test/pts/ble_peripheral_test.c b/test/pts/ble_peripheral_test.c index 89cb5f8f8..7472f7fcf 100644 --- a/test/pts/ble_peripheral_test.c +++ b/test/pts/ble_peripheral_test.c @@ -557,7 +557,7 @@ static void app_packet_handler (uint8_t packet_type, uint16_t channel, uint8_t * break; case HCI_EVENT_LE_META: - switch (packet[2]) { + switch (hci_event_le_meta_get_subevent_code(packet)) { case HCI_SUBEVENT_LE_CONNECTION_COMPLETE: advertisements_enabled = 0; handle = little_endian_read_16(packet, 4);