Merge the code from tizen_2.4
[platform/core/connectivity/bluetooth-frwk.git] / include / bluetooth-api.h
1 /*
2  * Bluetooth-frwk
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact:  Hocheol Seo <hocheol.seo@samsung.com>
7  *               Girishashok Joshi <girish.joshi@samsung.com>
8  *               Chanyeol Park <chanyeol.park@samsung.com>
9  *
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
13  *
14  *              http://www.apache.org/licenses/LICENSE-2.0
15  *
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.
21  *
22  */
23
24 #ifndef _BLUETOOTH_API_H_
25 #define _BLUETOOTH_API_H_
26
27 #include <stdlib.h>
28 #include <unistd.h>
29 #include <glib.h>
30
31 #ifdef __cplusplus
32 extern "C" {
33 #endif                          /* __cplusplus */
34
35 /**
36  * @defgroup BLUETOOTHFW BluetoothFW
37  *
38  * A base library for bluetooth framework
39  *
40  * @addtogroup BLUETOOTHFW
41  * @{
42  */
43
44 #define BLUETOOTH_ADDRESS_LENGTH            6 /**< This specifies bluetooth device address length */
45 #define BLUETOOTH_VERSION_LENGTH_MAX       30 /**< This specifies bluetooth device version length */
46 #define BLUETOOTH_INTERFACE_NAME_LENGTH        16
47 #define BLUETOOTH_DEVICE_NAME_LENGTH_MAX       248 /**< This specifies maximum device name length */
48 #define BLUETOOTH_DEVICE_PASSKEY_LENGTH_MAX       50 /**< This specifies maximum length of the passkey */
49 #define BLUETOOTH_ADVERTISING_DATA_LENGTH_MAX   31 /**< This specifies maximum AD data length */
50 #define BLUETOOTH_SCAN_RESP_DATA_LENGTH_MAX     31 /**< This specifies maximum LE Scan response data length */
51 #define BLUETOOTH_MANUFACTURER_DATA_LENGTH_MAX  240 /**< This specifies maximum manufacturer data length */
52
53 #define BLUETOOTH_MAX_SERVICES_FOR_DEVICE       40  /**< This specifies maximum number of services
54                                                         a device can support */
55
56 #define BLUETOOTH_UUID_STRING_MAX 50
57 #define BLUETOOTH_PATH_STRING 50
58
59 #define BLUETOOTH_OOB_DATA_LENGTH 16
60
61 #define BLUETOOTH_PIN_CODE_MAX_LENGTH 16
62
63 /**
64  * This is Bluetooth Connected event role
65  */
66 #define RFCOMM_ROLE_SERVER 1
67 #define RFCOMM_ROLE_CLIENT 2
68
69 /**
70  * This is RFCOMM default Channel Value
71  */
72 #define RFCOMM_DEFAULT_PROFILE_CHANNEL 0
73
74 /**
75  * This is maximum length for search value string for PBAP Phonebook Search
76  */
77 #define BLUETOOTH_PBAP_MAX_SEARCH_VALUE_LENGTH 100
78
79
80 /**
81  * This is Bluetooth error code
82  */
83 #define BLUETOOTH_ERROR_BASE                   ((int)0)         /**< Error code base */
84
85 #define BLUETOOTH_ERROR_NONE                   ((int)0)         /**< No error #0 */
86 #define BLUETOOTH_ERROR_CANCEL                 ((int)BLUETOOTH_ERROR_BASE - 0x01)
87                                                                 /**< cancelled */
88 #define BLUETOOTH_ERROR_INVALID_CALLBACK       ((int)BLUETOOTH_ERROR_BASE - 0x02)
89                                                                 /**< Callback error */
90 #define BLUETOOTH_ERROR_INVALID_PARAM          ((int)BLUETOOTH_ERROR_BASE - 0x03)
91                                                                 /**< invalid paramerror */
92 #define BLUETOOTH_ERROR_INVALID_DATA           ((int)BLUETOOTH_ERROR_BASE - 0x04)
93                                                                 /**< invalid data error */
94 #define BLUETOOTH_ERROR_MEMORY_ALLOCATION      ((int)BLUETOOTH_ERROR_BASE - 0x05)
95                                                                 /**< Memory allocation error */
96 #define BLUETOOTH_ERROR_OUT_OF_MEMORY          ((int)BLUETOOTH_ERROR_BASE - 0x06)
97                                                                 /**< out of memory error */
98 #define BLUETOOTH_ERROR_TIMEOUT                ((int)BLUETOOTH_ERROR_BASE - 0x07)
99                                                                 /**< timeout error */
100 #define BLUETOOTH_ERROR_NO_RESOURCES           ((int)BLUETOOTH_ERROR_BASE - 0x08)
101                                                                 /**< No resource error */
102 #define BLUETOOTH_ERROR_INTERNAL               ((int)BLUETOOTH_ERROR_BASE - 0x09)
103                                                                 /**< internal error */
104 #define BLUETOOTH_ERROR_NOT_SUPPORT            ((int)BLUETOOTH_ERROR_BASE - 0x0a)
105                                                                 /**< Not supported error */
106 #define BLUETOOTH_ERROR_DEVICE_NOT_ENABLED     ((int)BLUETOOTH_ERROR_BASE - 0x0b)
107                                                                 /**< Operation is failed because
108                                                                 of not enabled BT Adapter */
109 #define BLUETOOTH_ERROR_DEVICE_ALREADY_ENABLED  ((int)BLUETOOTH_ERROR_BASE - 0x0c)
110                                                                 /**< Enabling is failed because of
111                                                                 already enabled BT Adapter */
112 #define BLUETOOTH_ERROR_DEVICE_BUSY            ((int)BLUETOOTH_ERROR_BASE - 0x0d)
113                                                                 /**< Operation is failed because of
114                                                                 other on going operation */
115 #define BLUETOOTH_ERROR_ACCESS_DENIED          ((int)BLUETOOTH_ERROR_BASE - 0x0e)
116                                                                 /**< access denied error */
117 #define BLUETOOTH_ERROR_MAX_CLIENT             ((int)BLUETOOTH_ERROR_BASE - 0x0f)
118                                                                 /**< max client error */
119 #define BLUETOOTH_ERROR_NOT_FOUND              ((int)BLUETOOTH_ERROR_BASE - 0x10)
120                                                                 /**< not found error */
121 #define BLUETOOTH_ERROR_SERVICE_SEARCH_ERROR   ((int)BLUETOOTH_ERROR_BASE - 0x11)
122                                                                 /**< service search fail */
123 #define BLUETOOTH_ERROR_PARING_FAILED          ((int)BLUETOOTH_ERROR_BASE - 0x12)
124                                                                 /**< pairing failed error */
125 #define BLUETOOTH_ERROR_NOT_PAIRED             ((int)BLUETOOTH_ERROR_BASE - 0x13)
126                                                                 /**< Not paired error */
127 #define BLUETOOTH_ERROR_SERVICE_NOT_FOUND      ((int)BLUETOOTH_ERROR_BASE - 0x14)
128                                                                 /**< no service error */
129 #define BLUETOOTH_ERROR_NOT_CONNECTED          ((int)BLUETOOTH_ERROR_BASE - 0x15)
130                                                                 /**< no connection error */
131 #define BLUETOOTH_ERROR_ALREADY_CONNECT        ((int)BLUETOOTH_ERROR_BASE - 0x16)
132                                                                 /**< alread connected error */
133 #define BLUETOOTH_ERROR_CONNECTION_BUSY        ((int)BLUETOOTH_ERROR_BASE - 0x17)
134                                                                 /**< connection busy error */
135 #define BLUETOOTH_ERROR_CONNECTION_ERROR       ((int)BLUETOOTH_ERROR_BASE - 0x18)
136                                                                 /**< connection error */
137 #define BLUETOOTH_ERROR_MAX_CONNECTION         ((int)BLUETOOTH_ERROR_BASE - 0x19)
138                                                                 /**< max connection error*/
139 #define BLUETOOTH_ERROR_NOT_IN_OPERATION       ((int)BLUETOOTH_ERROR_BASE - 0x1a)
140                                                                 /**< Not in operation */
141 #define BLUETOOTH_ERROR_CANCEL_BY_USER         ((int)BLUETOOTH_ERROR_BASE - 0x1b)
142                                                                 /**< Cancelled by user */
143 #define BLUETOOTH_ERROR_REGISTRATION_FAILED    ((int)BLUETOOTH_ERROR_BASE - 0x1c)
144                                                                 /**< Service record registration failed */
145 #define BLUETOOTH_ERROR_IN_PROGRESS            ((int)BLUETOOTH_ERROR_BASE - 0x1d)
146                                                                 /**< Operation in progress */
147 #define BLUETOOTH_ERROR_AUTHENTICATION_FAILED  ((int)BLUETOOTH_ERROR_BASE - 0x1e)
148                                                                 /**< authentication failed error when paring*/
149 #define BLUETOOTH_ERROR_HOST_DOWN              ((int)BLUETOOTH_ERROR_BASE - 0x1f)
150                                                                 /**< Remote host is down */
151 #define BLUETOOTH_ERROR_END_OF_DEVICE_LIST     ((int)BLUETOOTH_ERROR_BASE - 0x20)
152                                                                 /**< End of device list */
153
154 #define BLUETOOTH_ERROR_AGENT_ALREADY_EXIST      ((int)BLUETOOTH_ERROR_BASE - 0x21)
155                                                                 /**< Obex agent already exists */
156 #define BLUETOOTH_ERROR_AGENT_DOES_NOT_EXIST    ((int)BLUETOOTH_ERROR_BASE - 0x22)
157                                                                 /**< Obex agent does not exist */
158
159 #define BLUETOOTH_ERROR_ALREADY_INITIALIZED    ((int)BLUETOOTH_ERROR_BASE - 0x23)
160                                                                 /**< Already initialized */
161
162 #define BLUETOOTH_ERROR_PERMISSION_DEINED    ((int)BLUETOOTH_ERROR_BASE - 0x24)
163                                                                 /**< Permission deined */
164
165 #define BLUETOOTH_ERROR_ALREADY_DEACTIVATED    ((int)BLUETOOTH_ERROR_BASE - 0x25)
166                                                                 /**< Nap already done */
167
168 #define BLUETOOTH_ERROR_NOT_INITIALIZED    ((int)BLUETOOTH_ERROR_BASE - 0x26)
169                                                                 /**< Not initialized */
170
171 /**
172 * Device disconnect reason
173 */
174 typedef enum {
175         BLUETOOTH_DEVICE_DISCONNECT_UNKNOWN,
176         BLUETOOTH_DEVICE_DISCONNECT_TIMEOUT,
177         BLUETOOTH_DEVICE_DISCONNECT_LOCAL_HOST,
178         BLUETOOTH_DEVICE_DISCONNECT_REMOTE,
179 } bluetooth_device_disconnect_reason_t;
180
181 /**
182  * This is Bluetooth device address type, fixed to 6 bytes ##:##:##:##:##:##
183  */
184 typedef struct {
185         unsigned char addr[BLUETOOTH_ADDRESS_LENGTH];
186 } bluetooth_device_address_t;
187
188 /**
189  * This is Bluetooth device address type
190  */
191 typedef enum
192 {
193         BLUETOOTH_DEVICE_PUBLIC_ADDRESS = 0x00,
194         BLUETOOTH_DEVICE_RANDOM_ADDRESS
195 } bluetooth_device_address_type_t;
196
197 /**
198  * This is Bluetooth version
199  */
200 typedef struct {
201         char version[BLUETOOTH_VERSION_LENGTH_MAX + 1];
202 } bluetooth_version_t;
203
204 /**
205  * This is Bluetooth device name type, maximum size of Bluetooth device name is 248 bytes
206  */
207 typedef struct {
208         char name[BLUETOOTH_DEVICE_NAME_LENGTH_MAX + 1];
209 } bluetooth_device_name_t;
210
211 /**
212  * This is Bluetooth manufacturer specific data, maximum size of data is 240 bytes
213  */
214 typedef struct {
215         int data_len;           /**< manafacturer specific data length */
216         char data[BLUETOOTH_MANUFACTURER_DATA_LENGTH_MAX];
217 } bluetooth_manufacturer_data_t;
218
219 typedef struct {
220         char pin_code[BLUETOOTH_PIN_CODE_MAX_LENGTH + 1];
221 } bluetooth_device_pin_code_t;
222
223 /**
224  * Adapter state
225  */
226 typedef enum {
227         BLUETOOTH_ADAPTER_DISABLED,         /**< Bluetooth adapter is disabled */
228         BLUETOOTH_ADAPTER_ENABLED,          /**< Bluetooth adapter is enabled */
229         BLUETOOTH_ADAPTER_CHANGING_ENABLE,  /**< Bluetooth adapter is currently enabling */
230         BLUETOOTH_ADAPTER_CHANGING_DISABLE, /**< Bluetooth adapter is currently disabling */
231 } bluetooth_adapter_state_t;
232
233 /**
234  * Adapter state
235  */
236 typedef enum {
237         BLUETOOTH_ADAPTER_LE_DISABLED,      /**< Bluetooth adapter le is disabled */
238         BLUETOOTH_ADAPTER_LE_ENABLED,       /**< Bluetooth adapter le is enabled */
239         BLUETOOTH_ADAPTER_LE_CHANGING_ENABLE,  /**< Bluetooth adapter le is currently enabling */
240         BLUETOOTH_ADAPTER_LE_CHANGING_DISABLE, /**< Bluetooth adapter le is currently disabling */
241 } bluetooth_adapter_le_state_t;
242
243 /**
244  * Discoverable mode
245  */
246 typedef enum {
247         BLUETOOTH_DISCOVERABLE_MODE_CONNECTABLE,         /**< Non discoverable mode */
248         /*Changed the order to make it compatable with old method */
249         BLUETOOTH_DISCOVERABLE_MODE_GENERAL_DISCOVERABLE,/**< Discoverable mode */
250         BLUETOOTH_DISCOVERABLE_MODE_TIME_LIMITED_DISCOVERABLE,
251                                                          /**< Discoverable mode with time limit
252                                                         After specific timeout, it is changed
253                                                                 to non discoverable mode */
254 } bluetooth_discoverable_mode_t;
255
256 /**
257  * Network connect mode
258  */
259 typedef enum {
260         BLUETOOTH_NETWORK_PANU_ROLE,
261                                  /**< PAN user */
262         BLUETOOTH_NETWORK_NAP_ROLE,/**< Network Access Point */
263         BLUETOOTH_NETWORK_GN_ROLE,  /**< Group ad-hoc Network */
264         BLUETOOTH_NETWORK_CUSTOM_UUID, /**< Custom role */
265 } bluetooth_network_role_t;
266
267 /**
268  * Service type
269  */
270 typedef enum {
271         BLUETOOTH_RFCOMM_SERVICE = 0x01,
272         BLUETOOTH_A2DP_SERVICE = 0x02,
273         BLUETOOTH_HSP_SERVICE = 0x04,
274         BLUETOOTH_HID_SERVICE = 0x08,
275         BLUETOOTH_NAP_SERVICE = 0x10,
276         BLUETOOTH_HFG_SERVICE = 0x20,
277         BLUETOOTH_GATT_SERVICE = 0x40,
278         BLUETOOTH_NAP_SERVER_SERVICE = 0x80,
279         BLUETOOTH_A2DP_SINK_SERVICE = 0x100,
280 } bluetooth_service_type_t;
281
282 /**
283  * Service type
284  */
285 typedef enum {
286         BLUETOOTH_DEV_CONN_DEFAULT = 0xFF, /* represents that connection
287                                         * type can both BR/EDR and LE */
288         BLUETOOTH_DEV_CONN_BREDR = 0x00,
289         BLUETOOTH_DEV_CONN_LE = 0x01,
290 } bluetooth_conn_type_t;
291
292 /**
293  * Service type
294  */
295 typedef enum {
296         BLUETOOTH_CODEC_ID_CVSD = 0x01,
297         BLUETOOTH_CODEC_ID_MSBC = 0x02,
298 } bluetooth_codec_type_t;
299
300 /**
301  * Service type
302  */
303 typedef enum {
304         BLUETOOTH_HF_AUDIO_DISCONNECTED = 0x00,
305         BLUETOOTH_HF_AUDIO_CONNECTED = 0x01,
306 } bluetooth_hf_audio_connected_type_t;
307
308 /**
309  * Advertising data
310  */
311 typedef struct {
312         guint8 data[BLUETOOTH_ADVERTISING_DATA_LENGTH_MAX];
313 } bluetooth_advertising_data_t;
314
315 /**
316  * Scan response data
317  */
318 typedef struct {
319         guint8 data[BLUETOOTH_SCAN_RESP_DATA_LENGTH_MAX];
320 } bluetooth_scan_resp_data_t;
321
322 /**
323  * Advertising filter policy
324  */
325 typedef enum {
326         BLUETOOTH_ALLOW_SCAN_CONN_ALL = 0x00,
327         BLUETOOTH_ALLOW_CONN_ALL_SCAN_WHITE_LIST = 0x01,
328         BLUETOOTH_ALLOW_SCAN_ALL_CONN_WHITE_LIST = 0x02,
329         BLUETOOTH_ALLOW_SCAN_CONN_WHITE_LIST = 0x03,
330 } bluetooth_advertising_filter_policy_t;
331
332 /**
333  * Advertising type
334  */
335 typedef enum {
336         BLUETOOTH_ADV_CONNECTABLE = 0x00, /* ADV_IND */
337         BLUETOOTH_ADV_CONNECTABLE_DIRECT_HIGH = 0x01, /* ADV_DIRECT_IND, high duty cycle */
338         BLUETOOTH_ADV_SCANNABLE = 0x02, /* ADV_SCAN_IND */
339         BLUETOOTH_ADV_NON_CONNECTABLE = 0x03, /* ADV_NONCOND_IND */
340         BLUETOOTH_ADV_CONNECTABLE_DIRECT_LOW = 0x04, /* ADV_DIRECT_IND, low duty cycle */
341 } bluetooth_advertising_type_t;
342
343 typedef enum
344 {
345         BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_BROADCAST = 0x01,
346         BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_READ = 0x02,
347         BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_WRITE_NO_RESPONSE = 0x04,
348         BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_WRITE = 0x08,
349         BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_NOTIFY = 0x10,
350         BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_INDICATE = 0x20,
351         BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_SIGNED_WRITE = 0x40,
352         BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_EXTENDED_PROPS = 0x80
353 }bt_gatt_characteristic_property_t;
354
355 /**
356 * Remote device request types for attributes
357 */
358 typedef enum {
359         BLUETOOTH_GATT_ATT_REQUEST_TYPE_READ = 0x00, /* Read Requested*/
360         BLUETOOTH_GATT_ATT_REQUEST_TYPE_WRITE = 0x01, /* Write Requested*/
361 } bluetooth_gatt_att_request_tyep_t;
362
363 /**
364 * Advertising parameters
365 */
366 typedef struct {
367         float interval_min;
368         float interval_max;
369         guint8 filter_policy;
370         guint8 type;
371 } bluetooth_advertising_params_t;
372
373 /**
374 * LE Scan parameters
375 */
376 typedef struct {
377         int type;  /**< passive 0, active 1 */
378         float interval;  /**< LE scan interval */
379         float window;  /**< LE scan window */
380 } bluetooth_le_scan_params_t;
381
382 /*
383         LE Connection Update
384  */
385 typedef struct {
386         guint16 interval_min;
387         guint16 interval_max;
388         guint16 latency;
389         guint16 timeout;
390 } bluetooth_le_connection_param_t;
391
392 /*
393         LE Read Maximum Data Length
394  */
395 typedef struct {
396         guint16 max_tx_octets;
397         guint16 max_tx_time;
398         guint16 max_rx_octets;
399         guint16 max_rx_time;
400 } bluetooth_le_read_maximum_data_length_t;
401
402 /*
403         LE Read Host suggested default Data Length
404  */
405 typedef struct {
406         guint16 def_tx_octets;
407         guint16 def_tx_time;
408 } bluetooth_le_read_host_suggested_data_length_t;
409
410 /**
411  * Samsung XSAT Vendor dependent command
412  */
413 typedef struct {
414         gint app_id;
415         char *message;
416 } bluetooth_vendor_dep_at_cmd_t;
417
418
419 #define BLUETOOTH_EVENT_BASE            ((int)(0x0000))         /**< No event */
420 #define BLUETOOTH_EVENT_GAP_BASE        ((int)(BLUETOOTH_EVENT_BASE + 0x0010))
421                                                                 /**< Base ID for GAP Event */
422 #define BLUETOOTH_EVENT_SDP_BASE        ((int)(BLUETOOTH_EVENT_GAP_BASE + 0x0020))
423                                                                 /**< Base ID for SDP events */
424 #define BLUETOOTH_EVENT_RFCOMM_BASE     ((int)(BLUETOOTH_EVENT_SDP_BASE + 0x0020))
425                                                                 /**< Base ID for RFCOMM events */
426 #define BLUETOOTH_EVENT_NETWORK_BASE     ((int)(BLUETOOTH_EVENT_RFCOMM_BASE + 0x0020))
427                                                                 /**< Base ID for NETWORK events */
428 #define BLUETOOTH_EVENT_HDP_BASE     ((int)(BLUETOOTH_EVENT_NETWORK_BASE + 0x0020))
429                                                                 /**< Base ID for HDP events */
430 #define BLUETOOTH_EVENT_OPC_BASE  ((int)(BLUETOOTH_EVENT_HDP_BASE + 0x0020))
431                                                                 /**< Base ID for OPC events */
432 #define BLUETOOTH_EVENT_OBEX_SERVER_BASE ((int)(BLUETOOTH_EVENT_OPC_BASE + 0x0020))
433                                                                 /**< Base ID for Obex Server events */
434 #define BLUETOOTH_EVENT_GATT_BASE ((int)(BLUETOOTH_EVENT_OBEX_SERVER_BASE + 0x0020))
435                                                                 /**< Base ID for GATT events */
436
437 #define BLUETOOTH_EVENT_AUDIO_BASE ((int)(BLUETOOTH_EVENT_GATT_BASE + 0x0020))
438                                                                 /**< Base ID for Audio events */
439 #define BLUETOOTH_EVENT_HID_BASE ((int)(BLUETOOTH_EVENT_AUDIO_BASE + 0x0030))
440                                                                 /**< Base ID for HID events */
441 #define BLUETOOTH_EVENT_ADVERTISING_BASE ((int)(BLUETOOTH_EVENT_HID_BASE + 0x0020))
442                                                                 /**< Base ID for Advertising events */
443 #define BLUETOOTH_EVENT_PBAP_CLIENT_BASE ((int)(BLUETOOTH_EVENT_ADVERTISING_BASE + 0x0020))
444                                                                 /**< Base ID for PBAP Client events */
445 #define BLUETOOTH_EVENT_AVRCP_CONTROL_BASE ((int)(BLUETOOTH_EVENT_PBAP_CLIENT_BASE + 0x0020))
446                                                                 /**< Base ID for AVRCP events */
447 #define BLUETOOTH_EVENT_IPSP_BASE ((int)(BLUETOOTH_EVENT_AVRCP_CONTROL_BASE + 0x0020))
448                                                                 /**< Base ID for IPSP events */
449
450 /**
451  * Bluetooth event type
452  */
453 typedef enum {
454         BLUETOOTH_EVENT_NONE = BLUETOOTH_EVENT_BASE,/**< No event */
455
456         BLUETOOTH_EVENT_ENABLED,                    /**< Bluetooth event adpater enabled */
457         BLUETOOTH_EVENT_DISABLED,                   /**< Bluetooth event adpater disabled */
458         BLUETOOTH_EVENT_LE_ENABLED,                 /**< Bluetooth event adpater enabled */
459         BLUETOOTH_EVENT_LE_DISABLED,                /**< Bluetooth event adpater disabled */
460         BLUETOOTH_EVENT_LOCAL_NAME_CHANGED,         /**< Bluetooth event local name changed*/
461         BLUETOOTH_EVENT_DISCOVERABLE_TIMEOUT_REQUESTED,
462                                         /**< Bluetooth event Discoverable timeout requested*/
463         BLUETOOTH_EVENT_DISCOVERABLE_MODE_CHANGED,  /**< Bluetooth event mode changed */
464         BLUETOOTH_EVENT_DISCOVERY_OPTION_REQUESTED, /**< Bluetooth event discovery option */
465         BLUETOOTH_EVENT_DISCOVERY_STARTED,          /**< Bluetooth event discovery started */
466         BLUETOOTH_EVENT_DISCOVERY_FINISHED,         /**< Bluetooth event discovery finished */
467         BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND,        /**< Bluetooth event remote deice found */
468         BLUETOOTH_EVENT_LE_DISCOVERY_STARTED,           /**< Bluetooth event LE discovery started */
469         BLUETOOTH_EVENT_LE_DISCOVERY_FINISHED,  /**< Bluetooth event LE discovery finished */
470         BLUETOOTH_EVENT_REMOTE_LE_DEVICE_FOUND,     /**< Bluetooth event remote deice found (LE dev) */
471         BLUETOOTH_EVENT_REMOTE_DEVICE_NAME_UPDATED,/**< Bluetooth event remote device name updated*/
472         BLUETOOTH_EVENT_BONDING_FINISHED,           /**< Bluetooth event bonding completed */
473         BLUETOOTH_EVENT_BONDED_DEVICE_REMOVED,      /**< Bluetooth event bonding removed */
474         BLUETOOTH_EVENT_BONDED_DEVICE_FOUND,        /**< Bluetooth event paired device found */
475         BLUETOOTH_EVENT_REMOTE_DEVICE_READ,         /**< Bluetooth event read remote device */
476         BLUETOOTH_EVENT_DEVICE_AUTHORIZED,          /**< Bluetooth event authorize device */
477         BLUETOOTH_EVENT_DEVICE_UNAUTHORIZED,        /**< Bluetooth event unauthorize device */
478         BLUETOOTH_EVENT_DISCOVERABLE_TIMEOUT_CHANGED,  /**< Bluetooth event mode changed */
479         BLUETOOTH_EVENT_KEYBOARD_PASSKEY_DISPLAY,       /**Bluetooth event for displaying keyboard  passkey to user*/
480         BLUETOOTH_EVENT_PIN_REQUEST,    /**Bluetooth event for PIN input by user*/
481         BLUETOOTH_EVENT_PASSKEY_REQUEST,        /**Bluetooth event for entering Passkey by user*/
482         BLUETOOTH_EVENT_PASSKEY_CONFIRM_REQUEST,        /**Bluetooth event for Passkey confirmation by user*/
483         BLUETOOTH_EVENT_CONNECTABLE_CHANGED,        /**< Bluetooth event connectable changed */
484
485         BLUETOOTH_EVENT_RSSI_ENABLED,           /**< Bluetooth event RSSI monitoring enabled */
486         BLUETOOTH_EVENT_RSSI_ALERT,                             /**< Bluetooth event RSSI Alert */
487         BLUETOOTH_EVENT_RAW_RSSI,                               /**< Bluetooth event Raw RSSI */
488
489         BLUETOOTH_EVENT_SERVICE_SEARCHED = BLUETOOTH_EVENT_SDP_BASE,
490                                                     /**< Bluetooth event serice search base id */
491         BLUETOOTH_EVENT_SERVICE_SEARCH_CANCELLED,   /**< Bluetooth event service search cancelled */
492         BLUETOOTH_EVENT_RFCOMM_DATA_RECEIVED = BLUETOOTH_EVENT_RFCOMM_BASE,
493                                                         /**< RFCOMM data receive event */
494         BLUETOOTH_EVENT_RFCOMM_CONNECTED,               /**< Rfcomm server incomming connection */
495         BLUETOOTH_EVENT_RFCOMM_DISCONNECTED,            /**< Rfcomm server/client disconnect */
496
497         BLUETOOTH_EVENT_RFCOMM_AUTHORIZE,
498
499         BLUETOOTH_EVENT_DEVICE_CONNECTED,           /**< Bluetooth event device connected */
500         BLUETOOTH_EVENT_DEVICE_DISCONNECTED,        /**< Bluetooth event device disconnected */
501
502         BLUETOOTH_EVENT_RFCOMM_SERVER_REMOVED,
503
504         BLUETOOTH_EVENT_NETWORK_SERVER_ACTIVATED = BLUETOOTH_EVENT_NETWORK_BASE,
505                                                                 /**< Bluetooth Network event */
506         BLUETOOTH_EVENT_NETWORK_SERVER_DEACTIVATED, /**< Network server deactivated */
507         BLUETOOTH_EVENT_NETWORK_SERVER_CONNECTED,     /**< Network connected event in server */
508         BLUETOOTH_EVENT_NETWORK_SERVER_DISCONNECTED,
509                                                    /**< Network disconnected evnet in server */
510
511         BLUETOOTH_EVENT_NETWORK_CONNECTED,              /**< Network connected event in client*/
512         BLUETOOTH_EVENT_NETWORK_DISCONNECTED,           /**< Network disconnected evnet in client*/
513
514         BLUETOOTH_EVENT_HDP_CONNECTED
515                         = BLUETOOTH_EVENT_HDP_BASE,                /**<HDP Connect>*/
516         BLUETOOTH_EVENT_HDP_DISCONNECTED,          /**<HDP Disconnect>*/
517         BLUETOOTH_EVENT_HDP_DATA_RECEIVED,         /**<HDP Data Indication>*/
518
519         BLUETOOTH_EVENT_OPC_CONNECTED = BLUETOOTH_EVENT_OPC_BASE,
520                                                                 /* OPC Connected event */
521         BLUETOOTH_EVENT_OPC_DISCONNECTED,               /* OPC Disonnected event */
522         BLUETOOTH_EVENT_OPC_TRANSFER_STARTED,   /* OPC Transfer started event */
523         BLUETOOTH_EVENT_OPC_TRANSFER_PROGRESS,  /* OPC Transfer progress event */
524         BLUETOOTH_EVENT_OPC_TRANSFER_COMPLETE,  /* OPC Transfer Complete event */
525
526         BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_AUTHORIZE = BLUETOOTH_EVENT_OBEX_SERVER_BASE,
527                                                                 /* Obex server authorize event*/
528         BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_STARTED,   /* Obex Server transfer started event*/
529         BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_PROGRESS,/* Obex Server transfer progress event*/
530         BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_COMPLETED,/* Obex Server transfer complete event*/
531         BLUETOOTH_EVENT_OBEX_SERVER_CONNECTION_AUTHORIZE,
532         BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_CONNECTED, /* Obex Transfer connected event */
533         BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_DISCONNECTED, /* Obex Transfer disconnected event */
534
535         BLUETOOTH_EVENT_GATT_SVC_CHAR_DISCOVERED = BLUETOOTH_EVENT_GATT_BASE,
536                                 /**<Discovered GATT service characteristics event*/
537         BLUETOOTH_EVENT_GATT_CHAR_VAL_CHANGED,
538                                 /**<Remote GATT charateristic value changed event*/
539         BLUETOOTH_EVENT_GATT_GET_CHAR_FROM_UUID,
540         BLUETOOTH_EVENT_GATT_READ_CHAR, /**<Gatt Read Characteristic Value */
541         BLUETOOTH_EVENT_GATT_WRITE_CHAR, /**<Gatt Write Characteristic Value */
542         BLUETOOTH_EVENT_GATT_READ_DESC, /**<Gatt Read Characteristic Descriptor Value */
543         BLUETOOTH_EVENT_GATT_WRITE_DESC, /**<Gatt Write Characteristic Descriptor Value */
544         BLUETOOTH_EVENT_GATT_SVC_CHAR_DESC_DISCOVERED, /**<Gatt Char Descriptors Discovered Event*/
545         BLUETOOTH_EVENT_GATT_CONNECTED,/**<Gatt connected event */
546         BLUETOOTH_EVENT_GATT_DISCONNECTED, /**<Gatt Disconnected event */
547         BLUETOOTH_EVENT_GATT_SERVER_CHARACTERISTIC_VALUE_CHANGED, /**<Gatt Char write callback event */
548         BLUETOOTH_EVENT_GATT_SERVER_READ_REQUESTED, /** <GATT Characteristic/Descriptor Read Request event */
549         BLUETOOTH_EVENT_GATT_SERVER_VALUE_CHANGED, /** <GATT Characteristic/Descriptor Value change event */
550         BLUETOOTH_EVENT_GATT_SERVER_NOTIFICATION_STATE_CHANGED, /** <GATT Characteristic Notification change event */
551         BLUETOOTH_EVENT_GATT_SERVER_INDICATE_CONFIRMED, /** <GATT Characteristic Notification change event */
552
553         BLUETOOTH_EVENT_AG_CONNECTED = BLUETOOTH_EVENT_AUDIO_BASE, /**<AG service connected event*/
554         BLUETOOTH_EVENT_AG_DISCONNECTED, /**<AG service disconnected event*/
555         BLUETOOTH_EVENT_AG_SPEAKER_GAIN, /**<Speaker gain request event*/
556         BLUETOOTH_EVENT_AG_MIC_GAIN, /**<Mic gain request event*/
557         BLUETOOTH_EVENT_AG_AUDIO_CONNECTED, /**<AV & AG service connected event*/
558         BLUETOOTH_EVENT_AG_AUDIO_DISCONNECTED,  /**<AV & AG service disconnected event*/
559         BLUETOOTH_EVENT_AV_CONNECTED, /**<AV service connected event*/
560         BLUETOOTH_EVENT_AV_DISCONNECTED, /**<AV service disconnected event*/
561         BLUETOOTH_EVENT_AV_SOURCE_CONNECTED, /**<AV Source device connected event */
562         BLUETOOTH_EVENT_AV_SOURCE_DISCONNECTED, /**<AV Source device disconnected event */
563         BLUETOOTH_EVENT_AVRCP_CONNECTED, /**<AVRCP service connected event*/
564         BLUETOOTH_EVENT_AVRCP_DISCONNECTED, /**<AVRCP service disconnected event*/
565         BLUETOOTH_EVENT_AVRCP_SETTING_SHUFFLE_STATUS, /**<AVRCP service player suffle  status event*/
566         BLUETOOTH_EVENT_AVRCP_SETTING_EQUALIZER_STATUS, /**<AVRCP service player equalizer status event*/
567         BLUETOOTH_EVENT_AVRCP_SETTING_REPEAT_STATUS, /**<AVRCP service player repeat status event*/
568         BLUETOOTH_EVENT_AVRCP_SETTING_SCAN_STATUS, /**<AVRCP service player scan status event*/
569         BLUETOOTH_EVENT_HF_CONNECTED,
570         BLUETOOTH_EVENT_HF_DISCONNECTED,
571         BLUETOOTH_EVENT_HF_AUDIO_CONNECTED,
572         BLUETOOTH_EVENT_HF_AUDIO_DISCONNECTED,
573         BLUETOOTH_EVENT_HF_RING_INDICATOR,
574         BLUETOOTH_EVENT_HF_CALL_WAITING,
575         BLUETOOTH_EVENT_HF_CALL_TERMINATED,
576         BLUETOOTH_EVENT_HF_CALL_STARTED,
577         BLUETOOTH_EVENT_HF_CALL_ENDED,
578         BLUETOOTH_EVENT_HF_CALL_UNHOLD,
579         BLUETOOTH_EVENT_HF_CALL_SWAPPED,
580         BLUETOOTH_EVENT_HF_CALL_ON_HOLD,
581         BLUETOOTH_EVENT_HF_CALL_STATUS,
582         BLUETOOTH_EVENT_HF_VOICE_RECOGNITION_ENABLED,
583         BLUETOOTH_EVENT_HF_VOICE_RECOGNITION_DISABLED,
584         BLUETOOTH_EVENT_HF_VOLUME_SPEAKER,
585         BLUETOOTH_EVENT_HF_VENDOR_DEP_CMD,
586
587         BLUETOOTH_HID_CONNECTED = BLUETOOTH_EVENT_HID_BASE, /**< Input connectd event*/
588         BLUETOOTH_HID_DISCONNECTED, /**< Input disconnectd event*/
589         BLUETOOTH_HID_DEVICE_CONNECTED, /**< HID Device connected event*/
590         BLUETOOTH_HID_DEVICE_DISCONNECTED, /**< HID Device disconnected event*/
591         BLUETOOTH_HID_DEVICE_DATA_RECEIVED, /**< HID Device data received event*/
592
593         BLUETOOTH_EVENT_ADVERTISING_STARTED = BLUETOOTH_EVENT_ADVERTISING_BASE, /**< Advertising started event */
594         BLUETOOTH_EVENT_ADVERTISING_STOPPED, /**< Advertising stopped event */
595         BLUETOOTH_EVENT_ADVERTISING_MANUFACTURER_DATA_CHANGED, /**< Advertising manufacturer data changed event */
596         BLUETOOTH_EVENT_SCAN_RESPONSE_MANUFACTURER_DATA_CHANGED, /**< Scan response manufacturer data changed event */
597         BLUETOOTH_EVENT_MANUFACTURER_DATA_CHANGED, /**< Manufacturer data changed event */
598         BLUETOOTH_EVENT_DEVICE_ERROR, /**< Hardware error */
599         BLUETOOTH_EVENT_TX_TIMEOUT_ERROR, /** TX Timeout Error*/
600         BLUETOOTH_EVENT_MAX, /**< Bluetooth event Max value */
601
602         BLUETOOTH_PBAP_CONNECTED = BLUETOOTH_EVENT_PBAP_CLIENT_BASE, /**< PBAP connected event*/
603         BLUETOOTH_PBAP_DISCONNECTED, /**< PBAP disconnectd event*/
604         BLUETOOTH_PBAP_PHONEBOOK_SIZE, /**< PBAP Phonebook Size event*/
605         BLUETOOTH_PBAP_PHONEBOOK_PULL, /**< PBAP Phonebook Pull event*/
606         BLUETOOTH_PBAP_VCARD_LIST, /**< PBAP vCard List event*/
607         BLUETOOTH_PBAP_VCARD_PULL, /**< PBAP vCard Pull event*/
608         BLUETOOTH_PBAP_PHONEBOOK_SEARCH, /**< PBAP Phonebook Search event*/
609
610         BLUETOOTH_EVENT_AVRCP_CONTROL_CONNECTED = BLUETOOTH_EVENT_AVRCP_CONTROL_BASE, /**<AVRCP service connected event*/
611         BLUETOOTH_EVENT_AVRCP_CONTROL_DISCONNECTED, /**<AVRCP service disconnected event*/
612         BLUETOOTH_EVENT_AVRCP_CONTROL_SHUFFLE_STATUS, /**<AVRCP control suffle  status event*/
613         BLUETOOTH_EVENT_AVRCP_CONTROL_EQUALIZER_STATUS, /**<AVRCP control equalizer status event*/
614         BLUETOOTH_EVENT_AVRCP_CONTROL_REPEAT_STATUS, /**<AVRCP control repeat status event*/
615         BLUETOOTH_EVENT_AVRCP_CONTROL_SCAN_STATUS, /**<AVRCP control scan status event*/
616         BLUETOOTH_EVENT_AVRCP_SONG_POSITION_STATUS, /**<AVRCP control play Postion status event*/
617         BLUETOOTH_EVENT_AVRCP_PLAY_STATUS_CHANGED, /**<AVRCP control play status event*/
618         BLUETOOTH_EVENT_AVRCP_TRACK_CHANGED, /**<AVRCP control song metadata event*/
619
620         BLUETOOTH_EVENT_IPSP_INIT_STATE_CHANGED = BLUETOOTH_EVENT_IPSP_BASE, /**<IPSP init event*/
621         BLUETOOTH_EVENT_IPSP_CONNECTED, /**< IPSP connected event  */
622         BLUETOOTH_EVENT_IPSP_DISCONNECTED, /**< IPSP Disconnected event */
623         BLUETOOTH_EVENT_LE_DATA_LENGTH_CHANGED,  /** LE data length values changed */
624 } bluetooth_event_type_t;
625
626  /**
627  * This bt_service_uuid_list_t  enum  indicates service uuid list .
628  * This values is stored the service_list_array in bt_sdp_info_t and bluetooth_device_info_t.
629  */
630
631 typedef enum {
632         BLUETOOTH_SPP_PROFILE_UUID = ((unsigned short)0x1101),                  /**<SPP*/
633         BLUETOOTH_LAP_PROFILE_UUID = ((unsigned short)0x1102),                  /**<LAP*/
634         BLUETOOTH_DUN_PROFILE_UUID = ((unsigned short)0x1103),                  /**<DUN*/
635         BLUETOOTH_OBEX_IR_MC_SYNC_SERVICE_UUID = ((unsigned short)0x1104),      /**<OBEX IR MC SYNC*/
636         BLUETOOTH_OBEX_OBJECT_PUSH_SERVICE_UUID = ((unsigned short)0x1105),     /**<OPP*/
637         BLUETOOTH_OBEX_FILE_TRANSFER_UUID = ((unsigned short)0x1106),           /**<FTP*/
638         BLUETOOTH_IRMC_SYNC_COMMAND_UUID = ((unsigned short)0x1107),            /**<IRMC SYNC COMMAND*/
639         BLUETOOTH_HS_PROFILE_UUID = ((unsigned short)0x1108),                   /**<HS*/
640         BLUETOOTH_CTP_PROFILE_UUID = ((unsigned short)0x1109),                  /**<CTP*/
641         BLUETOOTH_AUDIO_SOURCE_UUID = ((unsigned short)0x110A),                 /**<AUDIO SOURCE*/
642         BLUETOOTH_AUDIO_SINK_UUID = ((unsigned short)0x110B),                   /**<AUDIO SINK*/
643         BLUETOOTH_AV_REMOTE_CONTROL_TARGET_UUID = ((unsigned short)0x110C),     /**<AV REMOTE CONTROL
644                                                                                 TARGET*/
645         BLUETOOTH_ADVANCED_AUDIO_PROFILE_UUID = ((unsigned short)0x110D),       /**<A2DP*/
646         BLUETOOTH_AV_REMOTE_CONTROL_UUID = ((unsigned short)0x110E),            /**<AV REMOTE CONTROL UUID*/
647         BLUETOOTH_AV_REMOTE_CONTROL_CONTROLLER_UUID = ((unsigned short)0x110F), /**<AV REMOTE CONTROLLER UUID*/
648         BLUETOOTH_ICP_PROFILE_UUID = ((unsigned short)0x1110),                  /**<ICP*/
649         BLUETOOTH_FAX_PROFILE_UUID = ((unsigned short)0x1111),                  /**<FAX*/
650         BLUETOOTH_HEADSET_AG_SERVICE_UUID = ((unsigned short)0x1112),           /**<HS AG */
651         BLUETOOTH_PAN_PANU_PROFILE_UUID = ((unsigned short)0x1115),             /**<PAN*/
652         BLUETOOTH_PAN_NAP_PROFILE_UUID = ((unsigned short)0x1116),              /**<PAN*/
653         BLUETOOTH_PAN_GN_PROFILE_UUID = ((unsigned short)0x1117),               /**<PAN*/
654         BLUETOOTH_DIRECT_PRINTING = ((unsigned short)0x1118),
655         BLUETOOTH_OBEX_BPPS_PROFILE_UUID = ((unsigned short)0x1118),            /**<OBEX BPPS*/ /* Will be removed */
656         BLUETOOTH_REFERENCE_PRINTING = ((unsigned short)0x1119),
657         BLUETOOTH_OBEX_IMAGING_UUID = ((unsigned short)0x111A),                 /**<OBEX_IMAGING*/
658         BLUETOOTH_OBEX_IMAGING_RESPONDER_UUID = ((unsigned short)0x111B),       /**<OBEX_IMAGING
659                                                                                 RESPONDER*/
660         BLUETOOTH_IMAGING_AUTOMATIC_ARCHIVE_UUID = ((unsigned short)0x111C),    /**<IMAGING AUTOMATIC ARCHIVE*/
661         BLUETOOTH_IMAGING_REFERENCED_OBJECTS_UUID = ((unsigned short)0x111D),   /**<IMAGING REFERENCED OBJECTS*/
662         BLUETOOTH_HF_PROFILE_UUID = ((unsigned short)0x111E),                   /**<HF*/
663         BLUETOOTH_HFG_PROFILE_UUID = ((unsigned short)0x111F),                  /**<HFG*/
664         BLUETOOTH_DIRECT_PRINTING_REFERENCE_OBJ_UUID = ((unsigned short)0x1120),
665                                                                         /**<DIRECT PRINTING*/
666         BLUETOOTH_REFLECTED_UI = ((unsigned short)0x1121),              /**<REFLECTED UI*/
667         BLUETOOTH_BASIC_PRINTING = ((unsigned short)0x1122),            /**<BASIC PRINTING*/
668         BLUETOOTH_PRINTING_STATUS = ((unsigned short)0x1123),           /**<PRINTING  STATUS*/
669         BLUETOOTH_OBEX_PRINTING_STATUS_UUID = ((unsigned short)0x1123), /**<OBEX PRINTING STATUS*/ /* Will be removed */
670         BLUETOOTH_HID_PROFILE_UUID = ((unsigned short)0x1124),          /**<HID*/
671         BLUETOOTH_HCR_PROFILE_UUID = ((unsigned short)0x1125),          /**<HCRP*/
672         BLUETOOTH_HCR_PRINT_UUID = ((unsigned short)0x1126),            /**<HCR PRINT*/
673         BLUETOOTH_HCR_SCAN_UUID = ((unsigned short)0x1127),             /**<HCR SCAN*/
674         BLUETOOTH_SIM_ACCESS_PROFILE_UUID = ((unsigned short)0x112D),   /**<SIM ACCESS PROFILE*/
675         BLUETOOTH_PBAP_PCE_UUID = ((unsigned short)0x112E),             /**<PBAP - PCE*/
676         BLUETOOTH_PBAP_PSE_UUID = ((unsigned short)0x112F),             /**<OBEX PBA*/
677         BLUETOOTH_OBEX_PBA_PROFILE_UUID = ((unsigned short)0x112F),     /**<OBEX PBA*/ /* Will be removed */
678         BLUETOOTH_OBEX_PBAP_UUID = ((unsigned short)0x1130),            /**<OBEX PBA*/
679         BLUETOOTH_HEADSET_HS_UUID = ((unsigned short)0x1131),           /**<HEADSET HS*/
680         BLUETOOTH_MESSAGE_ACCESS_SERVER_UUID = ((unsigned short)0x1132),/**<MESSAGE ACCESS SERVER*/
681         BLUETOOTH_MESSAGE_NOTIFICATION_SERVER_UUID = ((unsigned short)0x1133),/**<MESSAGE NOTIFICATION SERVER*/
682         BLUETOOTH_MESSAGE_ACCESS_PROFILE_UUID = ((unsigned short)0x1134),/**<MESSAGE ACCESS PROFILE*/
683         BLUETOOTH_PNP_INFORMATION_UUID = ((unsigned short)0x1200),      /**<PNP*/
684         BLUETOOTH_GENERIC_NETWORKING_UUID = ((unsigned short)0x1201),   /**<GENERIC NETWORKING*/
685         BLUETOOTH_GENERIC_FILE_TRANSFER_UUID = ((unsigned short)0x1202),/**<GENERIC FILE TRANSFER*/
686         BLUETOOTH_GENERIC_AUDIO_UUID = ((unsigned short)0x1203),        /**<GENERIC AUDIO*/
687         BLUETOOTH_GENERIC_TELEPHONY_UUID = ((unsigned short)0x1204),    /**<GENERIC TELEPHONY*/
688         BLUETOOTH_VIDEO_SOURCE_UUID = ((unsigned short)0x1303),         /**<VEDIO SOURCE*/
689         BLUETOOTH_VIDEO_SINK_UUID = ((unsigned short)0x1304),           /**<VEDIO SINK*/
690         BLUETOOTH_VIDEO_DISTRIBUTION_UUID = ((unsigned short)0x1305),   /**<VEDIO DISTRIBUTION*/
691         BLUETOOTH_HDP_UUID = ((unsigned short)0x1400),                  /**<HDP*/
692         BLUETOOTH_HDP_SOURCE_UUID = ((unsigned short)0x1401),           /**<HDP SOURCE*/
693         BLUETOOTH_HDP_SINK_UUID = ((unsigned short)0x1402),             /**<HDP SINK*/
694         BLUETOOTH_OBEX_SYNCML_TRANSFER_UUID = ((unsigned short)0x0000)  /**<OBEX_SYNC*/ /* Will be removed */
695 } bluetooth_service_uuid_list_t;
696
697 /**
698 * Service class part of class of device returned from device discovery
699 */
700 typedef enum {
701         BLUETOOTH_DEVICE_SERVICE_CLASS_LIMITED_DISCOVERABLE_MODE = 0x002000,
702         BLUETOOTH_DEVICE_SERVICE_CLASS_POSITIONING = 0x010000,                  /**<  */
703         BLUETOOTH_DEVICE_SERVICE_CLASS_NETWORKING = 0x020000,                   /**<  */
704         BLUETOOTH_DEVICE_SERVICE_CLASS_RENDERING = 0x040000,                    /**<  */
705         BLUETOOTH_DEVICE_SERVICE_CLASS_CAPTURING = 0x080000,                    /**<  */
706         BLUETOOTH_DEVICE_SERVICE_CLASS_OBJECT_TRANSFER = 0x100000,              /**<  */
707         BLUETOOTH_DEVICE_SERVICE_CLASS_AUDIO = 0x200000,                        /**<  */
708         BLUETOOTH_DEVICE_SERVICE_CLASS_TELEPHONY = 0x400000,                    /**<  */
709         BLUETOOTH_DEVICE_SERVICE_CLASS_INFORMATION = 0x800000,                  /**<  */
710 } bluetooth_device_service_class_t;
711
712
713 /**
714  * Major device mask (For device discovery)
715  */
716 typedef enum {
717         BLUETOOTH_DEVICE_MAJOR_MASK_MISC = 0x00,
718         BLUETOOTH_DEVICE_MAJOR_MASK_COMPUTER = 0x0001,
719         BLUETOOTH_DEVICE_MAJOR_MASK_PHONE = 0x0002,
720         BLUETOOTH_DEVICE_MAJOR_MASK_LAN_ACCESS_POINT = 0x0004,
721         BLUETOOTH_DEVICE_MAJOR_MASK_AUDIO = 0x0008,
722         BLUETOOTH_DEVICE_MAJOR_MASK_PERIPHERAL = 0x0010,
723         BLUETOOTH_DEVICE_MAJOR_MASK_IMAGING = 0x0020,
724         BLUETOOTH_DEVICE_MAJOR_MASK_WEARABLE = 0x0040,
725         BLUETOOTH_DEVICE_MAJOR_MASK_TOY = 0x0080,
726         BLUETOOTH_DEVICE_MAJOR_MASK_HEALTH = 0x0100,
727 } bluetooth_device_major_mask_t;
728
729
730 /**
731  * Major device class (part of Class of Device)
732  */
733 typedef enum {
734         BLUETOOTH_DEVICE_MAJOR_CLASS_MISC = 0x00,       /**< Miscellaneous major device class*/
735         BLUETOOTH_DEVICE_MAJOR_CLASS_COMPUTER = 0x01,           /**< Computer major device class*/
736         BLUETOOTH_DEVICE_MAJOR_CLASS_PHONE = 0x02,              /**< Phone major device class*/
737         BLUETOOTH_DEVICE_MAJOR_CLASS_LAN_ACCESS_POINT = 0x03,   /**< LAN major device class*/
738         BLUETOOTH_DEVICE_MAJOR_CLASS_AUDIO = 0x04,              /**< AUDIO major device class*/
739         BLUETOOTH_DEVICE_MAJOR_CLASS_PERIPHERAL = 0x05,         /**< Peripheral major device class*/
740         BLUETOOTH_DEVICE_MAJOR_CLASS_IMAGING = 0x06,            /**< Imaging major device class*/
741         BLUETOOTH_DEVICE_MAJOR_CLASS_WEARABLE = 0x07,           /**< Wearable device class*/
742         BLUETOOTH_DEVICE_MAJOR_CLASS_TOY = 0x08,                /**< Toy device class*/
743         BLUETOOTH_DEVICE_MAJOR_CLASS_HEALTH = 0x09,             /**< Health device class*/
744         BLUETOOTH_DEVICE_MAJOR_CLASS_UNCLASSIFIED = 0x1F        /**< Unknown major device class*/
745 } bluetooth_device_major_class_t;
746
747 typedef enum {
748         BLUETOOTH_DEVICE_MINOR_CLASS_UNCLASSIFIED = 0x00,       /**< unclassified minor class */
749
750         /* About Computer Major class */
751         BLUETOOTH_DEVICE_MINOR_CLASS_DESKTOP_WORKSTATION = 0x04,        /**< desktop workstation
752                                                                         minor class */
753         BLUETOOTH_DEVICE_MINOR_CLASS_SERVER_CLASS_COMPUTER = 0x08,      /**< server minor class */
754         BLUETOOTH_DEVICE_MINOR_CLASS_LAPTOP = 0x0C,                     /**< laptop minor class */
755         BLUETOOTH_DEVICE_MINOR_CLASS_HANDHELD_PC_OR_PDA = 0x10,         /**< PDA minor class */
756         BLUETOOTH_DEVICE_MINOR_CLASS_PALM_SIZED_PC_OR_PDA = 0x14,       /**< PALM minor class */
757         BLUETOOTH_DEVICE_MINOR_CLASS_WEARABLE_COMPUTER = 0x18,  /**< Wearable PC minor class */
758
759         /* About Phone Major class */
760         BLUETOOTH_DEVICE_MINOR_CLASS_CELLULAR = 0x04,                   /**< Cellular minor class */
761         BLUETOOTH_DEVICE_MINOR_CLASS_CORDLESS = 0x08,                   /**< cordless minor class */
762         BLUETOOTH_DEVICE_MINOR_CLASS_SMART_PHONE = 0x0C,        /**< smart phone minor class */
763         BLUETOOTH_DEVICE_MINOR_CLASS_WIRED_MODEM_OR_VOICE_GATEWAY = 0x10,
764                                                                 /**< voice gateway minor class */
765         BLUETOOTH_DEVICE_MINOR_CLASS_COMMON_ISDN_ACCESS = 0x14,         /**< ISDN minor class */
766
767         /* About LAN/Network Access Point Major class */
768         BLUETOOTH_DEVICE_MINOR_CLASS_FULLY_AVAILABLE = 0x04,            /**< Fully available minor class */
769         BLUETOOTH_DEVICE_MINOR_CLASS_1_TO_17_PERCENT_UTILIZED = 0x20,   /**< 1-17% utilized minor class */
770         BLUETOOTH_DEVICE_MINOR_CLASS_17_TO_33_PERCENT_UTILIZED = 0x40,  /**< 17-33% utilized minor class */
771         BLUETOOTH_DEVICE_MINOR_CLASS_33_TO_50_PERCENT_UTILIZED = 0x60,  /**< 33-50% utilized minor class */
772         BLUETOOTH_DEVICE_MINOR_CLASS_50_to_67_PERCENT_UTILIZED = 0x80,  /**< 50-67% utilized minor class */
773         BLUETOOTH_DEVICE_MINOR_CLASS_67_TO_83_PERCENT_UTILIZED = 0xA0,  /**< 67-83% utilized minor class */
774         BLUETOOTH_DEVICE_MINOR_CLASS_83_TO_99_PERCENT_UTILIZED = 0xC0,  /**< 83-99% utilized minor class */
775         BLUETOOTH_DEVICE_MINOR_CLASS_NO_SERVICE_AVAILABLE = 0xE0,               /**< No service available minor class */
776
777         /* About Audio/Video Major class */
778         BLUETOOTH_DEVICE_MINOR_CLASS_HEADSET_PROFILE = 0x04,            /**< Headset minor class */
779         BLUETOOTH_DEVICE_MINOR_CLASS_HANDSFREE = 0x08,                  /**< Handsfree minor class*/
780
781         BLUETOOTH_DEVICE_MINOR_CLASS_MICROPHONE = 0x10,         /**< Microphone minor class */
782         BLUETOOTH_DEVICE_MINOR_CLASS_LOUD_SPEAKER = 0x14,       /**< Loud Speaker minor class */
783         BLUETOOTH_DEVICE_MINOR_CLASS_HEADPHONES = 0x18,         /**< Headphones minor class */
784         BLUETOOTH_DEVICE_MINOR_CLASS_PORTABLE_AUDIO = 0x1C,     /**< Portable Audio minor class */
785         BLUETOOTH_DEVICE_MINOR_CLASS_CAR_AUDIO = 0x20,           /**< Car Audio minor class */
786         BLUETOOTH_DEVICE_MINOR_CLASS_SET_TOP_BOX = 0x24,        /**< Set top box minor class */
787         BLUETOOTH_DEVICE_MINOR_CLASS_HIFI_AUDIO_DEVICE = 0x28,  /**< Hifi minor class */
788         BLUETOOTH_DEVICE_MINOR_CLASS_VCR = 0x2C,                /**< VCR minor class */
789         BLUETOOTH_DEVICE_MINOR_CLASS_VIDEO_CAMERA = 0x30,       /**< Video Camera minor class */
790         BLUETOOTH_DEVICE_MINOR_CLASS_CAM_CORDER = 0x34,         /**< CAM Corder minor class */
791         BLUETOOTH_DEVICE_MINOR_CLASS_VIDEO_MONITOR = 0x38,      /**<Video Monitor minor class */
792         BLUETOOTH_DEVICE_MINOR_CLASS_VIDEO_DISPLAY_AND_LOUD_SPEAKER = 0x3C,
793                                                                         /**< Video Display and Loud
794                                                                         Speaker minor class */
795         BLUETOOTH_DEVICE_MINOR_CLASS_VIDEO_CONFERENCING = 0x40, /**< Video Conferencing minor
796                                                                 class */
797
798         BLUETOOTH_DEVICE_MINOR_CLASS_GAMING_OR_TOY = 0x48,      /**< Gaming or toy minor class */
799
800         /* About Peripheral Major class */
801         BLUETOOTH_DEVICE_MINOR_CLASS_KEY_BOARD = 0x40,          /**< Key board minor class */
802         BLUETOOTH_DEVICE_MINOR_CLASS_POINTING_DEVICE = 0x80,    /**< Pointing Device minor class */
803         BLUETOOTH_DEVICE_MINOR_CLASS_COMBO_KEYBOARD_OR_POINTING_DEVICE = 0xC0,
804                                                                 /**< Combo Keyboard or pointing
805                                                                 device minorclass */
806
807         BLUETOOTH_DEVICE_MINOR_CLASS_JOYSTICK = 0x04,           /**< JoyStick minor class */
808         BLUETOOTH_DEVICE_MINOR_CLASS_GAME_PAD = 0x08,           /**< Game Pad minor class */
809         BLUETOOTH_DEVICE_MINOR_CLASS_REMOTE_CONTROL = 0x0C,     /**< Remote Control minor class */
810         BLUETOOTH_DEVICE_MINOR_CLASS_SENSING_DEVICE = 0x10,     /**< Sensing Device minor class */
811         BLUETOOTH_DEVICE_MINOR_CLASS_DIGITIZER_TABLET = 0x14,   /**< Digitizer minor class */
812         BLUETOOTH_DEVICE_MINOR_CLASS_CARD_READER = 0x18,        /**< Card Reader minor class */
813         BLUETOOTH_DEVICE_MINOR_CLASS_DIGITAL_PEN = 0x1C,        /**< Digital pen minor class */
814         BLUETOOTH_DEVICE_MINOR_CLASS_HANDHELD_SCANNER = 0x20,   /**< Handheld scanner for bar-codes, RFID minor class */
815         BLUETOOTH_DEVICE_MINOR_CLASS_HANDHELD_GESTURAL_INPUT_DEVICE = 0x24,     /**< Handheld gestural input device minor class */
816
817         /* About Imaging Major class */
818         BLUETOOTH_DEVICE_MINOR_CLASS_DISPLAY = 0x10,            /**< Display minor class */
819         BLUETOOTH_DEVICE_MINOR_CLASS_CAMERA = 0x20,             /**< Camera minor class */
820         BLUETOOTH_DEVICE_MINOR_CLASS_SCANNER = 0x40,            /**< Scanner minor class */
821         BLUETOOTH_DEVICE_MINOR_CLASS_PRINTER = 0x80,            /**< Printer minor class */
822
823         /* About Wearable Major class */
824         BLUETOOTH_DEVICE_MINOR_CLASS_WRIST_WATCH = 0x04,        /**< Wrist watch minor class */
825         BLUETOOTH_DEVICE_MINOR_CLASS_PAGER = 0x08,              /**< Pager minor class */
826         BLUETOOTH_DEVICE_MINOR_CLASS_JACKET = 0x0C,             /**< Jacket minor class */
827         BLUETOOTH_DEVICE_MINOR_CLASS_HELMET = 0x10,             /**< Helmet minor class */
828         BLUETOOTH_DEVICE_MINOR_CLASS_GLASSES = 0x14,            /**< Glasses minor class */
829
830         /* About Toy Major class */
831         BLUETOOTH_DEVICE_MINOR_CLASS_ROBOT = 0x04,              /**< Robot minor class */
832         BLUETOOTH_DEVICE_MINOR_CLASS_VEHICLE = 0x08,            /**< Vehicle minor class */
833         BLUETOOTH_DEVICE_MINOR_CLASS_DOLL_OR_ACTION = 0x0C,     /**< Doll or Action minor class */
834         BLUETOOTH_DEVICE_MINOR_CLASS_CONTROLLER = 0x10,         /**< Controller minor class */
835         BLUETOOTH_DEVICE_MINOR_CLASS_GAME = 0x14,               /**< Game minor class */
836
837         /* About Health Major class */
838         BLUETOOTH_DEVICE_MINOR_CLASS_BLOOD_PRESSURE_MONITOR = 0x04,     /**< Blood Pressure minor class */
839         BLUETOOTH_DEVICE_MINOR_CLASS_THERMOMETER = 0x08,                /**< Thermometer minor class */
840         BLUETOOTH_DEVICE_MINOR_CLASS_WEIGHING_SCALE = 0x0C,             /**< Weighing Scale minor class */
841         BLUETOOTH_DEVICE_MINOR_CLASS_GLUCOSE_METER = 0x10,              /**< Glucose minor class */
842         BLUETOOTH_DEVICE_MINOR_CLASS_PULSE_OXIMETER = 0x14,             /**< Pulse Oximeter minor class */
843         BLUETOOTH_DEVICE_MINOR_CLASS_HEART_OR_PULSE_RATE_MONITOR = 0x18,/**< Heart or pulse rate monitor minor class */
844         BLUETOOTH_DEVICE_MINOR_CLASS_MEDICAL_DATA_DISPLAY = 0x1C,       /**< Medical minor class */
845         BLUETOOTH_DEVICE_MINOR_CLASS_STEP_COUNTER = 0x20,               /**< Step Counter minor class */
846         BLUETOOTH_DEVICE_MINOR_CLASS_BODY_COMPOSITION_ANALYZER = 0x24,  /**< Body composition analyzer minor class */
847         BLUETOOTH_DEVICE_MINOR_CLASS_PEAK_FLOW_MONITOR = 0x28,  /**< Peak flow monitor minor class */
848         BLUETOOTH_DEVICE_MINOR_CLASS_MEDICATION_MONITOR = 0x2C, /**< Medication monitor minor class */
849         BLUETOOTH_DEVICE_MINOR_CLASS_KNEE_PROSTHESIS = 0x30,    /**< Knee prosthesis minor class */
850         BLUETOOTH_DEVICE_MINOR_CLASS_ANKLE_PROSTHESIS = 0x34,   /**< Ankle prosthesis minor class */
851 } bluetooth_device_minor_class_t;
852
853 /**
854  * structure to hold the device information
855  */
856 typedef struct {
857         bluetooth_device_major_class_t major_class; /**< major device class */
858         bluetooth_device_minor_class_t minor_class; /**< minor device class */
859         bluetooth_device_service_class_t service_class;
860                                                     /**< service device class */
861 } bluetooth_device_class_t;
862
863 /**
864  * Discovery Role types
865  */
866 typedef enum {
867         DISCOVERY_ROLE_BREDR = 0x1,
868         DISCOVERY_ROLE_LE,
869         DISCOVERY_ROLE_LE_BREDR
870 } bt_discovery_role_type_t;
871
872 /**
873  * Connected state types
874  */
875 typedef enum {
876         BLUETOOTH_CONNECTED_LINK_NONE = 0x00,
877         BLUETOOTH_CONNECTED_LINK_BREDR = 0x01,
878         BLUETOOTH_CONNECTED_LINK_LE = 0x02,
879         BLUETOOTH_CONNECTED_LINK_BREDR_LE = 0x03,
880 } bluetooth_connected_link_t;
881
882 /**
883 * Scan filter entry
884 */
885 typedef enum {
886         BLUETOOTH_LE_SCAN_FILTER_FEATURE_DEVICE_ADDRESS = 0x01,                 /**< device address */
887         BLUETOOTH_LE_SCAN_FILTER_FEATURE_SERVICE_UUID = 0x04,                   /**< service uuid */
888         BLUETOOTH_LE_SCAN_FILTER_FEATURE_SERVICE_SOLICITATION_UUID = 0x08,      /**< service solicitation uuid */
889         BLUETOOTH_LE_SCAN_FILTER_FEATURE_DEVICE_NAME = 0x10,                    /**< device name */
890         BLUETOOTH_LE_SCAN_FILTER_FEATURE_MANUFACTURER_DATA = 0x20,              /**< manufacturer data */
891         BLUETOOTH_LE_SCAN_FILTER_FEATURE_SERVICE_DATA = 0x40,                   /**< service data */
892 } bluetooth_le_scan_filter_feature_t;
893
894 /**
895  * LE connection mode
896  */
897 typedef enum {
898         BLUETOOTH_LE_CONNECTION_MODE_BALANCED,
899         BLUETOOTH_LE_CONNECTION_MODE_LOW_LATENCY,
900         BLUETOOTH_LE_CONNECTION_MODE_LOW_POWER
901 } bluetooth_le_connection_mode_t;
902
903 /**
904 * structure to hold the device information
905 */
906 typedef struct {
907         bluetooth_device_address_t device_address;      /**< device address */
908         bluetooth_device_name_t device_name;    /**< device name */
909         bluetooth_device_class_t device_class;  /**< device class */
910         char uuids[BLUETOOTH_MAX_SERVICES_FOR_DEVICE][BLUETOOTH_UUID_STRING_MAX];
911         unsigned int service_list_array[BLUETOOTH_MAX_SERVICES_FOR_DEVICE]; /**< Use enum values in bt_service_uuid_list_t */
912         int service_index;
913         int rssi;                               /**< received strength signal*/
914         gboolean paired;                        /**< paired flag */
915         bluetooth_connected_link_t connected;   /**< connected link type */
916         gboolean trust;                         /**< trust flag */
917         bluetooth_manufacturer_data_t manufacturer_data;        /**< manafacturer specific class */
918 } bluetooth_device_info_t;
919
920 /**
921 * structure to hold the LE device information
922 */
923 typedef struct {
924         int data_len;           /**< manafacturer specific data length */
925         bluetooth_advertising_data_t data;              /**< manafacturer specific data */
926 } bluetooth_le_advertising_data_t;
927
928 typedef struct {
929         bluetooth_device_address_t device_address;      /**< device address */
930         int addr_type;                  /**< address type*/
931         int rssi;                       /**< received strength signal*/
932         bluetooth_le_advertising_data_t adv_ind_data;
933         bluetooth_le_advertising_data_t scan_resp_data;
934 } bluetooth_le_device_info_t;
935
936 typedef struct {
937         int slot_id;
938         bluetooth_le_scan_filter_feature_t added_features;              /**< added features */
939         bluetooth_device_address_t device_address;                      /**< device address */
940         char device_name[BLUETOOTH_ADVERTISING_DATA_LENGTH_MAX];        /**< device name */
941         bluetooth_le_advertising_data_t service_uuid;                   /**< service uuid */
942         bluetooth_le_advertising_data_t service_uuid_mask;              /**< service uuid mask */
943         bluetooth_le_advertising_data_t service_solicitation_uuid;      /**< service solicitation uuid */
944         bluetooth_le_advertising_data_t service_solicitation_uuid_mask; /**< service solicitation uuid mask */
945         bluetooth_le_advertising_data_t service_data;                   /**< service data */
946         bluetooth_le_advertising_data_t service_data_mask;              /**< service data mask */
947         int manufacturer_id;                                            /**< manufacturer ID */
948         bluetooth_le_advertising_data_t manufacturer_data;              /**< manufacturer data */
949         bluetooth_le_advertising_data_t manufacturer_data_mask;         /**< manufacturer data mask */
950 } bluetooth_le_scan_filter_t;
951
952 /**
953  * structure to hold the paired device information
954  */
955 typedef struct {
956         bluetooth_device_address_t device_address;  /**< paired device address */
957         bluetooth_device_name_t device_name;        /**< device name */
958         bluetooth_device_class_t device_class;      /**< device class */
959 } bluetooth_paired_device_info_t;
960
961 /**
962 * structure to hold the paired device information
963 */
964 typedef struct {
965         bluetooth_device_address_t device_address;
966                                                /**< device address */
967         char interface_name[BLUETOOTH_INTERFACE_NAME_LENGTH + 1];
968                                                           /**< network interface name */
969 } bluetooth_network_device_info_t;
970
971 /**
972  * Authentication event types
973  */
974
975 typedef enum {
976         BLUETOOTH_AUTH_KEYBOARD_PASSKEY_REQUEST = 0,
977         BLUETOOTH_AUTH_PIN_REQUEST,
978         BLUETOOTH_AUTH_PASSKEY_REQUEST,
979         BLUETOOTH_AUTH_PASSKEY_CONFIRM_REQUEST,
980 } bluetooth_auth_type_t;
981
982 /**
983 * structure to hold the pincode/pass-key req informations
984 */
985 typedef struct {
986         bluetooth_device_address_t device_address;  /**< remote device address */
987         bluetooth_device_name_t device_name;        /**< device name */
988         char str_passkey[BLUETOOTH_DEVICE_PASSKEY_LENGTH_MAX]; /**< pass-key string */
989 } bluetooth_authentication_request_info_t;
990
991 /**
992 * Stucture to hold discovery option
993 */
994 typedef struct {
995         unsigned short max_response;    /**< the number of maximum response */
996         unsigned short discovery_duration;
997                                         /**< duration of discovery (seconds) */
998         unsigned int classOfDeviceMask; /**<  mask for values of class of device. to be used with
999                                         classOfDevice variable */
1000 } bluetooth_discovery_option_t;
1001
1002 /**
1003  * Stucture to hold event information
1004  */
1005 typedef struct {
1006         int event;      /**< event type */
1007         int result;     /**< Success or error value */
1008         void *param_data;
1009                         /**<parameter data pointer */
1010         void *user_data;
1011 } bluetooth_event_param_t;
1012
1013 typedef struct {
1014         bluetooth_device_address_t device_addr;
1015         char uuids[BLUETOOTH_MAX_SERVICES_FOR_DEVICE][BLUETOOTH_UUID_STRING_MAX];
1016         unsigned int service_list_array[BLUETOOTH_MAX_SERVICES_FOR_DEVICE]; /**< Use enum values in bt_service_uuid_list_t */
1017         unsigned int service_name_array[BLUETOOTH_MAX_SERVICES_FOR_DEVICE];
1018         int service_index;
1019 } bt_sdp_info_t;
1020
1021 typedef struct {
1022         bluetooth_device_address_t device_addr;
1023         unsigned char addr_type;
1024         int disc_reason;
1025 } bt_connection_info_t;
1026
1027 /**
1028  * Stucture to rfcomm receive data
1029  */
1030
1031 typedef struct {
1032         int socket_fd;
1033                 /**< the socket fd */
1034         int buffer_size;/**< the length of the receive buffer */
1035         char *buffer;
1036                 /**< the receive data buffer */
1037 } bluetooth_rfcomm_received_data_t;
1038
1039 /**
1040  * HID Header type
1041  */
1042 typedef enum {
1043         HTYPE_TRANS_HANDSHAKE,
1044         HTYPE_TRANS_HID_CONTROL,
1045         HTYPE_TRANS_GET_REPORT,
1046         HTYPE_TRANS_SET_REPORT,
1047         HTYPE_TRANS_GET_PROTOCOL,
1048         HTYPE_TRANS_SET_PROTOCOL,
1049         HTYPE_TRANS_DATA,
1050         HTYPE_TRANS_UNKNOWN
1051 }bt_hid_header_type_t;
1052
1053 /**
1054  * HID Param type
1055  */
1056 typedef enum {
1057         PTYPE_DATA_RTYPE_INPUT,
1058         PTYPE_DATA_RTYPE_OUTPUT
1059 }bt_hid_param_type_t;
1060
1061 /**
1062  * Stucture to hid receive data
1063  */
1064 typedef struct {
1065         const char *address;
1066         bt_hid_header_type_t type;
1067                 /**< Header type containing */
1068         bt_hid_param_type_t param;
1069                 /**< Param type in header like INPUT Report or OutPut Report */
1070         int buffer_size;/**< the length of the receive buffer */
1071         char *buffer;
1072                 /**< the receive data buffer */
1073 } bluetooth_hid_received_data_t;
1074
1075 /**
1076 * Stucture to rfcomm connection
1077 */
1078
1079 typedef struct {
1080         int socket_fd; /**< the socket fd */
1081         int server_id; /* Server id */
1082         int device_role; /** < Device role - RFCOMM_ROLE_SERVER or RFCOMM_ROLE_CLIENT */
1083         bluetooth_device_address_t device_addr;
1084                                               /**< device address */
1085         char uuid[BLUETOOTH_UUID_STRING_MAX];
1086 } bluetooth_rfcomm_connection_t;
1087
1088 /**
1089  * Stucture to rfcomm disconnection
1090  */
1091 typedef struct {
1092         int socket_fd;
1093                 /**< the socket fd */
1094         int device_role;/** < Device role - RFCOMM_ROLE_SERVER or RFCOMM_ROLE_CLIENT */
1095         bluetooth_device_address_t device_addr;
1096                                               /**< device address */
1097         char uuid[BLUETOOTH_UUID_STRING_MAX];
1098 } bluetooth_rfcomm_disconnection_t;
1099
1100 typedef struct {
1101         int socket_fd;
1102                 /**< the socket fd */
1103         bluetooth_device_address_t device_addr;
1104                                               /**< device address */
1105 } bluetooth_rfcomm_connection_request_t;
1106
1107 typedef struct {
1108         int socket_fd;
1109                 /**< the socket fd */
1110         bluetooth_device_address_t device_addr;
1111                                               /**< device address */
1112 } bluetooth_hid_request_t;
1113
1114 /**
1115  * HDP QOS types
1116  */
1117 typedef enum {
1118         HDP_QOS_RELIABLE,
1119         HDP_QOS_STREAMING,
1120         HDP_QOS_ANY
1121 }bt_hdp_qos_type_t;
1122
1123 /**
1124  * HDP Role types
1125  */
1126 typedef enum {
1127         HDP_ROLE_SOURCE = 0x0,
1128         HDP_ROLE_SINK
1129 }bt_hdp_role_type_t;
1130
1131
1132 /**
1133  * Stucture to HDP connected
1134  */
1135 typedef struct {
1136         const char *app_handle; /**< the application handle */
1137         unsigned int channel_id;        /**< the channel id */
1138         bt_hdp_qos_type_t type; /**< the QOS type */
1139         bluetooth_device_address_t device_address; /**< the remote address */
1140 } bt_hdp_connected_t;
1141
1142 /**
1143  * Stucture to HDP disconnected
1144  */
1145 typedef struct {
1146         unsigned int channel_id; /**< the channel id */
1147         bluetooth_device_address_t device_address; /**< the remote address */
1148 } bt_hdp_disconnected_t;
1149
1150 /**
1151  * Stucture to HDP data indication
1152  */
1153 typedef struct {
1154         unsigned int channel_id;         /**< the channel id */
1155         const char *buffer;      /**< the RX data buffer */
1156         unsigned int size;       /**< the RX data size */
1157 } bt_hdp_data_ind_t;
1158
1159 /**
1160  * Stucture to OPP client transfer information
1161  */
1162 typedef struct {
1163         char *filename;
1164         unsigned long size;
1165         int percentage;
1166 }bt_opc_transfer_info_t;
1167
1168 /* Obex Server transfer type */
1169 #define TRANSFER_PUT "PUT"
1170 #define TRANSFER_GET "GET"
1171 /**
1172  * Stucture to OPP/FTP Server authorize information
1173  */
1174 typedef struct {
1175         char *filename;
1176         int length;
1177 } bt_obex_server_authorize_into_t;
1178
1179 /**
1180  * Server type
1181  */
1182 typedef enum {
1183         OPP_SERVER = 0x0,
1184         FTP_SERVER
1185 } bt_obex_server_type_t;
1186
1187 /**
1188  * Stucture to OPP/FTP server transfer information
1189  */
1190 typedef struct {
1191         char *filename;
1192         char *device_name;
1193         char *file_path;
1194         char *type;
1195         int transfer_id;
1196         unsigned long file_size;
1197         int percentage;
1198         bt_obex_server_type_t server_type;
1199 } bt_obex_server_transfer_info_t;
1200
1201 /**
1202  * Stucture to OOB data
1203  */
1204
1205 typedef struct {
1206         unsigned char hash[BLUETOOTH_OOB_DATA_LENGTH];
1207         unsigned char randomizer[BLUETOOTH_OOB_DATA_LENGTH];
1208         unsigned int hash_len;
1209         unsigned int randomizer_len;
1210 } bt_oob_data_t;
1211
1212 /**
1213  * Structure to GATT attribute handle data
1214  */
1215
1216 typedef struct {
1217         int count;
1218         char **handle;
1219 } bt_gatt_handle_info_t;
1220
1221 /**
1222  * Structure to GATT Remote service data
1223  */
1224
1225 typedef struct {
1226         char *uuid;
1227         char *handle;
1228         gboolean primary;
1229         bt_gatt_handle_info_t include_handles;
1230         bt_gatt_handle_info_t char_handle;
1231 } bt_gatt_service_property_t;
1232
1233 /**
1234  * Structure to GATT Remote characteristic data
1235  */
1236
1237 typedef struct {
1238         char *service_handle;
1239         bt_gatt_handle_info_t handle_info;
1240 } bt_gatt_discovered_char_t;
1241
1242 /**
1243  * Structure to format of GATT Characteristic Value
1244  */
1245
1246 typedef struct {
1247         unsigned char format;
1248         unsigned char exponent;
1249         unsigned short unit;
1250         unsigned char name_space;
1251         unsigned short description;
1252 } bt_gatt_char_format_t;
1253
1254 /**
1255  * Structure to GATT Characteristic property
1256  */
1257
1258 typedef struct {
1259         char *handle;
1260         char *uuid;
1261         char *name;
1262         char *description;
1263         bt_gatt_char_format_t format;
1264         unsigned char *val;
1265         unsigned int val_len;
1266         unsigned int permission;
1267         char *representation;
1268         bt_gatt_handle_info_t char_desc_handle;
1269 } bt_gatt_char_property_t;
1270
1271 /**
1272  * Structure to GATT Characteristic descriptor property
1273  */
1274
1275 typedef struct {
1276         char *handle;
1277         char *uuid;
1278         unsigned char *val;
1279         unsigned int val_len;
1280 } bt_gatt_char_descriptor_property_t;
1281
1282 /**
1283  * Structure to GATT Characteristic value
1284  */
1285
1286 typedef struct {
1287         char *char_handle;
1288         guint8 *char_value;
1289         guint32 val_len;
1290 } bt_gatt_char_value_t;
1291
1292 /**
1293  * Structure to GATT Read Request
1294  */
1295 typedef struct {
1296         char *att_handle;
1297         char *service_handle;
1298         char *address;
1299         guint16 offset;
1300         guint8 req_id;
1301 } bt_gatt_read_req_t;
1302
1303 /**
1304  * Structure to GATT Value change
1305  */
1306 typedef struct {
1307         char *att_handle;
1308         char *service_handle;
1309         char *address;
1310         guint8 req_id;
1311         guint16 offset;
1312         guint8 *att_value;
1313         guint32 val_len;
1314 } bt_gatt_value_change_t;
1315
1316 /**
1317  * Structure to GATT characteristc Notification change
1318  */
1319 typedef struct {
1320         char *att_handle;
1321         char *service_handle;
1322         gboolean att_notify;
1323 } bt_gatt_char_notify_change_t;
1324
1325 /**
1326  * Structure to Indication confirmation
1327  */
1328 typedef struct {
1329         char *att_handle;
1330         char *service_handle;
1331         char *address;
1332         gboolean complete;
1333  } bt_gatt_indicate_confirm_t;
1334
1335 /**
1336  * Structure to RSSI Signal Strength Alert
1337  */
1338
1339 typedef struct {
1340         char *address;
1341         int link_type;
1342         int alert_type;
1343         int rssi_dbm;
1344 } bt_rssi_alert_t;
1345
1346 /**
1347  * Structure to RSSI Signal Strength
1348  */
1349
1350 typedef struct {
1351         char *address;
1352         int link_type;
1353         int rssi_dbm;
1354 } bt_raw_rssi_t;
1355
1356 /**
1357  * Structure for RSSI Enabled or Disabled
1358  */
1359
1360 typedef struct {
1361         char *address;
1362         int link_type;
1363         gboolean rssi_enabled;
1364 } bt_rssi_enabled_t;
1365
1366 /**
1367  * Structure for RSSI Threshold
1368  */
1369
1370 typedef struct {
1371         int low_threshold;
1372         int in_range_threshold;
1373         int high_threshold;
1374 } bt_rssi_threshold_t;
1375
1376 /**
1377  * Structure for PBAP Folder Parameters
1378  */
1379 typedef struct {
1380         unsigned char addressbook;
1381         unsigned char folder_type;
1382 } bt_pbap_folder_t;
1383
1384 /**
1385  * Structure for PBAP Pull application Parameters
1386  */
1387 typedef struct {
1388         unsigned char format;
1389         unsigned char order;
1390         unsigned short offset;
1391         unsigned short maxlist;
1392         long long unsigned fields;
1393 } bt_pbap_pull_parameters_t;
1394
1395 /**
1396  * Structure for PBAP List application Parameters
1397  */
1398 typedef struct {
1399         unsigned char order;
1400         unsigned short offset;
1401         unsigned short maxlist;
1402 } bt_pbap_list_parameters_t;
1403
1404 /**
1405  * Structure for PBAP Pull vCard application Parameters
1406  */
1407 typedef struct {
1408         unsigned char format;
1409         long long unsigned fields;
1410         int index;
1411 } bt_pbap_pull_vcard_parameters_t;
1412
1413 /**
1414  * Structure for PBAP Search application Parameters
1415  */
1416 typedef struct {
1417         unsigned char order;
1418         unsigned short offset;
1419         unsigned short maxlist;
1420         unsigned char search_attribute;
1421         char search_value[BLUETOOTH_PBAP_MAX_SEARCH_VALUE_LENGTH];
1422 } bt_pbap_search_parameters_t;
1423
1424 /**
1425  * Structure for PBAP Connection Status
1426  */
1427 typedef struct {
1428         bluetooth_device_address_t btaddr;
1429         int connected;
1430 } bt_pbap_connected_t;
1431
1432 /**
1433  * Structure for PBAP Phonebook Size
1434  */
1435 typedef struct {
1436         bluetooth_device_address_t btaddr;
1437         int size;
1438 } bt_pbap_phonebook_size_t;
1439
1440 /**
1441  * Structure for PBAP Phonebook Pull
1442  */
1443 typedef struct {
1444         bluetooth_device_address_t btaddr;
1445         char *vcf_file;
1446         int success;
1447 } bt_pbap_phonebook_pull_t;
1448
1449 /**
1450  * Structure for PBAP vCard List
1451  */
1452 typedef struct {
1453         bluetooth_device_address_t btaddr;
1454         char **vcards;
1455         int length;
1456         int success;
1457 } bt_pbap_vcard_list_t;
1458
1459 /**
1460  * Structure for PBAP vCard Pull
1461  */
1462 typedef struct {
1463         bluetooth_device_address_t btaddr;
1464         char *vcf_file;
1465         int success;
1466 } bt_pbap_vcard_pull_t;
1467
1468 /**
1469  * Structure for PBAP Phonebook search List
1470  */
1471 typedef struct {
1472         bluetooth_device_address_t btaddr;
1473         char **vcards;
1474         int length;
1475         int success;
1476 } bt_pbap_phonebook_search_list_t;
1477
1478 /**
1479  * Stucture to HF Call status information
1480  */
1481
1482 typedef struct {
1483         char *number; /*Phone Number */
1484         int direction; /*Direction :Incoming(1), Outgoing(0)*/
1485         int status; /* Call Status :Active(0), Held(1), Waiting(5), Dailing(2)*/
1486         int mpart; /*Multiparty/conf call: Yes(1), No(0) */
1487         int idx; /*Call index/ID */
1488 } bt_hf_call_status_info_t;
1489
1490 typedef struct {
1491         GList *list;
1492         int count;
1493 } bt_hf_call_list_s;
1494
1495 /**
1496  * Structure for LE data length change params
1497  */
1498
1499 typedef struct {
1500         bluetooth_device_address_t device_address;
1501         guint16 max_tx_octets;
1502         guint16 max_tx_time;
1503         guint16 max_rx_octets;
1504         guint16 max_rx_time;
1505 } bt_le_data_length_params_t;
1506
1507 /**
1508  * Callback pointer type
1509  */
1510 typedef void (*bluetooth_cb_func_ptr) (int, bluetooth_event_param_t *, void *);
1511
1512 /**
1513  * @fn int bluetooth_register_callback(bluetooth_cb_func_ptr callback_ptr, void *user_data)
1514  * @brief Set the callback function pointer for bluetooth event
1515  *
1516  *
1517  * This API will register the callback function, when any response and event are received from
1518  * bluetooth framework. @n
1519  * this registered callback function will be get called with appropriate event and data structures.
1520  * This function is a synchronous call. An application developer can call
1521  * bluetooth_register_callback() function to register a callback function of bluetooth_cb_func_ptr
1522  * type. This registered function will receive events of bluetooth_event_type_t type along with
1523  * data any.
1524  *
1525  *
1526  * @param[in]   callback_ptr    A pointer to the callback function
1527  * @param[in]   user_data    A pointer to user data
1528  * @return      BLUETOOTH_ERROR_NONE - Success
1529  * @remark      None
1530  * @see         None
1531 @code
1532 void bt_event_callback(int event, bluetooth_event_param_t *param, void *user_data)
1533 {
1534         GMainLoop *main_loop = (GMainLoop*) user_data;
1535
1536         switch(event)
1537         {
1538                 // Code for each event
1539                 default:
1540                         g_main_loop_quit(main_loop);
1541                         break;
1542         }
1543 }
1544
1545 int main()
1546 {
1547         GMainLoop *main_loop = NULL;
1548         int ret = 0;
1549         g_type_init();
1550         main_loop = g_main_loop_new(NULL, FALSE);
1551         ret = bluetooth_register_callback(bt_event_callback, (void*)main_loop);
1552         if (ret >= BLUETOOTH_ERROR_NONE)
1553         {
1554                 // bluetooth_register_callback returned Success
1555         }
1556         else
1557         {
1558                 // bluetooth_register_callback returned failiure
1559         }
1560         g_main_loop_run(main_loop);
1561 }
1562 @endcode
1563  */
1564 int bluetooth_register_callback(bluetooth_cb_func_ptr callback_ptr, void *user_data);
1565
1566 /**
1567  * @fn int bluetooth_le_register_callback(bluetooth_cb_func_ptr callback_ptr, void *user_data)
1568  * @brief Set the callback function pointer for bluetooth le event
1569  *
1570  *
1571  * This API will register the callback function, when any response and event are received from
1572  * bluetooth framework. @n
1573  * this registered callback function will be get called with appropriate event and data structures.
1574  * This function is a synchronous call. An application developer can call
1575  * bluetooth_le_register_callback() function to register a callback function of bluetooth_cb_func_ptr
1576  * type. This registered function will receive events of bluetooth_event_type_t type along with
1577  * data any.
1578  *
1579  *
1580  * @param[in]   callback_ptr    A pointer to the callback function
1581  * @param[in]   user_data    A pointer to user data
1582  * @return      BLUETOOTH_ERROR_NONE - Success
1583  * @remark      None
1584  * @see         None
1585  * */
1586 int bluetooth_le_register_callback(bluetooth_cb_func_ptr callback_ptr, void *user_data);
1587
1588 /**
1589  * @fn int bluetooth_le_unregister_callback(void)
1590  * @brief Set the callback function pointer for bluetooth le event
1591  *
1592  *
1593  * This API will register the callback function, when any response and event are received from
1594  * bluetooth framework. @n
1595  * this registered callback function will be get called with appropriate event and data structures.
1596  * This function is a synchronous call. An application developer can call
1597  * bluetooth_le_register_callback() function to register a callback function of bluetooth_cb_func_ptr
1598  * type. This registered function will receive events of bluetooth_event_type_t type along with
1599  * data any.
1600  *
1601  *
1602  * @param[in]   none
1603  * @return      BLUETOOTH_ERROR_NONE - Success
1604  * @remark      None
1605  * @see         None
1606  * */
1607 int bluetooth_le_unregister_callback(void);
1608
1609 /**
1610  * @fn int bluetooth_deregister_callback(bluetooth_cb_func_ptr callback_ptr)
1611  * @brief Set the callback function pointer for bluetooth event
1612  *
1613  *
1614  * This API will register the callback function, when any response and event are received from
1615  * bluetooth framework. @n
1616  * this registered callback function will be get called with appropriate event and data structures.
1617  * This function is a synchronous call. An application developer can call
1618  * bluetooth_register_callback() function to register a callback function of bluetooth_cb_func_ptr
1619  * type. This registered function will receive events of bluetooth_event_type_t type along with
1620  * data any.
1621  *
1622  *
1623  * @param[in]   none
1624  * @return      BLUETOOTH_ERROR_NONE - Success
1625  * @remark      None
1626  * @see         None
1627 @code
1628 void bt_event_callback(int event, bluetooth_event_param_t *param, void *user_data)
1629 {
1630         GMainLoop *main_loop = (GMainLoop*) user_data;
1631
1632         switch(event)
1633         {
1634                 // Code for each event
1635                 default:
1636                         g_main_loop_quit(main_loop);
1637                         break;
1638         }
1639 }
1640
1641 int main()
1642 {
1643         GMainLoop *main_loop = NULL;
1644         int ret = 0;
1645         g_type_init();
1646         main_loop = g_main_loop_new(NULL, FALSE);
1647         ret = bluetooth_register_callback(bt_event_callback, (void*)main_loop);
1648         if (ret >= BLUETOOTH_ERROR_NONE)
1649         {
1650                 // bluetooth_register_callback returned Success
1651         }
1652         else
1653         {
1654                 // bluetooth_register_callback returned failiure
1655         }
1656         ret = bluetooth_deregister_callback(void);
1657         g_main_loop_run(main_loop);
1658 }
1659 @endcode
1660  */
1661 int bluetooth_unregister_callback(void);
1662
1663 /**
1664  * @fn int bluetooth_enable_adapter(void)
1665  * @brief Enable the Bluetooth H/W
1666  *
1667  *
1668  * This API can be used to activate Bluetooth. It initializes Bluetooth protocol stack for use and
1669  * send request to bluetooth chip for activation.
1670  * This function is typically called at startup or when Bluetooth services are required.  This
1671  * function must be called before calling any other API of Bluetooth operations.
1672  *
1673  * Before performing any operations like Device discover, service search etc.., the adapter must be
1674  * enabled.
1675  *
1676  * This function is a asynchronous call.
1677  * If the call is success then the application will receive BLUETOOTH_EVENT_ENABLED event
1678  * through registered callback function with appropriate result code
1679  *                      BLUETOOTH_CHANGE_STATUS_TIMEOUT - Timeout has happen \n
1680  *                      BLUETOOTH_ERROR_NONE - Success \n
1681  *
1682  * If the adpter is not enabled with in 30 seconds then BLUETOOTH_EVENT_ENABLED with result code
1683  * BLUETOOTH_CHANGE_STATUS_TIMEOUT will come
1684  *
1685  * @return      BLUETOOTH_ERROR_NONE - Success\n
1686  *              BLUETOOTH_ERROR_DEVICE_ALREADY_ENABLED - Adapter already enabled\n
1687  *              BLUETOOTH_ERROR_ACCESS_DENIED - Enabling adapter is not allowed by MDM policy\n
1688  *              BLUETOOTH_ERROR_IN_PROGRESS - Adapter is activating or deactivating\n
1689  * @exception   BLUETOOTH_ERROR_INTERNAL - Dbus proxy call is fail
1690  * @remark      None
1691  * @see         bluetooth_check_adapter, bluetooth_disable_adapter
1692 @code
1693 void bt_event_callback(int event, bluetooth_event_param_t *param)
1694 {
1695         switch(event)
1696         {
1697                 case BLUETOOTH_EVENT_ENABLED:
1698                         if (param->result == BLUETOOTH_ERROR_NONE)
1699                         {
1700                                 // Successfully Enabled
1701                         }
1702                         else
1703                         {
1704                                 // Failed
1705                         }
1706                         break;
1707         }
1708 }
1709
1710 ...
1711
1712 int ret = 0;
1713 ret = bluetooth_enable_adapter();
1714
1715 @endcode
1716  */
1717 int bluetooth_enable_adapter(void);
1718
1719 /**
1720  * @fn int bluetooth_disable_adapter(void)
1721  * @brief Disable the Bluetooth H/W
1722  *
1723  *
1724  * This function disables Bluetooth protocol stack and hardware. This function is called when
1725  * Bluetooth is no longer used. It will internally free all resources and power off the RF radio.
1726  *
1727  * Bluetooth adapter should be disabled to switch off Bluetooth chip (and thereby saving power).
1728  * bluetooth_disable_adapter() API will do that job for you. After switching off Bluetooth,
1729  * BLUETOOTH_EVENT_DISABLED will be sent by SDK to application for confirmation with appropriate
1730  * error code.
1731  * The various error codes are BLUETOOTH_ERROR_NONE for success and BLUETOOTH_ERROR_INTERNAL for
1732  * internal error.
1733  *
1734  * This function is a asynchronous call.
1735  * If this call is success then the applications will receive BLUETOOTH_EVENT_DISABLED event
1736  * through registered callback function.
1737  *
1738  *
1739  * @return      BLUETOOTH_ERROR_NONE - Success\n
1740  *              BLUETOOTH_ERROR_IN_PROGRESS - Adapter is activating or deactivating\n
1741  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Bluetooth adapter is not enabled\n
1742  * @exception   BLUETOOTH_ERROR_INTERNAL - Dbus proxy call is fail
1743  * @remark      None
1744  * @see         bluetooth_check_adapter, bluetooth_enable_adapter
1745 @code
1746 void bt_event_callback(int event, bluetooth_event_param_t *param)
1747 {
1748         switch(event)
1749         {
1750                 case BLUETOOTH_EVENT_DISABLED:
1751                         if (param->result == BLUETOOTH_ERROR_NONE)
1752                         {
1753                                 // Successfully disabled
1754                         }
1755                         else
1756                         {
1757                                 // Failed
1758                         }
1759                         break;
1760         }
1761 }
1762
1763 ...
1764
1765 int ret = 0;
1766 ret = bluetooth_disable_adapter();
1767 @endcode
1768  */
1769 int bluetooth_disable_adapter(void);
1770 int bluetooth_recover_adapter(void);
1771 int bluetooth_check_adapter_le(void);
1772 int bluetooth_enable_adapter_le(void);
1773
1774 int bluetooth_disable_adapter_le(void);
1775
1776 /**
1777  * @fn int bluetooth_reset_adapter(void)
1778  * @brief Reset the Bluetooth H/W and values
1779  *
1780  *
1781  * This function resets Bluetooth protocol stack and hardware. This function is called when
1782  * an user want to initialize Bluetooth environment.
1783  *
1784  * The various error codes are BLUETOOTH_ERROR_NONE for success and BLUETOOTH_ERROR_INTERNAL for
1785  * internal error.
1786  *
1787  * This function is a synchronous call.
1788  *
1789  * @return      BLUETOOTH_ERROR_NONE - Success\n
1790  * @exception   BLUETOOTH_ERROR_INTERNAL - Dbus proxy call is fail
1791  * @remark      None
1792  * @see         bluetooth_check_adapter, bluetooth_enable_adapter
1793 @code
1794 ...
1795
1796 int ret = 0;
1797 ret = bluetooth_reset_adapter();
1798 @endcode
1799  */
1800 int bluetooth_reset_adapter(void);
1801
1802 /**
1803  * @fn int bluetooth_is_supported(void)
1804  * @brief Check if the bluetooth is supported or not by the current target
1805  *
1806  * This API checks whether the bluetooth is supported or not.
1807  * This API only run by root permission.
1808  *
1809  * This function is a synchronous call.
1810  *
1811  * @return      0 - if bluetooth is not supported\n
1812  *              1 - if bluetooth is supported\n
1813  *              BLUETOOTH_ERROR_INTERNAL - Error in API internal
1814  * @remark      None
1815 @code
1816
1817 int ret = 0;
1818 ret = bluetooth_is_supported();
1819 @endcode
1820  */
1821 int bluetooth_is_supported(void);
1822
1823
1824 /**
1825  * @fn int bluetooth_check_adapter(void)
1826  * @brief Check the current status of the Bluetooth adapter
1827  *
1828  *
1829  * This API checks whether the Bluetooth adapter is enabled or not. Before performing any operations
1830  * the bluetooth adapter should be enabled. This API helps to find out the current state of the
1831  * bluetooth adapter.
1832  * This API get the adapter internal data structure and check current adapter status.
1833  *
1834  * This function is a synchronous call.
1835  *
1836  *
1837  * @return      BLUETOOTH_ADAPTER_DISABLED - if bluetooth adapter is disabled\n
1838  *              BLUETOOTH_ADAPTER_ENABLED - if bluetooth adapter is enabled\n
1839  * @remark      None
1840  * @see         bluetooth_enable_adapter, bluetooth_disable_adapter
1841 @code
1842
1843 int ret = 0;
1844 ret = bluetooth_check_adapter();
1845 @endcode
1846  */
1847 int bluetooth_check_adapter(void);
1848
1849 /**
1850  * @fn int bluetooth_get_local_address(bluetooth_device_address_t *local_address)
1851  * @brief Get the local adapter bluetooth address
1852  *
1853  *
1854  * This API is used, get the device address of the local bluetooth adapter. Before calling this API,
1855  * the adapter should be enabled.
1856  * In its output parameter, you can receive bluetooth_device_address_t type of pointer which will
1857  * contain Bluetooth address.
1858  * Since its inconvenient for user to remember the address, Bluetooth provides a method to have a
1859  * friendly name for each device.
1860  * There is no event callback for this API.
1861  *
1862  * This function is a synchronous call.
1863  *
1864  *
1865  * @return      BLUETOOTH_ERROR_NONE - Succeess \n
1866  *              BLUETOOTH_ERROR_INVALID_PARAM -  Invalid parameter (NULL buffer) \n
1867  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED -  Adapter is disabled \n
1868  * @param[out]  local_address   a device address of local bluetooth adapter
1869  * @remark      None
1870  * @see         None
1871 @code
1872
1873 bluetooth_device_address_t local_address={0,};
1874 int ret = 0;
1875
1876 ret = bluetooth_get_local_address(&local_address);
1877 @endcode
1878  */
1879 int bluetooth_get_local_address(bluetooth_device_address_t *local_address);
1880
1881 /**
1882  * @fn int bluetooth_get_local_version(bluetooth_version_t *version)
1883  * @brief Get the hci version
1884  *
1885  *
1886  * This function is used to get the bluetooth hci version
1887  * Before calling this API make sure that the adapter is enabled.
1888  *
1889  * This function is a synchronous call.
1890  *
1891  *
1892  * @return      BLUETOOTH_ERROR_NONE - Success \n
1893  *              BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
1894  * @param[out]  timeout   remain visibility timeout value
1895  * @remark      None
1896  @code
1897 bluetooth_version_t *version;
1898  int ret = 0;
1899  ret = bluetooth_get_local_version (&version);
1900  @endcode
1901  */
1902 int bluetooth_get_local_version(bluetooth_version_t *version);
1903
1904 /**
1905  * @fn int bluetooth_get_local_name(bluetooth_device_name_t* local_name)
1906  * @brief Get the local device name
1907  *
1908  *
1909  * This function is used, get the local device name. Since its difficult to remember the Adapter
1910  * address, the friendly name can be assigned to the adapter and we can get it using this API. This
1911  * friendly name is retrived by the remote device and displaying.
1912  * Before calling this API, the adapter should be enabled. There is no event callback for this API.
1913  *
1914  * This function is a synchronous call.
1915  *
1916  *
1917  * @return      BLUETOOTH_ERROR_NONE - Success \n
1918  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter (NULL buffer)\n
1919  * @param[out]  local_name      a local device name
1920  * @remark      None
1921  * @see         None
1922 @code
1923 bluetooth_device_name_t local_name={0,}
1924 int ret = 0;
1925 ret = bluetooth_get_local_name (&local_name);
1926 @endcode
1927  */
1928 int bluetooth_get_local_name(bluetooth_device_name_t *local_name);
1929
1930 /**
1931  * @fn int bluetooth_set_local_name(const bluetooth_device_name_t *local_name)
1932  * @brief Set the local device name
1933  *
1934  *
1935  * This function is used to set the local device name. This is a human friendly name whose
1936  * length can be BLUETOOTH_DEVICE_NAME_LENGTH_MAX maximum
1937  *
1938  * This function is a synchronous call.
1939  *
1940  * @param[in]   local_name   bluetooth device name to set local device
1941  *
1942  * @return      BLUETOOTH_ERROR_NONE - Success \n
1943  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
1944  *              BLUETOOTH_ERROR_INVALID_PARAM - Bluetooth name parameter is incorrect \n
1945  *              BLUETOOTH_ERROR_INVALID_DATA - Device address provided is incorrect \n
1946  *              BLUETOOTH_ERROR_NO_RESOURCES - Pre-allocated memory error \n
1947  *              BLUETOOTH_ERROR_INTERNAL - The dbus method call is fail \n
1948  *
1949  * @remark      None
1950
1951 @code
1952 bluetooth_device_name_t local_name={0,}
1953 int ret = 0;
1954 ret = bluetooth_set_local_name (&local_name);
1955 @endcode
1956  */
1957 int bluetooth_set_local_name(const bluetooth_device_name_t *local_name);
1958
1959
1960 /**
1961  * @fn int bluetooth_is_service_used(const char *service_uuid, gboolean *used)
1962  * @brief Check if the uuid is used or not
1963  *
1964  * This function is used to check if the uuid is used or not.
1965  *
1966  * This function is a synchronous call.
1967  *
1968  * @param[in]   service_uuid   service uuid (UUID 128 bit as string)
1969  * @param[out] used  if the uuid is used or not
1970  *
1971  * @return      BLUETOOTH_ERROR_NONE - Success \n
1972  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
1973  *              BLUETOOTH_ERROR_INVALID_PARAM - Bluetooth name parameter is incorrect \n
1974  *              BLUETOOTH_ERROR_INTERNAL - The dbus method call is fail \n
1975  *
1976  * @remark      None
1977  *
1978 @code
1979 gboolean used = FALSE;
1980 const char *uuid ="00001101-0000-1000-8000-00805F9B34FB";
1981 ret = bluetooth_is_service_used(uuid, &used);
1982 @endcode
1983  */
1984 int bluetooth_is_service_used(const char *service_uuid, gboolean *used);
1985
1986 /**
1987  * @fn int bluetooth_is_device_connected(const bluetooth_device_address_t *device_address, bluetooth_service_type_t type, gboolean *is_connected)
1988  * @brief Check if the device is connected to the specific service
1989  *
1990  * This function is used to check if if the device is connected to the specific service.
1991  *
1992  * This function is a synchronous call.
1993  *
1994  * @param[in]   local_address   a device address of remote bluetooth device
1995  * @param[in]   type the service type
1996  * @param[out] is_connected  if the device is connected or not
1997  *
1998  * @return      BLUETOOTH_ERROR_NONE - Success \n
1999  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
2000  *              BLUETOOTH_ERROR_INVALID_PARAM - Bluetooth name parameter is incorrect \n
2001  *              BLUETOOTH_ERROR_INTERNAL - The dbus method call is fail \n
2002  *
2003  * @remark      None
2004  *
2005 @code
2006 gboolean is_connected = FALSE;
2007 bluetooth_device_address_t device_address={{0x00,0x0D,0xFD,0x24,0x5E,0xFF}};
2008 ret = bluetooth_is_device_connected(&device_address, BLUETOOTH_HSP_SERVICE, &used);
2009 @endcode
2010  */
2011 int bluetooth_is_device_connected(const bluetooth_device_address_t *device_address,
2012                                 bluetooth_service_type_t type,
2013                                 gboolean *is_connected);
2014
2015 /**
2016  * @fn int bluetooth_get_connected_link_type(const bluetooth_device_address_t *device_address, bluetooth_connected_link_t *connected_link)
2017  * @brief Gets device's connected link type
2018  *
2019  * This function is used to get device's connected link type
2020  *
2021  * This function is a synchronous call.
2022  *
2023  * @param[in]   device_address  a device address of remote bluetooth device
2024  * @param[out]  connected_link  a device's connected link type
2025  *
2026  * @return      BLUETOOTH_ERROR_NONE - Success \n
2027  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
2028  *              BLUETOOTH_ERROR_INVALID_PARAM - Bluetooth name parameter is incorrect \n
2029  *              BLUETOOTH_ERROR_INTERNAL - The dbus method call is fail \n
2030  *
2031  * @remark      None
2032  *
2033 @code
2034 bluetooth_connected_link_t *connected_link = BLUETOOTH_CONNECTED_LINK_NONE;
2035 bluetooth_device_address_t device_address={{0x00,0x0D,0xFD,0x24,0x5E,0xFF}};
2036 ret = bluetooth_get_connected_link(&device_address, &connected_link);
2037 @endcode
2038  */
2039 int bluetooth_get_connected_link_type(const bluetooth_device_address_t *device_address,
2040                                 bluetooth_connected_link_t *connected_link);
2041
2042 /**
2043  * @fn int bluetooth_get_discoverable_mode(bluetooth_discoverable_mode_t *discoverable_mode_ptr)
2044  * @brief Get the visibility mode
2045  *
2046  *
2047  * This function is used to get the discoverable mode (Visibility option). Depending upon the
2048  * visibity mode, the property of the device is determined whether it can be discoverable, non
2049  * discoverable, connectable etc. Before calling this API make sure that the adapter is enabled.
2050  *
2051  * This function is a synchronous call.
2052  *
2053  *
2054  * @return      BLUETOOTH_ERROR_NONE - Success \n
2055  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
2056  *              BLUETOOTH_ERROR_INVALID_DATA - Invalid data \n
2057  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
2058  *              BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
2059  * @param[out]  discoverable_mode   current bluetooth discoverable mode
2060  * @remark      None
2061  * @see         bluetooth_set_discoverable_mode
2062  @code
2063  bluetooth_discoverable_mode_t discoverable_mode_ptr;
2064  int ret = 0;
2065  ret = bluetooth_get_discoverable_mode (&discoverable_mode_ptr);
2066  @endcode
2067  */
2068 int bluetooth_get_discoverable_mode(bluetooth_discoverable_mode_t *discoverable_mode_ptr);
2069
2070 /**
2071  * @fn int bluetooth_set_discoverable_mode(bluetooth_discoverable_mode_t discoverable_mode,
2072  *                                              int timeout)
2073  * @brief Set the visibility mode
2074  *
2075  *
2076  * This function is used to set the discoverable mode (Visibility option).
2077  *
2078  * Many times user may want to keep his device discoverable so that when peer device is performing
2079  * device search, he/she can find user's device. Application programmer can keep the mode as
2080  * BLUETOOTH_DISCOVERABLE_MODE_GENERAL_DISCOVERABLE or
2081  * BLUETOOTH_DISCOVERABLE_MODE_TIME_LIMITED_DISCOVERABLE for the same purpose. However, all these
2082  * modes cause bluetooth adapter to consume more battery. Hence developer should generally
2083  * keep discoverable mode as BLUETOOTH_DISCOVERABLE_MODE_CONNECTABLE.
2084  *
2085  * This function is a synchronous call.
2086  *
2087  * @return      BLUETOOTH_ERROR_NONE - Success \n
2088  *              BLUETOOTH_ERROR_NOT_SUPPORT - Requested mode is not supported \n
2089  *
2090  * @param[in]  discoverable_mode   the bluetooth discoverable mode to set
2091  * @param[in]  timeout   discoverable time in only limited discoverable mode (second), default: 0
2092  * @remark      None
2093  * @see         bluetooth_get_discoverable_mode
2094
2095 @code
2096
2097 bluetooth_discoverable_mode_t mode;
2098 int ret = 0;
2099 mode= BLUETOOTH_DISCOVERABLE_MODE_TIME_LIMITED_DISCOVERABLE;
2100 ret = bluetooth_set_discoverable_mode (mode, 180);
2101
2102 @endcode
2103  */
2104 int bluetooth_set_discoverable_mode(bluetooth_discoverable_mode_t discoverable_mode,
2105                                             int timeout);
2106
2107
2108 /**
2109  * @fn int bluetooth_get_timeout_value(int *timeout)
2110  * @brief Get the visibility timeout value
2111  *
2112  *
2113  * This function is used to get the visibility timeout
2114  * Before calling this API make sure that the adapter is enabled.
2115  *
2116  * This function is a synchronous call.
2117  *
2118  *
2119  * @return      BLUETOOTH_ERROR_NONE - Success \n
2120  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
2121  *              BLUETOOTH_ERROR_INVALID_DATA - Invalid data \n
2122  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
2123  *              BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
2124  * @param[out]  timeout   remain visibility timeout value
2125  * @remark      None
2126  * @see         bluetooth_set_discoverable_mode
2127  @code
2128  int timeout;
2129  int ret = 0;
2130  ret = bluetooth_get_timeout_value (&timeout);
2131  @endcode
2132  */
2133 int bluetooth_get_timeout_value(int *timeout);
2134
2135
2136 /**
2137  * @fn int bluetooth_start_discovery(unsigned short max_response, unsigned short discovery_duration,
2138  *                                      unsigned int  classOfDeviceMask)
2139  * @brief Start the generic device discovery which finds both the BR/EDR and LE devices.
2140  *
2141  * To connect connect to peer bluetooth device, you will need to know its bluetooth address and its
2142  * name. You can search for Bluetooth devices in vicinity by bluetooth_start_discovery() API. It
2143  * first performs an inquiry and try to find both the BREDR and LE devices. For each device found
2144  * from the inquiry it gets the remote name of the device. Bluetooth device address and name are
2145  * given to Application via BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND event. In param_data of
2146  * bluetooth_event_param_t, you will receive a pointer to a structure of bluetooth_device_info_t type.
2147  * You will receive device address, device name, device class, rssi (received signal strength indicator).
2148  * please see bluetooth_device_info_t for more details.
2149  *
2150  *
2151  * This API provides searching options like max responses, discovery duration in seconds and class
2152  * of device mask to filter device search. some times there may be too many bluetooth devices in
2153  * vicinity of your device.in such scenario, application can request to reduce number of responces
2154  * (BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND event) with help of max_response parameter. However if you
2155  * pass zero, bluetooth adapter will not restrict number of responses. you can also specify duration
2156  * of the seach in discovery_duration. bluetooth adapter will automatically stop device search after
2157  * application defined time. please note that discovery_duration should be mentioned in seconds.
2158  * Also note that search will end after 180 seconds automatically if you pass 0 in discovery
2159  * duration.
2160  *
2161  * Sometimes user may want to search for a particular kind of device. for ex, mobile or pc. in such
2162  * case, you can use classOfDeviceMask parameter. please see bluetooth_device_service_class_t,
2163  * bluetooth_device_major_class_t and bluetooth_device_minor_class_t enums
2164  *
2165  * This function is a asynchronous call.
2166  * If the call is success then the application will receive BLUETOOTH_EVENT_DISCOVERY_STARTED event
2167  * through registered callback function.
2168  *
2169  * The discovery is responded by an BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND event for each device it
2170  * found and a BLUETOOTH_EVENT_REMOTE_DEVICE_NAME_UPDATED event for its name updation.
2171  *
2172  * The completion or cancellation of the discovery is indicated by an
2173  * BLUETOOTH_EVENT_DISCOVERY_FINISHED event.
2174  *
2175  * The device discovery can be cancelled by calling bluetooth_stop_discovery().
2176  *
2177  *
2178  * @return      BLUETOOTH_ERROR_NONE - Success \n
2179  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Bluetooth adapter is not enabled \n
2180  *              BLUETOOTH_ERROR_DEVICE_BUSY - Bluetooth adapter is busy doing some operation \n
2181  *              BLUETOOTH_ERROR_INTERNAL - System error like heap full has occured or bluetooth
2182                                                 agent is not running \n
2183  *
2184  * @param[in] max_response              define the maximum response of the number of founded devices
2185                                         (0 means unlimited)
2186  * @param[in] discovery_duration        define bluetooth discovery duration (0 means 180s )
2187  * @param[in] classOfDeviceMask         define classes of the device mask which user wants
2188                                         (refer to class of device)
2189  * @remark      None
2190  * @see         bluetooth_start_custom_discovery(), bluetooth_cancel_discovery, bluetooth_device_info_t
2191
2192 @code
2193 void bt_event_callback(int event, bluetooth_event_param_t *param)
2194 {
2195         switch(event)
2196         {
2197                 case BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND:
2198                 {
2199                         bluetooth_device_info_t *device_info = NULL;
2200                         printf("BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND, result [0x%04x]",
2201                                         param->result);
2202                         device_info  = (bluetooth_device_info_t *)param->param_data;
2203                         memcpy(&searched_device, &device_info->device_address,
2204                                                 sizeof(bluetooth_device_address_t));
2205                         printf("dev [%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X]",
2206                                 device_info->device_address.addr[0],
2207                                 device_info->device_address.addr[1],
2208                                 device_info->device_address.addr[2],
2209                                 device_info->device_address.addr[3],
2210                                 device_info->device_address.addr[4],
2211                                 device_info->device_address.addr[5]);
2212                         break;
2213                 }
2214                 case BLUETOOTH_EVENT_REMOTE_DEVICE_NAME_UPDATED:
2215                 {
2216                         bluetooth_device_info_t *device_info = NULL;
2217                         printf("BLUETOOTH_EVENT_REMOTE_DEVICE_NAME_UPDATED, result [0x%04x]",
2218                                                                                 param->result);
2219                         device_info  = (bluetooth_device_info_t *)param->param_data;
2220                         memcpy(&searched_device, &device_info->device_address,
2221                                                                 sizeof(bluetooth_device_address_t));
2222                         printf("dev [%s] [%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X]",
2223                                                         device_info->device_name.name,
2224                                                         device_info->device_address.addr[0],
2225                                                         device_info->device_address.addr[1],
2226                                                         device_info->device_address.addr[2],
2227                                                         device_info->device_address.addr[3],
2228                                                         device_info->device_address.addr[4],
2229                                                         device_info->device_address.addr[5]);
2230                         break;
2231                 }
2232
2233                 case BLUETOOTH_EVENT_DISCOVERY_FINISHED:
2234                         printf("BLUETOOTH_EVENT_DISCOVERY_FINISHED, result[0x%04x]", param->result);
2235                         break;
2236         }
2237 }
2238
2239 unsigned short max_response;
2240 unsigned short discovery_duration;
2241 unsigned classOfDeviceMask;
2242 int ret = 0;
2243
2244 max_response =0;
2245 discovery_duration =0;
2246 classOfDeviceMask =0;
2247
2248 ret = bluetooth_start_discovery(max_response,discovery_duration,classOfDeviceMask);
2249
2250 @endcode
2251  *
2252  */
2253 int bluetooth_start_discovery(unsigned short max_response,
2254                                       unsigned short discovery_duration,
2255                                       unsigned int classOfDeviceMask);
2256
2257 /**
2258  * @fn int bluetooth_start_custom_discovery(bt_discovery_role_type_t role
2259  *                                      unsigned short max_response,
2260  *                                      unsigned short discovery_duration,
2261  *                                      unsigned int  classOfDeviceMask)
2262  * @brief Start the custom device discovery with specific type such as BR/EDR, LE, LE+BR/EDR etc.
2263  *
2264  * Sometimes user may want to search for a particular kind of device. for ex, LE only or BR/EDR only.
2265  * In such case, you can use type parameter. This API is similar to that of bluetooth_start_discovery().
2266  * Please see bluetooth_start_discovery() for other parameters description.
2267  *
2268  * This function is a asynchronous call.
2269  * If the call is success then the application will receive BLUETOOTH_EVENT_DISCOVERY_STARTED event
2270  * through registered callback function.
2271  *
2272  * The discovery is responded by an BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND event for each device it
2273  * found and a BLUETOOTH_EVENT_REMOTE_DEVICE_NAME_UPDATED event for its name updation.
2274  *
2275  * The completion or cancellation of the discovery is indicated by an
2276  * BLUETOOTH_EVENT_DISCOVERY_FINISHED event.
2277  *
2278  * The device discovery can be cancelled by calling bluetooth_stop_discovery().
2279  *
2280  *
2281  * @return      BLUETOOTH_ERROR_NONE - Success \n
2282  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Bluetooth adapter is not enabled \n
2283  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
2284  *              BLUETOOTH_ERROR_IN_PROGRESS - Bluetooth adapter is busy with another discovery \n
2285  *              BLUETOOTH_ERROR_INTERNAL - System error like heap full has occured or bluetooth
2286                                                 agent is not running \n
2287  *
2288  * @param[in] role              define the role type of devices to be discovered. See enum bt_discovery_role_type_t.
2289                                         (DISCOVERY_ROLE_BREDR means BREDR only, DISCOVERY_ROLE_LE mean Low Energy only,
2290                                         DISCOVERY_ROLE_LE_BREDR means LE & BREDR - same as bluetooth_start_discovery())
2291  * @param[in] max_response              define the maximum response of the number of founded devices
2292                                         (0 means unlimited)
2293  * @param[in] discovery_duration        define bluetooth discovery duration (0 means 180s )
2294  * @param[in] classOfDeviceMask         define classes of the device mask which user wants
2295                                         (refer to class of device)
2296  * @remark      None
2297  * @see         bluetooth_start_discovery(), bluetooth_cancel_discovery, bluetooth_device_info_t
2298
2299 @code
2300 unsigned short type;
2301 unsigned short max_response;
2302 unsigned short discovery_duration;
2303 unsigned classOfDeviceMask;
2304 int ret = 0;
2305
2306 type = 1;
2307 max_response =0;
2308 discovery_duration =0;
2309 classOfDeviceMask =0;
2310
2311 ret = bluetooth_start_custom_discovery(type, max_response, discovery_duration, classOfDeviceMask);
2312
2313 @endcode
2314  *
2315  */
2316 int bluetooth_start_custom_discovery(bt_discovery_role_type_t role,
2317                                                 unsigned short max_response,
2318                                                 unsigned short discovery_duration,
2319                                                 unsigned int classOfDeviceMask);
2320
2321 /**
2322  * @fn int bluetooth_cancel_discovery (void)
2323  * @brief Cancel the on-going device discovery operation
2324  *
2325  *
2326  * This function stops the on-going device discovery operation. This API has to be called after the
2327  * bluetooth_start_discovery API and before the BLUETOOTH_EVENT_DISCOVERY_FINISHED event comes of
2328  * the bluetooth_start_discovery API
2329  *
2330  * Normally the device discovery takes a more time (~10.24 seconds) to get all the devices in its
2331  * vicinity and it recevies as BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND event. This API helps us to
2332  * cancel the discover request once the user received the device to which he wish to connect.
2333  *
2334  * This function is a asynchronous call.
2335  * If the call is success to cancel discovey then the application will receive
2336  * BLUETOOTH_EVENT_DISCOVERY_FINISHED event through registered callback function
2337  * with an error code BLUETOOTH_ERROR_CANCEL. In the case of failure the error code will be
2338  * BLUETOOTH_ERROR_NONE
2339  *
2340  *
2341  * @return      BLUETOOTH_ERROR_NONE - Success \n
2342  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
2343  *              BLUETOOTH_ERROR_NOT_IN_OPERATION - No Discovery operation in progess to cancel \n
2344  *              BLUETOOTH_ERROR_ACCESS_DENIED - Currently in discovery but it is requested from
2345                                                 other application \n
2346  *              BLUETOOTH_ERROR_INTERNAL - Internel IPC error \n
2347  * @remark      None
2348  * @see         bluetooth_start_discovery
2349 @code
2350 void bt_event_callback(int event, bluetooth_event_param_t *param)
2351 {
2352         switch(event)
2353         {
2354                 case BLUETOOTH_EVENT_DISCOVERY_FINISHED:
2355                         TC_PRT("BLUETOOTH_EVENT_DISCOVERY_FINISHED, result[0x%04x]", param->result);
2356                         break;
2357         }
2358 }
2359
2360 ..
2361
2362 int ret = 0;
2363
2364 ret = bluetooth_cancel_discovery();
2365 @endcode
2366  */
2367 int bluetooth_cancel_discovery(void);
2368
2369 /**
2370  * @fn int bluetooth_start_le_discovery(void)
2371  * @brief Start the generic device discovery which finds the LE devices.
2372  *
2373  * To connect connect to peer bluetooth device, you will need to know its bluetooth address and its
2374  * name. You can search for Bluetooth devices in vicinity by bluetooth_start_le_discovery() API.
2375  * It try to find LE devices. Bluetooth device address and name are
2376  * given to Application via BLUETOOTH_EVENT_REMOTE_LE_DEVICE_FOUND event. In param_data of
2377  * bluetooth_event_param_t, you will receive a pointer to a structure of bluetooth_device_info_t type.
2378  * You will receive device address, device name, device class, rssi (received signal strength indicator).
2379  * please see bluetooth_device_info_t for more details.
2380  *
2381  * This function is a asynchronous call.
2382  * If the call is success then the application will receive BLUETOOTH_EVENT_LE_DISCOVERY_STARTED event
2383  * through registered callback function.
2384  *
2385  * The discovery is responded by an BLUETOOTH_EVENT_REMOTE_LE_DEVICE_FOUND event for each device it
2386  * found.
2387  *
2388  * The completion or cancellation of the discovery is indicated by an
2389  * BLUETOOTH_EVENT_LE_DISCOVERY_FINISHED event.
2390  *
2391  * The device discovery can be cancelled by calling bluetooth_stop_le_discovery().
2392  *
2393  *
2394  * @return      BLUETOOTH_ERROR_NONE - Success \n
2395  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Bluetooth adapter is not enabled \n
2396  *              BLUETOOTH_ERROR_DEVICE_BUSY - Bluetooth adapter is busy doing some operation \n
2397  *              BLUETOOTH_ERROR_INTERNAL - System error like heap full has occured or bluetooth
2398                                                 agent is not running \n
2399  *
2400  * @remark      None
2401  * @see         bluetooth_stop_le_discovery, bluetooth_device_info_t
2402
2403 @code
2404 void bt_event_callback(int event, bluetooth_event_param_t *param)
2405 {
2406         switch(event)
2407         {
2408                 case BLUETOOTH_EVENT_REMOTE_LE_DEVICE_FOUND:
2409                 {
2410                         bluetooth_device_info_t *device_info = NULL;
2411                         printf("BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND, result [0x%04x]",
2412                                         param->result);
2413                         device_info  = (bluetooth_device_info_t *)param->param_data;
2414                         memcpy(&searched_device, &device_info->device_address,
2415                                                 sizeof(bluetooth_device_address_t));
2416                         printf("dev [%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X]",
2417                                 device_info->device_address.addr[0],
2418                                 device_info->device_address.addr[1],
2419                                 device_info->device_address.addr[2],
2420                                 device_info->device_address.addr[3],
2421                                 device_info->device_address.addr[4],
2422                                 device_info->device_address.addr[5]);
2423                         break;
2424                 }
2425
2426                 case BLUETOOTH_EVENT_LE_DISCOVERY_FINISHED:
2427                         printf("BLUETOOTH_EVENT_LE_DISCOVERY_FINISHED, result[0x%04x]", param->result);
2428                         break;
2429         }
2430 }
2431
2432 int ret = 0;
2433 ret = bluetooth_start_discovery();
2434
2435 @endcode
2436  *
2437  */
2438 int bluetooth_start_le_discovery(void);
2439
2440 /**
2441  * @fn int bluetooth_stop_le_discovery (void)
2442  * @brief Cancel the on-going device LE discovery operation
2443  *
2444  *
2445  * This function stops the on-going device discovery operation. This API has to be called after the
2446  * bluetooth_start_le_discovery API and before the BLUETOOTH_EVENT_LE_DISCOVERY_FINISHED event comes of
2447  * the bluetooth_start_le_discovery API
2448  *
2449  *
2450  * This function is a asynchronous call.
2451  * If the call is success to cancel discovey then the application will receive
2452  * BLUETOOTH_EVENT_LE_DISCOVERY_FINISHED event through registered callback function
2453  * with an error code BLUETOOTH_ERROR_CANCEL. In the case of failure the error code will be
2454  * BLUETOOTH_ERROR_NONE
2455  *
2456  *
2457  * @return      BLUETOOTH_ERROR_NONE - Success \n
2458  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
2459  *              BLUETOOTH_ERROR_NOT_IN_OPERATION - No Discovery operation in progess to cancel \n
2460  *              BLUETOOTH_ERROR_ACCESS_DENIED - Currently in discovery but it is requested from
2461                                                 other application \n
2462  *              BLUETOOTH_ERROR_INTERNAL - Internel IPC error \n
2463  * @remark      None
2464  * @see         bluetooth_start_discovery
2465 @code
2466 void bt_event_callback(int event, bluetooth_event_param_t *param)
2467 {
2468         switch(event)
2469         {
2470                 case BLUETOOTH_EVENT_LE_DISCOVERY_FINISHED:
2471                         TC_PRT("BLUETOOTH_EVENT_LE_DISCOVERY_FINISHED, result[0x%04x]", param->result);
2472                         break;
2473         }
2474 }
2475
2476 ..
2477
2478 int ret = 0;
2479
2480 ret = bluetooth_stop_le_discovery();
2481 @endcode
2482  */
2483 int bluetooth_stop_le_discovery(void);
2484
2485 /**
2486  * @fn int bluetooth_is_discovering(void)
2487  * @brief Check for the device discovery is in-progress or not.
2488  *
2489  * This API is used to check the current status of the Discovery operation.If discovery is in\
2490  * progress normally other operations are not allowed.
2491  * If a device discovery is in progress, we have to either cancel the discovery operation or wait
2492  * for the BLUETOOTH_EVENT_DISCOVERY_FINISHED
2493  * event before performing other operations. This API is used to get for the current discovery
2494  * operation status and using bluetooth_cancel_discovery()
2495  * we can cancell the ongoing discovery process.
2496  * Before calling this API, make sure that the adapter is enabled. There is no callback event for
2497  * this API.
2498  *
2499  * This function checks whether the device discovery is started or not.
2500  *
2501  * This function is a synchronous call.
2502  *
2503  *
2504  * @return      BLUETOOTH_ERROR_NONE - Discovery is not in progress \n
2505  *              BLUETOOTH_ERROR_NONE+1 - Discovery in progress \n
2506  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
2507  *
2508  * @remark      None
2509  * @see         bluetooth_start_discovery, bluetooth_cancel_discovery
2510
2511 @code
2512 int ret = 0;
2513 ret = bluetooth_is_discovering ();
2514 @endcode
2515  */
2516 int bluetooth_is_discovering(void);
2517
2518 /**
2519  * @fn int bluetooth_is_le_discovering(void)
2520  * @brief Check for the device LE discovery is in-progress or not.
2521  *
2522  * This API is used to check the current status of the LE Discovery operation.If discovery is in\
2523  * progress normally other operations are not allowed.
2524  * If a device discovery is in progress, we have to either cancel the discovery operation or wait
2525  * for the BLUETOOTH_EVENT_LE_DISCOVERY_FINISHED
2526  * event before performing other operations. This API is used to get for the current discovery
2527  * operation status and using bluetooth_stop_le_discovery()
2528  * we can cancell the ongoing LE discovery process.
2529  * Before calling this API, make sure that the adapter is enabled. There is no callback event for
2530  * this API.
2531  *
2532  * This function checks whether the device  LE discovery is started or not.
2533  *
2534  * This function is a synchronous call.
2535  *
2536  *
2537  * @return      BLUETOOTH_ERROR_NONE - Discovery is not in progress \n
2538  *              BLUETOOTH_ERROR_NONE+1 - Discovery in progress \n
2539  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
2540  *
2541  * @remark      None
2542  * @see         bluetooth_start_le_discovery, bluetooth_stop_le_discovery
2543
2544 @code
2545 int ret = 0;
2546 ret = bluetooth_is_le_discovering ();
2547 @endcode
2548  */
2549 int bluetooth_is_le_discovering(void);
2550
2551 /**
2552  * @fn int bluetooth_is_le_scanning(void)
2553  * @brief Check for the device LE scan is in-progress or not.
2554  *
2555  * This API is used to check the current status of the LE Scan operation.If discovery is in\
2556  * progress normally other operations are not allowed.
2557  *
2558  * This function checks whether the device  LE Scan is started or not.
2559  *
2560  * This function is a synchronous call.
2561  *
2562  * @return   TRUE  - LE Scan in progress \n
2563  *              FALSE - LE Scan is not in progress \n
2564  *
2565  * @remark      None
2566
2567 @code
2568 gboolean is_le_scanning = 0;
2569 is_le_scanning = bluetooth_is_le_scanning ();
2570 @endcode
2571  */
2572 gboolean bluetooth_is_le_scanning(void);
2573
2574 /**
2575  * @fn int bluetooth_register_scan_filter(bluetooth_le_scan_filter_t *filter, int *slot_id)
2576  * @brief Register scan filter.
2577  *
2578  * This function registers the scan filter.
2579  *
2580  * This function is a synchronous call.
2581  *
2582  * @return      BLUETOOTH_ERROR_NONE - Success \n
2583  *
2584  * @param[in]   filter   scan filter to register
2585  * @param[out]  slot_id  the slot ID of scan filter
2586  *
2587  * @remark      None
2588  */
2589 int bluetooth_register_scan_filter(bluetooth_le_scan_filter_t *filter, int *slot_id);
2590
2591 /**
2592  * @fn int bluetooth_unregister_scan_filter(int slot_id)
2593  * @brief Register scan filter.
2594  *
2595  * This function unregisters the scan filter.
2596  *
2597  * This function is a synchronous call.
2598  *
2599  * @return      BLUETOOTH_ERROR_NONE - Success \n
2600  *
2601  * @param[in]   slot_id  the slot ID of scan filter
2602  *
2603  * @remark      None
2604  */
2605 int bluetooth_unregister_scan_filter(int slot_id);
2606
2607 /**
2608  * @fn int bluetooth_unregister_all_scan_filters(void)
2609  * @brief Register scan filter.
2610  *
2611  * This function usregisters all scan filters.
2612  *
2613  * This function is a synchronous call.
2614  *
2615  * @return      BLUETOOTH_ERROR_NONE - Success \n
2616  *
2617  * @remark      None
2618  */
2619 int bluetooth_unregister_all_scan_filters(void);
2620
2621 /**
2622  * @fn int bluetooth_enable_rssi(const bluetooth_device_address_t *remote_address,
2623                 int link_type, bt_rssi_threshold_t rssi_threshold)
2624  * @brief Enable RSSI monitoring
2625  *
2626  * This function enables RSSI monitoring and sets threshold for a connection
2627  *
2628  * @return      BLUETOOTH_ERROR_NONE - Success \n
2629  *
2630  * @remark      None
2631  * @see bluetooth_get_rssi_strength
2632  */
2633 int bluetooth_enable_rssi(const bluetooth_device_address_t *remote_address,
2634                 int link_type, bt_rssi_threshold_t *rssi_threshold);
2635
2636 /**
2637  * @fn int bluetooth_get_rssi_strength(const bluetooth_device_address_t *remote_address, int link_type)
2638  * @brief Gets Raw RSSI signal Strength
2639  *
2640  * This function gives the Raw RSSI signal strength for a connection.
2641  *
2642  * @return      BLUETOOTH_ERROR_NONE - Success \n
2643  *
2644  * @remark      None
2645  * @see bluetooth_enable_rssi
2646  */
2647 int bluetooth_get_rssi_strength(const bluetooth_device_address_t *remote_address, int link_type);
2648
2649 int bluetooth_set_connectable(gboolean is_connectable);
2650
2651 int bluetooth_is_connectable(gboolean *is_connectable);
2652
2653 /**
2654  * @fn int bluetooth_bond_device(const bluetooth_device_address_t *device_address)
2655  * @brief Initiate a bonding process
2656  *
2657  *
2658  * This function initiates a bonding procedure with a peer device.  The bonding procedure
2659  * enables authentication and optionally encryption on the Bluetooth link.
2660  *
2661  * Bonding is applied to the discovered device to which we need a secure connection. We cannot
2662  * inititate the bonding request to the devices already in the paired list.
2663  *
2664  * Usually we call this API after the device discovery.
2665  * This function is a asynchronous call.
2666  *
2667  * Response will be received through BLUETOOTH_EVENT_BONDING_FINISHED event. It can any of the below
2668  * mentioed result code
2669  * BLUETOOTH_ERROR_PARING_FAILED - Pairing faied \n
2670  * BLUETOOTH_ERROR_ACCESS_DENIED - Authetication rejected \n
2671  * BLUETOOTH_ERROR_CANCEL_BY_USER - Cancelled by the user \n
2672  * BLUETOOTH_ERROR_PARING_FAILED - Pairing failed \n
2673  * BLUETOOTH_ERROR_TIMEOUT - Timeout has haapened \n
2674  *
2675  * If the remote user is not responding with in a specific time(60 seconds), then a timeout happens
2676  * and BLUETOOTH_EVENT_BONDING_FINISHED callback event is called with and BLUETOOTH_ERROR_TIMEOUT
2677  * result code
2678  *
2679  * The bonding operation can be cancelled by calling bluetooth_cancel_bonding().
2680  *
2681  *
2682  * @return      BLUETOOTH_ERROR_NONE - Success \n
2683  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
2684  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
2685  *              BLUETOOTH_ERROR_DEVICE_BUSY - Adapter is busy or Discovery is in Progress \n
2686  *              BLUETOOTH_ERROR_INVALID_DATA - Invalid BD address \n
2687  * @exception   None
2688  * @param[in]   device_address   This indicates an address of the device with which the pairing
2689  *                                      should be initiated
2690  * @remark      None
2691  * @see         bluetooth_cancel_bonding
2692  @code
2693 void bt_event_callback(int event, bluetooth_event_param_t *param)
2694 {
2695         switch(event)
2696         {
2697                 case BLUETOOTH_EVENT_BONDING_FINISHED:
2698                 {
2699                         TC_PRT("BLUETOOTH_EVENT_BONDING_FINISHED, result [0x%04x]", param->result);
2700                         if (param->result >= BLUETOOTH_ERROR_NONE)
2701                         {
2702                                 bluetooth_device_info_t *device_info = NULL;
2703                                 device_info  = (bluetooth_device_info_t *)param->param_data;
2704                                 printf("dev [%s] [%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X]
2705                                                         mjr[%#x] min[%#x] srv[%#x]",
2706                                                         device_info->device_name.name,
2707                                                         device_info->device_address.addr[0],
2708                                                         device_info->device_address.addr[1],
2709                                                         device_info->device_address.addr[2],
2710                                                         device_info->device_address.addr[3],
2711                                                         device_info->device_address.addr[4],
2712                                                         device_info->device_address.addr[5],
2713                                                         device_info->device_class.major_class,
2714                                                         device_info->device_class.minor_class,
2715                                                         device_info->device_class.service_class);
2716                         }
2717                         else
2718                         {
2719                                 //bonding failed
2720                         }
2721                         break;
2722                 }
2723         }
2724 }
2725
2726 ...
2727
2728 int ret = 0;
2729 bluetooth_device_address_t device_address={{0}};
2730
2731 ret = bluetooth_bond_device(&device_address);
2732
2733 @endcode
2734  */
2735 int bluetooth_bond_device(const bluetooth_device_address_t *device_address);
2736
2737 /**
2738  * @fn int bluetooth_bond_device_by_type(const bluetooth_device_address_t *device_address,
2739  *                              bluetooth_conn_type_t conn_type)
2740  * @brief Initiate a bonding process
2741  *
2742  *
2743  * This function initiates a bonding procedure with a peer device on the basis of connection type (BLE or BREDR).
2744  * The bonding procedure enables authentication and optionally encryption on the Bluetooth link.
2745  *
2746  * Bonding is applied to the discovered device to which we need a secure connection. We cannot
2747  * inititate the bonding request to the devices already in the paired list.
2748  *
2749  * Usually we call this API after the device discovery.
2750  * This function is a asynchronous call.
2751  *
2752  * Response will be received through BLUETOOTH_EVENT_BONDING_FINISHED event. It can any of the below
2753  * mentioed result code
2754  * BLUETOOTH_ERROR_PARING_FAILED - Pairing faied \n
2755  * BLUETOOTH_ERROR_ACCESS_DENIED - Authetication rejected \n
2756  * BLUETOOTH_ERROR_CANCEL_BY_USER - Cancelled by the user \n
2757  * BLUETOOTH_ERROR_PARING_FAILED - Pairing failed \n
2758  * BLUETOOTH_ERROR_TIMEOUT - Timeout has haapened \n
2759  *
2760  * If the remote user is not responding with in a specific time(60 seconds), then a timeout happens
2761  * and BLUETOOTH_EVENT_BONDING_FINISHED callback event is called with and BLUETOOTH_ERROR_TIMEOUT
2762  * result code
2763  *
2764  * The bonding operation can be cancelled by calling bluetooth_cancel_bonding().
2765  *
2766  *
2767  * @return BLUETOOTH_ERROR_NONE - Success \n
2768  *             BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
2769  *             BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
2770  *             BLUETOOTH_ERROR_DEVICE_BUSY - Adapter is busy or Discovery is in Progress \n
2771  *             BLUETOOTH_ERROR_INVALID_DATA - Invalid BD address \n
2772  * @exception None
2773  * @param[in] device_address This indicates an address of the device with which pairing
2774  *                                        should be initiated
2775  * @param[in] conn_type This Indicates the connection type to be used for pairing in case of
2776  *                                 dual mode devices
2777  * @remark None
2778  * @see bluetooth_cancel_bonding
2779  */
2780 int bluetooth_bond_device_by_type(const bluetooth_device_address_t *device_address,
2781                                 bluetooth_conn_type_t conn_type);
2782
2783 /**
2784  * @fn int bluetooth_cancel_bonding(void)
2785  * @brief Cancel the on-going bonding process
2786  *
2787  * This API is called to cancel the on-going bonding procedure. It should be called before the
2788  * BLUETOOTH_EVENT_BONDING_FINISHED event comes.
2789  * This API is useful when the remote device is not responding to the bond request or we wish to
2790  * cancel the bonding request. In this case we need not wait for the timeout to happen.
2791  *
2792  * This function is a synchronous call.
2793  *
2794  * @return      BLUETOOTH_ERROR_NONE - Success \n
2795  *              BLUETOOTH_ERROR_NOT_IN_OPERATION - No bonding request in progress \n
2796  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
2797  * @exception   None
2798  * @remark      None
2799  * @see         bluetooth_bond_device
2800 @code
2801 ...
2802
2803 int ret = 0;
2804
2805 ret = bluetooth_cancel_bonding();
2806 @endcode
2807  */
2808 int bluetooth_cancel_bonding(void);
2809
2810 /**
2811  * @fn int bluetooth_unbond_device(const bluetooth_device_address_t *device_address)
2812  * @brief Remove bonding
2813  *
2814  *
2815  * To communicate with remote device over bluetooth link, user should bond with peer device.
2816  * After bonding is over, peer device is added to list of bonded devices. bluetooth_unbond_device()
2817  * API is used to remove peer device from the list. Please note that after removing the device
2818  * from bonded device list, you cannot communication with peer device until bonding happens again.
2819  *
2820  * User can call this function by passing bluetooth device address of any bonded device. Please note
2821  * that after successful return of this function, any bluetooth application running on your device
2822  * will not be able to communicate with unbonded device until bond operation happens again using
2823  * bluetooth_bond_device()
2824  *
2825  *
2826  * This function is a asynchronous call. The request to remove the specified device from the bonded
2827  * list is responded by an BLUETOOTH_EVENT_BONDED_DEVICE_REMOVED event. if the operation is success,
2828  * you will receive BLUETOOTH_ERROR_NONE. BLUETOOTH_ERROR_NOT_PAIRED may be received in result code
2829  * in case if there is a problem in locating given bluetooth device address in bonded devices list
2830  *
2831  *
2832  *
2833  * @return      BLUETOOTH_ERROR_NONE - Success \n
2834  *              BLUETOOTH_ERROR_INVALID_PARAM - Device address is not valid \n
2835  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Bluetooth adapter is not enabled \n
2836  *              BLUETOOTH_ERROR_DEVICE_BUSY     - Bluetooth adapter is busy doing some operation \n
2837  *              BLUETOOTH_ERROR_INVALID_DATA - Device address provided is incorrect \n
2838  *              BLUETOOTH_ERROR_INTERNAL - System error like heap full has occured or bluetooth
2839  *                                              agent is not running \n
2840  *              BLUETOOTH_ERROR_NOT_PAIRED - Device address mentioned in the argument is not a
2841  *                                              bonded device \n
2842  *
2843  * @param[in]   device_address   This indicates an address of the device to remove bonding
2844  *
2845  * @remark      None
2846  *
2847  * @see         bluetooth_bond_device, bluetooth_cancel_bonding
2848  *
2849 @code
2850 void bt_event_callback(int event, bluetooth_event_param_t *param)
2851 {
2852         switch(event) {
2853                 case BLUETOOTH_EVENT_BONDED_DEVICE_REMOVED: {
2854                         bluetooth_device_address_t *dev_addr = NULL;
2855
2856                         if (param->result == BLUETOOTH_ERROR_NONE) {
2857                                 dev_addr = (bluetooth_device_address_t *)param->param_data;
2858                                 //Unbound scuccess
2859                                 printf("%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n",
2860                                         dev_addr->addr[0], dev_addr->addr[1]
2861                                         dev_addr->addr[2], dev_addr->addr[3]
2862                                         dev_addr->addr[4], dev_addr->addr[5]
2863                         } else {
2864                                 //unbound failure
2865                         }
2866                 }
2867         }
2868 }
2869
2870 ...
2871
2872 int ret = 0;
2873 bluetooth_device_address_t *device_address;
2874
2875 // copy valid device address in device_address
2876
2877 ret = bluetooth_unbond_device(device_address);
2878 @endcode
2879  */
2880 int bluetooth_unbond_device(const bluetooth_device_address_t *device_address);
2881
2882 /**
2883  * @fn int bluetooth_get_bonded_device_list(GPtrArray **dev_list)
2884  * @brief Get bonded(paired) device list
2885  *
2886  *
2887  * This API gets all bonded device list.
2888  * The devices in the bonded device list further can be used to perform the authorization by calling
2889  * bluetooth_authorize_device API.
2890  *
2891  * This function is a synchronous call.
2892  * Information for bonded devices can be obtained when result code is BLUETOOTH_ERROR_NONE. If not,
2893  * there is no valid information in the dev_list.
2894  * The len field in the dev_list represents the number of bonded devices. The data structure for
2895  * bonded device information is bluetooth_device_info_t.
2896  *
2897  *
2898  * @return      BLUETOOTH_ERROR_NONE - Success \n
2899  *              BLUETOOTH_ERROR_NOT_SUPPORT - Opreation not supported \n
2900  * @remark      None
2901  * @see         bluetooth_bond_device, bluetooth_unbond_device, bluetooth_authorize_device
2902  @code
2903 void bt_get_bonded_devices(void)
2904 {
2905 ...
2906         int i;
2907         GPtrArray *devinfo = NULL;
2908         bluetooth_device_info_t *ptr;
2909
2910         // allocate the g_pointer_array
2911         devinfo = g_ptr_array_new();
2912
2913         ret = bluetooth_get_bonded_device_list(&devinfo);
2914         if (ret != BLUETOOTH_ERROR_NONE)
2915         {
2916                 printf("bluetooth_get_bonded_device_list failed with [%d]",ret);
2917         }
2918         else
2919         {
2920                 printf("g pointer arrary count : [%d]", devinfo->len);
2921                 for (i=0; i<devinfo->len; i++)
2922                 {
2923                         ptr = g_ptr_array_index(devinfo, i);
2924                         if (ptr != NULL)
2925                         {
2926                                 printf("Name [%s]\n", ptr->device_name.name);
2927                                 printf("Major Class [%d]\n", ptr->device_class.major_class);
2928                                 printf("Minor Class [%d]\n", ptr->device_class.minor_class);
2929                                 printf("Service Class [%d]\n", ptr->device_class.service_class);
2930                                 printf("%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n",
2931                                                                 ptr->device_address.addr[0],
2932                                 ptr->device_address.addr[1], ptr->device_address.addr[2],
2933                                                                 ptr->device_address.addr[3],
2934                                 ptr->device_address.addr[4], ptr->device_address.addr[5]);
2935
2936                                 // handle
2937                                 ...
2938                         }
2939                 }
2940         }
2941         // free g_pointer_array
2942         g_ptr_array_free(devinfo, TRUE);
2943 }
2944
2945 @endcode
2946  */
2947 int bluetooth_get_bonded_device_list(GPtrArray **dev_list);
2948
2949 /**
2950  * @fn int bluetooth_get_bonded_device(const bluetooth_device_address_t *device_address,
2951  *                                      bluetooth_device_info_t *dev_info)
2952  * @brief Get a bonded(paired) device
2953  *
2954  *
2955  * This API gets a bonded device.
2956  *
2957  * This function is a synchronous call.
2958  * Information for bonded devices can be obtained when result code is BLUETOOTH_ERROR_NONE. If not,
2959  * there is no valid information in the dev_info.
2960  * The data structure for bonded device information is bluetooth_device_info_t.
2961  *
2962  *
2963  * @return      BLUETOOTH_ERROR_NONE - Success \n
2964  *              BLUETOOTH_ERROR_NOT_SUPPORT - Opreation not supported \n
2965  * @remark      None
2966  * @see         bluetooth_bond_device, bluetooth_unbond_device, bluetooth_authorize_device
2967  @code
2968 void bt_get_bonded_device(void)
2969 {
2970 ...
2971         int i;
2972         bluetooth_device_info_t devinfo = {0};
2973         bluetooth_device_address_t device_address={{0x00,0x1C,0x43,0x2B,0x1A,0xE5}};
2974
2975         ret = bluetooth_get_bonded_device(&device_address, &devinfo);
2976         if (ret != BLUETOOTH_ERROR_NONE)
2977         {
2978                 printf("bluetooth_get_bonded_device failed with [%d]",ret);
2979         }
2980         else
2981         {
2982                 printf("Name [%s]\n", devinfo.device_name.name);
2983                 printf("Major Class [%d]\n", devinfo.device_class.major_class);
2984                 printf("Minor Class [%d]\n", devinfo.device_class.minor_class);
2985                 printf("Service Class [%d]\n", devinfo.device_class.service_class);
2986                 printf("%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n", devinfo.device_address.addr[0],
2987                 devinfo.device_address.addr[1], devinfo.device_address.addr[2],
2988                 devinfo.device_address.addr[3], devinfo.device_address.addr[4],
2989                 devinfo.device_address.addr[5]);
2990
2991                 // handle
2992                 ...
2993         }
2994 }
2995
2996 @endcode
2997  */
2998 int bluetooth_get_bonded_device(const bluetooth_device_address_t *device_address,
2999                                         bluetooth_device_info_t *dev_info);
3000
3001 /**
3002  * @fn int bluetooth_set_alias(const bluetooth_device_address_t *device_address, const char *alias)
3003  * @brief set alias for bonded device
3004  *
3005  *
3006  * This function set alias for bonded device.
3007  *
3008  * This function is a synchronous call.
3009  *
3010  *
3011  * @return      BLUETOOTH_ERROR_NONE - Success \n
3012  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3013  * @param[in]   device_address   This indicates an address of the remote device
3014  * @param[in]   alias                   This indicates an alias to set
3015  * @remark      None
3016  * @see         None
3017 @code
3018 int ret = 0;
3019 ret = bluetooth_set_alias(&remote_address);
3020 @endcode
3021  */
3022 int bluetooth_set_alias(const bluetooth_device_address_t *device_address,
3023                                 const char *alias);
3024
3025 /**
3026  * @fn int bluetooth_get_remote_device(const bluetooth_device_address_t *device_address)
3027  * @brief Get remote deivice
3028  *
3029  *
3030  * This function gets specific remote device.
3031  *
3032  * This function is a asynchronous call.
3033  * This API is responded by an BLUETOOTH_EVENT_REMOTE_DEVICE_READ event.
3034  *
3035  *
3036  * @return      BLUETOOTH_ERROR_NONE - Success \n
3037  *              BLUETOOTH_ERROR_NOT_SUPPORT - Operation not supported \n
3038  * @param[in]   device_address   This indicates an address of the remote device
3039  * @remark      None
3040  * @see         None
3041 @code
3042 int ret = 0;
3043 ret = bluetooth_get_remote_device(&remote_address);
3044 @endcode
3045  */
3046 int bluetooth_get_remote_device(const bluetooth_device_address_t *device_address);
3047
3048 /**
3049  * @fn int bluetooth_authorize_device(const bluetooth_device_address_t *device_address,
3050  *                                      gboolean authorized)
3051  * @brief Authorize/Unauthorize a bonded device
3052  *
3053  *
3054  * This function authorizes/unauthorize a bonded device. It decides the device to connect
3055  * with/without user confirmation.
3056  *
3057  * If we select a paired device and make it authorized by calling this API with the authorized
3058  * parameter to TRUE, then it will not ask for the user conformation before connecting. Similarly
3059  * if we unauthorize the paired device by calling this API with the authorized parameter to FALSE,
3060  * then it will ask for the user conformation before the connection.
3061  *
3062  * This API supposed to be called on the paired devices. Which means we have to use this API only
3063  * after successful pairing.
3064  *
3065  * This function is a asynchronous call.
3066  * Response will be received through BLUETOOTH_EVENT_DEVICE_AUTHORIZED event.
3067  *
3068  * @return      BLUETOOTH_ERROR_NONE - Success \n
3069  * @exception   BLUETOOTH_ERROR_INTERNAL - Cannot get the interal DBUS proxy \n
3070  * @param[in]   device_address   This indicates an address of the device to authorize \n
3071  * @param[in]   authorized      TRUE : authorize FALSE: unauthorize
3072  * @remark      None
3073  * @see         bluetooth_get_bonded_device_list
3074 @code
3075 void bt_event_callback(int event, bluetooth_event_param_t *param)
3076 {
3077         switch(event)
3078         {
3079                 case BLUETOOTH_EVENT_DEVICE_AUTHORIZED :
3080                 {
3081                         if (param->result == BLUETOOTH_ERROR_NONE)
3082                         {
3083                                 //Device authorized
3084                         }
3085                         //device authorization failed failure
3086                 }
3087         }
3088 }
3089
3090 ...
3091
3092 int ret = 0;
3093 bluetooth_device_address_t device_address={{0}};
3094 gboolean authorized;
3095
3096 authorized =TRUE;
3097
3098 ret = bluetooth_authorize_device(&device_address,authorized);
3099 @endcode
3100  */
3101 int bluetooth_authorize_device(const bluetooth_device_address_t *device_address,
3102                                        gboolean authorized);
3103
3104 int bluetooth_set_pin_code(const bluetooth_device_address_t *device_address,
3105                                 const bluetooth_device_pin_code_t *pin_code);
3106
3107 int bluetooth_unset_pin_code(const bluetooth_device_address_t *device_address);
3108
3109 /**
3110  * @fn int bluetooth_passkey_reply(char *passkey, gboolean reply)
3111  *
3112  * @brief Receives Legacy Passkey\pin with following authentication response types
3113  *
3114  * @param[in]   passkey : This is the PIN or PASSKEY string required for remote device authentication
3115  * @param[in]   reply    TRUE : Accept AUthentication FALSE: Cancels authentication
3116  *
3117  */
3118 int bluetooth_passkey_reply(char *passkey, gboolean reply);
3119
3120 /**
3121  * @fn int bluetooth_passkey_confirmation_reply(gboolean reply);
3122  *
3123  * @brief This API sends user confirmation reply to the local adapter.
3124  *
3125  * @param[in] reply TRUE : Accept AUthentication FALSE: Cancels authentication
3126  *
3127  */
3128 int bluetooth_passkey_confirmation_reply(gboolean reply);
3129
3130 /**
3131  * @fn int bluetooth_search_service(const bluetooth_device_address_t *device_address)
3132  * @brief Get all services supported by remote device
3133  *
3134  *
3135  * This API call initiates the search for the services supported by the specified device. Normally
3136  * the service search will take a couple of seconds to get it completed. Before calling this API
3137  * make sure that the Adapter is enabled. We have to give the device address of the remote device to
3138  * perform the service search. We can get the device address by doing a device discovery operation.
3139  *
3140  *
3141  * This function is a asynchronous call.
3142  * The service search request is responded by BLUETOOTH_EVENT_SERVICE_SEARCHED event.
3143  *
3144  * There is a timeout associated with the service search. The default time out is 40 seconds. If the
3145  * remove device did not respond with in the time out period the BLUETOOTH_EVENT_SERVICE_SEARCHED
3146  * event is generated with appropriate result code.
3147  *
3148  * @return      BLUETOOTH_ERROR_NONE - Success \n
3149  *              BLUETOOTH_ERROR_SERVICE_SEARCH_ERROR - Service search error (NULL device address) \n
3150  *              BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
3151  * @param[in]   device_address   This indicates an address of the device
3152  *                               whose services need to be found
3153  * @remark      None
3154  * @see         bluetooth_cancel_service_search
3155  */
3156 int bluetooth_search_service(const bluetooth_device_address_t *device_address);
3157
3158 /**
3159  * @fn int bluetooth_cancel_service_search(void)
3160  * @brief Cancel the ongoing service search operation
3161  *
3162  *
3163  * This function cancel the ongoing service search operation. This API is usually calling after the
3164  * bluetooth_search_service API.
3165  * Normally service search will take a more time (> 5 seconds) to complete. This API will be called
3166  * if the user wish to cancel the Ongoing service search operation.
3167  *
3168  * This API should be called just after the bluetooth_search_service API and before the
3169  * BLUETOOTH_EVENT_SERVICE_SEARCHED event
3170  *
3171  * This function is a synchronous call.
3172  *
3173  * @return      BLUETOOTH_ERROR_NONE - Success \n
3174  *              BLUETOOTH_ERROR_CANCEL - Error in service search cancel operation \n
3175  *              BLUETOOTH_ERROR_NOT_PAIRED - Not paired device \n
3176  *              BLUETOOTH_ERROR_NOT_IN_OPERATION - Searching service is not in operation \n
3177  *
3178  * @remark      None
3179  * @see         bluetooth_search_service
3180 @code
3181 ...
3182
3183 int ret = 0;
3184 ret = bluetooth_cancel_service_search();
3185 @endcode
3186 */
3187 int bluetooth_cancel_service_search(void);
3188
3189 /**
3190  * @fn int bluetooth_rfcomm_create_socket(const char *uuid)
3191  * @brief Register rfcomm socket with a specific uuid
3192  *
3193  *
3194  * This API register rfcomm socket with the given UUID. The return value of this API is the socket
3195  * descriptor of the server.
3196  * This is the first API which is called to create the server. Once we created the server socket,
3197  * we will listen on that return socket.
3198  * So a bluetooth_rfcomm_listen_and_accept should follow this API call. This is a synchronous call.
3199  *
3200  *
3201  * @return  socket FD on Success \n
3202  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
3203  *              BLUETOOTH_ERROR_INTERNAL - Internal error\n
3204  *              BLUETOOTH_ERROR_MAX_CONNECTION - Maximum connection reached\n
3205  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3206  * @param[in]   UUID (128 bits)
3207  *
3208  * @remark      None
3209  * @see       bluetooth_rfcomm_listen_and_accept, bluetooth_rfcomm_remove_socket
3210  *
3211  @code
3212
3213   const char *rfcomm_test_uuid="00001101-0000-1000-8000-00805F9B34FB";
3214   fd  = bluetooth_rfcomm_create_socket(rfcomm_test_uuid);
3215
3216  @endcode
3217  */
3218 int bluetooth_rfcomm_create_socket(const char *uuid);
3219
3220 /**
3221  * @fn int bluetooth_rfcomm_create_socket_ex(const char *uuid, const char *bus_name, const char *path)
3222  * @brief Register rfcomm socket with a specific uuid
3223  *
3224  *
3225  * This API register rfcomm socket with the given UUID. The return value of this API is the socket
3226  * descriptor of the server.
3227  * This is the first API which is called to create the server. Once we created the server socket,
3228  * we will listen on that return socket.
3229  * So a bluetooth_rfcomm_listen_and_accept_ex should follow this API call. This is a synchronous call.
3230  *
3231  *
3232  * @return  socket FD on Success \n
3233  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
3234  *              BLUETOOTH_ERROR_INTERNAL - Internal error\n
3235  *              BLUETOOTH_ERROR_MAX_CONNECTION - Maximum connection reached\n
3236  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3237  * @param[in]   UUID (128 bits)
3238  * @param[in]   bus_name (const char)
3239  * @param[in]   path (const char)
3240  *
3241  * @remark      None
3242  * @see       bluetooth_rfcomm_listen_and_accept_ex, bluetooth_rfcomm_remove_socket
3243  *
3244  @code
3245
3246   const char *rfcomm_test_uuid="00001101-0000-1000-8000-00805F9B34FB";
3247   fd  = bluetooth_rfcomm_create_socket_ex(rfcomm_test_uuid, bus_name, path);
3248
3249  @endcode
3250  */
3251 int bluetooth_rfcomm_create_socket_ex(const char *uuid, const char *bus_name, const char *path);
3252
3253 /**
3254  * @fn int bluetooth_rfcomm_remove_socket(int socket_fd, const char *uuid)
3255  * @brief De-register the rfcomm socket
3256  *
3257  *
3258  * This API deregister rfcomm socket with the given socket fd and  UUID. If the remote device is
3259  * already connected then we will receive the BLUETOOTH_EVENT_RFCOMM_DISCONNECTED with socket
3260  * descriptor else no event will come. We will call this API only after the
3261  * bluetooth_rfcomm_listen_and_accept.
3262  * This is a synchronous call.
3263  *
3264  * @return   BLUETOOTH_ERROR_NONE - Success \n
3265  *               BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
3266  *               BLUETOOTH_ERROR_NOT_FOUND - Cannot find the proxy\n
3267  *               BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3268  * @param[in]  int socket_fd
3269  *
3270  * @remark      None
3271  * @see       bluetooth_rfcomm_create_socket, bluetooth_rfcomm_listen_and_accept
3272  *
3273  @code
3274  void bt_event_callback(int event, bluetooth_event_param_t *param)
3275  {
3276         switch(event)
3277         {
3278                 case BLUETOOTH_EVENT_RFCOMM_DISCONNECTED:
3279                 {
3280                         bluetooth_rfcomm_connection_t *discon_ind =
3281                                         (bluetooth_rfcomm_connection_t *)param->param_data;
3282
3283                         printf("\nDisconnected from FD %d",  discon_ind->socket_fd);
3284                 }
3285         }
3286  }
3287
3288  ...
3289
3290  int ret = 0;
3291  fd  = bluetooth_rfcomm_create_socket(rfcomm_test_uuid);
3292  ret = bluetooth_rfcomm_listen_and_accept(fd, 1);
3293  ....
3294  ret = bluetooth_rfcomm_remove_socket(fd);
3295  @endcode
3296  */
3297 int bluetooth_rfcomm_remove_socket(int socket_fd);
3298
3299 /**
3300  * @fn int bluetooth_rfcomm_remove_socket(const char *uuid)
3301  * @brief De-register the rfcomm socket
3302  *
3303  *
3304  * This API deregister rfcomm socket with the given socket UUID. If the remote device is
3305  * already connected then we will receive the BLUETOOTH_EVENT_RFCOMM_DISCONNECTED with socket
3306  * descriptor else no event will come. We will call this API only after the
3307  * bluetooth_rfcomm_listen_and_accept_ex.
3308  * This is a synchronous call.
3309  *
3310  * @return   BLUETOOTH_ERROR_NONE - Success \n
3311  *               BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
3312  *               BLUETOOTH_ERROR_NOT_FOUND - Cannot find the proxy\n
3313  *               BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3314  * @param[in]   UUID (128 bits)
3315  *
3316  * @remark      None
3317  * @see       bluetooth_rfcomm_create_socket_ex, bluetooth_rfcomm_listen_and_accept_ex
3318  *
3319  @code
3320  void bt_event_callback(int event, bluetooth_event_param_t *param)
3321  {
3322         switch(event)
3323         {
3324                 case BLUETOOTH_EVENT_RFCOMM_DISCONNECTED:
3325                 {
3326                         bluetooth_rfcomm_connection_t *discon_ind =
3327                                         (bluetooth_rfcomm_connection_t *)param->param_data;
3328
3329                         printf("\nDisconnected from FD %d",  discon_ind->socket_fd);
3330                 }
3331         }
3332  }
3333
3334  ...
3335
3336  int ret = 0;
3337  fd  = bluetooth_rfcomm_create_socket_ex(rfcomm_test_uuid, path, bus_name);
3338  ret = bluetooth_rfcomm_listen_and_accept_ex(rfcomm_test_uuid, 1, bus_name, path);
3339  ....
3340  ret = bluetooth_rfcomm_remove_socket_ex(rfcomm_test_uuid);
3341  @endcode
3342  */
3343 int bluetooth_rfcomm_remove_socket_ex(const char *uuid);
3344
3345 /**
3346  * @fn int bluetooth_rfcomm_server_disconnect(int socket_fd)
3347  * @brief Disconnect rfcomm connection
3348  *
3349  *
3350  * Disconnect a specific(device node fd)  RFCOMM connection. This is a Synchronous call and there
3351  * is no cabbback events for this API. We have to provice the valid client fd to disconnect from the
3352  * remote server.
3353  *
3354  * @return   BLUETOOTH_ERROR_NONE  - Success \n
3355  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3356  *              BLUETOOTH_ERROR_NOT_CONNECTED - Not connected \n
3357  * @param[in]  int socket_fd the sending socket fd
3358  *
3359  * @remark      None
3360  *
3361  @code
3362
3363   ret = bluetooth_rfcomm_server_disconnect(g_ret_fd);
3364   if (ret < 0)
3365         printf("Disconnection failed");
3366   else
3367   printf("Disconnection Success");
3368
3369  @endcode
3370  */
3371 int bluetooth_rfcomm_server_disconnect(int socket_fd);
3372
3373 /**
3374  * @fn int bluetooth_rfcomm_listen_and_accept(int socket_fd,int max_pending_connection)
3375  * @brief Rfcomm socket listen
3376  *
3377  *
3378  * This API make rfcomm socket listen and accept with socket. We will call this API immediatly
3379  * after the bluetooth_rfcomm_create_socket API.
3380  * This API listen for the incomming connection and once it receives a connection, it will give
3381  * BLUETOOTH_EVENT_RFCOMM_CONNECTED
3382  * event to the application. This is an Asynchronous API call.
3383  *
3384  *
3385  * @return  BLUETOOTH_ERROR_NONE - Success \n
3386  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3387  *              BLUETOOTH_ERROR_CONNECTION_ERROR - Listen failed \n
3388
3389  * @param[in]  int socket_fd
3390  * @param[in]  max pending connection.
3391  *
3392  * @remark      None
3393  * @see       bluetooth_rfcomm_create_socket
3394  *
3395   @code
3396   void bt_event_callback(int event, bluetooth_event_param_t* param)
3397  {
3398         switch(event)
3399         {
3400                 case BLUETOOTH_EVENT_RFCOMM_CONNECTED:
3401                 {
3402                         bluetooth_rfcomm_connection_t *conn_ind =
3403                                                 (bluetooth_rfcomm_connection_t *)param->param_data;
3404
3405                         printf("\nConnected from FD %d",  conn_ind->socket_fd);
3406                 }
3407         }
3408  }
3409
3410  ...
3411
3412  int ret = 0;
3413  fd  = bluetooth_rfcomm_create_socket(rfcomm_test_uuid);
3414  ret = bluetooth_rfcomm_listen_and_accept(fd, 1);
3415
3416  @endcode
3417  */
3418 int bluetooth_rfcomm_listen_and_accept(int socket_fd, int max_pending_connection);
3419
3420 /**
3421  * @fn int bluetooth_rfcomm_listen_and_accept_ex(const char *uuid, int max_pending_connection, const char *bus_name, const char *path)
3422  * @brief Rfcomm socket listen
3423  *
3424  *
3425  * This API make rfcomm socket listen and accept with socket. We will call this API immediatly
3426  * after the bluetooth_rfcomm_create_socket API.
3427  * This API listen for the incomming connection and once it receives a connection, it will give
3428  * BLUETOOTH_EVENT_RFCOMM_CONNECTED
3429  * event to the application. This is an Asynchronous API call.
3430  *
3431  *
3432  * @return  BLUETOOTH_ERROR_NONE - Success \n
3433  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3434  *              BLUETOOTH_ERROR_CONNECTION_ERROR - Listen failed \n
3435
3436  * @param[in]  int socket_fd
3437  * @param[in]  max pending connection.
3438  * @param[in]  name
3439  * @param[in]  path
3440  *
3441  * @remark      None
3442  * @see       bluetooth_rfcomm_create_socket_ex
3443  *
3444   @code
3445   void bt_event_callback(int event, bluetooth_event_param_t* param)
3446  {
3447         switch(event)
3448         {
3449                 case BLUETOOTH_EVENT_RFCOMM_CONNECTED:
3450                 {
3451                         bluetooth_rfcomm_connection_t *conn_ind =
3452                                                 (bluetooth_rfcomm_connection_t *)param->param_data;
3453
3454                         printf("\nConnected from FD %d",  conn_ind->socket_fd);
3455                 }
3456         }
3457  }
3458
3459  ...
3460
3461  int ret = 0;
3462  fd  = bluetooth_rfcomm_create_socket_ex(rfcomm_test_uuid);
3463  ret = bluetooth_rfcomm_listen_and_accept_ex(rfcomm_test_uuid, 1, bus_name, path);
3464
3465  @endcode
3466  */
3467
3468 int bluetooth_rfcomm_listen_and_accept_ex(const char *uuid, int max_pending_connection, const char *bus_name, const char *path);
3469
3470 /**
3471  * @fn int bluetooth_rfcomm_listen(int socket_fd,int max_pending_connection)
3472  * @brief Rfcomm socket listen
3473  *
3474  *
3475  * This API make rfcomm socket listen and accept with socket. We will call this API immediatly
3476  * after the bluetooth_rfcomm_create_socket API.
3477  * This API listen for the incomming connection and once it receives a connection, it will give
3478  * BLUETOOTH_EVENT_RFCOMM_AUTHORIZE
3479  * event to the application. This is an Asynchronous API call.
3480  *
3481  *
3482  * @return  BLUETOOTH_ERROR_NONE - Success \n
3483  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3484  *              BLUETOOTH_ERROR_CONNECTION_ERROR - Listen failed \n
3485
3486  * @param[in]  int socket_fd
3487  * @param[in]  max pending connection.
3488  *
3489  * @remark      None
3490  * @see       bluetooth_rfcomm_create_socket
3491  *
3492   @code
3493   void bt_event_callback(int event, bluetooth_event_param_t* param)
3494  {
3495         switch(event)
3496         {
3497                 case BLUETOOTH_EVENT_RFCOMM_AUTHORIZE:
3498                 {
3499                         char *name = (char *)param->param_data;
3500
3501                         printf("\nConnected from %s",  name);
3502
3503                         bluetooth_rfcomm_accept_connection();
3504                 }
3505         }
3506  }
3507
3508  ...
3509
3510  int ret = 0;
3511  fd  = bluetooth_rfcomm_create_socket(rfcomm_test_uuid);
3512  ret = bluetooth_rfcomm_listen(fd, 1);
3513
3514  @endcode
3515  */
3516 int bluetooth_rfcomm_listen(int socket_fd, int max_pending_connection);
3517
3518 /**
3519  * @fn int bluetooth_rfcomm_accept_connection()
3520  * @brief Accepts the authorization request indicated by the event
3521   * BLUETOOTH_EVENT_RFCOMM_AUTHORIZE.
3522  *
3523  * This function is a synchronous call.
3524  *
3525  * @return   BLUETOOTH_ERROR_NONE  - Success \n
3526  *              BLUETOOTH_ERROR_INTERNAL - Internal error \n
3527  *
3528  * @param[in]  the socket fd of the server
3529  * @param[out]  the socket fd of the client
3530  *
3531  * @exception   None
3532  * @remark       None
3533  * @see           bluetooth_rfcomm_reject_connection
3534  */
3535 int bluetooth_rfcomm_accept_connection(int server_fd);
3536
3537 /**
3538  * @fn int bluetooth_rfcomm_reject_connection()
3539  * @brief Rejects the authorization request indicated by the event
3540   * BLUETOOTH_EVENT_RFCOMM_AUTHORIZE.
3541  *
3542  * This function is a synchronous call.
3543  *
3544  * @return   BLUETOOTH_ERROR_NONE  - Success \n
3545  *              BLUETOOTH_ERROR_INTERNAL - Internal error \n
3546  *
3547  * @param[in]  the socket fd of the server
3548  *
3549  * @exception   None
3550  * @remark       None
3551  * @see           bluetooth_rfcomm_accept_connection
3552  */
3553 int bluetooth_rfcomm_reject_connection(int server_fd);
3554
3555 /**
3556  * @fn gboolean bluetooth_rfcomm_is_server_uuid_available(const char *uuid)
3557  * @brief Informs whether rfcomm server uuid is available or not.
3558  *
3559  * This function is a synchronous call.
3560  *
3561  * @return   TRUE  - RFCOMM uuid is available \n
3562  *              FALSE - RFCOMM uuid is not available \n
3563  *
3564  * @param[in]  uuid UUID string
3565  *
3566  * @exception   None
3567  *
3568  * @remark       None
3569  */
3570 gboolean bluetooth_rfcomm_is_server_uuid_available(const char *uuid);
3571
3572 /**
3573  * @fn int bluetooth_rfcomm_connect(const bluetooth_device_address_t  *remote_bt_address,
3574  *                                                                      const char *remote_uuid)
3575  * @brief Connect to the remote device rfcomm *
3576  *
3577  * Connect to a specific RFCOMM based service on a remote device UUID. This is a Async call. Once
3578  * the connection is successful callback BLUETOOTH_EVENT_RFCOMM_CONNECTED events is generated,
3579  * which contains the socket_fd, device role (RFCOMM_ROLE_SERVER/RFCOMM_ROLE_CLIENT), device addess
3580  * etc. The socket_fd can be further used to send the data. It better to do a sevice search before
3581  * initiating a connection.
3582  *
3583  * @return  BLUETOOTH_ERROR_NONE  - Success \n
3584  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
3585  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3586  *              BLUETOOTH_ERROR_CONNECTION_BUSY - Connection in progress \n
3587  *              BLUETOOTH_ERROR_INTERNAL - Internal Error\n
3588  * @param[in]  bluetooth_device_address_t remote bt_address
3589  * @param[in]  char remote uuid
3590  * @remark      None
3591  * @see         bluetooth_rfcomm_disconnect, bluetooth_rfcomm_write, bluetooth_search_service
3592  *
3593  @code
3594
3595  void bt_event_callback(int event, bluetooth_event_param_t *param)
3596  {
3597         switch(event)
3598         {
3599                 case BLUETOOTH_EVENT_SERVICE_SEARCHED:
3600                 {
3601                         if (param->result >= BLUETOOTH_ERROR_NONE)
3602                         {
3603                                 bt_sdp_info_t *bt_sdp_info=param->param_data;
3604
3605                                 printf("Dev add = %2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n",
3606                                         bt_sdp_info->device_addr.addr[0],
3607                                         bt_sdp_info->device_addr.addr[1],
3608                                         bt_sdp_info->device_addr.addr[2],
3609                                         bt_sdp_info->device_addr.addr[3],
3610                                         bt_sdp_info->device_addr.addr[4],
3611                                         bt_sdp_info->device_addr.addr[5]);
3612
3613                                         printf("Supported service list:\n");
3614                                         for(i=0; i<bt_sdp_info->service_index; i++)
3615                                                 printf("[%#x]\n",
3616                                                         bt_sdp_info->service_list_array[i]);
3617
3618                                 //Alternate method
3619                                 //ret = bluetooth_rfcomm_connect(bt_sdp_info->device_addr,
3620                                                                                 //rfcomm_test_uuid);
3621                         }
3622                         break;
3623                 }
3624                 case BLUETOOTH_EVENT_RFCOMM_CONNECTED:
3625                 {
3626                         bluetooth_rfcomm_connection_t *conn_ind =
3627                                                 (bluetooth_rfcomm_connection_t *)param->param_data;
3628
3629                         printf("\nConnected from FD %d, Role = %s",  conn_ind->socket_fd,
3630                                                 (conn_ind->device_role == RFCOMM_ROLE_SERVER) ?
3631                                                                         "SERVER" : "CLIENT");
3632                 }
3633         }
3634  }
3635
3636   bluetooth_device_address_t remote_address = {{0},};
3637   remote_address.addr[0] = 0x0; remote_address.addr[1] = 0x0A; remote_address.addr[2] = 0x3A;
3638   remote_address.addr[3]= 0x54; remote_address.addr[4] = 0x19;  remote_address.addr[5]= 0x36;
3639   ret = bluetooth_search_service(&remote_address);
3640  if (ret < 0)
3641         printf("Seach failed, Reason = %d", ret);
3642   else
3643          printf("Search Success, Ret = %d", ret);
3644
3645   ret = bluetooth_rfcomm_connect(&remote_address, rfcomm_test_uuid);
3646   if (ret < 0)
3647         printf("Connection failed, Reason = %d", ret);
3648   else
3649          printf("Connection Success, Ret = %d", ret);
3650
3651   @endcode
3652   */
3653 int bluetooth_rfcomm_connect(const bluetooth_device_address_t *remote_bt_address,
3654                                      const char *remote_uuid);
3655
3656 /**
3657  * @fn int bluetooth_rfcomm_disconnect(int socket_fd)
3658  * @brief Disconnect rfcomm connection
3659  *
3660  *
3661  * Disconnect a specific(device node fd)  RFCOMM connection. This is a Synchronous call and there
3662  * is no cabbback events for this API. We have to provice the valid client fd to disconnect from the
3663  * remote server.
3664  *
3665  * @return   BLUETOOTH_ERROR_NONE  - Success \n
3666  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3667  *              BLUETOOTH_ERROR_NOT_CONNECTED - Not connected \n
3668  * @param[in]  char remote bt_address
3669  *
3670  * @remark      None
3671  * @see         bluetooth_rfcomm_connect
3672  *
3673  @code
3674
3675   ret = bluetooth_rfcomm_disconnect(g_ret_fd);
3676   if (ret < 0)
3677         printf("Disconnection failed");
3678   else
3679   printf("Disconnection Success");
3680
3681  @endcode
3682  */
3683
3684 int bluetooth_rfcomm_disconnect(int socket_fd);
3685
3686 /**
3687  * @fn int bluetooth_rfcomm_write (int fd, const char *buff, int length)
3688  * @brief Write to rfcomm connection
3689  *
3690  *
3691  * This API is used to send the data over the rfcomm connection. This is a synchronous API. The same
3692  * API is used to send the data for server and the client.
3693  *
3694  * @return  BLUETOOTH_ERROR_NONE  - Success \n
3695  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3696  *              BLUETOOTH_ERROR_NOT_IN_OPERATION - The Fd is currently not in operation\n
3697  * @param[in]  int fd
3698  * @param[in]  const char *buff  Data buffer to send
3699  * @param[in]  int length Length of the data
3700  *
3701  * @remark      None
3702  * @see         bluetooth_rfcomm_connect
3703  *
3704   @code
3705   char *buff = "Test data 123456789"
3706   ret =  bluetooth_rfcomm_write(g_ret_fd, buff, 15);
3707   if (ret < 0)
3708         printf("Send failed");
3709   else
3710    printf("Send success");
3711
3712  @endcode
3713  */
3714 int bluetooth_rfcomm_write(int fd, const char *buf, int length);
3715
3716 /**
3717  * @fn gboolean bluetooth_rfcomm_is_client_connected(void)
3718  * @brief Informs whether rfcomm client is connected.
3719  *
3720  * This function is a synchronous call.
3721  *
3722  * @return   TRUE  - RFCOMM client is connected \n
3723  *              FALSE - RFCOMM client is not connected \n
3724  *
3725  * @exception   None
3726  *
3727  * @remark       None
3728  */
3729 gboolean bluetooth_rfcomm_is_client_connected(void);
3730 int bluetooth_rfcomm_client_is_connected(const bluetooth_device_address_t *device_address, gboolean *connected);
3731 int bluetooth_rfcomm_server_is_connected(const bluetooth_device_address_t *device_address, gboolean *connected);
3732
3733 /**
3734  * @fn int bluetooth_network_activate_server(void)
3735  * @brief Activate the NAP (Network Access Point) service
3736  *
3737  * This function is a asynchronous call.
3738  * The activate server request is responded by BLUETOOTH_EVENT_NETWORK_SERVER_ACTIVATED event.
3739  *
3740  * @return   BLUETOOTH_ERROR_NONE  - Success \n
3741  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3742  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
3743  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Not enabled \n
3744  *
3745  * @remark      None
3746   * @see        bluetooth_network_deactivate_server
3747  *
3748  */
3749 int bluetooth_network_activate_server(void);
3750
3751 /**
3752  * @fn int bluetooth_network_deactivate_server(void)
3753  * @brief Deactivate the NAP (Network Access Point) service
3754  *
3755  * This function is a asynchronous call.
3756  * The deactivate server request is responded by BLUETOOTH_EVENT_NETWORK_SERVER_DEACTIVATED event.
3757  *
3758  * @return   BLUETOOTH_ERROR_NONE  - Success \n
3759  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3760  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
3761  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Not enabled \n
3762  *
3763  * @remark      None
3764  * @see         bluetooth_network_activate_server
3765  *
3766  */
3767 int bluetooth_network_deactivate_server(void);
3768
3769 /**
3770  * @fn int bluetooth_network_connect(const bluetooth_device_address_t *device_address,
3771  *                                      bluetooth_network_role_t role,
3772  *                                      char  custom_uuid)
3773  * @brief Connect the network server in the peer
3774  *
3775  * This function is a asynchronous call.
3776  * The network connect request is responded by BLUETOOTH_EVENT_NETWORK_CONNECTED event.
3777  *
3778  * @return   BLUETOOTH_ERROR_NONE  - Success \n
3779  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3780  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
3781  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Not enabled \n
3782  *
3783  * @exception   None
3784  * @param[in]  device_address   This indicates an address of the device with which the pairing
3785  *                              should be initiated
3786  * @param[in]  role   The role to connect. PANU / GN / NAP / CUSTOM. If use the CUSTOM value,
3787  *                      need to use the third parameter.
3788  * @param[in]  custom_uuid   If use the CUSTOM value in second parameter, use this parameter to
3789  *                              connect. UUID string
3790  * @remark      None
3791  * @see         bluetooth_network_disconnect
3792  */
3793 int bluetooth_network_connect(const bluetooth_device_address_t *device_address,
3794                                       bluetooth_network_role_t role, char *custom_uuid);
3795
3796 /**
3797  * @fn int bluetooth_network_disconnect(const bluetooth_device_address_t *device_address,
3798  *                                                      bluetooth_network_role_t role,
3799  *                                                        char *custom_uuid)
3800  * @brief Connect the network server in the peer
3801  *
3802  * This function is a asynchronous call.
3803  * The network disconnect request is responded by BLUETOOTH_EVENT_NETWORK_CONNECTED event.
3804  *
3805  * @return   BLUETOOTH_ERROR_NONE  - Success \n
3806  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3807  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
3808  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Not enabled \n
3809  *
3810  * @exception   None
3811  * @param[in]   device_address   This indicates an address of the device with which the pairing
3812  *                                      should be initiated
3813  * @remark       None
3814  * @see         bluetooth_network_connect
3815  */
3816 int bluetooth_network_disconnect(const bluetooth_device_address_t *device_address);
3817
3818 /**
3819  * @fn int bluetooth_network_server_disconnect(const bluetooth_device_address_t *device_address)
3820  * @brief Disconnect the device from the network
3821  *
3822  * This function is an asynchronous call.
3823  * The network server disconnect request is responded by
3824  * BLUETOOTH_EVENT_NETWORK_SERVER_DISCONNECTED event.
3825  *
3826  * @return   BLUETOOTH_ERROR_NONE  - Success \n
3827  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3828  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
3829  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Not enabled \n
3830  *
3831  * @exception   None
3832  * @param[in]   device_address   This indicates an address of the connected client device
3833  * @remark       None
3834  * @see         bluetooth_network_activate_server
3835  */
3836 int bluetooth_network_server_disconnect(const bluetooth_device_address_t *device_address);
3837
3838 /*HDP - API's*/
3839
3840 /**
3841  * @fn int bluetooth_hdp_activate(unsigned short  data_type,
3842  *                                      bt_hdp_role_type_t role,
3843  *                                      bt_hdp_qos_type_t channel_type,
3844  *                                      char **app_handle)
3845  * @brief Activate the HDP service for a particular data type
3846  *
3847  * This function is a synchronous call.
3848  *
3849  * @return   BLUETOOTH_ERROR_NONE  - Success \n
3850  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3851  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
3852  *              BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
3853  *
3854  * @exception   None
3855  * @param[in]  data_type   The data type against corresponding service
3856  * @param[in]  role   The role of HDP. HDP_ROLE_SOURCE/HDP_ROLE_SINK.
3857  * @param[in]  channel_type   The QOS type for the channel.
3858  *                              HDP_QOS_RELIABLE/HDP_QOS_STREAMING/HDP_QOS_ANY.
3859  *                              For role = HDP_ROLE_SINK, the channel_type
3860  *                              should be HDP_QOS_ANY.
3861  * @param[out]  app_handle    The application handler against corresponding service
3862  * @remark       None
3863  * @see            bluetooth_hdp_deactivate
3864  */
3865 int bluetooth_hdp_activate(unsigned short  data_type,
3866                                 bt_hdp_role_type_t role,
3867                                 bt_hdp_qos_type_t channel_type,
3868                                 char **app_handle);
3869 /**
3870  * @fn int bluetooth_hdp_deactivate(const char *app_handle)
3871  * @brief Deactivate the HDP service for a particular service using the handler
3872  *
3873  * This function is a synchronous call.
3874  *
3875  * @return   BLUETOOTH_ERROR_NONE  - Success \n
3876  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3877  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
3878  *              BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
3879  *
3880  * @exception   None
3881  * @param[in]  app_handle   The application handler against corresponding service
3882  * @remark       None
3883  * @see            bluetooth_hdp_deactivate
3884  */
3885 int bluetooth_hdp_deactivate(const char *app_handle);
3886
3887 /**
3888  * @fn int bluetooth_hdp_send_data(unsigned int channel_id,
3889  *                                      const char *buffer, unsigned int size)
3890  * @brief Send data to the remote HDP device
3891  *
3892  * This function is a synchronous call.
3893  *
3894  * @return   BLUETOOTH_ERROR_NONE  - Success \n
3895  *             BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3896  *             BLUETOOTH_ERROR_INTERNAL - Internal Error \n
3897  *             BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
3898  *             BLUETOOTH_ERROR_NOT_IN_OPERATION - FD is invalid  \n
3899  *
3900  * @exception   None
3901  * @param[in]  channel_id   The channel id for the connection.
3902  * @param[in]  buffer   The pdu buffer.
3903  * @param[in]  size   Size of the buffer.
3904  * @remark       None
3905  * @see            bluetooth_hdp_connect
3906  */
3907 int bluetooth_hdp_send_data(unsigned int channel_id,
3908                                 const char *buffer, unsigned int size);
3909 /**
3910  * @fn int bluetooth_hdp_connect(const char *app_handle,
3911  *                              bt_hdp_qos_type_t channel_type,
3912  *                              const bluetooth_device_address_t *device_address)
3913  * @brief Connect to the remote device(Mainly used by source)
3914  *
3915  * This function is a asynchronous call.
3916  * The HDP activate is responded by BLUETOOTH_EVENT_HDP_CONNECTED event.
3917  *
3918  * @return   BLUETOOTH_ERROR_NONE  - Success \n
3919  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3920  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
3921  *              BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
3922  *              BLUETOOTH_ERROR_MEMORY_ALLOCATION -Memory allocation failed \n
3923  *
3924  * @exception   None
3925  * @param[in]  app_handle   The application handler against corresponding service
3926  * @param[in]  channel_type   The QOS type for the channel.
3927  *                              HDP_QOS_RELIABLE/HDP_QOS_STREAMING.
3928  * @param[in]  device_address   The remote device Bd address.
3929  *
3930  * @remark       None
3931  * @see            bluetooth_hdp_disconnect
3932  */
3933 int bluetooth_hdp_connect(const char *app_handle,
3934                         bt_hdp_qos_type_t channel_type,
3935                         const bluetooth_device_address_t *device_address);
3936 /**
3937  * @fn int bluetooth_hdp_disconnect(unsigned int channel_id,
3938  *                      const bluetooth_device_address_t *device_address)
3939  * @brief Disconnect from the remote device(Mainly used by source)
3940  *
3941  * This function is a asynchronous call.
3942  * The HDP activate is responded by BLUETOOTH_EVENT_HDP_DISCONNECTED event.
3943  *
3944  * @return   BLUETOOTH_ERROR_NONE  - Success \n
3945  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3946  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
3947  *              BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
3948   *              BLUETOOTH_ERROR_MEMORY_ALLOCATION -Memory allocation failed \n
3949  *
3950  * @exception   None
3951  * @param[in]  channel_id    The channel id for the connection.
3952  * @param[in]  device_address   The remote device Bd address.
3953  *
3954  * @remark       None
3955  * @see            bluetooth_hdp_connect
3956  */
3957 int bluetooth_hdp_disconnect(unsigned int channel_id,
3958                         const bluetooth_device_address_t  *device_address);
3959
3960
3961 /**
3962  * @fn int bluetooth_opc_init(void)
3963  * @brief Initialize OPP client.
3964  *
3965  * This function is a synchronous call.
3966  * No event corresponding to this api
3967  *
3968  * @return   BLUETOOTH_ERROR_NONE  - Success \n
3969  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
3970  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
3971  *              BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
3972   *             BLUETOOTH_ERROR_ACCESS_DENIED -Memory allocation failed \n
3973  *
3974  * @exception   None
3975  *
3976  * @remark       None
3977  * @see           bluetooth_opc_deinit
3978  */
3979 int bluetooth_opc_init(void);
3980
3981 /**
3982  * @fn int bluetooth_opc_deinit(void)
3983  * @brief Deinitialize OPP client.
3984  *
3985  * This function is a synchronous call.
3986  * No event corresponding to this api
3987  *
3988  * @return   BLUETOOTH_ERROR_NONE  - Success \n
3989  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
3990  *              BLUETOOTH_ERROR_ACCESS_DENIED -Memory allocation failed \n
3991  *
3992  * @exception   None
3993  *
3994  * @remark       None
3995  * @see           bluetooth_opc_init
3996  */
3997
3998  int bluetooth_opc_deinit(void);
3999
4000 /**
4001  * @fn int bluetooth_opc_push_files(bluetooth_device_address_t *remote_address,
4002                                         char **file_name_array)
4003  * @brief Send multiple files to a remote device.
4004  *
4005  * This function is a asynchronous call.
4006  * This api  is responded by BLUETOOTH_EVENT_OPC_CONNECTED event.
4007  *
4008  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4009  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
4010  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
4011  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4012  *              BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
4013  *              BLUETOOTH_ERROR_IN_PROGRESS -Already one push in progress \n
4014  *              BLUETOOTH_ERROR_ACCESS_DENIED - Not allowed by MDM policy \n
4015  *
4016  * @exception   None
4017  * @param[in]  device_address   The remote device Bd address.
4018  * @param[in]  file_name_array  Array of filepaths to be sent.
4019  *
4020  * @remark       None
4021  * @see          bluetooth_opc_cancel_push
4022  */
4023
4024 int bluetooth_opc_push_files(bluetooth_device_address_t *remote_address,
4025                                 char **file_name_array);
4026
4027 /**
4028  * @fn int bluetooth_opc_cancel_push(void)
4029  * @brief Cancels the ongoing file push.
4030  *
4031  * This function is a asynchronous call.
4032  * This api is responded with either BLUETOOTH_EVENT_OPC_CONNECTED or
4033  * BLUETOOTH_EVENT_OPC_TRANSFER_COMPLETED event.
4034  *
4035  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4036  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
4037  *              BLUETOOTH_ERROR_ACCESS_DENIED - No push in progress \n
4038  *
4039  * @exception   None
4040  *
4041  * @remark       None
4042  * @see           bluetooth_opc_push_files
4043  */
4044
4045 int bluetooth_opc_cancel_push(void);
4046
4047 /**
4048  * @fn gboolean bluetooth_opc_session_is_exist(void)
4049  * @brief Informs whether opc session exists or not.
4050  *
4051  * This function is a synchronous call.
4052  *
4053  * @return   TRUE  - OPC session exists \n
4054  *              FALSE - OPC session does not exist \n
4055  *
4056  * @exception   None
4057  *
4058  * @remark       None
4059  * @see          None
4060  */
4061
4062 gboolean bluetooth_opc_session_is_exist(void);
4063
4064 /**
4065  * @fn int bluetooth_opc_is_sending(gboolean *is_sending)
4066  * @brief Informs whether opc session exists or not.
4067  *
4068  * This function is a synchronous call.
4069  *
4070  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4071  *               BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Not enabled \n
4072  *               BLUETOOTH_ERROR_INTERNAL \n
4073  *
4074  * @exception   None
4075  * @param[out] is_sending The sending status: (@c TRUE = in sending , @c  false = not in sending)
4076  *
4077  * @remark       None
4078  * @see            None
4079  */
4080 int bluetooth_opc_is_sending(gboolean *is_sending);
4081
4082 /**
4083  * @fn int bluetooth_obex_server_init(const char *dst_path)
4084  * @brief Initialize OPP and FTP server.
4085  *
4086  * This function is a synchronous call.
4087  * No event corresponding to this api
4088  *
4089  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4090  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
4091  *              BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
4092  *              BLUETOOTH_ERROR_AGENT_ALREADY_EXIST - Obex agent already registered \n
4093  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
4094  *
4095  * @exception   None
4096  * @param[in]  dst_path   OPS destination file path.
4097  * @remark       None
4098  * @see           bluetooth_obex_server_deinit
4099  */
4100 int bluetooth_obex_server_init(const char *dst_path);
4101
4102
4103 /**
4104  * @fn int bluetooth_obex_server_deinit(void)
4105  * @brief Deinitialize OPP and FTP server.
4106  *
4107  * This function is a synchronous call.
4108  * No event corresponding to this api
4109  *
4110  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4111  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
4112  *              BLUETOOTH_ERROR_AGENT_DOES_NOT_EXIST -Obex agent not registered \n
4113  *
4114  * @exception   None
4115  *
4116  * @remark       None
4117  * @see           bluetooth_obex_server_init
4118  */
4119 int bluetooth_obex_server_deinit(void);
4120
4121
4122 /**
4123  * @fn gboolean bluetooth_obex_server_is_activated(void)
4124  * @brief Informs whether obex server is activated or not.
4125  *
4126  * This function is a synchronous call.
4127  *
4128  * @return   TRUE  - OBEX server is activated \n
4129  *              FALSE - OBEX server is not activated \n
4130  *
4131  * @exception   None
4132  *
4133  * @remark       None
4134  */
4135
4136 gboolean bluetooth_obex_server_is_activated(void);
4137
4138
4139 /**
4140  * @fn int bluetooth_obex_server_init_without_agent(const char *dst_path)
4141  * @brief Initialize OPP and FTP server without the conneciton authorization of the agent
4142  *
4143  * This function is a synchronous call.
4144  * No event corresponding to this api
4145  *
4146  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4147  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
4148  *              BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
4149  *              BLUETOOTH_ERROR_AGENT_ALREADY_EXIST - Obex agent already registered \n
4150  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
4151  *
4152  *
4153  * @exception   None
4154  * @param[in]  dst_path   OPS destination file path.
4155  * @remark       None
4156  * @see           bluetooth_obex_server_deinit_without_agent
4157  */
4158 int bluetooth_obex_server_init_without_agent(const char *dst_path);
4159
4160
4161 /**
4162  * @fn int bluetooth_obex_server_deinit_without_agent(void)
4163  * @brief Deinitialize OPP and FTP server without the conneciton authorization of the agent
4164  *
4165  * This function is a synchronous call.
4166  * No event corresponding to this api
4167  *
4168  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4169  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
4170  *              BLUETOOTH_ERROR_AGENT_DOES_NOT_EXIST -Obex agent not registered \n
4171  *
4172  * @exception   None
4173  *
4174  * @remark       None
4175  * @see           bluetooth_obex_server_init_without_agent
4176  */
4177 int bluetooth_obex_server_deinit_without_agent(void);
4178
4179
4180 /**
4181  * @fn int bluetooth_obex_server_accept_connection(void)
4182  * @brief Accepts the authorization request indicated by the event
4183   * BLUETOOTH_EVENT_OBEX_SERVER_CONNECTION_AUTHORIZE.
4184  *
4185  * This function is a synchronous call.
4186  *
4187  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4188  *              BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
4189  *              BLUETOOTH_ERROR_INTERNAL - Internal error \n
4190  *
4191  * @exception   None
4192  * @remark       None
4193  * @see           bluetooth_obex_server_reject_authorize
4194  */
4195 int bluetooth_obex_server_accept_connection(void);
4196
4197
4198 /**
4199  * @fn int bluetooth_obex_server_reject_connection(void)
4200  * @brief Rejects the authorization request indicated by the event
4201   * BLUETOOTH_EVENT_OBEX_SERVER_CONNECTION_AUTHORIZE.
4202  *
4203  * This function is a synchronous call.
4204  *
4205  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4206  *              BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
4207  *              BLUETOOTH_ERROR_INTERNAL - Internal error \n
4208  *
4209  * @exception   None
4210  * @remark       None
4211  * @see           bluetooth_obex_server_reject_authorize
4212  */
4213 int bluetooth_obex_server_reject_connection(void);
4214
4215
4216 /**
4217  * @fn int bluetooth_obex_server_accept_authorize(const char *filename)
4218  * @brief Accepts the authorization request indicated by the event
4219   * BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_AUTHORIZE.
4220  *
4221  * This function is a asynchronous call.
4222  * This api will be responded with the event BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_STARTED.
4223  *
4224  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4225  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
4226  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
4227  *              BLUETOOTH_ERROR_AGENT_DOES_NOT_EXIST -Obex agent not registered \n
4228  *
4229  * @exception   None
4230  * @param[in]  filename   Authorized filename.
4231
4232  * @remark       None
4233  * @see           bluetooth_obex_server_reject_authorize
4234  */
4235
4236 int bluetooth_obex_server_accept_authorize(const char *filename);
4237
4238 /**
4239  * @fn int bluetooth_obex_server_reject_authorize(void)
4240  * @brief Reject the authorization request indicated by the event
4241   * BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_AUTHORIZE.
4242  *
4243  * This function is a asynchronous call.
4244  * No event for this api..
4245  *
4246  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4247  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
4248  *              BLUETOOTH_ERROR_AGENT_DOES_NOT_EXIST -Obex agent not registered \n
4249  *
4250  * @exception   None
4251
4252  * @remark       None
4253  * @see           bluetooth_obex_server_accept_authorize
4254  */
4255
4256 int bluetooth_obex_server_reject_authorize(void);
4257
4258 /**
4259  * @fn int bluetooth_obex_server_set_destination_path(const char *dst_path)
4260  * @brief Set the OPS destination file path..
4261  *
4262  * This function is a asynchronous call.
4263  * No event for this api..
4264  *
4265  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4266  *              BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
4267  *              BLUETOOTH_ERROR_AGENT_DOES_NOT_EXIST -Obex agent not registered \n
4268  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid Param \n
4269  *
4270  * @exception   None
4271  * @param[in]  dst_path   OPS destination file path.
4272
4273  * @remark       None
4274  * @see          None
4275  */
4276
4277 int bluetooth_obex_server_set_destination_path(const char *dst_path);
4278
4279 /**
4280  * @fn int bluetooth_obex_server_set_root(const char *root)
4281  * @brief Set the FTS root folder..
4282  *
4283  * This function is a asynchronous call.
4284  * No event for this api..
4285  *
4286  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4287  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
4288  *              BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
4289  *              BLUETOOTH_ERROR_ACCESS_DENIED - Operation not allowed \n
4290  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
4291  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4292  *
4293  * @exception  None
4294  * @param[in]   root   FTS root folder.
4295
4296  * @remark       None
4297  * @see          None
4298  */
4299
4300 int bluetooth_obex_server_set_root(const char *root);
4301
4302 /**
4303  * @fn int bluetooth_obex_server_cancel_transfer(int transfer_id)
4304  * @brief Cancel the transfer on server
4305  *
4306  * This function is an asynchronous call.
4307  * If the function call that cancels transfer is successful, the application would receive
4308  * BLUETOOTH_EVENT_TRANSFER_COMPLETED event through registered callback
4309  * function with an error code BLUETOOTH_ERROR_CANCEL. In the case of failure
4310  * the error code will be BLUETOOTH_ERROR_NONE
4311  *
4312  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4313  *               BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Not enabled \n
4314  *               BLUETOOTH_ERROR_AGENT_DOES_NOT_EXIST -Obex agent not registered \n
4315  *               BLUETOOTH_ERROR_INTERNAL - internal error (proxy does not exist) \n
4316  *               BLUETOOTH_ERROR_NOT_FOUND - The transfer is not found \n
4317  *
4318  * @exception None
4319  * @param[in] transfer_id transfer ID
4320
4321  * @remark       None
4322  * @see          None
4323  */
4324 int bluetooth_obex_server_cancel_transfer(int transfer_id);
4325
4326
4327 /**
4328  * @fn int bluetooth_obex_server_cancel_all_transfers(void)
4329  * @brief Cancel the transfer on server
4330  *
4331  * This function is an asynchronous call.
4332  * If the function call that cancels transfer is successful, the application would receive
4333  * BLUETOOTH_EVENT_TRANSFER_COMPLETED event through registered callback
4334  * function with an error code BLUETOOTH_ERROR_CANCEL. In the case of failure
4335  * the error code will be BLUETOOTH_ERROR_NONE
4336  *
4337  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4338  *               BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Not enabled \n
4339  *               BLUETOOTH_ERROR_AGENT_DOES_NOT_EXIST -Obex agent not registered \n
4340  *               BLUETOOTH_ERROR_INTERNAL - internal error (proxy does not exist) \n
4341  *               BLUETOOTH_ERROR_NOT_FOUND - The transfer is not found \n
4342  *
4343  * @exception None
4344  *
4345  * @remark       None
4346  * @see          None
4347  */
4348 int bluetooth_obex_server_cancel_all_transfers(void);
4349
4350
4351 /**
4352  * @fn int bluetooth_obex_server_is_receiving(gboolean *is_receiving)
4353  * @brief Informs whether obex server is receiving or not.
4354  *
4355  * This function is a synchronous call.
4356  *
4357  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4358  *               BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Not enabled \n
4359  *               BLUETOOTH_ERROR_INTERNAL \n
4360  *
4361  * @exception   None
4362  * @param[out] is_receiving The receiving status: (@c TRUE = in receiving , @c  false = not in receiving)
4363  *
4364  * @remark       None
4365  * @see            None
4366  */
4367 int bluetooth_obex_server_is_receiving(gboolean *is_receiving);
4368
4369
4370 /**
4371  * @fn int bluetooth_oob_read_local_data(bt_oob_data_t *local_oob_data)
4372  * @brief Read the local Hash and Randmizer.
4373  *
4374  * This function is a synchronous call.
4375  *
4376  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4377  *           BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4378  *
4379  * @exception  None
4380  * @param[in]  None.
4381  * @param[out] local_oob_data - Pointer to the local OOB data
4382  *
4383  * @remark       None
4384  * @see          None
4385  */
4386
4387 int bluetooth_oob_read_local_data(bt_oob_data_t *local_oob_data);
4388
4389
4390 /**
4391  * @fn int bluetooth_oob_add_remote_data(
4392  *                      const bluetooth_device_address_t *remote_device_address,
4393  *                      bt_oob_data_t *oob_data)
4394  * @brief Add/updated the remote device  Hash and Randmizer.
4395  *
4396  * This function is a synchronous call.
4397  * No event for this api..
4398  *
4399  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4400  *           BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4401  *
4402  * @exception   None
4403  * @param[in] remote_device_address - Remote device address
4404  *            remote_oob_data - Ponter to Hash and Randomizer oob data structure
4405  *
4406  * @remark      None
4407  * @see         None
4408  */
4409
4410 int bluetooth_oob_add_remote_data(
4411                    const bluetooth_device_address_t *remote_device_address,
4412                    bt_oob_data_t *remote_oob_data);
4413
4414
4415 /**
4416  * @fn int bluetooth_oob_remove_remote_data(
4417  *                      const bluetooth_device_address_t *remote_device_address)
4418  * @brief Delete the Hash and Randomizer w.r.t the remote device address.
4419  *
4420  * This function is a synchronous call.
4421  * No event for this api..
4422  *
4423  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4424  *           BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4425  *
4426  * @exception  None
4427  * @param[in] remote_device_address - Remote device address
4428  *
4429  * @remark       None
4430  * @see          None
4431  */
4432
4433 int bluetooth_oob_remove_remote_data(
4434                         const bluetooth_device_address_t *remote_device_address);
4435
4436 /**
4437  * @fn int bluetooth_gatt_get_primary_services(const bluetooth_device_address_t *address,
4438  *                                              bt_gatt_handle_info_t *prim_svc);
4439  *
4440  * @brief Gets the GATT based primary services handle supported by remote device
4441  *
4442  * This function is a synchronous call.
4443  * The output parameter needs to be freed by calling bluetooth_gatt_free_primary_services()
4444  *
4445  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4446  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4447  *              BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4448  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4449  *
4450  * @exception    None
4451  * @param[in]    address - Remote device address
4452  * @param[out] prim_svc - Structure containing remote service count and handle list.
4453  *
4454  * @remark      None
4455  * @see         bluetooth_gatt_free_primary_services()
4456  */
4457 int bluetooth_gatt_get_primary_services(const bluetooth_device_address_t *address,
4458                                                 bt_gatt_handle_info_t *prim_svc);
4459
4460 /**
4461  * @fn int bluetooth_gatt_discover_service_characteristics(const char *service_handle)
4462  *
4463  * @brief Discovers the characteristics of GATT based service of remote device
4464  *
4465  * This function is an asynchronous call.
4466  * This API is responded with BLUETOOTH_EVENT_GATT_SVC_CHAR_DISCOVERED
4467  *
4468  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4469  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4470  *              BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4471  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4472  *
4473  * @exception   None
4474  * @param[in]   service_handle - Handle for remote service.
4475  *
4476  * @remark      None
4477  * @see         None
4478  */
4479 int bluetooth_gatt_discover_service_characteristics(const char *service_handle);
4480
4481 /**
4482  * @fn int bluetooth_gatt_get_service_property(const char *service_handle,
4483  *                                              bt_gatt_service_property_t *service);
4484  *
4485  * @brief Gets the properties of GATT based service of remote device
4486  *
4487  * This function is a synchronous call.
4488  * The output parameter needs to be freed by calling bluetooth_gatt_free_primary_services()
4489  *
4490  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4491  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4492  *              BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4493  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4494  *
4495  * @exception   None
4496  * @param[in]   service_handle - Handle for remote service.
4497  * @param[out]  service - Structure containing remote service property.
4498  *
4499  * @remark      None
4500  * @see         bluetooth_gatt_free_service_property()
4501  */
4502 int bluetooth_gatt_get_service_property(const char *service_handle,
4503                                                 bt_gatt_service_property_t *service);
4504
4505 /**
4506  * @fn int bluetooth_gatt_watch_characteristics(const char *service_handle)
4507  *
4508  * @brief Register to GATT based service to receive value change notification/indication.
4509  *
4510  * This function is a synchronous call.
4511  * No event for this api.
4512  *
4513  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4514  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4515  *              BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4516  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4517  *
4518  * @exception   None
4519  * @param[in]   service_handle - Handle for remote service.
4520  *
4521  * @remark      None
4522  * @see         None
4523  */
4524 int bluetooth_gatt_watch_characteristics(const char *service_handle);
4525
4526 /**
4527  * @fn int bluetooth_gatt_unwatch_characteristics(const char *service_handle)
4528  *
4529  * @brief Unregister GATT based service to receive value change notification/indication.
4530  *
4531  * This function is a synchronous call.
4532  * No event for this api.
4533  *
4534  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4535  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4536  *              BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4537  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4538  *
4539  * @exception   None
4540  * @param[in]   service_handle - Handle for remote service.
4541  *
4542  * @remark      None
4543  * @see         None
4544  */
4545 int bluetooth_gatt_unwatch_characteristics(const char *service_handle);
4546
4547 /**
4548  * @fn int bluetooth_gatt_get_characteristics_property(const char *char_handle,
4549  *                                              bt_gatt_char_property_t *characteristic);
4550  *
4551  * @brief Provides characteristic value along with properties.
4552  *
4553  * This function is a synchronous call.
4554  * The output parameter needs to be freed by calling bluetooth_gatt_free_char_property()
4555  *
4556  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4557  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4558  *              BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4559  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4560  *
4561  * @exception   None
4562  * @param[in]   char_handle - Handle for Characteristic property.
4563  * @param[out] characteristic - Structure containing remote characteristic property.
4564  *
4565  * @remark      None
4566  * @see         bluetooth_gatt_free_char_property()
4567  */
4568 int bluetooth_gatt_get_characteristics_property(const char *char_handle,
4569                                                 bt_gatt_char_property_t *characteristic);
4570
4571 /**
4572  * @fn int bluetooth_gatt_get_char_descriptor_property(const char *char_handle,
4573  *                                              bt_gatt_char_property_t *characteristic);
4574  *
4575  * @brief Provides characteristic descriptor value along with its UUID.
4576  *
4577  * This function is a synchronous call.
4578  * The output parameter needs to be freed by calling bluetooth_gatt_free_desc_property()
4579  *
4580  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4581  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4582  *              BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4583  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4584  *
4585  * @exception   None
4586  * @param[in]   desc_handle - Handle for Characteristic descriptor.
4587  * @param[out] descriptor - Structure containing remote characteristic descriptor property.
4588  *
4589  * @remark      None
4590  * @see         bluetooth_gatt_free_desc_property()
4591  */
4592 int bluetooth_gatt_get_char_descriptor_property(const char *desc_handle,
4593                                                 bt_gatt_char_descriptor_property_t *descriptor);
4594
4595
4596 /**
4597  * @fn int bluetooth_gatt_set_characteristics_value(const char *char_handle,
4598  *                                              const guint8 *value, int length)
4599  *
4600  * @brief Set characteristic value.
4601  *
4602  * This function is a synchronous call.
4603  *
4604  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4605  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4606  *              BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4607  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4608  *
4609  * @exception   None
4610  * @param[in]   char_handle - Handle for Characteristic property.
4611  * @param[in]   value - New value to set for characteristic property.
4612  * @param[in]   length - Length of the value to be set.
4613  *
4614  * @remark      None
4615  * @see         None
4616  */
4617 int bluetooth_gatt_set_characteristics_value(const char *char_handle,
4618                                                 const guint8 *value, int length);
4619
4620 /**
4621  * @fn int bluetooth_gatt_set_characteristics_value_by_type(const char *char_handle,
4622  *                              const guint8 *value, int length, guint8 write_type)
4623  *
4624  * @brief Set characteristic value by write type.
4625  *
4626  * This function is a synchronous call if write type is "write without resonse"
4627  * and it is an asynchronous call if write type is "write with response"
4628  *
4629  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4630  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4631  *              BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4632  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4633  *
4634  * @exception   None
4635  * @param[in]   char_handle - Handle for Characteristic property.
4636  * @param[in]   value - New value to set for characteristic property.
4637  * @param[in]   length - Length of the value to be set.
4638  * @param[in]   write_type - Type of write.
4639  *
4640  * @remark      None
4641  * @see         None
4642  */
4643 int bluetooth_gatt_set_characteristics_value_by_type(const char *char_handle,
4644                                 const guint8 *value, int length, guint8 write_type);
4645
4646
4647 /**
4648  * @fn int bluetooth_gatt_set_characteristics_value_request(const char *char_handle,
4649  *                                              const guint8 *value, int length)
4650  *
4651  * @brief Set characteristic value request.
4652  *
4653  * This function is an asynchronous call.
4654  *
4655  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4656  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4657  *              BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4658  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4659  *
4660  * @exception   None
4661  * @param[in]   char_handle - Handle for Characteristic property.
4662  * @param[in]   value - New value to set for characteristic property.
4663  * @param[in]   length - Length of the value to be set.
4664   *
4665  * @remark      None
4666  * @see         None
4667  */
4668 int bluetooth_gatt_set_characteristics_value_request(const char *char_handle,
4669                                                 const guint8 *value, int length);
4670
4671 /**
4672  * @fn int bluetooth_gatt_read_characteristic_value(const char *char_handle)
4673  *
4674  * @brief Read characteristic value.
4675  *
4676  * This function is a asynchronous call.
4677  *
4678  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4679  *             BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4680  *             BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4681  *             BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4682  *
4683  * @exception  None
4684  * @param[in]  char_handle - Handle for Characteristic property.
4685  *
4686  * @remark     None
4687  * @see        None
4688  */
4689 int bluetooth_gatt_read_characteristic_value(const char *char_handle);
4690
4691 /**
4692  * @fn int bluetooth_gatt_get_service_from_uuid(bluetooth_device_address_t *address,
4693  *                                      const char *service_uuid,
4694  *                                      bt_gatt_service_property_t *service)
4695  *
4696  * @brief Gets the service property from a device based on a particular uuid
4697  *
4698  * This function is a synchronous call.
4699  *
4700  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4701  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4702  *              BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4703  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4704  *
4705  * @exception   None
4706  * @param[in]   address - BD address of the remote device
4707  * @param[in]   service_uuid - uuid of the service.
4708  * @param[out] service - Structure containing the service property.
4709  *
4710  * @remark      None
4711  * @see         None
4712  */
4713  int bluetooth_gatt_get_service_from_uuid(bluetooth_device_address_t *address,
4714                                         const char *service_uuid,
4715                                         bt_gatt_service_property_t *service);
4716
4717 /**
4718  * @fn int bluetooth_gatt_get_char_from_uuid(const char *service_handle,
4719  *                                                      const char *char_uuid)
4720  *
4721  * @brief Gets the characteristic property from a service based on a particular char uuid
4722  *
4723  * This function is an asynchronous call.
4724  * This API is responded with BLUETOOTH_EVENT_GATT_GET_CHAR_FROM_UUID
4725  *
4726  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4727  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4728  *              BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4729  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4730  *
4731  * @exception   None
4732  * @param[in]   service_handle - Service handle.
4733  * @param[in]   uuid - Characteristic uuid.
4734  *
4735  * @remark      None
4736  * @see         None
4737  */
4738 int bluetooth_gatt_get_char_from_uuid(const char *service_handle,
4739                                                 const char *char_uuid);
4740
4741 /**
4742  * @fn int bluetooth_gatt_free_primary_services(bt_gatt_handle_info_t *prim_svc);
4743  *
4744  * @brief Releases the memory allocated by bluetooth_gatt_get_primary_services()
4745  *
4746  * This function is a synchronous call.
4747  * The input parameter is obtained by calling bluetooth_gatt_get_primary_services()
4748  *
4749  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4750  *              BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4751  *
4752  * @exception   None
4753  * @param[in]   prim_svc - GATT handle info structure
4754  *
4755  * @remark      None
4756  * @see         bluetooth_gatt_get_primary_services()
4757  */
4758 int bluetooth_gatt_free_primary_services(bt_gatt_handle_info_t *prim_svc);
4759
4760 /**
4761  * @fn int bluetooth_gatt_free_service_property(bt_gatt_service_property_t *svc_pty);
4762  *
4763  * @brief  Releases the memory allocated by bluetooth_gatt_get_service_property()
4764  *
4765  * This function is a synchronous call.
4766  * The input parameter is obtained by calling bluetooth_gatt_get_service_property()
4767  *
4768  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4769  *              BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4770  *
4771  * @exception   None
4772  * @param[in]   svc_pty - GATT service property structure.
4773  *
4774  * @remark      None
4775  * @see         bluetooth_gatt_get_service_property()
4776  */
4777 int bluetooth_gatt_free_service_property(bt_gatt_service_property_t *svc_pty);
4778
4779 /**
4780  * @fn int bluetooth_gatt_free_char_property(bt_gatt_char_property_t *char_pty);
4781  *
4782  * @brief Provides characteristic value along with properties.
4783  *
4784  * This function is a synchronous call.
4785  * The input parameter is obtained by calling bluetooth_gatt_get_characteristics_property()
4786  *
4787  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4788  *              BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4789  *
4790  * @exception   None
4791  * @param[in]   char_pty - GATT characteristics property structure.
4792  *
4793  * @remark      None
4794  * @see         bluetooth_gatt_get_characteristics_property()
4795  */
4796  int bluetooth_gatt_free_char_property(bt_gatt_char_property_t *char_pty);
4797
4798 /**
4799  * @fn int bluetooth_gatt_free_desc_property(bt_gatt_char_descriptor_property_t *desc_pty);
4800  *
4801  * @brief Releases the memory allocated by bluetooth_gatt_get_char_descriptor_property()
4802  *
4803  * This function is a synchronous call.
4804  * The input parameter is obtained by calling bluetooth_gatt_get_char_descriptor_property()
4805  *
4806  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4807  *              BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4808  *
4809  * @exception   None
4810  * @param[in]   desc_pty - GATT characteristics descriptor property structure.
4811  *
4812  * @remark      None
4813  * @see         bluetooth_gatt_get_char_descriptor_property()
4814  */
4815  int bluetooth_gatt_free_desc_property(bt_gatt_char_descriptor_property_t *desc_pty);
4816
4817
4818  int bluetooth_connect_le(const bluetooth_device_address_t *device_address, gboolean auto_connect);
4819
4820  int bluetooth_disconnect_le(const bluetooth_device_address_t *device_address);
4821
4822  /**
4823  * @fn int bluetooth_gatt_discover_characteristic_descriptor(const char *characteristic_handle);
4824  *
4825  * @brief Discovers the characteristic descriptor value of a characteristic within its definition, asynchronously
4826  *
4827  * The input parameter is obtained by calling bluetooth_gatt_get_characteristics_property()
4828  *
4829  * @return  BLUETOOTH_ERROR_NONE  - Success \n
4830  *                      BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4831  *
4832  * @exception   None
4833  * @param[in]   characteristic_handle - The characteristic handle for which characteristic descriptor has to be discovered.
4834  *
4835  * @remark      None
4836  */
4837 int bluetooth_gatt_discover_characteristic_descriptor(const char *characteristic_handle);
4838
4839 /**
4840  * @fn int bluetooth_gatt_read_descriptor_value(const char *desc_handle)
4841  *
4842  * @brief Read characteristic descriptor value.
4843  *
4844  * This function is a asynchronous call.
4845  *
4846  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4847  *             BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4848  *             BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4849  *             BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4850  *
4851  * @exception  None
4852  * @param[in]  desc_handle - Handle for Characteristic descriptor
4853  *
4854  * @remark     None
4855  * @see        None
4856  */
4857  int bluetooth_gatt_read_descriptor_value(const char *desc_handle);
4858
4859 /**
4860  * @fn int bluetooth_gatt_write_descriptor_value(const char *desc_handle,
4861  *                      const guint8 *value, int length);
4862  *
4863  * @brief Set characteristic descriptor value.
4864  *
4865  * This function is a asynchronous call.
4866  *
4867  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4868  *             BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4869  *             BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4870  *             BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4871  *
4872  * @exception  None
4873  * @param[in]  desc_handle - Handle for Characteristic descriptor
4874  * @param[in]  value - New value to set for characteristic descriptor
4875  * @param[in]  length - Length of the value to be set.
4876  *
4877  * @remark     None
4878  * @see        None
4879  */
4880  int bluetooth_gatt_write_descriptor_value(const char *desc_handle,
4881                         const guint8 *value, int length);
4882
4883 /* @fn int bluetooth_gatt_init(void)
4884 *
4885 * @brief Initializes the gatt service.
4886 *
4887 * This function is a synchronous call.
4888 * @return   BLUETOOTH_ERROR_NONE        - Success \n
4889 *        BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4890 *        BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4891 *        BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4892 *
4893 * @exception     None
4894 * @remark  Adapter should be enabled
4895 * @see  bluetooth_gatt_deinit()
4896 */
4897 int bluetooth_gatt_init(void);
4898
4899 /* @fn int bluetooth_gatt_init(void)
4900 *
4901 * @brief DeInitializes the gatt service.
4902 *
4903 * This function is a synchronous call.
4904 * @return   BLUETOOTH_ERROR_NONE        - Success \n
4905 *        BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4906 *        BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4907 *        BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4908 *
4909 * @exception     None
4910 * @remark  Adapter should be enabled
4911 * @see  bluetooth_gatt_init()
4912 */
4913 int bluetooth_gatt_deinit(void);
4914
4915 /* @fn int bluetooth_gatt_add_service(const char *svc_uuid,
4916                         unsigned char **svc_path)
4917 *
4918 * @brief Exports a new gatt service to the service interface.
4919 *
4920 * This function is a synchronous call.
4921 *
4922 * @return       BLUETOOTH_ERROR_NONE    - Success \n
4923 *        BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4924 *        BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4925 *        BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4926 *
4927 * @exception     None
4928 * @param[in]   svc_uuid  Gatt service uuid.
4929 * @param[out] svc_path  service object path of the exported service.
4930 * @remark  Adapter should be enabled
4931 * @see  bluetooth_gatt_init()
4932 */
4933 int bluetooth_gatt_add_service(const char *svc_uuid,
4934                         char **svc_path);
4935
4936 /* @fn int bluetooth_gatt_add_new_characteristic(
4937                         const char *svc_path, const char *char_uuid,
4938                         bt_gatt_characteristic_property_t *properties,
4939                         int flags_length, char **char_path);;
4940 *
4941 * @brief Exports a new gatt characteristic to the characteristic interface.
4942 *
4943 * This function is a synchronous call.
4944 * @return       BLUETOOTH_ERROR_NONE    - Success \n
4945 *        BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4946 *        BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4947 *        BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4948 * @exception     None
4949 * @param[in]   svc_path service object path of the exported service.
4950 * @param[in]   char_uuid  Gatt service uuid.
4951 * @param[in]   properties       GATT characteristic properties.
4952 * @param[out] char_path characteristic object path of the exported characteristic.
4953 *
4954 * @remark  Adapter should be enabled
4955 * @see  bluetooth_gatt_add_service()
4956 */
4957 int bluetooth_gatt_add_new_characteristic(
4958                         const char *svc_path, const char *char_uuid,
4959                         bt_gatt_characteristic_property_t properties,
4960                         char **char_path);
4961
4962 /* @fn bluetooth_gatt_set_characteristic_value(
4963                         const char *characteristic, const char *char_value,
4964                         int value_length);
4965 *
4966 * @brief adds gatt charactertisic value to the given charactertistic path.
4967 *
4968 * This function is a synchronous call.
4969 * @return       BLUETOOTH_ERROR_NONE    - Success \n
4970 *        BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4971 *        BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4972 *        BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4973 * @exception     None
4974 * @param[in]   char_value Value of the GATT characteristic to be added.
4975 * @param[in]   value_length length of the chantacteristic value..
4976 * @param[out] characteristic characteristic object path..
4977 *
4978 * @remark  Adapter should be enabled
4979 * @see  bluetooth_gatt_add_service()
4980 */
4981 int bluetooth_gatt_set_characteristic_value(
4982                         const char *characteristic, const char *char_value,
4983                         int value_length);
4984
4985 /* @fn int bluetooth_gatt_add_descriptor(const char *desc_uuid,
4986                         const char *desc_value, int value_length,
4987                         const char *permissions, const char *char_path,
4988                         char **desc_path);
4989 *
4990 * @brief Exports a new gatt descriptor to the descriptor interface.
4991 *
4992 * This function is a synchronous call.
4993 *
4994 * @return       BLUETOOTH_ERROR_NONE    - Success \n
4995 *        BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4996 *        BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4997 *        BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4998 *
4999 * @exception     None
5000 * @param[in]   desc_uuid  Gatt descriptor uuid.
5001 * @param[in]   desc_value       GATT descriptor value.
5002 * @param[in]   value_length     Length of GATT descriptor value.
5003 * @param[in]   permissions      descriptor permissions.
5004 * @param[in]  char_path characteristics object path of the exported character.
5005 *
5006 * @remark  Adapter should be enabled
5007 * @see  bluetooth_gatt_add_service()
5008 * @see  bluetooth_gatt_add_characteristics()
5009 */
5010 int bluetooth_gatt_add_descriptor(const char *char_path,
5011                         const char *desc_uuid,
5012                         char **desc_path);
5013
5014 /* @fn int bluetooth_gatt_set_descriptor_value(
5015                    const char *desc_path, const char *desc_value,
5016                    int value_length);
5017 *
5018 * @brief Adds value to the given descriptor handle.
5019 *
5020 * This function is a synchronous call.
5021 *
5022 * @return       BLUETOOTH_ERROR_NONE    - Success \n
5023 *        BLUETOOTH_ERROR_INTERNAL - Internal Error \n
5024 *        BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
5025 *        BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
5026 *
5027 * @exception     None
5028 * @param[in]   desc_value       GATT descriptor value.
5029 * @param[in]   value_length     Length of GATT descriptor value.
5030 * @param[in]  desc_path descriptor path to which the value needs to be added.
5031 *
5032 * @remark  Adapter should be enabled
5033 * @see  bluetooth_gatt_add_service()
5034 * @see  bluetooth_gatt_add_characteristics()
5035 */
5036 int bluetooth_gatt_set_descriptor_value(
5037                    const char *desc_path, const char *desc_value,
5038                    int value_length);
5039
5040 /* @fn int bluetooth_gatt_get_service(const char *svc_uuid);
5041 *
5042 * @brief Reads the Service registered on manager interface.
5043 *
5044 * This function is a synchronous call.
5045 *
5046 * @return       BLUETOOTH_ERROR_NONE    - Success \n
5047 *        BLUETOOTH_ERROR_INTERNAL - Internal Error \n
5048 *        BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
5049 *        BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
5050 *
5051 * @exception     None
5052 * @param[in]   svc_uuid  Gatt Service uuid.
5053 *
5054 * @remark  Adapter should be enabled and service should be registered.
5055 * @see  bluetooth_gatt_register_service()
5056 */
5057 int bluetooth_gatt_get_service(const char *svc_uuid);
5058
5059 /* @fn int bluetooth_gatt_register_service(const  char *svc_path)
5060 *
5061 * @brief Registers the given service path with the bluez gatt server.
5062 *
5063 * This function is a synchronous call.
5064 *
5065 * @return       BLUETOOTH_ERROR_NONE    - Success \n
5066 *        BLUETOOTH_ERROR_INTERNAL - Internal Error \n
5067 *        BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
5068 *        BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
5069 *
5070 * @exception     None
5071 * @param[in] svc_path   service object path of the exported service.
5072 *
5073 * @remark  Adapter should be enabled
5074 * @see  bluetooth_gatt_add_service()
5075 * @see  bluetooth_gatt_add_characteristics()
5076 * @see  bluetooth_gatt_add_descriptor()
5077 */
5078 int bluetooth_gatt_register_service(const char *svc_path);
5079
5080 /* @fn int bluetooth_gatt_unregister_service(const  char *svc_path)
5081 *
5082 * @brief Removes(unregister) service from the bluez gatt server db.
5083 *
5084 * This function is a synchronous call.
5085 *
5086 * @return       BLUETOOTH_ERROR_NONE    - Success \n
5087 *        BLUETOOTH_ERROR_INTERNAL - Internal Error \n
5088 *        BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
5089 *        BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
5090 *
5091 * @exception     None
5092 * @param[in] svc_path   service object path of the exported service.
5093 *
5094 * @remark  Adapter should be enabled
5095 * @see  bluetooth_gatt_add_service()
5096 * @see  bluetooth_gatt_add_characteristics()
5097 * @see  bluetooth_gatt_add_descriptor()
5098 * @see bluetooth_gatt_register_service()
5099 */
5100 int bluetooth_gatt_unregister_service(const char *svc_path);
5101
5102 /* @fn int bluetooth_gatt_send_response(int request_id,
5103 *                               int offset, char *value, int value_length)
5104 *
5105 * @brief Updates the attribute value in local attribute list.
5106 *
5107 * This function is a synchronous call.
5108 *
5109 * @return       BLUETOOTH_ERROR_NONE    - Success \n
5110 *        BLUETOOTH_ERROR_INTERNAL - Internal Error \n
5111 *        BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
5112 *        BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
5113 *
5114 * @exception     None
5115 * @param[in] request_id The identification of a read request
5116 * @param[in] req_type The identification of  request type (TRUE for Read request and FALSE for write request)
5117 * @param[in] resp_state The identification of response state
5118 * @param[in] offset The offset from where a value is read
5119 * @param[in] value The value to be sent. It will be sent from @a offset.
5120 *               If it is NULL, a requested GATT handle's value will be sent from @a offset.
5121 * @param[in] value_length Value Length.
5122 *
5123 * @remark  Adapter should be enabled
5124 * @see  bluetooth_gatt_add_service()
5125 * @see  bluetooth_gatt_add_characteristics()
5126 * @see  bluetooth_gatt_add_descriptor()
5127 * @see bluetooth_gatt_register_service()
5128 */
5129 int bluetooth_gatt_send_response(int request_id, guint req_type,
5130                                 int resp_state, int offset, char *value, int value_length);
5131
5132 /* @fn bluetooth_gatt_server_set_notification(const char *char_path)
5133 *
5134 * @brief Sets the notification property for a characteristic.
5135 *
5136 * This function is a synchronous call.
5137 *
5138 * @return       BLUETOOTH_ERROR_NONE    - Success \n
5139 *        BLUETOOTH_ERROR_INTERNAL - Internal Error \n
5140 *        BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
5141 *        BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
5142 *
5143 * @exception     None
5144 * @param[in] char_path characteristic object path.
5145 * @param[in]   unicast_address remote device address. if set notification is sent to only one device.
5146 *
5147 * @remark  Adapter should be enabled
5148 * @see  bluetooth_gatt_update_characteristic()
5149 */
5150 int bluetooth_gatt_server_set_notification(const char *char_path,
5151                                 bluetooth_device_address_t *unicast_address);
5152
5153 /* @fn int bluetooth_gatt_delete_services(void)
5154 *
5155 * @brief deletes (unregisters) all services from the gatt server database..
5156 *
5157 * This function is a synchronous call.
5158 *
5159 * @return       BLUETOOTH_ERROR_NONE    - Success \n
5160 *        BLUETOOTH_ERROR_INTERNAL - Internal Error \n
5161 *        BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
5162 *        BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
5163 *
5164 * @exception     None
5165 *
5166 * @remark  Adapter should be enabled
5167 * @see  bluetooth_gatt_add_service()
5168 * @see  bluetooth_gatt_add_characteristics()
5169 * @see  bluetooth_gatt_add_descriptor()
5170 * @see bluetooth_gatt_register_service()
5171 * @see bluetooth_gatt_unregister_service()
5172 */
5173 int bluetooth_gatt_delete_services(void);
5174
5175 /* @fn int bluetooth_gatt_update_characteristic(void)
5176 *
5177 * @brief updates the given characteristic with a new value
5178 *
5179 * This function is a synchronous call.
5180 *
5181 * @return       BLUETOOTH_ERROR_NONE    - Success \n
5182 *        BLUETOOTH_ERROR_INTERNAL - Internal Error \n
5183 *        BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
5184 *        BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
5185 *
5186 * @exception     None
5187 *
5188 * @remark  Adapter should be enabled
5189 * @see  bluetooth_gatt_add_service()
5190 * @see  bluetooth_gatt_add_characteristics()
5191 * @see  bluetooth_gatt_add_descriptor()
5192 * @see bluetooth_gatt_register_service()
5193 * @see bluetooth_gatt_unregister_service()
5194 */
5195 int bluetooth_gatt_update_characteristic(const char *char_path,
5196                 const char* char_value, int value_length);
5197
5198 /**
5199  * @fn int bluetooth_set_advertising(int handle, gboolean enable);
5200  *
5201  * @brief Set advertising status.
5202  *
5203  * This function is used to enable or disable LE advertising.
5204  * Once advertising is enabled, Advertising data is transmitted in the advertising packets
5205  *
5206  * This function is a synchronous call.
5207  *
5208  * @return      BLUETOOTH_ERROR_NONE - Success \n
5209  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
5210  *              BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
5211  *
5212  * @exception   None
5213  * @param[in]   enable - The status of advertising
5214  *
5215  * @remark      None
5216  * @see         bluetooth_set_advertising_data
5217  */
5218 int bluetooth_set_advertising(int handle, gboolean enable);
5219
5220 /**
5221  * @fn int bluetooth_set_custom_advertising(int handle, gboolean enable, bluetooth_advertising_params_t *params);
5222  *
5223  * @brief Set advertising status along with interval value.
5224  *
5225  * This function is used to enable or disable LE advertising.
5226  * Interval_min and Interval_max is used to set the best advertising interval.
5227  * Once advertising is enabled, Advertising data is transmitted in the advertising packets
5228  *
5229  * This function is a synchronous call.
5230  *
5231  * @return      BLUETOOTH_ERROR_NONE - Success \n
5232  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
5233  *              BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
5234  *
5235  * @exception   None
5236  * @param[in]   enable - The status of advertising
5237  * @param[in]   interval_min - Minimum interval of advertising (msec)
5238  * @param[in]   interval_max - Maximum interval of advertising (msec)
5239  * @param[in]   filter_policy - Advertising filter policy
5240  *
5241  * @remark      None
5242  * @see         bluetooth_set_advertising_data
5243  */
5244 int bluetooth_set_custom_advertising(int handle, gboolean enable,
5245                                         bluetooth_advertising_params_t *params);
5246
5247 /**
5248  * @fn int bluetooth_get_advertising_data(bluetooth_advertising_data_t *value, int *length);
5249  * @brief Get the advertising data
5250  *
5251  * This function is used to get advertising data.
5252  * Before calling this API, the adapter should be enabled.
5253  *
5254  * This function is a synchronous call.
5255  *
5256  * @return      BLUETOOTH_ERROR_NONE - Success \n
5257  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
5258  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter (NULL buffer)\n
5259  *              BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
5260  *
5261  * @param[out]  value - Advertising data structure.
5262  * @param[out]  length - The length of Advertising data.
5263  *
5264  * @remark      None
5265 @code
5266 bluetooth_advertising_data_t *value = { {0} };
5267 int length;
5268 int ret = 0;
5269 ret = bluetooth_get_advertising_data(&value, &length);
5270 @endcode
5271  */
5272 int bluetooth_get_advertising_data(bluetooth_advertising_data_t *value, int *length);
5273
5274 /**
5275  * @fn int bluetooth_set_advertising_data(int handle, const bluetooth_advertising_data_t *value, int length);
5276  *
5277  * @brief Set advertising data with value
5278  *
5279  * This function is used to set advertising data and Maximum size of advertising data
5280  *  is 28 byte (Except Flag)
5281  *
5282  * This function is a synchronous call.
5283  *
5284  * @return      BLUETOOTH_ERROR_NONE - Success \n
5285  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
5286  *              BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
5287  *
5288  * @exception   None
5289  * @param[in]   value - Advertising data structure.
5290  *
5291  * @remark      None
5292  */
5293 int bluetooth_set_advertising_data(int handle, const bluetooth_advertising_data_t *value, int length);
5294
5295 /**
5296  * @fn int bluetooth_check_privilege_advertising_parameter(void);
5297  *
5298  * @brief Check the privilege for advertising parameter setting
5299  *
5300  * This function is a synchronous call.
5301  *
5302  * @return      BLUETOOTH_ERROR_NONE - Success \n
5303  *              BLUETOOTH_ERROR_PERMISSION_DEINED - Permission deined \n
5304  *
5305  * @exception   None
5306  *
5307  * @remark      None
5308  */
5309 int bluetooth_check_privilege_advertising_parameter(void);
5310
5311 /**
5312  * @fn int bluetooth_get_scan_response_data(bluetooth_scan_resp_data_t *value, int *length);
5313  * @brief Get the LE scan response data
5314  *
5315  * This function is used to get scan response data.
5316  * Before calling this API, the adapter should be enabled.
5317  *
5318  * This function is a synchronous call.
5319  *
5320  * @return      BLUETOOTH_ERROR_NONE - Success \n
5321  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
5322  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter (NULL buffer)\n
5323  *              BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
5324  *
5325  * @param[out]  value - Scan response data structure.
5326  * @param[out]  length - The length of Scan response data.
5327  *
5328  * @remark      None
5329 @code
5330 bluetooth_scan_resp_data_t *value = { {0} };
5331 int length;
5332 int ret = 0;
5333 ret = bluetooth_get_scan_response_data(&value, &length);
5334 @endcode
5335  */
5336 int bluetooth_get_scan_response_data(bluetooth_scan_resp_data_t *value, int *length);
5337
5338 /**
5339  * @fn int bluetooth_set_scan_response_data(int handle, const bluetooth_scan_resp_data_t *value, int length);
5340  *
5341  * @brief Set scan response data with value
5342  *
5343  * This function is used to set scan response data and Maximum size of scan response data is 31 byte
5344  *
5345  * This function is a synchronous call.
5346  *
5347  * @return      BLUETOOTH_ERROR_NONE - Success \n
5348  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
5349  *              BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
5350  *
5351  * @exception   None
5352  * @param[in]   value - LE Scan response data structure.
5353  *
5354  * @remark      None
5355  */
5356 int bluetooth_set_scan_response_data(int handle, const bluetooth_scan_resp_data_t *value, int length);
5357
5358 /**
5359  * @fn int bluetooth_set_scan_parameters(bluetooth_le_scan_params_t *params);
5360  *
5361  * @brief Set scan interval and window
5362  *
5363  * This function is used to set LE scan interval and window size
5364  *
5365  * This function is a synchronous call.
5366  *
5367  * @return      BLUETOOTH_ERROR_NONE - Success \n
5368  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
5369  *              BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
5370  *
5371  * @exception   None
5372  * @param[in]   interval - Interval of LE scan (msec)
5373  * @param[in]   window - Window size of LE scan (msec)
5374  *
5375  * @remark      None
5376  */
5377 int bluetooth_set_scan_parameters(bluetooth_le_scan_params_t *params);
5378
5379 /**
5380  * @fn int bluetooth_is_advertising(void)
5381  * @brief Check for the advertising is in-progress or not.
5382  *
5383  * This API is used to check the current status of the advertising procedure.
5384  * Before calling this API, make sure that the adapter is enabled. There is no callback event for
5385  * this API.
5386  *
5387  * This function checks whether the advertising is started or not.
5388  *
5389  * This function is a synchronous call.
5390  *
5391  * @param[out] is_advertising The advertising status: (@c TRUE = in progress, @c  false = not in progress)
5392  *
5393  * @return      BLUETOOTH_ERROR_NONE - Success \n
5394  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
5395  *
5396  * @remark      None
5397  * @see         bluetooth_set_advertising, bluetooth_set_custom_advertising
5398
5399 @code
5400 int ret;
5401 gboolean is_advertising = 0;
5402
5403 ret = bluetooth_is_advertising(&is_advertising);
5404 @endcode
5405  */
5406 int bluetooth_is_advertising(gboolean *is_advertising);
5407
5408 /**
5409  * @fn int bluetooth_add_white_list(bluetooth_device_address_t *address, bluetooth_device_address_type_t address_type)
5410  * @brief Add LE device to white list
5411  *
5412  * This API is used to add LE device to white list
5413  * Before calling this API, make sure that the adapter is enabled. There is no callback event for
5414  * this API.
5415  *
5416  *
5417  * This function is a synchronous call.
5418  *
5419  * @param[in] address The address of remote device
5420  *
5421  * @return      BLUETOOTH_ERROR_NONE - Success \n
5422  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
5423  *
5424  * @remark      None
5425  * @see         bluetooth_set_custom_advertising
5426  */
5427 int bluetooth_add_white_list(bluetooth_device_address_t *address, bluetooth_device_address_type_t address_type);
5428
5429 /**
5430  * @fn int bluetooth_remove_white_list(bluetooth_device_address_t *address, bluetooth_device_address_type_t address_type)
5431  * @brief Remove LE device from white list
5432  *
5433  * This API is used to remove LE device from white list
5434  * Before calling this API, make sure that the adapter is enabled. There is no callback event for
5435  * this API.
5436  *
5437  *
5438  * This function is a synchronous call.
5439  *
5440  * @param[in] address The address of remote device
5441  *
5442  * @return      BLUETOOTH_ERROR_NONE - Success \n
5443  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
5444  *
5445  * @remark      None
5446  * @see         bluetooth_set_custom_advertising
5447  */
5448 int bluetooth_remove_white_list(bluetooth_device_address_t *address, bluetooth_device_address_type_t address_type);
5449
5450 /**
5451  * @fn int bluetooth_clear_white_list(void)
5452  * @brief Clear white list
5453  *
5454  * This API is used to clear white list
5455  * Before calling this API, make sure that the adapter is enabled. There is no callback event for
5456  * this API.
5457  *
5458  *
5459  * This function is a synchronous call.
5460  *
5461  * @param[in] address The address of remote device
5462  *
5463  * @return      BLUETOOTH_ERROR_NONE - Success \n
5464  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
5465  *
5466  * @remark      None
5467  * @see         bluetooth_set_custom_advertising
5468  */
5469 int bluetooth_clear_white_list(void);
5470
5471 /**
5472  * @fn int bluetooth_le_conn_update(bluetooth_device_address_t *address,
5473  *          const bluetooth_le_connection_param_t *parameters)
5474  * @brief update connection paramter of LE connection.
5475  *
5476  * This function is a synchronous call.
5477  *
5478  * @return   BLUETOOTH_ERROR_NONE  - Success \n
5479  *           BLUETOOTH_ERROR_INTERNAL - Internal Error \n
5480  *
5481  * @exception  None
5482  * @param[in]  address - remote device address value.
5483  * @param[in]  parameters - new connection parameters.
5484  *
5485  * @remark       None
5486  * @see     bluetooth_bond_device
5487  */
5488 int bluetooth_le_conn_update(const bluetooth_device_address_t *address,
5489             const bluetooth_le_connection_param_t *parameters);
5490
5491
5492 /**
5493  * @fn int bluetooth_enable_le_privacy(gboolean enable_privacy);
5494  *
5495  * @brief Enable/Disable LE Privacy feature.
5496  *
5497  * This function is used to enable or disable LE Privacy feature.
5498  * Once Privacy feature is enabled, Adapter can use Random Address for more security.
5499  *
5500  * This function is a synchronous call.
5501  *
5502  * @return      BLUETOOTH_ERROR_NONE - Success \n
5503  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
5504  *              BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
5505  *
5506  * @exception   None
5507  * @param[in]   enable_privacy - The status of Privacy feature to be activated/deactivated[True/False].
5508  *
5509  * @remark      None
5510  */
5511 int bluetooth_enable_le_privacy(gboolean enable_privacy);
5512
5513 /**
5514  * @fn int bluetooth_update_le_connection_mode(bluetooth_device_address_t *address,
5515  *                                             bluetooth_le_connection_mode_t mode)
5516  * @brief update connection paramter of LE connection.
5517  *
5518  * This function is a synchronous call.
5519  *
5520  * @return   BLUETOOTH_ERROR_NONE  - Success \n
5521  *           BLUETOOTH_ERROR_INTERNAL - Internal Error \n
5522  *           BLUETOOTH_ERROR_INVALID_PARAM - Parameter is not valid \n
5523  *
5524  * @exception  None
5525  * @param[in]  address - remote device address value.
5526  * @param[in]  mode - new connection mode.
5527  *
5528  * @remark       None
5529  */
5530 int bluetooth_update_le_connection_mode(const bluetooth_device_address_t *address,
5531                 bluetooth_le_connection_mode_t mode);
5532
5533 /**
5534  * @fn int bluetooth_le_read_maximum_data_length()
5535  * @brief reads the maximum LE data length supported in the controller.
5536  *
5537  * This function is a synchronous call.
5538  *
5539  * @return   BLUETOOTH_ERROR_NONE  - Success \n
5540  *           BLUETOOTH_ERROR_INTERNAL - Internal Error \n
5541  *
5542  * @exception  None
5543  *
5544  * @remark       None
5545  */
5546 int bluetooth_le_read_maximum_data_length(
5547                         bluetooth_le_read_maximum_data_length_t *max_le_datalength);
5548 /**
5549  * @fn int bluetooth_le_write_host_suggested_default_data_length()
5550  * @brief writes the host suggested values for the controllers max transmitted no of payload
5551  * octects to be used for new connections.
5552  *
5553  * This function is a synchronous call.
5554  *
5555  * @return   BLUETOOTH_ERROR_NONE  - Success \n
5556  *           BLUETOOTH_ERROR_INTERNAL - Internal Error \n
5557  *
5558  * @exception  None
5559  *
5560  * @remark       None
5561  */
5562 int bluetooth_le_write_host_suggested_default_data_length(
5563                 const unsigned int def_tx_Octets, const unsigned int def_tx_Time);
5564
5565 int bluetooth_le_read_suggested_default_data_length(
5566         bluetooth_le_read_host_suggested_data_length_t *le_data_length);
5567
5568 int bluetooth_le_set_data_length(bluetooth_device_address_t *address,
5569         const unsigned int max_tx_octets, const unsigned int max_tx_time);
5570
5571 int bluetooth_pbap_init(void);
5572 int bluetooth_pbap_deinit(void);
5573 int bluetooth_pbap_connect(const bluetooth_device_address_t *address);
5574 int bluetooth_pbap_disconnect(const bluetooth_device_address_t *address);
5575 int bluetooth_pbap_get_phonebook_size(const bluetooth_device_address_t *address,
5576                 bt_pbap_folder_t *folder);
5577 int bluetooth_pbap_get_phonebook(const bluetooth_device_address_t *address,
5578                 bt_pbap_folder_t *folder, bt_pbap_pull_parameters_t *app_param);
5579 int bluetooth_pbap_get_list(const bluetooth_device_address_t *address,
5580                 bt_pbap_folder_t *folder, bt_pbap_list_parameters_t *app_param);
5581 int bluetooth_pbap_pull_vcard(const bluetooth_device_address_t *address,
5582                 bt_pbap_folder_t *folder, bt_pbap_pull_vcard_parameters_t *app_param);
5583 int bluetooth_pbap_phonebook_search(const bluetooth_device_address_t *address,
5584                 bt_pbap_folder_t *folder, bt_pbap_search_parameters_t *app_param);
5585
5586 /**
5587  * @fn int bluetooth_set_manufacturer_data(const bluetooth_manufacturer_data_t *value);
5588  *
5589  * @brief Set manufacturer data with value
5590  *
5591  * This function is used to set manufacturer data.
5592  *
5593  * This function is a synchronous call.
5594  *
5595  * @return      BLUETOOTH_ERROR_NONE - Success \n
5596  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
5597  *              BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
5598  *
5599  * @exception   None
5600  * @param[in]   value - Manufacturer data structure.
5601  *
5602  * @remark      None
5603  */
5604 int bluetooth_set_manufacturer_data(const bluetooth_manufacturer_data_t *value);
5605 /**
5606  * @}
5607  */
5608
5609 #ifdef __cplusplus
5610 }
5611 #endif                          /* __cplusplus */
5612 #endif                          /* _BLUETOOTH_API_H_*/