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 
16 /**
17  * @addtogroup Bluetooth
18  * @{
19  *
20  * @brief Defines hid host service interface, including observer and api functions.
21  *
22  */
23 
24 /**
25  * @file interface_profile_hid_host.h
26  *
27  * @brief hid host interface.
28  *
29  */
30 
31 #ifndef INTERFACE_PROFILE_HID_HOST_H
32 #define INTERFACE_PROFILE_HID_HOST_H
33 
34 #include "interface_profile.h"
35 
36 namespace OHOS {
37 namespace bluetooth {
38 /**
39  * @brief hid host observer for framework api
40  *
41  */
42 class IHidHostObserver {
43 public:
44     /**
45      * @brief Destroy the IHidHostObserver object
46      *
47      */
48     virtual ~IHidHostObserver() = default;
49     /**
50      * @brief  ConnectionState Changed
51      *
52      * @param  deviceAddress     bluetooth address
53      * @param  state            changed status
54      */
OnConnectionStateChanged(const RawAddress & deviceAddress,int state)55     virtual void OnConnectionStateChanged(const RawAddress &deviceAddress, int state) {};
56 };
57 
58 class IProfileHidHost : public IProfile {
59 public:
60     /**
61      * @brief  register observer
62      *
63      * @param  observer         function pointer
64      */
65     virtual void RegisterObserver(IHidHostObserver &observer) = 0;
66     /**
67      * @brief  deregister observer
68      *
69      * @param  observer         function pointer
70      */
71     virtual void DeregisterObserver(IHidHostObserver &observer) = 0;
72     /**
73      * @brief Get remote AG device list which are in the specified states.
74      *
75      * @param states List of remote device states.
76      * @return Returns the list of devices.
77      */
78     virtual std::vector<RawAddress> GetDevicesByStates(std::vector<int> states) = 0;
79 
80     /**
81      * @brief Get the connection state of the specified remote device.
82      *
83      * @param device Remote device object.
84      * @return Returns the connection state of the remote device.
85      */
86     virtual int GetDeviceState(const RawAddress &device) = 0;
87 
88     /**
89      * @brief Get Hid Host VCUnplug.
90      *
91      */
92     virtual int HidHostVCUnplug(std::string device, uint8_t id, uint16_t size, uint8_t type) = 0;
93 
94     /**
95      * @brief Hid Host Send Data.
96      *
97      */
98     virtual int HidHostSendData(std::string device, uint8_t id, uint16_t size, uint8_t type) = 0;
99 
100     /**
101      * @brief Hid Host Set Report.
102      *
103      */
104     virtual int HidHostSetReport(std::string device, uint8_t type, uint16_t size, const uint8_t* report) = 0;
105 
106     /**
107      * @brief Hid Host Get Report.
108      *
109      */
110     virtual int HidHostGetReport(std::string device, uint8_t id, uint16_t size, const uint8_t type) = 0;
111 };
112 }  // namespace bluetooth
113 }  // namespace OHOS
114 #endif  // INTERFACE_PROFILE_HID_HOST_H