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