1*4d7e907cSAndroid Build Coastguard Worker/* 2*4d7e907cSAndroid Build Coastguard Worker * Copyright (C) 2016 The Android Open Source Project 3*4d7e907cSAndroid Build Coastguard Worker * 4*4d7e907cSAndroid Build Coastguard Worker * Licensed under the Apache License, Version 2.0 (the "License"); 5*4d7e907cSAndroid Build Coastguard Worker * you may not use this file except in compliance with the License. 6*4d7e907cSAndroid Build Coastguard Worker * You may obtain a copy of the License at 7*4d7e907cSAndroid Build Coastguard Worker * 8*4d7e907cSAndroid Build Coastguard Worker * http://www.apache.org/licenses/LICENSE-2.0 9*4d7e907cSAndroid Build Coastguard Worker * 10*4d7e907cSAndroid Build Coastguard Worker * Unless required by applicable law or agreed to in writing, software 11*4d7e907cSAndroid Build Coastguard Worker * distributed under the License is distributed on an "AS IS" BASIS, 12*4d7e907cSAndroid Build Coastguard Worker * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13*4d7e907cSAndroid Build Coastguard Worker * See the License for the specific language governing permissions and 14*4d7e907cSAndroid Build Coastguard Worker * limitations under the License. 15*4d7e907cSAndroid Build Coastguard Worker */ 16*4d7e907cSAndroid Build Coastguard Worker 17*4d7e907cSAndroid Build Coastguard Workerpackage [email protected]; 18*4d7e907cSAndroid Build Coastguard Worker 19*4d7e907cSAndroid Build Coastguard Workerimport IBluetoothHciCallbacks; 20*4d7e907cSAndroid Build Coastguard Worker 21*4d7e907cSAndroid Build Coastguard Worker/** 22*4d7e907cSAndroid Build Coastguard Worker * The Host Controller Interface (HCI) is the layer defined by the Bluetooth 23*4d7e907cSAndroid Build Coastguard Worker * specification between the software that runs on the host and the Bluetooth 24*4d7e907cSAndroid Build Coastguard Worker * controller chip. This boundary is the natural choice for a Hardware 25*4d7e907cSAndroid Build Coastguard Worker * Abstraction Layer (HAL). Dealing only in HCI packets and events simplifies 26*4d7e907cSAndroid Build Coastguard Worker * the stack and abstracts away power management, initialization, and other 27*4d7e907cSAndroid Build Coastguard Worker * implementation-specific details related to the hardware. 28*4d7e907cSAndroid Build Coastguard Worker */ 29*4d7e907cSAndroid Build Coastguard Worker 30*4d7e907cSAndroid Build Coastguard Workerinterface IBluetoothHci { 31*4d7e907cSAndroid Build Coastguard Worker /** 32*4d7e907cSAndroid Build Coastguard Worker * Initialize the underlying HCI interface. 33*4d7e907cSAndroid Build Coastguard Worker * 34*4d7e907cSAndroid Build Coastguard Worker * This method should be used to initialize any hardware interfaces 35*4d7e907cSAndroid Build Coastguard Worker * required to communicate with the Bluetooth hardware in the 36*4d7e907cSAndroid Build Coastguard Worker * device. 37*4d7e907cSAndroid Build Coastguard Worker * 38*4d7e907cSAndroid Build Coastguard Worker * The |oninitializationComplete| callback must be invoked in response 39*4d7e907cSAndroid Build Coastguard Worker * to this function to indicate success before any other function 40*4d7e907cSAndroid Build Coastguard Worker * (sendHciCommand, sendAclData, * sendScoData) is invoked on this 41*4d7e907cSAndroid Build Coastguard Worker * interface. 42*4d7e907cSAndroid Build Coastguard Worker * 43*4d7e907cSAndroid Build Coastguard Worker * @param callback implements IBluetoothHciCallbacks which will 44*4d7e907cSAndroid Build Coastguard Worker * receive callbacks when incoming HCI packets are received 45*4d7e907cSAndroid Build Coastguard Worker * from the controller to be sent to the host. 46*4d7e907cSAndroid Build Coastguard Worker */ 47*4d7e907cSAndroid Build Coastguard Worker @entry 48*4d7e907cSAndroid Build Coastguard Worker @callflow(next={"sendHciCommand", "sendAclData", "sendScoData", "close"}) 49*4d7e907cSAndroid Build Coastguard Worker initialize(IBluetoothHciCallbacks callback); 50*4d7e907cSAndroid Build Coastguard Worker 51*4d7e907cSAndroid Build Coastguard Worker /** 52*4d7e907cSAndroid Build Coastguard Worker * Send an HCI command (as specified in the Bluetooth Specification 53*4d7e907cSAndroid Build Coastguard Worker * V4.2, Vol 2, Part 5, Section 5.4.1) to the Bluetooth controller. 54*4d7e907cSAndroid Build Coastguard Worker * Commands must be executed in order. 55*4d7e907cSAndroid Build Coastguard Worker * 56*4d7e907cSAndroid Build Coastguard Worker * @param command is the HCI command to be sent 57*4d7e907cSAndroid Build Coastguard Worker */ 58*4d7e907cSAndroid Build Coastguard Worker @callflow(next={"sendHciCommand", "sendAclData", "sendScoData", "close"}) 59*4d7e907cSAndroid Build Coastguard Worker sendHciCommand(HciPacket command); 60*4d7e907cSAndroid Build Coastguard Worker 61*4d7e907cSAndroid Build Coastguard Worker /** 62*4d7e907cSAndroid Build Coastguard Worker * Send an HCI ACL data packet (as specified in the Bluetooth Specification 63*4d7e907cSAndroid Build Coastguard Worker * V4.2, Vol 2, Part 5, Section 5.4.2) to the Bluetooth controller. 64*4d7e907cSAndroid Build Coastguard Worker * Packets must be processed in order. 65*4d7e907cSAndroid Build Coastguard Worker * @param data HCI data packet to be sent 66*4d7e907cSAndroid Build Coastguard Worker */ 67*4d7e907cSAndroid Build Coastguard Worker @callflow(next={"sendHciCommand", "sendAclData", "sendScoData", "close"}) 68*4d7e907cSAndroid Build Coastguard Worker sendAclData(HciPacket data); 69*4d7e907cSAndroid Build Coastguard Worker 70*4d7e907cSAndroid Build Coastguard Worker /** 71*4d7e907cSAndroid Build Coastguard Worker * Send an SCO data packet (as specified in the Bluetooth Specification 72*4d7e907cSAndroid Build Coastguard Worker * V4.2, Vol 2, Part 5, Section 5.4.3) to the Bluetooth controller. 73*4d7e907cSAndroid Build Coastguard Worker * Packets must be processed in order. 74*4d7e907cSAndroid Build Coastguard Worker * @param data HCI data packet to be sent 75*4d7e907cSAndroid Build Coastguard Worker */ 76*4d7e907cSAndroid Build Coastguard Worker @callflow(next={"sendHciCommand", "sendAclData", "sendScoData", "close"}) 77*4d7e907cSAndroid Build Coastguard Worker sendScoData(HciPacket data); 78*4d7e907cSAndroid Build Coastguard Worker 79*4d7e907cSAndroid Build Coastguard Worker /** 80*4d7e907cSAndroid Build Coastguard Worker * Close the HCI interface 81*4d7e907cSAndroid Build Coastguard Worker */ 82*4d7e907cSAndroid Build Coastguard Worker @exit 83*4d7e907cSAndroid Build Coastguard Worker close(); 84*4d7e907cSAndroid Build Coastguard Worker}; 85