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