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