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