1 /*
2  * Copyright (C) 2021-2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef OHOS_BLUETOOTH_STANDARD_HID_HOST_SERVER_H
17 #define OHOS_BLUETOOTH_STANDARD_HID_HOST_SERVER_H
18 
19 #include <map>
20 
21 #include "bt_def.h"
22 #include "bluetooth_hid_host_stub.h"
23 #include "bluetooth_types.h"
24 #include "i_bluetooth_hid_host.h"
25 #include "if_system_ability_manager.h"
26 #include "iservice_registry.h"
27 #include "system_ability.h"
28 #include "interface_adapter_manager.h"
29 #include "interface_profile_manager.h"
30 
31 namespace OHOS {
32 namespace Bluetooth {
33 class BluetoothHidHostServer : public BluetoothHidHostStub {
34 public:
35     explicit BluetoothHidHostServer();
36     ~BluetoothHidHostServer() override;
37 
38     int32_t Connect(
39         const BluetoothRawAddress &device) override;
40 
41     int32_t Disconnect(
42         const BluetoothRawAddress &device) override;
43 
44     int32_t GetDeviceState(
45         const BluetoothRawAddress &device, int32_t &state) override;
46 
47     int32_t GetDevicesByStates(
48         const std::vector<int32_t> &states,
49         std::vector<BluetoothRawAddress>& result) override;
50 
51     ErrCode RegisterObserver(
52         const sptr<IBluetoothHidHostObserver> observer) override;
53 
54     ErrCode DeregisterObserver(
55         const sptr<IBluetoothHidHostObserver> observer) override;
56 
57     ErrCode HidHostVCUnplug(
58         std::string &device,
59         uint8_t &id,
60         uint16_t &size,
61         uint8_t &type,
62         int& result) override;
63 
64     ErrCode HidHostSendData(
65         std::string &device,
66         uint8_t &id,
67         uint16_t &size,
68         uint8_t &type,
69         int& result) override;
70 
71     ErrCode HidHostSetReport(
72         std::string &device,
73         uint8_t &type,
74         std::string &report,
75         int& reuslt) override;
76 
77     ErrCode HidHostGetReport(
78         std::string &device,
79         uint8_t &id,
80         uint16_t &size,
81         uint8_t &type,
82         int& result) override;
83     int32_t SetConnectStrategy(const BluetoothRawAddress &device, int strategy) override;
84     int32_t GetConnectStrategy(const BluetoothRawAddress &device, int &strategy) override;
85 private:
86     BLUETOOTH_DISALLOW_COPY_AND_ASSIGN(BluetoothHidHostServer);
87     BLUETOOTH_DECLARE_IMPL();
88 };
89 }  // namespace Bluetooth
90 }  // namespace OHOS
91 #endif  // OHOS_BLUETOOTH_STANDARD_HID_HOST_SERVER_H
92 
93