2016-09-12 19:58:42 +02:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2016 The Android Open Source Project
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
package android.hardware.bluetooth@1.0;
|
|
|
|
|
|
|
|
import IBluetoothHciCallbacks;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The Host Controller Interface (HCI) is the layer defined by the Bluetooth
|
|
|
|
* specification between the software that runs on the host and the Bluetooth
|
|
|
|
* controller chip. This boundary is the natural choice for a Hardware
|
|
|
|
* Abstraction Layer (HAL). Dealing only in HCI packets and events simplifies
|
|
|
|
* the stack and abstracts away power management, initialization, and other
|
|
|
|
* implementation-specific details related to the hardware.
|
|
|
|
*/
|
|
|
|
|
|
|
|
interface IBluetoothHci {
|
|
|
|
/**
|
|
|
|
* Initialize the underlying HCI interface.
|
|
|
|
*
|
|
|
|
* This method should be used to initialize any hardware interfaces
|
|
|
|
* required to communicate with the Bluetooth hardware in the
|
|
|
|
* device.
|
|
|
|
*
|
2017-01-18 03:23:12 +01:00
|
|
|
* The |oninitializationComplete| callback must be invoked in response
|
|
|
|
* to this function to indicate success before any other function
|
|
|
|
* (sendHciCommand, sendAclData, * sendScoData) is invoked on this
|
|
|
|
* interface.
|
|
|
|
*
|
2016-09-12 19:58:42 +02:00
|
|
|
* @param callback implements IBluetoothHciCallbacks which will
|
|
|
|
* receive callbacks when incoming HCI packets are received
|
|
|
|
* from the controller to be sent to the host.
|
|
|
|
*/
|
2017-01-18 03:23:12 +01:00
|
|
|
@entry
|
|
|
|
@callflow(next={"sendHciCommand", "sendAclData", "sendScoData", "close"})
|
|
|
|
initialize(IBluetoothHciCallbacks callback);
|
2016-09-12 19:58:42 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Send an HCI command (as specified in the Bluetooth Specification
|
|
|
|
* V4.2, Vol 2, Part 5, Section 5.4.1) to the Bluetooth controller.
|
|
|
|
* Commands must be executed in order.
|
|
|
|
*
|
|
|
|
* @param command is the HCI command to be sent
|
|
|
|
*/
|
2017-01-18 03:23:12 +01:00
|
|
|
@callflow(next={"sendHciCommand", "sendAclData", "sendScoData", "close"})
|
2016-09-12 19:58:42 +02:00
|
|
|
sendHciCommand(HciPacket command);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Send an HCI ACL data packet (as specified in the Bluetooth Specification
|
|
|
|
* V4.2, Vol 2, Part 5, Section 5.4.2) to the Bluetooth controller.
|
|
|
|
* Packets must be processed in order.
|
|
|
|
* @param data HCI data packet to be sent
|
|
|
|
*/
|
2017-01-18 03:23:12 +01:00
|
|
|
@callflow(next={"sendHciCommand", "sendAclData", "sendScoData", "close"})
|
2016-09-12 19:58:42 +02:00
|
|
|
sendAclData(HciPacket data);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Send an SCO data packet (as specified in the Bluetooth Specification
|
|
|
|
* V4.2, Vol 2, Part 5, Section 5.4.3) to the Bluetooth controller.
|
|
|
|
* Packets must be processed in order.
|
|
|
|
* @param data HCI data packet to be sent
|
|
|
|
*/
|
2017-01-18 03:23:12 +01:00
|
|
|
@callflow(next={"sendHciCommand", "sendAclData", "sendScoData", "close"})
|
2016-09-12 19:58:42 +02:00
|
|
|
sendScoData(HciPacket data);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Close the HCI interface
|
|
|
|
*/
|
2017-01-18 03:23:12 +01:00
|
|
|
@exit
|
2016-09-12 19:58:42 +02:00
|
|
|
close();
|
|
|
|
};
|