5e4222e0ab9289cc876d05b92d619780c90ca18e
[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         g_type_init();
1544         main_loop = g_main_loop_new(NULL, FALSE);
1545         ret = bluetooth_register_callback(bt_event_callback, (void*)main_loop);
1546         if (ret >= BLUETOOTH_ERROR_NONE)
1547         {
1548                 // bluetooth_register_callback returned Success
1549         }
1550         else
1551         {
1552                 // bluetooth_register_callback returned failiure
1553         }
1554         g_main_loop_run(main_loop);
1555 }
1556 @endcode
1557  */
1558 int bluetooth_register_callback(bluetooth_cb_func_ptr callback_ptr, void *user_data);
1559
1560 /**
1561  * @fn int bluetooth_le_register_callback(bluetooth_cb_func_ptr callback_ptr, void *user_data)
1562  * @brief Set the callback function pointer for bluetooth le event
1563  *
1564  *
1565  * This API will register the callback function, when any response and event are received from
1566  * bluetooth framework. @n
1567  * this registered callback function will be get called with appropriate event and data structures.
1568  * This function is a synchronous call. An application developer can call
1569  * bluetooth_le_register_callback() function to register a callback function of bluetooth_cb_func_ptr
1570  * type. This registered function will receive events of bluetooth_event_type_t type along with
1571  * data any.
1572  *
1573  *
1574  * @param[in]   callback_ptr    A pointer to the callback function
1575  * @param[in]   user_data    A pointer to user data
1576  * @return      BLUETOOTH_ERROR_NONE - Success
1577  * @remark      None
1578  * @see         None
1579  * */
1580 int bluetooth_le_register_callback(bluetooth_cb_func_ptr callback_ptr, void *user_data);
1581
1582 /**
1583  * @fn int bluetooth_le_unregister_callback(void)
1584  * @brief Set the callback function pointer for bluetooth le event
1585  *
1586  *
1587  * This API will register the callback function, when any response and event are received from
1588  * bluetooth framework. @n
1589  * this registered callback function will be get called with appropriate event and data structures.
1590  * This function is a synchronous call. An application developer can call
1591  * bluetooth_le_register_callback() function to register a callback function of bluetooth_cb_func_ptr
1592  * type. This registered function will receive events of bluetooth_event_type_t type along with
1593  * data any.
1594  *
1595  *
1596  * @param[in]   none
1597  * @return      BLUETOOTH_ERROR_NONE - Success
1598  * @remark      None
1599  * @see         None
1600  * */
1601 int bluetooth_le_unregister_callback(void);
1602
1603 /**
1604  * @fn int bluetooth_deregister_callback(bluetooth_cb_func_ptr callback_ptr)
1605  * @brief Set the callback function pointer for bluetooth event
1606  *
1607  *
1608  * This API will register the callback function, when any response and event are received from
1609  * bluetooth framework. @n
1610  * this registered callback function will be get called with appropriate event and data structures.
1611  * This function is a synchronous call. An application developer can call
1612  * bluetooth_register_callback() function to register a callback function of bluetooth_cb_func_ptr
1613  * type. This registered function will receive events of bluetooth_event_type_t type along with
1614  * data any.
1615  *
1616  *
1617  * @param[in]   none
1618  * @return      BLUETOOTH_ERROR_NONE - Success
1619  * @remark      None
1620  * @see         None
1621 @code
1622 void bt_event_callback(int event, bluetooth_event_param_t *param, void *user_data)
1623 {
1624         GMainLoop *main_loop = (GMainLoop*) user_data;
1625
1626         switch(event)
1627         {
1628                 // Code for each event
1629                 default:
1630                         g_main_loop_quit(main_loop);
1631                         break;
1632         }
1633 }
1634
1635 int main()
1636 {
1637         GMainLoop *main_loop = NULL;
1638         int ret = 0;
1639         g_type_init();
1640         main_loop = g_main_loop_new(NULL, FALSE);
1641         ret = bluetooth_register_callback(bt_event_callback, (void*)main_loop);
1642         if (ret >= BLUETOOTH_ERROR_NONE)
1643         {
1644                 // bluetooth_register_callback returned Success
1645         }
1646         else
1647         {
1648                 // bluetooth_register_callback returned failiure
1649         }
1650         ret = bluetooth_deregister_callback(void);
1651         g_main_loop_run(main_loop);
1652 }
1653 @endcode
1654  */
1655 int bluetooth_unregister_callback(void);
1656
1657 /**
1658  * @fn int bluetooth_enable_adapter(void)
1659  * @brief Enable the Bluetooth H/W
1660  *
1661  *
1662  * This API can be used to activate Bluetooth. It initializes Bluetooth protocol stack for use and
1663  * send request to bluetooth chip for activation.
1664  * This function is typically called at startup or when Bluetooth services are required.  This
1665  * function must be called before calling any other API of Bluetooth operations.
1666  *
1667  * Before performing any operations like Device discover, service search etc.., the adapter must be
1668  * enabled.
1669  *
1670  * This function is a asynchronous call.
1671  * If the call is success then the application will receive BLUETOOTH_EVENT_ENABLED event
1672  * through registered callback function with appropriate result code
1673  *                      BLUETOOTH_CHANGE_STATUS_TIMEOUT - Timeout has happen \n
1674  *                      BLUETOOTH_ERROR_NONE - Success \n
1675  *
1676  * If the adpter is not enabled with in 30 seconds then BLUETOOTH_EVENT_ENABLED with result code
1677  * BLUETOOTH_CHANGE_STATUS_TIMEOUT will come
1678  *
1679  * @return      BLUETOOTH_ERROR_NONE - Success\n
1680  *              BLUETOOTH_ERROR_DEVICE_ALREADY_ENABLED - Adapter already enabled\n
1681  *              BLUETOOTH_ERROR_ACCESS_DENIED - Enabling adapter is not allowed by MDM policy\n
1682  *              BLUETOOTH_ERROR_IN_PROGRESS - Adapter is activating or deactivating\n
1683  * @exception   BLUETOOTH_ERROR_INTERNAL - Dbus proxy call is fail
1684  * @remark      None
1685  * @see         bluetooth_check_adapter, bluetooth_disable_adapter
1686 @code
1687 void bt_event_callback(int event, bluetooth_event_param_t *param)
1688 {
1689         switch(event)
1690         {
1691                 case BLUETOOTH_EVENT_ENABLED:
1692                         if (param->result == BLUETOOTH_ERROR_NONE)
1693                         {
1694                                 // Successfully Enabled
1695                         }
1696                         else
1697                         {
1698                                 // Failed
1699                         }
1700                         break;
1701         }
1702 }
1703
1704 ...
1705
1706 int ret = 0;
1707 ret = bluetooth_enable_adapter();
1708
1709 @endcode
1710  */
1711 int bluetooth_enable_adapter(void);
1712
1713 /**
1714  * @fn int bluetooth_disable_adapter(void)
1715  * @brief Disable the Bluetooth H/W
1716  *
1717  *
1718  * This function disables Bluetooth protocol stack and hardware. This function is called when
1719  * Bluetooth is no longer used. It will internally free all resources and power off the RF radio.
1720  *
1721  * Bluetooth adapter should be disabled to switch off Bluetooth chip (and thereby saving power).
1722  * bluetooth_disable_adapter() API will do that job for you. After switching off Bluetooth,
1723  * BLUETOOTH_EVENT_DISABLED will be sent by SDK to application for confirmation with appropriate
1724  * error code.
1725  * The various error codes are BLUETOOTH_ERROR_NONE for success and BLUETOOTH_ERROR_INTERNAL for
1726  * internal error.
1727  *
1728  * This function is a asynchronous call.
1729  * If this call is success then the applications will receive BLUETOOTH_EVENT_DISABLED event
1730  * through registered callback function.
1731  *
1732  *
1733  * @return      BLUETOOTH_ERROR_NONE - Success\n
1734  *              BLUETOOTH_ERROR_IN_PROGRESS - Adapter is activating or deactivating\n
1735  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Bluetooth adapter is not enabled\n
1736  * @exception   BLUETOOTH_ERROR_INTERNAL - Dbus proxy call is fail
1737  * @remark      None
1738  * @see         bluetooth_check_adapter, bluetooth_enable_adapter
1739 @code
1740 void bt_event_callback(int event, bluetooth_event_param_t *param)
1741 {
1742         switch(event)
1743         {
1744                 case BLUETOOTH_EVENT_DISABLED:
1745                         if (param->result == BLUETOOTH_ERROR_NONE)
1746                         {
1747                                 // Successfully disabled
1748                         }
1749                         else
1750                         {
1751                                 // Failed
1752                         }
1753                         break;
1754         }
1755 }
1756
1757 ...
1758
1759 int ret = 0;
1760 ret = bluetooth_disable_adapter();
1761 @endcode
1762  */
1763 int bluetooth_disable_adapter(void);
1764 int bluetooth_recover_adapter(void);
1765 int bluetooth_check_adapter_le(void);
1766 int bluetooth_enable_adapter_le(void);
1767
1768 int bluetooth_disable_adapter_le(void);
1769
1770 /**
1771  * @fn int bluetooth_reset_adapter(void)
1772  * @brief Reset the Bluetooth H/W and values
1773  *
1774  *
1775  * This function resets Bluetooth protocol stack and hardware. This function is called when
1776  * an user want to initialize Bluetooth environment.
1777  *
1778  * The various error codes are BLUETOOTH_ERROR_NONE for success and BLUETOOTH_ERROR_INTERNAL for
1779  * internal error.
1780  *
1781  * This function is a synchronous call.
1782  *
1783  * @return      BLUETOOTH_ERROR_NONE - Success\n
1784  * @exception   BLUETOOTH_ERROR_INTERNAL - Dbus proxy call is fail
1785  * @remark      None
1786  * @see         bluetooth_check_adapter, bluetooth_enable_adapter
1787 @code
1788 ...
1789
1790 int ret = 0;
1791 ret = bluetooth_reset_adapter();
1792 @endcode
1793  */
1794 int bluetooth_reset_adapter(void);
1795
1796 /**
1797  * @fn int bluetooth_is_supported(void)
1798  * @brief Check if the bluetooth is supported or not by the current target
1799  *
1800  * This API checks whether the bluetooth is supported or not.
1801  * This API only run by root permission.
1802  *
1803  * This function is a synchronous call.
1804  *
1805  * @return      0 - if bluetooth is not supported\n
1806  *              1 - if bluetooth is supported\n
1807  *              BLUETOOTH_ERROR_INTERNAL - Error in API internal
1808  * @remark      None
1809 @code
1810
1811 int ret = 0;
1812 ret = bluetooth_is_supported();
1813 @endcode
1814  */
1815 int bluetooth_is_supported(void);
1816
1817
1818 /**
1819  * @fn int bluetooth_check_adapter(void)
1820  * @brief Check the current status of the Bluetooth adapter
1821  *
1822  *
1823  * This API checks whether the Bluetooth adapter is enabled or not. Before performing any operations
1824  * the bluetooth adapter should be enabled. This API helps to find out the current state of the
1825  * bluetooth adapter.
1826  * This API get the adapter internal data structure and check current adapter status.
1827  *
1828  * This function is a synchronous call.
1829  *
1830  *
1831  * @return      BLUETOOTH_ADAPTER_DISABLED - if bluetooth adapter is disabled\n
1832  *              BLUETOOTH_ADAPTER_ENABLED - if bluetooth adapter is enabled\n
1833  * @remark      None
1834  * @see         bluetooth_enable_adapter, bluetooth_disable_adapter
1835 @code
1836
1837 int ret = 0;
1838 ret = bluetooth_check_adapter();
1839 @endcode
1840  */
1841 int bluetooth_check_adapter(void);
1842
1843 /**
1844  * @fn int bluetooth_get_local_address(bluetooth_device_address_t *local_address)
1845  * @brief Get the local adapter bluetooth address
1846  *
1847  *
1848  * This API is used, get the device address of the local bluetooth adapter. Before calling this API,
1849  * the adapter should be enabled.
1850  * In its output parameter, you can receive bluetooth_device_address_t type of pointer which will
1851  * contain Bluetooth address.
1852  * Since its inconvenient for user to remember the address, Bluetooth provides a method to have a
1853  * friendly name for each device.
1854  * There is no event callback for this API.
1855  *
1856  * This function is a synchronous call.
1857  *
1858  *
1859  * @return      BLUETOOTH_ERROR_NONE - Succeess \n
1860  *              BLUETOOTH_ERROR_INVALID_PARAM -  Invalid parameter (NULL buffer) \n
1861  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED -  Adapter is disabled \n
1862  * @param[out]  local_address   a device address of local bluetooth adapter
1863  * @remark      None
1864  * @see         None
1865 @code
1866
1867 bluetooth_device_address_t local_address={0,};
1868 int ret = 0;
1869
1870 ret = bluetooth_get_local_address(&local_address);
1871 @endcode
1872  */
1873 int bluetooth_get_local_address(bluetooth_device_address_t *local_address);
1874
1875 /**
1876  * @fn int bluetooth_get_local_version(bluetooth_version_t *version)
1877  * @brief Get the hci version
1878  *
1879  *
1880  * This function is used to get the bluetooth hci version
1881  * Before calling this API make sure that the adapter is enabled.
1882  *
1883  * This function is a synchronous call.
1884  *
1885  *
1886  * @return      BLUETOOTH_ERROR_NONE - Success \n
1887  *              BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
1888  * @param[out]  timeout   remain visibility timeout value
1889  * @remark      None
1890  @code
1891 bluetooth_version_t *version;
1892  int ret = 0;
1893  ret = bluetooth_get_local_version (&version);
1894  @endcode
1895  */
1896 int bluetooth_get_local_version(bluetooth_version_t *version);
1897
1898 /**
1899  * @fn int bluetooth_get_local_name(bluetooth_device_name_t* local_name)
1900  * @brief Get the local device name
1901  *
1902  *
1903  * This function is used, get the local device name. Since its difficult to remember the Adapter
1904  * address, the friendly name can be assigned to the adapter and we can get it using this API. This
1905  * friendly name is retrived by the remote device and displaying.
1906  * Before calling this API, the adapter should be enabled. There is no event callback for this API.
1907  *
1908  * This function is a synchronous call.
1909  *
1910  *
1911  * @return      BLUETOOTH_ERROR_NONE - Success \n
1912  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter (NULL buffer)\n
1913  * @param[out]  local_name      a local device name
1914  * @remark      None
1915  * @see         None
1916 @code
1917 bluetooth_device_name_t local_name={0,}
1918 int ret = 0;
1919 ret = bluetooth_get_local_name (&local_name);
1920 @endcode
1921  */
1922 int bluetooth_get_local_name(bluetooth_device_name_t *local_name);
1923
1924 /**
1925  * @fn int bluetooth_set_local_name(const bluetooth_device_name_t *local_name)
1926  * @brief Set the local device name
1927  *
1928  *
1929  * This function is used to set the local device name. This is a human friendly name whose
1930  * length can be BLUETOOTH_DEVICE_NAME_LENGTH_MAX maximum
1931  *
1932  * This function is a synchronous call.
1933  *
1934  * @param[in]   local_name   bluetooth device name to set local device
1935  *
1936  * @return      BLUETOOTH_ERROR_NONE - Success \n
1937  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
1938  *              BLUETOOTH_ERROR_INVALID_PARAM - Bluetooth name parameter is incorrect \n
1939  *              BLUETOOTH_ERROR_INVALID_DATA - Device address provided is incorrect \n
1940  *              BLUETOOTH_ERROR_NO_RESOURCES - Pre-allocated memory error \n
1941  *              BLUETOOTH_ERROR_INTERNAL - The dbus method call is fail \n
1942  *
1943  * @remark      None
1944
1945 @code
1946 bluetooth_device_name_t local_name={0,}
1947 int ret = 0;
1948 ret = bluetooth_set_local_name (&local_name);
1949 @endcode
1950  */
1951 int bluetooth_set_local_name(const bluetooth_device_name_t *local_name);
1952
1953
1954 /**
1955  * @fn int bluetooth_is_service_used(const char *service_uuid, gboolean *used)
1956  * @brief Check if the uuid is used or not
1957  *
1958  * This function is used to check if the uuid is used or not.
1959  *
1960  * This function is a synchronous call.
1961  *
1962  * @param[in]   service_uuid   service uuid (UUID 128 bit as string)
1963  * @param[out] used  if the uuid is used or not
1964  *
1965  * @return      BLUETOOTH_ERROR_NONE - Success \n
1966  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
1967  *              BLUETOOTH_ERROR_INVALID_PARAM - Bluetooth name parameter is incorrect \n
1968  *              BLUETOOTH_ERROR_INTERNAL - The dbus method call is fail \n
1969  *
1970  * @remark      None
1971  *
1972 @code
1973 gboolean used = FALSE;
1974 const char *uuid ="00001101-0000-1000-8000-00805F9B34FB";
1975 ret = bluetooth_is_service_used(uuid, &used);
1976 @endcode
1977  */
1978 int bluetooth_is_service_used(const char *service_uuid, gboolean *used);
1979
1980 /**
1981  * @fn int bluetooth_is_device_connected(const bluetooth_device_address_t *device_address, bluetooth_service_type_t type, gboolean *is_connected)
1982  * @brief Check if the device is connected to the specific service
1983  *
1984  * This function is used to check if if the device is connected to the specific service.
1985  *
1986  * This function is a synchronous call.
1987  *
1988  * @param[in]   local_address   a device address of remote bluetooth device
1989  * @param[in]   type the service type
1990  * @param[out] is_connected  if the device is connected or not
1991  *
1992  * @return      BLUETOOTH_ERROR_NONE - Success \n
1993  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
1994  *              BLUETOOTH_ERROR_INVALID_PARAM - Bluetooth name parameter is incorrect \n
1995  *              BLUETOOTH_ERROR_INTERNAL - The dbus method call is fail \n
1996  *
1997  * @remark      None
1998  *
1999 @code
2000 gboolean is_connected = FALSE;
2001 bluetooth_device_address_t device_address={{0x00,0x0D,0xFD,0x24,0x5E,0xFF}};
2002 ret = bluetooth_is_device_connected(&device_address, BLUETOOTH_HSP_SERVICE, &used);
2003 @endcode
2004  */
2005 int bluetooth_is_device_connected(const bluetooth_device_address_t *device_address,
2006                                 bluetooth_service_type_t type,
2007                                 gboolean *is_connected);
2008
2009 /**
2010  * @fn int bluetooth_get_connected_link_type(const bluetooth_device_address_t *device_address, bluetooth_connected_link_t *connected_link)
2011  * @brief Gets device's connected link type
2012  *
2013  * This function is used to get device's connected link type
2014  *
2015  * This function is a synchronous call.
2016  *
2017  * @param[in]   device_address  a device address of remote bluetooth device
2018  * @param[out]  connected_link  a device's connected link type
2019  *
2020  * @return      BLUETOOTH_ERROR_NONE - Success \n
2021  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
2022  *              BLUETOOTH_ERROR_INVALID_PARAM - Bluetooth name parameter is incorrect \n
2023  *              BLUETOOTH_ERROR_INTERNAL - The dbus method call is fail \n
2024  *
2025  * @remark      None
2026  *
2027 @code
2028 bluetooth_connected_link_t *connected_link = BLUETOOTH_CONNECTED_LINK_NONE;
2029 bluetooth_device_address_t device_address={{0x00,0x0D,0xFD,0x24,0x5E,0xFF}};
2030 ret = bluetooth_get_connected_link(&device_address, &connected_link);
2031 @endcode
2032  */
2033 int bluetooth_get_connected_link_type(const bluetooth_device_address_t *device_address,
2034                                 bluetooth_connected_link_t *connected_link);
2035
2036 /**
2037  * @fn int bluetooth_get_discoverable_mode(bluetooth_discoverable_mode_t *discoverable_mode_ptr)
2038  * @brief Get the visibility mode
2039  *
2040  *
2041  * This function is used to get the discoverable mode (Visibility option). Depending upon the
2042  * visibity mode, the property of the device is determined whether it can be discoverable, non
2043  * discoverable, connectable etc. Before calling this API make sure that the adapter is enabled.
2044  *
2045  * This function is a synchronous call.
2046  *
2047  *
2048  * @return      BLUETOOTH_ERROR_NONE - Success \n
2049  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
2050  *              BLUETOOTH_ERROR_INVALID_DATA - Invalid data \n
2051  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
2052  *              BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
2053  * @param[out]  discoverable_mode   current bluetooth discoverable mode
2054  * @remark      None
2055  * @see         bluetooth_set_discoverable_mode
2056  @code
2057  bluetooth_discoverable_mode_t discoverable_mode_ptr;
2058  int ret = 0;
2059  ret = bluetooth_get_discoverable_mode (&discoverable_mode_ptr);
2060  @endcode
2061  */
2062 int bluetooth_get_discoverable_mode(bluetooth_discoverable_mode_t *discoverable_mode_ptr);
2063
2064 /**
2065  * @fn int bluetooth_set_discoverable_mode(bluetooth_discoverable_mode_t discoverable_mode,
2066  *                                              int timeout)
2067  * @brief Set the visibility mode
2068  *
2069  *
2070  * This function is used to set the discoverable mode (Visibility option).
2071  *
2072  * Many times user may want to keep his device discoverable so that when peer device is performing
2073  * device search, he/she can find user's device. Application programmer can keep the mode as
2074  * BLUETOOTH_DISCOVERABLE_MODE_GENERAL_DISCOVERABLE or
2075  * BLUETOOTH_DISCOVERABLE_MODE_TIME_LIMITED_DISCOVERABLE for the same purpose. However, all these
2076  * modes cause bluetooth adapter to consume more battery. Hence developer should generally
2077  * keep discoverable mode as BLUETOOTH_DISCOVERABLE_MODE_CONNECTABLE.
2078  *
2079  * This function is a synchronous call.
2080  *
2081  * @return      BLUETOOTH_ERROR_NONE - Success \n
2082  *              BLUETOOTH_ERROR_NOT_SUPPORT - Requested mode is not supported \n
2083  *
2084  * @param[in]  discoverable_mode   the bluetooth discoverable mode to set
2085  * @param[in]  timeout   discoverable time in only limited discoverable mode (second), default: 0
2086  * @remark      None
2087  * @see         bluetooth_get_discoverable_mode
2088
2089 @code
2090
2091 bluetooth_discoverable_mode_t mode;
2092 int ret = 0;
2093 mode= BLUETOOTH_DISCOVERABLE_MODE_TIME_LIMITED_DISCOVERABLE;
2094 ret = bluetooth_set_discoverable_mode (mode, 180);
2095
2096 @endcode
2097  */
2098 int bluetooth_set_discoverable_mode(bluetooth_discoverable_mode_t discoverable_mode,
2099                                             int timeout);
2100
2101
2102 /**
2103  * @fn int bluetooth_get_timeout_value(int *timeout)
2104  * @brief Get the visibility timeout value
2105  *
2106  *
2107  * This function is used to get the visibility timeout
2108  * Before calling this API make sure that the adapter is enabled.
2109  *
2110  * This function is a synchronous call.
2111  *
2112  *
2113  * @return      BLUETOOTH_ERROR_NONE - Success \n
2114  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
2115  *              BLUETOOTH_ERROR_INVALID_DATA - Invalid data \n
2116  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
2117  *              BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
2118  * @param[out]  timeout   remain visibility timeout value
2119  * @remark      None
2120  * @see         bluetooth_set_discoverable_mode
2121  @code
2122  int timeout;
2123  int ret = 0;
2124  ret = bluetooth_get_timeout_value (&timeout);
2125  @endcode
2126  */
2127 int bluetooth_get_timeout_value(int *timeout);
2128
2129
2130 /**
2131  * @fn int bluetooth_start_discovery(unsigned short max_response, unsigned short discovery_duration,
2132  *                                      unsigned int  classOfDeviceMask)
2133  * @brief Start the generic device discovery which finds both the BR/EDR and LE devices.
2134  *
2135  * To connect connect to peer bluetooth device, you will need to know its bluetooth address and its
2136  * name. You can search for Bluetooth devices in vicinity by bluetooth_start_discovery() API. It
2137  * first performs an inquiry and try to find both the BREDR and LE devices. For each device found
2138  * from the inquiry it gets the remote name of the device. Bluetooth device address and name are
2139  * given to Application via BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND event. In param_data of
2140  * bluetooth_event_param_t, you will receive a pointer to a structure of bluetooth_device_info_t type.
2141  * You will receive device address, device name, device class, rssi (received signal strength indicator).
2142  * please see bluetooth_device_info_t for more details.
2143  *
2144  *
2145  * This API provides searching options like max responses, discovery duration in seconds and class
2146  * of device mask to filter device search. some times there may be too many bluetooth devices in
2147  * vicinity of your device.in such scenario, application can request to reduce number of responces
2148  * (BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND event) with help of max_response parameter. However if you
2149  * pass zero, bluetooth adapter will not restrict number of responses. you can also specify duration
2150  * of the seach in discovery_duration. bluetooth adapter will automatically stop device search after
2151  * application defined time. please note that discovery_duration should be mentioned in seconds.
2152  * Also note that search will end after 180 seconds automatically if you pass 0 in discovery
2153  * duration.
2154  *
2155  * Sometimes user may want to search for a particular kind of device. for ex, mobile or pc. in such
2156  * case, you can use classOfDeviceMask parameter. please see bluetooth_device_service_class_t,
2157  * bluetooth_device_major_class_t and bluetooth_device_minor_class_t enums
2158  *
2159  * This function is a asynchronous call.
2160  * If the call is success then the application will receive BLUETOOTH_EVENT_DISCOVERY_STARTED event
2161  * through registered callback function.
2162  *
2163  * The discovery is responded by an BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND event for each device it
2164  * found and a BLUETOOTH_EVENT_REMOTE_DEVICE_NAME_UPDATED event for its name updation.
2165  *
2166  * The completion or cancellation of the discovery is indicated by an
2167  * BLUETOOTH_EVENT_DISCOVERY_FINISHED event.
2168  *
2169  * The device discovery can be cancelled by calling bluetooth_stop_discovery().
2170  *
2171  *
2172  * @return      BLUETOOTH_ERROR_NONE - Success \n
2173  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Bluetooth adapter is not enabled \n
2174  *              BLUETOOTH_ERROR_DEVICE_BUSY - Bluetooth adapter is busy doing some operation \n
2175  *              BLUETOOTH_ERROR_INTERNAL - System error like heap full has occured or bluetooth
2176                                                 agent is not running \n
2177  *
2178  * @param[in] max_response              define the maximum response of the number of founded devices
2179                                         (0 means unlimited)
2180  * @param[in] discovery_duration        define bluetooth discovery duration (0 means 180s )
2181  * @param[in] classOfDeviceMask         define classes of the device mask which user wants
2182                                         (refer to class of device)
2183  * @remark      None
2184  * @see         bluetooth_start_custom_discovery(), bluetooth_cancel_discovery, bluetooth_device_info_t
2185
2186 @code
2187 void bt_event_callback(int event, bluetooth_event_param_t *param)
2188 {
2189         switch(event)
2190         {
2191                 case BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND:
2192                 {
2193                         bluetooth_device_info_t *device_info = NULL;
2194                         printf("BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND, result [0x%04x]",
2195                                         param->result);
2196                         device_info  = (bluetooth_device_info_t *)param->param_data;
2197                         memcpy(&searched_device, &device_info->device_address,
2198                                                 sizeof(bluetooth_device_address_t));
2199                         printf("dev [%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X]",
2200                                 device_info->device_address.addr[0],
2201                                 device_info->device_address.addr[1],
2202                                 device_info->device_address.addr[2],
2203                                 device_info->device_address.addr[3],
2204                                 device_info->device_address.addr[4],
2205                                 device_info->device_address.addr[5]);
2206                         break;
2207                 }
2208                 case BLUETOOTH_EVENT_REMOTE_DEVICE_NAME_UPDATED:
2209                 {
2210                         bluetooth_device_info_t *device_info = NULL;
2211                         printf("BLUETOOTH_EVENT_REMOTE_DEVICE_NAME_UPDATED, result [0x%04x]",
2212                                                                                 param->result);
2213                         device_info  = (bluetooth_device_info_t *)param->param_data;
2214                         memcpy(&searched_device, &device_info->device_address,
2215                                                                 sizeof(bluetooth_device_address_t));
2216                         printf("dev [%s] [%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X]",
2217                                                         device_info->device_name.name,
2218                                                         device_info->device_address.addr[0],
2219                                                         device_info->device_address.addr[1],
2220                                                         device_info->device_address.addr[2],
2221                                                         device_info->device_address.addr[3],
2222                                                         device_info->device_address.addr[4],
2223                                                         device_info->device_address.addr[5]);
2224                         break;
2225                 }
2226
2227                 case BLUETOOTH_EVENT_DISCOVERY_FINISHED:
2228                         printf("BLUETOOTH_EVENT_DISCOVERY_FINISHED, result[0x%04x]", param->result);
2229                         break;
2230         }
2231 }
2232
2233 unsigned short max_response;
2234 unsigned short discovery_duration;
2235 unsigned classOfDeviceMask;
2236 int ret = 0;
2237
2238 max_response =0;
2239 discovery_duration =0;
2240 classOfDeviceMask =0;
2241
2242 ret = bluetooth_start_discovery(max_response,discovery_duration,classOfDeviceMask);
2243
2244 @endcode
2245  *
2246  */
2247 int bluetooth_start_discovery(unsigned short max_response,
2248                                       unsigned short discovery_duration,
2249                                       unsigned int classOfDeviceMask);
2250
2251 /**
2252  * @fn int bluetooth_start_custom_discovery(bt_discovery_role_type_t role
2253  *                                      unsigned short max_response,
2254  *                                      unsigned short discovery_duration,
2255  *                                      unsigned int  classOfDeviceMask)
2256  * @brief Start the custom device discovery with specific type such as BR/EDR, LE, LE+BR/EDR etc.
2257  *
2258  * Sometimes user may want to search for a particular kind of device. for ex, LE only or BR/EDR only.
2259  * In such case, you can use type parameter. This API is similar to that of bluetooth_start_discovery().
2260  * Please see bluetooth_start_discovery() for other parameters description.
2261  *
2262  * This function is a asynchronous call.
2263  * If the call is success then the application will receive BLUETOOTH_EVENT_DISCOVERY_STARTED event
2264  * through registered callback function.
2265  *
2266  * The discovery is responded by an BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND event for each device it
2267  * found and a BLUETOOTH_EVENT_REMOTE_DEVICE_NAME_UPDATED event for its name updation.
2268  *
2269  * The completion or cancellation of the discovery is indicated by an
2270  * BLUETOOTH_EVENT_DISCOVERY_FINISHED event.
2271  *
2272  * The device discovery can be cancelled by calling bluetooth_stop_discovery().
2273  *
2274  *
2275  * @return      BLUETOOTH_ERROR_NONE - Success \n
2276  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Bluetooth adapter is not enabled \n
2277  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
2278  *              BLUETOOTH_ERROR_IN_PROGRESS - Bluetooth adapter is busy with another discovery \n
2279  *              BLUETOOTH_ERROR_INTERNAL - System error like heap full has occured or bluetooth
2280                                                 agent is not running \n
2281  *
2282  * @param[in] role              define the role type of devices to be discovered. See enum bt_discovery_role_type_t.
2283                                         (DISCOVERY_ROLE_BREDR means BREDR only, DISCOVERY_ROLE_LE mean Low Energy only,
2284                                         DISCOVERY_ROLE_LE_BREDR means LE & BREDR - same as bluetooth_start_discovery())
2285  * @param[in] max_response              define the maximum response of the number of founded devices
2286                                         (0 means unlimited)
2287  * @param[in] discovery_duration        define bluetooth discovery duration (0 means 180s )
2288  * @param[in] classOfDeviceMask         define classes of the device mask which user wants
2289                                         (refer to class of device)
2290  * @remark      None
2291  * @see         bluetooth_start_discovery(), bluetooth_cancel_discovery, bluetooth_device_info_t
2292
2293 @code
2294 unsigned short type;
2295 unsigned short max_response;
2296 unsigned short discovery_duration;
2297 unsigned classOfDeviceMask;
2298 int ret = 0;
2299
2300 type = 1;
2301 max_response =0;
2302 discovery_duration =0;
2303 classOfDeviceMask =0;
2304
2305 ret = bluetooth_start_custom_discovery(type, max_response, discovery_duration, classOfDeviceMask);
2306
2307 @endcode
2308  *
2309  */
2310 int bluetooth_start_custom_discovery(bt_discovery_role_type_t role,
2311                                                 unsigned short max_response,
2312                                                 unsigned short discovery_duration,
2313                                                 unsigned int classOfDeviceMask);
2314
2315 /**
2316  * @fn int bluetooth_cancel_discovery (void)
2317  * @brief Cancel the on-going device discovery operation
2318  *
2319  *
2320  * This function stops the on-going device discovery operation. This API has to be called after the
2321  * bluetooth_start_discovery API and before the BLUETOOTH_EVENT_DISCOVERY_FINISHED event comes of
2322  * the bluetooth_start_discovery API
2323  *
2324  * Normally the device discovery takes a more time (~10.24 seconds) to get all the devices in its
2325  * vicinity and it recevies as BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND event. This API helps us to
2326  * cancel the discover request once the user received the device to which he wish to connect.
2327  *
2328  * This function is a asynchronous call.
2329  * If the call is success to cancel discovey then the application will receive
2330  * BLUETOOTH_EVENT_DISCOVERY_FINISHED event through registered callback function
2331  * with an error code BLUETOOTH_ERROR_CANCEL. In the case of failure the error code will be
2332  * BLUETOOTH_ERROR_NONE
2333  *
2334  *
2335  * @return      BLUETOOTH_ERROR_NONE - Success \n
2336  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
2337  *              BLUETOOTH_ERROR_NOT_IN_OPERATION - No Discovery operation in progess to cancel \n
2338  *              BLUETOOTH_ERROR_ACCESS_DENIED - Currently in discovery but it is requested from
2339                                                 other application \n
2340  *              BLUETOOTH_ERROR_INTERNAL - Internel IPC error \n
2341  * @remark      None
2342  * @see         bluetooth_start_discovery
2343 @code
2344 void bt_event_callback(int event, bluetooth_event_param_t *param)
2345 {
2346         switch(event)
2347         {
2348                 case BLUETOOTH_EVENT_DISCOVERY_FINISHED:
2349                         TC_PRT("BLUETOOTH_EVENT_DISCOVERY_FINISHED, result[0x%04x]", param->result);
2350                         break;
2351         }
2352 }
2353
2354 ..
2355
2356 int ret = 0;
2357
2358 ret = bluetooth_cancel_discovery();
2359 @endcode
2360  */
2361 int bluetooth_cancel_discovery(void);
2362
2363 /**
2364  * @fn int bluetooth_start_le_discovery(void)
2365  * @brief Start the generic device discovery which finds the LE devices.
2366  *
2367  * To connect connect to peer bluetooth device, you will need to know its bluetooth address and its
2368  * name. You can search for Bluetooth devices in vicinity by bluetooth_start_le_discovery() API.
2369  * It try to find LE devices. Bluetooth device address and name are
2370  * given to Application via BLUETOOTH_EVENT_REMOTE_LE_DEVICE_FOUND event. In param_data of
2371  * bluetooth_event_param_t, you will receive a pointer to a structure of bluetooth_device_info_t type.
2372  * You will receive device address, device name, device class, rssi (received signal strength indicator).
2373  * please see bluetooth_device_info_t for more details.
2374  *
2375  * This function is a asynchronous call.
2376  * If the call is success then the application will receive BLUETOOTH_EVENT_LE_DISCOVERY_STARTED event
2377  * through registered callback function.
2378  *
2379  * The discovery is responded by an BLUETOOTH_EVENT_REMOTE_LE_DEVICE_FOUND event for each device it
2380  * found.
2381  *
2382  * The completion or cancellation of the discovery is indicated by an
2383  * BLUETOOTH_EVENT_LE_DISCOVERY_FINISHED event.
2384  *
2385  * The device discovery can be cancelled by calling bluetooth_stop_le_discovery().
2386  *
2387  *
2388  * @return      BLUETOOTH_ERROR_NONE - Success \n
2389  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Bluetooth adapter is not enabled \n
2390  *              BLUETOOTH_ERROR_DEVICE_BUSY - Bluetooth adapter is busy doing some operation \n
2391  *              BLUETOOTH_ERROR_INTERNAL - System error like heap full has occured or bluetooth
2392                                                 agent is not running \n
2393  *
2394  * @remark      None
2395  * @see         bluetooth_stop_le_discovery, bluetooth_device_info_t
2396
2397 @code
2398 void bt_event_callback(int event, bluetooth_event_param_t *param)
2399 {
2400         switch(event)
2401         {
2402                 case BLUETOOTH_EVENT_REMOTE_LE_DEVICE_FOUND:
2403                 {
2404                         bluetooth_device_info_t *device_info = NULL;
2405                         printf("BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND, result [0x%04x]",
2406                                         param->result);
2407                         device_info  = (bluetooth_device_info_t *)param->param_data;
2408                         memcpy(&searched_device, &device_info->device_address,
2409                                                 sizeof(bluetooth_device_address_t));
2410                         printf("dev [%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X]",
2411                                 device_info->device_address.addr[0],
2412                                 device_info->device_address.addr[1],
2413                                 device_info->device_address.addr[2],
2414                                 device_info->device_address.addr[3],
2415                                 device_info->device_address.addr[4],
2416                                 device_info->device_address.addr[5]);
2417                         break;
2418                 }
2419
2420                 case BLUETOOTH_EVENT_LE_DISCOVERY_FINISHED:
2421                         printf("BLUETOOTH_EVENT_LE_DISCOVERY_FINISHED, result[0x%04x]", param->result);
2422                         break;
2423         }
2424 }
2425
2426 int ret = 0;
2427 ret = bluetooth_start_discovery();
2428
2429 @endcode
2430  *
2431  */
2432 int bluetooth_start_le_discovery(void);
2433
2434 /**
2435  * @fn int bluetooth_stop_le_discovery (void)
2436  * @brief Cancel the on-going device LE discovery operation
2437  *
2438  *
2439  * This function stops the on-going device discovery operation. This API has to be called after the
2440  * bluetooth_start_le_discovery API and before the BLUETOOTH_EVENT_LE_DISCOVERY_FINISHED event comes of
2441  * the bluetooth_start_le_discovery API
2442  *
2443  *
2444  * This function is a asynchronous call.
2445  * If the call is success to cancel discovey then the application will receive
2446  * BLUETOOTH_EVENT_LE_DISCOVERY_FINISHED event through registered callback function
2447  * with an error code BLUETOOTH_ERROR_CANCEL. In the case of failure the error code will be
2448  * BLUETOOTH_ERROR_NONE
2449  *
2450  *
2451  * @return      BLUETOOTH_ERROR_NONE - Success \n
2452  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
2453  *              BLUETOOTH_ERROR_NOT_IN_OPERATION - No Discovery operation in progess to cancel \n
2454  *              BLUETOOTH_ERROR_ACCESS_DENIED - Currently in discovery but it is requested from
2455                                                 other application \n
2456  *              BLUETOOTH_ERROR_INTERNAL - Internel IPC error \n
2457  * @remark      None
2458  * @see         bluetooth_start_discovery
2459 @code
2460 void bt_event_callback(int event, bluetooth_event_param_t *param)
2461 {
2462         switch(event)
2463         {
2464                 case BLUETOOTH_EVENT_LE_DISCOVERY_FINISHED:
2465                         TC_PRT("BLUETOOTH_EVENT_LE_DISCOVERY_FINISHED, result[0x%04x]", param->result);
2466                         break;
2467         }
2468 }
2469
2470 ..
2471
2472 int ret = 0;
2473
2474 ret = bluetooth_stop_le_discovery();
2475 @endcode
2476  */
2477 int bluetooth_stop_le_discovery(void);
2478
2479 /**
2480  * @fn int bluetooth_is_discovering(void)
2481  * @brief Check for the device discovery is in-progress or not.
2482  *
2483  * This API is used to check the current status of the Discovery operation.If discovery is in\
2484  * progress normally other operations are not allowed.
2485  * If a device discovery is in progress, we have to either cancel the discovery operation or wait
2486  * for the BLUETOOTH_EVENT_DISCOVERY_FINISHED
2487  * event before performing other operations. This API is used to get for the current discovery
2488  * operation status and using bluetooth_cancel_discovery()
2489  * we can cancell the ongoing discovery process.
2490  * Before calling this API, make sure that the adapter is enabled. There is no callback event for
2491  * this API.
2492  *
2493  * This function checks whether the device discovery is started or not.
2494  *
2495  * This function is a synchronous call.
2496  *
2497  *
2498  * @return      BLUETOOTH_ERROR_NONE - Discovery is not in progress \n
2499  *              BLUETOOTH_ERROR_NONE+1 - Discovery in progress \n
2500  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
2501  *
2502  * @remark      None
2503  * @see         bluetooth_start_discovery, bluetooth_cancel_discovery
2504
2505 @code
2506 int ret = 0;
2507 ret = bluetooth_is_discovering ();
2508 @endcode
2509  */
2510 int bluetooth_is_discovering(void);
2511
2512 /**
2513  * @fn int bluetooth_is_le_discovering(void)
2514  * @brief Check for the device LE discovery is in-progress or not.
2515  *
2516  * This API is used to check the current status of the LE Discovery operation.If discovery is in\
2517  * progress normally other operations are not allowed.
2518  * If a device discovery is in progress, we have to either cancel the discovery operation or wait
2519  * for the BLUETOOTH_EVENT_LE_DISCOVERY_FINISHED
2520  * event before performing other operations. This API is used to get for the current discovery
2521  * operation status and using bluetooth_stop_le_discovery()
2522  * we can cancell the ongoing LE discovery process.
2523  * Before calling this API, make sure that the adapter is enabled. There is no callback event for
2524  * this API.
2525  *
2526  * This function checks whether the device  LE discovery is started or not.
2527  *
2528  * This function is a synchronous call.
2529  *
2530  *
2531  * @return      BLUETOOTH_ERROR_NONE - Discovery is not in progress \n
2532  *              BLUETOOTH_ERROR_NONE+1 - Discovery in progress \n
2533  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
2534  *
2535  * @remark      None
2536  * @see         bluetooth_start_le_discovery, bluetooth_stop_le_discovery
2537
2538 @code
2539 int ret = 0;
2540 ret = bluetooth_is_le_discovering ();
2541 @endcode
2542  */
2543 int bluetooth_is_le_discovering(void);
2544
2545 /**
2546  * @fn int bluetooth_is_le_scanning(void)
2547  * @brief Check for the device LE scan is in-progress or not.
2548  *
2549  * This API is used to check the current status of the LE Scan operation.If discovery is in\
2550  * progress normally other operations are not allowed.
2551  *
2552  * This function checks whether the device  LE Scan is started or not.
2553  *
2554  * This function is a synchronous call.
2555  *
2556  * @return   TRUE  - LE Scan in progress \n
2557  *              FALSE - LE Scan is not in progress \n
2558  *
2559  * @remark      None
2560
2561 @code
2562 gboolean is_le_scanning = 0;
2563 is_le_scanning = bluetooth_is_le_scanning ();
2564 @endcode
2565  */
2566 gboolean bluetooth_is_le_scanning(void);
2567
2568 /**
2569  * @fn int bluetooth_register_scan_filter(bluetooth_le_scan_filter_t *filter, int *slot_id)
2570  * @brief Register scan filter.
2571  *
2572  * This function registers the scan filter.
2573  *
2574  * This function is a synchronous call.
2575  *
2576  * @return      BLUETOOTH_ERROR_NONE - Success \n
2577  *
2578  * @param[in]   filter   scan filter to register
2579  * @param[out]  slot_id  the slot ID of scan filter
2580  *
2581  * @remark      None
2582  */
2583 int bluetooth_register_scan_filter(bluetooth_le_scan_filter_t *filter, int *slot_id);
2584
2585 /**
2586  * @fn int bluetooth_unregister_scan_filter(int slot_id)
2587  * @brief Register scan filter.
2588  *
2589  * This function unregisters the scan filter.
2590  *
2591  * This function is a synchronous call.
2592  *
2593  * @return      BLUETOOTH_ERROR_NONE - Success \n
2594  *
2595  * @param[in]   slot_id  the slot ID of scan filter
2596  *
2597  * @remark      None
2598  */
2599 int bluetooth_unregister_scan_filter(int slot_id);
2600
2601 /**
2602  * @fn int bluetooth_unregister_all_scan_filters(void)
2603  * @brief Register scan filter.
2604  *
2605  * This function usregisters all scan filters.
2606  *
2607  * This function is a synchronous call.
2608  *
2609  * @return      BLUETOOTH_ERROR_NONE - Success \n
2610  *
2611  * @remark      None
2612  */
2613 int bluetooth_unregister_all_scan_filters(void);
2614
2615 /**
2616  * @fn int bluetooth_enable_rssi(const bluetooth_device_address_t *remote_address,
2617                 int link_type, bt_rssi_threshold_t rssi_threshold)
2618  * @brief Enable RSSI monitoring
2619  *
2620  * This function enables RSSI monitoring and sets threshold for a connection
2621  *
2622  * @return      BLUETOOTH_ERROR_NONE - Success \n
2623  *
2624  * @remark      None
2625  * @see bluetooth_get_rssi_strength
2626  */
2627 int bluetooth_enable_rssi(const bluetooth_device_address_t *remote_address,
2628                 int link_type, bt_rssi_threshold_t *rssi_threshold);
2629
2630 /**
2631  * @fn int bluetooth_get_rssi_strength(const bluetooth_device_address_t *remote_address, int link_type)
2632  * @brief Gets Raw RSSI signal Strength
2633  *
2634  * This function gives the Raw RSSI signal strength for a connection.
2635  *
2636  * @return      BLUETOOTH_ERROR_NONE - Success \n
2637  *
2638  * @remark      None
2639  * @see bluetooth_enable_rssi
2640  */
2641 int bluetooth_get_rssi_strength(const bluetooth_device_address_t *remote_address, int link_type);
2642
2643 int bluetooth_set_connectable(gboolean is_connectable);
2644
2645 int bluetooth_is_connectable(gboolean *is_connectable);
2646
2647 /**
2648  * @fn int bluetooth_bond_device(const bluetooth_device_address_t *device_address)
2649  * @brief Initiate a bonding process
2650  *
2651  *
2652  * This function initiates a bonding procedure with a peer device.  The bonding procedure
2653  * enables authentication and optionally encryption on the Bluetooth link.
2654  *
2655  * Bonding is applied to the discovered device to which we need a secure connection. We cannot
2656  * inititate the bonding request to the devices already in the paired list.
2657  *
2658  * Usually we call this API after the device discovery.
2659  * This function is a asynchronous call.
2660  *
2661  * Response will be received through BLUETOOTH_EVENT_BONDING_FINISHED event. It can any of the below
2662  * mentioed result code
2663  * BLUETOOTH_ERROR_PARING_FAILED - Pairing faied \n
2664  * BLUETOOTH_ERROR_ACCESS_DENIED - Authetication rejected \n
2665  * BLUETOOTH_ERROR_CANCEL_BY_USER - Cancelled by the user \n
2666  * BLUETOOTH_ERROR_PARING_FAILED - Pairing failed \n
2667  * BLUETOOTH_ERROR_TIMEOUT - Timeout has haapened \n
2668  *
2669  * If the remote user is not responding with in a specific time(60 seconds), then a timeout happens
2670  * and BLUETOOTH_EVENT_BONDING_FINISHED callback event is called with and BLUETOOTH_ERROR_TIMEOUT
2671  * result code
2672  *
2673  * The bonding operation can be cancelled by calling bluetooth_cancel_bonding().
2674  *
2675  *
2676  * @return      BLUETOOTH_ERROR_NONE - Success \n
2677  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
2678  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
2679  *              BLUETOOTH_ERROR_DEVICE_BUSY - Adapter is busy or Discovery is in Progress \n
2680  *              BLUETOOTH_ERROR_INVALID_DATA - Invalid BD address \n
2681  * @exception   None
2682  * @param[in]   device_address   This indicates an address of the device with which the pairing
2683  *                                      should be initiated
2684  * @remark      None
2685  * @see         bluetooth_cancel_bonding
2686  @code
2687 void bt_event_callback(int event, bluetooth_event_param_t *param)
2688 {
2689         switch(event)
2690         {
2691                 case BLUETOOTH_EVENT_BONDING_FINISHED:
2692                 {
2693                         TC_PRT("BLUETOOTH_EVENT_BONDING_FINISHED, result [0x%04x]", param->result);
2694                         if (param->result >= BLUETOOTH_ERROR_NONE)
2695                         {
2696                                 bluetooth_device_info_t *device_info = NULL;
2697                                 device_info  = (bluetooth_device_info_t *)param->param_data;
2698                                 printf("dev [%s] [%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X]
2699                                                         mjr[%#x] min[%#x] srv[%#x]",
2700                                                         device_info->device_name.name,
2701                                                         device_info->device_address.addr[0],
2702                                                         device_info->device_address.addr[1],
2703                                                         device_info->device_address.addr[2],
2704                                                         device_info->device_address.addr[3],
2705                                                         device_info->device_address.addr[4],
2706                                                         device_info->device_address.addr[5],
2707                                                         device_info->device_class.major_class,
2708                                                         device_info->device_class.minor_class,
2709                                                         device_info->device_class.service_class);
2710                         }
2711                         else
2712                         {
2713                                 //bonding failed
2714                         }
2715                         break;
2716                 }
2717         }
2718 }
2719
2720 ...
2721
2722 int ret = 0;
2723 bluetooth_device_address_t device_address={{0}};
2724
2725 ret = bluetooth_bond_device(&device_address);
2726
2727 @endcode
2728  */
2729 int bluetooth_bond_device(const bluetooth_device_address_t *device_address);
2730
2731 /**
2732  * @fn int bluetooth_bond_device_by_type(const bluetooth_device_address_t *device_address,
2733  *                              bluetooth_conn_type_t conn_type)
2734  * @brief Initiate a bonding process
2735  *
2736  *
2737  * This function initiates a bonding procedure with a peer device on the basis of connection type (BLE or BREDR).
2738  * The bonding procedure enables authentication and optionally encryption on the Bluetooth link.
2739  *
2740  * Bonding is applied to the discovered device to which we need a secure connection. We cannot
2741  * inititate the bonding request to the devices already in the paired list.
2742  *
2743  * Usually we call this API after the device discovery.
2744  * This function is a asynchronous call.
2745  *
2746  * Response will be received through BLUETOOTH_EVENT_BONDING_FINISHED event. It can any of the below
2747  * mentioed result code
2748  * BLUETOOTH_ERROR_PARING_FAILED - Pairing faied \n
2749  * BLUETOOTH_ERROR_ACCESS_DENIED - Authetication rejected \n
2750  * BLUETOOTH_ERROR_CANCEL_BY_USER - Cancelled by the user \n
2751  * BLUETOOTH_ERROR_PARING_FAILED - Pairing failed \n
2752  * BLUETOOTH_ERROR_TIMEOUT - Timeout has haapened \n
2753  *
2754  * If the remote user is not responding with in a specific time(60 seconds), then a timeout happens
2755  * and BLUETOOTH_EVENT_BONDING_FINISHED callback event is called with and BLUETOOTH_ERROR_TIMEOUT
2756  * result code
2757  *
2758  * The bonding operation can be cancelled by calling bluetooth_cancel_bonding().
2759  *
2760  *
2761  * @return BLUETOOTH_ERROR_NONE - Success \n
2762  *             BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
2763  *             BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
2764  *             BLUETOOTH_ERROR_DEVICE_BUSY - Adapter is busy or Discovery is in Progress \n
2765  *             BLUETOOTH_ERROR_INVALID_DATA - Invalid BD address \n
2766  * @exception None
2767  * @param[in] device_address This indicates an address of the device with which pairing
2768  *                                        should be initiated
2769  * @param[in] conn_type This Indicates the connection type to be used for pairing in case of
2770  *                                 dual mode devices
2771  * @remark None
2772  * @see bluetooth_cancel_bonding
2773  */
2774 int bluetooth_bond_device_by_type(const bluetooth_device_address_t *device_address,
2775                                 bluetooth_conn_type_t conn_type);
2776
2777 /**
2778  * @fn int bluetooth_cancel_bonding(void)
2779  * @brief Cancel the on-going bonding process
2780  *
2781  * This API is called to cancel the on-going bonding procedure. It should be called before the
2782  * BLUETOOTH_EVENT_BONDING_FINISHED event comes.
2783  * This API is useful when the remote device is not responding to the bond request or we wish to
2784  * cancel the bonding request. In this case we need not wait for the timeout to happen.
2785  *
2786  * This function is a synchronous call.
2787  *
2788  * @return      BLUETOOTH_ERROR_NONE - Success \n
2789  *              BLUETOOTH_ERROR_NOT_IN_OPERATION - No bonding request in progress \n
2790  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
2791  * @exception   None
2792  * @remark      None
2793  * @see         bluetooth_bond_device
2794 @code
2795 ...
2796
2797 int ret = 0;
2798
2799 ret = bluetooth_cancel_bonding();
2800 @endcode
2801  */
2802 int bluetooth_cancel_bonding(void);
2803
2804 /**
2805  * @fn int bluetooth_unbond_device(const bluetooth_device_address_t *device_address)
2806  * @brief Remove bonding
2807  *
2808  *
2809  * To communicate with remote device over bluetooth link, user should bond with peer device.
2810  * After bonding is over, peer device is added to list of bonded devices. bluetooth_unbond_device()
2811  * API is used to remove peer device from the list. Please note that after removing the device
2812  * from bonded device list, you cannot communication with peer device until bonding happens again.
2813  *
2814  * User can call this function by passing bluetooth device address of any bonded device. Please note
2815  * that after successful return of this function, any bluetooth application running on your device
2816  * will not be able to communicate with unbonded device until bond operation happens again using
2817  * bluetooth_bond_device()
2818  *
2819  *
2820  * This function is a asynchronous call. The request to remove the specified device from the bonded
2821  * list is responded by an BLUETOOTH_EVENT_BONDED_DEVICE_REMOVED event. if the operation is success,
2822  * you will receive BLUETOOTH_ERROR_NONE. BLUETOOTH_ERROR_NOT_PAIRED may be received in result code
2823  * in case if there is a problem in locating given bluetooth device address in bonded devices list
2824  *
2825  *
2826  *
2827  * @return      BLUETOOTH_ERROR_NONE - Success \n
2828  *              BLUETOOTH_ERROR_INVALID_PARAM - Device address is not valid \n
2829  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Bluetooth adapter is not enabled \n
2830  *              BLUETOOTH_ERROR_DEVICE_BUSY     - Bluetooth adapter is busy doing some operation \n
2831  *              BLUETOOTH_ERROR_INVALID_DATA - Device address provided is incorrect \n
2832  *              BLUETOOTH_ERROR_INTERNAL - System error like heap full has occured or bluetooth
2833  *                                              agent is not running \n
2834  *              BLUETOOTH_ERROR_NOT_PAIRED - Device address mentioned in the argument is not a
2835  *                                              bonded device \n
2836  *
2837  * @param[in]   device_address   This indicates an address of the device to remove bonding
2838  *
2839  * @remark      None
2840  *
2841  * @see         bluetooth_bond_device, bluetooth_cancel_bonding
2842  *
2843 @code
2844 void bt_event_callback(int event, bluetooth_event_param_t *param)
2845 {
2846         switch(event) {
2847                 case BLUETOOTH_EVENT_BONDED_DEVICE_REMOVED: {
2848                         bluetooth_device_address_t *dev_addr = NULL;
2849
2850                         if (param->result == BLUETOOTH_ERROR_NONE) {
2851                                 dev_addr = (bluetooth_device_address_t *)param->param_data;
2852                                 //Unbound scuccess
2853                                 printf("%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n",
2854                                         dev_addr->addr[0], dev_addr->addr[1]
2855                                         dev_addr->addr[2], dev_addr->addr[3]
2856                                         dev_addr->addr[4], dev_addr->addr[5]
2857                         } else {
2858                                 //unbound failure
2859                         }
2860                 }
2861         }
2862 }
2863
2864 ...
2865
2866 int ret = 0;
2867 bluetooth_device_address_t *device_address;
2868
2869 // copy valid device address in device_address
2870
2871 ret = bluetooth_unbond_device(device_address);
2872 @endcode
2873  */
2874 int bluetooth_unbond_device(const bluetooth_device_address_t *device_address);
2875
2876 /**
2877  * @fn int bluetooth_get_bonded_device_list(GPtrArray **dev_list)
2878  * @brief Get bonded(paired) device list
2879  *
2880  *
2881  * This API gets all bonded device list.
2882  * The devices in the bonded device list further can be used to perform the authorization by calling
2883  * bluetooth_authorize_device API.
2884  *
2885  * This function is a synchronous call.
2886  * Information for bonded devices can be obtained when result code is BLUETOOTH_ERROR_NONE. If not,
2887  * there is no valid information in the dev_list.
2888  * The len field in the dev_list represents the number of bonded devices. The data structure for
2889  * bonded device information is bluetooth_device_info_t.
2890  *
2891  *
2892  * @return      BLUETOOTH_ERROR_NONE - Success \n
2893  *              BLUETOOTH_ERROR_NOT_SUPPORT - Opreation not supported \n
2894  * @remark      None
2895  * @see         bluetooth_bond_device, bluetooth_unbond_device, bluetooth_authorize_device
2896  @code
2897 void bt_get_bonded_devices(void)
2898 {
2899 ...
2900         int i;
2901         GPtrArray *devinfo = NULL;
2902         bluetooth_device_info_t *ptr;
2903
2904         // allocate the g_pointer_array
2905         devinfo = g_ptr_array_new();
2906
2907         ret = bluetooth_get_bonded_device_list(&devinfo);
2908         if (ret != BLUETOOTH_ERROR_NONE)
2909         {
2910                 printf("bluetooth_get_bonded_device_list failed with [%d]",ret);
2911         }
2912         else
2913         {
2914                 printf("g pointer arrary count : [%d]", devinfo->len);
2915                 for (i=0; i<devinfo->len; i++)
2916                 {
2917                         ptr = g_ptr_array_index(devinfo, i);
2918                         if (ptr != NULL)
2919                         {
2920                                 printf("Name [%s]\n", ptr->device_name.name);
2921                                 printf("Major Class [%d]\n", ptr->device_class.major_class);
2922                                 printf("Minor Class [%d]\n", ptr->device_class.minor_class);
2923                                 printf("Service Class [%d]\n", ptr->device_class.service_class);
2924                                 printf("%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n",
2925                                                                 ptr->device_address.addr[0],
2926                                 ptr->device_address.addr[1], ptr->device_address.addr[2],
2927                                                                 ptr->device_address.addr[3],
2928                                 ptr->device_address.addr[4], ptr->device_address.addr[5]);
2929
2930                                 // handle
2931                                 ...
2932                         }
2933                 }
2934         }
2935         // free g_pointer_array
2936         g_ptr_array_free(devinfo, TRUE);
2937 }
2938
2939 @endcode
2940  */
2941 int bluetooth_get_bonded_device_list(GPtrArray **dev_list);
2942
2943 /**
2944  * @fn int bluetooth_get_bonded_device(const bluetooth_device_address_t *device_address,
2945  *                                      bluetooth_device_info_t *dev_info)
2946  * @brief Get a bonded(paired) device
2947  *
2948  *
2949  * This API gets a bonded device.
2950  *
2951  * This function is a synchronous call.
2952  * Information for bonded devices can be obtained when result code is BLUETOOTH_ERROR_NONE. If not,
2953  * there is no valid information in the dev_info.
2954  * The data structure for bonded device information is bluetooth_device_info_t.
2955  *
2956  *
2957  * @return      BLUETOOTH_ERROR_NONE - Success \n
2958  *              BLUETOOTH_ERROR_NOT_SUPPORT - Opreation not supported \n
2959  * @remark      None
2960  * @see         bluetooth_bond_device, bluetooth_unbond_device, bluetooth_authorize_device
2961  @code
2962 void bt_get_bonded_device(void)
2963 {
2964 ...
2965         int i;
2966         bluetooth_device_info_t devinfo = {0};
2967         bluetooth_device_address_t device_address={{0x00,0x1C,0x43,0x2B,0x1A,0xE5}};
2968
2969         ret = bluetooth_get_bonded_device(&device_address, &devinfo);
2970         if (ret != BLUETOOTH_ERROR_NONE)
2971         {
2972                 printf("bluetooth_get_bonded_device failed with [%d]",ret);
2973         }
2974         else
2975         {
2976                 printf("Name [%s]\n", devinfo.device_name.name);
2977                 printf("Major Class [%d]\n", devinfo.device_class.major_class);
2978                 printf("Minor Class [%d]\n", devinfo.device_class.minor_class);
2979                 printf("Service Class [%d]\n", devinfo.device_class.service_class);
2980                 printf("%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n", devinfo.device_address.addr[0],
2981                 devinfo.device_address.addr[1], devinfo.device_address.addr[2],
2982                 devinfo.device_address.addr[3], devinfo.device_address.addr[4],
2983                 devinfo.device_address.addr[5]);
2984
2985                 // handle
2986                 ...
2987         }
2988 }
2989
2990 @endcode
2991  */
2992 int bluetooth_get_bonded_device(const bluetooth_device_address_t *device_address,
2993                                         bluetooth_device_info_t *dev_info);
2994
2995 /**
2996  * @fn int bluetooth_set_alias(const bluetooth_device_address_t *device_address, const char *alias)
2997  * @brief set alias for bonded device
2998  *
2999  *
3000  * This function set alias for bonded device.
3001  *
3002  * This function is a synchronous call.
3003  *
3004  *
3005  * @return      BLUETOOTH_ERROR_NONE - Success \n
3006  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3007  * @param[in]   device_address   This indicates an address of the remote device
3008  * @param[in]   alias                   This indicates an alias to set
3009  * @remark      None
3010  * @see         None
3011 @code
3012 int ret = 0;
3013 ret = bluetooth_set_alias(&remote_address);
3014 @endcode
3015  */
3016 int bluetooth_set_alias(const bluetooth_device_address_t *device_address,
3017                                 const char *alias);
3018
3019 /**
3020  * @fn int bluetooth_get_remote_device(const bluetooth_device_address_t *device_address)
3021  * @brief Get remote deivice
3022  *
3023  *
3024  * This function gets specific remote device.
3025  *
3026  * This function is a asynchronous call.
3027  * This API is responded by an BLUETOOTH_EVENT_REMOTE_DEVICE_READ event.
3028  *
3029  *
3030  * @return      BLUETOOTH_ERROR_NONE - Success \n
3031  *              BLUETOOTH_ERROR_NOT_SUPPORT - Operation not supported \n
3032  * @param[in]   device_address   This indicates an address of the remote device
3033  * @remark      None
3034  * @see         None
3035 @code
3036 int ret = 0;
3037 ret = bluetooth_get_remote_device(&remote_address);
3038 @endcode
3039  */
3040 int bluetooth_get_remote_device(const bluetooth_device_address_t *device_address);
3041
3042 /**
3043  * @fn int bluetooth_authorize_device(const bluetooth_device_address_t *device_address,
3044  *                                      gboolean authorized)
3045  * @brief Authorize/Unauthorize a bonded device
3046  *
3047  *
3048  * This function authorizes/unauthorize a bonded device. It decides the device to connect
3049  * with/without user confirmation.
3050  *
3051  * If we select a paired device and make it authorized by calling this API with the authorized
3052  * parameter to TRUE, then it will not ask for the user conformation before connecting. Similarly
3053  * if we unauthorize the paired device by calling this API with the authorized parameter to FALSE,
3054  * then it will ask for the user conformation before the connection.
3055  *
3056  * This API supposed to be called on the paired devices. Which means we have to use this API only
3057  * after successful pairing.
3058  *
3059  * This function is a asynchronous call.
3060  * Response will be received through BLUETOOTH_EVENT_DEVICE_AUTHORIZED event.
3061  *
3062  * @return      BLUETOOTH_ERROR_NONE - Success \n
3063  * @exception   BLUETOOTH_ERROR_INTERNAL - Cannot get the interal DBUS proxy \n
3064  * @param[in]   device_address   This indicates an address of the device to authorize \n
3065  * @param[in]   authorized      TRUE : authorize FALSE: unauthorize
3066  * @remark      None
3067  * @see         bluetooth_get_bonded_device_list
3068 @code
3069 void bt_event_callback(int event, bluetooth_event_param_t *param)
3070 {
3071         switch(event)
3072         {
3073                 case BLUETOOTH_EVENT_DEVICE_AUTHORIZED :
3074                 {
3075                         if (param->result == BLUETOOTH_ERROR_NONE)
3076                         {
3077                                 //Device authorized
3078                         }
3079                         //device authorization failed failure
3080                 }
3081         }
3082 }
3083
3084 ...
3085
3086 int ret = 0;
3087 bluetooth_device_address_t device_address={{0}};
3088 gboolean authorized;
3089
3090 authorized =TRUE;
3091
3092 ret = bluetooth_authorize_device(&device_address,authorized);
3093 @endcode
3094  */
3095 int bluetooth_authorize_device(const bluetooth_device_address_t *device_address,
3096                                        gboolean authorized);
3097
3098 int bluetooth_set_pin_code(const bluetooth_device_address_t *device_address,
3099                                 const bluetooth_device_pin_code_t *pin_code);
3100
3101 int bluetooth_unset_pin_code(const bluetooth_device_address_t *device_address);
3102
3103 /**
3104  * @fn int bluetooth_passkey_reply(char *passkey, gboolean reply)
3105  *
3106  * @brief Receives Legacy Passkey\pin with following authentication response types
3107  *
3108  * @param[in]   passkey : This is the PIN or PASSKEY string required for remote device authentication
3109  * @param[in]   reply    TRUE : Accept AUthentication FALSE: Cancels authentication
3110  *
3111  */
3112 int bluetooth_passkey_reply(char *passkey, gboolean reply);
3113
3114 /**
3115  * @fn int bluetooth_passkey_confirmation_reply(gboolean reply);
3116  *
3117  * @brief This API sends user confirmation reply to the local adapter.
3118  *
3119  * @param[in] reply TRUE : Accept AUthentication FALSE: Cancels authentication
3120  *
3121  */
3122 int bluetooth_passkey_confirmation_reply(gboolean reply);
3123
3124 /**
3125  * @fn int bluetooth_search_service(const bluetooth_device_address_t *device_address)
3126  * @brief Get all services supported by remote device
3127  *
3128  *
3129  * This API call initiates the search for the services supported by the specified device. Normally
3130  * the service search will take a couple of seconds to get it completed. Before calling this API
3131  * make sure that the Adapter is enabled. We have to give the device address of the remote device to
3132  * perform the service search. We can get the device address by doing a device discovery operation.
3133  *
3134  *
3135  * This function is a asynchronous call.
3136  * The service search request is responded by BLUETOOTH_EVENT_SERVICE_SEARCHED event.
3137  *
3138  * There is a timeout associated with the service search. The default time out is 40 seconds. If the
3139  * remove device did not respond with in the time out period the BLUETOOTH_EVENT_SERVICE_SEARCHED
3140  * event is generated with appropriate result code.
3141  *
3142  * @return      BLUETOOTH_ERROR_NONE - Success \n
3143  *              BLUETOOTH_ERROR_SERVICE_SEARCH_ERROR - Service search error (NULL device address) \n
3144  *              BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
3145  * @param[in]   device_address   This indicates an address of the device
3146  *                               whose services need to be found
3147  * @remark      None
3148  * @see         bluetooth_cancel_service_search
3149  */
3150 int bluetooth_search_service(const bluetooth_device_address_t *device_address);
3151
3152 /**
3153  * @fn int bluetooth_cancel_service_search(void)
3154  * @brief Cancel the ongoing service search operation
3155  *
3156  *
3157  * This function cancel the ongoing service search operation. This API is usually calling after the
3158  * bluetooth_search_service API.
3159  * Normally service search will take a more time (> 5 seconds) to complete. This API will be called
3160  * if the user wish to cancel the Ongoing service search operation.
3161  *
3162  * This API should be called just after the bluetooth_search_service API and before the
3163  * BLUETOOTH_EVENT_SERVICE_SEARCHED event
3164  *
3165  * This function is a synchronous call.
3166  *
3167  * @return      BLUETOOTH_ERROR_NONE - Success \n
3168  *              BLUETOOTH_ERROR_CANCEL - Error in service search cancel operation \n
3169  *              BLUETOOTH_ERROR_NOT_PAIRED - Not paired device \n
3170  *              BLUETOOTH_ERROR_NOT_IN_OPERATION - Searching service is not in operation \n
3171  *
3172  * @remark      None
3173  * @see         bluetooth_search_service
3174 @code
3175 ...
3176
3177 int ret = 0;
3178 ret = bluetooth_cancel_service_search();
3179 @endcode
3180 */
3181 int bluetooth_cancel_service_search(void);
3182
3183 /**
3184  * @fn int bluetooth_rfcomm_create_socket(const char *uuid)
3185  * @brief Register rfcomm socket with a specific uuid
3186  *
3187  *
3188  * This API register rfcomm socket with the given UUID. The return value of this API is the socket
3189  * descriptor of the server.
3190  * This is the first API which is called to create the server. Once we created the server socket,
3191  * we will listen on that return socket.
3192  * So a bluetooth_rfcomm_listen_and_accept should follow this API call. This is a synchronous call.
3193  *
3194  *
3195  * @return  socket FD on Success \n
3196  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
3197  *              BLUETOOTH_ERROR_INTERNAL - Internal error\n
3198  *              BLUETOOTH_ERROR_MAX_CONNECTION - Maximum connection reached\n
3199  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3200  * @param[in]   UUID (128 bits)
3201  *
3202  * @remark      None
3203  * @see       bluetooth_rfcomm_listen_and_accept, bluetooth_rfcomm_remove_socket
3204  *
3205  @code
3206
3207   const char *rfcomm_test_uuid="00001101-0000-1000-8000-00805F9B34FB";
3208   fd  = bluetooth_rfcomm_create_socket(rfcomm_test_uuid);
3209
3210  @endcode
3211  */
3212 int bluetooth_rfcomm_create_socket(const char *uuid);
3213
3214 /**
3215  * @fn int bluetooth_rfcomm_create_socket_ex(const char *uuid, const char *bus_name, const char *path)
3216  * @brief Register rfcomm socket with a specific uuid
3217  *
3218  *
3219  * This API register rfcomm socket with the given UUID. The return value of this API is the socket
3220  * descriptor of the server.
3221  * This is the first API which is called to create the server. Once we created the server socket,
3222  * we will listen on that return socket.
3223  * So a bluetooth_rfcomm_listen_and_accept_ex should follow this API call. This is a synchronous call.
3224  *
3225  *
3226  * @return  socket FD on Success \n
3227  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
3228  *              BLUETOOTH_ERROR_INTERNAL - Internal error\n
3229  *              BLUETOOTH_ERROR_MAX_CONNECTION - Maximum connection reached\n
3230  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3231  * @param[in]   UUID (128 bits)
3232  * @param[in]   bus_name (const char)
3233  * @param[in]   path (const char)
3234  *
3235  * @remark      None
3236  * @see       bluetooth_rfcomm_listen_and_accept_ex, bluetooth_rfcomm_remove_socket
3237  *
3238  @code
3239
3240   const char *rfcomm_test_uuid="00001101-0000-1000-8000-00805F9B34FB";
3241   fd  = bluetooth_rfcomm_create_socket_ex(rfcomm_test_uuid, bus_name, path);
3242
3243  @endcode
3244  */
3245 int bluetooth_rfcomm_create_socket_ex(const char *uuid, const char *bus_name, const char *path);
3246
3247 /**
3248  * @fn int bluetooth_rfcomm_remove_socket(int socket_fd, const char *uuid)
3249  * @brief De-register the rfcomm socket
3250  *
3251  *
3252  * This API deregister rfcomm socket with the given socket fd and  UUID. If the remote device is
3253  * already connected then we will receive the BLUETOOTH_EVENT_RFCOMM_DISCONNECTED with socket
3254  * descriptor else no event will come. We will call this API only after the
3255  * bluetooth_rfcomm_listen_and_accept.
3256  * This is a synchronous call.
3257  *
3258  * @return   BLUETOOTH_ERROR_NONE - Success \n
3259  *               BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
3260  *               BLUETOOTH_ERROR_NOT_FOUND - Cannot find the proxy\n
3261  *               BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3262  * @param[in]  int socket_fd
3263  *
3264  * @remark      None
3265  * @see       bluetooth_rfcomm_create_socket, bluetooth_rfcomm_listen_and_accept
3266  *
3267  @code
3268  void bt_event_callback(int event, bluetooth_event_param_t *param)
3269  {
3270         switch(event)
3271         {
3272                 case BLUETOOTH_EVENT_RFCOMM_DISCONNECTED:
3273                 {
3274                         bluetooth_rfcomm_connection_t *discon_ind =
3275                                         (bluetooth_rfcomm_connection_t *)param->param_data;
3276
3277                         printf("\nDisconnected from FD %d",  discon_ind->socket_fd);
3278                 }
3279         }
3280  }
3281
3282  ...
3283
3284  int ret = 0;
3285  fd  = bluetooth_rfcomm_create_socket(rfcomm_test_uuid);
3286  ret = bluetooth_rfcomm_listen_and_accept(fd, 1);
3287  ....
3288  ret = bluetooth_rfcomm_remove_socket(fd);
3289  @endcode
3290  */
3291 int bluetooth_rfcomm_remove_socket(int socket_fd);
3292
3293 /**
3294  * @fn int bluetooth_rfcomm_remove_socket(const char *uuid)
3295  * @brief De-register the rfcomm socket
3296  *
3297  *
3298  * This API deregister rfcomm socket with the given socket UUID. If the remote device is
3299  * already connected then we will receive the BLUETOOTH_EVENT_RFCOMM_DISCONNECTED with socket
3300  * descriptor else no event will come. We will call this API only after the
3301  * bluetooth_rfcomm_listen_and_accept_ex.
3302  * This is a synchronous call.
3303  *
3304  * @return   BLUETOOTH_ERROR_NONE - Success \n
3305  *               BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
3306  *               BLUETOOTH_ERROR_NOT_FOUND - Cannot find the proxy\n
3307  *               BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3308  * @param[in]   UUID (128 bits)
3309  *
3310  * @remark      None
3311  * @see       bluetooth_rfcomm_create_socket_ex, bluetooth_rfcomm_listen_and_accept_ex
3312  *
3313  @code
3314  void bt_event_callback(int event, bluetooth_event_param_t *param)
3315  {
3316         switch(event)
3317         {
3318                 case BLUETOOTH_EVENT_RFCOMM_DISCONNECTED:
3319                 {
3320                         bluetooth_rfcomm_connection_t *discon_ind =
3321                                         (bluetooth_rfcomm_connection_t *)param->param_data;
3322
3323                         printf("\nDisconnected from FD %d",  discon_ind->socket_fd);
3324                 }
3325         }
3326  }
3327
3328  ...
3329
3330  int ret = 0;
3331  fd  = bluetooth_rfcomm_create_socket_ex(rfcomm_test_uuid, path, bus_name);
3332  ret = bluetooth_rfcomm_listen_and_accept_ex(rfcomm_test_uuid, 1, bus_name, path);
3333  ....
3334  ret = bluetooth_rfcomm_remove_socket_ex(rfcomm_test_uuid);
3335  @endcode
3336  */
3337 int bluetooth_rfcomm_remove_socket_ex(const char *uuid);
3338
3339 /**
3340  * @fn int bluetooth_rfcomm_server_disconnect(int socket_fd)
3341  * @brief Disconnect rfcomm connection
3342  *
3343  *
3344  * Disconnect a specific(device node fd)  RFCOMM connection. This is a Synchronous call and there
3345  * is no cabbback events for this API. We have to provice the valid client fd to disconnect from the
3346  * remote server.
3347  *
3348  * @return   BLUETOOTH_ERROR_NONE  - Success \n
3349  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3350  *              BLUETOOTH_ERROR_NOT_CONNECTED - Not connected \n
3351  * @param[in]  int socket_fd the sending socket fd
3352  *
3353  * @remark      None
3354  *
3355  @code
3356
3357   ret = bluetooth_rfcomm_server_disconnect(g_ret_fd);
3358   if (ret < 0)
3359         printf("Disconnection failed");
3360   else
3361   printf("Disconnection Success");
3362
3363  @endcode
3364  */
3365 int bluetooth_rfcomm_server_disconnect(int socket_fd);
3366
3367 /**
3368  * @fn int bluetooth_rfcomm_listen_and_accept(int socket_fd,int max_pending_connection)
3369  * @brief Rfcomm socket listen
3370  *
3371  *
3372  * This API make rfcomm socket listen and accept with socket. We will call this API immediatly
3373  * after the bluetooth_rfcomm_create_socket API.
3374  * This API listen for the incomming connection and once it receives a connection, it will give
3375  * BLUETOOTH_EVENT_RFCOMM_CONNECTED
3376  * event to the application. This is an Asynchronous API call.
3377  *
3378  *
3379  * @return  BLUETOOTH_ERROR_NONE - Success \n
3380  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3381  *              BLUETOOTH_ERROR_CONNECTION_ERROR - Listen failed \n
3382
3383  * @param[in]  int socket_fd
3384  * @param[in]  max pending connection.
3385  *
3386  * @remark      None
3387  * @see       bluetooth_rfcomm_create_socket
3388  *
3389   @code
3390   void bt_event_callback(int event, bluetooth_event_param_t* param)
3391  {
3392         switch(event)
3393         {
3394                 case BLUETOOTH_EVENT_RFCOMM_CONNECTED:
3395                 {
3396                         bluetooth_rfcomm_connection_t *conn_ind =
3397                                                 (bluetooth_rfcomm_connection_t *)param->param_data;
3398
3399                         printf("\nConnected from FD %d",  conn_ind->socket_fd);
3400                 }
3401         }
3402  }
3403
3404  ...
3405
3406  int ret = 0;
3407  fd  = bluetooth_rfcomm_create_socket(rfcomm_test_uuid);
3408  ret = bluetooth_rfcomm_listen_and_accept(fd, 1);
3409
3410  @endcode
3411  */
3412 int bluetooth_rfcomm_listen_and_accept(int socket_fd, int max_pending_connection);
3413
3414 /**
3415  * @fn int bluetooth_rfcomm_listen_and_accept_ex(const char *uuid, int max_pending_connection, const char *bus_name, const char *path)
3416  * @brief Rfcomm socket listen
3417  *
3418  *
3419  * This API make rfcomm socket listen and accept with socket. We will call this API immediatly
3420  * after the bluetooth_rfcomm_create_socket API.
3421  * This API listen for the incomming connection and once it receives a connection, it will give
3422  * BLUETOOTH_EVENT_RFCOMM_CONNECTED
3423  * event to the application. This is an Asynchronous API call.
3424  *
3425  *
3426  * @return  BLUETOOTH_ERROR_NONE - Success \n
3427  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3428  *              BLUETOOTH_ERROR_CONNECTION_ERROR - Listen failed \n
3429
3430  * @param[in]  int socket_fd
3431  * @param[in]  max pending connection.
3432  * @param[in]  name
3433  * @param[in]  path
3434  *
3435  * @remark      None
3436  * @see       bluetooth_rfcomm_create_socket_ex
3437  *
3438   @code
3439   void bt_event_callback(int event, bluetooth_event_param_t* param)
3440  {
3441         switch(event)
3442         {
3443                 case BLUETOOTH_EVENT_RFCOMM_CONNECTED:
3444                 {
3445                         bluetooth_rfcomm_connection_t *conn_ind =
3446                                                 (bluetooth_rfcomm_connection_t *)param->param_data;
3447
3448                         printf("\nConnected from FD %d",  conn_ind->socket_fd);
3449                 }
3450         }
3451  }
3452
3453  ...
3454
3455  int ret = 0;
3456  fd  = bluetooth_rfcomm_create_socket_ex(rfcomm_test_uuid);
3457  ret = bluetooth_rfcomm_listen_and_accept_ex(rfcomm_test_uuid, 1, bus_name, path);
3458
3459  @endcode
3460  */
3461
3462 int bluetooth_rfcomm_listen_and_accept_ex(const char *uuid, int max_pending_connection, const char *bus_name, const char *path);
3463
3464 /**
3465  * @fn int bluetooth_rfcomm_listen(int socket_fd,int max_pending_connection)
3466  * @brief Rfcomm socket listen
3467  *
3468  *
3469  * This API make rfcomm socket listen and accept with socket. We will call this API immediatly
3470  * after the bluetooth_rfcomm_create_socket API.
3471  * This API listen for the incomming connection and once it receives a connection, it will give
3472  * BLUETOOTH_EVENT_RFCOMM_AUTHORIZE
3473  * event to the application. This is an Asynchronous API call.
3474  *
3475  *
3476  * @return  BLUETOOTH_ERROR_NONE - Success \n
3477  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3478  *              BLUETOOTH_ERROR_CONNECTION_ERROR - Listen failed \n
3479
3480  * @param[in]  int socket_fd
3481  * @param[in]  max pending connection.
3482  *
3483  * @remark      None
3484  * @see       bluetooth_rfcomm_create_socket
3485  *
3486   @code
3487   void bt_event_callback(int event, bluetooth_event_param_t* param)
3488  {
3489         switch(event)
3490         {
3491                 case BLUETOOTH_EVENT_RFCOMM_AUTHORIZE:
3492                 {
3493                         char *name = (char *)param->param_data;
3494
3495                         printf("\nConnected from %s",  name);
3496
3497                         bluetooth_rfcomm_accept_connection();
3498                 }
3499         }
3500  }
3501
3502  ...
3503
3504  int ret = 0;
3505  fd  = bluetooth_rfcomm_create_socket(rfcomm_test_uuid);
3506  ret = bluetooth_rfcomm_listen(fd, 1);
3507
3508  @endcode
3509  */
3510 int bluetooth_rfcomm_listen(int socket_fd, int max_pending_connection);
3511
3512 /**
3513  * @fn int bluetooth_rfcomm_accept_connection()
3514  * @brief Accepts the authorization request indicated by the event
3515   * BLUETOOTH_EVENT_RFCOMM_AUTHORIZE.
3516  *
3517  * This function is a synchronous call.
3518  *
3519  * @return   BLUETOOTH_ERROR_NONE  - Success \n
3520  *              BLUETOOTH_ERROR_INTERNAL - Internal error \n
3521  *
3522  * @param[in]  the socket fd of the server
3523  * @param[out]  the socket fd of the client
3524  *
3525  * @exception   None
3526  * @remark       None
3527  * @see           bluetooth_rfcomm_reject_connection
3528  */
3529 int bluetooth_rfcomm_accept_connection(int server_fd);
3530
3531 /**
3532  * @fn int bluetooth_rfcomm_reject_connection()
3533  * @brief Rejects the authorization request indicated by the event
3534   * BLUETOOTH_EVENT_RFCOMM_AUTHORIZE.
3535  *
3536  * This function is a synchronous call.
3537  *
3538  * @return   BLUETOOTH_ERROR_NONE  - Success \n
3539  *              BLUETOOTH_ERROR_INTERNAL - Internal error \n
3540  *
3541  * @param[in]  the socket fd of the server
3542  *
3543  * @exception   None
3544  * @remark       None
3545  * @see           bluetooth_rfcomm_accept_connection
3546  */
3547 int bluetooth_rfcomm_reject_connection(int server_fd);
3548
3549 /**
3550  * @fn gboolean bluetooth_rfcomm_is_server_uuid_available(const char *uuid)
3551  * @brief Informs whether rfcomm server uuid is available or not.
3552  *
3553  * This function is a synchronous call.
3554  *
3555  * @return   TRUE  - RFCOMM uuid is available \n
3556  *              FALSE - RFCOMM uuid is not available \n
3557  *
3558  * @param[in]  uuid UUID string
3559  *
3560  * @exception   None
3561  *
3562  * @remark       None
3563  */
3564 gboolean bluetooth_rfcomm_is_server_uuid_available(const char *uuid);
3565
3566 /**
3567  * @fn int bluetooth_rfcomm_connect(const bluetooth_device_address_t  *remote_bt_address,
3568  *                                                                      const char *remote_uuid)
3569  * @brief Connect to the remote device rfcomm *
3570  *
3571  * Connect to a specific RFCOMM based service on a remote device UUID. This is a Async call. Once
3572  * the connection is successful callback BLUETOOTH_EVENT_RFCOMM_CONNECTED events is generated,
3573  * which contains the socket_fd, device role (RFCOMM_ROLE_SERVER/RFCOMM_ROLE_CLIENT), device addess
3574  * etc. The socket_fd can be further used to send the data. It better to do a sevice search before
3575  * initiating a connection.
3576  *
3577  * @return  BLUETOOTH_ERROR_NONE  - Success \n
3578  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
3579  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3580  *              BLUETOOTH_ERROR_CONNECTION_BUSY - Connection in progress \n
3581  *              BLUETOOTH_ERROR_INTERNAL - Internal Error\n
3582  * @param[in]  bluetooth_device_address_t remote bt_address
3583  * @param[in]  char remote uuid
3584  * @remark      None
3585  * @see         bluetooth_rfcomm_disconnect, bluetooth_rfcomm_write, bluetooth_search_service
3586  *
3587  @code
3588
3589  void bt_event_callback(int event, bluetooth_event_param_t *param)
3590  {
3591         switch(event)
3592         {
3593                 case BLUETOOTH_EVENT_SERVICE_SEARCHED:
3594                 {
3595                         if (param->result >= BLUETOOTH_ERROR_NONE)
3596                         {
3597                                 bt_sdp_info_t *bt_sdp_info=param->param_data;
3598
3599                                 printf("Dev add = %2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n",
3600                                         bt_sdp_info->device_addr.addr[0],
3601                                         bt_sdp_info->device_addr.addr[1],
3602                                         bt_sdp_info->device_addr.addr[2],
3603                                         bt_sdp_info->device_addr.addr[3],
3604                                         bt_sdp_info->device_addr.addr[4],
3605                                         bt_sdp_info->device_addr.addr[5]);
3606
3607                                         printf("Supported service list:\n");
3608                                         for(i=0; i<bt_sdp_info->service_index; i++)
3609                                                 printf("[%#x]\n",
3610                                                         bt_sdp_info->service_list_array[i]);
3611
3612                                 //Alternate method
3613                                 //ret = bluetooth_rfcomm_connect(bt_sdp_info->device_addr,
3614                                                                                 //rfcomm_test_uuid);
3615                         }
3616                         break;
3617                 }
3618                 case BLUETOOTH_EVENT_RFCOMM_CONNECTED:
3619                 {
3620                         bluetooth_rfcomm_connection_t *conn_ind =
3621                                                 (bluetooth_rfcomm_connection_t *)param->param_data;
3622
3623                         printf("\nConnected from FD %d, Role = %s",  conn_ind->socket_fd,
3624                                                 (conn_ind->device_role == RFCOMM_ROLE_SERVER) ?
3625                                                                         "SERVER" : "CLIENT");
3626                 }
3627         }
3628  }
3629
3630   bluetooth_device_address_t remote_address = {{0},};
3631   remote_address.addr[0] = 0x0; remote_address.addr[1] = 0x0A; remote_address.addr[2] = 0x3A;
3632   remote_address.addr[3]= 0x54; remote_address.addr[4] = 0x19;  remote_address.addr[5]= 0x36;
3633   ret = bluetooth_search_service(&remote_address);
3634  if (ret < 0)
3635         printf("Seach failed, Reason = %d", ret);
3636   else
3637          printf("Search Success, Ret = %d", ret);
3638
3639   ret = bluetooth_rfcomm_connect(&remote_address, rfcomm_test_uuid);
3640   if (ret < 0)
3641         printf("Connection failed, Reason = %d", ret);
3642   else
3643          printf("Connection Success, Ret = %d", ret);
3644
3645   @endcode
3646   */
3647 int bluetooth_rfcomm_connect(const bluetooth_device_address_t *remote_bt_address,
3648                                      const char *remote_uuid);
3649
3650 /**
3651  * @fn int bluetooth_rfcomm_disconnect(int socket_fd)
3652  * @brief Disconnect rfcomm connection
3653  *
3654  *
3655  * Disconnect a specific(device node fd)  RFCOMM connection. This is a Synchronous call and there
3656  * is no cabbback events for this API. We have to provice the valid client fd to disconnect from the
3657  * remote server.
3658  *
3659  * @return   BLUETOOTH_ERROR_NONE  - Success \n
3660  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3661  *              BLUETOOTH_ERROR_NOT_CONNECTED - Not connected \n
3662  * @param[in]  char remote bt_address
3663  *
3664  * @remark      None
3665  * @see         bluetooth_rfcomm_connect
3666  *
3667  @code
3668
3669   ret = bluetooth_rfcomm_disconnect(g_ret_fd);
3670   if (ret < 0)
3671         printf("Disconnection failed");
3672   else
3673   printf("Disconnection Success");
3674
3675  @endcode
3676  */
3677
3678 int bluetooth_rfcomm_disconnect(int socket_fd);
3679
3680 /**
3681  * @fn int bluetooth_rfcomm_write (int fd, const char *buff, int length)
3682  * @brief Write to rfcomm connection
3683  *
3684  *
3685  * This API is used to send the data over the rfcomm connection. This is a synchronous API. The same
3686  * API is used to send the data for server and the client.
3687  *
3688  * @return  BLUETOOTH_ERROR_NONE  - Success \n
3689  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3690  *              BLUETOOTH_ERROR_NOT_IN_OPERATION - The Fd is currently not in operation\n
3691  * @param[in]  int fd
3692  * @param[in]  const char *buff  Data buffer to send
3693  * @param[in]  int length Length of the data
3694  *
3695  * @remark      None
3696  * @see         bluetooth_rfcomm_connect
3697  *
3698   @code
3699   char *buff = "Test data 123456789"
3700   ret =  bluetooth_rfcomm_write(g_ret_fd, buff, 15);
3701   if (ret < 0)
3702         printf("Send failed");
3703   else
3704    printf("Send success");
3705
3706  @endcode
3707  */
3708 int bluetooth_rfcomm_write(int fd, const char *buf, int length);
3709
3710 /**
3711  * @fn gboolean bluetooth_rfcomm_is_client_connected(void)
3712  * @brief Informs whether rfcomm client is connected.
3713  *
3714  * This function is a synchronous call.
3715  *
3716  * @return   TRUE  - RFCOMM client is connected \n
3717  *              FALSE - RFCOMM client is not connected \n
3718  *
3719  * @exception   None
3720  *
3721  * @remark       None
3722  */
3723 gboolean bluetooth_rfcomm_is_client_connected(void);
3724 int bluetooth_rfcomm_client_is_connected(const bluetooth_device_address_t *device_address, gboolean *connected);
3725 int bluetooth_rfcomm_server_is_connected(const bluetooth_device_address_t *device_address, gboolean *connected);
3726
3727 /**
3728  * @fn int bluetooth_network_activate_server(void)
3729  * @brief Activate the NAP (Network Access Point) service
3730  *
3731  * This function is a asynchronous call.
3732  * The activate server request is responded by BLUETOOTH_EVENT_NETWORK_SERVER_ACTIVATED event.
3733  *
3734  * @return   BLUETOOTH_ERROR_NONE  - Success \n
3735  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3736  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
3737  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Not enabled \n
3738  *
3739  * @remark      None
3740   * @see        bluetooth_network_deactivate_server
3741  *
3742  */
3743 int bluetooth_network_activate_server(void);
3744
3745 /**
3746  * @fn int bluetooth_network_deactivate_server(void)
3747  * @brief Deactivate the NAP (Network Access Point) service
3748  *
3749  * This function is a asynchronous call.
3750  * The deactivate server request is responded by BLUETOOTH_EVENT_NETWORK_SERVER_DEACTIVATED event.
3751  *
3752  * @return   BLUETOOTH_ERROR_NONE  - Success \n
3753  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3754  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
3755  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Not enabled \n
3756  *
3757  * @remark      None
3758  * @see         bluetooth_network_activate_server
3759  *
3760  */
3761 int bluetooth_network_deactivate_server(void);
3762
3763 /**
3764  * @fn int bluetooth_network_connect(const bluetooth_device_address_t *device_address,
3765  *                                      bluetooth_network_role_t role,
3766  *                                      char  custom_uuid)
3767  * @brief Connect the network server in the peer
3768  *
3769  * This function is a asynchronous call.
3770  * The network connect request is responded by BLUETOOTH_EVENT_NETWORK_CONNECTED event.
3771  *
3772  * @return   BLUETOOTH_ERROR_NONE  - Success \n
3773  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3774  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
3775  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Not enabled \n
3776  *
3777  * @exception   None
3778  * @param[in]  device_address   This indicates an address of the device with which the pairing
3779  *                              should be initiated
3780  * @param[in]  role   The role to connect. PANU / GN / NAP / CUSTOM. If use the CUSTOM value,
3781  *                      need to use the third parameter.
3782  * @param[in]  custom_uuid   If use the CUSTOM value in second parameter, use this parameter to
3783  *                              connect. UUID string
3784  * @remark      None
3785  * @see         bluetooth_network_disconnect
3786  */
3787 int bluetooth_network_connect(const bluetooth_device_address_t *device_address,
3788                                       bluetooth_network_role_t role, char *custom_uuid);
3789
3790 /**
3791  * @fn int bluetooth_network_disconnect(const bluetooth_device_address_t *device_address,
3792  *                                                      bluetooth_network_role_t role,
3793  *                                                        char *custom_uuid)
3794  * @brief Connect the network server in the peer
3795  *
3796  * This function is a asynchronous call.
3797  * The network disconnect request is responded by BLUETOOTH_EVENT_NETWORK_CONNECTED event.
3798  *
3799  * @return   BLUETOOTH_ERROR_NONE  - Success \n
3800  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3801  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
3802  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Not enabled \n
3803  *
3804  * @exception   None
3805  * @param[in]   device_address   This indicates an address of the device with which the pairing
3806  *                                      should be initiated
3807  * @remark       None
3808  * @see         bluetooth_network_connect
3809  */
3810 int bluetooth_network_disconnect(const bluetooth_device_address_t *device_address);
3811
3812 /**
3813  * @fn int bluetooth_network_server_disconnect(const bluetooth_device_address_t *device_address)
3814  * @brief Disconnect the device from the network
3815  *
3816  * This function is an asynchronous call.
3817  * The network server disconnect request is responded by
3818  * BLUETOOTH_EVENT_NETWORK_SERVER_DISCONNECTED event.
3819  *
3820  * @return   BLUETOOTH_ERROR_NONE  - Success \n
3821  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3822  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
3823  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Not enabled \n
3824  *
3825  * @exception   None
3826  * @param[in]   device_address   This indicates an address of the connected client device
3827  * @remark       None
3828  * @see         bluetooth_network_activate_server
3829  */
3830 int bluetooth_network_server_disconnect(const bluetooth_device_address_t *device_address);
3831
3832 /*HDP - API's*/
3833
3834 /**
3835  * @fn int bluetooth_hdp_activate(unsigned short  data_type,
3836  *                                      bt_hdp_role_type_t role,
3837  *                                      bt_hdp_qos_type_t channel_type,
3838  *                                      char **app_handle)
3839  * @brief Activate the HDP service for a particular data type
3840  *
3841  * This function is a synchronous call.
3842  *
3843  * @return   BLUETOOTH_ERROR_NONE  - Success \n
3844  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3845  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
3846  *              BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
3847  *
3848  * @exception   None
3849  * @param[in]  data_type   The data type against corresponding service
3850  * @param[in]  role   The role of HDP. HDP_ROLE_SOURCE/HDP_ROLE_SINK.
3851  * @param[in]  channel_type   The QOS type for the channel.
3852  *                              HDP_QOS_RELIABLE/HDP_QOS_STREAMING/HDP_QOS_ANY.
3853  *                              For role = HDP_ROLE_SINK, the channel_type
3854  *                              should be HDP_QOS_ANY.
3855  * @param[out]  app_handle    The application handler against corresponding service
3856  * @remark       None
3857  * @see            bluetooth_hdp_deactivate
3858  */
3859 int bluetooth_hdp_activate(unsigned short  data_type,
3860                                 bt_hdp_role_type_t role,
3861                                 bt_hdp_qos_type_t channel_type,
3862                                 char **app_handle);
3863 /**
3864  * @fn int bluetooth_hdp_deactivate(const char *app_handle)
3865  * @brief Deactivate the HDP service for a particular service using the handler
3866  *
3867  * This function is a synchronous call.
3868  *
3869  * @return   BLUETOOTH_ERROR_NONE  - Success \n
3870  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3871  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
3872  *              BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
3873  *
3874  * @exception   None
3875  * @param[in]  app_handle   The application handler against corresponding service
3876  * @remark       None
3877  * @see            bluetooth_hdp_deactivate
3878  */
3879 int bluetooth_hdp_deactivate(const char *app_handle);
3880
3881 /**
3882  * @fn int bluetooth_hdp_send_data(unsigned int channel_id,
3883  *                                      const char *buffer, unsigned int size)
3884  * @brief Send data to the remote HDP device
3885  *
3886  * This function is a synchronous call.
3887  *
3888  * @return   BLUETOOTH_ERROR_NONE  - Success \n
3889  *             BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3890  *             BLUETOOTH_ERROR_INTERNAL - Internal Error \n
3891  *             BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
3892  *             BLUETOOTH_ERROR_NOT_IN_OPERATION - FD is invalid  \n
3893  *
3894  * @exception   None
3895  * @param[in]  channel_id   The channel id for the connection.
3896  * @param[in]  buffer   The pdu buffer.
3897  * @param[in]  size   Size of the buffer.
3898  * @remark       None
3899  * @see            bluetooth_hdp_connect
3900  */
3901 int bluetooth_hdp_send_data(unsigned int channel_id,
3902                                 const char *buffer, unsigned int size);
3903 /**
3904  * @fn int bluetooth_hdp_connect(const char *app_handle,
3905  *                              bt_hdp_qos_type_t channel_type,
3906  *                              const bluetooth_device_address_t *device_address)
3907  * @brief Connect to the remote device(Mainly used by source)
3908  *
3909  * This function is a asynchronous call.
3910  * The HDP activate is responded by BLUETOOTH_EVENT_HDP_CONNECTED event.
3911  *
3912  * @return   BLUETOOTH_ERROR_NONE  - Success \n
3913  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3914  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
3915  *              BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
3916  *              BLUETOOTH_ERROR_MEMORY_ALLOCATION -Memory allocation failed \n
3917  *
3918  * @exception   None
3919  * @param[in]  app_handle   The application handler against corresponding service
3920  * @param[in]  channel_type   The QOS type for the channel.
3921  *                              HDP_QOS_RELIABLE/HDP_QOS_STREAMING.
3922  * @param[in]  device_address   The remote device Bd address.
3923  *
3924  * @remark       None
3925  * @see            bluetooth_hdp_disconnect
3926  */
3927 int bluetooth_hdp_connect(const char *app_handle,
3928                         bt_hdp_qos_type_t channel_type,
3929                         const bluetooth_device_address_t *device_address);
3930 /**
3931  * @fn int bluetooth_hdp_disconnect(unsigned int channel_id,
3932  *                      const bluetooth_device_address_t *device_address)
3933  * @brief Disconnect from the remote device(Mainly used by source)
3934  *
3935  * This function is a asynchronous call.
3936  * The HDP activate is responded by BLUETOOTH_EVENT_HDP_DISCONNECTED event.
3937  *
3938  * @return   BLUETOOTH_ERROR_NONE  - Success \n
3939  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3940  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
3941  *              BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
3942   *              BLUETOOTH_ERROR_MEMORY_ALLOCATION -Memory allocation failed \n
3943  *
3944  * @exception   None
3945  * @param[in]  channel_id    The channel id for the connection.
3946  * @param[in]  device_address   The remote device Bd address.
3947  *
3948  * @remark       None
3949  * @see            bluetooth_hdp_connect
3950  */
3951 int bluetooth_hdp_disconnect(unsigned int channel_id,
3952                         const bluetooth_device_address_t  *device_address);
3953
3954
3955 /**
3956  * @fn int bluetooth_opc_init(void)
3957  * @brief Initialize OPP client.
3958  *
3959  * This function is a synchronous call.
3960  * No event corresponding to this api
3961  *
3962  * @return   BLUETOOTH_ERROR_NONE  - Success \n
3963  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
3964  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
3965  *              BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
3966   *             BLUETOOTH_ERROR_ACCESS_DENIED -Memory allocation failed \n
3967  *
3968  * @exception   None
3969  *
3970  * @remark       None
3971  * @see           bluetooth_opc_deinit
3972  */
3973 int bluetooth_opc_init(void);
3974
3975 /**
3976  * @fn int bluetooth_opc_deinit(void)
3977  * @brief Deinitialize OPP client.
3978  *
3979  * This function is a synchronous call.
3980  * No event corresponding to this api
3981  *
3982  * @return   BLUETOOTH_ERROR_NONE  - Success \n
3983  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
3984  *              BLUETOOTH_ERROR_ACCESS_DENIED -Memory allocation failed \n
3985  *
3986  * @exception   None
3987  *
3988  * @remark       None
3989  * @see           bluetooth_opc_init
3990  */
3991
3992  int bluetooth_opc_deinit(void);
3993
3994 /**
3995  * @fn int bluetooth_opc_push_files(bluetooth_device_address_t *remote_address,
3996                                         char **file_name_array)
3997  * @brief Send multiple files to a remote device.
3998  *
3999  * This function is a asynchronous call.
4000  * This api  is responded by BLUETOOTH_EVENT_OPC_CONNECTED event.
4001  *
4002  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4003  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
4004  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
4005  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4006  *              BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
4007  *              BLUETOOTH_ERROR_IN_PROGRESS -Already one push in progress \n
4008  *              BLUETOOTH_ERROR_ACCESS_DENIED - Not allowed by MDM policy \n
4009  *
4010  * @exception   None
4011  * @param[in]  device_address   The remote device Bd address.
4012  * @param[in]  file_name_array  Array of filepaths to be sent.
4013  *
4014  * @remark       None
4015  * @see          bluetooth_opc_cancel_push
4016  */
4017
4018 int bluetooth_opc_push_files(bluetooth_device_address_t *remote_address,
4019                                 char **file_name_array);
4020
4021 /**
4022  * @fn int bluetooth_opc_cancel_push(void)
4023  * @brief Cancels the ongoing file push.
4024  *
4025  * This function is a asynchronous call.
4026  * This api is responded with either BLUETOOTH_EVENT_OPC_CONNECTED or
4027  * BLUETOOTH_EVENT_OPC_TRANSFER_COMPLETED event.
4028  *
4029  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4030  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
4031  *              BLUETOOTH_ERROR_ACCESS_DENIED - No push in progress \n
4032  *
4033  * @exception   None
4034  *
4035  * @remark       None
4036  * @see           bluetooth_opc_push_files
4037  */
4038
4039 int bluetooth_opc_cancel_push(void);
4040
4041 /**
4042  * @fn gboolean bluetooth_opc_session_is_exist(void)
4043  * @brief Informs whether opc session exists or not.
4044  *
4045  * This function is a synchronous call.
4046  *
4047  * @return   TRUE  - OPC session exists \n
4048  *              FALSE - OPC session does not exist \n
4049  *
4050  * @exception   None
4051  *
4052  * @remark       None
4053  * @see          None
4054  */
4055
4056 gboolean bluetooth_opc_session_is_exist(void);
4057
4058 /**
4059  * @fn int bluetooth_opc_is_sending(gboolean *is_sending)
4060  * @brief Informs whether opc session exists or not.
4061  *
4062  * This function is a synchronous call.
4063  *
4064  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4065  *               BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Not enabled \n
4066  *               BLUETOOTH_ERROR_INTERNAL \n
4067  *
4068  * @exception   None
4069  * @param[out] is_sending The sending status: (@c TRUE = in sending , @c  false = not in sending)
4070  *
4071  * @remark       None
4072  * @see            None
4073  */
4074 int bluetooth_opc_is_sending(gboolean *is_sending);
4075
4076 /**
4077  * @fn int bluetooth_obex_server_init(const char *dst_path)
4078  * @brief Initialize OPP and FTP server.
4079  *
4080  * This function is a synchronous call.
4081  * No event corresponding to this api
4082  *
4083  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4084  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
4085  *              BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
4086  *              BLUETOOTH_ERROR_AGENT_ALREADY_EXIST - Obex agent already registered \n
4087  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
4088  *
4089  * @exception   None
4090  * @param[in]  dst_path   OPS destination file path.
4091  * @remark       None
4092  * @see           bluetooth_obex_server_deinit
4093  */
4094 int bluetooth_obex_server_init(const char *dst_path);
4095
4096
4097 /**
4098  * @fn int bluetooth_obex_server_deinit(void)
4099  * @brief Deinitialize OPP and FTP server.
4100  *
4101  * This function is a synchronous call.
4102  * No event corresponding to this api
4103  *
4104  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4105  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
4106  *              BLUETOOTH_ERROR_AGENT_DOES_NOT_EXIST -Obex agent not registered \n
4107  *
4108  * @exception   None
4109  *
4110  * @remark       None
4111  * @see           bluetooth_obex_server_init
4112  */
4113 int bluetooth_obex_server_deinit(void);
4114
4115
4116 /**
4117  * @fn gboolean bluetooth_obex_server_is_activated(void)
4118  * @brief Informs whether obex server is activated or not.
4119  *
4120  * This function is a synchronous call.
4121  *
4122  * @return   TRUE  - OBEX server is activated \n
4123  *              FALSE - OBEX server is not activated \n
4124  *
4125  * @exception   None
4126  *
4127  * @remark       None
4128  */
4129
4130 gboolean bluetooth_obex_server_is_activated(void);
4131
4132
4133 /**
4134  * @fn int bluetooth_obex_server_init_without_agent(const char *dst_path)
4135  * @brief Initialize OPP and FTP server without the conneciton authorization of the agent
4136  *
4137  * This function is a synchronous call.
4138  * No event corresponding to this api
4139  *
4140  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4141  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
4142  *              BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
4143  *              BLUETOOTH_ERROR_AGENT_ALREADY_EXIST - Obex agent already registered \n
4144  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
4145  *
4146  *
4147  * @exception   None
4148  * @param[in]  dst_path   OPS destination file path.
4149  * @remark       None
4150  * @see           bluetooth_obex_server_deinit_without_agent
4151  */
4152 int bluetooth_obex_server_init_without_agent(const char *dst_path);
4153
4154
4155 /**
4156  * @fn int bluetooth_obex_server_deinit_without_agent(void)
4157  * @brief Deinitialize OPP and FTP server without the conneciton authorization of the agent
4158  *
4159  * This function is a synchronous call.
4160  * No event corresponding to this api
4161  *
4162  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4163  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
4164  *              BLUETOOTH_ERROR_AGENT_DOES_NOT_EXIST -Obex agent not registered \n
4165  *
4166  * @exception   None
4167  *
4168  * @remark       None
4169  * @see           bluetooth_obex_server_init_without_agent
4170  */
4171 int bluetooth_obex_server_deinit_without_agent(void);
4172
4173
4174 /**
4175  * @fn int bluetooth_obex_server_accept_connection(void)
4176  * @brief Accepts the authorization request indicated by the event
4177   * BLUETOOTH_EVENT_OBEX_SERVER_CONNECTION_AUTHORIZE.
4178  *
4179  * This function is a synchronous call.
4180  *
4181  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4182  *              BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
4183  *              BLUETOOTH_ERROR_INTERNAL - Internal error \n
4184  *
4185  * @exception   None
4186  * @remark       None
4187  * @see           bluetooth_obex_server_reject_authorize
4188  */
4189 int bluetooth_obex_server_accept_connection(void);
4190
4191
4192 /**
4193  * @fn int bluetooth_obex_server_reject_connection(void)
4194  * @brief Rejects the authorization request indicated by the event
4195   * BLUETOOTH_EVENT_OBEX_SERVER_CONNECTION_AUTHORIZE.
4196  *
4197  * This function is a synchronous call.
4198  *
4199  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4200  *              BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
4201  *              BLUETOOTH_ERROR_INTERNAL - Internal error \n
4202  *
4203  * @exception   None
4204  * @remark       None
4205  * @see           bluetooth_obex_server_reject_authorize
4206  */
4207 int bluetooth_obex_server_reject_connection(void);
4208
4209
4210 /**
4211  * @fn int bluetooth_obex_server_accept_authorize(const char *filename)
4212  * @brief Accepts the authorization request indicated by the event
4213   * BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_AUTHORIZE.
4214  *
4215  * This function is a asynchronous call.
4216  * This api will be responded with the event BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_STARTED.
4217  *
4218  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4219  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
4220  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
4221  *              BLUETOOTH_ERROR_AGENT_DOES_NOT_EXIST -Obex agent not registered \n
4222  *
4223  * @exception   None
4224  * @param[in]  filename   Authorized filename.
4225
4226  * @remark       None
4227  * @see           bluetooth_obex_server_reject_authorize
4228  */
4229
4230 int bluetooth_obex_server_accept_authorize(const char *filename);
4231
4232 /**
4233  * @fn int bluetooth_obex_server_reject_authorize(void)
4234  * @brief Reject the authorization request indicated by the event
4235   * BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_AUTHORIZE.
4236  *
4237  * This function is a asynchronous call.
4238  * No event for this api..
4239  *
4240  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4241  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
4242  *              BLUETOOTH_ERROR_AGENT_DOES_NOT_EXIST -Obex agent not registered \n
4243  *
4244  * @exception   None
4245
4246  * @remark       None
4247  * @see           bluetooth_obex_server_accept_authorize
4248  */
4249
4250 int bluetooth_obex_server_reject_authorize(void);
4251
4252 /**
4253  * @fn int bluetooth_obex_server_set_destination_path(const char *dst_path)
4254  * @brief Set the OPS destination file path..
4255  *
4256  * This function is a asynchronous call.
4257  * No event for this api..
4258  *
4259  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4260  *              BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
4261  *              BLUETOOTH_ERROR_AGENT_DOES_NOT_EXIST -Obex agent not registered \n
4262  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid Param \n
4263  *
4264  * @exception   None
4265  * @param[in]  dst_path   OPS destination file path.
4266
4267  * @remark       None
4268  * @see          None
4269  */
4270
4271 int bluetooth_obex_server_set_destination_path(const char *dst_path);
4272
4273 /**
4274  * @fn int bluetooth_obex_server_set_root(const char *root)
4275  * @brief Set the FTS root folder..
4276  *
4277  * This function is a asynchronous call.
4278  * No event for this api..
4279  *
4280  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4281  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
4282  *              BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
4283  *              BLUETOOTH_ERROR_ACCESS_DENIED - Operation not allowed \n
4284  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
4285  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4286  *
4287  * @exception  None
4288  * @param[in]   root   FTS root folder.
4289
4290  * @remark       None
4291  * @see          None
4292  */
4293
4294 int bluetooth_obex_server_set_root(const char *root);
4295
4296 /**
4297  * @fn int bluetooth_obex_server_cancel_transfer(int transfer_id)
4298  * @brief Cancel the transfer on server
4299  *
4300  * This function is an asynchronous call.
4301  * If the function call that cancels transfer is successful, the application would receive
4302  * BLUETOOTH_EVENT_TRANSFER_COMPLETED event through registered callback
4303  * function with an error code BLUETOOTH_ERROR_CANCEL. In the case of failure
4304  * the error code will be BLUETOOTH_ERROR_NONE
4305  *
4306  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4307  *               BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Not enabled \n
4308  *               BLUETOOTH_ERROR_AGENT_DOES_NOT_EXIST -Obex agent not registered \n
4309  *               BLUETOOTH_ERROR_INTERNAL - internal error (proxy does not exist) \n
4310  *               BLUETOOTH_ERROR_NOT_FOUND - The transfer is not found \n
4311  *
4312  * @exception None
4313  * @param[in] transfer_id transfer ID
4314
4315  * @remark       None
4316  * @see          None
4317  */
4318 int bluetooth_obex_server_cancel_transfer(int transfer_id);
4319
4320
4321 /**
4322  * @fn int bluetooth_obex_server_cancel_all_transfers(void)
4323  * @brief Cancel the transfer on server
4324  *
4325  * This function is an asynchronous call.
4326  * If the function call that cancels transfer is successful, the application would receive
4327  * BLUETOOTH_EVENT_TRANSFER_COMPLETED event through registered callback
4328  * function with an error code BLUETOOTH_ERROR_CANCEL. In the case of failure
4329  * the error code will be BLUETOOTH_ERROR_NONE
4330  *
4331  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4332  *               BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Not enabled \n
4333  *               BLUETOOTH_ERROR_AGENT_DOES_NOT_EXIST -Obex agent not registered \n
4334  *               BLUETOOTH_ERROR_INTERNAL - internal error (proxy does not exist) \n
4335  *               BLUETOOTH_ERROR_NOT_FOUND - The transfer is not found \n
4336  *
4337  * @exception None
4338  *
4339  * @remark       None
4340  * @see          None
4341  */
4342 int bluetooth_obex_server_cancel_all_transfers(void);
4343
4344
4345 /**
4346  * @fn int bluetooth_obex_server_is_receiving(gboolean *is_receiving)
4347  * @brief Informs whether obex server is receiving or not.
4348  *
4349  * This function is a synchronous call.
4350  *
4351  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4352  *               BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Not enabled \n
4353  *               BLUETOOTH_ERROR_INTERNAL \n
4354  *
4355  * @exception   None
4356  * @param[out] is_receiving The receiving status: (@c TRUE = in receiving , @c  false = not in receiving)
4357  *
4358  * @remark       None
4359  * @see            None
4360  */
4361 int bluetooth_obex_server_is_receiving(gboolean *is_receiving);
4362
4363
4364 /**
4365  * @fn int bluetooth_oob_read_local_data(bt_oob_data_t *local_oob_data)
4366  * @brief Read the local Hash and Randmizer.
4367  *
4368  * This function is a synchronous call.
4369  *
4370  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4371  *           BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4372  *
4373  * @exception  None
4374  * @param[in]  None.
4375  * @param[out] local_oob_data - Pointer to the local OOB data
4376  *
4377  * @remark       None
4378  * @see          None
4379  */
4380
4381 int bluetooth_oob_read_local_data(bt_oob_data_t *local_oob_data);
4382
4383
4384 /**
4385  * @fn int bluetooth_oob_add_remote_data(
4386  *                      const bluetooth_device_address_t *remote_device_address,
4387  *                      bt_oob_data_t *oob_data)
4388  * @brief Add/updated the remote device  Hash and Randmizer.
4389  *
4390  * This function is a synchronous call.
4391  * No event for this api..
4392  *
4393  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4394  *           BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4395  *
4396  * @exception   None
4397  * @param[in] remote_device_address - Remote device address
4398  *            remote_oob_data - Ponter to Hash and Randomizer oob data structure
4399  *
4400  * @remark      None
4401  * @see         None
4402  */
4403
4404 int bluetooth_oob_add_remote_data(
4405                    const bluetooth_device_address_t *remote_device_address,
4406                    bt_oob_data_t *remote_oob_data);
4407
4408
4409 /**
4410  * @fn int bluetooth_oob_remove_remote_data(
4411  *                      const bluetooth_device_address_t *remote_device_address)
4412  * @brief Delete the Hash and Randomizer w.r.t the remote device address.
4413  *
4414  * This function is a synchronous call.
4415  * No event for this api..
4416  *
4417  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4418  *           BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4419  *
4420  * @exception  None
4421  * @param[in] remote_device_address - Remote device address
4422  *
4423  * @remark       None
4424  * @see          None
4425  */
4426
4427 int bluetooth_oob_remove_remote_data(
4428                         const bluetooth_device_address_t *remote_device_address);
4429
4430 /**
4431  * @fn int bluetooth_gatt_get_primary_services(const bluetooth_device_address_t *address,
4432  *                                              bt_gatt_handle_info_t *prim_svc);
4433  *
4434  * @brief Gets the GATT based primary services handle supported by remote device
4435  *
4436  * This function is a synchronous call.
4437  * The output parameter needs to be freed by calling bluetooth_gatt_free_primary_services()
4438  *
4439  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4440  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4441  *              BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4442  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4443  *
4444  * @exception    None
4445  * @param[in]    address - Remote device address
4446  * @param[out] prim_svc - Structure containing remote service count and handle list.
4447  *
4448  * @remark      None
4449  * @see         bluetooth_gatt_free_primary_services()
4450  */
4451 int bluetooth_gatt_get_primary_services(const bluetooth_device_address_t *address,
4452                                                 bt_gatt_handle_info_t *prim_svc);
4453
4454 /**
4455  * @fn int bluetooth_gatt_discover_service_characteristics(const char *service_handle)
4456  *
4457  * @brief Discovers the characteristics of GATT based service of remote device
4458  *
4459  * This function is an asynchronous call.
4460  * This API is responded with BLUETOOTH_EVENT_GATT_SVC_CHAR_DISCOVERED
4461  *
4462  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4463  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4464  *              BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4465  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4466  *
4467  * @exception   None
4468  * @param[in]   service_handle - Handle for remote service.
4469  *
4470  * @remark      None
4471  * @see         None
4472  */
4473 int bluetooth_gatt_discover_service_characteristics(const char *service_handle);
4474
4475 /**
4476  * @fn int bluetooth_gatt_get_service_property(const char *service_handle,
4477  *                                              bt_gatt_service_property_t *service);
4478  *
4479  * @brief Gets the properties of GATT based service of remote device
4480  *
4481  * This function is a synchronous call.
4482  * The output parameter needs to be freed by calling bluetooth_gatt_free_primary_services()
4483  *
4484  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4485  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4486  *              BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4487  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4488  *
4489  * @exception   None
4490  * @param[in]   service_handle - Handle for remote service.
4491  * @param[out]  service - Structure containing remote service property.
4492  *
4493  * @remark      None
4494  * @see         bluetooth_gatt_free_service_property()
4495  */
4496 int bluetooth_gatt_get_service_property(const char *service_handle,
4497                                                 bt_gatt_service_property_t *service);
4498
4499 /**
4500  * @fn int bluetooth_gatt_watch_characteristics(const char *service_handle)
4501  *
4502  * @brief Register to GATT based service to receive value change notification/indication.
4503  *
4504  * This function is a synchronous call.
4505  * No event for this api.
4506  *
4507  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4508  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4509  *              BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4510  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4511  *
4512  * @exception   None
4513  * @param[in]   service_handle - Handle for remote service.
4514  *
4515  * @remark      None
4516  * @see         None
4517  */
4518 int bluetooth_gatt_watch_characteristics(const char *service_handle);
4519
4520 /**
4521  * @fn int bluetooth_gatt_unwatch_characteristics(const char *service_handle)
4522  *
4523  * @brief Unregister GATT based service to receive value change notification/indication.
4524  *
4525  * This function is a synchronous call.
4526  * No event for this api.
4527  *
4528  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4529  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4530  *              BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4531  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4532  *
4533  * @exception   None
4534  * @param[in]   service_handle - Handle for remote service.
4535  *
4536  * @remark      None
4537  * @see         None
4538  */
4539 int bluetooth_gatt_unwatch_characteristics(const char *service_handle);
4540
4541 /**
4542  * @fn int bluetooth_gatt_get_characteristics_property(const char *char_handle,
4543  *                                              bt_gatt_char_property_t *characteristic);
4544  *
4545  * @brief Provides characteristic value along with properties.
4546  *
4547  * This function is a synchronous call.
4548  * The output parameter needs to be freed by calling bluetooth_gatt_free_char_property()
4549  *
4550  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4551  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4552  *              BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4553  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4554  *
4555  * @exception   None
4556  * @param[in]   char_handle - Handle for Characteristic property.
4557  * @param[out] characteristic - Structure containing remote characteristic property.
4558  *
4559  * @remark      None
4560  * @see         bluetooth_gatt_free_char_property()
4561  */
4562 int bluetooth_gatt_get_characteristics_property(const char *char_handle,
4563                                                 bt_gatt_char_property_t *characteristic);
4564
4565 /**
4566  * @fn int bluetooth_gatt_get_char_descriptor_property(const char *char_handle,
4567  *                                              bt_gatt_char_property_t *characteristic);
4568  *
4569  * @brief Provides characteristic descriptor value along with its UUID.
4570  *
4571  * This function is a synchronous call.
4572  * The output parameter needs to be freed by calling bluetooth_gatt_free_desc_property()
4573  *
4574  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4575  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4576  *              BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4577  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4578  *
4579  * @exception   None
4580  * @param[in]   desc_handle - Handle for Characteristic descriptor.
4581  * @param[out] descriptor - Structure containing remote characteristic descriptor property.
4582  *
4583  * @remark      None
4584  * @see         bluetooth_gatt_free_desc_property()
4585  */
4586 int bluetooth_gatt_get_char_descriptor_property(const char *desc_handle,
4587                                                 bt_gatt_char_descriptor_property_t *descriptor);
4588
4589
4590 /**
4591  * @fn int bluetooth_gatt_set_characteristics_value(const char *char_handle,
4592  *                                              const guint8 *value, int length)
4593  *
4594  * @brief Set characteristic value.
4595  *
4596  * This function is a synchronous call.
4597  *
4598  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4599  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4600  *              BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4601  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4602  *
4603  * @exception   None
4604  * @param[in]   char_handle - Handle for Characteristic property.
4605  * @param[in]   value - New value to set for characteristic property.
4606  * @param[in]   length - Length of the value to be set.
4607  *
4608  * @remark      None
4609  * @see         None
4610  */
4611 int bluetooth_gatt_set_characteristics_value(const char *char_handle,
4612                                                 const guint8 *value, int length);
4613
4614 /**
4615  * @fn int bluetooth_gatt_set_characteristics_value_by_type(const char *char_handle,
4616  *                              const guint8 *value, int length, guint8 write_type)
4617  *
4618  * @brief Set characteristic value by write type.
4619  *
4620  * This function is a synchronous call if write type is "write without resonse"
4621  * and it is an asynchronous call if write type is "write with response"
4622  *
4623  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4624  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4625  *              BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4626  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4627  *
4628  * @exception   None
4629  * @param[in]   char_handle - Handle for Characteristic property.
4630  * @param[in]   value - New value to set for characteristic property.
4631  * @param[in]   length - Length of the value to be set.
4632  * @param[in]   write_type - Type of write.
4633  *
4634  * @remark      None
4635  * @see         None
4636  */
4637 int bluetooth_gatt_set_characteristics_value_by_type(const char *char_handle,
4638                                 const guint8 *value, int length, guint8 write_type);
4639
4640
4641 /**
4642  * @fn int bluetooth_gatt_set_characteristics_value_request(const char *char_handle,
4643  *                                              const guint8 *value, int length)
4644  *
4645  * @brief Set characteristic value request.
4646  *
4647  * This function is an asynchronous call.
4648  *
4649  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4650  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4651  *              BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4652  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4653  *
4654  * @exception   None
4655  * @param[in]   char_handle - Handle for Characteristic property.
4656  * @param[in]   value - New value to set for characteristic property.
4657  * @param[in]   length - Length of the value to be set.
4658   *
4659  * @remark      None
4660  * @see         None
4661  */
4662 int bluetooth_gatt_set_characteristics_value_request(const char *char_handle,
4663                                                 const guint8 *value, int length);
4664
4665 /**
4666  * @fn int bluetooth_gatt_read_characteristic_value(const char *char_handle)
4667  *
4668  * @brief Read characteristic value.
4669  *
4670  * This function is a asynchronous call.
4671  *
4672  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4673  *             BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4674  *             BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4675  *             BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4676  *
4677  * @exception  None
4678  * @param[in]  char_handle - Handle for Characteristic property.
4679  *
4680  * @remark     None
4681  * @see        None
4682  */
4683 int bluetooth_gatt_read_characteristic_value(const char *char_handle);
4684
4685 /**
4686  * @fn int bluetooth_gatt_get_service_from_uuid(bluetooth_device_address_t *address,
4687  *                                      const char *service_uuid,
4688  *                                      bt_gatt_service_property_t *service)
4689  *
4690  * @brief Gets the service property from a device based on a particular uuid
4691  *
4692  * This function is a synchronous call.
4693  *
4694  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4695  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4696  *              BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4697  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4698  *
4699  * @exception   None
4700  * @param[in]   address - BD address of the remote device
4701  * @param[in]   service_uuid - uuid of the service.
4702  * @param[out] service - Structure containing the service property.
4703  *
4704  * @remark      None
4705  * @see         None
4706  */
4707  int bluetooth_gatt_get_service_from_uuid(bluetooth_device_address_t *address,
4708                                         const char *service_uuid,
4709                                         bt_gatt_service_property_t *service);
4710
4711 /**
4712  * @fn int bluetooth_gatt_get_char_from_uuid(const char *service_handle,
4713  *                                                      const char *char_uuid)
4714  *
4715  * @brief Gets the characteristic property from a service based on a particular char uuid
4716  *
4717  * This function is an asynchronous call.
4718  * This API is responded with BLUETOOTH_EVENT_GATT_GET_CHAR_FROM_UUID
4719  *
4720  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4721  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4722  *              BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4723  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4724  *
4725  * @exception   None
4726  * @param[in]   service_handle - Service handle.
4727  * @param[in]   uuid - Characteristic uuid.
4728  *
4729  * @remark      None
4730  * @see         None
4731  */
4732 int bluetooth_gatt_get_char_from_uuid(const char *service_handle,
4733                                                 const char *char_uuid);
4734
4735 /**
4736  * @fn int bluetooth_gatt_free_primary_services(bt_gatt_handle_info_t *prim_svc);
4737  *
4738  * @brief Releases the memory allocated by bluetooth_gatt_get_primary_services()
4739  *
4740  * This function is a synchronous call.
4741  * The input parameter is obtained by calling bluetooth_gatt_get_primary_services()
4742  *
4743  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4744  *              BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4745  *
4746  * @exception   None
4747  * @param[in]   prim_svc - GATT handle info structure
4748  *
4749  * @remark      None
4750  * @see         bluetooth_gatt_get_primary_services()
4751  */
4752 int bluetooth_gatt_free_primary_services(bt_gatt_handle_info_t *prim_svc);
4753
4754 /**
4755  * @fn int bluetooth_gatt_free_service_property(bt_gatt_service_property_t *svc_pty);
4756  *
4757  * @brief  Releases the memory allocated by bluetooth_gatt_get_service_property()
4758  *
4759  * This function is a synchronous call.
4760  * The input parameter is obtained by calling bluetooth_gatt_get_service_property()
4761  *
4762  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4763  *              BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4764  *
4765  * @exception   None
4766  * @param[in]   svc_pty - GATT service property structure.
4767  *
4768  * @remark      None
4769  * @see         bluetooth_gatt_get_service_property()
4770  */
4771 int bluetooth_gatt_free_service_property(bt_gatt_service_property_t *svc_pty);
4772
4773 /**
4774  * @fn int bluetooth_gatt_free_char_property(bt_gatt_char_property_t *char_pty);
4775  *
4776  * @brief Provides characteristic value along with properties.
4777  *
4778  * This function is a synchronous call.
4779  * The input parameter is obtained by calling bluetooth_gatt_get_characteristics_property()
4780  *
4781  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4782  *              BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4783  *
4784  * @exception   None
4785  * @param[in]   char_pty - GATT characteristics property structure.
4786  *
4787  * @remark      None
4788  * @see         bluetooth_gatt_get_characteristics_property()
4789  */
4790  int bluetooth_gatt_free_char_property(bt_gatt_char_property_t *char_pty);
4791
4792 /**
4793  * @fn int bluetooth_gatt_free_desc_property(bt_gatt_char_descriptor_property_t *desc_pty);
4794  *
4795  * @brief Releases the memory allocated by bluetooth_gatt_get_char_descriptor_property()
4796  *
4797  * This function is a synchronous call.
4798  * The input parameter is obtained by calling bluetooth_gatt_get_char_descriptor_property()
4799  *
4800  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4801  *              BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4802  *
4803  * @exception   None
4804  * @param[in]   desc_pty - GATT characteristics descriptor property structure.
4805  *
4806  * @remark      None
4807  * @see         bluetooth_gatt_get_char_descriptor_property()
4808  */
4809  int bluetooth_gatt_free_desc_property(bt_gatt_char_descriptor_property_t *desc_pty);
4810
4811
4812  int bluetooth_connect_le(const bluetooth_device_address_t *device_address, gboolean auto_connect);
4813
4814  int bluetooth_disconnect_le(const bluetooth_device_address_t *device_address);
4815
4816  /**
4817  * @fn int bluetooth_gatt_discover_characteristic_descriptor(const char *characteristic_handle);
4818  *
4819  * @brief Discovers the characteristic descriptor value of a characteristic within its definition, asynchronously
4820  *
4821  * The input parameter is obtained by calling bluetooth_gatt_get_characteristics_property()
4822  *
4823  * @return  BLUETOOTH_ERROR_NONE  - Success \n
4824  *                      BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4825  *
4826  * @exception   None
4827  * @param[in]   characteristic_handle - The characteristic handle for which characteristic descriptor has to be discovered.
4828  *
4829  * @remark      None
4830  */
4831 int bluetooth_gatt_discover_characteristic_descriptor(const char *characteristic_handle);
4832
4833 /**
4834  * @fn int bluetooth_gatt_read_descriptor_value(const char *desc_handle)
4835  *
4836  * @brief Read characteristic descriptor value.
4837  *
4838  * This function is a asynchronous call.
4839  *
4840  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4841  *             BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4842  *             BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4843  *             BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4844  *
4845  * @exception  None
4846  * @param[in]  desc_handle - Handle for Characteristic descriptor
4847  *
4848  * @remark     None
4849  * @see        None
4850  */
4851  int bluetooth_gatt_read_descriptor_value(const char *desc_handle);
4852
4853 /**
4854  * @fn int bluetooth_gatt_write_descriptor_value(const char *desc_handle,
4855  *                      const guint8 *value, int length);
4856  *
4857  * @brief Set characteristic descriptor value.
4858  *
4859  * This function is a asynchronous call.
4860  *
4861  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4862  *             BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4863  *             BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4864  *             BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4865  *
4866  * @exception  None
4867  * @param[in]  desc_handle - Handle for Characteristic descriptor
4868  * @param[in]  value - New value to set for characteristic descriptor
4869  * @param[in]  length - Length of the value to be set.
4870  *
4871  * @remark     None
4872  * @see        None
4873  */
4874  int bluetooth_gatt_write_descriptor_value(const char *desc_handle,
4875                         const guint8 *value, int length);
4876
4877 /* @fn int bluetooth_gatt_init(void)
4878 *
4879 * @brief Initializes the gatt service.
4880 *
4881 * This function is a synchronous call.
4882 * @return   BLUETOOTH_ERROR_NONE        - Success \n
4883 *        BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4884 *        BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4885 *        BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4886 *
4887 * @exception     None
4888 * @remark  Adapter should be enabled
4889 * @see  bluetooth_gatt_deinit()
4890 */
4891 int bluetooth_gatt_init(void);
4892
4893 /* @fn int bluetooth_gatt_init(void)
4894 *
4895 * @brief DeInitializes the gatt service.
4896 *
4897 * This function is a synchronous call.
4898 * @return   BLUETOOTH_ERROR_NONE        - Success \n
4899 *        BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4900 *        BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4901 *        BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4902 *
4903 * @exception     None
4904 * @remark  Adapter should be enabled
4905 * @see  bluetooth_gatt_init()
4906 */
4907 int bluetooth_gatt_deinit(void);
4908
4909 /* @fn int bluetooth_gatt_add_service(const char *svc_uuid,
4910                         unsigned char **svc_path)
4911 *
4912 * @brief Exports a new gatt service to the service interface.
4913 *
4914 * This function is a synchronous call.
4915 *
4916 * @return       BLUETOOTH_ERROR_NONE    - Success \n
4917 *        BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4918 *        BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4919 *        BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4920 *
4921 * @exception     None
4922 * @param[in]   svc_uuid  Gatt service uuid.
4923 * @param[out] svc_path  service object path of the exported service.
4924 * @remark  Adapter should be enabled
4925 * @see  bluetooth_gatt_init()
4926 */
4927 int bluetooth_gatt_add_service(const char *svc_uuid,
4928                         char **svc_path);
4929
4930 /* @fn int bluetooth_gatt_add_new_characteristic(
4931                         const char *svc_path, const char *char_uuid,
4932                         bt_gatt_characteristic_property_t *properties,
4933                         int flags_length, char **char_path);;
4934 *
4935 * @brief Exports a new gatt characteristic to the characteristic interface.
4936 *
4937 * This function is a synchronous call.
4938 * @return       BLUETOOTH_ERROR_NONE    - Success \n
4939 *        BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4940 *        BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4941 *        BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4942 * @exception     None
4943 * @param[in]   svc_path service object path of the exported service.
4944 * @param[in]   char_uuid  Gatt service uuid.
4945 * @param[in]   properties       GATT characteristic properties.
4946 * @param[out] char_path characteristic object path of the exported characteristic.
4947 *
4948 * @remark  Adapter should be enabled
4949 * @see  bluetooth_gatt_add_service()
4950 */
4951 int bluetooth_gatt_add_new_characteristic(
4952                         const char *svc_path, const char *char_uuid,
4953                         bt_gatt_characteristic_property_t properties,
4954                         char **char_path);
4955
4956 /* @fn bluetooth_gatt_set_characteristic_value(
4957                         const char *characteristic, const char *char_value,
4958                         int value_length);
4959 *
4960 * @brief adds gatt charactertisic value to the given charactertistic path.
4961 *
4962 * This function is a synchronous call.
4963 * @return       BLUETOOTH_ERROR_NONE    - Success \n
4964 *        BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4965 *        BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4966 *        BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4967 * @exception     None
4968 * @param[in]   char_value Value of the GATT characteristic to be added.
4969 * @param[in]   value_length length of the chantacteristic value..
4970 * @param[out] characteristic characteristic object path..
4971 *
4972 * @remark  Adapter should be enabled
4973 * @see  bluetooth_gatt_add_service()
4974 */
4975 int bluetooth_gatt_set_characteristic_value(
4976                         const char *characteristic, const char *char_value,
4977                         int value_length);
4978
4979 /* @fn int bluetooth_gatt_add_descriptor(const char *desc_uuid,
4980                         const char *desc_value, int value_length,
4981                         const char *permissions, const char *char_path,
4982                         char **desc_path);
4983 *
4984 * @brief Exports a new gatt descriptor to the descriptor interface.
4985 *
4986 * This function is a synchronous call.
4987 *
4988 * @return       BLUETOOTH_ERROR_NONE    - Success \n
4989 *        BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4990 *        BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4991 *        BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4992 *
4993 * @exception     None
4994 * @param[in]   desc_uuid  Gatt descriptor uuid.
4995 * @param[in]   desc_value       GATT descriptor value.
4996 * @param[in]   value_length     Length of GATT descriptor value.
4997 * @param[in]   permissions      descriptor permissions.
4998 * @param[in]  char_path characteristics object path of the exported character.
4999 *
5000 * @remark  Adapter should be enabled
5001 * @see  bluetooth_gatt_add_service()
5002 * @see  bluetooth_gatt_add_characteristics()
5003 */
5004 int bluetooth_gatt_add_descriptor(const char *char_path,
5005                         const char *desc_uuid,
5006                         char **desc_path);
5007
5008 /* @fn int bluetooth_gatt_set_descriptor_value(
5009                    const char *desc_path, const char *desc_value,
5010                    int value_length);
5011 *
5012 * @brief Adds value to the given descriptor handle.
5013 *
5014 * This function is a synchronous call.
5015 *
5016 * @return       BLUETOOTH_ERROR_NONE    - Success \n
5017 *        BLUETOOTH_ERROR_INTERNAL - Internal Error \n
5018 *        BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
5019 *        BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
5020 *
5021 * @exception     None
5022 * @param[in]   desc_value       GATT descriptor value.
5023 * @param[in]   value_length     Length of GATT descriptor value.
5024 * @param[in]  desc_path descriptor path to which the value needs to be added.
5025 *
5026 * @remark  Adapter should be enabled
5027 * @see  bluetooth_gatt_add_service()
5028 * @see  bluetooth_gatt_add_characteristics()
5029 */
5030 int bluetooth_gatt_set_descriptor_value(
5031                    const char *desc_path, const char *desc_value,
5032                    int value_length);
5033
5034 /* @fn int bluetooth_gatt_get_service(const char *svc_uuid);
5035 *
5036 * @brief Reads the Service registered on manager interface.
5037 *
5038 * This function is a synchronous call.
5039 *
5040 * @return       BLUETOOTH_ERROR_NONE    - Success \n
5041 *        BLUETOOTH_ERROR_INTERNAL - Internal Error \n
5042 *        BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
5043 *        BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
5044 *
5045 * @exception     None
5046 * @param[in]   svc_uuid  Gatt Service uuid.
5047 *
5048 * @remark  Adapter should be enabled and service should be registered.
5049 * @see  bluetooth_gatt_register_service()
5050 */
5051 int bluetooth_gatt_get_service(const char *svc_uuid);
5052
5053 /* @fn int bluetooth_gatt_register_service(const  char *svc_path)
5054 *
5055 * @brief Registers the given service path with the bluez gatt server.
5056 *
5057 * This function is a synchronous call.
5058 *
5059 * @return       BLUETOOTH_ERROR_NONE    - Success \n
5060 *        BLUETOOTH_ERROR_INTERNAL - Internal Error \n
5061 *        BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
5062 *        BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
5063 *
5064 * @exception     None
5065 * @param[in] svc_path   service object path of the exported service.
5066 *
5067 * @remark  Adapter should be enabled
5068 * @see  bluetooth_gatt_add_service()
5069 * @see  bluetooth_gatt_add_characteristics()
5070 * @see  bluetooth_gatt_add_descriptor()
5071 */
5072 int bluetooth_gatt_register_service(const char *svc_path);
5073
5074 /* @fn int bluetooth_gatt_unregister_service(const  char *svc_path)
5075 *
5076 * @brief Removes(unregister) service from the bluez gatt server db.
5077 *
5078 * This function is a synchronous call.
5079 *
5080 * @return       BLUETOOTH_ERROR_NONE    - Success \n
5081 *        BLUETOOTH_ERROR_INTERNAL - Internal Error \n
5082 *        BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
5083 *        BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
5084 *
5085 * @exception     None
5086 * @param[in] svc_path   service object path of the exported service.
5087 *
5088 * @remark  Adapter should be enabled
5089 * @see  bluetooth_gatt_add_service()
5090 * @see  bluetooth_gatt_add_characteristics()
5091 * @see  bluetooth_gatt_add_descriptor()
5092 * @see bluetooth_gatt_register_service()
5093 */
5094 int bluetooth_gatt_unregister_service(const char *svc_path);
5095
5096 /* @fn int bluetooth_gatt_send_response(int request_id,
5097 *                               int offset, char *value, int value_length)
5098 *
5099 * @brief Updates the attribute value in local attribute list.
5100 *
5101 * This function is a synchronous call.
5102 *
5103 * @return       BLUETOOTH_ERROR_NONE    - Success \n
5104 *        BLUETOOTH_ERROR_INTERNAL - Internal Error \n
5105 *        BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
5106 *        BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
5107 *
5108 * @exception     None
5109 * @param[in] request_id The identification of a read request
5110 * @param[in] req_type The identification of  request type (TRUE for Read request and FALSE for write request)
5111 * @param[in] resp_state The identification of response state
5112 * @param[in] offset The offset from where a value is read
5113 * @param[in] value The value to be sent. It will be sent from @a offset.
5114 *               If it is NULL, a requested GATT handle's value will be sent from @a offset.
5115 * @param[in] value_length Value Length.
5116 *
5117 * @remark  Adapter should be enabled
5118 * @see  bluetooth_gatt_add_service()
5119 * @see  bluetooth_gatt_add_characteristics()
5120 * @see  bluetooth_gatt_add_descriptor()
5121 * @see bluetooth_gatt_register_service()
5122 */
5123 int bluetooth_gatt_send_response(int request_id, guint req_type,
5124                                 int resp_state, int offset, char *value, int value_length);
5125
5126 /* @fn bluetooth_gatt_server_set_notification(const char *char_path)
5127 *
5128 * @brief Sets the notification property for a characteristic.
5129 *
5130 * This function is a synchronous call.
5131 *
5132 * @return       BLUETOOTH_ERROR_NONE    - Success \n
5133 *        BLUETOOTH_ERROR_INTERNAL - Internal Error \n
5134 *        BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
5135 *        BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
5136 *
5137 * @exception     None
5138 * @param[in] char_path characteristic object path.
5139 * @param[in]   unicast_address remote device address. if set notification is sent to only one device.
5140 *
5141 * @remark  Adapter should be enabled
5142 * @see  bluetooth_gatt_update_characteristic()
5143 */
5144 int bluetooth_gatt_server_set_notification(const char *char_path,
5145                                 bluetooth_device_address_t *unicast_address);
5146
5147 /* @fn int bluetooth_gatt_delete_services(void)
5148 *
5149 * @brief deletes (unregisters) all services from the gatt server database..
5150 *
5151 * This function is a synchronous call.
5152 *
5153 * @return       BLUETOOTH_ERROR_NONE    - Success \n
5154 *        BLUETOOTH_ERROR_INTERNAL - Internal Error \n
5155 *        BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
5156 *        BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
5157 *
5158 * @exception     None
5159 *
5160 * @remark  Adapter should be enabled
5161 * @see  bluetooth_gatt_add_service()
5162 * @see  bluetooth_gatt_add_characteristics()
5163 * @see  bluetooth_gatt_add_descriptor()
5164 * @see bluetooth_gatt_register_service()
5165 * @see bluetooth_gatt_unregister_service()
5166 */
5167 int bluetooth_gatt_delete_services(void);
5168
5169 /* @fn int bluetooth_gatt_update_characteristic(void)
5170 *
5171 * @brief updates the given characteristic with a new value
5172 *
5173 * This function is a synchronous call.
5174 *
5175 * @return       BLUETOOTH_ERROR_NONE    - Success \n
5176 *        BLUETOOTH_ERROR_INTERNAL - Internal Error \n
5177 *        BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
5178 *        BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
5179 *
5180 * @exception     None
5181 *
5182 * @remark  Adapter should be enabled
5183 * @see  bluetooth_gatt_add_service()
5184 * @see  bluetooth_gatt_add_characteristics()
5185 * @see  bluetooth_gatt_add_descriptor()
5186 * @see bluetooth_gatt_register_service()
5187 * @see bluetooth_gatt_unregister_service()
5188 */
5189 int bluetooth_gatt_update_characteristic(const char *char_path,
5190                 const char* char_value, int value_length);
5191
5192 /**
5193  * @fn int bluetooth_set_advertising(int handle, gboolean enable);
5194  *
5195  * @brief Set advertising status.
5196  *
5197  * This function is used to enable or disable LE advertising.
5198  * Once advertising is enabled, Advertising data is transmitted in the advertising packets
5199  *
5200  * This function is a synchronous call.
5201  *
5202  * @return      BLUETOOTH_ERROR_NONE - Success \n
5203  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
5204  *              BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
5205  *
5206  * @exception   None
5207  * @param[in]   enable - The status of advertising
5208  *
5209  * @remark      None
5210  * @see         bluetooth_set_advertising_data
5211  */
5212 int bluetooth_set_advertising(int handle, gboolean enable);
5213
5214 /**
5215  * @fn int bluetooth_set_custom_advertising(int handle, gboolean enable, bluetooth_advertising_params_t *params);
5216  *
5217  * @brief Set advertising status along with interval value.
5218  *
5219  * This function is used to enable or disable LE advertising.
5220  * Interval_min and Interval_max is used to set the best advertising interval.
5221  * Once advertising is enabled, Advertising data is transmitted in the advertising packets
5222  *
5223  * This function is a synchronous call.
5224  *
5225  * @return      BLUETOOTH_ERROR_NONE - Success \n
5226  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
5227  *              BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
5228  *
5229  * @exception   None
5230  * @param[in]   enable - The status of advertising
5231  * @param[in]   interval_min - Minimum interval of advertising (msec)
5232  * @param[in]   interval_max - Maximum interval of advertising (msec)
5233  * @param[in]   filter_policy - Advertising filter policy
5234  *
5235  * @remark      None
5236  * @see         bluetooth_set_advertising_data
5237  */
5238 int bluetooth_set_custom_advertising(int handle, gboolean enable,
5239                                         bluetooth_advertising_params_t *params);
5240
5241 /**
5242  * @fn int bluetooth_get_advertising_data(bluetooth_advertising_data_t *value, int *length);
5243  * @brief Get the advertising data
5244  *
5245  * This function is used to get advertising data.
5246  * Before calling this API, the adapter should be enabled.
5247  *
5248  * This function is a synchronous call.
5249  *
5250  * @return      BLUETOOTH_ERROR_NONE - Success \n
5251  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
5252  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter (NULL buffer)\n
5253  *              BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
5254  *
5255  * @param[out]  value - Advertising data structure.
5256  * @param[out]  length - The length of Advertising data.
5257  *
5258  * @remark      None
5259 @code
5260 bluetooth_advertising_data_t *value = { {0} };
5261 int length;
5262 int ret = 0;
5263 ret = bluetooth_get_advertising_data(&value, &length);
5264 @endcode
5265  */
5266 int bluetooth_get_advertising_data(bluetooth_advertising_data_t *value, int *length);
5267
5268 /**
5269  * @fn int bluetooth_set_advertising_data(int handle, const bluetooth_advertising_data_t *value, int length);
5270  *
5271  * @brief Set advertising data with value
5272  *
5273  * This function is used to set advertising data and Maximum size of advertising data
5274  *  is 28 byte (Except Flag)
5275  *
5276  * This function is a synchronous call.
5277  *
5278  * @return      BLUETOOTH_ERROR_NONE - Success \n
5279  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
5280  *              BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
5281  *
5282  * @exception   None
5283  * @param[in]   value - Advertising data structure.
5284  *
5285  * @remark      None
5286  */
5287 int bluetooth_set_advertising_data(int handle, const bluetooth_advertising_data_t *value, int length);
5288
5289 /**
5290  * @fn int bluetooth_check_privilege_advertising_parameter(void);
5291  *
5292  * @brief Check the privilege for advertising parameter setting
5293  *
5294  * This function is a synchronous call.
5295  *
5296  * @return      BLUETOOTH_ERROR_NONE - Success \n
5297  *              BLUETOOTH_ERROR_PERMISSION_DEINED - Permission deined \n
5298  *
5299  * @exception   None
5300  *
5301  * @remark      None
5302  */
5303 int bluetooth_check_privilege_advertising_parameter(void);
5304
5305 /**
5306  * @fn int bluetooth_get_scan_response_data(bluetooth_scan_resp_data_t *value, int *length);
5307  * @brief Get the LE scan response data
5308  *
5309  * This function is used to get scan response data.
5310  * Before calling this API, the adapter should be enabled.
5311  *
5312  * This function is a synchronous call.
5313  *
5314  * @return      BLUETOOTH_ERROR_NONE - Success \n
5315  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
5316  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter (NULL buffer)\n
5317  *              BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
5318  *
5319  * @param[out]  value - Scan response data structure.
5320  * @param[out]  length - The length of Scan response data.
5321  *
5322  * @remark      None
5323 @code
5324 bluetooth_scan_resp_data_t *value = { {0} };
5325 int length;
5326 int ret = 0;
5327 ret = bluetooth_get_scan_response_data(&value, &length);
5328 @endcode
5329  */
5330 int bluetooth_get_scan_response_data(bluetooth_scan_resp_data_t *value, int *length);
5331
5332 /**
5333  * @fn int bluetooth_set_scan_response_data(int handle, const bluetooth_scan_resp_data_t *value, int length);
5334  *
5335  * @brief Set scan response data with value
5336  *
5337  * This function is used to set scan response data and Maximum size of scan response data is 31 byte
5338  *
5339  * This function is a synchronous call.
5340  *
5341  * @return      BLUETOOTH_ERROR_NONE - Success \n
5342  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
5343  *              BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
5344  *
5345  * @exception   None
5346  * @param[in]   value - LE Scan response data structure.
5347  *
5348  * @remark      None
5349  */
5350 int bluetooth_set_scan_response_data(int handle, const bluetooth_scan_resp_data_t *value, int length);
5351
5352 /**
5353  * @fn int bluetooth_set_scan_parameters(bluetooth_le_scan_params_t *params);
5354  *
5355  * @brief Set scan interval and window
5356  *
5357  * This function is used to set LE scan interval and window size
5358  *
5359  * This function is a synchronous call.
5360  *
5361  * @return      BLUETOOTH_ERROR_NONE - Success \n
5362  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
5363  *              BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
5364  *
5365  * @exception   None
5366  * @param[in]   interval - Interval of LE scan (msec)
5367  * @param[in]   window - Window size of LE scan (msec)
5368  *
5369  * @remark      None
5370  */
5371 int bluetooth_set_scan_parameters(bluetooth_le_scan_params_t *params);
5372
5373 /**
5374  * @fn int bluetooth_is_advertising(void)
5375  * @brief Check for the advertising is in-progress or not.
5376  *
5377  * This API is used to check the current status of the advertising procedure.
5378  * Before calling this API, make sure that the adapter is enabled. There is no callback event for
5379  * this API.
5380  *
5381  * This function checks whether the advertising is started or not.
5382  *
5383  * This function is a synchronous call.
5384  *
5385  * @param[out] is_advertising The advertising status: (@c TRUE = in progress, @c  false = not in progress)
5386  *
5387  * @return      BLUETOOTH_ERROR_NONE - Success \n
5388  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
5389  *
5390  * @remark      None
5391  * @see         bluetooth_set_advertising, bluetooth_set_custom_advertising
5392
5393 @code
5394 int ret;
5395 gboolean is_advertising = 0;
5396
5397 ret = bluetooth_is_advertising(&is_advertising);
5398 @endcode
5399  */
5400 int bluetooth_is_advertising(gboolean *is_advertising);
5401
5402 /**
5403  * @fn int bluetooth_add_white_list(bluetooth_device_address_t *address, bluetooth_device_address_type_t address_type)
5404  * @brief Add LE device to white list
5405  *
5406  * This API is used to add LE device to white list
5407  * Before calling this API, make sure that the adapter is enabled. There is no callback event for
5408  * this API.
5409  *
5410  *
5411  * This function is a synchronous call.
5412  *
5413  * @param[in] address The address of remote device
5414  *
5415  * @return      BLUETOOTH_ERROR_NONE - Success \n
5416  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
5417  *
5418  * @remark      None
5419  * @see         bluetooth_set_custom_advertising
5420  */
5421 int bluetooth_add_white_list(bluetooth_device_address_t *address, bluetooth_device_address_type_t address_type);
5422
5423 /**
5424  * @fn int bluetooth_remove_white_list(bluetooth_device_address_t *address, bluetooth_device_address_type_t address_type)
5425  * @brief Remove LE device from white list
5426  *
5427  * This API is used to remove LE device from white list
5428  * Before calling this API, make sure that the adapter is enabled. There is no callback event for
5429  * this API.
5430  *
5431  *
5432  * This function is a synchronous call.
5433  *
5434  * @param[in] address The address of remote device
5435  *
5436  * @return      BLUETOOTH_ERROR_NONE - Success \n
5437  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
5438  *
5439  * @remark      None
5440  * @see         bluetooth_set_custom_advertising
5441  */
5442 int bluetooth_remove_white_list(bluetooth_device_address_t *address, bluetooth_device_address_type_t address_type);
5443
5444 /**
5445  * @fn int bluetooth_clear_white_list(void)
5446  * @brief Clear white list
5447  *
5448  * This API is used to clear white list
5449  * Before calling this API, make sure that the adapter is enabled. There is no callback event for
5450  * this API.
5451  *
5452  *
5453  * This function is a synchronous call.
5454  *
5455  * @param[in] address The address of remote device
5456  *
5457  * @return      BLUETOOTH_ERROR_NONE - Success \n
5458  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
5459  *
5460  * @remark      None
5461  * @see         bluetooth_set_custom_advertising
5462  */
5463 int bluetooth_clear_white_list(void);
5464
5465 /**
5466  * @fn int bluetooth_le_conn_update(bluetooth_device_address_t *address,
5467  *          const bluetooth_le_connection_param_t *parameters)
5468  * @brief update connection paramter of LE connection.
5469  *
5470  * This function is a synchronous call.
5471  *
5472  * @return   BLUETOOTH_ERROR_NONE  - Success \n
5473  *           BLUETOOTH_ERROR_INTERNAL - Internal Error \n
5474  *
5475  * @exception  None
5476  * @param[in]  address - remote device address value.
5477  * @param[in]  parameters - new connection parameters.
5478  *
5479  * @remark       None
5480  * @see     bluetooth_bond_device
5481  */
5482 int bluetooth_le_conn_update(const bluetooth_device_address_t *address,
5483             const bluetooth_le_connection_param_t *parameters);
5484
5485
5486 /**
5487  * @fn int bluetooth_enable_le_privacy(gboolean enable_privacy);
5488  *
5489  * @brief Enable/Disable LE Privacy feature.
5490  *
5491  * This function is used to enable or disable LE Privacy feature.
5492  * Once Privacy feature is enabled, Adapter can use Random Address for more security.
5493  *
5494  * This function is a synchronous call.
5495  *
5496  * @return      BLUETOOTH_ERROR_NONE - Success \n
5497  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
5498  *              BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
5499  *
5500  * @exception   None
5501  * @param[in]   enable_privacy - The status of Privacy feature to be activated/deactivated[True/False].
5502  *
5503  * @remark      None
5504  */
5505 int bluetooth_enable_le_privacy(gboolean enable_privacy);
5506
5507 /**
5508  * @fn int bluetooth_update_le_connection_mode(bluetooth_device_address_t *address,
5509  *                                             bluetooth_le_connection_mode_t mode)
5510  * @brief update connection paramter of LE connection.
5511  *
5512  * This function is a synchronous call.
5513  *
5514  * @return   BLUETOOTH_ERROR_NONE  - Success \n
5515  *           BLUETOOTH_ERROR_INTERNAL - Internal Error \n
5516  *           BLUETOOTH_ERROR_INVALID_PARAM - Parameter is not valid \n
5517  *
5518  * @exception  None
5519  * @param[in]  address - remote device address value.
5520  * @param[in]  mode - new connection mode.
5521  *
5522  * @remark       None
5523  */
5524 int bluetooth_update_le_connection_mode(const bluetooth_device_address_t *address,
5525                 bluetooth_le_connection_mode_t mode);
5526
5527 /**
5528  * @fn int bluetooth_le_read_maximum_data_length()
5529  * @brief reads the maximum LE data length supported in the controller.
5530  *
5531  * This function is a synchronous call.
5532  *
5533  * @return   BLUETOOTH_ERROR_NONE  - Success \n
5534  *           BLUETOOTH_ERROR_INTERNAL - Internal Error \n
5535  *
5536  * @exception  None
5537  *
5538  * @remark       None
5539  */
5540 int bluetooth_le_read_maximum_data_length(
5541                         bluetooth_le_read_maximum_data_length_t *max_le_datalength);
5542 /**
5543  * @fn int bluetooth_le_write_host_suggested_default_data_length()
5544  * @brief writes the host suggested values for the controllers max transmitted no of payload
5545  * octects to be used for new connections.
5546  *
5547  * This function is a synchronous call.
5548  *
5549  * @return   BLUETOOTH_ERROR_NONE  - Success \n
5550  *           BLUETOOTH_ERROR_INTERNAL - Internal Error \n
5551  *
5552  * @exception  None
5553  *
5554  * @remark       None
5555  */
5556 int bluetooth_le_write_host_suggested_default_data_length(
5557                 const unsigned int def_tx_Octets, const unsigned int def_tx_Time);
5558
5559 int bluetooth_le_read_suggested_default_data_length(
5560         bluetooth_le_read_host_suggested_data_length_t *le_data_length);
5561
5562 int bluetooth_le_set_data_length(bluetooth_device_address_t *address,
5563         const unsigned int max_tx_octets, const unsigned int max_tx_time);
5564
5565 int bluetooth_pbap_init(void);
5566 int bluetooth_pbap_deinit(void);
5567 int bluetooth_pbap_connect(const bluetooth_device_address_t *address);
5568 int bluetooth_pbap_disconnect(const bluetooth_device_address_t *address);
5569 int bluetooth_pbap_get_phonebook_size(const bluetooth_device_address_t *address,
5570                 bt_pbap_folder_t *folder);
5571 int bluetooth_pbap_get_phonebook(const bluetooth_device_address_t *address,
5572                 bt_pbap_folder_t *folder, bt_pbap_pull_parameters_t *app_param);
5573 int bluetooth_pbap_get_list(const bluetooth_device_address_t *address,
5574                 bt_pbap_folder_t *folder, bt_pbap_list_parameters_t *app_param);
5575 int bluetooth_pbap_pull_vcard(const bluetooth_device_address_t *address,
5576                 bt_pbap_folder_t *folder, bt_pbap_pull_vcard_parameters_t *app_param);
5577 int bluetooth_pbap_phonebook_search(const bluetooth_device_address_t *address,
5578                 bt_pbap_folder_t *folder, bt_pbap_search_parameters_t *app_param);
5579
5580 /**
5581  * @fn int bluetooth_set_manufacturer_data(const bluetooth_manufacturer_data_t *value);
5582  *
5583  * @brief Set manufacturer data with value
5584  *
5585  * This function is used to set manufacturer data.
5586  *
5587  * This function is a synchronous call.
5588  *
5589  * @return      BLUETOOTH_ERROR_NONE - Success \n
5590  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
5591  *              BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
5592  *
5593  * @exception   None
5594  * @param[in]   value - Manufacturer data structure.
5595  *
5596  * @remark      None
5597  */
5598 int bluetooth_set_manufacturer_data(const bluetooth_manufacturer_data_t *value);
5599 /**
5600  * @}
5601  */
5602
5603 #ifdef __cplusplus
5604 }
5605 #endif                          /* __cplusplus */
5606 #endif                          /* _BLUETOOTH_API_H_*/