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