4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Hocheol Seo <hocheol.seo@samsung.com>
7 * Girishashok Joshi <girish.joshi@samsung.com>
8 * Chanyeol Park <chanyeol.park@samsung.com>
10 * Licensed under the Apache License, Version 2.0 (the "License");
11 * you may not use this file except in compliance with the License.
12 * You may obtain a copy of the License at
14 * http://www.apache.org/licenses/LICENSE-2.0
16 * Unless required by applicable law or agreed to in writing, software
17 * distributed under the License is distributed on an "AS IS" BASIS,
18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 * See the License for the specific language governing permissions and
20 * limitations under the License.
24 #ifndef __BLUETOOTH_HID_API_H
25 #define __BLUETOOTH_HID_API_H
32 #define HID_ADDRESS_LENGTH 6
34 #define HID_ERROR_NONE ((int)0)
36 #define HID_ERROR_BASE ((int)0)
37 #define HID_ERROR_ALREADY_INITIALIZED ((int)HID_ERROR_BASE - 0x01)
38 #define HID_ERROR_NOT_INITIALIZED ((int)HID_ERROR_BASE - 0x01)
39 #define HID_ERROR_NOT_PAIRED ((int)HID_ERROR_BASE - 0x02)
40 #define HID_ERROR_INTERNAL ((int)HID_ERROR_BASE - 0x03)
41 #define HID_ERROR_INVALID_PARAM ((int)HID_ERROR_BASE - 0x04)
42 #define HID_ERROR_NOT_ENABLED ((int)HID_ERROR_BASE - 0x05)
43 #define HID_ERROR_CONNECTION_FAILED ((int)HID_ERROR_BASE - 0x06)
52 typedef void (*hid_cb_func_ptr)(int, hid_event_param_t *, void *);
55 unsigned char addr[HID_ADDRESS_LENGTH];
56 } hid_device_address_t;
60 * @fn int bluetooth_hid_init(hid_cb_func_ptr callback_ptr, void *user_data)
61 * @brief Initialize HID service and register the callback
63 * This function is a synchronous call.
65 * @return HID_ERROR_NONE - Success \n
66 * HID_ERROR_ALREADY_INITIALIZED - Aready Initialized \n
67 * HID_ERROR_INTERNAL - Internal Error \n
68 * HID_ERROR_NOT_ENABLED - Not enabled \n
73 int bluetooth_hid_init(hid_cb_func_ptr callback_ptr, void *user_data);
76 * @fn int bluetooth_hid_deinit(void)
77 * @brief Initialize HID service and register the callback
79 * This function is a synchronous call.
81 * @return HID_ERROR_NONE - Success \n
82 * HID_ERROR_NOT_INITIALIZED - Not Initialiezed \n
87 int bluetooth_hid_deinit(void);
91 * @fn int bluetooth_hid_connect(hid_device_address_t *device_address)
93 * @brief Connect the HID device in the peer
95 * This function is a asynchronous call.
96 * The HID connect request is responded by BLUETOOTH_HID_CONNECTED event.
98 * @return HID_ERROR_NONE - Success \n
99 * HID_ERROR_INVALID_PARAM - Invalid parameter \n
100 * HID_ERROR_NOT_INITIALIZED - Internal Error \n
101 * HID_ERROR_NOT_ENABLED - Not enabled \n
102 * HID_ERROR_INTERNAL - Not enabled \n
103 * HID_ERROR_NOT_PAIRED - Not enabled \n
104 * HID_ERROR_CONNECTION_FAILED - Connection Fail \n
107 * @param[in] device_address This indicates an address of the device with which the pairing
108 * should be initiated
111 int bluetooth_hid_connect(hid_device_address_t *device_address);
114 * @fn int bluetooth_hid_disconnect(hid_device_address_t *device_address)
116 * @brief Disconnect the HID device in the peer
118 * This function is a asynchronous call.
119 * The HID connect request is responded by BLUETOOTH_HID_DISCONNECTED event.
121 * @return HID_ERROR_NONE - Success \n
122 * HID_ERROR_INVALID_PARAM - Invalid parameter \n
123 * HID_ERROR_NOT_INITIALIZED - Internal Error \n
124 * HID_ERROR_NOT_ENABLED - Not enabled \n
125 * HID_ERROR_INTERNAL - Not enabled \n
126 * HID_ERROR_NOT_PAIRED - Not enabled \n
127 * HID_ERROR_CONNECTION_FAILED - Connection Fail \n
130 * @param[in] device_address This indicates an address of the device with which the pairing
131 * should be initiated
134 int bluetooth_hid_disconnect(hid_device_address_t *device_address);
140 #endif /* __BLUETOOTH_HID_API_H */