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: BluetoothSocketManagerBinderServer(const btsock_interface_t * socketInterface)32 explicit BluetoothSocketManagerBinderServer( 33 const btsock_interface_t* socketInterface) 34 : socketInterface(socketInterface) {} 35 ~BluetoothSocketManagerBinderServer() override = default; 36 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 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 50 Status requestMaximumTxDataLength(const BluetoothDevice& device); 51 52 private: 53 const btsock_interface_t* socketInterface; 54 DISALLOW_COPY_AND_ASSIGN(BluetoothSocketManagerBinderServer); 55 }; 56 } // namespace bluetooth 57 } // namespace android