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