Imported Upstream version 1.0.1
[platform/upstream/iotivity.git] / resource / csdk / connectivity / lib / tizen / ble / inc / bluetooth.h
1 /*
2  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the License);
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an AS IS BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17
18 #ifndef __TIZEN_NETWORK_BLUETOOTH_H__
19 #define __TIZEN_NETWORK_BLUETOOTH_H__
20
21 #include <stdlib.h>
22 #include <unistd.h>
23 #include <stdbool.h>
24 #include <tizen_error.h>
25
26 #include "bluetooth_type.h"
27
28 #ifdef __cplusplus
29 extern "C"
30 {
31 #endif /* __cplusplus */
32
33 /**
34  * @file        bluetooth.h
35  * @brief       API to control the Bluetooth adapter and devices and communications.
36  * @ingroup     CAPI_NETWORK_BLUETOOTH_MODULE
37  */
38
39
40 /**
41  * @addtogroup CAPI_NETWORK_BLUETOOTH_MODULE
42  * @{
43  */
44
45
46 /**
47  * @ingroup CAPI_NETWORK_BLUETOOTH_MODULE
48  * @brief Initializes the Bluetooth API.
49  * @since_tizen 2.3
50  *
51  * @remarks This function must be called before Bluetooth API starts. \n
52  * You must free all resources of the Bluetooth service by calling bt_deinitialize() if Bluetooth service is no longer needed.
53  *
54  * @return 0 on success, otherwise a negative error value.
55  * @retval #BT_ERROR_NONE  Successful
56  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
57  *
58  * @see  bt_deinitialize()
59  */
60 int bt_initialize(void);
61
62
63 /**
64  * @ingroup CAPI_NETWORK_BLUETOOTH_MODULE
65  * @brief Releases all resources of the Bluetooth API.
66  * @since_tizen 2.3
67  *
68  * @remarks This function must be called if Bluetooth API is no longer needed.
69  *
70  * @return 0 on success, otherwise a negative error value.
71  * @retval #BT_ERROR_NONE  Successful
72  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
73  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
74  *
75  * @pre Bluetooth API must be initialized with bt_initialize().
76  *
77  * @see bt_initialize()
78  */
79 int bt_deinitialize(void);
80
81 /**
82  * @internal
83  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
84  * @brief Enables the local Bluetooth adapter, asynchronously.
85  * @since_tizen 2.3
86  * @privlevel platform
87  * @privilege %http://tizen.org/privilege/bluetooth.admin
88  *
89  * @details This function enables Bluetooth protocol stack and hardware.
90  *
91  * @return 0 on success, otherwise a negative error value.
92  * @retval #BT_ERROR_NONE  Successful
93  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
94  * @retval #BT_ERROR_ALREADY_DONE  Already enabled
95  * @retval #BT_ERROR_NOW_IN_PROGRESS  Operation now in progress
96  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
97  *
98  * @pre Bluetooth service must be initialized with bt_initialize().
99  * @pre The state of local Bluetooth must be #BT_ADAPTER_DISABLED
100  * @post This function invokes bt_adapter_state_changed_cb().
101  *
102  * @see bt_initialize()
103  * @see bt_adapter_get_state()
104  * @see bt_adapter_set_state_changed_cb()
105  * @see bt_adapter_unset_state_changed_cb()
106  * @see bt_adapter_state_changed_cb()
107  *
108  */
109 int bt_adapter_enable(void);
110
111 /**
112  * @internal
113  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
114  * @brief Disables the local Bluetooth adapter, asynchronously.
115  * @since_tizen 2.3
116  * @privlevel platform
117  * @privilege %http://tizen.org/privilege/bluetooth.admin
118  *
119  * @details This function disables Bluetooth protocol stack and hardware.
120  *
121  * @remarks You should disable Bluetooth adapter, which is helpful for saving power.
122  *
123  * @return 0 on success, otherwise a negative error value.
124  * @retval #BT_ERROR_NONE  Successful
125  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
126  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
127  * @retval #BT_ERROR_NOW_IN_PROGRESS  Operation now in progress
128  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
129  *
130  * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED
131  * @post This function invokes bt_adapter_state_changed_cb().
132  *
133  * @see bt_adapter_get_state()
134  * @see bt_adapter_state_changed_cb()
135  * @see bt_adapter_set_state_changed_cb()
136  * @see bt_adapter_unset_state_changed_cb ()
137  *
138  */
139 int bt_adapter_disable(void);
140
141 /**
142  * @internal
143  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
144  * @brief Recover the local Bluetooth adapter, asynchronously.
145  * @since_tizen 2.3
146  * @privlevel platform
147  * @privilege %http://tizen.org/privilege/bluetooth.admin
148  *
149  * @details This function does recovery logic, disables Bluetooth protocol stack and hardware, then enables after a few seconds.
150  *
151  * @return 0 on success, otherwise a negative error value.
152  * @retval #BT_ERROR_NONE  Successful
153  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
154  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
155  * @retval #BT_ERROR_NOW_IN_PROGRESS  Operation now in progress
156  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
157  *
158  * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED
159  * @post This function invokes bt_adapter_state_changed_cb().
160  *
161  * @see bt_adapter_get_state()
162  * @see bt_adapter_state_changed_cb()
163  * @see bt_adapter_set_state_changed_cb()
164  * @see bt_adapter_unset_state_changed_cb ()
165  *
166  */
167 int bt_adapter_recover(void);
168
169 /**
170  * @internal
171  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
172  * @brief Reset the local Bluetooth adapter, synchronously.
173  * @since_tizen 2.3
174  * @privlevel platform
175  * @privilege %http://tizen.org/privilege/bluetooth.admin
176  *
177  * @details This function resets Bluetooth protocol and values.
178  *
179  * @return 0 on success, otherwise a negative error value.
180  * @retval #BT_ERROR_NONE  Successful
181  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
182  * @retval #BT_ERROR_OPERATION_FAILED Operation failed
183  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
184  *
185  * @pre Bluetooth service must be initialized with bt_initialize().
186  * @post bt_adapter_state_changed_cb() will be invoked if The state of local Bluetooth was #BT_ADAPTER_ENABLED.
187  *
188  * @see bt_initialize()
189  * @see bt_adapter_get_state()
190  * @see bt_adapter_set_state_changed_cb()
191  * @see bt_adapter_unset_state_changed_cb()
192  * @see bt_adapter_state_changed_cb()
193  *
194  */
195 int bt_adapter_reset(void);
196
197 /**
198  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
199  * @brief Gets the current state of local Bluetooth adapter.
200  * @since_tizen 2.3
201  *
202  * @param[out] adapter_state The current adapter state
203  *
204  * @return 0 on success, otherwise a negative error value.
205  * @retval #BT_ERROR_NONE  Successful
206  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
207  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
208  *
209  * @pre Bluetooth service must be initialized with bt_initialize().
210  *
211  * @see bt_initialize()
212  */
213 int bt_adapter_get_state(bt_adapter_state_e *adapter_state);
214
215 /**
216  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
217  * @brief Gets the address of local Bluetooth adapter.
218  * @since_tizen 2.3
219  *
220  * @remarks The @a local_address must be released with free() by you.
221  *
222  * @param[out] local_address The device address of local Bluetooth adapter
223  *
224  * @return 0 on success, otherwise a negative error value.
225  * @retval #BT_ERROR_NONE Successful
226  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
227  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
228  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
229  * @retval #BT_ERROR_OUT_OF_MEMORY  Out of memory
230  * @retval #BT_ERROR_OPERATION_FAILED Operation failed
231  * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
232  * @see bt_adapter_get_name()
233  */
234 int bt_adapter_get_address(char **local_address);
235
236 /**
237  * @internal
238  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
239  * @brief Gets the version of local Bluetooth adapter.
240  * @since_tizen 2.3
241  * @remarks The @a local_version must be released with free() by you.
242  *
243  * @param[out] local_version The version of local Bluetooth adapter
244  *
245  * @return 0 on success, otherwise a negative error value.
246  * @retval #BT_ERROR_NONE Successful
247  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
248  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
249  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
250  * @retval #BT_ERROR_OUT_OF_MEMORY  Out of memory
251  * @retval #BT_ERROR_OPERATION_FAILED Operation failed
252  * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
253  */
254 int bt_adapter_get_version(char **local_version);
255
256 /**
257  * @internal
258  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
259  * @brief Gets the information regarding local Bluetooth adapter.
260  * @since_tizen 2.3
261  * @remarks The @a all parameters must be released with free() by you.
262  *
263  * @param[out] chipset Chipset name of local Bluetooth adapter
264  * @param[out] firmware Firmware info. of local Bluetooth adapter
265  * @param[out] stack_version Bluetooth stack version
266  * @param[out] profiles The profile list of local Bluetooth adapter
267  *
268  * @return 0 on success, otherwise a negative error value.
269  * @retval #BT_ERROR_NONE Successful
270  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
271  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
272  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
273  * @retval #BT_ERROR_OUT_OF_MEMORY  Out of memory
274  * @retval #BT_ERROR_OPERATION_FAILED Operation failed
275  * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
276  */
277 int bt_adapter_get_local_info(char **chipset, char **firmware, char **stack_version, char **profiles);
278
279 /**
280  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
281  * @brief Gets the name of local Bluetooth adapter.
282  * @since_tizen 2.3
283  *
284  * @details Use this function to get the friendly name associated with Bluetooth
285  * device, retrieved by the remote Bluetooth devices.
286  *
287  * @remarks The @a local_name must be released with free() by you.
288  *
289  * @param[out] local_name  The local device name
290  *
291  * @return 0 on success, otherwise a negative error value.
292  * @retval #BT_ERROR_NONE  Successful
293  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
294  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
295  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
296  * @retval #BT_ERROR_OUT_OF_MEMORY  Out of memory
297  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
298  *
299  * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
300  *
301  * @see bt_adapter_set_name()
302  */
303 int bt_adapter_get_name(char **local_name);
304
305 /**
306  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
307  * @brief Sets the name of local Bluetooth adapter.
308  * @since_tizen 2.3
309  * @privlevel public
310  * @privilege %http://tizen.org/privilege/bluetooth
311  *
312  * @param[in] local_name The name of the Bluetooth device. \n
313  *                              The maximum length is 248 characters.
314  *
315  * @return 0 on success, otherwise a negative error value.
316  * @retval #BT_ERROR_NONE  Successful
317  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
318  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
319  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
320  * @retval #BT_ERROR_OPERATION_FAILED Operation failed
321  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
322  *
323  * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
324  * @post bt_adapter_name_changed_cb() will be invoked if this function returns #BT_ERROR_NONE.
325  *
326  * @see bt_adapter_get_name()
327  * @see bt_adapter_name_changed_cb()
328  * @see bt_adapter_set_name_changed_cb()
329  * @see bt_adapter_unset_name_changed_cb()
330  */
331 int bt_adapter_set_name(const char *local_name);
332
333 /**
334  * @ingroup  CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
335  * @brief  Gets the visibility mode of local Bluetooth adapter.
336  * @since_tizen 2.3
337  * @param[out] mode  The visibility mode of the Bluetooth device
338  * @param[out] duration  The duration until the visibility mode is changed to #BT_ADAPTER_VISIBILITY_MODE_NON_DISCOVERABLE (in seconds).
339  * @a duration is valid only if @a mode is #BT_ADAPTER_VISIBILITY_MODE_LIMITED_DISCOVERABLE. This value can be NULL.
340  * @return 0 on success, otherwise a negative error value.
341  * @retval #BT_ERROR_NONE  Successful
342  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
343  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
344  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
345  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
346  * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
347  */
348 int bt_adapter_get_visibility(bt_adapter_visibility_mode_e *mode, int *duration);
349
350 /**
351  * @internal
352  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
353  * @brief Sets the visibility mode.
354  * @since_tizen 2.3
355  * @privlevel platform
356  * @privilege %http://tizen.org/privilege/bluetooth.admin
357  *
358  * @remarks #BT_ADAPTER_VISIBILITY_MODE_LIMITED_DISCOVERABLE will change to #BT_ADAPTER_VISIBILITY_MODE_NON_DISCOVERABLE
359  * after the given @a duration goes.
360  *
361  * @param[in] discoverable_mode The Bluetooth visibility mode to set
362  * @param[in] duration The duration until the visibility mode is changed to #BT_ADAPTER_VISIBILITY_MODE_NON_DISCOVERABLE (in seconds).
363  * @a duration is used only for #BT_ADAPTER_VISIBILITY_MODE_LIMITED_DISCOVERABLE mode.
364  *
365  * @return 0 on success, otherwise a negative error value.
366  * @retval #BT_ERROR_NONE  Successful
367  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
368  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
369  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
370  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
371  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
372  *
373  * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
374  * @post bt_adapter_visibility_mode_changed_cb() will be invoked if this function returns #BT_ERROR_NONE.
375  *
376  * @see bt_adapter_get_visibility()
377  * @see bt_adapter_visibility_mode_changed_cb()
378  * @see bt_adapter_set_visibility_mode_changed_cb()
379  * @see bt_adapter_unset_visibility_mode_changed_cb()
380  */
381 int bt_adapter_set_visibility(bt_adapter_visibility_mode_e discoverable_mode, int duration);
382
383 /**
384  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
385  * @brief Starts the device discovery, asynchronously.
386  * @since_tizen 2.3
387  * @privlevel public
388  * @privilege %http://tizen.org/privilege/bluetooth
389  *
390  * @details If a device is discovered, bt_adapter_device_discovery_state_changed_cb() will be invoked
391  * with #BT_ADAPTER_DEVICE_DISCOVERY_FOUND, and then bt_adapter_device_discovery_state_changed_cb()
392  * will be called with #BT_ADAPTER_DEVICE_DISCOVERY_FINISHED in case of the completion or cancellation of the discovery.
393  *
394  * @remarks To connect to peer Bluetooth device, you need to know its Bluetooth address. \n
395  * The device discovery can be stopped by bt_adapter_stop_device_discovery().
396  *
397  * @return 0 on success, otherwise a negative error value.
398  * @retval #BT_ERROR_NONE  Successful
399  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
400  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
401  * @retval #BT_ERROR_NOW_IN_PROGRESS  Operation is now in progress
402  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
403  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
404  *
405  * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
406  * @post This function invokes bt_adapter_device_discovery_state_changed_cb().
407  *
408  * @see bt_adapter_is_discovering()
409  * @see bt_adapter_stop_device_discovery()
410  * @see bt_adapter_device_discovery_state_changed_cb()
411  * @see bt_adapter_set_device_discovery_state_changed_cb()
412  * @see bt_adapter_unset_device_discovery_state_changed_cb()
413  */
414 int bt_adapter_start_device_discovery(void);
415
416 /**
417  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
418  * @brief Stops the device discovery, asynchronously.
419  * @since_tizen 2.3
420  * @privlevel public
421  * @privilege %http://tizen.org/privilege/bluetooth
422  * @remarks The device discovery process will take 10 ~ 20 seconds to get all the devices in vicinity.
423  *
424  * @return 0 on success, otherwise a negative error value.
425  * @retval #BT_ERROR_NONE  Successful
426  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
427  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
428  * @retval #BT_ERROR_NOT_IN_PROGRESS  Operation is not in progress
429  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
430  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
431  *
432  * @pre The device discovery must be in progress with bt_adapter_start_device_discovery().
433  * @post This function invokes bt_adapter_device_discovery_state_changed_cb().
434  *
435  * @see bt_adapter_is_discovering()
436  * @see bt_adapter_start_device_discovery()
437  * @see bt_adapter_set_device_discovery_state_changed_cb()
438  * @see bt_adapter_unset_device_discovery_state_changed_cb()
439  * @see bt_adapter_device_discovery_state_changed_cb()
440  */
441 int bt_adapter_stop_device_discovery(void);
442
443 /**
444  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
445  * @brief Checks for the device discovery is in progress or not.
446  * @since_tizen 2.3
447  *
448  * @remarks If Bluetooth discovery is in progress, other operations are not allowed and
449  * you have to either stop the discovery operation, or wait for it to be finished,
450  * before performing other operations.
451
452  * @param[out] is_discovering The discovering status: (@c true = in progress , @c  false = not in progress )
453  *
454  * @return 0 on success, otherwise a negative error value.
455  * @retval #BT_ERROR_NONE  Successful
456  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
457  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
458  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
459  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
460  *
461  * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
462  *
463  * @see bt_adapter_start_device_discovery()
464  * @see bt_adapter_stop_device_discovery()
465  */
466 int bt_adapter_is_discovering(bool *is_discovering);
467
468 /**
469  * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
470  * @brief Get the service mask from the uuid list.
471  * @since_tizen 2.3
472  *
473  * @param[in] uuids The UUID list of the device.
474  * @param[in] no_of_service The number of the UUID list count.
475  * @param[out] service_mask_list Service mask list converted from the given UUID list.
476  *
477  * @return 0 on success, otherwise a negative error value.
478  * @retval #BT_ERROR_NONE  Successful
479  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
480  *
481  * @see bt_service_class_t
482  */
483 int bt_device_get_service_mask_from_uuid_list(char **uuids,
484                                       int no_of_service,
485                                       bt_service_class_t *service_mask_list);
486
487 /**
488  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
489  * @brief Retrieves the device information of all bonded devices.
490  * @since_tizen 2.3
491  *
492  * @param [in] callback The callback function to invoke
493  * @param [in] user_data The user data passed from the foreach function
494  *
495  * @return 0 on success, otherwise a negative error value.
496  * @retval #BT_ERROR_NONE  Successful
497  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
498  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
499  * @retval #BT_ERROR_OUT_OF_MEMORY  Out of memory
500  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
501  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
502  *
503  * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
504  * @post This function invokes bt_adapter_bonded_device_cb().
505  *
506  * @see bt_adapter_bonded_device_cb()
507  */
508 int bt_adapter_foreach_bonded_device(bt_adapter_bonded_device_cb callback, void *user_data);
509
510 /**
511  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
512  * @brief Gets the device information of a bonded device.
513  * @since_tizen 2.3
514  * @remarks The @a device_info must be released with bt_adapter_free_device_info() by you .
515  *
516  * @param [in] remote_address The address of remote device
517  * @param [out] device_info The bonded device information
518  *
519  * @return 0 on success, otherwise a negative error value.
520  * @retval #BT_ERROR_NONE  Successful
521  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
522  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
523  * @retval #BT_ERROR_OUT_OF_MEMORY  Out of memory
524  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
525  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
526  * @retval #BT_ERROR_REMOTE_DEVICE_NOT_BONDED  Remote device not bonded
527  *
528  * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
529  * @post This function invokes bt_adapter_bonded_device_cb().
530  *
531  * @see bt_adapter_bonded_device_cb()
532  */
533 int bt_adapter_get_bonded_device_info(const char *remote_address, bt_device_info_s **device_info);
534
535 /**
536  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
537  * @brief Frees device info.
538  * @since_tizen 2.3
539  *
540  * @param [in] device_info The bonded device information
541  *
542  * @return 0 on success, otherwise a negative error value.
543  * @retval #BT_ERROR_NONE  Successful
544  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
545  *
546  * @see bt_adapter_get_bonded_device_info()
547  */
548 int bt_adapter_free_device_info(bt_device_info_s *device_info);
549
550 /**
551  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
552  * @brief Checks whether the UUID of service is used or not
553  * @since_tizen 2.3
554  * @param[in] service_uuid The UUID of service
555  * @param[out] used Indicates whether the service is used or not
556  * @return true on success, otherwise false.
557  * @return 0 on success, otherwise a negative error value.
558  * @retval #BT_ERROR_NONE  Successful
559  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
560  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
561  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
562  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
563  */
564 int bt_adapter_is_service_used(const char *service_uuid, bool *used);
565
566 /**
567  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
568  * @brief  Registers a callback function to be invoked when the Bluetooth adapter state changes.
569  * @since_tizen 2.3
570  *
571  * @param[in] callback  The callback function to invoke
572  * @param[in] user_data The user data to be passed to the callback function
573  *
574  * @return   0 on success, otherwise a negative error value.
575  * @retval #BT_ERROR_NONE  Successful
576  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
577  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
578  *
579  * @pre The Bluetooth service must be initialized with bt_initialize().
580  * @post bt_adapter_state_changed_cb() will be invoked.
581  *
582  * @see bt_initialize()
583  * @see bt_adapter_state_changed_cb()
584  * @see bt_adapter_set_state_changed_cb()
585  * @see bt_adapter_unset_state_changed_cb()
586  */
587 int bt_adapter_set_state_changed_cb(bt_adapter_state_changed_cb callback, void *user_data);
588
589 /**
590  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
591  * @brief       Unregisters the callback function.
592  * @since_tizen 2.3
593  *
594  * @return      0 on success, otherwise a negative error value.
595  * @retval #BT_ERROR_NONE  Successful
596  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
597  *
598  * @pre The Bluetooth service must be initialized with bt_initialize().
599  *
600  * @see bt_initialize()
601  * @see bt_adapter_set_state_changed_cb()
602  */
603 int bt_adapter_unset_state_changed_cb(void);
604
605 /**
606  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
607  * @brief  Registers a callback function to be invoked when the name of Bluetooth adapter changes.
608  * @since_tizen 2.3
609  *
610  * @param[in] callback The callback function to invoke
611  * @param[in] user_data The user data to be passed to the callback function
612  *
613  * @return   0 on success, otherwise a negative error value.
614  * @retval #BT_ERROR_NONE  Successful
615  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
616  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
617  *
618  * @pre The Bluetooth service must be initialized with bt_initialize().
619  * @post  bt_adapter_name_changed_cb() will be invoked.
620  *
621  * @see bt_initialize()
622  * @see bt_adapter_name_changed_cb()
623  * @see bt_adapter_unset_name_changed_cb()
624  */
625 int bt_adapter_set_name_changed_cb(bt_adapter_name_changed_cb callback, void *user_data);
626
627 /**
628  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
629  * @brief       Unregisters the callback function.
630  * @since_tizen 2.3
631  *
632  * @return      0 on success, otherwise a negative error value.
633  * @retval #BT_ERROR_NONE  Successful
634  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
635  *
636  * @pre The Bluetooth service must be initialized with bt_initialize().
637  *
638  * @see bt_initialize()
639  * @see bt_adapter_set_name_changed_cb()
640  */
641 int bt_adapter_unset_name_changed_cb(void);
642
643 /**
644  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
645  * @brief  Registers a callback function to be invoked when the visibility mode changes.
646  * @since_tizen 2.3
647  *
648  * @param[in] callback The callback function to register
649  * @param[in] user_data The user data to be passed to the callback function
650  *
651  * @return   0 on success, otherwise a negative error value.
652  * @retval #BT_ERROR_NONE  Successful
653  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
654  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
655  *
656  * @pre The Bluetooth service must be initialized with bt_initialize().
657  * @post bt_adapter_visibility_mode_changed_cb() will be invoked.
658  *
659  * @see bt_initialize()
660  * @see bt_adapter_visibility_mode_changed_cb()
661  * @see bt_adapter_unset_visibility_mode_changed_cb()
662  */
663 int bt_adapter_set_visibility_mode_changed_cb(bt_adapter_visibility_mode_changed_cb callback, void *user_data);
664
665 /**
666  * @ingroup  CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
667  * @brief  Unregisters the callback function.
668  * @since_tizen 2.3
669  *
670  * @return  0 on success, otherwise a negative error value.
671  * @retval  #BT_ERROR_NONE  Successful
672  * @retval  #BT_ERROR_NOT_INITIALIZED  Not initialized
673  *
674  * @pre  The Bluetooth service must be initialized with bt_initialize().
675  *
676  * @see  bt_initialize()
677  * @see  bt_adapter_set_visibility_mode_changed_cb()
678  */
679 int bt_adapter_unset_visibility_mode_changed_cb(void);
680
681 /**
682  * @ingroup  CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
683  * @brief  Registers a callback function to be invoked every second
684  * @since_tizen 2.3
685  * until the visibility mode is changed from #BT_ADAPTER_VISIBILITY_MODE_LIMITED_DISCOVERABLE
686  * to #BT_ADAPTER_VISIBILITY_MODE_NON_DISCOVERABLE.
687  * @details  When you set visibility mode as #BT_ADAPTER_VISIBILITY_MODE_LIMITED_DISCOVERABLE,
688  * @a callback will be called every second until visibility mode is changed to #BT_ADAPTER_VISIBILITY_MODE_NON_DISCOVERABLE.
689  * @param[in]  callback  The callback function to register
690  * @param[in]  user_data  The user data to be passed to the callback function
691  * @return  0 on success, otherwise a negative error value.
692  * @retval  #BT_ERROR_NONE  Successful
693  * @retval  #BT_ERROR_NOT_INITIALIZED  Not initialized
694  * @retval  #BT_ERROR_INVALID_PARAMETER  Invalid parameter
695  * @pre  The Bluetooth service must be initialized by bt_initialize().
696  * @post  bt_adapter_visibility_duration_changed_cb() will be invoked.
697  * @see  bt_initialize()
698  * @see  bt_adapter_visibility_duration_changed_cb()
699  * @see  bt_adapter_unset_visibility_duration_changed_cb()
700  */
701 int bt_adapter_set_visibility_duration_changed_cb(bt_adapter_visibility_duration_changed_cb callback, void *user_data);
702
703 /**
704  * @ingroup  CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
705  * @brief        Unregisters the callback function.
706  * @since_tizen 2.3
707  * @return  0 on success, otherwise a negative error value.
708  * @retval  #BT_ERROR_NONE  Successful
709  * @retval  #BT_ERROR_NOT_INITIALIZED  Not initialized
710  * @pre  The Bluetooth service must be initialized with bt_initialize().
711  * @see  bt_initialize()
712  * @see  bt_adapter_set_visibility_duration_changed_cb()
713  */
714 int bt_adapter_unset_visibility_duration_changed_cb(void);
715
716 /**
717  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
718  * @brief  Registers a callback function to be invoked when the device discovery state changes.
719  * @since_tizen 2.3
720  *
721  * @param[in] callback The callback function to register
722  * @param[in] user_data The user data to be passed to the callback function
723  *
724  * @return   0 on success, otherwise a negative error value.
725  * @retval #BT_ERROR_NONE  Successful
726  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
727  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
728  *
729  * @pre The Bluetooth service must be initialized with bt_initialize().
730  * @post bt_adapter_device_discovery_state_changed_cb() will be invoked.
731  *
732  * @see bt_initialize()
733  * @see bt_adapter_device_discovery_state_changed_cb()
734  * @see bt_adapter_set_device_discovery_state_changed_cb()
735  * @see bt_adapter_unset_device_discovery_state_changed_cb()
736  */
737 int bt_adapter_set_device_discovery_state_changed_cb(bt_adapter_device_discovery_state_changed_cb callback, void *user_data);
738
739 /**
740  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
741  * @brief       Unregisters the callback function.
742  * @since_tizen 2.3
743  *
744  * @return      0 on success, otherwise a negative error value.
745  * @retval #BT_ERROR_NONE  Successful
746  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
747  *
748  * @pre The Bluetooth service must be initialized with bt_initialize().
749  *
750  * @see bt_initialize()
751  * @see bt_adapter_set_device_discovery_state_changed_cb()
752  */
753 int bt_adapter_unset_device_discovery_state_changed_cb(void);
754
755 /**
756  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
757  * @brief Get the Hash and Randmoizer value, synchronously.
758  * @since_tizen 2.3
759  *
760  * @param[out] hash The hash value recieved from the controller
761  * @param[out] randomizer The hash value recieved from the controller
762  * @param[out] hash_len The length of the hash value
763  * @param[out] randomizer_len The length of the randomizer value
764  * @return 0 on success, otherwise a negative error value.
765  * @retval #BT_ERROR_NONE  Successful
766  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
767  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
768  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
769  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
770  *
771  * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
772  * @pre The Bluetooth service must be initialized with bt_initialize().
773  * @see bt_initialize()
774  */
775 int bt_adapter_get_local_oob_data(unsigned char **hash, unsigned char **randomizer,
776                                         int *hash_len, int *randomizer_len);
777
778 /**
779  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
780  * @brief Sets the Hash and Randmoizer value, synchronously.
781  * @since_tizen 2.3
782  * @privlevel public
783  * @privilege %http://tizen.org/privilege/bluetooth
784  *
785  * @param[in] remote_address Remote device address
786  * @param[in] hash The hash value recieved from the controller
787  * @param[in] randomizer The hash value recieved from the controller
788  * @param[in] hash_len The length of the hash value. Allowed value is 16
789  * @param[in] randomizer_len The length of the randomizer value. Allowed value is 16
790  * @return 0 on success, otherwise a negative error value.
791  * @retval #BT_ERROR_NONE  Successful
792  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
793  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
794  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
795  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
796  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
797  *
798  * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
799  * @pre The Bluetooth service must be initialized with bt_initialize().
800  * @see bt_initialize()
801  */
802 int bt_adapter_set_remote_oob_data(const char *remote_address,
803                                 unsigned char *hash, unsigned char *randomizer,
804                                 int hash_len, int randomizer_len);
805 /**
806  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
807  * @brief Deletes the Hash and Randomizer value, synchronously.
808  * @since_tizen 2.3
809  * @privlevel public
810  * @privilege %http://tizen.org/privilege/bluetooth
811  *
812  * @param[in] remote_address Remote device address
813  * @return 0 on success, otherwise a negative error value.
814  * @retval #BT_ERROR_NONE  Successful
815  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
816  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
817  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
818  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
819  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
820  *
821  * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
822  * @pre The Bluetooth service must be initialized with bt_initialize().
823  * @see bt_initialize()
824  */
825 int bt_adapter_remove_remote_oob_data(const char *remote_address);
826
827 /**
828  * @internal
829  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
830  * @brief  Registers a callback function to be invoked when the connectable state changes.
831  * @since_tizen 2.3
832  *
833  * @param[in] callback The callback function to register
834  * @param[in] user_data The user data to be passed to the callback function
835  *
836  * @return   0 on success, otherwise a negative error value.
837  * @retval #BT_ERROR_NONE  Successful
838  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
839  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
840  *
841  * @pre The Bluetooth service must be initialized with bt_initialize().
842  * @post bt_adapter_connectable_changed_cb() will be invoked.
843  *
844  * @see bt_initialize()
845  * @see bt_adapter_connectable_changed_cb()
846  * @see bt_adapter_unset_connectable_changed_cb()
847  */
848 int bt_adapter_set_connectable_changed_cb(bt_adapter_connectable_changed_cb callback, void *user_data);
849
850 /**
851  * @internal
852  * @ingroup  CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
853  * @brief  Unregisters the callback function.
854  * @since_tizen 2.3
855  *
856  * @return  0 on success, otherwise a negative error value.
857  * @retval  #BT_ERROR_NONE  Successful
858  * @retval  #BT_ERROR_NOT_INITIALIZED  Not initialized
859  *
860  * @pre  The Bluetooth service must be initialized with bt_initialize().
861  *
862  * @see  bt_initialize()
863  * @see  bt_adapter_set_connectable_changed_cb()
864  */
865 int bt_adapter_unset_connectable_changed_cb(void);
866
867 /**
868  * @internal
869  * @ingroup  CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
870  * @brief  Gets the connectable state of local Bluetooth adapter.
871  * @since_tizen 2.3
872  *
873  * @remarks When connectable state is false, no device can connect to this device and visibility mode cannot be changed.
874  *
875  * @param[out] connectable The connectable state of local Bluetooth adapter
876  *
877  * @return 0 on success, otherwise a negative error value.
878  * @retval #BT_ERROR_NONE  Successful
879  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
880  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
881  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
882  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
883  *
884  * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
885  *
886  * @see bt_adapter_set_connectable()
887  */
888 int bt_adapter_get_connectable(bool *connectable);
889
890 /**
891  * @internal
892  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
893  * @brief  Sets the connectable state of local Bluetooth adapter.
894  * @since_tizen 2.3
895  * @privlevel platform
896  * @privilege %http://tizen.org/privilege/bluetooth.admin
897  *
898  * @remarks When connectable state is false, no device can connect to this device and visibility mode cannot be changed.
899  *
900  * @param[in] connectable The connectable state to set
901  *
902  * @return 0 on success, otherwise a negative error value.
903  * @retval #BT_ERROR_NONE  Successful
904  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
905  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
906  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
907  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
908  *
909  * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
910  * @post bt_adapter_connectable_changed_cb() will be invoked if this function returns #BT_ERROR_NONE.
911  *
912  * @see bt_adapter_get_connectable()
913  * @see bt_adapter_connectable_changed_cb()
914  * @see bt_adapter_set_connectable_changed_cb()
915  * @see bt_adapter_unset_connectable_changed_cb()
916  */
917 int bt_adapter_set_connectable(bool connectable);
918
919 /**
920  * @internal
921  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
922  * @brief Enables the local Bluetooth le adapter, asynchronously.
923  * @since_tizen 2.3
924  * @privlevel platform
925  * @privilege %http://tizen.org/privilege/bluetooth.admin
926  *
927  * @details This function enables Bluetooth protocol stack and hardware.
928  *
929  * @return 0 on success, otherwise a negative error value.
930  * @retval #BT_ERROR_NONE  Successful
931  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
932  * @retval #BT_ERROR_ALREADY_DONE  Already enabled
933  * @retval #BT_ERROR_NOW_IN_PROGRESS  Operation now in progress
934  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
935  *
936  * @pre Bluetooth service must be initialized with bt_initialize().
937  * @post This function invokes bt_adapter_le_state_changed_cb().
938  *
939  * @see bt_initialize()
940  * @see bt_adapter_le_get_state()
941  * @see bt_adapter_le_set_state_changed_cb()
942  * @see bt_adapter_le_unset_state_changed_cb()
943  * @see bt_adapter_le_state_changed_cb()
944  *
945  */
946 int bt_adapter_le_enable(void);
947
948 /**
949  * @internal
950  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
951  * @brief Disables the local Bluetooth le adapter, asynchronously.
952  * @since_tizen 2.3
953  * @privlevel platform
954  * @privilege %http://tizen.org/privilege/bluetooth.admin
955  *
956  * @details This function disables Bluetooth le protocol stack and hardware.
957  *
958  * @remarks
959  *
960  * @return 0 on success, otherwise a negative error value.
961  * @retval #BT_ERROR_NONE  Successful
962  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
963  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
964  * @retval #BT_ERROR_NOW_IN_PROGRESS  Operation now in progress
965  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
966  *
967  * @pre The state of local Bluetooth must be #BT_ADAPTER_LE_ENABLED
968  * @post This function invokes bt_adapter_le_state_changed_cb().
969  *
970  * @see bt_adapter_le_get_state()
971  * @see bt_adapter_le_state_changed_cb()
972  * @see bt_adapter_le_set_state_changed_cb()
973  * @see bt_adapter_le_unset_state_changed_cb ()
974  *
975  */
976 int bt_adapter_le_disable(void);
977
978 /**
979  * @internal
980  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
981  * @brief Gets the current state of local Bluetooth adapter.
982  * @since_tizen 2.3
983  *
984  * @param[out] adapter_le_state The current adapter le state
985  *
986  * @return 0 on success, otherwise a negative error value.
987  * @retval #BT_ERROR_NONE  Successful
988  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
989  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
990  *
991  * @pre Bluetooth service must be initialized with bt_initialize().
992  *
993  * @see bt_initialize()
994  */
995 int bt_adapter_le_get_state(bt_adapter_le_state_e *adapter_le_state);
996
997 /**
998  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
999  * @brief Starts the LE device discovery for a BT_ADAPTER_DEVICE_DISCOVERY_LE type.
1000  * @since_tizen 2.3
1001  * @privlevel public
1002  * @privilege %http://tizen.org/privilege/bluetooth
1003  *
1004  * @details If a LE device is discovered, bt_adapter_le_device_discovery_state_changed_cb()
1005 *  will be invoked with #BT_ADAPTER_LE_DEVICE_DISCOVERY_FOUND, and then bt_adapter_le_device_discovery_state_changed_cb()
1006  * will be called with #BT_ADAPTER_LE_DEVICE_DISCOVERY_FINISHED in case of the completion or cancellation of the discovery.
1007  *
1008  * @remarks To connect to peer Bluetooth device, you need to know its Bluetooth address. \n
1009  * The device discovery can be stopped by bt_adapter_le_stop_device_discovery().
1010  *
1011  * @return 0 on success, otherwise a negative error value.
1012  * @retval #BT_ERROR_NONE  Successful
1013  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1014  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
1015  * @retval #BT_ERROR_NOW_IN_PROGRESS  Operation is now in progress
1016  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
1017  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
1018  *
1019  * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
1020  * or must be #BT_ADAPTER_LE_ENABLED.
1021  * @post This function invokes bt_adapter_le_device_discovery_state_changed_cb().
1022  *
1023  * @see bt_adapter_le_is_discovering()
1024  * @see bt_adapter_le_device_discovery_state_changed_cb()
1025  * @see bt_adapter_le_set_device_discovery_state_changed_cb()
1026  * @see bt_adapter_le_unset_device_discovery_state_changed_cb()
1027  */
1028 int bt_adapter_le_start_device_discovery(void);
1029
1030 /**
1031  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
1032  * @brief Stops the LE device discovery, asynchronously.
1033  * @since_tizen 2.3
1034  * @privlevel public
1035  * @privilege %http://tizen.org/privilege/bluetooth
1036  *
1037  * @return 0 on success, otherwise a negative error value.
1038  * @retval #BT_ERROR_NONE  Successful
1039  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1040  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
1041  * @retval #BT_ERROR_NOT_IN_PROGRESS  Operation is not in progress
1042  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
1043  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
1044  *
1045  * @pre The device discovery must be in progress with bt_adapter_le_start_device_discovery().
1046  * @post This function invokes bt_adapter_le_device_discovery_state_changed_cb().
1047  *
1048  * @see bt_adapter_le_is_discovering()
1049  * @see bt_adapter_le_start_device_discovery()
1050  * @see bt_adapter_le_set_device_discovery_state_changed_cb()
1051  * @see bt_adapter_le_unset_device_discovery_state_changed_cb()
1052  * @see bt_adapter_le_device_discovery_state_changed_cb()
1053  */
1054 int bt_adapter_le_stop_device_discovery(void);
1055
1056 /**
1057  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
1058  * @brief Checks for the LE device discovery is in progress or not.
1059  * @since_tizen 2.3
1060  *
1061  * @remarks If Bluetooth LE discovery is in progress, other operations are not allowed and
1062  * you have to either stop the LE discovery operation, or wait for it to be finished,
1063  * before performing other operations.
1064
1065  * @param[out] is_discovering The discovering status: (@c true = in progress , @c  false = not in progress )
1066  *
1067  * @return 0 on success, otherwise a negative error value.
1068  * @retval #BT_ERROR_NONE  Successful
1069  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1070  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
1071  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
1072  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
1073  *
1074  * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
1075  * or must be #BT_ADAPTER_LE_ENABLED.
1076  *
1077  * @see bt_adapter_le_start_device_discovery()
1078  * @see bt_adapter_le_stop_device_discovery()
1079  */
1080 int bt_adapter_le_is_discovering(bool *is_discovering);
1081
1082 /**
1083  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
1084  * @brief  Registers a callback function to be invoked when the LE device discovery state changes.
1085  * @since_tizen 2.3
1086  *
1087  * @param[in] callback The callback function to register
1088  * @param[in] user_data The user data to be passed to the callback function
1089  *
1090  * @return   0 on success, otherwise a negative error value.
1091  * @retval #BT_ERROR_NONE  Successful
1092  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1093  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
1094  *
1095  * @pre The Bluetooth service must be initialized with bt_initialize().
1096  * @post bt_adapter_le_device_discovery_state_changed_cb() will be invoked.
1097  *
1098  * @see bt_initialize()
1099  * @see bt_adapter_le_device_discovery_state_changed_cb()
1100  * @see bt_adapter_le_unset_device_discovery_state_changed_cb()
1101  */
1102 int bt_adapter_le_set_device_discovery_state_changed_cb(bt_adapter_le_device_discovery_state_changed_cb callback, void *user_data);
1103
1104 /**
1105  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
1106  * @brief       Unregisters the callback function.
1107  * @since_tizen 2.3
1108  *
1109  * @return      0 on success, otherwise a negative error value.
1110  * @retval #BT_ERROR_NONE  Successful
1111  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1112  *
1113  * @pre The Bluetooth service must be initialized with bt_initialize().
1114  *
1115  * @see bt_initialize()
1116  * @see bt_adapter_le_set_device_discovery_state_changed_cb()
1117  */
1118 int bt_adapter_le_unset_device_discovery_state_changed_cb(void);
1119
1120 /**
1121  * @internal
1122  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
1123  * @brief  Registers a callback function to be invoked when the Bluetooth adapter le state changes.
1124  * @since_tizen 2.3
1125  *
1126  * @param[in] callback  The callback function to invoke
1127  * @param[in] user_data The user data to be passed to the callback function
1128  *
1129  * @return   0 on success, otherwise a negative error value.
1130  * @retval #BT_ERROR_NONE  Successful
1131  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1132  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
1133  *
1134  * @pre The Bluetooth service must be initialized with bt_initialize().
1135  * @post bt_adapter_le_state_changed_cb() will be invoked.
1136  *
1137  * @see bt_initialize()
1138  * @see bt_adapter_le_state_changed_cb()
1139  * @see bt_adapter_le_unset_state_changed_cb()
1140  */
1141 int bt_adapter_le_set_state_changed_cb(bt_adapter_le_state_changed_cb callback, void *user_data);
1142
1143 /**
1144  * @internal
1145  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
1146  * @brief       Unregisters the callback function.
1147  * @since_tizen 2.3
1148  *
1149  * @return      0 on success, otherwise a negative error value.
1150  * @retval #BT_ERROR_NONE  Successful
1151  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1152  *
1153  * @pre The Bluetooth service must be initialized with bt_initialize().
1154  *
1155  * @see bt_initialize()
1156  * @see bt_adapter_le_set_state_changed_cb()
1157  */
1158 int bt_adapter_le_unset_state_changed_cb(void);
1159
1160 /**
1161  * @internal
1162  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
1163  * @brief add address to whitelist for accepting scanning request.
1164  * @since_tizen 2.3
1165  * @privlevel platform
1166  * @privilege %http://tizen.org/privilege/bluetooth.admin
1167  *
1168  * @remarks If the adress is in the whitelist then other LE devices are able to
1169  * search this device. Before calling this API, make sure that the adapter is
1170  * enabled. There is no callback event for this API.
1171
1172  * @param[in] address The other device's address
1173  * @param[in] address_type The other device's address type
1174  *
1175  * @return 0 on success, otherwise a negative error value.
1176  * @retval #BT_ERROR_NONE  Successful
1177  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1178  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
1179  * @retval #BT_ERROR_NOT_ENABLED  Adapter is not enabled
1180  * @retval #BT_ERROR_RESOURCE_BUSY  Device or resource busy
1181  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
1182  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
1183  *
1184  * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
1185  *
1186  * @see bt_adapter_le_start_advertising()
1187  * @see bt_adapter_le_stop_advertising()
1188  */
1189 int bt_adapter_le_add_white_list(const char *address, bt_device_address_type_e address_type);
1190
1191 /**
1192  * @internal
1193  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
1194  * @brief remove address from the whitelist for not accepting scanning request.
1195  * @since_tizen 2.3
1196  * @privlevel platform
1197  * @privilege %http://tizen.org/privilege/bluetooth.admin
1198  *
1199  * @remarks If the adress is in the whitelist then other LE devices are able to
1200  * search this device. Before calling this API, make sure that the adapter is
1201  * enabled. There is no callback event for this API.
1202  *
1203  * @param[in] address The other device's address
1204  * @param[in] address_type The other device's address type
1205  *
1206  * @return 0 on success, otherwise a negative error value.
1207  * @retval #BT_ERROR_NONE  Successful
1208  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1209  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
1210  * @retval #BT_ERROR_NOT_ENABLED  Adapter is not enabled
1211  * @retval #BT_ERROR_RESOURCE_BUSY  Device or resource busy
1212  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
1213  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
1214  *
1215  * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
1216  *
1217  * @see bt_adapter_le_start_advertising()
1218  * @see bt_adapter_le_stop_advertising()
1219  */
1220 int bt_adapter_le_remove_white_list(const char *address, bt_device_address_type_e address_type);
1221
1222 /**
1223  * @internal
1224  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
1225  * @brief clear address from the whitelist for not accepting scanning request.
1226  * @since_tizen 2.3
1227  * @privlevel platform
1228  * @privilege %http://tizen.org/privilege/bluetooth.admin
1229  *
1230  * @remarks If the adress is in the whitelist then other LE devices are able to
1231  * search this device. Before calling this API, make sure that the adapter is
1232  * enabled. There is no callback event for this API.
1233  *
1234  * @return 0 on success, otherwise a negative error value.
1235  * @retval #BT_ERROR_NONE  Successful
1236  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1237  * @retval #BT_ERROR_NOT_ENABLED  Adapter is not enabled
1238  * @retval #BT_ERROR_RESOURCE_BUSY  Device or resource busy
1239  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
1240  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
1241  *
1242  * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
1243  *
1244  * @see bt_adapter_le_start_advertising()
1245  * @see bt_adapter_le_stop_advertising()
1246  */
1247 int bt_adapter_le_clear_white_list(void);
1248
1249 /**
1250  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
1251  * @brief Create advertiser to advertise device's existence or respond to LE scanning reqeust.
1252  * @since_tizen 2.3
1253  *
1254  * @param[out] advertiser The handle of advertiser
1255  *
1256  * @return 0 on success, otherwise a negative error value.
1257  * @retval #BT_ERROR_NONE  Successful
1258  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1259  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
1260  * @retval #BT_ERROR_OUT_OF_MEMORY  Out of memory
1261  *
1262  * @pre The Bluetooth service must be initialized with bt_initialize().
1263  *
1264  * @see bt_adapter_le_destroy_advertiser()
1265  */
1266 int bt_adapter_le_create_advertiser(bt_advertiser_h *advertiser);
1267
1268 /**
1269  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
1270  * @brief Destroy advertiser.
1271  * @since_tizen 2.3
1272  *
1273  * @param[out] advertiser The handle of advertiser
1274  *
1275  * @return 0 on success, otherwise a negative error value.
1276  * @retval #BT_ERROR_NONE  Successful
1277  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1278  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
1279  *
1280  * @pre The Bluetooth service must be initialized with bt_initialize().
1281  *
1282  * @see bt_adapter_le_create_advertiser()
1283  */
1284 int bt_adapter_le_destroy_advertiser(bt_advertiser_h advertiser);
1285
1286 /**
1287  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
1288  * @brief Set the data to be advertised or responded to scan request from LE scanning device.
1289  *        The maximum advertised or responded data size is 31 bytes
1290  *        including data type and system wide data.
1291  * @since_tizen 2.3
1292  *
1293  * @param[in] advertiser The handle of advertiser
1294  * @param[in] pkt_type The packet type
1295  * @param[in] data_type The data type that is included in packet
1296  * @param[in] data The data to be advertised or be responded to scan request from LE scanning device
1297  * @param[in] data_size The size of data to be set.
1298  *
1299  * @return 0 on success, otherwise a negative error value.
1300  * @retval #BT_ERROR_NONE  Successful
1301  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1302  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
1303  * @retval #BT_ERROR_QUOTA_EXCEEDED  Quota exceeded
1304  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
1305  *
1306  * @pre The Bluetooth service must be initialized with bt_initialize().
1307  *
1308  * @see bt_adapter_le_remove_advertising_data()
1309  * @see bt_adapter_le_clear_advertising_data()
1310  */
1311 int bt_adapter_le_add_advertising_data(bt_advertiser_h advertiser,
1312                 bt_adapter_le_packet_type_e pkt_type, bt_adapter_le_packet_data_type_e data_type,
1313                 void *data, unsigned int data_size);
1314
1315 /**
1316  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
1317  * @brief Unset the data to be advertised or responded to scan request from LE scanning device.
1318  * @since_tizen 2.3
1319  *
1320  * @param[in] advertiser The handle of advertiser
1321  * @param[in] pkt_type The packet type
1322  * @param[in] data_type The data type to be removed from selected packet
1323  *
1324  * @return 0 on success, otherwise a negative error value.
1325  * @retval #BT_ERROR_NONE  Successful
1326  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1327  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
1328  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
1329  *
1330  * @pre The Bluetooth service must be initialized with bt_initialize().
1331  *
1332  * @see bt_adapter_le_add_advertising_data()
1333  * @see bt_adapter_le_clear_advertising_data()
1334  */
1335 int bt_adapter_le_remove_advertising_data(bt_advertiser_h advertiser,
1336                 bt_adapter_le_packet_type_e pkt_type, bt_adapter_le_packet_data_type_e data_type);
1337
1338 /**
1339  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
1340  * @brief Clear all data to be advertised or responded to scan request from LE scanning device.
1341  * @since_tizen 2.3
1342  *
1343  * @param[in] advertiser The handle of advertiser
1344  * @param[in] pkt_type The packet type to be cleared
1345  *
1346  * @return 0 on success, otherwise a negative error value.
1347  * @retval #BT_ERROR_NONE  Successful
1348  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1349  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
1350  *
1351  * @pre The Bluetooth service must be initialized with bt_initialize().
1352  *
1353  * @see bt_adapter_le_add_advertising_data()
1354  * @see bt_adapter_le_remove_advertising_data()
1355  */
1356 int bt_adapter_le_clear_advertising_data(bt_advertiser_h advertiser, bt_adapter_le_packet_type_e pkt_type);
1357
1358 /**
1359  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
1360  * @brief Start advertising with passed advertiser and advertising parameters.
1361  * @since_tizen 2.3
1362  * @privlevel public
1363  * @privilege %http://tizen.org/privilege/bluetooth
1364  *
1365  * @details Once Bluetooth advertising is started, nearby Bluetooth LE(Low Energy) supported
1366  * devices can know this device's existence. And one of them can make a connection reqeust,
1367  * if it is allowed.
1368  *
1369  * @param[in] advertiser The handle of advertiser
1370  * @param[in] adv_params The parameters of advertising \n
1371  * If NULL is passed, default values which are defined in driver / controller are used.
1372  * @param[in] cb The callback to report the result of this function
1373  * @param[in] user_data The user data to be passed when callback is called
1374  *
1375  * @return 0 on success, otherwise a negative error value.
1376  * @retval #BT_ERROR_NONE  Successful
1377  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1378  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
1379  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
1380  * @retval #BT_ERROR_NOW_IN_PROGRESS  Operation is now in progress
1381  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
1382  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
1383  *
1384  * @pre The Bluetooth service must be initialized with bt_initialize().
1385  * @post This function invokes bt_adapter_le_advertising_state_changed_cb().
1386  *
1387  * @see bt_adapter_le_stop_advertising()
1388  * @see bt_adapter_le_advertising_state_changed_cb()
1389  */
1390 int bt_adapter_le_start_advertising(bt_advertiser_h advertiser, bt_adapter_le_advertising_params_s *adv_params,
1391                 bt_adapter_le_advertising_state_changed_cb cb, void *user_data);
1392 /**
1393  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
1394  * @brief Stops the advertising.
1395  * @since_tizen 2.3
1396  * @privlevel public
1397  * @privilege %http://tizen.org/privilege/bluetooth
1398  *
1399  * @param[in] advertiser The handle of advertiser
1400  *
1401  * @return 0 on success, otherwise a negative error value.
1402  * @retval #BT_ERROR_NONE  Successful
1403  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1404  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
1405  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
1406  * @retval #BT_ERROR_NOT_IN_PROGRESS  Operation is not in progress
1407  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
1408  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
1409  *
1410  * @pre The advertising must be going on with bt_adapter_le_start_advertising().
1411  * @post This function invokes bt_adapter_le_advertising_state_changed_cb().
1412  *
1413  * @see bt_adapter_le_start_advertising()
1414  * @see bt_adapter_le_advertising_state_changed_cb()
1415  */
1416 int bt_adapter_le_stop_advertising(bt_advertiser_h advertiser);
1417
1418 /**
1419  * @internal
1420  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
1421  * @brief  Sets the Privacy feature state of local Bluetooth adapter.
1422  * @since_tizen 2.3
1423  * @privlevel platform
1424  * @privilege %http://tizen.org/privilege/bluetooth.admin
1425  *
1426  * @param[in] enable_privacy The privacy feature to set/unset.
1427  *
1428  * @return 0 on success, otherwise a negative error value.
1429  * @retval #BT_ERROR_NONE  Successful
1430  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1431  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
1432  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
1433  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
1434  * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
1435  *
1436  * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
1437  * @pre The state of local Bluetooth must be #BT_ADAPTER_LE_ENABLED.
1438  *
1439  */
1440 int bt_adapter_le_enable_privacy(bool enable_privacy);
1441
1442 /**
1443  * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
1444  * @brief Creates a bond with a remote Bluetooth device, asynchronously.
1445  * @since_tizen 2.3
1446  * @privlevel public
1447  * @privilege %http://tizen.org/privilege/bluetooth
1448  *
1449  * @remarks A bond can be destroyed by bt_device_destroy_bond().\n
1450  * The bonding request can be cancelled by bt_device_cancel_bonding().
1451  *
1452  * @param[in] remote_address The address of the remote Bluetooth device with which the bond should be created
1453  *
1454  * @return 0 on success, otherwise a negative error value.
1455  * @retval #BT_ERROR_NONE  Successful
1456  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1457  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
1458  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
1459  * @retval #BT_ERROR_RESOURCE_BUSY  Device or resource busy
1460  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
1461  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
1462  *
1463  * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
1464  * @pre The remote device must be discoverable with bt_adapter_start_device_discovery().
1465  * @post This function invokes bt_device_bond_created_cb().
1466  *
1467  * @see bt_adapter_start_device_discovery()
1468  * @see bt_device_bond_created_cb()
1469  * @see bt_device_cancel_bonding()
1470  * @see bt_device_destroy_bond()
1471  * @see bt_device_set_bond_created_cb()
1472  * @see bt_device_unset_bond_created_cb()
1473  */
1474 int bt_device_create_bond(const char *remote_address);
1475
1476 /**
1477  * @internal
1478  * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
1479  * @brief Creates a bond with a remote Bluetooth device, asynchronously.
1480  * @since_tizen 2.3
1481  * @privlevel platform
1482  * @privilege %http://tizen.org/privilege/bluetooth.admin
1483  *
1484  * @remarks A bond can be destroyed by bt_device_destroy_bond().\n
1485  * The bonding request can be cancelled by bt_device_cancel_bonding().
1486  *
1487  * @param[in] remote_address The address of the remote Bluetooth device with which the bond should be created
1488  * @param[in] conn_type The connection type(LE or BREDR) to create bond with remote device
1489  *
1490  * @return 0 on success, otherwise a negative error value.
1491  * @retval #BT_ERROR_NONE  Successful
1492  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1493  * @retval #BT_ERROR_INVALID_PARAMETER Invalid parameter
1494  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
1495  * @retval #BT_ERROR_RESOURCE_BUSY     Device or resource busy
1496  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
1497  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
1498  *
1499  * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
1500  * @pre The remote device must be discoverable with bt_adapter_start_device_discovery().
1501  * @post This function invokes bt_device_bond_created_cb().
1502  *
1503  * @see bt_adapter_start_device_discovery()
1504  * @see bt_device_create_bond()
1505  * @see bt_device_bond_created_cb()
1506  * @see bt_device_cancel_bonding()
1507  * @see bt_device_destroy_bond()
1508  * @see bt_device_set_bond_created_cb()
1509  * @see bt_device_unset_bond_created_cb()
1510  */
1511 int bt_device_create_bond_by_type(const char *remote_address,
1512                                   bt_device_connection_link_type_e conn_type);
1513
1514 /**
1515  * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
1516  * @brief Cancels the bonding process.
1517  * @since_tizen 2.3
1518  * @privlevel public
1519  * @privilege %http://tizen.org/privilege/bluetooth
1520  *
1521  * @remarks Use this function when the remote Bluetooth device is not responding to the
1522  * bond request or you wish to cancel the bonding request.
1523  *
1524  * @return 0 on success, otherwise a negative error value.
1525  * @retval #BT_ERROR_NONE  Successful
1526  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1527  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
1528  * @retval #BT_ERROR_NOT_IN_PROGRESS  Operation not in progress
1529  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
1530  *
1531  * @pre The creating a bond must be in progress by bt_device_create_bond().
1532  *
1533  * @see bt_device_create_bond()
1534  * @see bt_device_bond_created_cb()
1535  * @see bt_device_set_bond_created_cb()
1536  * @see bt_device_unset_bond_created_cb()
1537  */
1538 int bt_device_cancel_bonding(void);
1539
1540 /**
1541  * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
1542  * @brief Destroys the bond, asynchronously.
1543  * @since_tizen 2.3
1544  * @privlevel public
1545  * @privilege %http://tizen.org/privilege/bluetooth
1546  *
1547  * @param[in] remote_address The address of the remote Bluetooth device to remove bonding
1548  *
1549  * @return 0 on success, otherwise a negative error value.
1550  * @retval #BT_ERROR_NONE  Successful
1551  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1552  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
1553  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
1554  * @retval #BT_ERROR_RESOURCE_BUSY  Device or resource busy
1555  * @retval #BT_ERROR_REMOTE_DEVICE_NOT_BONDED  Remote device not bonded
1556  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
1557  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
1558  *
1559  * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
1560  * @pre The bond with the remote device must be created with bt_device_create_bond().
1561  * @post This function invokes bt_device_bond_destroyed_cb().
1562  *
1563  * @see bt_device_create_bond()
1564  * @see bt_device_bond_destroyed_cb()
1565  * @see bt_device_set_bond_destroyed_cb()
1566  * @see bt_device_unset_bond_destroyed_cb()
1567  */
1568 int bt_device_destroy_bond(const char *remote_address);
1569
1570 /**
1571  * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
1572  * @brief Sets an alias for the bonded device.
1573  * @since_tizen 2.3
1574  * @privlevel public
1575  * @privilege %http://tizen.org/privilege/bluetooth
1576  *
1577  * @param[in] remote_address The address of the remote Bluetooth device
1578  * @param[in] alias The alias of the remote Bluetooth device
1579  *
1580  * @return 0 on success, otherwise a negative error value.
1581  * @retval #BT_ERROR_NONE  Successful
1582  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1583  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
1584  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
1585  * @retval #BT_ERROR_REMOTE_DEVICE_NOT_BONDED  Remote device not bonded
1586  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
1587  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
1588  *
1589  * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
1590  * @pre The bond with the remote device must be created with bt_device_create_bond().
1591  *
1592  * @see bt_device_create_bond()
1593  */
1594 int bt_device_set_alias(const char *remote_address, const char *alias);
1595
1596 /**
1597  * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
1598  * @brief Sets the authorization of a bonded device, asynchronously.
1599  * @since_tizen 2.3
1600  * @privlevel public
1601  * @privilege %http://tizen.org/privilege/bluetooth
1602  *
1603  * @remarks Once a device is authorized, you don't need to receive a confirmation.
1604  *
1605  * @param[in] remote_address The address of the remote Bluetooth device to authorize
1606  * @param[in] authorization_state The Bluetooth authorization state
1607  *
1608  * @return 0 on success, otherwise a negative error value.
1609  * @retval #BT_ERROR_NONE  Successful
1610  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1611  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
1612  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
1613  * @retval #BT_ERROR_REMOTE_DEVICE_NOT_BONDED  Remote device not bonded
1614  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
1615  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
1616  *
1617  * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
1618  * @pre The bond with the remote device must be created with bt_device_create_bond().
1619  * @post bt_device_authorization_changed_cb() will be invoked.
1620  *
1621  * @see bt_device_create_bond()
1622  * @see bt_device_authorization_changed_cb()
1623  * @see bt_device_set_authorization_changed_cb()
1624  * @see bt_device_unset_authorization_changed_cb()
1625  */
1626 int bt_device_set_authorization(const char *remote_address, bt_device_authorization_e authorization_state);
1627
1628 /**
1629  * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
1630  * @brief Starts the search for services supported by the specified device, asynchronously.
1631  * @since_tizen 2.3
1632  * @privlevel public
1633  * @privilege %http://tizen.org/privilege/bluetooth
1634  *
1635  * @remarks If creating a bond succeeds, which means bt_device_bond_created_cb() is called with result #BT_ERROR_NONE,
1636  * then you don't need to run this function.\n
1637  * The service search takes a couple of seconds to complete normally. \n
1638  * The service search can be canceled by bt_device_cancel_service_search().
1639  *
1640  * @param[in] remote_address The address of the remote Bluetooth device whose services need to be checked
1641  *
1642  * @return 0 on success, otherwise a negative error value.
1643  * @retval #BT_ERROR_NONE  Successful
1644  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1645  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
1646  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
1647  * @retval #BT_ERROR_REMOTE_DEVICE_NOT_BONDED  Remote device not bonded
1648  * @retval #BT_ERROR_SERVICE_SEARCH_FAILED  Service search failed
1649  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
1650  *
1651  * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
1652  * @pre The remote device must be discoverable with bt_adapter_start_device_discovery().
1653  * @pre The bond with the remote device must be created with bt_device_create_bond().
1654  * @post This function invokes bt_device_service_searched_cb().
1655  *
1656  * @see bt_adapter_start_device_discovery()
1657  * @see bt_device_create_bond()
1658  * @see bt_device_bond_created_cb()
1659  * @see bt_device_service_searched_cb()
1660  * @see bt_device_cancel_service_search()
1661  * @see bt_device_set_service_searched_cb()
1662  * @see bt_device_unset_service_searched_cb()
1663  */
1664 int bt_device_start_service_search(const char *remote_address);
1665
1666 /**
1667  * @internal
1668  * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
1669  * @brief Cancels service search process.
1670  * @since_tizen 2.3
1671  * @privlevel platform
1672  * @privilege %http://tizen.org/privilege/bluetooth.admin
1673  *
1674  * @return 0 on success, otherwise a negative error value.
1675  * @retval #BT_ERROR_NONE  Successful
1676  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1677  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
1678  * @retval #BT_ERROR_REMOTE_DEVICE_NOT_BONDED  Remote device not bonded
1679  * @retval #BT_ERROR_NOT_IN_PROGRESS  Operation not in progress
1680  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
1681  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
1682  *
1683  * @pre The service search must be in progress by bt_device_start_service_search().
1684  *
1685  * @see bt_device_start_service_search()
1686  * @see bt_device_service_searched_cb()
1687  * @see bt_device_set_service_searched_cb()
1688  * @see bt_device_unset_service_searched_cb()
1689  */
1690 int bt_device_cancel_service_search(void);
1691
1692 /**
1693  * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
1694  * @brief Gets the connected profiles.
1695  * @since_tizen 2.3
1696  * @param[in] remote_address The address of the remote device
1697  * @param[in] callback The callback function to invoke
1698  * @param[in] user_data The user data to be passed to the callback function
1699  * @return 0 on success, otherwise a negative error value.
1700  * @retval #BT_ERROR_NONE  Successful
1701  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
1702  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1703  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
1704  * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
1705  * @post bt_device_connected_profile() will be invoked.
1706  * @see bt_device_connected_profile()
1707  */
1708 int bt_device_foreach_connected_profiles(const char *remote_address, bt_device_connected_profile callback, void *user_data);
1709
1710 /**
1711  * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
1712  * @brief Gets the profile connected status.
1713  * @since_tizen 2.3
1714  * @param[in] remote_address The address of the remote device
1715  * @param[in] bt_profile wish to know bt_profile
1716  * @param[out] connected_status the connected status
1717  * @return 0 on success, otherwise a negative error value.
1718  * @retval #BT_ERROR_NONE  Successful
1719  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
1720  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1721  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
1722  * @retval #BT_ERROR_REMOTE_DEVICE_NOT_BONDED   Remote device not bonded
1723  * @retval #BT_ERROR_OPERATION_FAILED   Operation failed
1724  * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
1725  */
1726 int bt_device_is_profile_connected(const char *remote_address, bt_profile_e bt_profile,
1727                                         bool *connected_status);
1728
1729 /**
1730  * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
1731  * @brief  Registers a callback function to be invoked when the bond creates.
1732  * @since_tizen 2.3
1733  * @param[in] callback The callback function to register
1734  * @param[in] user_data The user data to be passed to the callback function
1735  * @return   0 on success, otherwise a negative error value.
1736  * @retval #BT_ERROR_NONE  Successful
1737  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1738  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
1739  * @pre The Bluetooth service must be initialized with bt_initialize().
1740  * @post  bt_device_bond_created_cb() will be invoked.
1741  * @see bt_initialize()
1742  * @see bt_device_bond_created_cb()
1743  * @see bt_device_unset_bond_created_cb()
1744  */
1745 int bt_device_set_bond_created_cb(bt_device_bond_created_cb callback, void *user_data);
1746
1747 /**
1748  * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
1749  * @brief       Unregisters the callback function.
1750  * @since_tizen 2.3
1751  * @return      0 on success, otherwise a negative error value.
1752  * @retval #BT_ERROR_NONE  Successful
1753  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1754  * @pre The Bluetooth service must be initialized with bt_initialize().
1755  * @see bt_initialize()
1756  * @see bt_device_set_bond_created_cb()
1757  */
1758 int bt_device_unset_bond_created_cb(void);
1759
1760 /**
1761  * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
1762  * @brief  Registers a callback function to be invoked when the bond destroys.
1763  * @since_tizen 2.3
1764  * @param[in] callback The callback function to register
1765  * @param[in] user_data The user data to be passed to the callback function
1766  * @return   0 on success, otherwise a negative error value.
1767  * @retval #BT_ERROR_NONE  Successful
1768  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1769  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
1770  * @pre The Bluetooth service must be initialized with bt_initialize().
1771  * @post  bt_device_bond_destroyed_cb() will be invoked.
1772  * @see bt_initialize()
1773  * @see bt_device_bond_destroyed_cb()
1774  * @see bt_device_unset_bond_destroyed_cb()
1775  */
1776 int bt_device_set_bond_destroyed_cb(bt_device_bond_destroyed_cb callback, void *user_data);
1777
1778 /**
1779  * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
1780  * @brief       Unregisters the callback function.
1781  * @since_tizen 2.3
1782  * @return      0 on success, otherwise a negative error value.
1783  * @retval #BT_ERROR_NONE  Successful
1784  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1785  * @pre The Bluetooth service must be initialized with bt_initialize().
1786  * @see bt_initialize()
1787  * @see bt_device_set_bond_destroyed_cb()
1788  */
1789 int bt_device_unset_bond_destroyed_cb(void);
1790
1791 /**
1792  * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
1793  * @brief  Registers a callback function to be invoked when the authorization of device changes.
1794  * @since_tizen 2.3
1795  * @param[in] callback The callback function to register
1796  * @param[in] user_data The user data to be passed to the callback function
1797  * @return   0 on success, otherwise a negative error value.
1798  * @retval #BT_ERROR_NONE  Successful
1799  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1800  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
1801  * @pre The Bluetooth service must be initialized with bt_initialize().
1802  * @post  bt_device_authorization_changed_cb() will be invoked.
1803  * @see bt_initialize()
1804  * @see bt_device_authorization_changed_cb()
1805  * @see bt_device_set_authorization_changed_cb()
1806  * @see bt_device_unset_authorization_changed_cb()
1807  */
1808 int bt_device_set_authorization_changed_cb(bt_device_authorization_changed_cb callback, void *user_data);
1809
1810 /**
1811  * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
1812  * @brief       Unregisters the callback function.
1813  * @since_tizen 2.3
1814  * @return      0 on success, otherwise a negative error value.
1815  * @retval #BT_ERROR_NONE  Successful
1816  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1817  * @pre The Bluetooth service must be initialized with bt_initialize().
1818  * @see bt_initialize()
1819  * @see bt_device_set_authorization_changed_cb()
1820  */
1821 int bt_device_unset_authorization_changed_cb(void);
1822
1823 /**
1824  * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
1825  * @brief  Registers a callback function to be invoked when the process of service search finishes.
1826  * @since_tizen 2.3
1827  * @param[in] callback The callback function to register
1828  * @param[in] user_data The user data to be passed to the callback function
1829  * @return   0 on success, otherwise a negative error value.
1830  * @retval #BT_ERROR_NONE  Successful
1831  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1832  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
1833  * @pre The Bluetooth service must be initialized with bt_initialize().
1834  * @post  bt_device_service_searched_cb() will be invoked.
1835  * @see bt_initialize()
1836  * @see bt_device_service_searched_cb()
1837  * @see bt_device_unset_service_searched_cb()
1838  */
1839 int bt_device_set_service_searched_cb(bt_device_service_searched_cb callback, void *user_data);
1840
1841 /**
1842  * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
1843  * @brief       Unregisters the callback function.
1844  * @since_tizen 2.3
1845  * @return      0 on success, otherwise a negative error value.
1846  * @retval #BT_ERROR_NONE  Successful
1847  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1848  * @pre The Bluetooth service must be initialized with bt_initialize().
1849  * @see bt_initialize()
1850  * @see bt_device_set_service_searched_cb()
1851  */
1852 int bt_device_unset_service_searched_cb(void);
1853
1854 /**
1855  * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
1856  * @brief  Registers a callback function to be invoked when the connection state is changed.
1857  * @since_tizen 2.3
1858  * @param[in] callback The callback function to register
1859  * @param[in] user_data The user data to be passed to the callback function
1860  * @return 0 on success, otherwise a negative error value.
1861  * @retval #BT_ERROR_NONE  Successful
1862  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1863  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
1864  * @pre The Bluetooth service must be initialized with bt_initialize().
1865  * @post bt_device_connection_state_changed_cb() will be invoked.
1866  * @see bt_initialize()
1867  * @see bt_device_connection_state_changed_cb()
1868  * @see bt_device_unset_connection_state_changed_cb()
1869  */
1870 int bt_device_set_connection_state_changed_cb(bt_device_connection_state_changed_cb callback, void *user_data);
1871
1872 /**
1873  * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
1874  * @brief       Unregisters the callback function to be invoked when the connection state is changed.
1875  * @since_tizen 2.3
1876  * @return 0 on success, otherwise a negative error value.
1877  * @retval #BT_ERROR_NONE  Successful
1878  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1879  * @pre The Bluetooth service must be initialized with bt_initialize().
1880  * @see bt_initialize()
1881  * @see bt_device_set_connection_state_changed_cb()
1882  */
1883 int bt_device_unset_connection_state_changed_cb(void);
1884
1885 /**
1886  * @ingroup CAPI_NETWORK_BLUETOOTH_SOCKET_MODULE
1887  * @brief Registers a rfcomm server socket with a specific UUID.
1888  * @since_tizen 2.3
1889  * @privlevel public
1890  * @privilege %http://tizen.org/privilege/bluetooth
1891  *
1892  * @remarks A socket can be destroyed by bt_socket_destroy_rfcomm().
1893  *
1894  * @param[in] service_uuid The UUID of service to provide
1895  * @param[out] socket_fd The file descriptor of socket to listen
1896  * @return 0 on success, otherwise a negative error value.
1897  *
1898  * @retval #BT_ERROR_NONE  Successful
1899  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1900  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
1901  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
1902  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
1903  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
1904  *
1905  * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
1906  *
1907  * @see bt_socket_listen_and_accept_rfcomm()
1908  * @see bt_socket_destroy_rfcomm()
1909  */
1910 int bt_socket_create_rfcomm(const char *service_uuid, int *socket_fd);
1911
1912 /**
1913  * @ingroup CAPI_NETWORK_BLUETOOTH_SOCKET_MODULE
1914  * @brief Removes the rfcomm server socket which was created using bt_socket_create_rfcomm().
1915  * @since_tizen 2.3
1916  * @privlevel public
1917  * @privilege %http://tizen.org/privilege/bluetooth
1918  * @remarks If callback function bt_socket_connection_state_changed_cb() is set and the remote Bluetooth device is connected,
1919  * then bt_socket_connection_state_changed_cb() will be called when this function is finished successfully.
1920  *
1921  * @param[in] socket_fd The file descriptor of socket (which was created using bt_socket_create_rfcomm()) to destroy
1922  * @return 0 on success, otherwise a negative error value.
1923  * @retval #BT_ERROR_NONE  Successful
1924  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1925  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
1926  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
1927  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
1928  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
1929  *
1930  * @pre The socket must be created with bt_socket_create_rfcomm().
1931  * @post If callback function bt_socket_connection_state_changed_cb() is set and the remote Bluetooth device is connected,
1932  * then bt_socket_connection_state_changed_cb() will be called.
1933  * @see bt_socket_create_rfcomm()
1934  * @see bt_socket_connection_state_changed_cb()
1935  * @see bt_socket_set_connection_state_changed_cb()
1936  * @see bt_socket_unset_connection_state_changed_cb()
1937  */
1938 int bt_socket_destroy_rfcomm(int socket_fd);
1939
1940 /**
1941  * @ingroup CAPI_NETWORK_BLUETOOTH_SOCKET_MODULE
1942  * @brief Starts listening on passed rfcomm socket and accepts connection requests.
1943  * @since_tizen 2.3
1944  * @privlevel public
1945  * @privilege %http://tizen.org/privilege/bluetooth
1946  * @details Pop-up is shown automatically when a RFCOMM connection is requested.
1947  * bt_socket_connection_state_changed_cb() will be called with
1948  * #BT_SOCKET_CONNECTED if you click "yes" and connection is finished successfully.
1949  * @param[in] socket_fd The file descriptor of socket on which start to listen
1950  * @param[in] max_pending_connections The maximum number of pending connections
1951  * @return 0 on success, otherwise a negative error value.
1952  * @retval #BT_ERROR_NONE  Successful
1953  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1954  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
1955  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
1956  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
1957  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
1958  *
1959  * @pre The socket must be created with bt_socket_create_rfcomm().
1960  * @post If callback function bt_socket_connection_state_changed_cb() is set,
1961  * then bt_socket_connection_state_changed_cb() will be called when the remote Bluetooth device is connected.
1962  * @see bt_socket_create_rfcomm()
1963  * @see bt_socket_connection_state_changed_cb()
1964  * @see bt_socket_set_connection_state_changed_cb()
1965  * @see bt_socket_unset_connection_state_changed_cb()
1966  */
1967 int bt_socket_listen_and_accept_rfcomm(int socket_fd, int max_pending_connections);
1968
1969 /**
1970  * @internal
1971  * @ingroup CAPI_NETWORK_BLUETOOTH_SOCKET_MODULE
1972  * @brief Starts listening on passed rfcomm socket.
1973  * @since_tizen 2.3
1974  * @privlevel platform
1975  * @privilege %http://tizen.org/privilege/bluetooth.admin
1976  * @details bt_socket_connection_requested_cb() will be called when a RFCOMM connection is requested.
1977  *
1978  * @param[in] socket_fd  The file descriptor socket on which start to listen
1979  * @param[in] max_pending_connections  The number of pending connections
1980  *
1981  * @return 0 on success, otherwise a negative error value.
1982  * @retval #BT_ERROR_NONE  Successful
1983  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1984  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
1985  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
1986  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
1987  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
1988  *
1989  * @pre The socket must be created with bt_socket_create_rfcomm().
1990  * @post This function invokes bt_socket_connection_state_changed_cb().
1991  *
1992  * @see bt_socket_create_rfcomm()
1993  * @see bt_socket_set_connection_requested_cb()
1994  * @see bt_socket_unset_connection_requested_cb()
1995  * @see bt_socket_connection_requested_cb()
1996  */
1997 int bt_socket_listen(int socket_fd, int max_pending_connections);
1998
1999 /**
2000  * @internal
2001  * @ingroup  CAPI_NETWORK_BLUETOOTH_SOCKET_MODULE
2002  * @brief  Accepts a connection request.
2003  * @since_tizen 2.3
2004  * @privlevel platform
2005  * @privilege %http://tizen.org/privilege/bluetooth.admin
2006  * @param[in] requested_socket_fd  The file descriptor of socket on which a connection is requested
2007  * @return 0 on success, otherwise a negative error value.
2008  * @retval #BT_ERROR_NONE  Successful
2009  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2010  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
2011  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
2012  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
2013  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
2014  *
2015  * @pre The connection is requested by bt_socket_connection_requested_cb().
2016  * @see bt_socket_create_rfcomm()
2017  * @see bt_socket_connection_requested_cb()
2018  * @see bt_socket_listen()
2019  * @see bt_socket_reject()
2020 */
2021 int bt_socket_accept(int requested_socket_fd);
2022
2023 /**
2024  * @internal
2025  * @ingroup  CAPI_NETWORK_BLUETOOTH_SOCKET_MODULE
2026  * @brief  Rejects a connection request.
2027  * @since_tizen 2.3
2028  * @privlevel platform
2029  * @privilege %http://tizen.org/privilege/bluetooth.admin
2030  * @param[in] socket_fd  The file descriptor of socket on which a connection is requested
2031  * @return 0 on success, otherwise a negative error value.
2032  * @retval #BT_ERROR_NONE  Successful
2033  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2034  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
2035  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
2036  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
2037  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
2038  *
2039  * @pre The connection is requested by bt_socket_connection_requested_cb().
2040  * @see bt_socket_create_rfcomm()
2041  * @see bt_socket_connection_requested_cb()
2042  * @see bt_socket_listen()
2043  * @see bt_socket_accept()
2044  */
2045 int bt_socket_reject(int socket_fd);
2046
2047 /**
2048  * @ingroup CAPI_NETWORK_BLUETOOTH_SOCKET_MODULE
2049  * @brief Connects to a specific RFCOMM based service on a remote Bluetooth device UUID, asynchronously.
2050  * @since_tizen 2.3
2051  * @privlevel public
2052  * @privilege %http://tizen.org/privilege/bluetooth
2053  *
2054  * @remarks A connection can be disconnected by bt_socket_disconnect_rfcomm().
2055  *
2056  * @param[in] remote_address The address of the remote Bluetooth device
2057  * @param[in] service_uuid The UUID of service provided by the remote Bluetooth device
2058  *
2059  * @return 0 on success, otherwise a negative error value.
2060  * @retval #BT_ERROR_NONE  Successful
2061  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2062  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
2063  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
2064  * @retval #BT_ERROR_REMOTE_DEVICE_NOT_BONDED  Remote device not bonded
2065  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
2066  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
2067  *
2068  * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
2069  * @pre The remote device must be discoverable with bt_adapter_start_device_discovery().
2070  * @pre The bond with the remote device must be created with bt_device_create_bond().
2071  * @post This function invokes bt_socket_connection_state_changed_cb().
2072  *
2073  * @see bt_device_create_bond()
2074  * @see bt_adapter_start_device_discovery()
2075  * @see bt_device_start_service_search()
2076  * @see bt_socket_disconnect_rfcomm()
2077  * @see bt_socket_connection_state_changed_cb()
2078  * @see bt_socket_set_connection_state_changed_cb()
2079  * @see bt_socket_unset_connection_state_changed_cb()
2080  */
2081 int bt_socket_connect_rfcomm(const char *remote_address, const char *service_uuid);
2082
2083 /**
2084  * @ingroup CAPI_NETWORK_BLUETOOTH_SOCKET_MODULE
2085  * @brief Disconnects the RFCOMM connection with the given file descriptor of conneted socket.
2086  * @since_tizen 2.3
2087  * @privlevel public
2088  * @privilege %http://tizen.org/privilege/bluetooth
2089  * @param[in] socket_fd  The file descriptor of socket to close which was received using bt_socket_connection_state_changed_cb().
2090  * @return 0 on success, otherwise a negative error value.
2091  * @retval #BT_ERROR_NONE  Successful
2092  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2093  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
2094  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
2095  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
2096  *
2097  * @pre The connection must be established.
2098  *
2099  * @see bt_socket_connection_state_changed_cb()
2100  * @see bt_socket_set_connection_state_changed_cb()
2101  * @see bt_socket_unset_connection_state_changed_cb()
2102  */
2103 int bt_socket_disconnect_rfcomm(int socket_fd);
2104
2105 /**
2106  * @ingroup CAPI_NETWORK_BLUETOOTH_SOCKET_MODULE
2107  * @brief Sends data to the connected device.
2108  * @since_tizen 2.3
2109  * @privlevel public
2110  * @privilege %http://tizen.org/privilege/bluetooth
2111  * @remark The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
2112  *
2113  * @param[in] socket_fd The file descriptor of connected socket which was received using bt_socket_connection_state_changed_cb()
2114  * @param[in] data The data to be sent
2115  * @param[in] length The length of data to be sent
2116  *
2117  * @return the number of bytes written (zero indicates nothing was written).
2118  * @retval On error, -1 is returned, and errno is set appropriately. See write 2 man page.
2119  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2120  * @exception BT_ERROR_NOT_INITIALIZED  Not initialized
2121  * @exception BT_ERROR_PERMISSION_DENIED  Permission denied
2122  * @exception BT_ERROR_AGAIN  Resource temporarily unavailable
2123  *
2124  * @pre The connection must be established.
2125  *
2126  * @see bt_socket_connection_state_changed_cb()
2127  * @see bt_socket_set_connection_state_changed_cb()
2128  * @see bt_socket_unset_connection_state_changed_cb()
2129  */
2130 int bt_socket_send_data(int socket_fd, const char *data, int length);
2131
2132 /**
2133  * @ingroup CAPI_NETWORK_BLUETOOTH_SOCKET_MODULE
2134  * @brief  Register a callback function that will be invoked when you receive data.
2135  * @since_tizen 2.3
2136  * @param[in] callback The callback function to register
2137  * @param[in] user_data The user data to be passed to the callback function
2138  * @return   0 on success, otherwise a negative error value.
2139  * @retval #BT_ERROR_NONE  Successful
2140  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2141  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
2142  * @pre The Bluetooth service must be initialized with bt_initialize().
2143  * @post  bt_socket_data_received_cb() will be invoked.
2144  * @see bt_initialize()
2145  * @see bt_socket_data_received_cb()
2146  * @see bt_socket_set_data_received_cb()
2147  * @see bt_socket_unset_data_received_cb()
2148  */
2149 int bt_socket_set_data_received_cb(bt_socket_data_received_cb callback, void *user_data);
2150
2151 /**
2152  * @ingroup CAPI_NETWORK_BLUETOOTH_SOCKET_MODULE
2153  * @brief       Unregisters the callback function.
2154  * @since_tizen 2.3
2155  * @return      0 on success, otherwise a negative error value.
2156  * @retval #BT_ERROR_NONE  Successful
2157  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2158  * @pre The Bluetooth service must be initialized with bt_initialize().
2159  * @see bt_initialize()
2160  * @see bt_socket_data_received_cb()
2161  * @see bt_socket_set_data_received_cb()
2162  */
2163 int bt_socket_unset_data_received_cb(void);
2164
2165 /**
2166  * @ingroup CAPI_NETWORK_BLUETOOTH_SOCKET_MODULE
2167  * @brief  Register a callback function that will be invoked when a RFCOMM connection is requested.
2168  * @since_tizen 2.3
2169  * @param[in] callback The callback function to register
2170  * @param[in] user_data The user data to be passed to the callback function
2171  * @return   0 on success, otherwise a negative error value.
2172  * @retval #BT_ERROR_NONE  Successful
2173  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2174  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
2175  * @pre The Bluetooth service must be initialized with bt_initialize().
2176  * @post If you listen a socket by bt_socket_listen(), bt_socket_connection_requested_cb() will be invoked.
2177  * @see bt_initialize()
2178  * @see bt_socket_unset_connection_requested_cb()
2179  */
2180 int bt_socket_set_connection_requested_cb(bt_socket_connection_requested_cb callback, void *user_data);
2181
2182 /**
2183  * @ingroup  CAPI_NETWORK_BLUETOOTH_SOCKET_MODULE
2184  * @brief  Unregisters the callback function.
2185  * @since_tizen 2.3
2186  * @return  0 on success, otherwise a negative error value.
2187  * @retval  #BT_ERROR_NONE  Successful
2188  * @retval  #BT_ERROR_NOT_INITIALIZED  Not initialized
2189  * @pre  The Bluetooth service must be initialized with bt_initialize().
2190  * @see  bt_initialize()
2191  * @see  bt_socket_set_connection_requested_cb()
2192  * @see  bt_socket_connection_requested_cb()
2193  */
2194 int bt_socket_unset_connection_requested_cb(void);
2195
2196 /**
2197  * @ingroup CAPI_NETWORK_BLUETOOTH_SOCKET_MODULE
2198  * @brief  Register a callback function that will be invoked when the connection state changes.
2199  * @since_tizen 2.3
2200  * @param[in] callback The callback function to register
2201  * @param[in] user_data The user data to be passed to the callback function
2202  * @return   0 on success, otherwise a negative error value.
2203  * @retval #BT_ERROR_NONE  Successful
2204  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2205  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
2206  * @pre The Bluetooth service must be initialized with bt_initialize().
2207  * @post bt_socket_connection_state_changed_cb() will be invoked.
2208  * @see bt_initialize()
2209  * @see bt_socket_connection_state_changed_cb()
2210  * @see bt_socket_unset_connection_state_changed_cb()
2211  */
2212 int bt_socket_set_connection_state_changed_cb(bt_socket_connection_state_changed_cb callback, void *user_data);
2213
2214 /**
2215  * @ingroup CAPI_NETWORK_BLUETOOTH_SOCKET_MODULE
2216  * @brief       Unregisters the callback function.
2217  * @since_tizen 2.3
2218  * @return      0 on success, otherwise a negative error value.
2219  * @retval #BT_ERROR_NONE  Successful
2220  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2221  * @pre The Bluetooth service must be initialized with bt_initialize().
2222  * @see bt_initialize()
2223  * @see bt_socket_connection_state_changed_cb()
2224  * @see bt_socket_set_connection_state_changed_cb()
2225  */
2226 int bt_socket_unset_connection_state_changed_cb(void);
2227
2228 /**
2229  * @internal
2230  * @ingroup CAPI_NETWORK_BLUETOOTH_OPP_SERVER_MODULE
2231  * @brief Initializes the Bluetooth OPP server requested by bt_opp_server_push_requested_cb().
2232  * @since_tizen 2.3
2233  * @details The popup appears when an OPP connection is requested from a remote device.
2234  * If you accept the request, then connection will be established and bt_opp_server_push_requested_cb() will be called.
2235  * At that time, you can call either bt_opp_server_accept() or bt_opp_server_reject().
2236  * @remarks This function must be called to start Bluetooth OPP server. You must free all resources of the Bluetooth service
2237  * by calling bt_opp_server_deinitialize() if Bluetooth OPP service is no longer needed.
2238  * @param[in] destination  The destination path
2239  * @param[in] push_requested_cb  The callback called when a push is requested
2240  * @param[in] user_data The user data to be passed to the callback function
2241  * @return 0 on success, otherwise a negative error value.
2242  * @retval #BT_ERROR_NONE  Successful
2243  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2244  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
2245  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
2246  * @retval #BT_ERROR_RESOURCE_BUSY  Device or resource busy
2247  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
2248  * @see  bt_opp_server_push_requested_cb()
2249  * @see  bt_opp_server_deinitialize()
2250  * @see  bt_opp_server_accept()
2251  * @see  bt_opp_server_reject()
2252  */
2253 int bt_opp_server_initialize(const char *destination, bt_opp_server_push_requested_cb push_requested_cb, void *user_data);
2254
2255 /**
2256  * @ingroup CAPI_NETWORK_BLUETOOTH_OPP_SERVER_MODULE
2257  * @brief Initializes the Bluetooth OPP server requested by bt_opp_server_connection_requested_cb().
2258  * @since_tizen 2.3
2259  * @details No popup appears when an OPP connection is requested from a remote device.
2260  * Instead, @a connection_requested_cb() will be called.
2261  * At that time, you can call either bt_opp_server_accept() or bt_opp_server_reject().
2262  * @remarks This function must be called to start Bluetooth OPP server. \n
2263  * You must free all resources of the Bluetooth service by calling bt_opp_server_deinitialize() if Bluetooth OPP service is no longer needed.
2264  * @param[in] destination  The destination path
2265  * @param[in] connection_requested_cb  The callback called when an OPP connection is requested
2266  * @param[in] user_data The user data to be passed to the callback function
2267  * @return 0 on success, otherwise a negative error value.
2268  * @retval #BT_ERROR_NONE  Successful
2269  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2270  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
2271  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
2272  * @retval #BT_ERROR_RESOURCE_BUSY  Device or resource busy
2273  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
2274  * @see  bt_opp_server_connection_requested_cb()
2275  * @see  bt_opp_server_deinitialize()
2276  * @see  bt_opp_server_accept_connection()
2277  * @see  bt_opp_server_reject_connection()
2278  */
2279 int bt_opp_server_initialize_by_connection_request(const char *destination, bt_opp_server_connection_requested_cb connection_requested_cb, void *user_data);
2280
2281 /**
2282  * @ingroup CAPI_NETWORK_BLUETOOTH_OPP_SERVER_MODULE
2283  * @brief Denitializes the Bluetooth OPP server.
2284  * @since_tizen 2.3
2285  * @return 0 on success, otherwise a negative error value.
2286  * @retval #BT_ERROR_NONE  Successful
2287  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2288  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
2289  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
2290  * @see  bt_opp_server_initialize()
2291  * @see  bt_opp_server_deinitialize()
2292  */
2293 int bt_opp_server_deinitialize(void);
2294
2295 /**
2296  * @ingroup CAPI_NETWORK_BLUETOOTH_OPP_SERVER_MODULE
2297  * @brief Accepts the push request from the remote device.
2298  * @since_tizen 2.3
2299  * @privlevel public
2300  * @privilege %http://tizen.org/privilege/bluetooth
2301  * @remarks If you initialize OPP server by bt_opp_server_initialize_by_connection_request(), then name is ignored.
2302  * You can cancel the pushes by bt_opp_server_cancel_transfer() with transfer_id.
2303  * @param[in] progress_cb  The callback called when a file is being transfered
2304  * @param[in] finished_cb  The callback called when a transfer is finished
2305  * @param[in] name  The name to store. This can be NULL if you initialize OPP server by bt_opp_server_initialize_by_connection_request().
2306  * @param[in] user_data The user data to be passed to the callback function
2307  * @param[out]  transfer_id  The ID of transfer
2308  * @return 0 on success, otherwise a negative error value.
2309  * @retval #BT_ERROR_NONE  Successful
2310  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
2311  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2312  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
2313  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
2314  * @retval #BT_ERROR_NOW_IN_PROGRESS  Operation now in progress
2315  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
2316  * @see  bt_opp_server_reject()
2317  */
2318 int bt_opp_server_accept(bt_opp_server_transfer_progress_cb progress_cb, bt_opp_server_transfer_finished_cb finished_cb, const char *name,
2319  void *user_data, int *transfer_id);
2320
2321 /**
2322  * @ingroup CAPI_NETWORK_BLUETOOTH_OPP_SERVER_MODULE
2323  * @brief Rejects the push request from the remote device.
2324  * @since_tizen 2.3
2325  * @privlevel public
2326  * @privilege %http://tizen.org/privilege/bluetooth
2327  * @return 0 on success, otherwise a negative error value.
2328  * @retval #BT_ERROR_NONE  Successful
2329  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2330  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
2331  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
2332  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
2333  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
2334  * @see  bt_opp_server_accept()
2335  */
2336 int bt_opp_server_reject(void);
2337
2338 /**
2339  * @ingroup CAPI_NETWORK_BLUETOOTH_OPP_SERVER_MODULE
2340  * @brief Cancels the transfer.
2341  * @since_tizen 2.3
2342  * @privlevel public
2343  * @privilege %http://tizen.org/privilege/bluetooth
2344  * @param[in] transfer_id  The ID of transfer
2345  * @return 0 on success, otherwise a negative error value.
2346  * @retval #BT_ERROR_NONE  Successful
2347  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2348  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
2349  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
2350  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
2351  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
2352  * @see  bt_opp_server_accept_connection()
2353  * @see  bt_opp_server_accept()
2354  */
2355 int bt_opp_server_cancel_transfer(int transfer_id);
2356
2357 /**
2358  * @ingroup CAPI_NETWORK_BLUETOOTH_OPP_SERVER_MODULE
2359  * @brief Sets the destination path of file to be pushed.
2360  * @since_tizen 2.3
2361  * @privlevel public
2362  * @privilege %http://tizen.org/privilege/bluetooth
2363  * @param[in] destination  The destination path of file to be pushed
2364  * @return 0 on success, otherwise a negative error value.
2365  * @retval #BT_ERROR_NONE  Successful
2366  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2367  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
2368  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
2369  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
2370  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
2371  * @see  bt_opp_server_initialize()
2372  */
2373 int bt_opp_server_set_destination(const char *destination);
2374
2375 /**
2376  * @ingroup CAPI_NETWORK_BLUETOOTH_OPP_CLIENT_MODULE
2377  * @brief Initializes the Bluetooth OPP client.
2378  * @since_tizen 2.3
2379  * @remarks This function must be called before Bluetooth OPP client starts. \n
2380  * You must free all resources of the Bluetooth service by calling bt_opp_client_deinitialize()
2381  * if Bluetooth OPP service is no longer needed.
2382  * @return 0 on success, otherwise a negative error value.
2383  * @retval #BT_ERROR_NONE  Successful
2384  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2385  * @retval #BT_ERROR_RESOURCE_BUSY  Device or resource busy
2386  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
2387  * @see  bt_opp_client_deinitialize()
2388  */
2389 int bt_opp_client_initialize(void);
2390
2391 /**
2392  * @ingroup CAPI_NETWORK_BLUETOOTH_OPP_CLIENT_MODULE
2393  * @brief Denitializes the Bluetooth OPP client.
2394  * @since_tizen 2.3
2395  * @return 0 on success, otherwise a negative error value.
2396  * @retval #BT_ERROR_NONE  Successful
2397  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2398  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
2399  * @see  bt_opp_client_initialize()
2400  */
2401 int bt_opp_client_deinitialize(void);
2402
2403 /**
2404  * @ingroup CAPI_NETWORK_BLUETOOTH_OPP_CLIENT_MODULE
2405  * @brief Adds file to be pushed.
2406  * @since_tizen 2.3
2407  * @param[in] file  The path of file to be pushed
2408  * @return 0 on success, otherwise a negative error value.
2409  * @retval #BT_ERROR_NONE  Successful
2410  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2411  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
2412  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
2413  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
2414  * @see  bt_opp_client_clear_files()
2415  * @see  bt_opp_client_push_files()
2416  */
2417 int bt_opp_client_add_file(const char *file);
2418
2419 /**
2420  * @ingroup CAPI_NETWORK_BLUETOOTH_OPP_CLIENT_MODULE
2421  * @brief Adds file to be pushed.
2422  * @since_tizen 2.3
2423  * @return 0 on success, otherwise a negative error value.
2424  * @retval #BT_ERROR_NONE  Successful
2425  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2426  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
2427  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
2428  * @see  bt_opp_client_add_file()
2429  * @see  bt_opp_client_push_files()
2430  */
2431 int bt_opp_client_clear_files(void);
2432
2433 /**
2434  * @ingroup CAPI_NETWORK_BLUETOOTH_OPP_CLIENT_MODULE
2435  * @brief Pushes the file to the remote device, asynchronously.
2436  * @since_tizen 2.3
2437  * @privlevel public
2438  * @privilege %http://tizen.org/privilege/bluetooth
2439  * @details At first, bt_opp_client_push_responded_cb() will be called when OPP server responds to the push request.
2440  * After connection is established, bt_opp_client_push_progress_cb() will be called repeatedly until a file is tranfered completely.
2441  * If you send several files, then bt_opp_client_push_progress_cb() with another file will be called repeatedly until the file is tranfered completely.
2442  * bt_opp_client_push_finished_cb() will be called when the push request is finished.
2443  * @param[in] remote_address The remote address
2444  * @param[in] responded_cb  The callback called when OPP server responds to the push request
2445  * @param[in] progress_cb  The callback called when each file is being transfered
2446  * @param[in] finished_cb  The callback called when the push request is finished
2447  * @param[in] user_data The user data to be passed to the callback function
2448  * @return 0 on success, otherwise a negative error value.
2449  * @retval #BT_ERROR_NONE  Successful
2450  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2451  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
2452  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
2453  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
2454  * @retval #BT_ERROR_NOW_IN_PROGRESS  Operation now in progress
2455  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
2456  * @see bt_opp_client_initialize()
2457  * @see bt_opp_client_cancel_push
2458  */
2459 int bt_opp_client_push_files(const char *remote_address, bt_opp_client_push_responded_cb responded_cb,
2460  bt_opp_client_push_progress_cb progress_cb, bt_opp_client_push_finished_cb finished_cb, void *user_data);
2461
2462 /**
2463  * @ingroup CAPI_NETWORK_BLUETOOTH_OPP_CLIENT_MODULE
2464  * @brief Cancels the push request in progress, asynchronously.
2465  * @since_tizen 2.3
2466  * @privlevel public
2467  * @privilege %http://tizen.org/privilege/bluetooth
2468  * @return 0 on success, otherwise a negative error value.
2469  * @retval #BT_ERROR_NONE  Successful
2470  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2471  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
2472  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
2473  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
2474  * @pre bt_opp_client_push_files() must be called.
2475  * @post bt_opp_client_push_finished_cb() will be invoked with result #BT_ERROR_CANCELLED,
2476  * which is a parameter of bt_opp_client_push_files().
2477  * @see bt_opp_client_initialize()
2478  * @see bt_opp_client_push_files()
2479  */
2480 int bt_opp_client_cancel_push(void);
2481
2482 /**
2483  * @ingroup CAPI_NETWORK_BLUETOOTH_HID_MODULE
2484  * @brief Initializes the Bluetooth HID(Human Interface Device) Host.
2485  * @since_tizen 2.3
2486  * @remarks This function must be called before Bluetooth HID Host starts. \n
2487  * You must free all resources of the Bluetooth service by calling bt_hid_host_deinitialize()
2488  * if Bluetooth HID Host service is no longer needed.
2489  * @param[in] connection_cb  The callback called when the connection state is changed
2490  * @param[in] user_data The user data to be passed to the callback function
2491  * @return 0 on success, otherwise a negative error value.
2492  * @retval #BT_ERROR_NONE  Successful
2493  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2494  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
2495  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
2496  * @pre The Bluetooth service must be initialized with bt_initialize().
2497  * @see bt_initialize()
2498  * @see  bt_hid_host_deinitialize()
2499  */
2500 int bt_hid_host_initialize(bt_hid_host_connection_state_changed_cb connection_cb, void *user_data);
2501
2502 /**
2503  * @ingroup CAPI_NETWORK_BLUETOOTH_HID_MODULE
2504  * @brief Deinitializes the Bluetooth HID(Human Interface Device) Host.
2505  * @since_tizen 2.3
2506  * @return 0 on success, otherwise a negative error value.
2507  * @retval #BT_ERROR_NONE  Successful
2508  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2509  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
2510  * @pre The Bluetooth HID service must be initialized with bt_hid_host_initialize().
2511  * @see  bt_hid_host_initialize()
2512  */
2513 int bt_hid_host_deinitialize(void);
2514
2515 /**
2516  * @ingroup CAPI_NETWORK_BLUETOOTH_HID_MODULE
2517  * @brief Connects the remote device with the HID(Human Interface Device) service, asynchronously.
2518  * @since_tizen 2.3
2519  * @privlevel public
2520  * @privilege %http://tizen.org/privilege/bluetooth
2521  * @param[in] remote_address  The remote address
2522  * @return 0 on success, otherwise a negative error value.
2523  * @retval #BT_ERROR_NONE  Successful
2524  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2525  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
2526  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
2527  * @retval #BT_ERROR_REMOTE_DEVICE_NOT_BONDED  Remote device is not bonded
2528  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
2529  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
2530  * @pre The local device must be bonded with the remote device by bt_device_create_bond().
2531  * @pre The Bluetooth HID service must be initialized with bt_hid_host_initialize().
2532  * @post bt_hid_host_connection_state_changed_cb() will be invoked.
2533  * @see bt_hid_host_disconnect()
2534  * @see bt_hid_host_connection_state_changed_cb()
2535  */
2536 int bt_hid_host_connect(const char *remote_address);
2537
2538 /**
2539  * @ingroup CAPI_NETWORK_BLUETOOTH_HID_MODULE
2540  * @brief Disconnects the remote device with the HID(Human Interface Device) service, asynchronously.
2541  * @since_tizen 2.3
2542  * @privlevel public
2543  * @privilege %http://tizen.org/privilege/bluetooth
2544  * @param[in] remote_address  The remote address
2545  * @return 0 on success, otherwise a negative error value.
2546  * @retval #BT_ERROR_NONE  Successful
2547  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2548  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
2549  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
2550  * @retval #BT_ERROR_REMOTE_DEVICE_NOT_CONNECTED  Remote device is not connected
2551  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
2552  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
2553  * @pre The remote device must be connected by bt_hid_host_connect().
2554  * @post bt_hid_host_connection_state_changed_cb() will be invoked.
2555  * @see bt_hid_host_connect()
2556  * @see bt_hid_host_connection_state_changed_cb()
2557  */
2558 int bt_hid_host_disconnect(const char *remote_address);
2559
2560 /**
2561  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_MODULE
2562  * @brief Initializes the Bluetooth profiles related with audio.
2563  * @since_tizen 2.3
2564  * @remarks This function must be called before Bluetooth profiles related with audio starts. \n
2565  * You must free all resources of the this service by calling bt_audio_deinitialize()
2566  * if Bluetooth profiles related with audio service is no longer needed.
2567  * @return 0 on success, otherwise a negative error value.
2568  * @retval #BT_ERROR_NONE  Successful
2569  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2570  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
2571  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
2572  * @pre The Bluetooth service must be initialized with bt_initialize().
2573  * @see bt_initialize()
2574  * @see bt_audio_deinitialize()
2575  */
2576 int bt_audio_initialize(void);
2577
2578 /**
2579  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_MODULE
2580  * @brief Deinitializes the Bluetooth profiles related with audio.
2581  * @since_tizen 2.3
2582  * @return 0 on success, otherwise a negative error value.
2583  * @retval #BT_ERROR_NONE  Successful
2584  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2585  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
2586  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
2587  * @pre The Bluetooth audio service must be initialized with bt_audio_initialize().
2588  * @see bt_audio_initialize()
2589  */
2590 int bt_audio_deinitialize(void);
2591
2592 /**
2593  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_MODULE
2594  * @brief Connects the remote device with the given audio profile, asynchronously.
2595  * @since_tizen 2.3
2596  * @privlevel public
2597  * @privilege %http://tizen.org/privilege/bluetooth
2598  * @details If you input type as #BT_AUDIO_PROFILE_TYPE_ALL and connection request succeeds, then bt_audio_connection_state_changed_cb() will be called twice
2599  * when #BT_AUDIO_PROFILE_TYPE_HSP_HFP is connected and #BT_AUDIO_PROFILE_TYPE_A2DP is connected.
2600  * @param[in] remote_address  The remote address
2601  * @param[in] type  The type of audio profile
2602  * @return 0 on success, otherwise a negative error value.
2603  * @retval #BT_ERROR_NONE  Successful
2604  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2605  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
2606  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
2607  * @retval #BT_ERROR_REMOTE_DEVICE_NOT_BONDED  Remote device is not bonded
2608  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
2609  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
2610  * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
2611  * @pre The Bluetooth audio service must be initialized with bt_audio_initialize().
2612  * @pre The local device must be bonded with the remote device by bt_device_create_bond().
2613  * @post bt_audio_connection_state_changed_cb() will be invoked.
2614  * @see bt_audio_disconnect()
2615  * @see bt_audio_connection_state_changed_cb()
2616  */
2617 int bt_audio_connect(const char *remote_address, bt_audio_profile_type_e type);
2618
2619 /**
2620  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_MODULE
2621  * @brief Disconnects the remote device with the given audio profile, asynchronously.
2622  * @since_tizen 2.3
2623  * @privlevel public
2624  * @privilege %http://tizen.org/privilege/bluetooth
2625  * @details If you input type as #BT_AUDIO_PROFILE_TYPE_ALL and disconnection request succeeds, then bt_audio_connection_state_changed_cb() will be called twice
2626  * when #BT_AUDIO_PROFILE_TYPE_HSP_HFP is disconnected and #BT_AUDIO_PROFILE_TYPE_A2DP is disconnected.
2627  * @param[in] remote_address  The remote address
2628  * @param[in] type  The type of audio profile
2629  * @return 0 on success, otherwise a negative error value.
2630  * @retval #BT_ERROR_NONE  Successful
2631  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2632  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
2633  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
2634  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
2635  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
2636  * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
2637  * @pre The remote device must be connected by bt_audio_connect().
2638  * @post bt_audio_connection_state_changed_cb() will be invoked.
2639  * @see bt_audio_connect()
2640  * @see bt_audio_connection_state_changed_cb()
2641  */
2642 int bt_audio_disconnect(const char *remote_address, bt_audio_profile_type_e type);
2643
2644 /**
2645  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_MODULE
2646  * @brief  Registers a callback function that will be invoked when the connection state is changed.
2647  * @since_tizen 2.3
2648  * @param[in] callback The callback function to register
2649  * @param[in] user_data The user data to be passed to the callback function
2650  * @return   0 on success, otherwise a negative error value.
2651  * @retval #BT_ERROR_NONE  Successful
2652  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2653  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
2654  * @pre The Bluetooth audio service must be initialized with bt_audio_initialize().
2655  * @see bt_audio_initialize()
2656  * @see bt_audio_connection_state_changed_cb()
2657  * @see bt_panu_unset_connection_state_changed_cb()
2658  */
2659 int bt_audio_set_connection_state_changed_cb(bt_audio_connection_state_changed_cb callback, void *user_data);
2660
2661 /**
2662  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_MODULE
2663  * @brief  Unregisters a callback function that will be invoked when the connection state is changed.
2664  * @since_tizen 2.3
2665  * @return   0 on success, otherwise a negative error value.
2666  * @retval #BT_ERROR_NONE  Successful
2667  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2668  * @pre The Bluetooth audio service must be initialized with bt_audio_initialize().
2669  * @see bt_audio_initialize()
2670  * @see bt_audio_connection_state_changed_cb()
2671  * @see bt_audio_set_connection_state_changed_cb()
2672  */
2673 int bt_audio_unset_connection_state_changed_cb(void);
2674
2675 /**
2676  * @internal
2677  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
2678  * @brief Opens a SCO(Synchronous Connection Oriented link) to connected remote device, asynchronously.
2679  * @since_tizen 2.3
2680  * @privlevel platform
2681  * @privilege %http://tizen.org/privilege/bluetooth.admin
2682  * @return 0 on success, otherwise a negative error value.
2683  * @retval #BT_ERROR_NONE  Successful
2684  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2685  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
2686  * @retval #BT_ERROR_REMOTE_DEVICE_NOT_BONDED  Remote device is not bonded
2687  * @retval #BT_ERROR_REMOTE_DEVICE_NOT_CONNECTED  Remote device is not connected
2688  * @retval #BT_ERROR_ALREADY_DONE  Operation is already done
2689  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
2690  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
2691  * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
2692  * @pre The Bluetooth audio device must be connected with bt_audio_connect().
2693  * @post bt_ag_sco_state_changed_cb() will be invoked.
2694  * @see bt_ag_close_sco()
2695  * @see bt_ag_sco_state_changed_cb()
2696  * @see bt_audio_connect()
2697  */
2698 int bt_ag_open_sco(void);
2699
2700 /**
2701  * @internal
2702  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
2703  * @brief Closes an opened SCO(Synchronous Connection Oriented link), asynchronously.
2704  * @since_tizen 2.3
2705  * @privlevel platform
2706  * @privilege %http://tizen.org/privilege/bluetooth.admin
2707  * @return 0 on success, otherwise a negative error value.
2708  * @retval #BT_ERROR_NONE  Successful
2709  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2710  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
2711  * @retval #BT_ERROR_REMOTE_DEVICE_NOT_BONDED  Remote device is not bonded
2712  * @retval #BT_ERROR_REMOTE_DEVICE_NOT_CONNECTED  Remote device is not connected
2713  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
2714  * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
2715  * @pre The SCO must be opened with bt_ag_open_sco().
2716  * @post bt_ag_sco_state_changed_cb() will be invoked.
2717  * @see bt_ag_open_sco()
2718  * @see bt_ag_sco_state_changed_cb()
2719  */
2720 int bt_ag_close_sco(void);
2721
2722 /**
2723  * @internal
2724  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
2725  * @brief Checks whether an opened SCO(Synchronous Connection Oriented link) exists or not.
2726  * @since_tizen 2.3
2727  * @param[out] opened The SCO status: (@c true = opened, @c  false = not opened)
2728  * @return 0 on success, otherwise a negative error value.
2729  * @retval #BT_ERROR_NONE  Successful
2730  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2731  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
2732  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
2733  * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
2734  * @pre The Bluetooth audio service must be initialized with bt_audio_initialize().
2735  * @see bt_ag_open_sco()
2736  * @see bt_ag_close_sco()
2737  */
2738 int bt_ag_is_sco_opened(bool *opened);
2739
2740 /**
2741  * @internal
2742  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
2743  * @brief  Registers a callback function that will be invoked when the SCO(Synchronous Connection Oriented link) state is changed.
2744  * @since_tizen 2.3
2745  * @param[in] callback The callback function to register
2746  * @param[in] user_data The user data to be passed to the callback function
2747  * @return   0 on success, otherwise a negative error value.
2748  * @retval #BT_ERROR_NONE  Successful
2749  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2750  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
2751  * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
2752  * @pre The Bluetooth audio service must be initialized with bt_audio_initialize().
2753  * @see bt_audio_initialize()
2754  * @see bt_ag_sco_state_changed_cb()
2755  * @see bt_ag_unset_sco_state_changed_cb()
2756  */
2757 int bt_ag_set_sco_state_changed_cb(bt_ag_sco_state_changed_cb callback, void *user_data);
2758
2759 /**
2760  * @internal
2761  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
2762  * @brief  Unregisters a callback function that will be invoked when the SCO(Synchronous Connection Oriented link) state is changed.
2763  * @since_tizen 2.3
2764  * @return   0 on success, otherwise a negative error value.
2765  * @retval #BT_ERROR_NONE  Successful
2766  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2767  * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
2768  * @pre The Bluetooth audio service must be initialized with bt_audio_initialize().
2769  * @see bt_audio_initialize()
2770  * @see bt_ag_sco_state_changed_cb()
2771  * @see bt_ag_set_sco_state_changed_cb()
2772  */
2773 int bt_ag_unset_sco_state_changed_cb(void);
2774
2775 /**
2776  * @internal
2777  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
2778  * @brief Notifies the call event to the remote bluetooth device.
2779  * @since_tizen 2.3
2780  * @privlevel platform
2781  * @privilege %http://tizen.org/privilege/bluetooth.admin
2782  * @remarks Before notifying #BT_AG_CALL_EVENT_ANSWERED or #BT_AG_CALL_EVENT_DIALING, you should open SCO(Synchronous Connection Oriented link)
2783  * if Bluetooth Hands-Free need SCO connection.
2784  * @param[in] event  The call event
2785  * @param[in] call_id  The call ID
2786  * @param[in] phone_number  The phone number. You must set this value in case of #BT_AG_CALL_EVENT_DIALING and #BT_AG_CALL_EVENT_INCOMING.
2787  * In other cases, this value can be NULL.
2788  * @return 0 on success, otherwise a negative error value.
2789  * @retval #BT_ERROR_NONE  Successful
2790  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2791  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
2792  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
2793  * @retval #BT_ERROR_REMOTE_DEVICE_NOT_BONDED  Remote device is not bonded
2794  * @retval #BT_ERROR_REMOTE_DEVICE_NOT_CONNECTED  Remote device is not connected
2795  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
2796  * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
2797  * @pre The Bluetooth audio device must be connected with bt_audio_connect().
2798  * @see bt_audio_connect()
2799  */
2800 int bt_ag_notify_call_event(bt_ag_call_event_e event, unsigned int call_id, const char *phone_number);
2801
2802 /**
2803  * @internal
2804  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
2805  * @brief Notifies the call list to the remote bluetooth device.
2806  * @since_tizen 2.3
2807  * @privlevel platform
2808  * @privilege %http://tizen.org/privilege/bluetooth.admin
2809  * @param[in] list  The call list
2810  * @return 0 on success, otherwise a negative error value.
2811  * @retval #BT_ERROR_NONE  Successful
2812  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2813  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
2814  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
2815  * @retval #BT_ERROR_REMOTE_DEVICE_NOT_BONDED  Remote device is not bonded
2816  * @retval #BT_ERROR_REMOTE_DEVICE_NOT_CONNECTED  Remote device is not connected
2817  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
2818  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
2819  * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
2820  * @pre The Bluetooth audio device must be connected with bt_audio_connect().
2821  * @see bt_audio_connect()
2822  */
2823 int bt_ag_notify_call_list(bt_call_list_h list);
2824
2825 /**
2826  * @internal
2827  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
2828  * @brief Notifies the state of voice recognition.
2829  * @since_tizen 2.3
2830  * @privlevel platform
2831  * @privilege %http://tizen.org/privilege/bluetooth.admin
2832  * @param[in] state  The state of voice recognition: (@c true = enabled, @c  false = disabled)
2833  * @return 0 on success, otherwise a negative error value.
2834  * @retval #BT_ERROR_NONE  Successful
2835  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2836  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
2837  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
2838  * @retval #BT_ERROR_REMOTE_DEVICE_NOT_BONDED  Remote device is not bonded
2839  * @retval #BT_ERROR_REMOTE_DEVICE_NOT_CONNECTED  Remote device is not connected
2840  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
2841  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
2842  * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
2843  * @pre The Bluetooth audio device must be connected with bt_audio_connect().
2844  * @see bt_audio_connect()
2845  */
2846 int bt_ag_notify_voice_recognition_state(bool state);
2847
2848 /**
2849  * @internal
2850  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
2851  * @brief  Registers a callback function that will be invoked when a call handling event happened from Hands-Free.
2852  * @since_tizen 2.3
2853  * @param[in] callback The callback function to register
2854  * @param[in] user_data The user data to be passed to the callback function
2855  * @return   0 on success, otherwise a negative error value.
2856  * @retval #BT_ERROR_NONE  Successful
2857  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2858  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
2859  * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
2860  * @pre The Bluetooth audio service must be initialized with bt_audio_initialize().
2861  * @see bt_audio_initialize()
2862  * @see bt_ag_call_handling_event_cb()
2863  * @see bt_ag_unset_call_handling_event_cb()
2864  */
2865 int bt_ag_set_call_handling_event_cb(bt_ag_call_handling_event_cb callback, void *user_data);
2866
2867 /**
2868  * @internal
2869  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
2870  * @brief  Unregisters a callback function that will be invoked when a call handling event happened from Hands-Free.
2871  * @since_tizen 2.3
2872  * @return   0 on success, otherwise a negative error value.
2873  * @retval #BT_ERROR_NONE  Successful
2874  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2875  * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
2876  * @pre The Bluetooth audio service must be initialized with bt_audio_initialize().
2877  * @see bt_audio_initialize()
2878  * @see bt_ag_call_handling_event_cb()
2879  * @see bt_ag_set_call_handling_event_cb()
2880  */
2881 int bt_ag_unset_call_handling_event_cb(void);
2882
2883 /**
2884  * @internal
2885  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
2886  * @brief  Registers a callback function that will be invoked when a multi call handling event happened from Hands-Free.
2887  * @since_tizen 2.3
2888  * @param[in] callback The callback function to register
2889  * @param[in] user_data The user data to be passed to the callback function
2890  * @return   0 on success, otherwise a negative error value.
2891  * @retval #BT_ERROR_NONE  Successful
2892  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2893  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
2894  * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
2895  * @pre The Bluetooth audio service must be initialized with bt_audio_initialize().
2896  * @see bt_audio_initialize()
2897  * @see bt_ag_multi_call_handling_event_cb()
2898  * @see bt_ag_unset_multi_call_handling_event_cb()
2899  */
2900 int bt_ag_set_multi_call_handling_event_cb(bt_ag_multi_call_handling_event_cb callback, void *user_data);
2901
2902 /**
2903  * @internal
2904  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
2905  * @brief  Unregisters a callback function that will be invoked when a multi call handling event happened from Hands-Free.
2906  * @since_tizen 2.3
2907  * @return   0 on success, otherwise a negative error value.
2908  * @retval #BT_ERROR_NONE  Successful
2909  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2910  * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
2911  * @pre The Bluetooth audio service must be initialized with bt_audio_initialize().
2912  * @see bt_audio_initialize()
2913  * @see bt_ag_multi_call_handling_event_cb()
2914  * @see bt_ag_set_multi_call_handling_event_cb()
2915  */
2916 int bt_ag_unset_multi_call_handling_event_cb(void);
2917
2918 /**
2919  * @internal
2920  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
2921  * @brief  Registers a callback function that will be invoked when a DTMF(Dual Tone Multi Frequency) is transmitted from Hands-Free.
2922  * @since_tizen 2.3
2923  * @param[in] callback The callback function to register
2924  * @param[in] user_data The user data to be passed to the callback function
2925  * @return   0 on success, otherwise a negative error value.
2926  * @retval #BT_ERROR_NONE  Successful
2927  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2928  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
2929  * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
2930  * @pre The Bluetooth audio service must be initialized with bt_audio_initialize().
2931  * @see bt_audio_initialize()
2932  * @see bt_ag_dtmf_transmitted_cb()
2933  * @see bt_ag_unset_dtmf_transmitted_cb()
2934  */
2935 int bt_ag_set_dtmf_transmitted_cb(bt_ag_dtmf_transmitted_cb callback, void *user_data);
2936
2937 /**
2938  * @internal
2939  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
2940  * @brief  Unregisters a callback function that will be invoked when a DTMF(Dual Tone Multi Frequency) is transmitted from Hands-Free.
2941  * @since_tizen 2.3
2942  * @return   0 on success, otherwise a negative error value.
2943  * @retval #BT_ERROR_NONE  Successful
2944  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2945  * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
2946  * @pre The Bluetooth audio service must be initialized with bt_audio_initialize().
2947  * @see bt_audio_initialize()
2948  * @see bt_ag_dtmf_transmitted_cb()
2949  * @see bt_ag_set_dtmf_transmitted_cb()
2950  */
2951 int bt_ag_unset_dtmf_transmitted_cb(void);
2952
2953 /**
2954  * @internal
2955  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
2956  * @brief  Notifies the speaker gain to the remote device.
2957  * @since_tizen 2.3
2958  * @privlevel platform
2959  * @privilege %http://tizen.org/privilege/bluetooth.admin
2960  * @details This function sends a signal to the remote device. This signal has the gain value.
2961  * @a gain is represented on a scale from 0 to 15. This value is absolute value relating to a particular volume level.
2962  * When the speaker gain of remote device is changed to the requested gain, bt_audio_speaker_gain_changed_cb() will be called.
2963  * @param[in] gain The gain of speaker (0 ~ 15)
2964  * @return   0 on success, otherwise a negative error value.
2965  * @retval #BT_ERROR_NONE  Successful
2966  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2967  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
2968  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
2969  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
2970  * @retval #BT_ERROR_REMOTE_DEVICE_NOT_CONNECTED  Remote device is not connected
2971  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
2972  * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
2973  * @pre The remote device is connected by bt_audio_connect() with #BT_AUDIO_PROFILE_TYPE_HSP_HFP service.
2974  * @see bt_ag_get_speaker_gain()
2975  * @see bt_ag_set_speaker_gain_changed_cb()
2976  * @see bt_ag_unset_speaker_gain_changed_cb()
2977  */
2978 int bt_ag_notify_speaker_gain(int gain);
2979
2980 /**
2981  * @internal
2982  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
2983  * @brief  Gets the current speaker gain of the remote device.
2984  * @since_tizen 2.3
2985  * @details This function gets the value of speaker gain of the remote device.
2986  * @a gain is represented on a scale from 0 to 15. This value is absolute value relating to a particular volume level.
2987  * @param[out] gain The gain of speaker (0 ~ 15)
2988  * @return   0 on success, otherwise a negative error value.
2989  * @retval #BT_ERROR_NONE  Successful
2990  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2991  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
2992  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
2993  * @retval #BT_ERROR_REMOTE_DEVICE_NOT_CONNECTED  Remote device is not connected
2994  * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
2995  * @pre The remote device is connected by bt_audio_connect() with #BT_AUDIO_PROFILE_TYPE_HSP_HFP service.
2996  * @see bt_ag_notify_speaker_gain()
2997  * @see bt_ag_set_speaker_gain_changed_cb()
2998  * @see bt_ag_unset_speaker_gain_changed_cb()
2999  */
3000 int bt_ag_get_speaker_gain(int *gain);
3001
3002 /**
3003  * @internal
3004  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
3005  * @brief Checks whether the remoted device enables NREC(Noise Reduction and Echo Canceling) or not.
3006  * @since_tizen 2.3
3007  * @param[out] enabled The NREC status: (@c true = enabled, @c  false = not enabled)
3008  * @return   0 on success, otherwise a negative error value.
3009  * @retval #BT_ERROR_NONE  Successful
3010  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
3011  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
3012  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
3013  * @retval #BT_ERROR_REMOTE_DEVICE_NOT_CONNECTED  Remote device is not connected
3014  * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
3015  * @pre The remote device is connected by bt_audio_connect() with #BT_AUDIO_PROFILE_TYPE_HSP_HFP service.
3016  * @see bt_audio_connect()
3017  */
3018 int bt_ag_is_nrec_enabled(bool *enabled);
3019
3020 /**
3021  * @internal
3022  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
3023  * @brief  Registers a callback function that will be invoked when the speaker gain of the remote device is changed.
3024  * @since_tizen 2.3
3025  * @details This function let you know the change of the speaker gain of the remote device.
3026  * @a gain is represented on a scale from 0 to 15. This value is absolute value relating to a particular volume level.
3027  * @param[in] callback The callback function to register
3028  * @param[in] user_data The user data to be passed to the callback function
3029  * @return   0 on success, otherwise a negative error value.
3030  * @retval #BT_ERROR_NONE  Successful
3031  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
3032  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
3033  * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
3034  * @pre The Bluetooth audio service must be initialized with bt_audio_initialize().
3035  * @see bt_audio_initialize()
3036  * @see bt_ag_unset_speaker_gain_changed_cb()
3037  */
3038 int bt_ag_set_speaker_gain_changed_cb(bt_ag_speaker_gain_changed_cb callback, void *user_data);
3039
3040 /**
3041  * @internal
3042  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
3043  * @brief  Unregisters a callback function that will be invoked when the speaker gain of the remote device is changed.
3044  * @since_tizen 2.3
3045  * @return   0 on success, otherwise a negative error value.
3046  * @retval #BT_ERROR_NONE  Successful
3047  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
3048  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
3049  * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
3050  * @pre The Bluetooth audio service must be initialized with bt_audio_initialize().
3051  * @see bt_audio_initialize()
3052  * @see bt_ag_set_speaker_gain_changed_cb()
3053  */
3054 int bt_ag_unset_speaker_gain_changed_cb(void);
3055
3056 /**
3057  * @internal
3058  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
3059  * @brief  Registers a callback function that will be invoked when the microphone gain of the remote device is changed.
3060  * @since_tizen 2.3
3061  * @param[in] callback The callback function to register
3062  * @param[in] user_data The user data to be passed to the callback function
3063  * @return   0 on success, otherwise a negative error value.
3064  * @retval #BT_ERROR_NONE  Successful
3065  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
3066  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
3067  * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
3068  * @pre The Bluetooth audio service must be initialized with bt_audio_initialize().
3069  * @see bt_audio_initialize()
3070  * @see bt_ag_unset_microphone_gain_changed_cb()
3071  */
3072 int bt_ag_set_microphone_gain_changed_cb(bt_ag_microphone_gain_changed_cb callback, void *user_data);
3073
3074 /**
3075  * @internal
3076  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
3077  * @brief  Unregisters a callback function that will be invoked when the microphone gain of the remote device is changed.
3078  * @since_tizen 2.3
3079  * @return   0 on success, otherwise a negative error value.
3080  * @retval #BT_ERROR_NONE  Successful
3081  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
3082  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
3083  * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
3084  * @pre The Bluetooth audio service must be initialized with bt_audio_initialize().
3085  * @see bt_audio_initialize()
3086  * @see bt_ag_set_microphone_gain_changed_cb()
3087  */
3088 int bt_ag_unset_microphone_gain_changed_cb(void);
3089
3090 /**
3091  * @internal
3092  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_CALL_MODULE
3093  * @brief Creates a handle of call list.
3094  * @since_tizen 2.3
3095  * @param[out] list  The handle of call list
3096  * @return 0 on success, otherwise a negative error value.
3097  * @retval #BT_ERROR_NONE  Successful
3098  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
3099  * @retval #BT_ERROR_OUT_OF_MEMORY  Out of memory
3100  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
3101  * @see bt_call_list_destroy()
3102  */
3103 int bt_call_list_create(bt_call_list_h *list);
3104
3105 /**
3106  * @internal
3107  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_CALL_MODULE
3108  * @brief Destroys the handle of call list.
3109  * @since_tizen 2.3
3110  * @param[in] list  The handle of call list
3111  * @return 0 on success, otherwise a negative error value.
3112  * @retval #BT_ERROR_NONE  Successful
3113  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
3114  * @see bt_call_list_create()
3115  */
3116 int bt_call_list_destroy(bt_call_list_h list);
3117
3118 /**
3119  * @internal
3120  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_CALL_MODULE
3121  * @brief Resets the handle of call list.
3122  * @since_tizen 2.3
3123  * @param[in] list  The handle of call list
3124  * @return 0 on success, otherwise a negative error value.
3125  * @retval #BT_ERROR_NONE  Successful
3126  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
3127  * @see bt_call_list_create()
3128  */
3129 int bt_call_list_reset(bt_call_list_h list);
3130
3131 /**
3132  * @internal
3133  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_CALL_MODULE
3134  * @brief Adds a call to the handle of call list.
3135  * @since_tizen 2.3
3136  * @param[in] list  The handle of call list
3137  * @param[in] call_id  The call ID
3138  * @param[in] state  The state of audio gate call
3139  * @param[in] phone_number The phone number. You must set this value in case of #BT_AG_CALL_EVENT_DIALING and      #BT_AG_CALL_EVENT_INCOMING.
3140  * @return 0 on success, otherwise a negative error value.
3141  * @retval #BT_ERROR_NONE  Successful
3142  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
3143  * @retval #BT_ERROR_OUT_OF_MEMORY  Out of memory
3144  * @see bt_call_list_create()
3145  */
3146 int bt_call_list_add(bt_call_list_h list, unsigned int call_id, bt_ag_call_state_e state, const char *phone_number);
3147
3148 /**
3149  * @internal
3150  * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE
3151  * @brief Initializes the Bluetooth AVRCP(Audio/Video Remote Control Profile) service.
3152  * @since_tizen 2.3
3153  * @remarks This function must be called before Bluetooth AVRCP service. \n
3154  * You must free all resources of the this service by calling bt_avrcp_target_deinitialize()
3155  * if Bluetooth AVRCP service is no longer needed.
3156  * @param[in] callback The callback function called when the connection state is changed
3157  * @param[in] user_data The user data to be passed to the callback function
3158  * @return 0 on success, otherwise a negative error value.
3159  * @retval #BT_ERROR_NONE  Successful
3160  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
3161  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
3162  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
3163  * @pre The Bluetooth service must be initialized with bt_initialize().
3164  * @see bt_initialize()
3165  * @see bt_avrcp_target_deinitialize()
3166  */
3167 int bt_avrcp_target_initialize(bt_avrcp_target_connection_state_changed_cb callback, void *user_data);
3168
3169 /**
3170  * @internal
3171  * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE
3172  * @brief Deinitializes the Bluetooth AVRCP(Audio/Video Remote Control Profile) service.
3173  * @since_tizen 2.3
3174  * @return 0 on success, otherwise a negative error value.
3175  * @retval #BT_ERROR_NONE  Successful
3176  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
3177  * @pre The Bluetooth audio service must be initialized with bt_avrcp_target_initialize().
3178  * @see bt_avrcp_target_initialize()
3179  */
3180 int bt_avrcp_target_deinitialize(void);
3181
3182 /**
3183  * @internal
3184  * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE
3185  * @brief  Notifies the equalize state to the remote device.
3186  * @since_tizen 2.3
3187  * @privlevel platform
3188  * @privilege %http://tizen.org/privilege/bluetooth.admin
3189  * @param[in] state The state of equalizer
3190  * @return   0 on success, otherwise a negative error value.
3191  * @retval #BT_ERROR_NONE  Successful
3192  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
3193  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
3194  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
3195  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
3196  * @retval #BT_ERROR_REMOTE_DEVICE_NOT_CONNECTED  Remote device is not connected
3197  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
3198  * @pre The remote device must be connected.
3199  * @see bt_avrcp_target_connection_state_changed_cb()
3200  * @see bt_avrcp_target_initialize()
3201  */
3202 int bt_avrcp_target_notify_equalizer_state(bt_avrcp_equalizer_state_e state);
3203
3204 /**
3205  * @internal
3206  * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE
3207  * @brief  Notifies the repeat mode to the remote device.
3208  * @since_tizen 2.3
3209  * @privlevel platform
3210  * @privilege %http://tizen.org/privilege/bluetooth.admin
3211  * @param[in] mode The repeat mode
3212  * @return   0 on success, otherwise a negative error value.
3213  * @retval #BT_ERROR_NONE  Successful
3214  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
3215  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
3216  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
3217  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
3218  * @retval #BT_ERROR_REMOTE_DEVICE_NOT_CONNECTED  Remote device is not connected
3219  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
3220  * @pre The remote device must be connected.
3221  * @see bt_avrcp_target_connection_state_changed_cb()
3222  * @see bt_avrcp_target_initialize()
3223  */
3224 int bt_avrcp_target_notify_repeat_mode(bt_avrcp_repeat_mode_e mode);
3225
3226 /**
3227  * @internal
3228  * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE
3229  * @brief  Notifies the shuffle mode to the remote device.
3230  * @since_tizen 2.3
3231  * @privlevel platform
3232  * @privilege %http://tizen.org/privilege/bluetooth.admin
3233  * @param[in] mode The repeat mode
3234  * @return   0 on success, otherwise a negative error value.
3235  * @retval #BT_ERROR_NONE  Successful
3236  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
3237  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
3238  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
3239  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
3240  * @retval #BT_ERROR_REMOTE_DEVICE_NOT_CONNECTED  Remote device is not connected
3241  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
3242  * @pre The remote device must be connected.
3243  * @see bt_avrcp_target_connection_state_changed_cb()
3244  * @see bt_avrcp_target_initialize()
3245  */
3246 int bt_avrcp_target_notify_shuffle_mode(bt_avrcp_shuffle_mode_e mode);
3247
3248 /**
3249  * @internal
3250  * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE
3251  * @brief  Notifies the scan mode to the remote device.
3252  * @since_tizen 2.3
3253  * @privlevel platform
3254  * @privilege %http://tizen.org/privilege/bluetooth.admin
3255  * @param[in] mode The scan mode
3256  * @return   0 on success, otherwise a negative error value.
3257  * @retval #BT_ERROR_NONE  Successful
3258  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
3259  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
3260  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
3261  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
3262  * @retval #BT_ERROR_REMOTE_DEVICE_NOT_CONNECTED  Remote device is not connected
3263  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
3264  * @pre The remote device must be connected.
3265  * @see bt_avrcp_target_connection_state_changed_cb()
3266  * @see bt_avrcp_target_initialize()
3267  */
3268 int bt_avrcp_target_notify_scan_mode(bt_avrcp_scan_mode_e mode);
3269
3270 /**
3271  * @internal
3272  * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE
3273  * @brief  Notifies the player state to the remote device.
3274  * @since_tizen 2.3
3275  * @privlevel platform
3276  * @privilege %http://tizen.org/privilege/bluetooth.admin
3277  * @param[in] state The player state
3278  * @return   0 on success, otherwise a negative error value.
3279  * @retval #BT_ERROR_NONE  Successful
3280  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
3281  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
3282  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
3283  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
3284  * @retval #BT_ERROR_REMOTE_DEVICE_NOT_CONNECTED  Remote device is not connected
3285  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
3286  * @pre The remote device must be connected.
3287  * @see bt_avrcp_target_connection_state_changed_cb()
3288  * @see bt_avrcp_target_initialize()
3289  */
3290 int bt_avrcp_target_notify_player_state(bt_avrcp_player_state_e state);
3291
3292 /**
3293  * @internal
3294  * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE
3295  * @brief  Notifies the current position of song to the remote device.
3296  * @since_tizen 2.3
3297  * @privlevel platform
3298  * @privilege %http://tizen.org/privilege/bluetooth.admin
3299  * @param[in] position The current position in milliseconds
3300  * @return  0 on success, otherwise a negative error value.
3301  * @retval #BT_ERROR_NONE  Successful
3302  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
3303  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
3304  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
3305  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
3306  * @retval #BT_ERROR_REMOTE_DEVICE_NOT_CONNECTED  Remote device is not connected
3307  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
3308  * @pre The remote device must be connected.
3309  * @see bt_avrcp_target_connection_state_changed_cb()
3310  * @see bt_avrcp_target_initialize()
3311  */
3312 int bt_avrcp_target_notify_position(unsigned int position);
3313
3314 /**
3315  * @internal
3316  * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE
3317  * @brief  Notifies the track to the remote device.
3318  * @since_tizen 2.3
3319  * @privlevel platform
3320  * @privilege %http://tizen.org/privilege/bluetooth.admin
3321  * @param[in] title The title of track
3322  * @param[in] artist The artist of track
3323  * @param[in] album The album of track
3324  * @param[in] genre The genre of track
3325  * @param[in] track_num The track number
3326  * @param[in] total_tracks The number of all tracks
3327  * @param[in] duration The duration of track in milliseconds
3328  * @return   0 on success, otherwise a negative error value.
3329  * @retval #BT_ERROR_NONE  Successful
3330  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
3331  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
3332  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
3333  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
3334  * @retval #BT_ERROR_REMOTE_DEVICE_NOT_CONNECTED  Remote device is not connected
3335  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
3336  * @pre The remote device must be connected.
3337  * @see bt_avrcp_target_connection_state_changed_cb()
3338  * @see bt_avrcp_target_initialize()
3339  */
3340 int bt_avrcp_target_notify_track(const char *title, const char *artist, const char *album, const char *genre, unsigned int track_num, unsigned int total_tracks, unsigned int duration);
3341
3342 /**
3343  * @internal
3344  * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE
3345  * @brief  Registers a callback function that will be invoked when the equalizer state is changed by the remote control device.
3346  * @since_tizen 2.3
3347  * @param[in] callback The callback function to register
3348  * @param[in] user_data The user data to be passed to the callback function
3349  * @return   0 on success, otherwise a negative error value.
3350  * @retval #BT_ERROR_NONE  Successful
3351  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
3352  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
3353  * @pre The Bluetooth service must be initialized by bt_initialize().
3354  * @see bt_initialize()
3355  * @see bt_avrcp_unset_equalizer_state_changed_cb()
3356  */
3357 int bt_avrcp_set_equalizer_state_changed_cb(bt_avrcp_equalizer_state_changed_cb callback, void *user_data);
3358
3359 /**
3360  * @internal
3361  * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE
3362  * @brief  Unregisters a callback function that will be invoked when the equalizer state is changed by the remote control device.
3363  * @since_tizen 2.3
3364  * @return   0 on success, otherwise a negative error value.
3365  * @retval #BT_ERROR_NONE  Successful
3366  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
3367  * @pre The Bluetooth service must be initialized by bt_initialize().
3368  * @see bt_initialize()
3369  * @see bt_avrcp_set_equalizer_state_changed_cb()
3370  */
3371 int bt_avrcp_unset_equalizer_state_changed_cb(void);
3372
3373 /**
3374  * @internal
3375  * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE
3376  * @brief  Registers a callback function that will be invoked when the repeat mode is changed by the remote control device.
3377  * @since_tizen 2.3
3378  * @param[in] callback The callback function to register
3379  * @param[in] user_data The user data to be passed to the callback function
3380  * @return   0 on success, otherwise a negative error value.
3381  * @retval #BT_ERROR_NONE  Successful
3382  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
3383  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
3384  * @pre The Bluetooth service must be initialized by bt_initialize().
3385  * @see bt_initialize()
3386  * @see bt_avrcp_unset_repeat_mode_changed_cb()
3387  */
3388 int bt_avrcp_set_repeat_mode_changed_cb(bt_avrcp_repeat_mode_changed_cb callback, void *user_data);
3389
3390 /**
3391  * @internal
3392  * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE
3393  * @brief  Unregisters a callback function that will be invoked when the repeat mode is changed by the remote control device.
3394  * @since_tizen 2.3
3395  * @return   0 on success, otherwise a negative error value.
3396  * @retval #BT_ERROR_NONE  Successful
3397  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
3398  * @pre The Bluetooth service must be initialized by bt_initialize().
3399  * @see bt_initialize()
3400  * @see bt_avrcp_set_repeat_mode_changed_cb()
3401  */
3402 int bt_avrcp_unset_repeat_mode_changed_cb(void);
3403
3404 /**
3405  * @internal
3406  * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE
3407  * @brief  Registers a callback function that will be invoked when the shuffle mode is changed by the remote control device.
3408  * @since_tizen 2.3
3409  * @param[in] callback The callback function to register
3410  * @param[in] user_data The user data to be passed to the callback function
3411  * @return   0 on success, otherwise a negative error value.
3412  * @retval #BT_ERROR_NONE  Successful
3413  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
3414  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
3415  * @pre The Bluetooth service must be initialized by bt_initialize().
3416  * @see bt_initialize()
3417  * @see bt_avrcp_unset_shuffle_mode_changed_cb()
3418  */
3419 int bt_avrcp_set_shuffle_mode_changed_cb(bt_avrcp_shuffle_mode_changed_cb callback, void *user_data);
3420
3421 /**
3422  * @internal
3423  * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE
3424  * @brief  Unregisters a callback function that will be invoked when the shuffle mode is changed by the remote control device.
3425  * @since_tizen 2.3
3426  * @return   0 on success, otherwise a negative error value.
3427  * @retval #BT_ERROR_NONE  Successful
3428  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
3429  * @pre The Bluetooth service must be initialized by bt_initialize().
3430  * @see bt_initialize()
3431  * @see bt_avrcp_set_shuffle_mode_changed_cb()
3432  */
3433 int bt_avrcp_unset_shuffle_mode_changed_cb(void);
3434
3435 /**
3436  * @internal
3437  * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE
3438  * @brief  Registers a callback function that will be invoked when the scan mode is changed by the remote control device.
3439  * @since_tizen 2.3
3440  * @param[in] callback The callback function to register
3441  * @param[in] user_data The user data to be passed to the callback function
3442  * @return   0 on success, otherwise a negative error value.
3443  * @retval #BT_ERROR_NONE  Successful
3444  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
3445  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
3446  * @pre The Bluetooth service must be initialized by bt_initialize().
3447  * @see bt_initialize()
3448  * @see bt_avrcp_unset_scan_mode_changed_cb()
3449  */
3450 int bt_avrcp_set_scan_mode_changed_cb(bt_avrcp_scan_mode_changed_cb callback, void *user_data);
3451
3452 /**
3453  * @internal
3454  * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE
3455  * @brief  Unregisters a callback function that will be invoked when the scan mode is changed by the remote control device.
3456  * @since_tizen 2.3
3457  * @return   0 on success, otherwise a negative error value.
3458  * @retval #BT_ERROR_NONE  Successful
3459  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
3460  * @pre The Bluetooth service must be initialized by bt_initialize().
3461  * @see bt_initialize()
3462  * @see bt_avrcp_set_scan_mode_changed_cb()
3463  */
3464 int bt_avrcp_unset_scan_mode_changed_cb(void);
3465
3466 /**
3467  * @ingroup CAPI_NETWORK_BLUETOOTH_HDP_MODULE
3468  * @brief Registers an application that acts as the @a Sink role of HDP(Health Device Profile).
3469  * @since_tizen 2.3
3470  * @privlevel public
3471  * @privilege %http://tizen.org/privilege/bluetooth
3472  * @remarks The @a app_id must be released with free() by you.
3473  * @param[in] data_type  The data type of MDEP. This value is defined in ISO/IEEE 11073-20601 spec.
3474  * For example, pulse oximeter is 0x1004 and blood pressure monitor is 0x1007.
3475  * @param[out] app_id  The ID of application
3476  * @return 0 on success, otherwise a negative error value.
3477  * @retval #BT_ERROR_NONE  Successful
3478  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
3479  * @retval #BT_ERROR_OUT_OF_MEMORY  Out of memory
3480  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
3481  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
3482  * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
3483  * @see bt_hdp_deactivate_sink()
3484  */
3485 int bt_hdp_register_sink_app(unsigned short data_type, char **app_id);
3486
3487 /**
3488  * @ingroup CAPI_NETWORK_BLUETOOTH_HDP_MODULE
3489  * @brief Unregisters the given application that acts as the @a Sink role of HDP(Health Device Profile).
3490  * @since_tizen 2.3
3491  * @privlevel public
3492  * @privilege %http://tizen.org/privilege/bluetooth
3493  * @param[in] app_id  The ID of application
3494  * @return 0 on success, otherwise a negative error value.
3495  * @retval #BT_ERROR_NONE  Successful
3496  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
3497  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
3498  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
3499  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
3500  * @see bt_hdp_register_sink_app()
3501  */
3502 int bt_hdp_unregister_sink_app(const char *app_id);
3503
3504 /**
3505  * @ingroup CAPI_NETWORK_BLUETOOTH_HDP_MODULE
3506  * @brief Connects the remote device which acts as @a Source role, asynchronously.
3507  * @since_tizen 2.3
3508  * @privlevel public
3509  * @privilege %http://tizen.org/privilege/bluetooth
3510  * @param[in] remote_address  The remote address
3511  * @param[in] app_id  The ID of application
3512  * @return 0 on success, otherwise a negative error value.
3513  * @retval #BT_ERROR_NONE  Successful
3514  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
3515  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
3516  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
3517  * @retval #BT_ERROR_REMOTE_DEVICE_NOT_BONDED  Remote device is not bonded
3518  * @retval #BT_ERROR_OUT_OF_MEMORY  Out of memory
3519  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
3520  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
3521  * @pre The Sink role of HDP must be registered with bt_hdp_register_sink_app().
3522  * @pre The local device must be bonded with the remote device by bt_device_create_bond().
3523  * @post bt_hdp_connected_cb() will be invoked.
3524  * @see bt_hdp_disconnect()
3525  * @see bt_hdp_set_connection_state_changed_cb()
3526  * @see bt_hdp_unset_connection_state_changed_cb()
3527  */
3528 int bt_hdp_connect_to_source(const char *remote_address, const char *app_id);
3529
3530 /**
3531  * @ingroup CAPI_NETWORK_BLUETOOTH_HDP_MODULE
3532  * @brief Disconnects the remote device, asynchronously.
3533  * @since_tizen 2.3
3534  * @privlevel public
3535  * @privilege %http://tizen.org/privilege/bluetooth
3536  * @param[in] remote_address  The remote address
3537  * @param[in] channel  The connected data channel
3538  * @return 0 on success, otherwise a negative error value.
3539  * @retval #BT_ERROR_NONE  Successful
3540  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
3541  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
3542  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
3543  * @retval #BT_ERROR_REMOTE_DEVICE_NOT_CONNECTED  Remote device is not connected
3544  * @retval #BT_ERROR_OUT_OF_MEMORY  Out of memory
3545  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
3546  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
3547  * @pre The remote device must be connected.
3548  * @post bt_hdp_disconnected_cb() will be invoked.
3549  * @see bt_hdp_set_connection_state_changed_cb()
3550  * @see bt_hdp_unset_connection_state_changed_cb()
3551  */
3552 int bt_hdp_disconnect(const char *remote_address, unsigned int channel);
3553
3554 /**
3555  * @ingroup CAPI_NETWORK_BLUETOOTH_HDP_MODULE
3556  * @brief Sends the data to the remote device.
3557  * @since_tizen 2.3
3558  * @privlevel public
3559  * @privilege %http://tizen.org/privilege/bluetooth
3560  * @param[in] channel  The connected data channel
3561  * @param[in] data  The data to send
3562  * @param[in] size  The size of data to send (byte)
3563  * @return 0 on success, otherwise a negative error value.
3564  * @retval #BT_ERROR_NONE  Successful
3565  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
3566  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
3567  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
3568  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
3569  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
3570  * @pre The remote device must be connected.
3571  * @see bt_hdp_data_received_cb()
3572  * @see bt_hdp_set_data_received_cb()
3573  * @see bt_hdp_unset_data_received_cb()
3574  */
3575 int bt_hdp_send_data(unsigned int channel, const char *data, unsigned int size);
3576
3577 /**
3578  * @ingroup CAPI_NETWORK_BLUETOOTH_HDP_MODULE
3579  * @brief  Registers a callback function that will be invoked when the connection state is changed.
3580  * @since_tizen 2.3
3581  * @param[in] connected_cb The callback function called when a connection is established
3582  * @param[in] disconnected_cb The callback function called when a connection is disconnected
3583  * @param[in] user_data The user data to be passed to the callback function
3584  * @return   0 on success, otherwise a negative error value.
3585  * @retval #BT_ERROR_NONE  Successful
3586  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
3587  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
3588  * @pre The Bluetooth service must be initialized with bt_initialize().
3589  * @see bt_hdp_unset_connection_state_changed_cb()
3590  */
3591 int bt_hdp_set_connection_state_changed_cb(bt_hdp_connected_cb connected_cb, bt_hdp_disconnected_cb disconnected_cb, void *user_data);
3592
3593 /**
3594  * @ingroup CAPI_NETWORK_BLUETOOTH_HDP_MODULE
3595  * @brief  Unregisters a callback function that will be invoked when the connection state is changed.
3596  * @since_tizen 2.3
3597  * @return   0 on success, otherwise a negative error value.
3598  * @retval #BT_ERROR_NONE  Successful
3599  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
3600  * @pre The Bluetooth service must be initialized with bt_initialize().
3601  * @see bt_hdp_set_connection_state_changed_cb()
3602  */
3603 int bt_hdp_unset_connection_state_changed_cb(void);
3604
3605 /**
3606  * @ingroup CAPI_NETWORK_BLUETOOTH_HDP_MODULE
3607  * @brief  Registers a callback function that will be invoked when you receive the data.
3608  * @since_tizen 2.3
3609  * @param[in] callback The callback function to register
3610  * @param[in] user_data The user data to be passed to the callback function
3611  * @return   0 on success, otherwise a negative error value.
3612  * @retval #BT_ERROR_NONE  Successful
3613  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
3614  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
3615  * @pre The Bluetooth service must be initialized with bt_initialize().
3616  * @see bt_hdp_unset_data_received_cb()
3617  */
3618 int bt_hdp_set_data_received_cb(bt_hdp_data_received_cb callback, void *user_data);
3619
3620 /**
3621  * @ingroup CAPI_NETWORK_BLUETOOTH_HDP_MODULE
3622  * @brief  Unregisters a callback function that will be invoked when you receive the data.
3623  * @since_tizen 2.3
3624  * @return   0 on success, otherwise a negative error value.
3625  * @retval #BT_ERROR_NONE  Successful
3626  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
3627  * @pre The Bluetooth service must be initialized with bt_initialize().
3628  * @see bt_hdp_set_data_received_cb()
3629  */
3630 int bt_hdp_unset_data_received_cb(void);
3631
3632 /**
3633  * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
3634  * @brief  Gets the primary services of GATT(Generic Attribute Profile).
3635  * @since_tizen 2.3
3636  * @privlevel public
3637  * @privilege %http://tizen.org/privilege/bluetooth
3638  * @param[in]  remote_address  The address of the remote device
3639  * @param[in]  callback  The callback function to invoke
3640  * @param[in]  user_data  The user data to be passed to the callback function
3641  * @return  0 on success, otherwise a negative error value.
3642  * @retval  #BT_ERROR_NONE  Successful
3643  * @retval  #BT_ERROR_INVALID_PARAMETER  Invalid parameter
3644  * @retval  #BT_ERROR_NOT_INITIALIZED  Not initialized
3645  * @retval  #BT_ERROR_NOT_ENABLED  Not enabled
3646  * @retval  #BT_ERROR_OPERATION_FAILED  Operation failed
3647  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
3648  * @pre  The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
3649  * @post  @a callback will be called if there are primary services.
3650  * @see  bt_gatt_primary_service_cb()
3651  */
3652 int bt_gatt_foreach_primary_services(const char *remote_address, bt_gatt_primary_service_cb callback, void *user_data);
3653
3654 /**
3655  * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
3656  * @brief  Discovers the characteristics in service, asynchronously.
3657  * @since_tizen 2.3
3658  * @privlevel public
3659  * @privilege %http://tizen.org/privilege/bluetooth
3660  * @param[in]  service  The attribute handle of service
3661  * @param[in]  callback  The result callback
3662  * @param[in]  user_data  The user data to be passed to the callback function
3663  * @return  0 on success, otherwise a negative error value.
3664  * @retval  #BT_ERROR_NONE  Successful
3665  * @retval  #BT_ERROR_NOT_INITIALIZED  Not initialized
3666  * @retval  #BT_ERROR_INVALID_PARAMETER  Invalid parameter
3667  * @retval  #BT_ERROR_OPERATION_FAILED  Operation failed
3668  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
3669  * @pre  The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
3670  * @post  @a callback will be called.
3671  * @see  bt_gatt_characteristics_discovered_cb()
3672  */
3673 int bt_gatt_discover_characteristics(bt_gatt_attribute_h service, bt_gatt_characteristics_discovered_cb callback, void *user_data);
3674
3675 /**
3676  * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
3677  * @brief  Gets the UUID of service.
3678  * @since_tizen 2.3
3679  * @privlevel public
3680  * @privilege %http://tizen.org/privilege/bluetooth
3681  * @remarks  @a uuid must be released with free() by you.
3682  * @param[in]  service  The attribute handle of service
3683  * @param[out]  uuid  The UUID of service
3684  * @return  0 on success, otherwise a negative error value.
3685  * @retval  #BT_ERROR_NONE  Successful
3686  * @retval  #BT_ERROR_NOT_INITIALIZED  Not initialized
3687  * @retval  #BT_ERROR_INVALID_PARAMETER  Invalid parameter
3688  * @retval  #BT_ERROR_OPERATION_FAILED  Operation failed
3689  * @retval  #BT_ERROR_OUT_OF_MEMORY  Out of memory
3690  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
3691  * @pre  The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
3692  */
3693 int bt_gatt_get_service_uuid(bt_gatt_attribute_h service, char **uuid);
3694
3695 /**
3696  * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
3697  * @brief  Gets the included services in service.
3698  * @since_tizen 2.3
3699  * @privlevel public
3700  * @privilege %http://tizen.org/privilege/bluetooth
3701  * @param[in]  service  The attribute handle of service
3702  * @param[in]  callback  The callback function to invoke
3703  * @param[in]  user_data  The user data to be passed to the callback function
3704  * @return  0 on success, otherwise a negative error value.
3705  * @retval  #BT_ERROR_NONE  Successful
3706  * @retval  #BT_ERROR_INVALID_PARAMETER  Invalid parameter
3707  * @retval  #BT_ERROR_NOT_INITIALIZED  Not initialized
3708  * @retval  #BT_ERROR_NOT_ENABLED  Not enabled
3709  * @retval  #BT_ERROR_OPERATION_FAILED  Operation failed
3710  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
3711  * @pre  The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
3712  * @post  @a callback will be called if there are included services.
3713  * @see  bt_gatt_included_service_cb()
3714  */
3715 int bt_gatt_foreach_included_services(bt_gatt_attribute_h service, bt_gatt_included_service_cb callback, void *user_data);
3716
3717 /**
3718  * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
3719  * @brief  Registers a callback function that will be invoked when a characteristic value is changed.
3720  * @since_tizen 2.3
3721  * @param[in]  callback  The callback function to register
3722  * @param[in]  user_data  The user data to be passed to the callback function
3723  * @return  0 on success, otherwise a negative error value.
3724  * @retval  #BT_ERROR_NONE  Successful
3725  * @retval  #BT_ERROR_NOT_INITIALIZED  Not initialized
3726  * @retval  #BT_ERROR_INVALID_PARAMETER  Invalid parameter
3727  * @pre  The Bluetooth service must be initialized with bt_initialize().
3728  * @see  bt_gatt_unset_characteristic_changed_cb()
3729  */
3730 int bt_gatt_set_characteristic_changed_cb(bt_gatt_characteristic_changed_cb callback, void *user_data);
3731
3732 /**
3733  * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
3734  * @brief  Unregisters a callback function that will be invoked when a characteristic is changed.
3735  * @since_tizen 2.3
3736  * @return  0 on success, otherwise a negative error value.
3737  * @retval #BT_ERROR_NONE  Successful
3738  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
3739  * @pre The Bluetooth service must be initialized with bt_initialize().
3740  * @see bt_gatt_set_characteristic_changed_cb()
3741  */
3742 int bt_gatt_unset_characteristic_changed_cb(void);
3743
3744 /**
3745  * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
3746  * @brief  Watches all the characteristic value changes of the service
3747  * @since_tizen 2.3
3748  * @privlevel public
3749  * @privilege %http://tizen.org/privilege/bluetooth
3750  * @param[in]  service  The attribute handle of service
3751  * @return  0 on success, otherwise a negative error value.
3752  * @retval  #BT_ERROR_NONE  Successful
3753  * @retval  #BT_ERROR_NOT_INITIALIZED  Not initialized
3754  * @retval  #BT_ERROR_INVALID_PARAMETER  Invalid parameter
3755  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
3756  * @pre  The Bluetooth service must be initialized with bt_initialize().
3757  * @see  bt_gatt_unset_characteristic_changed_cb()
3758  */
3759 int bt_gatt_watch_characteristic_changes(bt_gatt_attribute_h service);
3760
3761 /**
3762  * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
3763  * @brief  Remove watching of all the characteristic value changes of the service
3764  * @since_tizen 2.3
3765  * @privlevel public
3766  * @privilege %http://tizen.org/privilege/bluetooth
3767  * @param[in]  service  The attribute handle of service
3768  * @return  0 on success, otherwise a negative error value.
3769  * @retval #BT_ERROR_NONE  Successful
3770  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
3771  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
3772  * @pre The Bluetooth service must be initialized with bt_initialize().
3773  * @see bt_gatt_set_characteristic_changed_cb()
3774  */
3775 int bt_gatt_unwatch_characteristic_changes(bt_gatt_attribute_h service);
3776
3777
3778 /**
3779  * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
3780  * @brief  Gets the characteristic declaration.
3781  * @since_tizen 2.3
3782  * @privlevel public
3783  * @privilege %http://tizen.org/privilege/bluetooth
3784  * @remarks  @a uuid and @a value must be released with free() by you.
3785  * @param[in]  characteristic  The attribute handle of characteristic
3786  * @param[out]  uuid  The UUID of service
3787  * @param[out]  value  The value of characteristic (byte array)
3788  * @param[out]  value_length  The length of value
3789  * @return  0 on success, otherwise a negative error value.
3790  * @retval  #BT_ERROR_NONE  Successful
3791  * @retval  #BT_ERROR_NOT_INITIALIZED  Not initialized
3792  * @retval  #BT_ERROR_INVALID_PARAMETER  Invalid parameter
3793  * @retval  #BT_ERROR_OPERATION_FAILED  Operation failed
3794  * @retval  #BT_ERROR_OUT_OF_MEMORY  Out of memory
3795  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
3796  * @pre  The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
3797  * @see  bt_gatt_set_characteristic_value()
3798  */
3799 int bt_gatt_get_characteristic_declaration(bt_gatt_attribute_h characteristic, char **uuid, unsigned char **value, int *value_length);
3800
3801 /**
3802  * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
3803  * @brief  Sets the value of characteristic.
3804  * @since_tizen 2.3
3805  * @privlevel public
3806  * @privilege %http://tizen.org/privilege/bluetooth
3807  * @param[in]  characteristic  The attribute handle of characteristic
3808  * @param[in]  value  The value of characteristic (byte array)
3809  * @param[in]  value_length  The length of value
3810  * @return  0 on success, otherwise a negative error value.
3811  * @retval  #BT_ERROR_NONE  Successful
3812  * @retval  #BT_ERROR_NOT_INITIALIZED  Not initialized
3813  * @retval  #BT_ERROR_INVALID_PARAMETER  Invalid parameter
3814  * @retval  #BT_ERROR_OPERATION_FAILED  Operation failed
3815  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
3816  * @pre  The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
3817  * @see  bt_gatt_get_characteristic_declaration()
3818  */
3819 int bt_gatt_set_characteristic_value(bt_gatt_attribute_h characteristic, const unsigned char *value, int value_length);
3820
3821 /**
3822  * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
3823  * @brief  Sets the value of characteristic request.
3824  * @since_tizen 2.3
3825  * @privlevel public
3826  * @privilege %http://tizen.org/privilege/bluetooth
3827  * @param[in]  characteristic  The attribute handle of characteristic
3828  * @param[in]  value  The value of characteristic (byte array)
3829  * @param[in]  value_length  The length of value
3830   * @param[in]  callback  The result callback
3831  * @return  0 on success, otherwise a negative error value.
3832  * @retval  #BT_ERROR_NONE  Successful
3833  * @retval  #BT_ERROR_NOT_INITIALIZED  Not initialized
3834  * @retval  #BT_ERROR_INVALID_PARAMETER  Invalid parameter
3835  * @retval  #BT_ERROR_OPERATION_FAILED  Operation failed
3836  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
3837  * @pre  The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
3838  * @see  bt_gatt_get_characteristic_declaration()
3839  */
3840 int bt_gatt_set_characteristic_value_request(bt_gatt_attribute_h characteristic, const unsigned char *value,
3841                                 int value_length, bt_gatt_characteristic_write_cb callback);
3842
3843 /**
3844 * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
3845 * @brief  Clones the attribute handle.
3846 * @since_tizen 2.3
3847 * @remarks  @a clone must be released with bt_gatt_destroy_attribute_handle().
3848 * @param[out]  clone  The cloned attribute handle
3849 * @param[in]  origin  The origin attribute handle
3850 * @return  0 on success, otherwise negative error value.
3851 * @retval  #BT_ERROR_NONE  Successful
3852 * @retval  #BT_ERROR_INVALID_PARAMETER  Invalid parameter
3853 * @retval  #BT_ERROR_OUT_OF_MEMORY  Out of memory
3854 * @see  bt_gatt_destroy_attribute_handle()
3855 */
3856 int bt_gatt_clone_attribute_handle(bt_gatt_attribute_h* clone, bt_gatt_attribute_h origin);
3857
3858 /**
3859 * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
3860 * @brief  Destroys the attribute handle.
3861 * @since_tizen 2.3
3862 * @param[in]  handle  The attribute handle
3863 * @return  0 on success, otherwise negative error value.
3864 * @retval  #BT_ERROR_NONE  Successful
3865 * @retval  #BT_ERROR_INVALID_PARAMETER  Invalid parameter
3866 * @see  bt_gatt_clone_attribute_handle()
3867 */
3868 int bt_gatt_destroy_attribute_handle(bt_gatt_attribute_h handle);
3869
3870 /**
3871  * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
3872  * @brief  Reads the value of characteristic from remote device
3873  * @since_tizen 2.3
3874  * @privlevel public
3875  * @privilege %http://tizen.org/privilege/bluetooth
3876  * @param[in]  char_handle  The attribute handle of characteristic
3877  * @param[in]  callback  The result callback
3878  * @return      0 on success, otherwise a negative error value.
3879  * @retval #BT_ERROR_NONE       Successful
3880  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
3881  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
3882  * @retval #BT_ERROR_OPERATION_FAILED   Operation failed
3883  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
3884  * @pre  The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
3885  * @see  bt_gatt_get_characteristic_declaration()
3886  */
3887 int bt_gatt_read_characteristic_value(bt_gatt_attribute_h char_handle,
3888                 bt_gatt_characteristic_read_cb callback);
3889
3890 /**
3891  * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
3892  * @brief  Discovers the characteristic descriptors of a characteristic within its definition, asynchronously.
3893  * @since_tizen 2.3
3894  * @privlevel public
3895  * @privilege %http://tizen.org/privilege/bluetooth
3896  * @param[in]  characteristic_handle  The attribute handle of characteristic
3897  * @param[in]  callback  The result callback
3898  * @param[in]  user_data  The user data to be passed to the callback function
3899  * @return  0 on success, otherwise a negative error value.
3900  * @retval  #BT_ERROR_NONE  Successful
3901  * @retval  #BT_ERROR_NOT_INITIALIZED  Not initialized
3902  * @retval  #BT_ERROR_INVALID_PARAMETER  Invalid parameter
3903  * @retval  #BT_ERROR_OPERATION_FAILED  Operation failed
3904  * @retval  #BT_ERROR_PERMISSION_DENIED  Permission denied
3905  * @pre  The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
3906  * @post  @a callback will be called.
3907  * @see  bt_gatt_characteristic_descriptor_discovered_cb()
3908  */
3909 int bt_gatt_discover_characteristic_descriptor(bt_gatt_attribute_h characteristic_handle,
3910                 bt_gatt_characteristic_descriptor_discovered_cb callback,
3911                 void *user_data);
3912 /**
3913  * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
3914  * @brief  Sets the value of characteristic descriptor request.
3915  * @since_tizen 2.3
3916  * @privlevel public
3917  * @privilege %http://tizen.org/privilege/bluetooth
3918  * @param[in]  characteristic  The attribute handle of characteristic
3919  * @param[in]  value  The value of characteristic (byte array), desc handle, desc value
3920  * @param[in]  value_length  The length of value
3921   * @param[in]  callback  The result callback
3922  * @return      0 on success, otherwise a negative error value.
3923  * @retval      #BT_ERROR_NONE  Successful
3924  * @retval      #BT_ERROR_NOT_INITIALIZED  Not initialized
3925  * @retval      #BT_ERROR_INVALID_PARAMETER  Invalid parameter
3926  * @retval      #BT_ERROR_OPERATION_FAILED      Operation failed
3927  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
3928  * @pre  The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
3929  * @see  bt_gatt_get_characteristic_declaration()
3930  */
3931 int bt_gatt_set_characteristic_desc_value_request(bt_gatt_attribute_h characteristic,
3932                                 const unsigned char *value, int value_length,
3933                                 bt_gatt_characteristic_write_cb callback);
3934
3935 /**
3936  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
3937  * @brief Connect to a specific LE based service on a remote bluetooth dievice address, asynchronously.
3938  * @since_tizen 2.3
3939  * @privlevel public
3940  * @privilege %http://tizen.org/privilege/bluetooth
3941  *
3942  * @remarks A connection can be disconnected by bt_gatt_disconnect().
3943  *
3944  * @param[in] address The address of the remote Bluetooth device.
3945  * @param[in] auto_connect The flag of the auto connection.
3946  *
3947  * @return 0 on success, otherwise a negative error value.
3948  * @retval #BT_ERROR_NONE  Successful
3949  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
3950  * @retval #BT_ERROR_NOT_ENABLED Not enabled
3951  * @retval #BT_ERROR_INVALID_PARAMETER Invalid paramater
3952  * @retval #BT_ERROR_OPERATION_FAILED Operation failed
3953  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
3954  *
3955  * @pre The Bluetooth service must be initialized with bt_initialize().
3956  * @pre The remote device must support le connection.
3957  * @post This function invokes bt_gatt_connection_state_changed_cb().
3958  *
3959  * @see bt_initialize()
3960  * @see bt_gatt_disconnect()
3961  * @see bt_gatt_set_connection_state_changed_cb()
3962  * @see bt_gatt_unset_connection_state_changed_cb()
3963  * @see bt_gatt_connection_state_changed_cb()
3964  */
3965 int bt_gatt_connect(const char *address, bool auto_connect);
3966
3967 /**
3968  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
3969  * @brief Disconnect to LE connection with the given remote Bluetooth dievice address, asynchronously.
3970  * @since_tizen 2.3
3971  * @privlevel public
3972  * @privilege %http://tizen.org/privilege/bluetooth
3973  *
3974  * @param[in] address The address of the remote Bluetooth device
3975  *
3976  * @return 0 on success, otherwise a negative error value.
3977  * @retval #BT_ERROR_NONE  Successful
3978  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
3979  * @retval #BT_ERROR_NOT_ENABLED Not enabled
3980  * @retval #BT_ERROR_INVALID_PARAMETER Invalid paramater
3981  * @retval #BT_ERROR_OPERATION_FAILED Operation failed
3982  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
3983  *
3984  * @pre The connection must be established.
3985  * @post This function invokes bt_gatt_connection_state_changed_cb().
3986  *
3987  * @see bt_initialize()
3988  * @see bt_gatt_connect()
3989  * @see bt_gatt_set_connection_state_changed_cb()
3990  * @see bt_gatt_unset_connection_state_changed_cb()
3991  * @see bt_gatt_connection_state_changed_cb()
3992  */
3993 int bt_gatt_disconnect(const char *address);
3994
3995 /**
3996  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
3997  * @brief Registers a callback function that will be invoked when the connection state is changed.
3998  * @since_tizen 2.3
3999  *
4000  * @param[in] callback The callback function to register.
4001  * @param[in] user_data The user data to be passed  to the callback function.
4002  *
4003  * @retval #BT_ERROR_NONE  Successful
4004  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
4005  * @retval #BT_ERROR_INVALID_PARAMETER Invalid paramater
4006  *
4007  * @see bt_gatt_connect()
4008  * @see bt_gatt_disconnect()
4009  * @see bt_gatt_unset_connection_state_changed_cb()
4010  */
4011 int bt_gatt_set_connection_state_changed_cb(bt_gatt_connection_state_changed_cb callback, void *user_data);
4012
4013 /**
4014  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
4015  * @brief Unregisters a callback function that will be invoked when the connection state is changed.
4016  * @since_tizen 2.3
4017  *
4018  * @retval #BT_ERROR_NONE  Successful
4019  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
4020  *
4021  * @see bt_gatt_connect()
4022  * @see bt_gatt_disconnect()
4023  * @see bt_gatt_connection_state_changed_cb()
4024  */
4025 int bt_gatt_unset_connection_state_changed_cb(void);
4026
4027 /**
4028  * @internal
4029  * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
4030  * @brief  Initializes the Gatt Service.
4031  * @since_tizen 2.3
4032  * @privlevel platform
4033  * @privilege http://tizen.org/privilege/bluetooth.admin
4034  *
4035  * @return      0 on success, otherwise a negative error value.
4036  * @retval      #BT_ERROR_NONE  Successful
4037  * @retval      #BT_ERROR_NOT_INITIALIZED  Not initialized
4038  * @retval      #BT_ERROR_INVALID_PARAMETER  Invalid parameter
4039  * @retval      #BT_ERROR_OPERATION_FAILED      Operation failed
4040  * @retval      #BT_ERROR_PERMISSION_DENIED  Permission denied
4041  *
4042  * @pre  The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
4043  * @see  bt_adapter_enable()
4044  */
4045 int _bt_gatt_init_service(void);
4046
4047
4048 /**
4049  * @internal
4050  * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
4051  * @brief  DeInitializes the Gatt Service.
4052  * @since_tizen 2.3
4053  * @privlevel platform
4054  * @privilege http://tizen.org/privilege/bluetooth.admin
4055  *
4056  * @return      0 on success, otherwise a negative error value.
4057  * @retval      #BT_ERROR_NONE  Successful
4058  * @retval      #BT_ERROR_NOT_INITIALIZED  Not initialized
4059  * @retval      #BT_ERROR_INVALID_PARAMETER  Invalid parameter
4060  * @retval      #BT_ERROR_OPERATION_FAILED      Operation failed
4061  * @retval      #BT_ERROR_PERMISSION_DENIED  Permission denied
4062  *
4063  * @pre  The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
4064  * @see  bt_adapter_enable()
4065  * @see _bt_gatt_init_service(void)
4066  */
4067 int _bt_gatt_deinit_service(void);
4068
4069
4070 /**
4071  * @internal
4072  * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
4073  * @brief  Adds Gatt Service to the service interface.
4074  * @since_tizen 2.3
4075  * @privlevel platform
4076  * @privilege http://tizen.org/privilege/bluetooth.admin
4077  *
4078  * @param[in]  svc_uuid         Gatt service uuid.
4079  * @param[out] svc_path         Object path of the GATT service.
4080  * @remarks svc_path must be released with free() by you.
4081  *
4082  * @return      0 on success, otherwise a negative error value.
4083  * @retval      #BT_ERROR_NONE  Successful
4084  * @retval      #BT_ERROR_NOT_INITIALIZED  Not initialized
4085  * @retval      #BT_ERROR_INVALID_PARAMETER  Invalid parameter
4086  * @retval      #BT_ERROR_OPERATION_FAILED      Operation failed
4087  * @retval      #BT_ERROR_PERMISSION_DENIED  Permission denied
4088  *
4089  * @pre  The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
4090  * @see  bt_adapter_enable()
4091  */
4092 int bt_gatt_add_service(const char *svc_uuid,
4093                                 char **svc_path);
4094
4095 /**
4096  * @internal
4097  * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
4098  * @brief  Deletes a Gatt Service from the Gatt Server Database.
4099  * @since_tizen 2.3
4100  * @privlevel platform
4101  * @privilege http://tizen.org/privilege/bluetooth.admin
4102  *
4103  * @param[in]  svc_path  Service path of the gatt service to remove.
4104  * @return      0 on success, otherwise a negative error value.
4105  * @retval      #BT_ERROR_NONE  Successful
4106  * @retval      #BT_ERROR_NOT_INITIALIZED  Not initialized
4107  * @retval      #BT_ERROR_INVALID_PARAMETER  Invalid parameter
4108  * @retval      #BT_ERROR_OPERATION_FAILED      Operation failed
4109  * @retval     #BT_ERROR_PERMISSION_DENIED  Permission denied
4110  *
4111  * @pre  The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
4112  * @see  bt_adapter_enable()
4113  */
4114 int bt_gatt_remove_service(const char *svc_path);
4115
4116 /**
4117  * @internal
4118  * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
4119  * @brief  Adds Gatt characteristic to the Characteristics interface.
4120  * @since_tizen 2.3
4121  * @privlevel platform
4122  * @privilege http://tizen.org/privilege/bluetooth.admin
4123  *
4124  * @param[in]  char_uuid Gatt characteristic uuid.
4125  * @param[in]  char_value       Gatt characteristic value.
4126  * @param[in]  value_length Caracteristic value length.
4127  * @param[in]  char_flags    Characteristic flags.
4128  * @param[in]  flags_length Caracteristic flags length.
4129  * @param[in]  svc_path service path to which this characteristic belongs to.
4130  * @param[out]  char_path       characteristic path registered on the interface.
4131  * @remarks char_path must be released with free() by you.
4132  *
4133  * @return      0 on success, otherwise a negative error value.
4134  * @retval      #BT_ERROR_NONE  Successful
4135  * @retval      #BT_ERROR_NOT_INITIALIZED  Not initialized
4136  * @retval      #BT_ERROR_INVALID_PARAMETER  Invalid parameter
4137  * @retval      #BT_ERROR_OPERATION_FAILED      Operation failed
4138  * @retval     #BT_ERROR_PERMISSION_DENIED  Permission denied
4139  *
4140  * @pre  The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
4141  * @see  bt_adapter_enable()
4142  */
4143 int bt_gatt_add_characteristic(const char *char_uuid,
4144                         const char *char_value, int value_length,
4145                         const char *char_flags[], int flags_length,
4146                         const char *svc_path, char **char_path);
4147
4148 /**
4149  * @internal
4150  * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
4151  * @brief  Adds Gatt descriptor to the descriptor interface.
4152  * @since_tizen 2.3
4153  * @privlevel platform
4154  * @privilege http://tizen.org/privilege/bluetooth.admin
4155  *
4156  * @param[in]  desc_uuid Gatt descriptor uuid.
4157  * @param[in]  desc_value       Gatt descriptor value.
4158  * @param[in]  desc_length      Gatt descriptor value.
4159  * @param[in]  permissions      Permissions for the descriptor.
4160  * @param[in]  char_path        Characteristic path to which this descriptor should belong to.
4161  * @return      0 on success, otherwise a negative error value.
4162  * @retval      #BT_ERROR_NONE  Successful
4163  * @retval      #BT_ERROR_NOT_INITIALIZED  Not initialized
4164  * @retval      #BT_ERROR_INVALID_PARAMETER  Invalid parameter
4165  * @retval      #BT_ERROR_OPERATION_FAILED      Operation failed
4166  * @retval     #BT_ERROR_PERMISSION_DENIED  Permission denied
4167  *
4168  * @pre  The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
4169  * @see  bt_adapter_enable()
4170  */
4171 int bt_gatt_add_descriptor(const char *desc_uuid,
4172                         const char *desc_value, int value_length,
4173                         const char *permissions, const char *char_path,
4174                         char **desc_path);
4175
4176 /**
4177  * @internal
4178  * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
4179  * @brief  Registers the given service path (including characteristics and descriptor) with the Bluez.
4180  * @since_tizen 2.3
4181  * @privlevel platform
4182  * @privilege http://tizen.org/privilege/bluetooth.admin
4183  *
4184  * @param[in]  svc_path Gatt service path obtained from the add_service.
4185  * @return      0 on success, otherwise a negative error value.
4186  * @retval      #BT_ERROR_NONE  Successful
4187  * @retval      #BT_ERROR_NOT_INITIALIZED  Not initialized
4188  * @retval      #BT_ERROR_INVALID_PARAMETER  Invalid parameter
4189  * @retval      #BT_ERROR_OPERATION_FAILED      Operation failed
4190  * @retval     #BT_ERROR_PERMISSION_DENIED  Permission denied
4191  *
4192  * @pre  The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
4193  * @pre  bt_gatt_add_service, bt_gatt_add_characteristic and bt_gatt_add_descriptor
4194  *          must be called before calling bt_gatt_register_service
4195  *
4196  * @see  bt_adapter_enable()
4197  * @see  bt_gatt_add_service()
4198  * @see  bt_gatt_add_characteristic()
4199  * @see  bt_gatt_add_descriptor()
4200  */
4201 int bt_gatt_register_service(const char *svc_path,
4202                 bt_gatt_remote_characteristic_write_cb callback,
4203                 void *user_data);
4204
4205 /**
4206  * @internal
4207  * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
4208  * @brief  Updates the existing characteristic value.
4209  * @since_tizen 2.3
4210  * @privlevel platform
4211  * @privilege http://tizen.org/privilege/bluetooth.admin
4212  *
4213  * @param[in]  char_path        characteristic path registered on the interface.
4214  * @param[in]  char_value       Gatt characteristic value.
4215  * @param[in]  value_length     Characteristic value length.
4216  * @param[in]  address Remote device address, for which
4217  *                        Notification/Indication need to be sent.
4218  *
4219  * @return      0 on success, otherwise a negative error value.
4220  * @retval      #BT_ERROR_NONE  Successful
4221  * @retval      #BT_ERROR_NOT_INITIALIZED  Not initialized
4222  * @retval      #BT_ERROR_INVALID_PARAMETER  Invalid parameter
4223  * @retval      #BT_ERROR_OPERATION_FAILED      Operation failed
4224  * @retval     #BT_ERROR_PERMISSION_DENIED  Permission denied
4225  *
4226  * @pre  The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
4227  * @see  bt_adapter_enable()
4228  */
4229 int bt_gatt_update_characteristic(const char *char_path,
4230                         const char *char_value, int value_length,
4231                         const char *address);
4232 /**
4233  * @internal
4234  * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
4235  * @brief  Delete Gatt Services from the Gatt Server Database.
4236  * @since_tizen 2.3
4237  * @privlevel platform
4238  * @privilege http://tizen.org/privilege/bluetooth.admin
4239  *
4240  * @return      0 on success, otherwise a negative error value.
4241  * @retval      #BT_ERROR_NONE  Successful
4242  * @retval      #BT_ERROR_NOT_INITIALIZED  Not initialized
4243  * @retval      #BT_ERROR_INVALID_PARAMETER  Invalid parameter
4244  * @retval      #BT_ERROR_OPERATION_FAILED      Operation failed
4245  * @retval     #BT_ERROR_PERMISSION_DENIED  Permission denied
4246  *
4247  * @pre  The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
4248  * @post  @a callback will be called.
4249  * @see  bt_adapter_enable()
4250  */
4251 int bt_gatt_delete_services(void);
4252
4253 /**
4254  * @internal
4255  * @ingroup CAPI_NETWORK_BLUETOOTH_PAN_NAP_MODULE
4256  * @brief Activates the NAP(Network Access Point).
4257  * @since_tizen 2.3
4258  * @privlevel platform
4259  * @privilege %http://tizen.org/privilege/bluetooth.admin
4260  * @return 0 on success, otherwise a negative error value.
4261  * @retval #BT_ERROR_NONE  Successful
4262  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
4263  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
4264  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
4265  * @retval #BT_ERROR_ALREADY_DONE  Operation is already done
4266  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
4267  * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED
4268  * @see bt_nap_deactivate()
4269  */
4270 int bt_nap_activate(void);
4271
4272 /**
4273  * @internal
4274  * @ingroup CAPI_NETWORK_BLUETOOTH_PAN_NAP_MODULE
4275  * @brief Deactivates the NAP(Network Access Point).
4276  * @since_tizen 2.3
4277  * @privlevel platform
4278  * @privilege %http://tizen.org/privilege/bluetooth.admin
4279  * @return 0 on success, otherwise a negative error value.
4280  * @retval #BT_ERROR_NONE  Successful
4281  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
4282  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
4283  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
4284  * @retval #BT_ERROR_ALREADY_DONE  Operation is already done
4285  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
4286  * @pre The Bluetooth NAP service must be activated with bt_nap_activate().
4287  * @see bt_nap_activate()
4288  */
4289 int bt_nap_deactivate(void);
4290
4291 /**
4292  * @internal
4293  * @ingroup CAPI_NETWORK_BLUETOOTH_PAN_NAP_MODULE
4294  * @brief Disconnects the all PANUs(Personal Area Networking User) which are connected to you.
4295  * @since_tizen 2.3
4296  * @privlevel platform
4297  * @privilege %http://tizen.org/privilege/bluetooth.admin
4298  * @return 0 on success, otherwise a negative error value.
4299  * @retval #BT_ERROR_NONE  Successful
4300  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
4301  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
4302  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
4303  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
4304  * @pre The Bluetooth NAP service must be activated with bt_nap_activate().
4305  * @see bt_nap_activate()
4306  */
4307 int bt_nap_disconnect_all(void);
4308
4309 /**
4310  * @internal
4311  * @ingroup CAPI_NETWORK_BLUETOOTH_PAN_NAP_MODULE
4312  * @brief Disconnects the specified PANU(Personal Area Networking User) which is connected to you.
4313  * @since_tizen 2.3
4314  * @privlevel platform
4315  * @privilege %http://tizen.org/privilege/bluetooth.admin
4316  * @param[in] remote_address  The remote address
4317  * @return 0 on success, otherwise a negative error value.
4318  * @retval #BT_ERROR_NONE  Successful
4319  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
4320  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
4321  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
4322  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
4323  * @pre The Bluetooth NAP service must be activated with bt_nap_activate().
4324  * @see bt_nap_activate()
4325  */
4326 int bt_nap_disconnect(const char *remote_address);
4327
4328 /**
4329  * @internal
4330  * @ingroup CAPI_NETWORK_BLUETOOTH_PAN_NAP_MODULE
4331  * @brief  Registers a callback function that will be invoked when the connection state changes.
4332  * @since_tizen 2.3
4333  * @param[in] callback The callback function to register
4334  * @param[in] user_data The user data to be passed to the callback function
4335  * @return   0 on success, otherwise a negative error value.
4336  * @retval #BT_ERROR_NONE  Successful
4337  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
4338  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
4339  * @pre The Bluetooth service must be initialized with bt_initialize().
4340  * @post bt_nap_connection_state_changed_cb() will be invoked.
4341  * @see bt_initialize()
4342  * @see bt_nap_connection_state_changed_cb()
4343  * @see bt_nap_unset_connection_state_changed_cb()
4344  */
4345 int bt_nap_set_connection_state_changed_cb(bt_nap_connection_state_changed_cb callback, void *user_data);
4346
4347 /**
4348  * @internal
4349  * @ingroup CAPI_NETWORK_BLUETOOTH_PAN_NAP_MODULE
4350  * @brief  Unregisters a callback function that will be invoked when the connection state changes.
4351  * @since_tizen 2.3
4352  * @return   0 on success, otherwise a negative error value.
4353  * @retval #BT_ERROR_NONE  Successful
4354  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
4355  * @pre The Bluetooth service must be initialized with bt_initialize().
4356  * @post bt_nap_connection_state_changed_cb() will be invoked.
4357  * @see bt_initialize()
4358  * @see bt_nap_connection_state_changed_cb()
4359  * @see bt_nap_set_connection_state_changed_cb()
4360  */
4361 int bt_nap_unset_connection_state_changed_cb(void);
4362
4363 /**
4364  * @internal
4365  * @ingroup CAPI_NETWORK_BLUETOOTH_PAN_PANU_MODULE
4366  * @brief  Registers a callback function that will be invoked when the connection state changes.
4367  * @since_tizen 2.3
4368  * @param[in] callback The callback function to register
4369  * @param[in] user_data The user data to be passed to the callback function
4370  * @return   0 on success, otherwise a negative error value.
4371  * @retval #BT_ERROR_NONE  Successful
4372  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
4373  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
4374  * @pre The Bluetooth service must be initialized with bt_initialize().
4375  * @post bt_nap_connection_state_changed_cb() will be invoked.
4376  * @see bt_initialize()
4377  * @see bt_panu_connection_state_changed_cb()
4378  * @see bt_panu_unset_connection_state_changed_cb()
4379  */
4380 int bt_panu_set_connection_state_changed_cb(bt_panu_connection_state_changed_cb callback, void *user_data);
4381
4382 /**
4383  * @internal
4384  * @ingroup CAPI_NETWORK_BLUETOOTH_PAN_PANU_MODULE
4385  * @brief  Unregisters a callback function that will be invoked when the connection state changes.
4386  * @since_tizen 2.3
4387  * @return   0 on success, otherwise a negative error value.
4388  * @retval #BT_ERROR_NONE  Successful
4389  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
4390  * @pre The Bluetooth service must be initialized with bt_initialize().
4391  * @post bt_nap_connection_state_changed_cb() will be invoked.
4392  * @see bt_initialize()
4393  * @see bt_panu_connection_state_changed_cb()
4394  * @see bt_panu_set_connection_state_changed_cb()
4395  */
4396 int bt_panu_unset_connection_state_changed_cb(void);
4397
4398 /**
4399  * @internal
4400  * @ingroup CAPI_NETWORK_BLUETOOTH_PAN_PANU_MODULE
4401  * @brief Connects the remote device with the PAN(Personal Area Networking) service, asynchronously.
4402  * @since_tizen 2.3
4403  * @privlevel platform
4404  * @privilege %http://tizen.org/privilege/bluetooth.admin
4405  * @param[in] remote_address  The remote address
4406  * @param[in] type  The type of PAN service
4407  * @return 0 on success, otherwise a negative error value.
4408  * @retval #BT_ERROR_NONE  Successful
4409  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
4410  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
4411  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
4412  * @retval #BT_ERROR_REMOTE_DEVICE_NOT_BONDED  Remote device is not bonded
4413  * @retval #BT_ERROR_OUT_OF_MEMORY  Out of memory
4414  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
4415  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
4416  * @pre The local device must be bonded with the remote device by bt_device_create_bond().
4417  * @post bt_panu_connection_state_changed_cb() will be invoked.
4418  * @see bt_panu_disconnect()
4419  * @see bt_panu_connection_state_changed_cb()
4420  */
4421 int bt_panu_connect(const char *remote_address, bt_panu_service_type_e type);
4422
4423 /**
4424  * @internal
4425  * @ingroup CAPI_NETWORK_BLUETOOTH_PAN_PANU_MODULE
4426  * @brief Disconnects the remote device with the PAN(Personal Area Networking) service, asynchronously.
4427  * @since_tizen 2.3
4428  * @privlevel platform
4429  * @privilege %http://tizen.org/privilege/bluetooth.admin
4430  * @param[in] remote_address  The remote address
4431  * @return 0 on success, otherwise a negative error value.
4432  * @retval #BT_ERROR_NONE  Successful
4433  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
4434  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
4435  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
4436  * @retval #BT_ERROR_REMOTE_DEVICE_NOT_CONNECTED  Remote device is not connected
4437  * @retval #BT_ERROR_OUT_OF_MEMORY  Out of memory
4438  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
4439  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
4440  * @pre The remote device must be connected by bt_panu_connect().
4441  * @post bt_panu_connection_state_changed_cb() will be invoked.
4442  * @see bt_panu_connect()
4443  * @see bt_panu_connection_state_changed_cb()
4444  */
4445 int bt_panu_disconnect(const char *remote_address);
4446
4447 /**
4448  * @internal
4449  * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
4450  * @brief   update LE connection.
4451  * @since_tizen 2.3
4452  * @privlevel platform
4453  * @privilege %http://tizen.org/privilege/bluetooth.admin
4454  * @return 0 on success, otherwise a negative error value.
4455  * @retval #BT_ERROR_NONE  Successful
4456  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
4457  * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
4458  * @pre The Bluetooth service must be initialized by bt_initialize().
4459  * @pre The remote device must be connected with bt_gatt_connect().
4460  */
4461 int bt_device_le_conn_update(const char *device_address,
4462                              const bt_le_conn_update_s *parameters);
4463
4464
4465 /**
4466  * @}
4467  */
4468
4469
4470 #ifdef __cplusplus
4471 }
4472 #endif /* __cplusplus */
4473
4474 #endif // __TIZEN_NETWORK_BLUETOOTH_H__