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