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