Jakub Pawlowski | 13b4d31 | 2019-11-05 12:27:29 +0100 | [diff] [blame] | 1 | // |
| 2 | // Copyright 2019 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 | #define LOG_TAG "android.hardware.bluetooth@1.1-service" |
| 18 | |
| 19 | #include <android/hardware/bluetooth/1.1/IBluetoothHci.h> |
| 20 | #include <hidl/HidlTransportSupport.h> |
| 21 | |
| 22 | #include "bluetooth_hci.h" |
| 23 | |
| 24 | // Generated HIDL files |
| 25 | using android::hardware::bluetooth::V1_1::IBluetoothHci; |
| 26 | using android::hardware::bluetooth::V1_1::implementation::BluetoothHci; |
| 27 | |
| 28 | using android::sp; |
| 29 | using android::status_t; |
| 30 | |
| 31 | int main() { |
| 32 | ::android::hardware::configureRpcThreadpool(1 /*threads*/, true /*willJoin*/); |
| 33 | |
| 34 | sp bluetoothHci = new BluetoothHci(); |
| 35 | const status_t status = bluetoothHci->registerAsService(); |
| 36 | if (status != ::android::OK) { |
| 37 | ALOGE("Cannot register Bluetooth HAL service"); |
| 38 | return 1; // or handle error |
| 39 | } |
| 40 | |
| 41 | ::android::hardware::joinRpcThreadpool(); |
| 42 | return 1; // joinRpcThreadpool should never return |
| 43 | } |