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