hci.c (a9212437617aba91eeb14431cba875aa111ef17f) hci.c (ebd1b97964c95b2db90393bc92c0fc831641c1a8)
1/*
2 * Copyright (C) 2014 BlueKitchen GmbH
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright

--- 7877 unchanged lines hidden (view full) ---

7886 little_endian_store_16(event, 2, conn->con_handle);
7887 hci_emit_event(event, sizeof(event), 1);
7888}
7889#endif
7890
7891#ifdef ENABLE_BLE
7892#ifdef ENABLE_LE_CENTRAL
7893static void hci_emit_le_connection_complete(uint8_t address_type, const bd_addr_t address, hci_con_handle_t con_handle, uint8_t status){
1/*
2 * Copyright (C) 2014 BlueKitchen GmbH
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright

--- 7877 unchanged lines hidden (view full) ---

7886 little_endian_store_16(event, 2, conn->con_handle);
7887 hci_emit_event(event, sizeof(event), 1);
7888}
7889#endif
7890
7891#ifdef ENABLE_BLE
7892#ifdef ENABLE_LE_CENTRAL
7893static void hci_emit_le_connection_complete(uint8_t address_type, const bd_addr_t address, hci_con_handle_t con_handle, uint8_t status){
7894 uint8_t event[21];
7895 event[0] = HCI_EVENT_LE_META;
7896 event[1] = sizeof(event) - 2u;
7897 event[2] = HCI_SUBEVENT_LE_CONNECTION_COMPLETE;
7898 event[3] = status;
7899 little_endian_store_16(event, 4, con_handle);
7900 event[6] = 0; // TODO: role
7901 event[7] = address_type;
7902 reverse_bd_addr(address, &event[8]);
7903 little_endian_store_16(event, 14, 0); // interval
7904 little_endian_store_16(event, 16, 0); // latency
7905 little_endian_store_16(event, 18, 0); // supervision timeout
7906 event[20] = 0; // master clock accuracy
7907 hci_emit_event(event, sizeof(event), 1);
7894 uint8_t hci_event[21];
7895 hci_event[0] = HCI_EVENT_LE_META;
7896 hci_event[1] = sizeof(hci_event) - 2u;
7897 hci_event[2] = HCI_SUBEVENT_LE_CONNECTION_COMPLETE;
7898 hci_event[3] = status;
7899 little_endian_store_16(hci_event, 4, con_handle);
7900 hci_event[6] = 0; // TODO: role
7901 hci_event[7] = address_type;
7902 reverse_bd_addr(address, &hci_event[8]);
7903 little_endian_store_16(hci_event, 14, 0); // interval
7904 little_endian_store_16(hci_event, 16, 0); // latency
7905 little_endian_store_16(hci_event, 18, 0); // supervision timeout
7906 hci_event[20] = 0; // master clock accuracy
7907 hci_emit_event(hci_event, sizeof(hci_event), 1);
7908 // emit GAP event, too
7909 uint8_t gap_event[36];
7910 hci_create_gap_connection_complete_event(hci_event, gap_event);
7911 hci_emit_event(gap_event, sizeof(gap_event), 1);
7908}
7909#endif
7910#endif
7911
7912static void hci_emit_transport_packet_sent(void){
7913 // notify upper stack that it might be possible to send again
7914 uint8_t event[] = { HCI_EVENT_TRANSPORT_PACKET_SENT, 0};
7915 hci_emit_event(&event[0], sizeof(event), 0); // don't dump

--- 2594 unchanged lines hidden ---
7912}
7913#endif
7914#endif
7915
7916static void hci_emit_transport_packet_sent(void){
7917 // notify upper stack that it might be possible to send again
7918 uint8_t event[] = { HCI_EVENT_TRANSPORT_PACKET_SENT, 0};
7919 hci_emit_event(&event[0], sizeof(event), 0); // don't dump

--- 2594 unchanged lines hidden ---