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