blob: 484a6ab41d9137eccc1bfc7fb89b357ce045ea5d [file] [log] [blame]
Myles Watson90ee15b2017-02-09 16:47:33 -08001//
2// Copyright 2017 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#pragma once
18
19#include <android/hardware/bluetooth/1.0/IBluetoothHci.h>
20
21#include <hidl/MQDescriptor.h>
22
23#include "async_fd_watcher.h"
Myles Watson761dc492017-03-03 13:50:49 -080024#include "h4_protocol.h"
Myles Watson90ee15b2017-02-09 16:47:33 -080025
26namespace android {
27namespace hardware {
28namespace bluetooth {
29namespace V1_0 {
30namespace hikey {
31
32using ::android::hardware::Return;
33using ::android::hardware::hidl_vec;
34
35class BluetoothHci : public IBluetoothHci {
36 public:
37 Return<void> initialize(
38 const ::android::sp<IBluetoothHciCallbacks>& cb) override;
39 Return<void> sendHciCommand(const hidl_vec<uint8_t>& packet) override;
40 Return<void> sendAclData(const hidl_vec<uint8_t>& packet) override;
41 Return<void> sendScoData(const hidl_vec<uint8_t>& packet) override;
42 Return<void> close() override;
43
44 static void OnPacketReady();
45
Myles Watson90ee15b2017-02-09 16:47:33 -080046 private:
47 ::android::sp<IBluetoothHciCallbacks> event_cb_;
48 int hci_tty_fd_;
49
Myles Watson90ee15b2017-02-09 16:47:33 -080050 async::AsyncFdWatcher fd_watcher_;
51
Myles Watson761dc492017-03-03 13:50:49 -080052 hci::H4Protocol* hci_;
Myles Watson90ee15b2017-02-09 16:47:33 -080053};
54
55} // namespace hikey
56} // namespace V1_0
57} // namespace bluetooth
58} // namespace hardware
59} // namespace android