Fix the svace issue (DEREF_OF_NULL)
[platform/core/connectivity/bluetooth-frwk.git] / bt-oal / include / oal-hid-host.h
1 /*
2  * Open Adaptation Layer (OAL)
3  *
4  * Copyright (c) 2014-2015 Samsung Electronics Co., Ltd.
5  *
6  * Contact: Anupam Roy <anupam.r@samsung.com>
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  *              http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  */
21
22 #ifndef _OAL_HID_HOST_H_
23 #define _OAL_HID_HOST_H_
24
25 #include <glib.h>
26 #include <sys/types.h>
27
28 #include <oal-manager.h>
29
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33
34 #define OAL_SMART_RC_FEATURE_REPORT_ID  0x03
35
36 /**
37  * @brief HID Vendor specific report callback
38 */
39 typedef void (*hid_report_callback)(bt_address_t *address, uint8_t* rpt_data, int rpt_size);
40
41 /**
42  * @brief Enable HID Host Feature
43  *
44  * @remarks  HID mouse/keyboard/RC will be able to connect.
45  *
46  * @return OAL_STATUS_SUCCESS on success, otherwise non-zero error value.
47  * @retval #OAL_STATUS_SUCCESS  Successful
48  *
49  * @pre OAL API must be initialized with oal_bt_init().
50  *
51  * @see  hid_disable()
52  */
53 oal_status_t hid_enable(void);
54
55
56 /**
57  * @brief Disable HID Host Feature
58  *
59  * @remarks  HID mouse/keyboard/RC will not be able to connect.
60  *
61  * @return OAL_STATUS_SUCCESS on success, otherwise a non-zero error value.
62  * @retval #OAL_STATUS_SUCCESS  Successful
63  *
64  * @pre HID host should be enabled with hid_enable().
65  *
66  * @see  hid_enable()
67  */
68 oal_status_t hid_disable(void);
69
70 /**
71  * @brief Initiate connection with an HID device
72  *
73  * @details  Result will be notified through an OAL event
74  *
75  * @return OAL_STATUS_SUCCESS on success, otherwise a non-zero error value.
76  * @retval #OAL_STATUS_SUCCESS  Successful
77  *
78  * @pre HID host should be enabled with hid_enable().
79  *
80  * @see  OAL_EVENT_HID_CONNECTED
81  */
82 oal_status_t hid_connect(bt_address_t *address);
83
84 /**
85  * @brief Remove a connection with an HID device
86  *
87  * @details  Result will be notified through an OAL event
88  *
89  * @return OAL_STATUS_SUCCESS on success, otherwise a non-zero error value.
90  * @retval #OAL_STATUS_SUCCESS  Successful
91  *
92  * @pre HID host should be connected with a device.
93  *
94  * @see  OAL_EVENT_HID_DISCONNECTED
95  */
96 oal_status_t hid_disconnect(bt_address_t * address);
97
98 #ifdef __cplusplus
99 }
100 #endif /* __cplusplus */
101 #endif /* _OAL_HID_HOST_H_ */