Tizen 2.1 base
[platform/core/connectivity/bluetooth-frwk.git] / include / bluetooth-api.h
1 /*
2  * bluetooth-frwk
3  *
4  * Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  *              http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  */
19
20 #ifndef _BLUETOOTH_API_H_
21 #define _BLUETOOTH_API_H_
22
23 #include <stdlib.h>
24 #include <unistd.h>
25 #include <glib.h>
26
27 #ifdef __cplusplus
28 extern "C" {
29 #endif                          /* __cplusplus */
30
31 /**
32  * @defgroup BLUETOOTHFW BluetoothFW
33  *
34  * A base library for bluetooth framework
35  *
36  * @addtogroup BLUETOOTHFW
37  * @{
38  */
39
40 #define BLUETOOTH_ADDRESS_LENGTH            6 /**< This specifies bluetooth device address length */
41 #define BLUETOOTH_INTERFACE_NAME_LENGTH        16
42 #define BLUETOOTH_DEVICE_NAME_LENGTH_MAX       248 /**< This specifies maximum device name length */
43
44 #define BLUETOOTH_MAX_SERVICES_FOR_DEVICE       40  /**< This specifies maximum number of services
45                                                         a device can support */
46
47 #define BLUETOOTH_UUID_STRING_MAX 50
48
49 #define BLUETOOTH_OOB_DATA_LENGTH               16
50 /**
51  * This is Bluetooth Connected event role
52  */
53 #define RFCOMM_ROLE_SERVER 1
54 #define RFCOMM_ROLE_CLIENT 2
55
56 /**
57  * This is Bluetooth error code
58  */
59 #define BLUETOOTH_ERROR_BASE                   ((int)0)         /**< Error code base */
60
61 #define BLUETOOTH_ERROR_NONE                   ((int)0)         /**< No error #0 */
62 #define BLUETOOTH_ERROR_CANCEL                 ((int)BLUETOOTH_ERROR_BASE - 0x01)
63                                                                 /**< cancelled */
64 #define BLUETOOTH_ERROR_INVALID_CALLBACK       ((int)BLUETOOTH_ERROR_BASE - 0x02)
65                                                                 /**< Callback error */
66 #define BLUETOOTH_ERROR_INVALID_PARAM          ((int)BLUETOOTH_ERROR_BASE - 0x03)
67                                                                 /**< invalid paramerror */
68 #define BLUETOOTH_ERROR_INVALID_DATA           ((int)BLUETOOTH_ERROR_BASE - 0x04)
69                                                                 /**< invalid data error */
70 #define BLUETOOTH_ERROR_MEMORY_ALLOCATION      ((int)BLUETOOTH_ERROR_BASE - 0x05)
71                                                                 /**< Memory allocation error */
72 #define BLUETOOTH_ERROR_OUT_OF_MEMORY          ((int)BLUETOOTH_ERROR_BASE - 0x06)
73                                                                 /**< out of memory error */
74 #define BLUETOOTH_ERROR_TIMEOUT                ((int)BLUETOOTH_ERROR_BASE - 0x07)
75                                                                 /**< timeout error */
76 #define BLUETOOTH_ERROR_NO_RESOURCES           ((int)BLUETOOTH_ERROR_BASE - 0x08)
77                                                                 /**< No resource error */
78 #define BLUETOOTH_ERROR_INTERNAL               ((int)BLUETOOTH_ERROR_BASE - 0x09)
79                                                                 /**< internal error */
80 #define BLUETOOTH_ERROR_NOT_SUPPORT            ((int)BLUETOOTH_ERROR_BASE - 0x0a)
81                                                                 /**< Not supported error */
82 #define BLUETOOTH_ERROR_DEVICE_NOT_ENABLED     ((int)BLUETOOTH_ERROR_BASE - 0x0b)
83                                                                 /**< Operation is failed because
84                                                                 of not enabled BT Adapter */
85 #define BLUETOOTH_ERROR_DEVICE_ALREADY_ENABLED  ((int)BLUETOOTH_ERROR_BASE - 0x0c)
86                                                                 /**< Enabling is failed because of
87                                                                 already enabled BT Adapter */
88 #define BLUETOOTH_ERROR_DEVICE_BUSY            ((int)BLUETOOTH_ERROR_BASE - 0x0d)
89                                                                 /**< Operation is failed because of
90                                                                 other on going operation */
91 #define BLUETOOTH_ERROR_ACCESS_DENIED          ((int)BLUETOOTH_ERROR_BASE - 0x0e)
92                                                                 /**< access denied error */
93 #define BLUETOOTH_ERROR_MAX_CLIENT             ((int)BLUETOOTH_ERROR_BASE - 0x0f)
94                                                                 /**< max client error */
95 #define BLUETOOTH_ERROR_NOT_FOUND              ((int)BLUETOOTH_ERROR_BASE - 0x10)
96                                                                 /**< not found error */
97 #define BLUETOOTH_ERROR_SERVICE_SEARCH_ERROR   ((int)BLUETOOTH_ERROR_BASE - 0x11)
98                                                                 /**< service search fail */
99 #define BLUETOOTH_ERROR_PARING_FAILED          ((int)BLUETOOTH_ERROR_BASE - 0x12)
100                                                                 /**< pairing failed error */
101 #define BLUETOOTH_ERROR_NOT_PAIRED             ((int)BLUETOOTH_ERROR_BASE - 0x13)
102                                                                 /**< Not paired error */
103 #define BLUETOOTH_ERROR_SERVICE_NOT_FOUND      ((int)BLUETOOTH_ERROR_BASE - 0x14)
104                                                                 /**< no service error */
105 #define BLUETOOTH_ERROR_NOT_CONNECTED          ((int)BLUETOOTH_ERROR_BASE - 0x15)
106                                                                 /**< no connection error */
107 #define BLUETOOTH_ERROR_ALREADY_CONNECT        ((int)BLUETOOTH_ERROR_BASE - 0x16)
108                                                                 /**< alread connected error */
109 #define BLUETOOTH_ERROR_CONNECTION_BUSY        ((int)BLUETOOTH_ERROR_BASE - 0x17)
110                                                                 /**< connection busy error */
111 #define BLUETOOTH_ERROR_CONNECTION_ERROR       ((int)BLUETOOTH_ERROR_BASE - 0x18)
112                                                                 /**< connection error */
113 #define BLUETOOTH_ERROR_MAX_CONNECTION         ((int)BLUETOOTH_ERROR_BASE - 0x19)
114                                                                 /**< max connection error*/
115 #define BLUETOOTH_ERROR_NOT_IN_OPERATION       ((int)BLUETOOTH_ERROR_BASE - 0x1a)
116                                                                 /**< Not in operation */
117 #define BLUETOOTH_ERROR_CANCEL_BY_USER         ((int)BLUETOOTH_ERROR_BASE - 0x1b)
118                                                                 /**< Cancelled by user */
119 #define BLUETOOTH_ERROR_REGISTRATION_FAILED    ((int)BLUETOOTH_ERROR_BASE - 0x1c)
120                                                                 /**< Service record registration failed */
121 #define BLUETOOTH_ERROR_IN_PROGRESS            ((int)BLUETOOTH_ERROR_BASE - 0x1d)
122                                                                 /**< Operation in progress */
123 #define BLUETOOTH_ERROR_AUTHENTICATION_FAILED  ((int)BLUETOOTH_ERROR_BASE - 0x1e)
124                                                                 /**< authentication failed error when paring*/
125 #define BLUETOOTH_ERROR_HOST_DOWN              ((int)BLUETOOTH_ERROR_BASE - 0x1f)
126                                                                 /**< Remote host is down */
127 #define BLUETOOTH_ERROR_END_OF_DEVICE_LIST     ((int)BLUETOOTH_ERROR_BASE - 0x20)
128                                                                 /**< End of device list */
129
130 #define BLUETOOTH_ERROR_AGENT_ALREADY_EXIST      ((int)BLUETOOTH_ERROR_BASE - 0x21)
131                                                                 /**< Obex agent already exists */
132 #define BLUETOOTH_ERROR_AGENT_DOES_NOT_EXIST    ((int)BLUETOOTH_ERROR_BASE - 0x22)
133                                                                 /**< Obex agent does not exist */
134
135 #define BLUETOOTH_ERROR_ALREADY_INITIALIZED    ((int)BLUETOOTH_ERROR_BASE - 0x23)
136                                                                 /**< Already initialized */
137
138
139 /**
140  * This is Bluetooth device address type, fixed to 6 bytes ##:##:##:##:##:##
141  */
142 typedef struct {
143         unsigned char addr[BLUETOOTH_ADDRESS_LENGTH];
144 } bluetooth_device_address_t;
145
146 /**
147  * This is Bluetooth device name type, maximum size of Bluetooth device name is 248 bytes
148  */
149 typedef struct {
150         char name[BLUETOOTH_DEVICE_NAME_LENGTH_MAX + 1];
151 } bluetooth_device_name_t;
152
153 /**
154  * Adapter state
155  */
156 typedef enum {
157         BLUETOOTH_ADAPTER_DISABLED,         /**< Bluetooth adapter is disabled */
158         BLUETOOTH_ADAPTER_ENABLED,          /**< Bluetooth adapter is enabled */
159         BLUETOOTH_ADAPTER_CHANGING_ENABLE,  /**< Bluetooth adapter is currently enabling */
160         BLUETOOTH_ADAPTER_CHANGING_DISABLE, /**< Bluetooth adapter is currently disabling */
161 } bluetooth_adapter_state_t;
162
163 /**
164  * Discoverable mode
165  */
166 typedef enum {
167         BLUETOOTH_DISCOVERABLE_MODE_CONNECTABLE,         /**< Non discoverable mode */
168         /*Changed the order to make it compatable with old method */
169         BLUETOOTH_DISCOVERABLE_MODE_GENERAL_DISCOVERABLE,/**< Discoverable mode */
170         BLUETOOTH_DISCOVERABLE_MODE_TIME_LIMITED_DISCOVERABLE,
171                                                          /**< Discoverable mode with time limit
172                                                         After specific timeout, it is changed
173                                                                 to non discoverable mode */
174 } bluetooth_discoverable_mode_t;
175
176 /**
177  * Network connect mode
178  */
179 typedef enum {
180         BLUETOOTH_NETWORK_PANU_ROLE,
181                                  /**< PAN user */
182         BLUETOOTH_NETWORK_NAP_ROLE,/**< Network Access Point */
183         BLUETOOTH_NETWORK_GN_ROLE,  /**< Group ad-hoc Network */
184         BLUETOOTH_NETWORK_CUSTOM_UUID, /**< Custom role */
185 } bluetooth_network_role_t;
186
187 /**
188  * Service type
189  */
190 typedef enum {
191         BLUETOOTH_RFCOMM_SERVICE = 0x01,
192         BLUETOOTH_A2DP_SERVICE = 0x02,
193         BLUETOOTH_HSP_SERVICE = 0x04,
194         BLUETOOTH_HID_SERVICE = 0x08,
195 } bluetooth_service_type_t;
196
197 #define BLUETOOTH_EVENT_BASE            ((int)(0x0000))         /**< No event */
198 #define BLUETOOTH_EVENT_GAP_BASE        ((int)(BLUETOOTH_EVENT_BASE + 0x0010))
199                                                                 /**< Base ID for GAP Event */
200 #define BLUETOOTH_EVENT_SDP_BASE        ((int)(BLUETOOTH_EVENT_GAP_BASE + 0x0020))
201                                                                 /**< Base ID for SDP events */
202 #define BLUETOOTH_EVENT_RFCOMM_BASE     ((int)(BLUETOOTH_EVENT_SDP_BASE + 0x0020))
203                                                                 /**< Base ID for RFCOMM events */
204 #define BLUETOOTH_EVENT_NETWORK_BASE     ((int)(BLUETOOTH_EVENT_RFCOMM_BASE + 0x0020))
205                                                                 /**< Base ID for NETWORK events */
206 #define BLUETOOTH_EVENT_HDP_BASE     ((int)(BLUETOOTH_EVENT_NETWORK_BASE + 0x0020))
207                                                                 /**< Base ID for HDP events */
208 #define BLUETOOTH_EVENT_OPC_BASE  ((int)(BLUETOOTH_EVENT_HDP_BASE + 0x0020))
209                                                                 /**< Base ID for OPC events */
210 #define BLUETOOTH_EVENT_OBEX_SERVER_BASE ((int)(BLUETOOTH_EVENT_OPC_BASE + 0x0020))
211                                                                 /**< Base ID for Obex Server events */
212 #define BLUETOOTH_EVENT_GATT_BASE ((int)(BLUETOOTH_EVENT_OBEX_SERVER_BASE + 0x0020))
213                                                                 /**< Base ID for GATT events */
214
215 #define BLUETOOTH_EVENT_AUDIO_BASE ((int)(BLUETOOTH_EVENT_GATT_BASE + 0x0020))
216                                                                 /**< Base ID for Audio events */
217 #define BLUETOOTH_EVENT_HID_BASE ((int)(BLUETOOTH_EVENT_AUDIO_BASE + 0x0020))
218                                                                 /**< Base ID for HID events */
219
220 /**
221  * Bluetooth event type
222  */
223 typedef enum {
224         BLUETOOTH_EVENT_NONE = BLUETOOTH_EVENT_BASE,/**< No event */
225
226         BLUETOOTH_EVENT_ENABLED,                    /**< Bluetooth event adpater enabled */
227         BLUETOOTH_EVENT_DISABLED,                   /**< Bluetooth event adpater disabled */
228         BLUETOOTH_EVENT_LOCAL_NAME_CHANGED,         /**< Bluetooth event local name changed*/
229         BLUETOOTH_EVENT_DISCOVERABLE_TIMEOUT_REQUESTED,
230                                         /**< Bluetooth event Discoverable timeout requested*/
231         BLUETOOTH_EVENT_DISCOVERABLE_MODE_CHANGED,  /**< Bluetooth event mode changed */
232         BLUETOOTH_EVENT_DISCOVERY_OPTION_REQUESTED, /**< Bluetooth event discovery option */
233         BLUETOOTH_EVENT_DISCOVERY_STARTED,          /**< Bluetooth event discovery started */
234         BLUETOOTH_EVENT_DISCOVERY_FINISHED,         /**< Bluetooth event discovery finished */
235
236         BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND,        /**< Bluetooth event remote deice found */
237         BLUETOOTH_EVENT_REMOTE_DEVICE_NAME_UPDATED,/**< Bluetooth event remote device name updated*/
238         BLUETOOTH_EVENT_BONDING_FINISHED,           /**< Bluetooth event bonding completed */
239         BLUETOOTH_EVENT_BONDED_DEVICE_REMOVED,      /**< Bluetooth event bonding removed */
240         BLUETOOTH_EVENT_BONDED_DEVICE_FOUND,        /**< Bluetooth event paired device found */
241         BLUETOOTH_EVENT_REMOTE_DEVICE_READ,         /**< Bluetooth event read remote device */
242         BLUETOOTH_EVENT_DEVICE_AUTHORIZED,          /**< Bluetooth event authorize device */
243         BLUETOOTH_EVENT_DEVICE_UNAUTHORIZED,        /**< Bluetooth event unauthorize device */
244         BLUETOOTH_EVENT_DISCOVERABLE_TIMEOUT_CHANGED,  /**< Bluetooth event mode changed */
245
246         BLUETOOTH_EVENT_SERVICE_SEARCHED = BLUETOOTH_EVENT_SDP_BASE,
247                                                     /**< Bluetooth event serice search base id */
248         BLUETOOTH_EVENT_SERVICE_SEARCH_CANCELLED,   /**< Bluetooth event service search cancelled */
249         BLUETOOTH_EVENT_RFCOMM_DATA_RECEIVED = BLUETOOTH_EVENT_RFCOMM_BASE,
250                                                         /**< RFCOMM data receive event */
251         BLUETOOTH_EVENT_RFCOMM_CONNECTED,               /**< Rfcomm server incomming connection */
252         BLUETOOTH_EVENT_RFCOMM_DISCONNECTED,            /**< Rfcomm server/client disconnect */
253
254         BLUETOOTH_EVENT_RFCOMM_AUTHORIZE,
255
256         BLUETOOTH_EVENT_DEVICE_CONNECTED,           /**< Bluetooth event device connected */
257         BLUETOOTH_EVENT_DEVICE_DISCONNECTED,        /**< Bluetooth event device disconnected */
258
259         BLUETOOTH_EVENT_RFCOMM_SERVER_REMOVED,
260
261         BLUETOOTH_EVENT_NETWORK_SERVER_ACTIVATED = BLUETOOTH_EVENT_NETWORK_BASE,
262                                                                 /**< Bluetooth Network event */
263         BLUETOOTH_EVENT_NETWORK_SERVER_DEACTIVATED, /**< Network server deactivated */
264         BLUETOOTH_EVENT_NETWORK_SERVER_CONNECTED,     /**< Network connected event in server */
265         BLUETOOTH_EVENT_NETWORK_SERVER_DISCONNECTED,
266                                                    /**< Network disconnected evnet in server */
267
268         BLUETOOTH_EVENT_NETWORK_CONNECTED,              /**< Network connected event in client*/
269         BLUETOOTH_EVENT_NETWORK_DISCONNECTED,           /**< Network disconnected evnet in client*/
270
271         BLUETOOTH_EVENT_HDP_CONNECTED
272                         = BLUETOOTH_EVENT_HDP_BASE,                /**<HDP Connect>*/
273         BLUETOOTH_EVENT_HDP_DISCONNECTED,          /**<HDP Disconnect>*/
274         BLUETOOTH_EVENT_HDP_DATA_RECEIVED,         /**<HDP Data Indication>*/
275
276         BLUETOOTH_EVENT_OPC_CONNECTED = BLUETOOTH_EVENT_OPC_BASE,
277                                                                 /* OPC Connected event */
278         BLUETOOTH_EVENT_OPC_DISCONNECTED,               /* OPC Disonnected event */
279         BLUETOOTH_EVENT_OPC_TRANSFER_STARTED,   /* OPC Transfer started event */
280         BLUETOOTH_EVENT_OPC_TRANSFER_PROGRESS,  /* OPC Transfer progress event */
281         BLUETOOTH_EVENT_OPC_TRANSFER_COMPLETE,  /* OPC Transfer Complete event */
282
283         BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_AUTHORIZE = BLUETOOTH_EVENT_OBEX_SERVER_BASE,
284                                                                 /* Obex server authorize event*/
285         BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_STARTED,   /* Obex Server transfer started event*/
286         BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_PROGRESS,/* Obex Server transfer progress event*/
287         BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_COMPLETED,/* Obex Server transfer complete event*/
288         BLUETOOTH_EVENT_OBEX_SERVER_CONNECTION_AUTHORIZE,
289
290         BLUETOOTH_EVENT_GATT_SVC_CHAR_DISCOVERED = BLUETOOTH_EVENT_GATT_BASE,
291                                 /**<Discovered GATT service characteristics event*/
292         BLUETOOTH_EVENT_GATT_CHAR_VAL_CHANGED,
293                                 /**<Remote GATT charateristic value changed event*/
294
295         BLUETOOTH_EVENT_AG_CONNECTED = BLUETOOTH_EVENT_AUDIO_BASE, /**<AG service connected event*/
296         BLUETOOTH_EVENT_AG_DISCONNECTED, /**<AG service disconnected event*/
297         BLUETOOTH_EVENT_AG_SPEAKER_GAIN, /**<Speaker gain request event*/
298         BLUETOOTH_EVENT_AG_MIC_GAIN, /**<Mic gain request event*/
299         BLUETOOTH_EVENT_AG_AUDIO_CONNECTED, /**<AV & AG service connected event*/
300         BLUETOOTH_EVENT_AG_AUDIO_DISCONNECTED,  /**<AV & AG service disconnected event*/
301         BLUETOOTH_EVENT_AV_CONNECTED, /**<AV service connected event*/
302         BLUETOOTH_EVENT_AV_DISCONNECTED, /**<AV service disconnected event*/
303         BLUETOOTH_EVENT_AVRCP_CONNECTED, /**<AVRCP service connected event*/
304         BLUETOOTH_EVENT_AVRCP_DISCONNECTED, /**<AVRCP service disconnected event*/
305         BLUETOOTH_EVENT_AVRCP_SETTING_SHUFFLE_STATUS, /**<AVRCP service player suffle  status event*/
306         BLUETOOTH_EVENT_AVRCP_SETTING_EQUALIZER_STATUS, /**<AVRCP service player equalizer status event*/
307         BLUETOOTH_EVENT_AVRCP_SETTING_REPEAT_STATUS, /**<AVRCP service player repeat status event*/
308         BLUETOOTH_EVENT_AVRCP_SETTING_SCAN_STATUS, /**<AVRCP service player scan status event*/
309
310         BLUETOOTH_HID_CONNECTED = BLUETOOTH_EVENT_HID_BASE, /**< Input connectd event*/
311         BLUETOOTH_HID_DISCONNECTED, /**< Input disconnectd event*/
312         BLUETOOTH_EVENT_MAX, /**< Bluetooth event Max value */
313 } bluetooth_event_type_t;
314
315  /**
316  * This bt_service_uuid_list_t  enum  indicates service uuid list .
317  * This values is stored the service_list_array in bt_sdp_info_t and bluetooth_device_info_t.
318  */
319
320 typedef enum {
321         BLUETOOTH_SPP_PROFILE_UUID = ((unsigned short)0x1101),                  /**<SPP*/
322         BLUETOOTH_LAP_PROFILE_UUID = ((unsigned short)0x1102),                  /**<LAP*/
323         BLUETOOTH_DUN_PROFILE_UUID = ((unsigned short)0x1103),                  /**<DUN*/
324         BLUETOOTH_OBEX_IR_MC_SYNC_SERVICE_UUID = ((unsigned short)0x1104),      /**<OBEX IR MC SYNC*/
325         BLUETOOTH_OBEX_OBJECT_PUSH_SERVICE_UUID = ((unsigned short)0x1105),     /**<OPP*/
326         BLUETOOTH_OBEX_FILE_TRANSFER_UUID = ((unsigned short)0x1106),           /**<FTP*/
327         BLUETOOTH_IRMC_SYNC_COMMAND_UUID = ((unsigned short)0x1107),            /**<IRMC SYNC COMMAND*/
328         BLUETOOTH_HS_PROFILE_UUID = ((unsigned short)0x1108),                   /**<HS*/
329         BLUETOOTH_CTP_PROFILE_UUID = ((unsigned short)0x1109),                  /**<CTP*/
330         BLUETOOTH_AUDIO_SOURCE_UUID = ((unsigned short)0x110A),                 /**<AUDIO SOURCE*/
331         BLUETOOTH_AUDIO_SINK_UUID = ((unsigned short)0x110B),                   /**<AUDIO SINK*/
332         BLUETOOTH_AV_REMOTE_CONTROL_TARGET_UUID = ((unsigned short)0x110C),     /**<AV REMOTE CONTROL
333                                                                                 TARGET*/
334         BLUETOOTH_ADVANCED_AUDIO_PROFILE_UUID = ((unsigned short)0x110D),       /**<A2DP*/
335         BLUETOOTH_AV_REMOTE_CONTROL_UUID = ((unsigned short)0x110E),            /**<AV REMOTE CONTROL UUID*/
336         BLUETOOTH_AV_REMOTE_CONTROL_CONTROLLER_UUID = ((unsigned short)0x110F), /**<AV REMOTE CONTROLLER UUID*/
337         BLUETOOTH_ICP_PROFILE_UUID = ((unsigned short)0x1110),                  /**<ICP*/
338         BLUETOOTH_FAX_PROFILE_UUID = ((unsigned short)0x1111),                  /**<FAX*/
339         BLUETOOTH_HEADSET_AG_SERVICE_UUID = ((unsigned short)0x1112),           /**<HS AG */
340         BLUETOOTH_PAN_PANU_PROFILE_UUID = ((unsigned short)0x1115),             /**<PAN*/
341         BLUETOOTH_PAN_NAP_PROFILE_UUID = ((unsigned short)0x1116),              /**<PAN*/
342         BLUETOOTH_PAN_GN_PROFILE_UUID = ((unsigned short)0x1117),               /**<PAN*/
343         BLUETOOTH_DIRECT_PRINTING = ((unsigned short)0x1118),
344         BLUETOOTH_OBEX_BPPS_PROFILE_UUID = ((unsigned short)0x1118),            /**<OBEX BPPS*/ /* Will be removed */
345         BLUETOOTH_REFERENCE_PRINTING = ((unsigned short)0x1119),
346         BLUETOOTH_OBEX_IMAGING_UUID = ((unsigned short)0x111A),                 /**<OBEX_IMAGING*/
347         BLUETOOTH_OBEX_IMAGING_RESPONDER_UUID = ((unsigned short)0x111B),       /**<OBEX_IMAGING
348                                                                                 RESPONDER*/
349         BLUETOOTH_IMAGING_AUTOMATIC_ARCHIVE_UUID = ((unsigned short)0x111C),    /**<IMAGING AUTOMATIC ARCHIVE*/
350         BLUETOOTH_IMAGING_REFERENCED_OBJECTS_UUID = ((unsigned short)0x111D),   /**<IMAGING REFERENCED OBJECTS*/
351         BLUETOOTH_HF_PROFILE_UUID = ((unsigned short)0x111E),                   /**<HF*/
352         BLUETOOTH_HFG_PROFILE_UUID = ((unsigned short)0x111F),                  /**<HFG*/
353         BLUETOOTH_DIRECT_PRINTING_REFERENCE_OBJ_UUID = ((unsigned short)0x1120),
354                                                                         /**<DIRECT PRINTING*/
355         BLUETOOTH_REFLECTED_UI = ((unsigned short)0x1121),              /**<REFLECTED UI*/
356         BLUETOOTH_BASIC_PRINTING = ((unsigned short)0x1122),            /**<BASIC PRINTING*/
357         BLUETOOTH_PRINTING_STATUS = ((unsigned short)0x1123),           /**<PRINTING  STATUS*/
358         BLUETOOTH_OBEX_PRINTING_STATUS_UUID = ((unsigned short)0x1123), /**<OBEX PRINTING STATUS*/ /* Will be removed */
359         BLUETOOTH_HID_PROFILE_UUID = ((unsigned short)0x1124),          /**<HID*/
360         BLUETOOTH_HCR_PROFILE_UUID = ((unsigned short)0x1125),          /**<HCRP*/
361         BLUETOOTH_HCR_PRINT_UUID = ((unsigned short)0x1126),            /**<HCR PRINT*/
362         BLUETOOTH_HCR_SCAN_UUID = ((unsigned short)0x1127),             /**<HCR SCAN*/
363         BLUETOOTH_SIM_ACCESS_PROFILE_UUID = ((unsigned short)0x112D),   /**<SIM ACCESS PROFILE*/
364         BLUETOOTH_PBAP_PCE_UUID = ((unsigned short)0x112E),             /**<PBAP - PCE*/
365         BLUETOOTH_PBAP_PSE_UUID = ((unsigned short)0x112F),             /**<OBEX PBA*/
366         BLUETOOTH_OBEX_PBA_PROFILE_UUID = ((unsigned short)0x112F),     /**<OBEX PBA*/ /* Will be removed */
367         BLUETOOTH_OBEX_PBAP_UUID = ((unsigned short)0x1130),            /**<OBEX PBA*/
368         BLUETOOTH_HEADSET_HS_UUID = ((unsigned short)0x1131),           /**<HEADSET HS*/
369         BLUETOOTH_MESSAGE_ACCESS_SERVER_UUID = ((unsigned short)0x1132),/**<MESSAGE ACCESS SERVER*/
370         BLUETOOTH_MESSAGE_NOTIFICATION_SERVER_UUID = ((unsigned short)0x1133),/**<MESSAGE NOTIFICATION SERVER*/
371         BLUETOOTH_MESSAGE_ACCESS_PROFILE_UUID = ((unsigned short)0x1134),/**<MESSAGE ACCESS PROFILE*/
372         BLUETOOTH_PNP_INFORMATION_UUID = ((unsigned short)0x1200),      /**<PNP*/
373         BLUETOOTH_GENERIC_NETWORKING_UUID = ((unsigned short)0x1201),   /**<GENERIC NETWORKING*/
374         BLUETOOTH_GENERIC_FILE_TRANSFER_UUID = ((unsigned short)0x1202),/**<GENERIC FILE TRANSFER*/
375         BLUETOOTH_GENERIC_AUDIO_UUID = ((unsigned short)0x1203),        /**<GENERIC AUDIO*/
376         BLUETOOTH_GENERIC_TELEPHONY_UUID = ((unsigned short)0x1204),    /**<GENERIC TELEPHONY*/
377         BLUETOOTH_VIDEO_SOURCE_UUID = ((unsigned short)0x1303),         /**<VEDIO SOURCE*/
378         BLUETOOTH_VIDEO_SINK_UUID = ((unsigned short)0x1304),           /**<VEDIO SINK*/
379         BLUETOOTH_VIDEO_DISTRIBUTION_UUID = ((unsigned short)0x1305),   /**<VEDIO DISTRIBUTION*/
380         BLUETOOTH_HDP_UUID = ((unsigned short)0x1400),                  /**<HDP*/
381         BLUETOOTH_HDP_SOURCE_UUID = ((unsigned short)0x1401),           /**<HDP SOURCE*/
382         BLUETOOTH_HDP_SINK_UUID = ((unsigned short)0x1402),             /**<HDP SINK*/
383         BLUETOOTH_OBEX_SYNCML_TRANSFER_UUID = ((unsigned short)0x0000)  /**<OBEX_SYNC*/ /* Will be removed */
384 } bluetooth_service_uuid_list_t;
385
386 /**
387 * Service class part of class of device returned from device discovery
388 */
389 typedef enum {
390         BLUETOOTH_DEVICE_SERVICE_CLASS_LIMITED_DISCOVERABLE_MODE = 0x002000,
391         BLUETOOTH_DEVICE_SERVICE_CLASS_POSITIONING = 0x010000,                  /**<  */
392         BLUETOOTH_DEVICE_SERVICE_CLASS_NETWORKING = 0x020000,                   /**<  */
393         BLUETOOTH_DEVICE_SERVICE_CLASS_RENDERING = 0x040000,                    /**<  */
394         BLUETOOTH_DEVICE_SERVICE_CLASS_CAPTURING = 0x080000,                    /**<  */
395         BLUETOOTH_DEVICE_SERVICE_CLASS_OBJECT_TRANSFER = 0x100000,              /**<  */
396         BLUETOOTH_DEVICE_SERVICE_CLASS_AUDIO = 0x200000,                        /**<  */
397         BLUETOOTH_DEVICE_SERVICE_CLASS_TELEPHONY = 0x400000,                    /**<  */
398         BLUETOOTH_DEVICE_SERVICE_CLASS_INFORMATION = 0x800000,                  /**<  */
399 } bluetooth_device_service_class_t;
400
401
402 /**
403  * Major device mask (For device discovery)
404  */
405 typedef enum {
406         BLUETOOTH_DEVICE_MAJOR_MASK_MISC = 0x00,
407         BLUETOOTH_DEVICE_MAJOR_MASK_COMPUTER = 0x0001,
408         BLUETOOTH_DEVICE_MAJOR_MASK_PHONE = 0x0002,
409         BLUETOOTH_DEVICE_MAJOR_MASK_LAN_ACCESS_POINT = 0x0004,
410         BLUETOOTH_DEVICE_MAJOR_MASK_AUDIO = 0x0008,
411         BLUETOOTH_DEVICE_MAJOR_MASK_PERIPHERAL = 0x0010,
412         BLUETOOTH_DEVICE_MAJOR_MASK_IMAGING = 0x0020,
413         BLUETOOTH_DEVICE_MAJOR_MASK_WEARABLE = 0x0040,
414         BLUETOOTH_DEVICE_MAJOR_MASK_TOY = 0x0080,
415         BLUETOOTH_DEVICE_MAJOR_MASK_HEALTH = 0x0100,
416 } bluetooth_device_major_mask_t;
417
418
419 /**
420  * Major device class (part of Class of Device)
421  */
422 typedef enum {
423         BLUETOOTH_DEVICE_MAJOR_CLASS_MISC = 0x00,       /**< Miscellaneous major device class*/
424         BLUETOOTH_DEVICE_MAJOR_CLASS_COMPUTER = 0x01,           /**< Computer major device class*/
425         BLUETOOTH_DEVICE_MAJOR_CLASS_PHONE = 0x02,              /**< Phone major device class*/
426         BLUETOOTH_DEVICE_MAJOR_CLASS_LAN_ACCESS_POINT = 0x03,   /**< LAN major device class*/
427         BLUETOOTH_DEVICE_MAJOR_CLASS_AUDIO = 0x04,              /**< AUDIO major device class*/
428         BLUETOOTH_DEVICE_MAJOR_CLASS_PERIPHERAL = 0x05,         /**< Peripheral major device class*/
429         BLUETOOTH_DEVICE_MAJOR_CLASS_IMAGING = 0x06,            /**< Imaging major device class*/
430         BLUETOOTH_DEVICE_MAJOR_CLASS_WEARABLE = 0x07,           /**< Wearable device class*/
431         BLUETOOTH_DEVICE_MAJOR_CLASS_TOY = 0x08,                /**< Toy device class*/
432         BLUETOOTH_DEVICE_MAJOR_CLASS_HEALTH = 0x09,             /**< Health device class*/
433         BLUETOOTH_DEVICE_MAJOR_CLASS_UNCLASSIFIED = 0x1F        /**< Unknown major device class*/
434 } bluetooth_device_major_class_t;
435
436 typedef enum {
437         BLUETOOTH_DEVICE_MINOR_CLASS_UNCLASSIFIED = 0x00,       /**< unclassified minor class */
438
439         /* About Computer Major class */
440         BLUETOOTH_DEVICE_MINOR_CLASS_DESKTOP_WORKSTATION = 0x04,        /**< desktop workstation
441                                                                         minor class */
442         BLUETOOTH_DEVICE_MINOR_CLASS_SERVER_CLASS_COMPUTER = 0x08,      /**< server minor class */
443         BLUETOOTH_DEVICE_MINOR_CLASS_LAPTOP = 0x0C,                     /**< laptop minor class */
444         BLUETOOTH_DEVICE_MINOR_CLASS_HANDHELD_PC_OR_PDA = 0x10,         /**< PDA minor class */
445         BLUETOOTH_DEVICE_MINOR_CLASS_PALM_SIZED_PC_OR_PDA = 0x14,       /**< PALM minor class */
446         BLUETOOTH_DEVICE_MINOR_CLASS_WEARABLE_COMPUTER = 0x18,  /**< Wearable PC minor class */
447
448         /* About Phone Major class */
449         BLUETOOTH_DEVICE_MINOR_CLASS_CELLULAR = 0x04,                   /**< Cellular minor class */
450         BLUETOOTH_DEVICE_MINOR_CLASS_CORDLESS = 0x08,                   /**< cordless minor class */
451         BLUETOOTH_DEVICE_MINOR_CLASS_SMART_PHONE = 0x0C,        /**< smart phone minor class */
452         BLUETOOTH_DEVICE_MINOR_CLASS_WIRED_MODEM_OR_VOICE_GATEWAY = 0x10,
453                                                                 /**< voice gateway minor class */
454         BLUETOOTH_DEVICE_MINOR_CLASS_COMMON_ISDN_ACCESS = 0x14,         /**< ISDN minor class */
455
456         /* About LAN/Network Access Point Major class */
457         BLUETOOTH_DEVICE_MINOR_CLASS_FULLY_AVAILABLE = 0x04,            /**< Fully available minor class */
458         BLUETOOTH_DEVICE_MINOR_CLASS_1_TO_17_PERCENT_UTILIZED = 0x20,   /**< 1-17% utilized minor class */
459         BLUETOOTH_DEVICE_MINOR_CLASS_17_TO_33_PERCENT_UTILIZED = 0x40,  /**< 17-33% utilized minor class */
460         BLUETOOTH_DEVICE_MINOR_CLASS_33_TO_50_PERCENT_UTILIZED = 0x60,  /**< 33-50% utilized minor class */
461         BLUETOOTH_DEVICE_MINOR_CLASS_50_to_67_PERCENT_UTILIZED = 0x80,  /**< 50-67% utilized minor class */
462         BLUETOOTH_DEVICE_MINOR_CLASS_67_TO_83_PERCENT_UTILIZED = 0xA0,  /**< 67-83% utilized minor class */
463         BLUETOOTH_DEVICE_MINOR_CLASS_83_TO_99_PERCENT_UTILIZED = 0xC0,  /**< 83-99% utilized minor class */
464         BLUETOOTH_DEVICE_MINOR_CLASS_NO_SERVICE_AVAILABLE = 0xE0,               /**< No service available minor class */
465
466         /* About Audio/Video Major class */
467         BLUETOOTH_DEVICE_MINOR_CLASS_HEADSET_PROFILE = 0x04,            /**< Headset minor class */
468         BLUETOOTH_DEVICE_MINOR_CLASS_HANDSFREE = 0x08,                  /**< Handsfree minor class*/
469
470         BLUETOOTH_DEVICE_MINOR_CLASS_MICROPHONE = 0x10,         /**< Microphone minor class */
471         BLUETOOTH_DEVICE_MINOR_CLASS_LOUD_SPEAKER = 0x14,       /**< Loud Speaker minor class */
472         BLUETOOTH_DEVICE_MINOR_CLASS_HEADPHONES = 0x18,         /**< Headphones minor class */
473         BLUETOOTH_DEVICE_MINOR_CLASS_PORTABLE_AUDIO = 0x1C,     /**< Portable Audio minor class */
474         BLUETOOTH_DEVICE_MINOR_CLASS_CAR_AUDIO = 0x20,           /**< Car Audio minor class */
475         BLUETOOTH_DEVICE_MINOR_CLASS_SET_TOP_BOX = 0x24,        /**< Set top box minor class */
476         BLUETOOTH_DEVICE_MINOR_CLASS_HIFI_AUDIO_DEVICE = 0x28,  /**< Hifi minor class */
477         BLUETOOTH_DEVICE_MINOR_CLASS_VCR = 0x2C,                /**< VCR minor class */
478         BLUETOOTH_DEVICE_MINOR_CLASS_VIDEO_CAMERA = 0x30,       /**< Video Camera minor class */
479         BLUETOOTH_DEVICE_MINOR_CLASS_CAM_CORDER = 0x34,         /**< CAM Corder minor class */
480         BLUETOOTH_DEVICE_MINOR_CLASS_VIDEO_MONITOR = 0x38,      /**<Video Monitor minor class */
481         BLUETOOTH_DEVICE_MINOR_CLASS_VIDEO_DISPLAY_AND_LOUD_SPEAKER = 0x3C,
482                                                                         /**< Video Display and Loud
483                                                                         Speaker minor class */
484         BLUETOOTH_DEVICE_MINOR_CLASS_VIDEO_CONFERENCING = 0x40, /**< Video Conferencing minor
485                                                                 class */
486
487         BLUETOOTH_DEVICE_MINOR_CLASS_GAMING_OR_TOY = 0x48,      /**< Gaming or toy minor class */
488
489         /* About Peripheral Major class */
490         BLUETOOTH_DEVICE_MINOR_CLASS_KEY_BOARD = 0x40,          /**< Key board minor class */
491         BLUETOOTH_DEVICE_MINOR_CLASS_POINTING_DEVICE = 0x80,    /**< Pointing Device minor class */
492         BLUETOOTH_DEVICE_MINOR_CLASS_COMBO_KEYBOARD_OR_POINTING_DEVICE = 0xC0,
493                                                                 /**< Combo Keyboard or pointing
494                                                                 device minorclass */
495
496         BLUETOOTH_DEVICE_MINOR_CLASS_JOYSTICK = 0x04,           /**< JoyStick minor class */
497         BLUETOOTH_DEVICE_MINOR_CLASS_GAME_PAD = 0x08,           /**< Game Pad minor class */
498         BLUETOOTH_DEVICE_MINOR_CLASS_REMOTE_CONTROL = 0x0C,     /**< Remote Control minor class */
499         BLUETOOTH_DEVICE_MINOR_CLASS_SENSING_DEVICE = 0x10,     /**< Sensing Device minor class */
500         BLUETOOTH_DEVICE_MINOR_CLASS_DIGITIZER_TABLET = 0x14,   /**< Digitizer minor class */
501         BLUETOOTH_DEVICE_MINOR_CLASS_CARD_READER = 0x18,        /**< Card Reader minor class */
502         BLUETOOTH_DEVICE_MINOR_CLASS_DIGITAL_PEN = 0x1C,        /**< Digital pen minor class */
503         BLUETOOTH_DEVICE_MINOR_CLASS_HANDHELD_SCANNER = 0x20,   /**< Handheld scanner for bar-codes, RFID minor class */
504         BLUETOOTH_DEVICE_MINOR_CLASS_HANDHELD_GESTURAL_INPUT_DEVICE = 0x24,     /**< Handheld gestural input device minor class */
505
506         /* About Imaging Major class */
507         BLUETOOTH_DEVICE_MINOR_CLASS_DISPLAY = 0x10,            /**< Display minor class */
508         BLUETOOTH_DEVICE_MINOR_CLASS_CAMERA = 0x20,             /**< Camera minor class */
509         BLUETOOTH_DEVICE_MINOR_CLASS_SCANNER = 0x40,            /**< Scanner minor class */
510         BLUETOOTH_DEVICE_MINOR_CLASS_PRINTER = 0x80,            /**< Printer minor class */
511
512         /* About Wearable Major class */
513         BLUETOOTH_DEVICE_MINOR_CLASS_WRIST_WATCH = 0x04,        /**< Wrist watch minor class */
514         BLUETOOTH_DEVICE_MINOR_CLASS_PAGER = 0x08,              /**< Pager minor class */
515         BLUETOOTH_DEVICE_MINOR_CLASS_JACKET = 0x0C,             /**< Jacket minor class */
516         BLUETOOTH_DEVICE_MINOR_CLASS_HELMET = 0x10,             /**< Helmet minor class */
517         BLUETOOTH_DEVICE_MINOR_CLASS_GLASSES = 0x14,            /**< Glasses minor class */
518
519         /* About Toy Major class */
520         BLUETOOTH_DEVICE_MINOR_CLASS_ROBOT = 0x04,              /**< Robot minor class */
521         BLUETOOTH_DEVICE_MINOR_CLASS_VEHICLE = 0x08,            /**< Vehicle minor class */
522         BLUETOOTH_DEVICE_MINOR_CLASS_DOLL_OR_ACTION = 0x0C,     /**< Doll or Action minor class */
523         BLUETOOTH_DEVICE_MINOR_CLASS_CONTROLLER = 0x10,         /**< Controller minor class */
524         BLUETOOTH_DEVICE_MINOR_CLASS_GAME = 0x14,               /**< Game minor class */
525
526         /* About Health Major class */
527         BLUETOOTH_DEVICE_MINOR_CLASS_BLOOD_PRESSURE_MONITOR = 0x04,     /**< Blood Pressure minor class */
528         BLUETOOTH_DEVICE_MINOR_CLASS_THERMOMETER = 0x08,                /**< Thermometer minor class */
529         BLUETOOTH_DEVICE_MINOR_CLASS_WEIGHING_SCALE = 0x0C,             /**< Weighing Scale minor class */
530         BLUETOOTH_DEVICE_MINOR_CLASS_GLUCOSE_METER = 0x10,              /**< Glucose minor class */
531         BLUETOOTH_DEVICE_MINOR_CLASS_PULSE_OXIMETER = 0x14,             /**< Pulse Oximeter minor class */
532         BLUETOOTH_DEVICE_MINOR_CLASS_HEART_OR_PULSE_RATE_MONITOR = 0x18,/**< Heart or pulse rate monitor minor class */
533         BLUETOOTH_DEVICE_MINOR_CLASS_MEDICAL_DATA_DISPLAY = 0x1C,       /**< Medical minor class */
534         BLUETOOTH_DEVICE_MINOR_CLASS_STEP_COUNTER = 0x20,               /**< Step Counter minor class */
535         BLUETOOTH_DEVICE_MINOR_CLASS_BODY_COMPOSITION_ANALYZER = 0x24,  /**< Body composition analyzer minor class */
536         BLUETOOTH_DEVICE_MINOR_CLASS_PEAK_FLOW_MONITOR = 0x28,  /**< Peak flow monitor minor class */
537         BLUETOOTH_DEVICE_MINOR_CLASS_MEDICATION_MONITOR = 0x2C, /**< Medication monitor minor class */
538         BLUETOOTH_DEVICE_MINOR_CLASS_KNEE_PROSTHESIS = 0x30,    /**< Knee prosthesis minor class */
539         BLUETOOTH_DEVICE_MINOR_CLASS_ANKLE_PROSTHESIS = 0x34,   /**< Ankle prosthesis minor class */
540 } bluetooth_device_minor_class_t;
541
542 /**
543  * structure to hold the device information
544  */
545 typedef struct {
546         bluetooth_device_major_class_t major_class; /**< major device class */
547         bluetooth_device_minor_class_t minor_class; /**< minor device class */
548         bluetooth_device_service_class_t service_class;
549                                                     /**< service device class */
550 } bluetooth_device_class_t;
551
552 /**
553 * structure to hold the device information
554 */
555 typedef struct {
556         bluetooth_device_address_t device_address;      /**< device address */
557         bluetooth_device_name_t device_name;    /**< device name */
558         bluetooth_device_class_t device_class;  /**< device class */
559         char uuids[BLUETOOTH_MAX_SERVICES_FOR_DEVICE][BLUETOOTH_UUID_STRING_MAX];
560         unsigned int service_list_array[BLUETOOTH_MAX_SERVICES_FOR_DEVICE]; /**< Use enum values in bt_service_uuid_list_t */
561         int service_index;
562         int rssi;                       /**< received strength signal*/
563         gboolean paired;                /**< paired flag */
564         gboolean connected;     /**< connected flag */
565         gboolean trust;         /**< connected flag */
566 } bluetooth_device_info_t;
567
568 /**
569  * structure to hold the paired device information
570  */
571 typedef struct {
572         bluetooth_device_address_t device_address;  /**< paired device address */
573         bluetooth_device_name_t device_name;        /**< device name */
574         bluetooth_device_class_t device_class;      /**< device class */
575 } bluetooth_paired_device_info_t;
576
577 /**
578 * structure to hold the paired device information
579 */
580 typedef struct {
581         bluetooth_device_address_t device_address;
582                                                /**< device address */
583         char interface_name[BLUETOOTH_INTERFACE_NAME_LENGTH + 1];
584                                                           /**< network interface name */
585 } bluetooth_network_device_info_t;
586
587 /**
588 * Stucture to hold discovery option
589 */
590 typedef struct {
591         unsigned short max_response;    /**< the number of maximum response */
592         unsigned short discovery_duration;
593                                         /**< duration of discovery (seconds) */
594         unsigned int classOfDeviceMask; /**<  mask for values of class of device. to be used with
595                                         classOfDevice variable */
596 } bluetooth_discovery_option_t;
597
598 /**
599  * Stucture to hold event information
600  */
601 typedef struct {
602         int event;      /**< event type */
603         int result;     /**< Success or error value */
604         void *param_data;
605                         /**<parameter data pointer */
606         void *user_data;
607 } bluetooth_event_param_t;
608
609 typedef struct {
610         bluetooth_device_address_t device_addr;
611         char uuids[BLUETOOTH_MAX_SERVICES_FOR_DEVICE][BLUETOOTH_UUID_STRING_MAX];
612         unsigned int service_list_array[BLUETOOTH_MAX_SERVICES_FOR_DEVICE]; /**< Use enum values in bt_service_uuid_list_t */
613         unsigned int service_name_array[BLUETOOTH_MAX_SERVICES_FOR_DEVICE];
614         int service_index;
615 } bt_sdp_info_t;
616
617 /**
618  * Stucture to rfcomm receive data
619  */
620
621 typedef struct {
622         int socket_fd;
623                 /**< the socket fd */
624         int buffer_size;/**< the length of the receive buffer */
625         char *buffer;
626                 /**< the receive data buffer */
627 } bluetooth_rfcomm_received_data_t;
628
629 /**
630 * Stucture to rfcomm connection
631 */
632
633 typedef struct {
634         int socket_fd;
635                 /**< the socket fd */
636         int device_role;/** < Device role - RFCOMM_ROLE_SERVER or RFCOMM_ROLE_CLIENT */
637         bluetooth_device_address_t device_addr;
638                                               /**< device address */
639         char uuid[BLUETOOTH_UUID_STRING_MAX];
640 } bluetooth_rfcomm_connection_t;
641
642 /**
643  * Stucture to rfcomm disconnection
644  */
645 typedef struct {
646         int socket_fd;
647                 /**< the socket fd */
648         int device_role;/** < Device role - RFCOMM_ROLE_SERVER or RFCOMM_ROLE_CLIENT */
649         bluetooth_device_address_t device_addr;
650                                               /**< device address */
651         char uuid[BLUETOOTH_UUID_STRING_MAX];
652 } bluetooth_rfcomm_disconnection_t;
653
654 typedef struct {
655         int socket_fd;
656                 /**< the socket fd */
657         bluetooth_device_address_t device_addr;
658                                               /**< device address */
659 } bluetooth_rfcomm_connection_request_t;
660
661 /**
662  * HDP QOS types
663  */
664 typedef enum {
665         HDP_QOS_RELIABLE,
666         HDP_QOS_STREAMING,
667         HDP_QOS_ANY
668 }bt_hdp_qos_type_t;
669
670 /**
671  * HDP Role types
672  */
673 typedef enum {
674         HDP_ROLE_SOURCE = 0x0,
675         HDP_ROLE_SINK
676 }bt_hdp_role_type_t;
677
678
679 /**
680  * Stucture to HDP connected
681  */
682 typedef struct {
683         const char *app_handle; /**< the application handle */
684         unsigned int channel_id;        /**< the channel id */
685         bt_hdp_qos_type_t type; /**< the QOS type */
686         bluetooth_device_address_t device_address; /**< the remote address */
687 } bt_hdp_connected_t;
688
689 /**
690  * Stucture to HDP disconnected
691  */
692 typedef struct {
693         unsigned int channel_id; /**< the channel id */
694         bluetooth_device_address_t device_address; /**< the remote address */
695 } bt_hdp_disconnected_t;
696
697 /**
698  * Stucture to HDP data indication
699  */
700 typedef struct {
701         unsigned int channel_id;         /**< the channel id */
702         const char *buffer;      /**< the RX data buffer */
703         unsigned int size;       /**< the RX data size */
704 } bt_hdp_data_ind_t;
705
706 /**
707  * Stucture to OPP client transfer information
708  */
709 typedef struct {
710         char *filename;
711         unsigned long size;
712         int percentage;
713 }bt_opc_transfer_info_t;
714
715 /* Obex Server transfer type */
716 #define TRANSFER_PUT "PUT"
717 #define TRANSFER_GET "GET"
718 /**
719  * Stucture to OPP/FTP Server authorize information
720  */
721 typedef struct {
722         char *filename;
723         int length;
724 } bt_obex_server_authorize_into_t;
725
726 /**
727  * Stucture to OPP/FTP server transfer information
728  */
729 typedef struct {
730         char *filename;
731         char *device_name;
732         char *type;
733         int transfer_id;
734         unsigned long file_size;
735         int percentage;
736 } bt_obex_server_transfer_info_t;
737
738 /**
739  * Stucture to OOB data
740  */
741
742 typedef struct {
743         unsigned char hash[BLUETOOTH_OOB_DATA_LENGTH];
744         unsigned char randomizer[BLUETOOTH_OOB_DATA_LENGTH];
745         unsigned int hash_len;
746         unsigned int randomizer_len;
747 } bt_oob_data_t;
748
749 /**
750  * Structure to GATT attribute handle data
751  */
752
753 typedef struct {
754         int count;
755         char **handle;
756 } bt_gatt_handle_info_t;
757
758 /**
759  * Structure to GATT Remote service data
760  */
761
762 typedef struct {
763         char *uuid;
764         bt_gatt_handle_info_t handle_info;
765 } bt_gatt_service_property_t;
766
767 /**
768  * Structure to GATT Remote characteristic data
769  */
770
771 typedef struct {
772         char *service_handle;
773         bt_gatt_handle_info_t handle_info;
774 } bt_gatt_discovered_char_t;
775
776 /**
777  * Structure to format of GATT Characteristic Value
778  */
779
780 typedef struct {
781         unsigned char format;
782         unsigned char exponent;
783         unsigned short unit;
784         unsigned char name_space;
785         unsigned short description;
786 } bt_gatt_char_format_t;
787
788 /**
789  * Structure to GATT Characteristic property
790  */
791
792 typedef struct {
793         char *uuid;
794         char *name;
795         char *description;
796         bt_gatt_char_format_t format;
797         unsigned char *val;
798         unsigned int val_len;
799         char *representation;
800 } bt_gatt_char_property_t;
801
802 /**
803  * Structure to GATT Characteristic value
804  */
805
806 typedef struct {
807         char *char_handle;
808         guint8 *char_value;
809         guint32 val_len;
810 } bt_gatt_char_value_t;
811
812 /**
813  * Callback pointer type
814  */
815 typedef void (*bluetooth_cb_func_ptr) (int, bluetooth_event_param_t *, void *);
816
817 /**
818  * @fn int bluetooth_register_callback(bluetooth_cb_func_ptr callback_ptr, void *user_data)
819  * @brief Set the callback function pointer for bluetooth event
820  *
821  *
822  * This API will register the callback function, when any response and event are received from
823  * bluetooth framework. @n
824  * this registered callback function will be get called with appropriate event and data structures.
825  * This function is a synchronous call. An application developer can call
826  * bluetooth_register_callback() function to register a callback function of bluetooth_cb_func_ptr
827  * type. This registered function will receive events of bluetooth_event_type_t type along with
828  * data any.
829  *
830  *
831  * @param[in]   callback_ptr    A pointer to the callback function
832  * @param[in]   user_data    A pointer to user data
833  * @return      BLUETOOTH_ERROR_NONE - Success
834  * @remark      None
835  * @see         None
836 @code
837 void bt_event_callback(int event, bluetooth_event_param_t *param, void *user_data)
838 {
839         GMainLoop *main_loop = (GMainLoop*) user_data;
840
841         switch(event)
842         {
843                 // Code for each event
844                 default:
845                         g_main_loop_quit(main_loop);
846                         break;
847         }
848 }
849
850 int main()
851 {
852         GMainLoop *main_loop = NULL;
853         int ret = 0;
854         g_type_init();
855         main_loop = g_main_loop_new(NULL, FALSE);
856         ret = bluetooth_register_callback(bt_event_callback, (void*)main_loop);
857         if (ret >= BLUETOOTH_ERROR_NONE)
858         {
859                 // bluetooth_register_callback returned Success
860         }
861         else
862         {
863                 // bluetooth_register_callback returned failiure
864         }
865         g_main_loop_run(main_loop);
866 }
867 @endcode
868  */
869 int bluetooth_register_callback(bluetooth_cb_func_ptr callback_ptr, void *user_data);
870
871 /**
872  * @fn int bluetooth_deregister_callback(bluetooth_cb_func_ptr callback_ptr)
873  * @brief Set the callback function pointer for bluetooth event
874  *
875  *
876  * This API will register the callback function, when any response and event are received from
877  * bluetooth framework. @n
878  * this registered callback function will be get called with appropriate event and data structures.
879  * This function is a synchronous call. An application developer can call
880  * bluetooth_register_callback() function to register a callback function of bluetooth_cb_func_ptr
881  * type. This registered function will receive events of bluetooth_event_type_t type along with
882  * data any.
883  *
884  *
885  * @param[in]   none
886  * @return      BLUETOOTH_ERROR_NONE - Success
887  * @remark      None
888  * @see         None
889 @code
890 void bt_event_callback(int event, bluetooth_event_param_t *param, void *user_data)
891 {
892         GMainLoop *main_loop = (GMainLoop*) user_data;
893
894         switch(event)
895         {
896                 // Code for each event
897                 default:
898                         g_main_loop_quit(main_loop);
899                         break;
900         }
901 }
902
903 int main()
904 {
905         GMainLoop *main_loop = NULL;
906         int ret = 0;
907         g_type_init();
908         main_loop = g_main_loop_new(NULL, FALSE);
909         ret = bluetooth_register_callback(bt_event_callback, (void*)main_loop);
910         if (ret >= BLUETOOTH_ERROR_NONE)
911         {
912                 // bluetooth_register_callback returned Success
913         }
914         else
915         {
916                 // bluetooth_register_callback returned failiure
917         }
918         ret = bluetooth_deregister_callback(void);
919         g_main_loop_run(main_loop);
920 }
921 @endcode
922  */
923 int bluetooth_unregister_callback(void);
924
925 /**
926  * @fn int bluetooth_enable_adapter(void)
927  * @brief Enable the Bluetooth H/W
928  *
929  *
930  * This API can be used to activate Bluetooth. It initializes Bluetooth protocol stack for use and
931  * send request to bluetooth chip for activation.
932  * This function is typically called at startup or when Bluetooth services are required.  This
933  * function must be called before calling any other API of Bluetooth operations.
934  *
935  * Before performing any operations like Device discover, service search etc.., the adapter must be
936  * enabled.
937  *
938  * This function is a asynchronous call.
939  * If the call is success then the application will receive BLUETOOTH_EVENT_ENABLED event
940  * through registered callback function with appropriate result code
941  *                      BLUETOOTH_CHANGE_STATUS_TIMEOUT - Timeout has happen \n
942  *                      BLUETOOTH_ERROR_NONE - Success \n
943  *
944  * If the adpter is not enabled with in 30 seconds then BLUETOOTH_EVENT_ENABLED with result code
945  * BLUETOOTH_CHANGE_STATUS_TIMEOUT will come
946  *
947  * @return      BLUETOOTH_ERROR_NONE - Success\n
948  *              BLUETOOTH_ERROR_DEVICE_ALREADY_ENABLED - Adapter already enabled\n
949  *              BLUETOOTH_ERROR_ACCESS_DENIED - Enabling adapter is not allowed by MDM policy\n
950  *              BLUETOOTH_ERROR_IN_PROGRESS - Adapter is activating or deactivating\n
951  * @exception   BLUETOOTH_ERROR_INTERNAL - Dbus proxy call is fail
952  * @remark      None
953  * @see         bluetooth_check_adapter, bluetooth_disable_adapter
954 @code
955 void bt_event_callback(int event, bluetooth_event_param_t *param)
956 {
957         switch(event)
958         {
959                 case BLUETOOTH_EVENT_ENABLED:
960                         if (param->result == BLUETOOTH_ERROR_NONE)
961                         {
962                                 // Successfully Enabled
963                         }
964                         else
965                         {
966                                 // Failed
967                         }
968                         break;
969         }
970 }
971
972 ...
973
974 int ret = 0;
975 ret = bluetooth_enable_adapter();
976
977 @endcode
978  */
979 int bluetooth_enable_adapter(void);
980
981 /**
982  * @fn int bluetooth_disable_adapter(void)
983  * @brief Disable the Bluetooth H/W
984  *
985  *
986  * This function disables Bluetooth protocol stack and hardware. This function is called when
987  * Bluetooth is no longer used. It will internally free all resources and power off the RF radio.
988  *
989  * Bluetooth adapter should be disabled to switch off Bluetooth chip (and thereby saving power).
990  * bluetooth_disable_adapter() API will do that job for you. After switching off Bluetooth,
991  * BLUETOOTH_EVENT_DISABLED will be sent by SDK to application for confirmation with appropriate
992  * error code.
993  * The various error codes are BLUETOOTH_ERROR_NONE for success and BLUETOOTH_ERROR_INTERNAL for
994  * internal error.
995  *
996  * This function is a asynchronous call.
997  * If this call is success then the applications will receive BLUETOOTH_EVENT_DISABLED event
998  * through registered callback function.
999  *
1000  *
1001  * @return      BLUETOOTH_ERROR_NONE - Success\n
1002  *              BLUETOOTH_ERROR_IN_PROGRESS - Adapter is activating or deactivating\n
1003  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Bluetooth adapter is not enabled\n
1004  * @exception   BLUETOOTH_ERROR_INTERNAL - Dbus proxy call is fail
1005  * @remark      None
1006  * @see         bluetooth_check_adapter, bluetooth_enable_adapter
1007 @code
1008 void bt_event_callback(int event, bluetooth_event_param_t *param)
1009 {
1010         switch(event)
1011         {
1012                 case BLUETOOTH_EVENT_DISABLED:
1013                         if (param->result == BLUETOOTH_ERROR_NONE)
1014                         {
1015                                 // Successfully disabled
1016                         }
1017                         else
1018                         {
1019                                 // Failed
1020                         }
1021                         break;
1022         }
1023 }
1024
1025 ...
1026
1027 int ret = 0;
1028 ret = bluetooth_disable_adapter();
1029 @endcode
1030  */
1031 int bluetooth_disable_adapter(void);
1032
1033
1034 /**
1035  * @fn int bluetooth_is_supported(void)
1036  * @brief Check if the bluetooth is supported or not by the current target
1037  *
1038  * This API checks whether the bluetooth is supported or not.
1039  * This API only run by root permission.
1040  * This API was made for the MDM service.
1041  *
1042  * This function is a synchronous call.
1043  *
1044  * @return      0 - if bluetooth is not supported\n
1045  *              1 - if bluetooth is supported\n
1046  *              BLUETOOTH_ERROR_INTERNAL - Error in API internal
1047  * @remark      None
1048 @code
1049
1050 int ret = 0;
1051 ret = bluetooth_is_supported();
1052 @endcode
1053  */
1054 int bluetooth_is_supported(void);
1055
1056
1057 /**
1058  * @fn int bluetooth_check_adapter(void)
1059  * @brief Check the current status of the Bluetooth adapter
1060  *
1061  *
1062  * This API checks whether the Bluetooth adapter is enabled or not. Before performing any operations
1063  * the bluetooth adapter should be enabled. This API helps to find out the current state of the
1064  * bluetooth adapter.
1065  * This API get the adapter internal data structure and check current adapter status.
1066  *
1067  * This function is a synchronous call.
1068  *
1069  *
1070  * @return      BLUETOOTH_ADAPTER_DISABLED - if bluetooth adapter is disabled\n
1071  *              BLUETOOTH_ADAPTER_ENABLED - if bluetooth adapter is enabled\n
1072  * @remark      None
1073  * @see         bluetooth_enable_adapter, bluetooth_disable_adapter
1074 @code
1075
1076 int ret = 0;
1077 ret = bluetooth_check_adapter();
1078 @endcode
1079  */
1080 int bluetooth_check_adapter(void);
1081
1082 /**
1083  * @fn int bluetooth_get_local_address(bluetooth_device_address_t *local_address)
1084  * @brief Get the local adapter bluetooth address
1085  *
1086  *
1087  * This API is used, get the device address of the local bluetooth adapter. Before calling this API,
1088  * the adapter should be enabled.
1089  * In its output parameter, you can receive bluetooth_device_address_t type of pointer which will
1090  * contain Bluetooth address.
1091  * Since its inconvenient for user to remember the address, Bluetooth provides a method to have a
1092  * friendly name for each device.
1093  * There is no event callback for this API.
1094  *
1095  * This function is a synchronous call.
1096  *
1097  *
1098  * @return      BLUETOOTH_ERROR_NONE - Succeess \n
1099  *              BLUETOOTH_ERROR_INVALID_PARAM -  Invalid parameter (NULL buffer) \n
1100  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED -  Adapter is disabled \n
1101  * @param[out]  local_address   a device address of local bluetooth adapter
1102  * @remark      None
1103  * @see         None
1104 @code
1105
1106 bluetooth_device_address_t local_address={0,};
1107 int ret = 0;
1108
1109 ret = bluetooth_get_local_address(&local_address);
1110 @endcode
1111  */
1112 int bluetooth_get_local_address(bluetooth_device_address_t *local_address);
1113
1114 /**
1115  * @fn int bluetooth_get_local_name(bluetooth_device_name_t* local_name)
1116  * @brief Get the local device name
1117  *
1118  *
1119  * This function is used, get the local device name. Since its difficult to remember the Adapter
1120  * address, the friendly name can be assigned to the adapter and we can get it using this API. This
1121  * friendly name is retrived by the remote device and displaying.
1122  * Before calling this API, the adapter should be enabled. There is no event callback for this API.
1123  *
1124  * This function is a synchronous call.
1125  *
1126  *
1127  * @return      BLUETOOTH_ERROR_NONE - Success \n
1128  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter (NULL buffer)\n
1129  * @param[out]  local_name      a local device name
1130  * @remark      None
1131  * @see         None
1132 @code
1133 bluetooth_device_name_t local_name={0,}
1134 int ret = 0;
1135 ret = bluetooth_get_local_name (&local_name);
1136 @endcode
1137  */
1138 int bluetooth_get_local_name(bluetooth_device_name_t *local_name);
1139
1140 /**
1141  * @fn int bluetooth_set_local_name(const bluetooth_device_name_t *local_name)
1142  * @brief Set the local device name
1143  *
1144  *
1145  * This function is used to set the local device name. This is a human friendly name whose
1146  * length can be BLUETOOTH_DEVICE_NAME_LENGTH_MAX maximum
1147  *
1148  * This function is a synchronous call.
1149  *
1150  * @param[in]   local_name   bluetooth device name to set local device
1151  *
1152  * @return      BLUETOOTH_ERROR_NONE - Success \n
1153  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
1154  *              BLUETOOTH_ERROR_INVALID_PARAM - Bluetooth name parameter is incorrect \n
1155  *              BLUETOOTH_ERROR_INVALID_DATA - Device address provided is incorrect \n
1156  *              BLUETOOTH_ERROR_NO_RESOURCES - Pre-allocated memory error \n
1157  *              BLUETOOTH_ERROR_INTERNAL - The dbus method call is fail \n
1158  *
1159  * @remark      None
1160
1161 @code
1162 bluetooth_device_name_t local_name={0,}
1163 int ret = 0;
1164 ret = bluetooth_set_local_name (&local_name);
1165 @endcode
1166  */
1167 int bluetooth_set_local_name(const bluetooth_device_name_t *local_name);
1168
1169
1170 /**
1171  * @fn int bluetooth_is_service_used(const char *service_uuid, gboolean *used)
1172  * @brief Check if the uuid is used or not
1173  *
1174  * This function is used to check if the uuid is used or not.
1175  *
1176  * This function is a synchronous call.
1177  *
1178  * @param[in]   service_uuid   service uuid (UUID 128 bit as string)
1179  * @param[out] used  if the uuid is used or not
1180  *
1181  * @return      BLUETOOTH_ERROR_NONE - Success \n
1182  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
1183  *              BLUETOOTH_ERROR_INVALID_PARAM - Bluetooth name parameter is incorrect \n
1184  *              BLUETOOTH_ERROR_INTERNAL - The dbus method call is fail \n
1185  *
1186  * @remark      None
1187  *
1188 @code
1189 gboolean used = FALSE;
1190 const char *uuid ="00001101-0000-1000-8000-00805F9B34FB";
1191 ret = bluetooth_is_service_used(uuid, &used);
1192 @endcode
1193  */
1194 int bluetooth_is_service_used(const char *service_uuid, gboolean *used);
1195
1196 /**
1197  * @fn int bluetooth_is_device_connected(const bluetooth_device_address_t *device_address, bluetooth_service_type_t type, gboolean *is_connected)
1198  * @brief Check if the device is connected to the specific service
1199  *
1200  * This function is used to check if if the device is connected to the specific service.
1201  *
1202  * This function is a synchronous call.
1203  *
1204  * @param[in]   local_address   a device address of remote bluetooth device
1205  * @param[in]   type the service type
1206  * @param[out] is_connected  if the device is connected or not
1207  *
1208  * @return      BLUETOOTH_ERROR_NONE - Success \n
1209  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
1210  *              BLUETOOTH_ERROR_INVALID_PARAM - Bluetooth name parameter is incorrect \n
1211  *              BLUETOOTH_ERROR_INTERNAL - The dbus method call is fail \n
1212  *
1213  * @remark      None
1214  *
1215 @code
1216 gboolean is_connected = FALSE;
1217 bluetooth_device_address_t device_address={{0x00,0x0D,0xFD,0x24,0x5E,0xFF}};
1218 ret = bluetooth_is_device_connected(&device_address, BLUETOOTH_HSP_SERVICE, &used);
1219 @endcode
1220  */
1221 int bluetooth_is_device_connected(const bluetooth_device_address_t *device_address,
1222                                 bluetooth_service_type_t type,
1223                                 gboolean *is_connected);
1224
1225 /**
1226  * @fn int bluetooth_get_discoverable_mode(bluetooth_discoverable_mode_t *discoverable_mode_ptr)
1227  * @brief Get the visibility mode
1228  *
1229  *
1230  * This function is used to get the discoverable mode (Visibility option). Depending upon the
1231  * visibity mode, the property of the device is determined whether it can be discoverable, non
1232  * discoverable, connectable etc. Before calling this API make sure that the adapter is enabled.
1233  *
1234  * This function is a synchronous call.
1235  *
1236  *
1237  * @return      BLUETOOTH_ERROR_NONE - Success \n
1238  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
1239  *              BLUETOOTH_ERROR_INVALID_DATA - Invalid data \n
1240  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
1241  *              BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
1242  * @param[out]  discoverable_mode   current bluetooth discoverable mode
1243  * @remark      None
1244  * @see         bluetooth_set_discoverable_mode
1245  @code
1246  bluetooth_discoverable_mode_t discoverable_mode_ptr;
1247  int ret = 0;
1248  ret = bluetooth_get_discoverable_mode (&discoverable_mode_ptr);
1249  @endcode
1250  */
1251 int bluetooth_get_discoverable_mode(bluetooth_discoverable_mode_t *discoverable_mode_ptr);
1252
1253 /**
1254  * @fn int bluetooth_set_discoverable_mode(bluetooth_discoverable_mode_t discoverable_mode,
1255  *                                              int timeout)
1256  * @brief Set the visibility mode
1257  *
1258  *
1259  * This function is used to set the discoverable mode (Visibility option).
1260  *
1261  * Many times user may want to keep his device discoverable so that when peer device is performing
1262  * device search, he/she can find user's device. Application programmer can keep the mode as
1263  * BLUETOOTH_DISCOVERABLE_MODE_GENERAL_DISCOVERABLE or
1264  * BLUETOOTH_DISCOVERABLE_MODE_TIME_LIMITED_DISCOVERABLE for the same purpose. However, all these
1265  * modes cause bluetooth adapter to consume more battery. Hence developer should generally
1266  * keep discoverable mode as BLUETOOTH_DISCOVERABLE_MODE_CONNECTABLE.
1267  *
1268  * This function is a synchronous call.
1269  *
1270  * @return      BLUETOOTH_ERROR_NONE - Success \n
1271  *              BLUETOOTH_ERROR_NOT_SUPPORT - Requested mode is not supported \n
1272  *
1273  * @param[in]  discoverable_mode   the bluetooth discoverable mode to set
1274  * @param[in]  timeout   discoverable time in only limited discoverable mode (second), default: 0
1275  * @remark      None
1276  * @see         bluetooth_get_discoverable_mode
1277
1278 @code
1279
1280 bluetooth_discoverable_mode_t mode;
1281 int ret = 0;
1282 mode= BLUETOOTH_DISCOVERABLE_MODE_TIME_LIMITED_DISCOVERABLE;
1283 ret = bluetooth_set_discoverable_mode (mode, 180);
1284
1285 @endcode
1286  */
1287 int bluetooth_set_discoverable_mode(bluetooth_discoverable_mode_t discoverable_mode,
1288                                             int timeout);
1289
1290
1291 /**
1292  * @fn int bluetooth_get_timeout_value(int *timeout)
1293  * @brief Get the visibility timeout value
1294  *
1295  *
1296  * This function is used to get the visibility timeout
1297  * Before calling this API make sure that the adapter is enabled.
1298  *
1299  * This function is a synchronous call.
1300  *
1301  *
1302  * @return      BLUETOOTH_ERROR_NONE - Success \n
1303  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
1304  *              BLUETOOTH_ERROR_INVALID_DATA - Invalid data \n
1305  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
1306  *              BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
1307  * @param[out]  timeout   remain visibility timeout value
1308  * @remark      None
1309  * @see         bluetooth_set_discoverable_mode
1310  @code
1311  int timeout;
1312  int ret = 0;
1313  ret = bluetooth_get_timeout_value (&timeout);
1314  @endcode
1315  */
1316 int bluetooth_get_timeout_value(int *timeout);
1317
1318
1319 /**
1320  * @fn int bluetooth_start_discovery(unsigned short max_response, unsigned short discovery_duration,
1321  *                                      unsigned int  classOfDeviceMask)
1322  * @brief Start the device discovery
1323  *
1324  * To connect connect to peer bluetooth device, you will need to know its bluetooth address and its
1325  * name. You can search for Bluetooth devices in vicinity by bluetooth_start_discovery() API. It
1326  * first performs an inquiry. For each device found from the inquiry it gets the remote name of the
1327  * device. Bluetooth device address and name are given to Application via
1328  * BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND event. In param_data of bluetooth_event_param_t, you will
1329  * receive a pointer to a structure of bluetooth_device_info_t type. you will receive device
1330  * address, device name, device class, rssi (received signal strength indicator). please see
1331  * bluetooth_device_info_t for more details.
1332  *
1333  *
1334  * This API provides searching options like max responses, discovery duration in seconds and class
1335  * of device mask to filter device search. some times there may be too many bluetooth devices in
1336  * vicinity of your device.in such scenario, application can request to reduce number of responces
1337  * (BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND event) with help of max_response parameter. However if you
1338  * pass zero, bluetooth adapter will not restrict number of responses. you can also specify duration
1339  * of the seach in discovery_duration. bluetooth adapter will automatically stop device search after
1340  * application defined time. please note that discovery_duration should be mentioned in seconds.
1341  * Also note that search will end after 180 seconds automatically if you pass 0 in discovery
1342  * duration.
1343  *
1344  * sometimes user may want to search for a perticular kind of device. for ex, mobile or pc. in such
1345  * case, you can use classOfDeviceMask parameter. please see bluetooth_device_service_class_t,
1346  * bluetooth_device_major_class_t and bluetooth_device_minor_class_t enums
1347  *
1348  * This function is a asynchronous call.
1349  * If the call is success then the application will receive BLUETOOTH_EVENT_DISCOVERY_STARTED event
1350  * through registered callback function.
1351  *
1352  * The discovery is responded by an BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND event for each device it
1353  * finds and an BLUETOOTH_EVENT_REMOTE_DEVICE_NAME_UPDATED event for each fount device its name
1354  * finds.
1355  *
1356  * The completion or cancellation of the discovery is indicated by an
1357  * BLUETOOTH_EVENT_DISCOVERY_FINISHED event.
1358  *
1359  * The device discovery can be cancelled by calling bluetooth_stop_discovery().
1360  *
1361  *
1362  * @return      BLUETOOTH_ERROR_NONE - Success \n
1363  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Bluetooth adapter is not enabled \n
1364  *              BLUETOOTH_ERROR_DEVICE_BUSY - Bluetooth adapter is busy doing some operation \n
1365  *              BLUETOOTH_ERROR_INTERNAL - System error like heap full has occured or bluetooth
1366                                                 agent is not running \n
1367  *
1368  * @param[in] max_response              define the maximum response of the number of founded devices
1369                                         (0 means unlimited)
1370  * @param[in] discovery_duration        define bluetooth discovery duration (0 means 180s )
1371  * @param[in] classOfDeviceMask         define classes of the device mask which user wants
1372                                         (refer to class of device)
1373  * @remark      None
1374  * @see         bluetooth_cancel_discovery, bluetooth_device_info_t
1375
1376 @code
1377 void bt_event_callback(int event, bluetooth_event_param_t *param)
1378 {
1379         switch(event)
1380         {
1381                 case BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND:
1382                 {
1383                         bluetooth_device_info_t *device_info = NULL;
1384                         printf("BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND, result [0x%04x]",
1385                                         param->result);
1386                         device_info  = (bluetooth_device_info_t *)param->param_data;
1387                         memcpy(&searched_device, &device_info->device_address,
1388                                                 sizeof(bluetooth_device_address_t));
1389                         printf("dev [%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X]",
1390                                 device_info->device_address.addr[0],
1391                                 device_info->device_address.addr[1],
1392                                 device_info->device_address.addr[2],
1393                                 device_info->device_address.addr[3],
1394                                 device_info->device_address.addr[4],
1395                                 device_info->device_address.addr[5]);
1396                         break;
1397                 }
1398                 case BLUETOOTH_EVENT_REMOTE_DEVICE_NAME_UPDATED:
1399                 {
1400                         bluetooth_device_info_t *device_info = NULL;
1401                         printf("BLUETOOTH_EVENT_REMOTE_DEVICE_NAME_UPDATED, result [0x%04x]",
1402                                                                                 param->result);
1403                         device_info  = (bluetooth_device_info_t *)param->param_data;
1404                         memcpy(&searched_device, &device_info->device_address,
1405                                                                 sizeof(bluetooth_device_address_t));
1406                         printf("dev [%s] [%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X]",
1407                                                         device_info->device_name.name,
1408                                                         device_info->device_address.addr[0],
1409                                                         device_info->device_address.addr[1],
1410                                                         device_info->device_address.addr[2],
1411                                                         device_info->device_address.addr[3],
1412                                                         device_info->device_address.addr[4],
1413                                                         device_info->device_address.addr[5]);
1414                         break;
1415                 }
1416
1417                 case BLUETOOTH_EVENT_DISCOVERY_FINISHED:
1418                         printf("BLUETOOTH_EVENT_DISCOVERY_FINISHED, result[0x%04x]", param->result);
1419                         break;
1420         }
1421 }
1422
1423 unsigned short max_response;
1424 unsigned short discovery_duration;
1425 unsigned classOfDeviceMask;
1426 int ret = 0;
1427
1428 max_response =0;
1429 discovery_duration =0;
1430 classOfDeviceMask =0;
1431
1432 ret = bluetooth_start_discovery(max_response,discovery_duration,classOfDeviceMask);
1433
1434 @endcode
1435  *
1436  */
1437
1438 int bluetooth_start_discovery(unsigned short max_response,
1439                                       unsigned short discovery_duration,
1440                                       unsigned int classOfDeviceMask);
1441
1442 /**
1443  * @fn int bluetooth_cancel_discovery (void)
1444  * @brief Cancel the on-going device discovery operation
1445  *
1446  *
1447  * This function stops the on-going device discovery operation. This API has to be called after the
1448  * bluetooth_start_discovery API and before the BLUETOOTH_EVENT_DISCOVERY_FINISHED event comes of
1449  * the bluetooth_start_discovery API
1450  *
1451  * Normally the device discovery takes a more time (~10.24 seconds) to get all the devices in its
1452  * vicinity and it recevies as BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND event. This API helps us to
1453  * cancel the discover request once the user received the device to which he wish to connect.
1454  *
1455  * This function is a asynchronous call.
1456  * If the call is success to cancel discovey then the application will receive
1457  * BLUETOOTH_EVENT_DISCOVERY_FINISHED event through registered callback function
1458  * with an error code BLUETOOTH_ERROR_CANCEL. In the case of failure the error code will be
1459  * BLUETOOTH_ERROR_NONE
1460  *
1461  *
1462  * @return      BLUETOOTH_ERROR_NONE - Success \n
1463  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
1464  *              BLUETOOTH_ERROR_NOT_IN_OPERATION - No Discovery operation in progess to cancel \n
1465  *              BLUETOOTH_ERROR_ACCESS_DENIED - Currently in discovery but it is requested from
1466                                                 other application \n
1467  *              BLUETOOTH_ERROR_INTERNAL - Internel IPC error \n
1468  * @remark      None
1469  * @see         bluetooth_start_discovery
1470 @code
1471 void bt_event_callback(int event, bluetooth_event_param_t *param)
1472 {
1473         switch(event)
1474         {
1475                 case BLUETOOTH_EVENT_DISCOVERY_FINISHED:
1476                         TC_PRT("BLUETOOTH_EVENT_DISCOVERY_FINISHED, result[0x%04x]", param->result);
1477                         break;
1478         }
1479 }
1480
1481 ..
1482
1483 int ret = 0;
1484
1485 ret = bluetooth_cancel_discovery();
1486 @endcode
1487  */
1488 int bluetooth_cancel_discovery(void);
1489
1490 /**
1491  * @fn int bluetooth_is_discovering(void)
1492  * @brief Check for the device discovery is in-progress or not.
1493  *
1494  * This API is used to check the current status of the Discovery operation.If discovery is in\
1495  * progress normally other operations are not allowed.
1496  * If a device discovery is in progress, we have to either cancel the discovery operation or wait
1497  * for the BLUETOOTH_EVENT_DISCOVERY_FINISHED
1498  * event before performing other operations. This API is used to get for the current discovery
1499  * operation status and using bluetooth_cancel_discovery()
1500  * we can cancell the ongoing discovery process.
1501  * Before calling this API, make sure that the adapter is enabled. There is no callback event for
1502  * this API.
1503  *
1504  * This function checks whether the device discovery is started or not.
1505  *
1506  * This function is a synchronous call.
1507  *
1508  *
1509  * @return      BLUETOOTH_ERROR_NONE - Discovery is not in progress \n
1510  *              BLUETOOTH_ERROR_NONE+1 - Discovery in progress \n
1511  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
1512  *
1513  * @remark      None
1514  * @see         bluetooth_start_discovery, bluetooth_cancel_discovery
1515
1516 @code
1517 int ret = 0;
1518 ret = bluetooth_is_discovering ();
1519 @endcode
1520  */
1521 int bluetooth_is_discovering(void);
1522
1523 /**
1524  * @fn int bluetooth_bond_device(const bluetooth_device_address_t *device_address)
1525  * @brief Initiate a bonding process
1526  *
1527  *
1528  * This function initiates a bonding procedure with a peer device.  The bonding procedure
1529  * enables authentication and optionally encryption on the Bluetooth link.
1530  *
1531  * Bonding is applied to the discovered device to which we need a secure connection. We cannot
1532  * inititate the bonding request to the devices already in the paired list.
1533  *
1534  * Usually we call this API after the device discovery.
1535  * This function is a asynchronous call.
1536  *
1537  * Response will be received through BLUETOOTH_EVENT_BONDING_FINISHED event. It can any of the below
1538  * mentioed result code
1539  * BLUETOOTH_ERROR_PARING_FAILED - Pairing faied \n
1540  * BLUETOOTH_ERROR_ACCESS_DENIED - Authetication rejected \n
1541  * BLUETOOTH_ERROR_CANCEL_BY_USER - Cancelled by the user \n
1542  * BLUETOOTH_ERROR_PARING_FAILED - Pairing failed \n
1543  * BLUETOOTH_ERROR_TIMEOUT - Timeout has haapened \n
1544  *
1545  * If the remote user is not responding with in a specific time(60 seconds), then a timeout happens
1546  * and BLUETOOTH_EVENT_BONDING_FINISHED callback event is called with and BLUETOOTH_ERROR_TIMEOUT
1547  * result code
1548  *
1549  * The bonding operation can be cancelled by calling bluetooth_cancel_bonding().
1550  *
1551  *
1552  * @return      BLUETOOTH_ERROR_NONE - Success \n
1553  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
1554  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
1555  *              BLUETOOTH_ERROR_DEVICE_BUSY - Adapter is busy or Discovery is in Progress \n
1556  *              BLUETOOTH_ERROR_INVALID_DATA - Invalid BD address \n
1557  * @exception   None
1558  * @param[in]   device_address   This indicates an address of the device with which the pairing
1559  *                                      should be initiated
1560  * @remark      None
1561  * @see         bluetooth_cancel_bonding
1562  @code
1563 void bt_event_callback(int event, bluetooth_event_param_t *param)
1564 {
1565         switch(event)
1566         {
1567                 case BLUETOOTH_EVENT_BONDING_FINISHED:
1568                 {
1569                         TC_PRT("BLUETOOTH_EVENT_BONDING_FINISHED, result [0x%04x]", param->result);
1570                         if (param->result >= BLUETOOTH_ERROR_NONE)
1571                         {
1572                                 bluetooth_device_info_t *device_info = NULL;
1573                                 device_info  = (bluetooth_device_info_t *)param->param_data;
1574                                 printf("dev [%s] [%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X]
1575                                                         mjr[%#x] min[%#x] srv[%#x]",
1576                                                         device_info->device_name.name,
1577                                                         device_info->device_address.addr[0],
1578                                                         device_info->device_address.addr[1],
1579                                                         device_info->device_address.addr[2],
1580                                                         device_info->device_address.addr[3],
1581                                                         device_info->device_address.addr[4],
1582                                                         device_info->device_address.addr[5],
1583                                                         device_info->device_class.major_class,
1584                                                         device_info->device_class.minor_class,
1585                                                         device_info->device_class.service_class);
1586                         }
1587                         else
1588                         {
1589                                 //bonding failed
1590                         }
1591                         break;
1592                 }
1593         }
1594 }
1595
1596 ...
1597
1598 int ret = 0;
1599 bluetooth_device_address_t device_address={{0}};
1600
1601 ret = bluetooth_bond_device(&device_address);
1602
1603 @endcode
1604  */
1605 int bluetooth_bond_device(const bluetooth_device_address_t *device_address);
1606
1607 /**
1608  * @fn int bluetooth_cancel_bonding(void)
1609  * @brief Cancel the on-going bonding process
1610  *
1611  * This API is called to cancel the on-going bonding procedure. It should be called before the
1612  * BLUETOOTH_EVENT_BONDING_FINISHED event comes.
1613  * This API is useful when the remote device is not responding to the bond request or we wish to
1614  * cancel the bonding request. In this case we need not wait for the timeout to happen.
1615  *
1616  * This function is a synchronous call.
1617  *
1618  * @return      BLUETOOTH_ERROR_NONE - Success \n
1619  *              BLUETOOTH_ERROR_NOT_IN_OPERATION - No bonding request in progress \n
1620  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
1621  * @exception   None
1622  * @remark      None
1623  * @see         bluetooth_bond_device
1624 @code
1625 ...
1626
1627 int ret = 0;
1628
1629 ret = bluetooth_cancel_bonding();
1630 @endcode
1631  */
1632 int bluetooth_cancel_bonding(void);
1633
1634 /**
1635  * @fn int bluetooth_unbond_device(const bluetooth_device_address_t *device_address)
1636  * @brief Remove bonding
1637  *
1638  *
1639  * To communicate with remote device over bluetooth link, user should bond with peer device.
1640  * After bonding is over, peer device is added to list of bonded devices. bluetooth_unbond_device()
1641  * API is used to remove peer device from the list. Please note that after removing the device
1642  * from bonded device list, you cannot communication with peer device until bonding happens again.
1643  *
1644  * User can call this function by passing bluetooth device address of any bonded device. Please note
1645  * that after successful return of this function, any bluetooth application running on your device
1646  * will not be able to communicate with unbonded device until bond operation happens again using
1647  * bluetooth_bond_device()
1648  *
1649  *
1650  * This function is a asynchronous call. The request to remove the specified device from the bonded
1651  * list is responded by an BLUETOOTH_EVENT_BONDED_DEVICE_REMOVED event. if the operation is success,
1652  * you will receive BLUETOOTH_ERROR_NONE. BLUETOOTH_ERROR_NOT_PAIRED may be received in result code
1653  * in case if there is a problem in locating given bluetooth device address in bonded devices list
1654  *
1655  *
1656  *
1657  * @return      BLUETOOTH_ERROR_NONE - Success \n
1658  *              BLUETOOTH_ERROR_INVALID_PARAM - Device address is not valid \n
1659  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Bluetooth adapter is not enabled \n
1660  *              BLUETOOTH_ERROR_DEVICE_BUSY     - Bluetooth adapter is busy doing some operation \n
1661  *              BLUETOOTH_ERROR_INVALID_DATA - Device address provided is incorrect \n
1662  *              BLUETOOTH_ERROR_INTERNAL - System error like heap full has occured or bluetooth
1663  *                                              agent is not running \n
1664  *              BLUETOOTH_ERROR_NOT_PAIRED - Device address mentioned in the argument is not a
1665  *                                              bonded device \n
1666  *
1667  * @param[in]   device_address   This indicates an address of the device to remove bonding
1668  *
1669  * @remark      None
1670  *
1671  * @see         bluetooth_bond_device, bluetooth_cancel_bonding
1672  *
1673 @code
1674 void bt_event_callback(int event, bluetooth_event_param_t *param)
1675 {
1676         switch(event) {
1677                 case BLUETOOTH_EVENT_BONDED_DEVICE_REMOVED: {
1678                         bluetooth_device_address_t *dev_addr = NULL;
1679
1680                         if (param->result == BLUETOOTH_ERROR_NONE) {
1681                                 dev_addr = (bluetooth_device_address_t *)param->param_data;
1682                                 //Unbound scuccess
1683                                 printf("%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n",
1684                                         dev_addr->addr[0], dev_addr->addr[1]
1685                                         dev_addr->addr[2], dev_addr->addr[3]
1686                                         dev_addr->addr[4], dev_addr->addr[5]
1687                         } else {
1688                                 //unbound failure
1689                         }
1690                 }
1691         }
1692 }
1693
1694 ...
1695
1696 int ret = 0;
1697 bluetooth_device_address_t *device_address;
1698
1699 // copy valid device address in device_address
1700
1701 ret = bluetooth_unbond_device(device_address);
1702 @endcode
1703  */
1704 int bluetooth_unbond_device(const bluetooth_device_address_t *device_address);
1705
1706 /**
1707  * @fn int bluetooth_get_bonded_device_list(GPtrArray **dev_list)
1708  * @brief Get bonded(paired) device list
1709  *
1710  *
1711  * This API gets all bonded device list.
1712  * The devices in the bonded device list further can be used to perform the authorization by calling
1713  * bluetooth_authorize_device API.
1714  *
1715  * This function is a synchronous call.
1716  * Information for bonded devices can be obtained when result code is BLUETOOTH_ERROR_NONE. If not,
1717  * there is no valid information in the dev_list.
1718  * The len field in the dev_list represents the number of bonded devices. The data structure for
1719  * bonded device information is bluetooth_device_info_t.
1720  *
1721  *
1722  * @return      BLUETOOTH_ERROR_NONE - Success \n
1723  *              BLUETOOTH_ERROR_NOT_SUPPORT - Opreation not supported \n
1724  * @remark      None
1725  * @see         bluetooth_bond_device, bluetooth_unbond_device, bluetooth_authorize_device
1726  @code
1727 void bt_get_bonded_devices(void)
1728 {
1729 ...
1730         int i;
1731         GPtrArray *devinfo = NULL;
1732         bluetooth_device_info_t *ptr;
1733
1734         // allocate the g_pointer_array
1735         devinfo = g_ptr_array_new();
1736
1737         ret = bluetooth_get_bonded_device_list(&devinfo);
1738         if (ret != BLUETOOTH_ERROR_NONE)
1739         {
1740                 printf("bluetooth_get_bonded_device_list failed with [%d]",ret);
1741         }
1742         else
1743         {
1744                 printf("g pointer arrary count : [%d]", devinfo->len);
1745                 for (i=0; i<devinfo->len; i++)
1746                 {
1747                         ptr = g_ptr_array_index(devinfo, i);
1748                         if (ptr != NULL)
1749                         {
1750                                 printf("Name [%s]\n", ptr->device_name.name);
1751                                 printf("Major Class [%d]\n", ptr->device_class.major_class);
1752                                 printf("Minor Class [%d]\n", ptr->device_class.minor_class);
1753                                 printf("Service Class [%d]\n", ptr->device_class.service_class);
1754                                 printf("%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n",
1755                                                                 ptr->device_address.addr[0],
1756                                 ptr->device_address.addr[1], ptr->device_address.addr[2],
1757                                                                 ptr->device_address.addr[3],
1758                                 ptr->device_address.addr[4], ptr->device_address.addr[5]);
1759
1760                                 // handle
1761                                 ...
1762                         }
1763                 }
1764         }
1765         // free g_pointer_array
1766         g_ptr_array_free(devinfo, TRUE);
1767 }
1768
1769 @endcode
1770  */
1771 int bluetooth_get_bonded_device_list(GPtrArray **dev_list);
1772
1773 /**
1774  * @fn int bluetooth_get_bonded_device(const bluetooth_device_address_t *device_address,
1775  *                                      bluetooth_device_info_t *dev_info)
1776  * @brief Get a bonded(paired) device
1777  *
1778  *
1779  * This API gets a bonded device.
1780  *
1781  * This function is a synchronous call.
1782  * Information for bonded devices can be obtained when result code is BLUETOOTH_ERROR_NONE. If not,
1783  * there is no valid information in the dev_info.
1784  * The data structure for bonded device information is bluetooth_device_info_t.
1785  *
1786  *
1787  * @return      BLUETOOTH_ERROR_NONE - Success \n
1788  *              BLUETOOTH_ERROR_NOT_SUPPORT - Opreation not supported \n
1789  * @remark      None
1790  * @see         bluetooth_bond_device, bluetooth_unbond_device, bluetooth_authorize_device
1791  @code
1792 void bt_get_bonded_device(void)
1793 {
1794 ...
1795         int i;
1796         bluetooth_device_info_t devinfo = {0};
1797         bluetooth_device_address_t device_address={{0x00,0x1C,0x43,0x2B,0x1A,0xE5}};
1798
1799         ret = bluetooth_get_bonded_device(&device_address, &devinfo);
1800         if (ret != BLUETOOTH_ERROR_NONE)
1801         {
1802                 printf("bluetooth_get_bonded_device failed with [%d]",ret);
1803         }
1804         else
1805         {
1806                 printf("Name [%s]\n", devinfo.device_name.name);
1807                 printf("Major Class [%d]\n", devinfo.device_class.major_class);
1808                 printf("Minor Class [%d]\n", devinfo.device_class.minor_class);
1809                 printf("Service Class [%d]\n", devinfo.device_class.service_class);
1810                 printf("%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n", devinfo.device_address.addr[0],
1811                 devinfo.device_address.addr[1], devinfo.device_address.addr[2],
1812                 devinfo.device_address.addr[3], devinfo.device_address.addr[4],
1813                 devinfo.device_address.addr[5]);
1814
1815                 // handle
1816                 ...
1817         }
1818 }
1819
1820 @endcode
1821  */
1822 int bluetooth_get_bonded_device(const bluetooth_device_address_t *device_address,
1823                                         bluetooth_device_info_t *dev_info);
1824
1825 /**
1826  * @fn int bluetooth_set_alias(const bluetooth_device_address_t *device_address, const char *alias)
1827  * @brief set alias for bonded device
1828  *
1829  *
1830  * This function set alias for bonded device.
1831  *
1832  * This function is a synchronous call.
1833  *
1834  *
1835  * @return      BLUETOOTH_ERROR_NONE - Success \n
1836  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
1837  * @param[in]   device_address   This indicates an address of the remote device
1838  * @param[in]   alias                   This indicates an alias to set
1839  * @remark      None
1840  * @see         None
1841 @code
1842 int ret = 0;
1843 ret = bluetooth_set_alias(&remote_address);
1844 @endcode
1845  */
1846 int bluetooth_set_alias(const bluetooth_device_address_t *device_address,
1847                                 const char *alias);
1848
1849 /**
1850  * @fn int bluetooth_get_remote_device(const bluetooth_device_address_t *device_address)
1851  * @brief Get remote deivice
1852  *
1853  *
1854  * This function gets specific remote device.
1855  *
1856  * This function is a asynchronous call.
1857  * This API is responded by an BLUETOOTH_EVENT_REMOTE_DEVICE_READ event.
1858  *
1859  *
1860  * @return      BLUETOOTH_ERROR_NONE - Success \n
1861  *              BLUETOOTH_ERROR_NOT_SUPPORT - Operation not supported \n
1862  * @param[in]   device_address   This indicates an address of the remote device
1863  * @remark      None
1864  * @see         None
1865 @code
1866 int ret = 0;
1867 ret = bluetooth_get_remote_device(&remote_address);
1868 @endcode
1869  */
1870 int bluetooth_get_remote_device(const bluetooth_device_address_t *device_address);
1871
1872 /**
1873  * @fn int bluetooth_authorize_device(const bluetooth_device_address_t *device_address,
1874  *                                      gboolean authorized)
1875  * @brief Authorize/Unauthorize a bonded device
1876  *
1877  *
1878  * This function authorizes/unauthorize a bonded device. It decides the device to connect
1879  * with/without user confirmation.
1880  *
1881  * If we select a paired device and make it authorized by calling this API with the authorized
1882  * parameter to TRUE, then it will not ask for the user conformation before connecting. Similarly
1883  * if we unauthorize the paired device by calling this API with the authorized parameter to FALSE,
1884  * then it will ask for the user conformation before the connection.
1885  *
1886  * This API supposed to be called on the paired devices. Which means we have to use this API only
1887  * after successful pairing.
1888  *
1889  * This function is a asynchronous call.
1890  * Response will be received through BLUETOOTH_EVENT_DEVICE_AUTHORIZED event.
1891  *
1892  * @return      BLUETOOTH_ERROR_NONE - Success \n
1893  * @exception   BLUETOOTH_ERROR_INTERNAL - Cannot get the interal DBUS proxy \n
1894  * @param[in]   device_address   This indicates an address of the device to authorize \n
1895  * @param[in]   authorized      TRUE : authorize FALSE: unauthorize
1896  * @remark      None
1897  * @see         bluetooth_get_bonded_device_list
1898 @code
1899 void bt_event_callback(int event, bluetooth_event_param_t *param)
1900 {
1901         switch(event)
1902         {
1903                 case BLUETOOTH_EVENT_DEVICE_AUTHORIZED :
1904                 {
1905                         if (param->result == BLUETOOTH_ERROR_NONE)
1906                         {
1907                                 //Device authorized
1908                         }
1909                         //device authorization failed failure
1910                 }
1911         }
1912 }
1913
1914 ...
1915
1916 int ret = 0;
1917 bluetooth_device_address_t device_address={{0}};
1918 gboolean authorized;
1919
1920 authorized =TRUE;
1921
1922 ret = bluetooth_authorize_device(&device_address,authorized);
1923 @endcode
1924  */
1925 int bluetooth_authorize_device(const bluetooth_device_address_t *device_address,
1926                                        gboolean authorized);
1927
1928 /**
1929  * @fn int bluetooth_search_service(const bluetooth_device_address_t *device_address)
1930  * @brief Get all services supported by remote device
1931  *
1932  *
1933  * This API call initiates the search for the services supported by the specified device. Normally
1934  * the service search will take a couple of seconds to get it completed. Before calling this API
1935  * make sure that the Adapter is enabled. We have to give the device address of the remote device to
1936  * perform the service search. We can get the device address by doing a device discovery operation.
1937  *
1938  *
1939  * This function is a asynchronous call.
1940  * The service search request is responded by BLUETOOTH_EVENT_SERVICE_SEARCHED event.
1941  *
1942  * There is a timeout associated with the service search. The default time out is 40 seconds. If the
1943  * remove device did not respond with in the time out period the BLUETOOTH_EVENT_SERVICE_SEARCHED
1944  * event is generated with appropriate result code.
1945  *
1946  * @return      BLUETOOTH_ERROR_NONE - Success \n
1947  *              BLUETOOTH_ERROR_SERVICE_SEARCH_ERROR - Service search error (NULL device address) \n
1948  *              BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
1949  * @param[in]   device_address   This indicates an address of the device
1950  *                               whose services need to be found
1951  * @remark      None
1952  * @see         bluetooth_cancel_service_search
1953  */
1954 int bluetooth_search_service(const bluetooth_device_address_t *device_address);
1955
1956 /**
1957  * @fn int bluetooth_cancel_service_search(void)
1958  * @brief Cancel the ongoing service search operation
1959  *
1960  *
1961  * This function cancel the ongoing service search operation. This API is usually calling after the
1962  * bluetooth_search_service API.
1963  * Normally service search will take a more time (> 5 seconds) to complete. This API will be called
1964  * if the user wish to cancel the Ongoing service search operation.
1965  *
1966  * This API should be called just after the bluetooth_search_service API and before the
1967  * BLUETOOTH_EVENT_SERVICE_SEARCHED event
1968  *
1969  * This function is a synchronous call.
1970  *
1971  * @return      BLUETOOTH_ERROR_NONE - Success \n
1972  *              BLUETOOTH_ERROR_CANCEL - Error in service search cancel operation \n
1973  *              BLUETOOTH_ERROR_NOT_PAIRED - Not paired device \n
1974  *              BLUETOOTH_ERROR_NOT_IN_OPERATION - Searching service is not in operation \n
1975  *
1976  * @remark      None
1977  * @see         bluetooth_search_service
1978 @code
1979 ...
1980
1981 int ret = 0;
1982 ret = bluetooth_cancel_service_search();
1983 @endcode
1984 */
1985 int bluetooth_cancel_service_search(void);
1986
1987 /**
1988  * @fn int bluetooth_rfcomm_create_socket(const char *uuid)
1989  * @brief Register rfcomm socket with a specific uuid
1990  *
1991  *
1992  * This API register rfcomm socket with the given UUID. The return value of this API is the socket
1993  * descriptor of the server.
1994  * This is the first API which is called to create the server. Once we created the server socket,
1995  * we will listen on that return socket.
1996  * So a bluetooth_rfcomm_listen_and_accept should follow this API call. This is a synchronous call.
1997  *
1998  *
1999  * @return  socket FD on Success \n
2000  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
2001  *              BLUETOOTH_ERROR_INTERNAL - Internal error\n
2002  *              BLUETOOTH_ERROR_MAX_CONNECTION - Maximum connection reached\n
2003  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
2004  * @param[in]   UUID (128 bits)
2005  *
2006  * @remark      None
2007  * @see       bluetooth_rfcomm_listen_and_accept, bluetooth_rfcomm_remove_socket
2008  *
2009  @code
2010
2011   const char *rfcomm_test_uuid="00001101-0000-1000-8000-00805F9B34FB";
2012   fd  = bluetooth_rfcomm_create_socket(rfcomm_test_uuid);
2013
2014  @endcode
2015  */
2016 int bluetooth_rfcomm_create_socket(const char *uuid);
2017
2018 /**
2019  * @fn int bluetooth_rfcomm_remove_socket(int socket_fd, const char *uuid)
2020  * @brief De-register the rfcomm socket
2021  *
2022  *
2023  * This API deregister rfcomm socket with the given socket fd and  UUID. If the remote device is
2024  * already connected then we will receive the BLUETOOTH_EVENT_RFCOMM_DISCONNECTED with socket
2025  * descriptor else no event will come. We will call this API only after the
2026  * bluetooth_rfcomm_listen_and_accept.
2027  * This is a synchronous call.
2028  *
2029  * @return   BLUETOOTH_ERROR_NONE - Success \n
2030  *               BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
2031  *               BLUETOOTH_ERROR_NOT_FOUND - Cannot find the proxy\n
2032  *               BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
2033  * @param[in]  int socket_fd
2034  *
2035  * @remark      None
2036  * @see       bluetooth_rfcomm_create_socket, bluetooth_rfcomm_listen_and_accept
2037  *
2038  @code
2039  void bt_event_callback(int event, bluetooth_event_param_t *param)
2040  {
2041         switch(event)
2042         {
2043                 case BLUETOOTH_EVENT_RFCOMM_DISCONNECTED:
2044                 {
2045                         bluetooth_rfcomm_connection_t *discon_ind =
2046                                         (bluetooth_rfcomm_connection_t *)param->param_data;
2047
2048                         printf("\nDisconnected from FD %d",  discon_ind->socket_fd);
2049                 }
2050         }
2051  }
2052
2053  ...
2054
2055  int ret = 0;
2056  fd  = bluetooth_rfcomm_create_socket(rfcomm_test_uuid);
2057  ret = bluetooth_rfcomm_listen_and_accept(fd, 1);
2058  ....
2059  ret = bluetooth_rfcomm_remove_socket(fd);
2060  @endcode
2061  */
2062 int bluetooth_rfcomm_remove_socket(int socket_fd);
2063
2064 /**
2065  * @fn int bluetooth_rfcomm_server_disconnect(int socket_fd)
2066  * @brief Disconnect rfcomm connection
2067  *
2068  *
2069  * Disconnect a specific(device node fd)  RFCOMM connection. This is a Synchronous call and there
2070  * is no cabbback events for this API. We have to provice the valid client fd to disconnect from the
2071  * remote server.
2072  *
2073  * @return   BLUETOOTH_ERROR_NONE  - Success \n
2074  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
2075  *              BLUETOOTH_ERROR_NOT_CONNECTED - Not connected \n
2076  * @param[in]  int socket_fd the sending socket fd
2077  *
2078  * @remark      None
2079  *
2080  @code
2081
2082   ret = bluetooth_rfcomm_server_disconnect(g_ret_fd);
2083   if (ret < 0)
2084         printf("Disconnection failed");
2085   else
2086   printf("Disconnection Success");
2087
2088  @endcode
2089  */
2090 int bluetooth_rfcomm_server_disconnect(int socket_fd);
2091
2092 /**
2093  * @fn int bluetooth_rfcomm_listen_and_accept(int socket_fd,int max_pending_connection)
2094  * @brief Rfcomm socket listen
2095  *
2096  *
2097  * This API make rfcomm socket listen and accept with socket. We will call this API immediatly
2098  * after the bluetooth_rfcomm_create_socket API.
2099  * This API listen for the incomming connection and once it receives a connection, it will give
2100  * BLUETOOTH_EVENT_RFCOMM_CONNECTED
2101  * event to the application. This is an Asynchronous API call.
2102  *
2103  *
2104  * @return  BLUETOOTH_ERROR_NONE - Success \n
2105  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
2106  *              BLUETOOTH_ERROR_CONNECTION_ERROR - Listen failed \n
2107
2108  * @param[in]  int socket_fd
2109  * @param[in]  max pending connection.
2110  *
2111  * @remark      None
2112  * @see       bluetooth_rfcomm_create_socket
2113  *
2114   @code
2115   void bt_event_callback(int event, bluetooth_event_param_t* param)
2116  {
2117         switch(event)
2118         {
2119                 case BLUETOOTH_EVENT_RFCOMM_CONNECTED:
2120                 {
2121                         bluetooth_rfcomm_connection_t *conn_ind =
2122                                                 (bluetooth_rfcomm_connection_t *)param->param_data;
2123
2124                         printf("\nConnected from FD %d",  conn_ind->socket_fd);
2125                 }
2126         }
2127  }
2128
2129  ...
2130
2131  int ret = 0;
2132  fd  = bluetooth_rfcomm_create_socket(rfcomm_test_uuid);
2133  ret = bluetooth_rfcomm_listen_and_accept(fd, 1);
2134
2135  @endcode
2136  */
2137 int bluetooth_rfcomm_listen_and_accept(int socket_fd, int max_pending_connection);
2138
2139 /**
2140  * @fn int bluetooth_rfcomm_listen(int socket_fd,int max_pending_connection)
2141  * @brief Rfcomm socket listen
2142  *
2143  *
2144  * This API make rfcomm socket listen and accept with socket. We will call this API immediatly
2145  * after the bluetooth_rfcomm_create_socket API.
2146  * This API listen for the incomming connection and once it receives a connection, it will give
2147  * BLUETOOTH_EVENT_RFCOMM_AUTHORIZE
2148  * event to the application. This is an Asynchronous API call.
2149  *
2150  *
2151  * @return  BLUETOOTH_ERROR_NONE - Success \n
2152  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
2153  *              BLUETOOTH_ERROR_CONNECTION_ERROR - Listen failed \n
2154
2155  * @param[in]  int socket_fd
2156  * @param[in]  max pending connection.
2157  *
2158  * @remark      None
2159  * @see       bluetooth_rfcomm_create_socket
2160  *
2161   @code
2162   void bt_event_callback(int event, bluetooth_event_param_t* param)
2163  {
2164         switch(event)
2165         {
2166                 case BLUETOOTH_EVENT_RFCOMM_AUTHORIZE:
2167                 {
2168                         char *name = (char *)param->param_data;
2169
2170                         printf("\nConnected from %s",  name);
2171
2172                         bluetooth_rfcomm_accept_connection();
2173                 }
2174         }
2175  }
2176
2177  ...
2178
2179  int ret = 0;
2180  fd  = bluetooth_rfcomm_create_socket(rfcomm_test_uuid);
2181  ret = bluetooth_rfcomm_listen(fd, 1);
2182
2183  @endcode
2184  */
2185 int bluetooth_rfcomm_listen(int socket_fd, int max_pending_connection);
2186
2187 /**
2188  * @fn int bluetooth_rfcomm_accept_connection()
2189  * @brief Accepts the authorization request indicated by the event
2190   * BLUETOOTH_EVENT_RFCOMM_AUTHORIZE.
2191  *
2192  * This function is a synchronous call.
2193  *
2194  * @return   BLUETOOTH_ERROR_NONE  - Success \n
2195  *              BLUETOOTH_ERROR_INTERNAL - Internal error \n
2196  *
2197  * @param[in]  the socket fd of the server
2198  * @param[out]  the socket fd of the client
2199  *
2200  * @exception   None
2201  * @remark       None
2202  * @see           bluetooth_rfcomm_reject_connection
2203  */
2204 int bluetooth_rfcomm_accept_connection(int server_fd, int *client_fd);
2205
2206 /**
2207  * @fn int bluetooth_rfcomm_reject_connection()
2208  * @brief Rejects the authorization request indicated by the event
2209   * BLUETOOTH_EVENT_RFCOMM_AUTHORIZE.
2210  *
2211  * This function is a synchronous call.
2212  *
2213  * @return   BLUETOOTH_ERROR_NONE  - Success \n
2214  *              BLUETOOTH_ERROR_INTERNAL - Internal error \n
2215  *
2216  * @param[in]  the socket fd of the server
2217  *
2218  * @exception   None
2219  * @remark       None
2220  * @see           bluetooth_rfcomm_accept_connection
2221  */
2222 int bluetooth_rfcomm_reject_connection(int server_fd);
2223
2224 /**
2225  * @fn gboolean bluetooth_rfcomm_is_server_uuid_available(const char *uuid)
2226  * @brief Informs whether rfcomm server uuid is available or not.
2227  *
2228  * This function is a synchronous call.
2229  *
2230  * @return   TRUE  - RFCOMM uuid is available \n
2231  *              FALSE - RFCOMM uuid is not available \n
2232  *
2233  * @param[in]  uuid UUID string
2234  *
2235  * @exception   None
2236  *
2237  * @remark       None
2238  */
2239 gboolean bluetooth_rfcomm_is_server_uuid_available(const char *uuid);
2240
2241 /**
2242  * @fn int bluetooth_rfcomm_connect(const bluetooth_device_address_t  *remote_bt_address,
2243  *                                                                      const char *remote_uuid)
2244  * @brief Connect to the remote device rfcomm *
2245  *
2246  * Connect to a specific RFCOMM based service on a remote device UUID. This is a Async call. Once
2247  * the connection is successful callback BLUETOOTH_EVENT_RFCOMM_CONNECTED events is generated,
2248  * which contains the socket_fd, device role (RFCOMM_ROLE_SERVER/RFCOMM_ROLE_CLIENT), device addess
2249  * etc. The socket_fd can be further used to send the data. It better to do a sevice search before
2250  * initiating a connection.
2251  *
2252  * @return  BLUETOOTH_ERROR_NONE  - Success \n
2253  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
2254  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
2255  *              BLUETOOTH_ERROR_CONNECTION_BUSY - Connection in progress \n
2256  *              BLUETOOTH_ERROR_INTERNAL - Internal Error\n
2257  * @param[in]  bluetooth_device_address_t remote bt_address
2258  * @param[in]  char remote uuid
2259  * @remark      None
2260  * @see         bluetooth_rfcomm_disconnect, bluetooth_rfcomm_write, bluetooth_search_service
2261  *
2262  @code
2263
2264  void bt_event_callback(int event, bluetooth_event_param_t *param)
2265  {
2266         switch(event)
2267         {
2268                 case BLUETOOTH_EVENT_SERVICE_SEARCHED:
2269                 {
2270                         if (param->result >= BLUETOOTH_ERROR_NONE)
2271                         {
2272                                 bt_sdp_info_t *bt_sdp_info=param->param_data;
2273
2274                                 printf("Dev add = %2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n",
2275                                         bt_sdp_info->device_addr.addr[0],
2276                                         bt_sdp_info->device_addr.addr[1],
2277                                         bt_sdp_info->device_addr.addr[2],
2278                                         bt_sdp_info->device_addr.addr[3],
2279                                         bt_sdp_info->device_addr.addr[4],
2280                                         bt_sdp_info->device_addr.addr[5]);
2281
2282                                         printf("Supported service list:\n");
2283                                         for(i=0; i<bt_sdp_info->service_index; i++)
2284                                                 printf("[%#x]\n",
2285                                                         bt_sdp_info->service_list_array[i]);
2286
2287                                 //Alternate method
2288                                 //ret = bluetooth_rfcomm_connect(bt_sdp_info->device_addr,
2289                                                                                 //rfcomm_test_uuid);
2290                         }
2291                         break;
2292                 }
2293                 case BLUETOOTH_EVENT_RFCOMM_CONNECTED:
2294                 {
2295                         bluetooth_rfcomm_connection_t *conn_ind =
2296                                                 (bluetooth_rfcomm_connection_t *)param->param_data;
2297
2298                         printf("\nConnected from FD %d, Role = %s",  conn_ind->socket_fd,
2299                                                 (conn_ind->device_role == RFCOMM_ROLE_SERVER) ?
2300                                                                         "SERVER" : "CLIENT");
2301                 }
2302         }
2303  }
2304
2305   bluetooth_device_address_t remote_address = {{0},};
2306   remote_address.addr[0] = 0x0; remote_address.addr[1] = 0x0A; remote_address.addr[2] = 0x3A;
2307   remote_address.addr[3]= 0x54; remote_address.addr[4] = 0x19;  remote_address.addr[5]= 0x36;
2308   ret = bluetooth_search_service(&remote_address);
2309  if (ret < 0)
2310         printf("Seach failed, Reason = %d", ret);
2311   else
2312          printf("Search Success, Ret = %d", ret);
2313
2314   ret = bluetooth_rfcomm_connect(&remote_address, rfcomm_test_uuid);
2315   if (ret < 0)
2316         printf("Connection failed, Reason = %d", ret);
2317   else
2318          printf("Connection Success, Ret = %d", ret);
2319
2320   @endcode
2321   */
2322 int bluetooth_rfcomm_connect(const bluetooth_device_address_t *remote_bt_address,
2323                                      const char *remote_uuid);
2324
2325 /**
2326  * @fn int bluetooth_rfcomm_disconnect(int socket_fd)
2327  * @brief Disconnect rfcomm connection
2328  *
2329  *
2330  * Disconnect a specific(device node fd)  RFCOMM connection. This is a Synchronous call and there
2331  * is no cabbback events for this API. We have to provice the valid client fd to disconnect from the
2332  * remote server.
2333  *
2334  * @return   BLUETOOTH_ERROR_NONE  - Success \n
2335  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
2336  *              BLUETOOTH_ERROR_NOT_CONNECTED - Not connected \n
2337  * @param[in]  char remote bt_address
2338  *
2339  * @remark      None
2340  * @see         bluetooth_rfcomm_connect
2341  *
2342  @code
2343
2344   ret = bluetooth_rfcomm_disconnect(g_ret_fd);
2345   if (ret < 0)
2346         printf("Disconnection failed");
2347   else
2348   printf("Disconnection Success");
2349
2350  @endcode
2351  */
2352
2353 int bluetooth_rfcomm_disconnect(int socket_fd);
2354
2355 /**
2356  * @fn int bluetooth_rfcomm_write (int fd, const char *buff, int length)
2357  * @brief Write to rfcomm connection
2358  *
2359  *
2360  * This API is used to send the data over the rfcomm connection. This is a synchronous API. The same
2361  * API is used to send the data for server and the client.
2362  *
2363  * @return  BLUETOOTH_ERROR_NONE  - Success \n
2364  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
2365  *              BLUETOOTH_ERROR_NOT_IN_OPERATION - The Fd is currently not in operation\n
2366  * @param[in]  int fd
2367  * @param[in]  const char *buff  Data buffer to send
2368  * @param[in]  int length Length of the data
2369  *
2370  * @remark      None
2371  * @see         bluetooth_rfcomm_connect
2372  *
2373   @code
2374   char *buff = "Test data 123456789"
2375   ret =  bluetooth_rfcomm_write(g_ret_fd, buff, 15);
2376   if (ret < 0)
2377         printf("Send failed");
2378   else
2379    printf("Send success");
2380
2381  @endcode
2382  */
2383 int bluetooth_rfcomm_write(int fd, const char *buf, int length);
2384
2385 /**
2386  * @fn gboolean bluetooth_rfcomm_is_client_connected(void)
2387  * @brief Informs whether rfcomm client is connected.
2388  *
2389  * This function is a synchronous call.
2390  *
2391  * @return   TRUE  - RFCOMM client is connected \n
2392  *              FALSE - RFCOMM client is not connected \n
2393  *
2394  * @exception   None
2395  *
2396  * @remark       None
2397  */
2398 gboolean bluetooth_rfcomm_is_client_connected(void);
2399
2400 /**
2401  * @fn int bluetooth_network_activate_server(void)
2402  * @brief Activate the NAP (Network Access Point) service
2403  *
2404  * This function is a asynchronous call.
2405  * The activate server request is responded by BLUETOOTH_EVENT_NETWORK_SERVER_ACTIVATED event.
2406  *
2407  * @return   BLUETOOTH_ERROR_NONE  - Success \n
2408  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
2409  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
2410  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Not enabled \n
2411  *
2412  * @remark      None
2413   * @see        bluetooth_network_deactivate_server
2414  *
2415  */
2416 int bluetooth_network_activate_server(void);
2417
2418 /**
2419  * @fn int bluetooth_network_deactivate_server(void)
2420  * @brief Deactivate the NAP (Network Access Point) service
2421  *
2422  * This function is a asynchronous call.
2423  * The deactivate server request is responded by BLUETOOTH_EVENT_NETWORK_SERVER_DEACTIVATED event.
2424  *
2425  * @return   BLUETOOTH_ERROR_NONE  - Success \n
2426  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
2427  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
2428  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Not enabled \n
2429  *
2430  * @remark      None
2431  * @see         bluetooth_network_activate_server
2432  *
2433  */
2434 int bluetooth_network_deactivate_server(void);
2435
2436 /**
2437  * @fn int bluetooth_network_connect(const bluetooth_device_address_t *device_address,
2438  *                                      bluetooth_network_role_t role,
2439  *                                      char  custom_uuid)
2440  * @brief Connect the network server in the peer
2441  *
2442  * This function is a asynchronous call.
2443  * The network connect request is responded by BLUETOOTH_EVENT_NETWORK_CONNECTED event.
2444  *
2445  * @return   BLUETOOTH_ERROR_NONE  - Success \n
2446  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
2447  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
2448  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Not enabled \n
2449  *
2450  * @exception   None
2451  * @param[in]  device_address   This indicates an address of the device with which the pairing
2452  *                              should be initiated
2453  * @param[in]  role   The role to connect. PANU / GN / NAP / CUSTOM. If use the CUSTOM value,
2454  *                      need to use the third parameter.
2455  * @param[in]  custom_uuid   If use the CUSTOM value in second parameter, use this parameter to
2456  *                              connect. UUID string
2457  * @remark      None
2458  * @see         bluetooth_network_disconnect
2459  */
2460 int bluetooth_network_connect(const bluetooth_device_address_t *device_address,
2461                                       bluetooth_network_role_t role, char *custom_uuid);
2462
2463 /**
2464  * @fn int bluetooth_network_disconnect(const bluetooth_device_address_t *device_address,
2465  *                                                      bluetooth_network_role_t role,
2466  *                                                        char *custom_uuid)
2467  * @brief Connect the network server in the peer
2468  *
2469  * This function is a asynchronous call.
2470  * The network disconnect request is responded by BLUETOOTH_EVENT_NETWORK_CONNECTED event.
2471  *
2472  * @return   BLUETOOTH_ERROR_NONE  - Success \n
2473  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
2474  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
2475  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Not enabled \n
2476  *
2477  * @exception   None
2478  * @param[in]   device_address   This indicates an address of the device with which the pairing
2479  *                                      should be initiated
2480  * @remark       None
2481  * @see         bluetooth_network_connect
2482  */
2483 int bluetooth_network_disconnect(const bluetooth_device_address_t *device_address);
2484
2485 /*HDP - API's*/
2486
2487 /**
2488  * @fn int bluetooth_hdp_activate(unsigned short  data_type,
2489  *                                      bt_hdp_role_type_t role,
2490  *                                      bt_hdp_qos_type_t channel_type,
2491  *                                      char **app_handle)
2492  * @brief Activate the HDP service for a particular data type
2493  *
2494  * This function is a synchronous call.
2495  *
2496  * @return   BLUETOOTH_ERROR_NONE  - Success \n
2497  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
2498  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
2499  *              BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
2500  *
2501  * @exception   None
2502  * @param[in]  data_type   The data type against corresponding service
2503  * @param[in]  role   The role of HDP. HDP_ROLE_SOURCE/HDP_ROLE_SINK.
2504  * @param[in]  channel_type   The QOS type for the channel.
2505  *                              HDP_QOS_RELIABLE/HDP_QOS_STREAMING/HDP_QOS_ANY.
2506  *                              For role = HDP_ROLE_SINK, the channel_type
2507  *                              should be HDP_QOS_ANY.
2508  * @param[out]  app_handle    The application handler against corresponding service
2509  * @remark       None
2510  * @see            bluetooth_hdp_deactivate
2511  */
2512 int bluetooth_hdp_activate(unsigned short  data_type,
2513                                 bt_hdp_role_type_t role,
2514                                 bt_hdp_qos_type_t channel_type,
2515                                 char **app_handle);
2516 /**
2517  * @fn int bluetooth_hdp_deactivate(const char *app_handle)
2518  * @brief Deactivate the HDP service for a particular service using the handler
2519  *
2520  * This function is a synchronous call.
2521  *
2522  * @return   BLUETOOTH_ERROR_NONE  - Success \n
2523  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
2524  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
2525  *              BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
2526  *
2527  * @exception   None
2528  * @param[in]  app_handle   The application handler against corresponding service
2529  * @remark       None
2530  * @see            bluetooth_hdp_deactivate
2531  */
2532 int bluetooth_hdp_deactivate(const char *app_handle);
2533
2534 /**
2535  * @fn int bluetooth_hdp_send_data(unsigned int channel_id,
2536  *                                      const char *buffer, unsigned int size)
2537  * @brief Send data to the remote HDP device
2538  *
2539  * This function is a synchronous call.
2540  *
2541  * @return   BLUETOOTH_ERROR_NONE  - Success \n
2542  *             BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
2543  *             BLUETOOTH_ERROR_INTERNAL - Internal Error \n
2544  *             BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
2545  *             BLUETOOTH_ERROR_NOT_IN_OPERATION - FD is invalid  \n
2546  *
2547  * @exception   None
2548  * @param[in]  channel_id   The channel id for the connection.
2549  * @param[in]  buffer   The pdu buffer.
2550  * @param[in]  size   Size of the buffer.
2551  * @remark       None
2552  * @see            bluetooth_hdp_connect
2553  */
2554 int bluetooth_hdp_send_data(unsigned int channel_id,
2555                                 const char *buffer, unsigned int size);
2556 /**
2557  * @fn int bluetooth_hdp_connect(const char *app_handle,
2558  *                              bt_hdp_qos_type_t channel_type,
2559  *                              const bluetooth_device_address_t *device_address)
2560  * @brief Connect to the remote device(Mainly used by source)
2561  *
2562  * This function is a asynchronous call.
2563  * The HDP activate is responded by BLUETOOTH_EVENT_HDP_CONNECTED event.
2564  *
2565  * @return   BLUETOOTH_ERROR_NONE  - Success \n
2566  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
2567  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
2568  *              BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
2569  *              BLUETOOTH_ERROR_MEMORY_ALLOCATION -Memory allocation failed \n
2570  *
2571  * @exception   None
2572  * @param[in]  app_handle   The application handler against corresponding service
2573  * @param[in]  channel_type   The QOS type for the channel.
2574  *                              HDP_QOS_RELIABLE/HDP_QOS_STREAMING.
2575  * @param[in]  device_address   The remote device Bd address.
2576  *
2577  * @remark       None
2578  * @see            bluetooth_hdp_disconnect
2579  */
2580 int bluetooth_hdp_connect(const char *app_handle,
2581                         bt_hdp_qos_type_t channel_type,
2582                         const bluetooth_device_address_t *device_address);
2583 /**
2584  * @fn int bluetooth_hdp_disconnect(unsigned int channel_id,
2585  *                      const bluetooth_device_address_t *device_address)
2586  * @brief Disconnect from the remote device(Mainly used by source)
2587  *
2588  * This function is a asynchronous call.
2589  * The HDP activate is responded by BLUETOOTH_EVENT_HDP_DISCONNECTED event.
2590  *
2591  * @return   BLUETOOTH_ERROR_NONE  - Success \n
2592  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
2593  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
2594  *              BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
2595   *              BLUETOOTH_ERROR_MEMORY_ALLOCATION -Memory allocation failed \n
2596  *
2597  * @exception   None
2598  * @param[in]  channel_id    The channel id for the connection.
2599  * @param[in]  device_address   The remote device Bd address.
2600  *
2601  * @remark       None
2602  * @see            bluetooth_hdp_connect
2603  */
2604 int bluetooth_hdp_disconnect(unsigned int channel_id,
2605                         const bluetooth_device_address_t  *device_address);
2606
2607
2608 /**
2609  * @fn int bluetooth_opc_init(void)
2610  * @brief Initialize OPP client.
2611  *
2612  * This function is a synchronous call.
2613  * No event corresponding to this api
2614  *
2615  * @return   BLUETOOTH_ERROR_NONE  - Success \n
2616  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
2617  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
2618  *              BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
2619   *             BLUETOOTH_ERROR_ACCESS_DENIED -Memory allocation failed \n
2620  *
2621  * @exception   None
2622  *
2623  * @remark       None
2624  * @see           bluetooth_opc_deinit
2625  */
2626 int bluetooth_opc_init(void);
2627
2628 /**
2629  * @fn int bluetooth_opc_deinit(void)
2630  * @brief Deinitialize OPP client.
2631  *
2632  * This function is a synchronous call.
2633  * No event corresponding to this api
2634  *
2635  * @return   BLUETOOTH_ERROR_NONE  - Success \n
2636  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
2637  *              BLUETOOTH_ERROR_ACCESS_DENIED -Memory allocation failed \n
2638  *
2639  * @exception   None
2640  *
2641  * @remark       None
2642  * @see           bluetooth_opc_init
2643  */
2644
2645  int bluetooth_opc_deinit(void);
2646
2647 /**
2648  * @fn int bluetooth_opc_push_files(bluetooth_device_address_t *remote_address,
2649                                         char **file_name_array)
2650  * @brief Send multiple files to a remote device.
2651  *
2652  * This function is a asynchronous call.
2653  * This api  is responded by BLUETOOTH_EVENT_OPC_CONNECTED event.
2654  *
2655  * @return   BLUETOOTH_ERROR_NONE  - Success \n
2656  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
2657  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
2658  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
2659  *              BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
2660  *              BLUETOOTH_ERROR_IN_PROGRESS -Already one push in progress \n
2661  *              BLUETOOTH_ERROR_ACCESS_DENIED - Not allowed by MDM policy \n
2662  *
2663  * @exception   None
2664  * @param[in]  device_address   The remote device Bd address.
2665  * @param[in]  file_name_array  Array of filepaths to be sent.
2666  *
2667  * @remark       None
2668  * @see          bluetooth_opc_cancel_push
2669  */
2670
2671 int bluetooth_opc_push_files(bluetooth_device_address_t *remote_address,
2672                                 char **file_name_array);
2673
2674 /**
2675  * @fn int bluetooth_opc_cancel_push(void)
2676  * @brief Cancels the ongoing file push.
2677  *
2678  * This function is a asynchronous call.
2679  * This api is responded with either BLUETOOTH_EVENT_OPC_CONNECTED or
2680  * BLUETOOTH_EVENT_OPC_TRANSFER_COMPLETED event.
2681  *
2682  * @return   BLUETOOTH_ERROR_NONE  - Success \n
2683  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
2684  *              BLUETOOTH_ERROR_ACCESS_DENIED - No push in progress \n
2685  *
2686  * @exception   None
2687  *
2688  * @remark       None
2689  * @see           bluetooth_opc_push_files
2690  */
2691
2692 int bluetooth_opc_cancel_push(void);
2693
2694 /**
2695  * @fn gboolean bluetooth_opc_session_is_exist(void)
2696  * @brief Informs whether opc session exists or not.
2697  *
2698  * This function is a synchronous call.
2699  *
2700  * @return   TRUE  - OPC session exists \n
2701  *              FALSE - OPC session does not exist \n
2702  *
2703  * @exception   None
2704  *
2705  * @remark       None
2706  * @see          None
2707  */
2708
2709 gboolean bluetooth_opc_session_is_exist(void);
2710
2711
2712 /**
2713  * @fn int bluetooth_obex_server_init(const char *dst_path)
2714  * @brief Initialize OPP and FTP server.
2715  *
2716  * This function is a synchronous call.
2717  * No event corresponding to this api
2718  *
2719  * @return   BLUETOOTH_ERROR_NONE  - Success \n
2720  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
2721  *              BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
2722  *              BLUETOOTH_ERROR_AGENT_ALREADY_EXIST - Obex agent already registered \n
2723  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
2724  *
2725  * @exception   None
2726  * @param[in]  dst_path   OPS destination file path.
2727  * @remark       None
2728  * @see           bluetooth_obex_server_deinit
2729  */
2730 int bluetooth_obex_server_init(const char *dst_path);
2731
2732
2733 /**
2734  * @fn int bluetooth_obex_server_deinit(void)
2735  * @brief Deinitialize OPP and FTP server.
2736  *
2737  * This function is a synchronous call.
2738  * No event corresponding to this api
2739  *
2740  * @return   BLUETOOTH_ERROR_NONE  - Success \n
2741  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
2742  *              BLUETOOTH_ERROR_AGENT_DOES_NOT_EXIST -Obex agent not registered \n
2743  *
2744  * @exception   None
2745  *
2746  * @remark       None
2747  * @see           bluetooth_obex_server_init
2748  */
2749 int bluetooth_obex_server_deinit(void);
2750
2751
2752 /**
2753  * @fn gboolean bluetooth_obex_server_is_activated(void)
2754  * @brief Informs whether obex server is activated or not.
2755  *
2756  * This function is a synchronous call.
2757  *
2758  * @return   TRUE  - OBEX server is activated \n
2759  *              FALSE - OBEX server is not activated \n
2760  *
2761  * @exception   None
2762  *
2763  * @remark       None
2764  */
2765
2766 gboolean bluetooth_obex_server_is_activated(void);
2767
2768
2769 /**
2770  * @fn int bluetooth_obex_server_init_without_agent(const char *dst_path)
2771  * @brief Initialize OPP and FTP server without the conneciton authorization of the agent
2772  *
2773  * This function is a synchronous call.
2774  * No event corresponding to this api
2775  *
2776  * @return   BLUETOOTH_ERROR_NONE  - Success \n
2777  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
2778  *              BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
2779  *              BLUETOOTH_ERROR_AGENT_ALREADY_EXIST - Obex agent already registered \n
2780  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
2781  *
2782  *
2783  * @exception   None
2784  * @param[in]  dst_path   OPS destination file path.
2785  * @remark       None
2786  * @see           bluetooth_obex_server_deinit_without_agent
2787  */
2788 int bluetooth_obex_server_init_without_agent(const char *dst_path);
2789
2790
2791 /**
2792  * @fn int bluetooth_obex_server_deinit_without_agent(void)
2793  * @brief Deinitialize OPP and FTP server without the conneciton authorization of the agent
2794  *
2795  * This function is a synchronous call.
2796  * No event corresponding to this api
2797  *
2798  * @return   BLUETOOTH_ERROR_NONE  - Success \n
2799  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
2800  *              BLUETOOTH_ERROR_AGENT_DOES_NOT_EXIST -Obex agent not registered \n
2801  *
2802  * @exception   None
2803  *
2804  * @remark       None
2805  * @see           bluetooth_obex_server_init_without_agent
2806  */
2807 int bluetooth_obex_server_deinit_without_agent(void);
2808
2809
2810 /**
2811  * @fn int bluetooth_obex_server_accept_connection(void)
2812  * @brief Accepts the authorization request indicated by the event
2813   * BLUETOOTH_EVENT_OBEX_SERVER_CONNECTION_AUTHORIZE.
2814  *
2815  * This function is a synchronous call.
2816  *
2817  * @return   BLUETOOTH_ERROR_NONE  - Success \n
2818  *              BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
2819  *              BLUETOOTH_ERROR_INTERNAL - Internal error \n
2820  *
2821  * @exception   None
2822  * @remark       None
2823  * @see           bluetooth_obex_server_reject_authorize
2824  */
2825 int bluetooth_obex_server_accept_connection(void);
2826
2827
2828 /**
2829  * @fn int bluetooth_obex_server_reject_connection(void)
2830  * @brief Rejects the authorization request indicated by the event
2831   * BLUETOOTH_EVENT_OBEX_SERVER_CONNECTION_AUTHORIZE.
2832  *
2833  * This function is a synchronous call.
2834  *
2835  * @return   BLUETOOTH_ERROR_NONE  - Success \n
2836  *              BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
2837  *              BLUETOOTH_ERROR_INTERNAL - Internal error \n
2838  *
2839  * @exception   None
2840  * @remark       None
2841  * @see           bluetooth_obex_server_reject_authorize
2842  */
2843 int bluetooth_obex_server_reject_connection(void);
2844
2845
2846 /**
2847  * @fn int bluetooth_obex_server_accept_authorize(const char *filename)
2848  * @brief Accepts the authorization request indicated by the event
2849   * BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_AUTHORIZE.
2850  *
2851  * This function is a asynchronous call.
2852  * This api will be responded with the event BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_STARTED.
2853  *
2854  * @return   BLUETOOTH_ERROR_NONE  - Success \n
2855  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
2856  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
2857  *              BLUETOOTH_ERROR_AGENT_DOES_NOT_EXIST -Obex agent not registered \n
2858  *
2859  * @exception   None
2860  * @param[in]  filename   Authorized filename.
2861
2862  * @remark       None
2863  * @see           bluetooth_obex_server_reject_authorize
2864  */
2865
2866 int bluetooth_obex_server_accept_authorize(const char *filename);
2867
2868 /**
2869  * @fn int bluetooth_obex_server_reject_authorize(void)
2870  * @brief Reject the authorization request indicated by the event
2871   * BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_AUTHORIZE.
2872  *
2873  * This function is a asynchronous call.
2874  * No event for this api..
2875  *
2876  * @return   BLUETOOTH_ERROR_NONE  - Success \n
2877  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
2878  *              BLUETOOTH_ERROR_AGENT_DOES_NOT_EXIST -Obex agent not registered \n
2879  *
2880  * @exception   None
2881
2882  * @remark       None
2883  * @see           bluetooth_obex_server_accept_authorize
2884  */
2885
2886 int bluetooth_obex_server_reject_authorize(void);
2887
2888 /**
2889  * @fn int bluetooth_obex_server_set_destination_path(const char *dst_path)
2890  * @brief Set the OPS destination file path..
2891  *
2892  * This function is a asynchronous call.
2893  * No event for this api..
2894  *
2895  * @return   BLUETOOTH_ERROR_NONE  - Success \n
2896  *              BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
2897  *              BLUETOOTH_ERROR_AGENT_DOES_NOT_EXIST -Obex agent not registered \n
2898  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid Param \n
2899  *
2900  * @exception   None
2901  * @param[in]  dst_path   OPS destination file path.
2902
2903  * @remark       None
2904  * @see          None
2905  */
2906
2907 int bluetooth_obex_server_set_destination_path(const char *dst_path);
2908
2909 /**
2910  * @fn int bluetooth_obex_server_set_root(const char *root)
2911  * @brief Set the FTS root folder..
2912  *
2913  * This function is a asynchronous call.
2914  * No event for this api..
2915  *
2916  * @return   BLUETOOTH_ERROR_NONE  - Success \n
2917  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
2918  *              BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
2919  *              BLUETOOTH_ERROR_ACCESS_DENIED - Operation not allowed \n
2920  *              BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
2921  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
2922  *
2923  * @exception  None
2924  * @param[in]   root   FTS root folder.
2925
2926  * @remark       None
2927  * @see          None
2928  */
2929
2930 int bluetooth_obex_server_set_root(const char *root);
2931
2932 /**
2933  * @fn int bluetooth_obex_server_cancel_transfer(int transfer_id)
2934  * @brief Cancel the transfer on server
2935  *
2936  * This function is an asynchronous call.
2937  * If the function call that cancels transfer is successful, the application would receive
2938  * BLUETOOTH_EVENT_TRANSFER_COMPLETED event through registered callback
2939  * function with an error code BLUETOOTH_ERROR_CANCEL. In the case of failure
2940  * the error code will be BLUETOOTH_ERROR_NONE
2941  *
2942  * @return   BLUETOOTH_ERROR_NONE  - Success \n
2943  *               BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Not enabled \n
2944  *               BLUETOOTH_ERROR_AGENT_DOES_NOT_EXIST -Obex agent not registered \n
2945  *               BLUETOOTH_ERROR_INTERNAL - internal error (proxy does not exist) \n
2946  *               BLUETOOTH_ERROR_NOT_FOUND - The transfer is not found \n
2947  *
2948  * @exception None
2949  * @param[in] transfer_id transfer ID
2950
2951  * @remark       None
2952  * @see          None
2953  */
2954 int bluetooth_obex_server_cancel_transfer(int transfer_id);
2955
2956
2957 /**
2958  * @fn int bluetooth_obex_server_cancel_all_transfers(void)
2959  * @brief Cancel the transfer on server
2960  *
2961  * This function is an asynchronous call.
2962  * If the function call that cancels transfer is successful, the application would receive
2963  * BLUETOOTH_EVENT_TRANSFER_COMPLETED event through registered callback
2964  * function with an error code BLUETOOTH_ERROR_CANCEL. In the case of failure
2965  * the error code will be BLUETOOTH_ERROR_NONE
2966  *
2967  * @return   BLUETOOTH_ERROR_NONE  - Success \n
2968  *               BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Not enabled \n
2969  *               BLUETOOTH_ERROR_AGENT_DOES_NOT_EXIST -Obex agent not registered \n
2970  *               BLUETOOTH_ERROR_INTERNAL - internal error (proxy does not exist) \n
2971  *               BLUETOOTH_ERROR_NOT_FOUND - The transfer is not found \n
2972  *
2973  * @exception None
2974  *
2975  * @remark       None
2976  * @see          None
2977  */
2978 int bluetooth_obex_server_cancel_all_transfers(void);
2979
2980
2981 /**
2982  * @fn int bluetooth_oob_read_local_data(bt_oob_data_t *local_oob_data)
2983  * @brief Read the local Hash and Randmizer.
2984  *
2985  * This function is a synchronous call.
2986  *
2987  * @return   BLUETOOTH_ERROR_NONE  - Success \n
2988  *           BLUETOOTH_ERROR_INTERNAL - Internal Error \n
2989  *
2990  * @exception  None
2991  * @param[in]  None.
2992  * @param[out] local_oob_data - Pointer to the local OOB data
2993  *
2994  * @remark       None
2995  * @see          None
2996  */
2997
2998 int bluetooth_oob_read_local_data(bt_oob_data_t *local_oob_data);
2999
3000
3001 /**
3002  * @fn int bluetooth_oob_add_remote_data(
3003  *                      const bluetooth_device_address_t *remote_device_address,
3004  *                      bt_oob_data_t *oob_data)
3005  * @brief Add/updated the remote device  Hash and Randmizer.
3006  *
3007  * This function is a synchronous call.
3008  * No event for this api..
3009  *
3010  * @return   BLUETOOTH_ERROR_NONE  - Success \n
3011  *           BLUETOOTH_ERROR_INTERNAL - Internal Error \n
3012  *
3013  * @exception   None
3014  * @param[in] remote_device_address - Remote device address
3015  *            remote_oob_data - Ponter to Hash and Randomizer oob data structure
3016  *
3017  * @remark      None
3018  * @see         None
3019  */
3020
3021 int bluetooth_oob_add_remote_data(
3022                    const bluetooth_device_address_t *remote_device_address,
3023                    bt_oob_data_t *remote_oob_data);
3024
3025
3026 /**
3027  * @fn int bluetooth_oob_remove_remote_data(
3028  *                      const bluetooth_device_address_t *remote_device_address)
3029  * @brief Delete the Hash and Randomizer w.r.t the remote device address.
3030  *
3031  * This function is a synchronous call.
3032  * No event for this api..
3033  *
3034  * @return   BLUETOOTH_ERROR_NONE  - Success \n
3035  *           BLUETOOTH_ERROR_INTERNAL - Internal Error \n
3036  *
3037  * @exception  None
3038  * @param[in] remote_device_address - Remote device address
3039  *
3040  * @remark       None
3041  * @see          None
3042  */
3043
3044 int bluetooth_oob_remove_remote_data(
3045                         const bluetooth_device_address_t *remote_device_address);
3046
3047 /**
3048  * @fn int bluetooth_gatt_get_primary_services(const bluetooth_device_address_t *address,
3049  *                                              bt_gatt_handle_info_t *prim_svc);
3050  *
3051  * @brief Gets the GATT based primary services handle supported by remote device
3052  *
3053  * This function is a synchronous call.
3054  * The output parameter needs to be freed by calling bluetooth_gatt_free_primary_services()
3055  *
3056  * @return   BLUETOOTH_ERROR_NONE  - Success \n
3057  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
3058  *              BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
3059  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
3060  *
3061  * @exception    None
3062  * @param[in]    address - Remote device address
3063  * @param[out] prim_svc - Structure containing remote service count and handle list.
3064  *
3065  * @remark      None
3066  * @see         bluetooth_gatt_free_primary_services()
3067  */
3068 int bluetooth_gatt_get_primary_services(const bluetooth_device_address_t *address,
3069                                                 bt_gatt_handle_info_t *prim_svc);
3070
3071 /**
3072  * @fn int bluetooth_gatt_discover_service_characteristics(const char *service_handle)
3073  *
3074  * @brief Discovers the characteristics of GATT based service of remote device
3075  *
3076  * This function is an asynchronous call.
3077  * This API is responded with BLUETOOTH_EVENT_GATT_SVC_CHAR_DISCOVERED
3078  *
3079  * @return   BLUETOOTH_ERROR_NONE  - Success \n
3080  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
3081  *              BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
3082  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
3083  *
3084  * @exception   None
3085  * @param[in]   service_handle - Handle for remote service.
3086  *
3087  * @remark      None
3088  * @see         None
3089  */
3090 int bluetooth_gatt_discover_service_characteristics(const char *service_handle);
3091
3092 /**
3093  * @fn int bluetooth_gatt_get_service_property(const char *service_handle,
3094  *                                              bt_gatt_service_property_t *service);
3095  *
3096  * @brief Gets the properties of GATT based service of remote device
3097  *
3098  * This function is a synchronous call.
3099  * The output parameter needs to be freed by calling bluetooth_gatt_free_primary_services()
3100  *
3101  * @return   BLUETOOTH_ERROR_NONE  - Success \n
3102  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
3103  *              BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
3104  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
3105  *
3106  * @exception   None
3107  * @param[in]   service_handle - Handle for remote service.
3108  * @param[out]  service - Structure containing remote service property.
3109  *
3110  * @remark      None
3111  * @see         bluetooth_gatt_free_service_property()
3112  */
3113 int bluetooth_gatt_get_service_property(const char *service_handle,
3114                                                 bt_gatt_service_property_t *service);
3115
3116 /**
3117  * @fn int bluetooth_gatt_watch_characteristics(const char *service_handle)
3118  *
3119  * @brief Register to GATT based service to receive value change notification/indication.
3120  *
3121  * This function is a synchronous call.
3122  * No event for this api.
3123  *
3124  * @return   BLUETOOTH_ERROR_NONE  - Success \n
3125  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
3126  *              BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
3127  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
3128  *
3129  * @exception   None
3130  * @param[in]   service_handle - Handle for remote service.
3131  *
3132  * @remark      None
3133  * @see         None
3134  */
3135 int bluetooth_gatt_watch_characteristics(const char *service_handle);
3136
3137 /**
3138  * @fn int bluetooth_gatt_unwatch_characteristics(const char *service_handle)
3139  *
3140  * @brief Unregister GATT based service to receive value change notification/indication.
3141  *
3142  * This function is a synchronous call.
3143  * No event for this api.
3144  *
3145  * @return   BLUETOOTH_ERROR_NONE  - Success \n
3146  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
3147  *              BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
3148  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
3149  *
3150  * @exception   None
3151  * @param[in]   service_handle - Handle for remote service.
3152  *
3153  * @remark      None
3154  * @see         None
3155  */
3156 int bluetooth_gatt_unwatch_characteristics(const char *service_handle);
3157
3158 /**
3159  * @fn int bluetooth_gatt_get_characteristics_property(const char *char_handle,
3160  *                                              bt_gatt_char_property_t *characteristic);
3161  *
3162  * @brief Provides characteristic value along with properties.
3163  *
3164  * This function is a synchronous call.
3165  * The output parameter needs to be freed by calling bluetooth_gatt_free_char_property()
3166  *
3167  * @return   BLUETOOTH_ERROR_NONE  - Success \n
3168  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
3169  *              BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
3170  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
3171  *
3172  * @exception   None
3173  * @param[in]   char_handle - Handle for Characteristic property.
3174  * @param[out] characteristic - Structure containing remote characteristic property.
3175  *
3176  * @remark      None
3177  * @see         bluetooth_gatt_free_char_property()
3178  */
3179 int bluetooth_gatt_get_characteristics_property(const char *char_handle,
3180                                                 bt_gatt_char_property_t *characteristic);
3181
3182 /**
3183  * @fn int bluetooth_gatt_set_characteristics_value(const char *char_handle,
3184  *                                              const guint8 *value, int length)
3185  *
3186  * @brief Set characteristic value.
3187  *
3188  * This function is a synchronous call.
3189  *
3190  * @return   BLUETOOTH_ERROR_NONE  - Success \n
3191  *              BLUETOOTH_ERROR_INTERNAL - Internal Error \n
3192  *              BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
3193  *              BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
3194  *
3195  * @exception   None
3196  * @param[in]   char_handle - Handle for Characteristic property.
3197  * @param[in]   value - New value to set for characteristic property.
3198  * @param[in]   length - Length of the value to be set.
3199  *
3200  * @remark      None
3201  * @see         None
3202  */
3203 int bluetooth_gatt_set_characteristics_value(const char *char_handle,
3204                                                 const guint8 *value, int length);
3205
3206 /**
3207  * @fn int bluetooth_gatt_free_primary_services(bt_gatt_handle_info_t *prim_svc);
3208  *
3209  * @brief Releases the memory allocated by bluetooth_gatt_get_primary_services()
3210  *
3211  * This function is a synchronous call.
3212  * The input parameter is obtained by calling bluetooth_gatt_get_primary_services()
3213  *
3214  * @return   BLUETOOTH_ERROR_NONE  - Success \n
3215  *              BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
3216  *
3217  * @exception   None
3218  * @param[in]   prim_svc - GATT handle info structure
3219  *
3220  * @remark      None
3221  * @see         bluetooth_gatt_get_primary_services()
3222  */
3223 int bluetooth_gatt_free_primary_services(bt_gatt_handle_info_t *prim_svc);
3224
3225 /**
3226  * @fn int bluetooth_gatt_free_service_property(bt_gatt_service_property_t *svc_pty);
3227  *
3228  * @brief  Releases the memory allocated by bluetooth_gatt_get_service_property()
3229  *
3230  * This function is a synchronous call.
3231  * The input parameter is obtained by calling bluetooth_gatt_get_service_property()
3232  *
3233  * @return   BLUETOOTH_ERROR_NONE  - Success \n
3234  *              BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
3235  *
3236  * @exception   None
3237  * @param[in]   svc_pty - GATT service property structure.
3238  *
3239  * @remark      None
3240  * @see         bluetooth_gatt_get_service_property()
3241  */
3242 int bluetooth_gatt_free_service_property(bt_gatt_service_property_t *svc_pty);
3243
3244 /**
3245  * @fn int bluetooth_gatt_free_char_property(bt_gatt_char_property_t *char_pty);
3246  *
3247  * @brief Provides characteristic value along with properties.
3248  *
3249  * This function is a synchronous call.
3250  * The input parameter is obtained by calling bluetooth_gatt_get_characteristics_property()
3251  *
3252  * @return   BLUETOOTH_ERROR_NONE  - Success \n
3253  *              BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
3254  *
3255  * @exception   None
3256  * @param[in]   char_pty - GATT characteristics property structure.
3257  *
3258  * @remark      None
3259  * @see         bluetooth_gatt_get_characteristics_property()
3260  */
3261  int bluetooth_gatt_free_char_property(bt_gatt_char_property_t *char_pty);
3262
3263 /**
3264  * @}
3265  */
3266
3267 #ifdef __cplusplus
3268 }
3269 #endif                          /* __cplusplus */
3270 #endif                          /* _BLUETOOTH_API_H_*/