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