Andre Eisenbach | 89ba528 | 2016-10-13 15:45:02 -0700 | [diff] [blame] | 1 | // |
| 2 | // Copyright 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 | #ifndef HIDL_GENERATED_android_hardware_bluetooth_V1_0_BluetoothHci_H_ |
| 18 | #define HIDL_GENERATED_android_hardware_bluetooth_V1_0_BluetoothHci_H_ |
| 19 | |
| 20 | #include <android/hardware/bluetooth/1.0/IBluetoothHci.h> |
| 21 | |
| 22 | #include <hidl/MQDescriptor.h> |
| 23 | |
| 24 | namespace android { |
| 25 | namespace hardware { |
| 26 | namespace bluetooth { |
| 27 | namespace V1_0 { |
| 28 | namespace implementation { |
| 29 | |
| 30 | using ::android::hardware::Return; |
| 31 | using ::android::hardware::hidl_vec; |
| 32 | |
Martijn Coenen | 678af7f | 2017-02-23 17:25:18 +0100 | [diff] [blame] | 33 | struct BluetoothDeathRecipient : hidl_death_recipient { |
| 34 | BluetoothDeathRecipient(const sp<IBluetoothHci> hci) : mHci(hci) {} |
| 35 | |
| 36 | virtual void serviceDied( |
| 37 | uint64_t /*cookie*/, |
| 38 | const wp<::android::hidl::base::V1_0::IBase>& /*who*/) { |
| 39 | mHci->close(); |
| 40 | } |
| 41 | sp<IBluetoothHci> mHci; |
| 42 | }; |
| 43 | |
Andre Eisenbach | 89ba528 | 2016-10-13 15:45:02 -0700 | [diff] [blame] | 44 | class BluetoothHci : public IBluetoothHci { |
| 45 | public: |
Martijn Coenen | 678af7f | 2017-02-23 17:25:18 +0100 | [diff] [blame] | 46 | BluetoothHci(); |
Andre Eisenbach | 9041d97 | 2017-01-17 18:23:12 -0800 | [diff] [blame] | 47 | Return<void> initialize( |
Andre Eisenbach | 89ba528 | 2016-10-13 15:45:02 -0700 | [diff] [blame] | 48 | const ::android::sp<IBluetoothHciCallbacks>& cb) override; |
| 49 | Return<void> sendHciCommand(const hidl_vec<uint8_t>& packet) override; |
| 50 | Return<void> sendAclData(const hidl_vec<uint8_t>& data) override; |
| 51 | Return<void> sendScoData(const hidl_vec<uint8_t>& data) override; |
| 52 | Return<void> close() override; |
| 53 | |
| 54 | private: |
| 55 | void sendDataToController(const uint8_t type, const hidl_vec<uint8_t>& data); |
| 56 | ::android::sp<IBluetoothHciCallbacks> event_cb_; |
Martijn Coenen | 678af7f | 2017-02-23 17:25:18 +0100 | [diff] [blame] | 57 | ::android::sp<BluetoothDeathRecipient> deathRecipient; |
Andre Eisenbach | 89ba528 | 2016-10-13 15:45:02 -0700 | [diff] [blame] | 58 | }; |
| 59 | |
| 60 | extern "C" IBluetoothHci* HIDL_FETCH_IBluetoothHci(const char* name); |
| 61 | |
| 62 | } // namespace implementation |
| 63 | } // namespace V1_0 |
| 64 | } // namespace bluetooth |
| 65 | } // namespace hardware |
| 66 | } // namespace android |
| 67 | |
| 68 | #endif // HIDL_GENERATED_android_hardware_bluetooth_V1_0_BluetoothHci_H_ |