1 /*
2  * Copyright (C) 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 #ifndef OHOS_BLUETOOTH_IBLUETOOTHHIDHOST_H
16 #define OHOS_BLUETOOTH_IBLUETOOTHHIDHOST_H
17 
18 #include <vector>
19 #include <string_ex.h>
20 #include <iremote_broker.h>
21 #include "bluetooth_service_ipc_interface_code.h"
22 #include "i_bluetooth_hid_host_observer.h"
23 
24 using OHOS::Bluetooth::IBluetoothHidHostObserver;
25 
26 namespace OHOS {
27 namespace Bluetooth {
28 using namespace OHOS::bluetooth;
29 
30 class IBluetoothHidHost : public IRemoteBroker {
31 public:
32     DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.Bluetooth.IBluetoothHidHost");
33 
34     virtual int32_t Connect(const BluetoothRawAddress &device) = 0;
35     virtual int32_t Disconnect(const BluetoothRawAddress &device) = 0;
36     virtual int32_t GetDeviceState(const BluetoothRawAddress &device, int32_t &state) = 0;
37     virtual int32_t GetDevicesByStates(const std::vector<int32_t> &states,
38         std::vector<BluetoothRawAddress>& result) = 0;
39     virtual ErrCode RegisterObserver(const sptr<IBluetoothHidHostObserver> observer) = 0;
40     virtual ErrCode DeregisterObserver(const sptr<IBluetoothHidHostObserver> observer) = 0;
41     virtual ErrCode HidHostVCUnplug(std::string &device,
42         uint8_t &id, uint16_t &size, uint8_t &type, int& result) = 0;
43     virtual ErrCode HidHostSendData(std::string &device,
44         uint8_t &id, uint16_t &size, uint8_t &type, int& result) = 0;
45     virtual ErrCode HidHostSetReport(std::string &device,
46         uint8_t &type, std::string &report, int& reuslt) = 0;
47     virtual ErrCode HidHostGetReport(std::string &device,
48         uint8_t &id, uint16_t &size, uint8_t &type, int& result) = 0;
49     virtual int32_t SetConnectStrategy(const BluetoothRawAddress &device, int strategy) = 0;
50     virtual int32_t GetConnectStrategy(const BluetoothRawAddress &device, int &strategy) = 0;
51 };
52 } // Bluetooth
53 } // OHOS
54 
55 #endif // OHOS_BLUETOOTH_IBLUETOOTHHIDHOST_H
56 
57