blob: e732dcccc1335f634d84dd7843a7b2753704b3c4 [file] [log] [blame]
Jakub Pawlowski80eeb8f2017-11-01 10:11:52 -07001/*
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
25namespace android {
26namespace bluetooth {
27
28using ::android::binder::Status;
29
30class BluetoothSocketManagerBinderServer : public BnBluetoothSocketManager {
31 public:
32 explicit BluetoothSocketManagerBinderServer(
Jakub Pawlowskiad311b22017-11-03 19:06:23 -070033 const btsock_interface_t* socketInterface)
34 : socketInterface(socketInterface) {}
Jakub Pawlowski80eeb8f2017-11-01 10:11:52 -070035 ~BluetoothSocketManagerBinderServer() override = default;
36
Jakub Pawlowskib55d9572017-11-06 10:36:58 -080037 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 Pawlowskiad311b22017-11-03 19:06:23 -070043 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 Tng1a8c6e32018-01-16 10:49:25 -080050 Status requestMaximumTxDataLength(const BluetoothDevice& device);
51
Jakub Pawlowski80eeb8f2017-11-01 10:11:52 -070052 private:
Jakub Pawlowskiad311b22017-11-03 19:06:23 -070053 const btsock_interface_t* socketInterface;
Jakub Pawlowski80eeb8f2017-11-01 10:11:52 -070054 DISALLOW_COPY_AND_ASSIGN(BluetoothSocketManagerBinderServer);
55};
56} // namespace bluetooth
57} // namespace android