4 * Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
20 #ifndef __BLUETOOTH_HID_API_H
21 #define __BLUETOOTH_HID_API_H
28 #define HID_ADDRESS_LENGTH 6
30 #define HID_ERROR_NONE ((int)0)
32 #define HID_ERROR_BASE ((int)0)
33 #define HID_ERROR_ALREADY_INITIALIZED ((int)HID_ERROR_BASE - 0x01)
34 #define HID_ERROR_NOT_INITIALIZED ((int)HID_ERROR_BASE - 0x01)
35 #define HID_ERROR_NOT_PAIRED ((int)HID_ERROR_BASE - 0x02)
36 #define HID_ERROR_INTERNAL ((int)HID_ERROR_BASE - 0x03)
37 #define HID_ERROR_INVALID_PARAM ((int)HID_ERROR_BASE - 0x04)
38 #define HID_ERROR_NOT_ENABLED ((int)HID_ERROR_BASE - 0x05)
39 #define HID_ERROR_CONNECTION_FAILED ((int)HID_ERROR_BASE - 0x06)
48 typedef void (*hid_cb_func_ptr)(int, hid_event_param_t *, void *);
51 unsigned char addr[HID_ADDRESS_LENGTH];
52 } hid_device_address_t;
56 * @fn int bluetooth_hid_init(hid_cb_func_ptr callback_ptr, void *user_data)
57 * @brief Initialize HID service and register the callback
59 * This function is a synchronous call.
61 * @return HID_ERROR_NONE - Success \n
62 * HID_ERROR_ALREADY_INITIALIZED - Aready Initialized \n
63 * HID_ERROR_INTERNAL - Internal Error \n
64 * HID_ERROR_NOT_ENABLED - Not enabled \n
69 int bluetooth_hid_init(hid_cb_func_ptr callback_ptr, void *user_data);
72 * @fn int bluetooth_hid_deinit(void)
73 * @brief Initialize HID service and register the callback
75 * This function is a synchronous call.
77 * @return HID_ERROR_NONE - Success \n
78 * HID_ERROR_NOT_INITIALIZED - Not Initialiezed \n
83 int bluetooth_hid_deinit(void);
87 * @fn int bluetooth_hid_connect(hid_device_address_t *device_address)
89 * @brief Connect the HID device in the peer
91 * This function is a asynchronous call.
92 * The HID connect request is responded by BLUETOOTH_HID_CONNECTED event.
94 * @return HID_ERROR_NONE - Success \n
95 * HID_ERROR_INVALID_PARAM - Invalid parameter \n
96 * HID_ERROR_NOT_INITIALIZED - Internal Error \n
97 * HID_ERROR_NOT_ENABLED - Not enabled \n
98 * HID_ERROR_INTERNAL - Not enabled \n
99 * HID_ERROR_NOT_PAIRED - Not enabled \n
100 * HID_ERROR_CONNECTION_FAILED - Connection Fail \n
103 * @param[in] device_address This indicates an address of the device with which the pairing
104 * should be initiated
107 int bluetooth_hid_connect(hid_device_address_t *device_address);
110 * @fn int bluetooth_hid_disconnect(hid_device_address_t *device_address)
112 * @brief Disconnect the HID device in the peer
114 * This function is a asynchronous call.
115 * The HID connect request is responded by BLUETOOTH_HID_DISCONNECTED event.
117 * @return HID_ERROR_NONE - Success \n
118 * HID_ERROR_INVALID_PARAM - Invalid parameter \n
119 * HID_ERROR_NOT_INITIALIZED - Internal Error \n
120 * HID_ERROR_NOT_ENABLED - Not enabled \n
121 * HID_ERROR_INTERNAL - Not enabled \n
122 * HID_ERROR_NOT_PAIRED - Not enabled \n
123 * HID_ERROR_CONNECTION_FAILED - Connection Fail \n
126 * @param[in] device_address This indicates an address of the device with which the pairing
127 * should be initiated
130 int bluetooth_hid_disconnect(hid_device_address_t *device_address);
136 #endif /* __BLUETOOTH_HID_API_H */