Jakub Pawlowski | 80eeb8f | 2017-11-01 10:11:52 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 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 | #include <android/bluetooth/BnBluetoothSocketManager.h> |
| 18 | #include <android/bluetooth/IBluetoothSocketManager.h> |
| 19 | #include <base/macros.h> |
| 20 | #include <binder/IBinder.h> |
| 21 | #include <binder/IInterface.h> |
| 22 | #include <hardware/bluetooth.h> |
| 23 | #include <hardware/bt_sock.h> |
| 24 | |
| 25 | namespace android { |
| 26 | namespace bluetooth { |
| 27 | |
| 28 | using ::android::binder::Status; |
| 29 | |
| 30 | class BluetoothSocketManagerBinderServer : public BnBluetoothSocketManager { |
| 31 | public: |
| 32 | explicit BluetoothSocketManagerBinderServer( |
Jakub Pawlowski | ad311b2 | 2017-11-03 19:06:23 -0700 | [diff] [blame] | 33 | const btsock_interface_t* socketInterface) |
| 34 | : socketInterface(socketInterface) {} |
Jakub Pawlowski | 80eeb8f | 2017-11-01 10:11:52 -0700 | [diff] [blame] | 35 | ~BluetoothSocketManagerBinderServer() override = default; |
| 36 | |
Jakub Pawlowski | b55d957 | 2017-11-06 10:36:58 -0800 | [diff] [blame] | 37 | Status connectSocket( |
| 38 | const BluetoothDevice& device, int32_t type, |
| 39 | const std::unique_ptr<::android::os::ParcelUuid>& uuid, int32_t port, |
| 40 | int32_t flag, |
| 41 | std::unique_ptr<::android::os::ParcelFileDescriptor>* _aidl_return); |
| 42 | |
Jakub Pawlowski | ad311b2 | 2017-11-03 19:06:23 -0700 | [diff] [blame] | 43 | Status createSocketChannel( |
| 44 | int32_t type, const std::unique_ptr<::android::String16>& serviceName, |
| 45 | const std::unique_ptr<::android::os::ParcelUuid>& uuid, int32_t port, |
| 46 | int32_t flag, |
| 47 | std::unique_ptr<::android::os::ParcelFileDescriptor>* _aidl_return) |
| 48 | override; |
| 49 | |
Stanley Tng | 1a8c6e3 | 2018-01-16 10:49:25 -0800 | [diff] [blame] | 50 | Status requestMaximumTxDataLength(const BluetoothDevice& device); |
| 51 | |
Jakub Pawlowski | 80eeb8f | 2017-11-01 10:11:52 -0700 | [diff] [blame] | 52 | private: |
Jakub Pawlowski | ad311b2 | 2017-11-03 19:06:23 -0700 | [diff] [blame] | 53 | const btsock_interface_t* socketInterface; |
Jakub Pawlowski | 80eeb8f | 2017-11-01 10:11:52 -0700 | [diff] [blame] | 54 | DISALLOW_COPY_AND_ASSIGN(BluetoothSocketManagerBinderServer); |
| 55 | }; |
| 56 | } // namespace bluetooth |
| 57 | } // namespace android |