BT 5.0 : Support for extended Scanning
[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 <stdbool.h>
23 #include <unistd.h>
24 #include <glib.h>
25 #include <stdint.h>
26
27
28 #ifdef __cplusplus
29 extern "C" {
30 #endif                          /* __cplusplus */
31
32 /**
33  * @defgroup BLUETOOTHFW BluetoothFW
34  *
35  * A base library for bluetooth framework
36  *
37  * @addtogroup BLUETOOTHFW
38  * @{
39  */
40
41 #define BLUETOOTH_ADDRESS_STRING_LENGTH         18 /**< This specifies bluetooth device address length (AA:BB:CC:DD:EE:FF) */
42 #define BLUETOOTH_ADDRESS_LENGTH                6 /**< This specifies bluetooth device address length */
43 #define BLUETOOTH_VERSION_LENGTH_MAX            30 /**< This specifies bluetooth device version length */
44 #define BLUETOOTH_INTERFACE_NAME_LENGTH         16
45 #define BLUETOOTH_DEVICE_NAME_LENGTH_MAX        248 /**< This specifies maximum device name length */
46 #define BLUETOOTH_DEVICE_PASSKEY_LENGTH_MAX       50 /**< This specifies maximum length of the passkey */
47 #define BLUETOOTH_ADVERTISING_DATA_LENGTH_MAX   31 /**< This specifies maximum AD data length */
48 #define BLUETOOTH_EXTENDED_ADVERTISING_DATA_LENGTH_MAX  255 /**< This specifies maximum AD data length */
49 #define BLUETOOTH_SCAN_RESP_DATA_LENGTH_MAX     31 /**< This specifies maximum LE Scan response data length */
50 #define BLUETOOTH_MANUFACTURER_DATA_LENGTH_MAX  240 /**< This specifies maximum manufacturer data length */
51 #define BLUETOOTH_APPEARANCE_LENGTH 2 /**< This specifies bluetooth device appearance characteristic length */
52
53 #define BLUETOOTH_MAX_SERVICES_FOR_DEVICE       40  /**< This specifies maximum number of services
54                                                         a device can support */
55
56 #define BLUETOOTH_MAX_ATT_MTU   512             /**< This specifies the maximum  ATT MTU Value*/
57
58 #define BLUETOOTH_UUID_STRING_MAX 50
59 #define BLUETOOTH_PATH_STRING 50
60
61 #define BLUETOOTH_OOB_DATA_LENGTH 16
62
63 #define BLUETOOTH_LE_OOB_DATA_LENGTH 100
64
65 #define BLUETOOTH_PIN_CODE_MAX_LENGTH 16
66
67 #define BLUETOOTH_GATT_ATT_DATA_LENGTH_MAX      610 /**< GATT ATT value max len */
68
69 /**
70  * This is Bluetooth Connected event role
71  */
72 #define RFCOMM_ROLE_SERVER 1
73 #define RFCOMM_ROLE_CLIENT 2
74
75 /**
76  * This is RFCOMM default Channel Value
77  */
78 #define RFCOMM_DEFAULT_PROFILE_CHANNEL 0
79 #define RFCOMM_ROBOT_PROFILE_CHANNEL 22
80
81 /**
82  * This is L2cap LE Socket Connected event role
83  */
84 #define L2CAP_LE_ROLE_SERVER 1
85 #define L2CAP_LE_ROLE_CLIENT 2
86
87 /**
88  * This is maximum length for search value string for PBAP Phonebook Search
89  */
90 #define BLUETOOTH_PBAP_MAX_SEARCH_VALUE_LENGTH 100
91
92
93 #define BLUETOOTH_MAX_DPM_LIST 20       /**< This specifies maximum number of devices/uuids
94                                                         dpm shall store */
95
96 #define BLUETOOTH_TDS_DATA_LENGTH_MAX   239 /**< This specifies maximum AD data length: 0xEF */
97 #define BLUETOOTH_TDS_CONTROL_POINT_PARAM_LENGTH_MAX   500 /**< TDS Control Point parameter Max length */
98
99 /*
100  * < This defines the maximum size of OTP server directory name
101  */
102 #define BLUETOOTH_MAX_OTP_SERVER_DIR_NAME 100
103
104 #define BLUETOOTH_OTP_CHARC_VAL_MAX_LENGTH   500 /**< OTP Characteristics Value Max length */
105
106 /**
107  * This is Bluetooth error code
108  */
109 #define BLUETOOTH_ERROR_BASE                   ((int)0)         /**< Error code base */
110
111 #define BLUETOOTH_ERROR_NONE                   ((int)0)         /**< No error #0 */
112 #define BLUETOOTH_ERROR_CANCEL                 ((int)BLUETOOTH_ERROR_BASE - 0x01)
113                                                                 /**< cancelled */
114 #define BLUETOOTH_ERROR_INVALID_CALLBACK       ((int)BLUETOOTH_ERROR_BASE - 0x02)
115                                                                 /**< Callback error */
116 #define BLUETOOTH_ERROR_INVALID_PARAM          ((int)BLUETOOTH_ERROR_BASE - 0x03)
117                                                                 /**< invalid paramerror */
118 #define BLUETOOTH_ERROR_INVALID_DATA           ((int)BLUETOOTH_ERROR_BASE - 0x04)
119                                                                 /**< invalid data error */
120 #define BLUETOOTH_ERROR_MEMORY_ALLOCATION      ((int)BLUETOOTH_ERROR_BASE - 0x05)
121                                                                 /**< Memory allocation error */
122 #define BLUETOOTH_ERROR_OUT_OF_MEMORY          ((int)BLUETOOTH_ERROR_BASE - 0x06)
123                                                                 /**< out of memory error */
124 #define BLUETOOTH_ERROR_TIMEOUT                ((int)BLUETOOTH_ERROR_BASE - 0x07)
125                                                                 /**< timeout error */
126 #define BLUETOOTH_ERROR_NO_RESOURCES           ((int)BLUETOOTH_ERROR_BASE - 0x08)
127                                                                 /**< No resource error */
128 #define BLUETOOTH_ERROR_INTERNAL               ((int)BLUETOOTH_ERROR_BASE - 0x09)
129                                                                 /**< internal error */
130 #define BLUETOOTH_ERROR_NOT_SUPPORT            ((int)BLUETOOTH_ERROR_BASE - 0x0a)
131                                                                 /**< Not supported error */
132 #define BLUETOOTH_ERROR_DEVICE_NOT_ENABLED     ((int)BLUETOOTH_ERROR_BASE - 0x0b)
133                                                                 /**< Operation is failed because
134                                                                 of not enabled BT Adapter */
135 #define BLUETOOTH_ERROR_DEVICE_ALREADY_ENABLED  ((int)BLUETOOTH_ERROR_BASE - 0x0c)
136                                                                 /**< Enabling is failed because of
137                                                                 already enabled BT Adapter */
138 #define BLUETOOTH_ERROR_DEVICE_BUSY            ((int)BLUETOOTH_ERROR_BASE - 0x0d)
139                                                                 /**< Operation is failed because of
140                                                                 other on going operation */
141 #define BLUETOOTH_ERROR_ACCESS_DENIED          ((int)BLUETOOTH_ERROR_BASE - 0x0e)
142                                                                 /**< access denied error */
143 #define BLUETOOTH_ERROR_MAX_CLIENT             ((int)BLUETOOTH_ERROR_BASE - 0x0f)
144                                                                 /**< max client error */
145 #define BLUETOOTH_ERROR_NOT_FOUND              ((int)BLUETOOTH_ERROR_BASE - 0x10)
146                                                                 /**< not found error */
147 #define BLUETOOTH_ERROR_SERVICE_SEARCH_ERROR   ((int)BLUETOOTH_ERROR_BASE - 0x11)
148                                                                 /**< service search fail */
149 #define BLUETOOTH_ERROR_PARING_FAILED          ((int)BLUETOOTH_ERROR_BASE - 0x12)
150                                                                 /**< pairing failed error */
151 #define BLUETOOTH_ERROR_NOT_PAIRED             ((int)BLUETOOTH_ERROR_BASE - 0x13)
152                                                                 /**< Not paired error */
153 #define BLUETOOTH_ERROR_SERVICE_NOT_FOUND      ((int)BLUETOOTH_ERROR_BASE - 0x14)
154                                                                 /**< no service error */
155 #define BLUETOOTH_ERROR_NOT_CONNECTED          ((int)BLUETOOTH_ERROR_BASE - 0x15)
156                                                                 /**< no connection error */
157 #define BLUETOOTH_ERROR_ALREADY_CONNECT        ((int)BLUETOOTH_ERROR_BASE - 0x16)
158                                                                 /**< alread connected error */
159 #define BLUETOOTH_ERROR_CONNECTION_BUSY        ((int)BLUETOOTH_ERROR_BASE - 0x17)
160                                                                 /**< connection busy error */
161 #define BLUETOOTH_ERROR_CONNECTION_ERROR       ((int)BLUETOOTH_ERROR_BASE - 0x18)
162                                                                 /**< connection error */
163 #define BLUETOOTH_ERROR_MAX_CONNECTION         ((int)BLUETOOTH_ERROR_BASE - 0x19)
164                                                                 /**< max connection error*/
165 #define BLUETOOTH_ERROR_NOT_IN_OPERATION       ((int)BLUETOOTH_ERROR_BASE - 0x1a)
166                                                                 /**< Not in operation */
167 #define BLUETOOTH_ERROR_CANCEL_BY_USER         ((int)BLUETOOTH_ERROR_BASE - 0x1b)
168                                                                 /**< Cancelled by user */
169 #define BLUETOOTH_ERROR_REGISTRATION_FAILED    ((int)BLUETOOTH_ERROR_BASE - 0x1c)
170                                                                 /**< Service record registration failed */
171 #define BLUETOOTH_ERROR_IN_PROGRESS            ((int)BLUETOOTH_ERROR_BASE - 0x1d)
172                                                                 /**< Operation in progress */
173 #define BLUETOOTH_ERROR_AUTHENTICATION_FAILED  ((int)BLUETOOTH_ERROR_BASE - 0x1e)
174                                                                 /**< authentication failed error when paring*/
175 #define BLUETOOTH_ERROR_HOST_DOWN              ((int)BLUETOOTH_ERROR_BASE - 0x1f)
176                                                                 /**< Remote host is down */
177 #define BLUETOOTH_ERROR_END_OF_DEVICE_LIST     ((int)BLUETOOTH_ERROR_BASE - 0x20)
178                                                                 /**< End of device list */
179
180 #define BLUETOOTH_ERROR_AGENT_ALREADY_EXIST      ((int)BLUETOOTH_ERROR_BASE - 0x21)
181                                                                 /**< Obex agent already exists */
182 #define BLUETOOTH_ERROR_AGENT_DOES_NOT_EXIST    ((int)BLUETOOTH_ERROR_BASE - 0x22)
183                                                                 /**< Obex agent does not exist */
184
185 #define BLUETOOTH_ERROR_ALREADY_INITIALIZED    ((int)BLUETOOTH_ERROR_BASE - 0x23)
186                                                                 /**< Already initialized */
187
188 #define BLUETOOTH_ERROR_PERMISSION_DEINED    ((int)BLUETOOTH_ERROR_BASE - 0x24)
189                                                                 /**< Permission deined */
190
191 #define BLUETOOTH_ERROR_ALREADY_DEACTIVATED    ((int)BLUETOOTH_ERROR_BASE - 0x25)
192                                                                 /**< Nap already done */
193
194 #define BLUETOOTH_ERROR_NOT_INITIALIZED    ((int)BLUETOOTH_ERROR_BASE - 0x26)
195                                                                 /**< Not initialized */
196
197 #define BLUETOOTH_ERROR_AUTHENTICATION_REJECTED ((int)BLUETOOTH_ERROR_BASE - 0x27)
198                                                                 /**< Authentication rejected */
199
200 #define BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION    ((int)BLUETOOTH_ERROR_BASE - 0x28)
201                                                                 /**< Device Policy Restricted */
202
203 #define BLUETOOTH_ERROR_NO_DATA    ((int)BLUETOOTH_ERROR_BASE - 0x29)
204                                                                 /**< No data */
205
206 #define BLUETOOTH_ERROR_AUTHORIZATION_REJECTED  ((int)BLUETOOTH_ERROR_BASE - 0x2a)
207                                                                 /**< Authorization rejected */
208
209 /**
210 * Error codes for ATT Error response *
211 */
212 #define BLUETOOTH_ATT_ERROR_INTERNAL                            -1
213 #define BLUETOOTH_ATT_ERROR_NONE                                0x00
214 #define BLUETOOTH_ATT_ERROR_INVALID_HANDLE                      0x01
215 #define BLUETOOTH_ATT_ERROR_READ_NOT_PERMITTED                  0x02
216 #define BLUETOOTH_ATT_ERROR_WRITE_NOT_PERMITTED                 0x03
217 #define BLUETOOTH_ATT_ERROR_INVALID_PDU                         0x04
218 #define BLUETOOTH_ATT_ERROR_AUTHENTICATION                      0x05
219 #define BLUETOOTH_ATT_ERROR_REQUEST_NOT_SUPPORTED               0x06
220 #define BLUETOOTH_ATT_ERROR_INVALID_OFFSET                      0x07
221 #define BLUETOOTH_ATT_ERROR_AUTHORIZATION                       0x08
222 #define BLUETOOTH_ATT_ERROR_PREPARE_QUEUE_FULL                  0x09
223 #define BLUETOOTH_ATT_ERROR_ATTRIBUTE_NOT_FOUND                 0x0A
224 #define BLUETOOTH_ATT_ERROR_ATTRIBUTE_NOT_LONG                  0x0B
225 #define BLUETOOTH_ATT_ERROR_INSUFFICIENT_ENCRYPTION_KEY_SIZE    0x0C
226 #define BLUETOOTH_ATT_ERROR_INVALID_ATTRIBUTE_VALUE_LEN         0x0D
227 #define BLUETOOTH_ATT_ERROR_UNLIKELY                            0x0E
228 #define BLUETOOTH_ATT_ERROR_INSUFFICIENT_ENCRYPTION             0x0F
229 #define BLUETOOTH_ATT_ERROR_UNSUPPORTED_GROUP_TYPE              0x10
230 #define BLUETOOTH_ATT_ERROR_INSUFFICIENT_RESOURCES              0x11
231 /* Common profile error codes */
232 #define BLUETOOTH_ATT_ERROR_WRITE_REQUEST_REJECTED              0xFC
233 #define BLUETOOTH_ATT_ERROR_CCCD_IMPROPERLY_CONFIGURED          0xFD
234 #define BLUETOOTH_ATT_ERROR_PROCEDURE_ALREADY_IN_PROGRESS       0xFE
235 #define BLUETOOTH_ATT_ERROR_OUT_OF_RANGE        0xFF
236
237 /*
238  * Bluetooth ATT error codes specific to OTP
239  */
240 #define BLUETOOTH_OTP_ERROR_WRITE_REQUEST_REJECTED      0x80
241 #define BLUETOOTH_OTP_ERROR_OBJECT_NOT_SELECTED 0x81
242 #define BLUETOOTH_OTP_ERROR_CONCURRENCY_LIMIT_EXCEEDED  0x82
243 #define BLUETOOTH_OTP_ERROR_OBJECT_NAME_EXISTS          0x83
244
245 /*
246  * Bluetooth OTP error codes
247  * TODO: Check error code conflict
248  */
249 #define BLUETOOTH_ERROR_INVALID_DIRECTORY       0x01
250 #define BLUETOOTH_ERROR_NO_OBJECTS_FOUND        0x02
251
252 /**
253  * Device disconnection reasons; received from stack
254  */
255 #define BLUETOOTH_ERROR_PAGE_TIMEOUT    0x04
256 #define BLUETOOTH_ERROR_AUTH_FAILURE    0x05
257 #define BLUETOOTH_ERROR_PIN_OR_KEY_MISSING      0x06
258 #define BLUETOOTH_ERROR_CONNECTION_TIMEOUT      0x08
259 #define BLUETOOTH_ERROR_CONNECTION_REJECTED_DUE_TO_SECURITY_REASONS 0x0e
260 #define BLUETOOTH_ERROR_REMOTE_USER_TERM        0x13
261 #define BLUETOOTH_ERROR_REMOTE_LOW_RESOURCES    0x14
262 #define BLUETOOTH_ERROR_REMOTE_POWER_OFF        0x15
263 #define BLUETOOTH_ERROR_LOCAL_HOST_TERM 0x16
264 #define BLUETOOTH_ERROR_REPEATED_ATTEMPTS       0x17
265 #define BLUETOOTH_ERROR_LMP_RESPONSE_TIMEOUT 0x22
266 #define BLUETOOTH_ERROR_LMP_TRANSACTION_COLLISION 0x23
267 #define BLUETOOTH_ERROR_INSTANT_PASSED 0x28
268 #define BLUETOOTH_ERROR_INSUFFICIENT_SECURITY 0x2f
269 #define BLUETOOTH_ERROR_CONNECTION_TERMINATED_DUE_TO_MIC_FAILURE 0x3d
270 #define BLUETOOTH_ERROR_CONNECTION_FAILED_TO_BE_ESTABLISHED     0x3e
271
272 /**
273 * Device disconnect reason
274 */
275 typedef enum {
276         BLUETOOTH_DEVICE_DISCONNECT_UNKNOWN,
277         BLUETOOTH_DEVICE_DISCONNECT_TIMEOUT,
278         BLUETOOTH_DEVICE_DISCONNECT_LOCAL_HOST,
279         BLUETOOTH_DEVICE_DISCONNECT_REMOTE,
280 } bluetooth_device_disconnect_reason_t;
281
282 /**
283  * This is Bluetooth device address type, fixed to 6 bytes ##:##:##:##:##:##
284  */
285 typedef struct {
286         unsigned char addr[BLUETOOTH_ADDRESS_LENGTH];
287 } bluetooth_device_address_t;
288
289 /**
290  * This is Bluetooth device address type
291  */
292 typedef enum {
293         BLUETOOTH_DEVICE_PUBLIC_ADDRESS = 0x00,
294         BLUETOOTH_DEVICE_RANDOM_ADDRESS
295 } bluetooth_device_address_type_t;
296
297 /**
298  * This is BD Address type defined in kernel BT header
299  */
300 typedef enum {
301         BLUETOOTH_BDADDR_BREDR = 0x00,
302         BLUETOOTH_BDADDR_LE_PUBLIC = 0x01,
303         BLUETOOTH_BDADDR_LE_RANDOM = 0x02
304 } bluetooth_bdaddr_type_e;
305
306 /**
307  * This is Bluetooth version
308  */
309 typedef struct {
310         char version[BLUETOOTH_VERSION_LENGTH_MAX + 1];
311 } bluetooth_version_t;
312
313 /**
314  * This is Bluetooth device name type, maximum size of Bluetooth device name is 248 bytes
315  */
316 typedef struct {
317         char name[BLUETOOTH_DEVICE_NAME_LENGTH_MAX + 1];
318 } bluetooth_device_name_t;
319
320 /**
321  * This is Bluetooth manufacturer specific data, maximum size of data is 240 bytes
322  */
323 typedef struct {
324         int data_len;           /**< manafacturer specific data length */
325         char data[BLUETOOTH_MANUFACTURER_DATA_LENGTH_MAX];
326 } bluetooth_manufacturer_data_t;
327
328 typedef struct {
329         char pin_code[BLUETOOTH_PIN_CODE_MAX_LENGTH + 1];
330 } bluetooth_device_pin_code_t;
331
332 /**
333  * This is data for battery usage monitoring
334  */
335
336 typedef struct {
337         time_t session_start_time;
338         time_t session_end_time;
339         uint32_t tx_time;
340         uint32_t rx_time;
341         uint32_t idle_time;
342         uint32_t session_connected_time;
343         uint32_t session_scan_time;
344         GSList *atm_list;
345 } bt_battery_data;
346
347 typedef struct {
348         uid_t uid;
349         pid_t pid;
350         uint32_t rx_bytes;
351         uint32_t tx_bytes;
352         uint time;
353 } bt_battery_app_data;
354
355 /**
356  * Adapter state
357  */
358 typedef enum {
359         BLUETOOTH_ADAPTER_DISABLED,         /**< Bluetooth adapter is disabled */
360         BLUETOOTH_ADAPTER_ENABLED,          /**< Bluetooth adapter is enabled */
361         BLUETOOTH_ADAPTER_CHANGING_ENABLE,  /**< Bluetooth adapter is currently enabling */
362         BLUETOOTH_ADAPTER_CHANGING_DISABLE, /**< Bluetooth adapter is currently disabling */
363 } bluetooth_adapter_state_t;
364
365 /**
366  * Adapter state
367  */
368 typedef enum {
369         BLUETOOTH_ADAPTER_LE_DISABLED,      /**< Bluetooth adapter le is disabled */
370         BLUETOOTH_ADAPTER_LE_ENABLED,       /**< Bluetooth adapter le is enabled */
371         BLUETOOTH_ADAPTER_LE_CHANGING_ENABLE,  /**< Bluetooth adapter le is currently enabling */
372         BLUETOOTH_ADAPTER_LE_CHANGING_DISABLE, /**< Bluetooth adapter le is currently disabling */
373 } bluetooth_adapter_le_state_t;
374
375 /**
376  * Discoverable mode
377  */
378 typedef enum {
379         BLUETOOTH_DISCOVERABLE_MODE_CONNECTABLE,         /**< Non discoverable mode */
380         /*Changed the order to make it compatable with old method */
381         BLUETOOTH_DISCOVERABLE_MODE_GENERAL_DISCOVERABLE,/**< Discoverable mode */
382         BLUETOOTH_DISCOVERABLE_MODE_TIME_LIMITED_DISCOVERABLE,
383                                                          /**< Discoverable mode with time limit
384                                                         After specific timeout, it is changed
385                                                                 to non discoverable mode */
386 } bluetooth_discoverable_mode_t;
387
388 /**
389  * Network connect mode
390  */
391 typedef enum {
392         BLUETOOTH_NETWORK_PANU_ROLE,
393                                  /**< PAN user */
394         BLUETOOTH_NETWORK_NAP_ROLE,/**< Network Access Point */
395         BLUETOOTH_NETWORK_GN_ROLE,  /**< Group ad-hoc Network */
396         BLUETOOTH_NETWORK_CUSTOM_UUID, /**< Custom role */
397 } bluetooth_network_role_t;
398
399 /**
400  * Service type
401  * Service type matched to bt_profile_type_t of bt-service-common.h
402  */
403 typedef enum {
404         BLUETOOTH_RFCOMM_SERVICE = 0x01,
405         BLUETOOTH_A2DP_SERVICE = 0x02,
406         BLUETOOTH_HSP_SERVICE = 0x04,
407         BLUETOOTH_HID_SERVICE = 0x08,
408         BLUETOOTH_NAP_SERVICE = 0x10,
409         BLUETOOTH_HFG_SERVICE = 0x20,
410         BLUETOOTH_GATT_SERVICE = 0x40,
411         BLUETOOTH_NAP_SERVER_SERVICE = 0x80,
412         BLUETOOTH_A2DP_SINK_SERVICE = 0x100,
413         BLUETOOTH_PBAP_SERVICE = 0x200,
414 } bluetooth_service_type_t;
415
416 /**
417  * Service type
418  */
419 typedef enum {
420         BLUETOOTH_DEV_CONN_DEFAULT = 0xFF,
421         /* represents that connection
422          * type can both BR/EDR and LE */
423         BLUETOOTH_DEV_CONN_BREDR = 0x00,
424         BLUETOOTH_DEV_CONN_LE = 0x01,
425 } bluetooth_conn_type_t;
426
427 /**
428  * Service type
429  */
430 typedef enum {
431         BLUETOOTH_CODEC_ID_CVSD = 0x01,
432         BLUETOOTH_CODEC_ID_MSBC = 0x02,
433 } bluetooth_codec_type_t;
434
435 /**
436  * Service type
437  */
438 typedef enum {
439         BLUETOOTH_HF_AUDIO_DISCONNECTED = 0x00,
440         BLUETOOTH_HF_AUDIO_CONNECTED = 0x01,
441 } bluetooth_hf_audio_connected_type_t;
442
443 /**
444  * Advertising data
445  */
446 typedef struct {
447         guint8 data[BLUETOOTH_ADVERTISING_DATA_LENGTH_MAX];
448 } bluetooth_advertising_data_t;
449
450 /**
451  * Scan response data
452  */
453 typedef struct {
454         guint8 data[BLUETOOTH_SCAN_RESP_DATA_LENGTH_MAX];
455 } bluetooth_scan_resp_data_t;
456
457 /**
458  * Advertising filter policy
459  */
460 typedef enum {
461         BLUETOOTH_ALLOW_SCAN_CONN_ALL = 0x00,
462         BLUETOOTH_ALLOW_CONN_ALL_SCAN_ALLOW_LIST = 0x01,
463         BLUETOOTH_ALLOW_SCAN_ALL_CONN_ALLOW_LIST = 0x02,
464         BLUETOOTH_ALLOW_SCAN_CONN_ALLOW_LIST = 0x03,
465 } bluetooth_advertising_filter_policy_t;
466
467 /**
468  * Advertising type
469  */
470 typedef enum {
471         BLUETOOTH_ADV_CONNECTABLE = 0x00, /* ADV_IND */
472         BLUETOOTH_ADV_CONNECTABLE_DIRECT_HIGH = 0x01, /* ADV_DIRECT_IND, high duty cycle */
473         BLUETOOTH_ADV_SCANNABLE = 0x02, /* ADV_SCAN_IND */
474         BLUETOOTH_ADV_NON_CONNECTABLE = 0x03, /* ADV_NONCOND_IND */
475         BLUETOOTH_ADV_CONNECTABLE_DIRECT_LOW = 0x04, /* ADV_DIRECT_IND, low duty cycle */
476 } bluetooth_advertising_type_t;
477
478 typedef enum {
479         BLUETOOTH_GATT_SERVICE_CHANGE_TYPE_ADD = 0x01,
480         BLUETOOTH_GATT_SERVICE_CHANGE_TYPE_REMOVE = 0x02,
481         BLUETOOTH_GATT_SERVICE_CHANGE_TYPE_RESYNC = 0x03,
482 } bluetooth_gatt_service_change_type_t;
483
484 typedef enum {
485         BLUETOOTH_GATT_PERMISSION_READ = 0x01,
486         BLUETOOTH_GATT_PERMISSION_WRITE = 0x02,
487         BLUETOOTH_GATT_PERMISSION_ENCRYPT_READ = 0x04,
488         BLUETOOTH_GATT_PERMISSION_ENCRYPT_WRITE = 0x08,
489         BLUETOOTH_GATT_PERMISSION_ENCRYPT_AUTHENTICATED_READ = 0x10,
490         BLUETOOTH_GATT_PERMISSION_ENCRYPT_AUTHENTICATED_WRITE = 0x20,
491 } bt_gatt_permission_t;
492
493 typedef enum {
494         BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_BROADCAST = 0x01,
495         BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_READ = 0x02,
496         BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_WRITE_NO_RESPONSE = 0x04,
497         BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_WRITE = 0x08,
498         BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_NOTIFY = 0x10,
499         BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_INDICATE = 0x20,
500         BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_SIGNED_WRITE = 0x40,
501         BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_RELIABLE_WRITE = 0x80,
502         BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_WRITABLE_AUXILIARIES = 0x100,
503         BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_ENCRYPT_READ = 0x200,
504         BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_ENCRYPT_WRITE = 0x400,
505         BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_ENCRYPT_AUTHENTICATED_READ = 0x800,
506         BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_ENCRYPT_AUTHENTICATED_WRITE = 0x1000,
507         BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_EXTENDED_PROPS = 0xffff,
508 } bt_gatt_characteristic_property_t;
509
510 /**
511 * Remote device request types for attributes
512 */
513 typedef enum {
514         BLUETOOTH_GATT_ATT_REQUEST_TYPE_READ = 0x00, /* Read Requested*/
515         BLUETOOTH_GATT_ATT_REQUEST_TYPE_WRITE = 0x01, /* Write Requested*/
516 } bluetooth_gatt_att_request_tyep_t;
517
518 /**
519  * Proximity Property Type
520  */
521 typedef enum {
522                 BLUETOOTH_PXP_PROPERTY_LLS = 0x01,      /* Link Loss Alert Proeprty */
523                 BLUETOOTH_PXP_PROPERTY_IAS = 0x02,      /* Immediate Alert Proeprty */
524                 BLUETOOTH_PXP_PROPERTY_TX_POWER = 0x04, /* TX Power */
525 } bluetooth_pxp_poperty_t;
526
527 /**
528  * TDS transport Type
529  */
530 typedef enum {
531                 BLUETOOTH_TDS_TRANSPORT_BT = 0x01,              /* Transport type BR-EDR */
532                 BLUETOOTH_TDS_TRANSPORT_CUSTOM,                 /* Transport type custom */
533                 BLUETOOTH_TDS_TRANSPORT_WIFI_NAN,               /* Wi-Fi Alliance Neighbor Awareness Networking */
534                 BLUETOOTH_TDS_TRANSPORT_WIFI_SVC_ADV,   /* Wi-Fi Alliance Service Advertisement */
535                 /* ... */
536                 BLUETOOTH_TDS_TRANSPORT_INVALID
537 } bluetooth_tds_transport_t;
538
539 /**
540  * TDS transport state
541  */
542 typedef enum {
543         BLUETOOTH_TDS_TRANSPORT_STATE_OFF = 0,
544         BLUETOOTH_TDS_TRANSPORT_STATE_ON,
545         BLUETOOTH_TDS_TRANSPORT_STATE_UNAVAILABLE,
546         BLUETOOTH_TDS_TRANSPORT_STATE_RESERVED
547 } bluetooth_tds_transport_state_t;
548
549 /**
550 * TDS data
551 */
552 typedef struct {
553         int length;
554         guint8 data[BLUETOOTH_TDS_DATA_LENGTH_MAX];
555 } bluetooth_tds_data_t;
556
557 /**
558 * TDS activation request
559 */
560 typedef struct {
561         bluetooth_device_address_t rem_addr;
562         bluetooth_tds_transport_t transport;
563         bluetooth_tds_data_t tds_data;
564 } bluetooth_tds_activation_req_t;
565
566 /**
567 * TDS Control Point data
568 */
569 typedef struct {
570         int length;                                                     /**< Control point data length */
571         guint8 data[BLUETOOTH_TDS_CONTROL_POINT_PARAM_LENGTH_MAX];      /**< Control pint param data */
572 } bluetooth_control_point_data_t;
573
574 /**
575 * TDS Indication Response data
576 */
577 typedef struct {
578         bluetooth_device_address_t rem_addr;         /**< Device address */
579         bluetooth_control_point_data_t tds_data;     /**< TDS Control Point Indication params */
580 } bluetooth_tds_indication_res_t;
581
582 /**
583 * Structure to hold the TDS Complete data information which is read from remote TDS provider
584 */
585 typedef struct {
586         bluetooth_device_address_t device_address;      /**< Device address */
587         int data_length;                        /**< Data length */
588         char *data;                             /**< Complete Transport Specific data */
589 } bluetooth_tds_transport_data_info_t;
590
591 /**
592 * OTP Characteristics Value
593 */
594 typedef struct {
595         int length;                                                     /**< Characteristics value length */
596         guint8 data[BLUETOOTH_OTP_CHARC_VAL_MAX_LENGTH];        /**< Characteristics data */
597 } bluetooth_otp_charc_data_t;
598
599 /**
600 * Structure to hold the OTP response data from remote OTP server
601 */
602 typedef struct {
603         char *handle;      /**< Handle */
604         int data_length;                        /**< Data length */
605         char *data;                             /**< Read data */
606 } bluetooth_otp_resp_info_t;
607
608 /**
609 * Structure to hold the OTC Channel Info
610 */
611 typedef struct {
612         gboolean connected;     /**< Connection Status */
613         int fd;                         /**< Fd */
614         char *address;      /**< Remote address */
615 } bluetooth_otc_info_t;
616
617 /**
618 * Advertising parameters
619 */
620 typedef struct {
621         int interval_min;
622         int interval_max;
623         guint8 filter_policy;
624         guint8 type;
625         int tx_power_level;
626 } bluetooth_advertising_params_t;
627
628 /**
629 * LE Scan parameters
630 */
631 typedef struct {
632         int type;  /**< passive 0, active 1 */
633         float interval;  /**< LE scan interval */
634         float window;  /**< LE scan window */
635 } bluetooth_le_scan_params_t;
636
637 /**
638 * LE Scan type
639 */
640 typedef enum {
641         BLUETOOTH_LE_PASSIVE_SCAN = 0x00,
642         BLUETOOTH_LE_ACTIVE_SCAN
643 } bluetooth_le_scan_type_t;
644
645 typedef enum {
646         BLUETOOTH_LE_SCAN_ALL = 0x00,
647         BLUETOOTH_LE_SCAN_LEGACY_ONLY,
648         BLUETOOTH_LE_SCAN_EXTENDED_ONLY
649 } bluetooth_le_scan_role_t;
650
651 typedef enum {
652         BLUETOOTH_ALL_PHY = 0x00,
653         BLUETOOTH_1M_PHY = 0x01,
654         BLUETOOTH_ONE_M_CODED_PHY = 0x03
655 } bleutooth_le_scanning_phy_t;
656
657 /*
658         LE Connection Update
659  */
660 typedef struct {
661         float interval_min;
662         float interval_max;
663         guint16 latency;
664         guint16 timeout;
665 } bluetooth_le_connection_param_t;
666
667 /*
668         LE Read Maximum Data Length
669  */
670 typedef struct {
671         guint16 max_tx_octets;
672         guint16 max_tx_time;
673         guint16 max_rx_octets;
674         guint16 max_rx_time;
675 } bluetooth_le_read_maximum_data_length_t;
676
677 /*
678         LE Read Host suggested default Data Length
679  */
680 typedef struct {
681         guint16 def_tx_octets;
682         guint16 def_tx_time;
683 } bluetooth_le_read_host_suggested_data_length_t;
684
685 /**
686  * Samsung XSAT Vendor dependent command
687  */
688 typedef struct {
689         gint app_id;
690         char *message;
691 } bluetooth_vendor_dep_at_cmd_t;
692
693 /**
694  * Transfer Types
695  */
696 typedef enum {
697         BLUETOOTH_TRANSFER_INBOUND,         /**< Inbound Transfer Type */
698         BLUETOOTH_TRANSFER_OUTBOUND,        /**< Outbound Transfer Type */
699 } bluetooth_opp_transfer_type_t;
700
701 typedef struct {
702         gint event;
703         gint value;
704 } bluetooth_hf_ciev_device_event_t;
705
706 #define BLUETOOTH_EVENT_BASE            ((int)(0x0000))         /**< No event */
707 #define BLUETOOTH_EVENT_GAP_BASE        ((int)(BLUETOOTH_EVENT_BASE + 0x0010))
708                                                                 /**< Base ID for GAP Event */
709 #define BLUETOOTH_EVENT_SDP_BASE        ((int)(BLUETOOTH_EVENT_GAP_BASE + 0x0020))
710                                                                 /**< Base ID for SDP events */
711 #define BLUETOOTH_EVENT_RFCOMM_BASE     ((int)(BLUETOOTH_EVENT_SDP_BASE + 0x0020))
712                                                                 /**< Base ID for RFCOMM events */
713 #define BLUETOOTH_EVENT_NETWORK_BASE     ((int)(BLUETOOTH_EVENT_RFCOMM_BASE + 0x0020))
714                                                                 /**< Base ID for NETWORK events */
715 #define BLUETOOTH_EVENT_HDP_BASE     ((int)(BLUETOOTH_EVENT_NETWORK_BASE + 0x0020))
716                                                                 /**< Base ID for HDP events */
717 #define BLUETOOTH_EVENT_OPC_BASE  ((int)(BLUETOOTH_EVENT_HDP_BASE + 0x0020))
718                                                                 /**< Base ID for OPC events */
719 #define BLUETOOTH_EVENT_OBEX_SERVER_BASE ((int)(BLUETOOTH_EVENT_OPC_BASE + 0x0020))
720                                                                 /**< Base ID for Obex Server events */
721 #define BLUETOOTH_EVENT_GATT_BASE ((int)(BLUETOOTH_EVENT_OBEX_SERVER_BASE + 0x0020))
722                                                                 /**< Base ID for GATT events */
723
724 #define BLUETOOTH_EVENT_AUDIO_BASE ((int)(BLUETOOTH_EVENT_GATT_BASE + 0x0020))
725                                                                 /**< Base ID for Audio events */
726 #define BLUETOOTH_EVENT_HID_BASE ((int)(BLUETOOTH_EVENT_AUDIO_BASE + 0x0030))
727                                                                 /**< Base ID for HID events */
728 #define BLUETOOTH_EVENT_ADVERTISING_BASE ((int)(BLUETOOTH_EVENT_HID_BASE + 0x0020))
729                                                                 /**< Base ID for Advertising events */
730 #define BLUETOOTH_EVENT_PBAP_CLIENT_BASE ((int)(BLUETOOTH_EVENT_ADVERTISING_BASE + 0x0020))
731                                                                 /**< Base ID for PBAP Client events */
732 #define BLUETOOTH_EVENT_AVRCP_CONTROL_BASE ((int)(BLUETOOTH_EVENT_PBAP_CLIENT_BASE + 0x0020))
733                                                                 /**< Base ID for AVRCP events */
734 #define BLUETOOTH_EVENT_IPSP_BASE ((int)(BLUETOOTH_EVENT_AVRCP_CONTROL_BASE + 0x0020))
735                                                                 /**< Base ID for IPSP events */
736 #define BLUETOOTH_EVENT_MAP_BASE  ((int)(BLUETOOTH_EVENT_IPSP_BASE + 0x0020))
737                                                                 /**< Base ID for MAP events */
738 #define BLUETOOTH_EVENT_MESH_BASE  ((int)(BLUETOOTH_EVENT_MAP_BASE + 0x0020))
739                                                                 /**< Base ID for MAP events */
740 #define BLUETOOTH_EVENT_L2CAP_LE_BASE  ((int)(BLUETOOTH_EVENT_MESH_BASE + 0x0040))
741                                                                 /**< Base ID for L2CAP_LE events */
742
743 /**
744  * Bluetooth event type
745  */
746 typedef enum {
747         BLUETOOTH_EVENT_NONE = BLUETOOTH_EVENT_BASE,/**< No event */
748
749         BLUETOOTH_EVENT_ENABLED,                    /**< Bluetooth event adpater enabled */
750         BLUETOOTH_EVENT_DISABLED,                   /**< Bluetooth event adpater disabled */
751         BLUETOOTH_EVENT_DISABLED_BATTERY_DATA,      /**< Bluetooth event adapter disabled battery data*/
752         BLUETOOTH_EVENT_LE_ENABLED,                 /**< Bluetooth event adpater enabled */
753         BLUETOOTH_EVENT_LE_DISABLED,                /**< Bluetooth event adpater disabled */
754         BLUETOOTH_EVENT_LOCAL_NAME_CHANGED,         /**< Bluetooth event local name changed*/
755         BLUETOOTH_EVENT_DISCOVERABLE_TIMEOUT_REQUESTED,
756                                         /**< Bluetooth event Discoverable timeout requested*/
757         BLUETOOTH_EVENT_DISCOVERABLE_MODE_CHANGED,  /**< Bluetooth event mode changed */
758         BLUETOOTH_EVENT_DISCOVERY_OPTION_REQUESTED, /**< Bluetooth event discovery option */
759         BLUETOOTH_EVENT_DISCOVERY_STARTED,          /**< Bluetooth event discovery started */
760         BLUETOOTH_EVENT_DISCOVERY_FINISHED,         /**< Bluetooth event discovery finished */
761         BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND,        /**< Bluetooth event remote deice found */
762         BLUETOOTH_EVENT_LE_DISCOVERY_STARTED,           /**< Bluetooth event LE discovery started */
763         BLUETOOTH_EVENT_LE_DISCOVERY_FINISHED,  /**< Bluetooth event LE discovery finished */
764         BLUETOOTH_EVENT_REMOTE_LE_DEVICE_FOUND,     /**< Bluetooth event remote deice found (LE dev) */
765         BLUETOOTH_EVENT_REMOTE_DEVICE_NAME_UPDATED,/**< Bluetooth event remote device name updated*/
766         BLUETOOTH_EVENT_BONDING_FINISHED,           /**< Bluetooth event bonding completed */
767         BLUETOOTH_EVENT_BONDED_DEVICE_REMOVED,      /**< Bluetooth event bonding removed */
768         BLUETOOTH_EVENT_BONDED_DEVICE_FOUND,        /**< Bluetooth event paired device found */
769         BLUETOOTH_EVENT_REMOTE_DEVICE_READ,         /**< Bluetooth event read remote device */
770         BLUETOOTH_EVENT_DEVICE_AUTHORIZED,          /**< Bluetooth event authorize device */
771         BLUETOOTH_EVENT_DEVICE_UNAUTHORIZED,        /**< Bluetooth event unauthorize device */
772         BLUETOOTH_EVENT_DISCOVERABLE_TIMEOUT_CHANGED,  /**< Bluetooth event mode changed */
773         BLUETOOTH_EVENT_KEYBOARD_PASSKEY_DISPLAY,       /**Bluetooth event for displaying keyboard  passkey to user*/
774         BLUETOOTH_EVENT_PIN_REQUEST,    /**Bluetooth event for PIN input by user*/
775         BLUETOOTH_EVENT_PASSKEY_REQUEST,        /**Bluetooth event for entering Passkey by user*/
776         BLUETOOTH_EVENT_PASSKEY_CONFIRM_REQUEST,        /**Bluetooth event for Passkey confirmation by user*/
777         BLUETOOTH_EVENT_CONNECTABLE_CHANGED,        /**< Bluetooth event connectable changed */
778
779         BLUETOOTH_EVENT_RSSI_ENABLED,           /**< Bluetooth event RSSI monitoring enabled */
780         BLUETOOTH_EVENT_RSSI_ALERT,                             /**< Bluetooth event RSSI Alert */
781         BLUETOOTH_EVENT_RAW_RSSI,                               /**< Bluetooth event Raw RSSI */
782         BLUETOOTH_EVENT_SUPPORTED_PROFILE_TRUSTED,      /**< Bluetooth event Supported Profile Trusted */
783         BLUETOOTH_EVENT_PASSKEY_NOTIFICATION,       /**< Bluetooth event passkey notification */
784
785         BLUETOOTH_EVENT_SERVICE_SEARCHED = BLUETOOTH_EVENT_SDP_BASE,
786                                                     /**< Bluetooth event serice search base id */
787         BLUETOOTH_EVENT_SERVICE_SEARCH_CANCELLED,   /**< Bluetooth event service search cancelled */
788         BLUETOOTH_EVENT_RFCOMM_DATA_RECEIVED = BLUETOOTH_EVENT_RFCOMM_BASE,
789                                                         /**< RFCOMM data receive event */
790         BLUETOOTH_EVENT_RFCOMM_CONNECTED,               /**< Rfcomm server incomming connection */
791         BLUETOOTH_EVENT_RFCOMM_DISCONNECTED,            /**< Rfcomm server/client disconnect */
792
793         BLUETOOTH_EVENT_RFCOMM_AUTHORIZE,
794
795         BLUETOOTH_EVENT_DEVICE_CONNECTED,           /**< Bluetooth event device connected */
796         BLUETOOTH_EVENT_DEVICE_DISCONNECTED,        /**< Bluetooth event device disconnected */
797
798         BLUETOOTH_EVENT_RFCOMM_SERVER_REMOVED,
799
800         BLUETOOTH_EVENT_NETWORK_SERVER_ACTIVATED = BLUETOOTH_EVENT_NETWORK_BASE,
801                                                                 /**< Bluetooth Network event */
802         BLUETOOTH_EVENT_NETWORK_SERVER_DEACTIVATED, /**< Network server deactivated */
803         BLUETOOTH_EVENT_NETWORK_SERVER_CONNECTED,     /**< Network connected event in server */
804         BLUETOOTH_EVENT_NETWORK_SERVER_DISCONNECTED,
805                                                    /**< Network disconnected evnet in server */
806
807         BLUETOOTH_EVENT_NETWORK_CONNECTED,              /**< Network connected event in client*/
808         BLUETOOTH_EVENT_NETWORK_DISCONNECTED,           /**< Network disconnected evnet in client*/
809
810         BLUETOOTH_EVENT_HDP_CONNECTED
811                         = BLUETOOTH_EVENT_HDP_BASE,                /**<HDP Connect>*/
812         BLUETOOTH_EVENT_HDP_DISCONNECTED,          /**<HDP Disconnect>*/
813         BLUETOOTH_EVENT_HDP_DATA_RECEIVED,         /**<HDP Data Indication>*/
814
815         BLUETOOTH_EVENT_OPC_CONNECTED = BLUETOOTH_EVENT_OPC_BASE,
816                                                                 /* OPC Connected event */
817         BLUETOOTH_EVENT_OPC_DISCONNECTED,               /* OPC Disonnected event */
818         BLUETOOTH_EVENT_OPC_TRANSFER_STARTED,   /* OPC Transfer started event */
819         BLUETOOTH_EVENT_OPC_TRANSFER_PROGRESS,  /* OPC Transfer progress event */
820         BLUETOOTH_EVENT_OPC_TRANSFER_COMPLETE,  /* OPC Transfer Complete event */
821
822         BLUETOOTH_EVENT_MAP_CONNECTED = BLUETOOTH_EVENT_MAP_BASE,
823         BLUETOOTH_EVENT_MAP_DISCONNECTED,
824         /*
825         BLUETOOTH_EVENT_MAP_SET_FOLDER_COMPLETE,
826         BLUETOOTH_EVENT_MAP_SET_FOLDER_INVALID_ARGUMENTS,
827         BLUETOOTH_EVENT_MAP_SET_FOLDER_FAILED,
828         BLUETOOTH_EVENT_MAP_UPDATE_INBOX_COMPLETE,
829         BLUETOOTH_EVENT_MAP_UPDATE_INBOX_FAILED,
830         */
831         BLUETOOTH_EVENT_MAP_LIST_FOLDERS_COMPLETE,
832         BLUETOOTH_EVENT_MAP_LIST_FOLDERS_INVALID_ARGUMENTS,
833         BLUETOOTH_EVENT_MAP_LIST_FOLDERS_FAILED,
834         BLUETOOTH_EVENT_MAP_LIST_MESSAGES_COMPLETE,
835         BLUETOOTH_EVENT_MAP_LIST_MESSAGES_INVALID_ARGUMENTS,
836         BLUETOOTH_EVENT_MAP_LIST_MESSAGES_FAILED,
837         BLUETOOTH_EVENT_MAP_PUSH_MESSAGE_COMPLETE,
838         BLUETOOTH_EVENT_MAP_PUSH_MESSAGE_INVALID_ARGUMENTS,
839         BLUETOOTH_EVENT_MAP_PUSH_MESSAGE_FAILED,
840         BLUETOOTH_EVENT_MAP_GET_MESSAGE_COMPLETE,
841         BLUETOOTH_EVENT_MAP_GET_MESSAGE_INVALID_ARGUMENTS,
842         BLUETOOTH_EVENT_MAP_GET_MESSAGE_FAILED,
843         BLUETOOTH_EVENT_MAP_LIST_FILTER_FIELD_COMPLETE,
844
845         BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_AUTHORIZE = BLUETOOTH_EVENT_OBEX_SERVER_BASE,
846                                                                 /* Obex server authorize event*/
847         BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_STARTED,   /* Obex Server transfer started event*/
848         BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_PROGRESS,/* Obex Server transfer progress event*/
849         BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_COMPLETED,/* Obex Server transfer complete event*/
850         BLUETOOTH_EVENT_OBEX_SERVER_CONNECTION_AUTHORIZE,
851         BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_CONNECTED, /* Obex Transfer connected event */
852         BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_DISCONNECTED, /* Obex Transfer disconnected event */
853
854         BLUETOOTH_EVENT_GATT_SVC_CHAR_DISCOVERED = BLUETOOTH_EVENT_GATT_BASE,
855                                 /**<Discovered GATT service characteristics event*/
856         BLUETOOTH_EVENT_GATT_CHAR_VAL_CHANGED,
857                                 /**<Remote GATT charateristic value changed event*/
858         BLUETOOTH_EVENT_GATT_GET_CHAR_FROM_UUID,
859         BLUETOOTH_EVENT_GATT_READ_CHAR, /**<Gatt Read Characteristic Value */
860         BLUETOOTH_EVENT_GATT_WRITE_CHAR, /**<Gatt Write Characteristic Value */
861         BLUETOOTH_EVENT_GATT_READ_DESC, /**<Gatt Read Characteristic Descriptor Value */
862         BLUETOOTH_EVENT_GATT_WRITE_DESC, /**<Gatt Write Characteristic Descriptor Value */
863         BLUETOOTH_EVENT_GATT_SVC_CHAR_DESC_DISCOVERED, /**<Gatt Char Descriptors Discovered Event*/
864         BLUETOOTH_EVENT_GATT_SERVER_CONNECTED,/**<Local Gatt Server connected event */
865         BLUETOOTH_EVENT_GATT_SERVER_DISCONNECTED, /**<Local Gatt Server Disconnected event */
866         BLUETOOTH_EVENT_GATT_CLIENT_CONNECTED,/**<Local Gatt Client connected event */
867         BLUETOOTH_EVENT_GATT_CLIENT_DISCONNECTED, /**<Local Gatt Client Disconnected event */
868         BLUETOOTH_EVENT_GATT_ATT_MTU_CHANGED, /**<Attribute protocol MTU changed event */
869         BLUETOOTH_EVENT_GATT_SERVER_ATT_MTU_CHANGED, /**<Attribute protocol Server MTU changed event */
870         BLUETOOTH_EVENT_GATT_SERVER_CHARACTERISTIC_VALUE_CHANGED, /**<Gatt Char write callback event */
871         BLUETOOTH_EVENT_GATT_SERVER_READ_REQUESTED, /** <GATT Characteristic/Descriptor Read Request event */
872         BLUETOOTH_EVENT_GATT_SERVER_VALUE_CHANGED, /** <GATT Characteristic/Descriptor Value change event */
873         BLUETOOTH_EVENT_GATT_SERVER_NOTIFICATION_STATE_CHANGED, /** <GATT Characteristic Notification change event */
874         BLUETOOTH_EVENT_GATT_SERVER_NOTIFICATION_COMPLETED, /** <GATT Characteristic Notification or Indication completed event */
875         BLUETOOTH_EVENT_GATT_CLIENT_SERVICE_CHANGED, /** <GATT Client service change event */
876         BLUETOOTH_EVENT_GATT_SERVER_ACQUIRE_WRITE, /** <GATT Characteristic/Descriptor Value change event */
877         BLUETOOTH_EVENT_GATT_SERVER_ACQUIRE_NOTIFY,
878         BLUETOOTH_EVENT_AG_CONNECTED = BLUETOOTH_EVENT_AUDIO_BASE, /**<AG service connected event*/
879         BLUETOOTH_EVENT_AG_DISCONNECTED, /**<AG service disconnected event*/
880         BLUETOOTH_EVENT_AG_SPEAKER_GAIN, /**<Speaker gain request event*/
881         BLUETOOTH_EVENT_AG_MIC_GAIN, /**<Mic gain request event*/
882         BLUETOOTH_EVENT_AG_AUDIO_CONNECTED, /**<AV & AG service connected event*/
883         BLUETOOTH_EVENT_AG_AUDIO_DISCONNECTED,  /**<AV & AG service disconnected event*/
884         BLUETOOTH_EVENT_AV_CONNECTED, /**<AV service connected event*/
885         BLUETOOTH_EVENT_AV_DISCONNECTED, /**<AV service disconnected event*/
886         BLUETOOTH_EVENT_AV_SOURCE_CONNECTED, /**<AV Source device connected event */
887         BLUETOOTH_EVENT_AV_SOURCE_DISCONNECTED, /**<AV Source device disconnected event */
888         BLUETOOTH_EVENT_AVRCP_CONNECTED, /**<AVRCP service connected event*/
889         BLUETOOTH_EVENT_AVRCP_DISCONNECTED, /**<AVRCP service disconnected event*/
890         BLUETOOTH_EVENT_AVRCP_SETTING_SHUFFLE_STATUS, /**<AVRCP service player suffle  status event*/
891         BLUETOOTH_EVENT_AVRCP_SETTING_EQUALIZER_STATUS, /**<AVRCP service player equalizer status event*/
892         BLUETOOTH_EVENT_AVRCP_SETTING_REPEAT_STATUS, /**<AVRCP service player repeat status event*/
893         BLUETOOTH_EVENT_AVRCP_SETTING_SCAN_STATUS, /**<AVRCP service player scan status event*/
894         BLUETOOTH_EVENT_AVRCP_DELAY_CHANGED, /**<AVRCP service transport delay changed event*/
895         BLUETOOTH_EVENT_AVRCP_VOLUME_CHANGED, /**<AVRCP service transport volume changed event*/
896         BLUETOOTH_EVENT_AUDIO_AVC_STATUS, /**<Absolute Volume Control status changed event*/
897         BLUETOOTH_EVENT_HF_CONNECTED,
898         BLUETOOTH_EVENT_HF_DISCONNECTED,
899         BLUETOOTH_EVENT_HF_AUDIO_CONNECTED,
900         BLUETOOTH_EVENT_HF_AUDIO_DISCONNECTED,
901         BLUETOOTH_EVENT_HF_RING_INDICATOR,
902         BLUETOOTH_EVENT_HF_CALL_WAITING,
903         BLUETOOTH_EVENT_HF_CALL_TERMINATED,
904         BLUETOOTH_EVENT_HF_CALL_STARTED,
905         BLUETOOTH_EVENT_HF_CALL_ENDED,
906         BLUETOOTH_EVENT_HF_CALL_UNHOLD,
907         BLUETOOTH_EVENT_HF_CALL_SWAPPED,
908         BLUETOOTH_EVENT_HF_CALL_ON_HOLD,
909         BLUETOOTH_EVENT_HF_CALL_STATUS,
910         BLUETOOTH_EVENT_HF_VOICE_RECOGNITION_ENABLED,
911         BLUETOOTH_EVENT_HF_VOICE_RECOGNITION_DISABLED,
912         BLUETOOTH_EVENT_HF_VOLUME_SPEAKER,
913         BLUETOOTH_EVENT_HF_VENDOR_DEP_CMD,
914         BLUETOOTH_EVENT_HF_CALLSETUP_INCOMING,
915         BLUETOOTH_EVENT_HF_CALL_FAILED_TO_DIAL,
916         BLUETOOTH_EVENT_HF_CALL_IDLE,
917         BLUETOOTH_EVENT_HF_CALLSETUP_DIALING,
918         BLUETOOTH_EVENT_HF_CALLSETUP_ALERTING,
919         BLUETOOTH_EVENT_HF_CIEV_DEVICE_STATUS_CHANGED,
920         BLUETOOTH_EVENT_AUDIO_AVC_MODE_CHANGED,
921
922         BLUETOOTH_HID_CONNECTED = BLUETOOTH_EVENT_HID_BASE, /**< Input connectd event*/
923         BLUETOOTH_HID_DISCONNECTED, /**< Input disconnectd event*/
924         BLUETOOTH_HID_DEVICE_CONNECTED, /**< HID Device connected event*/
925         BLUETOOTH_HID_DEVICE_DISCONNECTED, /**< HID Device disconnected event*/
926         BLUETOOTH_HID_DEVICE_DATA_RECEIVED, /**< HID Device data received event*/
927
928         BLUETOOTH_EVENT_ADVERTISING_STARTED = BLUETOOTH_EVENT_ADVERTISING_BASE, /**< Advertising started event */
929         BLUETOOTH_EVENT_ADVERTISING_STOPPED, /**< Advertising stopped event */
930         BLUETOOTH_EVENT_ADVERTISING_MANUFACTURER_DATA_CHANGED, /**< Advertising manufacturer data changed event */
931         BLUETOOTH_EVENT_SCAN_RESPONSE_MANUFACTURER_DATA_CHANGED, /**< Scan response manufacturer data changed event */
932         BLUETOOTH_EVENT_MANUFACTURER_DATA_CHANGED, /**< Manufacturer data changed event */
933         BLUETOOTH_EVENT_DEVICE_ERROR, /**< Hardware error */
934         BLUETOOTH_EVENT_TX_TIMEOUT_ERROR, /** TX Timeout Error*/
935         BLUETOOTH_EVENT_MAX, /**< Bluetooth event Max value */
936
937         BLUETOOTH_PBAP_CONNECTED = BLUETOOTH_EVENT_PBAP_CLIENT_BASE, /**< PBAP connected event*/
938         BLUETOOTH_PBAP_DISCONNECTED, /**< PBAP disconnectd event*/
939         BLUETOOTH_PBAP_PHONEBOOK_SIZE, /**< PBAP Phonebook Size event*/
940         BLUETOOTH_PBAP_PHONEBOOK_PULL, /**< PBAP Phonebook Pull event*/
941         BLUETOOTH_PBAP_VCARD_LIST, /**< PBAP vCard List event*/
942         BLUETOOTH_PBAP_VCARD_PULL, /**< PBAP vCard Pull event*/
943         BLUETOOTH_PBAP_PHONEBOOK_SEARCH, /**< PBAP Phonebook Search event*/
944
945         BLUETOOTH_EVENT_AVRCP_CONTROL_CONNECTED = BLUETOOTH_EVENT_AVRCP_CONTROL_BASE, /**<AVRCP service connected event*/
946         BLUETOOTH_EVENT_AVRCP_CONTROL_DISCONNECTED, /**<AVRCP service disconnected event*/
947         BLUETOOTH_EVENT_AVRCP_CONTROL_SHUFFLE_STATUS, /**<AVRCP control suffle  status event*/
948         BLUETOOTH_EVENT_AVRCP_CONTROL_EQUALIZER_STATUS, /**<AVRCP control equalizer status event*/
949         BLUETOOTH_EVENT_AVRCP_CONTROL_REPEAT_STATUS, /**<AVRCP control repeat status event*/
950         BLUETOOTH_EVENT_AVRCP_CONTROL_SCAN_STATUS, /**<AVRCP control scan status event*/
951         BLUETOOTH_EVENT_AVRCP_SONG_POSITION_STATUS, /**<AVRCP control play Postion status event*/
952         BLUETOOTH_EVENT_AVRCP_PLAY_STATUS_CHANGED, /**<AVRCP control play status event*/
953         BLUETOOTH_EVENT_AVRCP_TRACK_CHANGED, /**<AVRCP control song metadata event*/
954
955         BLUETOOTH_EVENT_IPSP_INIT_STATE_CHANGED = BLUETOOTH_EVENT_IPSP_BASE, /**<IPSP init event*/
956         BLUETOOTH_EVENT_IPSP_CONNECTED, /**< IPSP connected event  */
957         BLUETOOTH_EVENT_IPSP_DISCONNECTED, /**< IPSP Disconnected event */
958         BLUETOOTH_EVENT_IPSP_INTERFACE_INFO, /** IPSP BT Interface Info after connection */
959         BLUETOOTH_EVENT_LE_DATA_LENGTH_CHANGED,  /** LE data length values changed */
960         BLUETOOTH_EVENT_PXP_PROPERTY_CHANGED, /** Proximity property changed */
961         BLUETOOTH_EVENT_TDS_ACTIVATION_REQUESTED, /** TDS activation requested */
962         BLUETOOTH_EVENT_TDS_TRANSPORT_DATA_RECEIVED,  /** TDS Transport Data received */
963         BLUETOOTH_EVENT_TDS_ACTIVATION_RESULT,        /** TDS Activation Result */
964         BLUETOOTH_EVENT_TDS_CONTROL_POINT_ENABLED,    /** TDS CCCD enabled event */
965         BLUETOOTH_EVENT_TDS_ACTIVATION_INDICATION,    /** TDS Activation Indication from Provider */
966
967         BLUETOOTH_EVENT_OTP_SERVER_STATE_CHANGED,       /* OTP Server Status **/
968         BLUETOOTH_EVENT_OTP_READ_CHAR_VAL,      /* OTP Read Value Response */
969         BLUETOOTH_EVENT_OTP_NOTIFICATION_ENABLED,       /* OTP Notification Enabled Response */
970         BLUETOOTH_EVENT_OTP_WRITE_CHAR_VAL,     /* OTP Write Value Response */
971         BLUETOOTH_EVENT_OTP_INDICATION, /* OTP Indication */
972         BLUETOOTH_EVENT_OTC_STATE_CHANGED,              /* OTC Connection State Changed Event */
973         BLUETOOTH_EVENT_MESH_SCAN_STARTED = BLUETOOTH_EVENT_MESH_BASE,
974         BLUETOOTH_EVENT_MESH_SCAN_FINISHED,
975         BLUETOOTH_EVENT_MESH_SCAN_RESULT,
976         BLUETOOTH_EVENT_MESH_AUTHENTICATION_REQUEST,
977         BLUETOOTH_EVENT_MESH_PROVISIONING_FINISHED,
978         BLUETOOTH_EVENT_MESH_NODE_BROWSED,
979         BLUETOOTH_EVENT_MESH_NODE_VENDOR_FEATURES,
980         BLUETOOTH_EVENT_MESH_NODE_KEY_CONFIGURED,
981         BLUETOOTH_EVENT_MESH_NODE_TTL_CONFIGURED,
982         BLUETOOTH_EVENT_MESH_MODEL_APPKEY_BIND,
983         BLUETOOTH_EVENT_MESH_MODEL_APPKEY_LIST,
984         BLUETOOTH_EVENT_MESH_MODEL_MSG_EXECUTED,
985         BLUETOOTH_EVENT_MESH_MODEL_MSG_RECEIVED,
986         BLUETOOTH_EVENT_MESH_MODEL_SUBSCRIPTION_LIST,
987         BLUETOOTH_EVENT_MESH_MODEL_SUBSCRIPTION_CONFGURED,
988         BLUETOOTH_EVENT_MESH_MODEL_VIRTUAL_SUBSCRIPTION_CONFGURED,
989         BLUETOOTH_EVENT_MESH_MODEL_PUBLICATION_STATUS,
990         BLUETOOTH_EVENT_MESH_JOIN_COMPLETED,
991         BLUETOOTH_EVENT_L2CAP_LE_DATA_RECEIVED = BLUETOOTH_EVENT_L2CAP_LE_BASE,
992                                                 /**< L2CAP_LE data receive event */
993         BLUETOOTH_EVENT_L2CAP_LE_CONNECTED,     /**< L2CAP_LE server/client connect */
994         BLUETOOTH_EVENT_L2CAP_LE_DISCONNECTED,  /**< L2CAP_LE server/client disconnect */
995         BLUETOOTH_EVENT_L2CAP_LE_AUTHORIZE,
996         BLUETOOTH_EVENT_L2CAP_LE_SERVER_REMOVED
997 } bluetooth_event_type_t;
998
999  /**
1000  * This bt_service_uuid_list_t  enum  indicates service uuid list .
1001  * This values is stored the service_list_array in bt_sdp_info_t and bluetooth_device_info_t.
1002  */
1003
1004 typedef enum {
1005         BLUETOOTH_SPP_PROFILE_UUID = ((unsigned short)0x1101),                  /**<SPP*/
1006         BLUETOOTH_LAP_PROFILE_UUID = ((unsigned short)0x1102),                  /**<LAP*/
1007         BLUETOOTH_DUN_PROFILE_UUID = ((unsigned short)0x1103),                  /**<DUN*/
1008         BLUETOOTH_OBEX_IR_MC_SYNC_SERVICE_UUID = ((unsigned short)0x1104),      /**<OBEX IR MC SYNC*/
1009         BLUETOOTH_OBEX_OBJECT_PUSH_SERVICE_UUID = ((unsigned short)0x1105),     /**<OPP*/
1010         BLUETOOTH_OBEX_MESSAGE_ACCESS_SERVICE_UUID = ((unsigned short)0x1134),  /**<MAP*/
1011         BLUETOOTH_OBEX_FILE_TRANSFER_UUID = ((unsigned short)0x1106),           /**<FTP*/
1012         BLUETOOTH_IRMC_SYNC_COMMAND_UUID = ((unsigned short)0x1107),            /**<IRMC SYNC COMMAND*/
1013         BLUETOOTH_HS_PROFILE_UUID = ((unsigned short)0x1108),                   /**<HS*/
1014         BLUETOOTH_CTP_PROFILE_UUID = ((unsigned short)0x1109),                  /**<CTP*/
1015         BLUETOOTH_AUDIO_SOURCE_UUID = ((unsigned short)0x110A),                 /**<AUDIO SOURCE*/
1016         BLUETOOTH_AUDIO_SINK_UUID = ((unsigned short)0x110B),                   /**<AUDIO SINK*/
1017         BLUETOOTH_AV_REMOTE_CONTROL_TARGET_UUID = ((unsigned short)0x110C),     /**<AV REMOTE CONTROL
1018                                                                                 TARGET*/
1019         BLUETOOTH_ADVANCED_AUDIO_PROFILE_UUID = ((unsigned short)0x110D),       /**<A2DP*/
1020         BLUETOOTH_AV_REMOTE_CONTROL_UUID = ((unsigned short)0x110E),            /**<AV REMOTE CONTROL UUID*/
1021         BLUETOOTH_AV_REMOTE_CONTROL_CONTROLLER_UUID = ((unsigned short)0x110F), /**<AV REMOTE CONTROLLER UUID*/
1022         BLUETOOTH_ICP_PROFILE_UUID = ((unsigned short)0x1110),                  /**<ICP*/
1023         BLUETOOTH_FAX_PROFILE_UUID = ((unsigned short)0x1111),                  /**<FAX*/
1024         BLUETOOTH_HEADSET_AG_SERVICE_UUID = ((unsigned short)0x1112),           /**<HS AG */
1025         BLUETOOTH_PAN_PANU_PROFILE_UUID = ((unsigned short)0x1115),             /**<PAN*/
1026         BLUETOOTH_PAN_NAP_PROFILE_UUID = ((unsigned short)0x1116),              /**<PAN*/
1027         BLUETOOTH_PAN_GN_PROFILE_UUID = ((unsigned short)0x1117),               /**<PAN*/
1028         BLUETOOTH_DIRECT_PRINTING = ((unsigned short)0x1118),
1029         BLUETOOTH_OBEX_BPPS_PROFILE_UUID = ((unsigned short)0x1118),            /**<OBEX BPPS*/ /* Will be removed */
1030         BLUETOOTH_REFERENCE_PRINTING = ((unsigned short)0x1119),
1031         BLUETOOTH_OBEX_IMAGING_UUID = ((unsigned short)0x111A),                 /**<OBEX_IMAGING*/
1032         BLUETOOTH_OBEX_IMAGING_RESPONDER_UUID = ((unsigned short)0x111B),       /**<OBEX_IMAGING
1033                                                                                 RESPONDER*/
1034         BLUETOOTH_IMAGING_AUTOMATIC_ARCHIVE_UUID = ((unsigned short)0x111C),    /**<IMAGING AUTOMATIC ARCHIVE*/
1035         BLUETOOTH_IMAGING_REFERENCED_OBJECTS_UUID = ((unsigned short)0x111D),   /**<IMAGING REFERENCED OBJECTS*/
1036         BLUETOOTH_HF_PROFILE_UUID = ((unsigned short)0x111E),                   /**<HF*/
1037         BLUETOOTH_HFG_PROFILE_UUID = ((unsigned short)0x111F),                  /**<HFG*/
1038         BLUETOOTH_DIRECT_PRINTING_REFERENCE_OBJ_UUID = ((unsigned short)0x1120),
1039                                                                         /**<DIRECT PRINTING*/
1040         BLUETOOTH_REFLECTED_UI = ((unsigned short)0x1121),              /**<REFLECTED UI*/
1041         BLUETOOTH_BASIC_PRINTING = ((unsigned short)0x1122),            /**<BASIC PRINTING*/
1042         BLUETOOTH_PRINTING_STATUS = ((unsigned short)0x1123),           /**<PRINTING  STATUS*/
1043         BLUETOOTH_OBEX_PRINTING_STATUS_UUID = ((unsigned short)0x1123), /**<OBEX PRINTING STATUS*/ /* Will be removed */
1044         BLUETOOTH_HID_PROFILE_UUID = ((unsigned short)0x1124),          /**<HID*/
1045         BLUETOOTH_HCR_PROFILE_UUID = ((unsigned short)0x1125),          /**<HCRP*/
1046         BLUETOOTH_HCR_PRINT_UUID = ((unsigned short)0x1126),            /**<HCR PRINT*/
1047         BLUETOOTH_HCR_SCAN_UUID = ((unsigned short)0x1127),             /**<HCR SCAN*/
1048         BLUETOOTH_SIM_ACCESS_PROFILE_UUID = ((unsigned short)0x112D),   /**<SIM ACCESS PROFILE*/
1049         BLUETOOTH_PBAP_PCE_UUID = ((unsigned short)0x112E),             /**<PBAP - PCE*/
1050         BLUETOOTH_PBAP_PSE_UUID = ((unsigned short)0x112F),             /**<OBEX PBA*/
1051         BLUETOOTH_OBEX_PBA_PROFILE_UUID = ((unsigned short)0x112F),     /**<OBEX PBA*/ /* Will be removed */
1052         BLUETOOTH_OBEX_PBAP_UUID = ((unsigned short)0x1130),            /**<OBEX PBA*/
1053         BLUETOOTH_HEADSET_HS_UUID = ((unsigned short)0x1131),           /**<HEADSET HS*/
1054         BLUETOOTH_MESSAGE_ACCESS_SERVER_UUID = ((unsigned short)0x1132),/**<MESSAGE ACCESS SERVER*/
1055         BLUETOOTH_MESSAGE_NOTIFICATION_SERVER_UUID = ((unsigned short)0x1133),/**<MESSAGE NOTIFICATION SERVER*/
1056         BLUETOOTH_MESSAGE_ACCESS_PROFILE_UUID = ((unsigned short)0x1134),/**<MESSAGE ACCESS PROFILE*/
1057         BLUETOOTH_PNP_INFORMATION_UUID = ((unsigned short)0x1200),      /**<PNP*/
1058         BLUETOOTH_GENERIC_NETWORKING_UUID = ((unsigned short)0x1201),   /**<GENERIC NETWORKING*/
1059         BLUETOOTH_GENERIC_FILE_TRANSFER_UUID = ((unsigned short)0x1202),/**<GENERIC FILE TRANSFER*/
1060         BLUETOOTH_GENERIC_AUDIO_UUID = ((unsigned short)0x1203),        /**<GENERIC AUDIO*/
1061         BLUETOOTH_GENERIC_TELEPHONY_UUID = ((unsigned short)0x1204),    /**<GENERIC TELEPHONY*/
1062         BLUETOOTH_VIDEO_SOURCE_UUID = ((unsigned short)0x1303), /**<VEDIO SOURCE*/
1063         BLUETOOTH_VIDEO_SINK_UUID = ((unsigned short)0x1304),           /**<VEDIO SINK*/
1064         BLUETOOTH_VIDEO_DISTRIBUTION_UUID = ((unsigned short)0x1305),   /**<VEDIO DISTRIBUTION*/
1065         BLUETOOTH_HDP_UUID = ((unsigned short)0x1400),                  /**<HDP*/
1066         BLUETOOTH_HDP_SOURCE_UUID = ((unsigned short)0x1401),           /**<HDP SOURCE*/
1067         BLUETOOTH_HDP_SINK_UUID = ((unsigned short)0x1402),             /**<HDP SINK*/
1068         BLUETOOTH_OBEX_SYNCML_TRANSFER_UUID = ((unsigned short)0x0000)  /**<OBEX_SYNC*/ /* Will be removed */
1069 } bluetooth_service_uuid_list_t;
1070
1071 /**
1072 * Service class part of class of device returned from device discovery
1073 */
1074 typedef enum {
1075         BLUETOOTH_DEVICE_SERVICE_CLASS_LIMITED_DISCOVERABLE_MODE = 0x002000,
1076         BLUETOOTH_DEVICE_SERVICE_CLASS_POSITIONING = 0x010000,                  /**<  */
1077         BLUETOOTH_DEVICE_SERVICE_CLASS_NETWORKING = 0x020000,                   /**<  */
1078         BLUETOOTH_DEVICE_SERVICE_CLASS_RENDERING = 0x040000,                    /**<  */
1079         BLUETOOTH_DEVICE_SERVICE_CLASS_CAPTURING = 0x080000,                    /**<  */
1080         BLUETOOTH_DEVICE_SERVICE_CLASS_OBJECT_TRANSFER = 0x100000,              /**<  */
1081         BLUETOOTH_DEVICE_SERVICE_CLASS_AUDIO = 0x200000,                        /**<  */
1082         BLUETOOTH_DEVICE_SERVICE_CLASS_TELEPHONY = 0x400000,                    /**<  */
1083         BLUETOOTH_DEVICE_SERVICE_CLASS_INFORMATION = 0x800000,                  /**<  */
1084 } bluetooth_device_service_class_t;
1085
1086
1087 /**
1088  * Major device mask (For device discovery)
1089  */
1090 typedef enum {
1091         BLUETOOTH_DEVICE_MAJOR_MASK_MISC = 0x00,
1092         BLUETOOTH_DEVICE_MAJOR_MASK_COMPUTER = 0x0001,
1093         BLUETOOTH_DEVICE_MAJOR_MASK_PHONE = 0x0002,
1094         BLUETOOTH_DEVICE_MAJOR_MASK_LAN_ACCESS_POINT = 0x0004,
1095         BLUETOOTH_DEVICE_MAJOR_MASK_AUDIO = 0x0008,
1096         BLUETOOTH_DEVICE_MAJOR_MASK_PERIPHERAL = 0x0010,
1097         BLUETOOTH_DEVICE_MAJOR_MASK_IMAGING = 0x0020,
1098         BLUETOOTH_DEVICE_MAJOR_MASK_WEARABLE = 0x0040,
1099         BLUETOOTH_DEVICE_MAJOR_MASK_TOY = 0x0080,
1100         BLUETOOTH_DEVICE_MAJOR_MASK_HEALTH = 0x0100,
1101 } bluetooth_device_major_mask_t;
1102
1103
1104 /**
1105  * Major device class (part of Class of Device)
1106  */
1107 typedef enum {
1108         BLUETOOTH_DEVICE_MAJOR_CLASS_MISC = 0x00,       /**< Miscellaneous major device class*/
1109         BLUETOOTH_DEVICE_MAJOR_CLASS_COMPUTER = 0x01,           /**< Computer major device class*/
1110         BLUETOOTH_DEVICE_MAJOR_CLASS_PHONE = 0x02,              /**< Phone major device class*/
1111         BLUETOOTH_DEVICE_MAJOR_CLASS_LAN_ACCESS_POINT = 0x03,   /**< LAN major device class*/
1112         BLUETOOTH_DEVICE_MAJOR_CLASS_AUDIO = 0x04,              /**< AUDIO major device class*/
1113         BLUETOOTH_DEVICE_MAJOR_CLASS_PERIPHERAL = 0x05,         /**< Peripheral major device class*/
1114         BLUETOOTH_DEVICE_MAJOR_CLASS_IMAGING = 0x06,            /**< Imaging major device class*/
1115         BLUETOOTH_DEVICE_MAJOR_CLASS_WEARABLE = 0x07,           /**< Wearable device class*/
1116         BLUETOOTH_DEVICE_MAJOR_CLASS_TOY = 0x08,                /**< Toy device class*/
1117         BLUETOOTH_DEVICE_MAJOR_CLASS_HEALTH = 0x09,             /**< Health device class*/
1118         BLUETOOTH_DEVICE_MAJOR_CLASS_UNCLASSIFIED = 0x1F        /**< Unknown major device class*/
1119 } bluetooth_device_major_class_t;
1120
1121 typedef enum {
1122         BLUETOOTH_DEVICE_MINOR_CLASS_UNCLASSIFIED = 0x00,       /**< unclassified minor class */
1123
1124         /* About Computer Major class */
1125         BLUETOOTH_DEVICE_MINOR_CLASS_DESKTOP_WORKSTATION = 0x04,        /**< desktop workstation
1126                                                                         minor class */
1127         BLUETOOTH_DEVICE_MINOR_CLASS_SERVER_CLASS_COMPUTER = 0x08,      /**< server minor class */
1128         BLUETOOTH_DEVICE_MINOR_CLASS_LAPTOP = 0x0C,                     /**< laptop minor class */
1129         BLUETOOTH_DEVICE_MINOR_CLASS_HANDHELD_PC_OR_PDA = 0x10,         /**< PDA minor class */
1130         BLUETOOTH_DEVICE_MINOR_CLASS_PALM_SIZED_PC_OR_PDA = 0x14,       /**< PALM minor class */
1131         BLUETOOTH_DEVICE_MINOR_CLASS_WEARABLE_COMPUTER = 0x18,  /**< Wearable PC minor class */
1132
1133         /* About Phone Major class */
1134         BLUETOOTH_DEVICE_MINOR_CLASS_CELLULAR = 0x04,                   /**< Cellular minor class */
1135         BLUETOOTH_DEVICE_MINOR_CLASS_CORDLESS = 0x08,                   /**< cordless minor class */
1136         BLUETOOTH_DEVICE_MINOR_CLASS_SMART_PHONE = 0x0C,        /**< smart phone minor class */
1137         BLUETOOTH_DEVICE_MINOR_CLASS_WIRED_MODEM_OR_VOICE_GATEWAY = 0x10,
1138                                                                 /**< voice gateway minor class */
1139         BLUETOOTH_DEVICE_MINOR_CLASS_COMMON_ISDN_ACCESS = 0x14,         /**< ISDN minor class */
1140
1141         /* About LAN/Network Access Point Major class */
1142         BLUETOOTH_DEVICE_MINOR_CLASS_FULLY_AVAILABLE = 0x04,            /**< Fully available minor class */
1143         BLUETOOTH_DEVICE_MINOR_CLASS_1_TO_17_PERCENT_UTILIZED = 0x20,   /**< 1-17% utilized minor class */
1144         BLUETOOTH_DEVICE_MINOR_CLASS_17_TO_33_PERCENT_UTILIZED = 0x40,  /**< 17-33% utilized minor class */
1145         BLUETOOTH_DEVICE_MINOR_CLASS_33_TO_50_PERCENT_UTILIZED = 0x60,  /**< 33-50% utilized minor class */
1146         BLUETOOTH_DEVICE_MINOR_CLASS_50_to_67_PERCENT_UTILIZED = 0x80,  /**< 50-67% utilized minor class */
1147         BLUETOOTH_DEVICE_MINOR_CLASS_67_TO_83_PERCENT_UTILIZED = 0xA0,  /**< 67-83% utilized minor class */
1148         BLUETOOTH_DEVICE_MINOR_CLASS_83_TO_99_PERCENT_UTILIZED = 0xC0,  /**< 83-99% utilized minor class */
1149         BLUETOOTH_DEVICE_MINOR_CLASS_NO_SERVICE_AVAILABLE = 0xE0,               /**< No service available minor class */
1150
1151         /* About Audio/Video Major class */
1152         BLUETOOTH_DEVICE_MINOR_CLASS_HEADSET_PROFILE = 0x04,            /**< Headset minor class */
1153         BLUETOOTH_DEVICE_MINOR_CLASS_HANDSFREE = 0x08,                  /**< Handsfree minor class*/
1154
1155         BLUETOOTH_DEVICE_MINOR_CLASS_MICROPHONE = 0x10,         /**< Microphone minor class */
1156         BLUETOOTH_DEVICE_MINOR_CLASS_LOUD_SPEAKER = 0x14,       /**< Loud Speaker minor class */
1157         BLUETOOTH_DEVICE_MINOR_CLASS_HEADPHONES = 0x18,         /**< Headphones minor class */
1158         BLUETOOTH_DEVICE_MINOR_CLASS_PORTABLE_AUDIO = 0x1C,     /**< Portable Audio minor class */
1159         BLUETOOTH_DEVICE_MINOR_CLASS_CAR_AUDIO = 0x20,           /**< Car Audio minor class */
1160         BLUETOOTH_DEVICE_MINOR_CLASS_SET_TOP_BOX = 0x24,        /**< Set top box minor class */
1161         BLUETOOTH_DEVICE_MINOR_CLASS_HIFI_AUDIO_DEVICE = 0x28,  /**< Hifi minor class */
1162         BLUETOOTH_DEVICE_MINOR_CLASS_VCR = 0x2C,                /**< VCR minor class */
1163         BLUETOOTH_DEVICE_MINOR_CLASS_VIDEO_CAMERA = 0x30,       /**< Video Camera minor class */
1164         BLUETOOTH_DEVICE_MINOR_CLASS_CAM_CORDER = 0x34,         /**< CAM Corder minor class */
1165         BLUETOOTH_DEVICE_MINOR_CLASS_VIDEO_MONITOR = 0x38,      /**<Video Monitor minor class */
1166         BLUETOOTH_DEVICE_MINOR_CLASS_VIDEO_DISPLAY_AND_LOUD_SPEAKER = 0x3C,
1167                                                                         /**< Video Display and Loud
1168                                                                         Speaker minor class */
1169         BLUETOOTH_DEVICE_MINOR_CLASS_VIDEO_CONFERENCING = 0x40, /**< Video Conferencing minor
1170                                                                 class */
1171
1172         BLUETOOTH_DEVICE_MINOR_CLASS_GAMING_OR_TOY = 0x48,      /**< Gaming or toy minor class */
1173
1174         /* About Peripheral Major class */
1175         BLUETOOTH_DEVICE_MINOR_CLASS_KEY_BOARD = 0x40,          /**< Key board minor class */
1176         BLUETOOTH_DEVICE_MINOR_CLASS_POINTING_DEVICE = 0x80,    /**< Pointing Device minor class */
1177         BLUETOOTH_DEVICE_MINOR_CLASS_COMBO_KEYBOARD_OR_POINTING_DEVICE = 0xC0,
1178                                                                 /**< Combo Keyboard or pointing
1179                                                                 device minorclass */
1180
1181         BLUETOOTH_DEVICE_MINOR_CLASS_JOYSTICK = 0x04,           /**< JoyStick minor class */
1182         BLUETOOTH_DEVICE_MINOR_CLASS_GAME_PAD = 0x08,           /**< Game Pad minor class */
1183         BLUETOOTH_DEVICE_MINOR_CLASS_REMOTE_CONTROL = 0x0C,     /**< Remote Control minor class */
1184         BLUETOOTH_DEVICE_MINOR_CLASS_SENSING_DEVICE = 0x10,     /**< Sensing Device minor class */
1185         BLUETOOTH_DEVICE_MINOR_CLASS_DIGITIZER_TABLET = 0x14,   /**< Digitizer minor class */
1186         BLUETOOTH_DEVICE_MINOR_CLASS_CARD_READER = 0x18,        /**< Card Reader minor class */
1187         BLUETOOTH_DEVICE_MINOR_CLASS_DIGITAL_PEN = 0x1C,        /**< Digital pen minor class */
1188         BLUETOOTH_DEVICE_MINOR_CLASS_HANDHELD_SCANNER = 0x20,   /**< Handheld scanner for bar-codes, RFID minor class */
1189         BLUETOOTH_DEVICE_MINOR_CLASS_HANDHELD_GESTURAL_INPUT_DEVICE = 0x24,     /**< Handheld gestural input device minor class */
1190
1191         /* About Imaging Major class */
1192         BLUETOOTH_DEVICE_MINOR_CLASS_DISPLAY = 0x10,            /**< Display minor class */
1193         BLUETOOTH_DEVICE_MINOR_CLASS_CAMERA = 0x20,             /**< Camera minor class */
1194         BLUETOOTH_DEVICE_MINOR_CLASS_SCANNER = 0x40,            /**< Scanner minor class */
1195         BLUETOOTH_DEVICE_MINOR_CLASS_PRINTER = 0x80,            /**< Printer minor class */
1196
1197         /* About Wearable Major class */
1198         BLUETOOTH_DEVICE_MINOR_CLASS_WRIST_WATCH = 0x04,        /**< Wrist watch minor class */
1199         BLUETOOTH_DEVICE_MINOR_CLASS_PAGER = 0x08,              /**< Pager minor class */
1200         BLUETOOTH_DEVICE_MINOR_CLASS_JACKET = 0x0C,             /**< Jacket minor class */
1201         BLUETOOTH_DEVICE_MINOR_CLASS_HELMET = 0x10,             /**< Helmet minor class */
1202         BLUETOOTH_DEVICE_MINOR_CLASS_GLASSES = 0x14,            /**< Glasses minor class */
1203
1204         /* About Toy Major class */
1205         BLUETOOTH_DEVICE_MINOR_CLASS_ROBOT = 0x04,              /**< Robot minor class */
1206         BLUETOOTH_DEVICE_MINOR_CLASS_VEHICLE = 0x08,            /**< Vehicle minor class */
1207         BLUETOOTH_DEVICE_MINOR_CLASS_DOLL_OR_ACTION = 0x0C,     /**< Doll or Action minor class */
1208         BLUETOOTH_DEVICE_MINOR_CLASS_CONTROLLER = 0x10,         /**< Controller minor class */
1209         BLUETOOTH_DEVICE_MINOR_CLASS_GAME = 0x14,               /**< Game minor class */
1210
1211         /* About Health Major class */
1212         BLUETOOTH_DEVICE_MINOR_CLASS_BLOOD_PRESSURE_MONITOR = 0x04,     /**< Blood Pressure minor class */
1213         BLUETOOTH_DEVICE_MINOR_CLASS_THERMOMETER = 0x08,                /**< Thermometer minor class */
1214         BLUETOOTH_DEVICE_MINOR_CLASS_WEIGHING_SCALE = 0x0C,             /**< Weighing Scale minor class */
1215         BLUETOOTH_DEVICE_MINOR_CLASS_GLUCOSE_METER = 0x10,              /**< Glucose minor class */
1216         BLUETOOTH_DEVICE_MINOR_CLASS_PULSE_OXIMETER = 0x14,             /**< Pulse Oximeter minor class */
1217         BLUETOOTH_DEVICE_MINOR_CLASS_HEART_OR_PULSE_RATE_MONITOR = 0x18,/**< Heart or pulse rate monitor minor class */
1218         BLUETOOTH_DEVICE_MINOR_CLASS_MEDICAL_DATA_DISPLAY = 0x1C,       /**< Medical minor class */
1219         BLUETOOTH_DEVICE_MINOR_CLASS_STEP_COUNTER = 0x20,               /**< Step Counter minor class */
1220         BLUETOOTH_DEVICE_MINOR_CLASS_BODY_COMPOSITION_ANALYZER = 0x24,  /**< Body composition analyzer minor class */
1221         BLUETOOTH_DEVICE_MINOR_CLASS_PEAK_FLOW_MONITOR = 0x28,  /**< Peak flow monitor minor class */
1222         BLUETOOTH_DEVICE_MINOR_CLASS_MEDICATION_MONITOR = 0x2C, /**< Medication monitor minor class */
1223         BLUETOOTH_DEVICE_MINOR_CLASS_KNEE_PROSTHESIS = 0x30,    /**< Knee prosthesis minor class */
1224         BLUETOOTH_DEVICE_MINOR_CLASS_ANKLE_PROSTHESIS = 0x34,   /**< Ankle prosthesis minor class */
1225 } bluetooth_device_minor_class_t;
1226
1227 /**
1228  * structure to hold the device information
1229  */
1230 typedef struct {
1231         bluetooth_device_major_class_t major_class; /**< major device class */
1232         bluetooth_device_minor_class_t minor_class; /**< minor device class */
1233         bluetooth_device_service_class_t service_class;
1234                                                     /**< service device class */
1235 } bluetooth_device_class_t;
1236
1237 /**
1238  * Discovery Role types
1239  */
1240 typedef enum {
1241         DISCOVERY_ROLE_BREDR = 0x1,
1242         DISCOVERY_ROLE_LE,
1243         DISCOVERY_ROLE_LE_BREDR
1244 } bt_discovery_role_type_t;
1245
1246 /**
1247  * Connected state types
1248  */
1249 typedef enum {
1250         BLUETOOTH_CONNECTED_LINK_NONE = 0x00,
1251         BLUETOOTH_CONNECTED_LINK_BREDR = 0x01,
1252         BLUETOOTH_CONNECTED_LINK_LE = 0x02,
1253         BLUETOOTH_CONNECTED_LINK_BREDR_LE = 0x03,
1254 } bluetooth_connected_link_t;
1255
1256 /**
1257 * Scan filter entry
1258 */
1259 typedef enum {
1260         BLUETOOTH_LE_SCAN_FILTER_FEATURE_DEVICE_ADDRESS = 0x01,                 /**< device address */
1261         BLUETOOTH_LE_SCAN_FILTER_FEATURE_SERVICE_UUID = 0x04,                   /**< service uuid */
1262         BLUETOOTH_LE_SCAN_FILTER_FEATURE_SERVICE_SOLICITATION_UUID = 0x08,      /**< service solicitation uuid */
1263         BLUETOOTH_LE_SCAN_FILTER_FEATURE_DEVICE_NAME = 0x10,                    /**< device name */
1264         BLUETOOTH_LE_SCAN_FILTER_FEATURE_MANUFACTURER_DATA = 0x20,              /**< manufacturer data */
1265         BLUETOOTH_LE_SCAN_FILTER_FEATURE_SERVICE_DATA = 0x40,                   /**< service data */
1266         BLUETOOTH_LE_SCAN_FILTER_FEATURE_RSSI_HIGH_THRESHOLD = 0x80,                    /**< rssi high threshold */
1267 } bluetooth_le_scan_filter_feature_t;
1268
1269 /**
1270  * LE connection mode
1271  */
1272 typedef enum {
1273         BLUETOOTH_LE_CONNECTION_MODE_BALANCED,
1274         BLUETOOTH_LE_CONNECTION_MODE_LOW_LATENCY,
1275         BLUETOOTH_LE_CONNECTION_MODE_LOW_POWER
1276 } bluetooth_le_connection_mode_t;
1277
1278 /**
1279 * structure to hold the device information
1280 */
1281 typedef struct {
1282         bluetooth_device_address_t device_address;      /**< device address */
1283         bluetooth_device_name_t device_name;    /**< device name */
1284         bluetooth_device_class_t device_class;  /**< device class */
1285         char uuids[BLUETOOTH_MAX_SERVICES_FOR_DEVICE][BLUETOOTH_UUID_STRING_MAX];
1286         unsigned int service_list_array[BLUETOOTH_MAX_SERVICES_FOR_DEVICE]; /**< Use enum values in bt_service_uuid_list_t */
1287         int service_index;
1288         int rssi;                               /**< received strength signal*/
1289         gboolean paired;                        /**< paired flag */
1290         bluetooth_connected_link_t connected;   /**< connected link type */
1291         gboolean trust;                         /**< trust flag */
1292         gboolean is_alias_set;          /** is device alias set flag**/
1293         bluetooth_manufacturer_data_t manufacturer_data;        /**< manafacturer specific class */
1294 } bluetooth_device_info_t;
1295
1296 /**
1297 * structure to hold the LE device information
1298 */
1299 typedef struct {
1300         int data_len;           /**< manafacturer specific data length */
1301         bluetooth_advertising_data_t data;              /**< manafacturer specific data */
1302 } bluetooth_le_advertising_data_t;
1303
1304 typedef struct {
1305         guint8 data[BLUETOOTH_EXTENDED_ADVERTISING_DATA_LENGTH_MAX];
1306 } bluetooth_extended_advertising_data_t;
1307
1308 typedef struct {
1309         int data_len;           /**< manafacturer specific data length */
1310         bluetooth_extended_advertising_data_t data;             /**< manafacturer specific data */
1311 } bluetooth_le_extended_advertising_data_t;
1312
1313 typedef struct {
1314         bluetooth_device_address_t device_address;      /**< device address */
1315         int addr_type;          /**< address type*/
1316         int rssi;       /**< received strength signal*/
1317         int event_type;
1318         int primary_phy;
1319         int secondary_phy;
1320         int advertising_sid;
1321         int tx_power;
1322         int periodic_adv_int;
1323         bool is_extended;
1324         /* TODO : Replace bluetooth_le_advertising_data_t adv_ind_data with
1325          * bluetooth_le_extended_advertising_data_t once
1326          * LE_EXTENDED feature is supported */
1327         bluetooth_le_advertising_data_t adv_ind_data;
1328         bluetooth_le_advertising_data_t scan_resp_data;
1329 } bluetooth_le_device_info_t;
1330
1331 typedef struct {
1332         int slot_id;
1333         bluetooth_le_scan_filter_feature_t added_features;              /**< added features */
1334         bluetooth_device_address_t device_address;                      /**< device address */
1335         char device_name[BLUETOOTH_ADVERTISING_DATA_LENGTH_MAX];        /**< device name */
1336         bluetooth_le_advertising_data_t service_uuid;                   /**< service uuid */
1337         bluetooth_le_advertising_data_t service_uuid_mask;              /**< service uuid mask */
1338         bluetooth_le_advertising_data_t service_solicitation_uuid;      /**< service solicitation uuid */
1339         bluetooth_le_advertising_data_t service_solicitation_uuid_mask; /**< service solicitation uuid mask */
1340         bluetooth_le_advertising_data_t service_data;                   /**< service data */
1341         bluetooth_le_advertising_data_t service_data_mask;              /**< service data mask */
1342         int manufacturer_id;                                            /**< manufacturer ID */
1343         bluetooth_le_advertising_data_t manufacturer_data;              /**< manufacturer data */
1344         bluetooth_le_advertising_data_t manufacturer_data_mask;         /**< manufacturer data mask */
1345         int rssi_high_threshold;                                                        /**< rssi high threshold */
1346 } bluetooth_le_scan_filter_t;
1347
1348 typedef struct {
1349         bluetooth_device_address_t device_address;      /**< device address */
1350         unsigned int mtu;       /** < MTU set for the ATT connection */
1351         unsigned int status; /** < status of the MTU exchange */
1352 } bluetooth_le_att_mtu_info_t;
1353
1354 /**
1355  * structure to hold the paired device information
1356  */
1357 typedef struct {
1358         bluetooth_device_address_t device_address;  /**< paired device address */
1359         bluetooth_device_name_t device_name;        /**< device name */
1360         bluetooth_device_class_t device_class;      /**< device class */
1361 } bluetooth_paired_device_info_t;
1362
1363 /**
1364 * structure to hold the paired device information
1365 */
1366 typedef struct {
1367         bluetooth_device_address_t device_address;
1368                                                /**< device address */
1369         char interface_name[BLUETOOTH_INTERFACE_NAME_LENGTH + 1];
1370                                                           /**< network interface name */
1371 } bluetooth_network_device_info_t;
1372
1373 /**
1374  * Authentication event types
1375  */
1376
1377 typedef enum {
1378         BLUETOOTH_AUTH_KEYBOARD_PASSKEY_REQUEST = 0,
1379         BLUETOOTH_AUTH_PIN_REQUEST,
1380         BLUETOOTH_AUTH_PASSKEY_REQUEST,
1381         BLUETOOTH_AUTH_PASSKEY_CONFIRM_REQUEST,
1382 } bluetooth_auth_type_t;
1383
1384 /**
1385 * structure to hold the pincode/pass-key req informations
1386 */
1387 typedef struct {
1388         bluetooth_device_address_t device_address;  /**< remote device address */
1389         bluetooth_device_name_t device_name;        /**< device name */
1390         char str_passkey[BLUETOOTH_DEVICE_PASSKEY_LENGTH_MAX]; /**< pass-key string */
1391         bool incoming; /**< stores if bonding request is incoming */
1392 } bluetooth_authentication_request_info_t;
1393
1394 /**
1395 * Stucture to hold discovery option
1396 */
1397 typedef struct {
1398         unsigned short max_response;    /**< the number of maximum response */
1399         unsigned short discovery_duration;
1400                                         /**< duration of discovery (seconds) */
1401         unsigned int classOfDeviceMask; /**<  mask for values of class of device. to be used with
1402                                         classOfDevice variable */
1403 } bluetooth_discovery_option_t;
1404
1405 /**
1406  * Stucture to hold event information
1407  */
1408 typedef struct {
1409         int event;      /**< event type */
1410         int result;     /**< Success or error value */
1411         void *param_data;
1412                         /**<parameter data pointer */
1413         void *user_data;
1414 } bluetooth_event_param_t;
1415
1416 typedef struct {
1417         bluetooth_device_address_t device_addr;
1418         char uuids[BLUETOOTH_MAX_SERVICES_FOR_DEVICE][BLUETOOTH_UUID_STRING_MAX];
1419         unsigned int service_list_array[BLUETOOTH_MAX_SERVICES_FOR_DEVICE]; /**< Use enum values in bt_service_uuid_list_t */
1420         unsigned int service_name_array[BLUETOOTH_MAX_SERVICES_FOR_DEVICE];
1421         int service_index;
1422 } bt_sdp_info_t;
1423
1424 typedef struct {
1425         bluetooth_device_address_t device_addr;
1426         unsigned char addr_type;
1427         int disc_reason;
1428         int rssi;
1429 } bt_connection_info_t;
1430
1431 /**
1432  * Stucture to rfcomm receive data
1433  */
1434
1435 typedef struct {
1436         int socket_fd;
1437                 /**< the socket fd */
1438         int buffer_size;/**< the length of the receive buffer */
1439         char *buffer;
1440                 /**< the receive data buffer */
1441 } bluetooth_rfcomm_received_data_t;
1442
1443 /**
1444  * Stucture to l2cap_le receive data
1445  */
1446 typedef struct {
1447         int socket_fd; /**< the socket fd */
1448         int buffer_size; /**< the length of the receive buffer */
1449         char *buffer; /**< the receive data buffer */
1450 } bluetooth_l2cap_le_received_data_t;
1451
1452 /**
1453  * HID Header type
1454  */
1455 typedef enum {
1456         HTYPE_TRANS_HANDSHAKE,
1457         HTYPE_TRANS_HID_CONTROL,
1458         HTYPE_TRANS_GET_REPORT,
1459         HTYPE_TRANS_SET_REPORT,
1460         HTYPE_TRANS_GET_PROTOCOL,
1461         HTYPE_TRANS_SET_PROTOCOL,
1462         HTYPE_TRANS_DATA,
1463         HTYPE_TRANS_UNKNOWN,
1464         HTYPE_TRANS_GET_IDLE = 0xF0,
1465         HTYPE_TRANS_SET_IDLE = 0xF1,
1466 } bt_hid_header_type_t;
1467
1468 /**
1469  * HID Param type
1470  */
1471 typedef enum {
1472         PTYPE_DATA_RTYPE_INPUT,
1473         PTYPE_DATA_RTYPE_OUTPUT
1474 } bt_hid_param_type_t;
1475
1476 /**
1477  * Stucture to hid receive data
1478  */
1479 typedef struct {
1480         const char *address;
1481         bt_hid_header_type_t type;
1482                 /**< Header type containing */
1483         bt_hid_param_type_t param;
1484                 /**< Param type in header like INPUT Report or OutPut Report */
1485         int buffer_size;/**< the length of the receive buffer */
1486         char *buffer;
1487                 /**< the receive data buffer */
1488 } bluetooth_hid_received_data_t;
1489
1490 /**
1491 * Stucture to rfcomm connection
1492 */
1493
1494 typedef struct {
1495         int socket_fd; /**< the socket fd */
1496         int server_id; /* Server id */
1497         int device_role; /** < Device role - RFCOMM_ROLE_SERVER or RFCOMM_ROLE_CLIENT */
1498         bluetooth_device_address_t device_addr;
1499                                               /**< device address */
1500         char uuid[BLUETOOTH_UUID_STRING_MAX];
1501 } bluetooth_rfcomm_connection_t;
1502
1503 /**
1504  * Stucture to rfcomm disconnection
1505  */
1506 typedef struct {
1507         int socket_fd;
1508                 /**< the socket fd */
1509         int device_role;/** < Device role - RFCOMM_ROLE_SERVER or RFCOMM_ROLE_CLIENT */
1510         bluetooth_device_address_t device_addr;
1511                                               /**< device address */
1512         char uuid[BLUETOOTH_UUID_STRING_MAX];
1513 } bluetooth_rfcomm_disconnection_t;
1514
1515 typedef struct {
1516         int socket_fd;
1517                 /**< the socket fd */
1518         bluetooth_device_address_t device_addr;
1519                                               /**< device address */
1520 } bluetooth_rfcomm_connection_request_t;
1521
1522 /**
1523  * Stucture to l2cap_le connection
1524  */
1525 typedef struct {
1526         int socket_fd; /**< the socket fd */
1527         int server_id; /* Server id */
1528         int device_role; /** < Device role - L2CAP_LE_ROLE_SERVER or L2CAP_LE_ROLE_CLIENT */
1529         bluetooth_device_address_t device_addr; /**< device address */
1530         int psm;
1531 } bluetooth_l2cap_le_connection_t;
1532
1533 /**
1534  * Stucture to l2cap_le disconnection
1535  */
1536 typedef struct {
1537         int socket_fd; /**< the socket fd */
1538         int device_role;
1539                         /** < Device role - L2CAP_LE_ROLE_SERVER or L2CAP_LE_ROLE_CLIENT */
1540         bluetooth_device_address_t device_addr; /**< device address */
1541         int psm;
1542 } bluetooth_l2cap_le_disconnection_t;
1543
1544 /**
1545  * Stucture to l2cap_le connection request
1546  */
1547 typedef struct {
1548         int socket_fd; /**< the socket fd */
1549         bluetooth_device_address_t device_addr; /**< device address */
1550 } bluetooth_l2cap_le_connection_request_t;
1551
1552 /**
1553  * HDP QOS types
1554  */
1555 typedef enum {
1556         HDP_QOS_RELIABLE,
1557         HDP_QOS_STREAMING,
1558         HDP_QOS_ANY
1559 } bt_hdp_qos_type_t;
1560
1561 /**
1562  * HDP Role types
1563  */
1564 typedef enum {
1565         HDP_ROLE_SOURCE = 0x0,
1566         HDP_ROLE_SINK
1567 } bt_hdp_role_type_t;
1568
1569
1570 /**
1571  * Stucture to HDP connected
1572  */
1573 typedef struct {
1574         const char *app_handle; /**< the application handle */
1575         unsigned int channel_id;        /**< the channel id */
1576         bt_hdp_qos_type_t type; /**< the QOS type */
1577         bluetooth_device_address_t device_address; /**< the remote address */
1578 } bt_hdp_connected_t;
1579
1580 /**
1581  * Stucture to HDP disconnected
1582  */
1583 typedef struct {
1584         unsigned int channel_id; /**< the channel id */
1585         bluetooth_device_address_t device_address; /**< the remote address */
1586 } bt_hdp_disconnected_t;
1587
1588 /**
1589  * Stucture to HDP data indication
1590  */
1591 typedef struct {
1592         unsigned int channel_id;         /**< the channel id */
1593         const char *buffer;      /**< the RX data buffer */
1594         unsigned int size;       /**< the RX data size */
1595 } bt_hdp_data_ind_t;
1596
1597 /**
1598  * Stucture to OPP client transfer information
1599  */
1600 typedef struct {
1601         char *device_addr;
1602         char *filename;
1603         unsigned long size;
1604         int percentage;
1605 } bt_opc_transfer_info_t;
1606
1607 /* TODO: MAP client structures, see above */
1608 /**
1609  * Stucture to Map filter fields
1610  */
1611 typedef struct {
1612         char **fields;
1613         int size;
1614 } bt_map_list_filter_fields_info_t;
1615
1616 /* Obex Server transfer type */
1617 #define TRANSFER_PUT "PUT"
1618 #define TRANSFER_GET "GET"
1619 /**
1620  * Stucture to OPP/FTP Server authorize information
1621  */
1622 typedef struct {
1623         char *filename;
1624         int length;
1625         char *address;
1626         char *name;
1627 } bt_obex_server_authorize_into_t;
1628
1629 /**
1630  * Server type
1631  */
1632 typedef enum {
1633         OPP_SERVER = 0x0,
1634         FTP_SERVER
1635 } bt_obex_server_type_t;
1636
1637 /**
1638  * Stucture to OPP/FTP server transfer information
1639  */
1640 typedef struct {
1641         char *filename;
1642         char *device_name;
1643         char *file_path;
1644         char *type;
1645         int transfer_id;
1646         unsigned long file_size;
1647         int percentage;
1648         bt_obex_server_type_t server_type;
1649         char *address;
1650         unsigned char *contact_auth_info;
1651 } bt_obex_server_transfer_info_t;
1652
1653 /**
1654  * Stucture to OPP/FTP server connection/disconnection information
1655  */
1656 typedef struct {
1657         char *address;
1658         char *device_name;
1659         int transfer_id;
1660 } bt_obex_server_connection_info_t;
1661
1662
1663 /**
1664  * Stucture to OOB data
1665  */
1666
1667 typedef struct {
1668         unsigned char hash[BLUETOOTH_OOB_DATA_LENGTH];
1669         unsigned char randomizer[BLUETOOTH_OOB_DATA_LENGTH];
1670         unsigned int hash_len;
1671         unsigned int randomizer_len;
1672
1673         unsigned char hash256[BLUETOOTH_OOB_DATA_LENGTH];
1674         unsigned char randomizer256[BLUETOOTH_OOB_DATA_LENGTH];
1675         unsigned int hash256_len;
1676         unsigned int randomizer256_len;
1677
1678         unsigned char eir[BLUETOOTH_LE_OOB_DATA_LENGTH];
1679         unsigned int eir_len;
1680 } bt_oob_data_t;
1681
1682 /**
1683  * Structure to GATT attribute handle data
1684  */
1685
1686 typedef struct {
1687         int count;
1688         char **handle;
1689         char uuids[BLUETOOTH_MAX_SERVICES_FOR_DEVICE][BLUETOOTH_UUID_STRING_MAX];
1690         int inst_id[BLUETOOTH_MAX_SERVICES_FOR_DEVICE];
1691 } bt_gatt_handle_info_t;
1692
1693 /**
1694  * Structure to a most basic GATT attribute handle data
1695  */
1696 typedef struct {
1697         int instance_id;
1698         unsigned char uuid[16];
1699         char address[BLUETOOTH_ADDRESS_STRING_LENGTH];
1700 } bt_gatt_handle_property_t;
1701
1702 /**
1703  * Structure to GATT Remote service data
1704  */
1705
1706 typedef struct {
1707         char *uuid;
1708         char *handle;
1709         gboolean primary;
1710         bt_gatt_handle_info_t include_handles;
1711         bt_gatt_handle_info_t char_handle;
1712         bt_gatt_handle_property_t prop; /* Added Service UUID, instance_id & associated remote device  */
1713 } bt_gatt_service_property_t;
1714
1715 /**
1716  * Structure to GATT Remote characteristic data
1717  */
1718
1719 typedef struct {
1720         char *service_handle;
1721         bt_gatt_handle_info_t handle_info;
1722 } bt_gatt_discovered_char_t;
1723
1724 /**
1725  * Structure to format of GATT Characteristic Value
1726  */
1727
1728 typedef struct {
1729         unsigned char format;
1730         unsigned char exponent;
1731         unsigned short unit;
1732         unsigned char name_space;
1733         unsigned short description;
1734 } bt_gatt_char_format_t;
1735
1736 /**
1737  * Structure to GATT Characteristic property
1738  */
1739
1740 typedef struct {
1741         char *handle;
1742         char *uuid;
1743         char *name;
1744         char *description;
1745         bt_gatt_char_format_t format;
1746         unsigned char *val;
1747         unsigned int val_len;
1748         unsigned int permission;
1749         char *representation;
1750         bt_gatt_handle_info_t char_desc_handle;
1751         bt_gatt_handle_property_t prop;      /* Added Char UUID, instance_id */
1752         bt_gatt_handle_property_t svc_prop;  /* Added Service UUID, instance_id */
1753         char value[BLUETOOTH_GATT_ATT_DATA_LENGTH_MAX]; /* Added */
1754         char address[BLUETOOTH_ADDRESS_STRING_LENGTH];         /* Added */
1755 } bt_gatt_char_property_t;
1756
1757 /**
1758  * Structure to GATT Characteristic descriptor property
1759  */
1760
1761 typedef struct {
1762         char *handle;
1763         char *uuid;
1764         unsigned char *val;
1765         unsigned int val_len;
1766         bt_gatt_handle_property_t prop;      /* Added Descriptor UUID, instance_id */
1767         bt_gatt_handle_property_t char_prop; /* Added Char UUID, instance_id */
1768         bt_gatt_handle_property_t svc_prop;  /* Added Service UUID, instance_id */
1769         char value[BLUETOOTH_GATT_ATT_DATA_LENGTH_MAX];/* Added */
1770         char address[BLUETOOTH_ADDRESS_STRING_LENGTH];          /* Added */
1771 } bt_gatt_char_descriptor_property_t;
1772
1773 /**
1774  * Structure to GATT Characteristic value
1775  */
1776
1777 typedef struct {
1778         char *char_handle;
1779         guint8 *char_value;
1780         guint32 val_len;
1781 } bt_gatt_char_value_t;
1782
1783 typedef struct {
1784         unsigned char UUID[16];
1785         char address[18];
1786         char *val;
1787         int len;
1788 } bt_gatt_notify_req_t ;
1789
1790 /**
1791  * Structure to GATT Read Request
1792  */
1793 typedef struct {
1794         char *att_handle;
1795         char *service_handle;
1796         char *address;
1797         guint16 offset;
1798         guint req_id;
1799 } bt_gatt_read_req_t;
1800
1801 /**
1802  * Structure to GATT Value change
1803  */
1804 typedef struct {
1805         char *att_handle;
1806         char *service_handle;
1807         char *address;
1808         guint req_id;
1809         gboolean response_needed;
1810         guint16 offset;
1811         guint8 *att_value;
1812         guint32 val_len;
1813 } bt_gatt_value_change_t;
1814
1815 typedef struct {
1816         bluetooth_device_address_t device_addr;
1817         char *svc_path;
1818         bluetooth_gatt_service_change_type_t change_type;
1819         int inst_id;
1820         char *uuid;
1821 } bt_gatt_service_change_t;
1822
1823 /**
1824  * Structure to GATT characteristc Notification change
1825  */
1826 typedef struct {
1827         char *att_handle;
1828         char *service_handle;
1829         gboolean att_notify;
1830 } bt_gatt_char_notify_change_t;
1831
1832 /**
1833  * Structure to Indication confirmation
1834  */
1835 typedef struct {
1836         char *att_handle;
1837         char *service_handle;
1838         char *address;
1839         gboolean complete;
1840 } bt_gatt_indicate_confirm_t;
1841
1842 /**
1843  * Structure for GATT response data
1844  */
1845 typedef struct {
1846         char *handle;
1847         guint8 *value;
1848         guint32 len;
1849         gpointer user_data;
1850 } bt_gatt_resp_data_t;
1851
1852 /**
1853  * Structure to RSSI Signal Strength Alert
1854  */
1855
1856 typedef struct {
1857         char *address;
1858         int link_type;
1859         int alert_type;
1860         int rssi_dbm;
1861 } bt_rssi_alert_t;
1862
1863 /**
1864  * Structure to RSSI Signal Strength
1865  */
1866
1867 typedef struct {
1868         char *address;
1869         int link_type;
1870         int rssi_dbm;
1871 } bt_raw_rssi_t;
1872
1873 /**
1874  * Structure for RSSI Enabled or Disabled
1875  */
1876
1877 typedef struct {
1878         char *address;
1879         int link_type;
1880         gboolean rssi_enabled;
1881 } bt_rssi_enabled_t;
1882
1883 /**
1884  * Structure for RSSI Threshold
1885  */
1886
1887 typedef struct {
1888         int low_threshold;
1889         int in_range_threshold;
1890         int high_threshold;
1891 } bt_rssi_threshold_t;
1892
1893
1894 /**
1895  * Structure for Suppoted Profiles and Trusted Profiles
1896  */
1897 typedef struct {
1898         char *address;
1899         int profile;
1900         gboolean supported;
1901         gboolean trusted;
1902 } bt_supported_profile_trusted_t;
1903
1904 /**
1905  * Structure for PBAP Folder Parameters
1906  */
1907 typedef struct {
1908         unsigned char addressbook;
1909         unsigned char folder_type;
1910 } bt_pbap_folder_t;
1911
1912 /**
1913  * Structure for PBAP Pull application Parameters
1914  */
1915 typedef struct {
1916         unsigned char format;
1917         unsigned char order;
1918         unsigned short offset;
1919         unsigned short maxlist;
1920         long long unsigned fields;
1921 } bt_pbap_pull_parameters_t;
1922
1923 /**
1924  * Structure for PBAP List application Parameters
1925  */
1926 typedef struct {
1927         unsigned char order;
1928         unsigned short offset;
1929         unsigned short maxlist;
1930 } bt_pbap_list_parameters_t;
1931
1932 /**
1933  * Structure for PBAP Pull vCard application Parameters
1934  */
1935 typedef struct {
1936         unsigned char format;
1937         long long unsigned fields;
1938         int index;
1939 } bt_pbap_pull_vcard_parameters_t;
1940
1941 /**
1942  * Structure for PBAP Search application Parameters
1943  */
1944 typedef struct {
1945         unsigned char order;
1946         unsigned short offset;
1947         unsigned short maxlist;
1948         unsigned char search_attribute;
1949         char search_value[BLUETOOTH_PBAP_MAX_SEARCH_VALUE_LENGTH];
1950 } bt_pbap_search_parameters_t;
1951
1952 /**
1953  * Structure for PBAP Connection Status
1954  */
1955 typedef struct {
1956         bluetooth_device_address_t btaddr;
1957         int connected;
1958 } bt_pbap_connected_t;
1959
1960 /**
1961  * Structure for PBAP Phonebook Size
1962  */
1963 typedef struct {
1964         bluetooth_device_address_t btaddr;
1965         int size;
1966 } bt_pbap_phonebook_size_t;
1967
1968 /**
1969  * Structure for PBAP Phonebook Pull
1970  */
1971 typedef struct {
1972         bluetooth_device_address_t btaddr;
1973         char *vcf_file;
1974         int success;
1975 } bt_pbap_phonebook_pull_t;
1976
1977 /**
1978  * Structure for PBAP vCard List
1979  */
1980 typedef struct {
1981         bluetooth_device_address_t btaddr;
1982         char **vcards;
1983         int length;
1984         int success;
1985 } bt_pbap_vcard_list_t;
1986
1987 /**
1988  * Structure for PBAP vCard Pull
1989  */
1990 typedef struct {
1991         bluetooth_device_address_t btaddr;
1992         char *vcf_file;
1993         int success;
1994 } bt_pbap_vcard_pull_t;
1995
1996 /**
1997  * Structure for PBAP Phonebook search List
1998  */
1999 typedef struct {
2000         bluetooth_device_address_t btaddr;
2001         char **vcards;
2002         int length;
2003         int success;
2004 } bt_pbap_phonebook_search_list_t;
2005
2006 /**
2007  * Stucture to HF Call status information
2008  */
2009
2010 typedef struct {
2011         char *number; /*Phone Number */
2012         int direction; /*Direction :Incoming(1), Outgoing(0)*/
2013         int status; /* Call Status :Active(0), Held(1), Waiting(5), Dailing(2)*/
2014         int mpart; /*Multiparty/conf call: Yes(1), No(0) */
2015         int idx; /*Call index/ID */
2016 } bt_hf_call_status_info_t;
2017
2018 typedef struct {
2019         GList *list;
2020         int count;
2021 } bt_hf_call_list_s;
2022
2023 /**
2024  * Profile types
2025  */
2026 typedef enum {
2027         TRUSTED_PROFILE_PBAP = 1,
2028         TRUSTED_PROFILE_MAP,
2029         TRUSTED_PROFILE_SAP,
2030         TRUSTED_PROFILE_HFP_HF,
2031         TRUSTED_PROFILE_A2DP,
2032         TRUSTED_PROFILE_ALL = 0xFFFFFFFF,
2033 } bluetooth_trusted_profile_t;
2034
2035 /**
2036  * Structure for LE data length change params
2037  */
2038 typedef struct {
2039         bluetooth_device_address_t device_address;
2040         guint16 max_tx_octets;
2041         guint16 max_tx_time;
2042         guint16 max_rx_octets;
2043         guint16 max_rx_time;
2044 } bt_le_data_length_params_t;
2045
2046 /**
2047  * Structure for proximity property change params
2048  */
2049 typedef struct {
2050         bluetooth_device_address_t device_address;
2051         int role;
2052         int service_type;
2053         int alert_lvl;
2054 } bt_pxp_property_changed_params_t;
2055
2056  /**
2057  * @brief DPM BT allowance state
2058  * @see
2059  */
2060 typedef enum {
2061         BLUETOOTH_DPM_ERROR      = -1,   /**< bluetooth allowance error */
2062         BLUETOOTH_DPM_BT_ALLOWED,                /**< bluetooth allowance allowed */
2063         BLUETOOTH_DPM_HANDSFREE_ONLY,  /**< bluetooth allowance handsfree only */
2064         BLUETOOTH_DPM_BT_RESTRICTED,  /**< bluetooth allowance restricted */
2065 } bt_dpm_allow_t;
2066
2067  /**
2068  * @brief DPM API result
2069  * @see
2070  */
2071 typedef enum {
2072         BLUETOOTH_DPM_RESULT_SERVICE_NOT_ENABLED = -5,  /**< DPM API result service not enabled. */
2073         BLUETOOTH_DPM_RESULT_ACCESS_DENIED = -4,                        /**< DPM API result access denied. */
2074         BLUETOOTH_DPM_RESULT_INVALID_PARAM = -3,                        /**< DPM API result invalid parameter. */
2075         BLUETOOTH_DPM_RESULT_NOT_SUPPORTED = -2,                        /**< DPM API result not supported. */
2076         BLUETOOTH_DPM_RESULT_FAIL        = -1,                          /**< DPM API result fail. */
2077         BLUETOOTH_DPM_RESULT_SUCCESS     = 0,                           /**< DPM API result success. */
2078 } bt_dpm_result_t;
2079
2080 /**
2081  * @brief DPM Policy status
2082  * @see
2083  */
2084 typedef enum {
2085         BLUETOOTH_DPM_STATUS_ERROR      = -1,
2086
2087         BLUETOOTH_DPM_ALLOWED           = 0,    /**< DPM Policy status allowed. */
2088         BLUETOOTH_DPM_RESTRICTED                = 1,    /**< DPM Policy status restricted. */
2089
2090         BLUETOOTH_DPM_ENABLE                    = 1,    /**< DPM Policy status enabled. */
2091         BLUETOOTH_DPM_DISABLE   = 0,    /**< DPM Policy status disabled. */
2092
2093         BLUETOOTH_DPM_FALSE                     = 0,    /**< DPM Policy status false. */
2094         BLUETOOTH_DPM_TRUE                      = 1,    /**< DPM Policy status true. */
2095 } bt_dpm_status_t;
2096
2097 typedef enum {
2098         /* policy-group : BLUETOOTH */
2099         BLUETOOTH_DPM_POLICY_ALLOW,
2100         BLUETOOTH_DPM_POLICY_DEVICE_RESTRICTION,
2101         BLUETOOTH_DPM_POLICY_UUID_RESTRICTION,
2102         BLUETOOTH_DPM_POLICY_DEVICES_ALLOWLIST,
2103         BLUETOOTH_DPM_POLICY_DEVICES_BLOCKLIST,
2104         BLUETOOTH_DPM_POLICY_UUIDS_ALLOWLIST,
2105         BLUETOOTH_DPM_POLICY_UUIDS_BLOCKLIST,
2106         BLUETOOTH_DPM_POLICY_ALLOW_OUTGOING_CALL,
2107         BLUETOOTH_DPM_POLICY_PAIRING_STATE,
2108         BLUETOOTH_DPM_POLICY_DESKTOP_CONNECTIVITY_STATE,
2109         BLUETOOTH_DPM_POLICY_DISCOVERABLE_STATE,
2110         BLUETOOTH_DPM_POLICY_LIMITED_DISCOVERABLE_STATE,
2111         BLUETOOTH_DPM_POLICY_DATA_TRANSFER_STATE,
2112         BLUETOOTH_DPM_POLICY_END,
2113 } bt_dpm_policy_cmd_t;
2114
2115
2116 struct bt_dpm_policy {
2117         union {
2118                 int value;
2119                 GSList *list;
2120         };
2121 };
2122 typedef struct bt_dpm_policy bt_dpm_policy_t;
2123
2124 typedef enum {
2125         BLUETOOTH_DPM_POLICY_A2DP_PROFILE_STATE,
2126         BLUETOOTH_DPM_POLICY_AVRCP_PROFILE_STATE,
2127         BLUETOOTH_DPM_POLICY_BPP_PROFILE_STATE,
2128         BLUETOOTH_DPM_POLICY_DUN_PROFILE_STATE,
2129         BLUETOOTH_DPM_POLICY_FTP_PROFILE_STATE,
2130         BLUETOOTH_DPM_POLICY_HFP_PROFILE_STATE,
2131         BLUETOOTH_DPM_POLICY_HSP_PROFILE_STATE,
2132         BLUETOOTH_DPM_POLICY_PBAP_PROFILE_STATE,
2133         BLUETOOTH_DPM_POLICY_SAP_PROFILE_STATE,
2134         BLUETOOTH_DPM_POLICY_SPP_PROFILE_STATE,
2135         BLUETOOTH_DPM_PROFILE_NONE,
2136 } bt_dpm_profile_t;
2137
2138 struct bt_dpm_profile_val {
2139                 int value; /* tells whether the profile is enabled or disabled */
2140 };
2141 typedef struct dpm_profile_val dpm_profile_state_t;
2142
2143 /**
2144  * Structure to DPM device list
2145  */
2146 typedef struct {
2147         int count;
2148         bluetooth_device_address_t addresses[BLUETOOTH_MAX_DPM_LIST];
2149 } bt_dpm_device_list_t;
2150
2151 /**
2152  * Structure to DPM uuid list
2153  */
2154 typedef struct {
2155         int count;
2156         char uuids[BLUETOOTH_MAX_DPM_LIST][BLUETOOTH_UUID_STRING_MAX];
2157 } bt_dpm_uuids_list_t;
2158
2159 /**
2160  * Structure for IPSP Interface Info
2161  */
2162 typedef struct {
2163         bluetooth_device_address_t btaddr;
2164         char if_name[16];
2165 } bt_ipsp_connection_info_t;
2166
2167 typedef struct {
2168         char* session_path;
2169         char* remote_address;
2170 } bt_map_client_session_info_s;
2171
2172 typedef char* bt_map_client_message_object_t;
2173
2174 typedef struct {
2175         int16_t offset;
2176         int16_t max_count;
2177 } bt_map_client_list_folders_filter_t;
2178
2179 typedef struct {
2180         int16_t offset;
2181         int16_t max_count;
2182         int8_t subject_length;
2183         char *fields;
2184         char *types;
2185         char *period_begin;
2186         char *period_end;
2187         int is_read;
2188         char *recipient;
2189         char *sender;
2190         int is_priority;
2191 } bt_map_client_list_messages_filter_t;
2192
2193 typedef struct {
2194         bt_map_client_message_object_t message_object;
2195         char *folder;
2196         char *subject;
2197         char *timestamp;
2198         char *sender;
2199         char *sender_address;
2200         char *reply_to;
2201         char *recipient;
2202         char *recipient_address;
2203         char *type;
2204         int64_t size;
2205         int is_text;
2206         char *status;
2207         int64_t attachment_size;
2208         int is_priority;
2209         int is_read;
2210         int is_sent;
2211         int is_protected;
2212 } bt_map_client_message_item_t;
2213
2214 typedef struct {
2215         int is_transparent;
2216         int is_retry;
2217         char *charset;
2218 } bt_map_client_push_message_args_t;
2219
2220 typedef struct {
2221         char *folder;
2222         char *subject;
2223         char *timestamp;
2224         char *sender;
2225         char *sender_address;
2226         char *reply_to;
2227         char *recipient;
2228         char *recipient_address;
2229         char *type;
2230         int64_t size;
2231         char *status;
2232         int is_priority;
2233         int is_read;
2234         int is_deleted;
2235         int is_sent;
2236         int is_protected;
2237 } bt_map_client_message_t;
2238
2239 typedef struct {
2240         char **names; // holding %size null-terminated folder names
2241         int64_t size;
2242 } bt_map_client_folders_s;
2243
2244 typedef struct {
2245         bt_map_client_message_item_t *message_items;
2246         int64_t size;
2247 } bt_map_client_message_items_s;
2248
2249 typedef struct {
2250         const char* target_file;
2251         void* user_data;
2252 } bt_get_message_callback_data;
2253
2254 /**
2255  * Callback pointer type
2256  */
2257 typedef void (*bluetooth_cb_func_ptr) (int, bluetooth_event_param_t *, void *);
2258
2259 /**
2260  * @fn int bluetooth_register_callback(bluetooth_cb_func_ptr callback_ptr, void *user_data)
2261  * @brief Set the callback function pointer for bluetooth event
2262  *
2263  *
2264  * This API will register the callback function, when any response and event are received from
2265  * bluetooth framework. @n
2266  * this registered callback function will be get called with appropriate event and data structures.
2267  * This function is a synchronous call. An application developer can call
2268  * bluetooth_register_callback() function to register a callback function of bluetooth_cb_func_ptr
2269  * type. This registered function will receive events of bluetooth_event_type_t type along with
2270  * data any.
2271  *
2272  *
2273  * @param[in]   callback_ptr    A pointer to the callback function
2274  * @param[in]   user_data    A pointer to user data
2275  * @return      BLUETOOTH_ERROR_NONE - Success
2276  * @remark      None
2277  * @see         None
2278 @code
2279 void bt_event_callback(int event, bluetooth_event_param_t *param, void *user_data)
2280 {
2281         GMainLoop *main_loop = (GMainLoop*) user_data;
2282
2283         switch(event)
2284         {
2285                 // Code for each event
2286                 default:
2287                         g_main_loop_quit(main_loop);
2288                         break;
2289         }
2290 }
2291
2292 int main()
2293 {
2294         GMainLoop *main_loop = NULL;
2295         int ret = 0;
2296         g_type_init();
2297         main_loop = g_main_loop_new(NULL, FALSE);
2298         ret = bluetooth_register_callback(bt_event_callback, (void*)main_loop);
2299         if (ret >= BLUETOOTH_ERROR_NONE)
2300         {
2301                 // bluetooth_register_callback returned Success
2302         }
2303         else
2304         {
2305                 // bluetooth_register_callback returned failiure
2306         }
2307         g_main_loop_run(main_loop);
2308 }
2309 @endcode
2310  */
2311 int bluetooth_register_callback(bluetooth_cb_func_ptr callback_ptr, void *user_data);
2312
2313 /**
2314  * @fn int bluetooth_le_register_callback(bluetooth_cb_func_ptr callback_ptr, void *user_data)
2315  * @brief Set the callback function pointer for bluetooth le event
2316  *
2317  *
2318  * This API will register the callback function, when any response and event are received from
2319  * bluetooth framework. @n
2320  * this registered callback function will be get called with appropriate event and data structures.
2321  * This function is a synchronous call. An application developer can call
2322  * bluetooth_le_register_callback() function to register a callback function of bluetooth_cb_func_ptr
2323  * type. This registered function will receive events of bluetooth_event_type_t type along with
2324  * data any.
2325  *
2326  *
2327  * @param[in]   callback_ptr    A pointer to the callback function
2328  * @param[in]   user_data    A pointer to user data
2329  * @return      BLUETOOTH_ERROR_NONE - Success
2330  * @remark      None
2331  * @see         None
2332  * */
2333 int bluetooth_le_register_callback(bluetooth_cb_func_ptr callback_ptr, void *user_data);
2334
2335 /**
2336  * @fn int bluetooth_le_unregister_callback(void)
2337  * @brief Set the callback function pointer for bluetooth le event
2338  *
2339  *
2340  * This API will register the callback function, when any response and event are received from
2341  * bluetooth framework. @n
2342  * this registered callback function will be get called with appropriate event and data structures.
2343  * This function is a synchronous call. An application developer can call
2344  * bluetooth_le_register_callback() function to register a callback function of bluetooth_cb_func_ptr
2345  * type. This registered function will receive events of bluetooth_event_type_t type along with
2346  * data any.
2347  *
2348  *
2349  * @param[in]   none
2350  * @return      BLUETOOTH_ERROR_NONE - Success
2351  * @remark      None
2352  * @see         None
2353  * */
2354 int bluetooth_le_unregister_callback(void);
2355
2356 /**
2357  * @fn int bluetooth_deregister_callback(bluetooth_cb_func_ptr callback_ptr)
2358  * @brief Set the callback function pointer for bluetooth event
2359  *
2360  *
2361  * This API will register the callback function, when any response and event are received from
2362  * bluetooth framework. @n
2363  * this registered callback function will be get called with appropriate event and data structures.
2364  * This function is a synchronous call. An application developer can call
2365  * bluetooth_register_callback() function to register a callback function of bluetooth_cb_func_ptr
2366  * type. This registered function will receive events of bluetooth_event_type_t type along with
2367  * data any.
2368  *
2369  *
2370  * @param[in]   none
2371  * @return      BLUETOOTH_ERROR_NONE - Success
2372  * @remark      None
2373  * @see         None
2374 @code
2375 void bt_event_callback(int event, bluetooth_event_param_t *param, void *user_data)
2376 {
2377         GMainLoop *main_loop = (GMainLoop*) user_data;
2378
2379         switch(event)
2380         {
2381                 // Code for each event
2382                 default:
2383                         g_main_loop_quit(main_loop);
2384                         break;
2385         }
2386 }
2387
2388 int main()
2389 {
2390         GMainLoop *main_loop = NULL;
2391         int ret = 0;
2392         g_type_init();
2393         main_loop = g_main_loop_new(NULL, FALSE);
2394         ret = bluetooth_register_callback(bt_event_callback, (void*)main_loop);
2395         if (ret >= BLUETOOTH_ERROR_NONE)
2396         {
2397                 // bluetooth_register_callback returned Success
2398         }
2399         else
2400         {
2401                 // bluetooth_register_callback returned failiure
2402         }
2403         ret = bluetooth_deregister_callback(void);
2404         g_main_loop_run(main_loop);
2405 }
2406 @endcode
2407  */
2408 int bluetooth_unregister_callback(void);
2409
2410 /**
2411  * @fn int bluetooth_enable_adapter(void)
2412  * @brief Enable the Bluetooth H/W
2413  *
2414  *
2415  * This API can be used to activate Bluetooth. It initializes Bluetooth protocol stack for use and
2416  * send request to bluetooth chip for activation.
2417  * This function is typically called at startup or when Bluetooth services are required.  This
2418  * function must be called before calling any other API of Bluetooth operations.
2419  *
2420  * Before performing any operations like Device discover, service search etc.., the adapter must be
2421  * enabled.
2422  *
2423  * This function is a asynchronous call.
2424  * If the call is success then the application will receive BLUETOOTH_EVENT_ENABLED event
2425  * through registered callback function with appropriate result code
2426  *                      BLUETOOTH_CHANGE_STATUS_TIMEOUT - Timeout has happen \n
2427  *                      BLUETOOTH_ERROR_NONE - Success \n
2428  *
2429  * If the adpter is not enabled with in 30 seconds then BLUETOOTH_EVENT_ENABLED with result code
2430  * BLUETOOTH_CHANGE_STATUS_TIMEOUT will come
2431  *
2432  * @return      BLUETOOTH_ERROR_NONE - Success\n
2433  *              BLUETOOTH_ERROR_DEVICE_ALREADY_ENABLED - Adapter already enabled\n
2434  *              BLUETOOTH_ERROR_ACCESS_DENIED - Enabling adapter is not allowed by MDM policy\n
2435  *              BLUETOOTH_ERROR_IN_PROGRESS - Adapter is activating or deactivating\n
2436  * @exception   BLUETOOTH_ERROR_INTERNAL - Dbus proxy call is fail
2437  * @remark      None
2438  * @see         bluetooth_check_adapter, bluetooth_disable_adapter
2439 @code
2440 void bt_event_callback(int event, bluetooth_event_param_t *param)
2441 {
2442         switch(event)
2443         {
2444                 case BLUETOOTH_EVENT_ENABLED:
2445                         if (param->result == BLUETOOTH_ERROR_NONE)
2446                         {
2447                                 // Successfully Enabled
2448                         }
2449                         else
2450                         {
2451                                 // Failed
2452                         }
2453                         break;
2454         }
2455 }
2456
2457 ...
2458
2459 int ret = 0;
2460 ret = bluetooth_enable_adapter();
2461
2462 @endcode
2463  */
2464 int bluetooth_enable_adapter(void);
2465
2466 /**
2467  * @fn int bluetooth_disable_adapter(void)
2468  * @brief Disable the Bluetooth H/W
2469  *
2470  *
2471  * This function disables Bluetooth protocol stack and hardware. This function is called when
2472  * Bluetooth is no longer used. It will internally free all resources and power off the RF radio.
2473  *
2474  * Bluetooth adapter should be disabled to switch off Bluetooth chip (and thereby saving power).
2475  * bluetooth_disable_adapter() API will do that job for you. After switching off Bluetooth,
2476  * BLUETOOTH_EVENT_DISABLED will be sent by SDK to application for confirmation with appropriate
2477  * error code.
2478  * The various error codes are BLUETOOTH_ERROR_NONE for success and BLUETOOTH_ERROR_INTERNAL for
2479  * internal error.
2480  *
2481  * This function is a asynchronous call.
2482  * If this call is success then the applications will receive BLUETOOTH_EVENT_DISABLED event
2483  * through registered callback function.
2484  *
2485  *
2486  * @return      BLUETOOTH_ERROR_NONE - Success\n
2487  *              BLUETOOTH_ERROR_IN_PROGRESS - Adapter is activating or deactivating\n
2488  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Bluetooth adapter is not enabled\n
2489  * @exception   BLUETOOTH_ERROR_INTERNAL - Dbus proxy call is fail
2490  * @remark      None
2491  * @see         bluetooth_check_adapter, bluetooth_enable_adapter
2492 @code
2493 void bt_event_callback(int event, bluetooth_event_param_t *param)
2494 {
2495         switch(event)
2496         {
2497                 case BLUETOOTH_EVENT_DISABLED:
2498                         if (param->result == BLUETOOTH_ERROR_NONE)
2499                         {
2500                                 // Successfully disabled
2501                         }
2502                         else
2503                         {
2504                                 // Failed
2505                         }
2506                         break;
2507         }
2508 }
2509
2510 ...
2511
2512 int ret = 0;
2513 ret = bluetooth_disable_adapter();
2514 @endcode
2515  */
2516 int bluetooth_disable_adapter(void);
2517 int bluetooth_read_battery_data(bt_battery_data *latest);
2518 int bluetooth_set_battery_monitor_state(bool state);
2519 int bluetooth_get_battery_monitor_state(void);
2520 int bluetooth_recover_adapter(void);
2521 int bluetooth_check_adapter_le(void);
2522 int bluetooth_enable_adapter_le(void);
2523
2524 int bluetooth_disable_adapter_le(void);
2525 int bluetooth_get_uuid_name(const char *uuid, char **name);
2526
2527 /**
2528  * @fn int bluetooth_reset_adapter(void)
2529  * @brief Reset the Bluetooth H/W and values
2530  *
2531  *
2532  * This function resets Bluetooth protocol stack and hardware. This function is called when
2533  * an user want to initialize Bluetooth environment.
2534  *
2535  * The various error codes are BLUETOOTH_ERROR_NONE for success and BLUETOOTH_ERROR_INTERNAL for
2536  * internal error.
2537  *
2538  * This function is a synchronous call.
2539  *
2540  * @return      BLUETOOTH_ERROR_NONE - Success\n
2541  * @exception   BLUETOOTH_ERROR_INTERNAL - Dbus proxy call is fail
2542  * @remark      None
2543  * @see         bluetooth_check_adapter, bluetooth_enable_adapter
2544 @code
2545 ...
2546
2547 int ret = 0;
2548 ret = bluetooth_reset_adapter();
2549 @endcode
2550  */
2551 int bluetooth_reset_adapter(void);
2552
2553 /**
2554  * @fn int bluetooth_is_supported(void)
2555  * @brief Check if the bluetooth is supported or not by the current target
2556  *
2557  * This API checks whether the bluetooth is supported or not.
2558  * This API only run by root permission.
2559  *
2560  * This function is a synchronous call.
2561  *
2562  * @return      0 - if bluetooth is not supported\n
2563  *              1 - if bluetooth is supported\n
2564  *              BLUETOOTH_ERROR_INTERNAL - Error in API internal
2565  * @remark      None
2566 @code
2567
2568 int ret = 0;
2569 ret = bluetooth_is_supported();
2570 @endcode
2571  */
2572 int bluetooth_is_supported(void);
2573
2574
2575 /**
2576  * @fn int bluetooth_check_adapter(void)
2577  * @brief Check the current status of the Bluetooth adapter
2578  *
2579  *
2580  * This API checks whether the Bluetooth adapter is enabled or not. Before performing any operations
2581  * the bluetooth adapter should be enabled. This API helps to find out the current state of the
2582  * bluetooth adapter.
2583  * This API get the adapter internal data structure and check current adapter status.
2584  *
2585  * This function is a synchronous call.
2586  *
2587  *
2588  * @return      BLUETOOTH_ADAPTER_DISABLED - if bluetooth adapter is disabled\n
2589  *              BLUETOOTH_ADAPTER_ENABLED - if bluetooth adapter is enabled\n
2590  * @remark      None
2591  * @see         bluetooth_enable_adapter, bluetooth_disable_adapter
2592 @code
2593
2594 int ret = 0;
2595 ret = bluetooth_check_adapter();
2596 @endcode
2597  */
2598 int bluetooth_check_adapter(void);
2599
2600 /**
2601  * @fn int bluetooth_get_local_address(bluetooth_device_address_t *local_address)
2602  * @brief Get the local adapter bluetooth address
2603  *
2604  *
2605  * This API is used, get the device address of the local bluetooth adapter. Before calling this API,
2606  * the adapter should be enabled.
2607  * In its output parameter, you can receive bluetooth_device_address_t type of pointer which will
2608  * contain Bluetooth address.
2609  * Since its inconvenient for user to remember the address, Bluetooth provides a method to have a
2610  * friendly name for each device.
2611  * There is no event callback for this API.
2612  *
2613  * This function is a synchronous call.
2614  *
2615  *
2616  * @return      BLUETOOTH_ERROR_NONE - Succeess \n
2617  *              BLUETOOTH_ERROR_INVALID_PARAM -  Invalid parameter (NULL buffer) \n
2618  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED -  Adapter is disabled \n
2619  * @param[out]  local_address   a device address of local bluetooth adapter
2620  * @remark      None
2621  * @see         None
2622 @code
2623
2624 bluetooth_device_address_t local_address={0,};
2625 int ret = 0;
2626
2627 ret = bluetooth_get_local_address(&local_address);
2628 @endcode
2629  */
2630 int bluetooth_get_local_address(bluetooth_device_address_t *local_address);
2631
2632 /**
2633  * @fn int bluetooth_get_local_version(bluetooth_version_t *version)
2634  * @brief Get the hci version
2635  *
2636  *
2637  * This function is used to get the bluetooth hci version
2638  * Before calling this API make sure that the adapter is enabled.
2639  *
2640  * This function is a synchronous call.
2641  *
2642  *
2643  * @return      BLUETOOTH_ERROR_NONE - Success \n
2644  *              BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
2645  * @param[out]  timeout   remain visibility timeout value
2646  * @remark      None
2647  @code
2648 bluetooth_version_t *version;
2649  int ret = 0;
2650  ret = bluetooth_get_local_version (&version);
2651  @endcode
2652  */
2653 int bluetooth_get_local_version(bluetooth_version_t *version);
2654
2655 /**
2656  * @fn int bluetooth_get_local_name(bluetooth_device_name_t* local_name)
2657  * @brief Get the local device name
2658  *
2659  *
2660  * This function is used, get the local device name. Since its difficult to remember the Adapter
2661  * address, the friendly name can be assigned to the adapter and we can get it using this API. This
2662  * friendly name is retrived by the remote device and displaying.
2663  * Before calling this API, the adapter should be enabled. There is no event callback for this API.
2664  *
2665  * This function is a synchronous call.
2666  *
2667  *
2668  * @return      BLUETOOTH_ERROR_NONE - Success \n
2669  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter (NULL buffer)\n
2670  * @param[out]  local_name      a local device name
2671  * @remark      None
2672  * @see         None
2673 @code
2674 bluetooth_device_name_t local_name={0,}
2675 int ret = 0;
2676 ret = bluetooth_get_local_name (&local_name);
2677 @endcode
2678  */
2679 int bluetooth_get_local_name(bluetooth_device_name_t *local_name);
2680
2681 /**
2682  * @fn int bluetooth_set_local_name(const bluetooth_device_name_t *local_name)
2683  * @brief Set the local device name
2684  *
2685  *
2686  * This function is used to set the local device name. This is a human friendly name whose
2687  * length can be BLUETOOTH_DEVICE_NAME_LENGTH_MAX maximum
2688  *
2689  * This function is a synchronous call.
2690  *
2691  * @param[in]   local_name   bluetooth device name to set local device
2692  *
2693  * @return      BLUETOOTH_ERROR_NONE - Success \n
2694  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
2695  *              BLUETOOTH_ERROR_INVALID_PARAM - Bluetooth name parameter is incorrect \n
2696  *              BLUETOOTH_ERROR_INVALID_DATA - Device address provided is incorrect \n
2697  *              BLUETOOTH_ERROR_NO_RESOURCES - Pre-allocated memory error \n
2698  *              BLUETOOTH_ERROR_INTERNAL - The dbus method call is fail \n
2699  *
2700  * @remark      None
2701
2702 @code
2703 bluetooth_device_name_t local_name={0,}
2704 int ret = 0;
2705 ret = bluetooth_set_local_name (&local_name);
2706 @endcode
2707  */
2708 int bluetooth_set_local_name(const bluetooth_device_name_t *local_name);
2709
2710
2711 /**
2712  * @fn int bluetooth_is_service_used(const char *service_uuid, gboolean *used)
2713  * @brief Check if the uuid is used or not
2714  *
2715  * This function is used to check if the uuid is used or not.
2716  *
2717  * This function is a synchronous call.
2718  *
2719  * @param[in]   service_uuid   service uuid (UUID 128 bit as string)
2720  * @param[out] used  if the uuid is used or not
2721  *
2722  * @return      BLUETOOTH_ERROR_NONE - Success \n
2723  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
2724  *              BLUETOOTH_ERROR_INVALID_PARAM - Bluetooth name parameter is incorrect \n
2725  *              BLUETOOTH_ERROR_INTERNAL - The dbus method call is fail \n
2726  *
2727  * @remark      None
2728  *
2729 @code
2730 gboolean used = FALSE;
2731 const char *uuid ="00001101-0000-1000-8000-00805F9B34FB";
2732 ret = bluetooth_is_service_used(uuid, &used);
2733 @endcode
2734  */
2735 int bluetooth_is_service_used(const char *service_uuid, gboolean *used);
2736
2737 /**
2738  * @fn int bluetooth_is_device_connected(const bluetooth_device_address_t *device_address, bluetooth_service_type_t type, gboolean *is_connected)
2739  * @brief Check if the device is connected to the specific service
2740  *
2741  * This function is used to check if if the device is connected to the specific service.
2742  *
2743  * This function is a synchronous call.
2744  *
2745  * @param[in]   local_address   a device address of remote bluetooth device
2746  * @param[in]   type the service type
2747  * @param[out] is_connected  if the device is connected or not
2748  *
2749  * @return      BLUETOOTH_ERROR_NONE - Success \n
2750  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
2751  *              BLUETOOTH_ERROR_INVALID_PARAM - Bluetooth name parameter is incorrect \n
2752  *              BLUETOOTH_ERROR_INTERNAL - The dbus method call is fail \n
2753  *
2754  * @remark      None
2755  *
2756 @code
2757 gboolean is_connected = FALSE;
2758 bluetooth_device_address_t device_address={{0x00,0x0D,0xFD,0x24,0x5E,0xFF}};
2759 ret = bluetooth_is_device_connected(&device_address, BLUETOOTH_HSP_SERVICE, &used);
2760 @endcode
2761  */
2762 int bluetooth_is_device_connected(const bluetooth_device_address_t *device_address,
2763                                 bluetooth_service_type_t type,
2764                                 gboolean *is_connected);
2765
2766 /**
2767  * @fn int bluetooth_get_connected_link_type(const bluetooth_device_address_t *device_address, bluetooth_connected_link_t *connected_link)
2768  * @brief Gets device's connected link type
2769  *
2770  * This function is used to get device's connected link type
2771  *
2772  * This function is a synchronous call.
2773  *
2774  * @param[in]   device_address  a device address of remote bluetooth device
2775  * @param[out]  connected_link  a device's connected link type
2776  *
2777  * @return      BLUETOOTH_ERROR_NONE - Success \n
2778  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
2779  *              BLUETOOTH_ERROR_INVALID_PARAM - Bluetooth name parameter is incorrect \n
2780  *              BLUETOOTH_ERROR_INTERNAL - The dbus method call is fail \n
2781  *
2782  * @remark      None
2783  *
2784 @code
2785 bluetooth_connected_link_t *connected_link = BLUETOOTH_CONNECTED_LINK_NONE;
2786 bluetooth_device_address_t device_address={{0x00,0x0D,0xFD,0x24,0x5E,0xFF}};
2787 ret = bluetooth_get_connected_link(&device_address, &connected_link);
2788 @endcode
2789  */
2790 int bluetooth_get_connected_link_type(const bluetooth_device_address_t *device_address,
2791                                 bluetooth_connected_link_t *connected_link);
2792
2793 /**
2794  * @fn int bluetooth_set_profile_trusted(const bluetooth_device_address_t *device_address, int profile, int trust)
2795  * @brief Sets a profile trusted for a device
2796  *
2797  * This function is used to Set a profile as trusted for a device
2798  *
2799  * This function is a synchronous call.
2800  *
2801  * @param[in]   device_address  a device address of remote bluetooth device
2802  * @param[in]   profile profile which is to be set as trusted[0-PBAP, 1-MAP, 2-SAP]
2803  * @param[in]   trust   to set as trusted or untrusted[1-trusted 0-untrusted]
2804  *
2805  * @return      BLUETOOTH_ERROR_NONE - Success \n
2806  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
2807  *              BLUETOOTH_ERROR_INVALID_PARAM - Bluetooth name parameter is incorrect \n
2808  *              BLUETOOTH_ERROR_INTERNAL - The dbus method call is fail \n
2809  *
2810  * @remark      None
2811  */
2812 int bluetooth_set_profile_trusted(
2813                 const bluetooth_device_address_t *device_address,
2814                 int profile, int trust);
2815
2816 /**
2817  * @fn int bluetooth_get_profile_trusted(const bluetooth_device_address_t *device_address, int profile, int *trust)
2818  * @brief Gets a profile is trusted for a device
2819  *
2820  * This function is used to Get a profile is trusted or not for a device
2821  *
2822  * This function is a synchronous call.
2823  *
2824  * @param[in]   device_address  a device address of remote bluetooth device
2825  * @param[in]   profile profile whose trust status is needed[0-PBAP, 1-MAP, 2-SAP]
2826  * @param[out]  trust   profile is set as trusted or untrusted[1-trusted 0-untrusted]
2827  *
2828  * @return      BLUETOOTH_ERROR_NONE - Success \n
2829  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
2830  *              BLUETOOTH_ERROR_INVALID_PARAM - Bluetooth name parameter is incorrect \n
2831  *              BLUETOOTH_ERROR_INTERNAL - The dbus method call is fail \n
2832  *
2833  * @remark      None
2834  */
2835 int bluetooth_get_profile_trusted(
2836                 const bluetooth_device_address_t *device_address,
2837                 int profile, int *trust);
2838
2839 /**
2840  * @fn int bluetooth_get_discoverable_mode(bluetooth_discoverable_mode_t *discoverable_mode_ptr)
2841  * @brief Get the visibility mode
2842  *
2843  *
2844  * This function is used to get the discoverable mode (Visibility option). Depending upon the
2845  * visibity mode, the property of the device is determined whether it can be discoverable, non
2846  * discoverable, connectable etc. Before calling this API make sure that the adapter is enabled.
2847  *
2848  * This function is a synchronous call.
2849  *
2850  *
2851  * @return      BLUETOOTH_ERROR_NONE - Success \n
2852  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
2853  *              BLUETOOTH_ERROR_INVALID_DATA - Invalid data \n
2854  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
2855  *              BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
2856  * @param[out]  discoverable_mode   current bluetooth discoverable mode
2857  * @remark      None
2858  * @see         bluetooth_set_discoverable_mode
2859  @code
2860  bluetooth_discoverable_mode_t discoverable_mode_ptr;
2861  int ret = 0;
2862  ret = bluetooth_get_discoverable_mode (&discoverable_mode_ptr);
2863  @endcode
2864  */
2865 int bluetooth_get_discoverable_mode(bluetooth_discoverable_mode_t *discoverable_mode_ptr);
2866
2867 /**
2868  * @fn int bluetooth_set_discoverable_mode(bluetooth_discoverable_mode_t discoverable_mode,
2869  *                                              int timeout)
2870  * @brief Set the visibility mode
2871  *
2872  *
2873  * This function is used to set the discoverable mode (Visibility option).
2874  *
2875  * Many times user may want to keep his device discoverable so that when peer device is performing
2876  * device search, he/she can find user's device. Application programmer can keep the mode as
2877  * BLUETOOTH_DISCOVERABLE_MODE_GENERAL_DISCOVERABLE or
2878  * BLUETOOTH_DISCOVERABLE_MODE_TIME_LIMITED_DISCOVERABLE for the same purpose. However, all these
2879  * modes cause bluetooth adapter to consume more battery. Hence developer should generally
2880  * keep discoverable mode as BLUETOOTH_DISCOVERABLE_MODE_CONNECTABLE.
2881  *
2882  * This function is a synchronous call.
2883  *
2884  * @return      BLUETOOTH_ERROR_NONE - Success \n
2885  *              BLUETOOTH_ERROR_NOT_SUPPORT - Requested mode is not supported \n
2886  *
2887  * @param[in]  discoverable_mode   the bluetooth discoverable mode to set
2888  * @param[in]  timeout   discoverable time in only limited discoverable mode (second), default: 0
2889  * @remark      None
2890  * @see         bluetooth_get_discoverable_mode
2891
2892 @code
2893
2894 bluetooth_discoverable_mode_t mode;
2895 int ret = 0;
2896 mode= BLUETOOTH_DISCOVERABLE_MODE_TIME_LIMITED_DISCOVERABLE;
2897 ret = bluetooth_set_discoverable_mode (mode, 180);
2898
2899 @endcode
2900  */
2901 int bluetooth_set_discoverable_mode(bluetooth_discoverable_mode_t discoverable_mode,
2902                                             int timeout);
2903
2904
2905 /**
2906  * @fn int bluetooth_get_timeout_value(int *timeout)
2907  * @brief Get the visibility timeout value
2908  *
2909  *
2910  * This function is used to get the visibility timeout
2911  * Before calling this API make sure that the adapter is enabled.
2912  *
2913  * This function is a synchronous call.
2914  *
2915  *
2916  * @return      BLUETOOTH_ERROR_NONE - Success \n
2917  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
2918  *              BLUETOOTH_ERROR_INVALID_DATA - Invalid data \n
2919  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
2920  *              BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
2921  * @param[out]  timeout   remain visibility timeout value
2922  * @remark      None
2923  * @see         bluetooth_set_discoverable_mode
2924  @code
2925  int timeout;
2926  int ret = 0;
2927  ret = bluetooth_get_timeout_value (&timeout);
2928  @endcode
2929  */
2930 int bluetooth_get_timeout_value(int *timeout);
2931
2932
2933 /**
2934  * @fn int bluetooth_start_discovery(unsigned short max_response, unsigned short discovery_duration,
2935  *                                      unsigned int  classOfDeviceMask)
2936  * @brief Start the generic device discovery which finds both the BR/EDR and LE devices.
2937  *
2938  * To connect connect to peer bluetooth device, you will need to know its bluetooth address and its
2939  * name. You can search for Bluetooth devices in vicinity by bluetooth_start_discovery() API. It
2940  * first performs an inquiry and try to find both the BREDR and LE devices. For each device found
2941  * from the inquiry it gets the remote name of the device. Bluetooth device address and name are
2942  * given to Application via BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND event. In param_data of
2943  * bluetooth_event_param_t, you will receive a pointer to a structure of bluetooth_device_info_t type.
2944  * You will receive device address, device name, device class, rssi (received signal strength indicator).
2945  * please see bluetooth_device_info_t for more details.
2946  *
2947  *
2948  * This API provides searching options like max responses, discovery duration in seconds and class
2949  * of device mask to filter device search. some times there may be too many bluetooth devices in
2950  * vicinity of your device.in such scenario, application can request to reduce number of responces
2951  * (BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND event) with help of max_response parameter. However if you
2952  * pass zero, bluetooth adapter will not restrict number of responses. you can also specify duration
2953  * of the seach in discovery_duration. bluetooth adapter will automatically stop device search after
2954  * application defined time. please note that discovery_duration should be mentioned in seconds.
2955  * Also note that search will end after 180 seconds automatically if you pass 0 in discovery
2956  * duration.
2957  *
2958  * Sometimes user may want to search for a particular kind of device. for ex, mobile or pc. in such
2959  * case, you can use classOfDeviceMask parameter. please see bluetooth_device_service_class_t,
2960  * bluetooth_device_major_class_t and bluetooth_device_minor_class_t enums
2961  *
2962  * This function is a asynchronous call.
2963  * If the call is success then the application will receive BLUETOOTH_EVENT_DISCOVERY_STARTED event
2964  * through registered callback function.
2965  *
2966  * The discovery is responded by an BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND event for each device it
2967  * found and a BLUETOOTH_EVENT_REMOTE_DEVICE_NAME_UPDATED event for its name updation.
2968  *
2969  * The completion or cancellation of the discovery is indicated by an
2970  * BLUETOOTH_EVENT_DISCOVERY_FINISHED event.
2971  *
2972  * The device discovery can be cancelled by calling bluetooth_stop_discovery().
2973  *
2974  *
2975  * @return      BLUETOOTH_ERROR_NONE - Success \n
2976  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Bluetooth adapter is not enabled \n
2977  *              BLUETOOTH_ERROR_DEVICE_BUSY - Bluetooth adapter is busy doing some operation \n
2978  *              BLUETOOTH_ERROR_INTERNAL - System error like heap full has occured or bluetooth
2979                                                 agent is not running \n
2980  *
2981  * @param[in] max_response              define the maximum response of the number of founded devices
2982                                         (0 means unlimited)
2983  * @param[in] discovery_duration        define bluetooth discovery duration (0 means 180s )
2984  * @param[in] classOfDeviceMask         define classes of the device mask which user wants
2985                                         (refer to class of device)
2986  * @remark      None
2987  * @see         bluetooth_start_custom_discovery(), bluetooth_cancel_discovery, bluetooth_device_info_t
2988
2989 @code
2990 void bt_event_callback(int event, bluetooth_event_param_t *param)
2991 {
2992         switch(event)
2993         {
2994                 case BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND:
2995                 {
2996                         bluetooth_device_info_t *device_info = NULL;
2997                         printf("BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND, result [0x%04x]",
2998                                         param->result);
2999                         device_info  = (bluetooth_device_info_t *)param->param_data;
3000                         memcpy(&searched_device, &device_info->device_address,
3001                                                 sizeof(bluetooth_device_address_t));
3002                         printf("dev [%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X]",
3003                                 device_info->device_address.addr[0],
3004                                 device_info->device_address.addr[1],
3005                                 device_info->device_address.addr[2],
3006                                 device_info->device_address.addr[3],
3007                                 device_info->device_address.addr[4],
3008                                 device_info->device_address.addr[5]);
3009                         break;
3010                 }
3011                 case BLUETOOTH_EVENT_REMOTE_DEVICE_NAME_UPDATED:
3012                 {
3013                         bluetooth_device_info_t *device_info = NULL;
3014                         printf("BLUETOOTH_EVENT_REMOTE_DEVICE_NAME_UPDATED, result [0x%04x]",
3015                                                                                 param->result);
3016                         device_info  = (bluetooth_device_info_t *)param->param_data;
3017                         memcpy(&searched_device, &device_info->device_address,
3018                                                                 sizeof(bluetooth_device_address_t));
3019                         printf("dev [%s] [%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X]",
3020                                                         device_info->device_name.name,
3021                                                         device_info->device_address.addr[0],
3022                                                         device_info->device_address.addr[1],
3023                                                         device_info->device_address.addr[2],
3024                                                         device_info->device_address.addr[3],
3025                                                         device_info->device_address.addr[4],
3026                                                         device_info->device_address.addr[5]);
3027                         break;
3028                 }
3029
3030                 case BLUETOOTH_EVENT_DISCOVERY_FINISHED:
3031                         printf("BLUETOOTH_EVENT_DISCOVERY_FINISHED, result[0x%04x]", param->result);
3032                         break;
3033         }
3034 }
3035
3036 unsigned short max_response;
3037 unsigned short discovery_duration;
3038 unsigned classOfDeviceMask;
3039 int ret = 0;
3040
3041 max_response =0;
3042 discovery_duration =0;
3043 classOfDeviceMask =0;
3044
3045 ret = bluetooth_start_discovery(max_response,discovery_duration,classOfDeviceMask);
3046
3047 @endcode
3048  *
3049  */
3050 int bluetooth_start_discovery(unsigned short max_response,
3051                                       unsigned short discovery_duration,
3052                                       unsigned int classOfDeviceMask);
3053
3054 /**
3055  * @fn int bluetooth_start_custom_discovery(bt_discovery_role_type_t role
3056  *                                      unsigned short max_response,
3057  *                                      unsigned short discovery_duration,
3058  *                                      unsigned int  classOfDeviceMask)
3059  * @brief Start the custom device discovery with specific type such as BR/EDR, LE, LE+BR/EDR etc.
3060  *
3061  * Sometimes user may want to search for a particular kind of device. for ex, LE only or BR/EDR only.
3062  * In such case, you can use type parameter. This API is similar to that of bluetooth_start_discovery().
3063  * Please see bluetooth_start_discovery() for other parameters description.
3064  *
3065  * This function is a asynchronous call.
3066  * If the call is success then the application will receive BLUETOOTH_EVENT_DISCOVERY_STARTED event
3067  * through registered callback function.
3068  *
3069  * The discovery is responded by an BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND event for each device it
3070  * found and a BLUETOOTH_EVENT_REMOTE_DEVICE_NAME_UPDATED event for its name updation.
3071  *
3072  * The completion or cancellation of the discovery is indicated by an
3073  * BLUETOOTH_EVENT_DISCOVERY_FINISHED event.
3074  *
3075  * The device discovery can be cancelled by calling bluetooth_stop_discovery().
3076  *
3077  *
3078  * @return      BLUETOOTH_ERROR_NONE - Success \n
3079  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Bluetooth adapter is not enabled \n
3080  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3081  *              BLUETOOTH_ERROR_IN_PROGRESS - Bluetooth adapter is busy with another discovery \n
3082  *              BLUETOOTH_ERROR_INTERNAL - System error like heap full has occured or bluetooth
3083                                                 agent is not running \n
3084  *
3085  * @param[in] role              define the role type of devices to be discovered. See enum bt_discovery_role_type_t.
3086                                         (DISCOVERY_ROLE_BREDR means BREDR only, DISCOVERY_ROLE_LE mean Low Energy only,
3087                                         DISCOVERY_ROLE_LE_BREDR means LE & BREDR - same as bluetooth_start_discovery())
3088  * @param[in] max_response              define the maximum response of the number of founded devices
3089                                         (0 means unlimited)
3090  * @param[in] discovery_duration        define bluetooth discovery duration (0 means 180s )
3091  * @param[in] classOfDeviceMask         define classes of the device mask which user wants
3092                                         (refer to class of device)
3093  * @remark      None
3094  * @see         bluetooth_start_discovery(), bluetooth_cancel_discovery, bluetooth_device_info_t
3095
3096 @code
3097 unsigned short type;
3098 unsigned short max_response;
3099 unsigned short discovery_duration;
3100 unsigned classOfDeviceMask;
3101 int ret = 0;
3102
3103 type = 1;
3104 max_response =0;
3105 discovery_duration =0;
3106 classOfDeviceMask =0;
3107
3108 ret = bluetooth_start_custom_discovery(type, max_response, discovery_duration, classOfDeviceMask);
3109
3110 @endcode
3111  *
3112  */
3113 int bluetooth_start_custom_discovery(bt_discovery_role_type_t role,
3114                                                 unsigned short max_response,
3115                                                 unsigned short discovery_duration,
3116                                                 unsigned int classOfDeviceMask);
3117
3118 /**
3119  * @fn int bluetooth_cancel_discovery (void)
3120  * @brief Cancel the on-going device discovery operation
3121  *
3122  *
3123  * This function stops the on-going device discovery operation. This API has to be called after the
3124  * bluetooth_start_discovery API and before the BLUETOOTH_EVENT_DISCOVERY_FINISHED event comes of
3125  * the bluetooth_start_discovery API
3126  *
3127  * Normally the device discovery takes a more time (~10.24 seconds) to get all the devices in its
3128  * vicinity and it recevies as BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND event. This API helps us to
3129  * cancel the discover request once the user received the device to which he wish to connect.
3130  *
3131  * This function is a asynchronous call.
3132  * If the call is success to cancel discovey then the application will receive
3133  * BLUETOOTH_EVENT_DISCOVERY_FINISHED event through registered callback function
3134  * with an error code BLUETOOTH_ERROR_CANCEL. In the case of failure the error code will be
3135  * BLUETOOTH_ERROR_NONE
3136  *
3137  *
3138  * @return      BLUETOOTH_ERROR_NONE - Success \n
3139  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
3140  *              BLUETOOTH_ERROR_NOT_IN_OPERATION - No Discovery operation in progess to cancel \n
3141  *              BLUETOOTH_ERROR_ACCESS_DENIED - Currently in discovery but it is requested from
3142                                                 other application \n
3143  *              BLUETOOTH_ERROR_INTERNAL - Internel IPC error \n
3144  * @remark      None
3145  * @see         bluetooth_start_discovery
3146 @code
3147 void bt_event_callback(int event, bluetooth_event_param_t *param)
3148 {
3149         switch(event)
3150         {
3151                 case BLUETOOTH_EVENT_DISCOVERY_FINISHED:
3152                         TC_PRT("BLUETOOTH_EVENT_DISCOVERY_FINISHED, result[0x%04x]", param->result);
3153                         break;
3154         }
3155 }
3156
3157 ..
3158
3159 int ret = 0;
3160
3161 ret = bluetooth_cancel_discovery();
3162 @endcode
3163  */
3164 int bluetooth_cancel_discovery(void);
3165
3166 /**
3167  * @fn int bluetooth_start_le_discovery(void)
3168  * @brief Start the generic device discovery which finds the LE devices.
3169  *
3170  * To connect connect to peer bluetooth device, you will need to know its bluetooth address and its
3171  * name. You can search for Bluetooth devices in vicinity by bluetooth_start_le_discovery() API.
3172  * It try to find LE devices. Bluetooth device address and name are
3173  * given to Application via BLUETOOTH_EVENT_REMOTE_LE_DEVICE_FOUND event. In param_data of
3174  * bluetooth_event_param_t, you will receive a pointer to a structure of bluetooth_device_info_t type.
3175  * You will receive device address, device name, device class, rssi (received signal strength indicator).
3176  * please see bluetooth_device_info_t for more details.
3177  *
3178  * This function is a asynchronous call.
3179  * If the call is success then the application will receive BLUETOOTH_EVENT_LE_DISCOVERY_STARTED event
3180  * through registered callback function.
3181  *
3182  * The discovery is responded by an BLUETOOTH_EVENT_REMOTE_LE_DEVICE_FOUND event for each device it
3183  * found.
3184  *
3185  * The completion or cancellation of the discovery is indicated by an
3186  * BLUETOOTH_EVENT_LE_DISCOVERY_FINISHED event.
3187  *
3188  * The device discovery can be cancelled by calling bluetooth_stop_le_discovery().
3189  *
3190  *
3191  * @return      BLUETOOTH_ERROR_NONE - Success \n
3192  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Bluetooth adapter is not enabled \n
3193  *              BLUETOOTH_ERROR_DEVICE_BUSY - Bluetooth adapter is busy doing some operation \n
3194  *              BLUETOOTH_ERROR_INTERNAL - System error like heap full has occured or bluetooth
3195                                                 agent is not running \n
3196  *
3197  * @remark      None
3198  * @see         bluetooth_stop_le_discovery, bluetooth_device_info_t
3199
3200 @code
3201 void bt_event_callback(int event, bluetooth_event_param_t *param)
3202 {
3203         switch(event)
3204         {
3205                 case BLUETOOTH_EVENT_REMOTE_LE_DEVICE_FOUND:
3206                 {
3207                         bluetooth_device_info_t *device_info = NULL;
3208                         printf("BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND, result [0x%04x]",
3209                                         param->result);
3210                         device_info  = (bluetooth_device_info_t *)param->param_data;
3211                         memcpy(&searched_device, &device_info->device_address,
3212                                                 sizeof(bluetooth_device_address_t));
3213                         printf("dev [%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X]",
3214                                 device_info->device_address.addr[0],
3215                                 device_info->device_address.addr[1],
3216                                 device_info->device_address.addr[2],
3217                                 device_info->device_address.addr[3],
3218                                 device_info->device_address.addr[4],
3219                                 device_info->device_address.addr[5]);
3220                         break;
3221                 }
3222
3223                 case BLUETOOTH_EVENT_LE_DISCOVERY_FINISHED:
3224                         printf("BLUETOOTH_EVENT_LE_DISCOVERY_FINISHED, result[0x%04x]", param->result);
3225                         break;
3226         }
3227 }
3228
3229 int ret = 0;
3230 ret = bluetooth_start_discovery();
3231
3232 @endcode
3233  *
3234  */
3235 int bluetooth_start_le_discovery(void);
3236
3237 /**
3238  * @fn int bluetooth_stop_le_discovery (void)
3239  * @brief Cancel the on-going device LE discovery operation
3240  *
3241  *
3242  * This function stops the on-going device discovery operation. This API has to be called after the
3243  * bluetooth_start_le_discovery API and before the BLUETOOTH_EVENT_LE_DISCOVERY_FINISHED event comes of
3244  * the bluetooth_start_le_discovery API
3245  *
3246  *
3247  * This function is a asynchronous call.
3248  * If the call is success to cancel discovey then the application will receive
3249  * BLUETOOTH_EVENT_LE_DISCOVERY_FINISHED event through registered callback function
3250  * with an error code BLUETOOTH_ERROR_CANCEL. In the case of failure the error code will be
3251  * BLUETOOTH_ERROR_NONE
3252  *
3253  *
3254  * @return      BLUETOOTH_ERROR_NONE - Success \n
3255  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
3256  *              BLUETOOTH_ERROR_NOT_IN_OPERATION - No Discovery operation in progess to cancel \n
3257  *              BLUETOOTH_ERROR_ACCESS_DENIED - Currently in discovery but it is requested from
3258                                                 other application \n
3259  *              BLUETOOTH_ERROR_INTERNAL - Internel IPC error \n
3260  * @remark      None
3261  * @see         bluetooth_start_discovery
3262 @code
3263 void bt_event_callback(int event, bluetooth_event_param_t *param)
3264 {
3265         switch(event)
3266         {
3267                 case BLUETOOTH_EVENT_LE_DISCOVERY_FINISHED:
3268                         TC_PRT("BLUETOOTH_EVENT_LE_DISCOVERY_FINISHED, result[0x%04x]", param->result);
3269                         break;
3270         }
3271 }
3272
3273 ..
3274
3275 int ret = 0;
3276
3277 ret = bluetooth_stop_le_discovery();
3278 @endcode
3279  */
3280 int bluetooth_stop_le_discovery(void);
3281
3282 /**
3283  * @fn int bluetooth_is_discovering(void)
3284  * @brief Check for the device discovery is in-progress or not.
3285  *
3286  * This API is used to check the current status of the Discovery operation.If discovery is in\
3287  * progress normally other operations are not allowed.
3288  * If a device discovery is in progress, we have to either cancel the discovery operation or wait
3289  * for the BLUETOOTH_EVENT_DISCOVERY_FINISHED
3290  * event before performing other operations. This API is used to get for the current discovery
3291  * operation status and using bluetooth_cancel_discovery()
3292  * we can cancell the ongoing discovery process.
3293  * Before calling this API, make sure that the adapter is enabled. There is no callback event for
3294  * this API.
3295  *
3296  * This function checks whether the device discovery is started or not.
3297  *
3298  * This function is a synchronous call.
3299  *
3300  *
3301  * @return      BLUETOOTH_ERROR_NONE - Discovery is not in progress \n
3302  *              BLUETOOTH_ERROR_NONE+1 - Discovery in progress \n
3303  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
3304  *
3305  * @remark      None
3306  * @see         bluetooth_start_discovery, bluetooth_cancel_discovery
3307
3308 @code
3309 int ret = 0;
3310 ret = bluetooth_is_discovering ();
3311 @endcode
3312  */
3313 int bluetooth_is_discovering(void);
3314
3315 /**
3316  * @fn int bluetooth_is_le_discovering(void)
3317  * @brief Check for the device LE discovery is in-progress or not.
3318  *
3319  * This API is used to check the current status of the LE Discovery operation.If discovery is in\
3320  * progress normally other operations are not allowed.
3321  * If a device discovery is in progress, we have to either cancel the discovery operation or wait
3322  * for the BLUETOOTH_EVENT_LE_DISCOVERY_FINISHED
3323  * event before performing other operations. This API is used to get for the current discovery
3324  * operation status and using bluetooth_stop_le_discovery()
3325  * we can cancell the ongoing LE discovery process.
3326  * Before calling this API, make sure that the adapter is enabled. There is no callback event for
3327  * this API.
3328  *
3329  * This function checks whether the device  LE discovery is started or not.
3330  *
3331  * This function is a synchronous call.
3332  *
3333  *
3334  * @return      BLUETOOTH_ERROR_NONE - Discovery is not in progress \n
3335  *              BLUETOOTH_ERROR_NONE+1 - Discovery in progress \n
3336  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
3337  *
3338  * @remark      None
3339  * @see         bluetooth_start_le_discovery, bluetooth_stop_le_discovery
3340
3341 @code
3342 int ret = 0;
3343 ret = bluetooth_is_le_discovering ();
3344 @endcode
3345  */
3346 int bluetooth_is_le_discovering(void);
3347
3348 /**
3349  * @fn int bluetooth_is_le_scanning(void)
3350  * @brief Check for the device LE scan is in-progress or not.
3351  *
3352  * This API is used to check the current status of the LE Scan operation.If discovery is in\
3353  * progress normally other operations are not allowed.
3354  *
3355  * This function checks whether the device  LE Scan is started or not.
3356  *
3357  * This function is a synchronous call.
3358  *
3359  * @return   TRUE  - LE Scan in progress \n
3360  *              FALSE - LE Scan is not in progress \n
3361  *
3362  * @remark      None
3363
3364 @code
3365 gboolean is_le_scanning = 0;
3366 is_le_scanning = bluetooth_is_le_scanning ();
3367 @endcode
3368  */
3369 gboolean bluetooth_is_le_scanning(void);
3370
3371 int  bluetooth_is_scan_filter_supported(gboolean *is_supported);
3372
3373 /**
3374  * @fn int bluetooth_force_hcidump(int timeout)
3375  * @brief Enable /disable force-hcidump
3376  *
3377  * This function control force-hcidump.
3378  *
3379  * This function is a synchronous call.
3380  *
3381  * @return      BLUETOOTH_ERROR_NONE - Success \n
3382  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
3383  *              BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
3384  *
3385  * @param[in]   start  To enable or disable force-hcidump[TRUE / FALSE]
3386  *
3387  *
3388  * @remark      None
3389  */
3390 int bluetooth_force_hcidump(int timeout);
3391
3392 /**
3393  * @fn int bluetooth_register_scan_filter(bluetooth_le_scan_filter_t *filter)
3394  * @brief Register scan filter.
3395  *
3396  * This function registers the scan filter.
3397  *
3398  * This function is a synchronous call.
3399  *
3400  * @return      BLUETOOTH_ERROR_NONE - Success \n
3401  *
3402  * @param[in]   filter   scan filter to register
3403  *
3404  * @remark      None
3405  */
3406 int bluetooth_register_scan_filter(bluetooth_le_scan_filter_t *filter);
3407
3408 /**
3409  * @fn int bluetooth_enable_rssi(const bluetooth_device_address_t *remote_address,
3410                 int link_type, bt_rssi_threshold_t rssi_threshold)
3411  * @brief Enable RSSI monitoring
3412  *
3413  * This function enables RSSI monitoring and sets threshold for a connection
3414  *
3415  * @return      BLUETOOTH_ERROR_NONE - Success \n
3416  *
3417  * @remark      None
3418  * @see bluetooth_get_rssi_strength
3419  */
3420 int bluetooth_enable_rssi(const bluetooth_device_address_t *remote_address,
3421                 int link_type, bt_rssi_threshold_t *rssi_threshold);
3422
3423 /**
3424  * @fn int bluetooth_get_rssi_strength(const bluetooth_device_address_t *remote_address, int link_type)
3425  * @brief Gets Raw RSSI signal Strength
3426  *
3427  * This function gives the Raw RSSI signal strength for a connection.
3428  *
3429  * @return      BLUETOOTH_ERROR_NONE - Success \n
3430  *
3431  * @remark      None
3432  * @see bluetooth_enable_rssi
3433  */
3434 int bluetooth_get_rssi_strength(const bluetooth_device_address_t *remote_address, int link_type);
3435
3436 int bluetooth_set_connectable(gboolean is_connectable);
3437
3438 int bluetooth_is_connectable(gboolean *is_connectable);
3439
3440 int bluetooth_disconnect_device(const bluetooth_device_address_t *device_address);
3441
3442 /**
3443  * @fn int bluetooth_bond_device(const bluetooth_device_address_t *device_address)
3444  * @brief Initiate a bonding process
3445  *
3446  *
3447  * This function initiates a bonding procedure with a peer device.  The bonding procedure
3448  * enables authentication and optionally encryption on the Bluetooth link.
3449  *
3450  * Bonding is applied to the discovered device to which we need a secure connection. We cannot
3451  * inititate the bonding request to the devices already in the paired list.
3452  *
3453  * Usually we call this API after the device discovery.
3454  * This function is a asynchronous call.
3455  *
3456  * Response will be received through BLUETOOTH_EVENT_BONDING_FINISHED event. It can any of the below
3457  * mentioed result code
3458  * BLUETOOTH_ERROR_PARING_FAILED - Pairing faied \n
3459  * BLUETOOTH_ERROR_ACCESS_DENIED - Authetication rejected \n
3460  * BLUETOOTH_ERROR_CANCEL_BY_USER - Cancelled by the user \n
3461  * BLUETOOTH_ERROR_PARING_FAILED - Pairing failed \n
3462  * BLUETOOTH_ERROR_TIMEOUT - Timeout has haapened \n
3463  *
3464  * If the remote user is not responding with in a specific time(60 seconds), then a timeout happens
3465  * and BLUETOOTH_EVENT_BONDING_FINISHED callback event is called with and BLUETOOTH_ERROR_TIMEOUT
3466  * result code
3467  *
3468  * The bonding operation can be cancelled by calling bluetooth_cancel_bonding().
3469  *
3470  *
3471  * @return      BLUETOOTH_ERROR_NONE - Success \n
3472  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3473  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
3474  *              BLUETOOTH_ERROR_DEVICE_BUSY - Adapter is busy or Discovery is in Progress \n
3475  *              BLUETOOTH_ERROR_INVALID_DATA - Invalid BD address \n
3476  * @exception   None
3477  * @param[in]   device_address   This indicates an address of the device with which the pairing
3478  *                                      should be initiated
3479  * @remark      None
3480  * @see         bluetooth_cancel_bonding
3481  @code
3482 void bt_event_callback(int event, bluetooth_event_param_t *param)
3483 {
3484         switch(event)
3485         {
3486                 case BLUETOOTH_EVENT_BONDING_FINISHED:
3487                 {
3488                         TC_PRT("BLUETOOTH_EVENT_BONDING_FINISHED, result [0x%04x]", param->result);
3489                         if (param->result >= BLUETOOTH_ERROR_NONE)
3490                         {
3491                                 bluetooth_device_info_t *device_info = NULL;
3492                                 device_info  = (bluetooth_device_info_t *)param->param_data;
3493                                 printf("dev [%s] [%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X]
3494                                                         mjr[%#x] min[%#x] srv[%#x]",
3495                                                         device_info->device_name.name,
3496                                                         device_info->device_address.addr[0],
3497                                                         device_info->device_address.addr[1],
3498                                                         device_info->device_address.addr[2],
3499                                                         device_info->device_address.addr[3],
3500                                                         device_info->device_address.addr[4],
3501                                                         device_info->device_address.addr[5],
3502                                                         device_info->device_class.major_class,
3503                                                         device_info->device_class.minor_class,
3504                                                         device_info->device_class.service_class);
3505                         }
3506                         else
3507                         {
3508                                 //bonding failed
3509                         }
3510                         break;
3511                 }
3512         }
3513 }
3514
3515 ...
3516
3517 int ret = 0;
3518 bluetooth_device_address_t device_address={{0}};
3519
3520 ret = bluetooth_bond_device(&device_address);
3521
3522 @endcode
3523  */
3524 int bluetooth_bond_device(const bluetooth_device_address_t *device_address);
3525
3526 /**
3527  * @fn int bluetooth_bond_device_by_type(const bluetooth_device_address_t *device_address,
3528  *                              bluetooth_conn_type_t conn_type)
3529  * @brief Initiate a bonding process
3530  *
3531  *
3532  * This function initiates a bonding procedure with a peer device on the basis of connection type (BLE or BREDR).
3533  * The bonding procedure enables authentication and optionally encryption on the Bluetooth link.
3534  *
3535  * Bonding is applied to the discovered device to which we need a secure connection. We cannot
3536  * inititate the bonding request to the devices already in the paired list.
3537  *
3538  * Usually we call this API after the device discovery.
3539  * This function is a asynchronous call.
3540  *
3541  * Response will be received through BLUETOOTH_EVENT_BONDING_FINISHED event. It can any of the below
3542  * mentioed result code
3543  * BLUETOOTH_ERROR_PARING_FAILED - Pairing faied \n
3544  * BLUETOOTH_ERROR_ACCESS_DENIED - Authetication rejected \n
3545  * BLUETOOTH_ERROR_CANCEL_BY_USER - Cancelled by the user \n
3546  * BLUETOOTH_ERROR_PARING_FAILED - Pairing failed \n
3547  * BLUETOOTH_ERROR_TIMEOUT - Timeout has haapened \n
3548  *
3549  * If the remote user is not responding with in a specific time(60 seconds), then a timeout happens
3550  * and BLUETOOTH_EVENT_BONDING_FINISHED callback event is called with and BLUETOOTH_ERROR_TIMEOUT
3551  * result code
3552  *
3553  * The bonding operation can be cancelled by calling bluetooth_cancel_bonding().
3554  *
3555  *
3556  * @return BLUETOOTH_ERROR_NONE - Success \n
3557  *             BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3558  *             BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
3559  *             BLUETOOTH_ERROR_DEVICE_BUSY - Adapter is busy or Discovery is in Progress \n
3560  *             BLUETOOTH_ERROR_INVALID_DATA - Invalid BD address \n
3561  * @exception None
3562  * @param[in] device_address This indicates an address of the device with which pairing
3563  *                                        should be initiated
3564  * @param[in] conn_type This Indicates the connection type to be used for pairing in case of
3565  *                                 dual mode devices
3566  * @remark None
3567  * @see bluetooth_cancel_bonding
3568  */
3569 int bluetooth_bond_device_by_type(const bluetooth_device_address_t *device_address,
3570                                 bluetooth_conn_type_t conn_type);
3571
3572 /**
3573  * @fn int bluetooth_cancel_bonding(void)
3574  * @brief Cancel the on-going bonding process
3575  *
3576  * This API is called to cancel the on-going bonding procedure. It should be called before the
3577  * BLUETOOTH_EVENT_BONDING_FINISHED event comes.
3578  * This API is useful when the remote device is not responding to the bond request or we wish to
3579  * cancel the bonding request. In this case we need not wait for the timeout to happen.
3580  *
3581  * This function is a synchronous call.
3582  *
3583  * @return      BLUETOOTH_ERROR_NONE - Success \n
3584  *              BLUETOOTH_ERROR_NOT_IN_OPERATION - No bonding request in progress \n
3585  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
3586  * @exception   None
3587  * @remark      None
3588  * @see         bluetooth_bond_device
3589 @code
3590 ...
3591
3592 int ret = 0;
3593
3594 ret = bluetooth_cancel_bonding();
3595 @endcode
3596  */
3597 int bluetooth_cancel_bonding(void);
3598
3599 /**
3600  * @fn int bluetooth_unbond_device(const bluetooth_device_address_t *device_address)
3601  * @brief Remove bonding
3602  *
3603  *
3604  * To communicate with remote device over bluetooth link, user should bond with peer device.
3605  * After bonding is over, peer device is added to list of bonded devices. bluetooth_unbond_device()
3606  * API is used to remove peer device from the list. Please note that after removing the device
3607  * from bonded device list, you cannot communication with peer device until bonding happens again.
3608  *
3609  * User can call this function by passing bluetooth device address of any bonded device. Please note
3610  * that after successful return of this function, any bluetooth application running on your device
3611  * will not be able to communicate with unbonded device until bond operation happens again using
3612  * bluetooth_bond_device()
3613  *
3614  *
3615  * This function is a asynchronous call. The request to remove the specified device from the bonded
3616  * list is responded by an BLUETOOTH_EVENT_BONDED_DEVICE_REMOVED event. if the operation is success,
3617  * you will receive BLUETOOTH_ERROR_NONE. BLUETOOTH_ERROR_NOT_PAIRED may be received in result code
3618  * in case if there is a problem in locating given bluetooth device address in bonded devices list
3619  *
3620  *
3621  *
3622  * @return      BLUETOOTH_ERROR_NONE - Success \n
3623  *              BLUETOOTH_ERROR_INVALID_PARAM - Device address is not valid \n
3624  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Bluetooth adapter is not enabled \n
3625  *              BLUETOOTH_ERROR_DEVICE_BUSY     - Bluetooth adapter is busy doing some operation \n
3626  *              BLUETOOTH_ERROR_INVALID_DATA - Device address provided is incorrect \n
3627  *              BLUETOOTH_ERROR_INTERNAL - System error like heap full has occured or bluetooth
3628  *                                              agent is not running \n
3629  *              BLUETOOTH_ERROR_NOT_PAIRED - Device address mentioned in the argument is not a
3630  *                                              bonded device \n
3631  *
3632  * @param[in]   device_address   This indicates an address of the device to remove bonding
3633  *
3634  * @remark      None
3635  *
3636  * @see         bluetooth_bond_device, bluetooth_cancel_bonding
3637  *
3638 @code
3639 void bt_event_callback(int event, bluetooth_event_param_t *param)
3640 {
3641         switch(event) {
3642                 case BLUETOOTH_EVENT_BONDED_DEVICE_REMOVED: {
3643                         bluetooth_device_address_t *dev_addr = NULL;
3644
3645                         if (param->result == BLUETOOTH_ERROR_NONE) {
3646                                 dev_addr = (bluetooth_device_address_t *)param->param_data;
3647                                 //Unbound scuccess
3648                                 printf("%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n",
3649                                         dev_addr->addr[0], dev_addr->addr[1]
3650                                         dev_addr->addr[2], dev_addr->addr[3]
3651                                         dev_addr->addr[4], dev_addr->addr[5]
3652                         } else {
3653                                 //unbound failure
3654                         }
3655                 }
3656         }
3657 }
3658
3659 ...
3660
3661 int ret = 0;
3662 bluetooth_device_address_t *device_address;
3663
3664 // copy valid device address in device_address
3665
3666 ret = bluetooth_unbond_device(device_address);
3667 @endcode
3668  */
3669 int bluetooth_unbond_device(const bluetooth_device_address_t *device_address);
3670
3671 /**
3672  * @fn int bluetooth_get_bonded_device_list(GPtrArray **dev_list)
3673  * @brief Get bonded(paired) device list
3674  *
3675  *
3676  * This API gets all bonded device list.
3677  * The devices in the bonded device list further can be used to perform the authorization by calling
3678  * bluetooth_authorize_device API.
3679  *
3680  * This function is a synchronous call.
3681  * Information for bonded devices can be obtained when result code is BLUETOOTH_ERROR_NONE. If not,
3682  * there is no valid information in the dev_list.
3683  * The len field in the dev_list represents the number of bonded devices. The data structure for
3684  * bonded device information is bluetooth_device_info_t.
3685  *
3686  *
3687  * @return      BLUETOOTH_ERROR_NONE - Success \n
3688  *              BLUETOOTH_ERROR_NOT_SUPPORT - Opreation not supported \n
3689  * @remark      None
3690  * @see         bluetooth_bond_device, bluetooth_unbond_device, bluetooth_authorize_device
3691  @code
3692 void bt_get_bonded_devices(void)
3693 {
3694 ...
3695         int i;
3696         GPtrArray *devinfo = NULL;
3697         bluetooth_device_info_t *ptr;
3698
3699         // allocate the g_pointer_array
3700         devinfo = g_ptr_array_new();
3701
3702         ret = bluetooth_get_bonded_device_list(&devinfo);
3703         if (ret != BLUETOOTH_ERROR_NONE)
3704         {
3705                 printf("bluetooth_get_bonded_device_list failed with [%d]",ret);
3706         }
3707         else
3708         {
3709                 printf("g pointer arrary count : [%d]", devinfo->len);
3710                 for (i=0; i<devinfo->len; i++)
3711                 {
3712                         ptr = g_ptr_array_index(devinfo, i);
3713                         if (ptr != NULL)
3714                         {
3715                                 printf("Name [%s]\n", ptr->device_name.name);
3716                                 printf("Major Class [%d]\n", ptr->device_class.major_class);
3717                                 printf("Minor Class [%d]\n", ptr->device_class.minor_class);
3718                                 printf("Service Class [%d]\n", ptr->device_class.service_class);
3719                                 printf("%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n",
3720                                                                 ptr->device_address.addr[0],
3721                                 ptr->device_address.addr[1], ptr->device_address.addr[2],
3722                                                                 ptr->device_address.addr[3],
3723                                 ptr->device_address.addr[4], ptr->device_address.addr[5]);
3724
3725                                 // handle
3726                                 ...
3727                         }
3728                 }
3729         }
3730         // free g_pointer_array
3731         g_ptr_array_free(devinfo, TRUE);
3732 }
3733
3734 @endcode
3735  */
3736 int bluetooth_get_bonded_device_list(GPtrArray **dev_list);
3737
3738 int bluetooth_get_profile_connected_device_list(
3739                 const char *profile_uuid, GPtrArray **addr_list);
3740
3741 /**
3742  * @fn int bluetooth_get_bonded_device(const bluetooth_device_address_t *device_address,
3743  *                                      bluetooth_device_info_t *dev_info)
3744  * @brief Get a bonded(paired) device
3745  *
3746  *
3747  * This API gets a bonded device.
3748  *
3749  * This function is a synchronous call.
3750  * Information for bonded devices can be obtained when result code is BLUETOOTH_ERROR_NONE. If not,
3751  * there is no valid information in the dev_info.
3752  * The data structure for bonded device information is bluetooth_device_info_t.
3753  *
3754  *
3755  * @return      BLUETOOTH_ERROR_NONE - Success \n
3756  *              BLUETOOTH_ERROR_NOT_SUPPORT - Opreation not supported \n
3757  * @remark      None
3758  * @see         bluetooth_bond_device, bluetooth_unbond_device, bluetooth_authorize_device
3759  @code
3760 void bt_get_bonded_device(void)
3761 {
3762 ...
3763         int i;
3764         bluetooth_device_info_t devinfo = {0};
3765         bluetooth_device_address_t device_address={{0x00,0x1C,0x43,0x2B,0x1A,0xE5}};
3766
3767         ret = bluetooth_get_bonded_device(&device_address, &devinfo);
3768         if (ret != BLUETOOTH_ERROR_NONE)
3769         {
3770                 printf("bluetooth_get_bonded_device failed with [%d]",ret);
3771         }
3772         else
3773         {
3774                 printf("Name [%s]\n", devinfo.device_name.name);
3775                 printf("Major Class [%d]\n", devinfo.device_class.major_class);
3776                 printf("Minor Class [%d]\n", devinfo.device_class.minor_class);
3777                 printf("Service Class [%d]\n", devinfo.device_class.service_class);
3778                 printf("%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n", devinfo.device_address.addr[0],
3779                 devinfo.device_address.addr[1], devinfo.device_address.addr[2],
3780                 devinfo.device_address.addr[3], devinfo.device_address.addr[4],
3781                 devinfo.device_address.addr[5]);
3782
3783                 // handle
3784                 ...
3785         }
3786 }
3787
3788 @endcode
3789  */
3790 int bluetooth_get_bonded_device(const bluetooth_device_address_t *device_address,
3791                                         bluetooth_device_info_t *dev_info);
3792
3793 /**
3794  * @fn int bluetooth_get_is_alias_set(const bluetooth_device_address_t *device_address,
3795  *                                      gboolean *is_alias_set)
3796  * @brief Get is_alias_set property of device
3797  *
3798  * This API gets is_alias_set property of a bonded device.
3799  *
3800  * This function is a synchronous call.
3801  * Information for is_alias_set property can be obtained only when result code is BLUETOOTH_ERROR_NONE.
3802  * If not,there is no valid information in the is_alias_set.
3803  *
3804  * @return      BLUETOOTH_ERROR_NONE - Success \n
3805  *                      BLUETOOTH_ERROR_NOT_SUPPORT - Opreation not supported \n
3806  * @remark None
3807  @code
3808         int ret = 0;
3809         gboolean alias_set;
3810         bluetooth_device_address_t device_address = {{0x00,0x1C,0x43,0x2B,0x1A,0xE5}};
3811
3812         ret = bluetooth_get_is_alias_set(&device_address, &alias_set);
3813  @endcode
3814  */
3815 int bluetooth_get_is_alias_set(const bluetooth_device_address_t *device_address,
3816                                 gboolean *is_alias_set);
3817
3818 /**
3819  * @fn int bluetooth_set_alias(const bluetooth_device_address_t *device_address, const char *alias)
3820  * @brief set alias for bonded device
3821  *
3822  *
3823  * This function set alias for bonded device.
3824  *
3825  * This function is a synchronous call.
3826  *
3827  *
3828  * @return      BLUETOOTH_ERROR_NONE - Success \n
3829  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3830  * @param[in]   device_address   This indicates an address of the remote device
3831  * @param[in]   alias                   This indicates an alias to set
3832  * @remark      None
3833  * @see         None
3834 @code
3835 int ret = 0;
3836 ret = bluetooth_set_alias(&remote_address);
3837 @endcode
3838  */
3839 int bluetooth_set_alias(const bluetooth_device_address_t *device_address,
3840                                 const char *alias);
3841
3842 /**
3843  * @fn int bluetooth_get_remote_device(const bluetooth_device_address_t *device_address)
3844  * @brief Get remote deivice
3845  *
3846  *
3847  * This function gets specific remote device.
3848  *
3849  * This function is a asynchronous call.
3850  * This API is responded by an BLUETOOTH_EVENT_REMOTE_DEVICE_READ event.
3851  *
3852  *
3853  * @return      BLUETOOTH_ERROR_NONE - Success \n
3854  *              BLUETOOTH_ERROR_NOT_SUPPORT - Operation not supported \n
3855  * @param[in]   device_address   This indicates an address of the remote device
3856  * @remark      None
3857  * @see         None
3858 @code
3859 int ret = 0;
3860 ret = bluetooth_get_remote_device(&remote_address);
3861 @endcode
3862  */
3863 int bluetooth_get_remote_device(const bluetooth_device_address_t *device_address);
3864
3865 /**
3866  * @fn int bluetooth_authorize_device(const bluetooth_device_address_t *device_address,
3867  *                                      gboolean authorized)
3868  * @brief Authorize/Unauthorize a bonded device
3869  *
3870  *
3871  * This function authorizes/unauthorize a bonded device. It decides the device to connect
3872  * with/without user confirmation.
3873  *
3874  * If we select a paired device and make it authorized by calling this API with the authorized
3875  * parameter to TRUE, then it will not ask for the user conformation before connecting. Similarly
3876  * if we unauthorize the paired device by calling this API with the authorized parameter to FALSE,
3877  * then it will ask for the user conformation before the connection.
3878  *
3879  * This API supposed to be called on the paired devices. Which means we have to use this API only
3880  * after successful pairing.
3881  *
3882  * This function is a asynchronous call.
3883  * Response will be received through BLUETOOTH_EVENT_DEVICE_AUTHORIZED event.
3884  *
3885  * @return      BLUETOOTH_ERROR_NONE - Success \n
3886  * @exception   BLUETOOTH_ERROR_INTERNAL - Cannot get the interal DBUS proxy \n
3887  * @param[in]   device_address   This indicates an address of the device to authorize \n
3888  * @param[in]   authorized      TRUE : authorize FALSE: unauthorize
3889  * @remark      None
3890  * @see         bluetooth_get_bonded_device_list
3891 @code
3892 void bt_event_callback(int event, bluetooth_event_param_t *param)
3893 {
3894         switch(event)
3895         {
3896                 case BLUETOOTH_EVENT_DEVICE_AUTHORIZED :
3897                 {
3898                         if (param->result == BLUETOOTH_ERROR_NONE)
3899                         {
3900                                 //Device authorized
3901                         }
3902                         //device authorization failed failure
3903                 }
3904         }
3905 }
3906
3907 ...
3908
3909 int ret = 0;
3910 bluetooth_device_address_t device_address={{0}};
3911 gboolean authorized;
3912
3913 authorized =TRUE;
3914
3915 ret = bluetooth_authorize_device(&device_address,authorized);
3916 @endcode
3917  */
3918 int bluetooth_authorize_device(const bluetooth_device_address_t *device_address,
3919                                        gboolean authorized);
3920
3921 int bluetooth_set_pin_code(const bluetooth_device_address_t *device_address,
3922                                 const bluetooth_device_pin_code_t *pin_code);
3923
3924 int bluetooth_unset_pin_code(const bluetooth_device_address_t *device_address);
3925
3926 /**
3927  * @fn int bluetooth_passkey_reply(char *passkey, gboolean reply)
3928  *
3929  * @brief Receives Legacy Passkey\pin with following authentication response types
3930  *
3931  * @param[in]   passkey : This is the PIN or PASSKEY string required for remote device authentication
3932  * @param[in]   reply    TRUE : Accept AUthentication FALSE: Cancels authentication
3933  *
3934  */
3935 int bluetooth_passkey_reply(char *passkey, gboolean reply);
3936
3937 /**
3938  * @fn int bluetooth_passkey_confirmation_reply(gboolean reply);
3939  *
3940  * @brief This API sends user confirmation reply to the local adapter.
3941  *
3942  * @param[in] reply TRUE : Accept AUthentication FALSE: Cancels authentication
3943  *
3944  */
3945 int bluetooth_passkey_confirmation_reply(gboolean reply);
3946
3947 /**
3948  * @fn int bluetooth_search_service(const bluetooth_device_address_t *device_address)
3949  * @brief Get all services supported by remote device
3950  *
3951  *
3952  * This API call initiates the search for the services supported by the specified device. Normally
3953  * the service search will take a couple of seconds to get it completed. Before calling this API
3954  * make sure that the Adapter is enabled. We have to give the device address of the remote device to
3955  * perform the service search. We can get the device address by doing a device discovery operation.
3956  *
3957  *
3958  * This function is a asynchronous call.
3959  * The service search request is responded by BLUETOOTH_EVENT_SERVICE_SEARCHED event.
3960  *
3961  * There is a timeout associated with the service search. The default time out is 40 seconds. If the
3962  * remove device did not respond with in the time out period the BLUETOOTH_EVENT_SERVICE_SEARCHED
3963  * event is generated with appropriate result code.
3964  *
3965  * @return      BLUETOOTH_ERROR_NONE - Success \n
3966  *              BLUETOOTH_ERROR_SERVICE_SEARCH_ERROR - Service search error (NULL device address) \n
3967  *              BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
3968  * @param[in]   device_address   This indicates an address of the device
3969  *                               whose services need to be found
3970  * @remark      None
3971  * @see         bluetooth_cancel_service_search
3972  */
3973 int bluetooth_search_service(const bluetooth_device_address_t *device_address);
3974
3975 /**
3976  * @fn int bluetooth_cancel_service_search(void)
3977  * @brief Cancel the ongoing service search operation
3978  *
3979  *
3980  * This function cancel the ongoing service search operation. This API is usually calling after the
3981  * bluetooth_search_service API.
3982  * Normally service search will take a more time (> 5 seconds) to complete. This API will be called
3983  * if the user wish to cancel the Ongoing service search operation.
3984  *
3985  * This API should be called just after the bluetooth_search_service API and before the
3986  * BLUETOOTH_EVENT_SERVICE_SEARCHED event
3987  *
3988  * This function is a synchronous call.
3989  *
3990  * @return      BLUETOOTH_ERROR_NONE - Success \n
3991  *              BLUETOOTH_ERROR_CANCEL - Error in service search cancel operation \n
3992  *              BLUETOOTH_ERROR_NOT_PAIRED - Not paired device \n
3993  *              BLUETOOTH_ERROR_NOT_IN_OPERATION - Searching service is not in operation \n
3994  *
3995  * @remark      None
3996  * @see         bluetooth_search_service
3997 @code
3998 ...
3999
4000 int ret = 0;
4001 ret = bluetooth_cancel_service_search();
4002 @endcode
4003 */
4004 int bluetooth_cancel_service_search(void);
4005
4006 /**
4007  * @fn int bluetooth_rfcomm_create_socket(const char *uuid)
4008  * @brief Register rfcomm socket with a specific uuid
4009  *
4010  *
4011  * This API register rfcomm socket with the given UUID. The return value of this API is the socket
4012  * descriptor of the server.
4013  * This is the first API which is called to create the server. Once we created the server socket,
4014  * we will listen on that return socket.
4015  * So a bluetooth_rfcomm_listen_and_accept should follow this API call. This is a synchronous call.
4016  *
4017  *
4018  * @return  socket FD on Success \n
4019  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
4020  *              BLUETOOTH_ERROR_INTERNAL - Internal error\n
4021  *              BLUETOOTH_ERROR_MAX_CONNECTION - Maximum connection reached\n
4022  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
4023  * @param[in]   UUID (128 bits)
4024  *
4025  * @remark      None
4026  * @see       bluetooth_rfcomm_listen_and_accept, bluetooth_rfcomm_remove_socket
4027  *
4028  @code
4029
4030   const char *rfcomm_test_uuid="00001101-0000-1000-8000-00805F9B34FB";
4031   fd  = bluetooth_rfcomm_create_socket(rfcomm_test_uuid);
4032
4033  @endcode
4034  */
4035 int bluetooth_rfcomm_create_socket(const char *uuid);
4036
4037 /**
4038  * @fn int bluetooth_rfcomm_create_socket_ex(const char *uuid, const char *bus_name, const char *path)
4039  * @brief Register rfcomm socket with a specific uuid
4040  *
4041  *
4042  * This API register rfcomm socket with the given UUID. The return value of this API is the socket
4043  * descriptor of the server.
4044  * This is the first API which is called to create the server. Once we created the server socket,
4045  * we will listen on that return socket.
4046  * So a bluetooth_rfcomm_listen_and_accept_ex should follow this API call. This is a synchronous call.
4047  *
4048  *
4049  * @return  socket FD on Success \n
4050  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
4051  *              BLUETOOTH_ERROR_INTERNAL - Internal error\n
4052  *              BLUETOOTH_ERROR_MAX_CONNECTION - Maximum connection reached\n
4053  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
4054  * @param[in]   UUID (128 bits)
4055  * @param[in]   bus_name (const char)
4056  * @param[in]   path (const char)
4057  *
4058  * @remark      None
4059  * @see       bluetooth_rfcomm_listen_and_accept_ex, bluetooth_rfcomm_remove_socket
4060  *
4061  @code
4062
4063   const char *rfcomm_test_uuid="00001101-0000-1000-8000-00805F9B34FB";
4064   fd  = bluetooth_rfcomm_create_socket_ex(rfcomm_test_uuid, bus_name, path);
4065
4066  @endcode
4067  */
4068 int bluetooth_rfcomm_create_socket_ex(const char *uuid, const char *bus_name, const char *path);
4069
4070 /**
4071  * @fn int bluetooth_rfcomm_remove_socket(int socket_fd, const char *uuid)
4072  * @brief De-register the rfcomm socket
4073  *
4074  *
4075  * This API deregister rfcomm socket with the given socket fd and  UUID. If the remote device is
4076  * already connected then we will receive the BLUETOOTH_EVENT_RFCOMM_DISCONNECTED with socket
4077  * descriptor else no event will come. We will call this API only after the
4078  * bluetooth_rfcomm_listen_and_accept.
4079  * This is a synchronous call.
4080  *
4081  * @return   BLUETOOTH_ERROR_NONE - Success \n
4082  *               BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
4083  *               BLUETOOTH_ERROR_NOT_FOUND - Cannot find the proxy\n
4084  *               BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
4085  * @param[in]  int socket_fd
4086  *
4087  * @remark      None
4088  * @see       bluetooth_rfcomm_create_socket, bluetooth_rfcomm_listen_and_accept
4089  *
4090  @code
4091  void bt_event_callback(int event, bluetooth_event_param_t *param)
4092  {
4093         switch(event)
4094         {
4095                 case BLUETOOTH_EVENT_RFCOMM_DISCONNECTED:
4096                 {
4097                         bluetooth_rfcomm_connection_t *discon_ind =
4098                                         (bluetooth_rfcomm_connection_t *)param->param_data;
4099
4100                         printf("\nDisconnected from FD %d",  discon_ind->socket_fd);
4101                 }
4102         }
4103  }
4104
4105  ...
4106
4107  int ret = 0;
4108  fd  = bluetooth_rfcomm_create_socket(rfcomm_test_uuid);
4109  ret = bluetooth_rfcomm_listen_and_accept(fd, 1);
4110  ....
4111  ret = bluetooth_rfcomm_remove_socket(fd);
4112  @endcode
4113  */
4114 int bluetooth_rfcomm_remove_socket(int socket_fd);
4115
4116 /**
4117  * @fn int bluetooth_rfcomm_remove_socket(const char *uuid)
4118  * @brief De-register the rfcomm socket
4119  *
4120  *
4121  * This API deregister rfcomm socket with the given socket UUID. If the remote device is
4122  * already connected then we will receive the BLUETOOTH_EVENT_RFCOMM_DISCONNECTED with socket
4123  * descriptor else no event will come. We will call this API only after the
4124  * bluetooth_rfcomm_listen_and_accept_ex.
4125  * This is a synchronous call.
4126  *
4127  * @return   BLUETOOTH_ERROR_NONE - Success \n
4128  *               BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
4129  *               BLUETOOTH_ERROR_NOT_FOUND - Cannot find the proxy\n
4130  *               BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
4131  * @param[in]   UUID (128 bits)
4132  *
4133  * @remark      None
4134  * @see       bluetooth_rfcomm_create_socket_ex, bluetooth_rfcomm_listen_and_accept_ex
4135  *
4136  @code
4137  void bt_event_callback(int event, bluetooth_event_param_t *param)
4138  {
4139         switch(event)
4140         {
4141                 case BLUETOOTH_EVENT_RFCOMM_DISCONNECTED:
4142                 {
4143                         bluetooth_rfcomm_connection_t *discon_ind =
4144                                         (bluetooth_rfcomm_connection_t *)param->param_data;
4145
4146                         printf("\nDisconnected from FD %d",  discon_ind->socket_fd);
4147                 }
4148         }
4149  }
4150
4151  ...
4152
4153  int ret = 0;
4154  fd  = bluetooth_rfcomm_create_socket_ex(rfcomm_test_uuid, path, bus_name);
4155  ret = bluetooth_rfcomm_listen_and_accept_ex(rfcomm_test_uuid, 1, bus_name, path);
4156  ....
4157  ret = bluetooth_rfcomm_remove_socket_ex(rfcomm_test_uuid);
4158  @endcode
4159  */
4160 int bluetooth_rfcomm_remove_socket_ex(const char *uuid);
4161
4162 /**
4163  * @fn int bluetooth_rfcomm_server_disconnect(int socket_fd)
4164  * @brief Disconnect rfcomm connection
4165  *
4166  *
4167  * Disconnect a specific(device node fd)  RFCOMM connection. This is a Synchronous call and there
4168  * is no cabbback events for this API. We have to provice the valid client fd to disconnect from the
4169  * remote server.
4170  *
4171  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4172  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
4173  *              BLUETOOTH_ERROR_NOT_CONNECTED - Not connected \n
4174  * @param[in]  int socket_fd the sending socket fd
4175  *
4176  * @remark      None
4177  *
4178  @code
4179
4180   ret = bluetooth_rfcomm_server_disconnect(g_ret_fd);
4181   if (ret < 0)
4182         printf("Disconnection failed");
4183   else
4184   printf("Disconnection Success");
4185
4186  @endcode
4187  */
4188 int bluetooth_rfcomm_server_disconnect(int socket_fd);
4189
4190 /**
4191  * @fn int bluetooth_rfcomm_listen_and_accept(int socket_fd,int max_pending_connection)
4192  * @brief Rfcomm socket listen
4193  *
4194  *
4195  * This API make rfcomm socket listen and accept with socket. We will call this API immediatly
4196  * after the bluetooth_rfcomm_create_socket API.
4197  * This API listen for the incomming connection and once it receives a connection, it will give
4198  * BLUETOOTH_EVENT_RFCOMM_CONNECTED
4199  * event to the application. This is an Asynchronous API call.
4200  *
4201  *
4202  * @return  BLUETOOTH_ERROR_NONE - Success \n
4203  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
4204  *              BLUETOOTH_ERROR_CONNECTION_ERROR - Listen failed \n
4205
4206  * @param[in]  int socket_fd
4207  * @param[in]  max pending connection.
4208  *
4209  * @remark      None
4210  * @see       bluetooth_rfcomm_create_socket
4211  *
4212   @code
4213   void bt_event_callback(int event, bluetooth_event_param_t* param)
4214  {
4215         switch(event)
4216         {
4217                 case BLUETOOTH_EVENT_RFCOMM_CONNECTED:
4218                 {
4219                         bluetooth_rfcomm_connection_t *conn_ind =
4220                                                 (bluetooth_rfcomm_connection_t *)param->param_data;
4221
4222                         printf("\nConnected from FD %d",  conn_ind->socket_fd);
4223                 }
4224         }
4225  }
4226
4227  ...
4228
4229  int ret = 0;
4230  fd  = bluetooth_rfcomm_create_socket(rfcomm_test_uuid);
4231  ret = bluetooth_rfcomm_listen_and_accept(fd, 1);
4232
4233  @endcode
4234  */
4235 int bluetooth_rfcomm_listen_and_accept(int socket_fd, int max_pending_connection);
4236
4237 /**
4238  * @fn int bluetooth_rfcomm_listen_and_accept_ex(const char *uuid, int max_pending_connection, const char *bus_name, const char *path)
4239  * @brief Rfcomm socket listen
4240  *
4241  *
4242  * This API make rfcomm socket listen and accept with socket. We will call this API immediatly
4243  * after the bluetooth_rfcomm_create_socket API.
4244  * This API listen for the incomming connection and once it receives a connection, it will give
4245  * BLUETOOTH_EVENT_RFCOMM_CONNECTED
4246  * event to the application. This is an Asynchronous API call.
4247  *
4248  *
4249  * @return  BLUETOOTH_ERROR_NONE - Success \n
4250  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
4251  *              BLUETOOTH_ERROR_CONNECTION_ERROR - Listen failed \n
4252
4253  * @param[in]  int socket_fd
4254  * @param[in]  max pending connection.
4255  * @param[in]  name
4256  * @param[in]  path
4257  *
4258  * @remark      None
4259  * @see       bluetooth_rfcomm_create_socket_ex
4260  *
4261   @code
4262   void bt_event_callback(int event, bluetooth_event_param_t* param)
4263  {
4264         switch(event)
4265         {
4266                 case BLUETOOTH_EVENT_RFCOMM_CONNECTED:
4267                 {
4268                         bluetooth_rfcomm_connection_t *conn_ind =
4269                                                 (bluetooth_rfcomm_connection_t *)param->param_data;
4270
4271                         printf("\nConnected from FD %d",  conn_ind->socket_fd);
4272                 }
4273         }
4274  }
4275
4276  ...
4277
4278  int ret = 0;
4279  fd  = bluetooth_rfcomm_create_socket_ex(rfcomm_test_uuid);
4280  ret = bluetooth_rfcomm_listen_and_accept_ex(rfcomm_test_uuid, 1, bus_name, path);
4281
4282  @endcode
4283  */
4284
4285 int bluetooth_rfcomm_listen_and_accept_ex(const char *uuid, int max_pending_connection, const char *bus_name, const char *path);
4286
4287 /**
4288  * @fn int bluetooth_rfcomm_listen(int socket_fd,int max_pending_connection)
4289  * @brief Rfcomm socket listen
4290  *
4291  *
4292  * This API make rfcomm socket listen and accept with socket. We will call this API immediatly
4293  * after the bluetooth_rfcomm_create_socket API.
4294  * This API listen for the incomming connection and once it receives a connection, it will give
4295  * BLUETOOTH_EVENT_RFCOMM_AUTHORIZE
4296  * event to the application. This is an Asynchronous API call.
4297  *
4298  *
4299  * @return  BLUETOOTH_ERROR_NONE - Success \n
4300  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
4301  *              BLUETOOTH_ERROR_CONNECTION_ERROR - Listen failed \n
4302
4303  * @param[in]  int socket_fd
4304  * @param[in]  max pending connection.
4305  *
4306  * @remark      None
4307  * @see       bluetooth_rfcomm_create_socket
4308  *
4309   @code
4310   void bt_event_callback(int event, bluetooth_event_param_t* param)
4311  {
4312         switch(event)
4313         {
4314                 case BLUETOOTH_EVENT_RFCOMM_AUTHORIZE:
4315                 {
4316                         char *name = (char *)param->param_data;
4317
4318                         printf("\nConnected from %s",  name);
4319
4320                         bluetooth_rfcomm_accept_connection();
4321                 }
4322         }
4323  }
4324
4325  ...
4326
4327  int ret = 0;
4328  fd  = bluetooth_rfcomm_create_socket(rfcomm_test_uuid);
4329  ret = bluetooth_rfcomm_listen(fd, 1);
4330
4331  @endcode
4332  */
4333 int bluetooth_rfcomm_listen(int socket_fd, int max_pending_connection);
4334
4335 /**
4336  * @fn int bluetooth_rfcomm_accept_connection()
4337  * @brief Accepts the authorization request indicated by the event
4338   * BLUETOOTH_EVENT_RFCOMM_AUTHORIZE.
4339  *
4340  * This function is a synchronous call.
4341  *
4342  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4343  *              BLUETOOTH_ERROR_INTERNAL - Internal error \n
4344  *
4345  * @param[in]  the socket fd of the server
4346  * @param[out]  the socket fd of the client
4347  *
4348  * @exception   None
4349  * @remark       None
4350  * @see bluetooth_rfcomm_reject_connection
4351  */
4352 int bluetooth_rfcomm_accept_connection(int server_fd);
4353
4354 /**
4355  * @fn int bluetooth_rfcomm_reject_connection()
4356  * @brief Rejects the authorization request indicated by the event
4357   * BLUETOOTH_EVENT_RFCOMM_AUTHORIZE.
4358  *
4359  * This function is a synchronous call.
4360  *
4361  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4362  *              BLUETOOTH_ERROR_INTERNAL - Internal error \n
4363  *
4364  * @param[in]  the socket fd of the server
4365  *
4366  * @exception   None
4367  * @remark       None
4368  * @see bluetooth_rfcomm_accept_connection
4369  */
4370 int bluetooth_rfcomm_reject_connection(int server_fd);
4371
4372 /**
4373  * @fn gboolean bluetooth_rfcomm_is_server_uuid_available(const char *uuid)
4374  * @brief Informs whether rfcomm server uuid is available or not.
4375  *
4376  * This function is a synchronous call.
4377  *
4378  * @return   TRUE  - RFCOMM uuid is available \n
4379  *              FALSE - RFCOMM uuid is not available \n
4380  *
4381  * @param[in]  uuid UUID string
4382  *
4383  * @exception   None
4384  *
4385  * @remark       None
4386  */
4387 gboolean bluetooth_rfcomm_is_server_uuid_available(const char *uuid);
4388
4389 /**
4390  * @fn int bluetooth_rfcomm_connect(const bluetooth_device_address_t  *remote_bt_address,
4391  *                                                                      const char *remote_uuid)
4392  * @brief Connect to the remote device rfcomm *
4393  *
4394  * Connect to a specific RFCOMM based service on a remote device UUID. This is a Async call. Once
4395  * the connection is successful callback BLUETOOTH_EVENT_RFCOMM_CONNECTED events is generated,
4396  * which contains the socket_fd, device role (RFCOMM_ROLE_SERVER/RFCOMM_ROLE_CLIENT), device addess
4397  * etc. The socket_fd can be further used to send the data. It better to do a sevice search before
4398  * initiating a connection.
4399  *
4400  * @return  BLUETOOTH_ERROR_NONE  - Success \n
4401  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
4402  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
4403  *              BLUETOOTH_ERROR_CONNECTION_BUSY - Connection in progress \n
4404  *              BLUETOOTH_ERROR_INTERNAL - Internal Error\n
4405  * @param[in]  bluetooth_device_address_t remote bt_address
4406  * @param[in]  char remote uuid
4407  * @remark      None
4408  * @see         bluetooth_rfcomm_disconnect, bluetooth_rfcomm_write, bluetooth_search_service
4409  *
4410  @code
4411
4412  void bt_event_callback(int event, bluetooth_event_param_t *param)
4413  {
4414         switch(event)
4415         {
4416                 case BLUETOOTH_EVENT_SERVICE_SEARCHED:
4417                 {
4418                         if (param->result >= BLUETOOTH_ERROR_NONE)
4419                         {
4420                                 bt_sdp_info_t *bt_sdp_info=param->param_data;
4421
4422                                 printf("Dev add = %2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n",
4423                                         bt_sdp_info->device_addr.addr[0],
4424                                         bt_sdp_info->device_addr.addr[1],
4425                                         bt_sdp_info->device_addr.addr[2],
4426                                         bt_sdp_info->device_addr.addr[3],
4427                                         bt_sdp_info->device_addr.addr[4],
4428                                         bt_sdp_info->device_addr.addr[5]);
4429
4430                                         printf("Supported service list:\n");
4431                                         for(i=0; i<bt_sdp_info->service_index; i++)
4432                                                 printf("[%#x]\n",
4433                                                         bt_sdp_info->service_list_array[i]);
4434
4435                                 //Alternate method
4436                                 //ret = bluetooth_rfcomm_connect(bt_sdp_info->device_addr,
4437                                                                                 //rfcomm_test_uuid);
4438                         }
4439                         break;
4440                 }
4441                 case BLUETOOTH_EVENT_RFCOMM_CONNECTED:
4442                 {
4443                         bluetooth_rfcomm_connection_t *conn_ind =
4444                                                 (bluetooth_rfcomm_connection_t *)param->param_data;
4445
4446                         printf("\nConnected from FD %d, Role = %s",  conn_ind->socket_fd,
4447                                                 (conn_ind->device_role == RFCOMM_ROLE_SERVER) ?
4448                                                                         "SERVER" : "CLIENT");
4449                 }
4450         }
4451  }
4452
4453   bluetooth_device_address_t remote_address = {{0},};
4454   remote_address.addr[0] = 0x0; remote_address.addr[1] = 0x0A; remote_address.addr[2] = 0x3A;
4455   remote_address.addr[3]= 0x54; remote_address.addr[4] = 0x19;  remote_address.addr[5]= 0x36;
4456   ret = bluetooth_search_service(&remote_address);
4457  if (ret < 0)
4458         printf("Seach failed, Reason = %d", ret);
4459   else
4460          printf("Search Success, Ret = %d", ret);
4461
4462   ret = bluetooth_rfcomm_connect(&remote_address, rfcomm_test_uuid);
4463   if (ret < 0)
4464         printf("Connection failed, Reason = %d", ret);
4465   else
4466          printf("Connection Success, Ret = %d", ret);
4467
4468   @endcode
4469   */
4470 int bluetooth_rfcomm_connect(const bluetooth_device_address_t *remote_bt_address,
4471                                      const char *remote_uuid);
4472
4473 /**
4474  * @fn int bluetooth_rfcomm_disconnect(int socket_fd)
4475  * @brief Disconnect rfcomm connection
4476  *
4477  *
4478  * Disconnect a specific(device node fd)  RFCOMM connection. This is a Synchronous call and there
4479  * is no cabbback events for this API. We have to provice the valid client fd to disconnect from the
4480  * remote server.
4481  *
4482  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4483  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
4484  *              BLUETOOTH_ERROR_NOT_CONNECTED - Not connected \n
4485  * @param[in]  char remote bt_address
4486  *
4487  * @remark      None
4488  * @see         bluetooth_rfcomm_connect
4489  *
4490  @code
4491
4492   ret = bluetooth_rfcomm_disconnect(g_ret_fd);
4493   if (ret < 0)
4494         printf("Disconnection failed");
4495   else
4496   printf("Disconnection Success");
4497
4498  @endcode
4499  */
4500
4501 int bluetooth_rfcomm_disconnect(int socket_fd);
4502
4503 /**
4504  * @fn int bluetooth_rfcomm_write (int fd, const char *buff, int length)
4505  * @brief Write to rfcomm connection
4506  *
4507  *
4508  * This API is used to send the data over the rfcomm connection. This is a synchronous API. The same
4509  * API is used to send the data for server and the client.
4510  *
4511  * @return  BLUETOOTH_ERROR_NONE  - Success \n
4512  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
4513  *              BLUETOOTH_ERROR_NOT_IN_OPERATION - The Fd is currently not in operation\n
4514  * @param[in]  int fd
4515  * @param[in]  const char *buff  Data buffer to send
4516  * @param[in]  int length Length of the data
4517  *
4518  * @remark      None
4519  * @see         bluetooth_rfcomm_connect
4520  *
4521   @code
4522   char *buff = "Test data 123456789"
4523   ret =  bluetooth_rfcomm_write(g_ret_fd, buff, 15);
4524   if (ret < 0)
4525         printf("Send failed");
4526   else
4527    printf("Send success");
4528
4529  @endcode
4530  */
4531 int bluetooth_rfcomm_write(int fd, const char *buf, int length);
4532
4533 /**
4534  * @fn gboolean bluetooth_rfcomm_is_client_connected(void)
4535  * @brief Informs whether rfcomm client is connected.
4536  *
4537  * This function is a synchronous call.
4538  *
4539  * @return   TRUE  - RFCOMM client is connected \n
4540  *              FALSE - RFCOMM client is not connected \n
4541  *
4542  * @exception   None
4543  *
4544  * @remark       None
4545  */
4546 gboolean bluetooth_rfcomm_is_client_connected(void);
4547 int bluetooth_rfcomm_client_is_connected(const bluetooth_device_address_t *device_address, gboolean *connected);
4548 int bluetooth_rfcomm_server_is_connected(const bluetooth_device_address_t *device_address, gboolean *connected);
4549
4550 /**
4551  * @fn int bluetooth_network_activate_server(void)
4552  * @brief Activate the NAP (Network Access Point) service
4553  *
4554  * This function is a asynchronous call.
4555  * The activate server request is responded by BLUETOOTH_EVENT_NETWORK_SERVER_ACTIVATED event.
4556  *
4557  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4558  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
4559  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4560  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Not enabled \n
4561  *
4562  * @remark      None
4563   * @see        bluetooth_network_deactivate_server
4564  *
4565  */
4566 int bluetooth_network_activate_server(void);
4567
4568 /**
4569  * @fn int bluetooth_network_deactivate_server(void)
4570  * @brief Deactivate the NAP (Network Access Point) service
4571  *
4572  * This function is a asynchronous call.
4573  * The deactivate server request is responded by BLUETOOTH_EVENT_NETWORK_SERVER_DEACTIVATED event.
4574  *
4575  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4576  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
4577  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4578  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Not enabled \n
4579  *
4580  * @remark      None
4581  * @see         bluetooth_network_activate_server
4582  *
4583  */
4584 int bluetooth_network_deactivate_server(void);
4585
4586 /**
4587  * @fn int bluetooth_network_connect(const bluetooth_device_address_t *device_address,
4588  *                                      bluetooth_network_role_t role,
4589  *                                      char  custom_uuid)
4590  * @brief Connect the network server in the peer
4591  *
4592  * This function is a asynchronous call.
4593  * The network connect request is responded by BLUETOOTH_EVENT_NETWORK_CONNECTED event.
4594  *
4595  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4596  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
4597  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4598  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Not enabled \n
4599  *
4600  * @exception   None
4601  * @param[in]  device_address   This indicates an address of the device with which the pairing
4602  *                              should be initiated
4603  * @param[in]  role   The role to connect. PANU / GN / NAP / CUSTOM. If use the CUSTOM value,
4604  *                      need to use the third parameter.
4605  * @param[in]  custom_uuid   If use the CUSTOM value in second parameter, use this parameter to
4606  *                              connect. UUID string
4607  * @remark      None
4608  * @see         bluetooth_network_disconnect
4609  */
4610 int bluetooth_network_connect(const bluetooth_device_address_t *device_address,
4611                                       bluetooth_network_role_t role, char *custom_uuid);
4612
4613 /**
4614  * @fn int bluetooth_network_disconnect(const bluetooth_device_address_t *device_address,
4615  *                                                      bluetooth_network_role_t role,
4616  *                                                        char *custom_uuid)
4617  * @brief Connect the network server in the peer
4618  *
4619  * This function is a asynchronous call.
4620  * The network disconnect request is responded by BLUETOOTH_EVENT_NETWORK_CONNECTED event.
4621  *
4622  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4623  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
4624  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4625  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Not enabled \n
4626  *
4627  * @exception   None
4628  * @param[in]   device_address   This indicates an address of the device with which the pairing
4629  *                                      should be initiated
4630  * @remark       None
4631  * @see         bluetooth_network_connect
4632  */
4633 int bluetooth_network_disconnect(const bluetooth_device_address_t *device_address);
4634
4635 /**
4636  * @fn int bluetooth_network_server_disconnect(const bluetooth_device_address_t *device_address)
4637  * @brief Disconnect the device from the network
4638  *
4639  * This function is an asynchronous call.
4640  * The network server disconnect request is responded by
4641  * BLUETOOTH_EVENT_NETWORK_SERVER_DISCONNECTED event.
4642  *
4643  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4644  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
4645  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4646  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Not enabled \n
4647  *
4648  * @exception   None
4649  * @param[in]   device_address   This indicates an address of the connected client device
4650  * @remark       None
4651  * @see         bluetooth_network_activate_server
4652  */
4653 int bluetooth_network_server_disconnect(const bluetooth_device_address_t *device_address);
4654
4655 /*HDP - API's*/
4656
4657 /**
4658  * @fn int bluetooth_hdp_activate(unsigned short  data_type,
4659  *                                      bt_hdp_role_type_t role,
4660  *                                      bt_hdp_qos_type_t channel_type,
4661  *                                      char **app_handle)
4662  * @brief Activate the HDP service for a particular data type
4663  *
4664  * This function is a synchronous call.
4665  *
4666  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4667  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
4668  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4669  *              BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
4670  *
4671  * @exception   None
4672  * @param[in]  data_type   The data type against corresponding service
4673  * @param[in]  role   The role of HDP. HDP_ROLE_SOURCE/HDP_ROLE_SINK.
4674  * @param[in]  channel_type   The QOS type for the channel.
4675  *                              HDP_QOS_RELIABLE/HDP_QOS_STREAMING/HDP_QOS_ANY.
4676  *                              For role = HDP_ROLE_SINK, the channel_type
4677  *                              should be HDP_QOS_ANY.
4678  * @param[out]  app_handle    The application handler against corresponding service
4679  * @remark       None
4680  * @see bluetooth_hdp_deactivate
4681  */
4682 int bluetooth_hdp_activate(unsigned short  data_type,
4683                                 bt_hdp_role_type_t role,
4684                                 bt_hdp_qos_type_t channel_type,
4685                                 char **app_handle);
4686 /**
4687  * @fn int bluetooth_hdp_deactivate(const char *app_handle)
4688  * @brief Deactivate the HDP service for a particular service using the handler
4689  *
4690  * This function is a synchronous call.
4691  *
4692  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4693  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
4694  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4695  *              BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
4696  *
4697  * @exception   None
4698  * @param[in]  app_handle   The application handler against corresponding service
4699  * @remark       None
4700  * @see bluetooth_hdp_deactivate
4701  */
4702 int bluetooth_hdp_deactivate(const char *app_handle);
4703
4704 /**
4705  * @fn int bluetooth_hdp_send_data(unsigned int channel_id,
4706  *                                      const char *buffer, unsigned int size)
4707  * @brief Send data to the remote HDP device
4708  *
4709  * This function is a synchronous call.
4710  *
4711  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4712  *             BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
4713  *             BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4714  *             BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
4715  *             BLUETOOTH_ERROR_NOT_IN_OPERATION - FD is invalid  \n
4716  *
4717  * @exception   None
4718  * @param[in]  channel_id   The channel id for the connection.
4719  * @param[in]  buffer   The pdu buffer.
4720  * @param[in]  size   Size of the buffer.
4721  * @remark       None
4722  * @see bluetooth_hdp_connect
4723  */
4724 int bluetooth_hdp_send_data(unsigned int channel_id,
4725                                 const char *buffer, unsigned int size);
4726 /**
4727  * @fn int bluetooth_hdp_connect(const char *app_handle,
4728  *                              bt_hdp_qos_type_t channel_type,
4729  *                              const bluetooth_device_address_t *device_address)
4730  * @brief Connect to the remote device(Mainly used by source)
4731  *
4732  * This function is a asynchronous call.
4733  * The HDP activate is responded by BLUETOOTH_EVENT_HDP_CONNECTED event.
4734  *
4735  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4736  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
4737  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4738  *              BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
4739  *              BLUETOOTH_ERROR_MEMORY_ALLOCATION -Memory allocation failed \n
4740  *
4741  * @exception   None
4742  * @param[in]  app_handle   The application handler against corresponding service
4743  * @param[in]  channel_type   The QOS type for the channel.
4744  *                              HDP_QOS_RELIABLE/HDP_QOS_STREAMING.
4745  * @param[in]  device_address   The remote device Bd address.
4746  *
4747  * @remark       None
4748  * @see bluetooth_hdp_disconnect
4749  */
4750 int bluetooth_hdp_connect(const char *app_handle,
4751                         bt_hdp_qos_type_t channel_type,
4752                         const bluetooth_device_address_t *device_address);
4753 /**
4754  * @fn int bluetooth_hdp_disconnect(unsigned int channel_id,
4755  *                      const bluetooth_device_address_t *device_address)
4756  * @brief Disconnect from the remote device(Mainly used by source)
4757  *
4758  * This function is a asynchronous call.
4759  * The HDP activate is responded by BLUETOOTH_EVENT_HDP_DISCONNECTED event.
4760  *
4761  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4762  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
4763  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4764  *              BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
4765   *              BLUETOOTH_ERROR_MEMORY_ALLOCATION -Memory allocation failed \n
4766  *
4767  * @exception   None
4768  * @param[in]  channel_id    The channel id for the connection.
4769  * @param[in]  device_address   The remote device Bd address.
4770  *
4771  * @remark       None
4772  * @see bluetooth_hdp_connect
4773  */
4774 int bluetooth_hdp_disconnect(unsigned int channel_id,
4775                         const bluetooth_device_address_t  *device_address);
4776
4777
4778 /**
4779  * @fn int bluetooth_opc_init(void)
4780  * @brief Initialize OPP client.
4781  *
4782  * This function is a synchronous call.
4783  * No event corresponding to this api
4784  *
4785  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4786  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
4787  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4788  *              BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
4789   *             BLUETOOTH_ERROR_ACCESS_DENIED -Memory allocation failed \n
4790  *
4791  * @exception   None
4792  *
4793  * @remark       None
4794  * @see bluetooth_opc_deinit
4795  */
4796 int bluetooth_opc_init(void);
4797
4798 /**
4799  * @fn int bluetooth_opc_deinit(void)
4800  * @brief Deinitialize OPP client.
4801  *
4802  * This function is a synchronous call.
4803  * No event corresponding to this api
4804  *
4805  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4806  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
4807  *              BLUETOOTH_ERROR_ACCESS_DENIED -Memory allocation failed \n
4808  *
4809  * @exception   None
4810  *
4811  * @remark       None
4812  * @see bluetooth_opc_init
4813  */
4814
4815 int bluetooth_opc_deinit(void);
4816
4817 /**
4818  * @fn int bluetooth_opc_push_files(bluetooth_device_address_t *remote_address,
4819                                         char **file_name_array)
4820  * @brief Send multiple files to a remote device.
4821  *
4822  * This function is a asynchronous call.
4823  * This api  is responded by BLUETOOTH_EVENT_OPC_CONNECTED event.
4824  *
4825  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4826  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
4827  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
4828  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4829  *              BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
4830  *              BLUETOOTH_ERROR_IN_PROGRESS -Already one push in progress \n
4831  *              BLUETOOTH_ERROR_ACCESS_DENIED - Not allowed by MDM policy \n
4832  *
4833  * @exception   None
4834  * @param[in]  device_address   The remote device Bd address.
4835  * @param[in]  file_name_array  Array of filepaths to be sent.
4836  *
4837  * @remark       None
4838  * @see bluetooth_opc_cancel_push
4839  */
4840
4841 int bluetooth_opc_push_files(bluetooth_device_address_t *remote_address,
4842                                 char **file_name_array);
4843
4844 /**
4845  * @fn int bluetooth_opc_cancel_push(void)
4846  * @brief Cancels the ongoing file push.
4847  *
4848  * This function is a asynchronous call.
4849  * This api is responded with either BLUETOOTH_EVENT_OPC_CONNECTED or
4850  * BLUETOOTH_EVENT_OPC_TRANSFER_COMPLETED event.
4851  *
4852  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4853  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
4854  *              BLUETOOTH_ERROR_ACCESS_DENIED - No push in progress \n
4855  *
4856  * @exception   None
4857  *
4858  * @remark       None
4859  * @see bluetooth_opc_push_files
4860  */
4861
4862 int bluetooth_opc_cancel_push(void);
4863
4864 /**
4865  * @fn gboolean bluetooth_opc_session_is_exist(void)
4866  * @brief Informs whether opc session exists or not.
4867  *
4868  * This function is a synchronous call.
4869  *
4870  * @return   TRUE  - OPC session exists \n
4871  *              FALSE - OPC session does not exist \n
4872  *
4873  * @exception   None
4874  *
4875  * @remark       None
4876  * @see None
4877  */
4878
4879 gboolean bluetooth_opc_session_is_exist(void);
4880
4881 /**
4882  * @fn int bluetooth_opc_is_sending(gboolean *is_sending)
4883  * @brief Informs whether opc session exists or not.
4884  *
4885  * This function is a synchronous call.
4886  *
4887  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4888  *               BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Not enabled \n
4889  *               BLUETOOTH_ERROR_INTERNAL \n
4890  *
4891  * @exception   None
4892  * @param[out] is_sending The sending status: (@c TRUE = in sending , @c  false = not in sending)
4893  *
4894  * @remark       None
4895  * @see            None
4896  */
4897 int bluetooth_opc_is_sending(gboolean *is_sending);
4898
4899 /**
4900  * @fn int bluetooth_opp_get_transfer_progress(bluetooth_opp_transfer_type_t transfer_type,
4901                 int transfer_id, unsigned char *progress)
4902  * @brief Gets the percentage progress for ongoing transfers.
4903  *
4904  * This function is a synchronous call.
4905  *
4906  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4907  *               BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Not enabled \n
4908  *               BLUETOOTH_ERROR_NOT_FOUND - Not found \n
4909  *
4910  * @exception   None
4911  * @param[in] transfer_type     Transfer Type: (@c BLUETOOTH_TRANSFER_INBOUND = receiving , @c  BLUETOOTH_TRANSFER_OUTBOUND = sending)
4912  * @param[in] transfer_id       Transfer ID
4913  * @param[out] progress         Percentage Progress
4914  * @remark       None
4915  * @see            None
4916  */
4917 int bluetooth_opp_get_transfer_progress(bluetooth_opp_transfer_type_t transfer_type,
4918                 int transfer_id, unsigned char *progress);
4919
4920 /**
4921  * @fn int bluetooth_obex_server_init(const char *dst_path)
4922  * @brief Initialize OPP and FTP server.
4923  *
4924  * This function is a synchronous call.
4925  * No event corresponding to this api
4926  *
4927  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4928  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
4929  *              BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
4930  *              BLUETOOTH_ERROR_AGENT_ALREADY_EXIST - Obex agent already registered \n
4931  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
4932  *
4933  * @exception   None
4934  * @param[in]  dst_path   OPS destination file path.
4935  * @remark       None
4936  * @see bluetooth_obex_server_deinit
4937  */
4938 int bluetooth_obex_server_init(const char *dst_path);
4939
4940
4941 /**
4942  * @fn int bluetooth_obex_server_deinit(void)
4943  * @brief Deinitialize OPP and FTP server.
4944  *
4945  * This function is a synchronous call.
4946  * No event corresponding to this api
4947  *
4948  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4949  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
4950  *              BLUETOOTH_ERROR_AGENT_DOES_NOT_EXIST -Obex agent not registered \n
4951  *
4952  * @exception   None
4953  *
4954  * @remark       None
4955  * @see bluetooth_obex_server_init
4956  */
4957 int bluetooth_obex_server_deinit(void);
4958
4959
4960 /**
4961  * @fn gboolean bluetooth_obex_server_is_activated(void)
4962  * @brief Informs whether obex server is activated or not.
4963  *
4964  * This function is a synchronous call.
4965  *
4966  * @return   TRUE  - OBEX server is activated \n
4967  *              FALSE - OBEX server is not activated \n
4968  *
4969  * @exception   None
4970  *
4971  * @remark       None
4972  */
4973
4974 gboolean bluetooth_obex_server_is_activated(void);
4975
4976
4977 /**
4978  * @fn int bluetooth_obex_server_init_without_agent(const char *dst_path)
4979  * @brief Initialize OPP and FTP server without the conneciton authorization of the agent
4980  *
4981  * This function is a synchronous call.
4982  * No event corresponding to this api
4983  *
4984  * @return   BLUETOOTH_ERROR_NONE  - Success \n
4985  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
4986  *              BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
4987  *              BLUETOOTH_ERROR_AGENT_ALREADY_EXIST - Obex agent already registered \n
4988  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
4989  *
4990  *
4991  * @exception   None
4992  * @param[in]  dst_path   OPS destination file path.
4993  * @remark       None
4994  * @see bluetooth_obex_server_deinit_without_agent
4995  */
4996 int bluetooth_obex_server_init_without_agent(const char *dst_path);
4997
4998
4999 /**
5000  * @fn int bluetooth_obex_server_deinit_without_agent(void)
5001  * @brief Deinitialize OPP and FTP server without the conneciton authorization of the agent
5002  *
5003  * This function is a synchronous call.
5004  * No event corresponding to this api
5005  *
5006  * @return   BLUETOOTH_ERROR_NONE  - Success \n
5007  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
5008  *              BLUETOOTH_ERROR_AGENT_DOES_NOT_EXIST -Obex agent not registered \n
5009  *
5010  * @exception   None
5011  *
5012  * @remark       None
5013  * @see bluetooth_obex_server_init_without_agent
5014  */
5015 int bluetooth_obex_server_deinit_without_agent(void);
5016
5017
5018 /**
5019  * @fn int bluetooth_obex_server_accept_connection(void)
5020  * @brief Accepts the authorization request indicated by the event
5021   * BLUETOOTH_EVENT_OBEX_SERVER_CONNECTION_AUTHORIZE.
5022  *
5023  * This function is a synchronous call.
5024  *
5025  * @return   BLUETOOTH_ERROR_NONE  - Success \n
5026  *              BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
5027  *              BLUETOOTH_ERROR_INTERNAL - Internal error \n
5028  *
5029  * @exception   None
5030  * @remark       None
5031  * @see bluetooth_obex_server_reject_authorize
5032  */
5033 int bluetooth_obex_server_accept_connection(void);
5034
5035
5036 /**
5037  * @fn int bluetooth_obex_server_reject_connection(void)
5038  * @brief Rejects the authorization request indicated by the event
5039   * BLUETOOTH_EVENT_OBEX_SERVER_CONNECTION_AUTHORIZE.
5040  *
5041  * This function is a synchronous call.
5042  *
5043  * @return   BLUETOOTH_ERROR_NONE  - Success \n
5044  *              BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
5045  *              BLUETOOTH_ERROR_INTERNAL - Internal error \n
5046  *
5047  * @exception   None
5048  * @remark       None
5049  * @see bluetooth_obex_server_reject_authorize
5050  */
5051 int bluetooth_obex_server_reject_connection(void);
5052
5053
5054 /**
5055  * @fn int bluetooth_obex_server_accept_authorize(const char *filename)
5056  * @brief Accepts the authorization request indicated by the event
5057   * BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_AUTHORIZE.
5058  *
5059  * This function is a asynchronous call.
5060  * This api will be responded with the event BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_STARTED.
5061  *
5062  * @return   BLUETOOTH_ERROR_NONE  - Success \n
5063  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
5064  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
5065  *              BLUETOOTH_ERROR_AGENT_DOES_NOT_EXIST -Obex agent not registered \n
5066  *
5067  * @exception   None
5068  * @param[in]  filename   Authorized filename.
5069
5070  * @remark       None
5071  * @see bluetooth_obex_server_reject_authorize
5072  */
5073
5074 int bluetooth_obex_server_accept_authorize(const char *filename);
5075
5076 /**
5077  * @fn int bluetooth_obex_server_reject_authorize(void)
5078  * @brief Reject the authorization request indicated by the event
5079   * BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_AUTHORIZE.
5080  *
5081  * This function is a asynchronous call.
5082  * No event for this api..
5083  *
5084  * @return   BLUETOOTH_ERROR_NONE  - Success \n
5085  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
5086  *              BLUETOOTH_ERROR_AGENT_DOES_NOT_EXIST -Obex agent not registered \n
5087  *
5088  * @exception   None
5089
5090  * @remark       None
5091  * @see bluetooth_obex_server_accept_authorize
5092  */
5093
5094 int bluetooth_obex_server_reject_authorize(void);
5095
5096 /**
5097  * @fn int bluetooth_obex_server_set_destination_path(const char *dst_path)
5098  * @brief Set the OPS destination file path..
5099  *
5100  * This function is a asynchronous call.
5101  * No event for this api..
5102  *
5103  * @return   BLUETOOTH_ERROR_NONE  - Success \n
5104  *              BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
5105  *              BLUETOOTH_ERROR_AGENT_DOES_NOT_EXIST -Obex agent not registered \n
5106  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid Param \n
5107  *
5108  * @exception   None
5109  * @param[in]  dst_path   OPS destination file path.
5110
5111  * @remark       None
5112  * @see None
5113  */
5114
5115 int bluetooth_obex_server_set_destination_path(const char *dst_path);
5116
5117 /**
5118  * @fn int bluetooth_obex_server_set_root(const char *root)
5119  * @brief Set the FTS root folder..
5120  *
5121  * This function is a asynchronous call.
5122  * No event for this api..
5123  *
5124  * @return   BLUETOOTH_ERROR_NONE  - Success \n
5125  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
5126  *              BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
5127  *              BLUETOOTH_ERROR_ACCESS_DENIED - Operation not allowed \n
5128  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
5129  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
5130  *
5131  * @exception  None
5132  * @param[in]   root   FTS root folder.
5133
5134  * @remark       None
5135  * @see None
5136  */
5137
5138 int bluetooth_obex_server_set_root(const char *root);
5139
5140 /**
5141  * @fn int bluetooth_obex_server_cancel_transfer(int transfer_id)
5142  * @brief Cancel the transfer on server
5143  *
5144  * This function is an asynchronous call.
5145  * If the function call that cancels transfer is successful, the application would receive
5146  * BLUETOOTH_EVENT_TRANSFER_COMPLETED event through registered callback
5147  * function with an error code BLUETOOTH_ERROR_CANCEL. In the case of failure
5148  * the error code will be BLUETOOTH_ERROR_NONE
5149  *
5150  * @return   BLUETOOTH_ERROR_NONE  - Success \n
5151  *               BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Not enabled \n
5152  *               BLUETOOTH_ERROR_AGENT_DOES_NOT_EXIST -Obex agent not registered \n
5153  *               BLUETOOTH_ERROR_INTERNAL - internal error (proxy does not exist) \n
5154  *               BLUETOOTH_ERROR_NOT_FOUND - The transfer is not found \n
5155  *
5156  * @exception None
5157  * @param[in] transfer_id transfer ID
5158
5159  * @remark       None
5160  * @see None
5161  */
5162 int bluetooth_obex_server_cancel_transfer(int transfer_id);
5163
5164
5165 /**
5166  * @fn int bluetooth_obex_server_cancel_all_transfers(void)
5167  * @brief Cancel the transfer on server
5168  *
5169  * This function is an asynchronous call.
5170  * If the function call that cancels transfer is successful, the application would receive
5171  * BLUETOOTH_EVENT_TRANSFER_COMPLETED event through registered callback
5172  * function with an error code BLUETOOTH_ERROR_CANCEL. In the case of failure
5173  * the error code will be BLUETOOTH_ERROR_NONE
5174  *
5175  * @return   BLUETOOTH_ERROR_NONE  - Success \n
5176  *               BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Not enabled \n
5177  *               BLUETOOTH_ERROR_AGENT_DOES_NOT_EXIST -Obex agent not registered \n
5178  *               BLUETOOTH_ERROR_INTERNAL - internal error (proxy does not exist) \n
5179  *               BLUETOOTH_ERROR_NOT_FOUND - The transfer is not found \n
5180  *
5181  * @exception None
5182  *
5183  * @remark       None
5184  * @see None
5185  */
5186 int bluetooth_obex_server_cancel_all_transfers(void);
5187
5188
5189 /**
5190  * @fn int bluetooth_obex_server_is_receiving(gboolean *is_receiving)
5191  * @brief Informs whether obex server is receiving or not.
5192  *
5193  * This function is a synchronous call.
5194  *
5195  * @return   BLUETOOTH_ERROR_NONE  - Success \n
5196  *               BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Not enabled \n
5197  *               BLUETOOTH_ERROR_INTERNAL \n
5198  *
5199  * @exception   None
5200  * @param[out] is_receiving The receiving status: (@c TRUE = in receiving , @c  false = not in receiving)
5201  *
5202  * @remark       None
5203  * @see None
5204  */
5205 int bluetooth_obex_server_is_receiving(gboolean *is_receiving);
5206
5207
5208 /**
5209  * @fn int bluetooth_map_client_init(void)
5210  * @brief Initialize MAP client.
5211  *
5212  * This function is a synchronous call.
5213  * No event corresponding to this api
5214  *
5215  * @return   BLUETOOTH_ERROR_NONE  - Success \n
5216  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
5217  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
5218  *              BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
5219  *              BLUETOOTH_ERROR_ACCESS_DENIED -Memory allocation failed \n
5220  *
5221  * @exception None
5222  *
5223  * @remark None
5224  * @see bluetooth_map_client_deinit
5225  */
5226 int bluetooth_map_client_init(void);
5227
5228 int bluetooth_map_client_deinit(void);
5229
5230 int bluetooth_map_client_create_session(bt_map_client_session_info_s *session);
5231
5232 int bluetooth_map_client_destroy_session(bt_map_client_session_info_s *session);
5233
5234 int bluetooth_map_client_set_folder(bt_map_client_session_info_s *session, const char *name);
5235
5236 int bluetooth_map_client_list_folders(bt_map_client_session_info_s *session,
5237                         bt_map_client_list_folders_filter_t *filter);
5238
5239 /**
5240  * @fn int bluetooth_map_client_list_filter_fields(bt_map_session_info_s* session)
5241  * @brief Return all available fields that can be used in Fields filter.
5242  *
5243  * This function is a asynchronous call.
5244  *
5245  * @return   BLUETOOTH_ERROR_NONE  - Success \n
5246  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
5247  *              BLUETOOTH_ERROR_INTERNAL - Update inbox failed \n
5248  *
5249  * @exception   None
5250  * @param[in]  session   Information about session.
5251  * @remark       None
5252  */
5253 int bluetooth_map_client_list_filter_fields(bt_map_client_session_info_s *session);
5254
5255 int bluetooth_map_client_list_messages(bt_map_client_session_info_s *session,
5256                         const char *folder,
5257                         bt_map_client_list_messages_filter_t *filter);
5258
5259 int bluetooth_map_client_update_inbox(bt_map_client_session_info_s *session);
5260
5261 int bluetooth_map_client_push_message(bt_map_client_session_info_s *session,
5262                         const char *source_file,
5263                         const char *folder,
5264                         bt_map_client_push_message_args_t *args);
5265
5266 int bluetooth_map_client_get_message(bt_map_client_session_info_s *session,
5267                         const bt_map_client_message_object_t message_object,
5268                         const char *target_file,
5269                         bool attachment);
5270
5271
5272 /**
5273  * @fn int bluetooth_oob_read_local_data(bt_oob_data_t *local_oob_data)
5274  * @brief Read the local Hash and Randmizer.
5275  *
5276  * This function is a synchronous call.
5277  *
5278  * @return   BLUETOOTH_ERROR_NONE  - Success \n
5279  *           BLUETOOTH_ERROR_INTERNAL - Internal Error \n
5280  *
5281  * @exception  None
5282  * @param[in]  None.
5283  * @param[out] local_oob_data - Pointer to the local OOB data
5284  *
5285  * @remark       None
5286  * @see None
5287  */
5288
5289 int bluetooth_oob_read_local_data(bt_oob_data_t *local_oob_data);
5290
5291
5292 /**
5293  * @fn int bluetooth_oob_add_remote_data(
5294  *                      const bluetooth_device_address_t *remote_device_address,
5295  *                      bluetooth_bdaddr_type_e address_type,
5296  *                      bt_oob_data_t *oob_data)
5297  * @brief Add/updated the remote device  Hash and Randmizer.
5298  *
5299  * This function is a synchronous call.
5300  * No event for this api..
5301  *
5302  * @return   BLUETOOTH_ERROR_NONE  - Success \n
5303  *           BLUETOOTH_ERROR_INTERNAL - Internal Error \n
5304  *
5305  * @exception   None
5306  * @param[in] remote_device_address - Remote device address
5307   *           address_type - bdaddr type
5308  *            remote_oob_data - Ponter to Hash and Randomizer oob data structure
5309  *
5310  * @remark      None
5311  * @see         None
5312  */
5313
5314 int bluetooth_oob_add_remote_data(
5315                    const bluetooth_device_address_t *remote_device_address,
5316                    bluetooth_bdaddr_type_e address_type,
5317                    bt_oob_data_t *remote_oob_data);
5318
5319
5320 /**
5321  * @fn int bluetooth_oob_remove_remote_data(
5322  *                      const bluetooth_device_address_t *remote_device_address)
5323  * @brief Delete the Hash and Randomizer w.r.t the remote device address.
5324  *
5325  * This function is a synchronous call.
5326  * No event for this api..
5327  *
5328  * @return   BLUETOOTH_ERROR_NONE  - Success \n
5329  *           BLUETOOTH_ERROR_INTERNAL - Internal Error \n
5330  *
5331  * @exception  None
5332  * @param[in] remote_device_address - Remote device address
5333  *
5334  * @remark       None
5335  * @see None
5336  */
5337
5338 int bluetooth_oob_remove_remote_data(
5339                         const bluetooth_device_address_t *remote_device_address);
5340
5341
5342 /**
5343  * @fn int bluetooth_le_oob_read_local_data(bt_oob_data_t *local_oob_data)
5344  * @brief Read the local Hash and Randmizer.
5345  *
5346  * This function is a synchronous call.
5347  *
5348  * @return   BLUETOOTH_ERROR_NONE  - Success \n
5349  *           BLUETOOTH_ERROR_INTERNAL - Internal Error \n
5350  *
5351  * @exception  None
5352  * @param[in]  None.
5353  * @param[out] local_oob_data - Pointer to the local OOB data
5354  *
5355  * @remark       None
5356  * @see None
5357  */
5358 int bluetooth_le_oob_read_local_data(bt_oob_data_t *local_oob_data);
5359
5360 /**
5361  * @fn int bluetooth_le_oob_add_remote_data(
5362  *                      const bluetooth_device_address_t *remote_device_address,
5363  *                      bluetooth_bdaddr_type_e address_type,
5364  *                      bt_oob_data_t *oob_data)
5365  * @brief Add/updated the remote device  Hash and Randmizer.
5366  *
5367  * This function is a synchronous call.
5368  * No event for this api..
5369  *
5370  * @return   BLUETOOTH_ERROR_NONE  - Success \n
5371  *           BLUETOOTH_ERROR_INTERNAL - Internal Error \n
5372  *
5373  * @exception   None
5374  * @param[in] remote_device_address - Remote device address
5375   *           address_type - bdaddr type
5376  *            remote_oob_data - Ponter to Hash and Randomizer oob data structure
5377  *
5378  * @remark      None
5379  * @see         None
5380  */
5381 int bluetooth_le_oob_add_remote_data(
5382                         const bluetooth_device_address_t *remote_device_address,
5383                         bluetooth_bdaddr_type_e address_type,
5384                         bt_oob_data_t *remote_oob_data);
5385
5386 /**
5387  * @fn int bluetooth_gatt_get_primary_services(const bluetooth_device_address_t *address,
5388  *                                              bt_gatt_handle_info_t *prim_svc);
5389  *
5390  * @brief Gets the GATT based primary services handle supported by remote device
5391  *
5392  * This function is a synchronous call.
5393  * The output parameter needs to be freed by calling bluetooth_gatt_free_primary_services()
5394  *
5395  * @return   BLUETOOTH_ERROR_NONE  - Success \n
5396  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
5397  *              BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
5398  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
5399  *
5400  * @exception    None
5401  * @param[in]    address - Remote device address
5402  * @param[out] prim_svc - Structure containing remote service count and handle list.
5403  *
5404  * @remark      None
5405  * @see         bluetooth_gatt_free_primary_services()
5406  */
5407 int bluetooth_gatt_get_primary_services(const bluetooth_device_address_t *address,
5408                                                 bt_gatt_handle_info_t *prim_svc);
5409
5410 /**
5411  * @fn int bluetooth_gatt_discover_service_characteristics(const char *service_handle)
5412  *
5413  * @brief Discovers the characteristics of GATT based service of remote device
5414  *
5415  * This function is an asynchronous call.
5416  * This API is responded with BLUETOOTH_EVENT_GATT_SVC_CHAR_DISCOVERED
5417  *
5418  * @return   BLUETOOTH_ERROR_NONE  - Success \n
5419  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
5420  *              BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
5421  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
5422  *
5423  * @exception   None
5424  * @param[in]   service_handle - Handle for remote service.
5425  *
5426  * @remark      None
5427  * @see         None
5428  */
5429 int bluetooth_gatt_discover_service_characteristics(const char *service_handle);
5430
5431 int bluetooth_gatt_set_service_change_watcher(
5432                 const bluetooth_device_address_t *address, gboolean enable);
5433
5434 /**
5435  * @fn int bluetooth_gatt_get_service_property(const char *service_handle,
5436  *                                              bt_gatt_service_property_t *service);
5437  *
5438  * @brief Gets the properties of GATT based service of remote device
5439  *
5440  * This function is a synchronous call.
5441  * The output parameter needs to be freed by calling bluetooth_gatt_free_primary_services()
5442  *
5443  * @return   BLUETOOTH_ERROR_NONE  - Success \n
5444  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
5445  *              BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
5446  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
5447  *
5448  * @exception   None
5449  * @param[in]   service_handle - Handle for remote service.
5450  * @param[out]  service - Structure containing remote service property.
5451  *
5452  * @remark      None
5453  * @see         bluetooth_gatt_free_service_property()
5454  */
5455 int bluetooth_gatt_get_service_property(const char *service_handle,
5456                                                 bt_gatt_service_property_t *service);
5457
5458 /**
5459  * @fn int bluetooth_gatt_watch_characteristics(const char *service_handle, const char *svc_name)
5460  *
5461  * @brief Register to GATT based service to receive value change notification/indication.
5462  *
5463  * This function is a synchronous call.
5464  * No event for this api.
5465  *
5466  * @return   BLUETOOTH_ERROR_NONE  - Success \n
5467  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
5468  *              BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
5469  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
5470  *
5471  * @exception   None
5472  * @param[in]   service_handle - Handle for remote service.
5473  * @param[in]   service_name - Friednly name of service uuid.
5474  *
5475  * @remark      None
5476  * @see None
5477  */
5478 int bluetooth_gatt_watch_characteristics(const char *service_handle, const char *svc_name);
5479
5480 /**
5481  * @fn int bluetooth_gatt_unwatch_characteristics(const char *service_handle)
5482  *
5483  * @brief Unregister GATT based service to receive value change notification/indication.
5484  *
5485  * This function is a synchronous call.
5486  * No event for this api.
5487  *
5488  * @return   BLUETOOTH_ERROR_NONE  - Success \n
5489  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
5490  *              BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
5491  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
5492  *
5493  * @exception   None
5494  * @param[in]   service_handle - Handle for remote service.
5495  *
5496  * @remark      None
5497  * @see         None
5498  */
5499 int bluetooth_gatt_unwatch_characteristics(const char *service_handle);
5500
5501 /**
5502  * @fn int bluetooth_gatt_get_characteristics_property(const char *char_handle,
5503  *                                              bt_gatt_char_property_t *characteristic);
5504  *
5505  * @brief Provides characteristic value along with properties.
5506  *
5507  * This function is a synchronous call.
5508  * The output parameter needs to be freed by calling bluetooth_gatt_free_char_property()
5509  *
5510  * @return   BLUETOOTH_ERROR_NONE  - Success \n
5511  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
5512  *              BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
5513  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
5514  *
5515  * @exception   None
5516  * @param[in]   char_handle - Handle for Characteristic property.
5517  * @param[out] characteristic - Structure containing remote characteristic property.
5518  *
5519  * @remark      None
5520  * @see         bluetooth_gatt_free_char_property()
5521  */
5522 int bluetooth_gatt_get_characteristics_property(const char *char_handle,
5523                                                 bt_gatt_char_property_t *characteristic);
5524
5525 /**
5526  * @fn int bluetooth_gatt_get_char_descriptor_property(const char *char_handle,
5527  *                                              bt_gatt_char_property_t *characteristic);
5528  *
5529  * @brief Provides characteristic descriptor value along with its UUID.
5530  *
5531  * This function is a synchronous call.
5532  * The output parameter needs to be freed by calling bluetooth_gatt_free_desc_property()
5533  *
5534  * @return   BLUETOOTH_ERROR_NONE  - Success \n
5535  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
5536  *              BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
5537  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
5538  *
5539  * @exception   None
5540  * @param[in]   desc_handle - Handle for Characteristic descriptor.
5541  * @param[out] descriptor - Structure containing remote characteristic descriptor property.
5542  *
5543  * @remark      None
5544  * @see         bluetooth_gatt_free_desc_property()
5545  */
5546 int bluetooth_gatt_get_char_descriptor_property(const char *desc_handle,
5547                                                 bt_gatt_char_descriptor_property_t *descriptor);
5548
5549
5550 /**
5551  * @fn int bluetooth_gatt_set_characteristics_value(const char *char_handle,
5552  *                                              const guint8 *value, int length)
5553  *
5554  * @brief Set characteristic value.
5555  *
5556  * This function is a synchronous call.
5557  *
5558  * @return   BLUETOOTH_ERROR_NONE  - Success \n
5559  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
5560  *              BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
5561  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
5562  *
5563  * @exception   None
5564  * @param[in]   char_handle - Handle for Characteristic property.
5565  * @param[in]   value - New value to set for characteristic property.
5566  * @param[in]   length - Length of the value to be set.
5567  *
5568  * @remark      None
5569  * @see         None
5570  */
5571 int bluetooth_gatt_set_characteristics_value(const char *char_handle,
5572                                                 const guint8 *value, int length);
5573
5574 /**
5575  * @fn int bluetooth_gatt_set_characteristics_value_by_type(const char *char_handle,
5576  *                              const guint8 *value, int length, guint8 write_type)
5577  *
5578  * @brief Set characteristic value by write type.
5579  *
5580  * This function is a synchronous call if write type is "write without resonse"
5581  * and it is an asynchronous call if write type is "write with response"
5582  *
5583  * @return   BLUETOOTH_ERROR_NONE  - Success \n
5584  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
5585  *              BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
5586  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
5587  *
5588  * @exception   None
5589  * @param[in]   char_handle - Handle for Characteristic property.
5590  * @param[in]   value - New value to set for characteristic property.
5591  * @param[in]   length - Length of the value to be set.
5592  * @param[in]   write_type - Type of write.
5593  *
5594  * @remark      None
5595  * @see         None
5596  */
5597 int bluetooth_gatt_set_characteristics_value_by_type(const char *char_handle,
5598                                         const guint8 *value, int length,
5599                                         guint8 write_type, gpointer app_data);
5600
5601
5602 /**
5603  * @fn int bluetooth_gatt_set_characteristics_value_request(const char *char_handle,
5604  *                                              const guint8 *value, int length)
5605  *
5606  * @brief Set characteristic value request.
5607  *
5608  * This function is an asynchronous call.
5609  *
5610  * @return   BLUETOOTH_ERROR_NONE  - Success \n
5611  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
5612  *              BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
5613  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
5614  *
5615  * @exception   None
5616  * @param[in]   char_handle - Handle for Characteristic property.
5617  * @param[in]   value - New value to set for characteristic property.
5618  * @param[in]   length - Length of the value to be set.
5619   *
5620  * @remark      None
5621  * @see         None
5622  */
5623 int bluetooth_gatt_set_characteristics_value_request(const char *char_handle,
5624                                                 const guint8 *value, int length);
5625
5626 /**
5627  * @fn int bluetooth_gatt_read_characteristic_value(const char *char_handle)
5628  *
5629  * @brief Read characteristic value.
5630  *
5631  * This function is a asynchronous call.
5632  *
5633  * @return   BLUETOOTH_ERROR_NONE  - Success \n
5634  *             BLUETOOTH_ERROR_INTERNAL - Internal Error \n
5635  *             BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
5636  *             BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
5637  *
5638  * @exception  None
5639  * @param[in]  char_handle - Handle for Characteristic property.
5640  *
5641  * @remark     None
5642  * @see        None
5643  */
5644 int bluetooth_gatt_read_characteristic_value(const char *char_handle, gpointer app_data);
5645
5646 /**
5647  * @fn int bluetooth_gatt_get_service_from_uuid(bluetooth_device_address_t *address,
5648  *                                      const char *service_uuid,
5649  *                                      bt_gatt_service_property_t *service)
5650  *
5651  * @brief Gets the service property from a device based on a particular uuid
5652  *
5653  * This function is a synchronous call.
5654  *
5655  * @return   BLUETOOTH_ERROR_NONE  - Success \n
5656  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
5657  *              BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
5658  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
5659  *
5660  * @exception   None
5661  * @param[in]   address - BD address of the remote device
5662  * @param[in]   service_uuid - uuid of the service.
5663  * @param[out] service - Structure containing the service property.
5664  *
5665  * @remark      None
5666  * @see         None
5667  */
5668 int bluetooth_gatt_get_service_from_uuid(bluetooth_device_address_t *address,
5669                                         const char *service_uuid,
5670                                         bt_gatt_service_property_t *service);
5671
5672 /**
5673  * @fn int bluetooth_gatt_get_char_from_uuid(const char *service_handle,
5674  *                                                      const char *char_uuid)
5675  *
5676  * @brief Gets the characteristic property from a service based on a particular char uuid
5677  *
5678  * This function is an asynchronous call.
5679  * This API is responded with BLUETOOTH_EVENT_GATT_GET_CHAR_FROM_UUID
5680  *
5681  * @return   BLUETOOTH_ERROR_NONE  - Success \n
5682  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
5683  *              BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
5684  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
5685  *
5686  * @exception   None
5687  * @param[in]   service_handle - Service handle.
5688  * @param[in]   uuid - Characteristic uuid.
5689  *
5690  * @remark      None
5691  * @see         None
5692  */
5693 int bluetooth_gatt_get_char_from_uuid(const char *service_handle,
5694                                                 const char *char_uuid);
5695
5696 /**
5697  * @fn int bluetooth_gatt_free_primary_services(bt_gatt_handle_info_t *prim_svc);
5698  *
5699  * @brief Releases the memory allocated by bluetooth_gatt_get_primary_services()
5700  *
5701  * This function is a synchronous call.
5702  * The input parameter is obtained by calling bluetooth_gatt_get_primary_services()
5703  *
5704  * @return   BLUETOOTH_ERROR_NONE  - Success \n
5705  *              BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
5706  *
5707  * @exception   None
5708  * @param[in]   prim_svc - GATT handle info structure
5709  *
5710  * @remark      None
5711  * @see         bluetooth_gatt_get_primary_services()
5712  */
5713 int bluetooth_gatt_free_primary_services(bt_gatt_handle_info_t *prim_svc);
5714
5715 /**
5716  * @fn int bluetooth_gatt_free_service_property(bt_gatt_service_property_t *svc_pty);
5717  *
5718  * @brief  Releases the memory allocated by bluetooth_gatt_get_service_property()
5719  *
5720  * This function is a synchronous call.
5721  * The input parameter is obtained by calling bluetooth_gatt_get_service_property()
5722  *
5723  * @return   BLUETOOTH_ERROR_NONE  - Success \n
5724  *              BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
5725  *
5726  * @exception   None
5727  * @param[in]   svc_pty - GATT service property structure.
5728  *
5729  * @remark      None
5730  * @see         bluetooth_gatt_get_service_property()
5731  */
5732 int bluetooth_gatt_free_service_property(bt_gatt_service_property_t *svc_pty);
5733
5734 /**
5735  * @fn int bluetooth_gatt_free_char_property(bt_gatt_char_property_t *char_pty);
5736  *
5737  * @brief Provides characteristic value along with properties.
5738  *
5739  * This function is a synchronous call.
5740  * The input parameter is obtained by calling bluetooth_gatt_get_characteristics_property()
5741  *
5742  * @return   BLUETOOTH_ERROR_NONE  - Success \n
5743  *              BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
5744  *
5745  * @exception   None
5746  * @param[in]   char_pty - GATT characteristics property structure.
5747  *
5748  * @remark      None
5749  * @see         bluetooth_gatt_get_characteristics_property()
5750  */
5751 int bluetooth_gatt_free_char_property(bt_gatt_char_property_t *char_pty);
5752
5753 /**
5754  * @fn int bluetooth_gatt_free_desc_property(bt_gatt_char_descriptor_property_t *desc_pty);
5755  *
5756  * @brief Releases the memory allocated by bluetooth_gatt_get_char_descriptor_property()
5757  *
5758  * This function is a synchronous call.
5759  * The input parameter is obtained by calling bluetooth_gatt_get_char_descriptor_property()
5760  *
5761  * @return   BLUETOOTH_ERROR_NONE  - Success \n
5762  *              BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
5763  *
5764  * @exception   None
5765  * @param[in]   desc_pty - GATT characteristics descriptor property structure.
5766  *
5767  * @remark      None
5768  * @see         bluetooth_gatt_get_char_descriptor_property()
5769  */
5770 int bluetooth_gatt_free_desc_property(bt_gatt_char_descriptor_property_t *desc_pty);
5771
5772 int bluetooth_connect_le(const bluetooth_device_address_t *device_address,
5773                                 gboolean auto_connect, int client_id);
5774
5775 int bluetooth_disconnect_le(const bluetooth_device_address_t *device_address,
5776                 int client_id);
5777
5778 int bluetooth_get_gatt_data_batching_available_packets(
5779         int *available_packets);
5780
5781 int bluetooth_enable_gatt_data_batching(
5782         const bluetooth_device_address_t *device_address, int packet_threshold, int timeout);
5783
5784 int bluetooth_disable_gatt_data_batching(
5785         const bluetooth_device_address_t *device_address);
5786
5787  /**
5788  * @fn int bluetooth_gatt_discover_characteristic_descriptor(const char *characteristic_handle);
5789  *
5790  * @brief Discovers the characteristic descriptor value of a characteristic within its definition, asynchronously
5791  *
5792  * The input parameter is obtained by calling bluetooth_gatt_get_characteristics_property()
5793  *
5794  * @return  BLUETOOTH_ERROR_NONE  - Success \n
5795  *                      BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
5796  *
5797  * @exception   None
5798  * @param[in]   characteristic_handle - The characteristic handle for which characteristic descriptor has to be discovered.
5799  *
5800  * @remark      None
5801  */
5802 int bluetooth_gatt_discover_characteristic_descriptor(const char *characteristic_handle);
5803
5804 /**
5805  * @fn int bluetooth_gatt_read_descriptor_value(const char *desc_handle)
5806  *
5807  * @brief Read characteristic descriptor value.
5808  *
5809  * This function is a asynchronous call.
5810  *
5811  * @return   BLUETOOTH_ERROR_NONE  - Success \n
5812  *             BLUETOOTH_ERROR_INTERNAL - Internal Error \n
5813  *             BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
5814  *             BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
5815  *
5816  * @exception  None
5817  * @param[in]  desc_handle - Handle for Characteristic descriptor
5818  *
5819  * @remark     None
5820  * @see        None
5821  */
5822 int bluetooth_gatt_read_descriptor_value(const char *desc_handle, gpointer app_data);
5823
5824 /**
5825  * @fn int bluetooth_gatt_write_descriptor_value(const char *desc_handle,
5826  *                      const guint8 *value, int length);
5827  *
5828  * @brief Set characteristic descriptor value.
5829  *
5830  * This function is a asynchronous call.
5831  *
5832  * @return   BLUETOOTH_ERROR_NONE  - Success \n
5833  *             BLUETOOTH_ERROR_INTERNAL - Internal Error \n
5834  *             BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
5835  *             BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
5836  *
5837  * @exception  None
5838  * @param[in]  desc_handle - Handle for Characteristic descriptor
5839  * @param[in]  value - New value to set for characteristic descriptor
5840  * @param[in]  length - Length of the value to be set.
5841  *
5842  * @remark     None
5843  * @see        None
5844  */
5845 int bluetooth_gatt_write_descriptor_value(const char *desc_handle,
5846                         const guint8 *value, int length, gpointer app_data);
5847
5848 /* @fn int bluetooth_gatt_init(void)
5849 *
5850 * @brief Initializes the gatt service.
5851 *
5852 * This function is a synchronous call.
5853 * @return   BLUETOOTH_ERROR_NONE        - Success \n
5854 *       BLUETOOTH_ERROR_INTERNAL - Internal Error \n
5855 *       BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
5856 *       BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
5857 *
5858 * @exception     None
5859 * @remark  Adapter should be enabled
5860 * @see  bluetooth_gatt_deinit()
5861 */
5862 int bluetooth_gatt_init(void);
5863
5864 /* @fn int bluetooth_gatt_init(void)
5865 *
5866 * @brief DeInitializes the gatt service.
5867 *
5868 * This function is a synchronous call.
5869 * @return   BLUETOOTH_ERROR_NONE        - Success \n
5870 *       BLUETOOTH_ERROR_INTERNAL - Internal Error \n
5871 *       BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
5872 *       BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
5873 *
5874 * @exception     None
5875 * @remark  Adapter should be enabled
5876 * @see  bluetooth_gatt_init()
5877 */
5878 int bluetooth_gatt_deinit(void);
5879
5880 /* @fn int bluetooth_gatt_add_service(const char *svc_uuid,
5881                         unsigned char **svc_path)
5882 *
5883 * @brief Exports a new gatt service to the service interface.
5884 *
5885 * This function is a synchronous call.
5886 *
5887 * @return       BLUETOOTH_ERROR_NONE    - Success \n
5888 *        BLUETOOTH_ERROR_INTERNAL - Internal Error \n
5889 *        BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
5890 *        BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
5891 *
5892 * @exception     None
5893 * @param[in]   svc_uuid  Gatt service uuid.
5894 * @param[out] svc_path  service object path of the exported service.
5895 * @remark  Adapter should be enabled
5896 * @see  bluetooth_gatt_init()
5897 */
5898 int bluetooth_gatt_add_service(const char *svc_uuid,
5899                         char **svc_path);
5900
5901 /* @fn int bluetooth_gatt_add_new_characteristic(
5902                         const char *svc_path, const char *char_uuid,
5903                         bt_gatt_permission_t permissions,
5904                         bt_gatt_characteristic_property_t properties,
5905                         int flags_length, char **char_path);;
5906 *
5907 * @brief Exports a new gatt characteristic to the characteristic interface.
5908 *
5909 * This function is a synchronous call.
5910 * @return       BLUETOOTH_ERROR_NONE    - Success \n
5911 *        BLUETOOTH_ERROR_INTERNAL - Internal Error \n
5912 *        BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
5913 *        BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
5914 * @exception     None
5915 * @param[in]   svc_path service object path of the exported service.
5916 * @param[in]   char_uuid  Gatt service uuid.
5917 * @param[in]   properties       GATT characteristic properties.
5918 * @param[out] char_path characteristic object path of the exported characteristic.
5919 *
5920 * @remark  Adapter should be enabled
5921 * @see  bluetooth_gatt_add_service()
5922 */
5923 int bluetooth_gatt_add_new_characteristic(
5924                         const char *svc_path, const char *char_uuid,
5925                         bt_gatt_permission_t permissions,
5926                         bt_gatt_characteristic_property_t properties,
5927                         char **char_path);
5928
5929 /* @fn bluetooth_gatt_set_characteristic_value(
5930                         const char *characteristic, const char *char_value,
5931                         int value_length);
5932 *
5933 * @brief adds gatt charactertisic value to the given charactertistic path.
5934 *
5935 * This function is a synchronous call.
5936 * @return       BLUETOOTH_ERROR_NONE    - Success \n
5937 *        BLUETOOTH_ERROR_INTERNAL - Internal Error \n
5938 *        BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
5939 *        BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
5940 * @exception     None
5941 * @param[in]   char_value Value of the GATT characteristic to be added.
5942 * @param[in]   value_length length of the chantacteristic value..
5943 * @param[out] characteristic characteristic object path..
5944 *
5945 * @remark  Adapter should be enabled
5946 * @see  bluetooth_gatt_add_service()
5947 */
5948 int bluetooth_gatt_set_characteristic_value(
5949                         const char *characteristic, const char *char_value,
5950                         int value_length);
5951
5952 /* @fn  int bluetooth_gatt_add_descriptor(
5953                         const char *char_path, const char *desc_uuid,
5954                         bt_gatt_permission_t permissions,
5955                         char **desc_path);
5956 *
5957 * @brief Exports a new gatt descriptor to the descriptor interface.
5958 *
5959 * This function is a synchronous call.
5960 *
5961 * @return       BLUETOOTH_ERROR_NONE    - Success \n
5962 *        BLUETOOTH_ERROR_INTERNAL - Internal Error \n
5963 *        BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
5964 *        BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
5965 *
5966 * @exception    None
5967 * @param[in]    desc_uuid  Gatt descriptor uuid.
5968 * @param[in]    desc_value      GATT descriptor value.
5969 * @param[in]    value_length    Length of GATT descriptor value.
5970 * @param[in]    permissions     descriptor permissions.
5971 * @param[in]    properties      GATT descriptor properties.
5972 * @param[in]    char_path       characteristics object path of the exported character.
5973 *
5974 * @remark  Adapter should be enabled
5975 * @see  bluetooth_gatt_add_service()
5976 * @see  bluetooth_gatt_add_characteristics()
5977 */
5978 int bluetooth_gatt_add_descriptor(
5979                         const char *char_path, const char *desc_uuid,
5980                         bt_gatt_permission_t permissions,
5981                         char **desc_path);
5982
5983 /* @fn int bluetooth_gatt_set_descriptor_value(
5984                    const char *desc_path, const char *desc_value,
5985                    int value_length);
5986 *
5987 * @brief Adds value to the given descriptor handle.
5988 *
5989 * This function is a synchronous call.
5990 *
5991 * @return       BLUETOOTH_ERROR_NONE    - Success \n
5992 *        BLUETOOTH_ERROR_INTERNAL - Internal Error \n
5993 *        BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
5994 *        BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
5995 *
5996 * @exception     None
5997 * @param[in]   desc_value       GATT descriptor value.
5998 * @param[in]   value_length     Length of GATT descriptor value.
5999 * @param[in]   desc_path descriptor path to which the value needs to be added.
6000 *
6001 * @remark  Adapter should be enabled
6002 * @see  bluetooth_gatt_add_service()
6003 * @see  bluetooth_gatt_add_characteristics()
6004 */
6005 int bluetooth_gatt_set_descriptor_value(
6006                    const char *desc_path, const char *desc_value,
6007                    int value_length);
6008
6009 /* @fn int bluetooth_gatt_get_service(const char *svc_uuid);
6010 *
6011 * @brief Reads the Service registered on manager interface.
6012 *
6013 * This function is a synchronous call.
6014 *
6015 * @return       BLUETOOTH_ERROR_NONE    - Success \n
6016 *        BLUETOOTH_ERROR_INTERNAL - Internal Error \n
6017 *        BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
6018 *        BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
6019 *
6020 * @exception     None
6021 * @param[in]   svc_uuid  Gatt Service uuid.
6022 *
6023 * @remark  Adapter should be enabled and service should be registered.
6024 * @see  bluetooth_gatt_register_service()
6025 */
6026 int bluetooth_gatt_get_service(const char *svc_uuid);
6027
6028 /* @fn int bluetooth_gatt_register_service(const  char *svc_path)
6029 *
6030 * @brief Registers the given service path with the library.
6031 *
6032 * This function is a synchronous call.
6033 *
6034 * @return       BLUETOOTH_ERROR_NONE    - Success \n
6035 *        BLUETOOTH_ERROR_INTERNAL - Internal Error \n
6036 *        BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
6037 *        BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
6038 *
6039 * @exception     None
6040 * @param[in] svc_path   service object path of the exported service.
6041 *
6042 * @remark  Adapter should be enabled
6043 * @see  bluetooth_gatt_add_service()
6044 * @see  bluetooth_gatt_add_characteristics()
6045 * @see  bluetooth_gatt_add_descriptor()
6046 * @see  bluetooth_gatt_register_application()
6047 */
6048 int bluetooth_gatt_register_service(const char *svc_path);
6049
6050 /* @fn int bluetooth_gatt_register_application(void)
6051 *
6052 * @brief Registers the application with the bluez gatt server.
6053 *
6054 * This function is a synchronous call.
6055 *
6056 * @return       BLUETOOTH_ERROR_NONE    - Success \n
6057 *        BLUETOOTH_ERROR_INTERNAL - Internal Error \n
6058 *        BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
6059 *        BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
6060 *
6061 * @exception     None
6062 *
6063 * @remark  Adapter should be enabled
6064 * @see  bluetooth_gatt_init()
6065 * @see  bluetooth_gatt_add_service()
6066 * @see  bluetooth_gatt_add_characteristics()
6067 * @see  bluetooth_gatt_add_descriptor()
6068 * @see  bluetooth_gatt_register_service()
6069 */
6070 int bluetooth_gatt_register_application(void);
6071
6072 /* @fn int bluetooth_gatt_unregister_service(const  char *svc_path)
6073 *
6074 * @brief Removes(unregister) service from the bluez gatt server db.
6075 *
6076 * This function is a synchronous call.
6077 *
6078 * @return       BLUETOOTH_ERROR_NONE    - Success \n
6079 *        BLUETOOTH_ERROR_INTERNAL - Internal Error \n
6080 *        BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
6081 *        BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
6082 *
6083 * @exception     None
6084 * @param[in] svc_path   service object path of the exported service.
6085 *
6086 * @remark  Adapter should be enabled
6087 * @see  bluetooth_gatt_add_service()
6088 * @see  bluetooth_gatt_add_characteristics()
6089 * @see  bluetooth_gatt_add_descriptor()
6090 * @see bluetooth_gatt_register_service()
6091 */
6092 int bluetooth_gatt_unregister_service(const char *svc_path);
6093
6094 /* @fn int bluetooth_gatt_unregister_application(void)
6095 *
6096 * @brief Removes(unregister) the application with the bluez gatt server,
6097 *        and deletes all the service registered.
6098 *
6099 * This function is a synchronous call.
6100 *
6101 * @return       BLUETOOTH_ERROR_NONE    - Success \n
6102 *        BLUETOOTH_ERROR_INTERNAL - Internal Error \n
6103 *        BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
6104 *        BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
6105 *
6106 * @exception     None
6107 *
6108 * @remark  Adapter should be enabled
6109 * @see  bluetooth_gatt_init()
6110 * @see  bluetooth_gatt_add_service()
6111 * @see  bluetooth_gatt_add_characteristics()
6112 * @see  bluetooth_gatt_add_descriptor()
6113 * @see  bluetooth_gatt_register_service()
6114 * @see  bluetooth_gatt_unregister_service()
6115 */
6116 int bluetooth_gatt_unregister_application(void);
6117
6118 /* @fn int bluetooth_gatt_send_response(int request_id,
6119 *                               int offset, char *value, int value_length)
6120 *
6121 * @brief Updates the attribute value in local attribute list.
6122 *
6123 * This function is a synchronous call.
6124 *
6125 * @return       BLUETOOTH_ERROR_NONE    - Success \n
6126 *        BLUETOOTH_ERROR_INTERNAL - Internal Error \n
6127 *        BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
6128 *        BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
6129 *
6130 * @exception     None
6131 * @param[in] request_id The identification of a read request
6132 * @param[in] req_type The identification of  request type (TRUE for Read request and FALSE for write request)
6133 * @param[in] resp_state The identification of response state
6134 * @param[in] offset The offset from where a value is read
6135 * @param[in] value The value to be sent. It will be sent from @a offset.
6136 *               If it is NULL, a requested GATT handle's value will be sent from @a offset.
6137 * @param[in] value_length Value Length.
6138 *
6139 * @remark  Adapter should be enabled
6140 * @see  bluetooth_gatt_add_service()
6141 * @see  bluetooth_gatt_add_characteristics()
6142 * @see  bluetooth_gatt_add_descriptor()
6143 * @see bluetooth_gatt_register_service()
6144 */
6145 int bluetooth_gatt_send_response(int request_id, guint req_type,
6146                                 int resp_state, int offset, char *value, int value_length);
6147
6148 /* @fn bluetooth_gatt_server_set_notification(const char *char_path)
6149 *
6150 * @brief Sets the notification property for a characteristic.
6151 *
6152 * This function is a synchronous call.
6153 *
6154 * @return       BLUETOOTH_ERROR_NONE    - Success \n
6155 *        BLUETOOTH_ERROR_INTERNAL - Internal Error \n
6156 *        BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
6157 *        BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
6158 *
6159 * @exception     None
6160 * @param[in] char_path characteristic object path.
6161 * @param[in]   unicast_address remote device address. if set notification is sent to only one device.
6162 *
6163 * @remark  Adapter should be enabled
6164 * @see  bluetooth_gatt_update_characteristic()
6165 */
6166 int bluetooth_gatt_server_set_notification(const char *char_path,
6167                                 bluetooth_device_address_t *unicast_address);
6168
6169 /* @fn int bluetooth_gatt_delete_services(void)
6170 *
6171 * @brief deletes (unregisters) all services from the gatt server database..
6172 *
6173 * This function is a synchronous call.
6174 *
6175 * @return       BLUETOOTH_ERROR_NONE    - Success \n
6176 *        BLUETOOTH_ERROR_INTERNAL - Internal Error \n
6177 *        BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
6178 *        BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
6179 *
6180 * @exception     None
6181 *
6182 * @remark  Adapter should be enabled
6183 * @see  bluetooth_gatt_add_service()
6184 * @see  bluetooth_gatt_add_characteristics()
6185 * @see  bluetooth_gatt_add_descriptor()
6186 * @see bluetooth_gatt_register_service()
6187 * @see bluetooth_gatt_unregister_service()
6188 */
6189 int bluetooth_gatt_delete_services(void);
6190
6191 /* @fn int bluetooth_gatt_update_characteristic(void)
6192 *
6193 * @brief updates the given characteristic with a new value
6194 *
6195 * This function is a synchronous call.
6196 *
6197 * @return       BLUETOOTH_ERROR_NONE    - Success \n
6198 *        BLUETOOTH_ERROR_INTERNAL - Internal Error \n
6199 *        BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
6200 *        BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
6201 *
6202 * @exception     None
6203 *
6204 * @remark  Adapter should be enabled
6205 * @see  bluetooth_gatt_add_service()
6206 * @see  bluetooth_gatt_add_characteristics()
6207 * @see  bluetooth_gatt_add_descriptor()
6208 * @see bluetooth_gatt_register_service()
6209 * @see bluetooth_gatt_unregister_service()
6210 */
6211 int bluetooth_gatt_update_characteristic(const char *char_path,
6212                 const char* char_value, int value_length);
6213
6214 /**
6215  * @fn int bluetooth_set_advertising(int handle, gboolean enable);
6216  *
6217  * @brief Set advertising status.
6218  *
6219  * This function is used to enable or disable LE advertising.
6220  * Once advertising is enabled, Advertising data is transmitted in the advertising packets
6221  *
6222  * This function is a synchronous call.
6223  *
6224  * @return      BLUETOOTH_ERROR_NONE - Success \n
6225  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
6226  *              BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
6227  *
6228  * @exception   None
6229  * @param[in]   enable - The status of advertising
6230  *
6231  * @remark      None
6232  * @see         bluetooth_set_advertising_data
6233  */
6234 int bluetooth_set_advertising(int handle, gboolean enable);
6235
6236 /**
6237  * @fn int bluetooth_set_custom_advertising(int handle, gboolean enable, bluetooth_advertising_params_t *params);
6238  *
6239  * @brief Set advertising status along with interval value.
6240  *
6241  * This function is used to enable or disable LE advertising.
6242  * Interval_min and Interval_max is used to set the best advertising interval.
6243  * Once advertising is enabled, Advertising data is transmitted in the advertising packets
6244  *
6245  * This function is a synchronous call.
6246  *
6247  * @return      BLUETOOTH_ERROR_NONE - Success \n
6248  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
6249  *              BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
6250  *
6251  * @exception   None
6252  * @param[in]   enable - The status of advertising
6253  * @param[in]   interval_min - Minimum interval of advertising (msec)
6254  * @param[in]   interval_max - Maximum interval of advertising (msec)
6255  * @param[in]   filter_policy - Advertising filter policy
6256  *
6257  * @remark      None
6258  * @see         bluetooth_set_advertising_data
6259  */
6260 int bluetooth_set_custom_advertising(int handle, gboolean enable,
6261                                         bluetooth_advertising_params_t *params);
6262
6263 /**
6264  * @fn int bluetooth_get_advertising_data(bluetooth_advertising_data_t *value, int *length);
6265  * @brief Get the advertising data
6266  *
6267  * This function is used to get advertising data.
6268  * Before calling this API, the adapter should be enabled.
6269  *
6270  * This function is a synchronous call.
6271  *
6272  * @return      BLUETOOTH_ERROR_NONE - Success \n
6273  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
6274  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter (NULL buffer)\n
6275  *              BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
6276  *
6277  * @param[out]  value - Advertising data structure.
6278  * @param[out]  length - The length of Advertising data.
6279  *
6280  * @remark      None
6281 @code
6282 bluetooth_advertising_data_t *value = { {0} };
6283 int length;
6284 int ret = 0;
6285 ret = bluetooth_get_advertising_data(&value, &length);
6286 @endcode
6287  */
6288 int bluetooth_get_advertising_data(bluetooth_advertising_data_t *value, int *length);
6289
6290 /**
6291  * @fn int bluetooth_set_advertising_data(int handle, const bluetooth_advertising_data_t *value, int length);
6292  *
6293  * @brief Set advertising data with value
6294  *
6295  * This function is used to set advertising data and Maximum size of advertising data
6296  *  is 28 byte (Except Flag)
6297  *
6298  * This function is a synchronous call.
6299  *
6300  * @return      BLUETOOTH_ERROR_NONE - Success \n
6301  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
6302  *              BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
6303  *
6304  * @exception   None
6305  * @param[in]   value - Advertising data structure.
6306  *
6307  * @remark      None
6308  */
6309 int bluetooth_set_advertising_data(int handle, const bluetooth_advertising_data_t *value, int length);
6310
6311 /**
6312  * @fn int bluetooth_check_privilege_advertising_parameter(void);
6313  *
6314  * @brief Check the privilege for advertising parameter setting
6315  *
6316  * This function is a synchronous call.
6317  *
6318  * @return      BLUETOOTH_ERROR_NONE - Success \n
6319  *              BLUETOOTH_ERROR_PERMISSION_DEINED - Permission deined \n
6320  *
6321  * @exception   None
6322  *
6323  * @remark      None
6324  */
6325 int bluetooth_check_privilege_advertising_parameter(void);
6326
6327 /**
6328  * @fn int bluetooth_get_scan_response_data(bluetooth_scan_resp_data_t *value, int *length);
6329  * @brief Get the LE scan response data
6330  *
6331  * This function is used to get scan response data.
6332  * Before calling this API, the adapter should be enabled.
6333  *
6334  * This function is a synchronous call.
6335  *
6336  * @return      BLUETOOTH_ERROR_NONE - Success \n
6337  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
6338  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter (NULL buffer)\n
6339  *              BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
6340  *
6341  * @param[out]  value - Scan response data structure.
6342  * @param[out]  length - The length of Scan response data.
6343  *
6344  * @remark      None
6345 @code
6346 bluetooth_scan_resp_data_t *value = { {0} };
6347 int length;
6348 int ret = 0;
6349 ret = bluetooth_get_scan_response_data(&value, &length);
6350 @endcode
6351  */
6352 int bluetooth_get_scan_response_data(bluetooth_scan_resp_data_t *value, int *length);
6353
6354 /**
6355  * @fn int bluetooth_set_scan_response_data(int handle, const bluetooth_scan_resp_data_t *value, int length);
6356  *
6357  * @brief Set scan response data with value
6358  *
6359  * This function is used to set scan response data and Maximum size of scan response data is 31 byte
6360  *
6361  * This function is a synchronous call.
6362  *
6363  * @return      BLUETOOTH_ERROR_NONE - Success \n
6364  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
6365  *              BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
6366  *
6367  * @exception   None
6368  * @param[in]   value - LE Scan response data structure.
6369  *
6370  * @remark      None
6371  */
6372 int bluetooth_set_scan_response_data(int handle, const bluetooth_scan_resp_data_t *value, int length);
6373
6374 /**
6375  * @fn int bluetooth_set_scan_parameters(bluetooth_le_scan_params_t *params);
6376  *
6377  * @brief Set scan interval and window
6378  *
6379  * This function is used to set LE scan interval and window size
6380  *
6381  * This function is a synchronous call.
6382  *
6383  * @return      BLUETOOTH_ERROR_NONE - Success \n
6384  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
6385  *              BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
6386  *
6387  * @exception   None
6388  * @param[in]   interval - Interval of LE scan (msec)
6389  * @param[in]   window - Window size of LE scan (msec)
6390  *
6391  * @remark      None
6392  */
6393 int bluetooth_set_scan_parameters(bluetooth_le_scan_params_t *params);
6394
6395 /**
6396  * @fn intbluetooth_set_scan_type(bluetooth_le_scan_type_t scan_type);
6397  *ss
6398  * @brief Set scan type
6399  *
6400  * This function is used to set LE scan type
6401  *
6402  * This function is a synchronous call.
6403  *
6404  * @return      BLUETOOTH_ERROR_NONE - Success \n
6405  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
6406  *              BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
6407  *
6408  * @exception   None
6409  * @param[in]   scan_type - LE scan type
6410  *
6411  * @remark      None
6412  */
6413 int bluetooth_set_scan_type(bluetooth_le_scan_type_t scan_type);
6414
6415 /**
6416  * @fn intbluetooth_set_scan_phy(bleutooth_le_scanning_phy_t phy);
6417  *ss
6418  * @brief Set scan phy
6419  *
6420  * This function is used to set LE scan phy
6421  *
6422  * This function is a synchronous call.
6423  *
6424  * @return      BLUETOOTH_ERROR_NONE - Success \n
6425  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
6426  *              BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
6427  *
6428  * @exception   None
6429  * @param[in]   phy - LE scanning PHY
6430  *
6431  * @remark      None
6432  */
6433 int bluetooth_set_le_scan_phy(bleutooth_le_scanning_phy_t phy);
6434
6435 /**
6436  * @fn intbluetooth_set_scan_phy(bluetooth_le_scan_role_t role);
6437  *ss
6438  * @brief Set scan role
6439  *
6440  * This function is used to set LE scan role
6441  *
6442  * This function is a synchronous call.
6443  *
6444  * @return      BLUETOOTH_ERROR_NONE - Success \n
6445  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
6446  *              BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
6447  *
6448  * @exception   None
6449  * @param[in]   role - LE scanning role
6450  *
6451  * @remark      None
6452  */
6453 int bluetooth_set_le_scan_role(bluetooth_le_scan_role_t role);
6454
6455 /**
6456  * @fn int bluetooth_is_advertising(void)
6457  * @brief Check for the advertising is in-progress or not.
6458  *
6459  * This API is used to check the current status of the advertising procedure.
6460  * Before calling this API, make sure that the adapter is enabled. There is no callback event for
6461  * this API.
6462  *
6463  * This function checks whether the advertising is started or not.
6464  *
6465  * This function is a synchronous call.
6466  *
6467  * @param[out] is_advertising The advertising status: (@c TRUE = in progress, @c  false = not in progress)
6468  *
6469  * @return      BLUETOOTH_ERROR_NONE - Success \n
6470  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
6471  *
6472  * @remark      None
6473  * @see         bluetooth_set_advertising, bluetooth_set_custom_advertising
6474
6475 @code
6476 int ret;
6477 gboolean is_advertising = 0;
6478
6479 ret = bluetooth_is_advertising(&is_advertising);
6480 @endcode
6481  */
6482 int bluetooth_is_advertising(gboolean *is_advertising);
6483
6484 /**
6485  * @fn int bluetooth_add_allow_list(bluetooth_device_address_t *address, bluetooth_device_address_type_t address_type)
6486  * @brief Add LE device to allow list
6487  *
6488  * This API is used to add LE device to allow list
6489  * Before calling this API, make sure that the adapter is enabled. There is no callback event for
6490  * this API.
6491  *
6492  *
6493  * This function is a synchronous call.
6494  *
6495  * @param[in] address The address of remote device
6496  *
6497  * @return      BLUETOOTH_ERROR_NONE - Success \n
6498  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
6499  *
6500  * @remark      None
6501  * @see         bluetooth_set_custom_advertising
6502  */
6503 int bluetooth_add_allow_list(bluetooth_device_address_t *address, bluetooth_device_address_type_t address_type);
6504
6505 /**
6506  * @fn int bluetooth_remove_allow_list(bluetooth_device_address_t *address, bluetooth_device_address_type_t address_type)
6507  * @brief Remove LE device from allow list
6508  *
6509  * This API is used to remove LE device from allow list
6510  * Before calling this API, make sure that the adapter is enabled. There is no callback event for
6511  * this API.
6512  *
6513  *
6514  * This function is a synchronous call.
6515  *
6516  * @param[in] address The address of remote device
6517  *
6518  * @return      BLUETOOTH_ERROR_NONE - Success \n
6519  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
6520  *
6521  * @remark      None
6522  * @see         bluetooth_set_custom_advertising
6523  */
6524 int bluetooth_remove_allow_list(bluetooth_device_address_t *address, bluetooth_device_address_type_t address_type);
6525
6526 /**
6527  * @fn int bluetooth_clear_allow_list(void)
6528  * @brief Clear allow list
6529  *
6530  * This API is used to clear allow list
6531  * Before calling this API, make sure that the adapter is enabled. There is no callback event for
6532  * this API.
6533  *
6534  *
6535  * This function is a synchronous call.
6536  *
6537  * @param[in] address The address of remote device
6538  *
6539  * @return      BLUETOOTH_ERROR_NONE - Success \n
6540  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
6541  *
6542  * @remark      None
6543  * @see         bluetooth_set_custom_advertising
6544  */
6545 int bluetooth_clear_allow_list(void);
6546
6547 /**
6548  * @fn int bluetooth_le_conn_update(bluetooth_device_address_t *address,
6549  *          const bluetooth_le_connection_param_t *parameters)
6550  * @brief update connection paramter of LE connection.
6551  *
6552  * This function is a synchronous call.
6553  *
6554  * @return   BLUETOOTH_ERROR_NONE  - Success \n
6555  *           BLUETOOTH_ERROR_INTERNAL - Internal Error \n
6556  *
6557  * @exception  None
6558  * @param[in]  address - remote device address value.
6559  * @param[in]  parameters - new connection parameters.
6560  *
6561  * @remark       None
6562  * @see     bluetooth_bond_device
6563  */
6564 int bluetooth_le_conn_update(const bluetooth_device_address_t *address,
6565                 const bluetooth_le_connection_param_t *parameters);
6566
6567 /**
6568  * @fn int bluetooth_enable_le_privacy(gboolean enable_privacy);
6569  *
6570  * @brief Enable/Disable LE Privacy feature.
6571  *
6572  * This function is used to enable or disable LE Privacy feature.
6573  * Once Privacy feature is enabled, Adapter can use Random Address for more security.
6574  *
6575  * This function is a synchronous call.
6576  *
6577  * @return      BLUETOOTH_ERROR_NONE - Success \n
6578  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
6579  *              BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
6580  *
6581  * @exception   None
6582  * @param[in]   enable_privacy - The status of Privacy feature to be activated/deactivated[True/False].
6583  *
6584  * @remark      None
6585  */
6586 int bluetooth_enable_le_privacy(gboolean enable_privacy);
6587
6588 /**
6589  * @fn int bluetooth_set_le_static_random_address(gboolean enable);
6590  *
6591  * @brief Enable/Disable LE static random address.
6592  *
6593  * This function is used to enable or disable LE static random address.
6594  *
6595  * This function is a synchronous call.
6596  *
6597  * @return      BLUETOOTH_ERROR_NONE - Success \n
6598  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
6599  *              BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
6600  *
6601  * @exception   None
6602  * @param[in]   enable - The status of LE static random address to be activated/deactivated[True/False].
6603  *
6604  * @remark      None
6605  */
6606 int bluetooth_set_le_static_random_address(gboolean enable);
6607
6608 /**
6609  * @fn int bluetooth_update_le_connection_mode(bluetooth_device_address_t *address,
6610  *                                             bluetooth_le_connection_mode_t mode)
6611  * @brief update connection paramter of LE connection.
6612  *
6613  * This function is a synchronous call.
6614  *
6615  * @return   BLUETOOTH_ERROR_NONE  - Success \n
6616  *           BLUETOOTH_ERROR_INTERNAL - Internal Error \n
6617  *           BLUETOOTH_ERROR_INVALID_PARAM - Parameter is not valid \n
6618  *
6619  * @exception  None
6620  * @param[in]  address - remote device address value.
6621  * @param[in]  mode - new connection mode.
6622  *
6623  * @remark       None
6624  */
6625 int bluetooth_update_le_connection_mode(const bluetooth_device_address_t *address,
6626                 bluetooth_le_connection_mode_t mode);
6627
6628 /**
6629  * @fn int bluetooth_request_att_mtu(const bluetooth_device_address_t *device_address, guint16 mtu)
6630  * @brief Request for new ATT MTU value.
6631  *
6632  * This function is a asynchronous call.
6633  *
6634  * @return   BLUETOOTH_ERROR_NONE  - Success \n
6635  *           BLUETOOTH_ERROR_INTERNAL - Internal Error \n
6636  *           BLUETOOTH_ERROR_INVALID_PARAM - Parameter is not valid \n
6637  *
6638  * @exception  None
6639  * @param[in]  address - remote device address value.
6640  * @param[in]  mtu - MTU value to be set.
6641  *
6642  * @remark       None
6643  */
6644 int bluetooth_request_att_mtu(const bluetooth_device_address_t *device_address, unsigned int mtu);
6645
6646 /**
6647  * @fn int bluetooth_get_att_mtu(const bluetooth_device_address_t *device_address,
6648  *                              unsigned int *mtu)
6649  * @brief Gets the xisting MTU value set for a connection.
6650  *
6651  * This function is a synchronous call.
6652  *
6653  * @return       BLUETOOTH_ERROR_NONE  - Success \n
6654  *                       BLUETOOTH_ERROR_INTERNAL - Internal Error \n
6655  *                       BLUETOOTH_ERROR_INVALID_PARAM - Parameter is not valid \n
6656  *
6657  * @exception  None
6658  * @param[in]  address - remote device address value.
6659  * @param[out]  mtu - MTU value set for the connection.
6660  *
6661  * @remark               None
6662  */
6663 int bluetooth_get_att_mtu(const bluetooth_device_address_t *device_address,
6664                                 unsigned int *mtu);
6665
6666 /**
6667  * @fn int bluetooth_get_device_ida(const bluetooth_device_address_t *device_rpa,
6668  *                                      bluetooth_device_address_t *id_address)
6669  * @brief Gets the Identity address of remote device.
6670  *
6671  * This function is a synchronous call.
6672  *
6673  * @return              BLUETOOTH_ERROR_NONE  - Success \n
6674  *                      BLUETOOTH_ERROR_INTERNAL - Internal Error \n
6675  *                      BLUETOOTH_ERROR_INVALID_PARAM - Parameter is not valid \n
6676  *
6677  * @exception  None
6678  * @param[in]  device_rpa - remote Resolvable private address.
6679  * @param[out] id_address - remote Identity device address value.
6680  *
6681  * @remark               None
6682  */
6683 int bluetooth_get_device_ida(const bluetooth_device_address_t *device_rpa,
6684         bluetooth_device_address_t *id_address);
6685
6686 /**
6687  * @fn int bluetooth_le_read_maximum_data_length()
6688  * @brief reads the maximum LE data length supported in the controller.
6689  *
6690  * This function is a synchronous call.
6691  *
6692  * @return   BLUETOOTH_ERROR_NONE  - Success \n
6693  *           BLUETOOTH_ERROR_INTERNAL - Internal Error \n
6694  *
6695  * @exception  None
6696  *
6697  * @remark       None
6698  */
6699 int bluetooth_le_read_maximum_data_length(
6700                         bluetooth_le_read_maximum_data_length_t *max_le_datalength);
6701 /**
6702  * @fn int bluetooth_le_write_host_suggested_default_data_length()
6703  * @brief writes the host suggested values for the controllers max transmitted no of payload
6704  * octects to be used for new connections.
6705  *
6706  * This function is a synchronous call.
6707  *
6708  * @return   BLUETOOTH_ERROR_NONE  - Success \n
6709  *           BLUETOOTH_ERROR_INTERNAL - Internal Error \n
6710  *
6711  * @exception  None
6712  *
6713  * @remark       None
6714  */
6715 int bluetooth_le_write_host_suggested_default_data_length(
6716                 const unsigned int def_tx_Octets, const unsigned int def_tx_Time);
6717
6718 int bluetooth_le_read_suggested_default_data_length(
6719         bluetooth_le_read_host_suggested_data_length_t *le_data_length);
6720
6721 int bluetooth_le_set_data_length(bluetooth_device_address_t *address,
6722         const unsigned int max_tx_octets, const unsigned int max_tx_time);
6723
6724 int bluetooth_pbap_init(void);
6725 int bluetooth_pbap_deinit(void);
6726 int bluetooth_pbap_connect(const bluetooth_device_address_t *address);
6727 int bluetooth_pbap_disconnect(const bluetooth_device_address_t *address);
6728 int bluetooth_pbap_get_phonebook_size(const bluetooth_device_address_t *address,
6729                 bt_pbap_folder_t *folder);
6730 int bluetooth_pbap_get_phonebook(const bluetooth_device_address_t *address,
6731                 bt_pbap_folder_t *folder, bt_pbap_pull_parameters_t *app_param);
6732 int bluetooth_pbap_get_list(const bluetooth_device_address_t *address,
6733                 bt_pbap_folder_t *folder, bt_pbap_list_parameters_t *app_param);
6734 int bluetooth_pbap_pull_vcard(const bluetooth_device_address_t *address,
6735                 bt_pbap_folder_t *folder, bt_pbap_pull_vcard_parameters_t *app_param);
6736 int bluetooth_pbap_phonebook_search(const bluetooth_device_address_t *address,
6737                 bt_pbap_folder_t *folder, bt_pbap_search_parameters_t *app_param);
6738
6739 /**
6740  * @fn int bluetooth_set_manufacturer_data(const bluetooth_manufacturer_data_t *value);
6741  *
6742  * @brief Set manufacturer data with value
6743  *
6744  * This function is used to set manufacturer data.
6745  *
6746  * This function is a synchronous call.
6747  *
6748  * @return      BLUETOOTH_ERROR_NONE - Success \n
6749  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
6750  *              BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
6751  *
6752  * @exception   None
6753  * @param[in]   value - Manufacturer data structure.
6754  *
6755  * @remark      None
6756  */
6757 int bluetooth_set_manufacturer_data(const bluetooth_manufacturer_data_t *value);
6758
6759 int bluetooth_set_passkey_notification(gboolean enable);
6760
6761 /**
6762  * @fn int bluetooth_dpm_is_mode_allowed(void);
6763  *
6764  * @brief Checks Restriction for BT mode(BT allowed or not)
6765  *
6766  * This function is a synchronous call.
6767  *
6768  * @return      BLUETOOTH_DPM_RESULT_SUCCESS - Success \n
6769  *              BLUETOOTH_DPM_RESULT_ACCESS_DENIED - BT restricted \n
6770  *              BLUETOOTH_DPM_RESULT_FAIL - Internal error \n
6771  *
6772  * @exception   None
6773  *  @param[in] None
6774  *
6775  * @remark      None
6776  */
6777 int bluetooth_dpm_is_mode_allowed(void);
6778
6779 /**
6780  * @fn int bluetooth_dpm_set_allow_mode(bt_dpm_allow_t value);
6781  *
6782  * @brief Sets Restriction for BT mode(BT allowed or not)
6783  *
6784  * This function is a synchronous call.
6785  *
6786  * @return      BLUETOOTH_DPM_RESULT_SUCCESS - Success \n
6787  *              BLUETOOTH_DPM_RESULT_ACCESS_DENIED - BT restricted \n
6788  *              BLUETOOTH_DPM_RESULT_FAIL - Internal error \n
6789  *
6790  * @exception   None
6791  * @param[in]   value - BT Allow value.
6792  *              BLUETOOTH_DPM_ERROR  = -1,       < bluetooth allowance error
6793  *              BLUETOOTH_DPM_BT_ALLOWED,                < bluetooth allowance allowed
6794  *              BLUETOOTH_DPM_HANDSFREE_ONLY,  < bluetooth allowance handsfree only
6795  *              BLUETOOTH_DPM_BT_RESTRICTED,  < bluetooth allowance restricted
6796  *
6797  * @remark      None
6798  */
6799 int bluetooth_dpm_set_allow_mode(bt_dpm_allow_t value);
6800
6801 /**
6802  * @fn int bluetooth_dpm_get_allow_mode(bt_dpm_allow_t value);
6803  *
6804  * @brief Reads the Restriction for BT mode(BT allowed or not)
6805  *
6806  * This function is a synchronous call.
6807  *
6808  * @return      BLUETOOTH_DPM_RESULT_SUCCESS - Success \n
6809  *              BLUETOOTH_DPM_RESULT_ACCESS_DENIED - BT restricted \n
6810  *              BLUETOOTH_DPM_RESULT_FAIL - Internal error \n
6811  *
6812  * @exception   None
6813  *  @param[in] None
6814  * @param[out]  value - BT Allow value.
6815  *              BLUETOOTH_DPM_ERROR      = -1,   < bluetooth allowance error
6816  *              BLUETOOTH_DPM_BT_ALLOWED,                < bluetooth allowance allowed
6817  *              BLUETOOTH_DPM_HANDSFREE_ONLY,  < bluetooth allowance handsfree only
6818  *              BLUETOOTH_DPM_BT_RESTRICTED,  < bluetooth allowance restricted
6819  *
6820  * @remark      None
6821  */
6822 int bluetooth_dpm_get_allow_mode(bt_dpm_allow_t *value);
6823
6824 /**
6825  * @fn int bluetooth_dpm_activate_device_restriction(bt_dpm_status_t value);
6826  *
6827  * @brief Sets the Restriction for device.
6828  *
6829  * This function is a synchronous call.
6830  *
6831  * @return      BLUETOOTH_DPM_RESULT_SUCCESS - Success \n
6832  *              BLUETOOTH_DPM_RESULT_ACCESS_DENIED - BT restricted \n
6833  *              BLUETOOTH_DPM_RESULT_FAIL - Internal error \n
6834  *
6835  * @exception   None
6836  * @param[in]   value - State value.
6837  *              BLUETOOTH_DPM_ALLOWED           = 0,    < DPM Policy status allowed.
6838  *              BLUETOOTH_DPM_RESTRICTED                = 1,    < DPM Policy status restricted.
6839  *
6840  * @remark      None
6841  */
6842 int bluetooth_dpm_activate_device_restriction(bt_dpm_status_t value);
6843
6844 /**
6845  * @fn int bluetooth_dpm_is_device_restriction_active(bt_dpm_status_t *value);
6846  *
6847  * @brief Reads the Restriction for device.
6848  *
6849  * This function is a synchronous call.
6850  *
6851  * @return      BLUETOOTH_DPM_RESULT_SUCCESS - Success \n
6852  *              BLUETOOTH_DPM_RESULT_ACCESS_DENIED - BT restricted \n
6853  *              BLUETOOTH_DPM_RESULT_FAIL - Internal error \n
6854  *
6855  * @exception   None
6856  * @param[in] None
6857  * @param[out]  value - State value.
6858  *              BLUETOOTH_DPM_ALLOWED           = 0,    < DPM Policy status allowed.
6859  *              BLUETOOTH_DPM_RESTRICTED                = 1,    < DPM Policy status restricted.
6860  *
6861  * @remark      None
6862  */
6863 int bluetooth_dpm_is_device_restriction_active(bt_dpm_status_t *value);
6864
6865 /**
6866  * @fn int bluetooth_dpm_activate_bluetoooth_uuid_restriction(bt_dpm_status_t value);
6867  *
6868  * @brief Sets the Restriction for uuid.
6869  *
6870  * This function is a synchronous call.
6871  *
6872  * @return      BLUETOOTH_DPM_RESULT_SUCCESS - Success \n
6873  *              BLUETOOTH_DPM_RESULT_ACCESS_DENIED - BT restricted \n
6874  *              BLUETOOTH_DPM_RESULT_FAIL - Internal error \n
6875  *
6876  * @exception   None
6877  * @param[in]   value - State value.
6878  *              BLUETOOTH_DPM_ALLOWED           = 0,    < DPM Policy status allowed.
6879  *              BLUETOOTH_DPM_RESTRICTED                = 1,    < DPM Policy status restricted.
6880  *
6881  * @remark      None
6882  */
6883 int bluetooth_dpm_activate_uuid_restriction(bt_dpm_status_t value);
6884
6885 /**
6886  * @fn int bluetooth_dpm_is_uuid_restriction_active(bt_dpm_status_t *value);
6887  *
6888  * @brief Reads the Restriction for uuid.
6889  *
6890  * This function is a synchronous call.
6891  *
6892  * @return      BLUETOOTH_DPM_RESULT_SUCCESS - Success \n
6893  *              BLUETOOTH_DPM_RESULT_ACCESS_DENIED - BT restricted \n
6894  *              BLUETOOTH_DPM_RESULT_FAIL - Internal error \n
6895  *
6896  * @exception   None
6897  * @param[in] None
6898  * @param[out]  value - State value.
6899  *              BLUETOOTH_DPM_ALLOWED           = 0,    < DPM Policy status allowed.
6900  *              BLUETOOTH_DPM_RESTRICTED                = 1,    < DPM Policy status restricted.
6901  *
6902  * @remark      None
6903  */
6904 int bluetooth_dpm_is_uuid_restriction_active(bt_dpm_status_t *value);
6905
6906 /**
6907  * @fn int bluetooth_dpm_add_devices_to_blocklist(const bluetooth_device_address_t *device_address);
6908  *
6909  * @brief Adds the device to blocklist.
6910  *
6911  * This function is a synchronous call.
6912  *
6913  * @return      BLUETOOTH_DPM_RESULT_SUCCESS - Success \n
6914  *              BLUETOOTH_DPM_RESULT_ACCESS_DENIED - BT restricted \n
6915  *              BLUETOOTH_DPM_RESULT_FAIL - Internal error \n
6916  *
6917  * @exception   None
6918  * @param[in]   device_address - Device address
6919  *
6920  * @remark      None
6921  */
6922 int bluetooth_dpm_add_devices_to_blocklist(const bluetooth_device_address_t *device_address);
6923
6924 /**
6925  * @fn int bluetooth_dpm_add_devices_to_allowlist(const bluetooth_device_address_t *device_address);
6926  *
6927  * @brief Adds the device to allowlist.
6928  *
6929  * This function is a synchronous call.
6930  *
6931  * @return      BLUETOOTH_DPM_RESULT_SUCCESS - Success \n
6932  *              BLUETOOTH_DPM_RESULT_ACCESS_DENIED - BT restricted \n
6933  *              BLUETOOTH_DPM_RESULT_FAIL - Internal error \n
6934  *
6935  * @exception   None
6936  * @param[in]   device_address - Device address
6937  *
6938  * @remark      None
6939  */
6940 int bluetooth_dpm_add_devices_to_allowlist(const bluetooth_device_address_t *device_address);
6941
6942 /**
6943  * @fn int bluetooth_dpm_add_uuids_to_blocklist(const char *service_uuid);
6944  *
6945  * @brief Adds the Service UUIDS to blocklist.
6946  *
6947  * This function is a synchronous call.
6948  *
6949  * @return      BLUETOOTH_DPM_RESULT_SUCCESS - Success \n
6950  *              BLUETOOTH_DPM_RESULT_ACCESS_DENIED - BT restricted \n
6951  *              BLUETOOTH_DPM_RESULT_FAIL - Internal error \n
6952  *
6953  * @exception   None
6954  * @param[in]   service_uuids - profile or custom service uuids
6955  *
6956  * @remark      None
6957  */
6958 int bluetooth_dpm_add_uuids_to_blocklist(const char *service_uuid);
6959
6960 /**
6961  * @fn int bluetooth_dpm_add_uuids_to_allowlist(const char *service_uuid);
6962  *
6963  * @brief Adds the Service UUIDS to allowlist.
6964  *
6965  * This function is a synchronous call.
6966  *
6967  * @return      BLUETOOTH_DPM_RESULT_SUCCESS - Success \n
6968  *              BLUETOOTH_DPM_RESULT_ACCESS_DENIED - BT restricted \n
6969  *              BLUETOOTH_DPM_RESULT_FAIL - Internal error \n
6970  *
6971  * @exception   None
6972  * @param[in]   service_uuids - profile or custom service uuids
6973  *
6974  * @remark      None
6975  */
6976 int bluetooth_dpm_add_uuids_to_allowlist(const char *service_uuid);
6977
6978 /**
6979  * @fn int bluetooth_dpm_clear_devices_from_blocklist();
6980  *
6981  * @brief Clears the devices from blocklist.
6982  *
6983  * This function is a synchronous call.
6984  *
6985  * @return      BLUETOOTH_DPM_RESULT_SUCCESS - Success \n
6986  *              BLUETOOTH_DPM_RESULT_ACCESS_DENIED - BT restricted \n
6987  *              BLUETOOTH_DPM_RESULT_FAIL - Internal error \n
6988  *
6989  * @exception   None
6990  * @param[in]   None
6991  *
6992  * @remark      None
6993  */
6994 int bluetooth_dpm_clear_devices_from_blocklist(void);
6995
6996 /**
6997  * @fn int bluetooth_dpm_clear_devices_from_allowlist();
6998  *
6999  * @brief Clears the devices from allowlist.
7000  *
7001  * This function is a synchronous call.
7002  *
7003  * @return      BLUETOOTH_DPM_RESULT_SUCCESS - Success \n
7004  *              BLUETOOTH_DPM_RESULT_ACCESS_DENIED - BT restricted \n
7005  *              BLUETOOTH_DPM_RESULT_FAIL - Internal error \n
7006  *
7007  * @exception   None
7008  * @param[in]   None
7009  *
7010  * @remark      None
7011  */
7012 int bluetooth_dpm_clear_devices_from_allowlist(void);
7013
7014 /**
7015  * @fn int bluetooth_dpm_clear_uuids_from_blocklist();
7016  *
7017  * @brief Clears the uuids from blocklist.
7018  *
7019  * This function is a synchronous call.
7020  *
7021  * @return      BLUETOOTH_DPM_RESULT_SUCCESS - Success \n
7022  *              BLUETOOTH_DPM_RESULT_ACCESS_DENIED - BT restricted \n
7023  *              BLUETOOTH_DPM_RESULT_FAIL - Internal error \n
7024  *
7025  * @exception   None
7026  * @param[in]   None
7027  *
7028  * @remark      None
7029  */
7030 int bluetooth_dpm_clear_uuids_from_blocklist(void);
7031
7032 /**
7033  * @fn int bluetooth_dpm_clear_uuids_from_allowlist();
7034  *
7035  * @brief Clears the uuids from allowlist.
7036  *
7037  * This function is a synchronous call.
7038  *
7039  * @return      BLUETOOTH_DPM_RESULT_SUCCESS - Success \n
7040  *              BLUETOOTH_DPM_RESULT_ACCESS_DENIED - BT restricted \n
7041  *              BLUETOOTH_DPM_RESULT_FAIL - Internal error \n
7042  *
7043  * @exception   None
7044  * @param[in]   None
7045  *
7046  * @remark      None
7047  */
7048 int bluetooth_dpm_clear_uuids_from_allowlist(void);
7049
7050 /**
7051  * @fn int bluetooth_dpm_get_devices_from_blocklist(bt_dpm_device_list_t *device_list);
7052  *
7053  * @brief reads the devices from blocklist.
7054  *
7055  * This function is a synchronous call.
7056  *
7057  * @return      BLUETOOTH_DPM_RESULT_SUCCESS - Success \n
7058  *              BLUETOOTH_DPM_RESULT_ACCESS_DENIED - BT restricted \n
7059  *              BLUETOOTH_DPM_RESULT_FAIL - Internal error \n
7060  *
7061  * @exception   None
7062  * @param[out]  device_list - list of devices
7063  *
7064  * @remark      None
7065  */
7066 int bluetooth_dpm_get_devices_from_blocklist(bt_dpm_device_list_t *device_list);
7067
7068 /**
7069  * @fn int bluetooth_dpm_get_devices_from_allowlist(bt_dpm_device_list_t *device_list);
7070  *
7071  * @brief reads the devices from allowlist.
7072  *
7073  * This function is a synchronous call.
7074  *
7075  * @return      BLUETOOTH_DPM_RESULT_SUCCESS - Success \n
7076  *              BLUETOOTH_DPM_RESULT_ACCESS_DENIED - BT restricted \n
7077  *              BLUETOOTH_DPM_RESULT_FAIL - Internal error \n
7078  *
7079  * @exception   None
7080  * @param[out]  device_list - list of devices
7081  *
7082  * @remark      None
7083  */
7084 int bluetooth_dpm_get_devices_from_allowlist(bt_dpm_device_list_t *device_list);
7085
7086 /**
7087  * @fn int bluetooth_dpm_get_uuids_from_blocklist(bt_dpm_uuids_list_t *uuid_list);
7088  *
7089  * @brief reads the uuids from blocklist.
7090  *
7091  * This function is a synchronous call.
7092  *
7093  * @return      BLUETOOTH_DPM_RESULT_SUCCESS - Success \n
7094  *              BLUETOOTH_DPM_RESULT_ACCESS_DENIED - BT restricted \n
7095  *              BLUETOOTH_DPM_RESULT_FAIL - Internal error \n
7096  *
7097  * @exception   None
7098  * @param[in]   uuid_list - list of uuids
7099  *
7100  * @remark      None
7101  */
7102 int bluetooth_dpm_get_uuids_from_blocklist(bt_dpm_uuids_list_t *uuid_list);
7103
7104 /**
7105  * @fn int bluetooth_dpm_get_uuids_from_allowlist(bt_dpm_uuids_list_t *uuid_list);
7106  *
7107  * @brief reads the uuids from allowlist.
7108  *
7109  * This function is a synchronous call.
7110  *
7111  * @return      BLUETOOTH_DPM_RESULT_SUCCESS - Success \n
7112  *              BLUETOOTH_DPM_RESULT_ACCESS_DENIED - BT restricted \n
7113  *              BLUETOOTH_DPM_RESULT_FAIL - Internal error \n
7114  *
7115  * @exception   None
7116  * @param[in]   uuid_list - list of uuids
7117  *
7118  * @remark      None
7119  */
7120 int bluetooth_dpm_get_uuids_from_allowlist(bt_dpm_uuids_list_t *uuid_list);
7121
7122 /**
7123  * @fn int bluetooth_dpm_remove_device_from_allowlist(const bluetooth_device_address_t *device_address);
7124  *
7125  * @brief Removes the device from allowlist.
7126  *
7127  * This function is a synchronous call.
7128  *
7129  * @return      BLUETOOTH_DPM_RESULT_SUCCESS - Success \n
7130  *              BLUETOOTH_DPM_RESULT_ACCESS_DENIED - BT restricted \n
7131  *              BLUETOOTH_DPM_RESULT_FAIL - Internal error \n
7132  *
7133  * @exception   None
7134  * @param[in]   device_address - Device address
7135  *
7136  * @remark      None
7137  */
7138 int bluetooth_dpm_remove_device_from_allowlist(const bluetooth_device_address_t *device_address);
7139
7140 /**
7141  * @fn int bluetooth_dpm_remove_device_from_blocklist(const bluetooth_device_address_t *device_address);
7142  *
7143  * @brief Removes the device from blocklist.
7144  *
7145  * This function is a synchronous call.
7146  *
7147  * @return      BLUETOOTH_DPM_RESULT_SUCCESS - Success \n
7148  *              BLUETOOTH_DPM_RESULT_ACCESS_DENIED - BT restricted \n
7149  *              BLUETOOTH_DPM_RESULT_FAIL - Internal error \n
7150  *
7151  * @exception   None
7152  * @param[in]   device_address - Device address
7153  *
7154  * @remark      None
7155  */
7156 int bluetooth_dpm_remove_device_from_blocklist(const bluetooth_device_address_t *device_address);
7157
7158 /**
7159  * @fn int bluetooth_dpm_remove_uuid_from_allowlist(const char *service_uuid);
7160  *
7161  * @brief Removes the Service UUIDS from allowlist.
7162  *
7163  * This function is a synchronous call.
7164  *
7165  * @return      BLUETOOTH_DPM_RESULT_SUCCESS - Success \n
7166  *              BLUETOOTH_DPM_RESULT_ACCESS_DENIED - BT restricted \n
7167  *              BLUETOOTH_DPM_RESULT_FAIL - Internal error \n
7168  *
7169  * @exception   None
7170  * @param[in]   service_uuids - profile or custom service uuids
7171  *
7172  * @remark      None
7173  */
7174 int bluetooth_dpm_remove_uuid_from_allowlist(const char *service_uuid);
7175
7176 /**
7177  * @fn int bluetooth_dpm_remove_uuid_from_blocklist(const char *service_uuid);
7178  *
7179  *
7180  * @brief Removes the Service UUIDS from blocklist.
7181  *
7182  * This function is a synchronous call.
7183  *
7184  * @return      BLUETOOTH_DPM_RESULT_SUCCESS - Success \n
7185  *              BLUETOOTH_DPM_RESULT_ACCESS_DENIED - BT restricted \n
7186  *              BLUETOOTH_DPM_RESULT_FAIL - Internal error \n
7187  *
7188  * @exception   None
7189  * @param[in]   service_uuids - profile or custom service uuids
7190  *
7191  * @remark      None
7192  */
7193 int bluetooth_dpm_remove_uuid_from_blocklist(const char *service_uuid);
7194
7195 /**
7196  * @fn int bluetooth_dpm_set_allow_outgoing_call(bt_dpm_status_t value);
7197  *
7198  * @brief Sets the Restriction for outgoing call.
7199  *
7200  * This function is a synchronous call.
7201  *
7202  * @return      BLUETOOTH_DPM_RESULT_SUCCESS - Success \n
7203  *              BLUETOOTH_DPM_RESULT_ACCESS_DENIED - BT restricted \n
7204  *              BLUETOOTH_DPM_RESULT_FAIL - Internal error \n
7205  *
7206  * @exception   None
7207  * @param[in]   value - State value.
7208  *              BLUETOOTH_DPM_ALLOWED           = 0,    < DPM Policy status allowed.
7209  *              BLUETOOTH_DPM_RESTRICTED                = 1,    < DPM Policy status restricted.
7210  *
7211  * @remark      None
7212  */
7213 int bluetooth_dpm_set_allow_outgoing_call(bt_dpm_status_t value);
7214
7215 /**
7216  * @fn int bluetooth_dpm_get_allow_outgoing_call(bt_dpm_status_t *value);
7217  *
7218  * @brief Reads the Restriction for  outgoing call.
7219  *
7220  * This function is a synchronous call.
7221  *
7222  * @return      BLUETOOTH_DPM_RESULT_SUCCESS - Success \n
7223  *              BLUETOOTH_DPM_RESULT_ACCESS_DENIED - BT restricted \n
7224  *              BLUETOOTH_DPM_RESULT_FAIL - Internal error \n
7225  *
7226  * @exception   None
7227  * @param[in] None
7228  * @param[out]  value - State value.
7229  *              BLUETOOTH_DPM_ALLOWED           = 0,    < DPM Policy status allowed.
7230  *              BLUETOOTH_DPM_RESTRICTED                = 1,    < DPM Policy status restricted.
7231  *
7232  * @remark      None
7233  */
7234 int bluetooth_dpm_get_allow_outgoing_call(bt_dpm_status_t *value);
7235
7236 /**
7237  * @fn int bluetooth_dpm_set_pairing_state(bt_dpm_status_t value);
7238  *
7239  * @brief Sets the Restriction for Pairing.
7240  *
7241  * This function is a synchronous call.
7242  *
7243  * @return      BLUETOOTH_DPM_RESULT_SUCCESS - Success \n
7244  *              BLUETOOTH_DPM_RESULT_ACCESS_DENIED - BT restricted \n
7245  *              BLUETOOTH_DPM_RESULT_FAIL - Internal error \n
7246  *
7247  * @exception   None
7248  * @param[in]   value - State value.
7249  *              BLUETOOTH_DPM_ALLOWED           = 0,    < DPM Policy status allowed.
7250  *              BLUETOOTH_DPM_RESTRICTED                = 1,    < DPM Policy status restricted.
7251  *
7252  * @remark      None
7253  */
7254 int bluetooth_dpm_set_pairing_state(bt_dpm_status_t value);
7255
7256 /**
7257  * @fn int bluetooth_dpm_get_pairing_state(bt_dpm_status_t *value);
7258  *
7259  * @brief Reads the Restriction for Pairing
7260  *
7261  * This function is a synchronous call.
7262  *
7263  * @return      BLUETOOTH_DPM_RESULT_SUCCESS - Success \n
7264  *              BLUETOOTH_DPM_RESULT_ACCESS_DENIED - BT restricted \n
7265  *              BLUETOOTH_DPM_RESULT_FAIL - Internal error \n
7266  *
7267  * @exception   None
7268  * @param[in] None
7269  * @param[out]  value - State value.
7270  *              BLUETOOTH_DPM_ALLOWED           = 0,    < DPM Policy status allowed.
7271  *              BLUETOOTH_DPM_RESTRICTED                = 1,    < DPM Policy status restricted.
7272  *
7273  * @remark      None
7274  */
7275 int bluetooth_dpm_get_pairing_state(bt_dpm_status_t *value);
7276
7277 /**
7278  * @fnint bluetooth_dpm_set_profile_state(bt_dpm_profile_t profile, bt_dpm_status_t value);
7279  *
7280  * @brief Sets the Restriction for using Profiles.
7281  *
7282  * This function is a synchronous call.
7283  *
7284  * @return      BLUETOOTH_DPM_RESULT_SUCCESS - Success \n
7285  *              BLUETOOTH_DPM_RESULT_ACCESS_DENIED - BT restricted \n
7286  *              BLUETOOTH_DPM_RESULT_FAIL - Internal error \n
7287  *
7288  * @exception   None
7289  * @param[in]profile - Profile.
7290  *              BLUETOOTH_DPM_POLICY_A2DP_PROFILE_STATE,
7291  *              BLUETOOTH_DPM_POLICY_AVRCP_PROFILE_STATE,
7292  *              BLUETOOTH_DPM_POLICY_BPP_PROFILE_STATE,
7293  *              BLUETOOTH_DPM_POLICY_DUN_PROFILE_STATE,
7294  *              BLUETOOTH_DPM_POLICY_FTP_PROFILE_STATE,
7295  *              BLUETOOTH_DPM_POLICY_HFP_PROFILE_STATE,
7296  *              BLUETOOTH_DPM_POLICY_HSP_PROFILE_STATE,
7297  *              BLUETOOTH_DPM_POLICY_PBAP_PROFILE_STATE,
7298  *              BLUETOOTH_DPM_POLICY_SAP_PROFILE_STATE,
7299  *              BLUETOOTH_DPM_POLICY_SPP_PROFILE_STATE,
7300  *              BLUETOOTH_DPM_PROFILE_NONE
7301  * @param[in]   value - State value.
7302  *              BLUETOOTH_DPM_ALLOWED           = 0,    < DPM Policy status allowed.
7303  *              BLUETOOTH_DPM_RESTRICTED                = 1,    < DPM Policy status restricted.
7304  *
7305  * @remark      None
7306  */
7307 int bluetooth_dpm_set_profile_state(bt_dpm_profile_t profile, bt_dpm_status_t value);
7308
7309 /**
7310  * @fn int bluetooth_dpm_get_profile_state(bt_dpm_profile_t profile, bt_dpm_status_t *value);
7311  *
7312  * @brief Reads the Restriction for using Profiles.
7313  *
7314  * This function is a synchronous call.
7315  *
7316  * @return      BLUETOOTH_DPM_RESULT_SUCCESS - Success \n
7317  *              BLUETOOTH_DPM_RESULT_ACCESS_DENIED - BT restricted \n
7318  *              BLUETOOTH_DPM_RESULT_FAIL - Internal error \n
7319  *
7320  * @exception   None
7321  * @param[in]profile - Profile.
7322  *              BLUETOOTH_DPM_POLICY_A2DP_PROFILE_STATE,
7323  *              BLUETOOTH_DPM_POLICY_AVRCP_PROFILE_STATE,
7324  *              BLUETOOTH_DPM_POLICY_BPP_PROFILE_STATE,
7325  *              BLUETOOTH_DPM_POLICY_DUN_PROFILE_STATE,
7326  *              BLUETOOTH_DPM_POLICY_FTP_PROFILE_STATE,
7327  *              BLUETOOTH_DPM_POLICY_HFP_PROFILE_STATE,
7328  *              BLUETOOTH_DPM_POLICY_HSP_PROFILE_STATE,
7329  *              BLUETOOTH_DPM_POLICY_PBAP_PROFILE_STATE,
7330  *              BLUETOOTH_DPM_POLICY_SAP_PROFILE_STATE,
7331  *              BLUETOOTH_DPM_POLICY_SPP_PROFILE_STATE,
7332  *              BLUETOOTH_DPM_PROFILE_NONE
7333  * @param[out]  value - State value.
7334  *              BLUETOOTH_DPM_ALLOWED           = 0,    < DPM Policy status allowed.
7335  *              BLUETOOTH_DPM_RESTRICTED                = 1,    < DPM Policy status restricted.
7336  *
7337  * @remark      None
7338  */
7339 int bluetooth_dpm_get_profile_state(bt_dpm_profile_t profile, bt_dpm_status_t *value);
7340
7341 /**
7342  * @fn int bluetooth_dpm_set_desktop_connectivity_state(bt_dpm_status_t value);
7343  *
7344  * @brief Sets the Restriction for Desktop Connectivity.
7345  *
7346  * This function is a synchronous call.
7347  *
7348  * @return      BLUETOOTH_DPM_RESULT_SUCCESS - Success \n
7349  *              BLUETOOTH_DPM_RESULT_ACCESS_DENIED - BT restricted \n
7350  *              BLUETOOTH_DPM_RESULT_FAIL - Internal error \n
7351  *
7352  * @exception   None
7353  * @param[in]   value - State value.
7354  *              BLUETOOTH_DPM_ALLOWED           = 0,    < DPM Policy status allowed.
7355  *              BLUETOOTH_DPM_RESTRICTED                = 1,    < DPM Policy status restricted.
7356  *
7357  * @remark      None
7358  */
7359 int bluetooth_dpm_set_desktop_connectivity_state(bt_dpm_status_t value);
7360
7361 /**
7362  * @fn int bluetooth_dpm_get_desktop_connectivity_state(bt_dpm_status_t *value);
7363  *
7364  * @brief Reads the Restriction for Desktop Connectivity.
7365  *
7366  * This function is a synchronous call.
7367  *
7368  * @return      BLUETOOTH_DPM_RESULT_SUCCESS - Success \n
7369  *              BLUETOOTH_DPM_RESULT_ACCESS_DENIED - BT restricted \n
7370  *              BLUETOOTH_DPM_RESULT_FAIL - Internal error \n
7371  *
7372  * @exception   None
7373  * @param[in] None
7374  * @param[out]  value - State value.
7375  *              BLUETOOTH_DPM_ALLOWED           = 0,    < DPM Policy status allowed.
7376  *              BLUETOOTH_DPM_RESTRICTED                = 1,    < DPM Policy status restricted.
7377  *
7378  * @remark      None
7379  */
7380 int bluetooth_dpm_get_desktop_connectivity_state(bt_dpm_status_t *value);
7381
7382 /**
7383  * @fn int bluetooth_dpm_set_discoverable_state(bt_dpm_status_t value);
7384  *
7385  * @brief Sets the Restriction for Discoverable state.
7386  *
7387  * This function is a synchronous call.
7388  *
7389  * @return      BLUETOOTH_DPM_RESULT_SUCCESS - Success \n
7390  *              BLUETOOTH_DPM_RESULT_ACCESS_DENIED - BT restricted \n
7391  *              BLUETOOTH_DPM_RESULT_FAIL - Internal error \n
7392  *
7393  * @exception   None
7394  * @param[in]   value - State value.
7395  *              BLUETOOTH_DPM_ALLOWED           = 0,    < DPM Policy status allowed.
7396  *              BLUETOOTH_DPM_RESTRICTED                = 1,    < DPM Policy status restricted.
7397  *
7398  * @remark      None
7399  */
7400 int bluetooth_dpm_set_discoverable_state(bt_dpm_status_t value);
7401
7402 /**
7403  * @fn int bluetooth_dpm_get_discoverable_state(bt_dpm_status_t *value);
7404  *
7405  * @brief Reads the Restriction for Discoverable state.
7406  *
7407  * This function is a synchronous call.
7408  *
7409  * @return      BLUETOOTH_DPM_RESULT_SUCCESS - Success \n
7410  *              BLUETOOTH_DPM_RESULT_ACCESS_DENIED - BT restricted \n
7411  *              BLUETOOTH_DPM_RESULT_FAIL - Internal error \n
7412  *
7413  * @exception   None
7414  * @param[in] None
7415  * @param[out]  value - State value.
7416  *              BLUETOOTH_DPM_ALLOWED           = 0,    < DPM Policy status allowed.
7417  *              BLUETOOTH_DPM_RESTRICTED                = 1,    < DPM Policy status restricted.
7418  *
7419  * @remark      None
7420  */
7421 int bluetooth_dpm_get_discoverable_state(bt_dpm_status_t *value);
7422
7423 /**
7424  * @fn int bluetooth_dpm_set_limited_discoverable_state(bt_dpm_status_t value);
7425  *
7426  * @brief Sets the Restriction for linited discoverable state..
7427  *
7428  * This function is a synchronous call.
7429  *
7430  * @return      BLUETOOTH_DPM_RESULT_SUCCESS - Success \n
7431  *              BLUETOOTH_DPM_RESULT_ACCESS_DENIED - BT restricted \n
7432  *              BLUETOOTH_DPM_RESULT_FAIL - Internal error \n
7433  *
7434  * @exception   None
7435  * @param[in]   value - State value.
7436  *              BLUETOOTH_DPM_ALLOWED           = 0,    < DPM Policy status allowed.
7437  *              BLUETOOTH_DPM_RESTRICTED                = 1,    < DPM Policy status restricted.
7438  *
7439  * @remark      None
7440  */
7441 int bluetooth_dpm_set_limited_discoverable_state(bt_dpm_status_t value);
7442
7443 /**
7444  * @fn int bluetooth_dpm_get_limited_discoverable_state(bt_dpm_status_t *value);
7445  *
7446  * @brief Reads the Restriction for limited discoverable state.
7447  *
7448  * This function is a synchronous call.
7449  *
7450  * @return      BLUETOOTH_DPM_RESULT_SUCCESS - Success \n
7451  *              BLUETOOTH_DPM_RESULT_ACCESS_DENIED - BT restricted \n
7452  *              BLUETOOTH_DPM_RESULT_FAIL - Internal error \n
7453  *
7454  * @exception   None
7455  * @param[in] None
7456  * @param[out]  value - State value.
7457  *              BLUETOOTH_DPM_ALLOWED           = 0,    < DPM Policy status allowed.
7458  *              BLUETOOTH_DPM_RESTRICTED                = 1,    < DPM Policy status restricted.
7459  *
7460  * @remark      None
7461  */
7462 int bluetooth_dpm_get_limited_discoverable_state(bt_dpm_status_t *value);
7463 /**
7464  * @fn int bluetooth_dpm_set_data_transfer_state(bt_dpm_status_t value);
7465  *
7466  * @brief Sets the Restriction for Data trasnfer.
7467  *
7468  * This function is a synchronous call.
7469  *
7470  * @return      BLUETOOTH_DPM_RESULT_SUCCESS - Success \n
7471  *              BLUETOOTH_DPM_RESULT_ACCESS_DENIED - BT restricted \n
7472  *              BLUETOOTH_DPM_RESULT_FAIL - Internal error \n
7473  *
7474  * @exception   None
7475  * @param[in]   value - State value.
7476  *              BLUETOOTH_DPM_ALLOWED           = 0,    < DPM Policy status allowed.
7477  *              BLUETOOTH_DPM_RESTRICTED                = 1,    < DPM Policy status restricted.
7478  *
7479  * @remark      None
7480  */
7481 int bluetooth_dpm_set_data_transfer_state(bt_dpm_status_t value);
7482
7483
7484 /**
7485  * @fn int bluetooth_dpm_get_data_transfer_state(bt_dpm_status_t *value);
7486  *
7487  * @brief Reads the Restriction for Data trasnfer.
7488  *
7489  * This function is a synchronous call.
7490  *
7491  * @return      BLUETOOTH_DPM_RESULT_SUCCESS - Success \n
7492  *              BLUETOOTH_DPM_RESULT_ACCESS_DENIED - BT restricted \n
7493  *              BLUETOOTH_DPM_RESULT_FAIL - Internal error \n
7494  *
7495  * @exception   None
7496  * @param[in] None
7497  * @param[out]  value - State value.
7498  *              BLUETOOTH_DPM_ALLOWED           = 0,    < DPM Policy status allowed.
7499  *              BLUETOOTH_DPM_RESTRICTED                = 1,    < DPM Policy status restricted.
7500  *
7501  * @remark      None
7502  */
7503 int bluetooth_dpm_get_data_transfer_state(bt_dpm_status_t *value);
7504
7505 /**
7506  * @fn int bluetooth_proximity_monitor_set_property(const bluetooth_device_address_t *device_address,
7507  *                                              bluetooth_pxp_poperty_t property, int value);
7508  *
7509  * @brief Sets the Proximity alert level/properties for monitor role.
7510  *
7511  * This function is a synchronous call.
7512  *
7513  * @return   BLUETOOTH_ERROR_NONE - Success \n
7514  *               BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
7515  *               BLUETOOTH_ERROR_NOT_FOUND - Cannot find the proxy\n
7516  *               BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
7517  *
7518  * @exception   None
7519  * @param[in] device_address remote device address
7520  * @param[in] property proximity profile property
7521  * @param[in] value alert level/property value to be set
7522  * @param[out] None
7523  *
7524  * @remark      None
7525  */
7526 int bluetooth_proximity_monitor_set_property(const bluetooth_device_address_t *device_address,
7527                                                         bluetooth_pxp_poperty_t property, int value);
7528
7529 /**
7530  * @fn int bluetooth_proximity_monitor_get_property(const bluetooth_device_address_t *device_address,
7531  *                                              bluetooth_pxp_poperty_t property, int *value);
7532  *
7533  * @brief Reads the Proximity alert level/properties for monitor role.
7534  *
7535  * This function is a synchronous call.
7536  *
7537  * @return   BLUETOOTH_ERROR_NONE - Success \n
7538  *               BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
7539  *               BLUETOOTH_ERROR_NOT_FOUND - Cannot find the proxy\n
7540  *               BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
7541  *
7542  * @exception   None
7543  * @param[in] device_address remote device address
7544  * @param[in] property proximity profile property
7545  * @param[out] value alert level/property value
7546  *
7547  * @remark      None
7548  */
7549 int bluetooth_proximity_monitor_get_property(const bluetooth_device_address_t *device_address,
7550                                                         bluetooth_pxp_poperty_t property, int *value);
7551
7552 /**
7553  * @fn int bluetooth_proximity_monitor_get_supported_services(const bluetooth_device_address_t *device_address,
7554  *                                              int *services_supported);
7555  *
7556  * @brief Reads the Proximity Monitor profile supported properties/services.
7557  *
7558  * This function is a synchronous call.
7559  *
7560  * @return       BLUETOOTH_ERROR_NONE - Success \n
7561  *                               BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
7562  *                               BLUETOOTH_ERROR_NOT_FOUND - Cannot find the proxy\n
7563  *                               BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
7564  *
7565  * @exception   None
7566  * @param[in] device_address remote device address
7567  * @param[out] services_supported proximity profile property/service
7568  *
7569  * @remark      None
7570  */
7571 int bluetooth_proximity_monitor_get_supported_services(const bluetooth_device_address_t *device_address,
7572                                                         int *services_supported);
7573
7574 /**
7575  * @fn int bluetooth_proximity_reporter_register();
7576  *
7577  * @brief Register all proximity related services in BlueZ.
7578  *
7579  * This function is a synchronous call.
7580  *
7581  * @return       BLUETOOTH_ERROR_NONE - Success \n
7582  *                       BLUETOOTH_ERROR_NOT_FOUND - Cannot find the proxy\n
7583  *
7584  * @exception   None
7585  *
7586  * @remark      None
7587  */
7588 int bluetooth_proximity_reporter_register(void);
7589
7590 /**
7591  * @fn int bluetooth_proximity_reporter_unregister();
7592  *
7593  * @brief Unregister all proximity related services in BlueZ.
7594  *
7595  * This function is a synchronous call.
7596  *
7597  * @return       BLUETOOTH_ERROR_NONE - Success \n
7598  *                       BLUETOOTH_ERROR_NOT_FOUND - Cannot find the proxy\n
7599  *
7600  * @exception   None
7601  *
7602  * @remark      None
7603  */
7604 int bluetooth_proximity_reporter_unregister(void);
7605
7606 /**
7607  * @fn int bluetooth_proximity_reporter_get_property(const bluetooth_device_address_t *device_address,
7608  *                                              bluetooth_pxp_poperty_t property, int *value);
7609  *
7610  * @brief Reads the Proximity alert level/properties for reporter role.
7611  *
7612  * This function is a synchronous call.
7613  *
7614  * @return       BLUETOOTH_ERROR_NONE - Success \n
7615  *                               BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
7616  *                               BLUETOOTH_ERROR_NOT_FOUND - Cannot find the proxy\n
7617  *                               BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
7618  *
7619  * @exception   None
7620  * @param[in] device_address remote device address
7621  * @param[in] property proximity profile property
7622  * @param[out] value alert level/property value
7623  *
7624  * @remark      None
7625  */
7626 int bluetooth_proximity_reporter_get_property(const bluetooth_device_address_t *device_address,
7627                                                         bluetooth_pxp_poperty_t property, int *value);
7628
7629 /**
7630  * @fn int bluetooth_tds_provider_register(void);
7631  *
7632  * @brief Register Transport Discovery Provider role.
7633  *
7634  * This function is a synchronous call.
7635  *
7636  * @return       BLUETOOTH_ERROR_NONE - Success \n
7637  *                               BLUETOOTH_ERROR_ALREADY_INITIALIZED - Already done \n
7638  *                               BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter not enabled \n
7639  *                               BLUETOOTH_ERROR_INTERNAL - Operation failed\n
7640  *
7641  * @exception   None
7642  * @param[in] None
7643  * @param[out] None
7644  *
7645  * @remark      None
7646  */
7647 int bluetooth_tds_provider_register(void);
7648
7649 /**
7650  * @fn int bluetooth_tds_provider_unregister(void);
7651  *
7652  * @brief Unregister Transport Discovery Provider role.
7653  *
7654  * This function is a synchronous call.
7655  *
7656  * @return       BLUETOOTH_ERROR_NONE - Success \n
7657  *                               BLUETOOTH_ERROR_NOT_INITIALIZED - Provider not registered \n
7658  *                               BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter not enabled \n
7659  *                               BLUETOOTH_ERROR_INTERNAL - Operation failed\n
7660  *
7661  * @exception   None
7662  * @param[in] None
7663  * @param[out] None
7664  *
7665  * @remark      None
7666  */
7667 int bluetooth_tds_provider_unregister(void);
7668
7669 /**
7670  * @fn int bluetooth_tds_provider_create(int transport, unsigned int handle);
7671  *
7672  * @brief Create Transport Discovery Provider for a transport.
7673  *
7674  * This function is a synchronous call.
7675  *
7676  * @return       BLUETOOTH_ERROR_NONE - Success \n
7677  *                               BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
7678  *                               BLUETOOTH_ERROR_NOT_INITIALIZED - Provider not registered \n
7679  *                               BLUETOOTH_ERROR_INTERNAL - Operation failed\n
7680  *
7681  * @exception   None
7682  * @param[in] Transport (BT, CUSTOM etc.)
7683  * @param[in] Unique handle for TDS provider.
7684  * @param[out] None
7685  *
7686  * @remark      None
7687  */
7688 int bluetooth_tds_provider_create(int transport, unsigned int handle);
7689
7690 /**
7691  * @fn int bluetooth_tds_provider_destroy(unsigned int handle);
7692  *
7693  * @brief Remove previously created Transport Discovery Provider.
7694  *
7695  * This function is a synchronous call.
7696  *
7697  * @return       BLUETOOTH_ERROR_NONE - Success \n
7698  *                               BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
7699  *
7700  * @exception   None
7701  * @param[in] Unique handle for previously created provider.
7702  * @param[out] None
7703  *
7704  * @remark      None
7705  */
7706 int bluetooth_tds_provider_destroy(unsigned int handle);
7707
7708 /**
7709  * @fn int bluetooth_set_tds_provider_manuf_data(unsigned char *buf, unsigned int length);
7710  *
7711  * @brief Set transport block for in advertisement and gatt db.
7712  *
7713  * This function is a synchronous call.
7714  *
7715  * @return       BLUETOOTH_ERROR_NONE - Success \n
7716  *                               BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
7717  *                               BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter not enabled \n
7718  *                               BLUETOOTH_ERROR_INTERNAL - Operation failed\n
7719  *
7720  * @exception   None
7721  * @param[in] Provider specific manufacturer data.
7722  * @param[in] Provider specific manufacturer data length.
7723  * @param[out] None
7724  *
7725  * @remark      None
7726  */
7727 int bluetooth_set_tds_provider_manuf_data(unsigned char *buf, unsigned int length);
7728
7729 /**
7730  * @fn int bluetooth_set_tds_provider_transport_data(unsigned int tds_handle,
7731  *              bluetooth_tds_transport_state_t state, unsigned char *buf, unsigned int length);
7732  *
7733  * @brief Set transport block for in advertisement and gatt db.
7734  *
7735  * This function is a synchronous call.
7736  *
7737  * @return       BLUETOOTH_ERROR_NONE - Success \n
7738  *                               BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
7739  *                               BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter not enabled \n
7740  *                               BLUETOOTH_ERROR_INTERNAL - Operation failed\n
7741  *
7742  * @exception   None
7743  * @param[in] Unique handle for TDS provider.
7744  * @param[in] Transport state (On/Off/Not Available).
7745  * @param[in] Transport specific data block.
7746  * @param[in] Transport specific data block length.
7747  * @param[out] None
7748  *
7749  * @remark      None
7750  */
7751 int bluetooth_set_tds_provider_transport_data(unsigned int tds_handle,
7752                 bluetooth_tds_transport_state_t state, unsigned char *buf, unsigned int length);
7753
7754 /**
7755  * @fn int bluetooth_send_tds_activation_response(bluetooth_device_address_t *device_address,
7756  *              unsigned int tds_handle, int response, unsigned char *buf, unsigned int length);
7757  *
7758  * @brief Send response to TDS activation request from remoted device.
7759  *
7760  * This function is a synchronous call.
7761  *
7762  * @return       BLUETOOTH_ERROR_NONE - Success \n
7763  *                               BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
7764  *                               BLUETOOTH_ERROR_NOT_INITIALIZED - Provider not registered \n
7765  *                               BLUETOOTH_ERROR_INTERNAL - Operation failed\n
7766  *
7767  * @exception   None
7768  * @param[in] Remote device BT address.
7769  * @param[in] Unique handle for TDS provider.
7770  * @param[in] Response for TDS activation request.
7771  * @param[in] Transport specific data block to be sent in activation response.
7772  * @param[in] Data block length.
7773  * @param[out] None
7774  *
7775  * @remark      None
7776  */
7777 int bluetooth_send_tds_activation_response(bluetooth_device_address_t *device_address,
7778         unsigned int tds_handle, int response, unsigned char *buf, unsigned int length);
7779
7780 /**
7781  * @fn int bluetooth_tds_read_transport_data(bluetooth_device_address_t *device_address, const char *handle);
7782  *
7783  * @brief Reads the Complete TDS transport Blocks from Remote Provider's GATT database.
7784  *
7785  * This function is an asynchronous call.
7786  *
7787  * @return       BLUETOOTH_ERROR_NONE - Success \n
7788  *                               BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
7789  *                               BLUETOOTH_ERROR_INTERNAL - Internal Error \n
7790  *                               BLUETOOTH_ERROR_IN_PROGRESS - Already Read Request is pending on same provider \n
7791  *                               BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
7792  *
7793  * @exception   None
7794  * @param[in] device_address remote device address
7795  * @param[in] handle attribute handle
7796  *
7797  * @remark      BLUETOOTH_EVENT_TDS_TRANSPORT_DATA_RECEIVED event is sent to pplication
7798  * when TDS data is received from Remote provider
7799  */
7800 int bluetooth_tds_read_transport_data(const bluetooth_device_address_t *device_address,
7801                                                 const char *handle);
7802
7803 /**
7804  * @fn int bluetooth_tds_enable_control_point(const bluetooth_device_address_t *device_address, const char *handle);
7805  *
7806  * @brief Enables CCCD on Remote Provider.
7807  *
7808  * This function is an asynchronous call.
7809  *
7810  * @return       BLUETOOTH_ERROR_NONE - Success \n
7811  *                               BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
7812  *                               BLUETOOTH_ERROR_INTERNAL - Internal Error \n
7813  *                               BLUETOOTH_ERROR_IN_PROGRESS - Already Control Point activation is ongoing to Same Provider \n
7814  *                               BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
7815  *
7816  * @exception   None
7817  * @param[in] device_address remote device address
7818  * @param[in] handle attribute handle
7819  *
7820  * @remark      BLUETOOTH_EVENT_TDS_CONTROL_POINT_ENABLED event is sent to application
7821  * when Indication is enabled on Remote provider
7822  */
7823 int bluetooth_tds_enable_control_point(const bluetooth_device_address_t *device_address,
7824                                                 const char *handle);
7825
7826 /**
7827  * @fn int bluetooth_tds_activate_control_point(const bluetooth_device_address_t *device_address, const char *handle
7828  *                                                      unsigned char *buf, int length);
7829  * @brief Sends activation request for Alternate Transport enable on Remote Provider
7830  *
7831  * This function is an asynchronous call.
7832  *
7833  * @return       BLUETOOTH_ERROR_NONE - Success \n
7834  *                               BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
7835  *                               BLUETOOTH_ERROR_INTERNAL - Internal Error \n
7836  *                               BLUETOOTH_ERROR_IN_PROGRESS - Already Control Point activation is ongoing to Same Provider \n
7837  *                               BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
7838  *
7839  * @exception   None
7840  * @param[in] device_address remote device address
7841  * @param[in] handle attribute handle
7842  * @param[in] buf Control point activation param
7843  * @param[in] param length
7844  *
7845  * @remark      BLUETOOTH_EVENT_TDS_ACTIVATION_INDICATION event is sent to application when Indication response
7846  * is received from remote Provider
7847  */
7848 int bluetooth_tds_activate_control_point(const bluetooth_device_address_t *device_address, const char *handle,
7849                                                 unsigned char *buf, int length);
7850
7851 /**
7852  * @fn int bluetooth_otp_server_init(const char *directory);
7853  *
7854  * @brief Starts OTP server.
7855  *
7856  * This function is a synchronous call.
7857  *
7858  * @return
7859  *
7860  * @exception   None
7861  * @param[in] None
7862  * @param[out]  None
7863  *
7864  * @remark      None
7865  */
7866 int bluetooth_otp_server_init(const char *directory);
7867
7868 /**
7869  * @fn int bluetooth_otp_server_deinit();
7870  *
7871  * @brief Stops OTP server.
7872  *
7873  * This function is a synchronous call.
7874  *
7875  * @return
7876  *
7877  * @exception   None
7878  * @param[in] None
7879  * @param[out]  None
7880  *
7881  * @remark      None
7882  */
7883 int bluetooth_otp_server_deinit();
7884
7885 /**
7886  * @fn int bluetooth_otp_enable_notification(const char *handle);
7887  *
7888  * @brief Enable notification for remote OACP & OLCP characteristics.
7889  *
7890  * This function is a synchronous call.
7891  *
7892  * @return
7893  *
7894  * @exception   None
7895  * @param[in] None
7896  * @param[out]  None
7897  *
7898  * @remark      None
7899  */
7900 int bluetooth_otp_enable_notification(const char *handle);
7901
7902 /**
7903  * @fn int bluetooth_otp_write_characteristics_value( const char *handle,
7904  *                                              unsigned char *buf, int length);
7905  *
7906  * @brief Write value on remote characteristics.
7907  *
7908  * This function is a synchronous call.
7909  *
7910  * @return
7911  *
7912  * @exception   None
7913  * @param[in] None
7914  * @param[out]  None
7915  *
7916  * @remark      None
7917  */
7918 int bluetooth_otp_write_characteristics_value(const char *handle,
7919                                         unsigned char *buf, int length);
7920
7921 /**
7922  * @fn int bluetooth_otp_read_characteristic_value(const char *handle);
7923  *
7924  * @brief Read value for remote characteristics.
7925  *
7926  * This function is a synchronous call.
7927  *
7928  * @return
7929  *
7930  * @exception   None
7931  * @param[in] None
7932  * @param[out]  None
7933  *
7934  * @remark      None
7935  */
7936 int bluetooth_otp_read_characteristic_value(const char *handle);
7937
7938 /**
7939  * @fn int bluetooth_otp_connect_otc(const bluetooth_device_address_t *device_address);
7940  *
7941  * @brief Read value for remote characteristics.
7942  *
7943  * This function is a synchronous call.
7944  *
7945  * @return
7946  *
7947  * @exception   None
7948  * @param[in] None
7949  * @param[out]  None
7950  *
7951  * @remark      None
7952  */
7953 int bluetooth_otp_connect_otc(const bluetooth_device_address_t *device_address);
7954
7955 /**
7956  * @fn int bluetooth_otp_disconnect_otc(const bluetooth_device_address_t *device_address);
7957  *
7958  * @brief Read value for remote characteristics.
7959  *
7960  * This function is a synchronous call.
7961  *
7962  * @return
7963  *
7964  * @exception   None
7965  * @param[in] None
7966  * @param[out]  None
7967  *
7968  * @remark      None
7969  */
7970 int bluetooth_otp_disconnect_otc(const bluetooth_device_address_t *device_address);
7971
7972 /**
7973  * @fn int bluetooth_is_le_2m_phy_supported(gboolean *is_supported)
7974  * @brief Check if Adapter supports LE 2M PHY feature or not.
7975  *
7976  * This API is used to check the whether LE Adapter supports LE 2M PHY feature, which is introduced
7977  * in BT 5.0 specification.
7978  *
7979  * This function is a synchronous call.
7980  *
7981  * @return      BLUETOOTH_ERROR_NONE - Success \n
7982  *              BLUETOOTH_ERROR_INVALID_PARAM -  Invalid parameter (NULL buffer) \n
7983  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED -  Adapter is disabled \n
7984  *              BLUETOOTH_ERROR_INTERNAL -  Internal error \n
7985  * @param[out]  is_supported. This boolean variable indicates whether LE 2M PHY is supported or not
7986  *
7987  * @remark      None
7988  */
7989 int bluetooth_is_le_2m_phy_supported(gboolean *is_supported);
7990
7991 /**
7992  * @fn int bluetooth_is_le_coded_phy_supported(gboolean *is_supported)
7993  * @brief Check if Adapter supports LE 2M CODED feature or not.
7994  *
7995  * This API is used to check the whether LE Adapter supports LE CODED PHY feature, which is introduced
7996  * in BT 5.0 specification.
7997  *
7998  * This function is a synchronous call.
7999  *
8000  * @return      BLUETOOTH_ERROR_NONE - Success \n
8001  *              BLUETOOTH_ERROR_INVALID_PARAM -  Invalid parameter (NULL buffer) \n
8002  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED -  Adapter is disabled \n
8003  *              BLUETOOTH_ERROR_INTERNAL -  Internal error \n
8004  * @param[out]  is_supported. This boolean variable indicates whether LE CODED PHY is supported or not
8005  *
8006  * @remark      None
8007  */
8008 int bluetooth_is_le_coded_phy_supported(gboolean *is_supported);
8009
8010 /**
8011  * @fn int bluetooth_is_le_extended_advertising_supported(gboolean *is_supported)
8012  * @brief Check if Adapter supports LE Extended Advertising feature or not.
8013  *
8014  * This API is used to check whether LE Adapter supports LE Extended Advertising feature, which is introduced
8015  * in BT 5.0 specification.
8016  *
8017  * This function is a synchronous call.
8018  *
8019  * @return      BLUETOOTH_ERROR_NONE - Success \n
8020  *              BLUETOOTH_ERROR_INVALID_PARAM -  Invalid parameter (NULL buffer) \n
8021  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED -  Adapter is disabled \n
8022  *              BLUETOOTH_ERROR_INTERNAL -  Internal error \n
8023  * @param[out]  is_supported. This boolean variable indicates whether LE Extended Advertising is supported or not
8024  *
8025  * @remark      None
8026  */
8027 int bluetooth_is_le_extended_advertising_supported(gboolean *is_supported);
8028
8029 /**
8030  * @fn int bluetooth_is_le_extended_scan_supported(gboolean *is_supported)
8031  * @brief Check if Adapter supports LE Extended Scan feature or not.
8032  *
8033  * This API is used to check whether LE Adapter supports LE Extended Scan feature, which is introduced
8034  * in BT 5.0 specification.
8035  *
8036  * This function is a synchronous call.
8037  *
8038  * @return      BLUETOOTH_ERROR_NONE - Success \n
8039  *              BLUETOOTH_ERROR_INVALID_PARAM -  Invalid parameter (NULL buffer) \n
8040  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED -  Adapter is disabled \n
8041  *              BLUETOOTH_ERROR_INTERNAL -  Internal error \n
8042  * @param[out]  is_supported. This boolean variable indicates whether LE Extended Scan is supported or not
8043  *
8044  * @remark      None
8045  */
8046 int bluetooth_is_le_extended_scan_supported(gboolean *is_supported);
8047
8048 /**
8049  * @fn int bluetooth_le_get_maximum_advertising_data_length(gint *data_length)
8050  * @brief gives the maximum advertising data length supported by controller.
8051  *
8052  * This API is used to get the maximum advertising data length supported by controller. This feature is introduced
8053  * in BT 5.0 specification.
8054  *
8055  * This function is a synchronous call.
8056  *
8057  * @return      BLUETOOTH_ERROR_NONE - Success \n
8058  *              BLUETOOTH_ERROR_INVALID_PARAM -  Invalid parameter (NULL buffer) \n
8059  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED -  Adapter is disabled \n
8060  *              BLUETOOTH_ERROR_INTERNAL -  Internal error \n
8061  * @param[out]  data_length. This integer variable indicates the maximum advertising data length supported by the controller
8062  *
8063  * @remark      None
8064  */
8065 int bluetooth_le_get_maximum_advertising_data_length(gint *data_length);
8066
8067 /**
8068  * @fn int bluetooth_l2cap_le_create_socket(int psm)
8069  * @brief Register l2cap_le socket with a specific PSM
8070  *
8071  *
8072  * This API register l2cap_le socket with the given PSM. The return value of this API is the socket
8073  * descriptor of the server.
8074  * This is the first API which is called to create the server. Once we created the server socket,
8075  * we will listen on that return socket.
8076  * So a bluetooth_l2cap_le_listen_and_accept should follow this API call. This is a synchronous call.
8077  *
8078  *
8079  * @return  socket FD on Success \n
8080  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
8081  *              BLUETOOTH_ERROR_INTERNAL - Internal error\n
8082  *              BLUETOOTH_ERROR_MAX_CONNECTION - Maximum connection reached\n
8083  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
8084  * @param[in]   int psm
8085  *
8086  * @remark      None
8087  * @see       bluetooth_l2cap_le_listen_and_accept, bluetooth_l2cap_le_remove_socket
8088  *
8089  @code
8090
8091   int test_psm = 0;
8092   fd = bluetooth_l2cap_le_create_socket(test_psm);
8093
8094  @endcode
8095  */
8096 int bluetooth_l2cap_le_create_socket(int psm);
8097
8098 /**
8099  * @fn int bluetooth_l2cap_le_remove_socket(int socket_fd)
8100  * @brief De-register the l2cap_le socket
8101  *
8102  *
8103  * This API deregister l2cap_le socket with the given socket fd. If the remote device is
8104  * already connected then we will receive the BLUETOOTH_EVENT_L2CAP_LE_DISCONNECTED with socket
8105  * descriptor else no event will come. We will call this API only after the
8106  * bluetooth_l2cap_le_listen_and_accept.
8107  * This is a synchronous call.
8108  *
8109  * @return   BLUETOOTH_ERROR_NONE - Success \n
8110  *               BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
8111  *               BLUETOOTH_ERROR_NOT_FOUND - Cannot find the proxy\n
8112  *               BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
8113  * @param[in]  int socket_fd
8114  *
8115  * @remark      None
8116  * @see       bluetooth_l2cap_le_create_socket, bluetooth_l2cap_le_listen_and_accept
8117  *
8118  @code
8119  void bt_event_callback(int event, bluetooth_event_param_t *param)
8120  {
8121         switch(event)
8122         {
8123                 case BLUETOOTH_EVENT_L2CAP_LE_DISCONNECTED:
8124                 {
8125                         bluetooth_l2cap_le_connection_t *discon_ind =
8126                                         (bluetooth_l2cap_le_connection_t *)param->param_data;
8127
8128                         printf("\nDisconnected from FD %d",  discon_ind->socket_fd);
8129                 }
8130         }
8131  }
8132
8133  ...
8134
8135  int ret = 0;
8136  fd  = bluetooth_l2cap_le_create_socket(test_psm);
8137  ret = bluetooth_l2cap_le_listen_and_accept(fd, 1);
8138  ....
8139  ret = bluetooth_l2cap_le_remove_socket(fd);
8140  @endcode
8141  */
8142 int bluetooth_l2cap_le_remove_socket(int socket_fd);
8143
8144 /**
8145  * @fn int bluetooth_l2cap_le_server_disconnect(int socket_fd)
8146  * @brief Disconnect l2cap_le connection
8147  *
8148  *
8149  * Disconnect a specific(device node fd) l2cap_le connection. This is a Synchronous call and there
8150  * is no callback events for this API. We have to provide the valid client fd to disconnect from the
8151  * remote server.
8152  *
8153  * @return   BLUETOOTH_ERROR_NONE  - Success \n
8154  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
8155  *              BLUETOOTH_ERROR_NOT_CONNECTED - Not connected \n
8156  * @param[in]  int socket_fd
8157  *
8158  * @remark      None
8159  *
8160  @code
8161
8162   ret = bluetooth_l2cap_le_server_disconnect(g_ret_fd);
8163   if (ret < 0)
8164         printf("Disconnection failed");
8165   else
8166         printf("Disconnection Success");
8167
8168  @endcode
8169  */
8170 int bluetooth_l2cap_le_server_disconnect(int socket_fd);
8171
8172 /**
8173  * @fn int bluetooth_l2cap_le_listen_and_accept(int socket_fd, int max_pending_connection)
8174  * @brief L2CAP_LE socket listen
8175  *
8176  *
8177  * This API make l2cap_le socket listen and accept with socket. We will call this API immediately
8178  * after the bluetooth_l2cap_le_create_socket API.
8179  * This API listen for the incoming connection and once it receives a connection, it will give
8180  * BLUETOOTH_EVENT_L2CAP_LE_CONNECTED
8181  * event to the application. This is an Asynchronous API call.
8182  *
8183  *
8184  * @return  BLUETOOTH_ERROR_NONE - Success \n
8185  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
8186  *              BLUETOOTH_ERROR_CONNECTION_ERROR - Listen failed \n
8187
8188  * @param[in]  int socket_fd
8189  * @param[in]  max pending connection.
8190  *
8191  * @remark      None
8192  * @see       bluetooth_l2cap_le_create_socket
8193  *
8194   @code
8195   void bt_event_callback(int event, bluetooth_event_param_t* param)
8196  {
8197         switch(event)
8198         {
8199                 case BLUETOOTH_EVENT_L2CAP_LE_CONNECTED:
8200                 {
8201                         bluetooth_l2cap_le_connection_t *conn_ind =
8202                                                 (bluetooth_l2cap_le_connection_t *)param->param_data;
8203
8204                         printf("\nConnected from FD %d",  conn_ind->socket_fd);
8205                 }
8206         }
8207  }
8208
8209  ...
8210
8211  int ret = 0;
8212  fd  = bluetooth_l2cap_le_create_socket(test_psm);
8213  ret = bluetooth_l2cap_le_listen_and_accept(fd, 1);
8214
8215  @endcode
8216  */
8217 int bluetooth_l2cap_le_listen_and_accept(int socket_fd, int max_pending_connection);
8218
8219 /**
8220  * @fn int bluetooth_l2cap_le_listen(int socket_fd, int max_pending_connection)
8221  * @brief L2cap_le socket listen
8222  *
8223  *
8224  * This API make l2cap_le socket listen and accept with socket. We will call this API immediately
8225  * after the bluetooth_l2cap_le_create_socket API.
8226  * This API listen for the incoming connection and once it receives a connection, it will give
8227  * BLUETOOTH_EVENT_L2CAP_LE_AUTHORIZE
8228  * event to the application. This is an Asynchronous API call.
8229  *
8230  *
8231  * @return  BLUETOOTH_ERROR_NONE - Success \n
8232  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
8233  *              BLUETOOTH_ERROR_CONNECTION_ERROR - Listen failed \n
8234
8235  * @param[in]  int socket_fd
8236  * @param[in]  max pending connection.
8237  *
8238  * @remark      None
8239  * @see       bluetooth_l2cap_le_create_socket
8240  *
8241   @code
8242   void bt_event_callback(int event, bluetooth_event_param_t* param)
8243  {
8244         switch(event)
8245         {
8246                 case BLUETOOTH_EVENT_L2CAP_LE_AUTHORIZE:
8247                 {
8248                         char *name = (char *)param->param_data;
8249
8250                         printf("\nConnected from %s",  name);
8251
8252                         bluetooth_l2cap_le_accept_connection();
8253                 }
8254         }
8255  }
8256
8257  ...
8258
8259  int ret = 0;
8260  fd  = bluetooth_l2cap_le_create_socket(test_psm);
8261  ret = bluetooth_l2cap_le_listen(fd, 1);
8262
8263  @endcode
8264  */
8265 int bluetooth_l2cap_le_listen(int socket_fd, int max_pending_connection);
8266
8267 /**
8268  * @fn int bluetooth_l2cap_le_accept_connection()
8269  * @brief Accepts the authorization request indicated by the event
8270   * BLUETOOTH_EVENT_L2CAP_LE_AUTHORIZE.
8271  *
8272  * This function is a synchronous call.
8273  *
8274  * @return   BLUETOOTH_ERROR_NONE  - Success \n
8275  *              BLUETOOTH_ERROR_INTERNAL - Internal error \n
8276  *
8277  * @param[in]  the socket fd of the server
8278  * @param[out]  the socket fd of the client
8279  *
8280  * @exception   None
8281  * @remark       None
8282  * @see bluetooth_l2cap_le_reject_connection
8283  */
8284 int bluetooth_l2cap_le_accept_connection(int server_fd);
8285
8286 /**
8287  * @fn int bluetooth_l2cap_le_reject_connection()
8288  * @brief Rejects the authorization request indicated by the event
8289   * BLUETOOTH_EVENT_L2CAP_LE_AUTHORIZE.
8290  *
8291  * This function is a synchronous call.
8292  *
8293  * @return   BLUETOOTH_ERROR_NONE  - Success \n
8294  *              BLUETOOTH_ERROR_INTERNAL - Internal error \n
8295  *
8296  * @param[in]  the socket fd of the server
8297  *
8298  * @exception   None
8299  * @remark       None
8300  * @see bluetooth_l2cap_le_accept_connection
8301  */
8302 int bluetooth_l2cap_le_reject_connection(int server_fd);
8303
8304 /**
8305  * @fn gboolean bluetooth_l2cap_le_is_server_psm_available(int psm)
8306  * @brief Informs whether l2cap_le server psm is available or not.
8307  *
8308  * This function is a synchronous call.
8309  *
8310  * @return   TRUE  - L2CAP_LE PSM is available \n
8311  *              FALSE - L2CAP_LE PSM is not available \n
8312  *
8313  * @param[in]  psm (int)
8314  *
8315  * @exception   None
8316  *
8317  * @remark       None
8318  */
8319 gboolean bluetooth_l2cap_le_is_server_psm_available(int psm);
8320
8321 /**
8322  * @fn int bluetooth_l2cap_le_connect(const bluetooth_device_address_t *remote_bt_address,
8323  *                                                                      int psm)
8324  * @brief Connect to the remote device l2cap_le *
8325  *
8326  * Connect to a specific l2cap_le socket on a remote device psm. This is a Async call. Once
8327  * the connection is successful callback BLUETOOTH_EVENT_L2CAP_LE_CONNECTED events is generated,
8328  * which contains the socket_fd, device role (L2CAP_LE_ROLE_SERVER/L2CAP_LE_ROLE_CLIENT), device addess
8329  * etc. The socket_fd can be further used to send the data. It better to do a ble scanning before
8330  * initiating a connection.
8331  *
8332  * @return  BLUETOOTH_ERROR_NONE  - Success \n
8333  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
8334  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
8335  *              BLUETOOTH_ERROR_CONNECTION_BUSY - Connection in progress \n
8336  *              BLUETOOTH_ERROR_INTERNAL - Internal Error\n
8337  * @param[in]  bluetooth_device_address_t remote bt_address
8338  * @param[in]  int psm
8339  * @remark      None
8340  * @see         bluetooth_l2cap_le_disconnect, bluetooth_l2cap_le_write
8341  *
8342  @code
8343
8344  void bt_event_callback(int event, bluetooth_event_param_t *param)
8345  {
8346         switch(event)
8347         {
8348                 case BLUETOOTH_EVENT_L2CAP_LE_CONNECTED:
8349                 {
8350                         bluetooth_l2cap_le_connection_t *conn_ind =
8351                                                 (bluetooth_l2cap_le_connection_t *)param->param_data;
8352
8353                         printf("\nConnected from FD %d, Role = %s",  conn_ind->socket_fd,
8354                                                 (conn_ind->device_role == L2CAP_LE_ROLE_SERVER) ?
8355                                                                         "SERVER" : "CLIENT");
8356                 }
8357         }
8358  }
8359
8360   bluetooth_device_address_t remote_address = {{0},};
8361   remote_address.addr[0] = 0x0; remote_address.addr[1] = 0x0A; remote_address.addr[2] = 0x3A;
8362   remote_address.addr[3]= 0x54; remote_address.addr[4] = 0x19;  remote_address.addr[5]= 0x36;
8363
8364   ret = bluetooth_l2cap_le_connect(&remote_address, test_psm);
8365   if (ret < 0)
8366         printf("Connection failed, Reason = %d", ret);
8367   else
8368          printf("Connection Success, Ret = %d", ret);
8369
8370   @endcode
8371   */
8372 int bluetooth_l2cap_le_connect(const bluetooth_device_address_t *remote_bt_address,
8373                                                 int psm);
8374
8375 /**
8376  * @fn int bluetooth_l2cap_le_disconnect(int socket_fd)
8377  * @brief Disconnect l2cap_le connection
8378  *
8379  *
8380  * Disconnect a specific(device node fd)  L2CAP_LE connection. This is a Synchronous call and there
8381  * is no callback events for this API. We have to provide the valid client fd to disconnect from the
8382  * remote server.
8383  *
8384  * @return   BLUETOOTH_ERROR_NONE  - Success \n
8385  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
8386  *              BLUETOOTH_ERROR_NOT_CONNECTED - Not connected \n
8387  * @param[in]  int remote socket_fd
8388  *
8389  * @remark      None
8390  * @see         bluetooth_l2cap_le_connect
8391  *
8392  @code
8393
8394   ret = bluetooth_l2cap_le_disconnect(g_ret_fd);
8395   if (ret < 0)
8396         printf("Disconnection failed");
8397   else
8398         printf("Disconnection Success");
8399
8400  @endcode
8401  */
8402
8403 int bluetooth_l2cap_le_disconnect(int socket_fd);
8404
8405 /**
8406  * @fn int bluetooth_l2cap_le_write (int fd, const char *buf, int length)
8407  * @brief Write to l2cap_le connection
8408  *
8409  *
8410  * This API is used to send the data over the l2cap_le connection. This is a
8411  * synchronous API. The same API is used to send the data for server and the client.
8412  *
8413  * @return  BLUETOOTH_ERROR_NONE  - Success \n
8414  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
8415  *              BLUETOOTH_ERROR_NOT_IN_OPERATION - The Fd is currently not in operation\n
8416  * @param[in]  int fd
8417  * @param[in]  const char *buff  Data buffer to send
8418  * @param[in]  int length Length of the data
8419  *
8420  * @remark      None
8421  * @see         bluetooth_l2cap_le_connect
8422  *
8423   @code
8424   char *buff = "Test data 123456789"
8425   ret =  bluetooth_l2cap_le_write(g_ret_fd, buff, 15);
8426   if (ret < 0)
8427         printf("Send failed");
8428   else
8429         printf("Send success");
8430
8431  @endcode
8432  */
8433 int bluetooth_l2cap_le_write(int fd, const char *buf, int length);
8434
8435 /**
8436  * @fn gboolean bluetooth_l2cap_le_client_is_connected(
8437  *                              const bluetooth_device_address_t *device_address, gboolean *connected)
8438  * @brief Informs whether l2cap_le client is connected.
8439  *
8440  * This function is a synchronous call.
8441  *
8442  * @return   TRUE  - L2CAP_LE client is connected \n
8443  *              FALSE - L2CAP_LE client is not connected \n
8444  *
8445  * @exception   None
8446  *
8447  * @remark       None
8448  */
8449 int bluetooth_l2cap_le_client_is_connected(
8450                                 const bluetooth_device_address_t *device_address, gboolean *connected);
8451
8452 /**
8453  * @fn gboolean bluetooth_l2cap_le_server_is_connected(
8454  *                              const bluetooth_device_address_t *device_address, gboolean *connected)
8455  * @brief Informs whether l2cap_le server is connected.
8456  *
8457  * This function is a synchronous call.
8458  *
8459  * @return   TRUE  - L2CAP_LE server is connected \n
8460  *              FALSE - L2CAP_LE server is not connected \n
8461  *
8462  * @exception   None
8463  *
8464  * @remark       None
8465  */
8466 int bluetooth_l2cap_le_server_is_connected(
8467                                 const bluetooth_device_address_t *device_address, gboolean *connected);
8468
8469 /**
8470  * @fn gboolean bluetooth_l2cap_le_get_psm(int server_fd, int *psm)
8471  * @brief gives the psm of the specific l2cap_le socket connection.
8472  *
8473  * This function is a synchronous call.
8474  *
8475  * @return  BLUETOOTH_ERROR_NONE  - Success \n
8476  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
8477  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
8478  *
8479  * @param[in]  the socket fd of the server
8480  * @param[out]  int *psm
8481  *
8482  * @exception   None
8483  *
8484  * @remark       None
8485  */
8486 int bluetooth_l2cap_le_get_psm(int id, int *psm);
8487
8488
8489 /**
8490  * @}
8491  */
8492
8493 #ifdef __cplusplus
8494 }
8495 #endif                          /* __cplusplus */
8496 #endif                          /* _BLUETOOTH_API_H_*/