1 /****************************************************************************** 2 * 3 * Copyright 2014 Google, Inc. 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at: 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 * 17 ******************************************************************************/ 18 19 #pragma once 20 21 #include <base/functional/callback.h> 22 #include <base/location.h> 23 24 #include "stack/include/bt_hdr.h" 25 #include "stack/include/bt_types.h" 26 27 ///// LEGACY DEFINITIONS ///// 28 29 /* Message event mask across Host/Controller lib and stack */ 30 #define MSG_EVT_MASK 0xFF00 /* eq. BT_EVT_MASK */ 31 #define MSG_SUB_EVT_MASK 0x00FF /* eq. BT_SUB_EVT_MASK */ 32 33 /* Message event ID passed from Host/Controller lib to stack */ 34 #define MSG_HC_TO_STACK_HCI_ERR 0x1300 /* eq. BT_EVT_TO_BTU_HCIT_ERR */ 35 #define MSG_HC_TO_STACK_HCI_ISO 0x1700 /* eq. BT_EVT_TO_BTU_HCI_ISO */ 36 #define MSG_HC_TO_STACK_HCI_EVT 0x1000 /* eq. BT_EVT_TO_BTU_HCI_EVT */ 37 38 /* Message event ID passed from stack to vendor lib */ 39 #define MSG_STACK_TO_HC_HCI_ISO 0x2d00 /* eq. BT_EVT_TO_LM_HCI_ISO */ 40 #define MSG_STACK_TO_HC_HCI_CMD 0x2000 /* eq. BT_EVT_TO_LM_HCI_CMD */ 41 42 /* Local Bluetooth Controller ID for BR/EDR */ 43 #define LOCAL_BR_EDR_CONTROLLER_ID 0 44 45 ///// END LEGACY DEFINITIONS ///// 46 typedef struct packet_fragmenter_t packet_fragmenter_t; 47 typedef uint16_t command_opcode_t; 48 49 typedef void (*command_complete_cb)(BT_HDR* response, void* context); 50 typedef void (*command_status_cb)(uint8_t status, BT_HDR* command, 51 void* context); 52 53 typedef struct hci_t { 54 // Set the callback that the HCI layer uses to send data upwards 55 void (*set_data_cb)( 56 base::Callback<void(const base::Location&, BT_HDR*)> send_data_cb); 57 58 // Send a command through the HCI layer 59 void (*transmit_command)(const BT_HDR* command, 60 command_complete_cb complete_callback, 61 command_status_cb status_cb, void* context); 62 63 // Send some data downward through the HCI layer 64 void (*transmit_downward)(void* data, uint16_t iso_buffer_size); 65 } hci_t; 66 67 const hci_t* hci_layer_get_interface(); 68 69 bool hci_is_root_inflammation_event_received(); 70