Tizen Native API
3.0
|
Bluetooth Adapter API provides functions for setting up Bluetooth and discovering other devices.
Required Header
#include <bluetooth.h>
Overview
This set of function is used to control a bluetooth adapter. You can also control visibility of the device, its appearance for others (adapter name). In addition, this api is used to discover neighboring bluetooth devices. This process is asynchronous, so it is up to you to build and hold list of devices in the neighborhood
- the api does not provide this list. Before starting a device discovery, you can find a device from the connected devices. This functionality is implemented by foreach loop.
Related Features
This API is related with the following features:
It is recommended to design feature related codes in your application for reliability.
You can check if a device supports the related features for this API by using System Information,thereby controlling the procedure of your application.
To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.
More details on featuring your application can be found from Feature Element.
Asynchronous Operations
FUNCTION | CALLBACK | DESCRIPTION |
---|---|---|
bt_adapter_set_name() | bt_adapter_name_changed_cb() | Used to set adapter name. |
bt_adapter_visibility_mode_changed_cb() | Used to set visibility mode (bt_adapter_visibility_mode_e). | |
bt_adapter_start_device_discovery() bt_adapter_stop_device_discovery() | bt_adapter_device_discovery_state_changed_cb() | Used to start or cancel device discovery. |
Callback(Event) Operations
REGISTER | UNREGISTER | CALLBACK | DESCRIPTION |
---|---|---|---|
bt_adapter_set_state_changed_cb() | bt_adapter_unset_state_changed_cb() | bt_adapter_state_changed_cb() | Used to be notified of state change (enable or disable). |
bt_adapter_set_name_changed_cb() | bt_adapter_unset_name_changed_cb() | bt_adapter_name_changed_cb() | Used to be notified of name change. |
bt_adapter_set_visibility_mode_changed_cb() | bt_adapter_unset_visibility_mode_changed_cb() | bt_adapter_visibility_mode_changed_cb() | Used to be notified of change of visibility mode (bt_adapter_visibility_mode_e). |
bt_adapter_set_device_discovery_state_changed_cb() | bt_adapter_unset_device_discovery_state_changed_cb() | bt_adapter_device_discovery_state_changed_cb() | Used to be notified of change of device discovery state (bt_adapter_device_discovery_state_e). |
Foreach Operations
FOREACH | CALLBACK | DESCRIPTION |
---|---|---|
bt_adapter_foreach_bonded_device() | bt_adapter_bonded_device_cb() | Used to get bonded devices. |
Please refer Bluetooth Tutorial if you want to get more detailed usages and information of this api.
Functions | |
int | bt_adapter_get_state (bt_adapter_state_e *adapter_state) |
Gets the current state of local Bluetooth adapter. | |
int | bt_adapter_get_address (char **local_address) |
Gets the address of local Bluetooth adapter. | |
int | bt_adapter_get_name (char **local_name) |
Gets the name of local Bluetooth adapter. | |
int | bt_adapter_set_name (const char *local_name) |
Sets the name of local Bluetooth adapter. | |
int | bt_adapter_get_visibility (bt_adapter_visibility_mode_e *mode, int *duration) |
Gets the visibility mode of local Bluetooth adapter. | |
int | bt_adapter_start_device_discovery (void) |
Starts the device discovery, asynchronously. | |
int | bt_adapter_stop_device_discovery (void) |
Stops the device discovery, asynchronously. | |
int | bt_adapter_is_discovering (bool *is_discovering) |
Checks if the device discovery is in progress or not. | |
int | bt_adapter_foreach_bonded_device (bt_adapter_bonded_device_cb callback, void *user_data) |
Retrieves the device information of all bonded devices. | |
int | bt_adapter_get_bonded_device_info (const char *remote_address, bt_device_info_s **device_info) |
Gets the device information of a bonded device. | |
int | bt_adapter_free_device_info (bt_device_info_s *device_info) |
Frees device info. | |
int | bt_adapter_is_service_used (const char *service_uuid, bool *used) |
Checks whether the UUID of service is used or not. | |
int | bt_adapter_set_state_changed_cb (bt_adapter_state_changed_cb callback, void *user_data) |
Registers a callback function to be invoked when the Bluetooth adapter state changes. | |
int | bt_adapter_unset_state_changed_cb (void) |
Unregisters the callback function. | |
int | bt_adapter_set_name_changed_cb (bt_adapter_name_changed_cb callback, void *user_data) |
Registers a callback function to be invoked when the name of Bluetooth adapter changes. | |
int | bt_adapter_unset_name_changed_cb (void) |
Unregisters the callback function. | |
int | bt_adapter_set_visibility_mode_changed_cb (bt_adapter_visibility_mode_changed_cb callback, void *user_data) |
Registers a callback function to be invoked when the visibility mode changes. | |
int | bt_adapter_unset_visibility_mode_changed_cb (void) |
Unregisters the callback function. | |
int | bt_adapter_set_visibility_duration_changed_cb (bt_adapter_visibility_duration_changed_cb callback, void *user_data) |
Registers a callback function to be invoked every second. Until the visibility mode is changed from BT_ADAPTER_VISIBILITY_MODE_LIMITED_DISCOVERABLE to BT_ADAPTER_VISIBILITY_MODE_NON_DISCOVERABLE. | |
int | bt_adapter_unset_visibility_duration_changed_cb (void) |
Unregisters the callback function. | |
int | bt_adapter_set_device_discovery_state_changed_cb (bt_adapter_device_discovery_state_changed_cb callback, void *user_data) |
Registers a callback function to be invoked when the device discovery state changes. | |
int | bt_adapter_unset_device_discovery_state_changed_cb (void) |
Unregisters the callback function. | |
int | bt_adapter_get_local_oob_data (unsigned char **hash, unsigned char **randomizer, int *hash_len, int *randomizer_len) |
Gets the Hash and Randmoizer value, synchronously. | |
int | bt_adapter_set_remote_oob_data (const char *remote_address, unsigned char *hash, unsigned char *randomizer, int hash_len, int randomizer_len) |
Sets the Hash and Randmoizer value, synchronously. | |
int | bt_adapter_get_local_oob_ext_data (unsigned char **hash192, unsigned char **randomizer192, int *hash192_len, int *randomizer192_len, unsigned char **hash256, unsigned char **randomizer256, int *hash256_len, int *randomizer256_len) |
Gets the Hash and Randmoizer value, synchronously. | |
int | bt_adapter_set_remote_oob_ext_data (const char *remote_address, const unsigned char *hash192, const unsigned char *randomizer192, int hash192_len, int randomizer192_len, const unsigned char *hash256, const unsigned char *randomizer256, int hash256_len, int randomizer256_len) |
Sets the Hash and Randmoizer value, synchronously. | |
int | bt_adapter_remove_remote_oob_data (const char *remote_address) |
Deletes the Hash and Randomizer value, synchronously. | |
Typedefs | |
typedef void(* | bt_adapter_state_changed_cb )(int result, bt_adapter_state_e adapter_state, void *user_data) |
Called when the Bluetooth adapter state changes. | |
typedef void(* | bt_adapter_name_changed_cb )(char *device_name, void *user_data) |
Called when adapter name changes. | |
typedef void(* | bt_adapter_visibility_mode_changed_cb )(int result, bt_adapter_visibility_mode_e visibility_mode, void *user_data) |
Called when the visibility mode changes. | |
typedef void(* | bt_adapter_visibility_duration_changed_cb )(int duration, void *user_data) |
Called every second until the visibility mode is changed to BT_ADAPTER_VISIBILITY_MODE_NON_DISCOVERABLE. | |
typedef void(* | bt_adapter_device_discovery_state_changed_cb )(int result, bt_adapter_device_discovery_state_e discovery_state, bt_adapter_device_discovery_info_s *discovery_info, void *user_data) |
Called when the state of device discovery changes. | |
typedef bool(* | bt_adapter_bonded_device_cb )(bt_device_info_s *device_info, void *user_data) |
Called when you get bonded devices repeatedly. |
Typedef Documentation
typedef bool(* bt_adapter_bonded_device_cb)(bt_device_info_s *device_info, void *user_data) |
Called when you get bonded devices repeatedly.
- Since :
- 2.3.1
- Parameters:
-
[in] device_info The bonded device information [in] user_data The user data passed from the foreach function
- Returns:
true
to continue with the next iteration of the loop,
false
to break out of the loop.
- Precondition:
- bt_adapter_foreach_bonded_device() will invoke this function.
- See also:
- bt_adapter_foreach_bonded_device()
typedef void(* bt_adapter_device_discovery_state_changed_cb)(int result, bt_adapter_device_discovery_state_e discovery_state, bt_adapter_device_discovery_info_s *discovery_info, void *user_data) |
Called when the state of device discovery changes.
- Since :
- 2.3.1
- Remarks:
- If discovery_state is BT_ADAPTER_DEVICE_DISCOVERY_FOUND, then you can get some information, such as remote device address, remote device name, rssi, and bonding state.
- Parameters:
-
[in] result The result of the device discovery [in] discovery_state The discovery state to be changed [in] discovery_info The information of the discovered device
If discovery_state is BT_ADAPTER_DEVICE_DISCOVERY_STARTED or BT_ADAPTER_DEVICE_DISCOVERY_FINISHED, then discovery_info is NULL.[in] user_data The user data passed from the callback registration function
- Precondition:
- Either bt_adapter_start_device_discovery() or bt_adapter_stop_device_discovery() will invoke this function if you register this callback using bt_adapter_set_device_discovery_state_changed_cb().
typedef void(* bt_adapter_name_changed_cb)(char *device_name, void *user_data) |
Called when adapter name changes.
- Since :
- 2.3.1
- Parameters:
-
[in] device_name The name of the Bluetooth device to be changed [in] user_data The user data passed from the callback registration function
- Precondition:
- This function will be invoked when the name of Bluetooth adapter changes if you register this callback using bt_adapter_set_name_changed_cb().
typedef void(* bt_adapter_state_changed_cb)(int result, bt_adapter_state_e adapter_state, void *user_data) |
Called when the Bluetooth adapter state changes.
- Since :
- 2.3.1
- Parameters:
-
[in] result The result of the adapter state changing [in] adapter_state The adapter state to be changed [in] user_data The user data passed from the callback registration function
typedef void(* bt_adapter_visibility_duration_changed_cb)(int duration, void *user_data) |
Called every second until the visibility mode is changed to BT_ADAPTER_VISIBILITY_MODE_NON_DISCOVERABLE.
- Since :
- 2.3.1
- Remarks:
- This callback function is called only if visibility mode is BT_ADAPTER_VISIBILITY_MODE_LIMITED_DISCOVERABLE.
- Parameters:
-
[in] duration The duration until the visibility mode is changed to BT_ADAPTER_VISIBILITY_MODE_NON_DISCOVERABLE (in seconds) [in] user_data The user data passed from the callback registration function
- Precondition:
- This function will be invoked if you register this callback using bt_adapter_set_visibility_duration_changed_cb().
typedef void(* bt_adapter_visibility_mode_changed_cb)(int result, bt_adapter_visibility_mode_e visibility_mode, void *user_data) |
Called when the visibility mode changes.
- Since :
- 2.3.1
- Parameters:
-
[in] result The result of the visibility mode changing [in] visibility_mode The visibility mode to be changed [in] user_data The user data passed from the callback registration function
- Precondition:
- This function will be invoked when the visibility of Bluetooth adapter changes if you register this callback using bt_adapter_set_visibility_mode_changed_cb().
Enumeration Type Documentation
enum bt_adapter_state_e |
Enumerations of the Bluetooth visibility mode.
- Since :
- 2.3.1
- Enumerator:
BT_ADAPTER_VISIBILITY_MODE_NON_DISCOVERABLE Other devices cannot find your device via discovery
BT_ADAPTER_VISIBILITY_MODE_GENERAL_DISCOVERABLE Discoverable mode
BT_ADAPTER_VISIBILITY_MODE_LIMITED_DISCOVERABLE Discoverable mode with time limit. After specific period, it is changed to BT_ADAPTER_VISIBILITY_MODE_NON_DISCOVERABLE.
Function Documentation
int bt_adapter_foreach_bonded_device | ( | bt_adapter_bonded_device_cb | callback, |
void * | user_data | ||
) |
Retrieves the device information of all bonded devices.
- Since :
- 2.3
- Parameters:
-
[in] callback The callback function to invoke [in] user_data The user data passed from the foreach function
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
BT_ERROR_NONE Successful BT_ERROR_NOT_INITIALIZED Not initialized BT_ERROR_INVALID_PARAMETER Invalid parameter BT_ERROR_OUT_OF_MEMORY Out of memory BT_ERROR_NOT_ENABLED Not enabled BT_ERROR_OPERATION_FAILED Operation failed BT_ERROR_NOT_SUPPORTED Not supported
- Precondition:
- The state of local Bluetooth must be BT_ADAPTER_ENABLED.
- Postcondition:
- This function invokes bt_adapter_bonded_device_cb().
- See also:
- bt_adapter_bonded_device_cb()
int bt_adapter_free_device_info | ( | bt_device_info_s * | device_info | ) |
Frees device info.
- Since :
- 2.3
- Parameters:
-
[in] device_info The bonded device information
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
BT_ERROR_NONE Successful BT_ERROR_INVALID_PARAMETER Invalid parameter BT_ERROR_NOT_SUPPORTED Not supported
- See also:
- bt_adapter_get_bonded_device_info()
int bt_adapter_get_address | ( | char ** | local_address | ) |
Gets the address of local Bluetooth adapter.
- Since :
- 2.3
- Remarks:
- The local_address must be released with free() by you.
- Parameters:
-
[out] local_address The device address of local Bluetooth adapter
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
BT_ERROR_NONE Successful BT_ERROR_NOT_INITIALIZED Not initialized BT_ERROR_INVALID_PARAMETER Invalid parameter BT_ERROR_NOT_ENABLED Not enabled BT_ERROR_OUT_OF_MEMORY Out of memory BT_ERROR_OPERATION_FAILED Operation failed BT_ERROR_NOT_SUPPORTED Not supported
- Precondition:
- The state of local Bluetooth must be BT_ADAPTER_ENABLED.
- See also:
- bt_adapter_get_name()
int bt_adapter_get_bonded_device_info | ( | const char * | remote_address, |
bt_device_info_s ** | device_info | ||
) |
Gets the device information of a bonded device.
- Since :
- 2.3
- Remarks:
- The device_info must be released with bt_adapter_free_device_info() by you.
- Parameters:
-
[in] remote_address The address of remote device [out] device_info The bonded device information
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
BT_ERROR_NONE Successful BT_ERROR_NOT_INITIALIZED Not initialized BT_ERROR_INVALID_PARAMETER Invalid parameter BT_ERROR_OUT_OF_MEMORY Out of memory BT_ERROR_NOT_ENABLED Not enabled BT_ERROR_OPERATION_FAILED Operation failed BT_ERROR_REMOTE_DEVICE_NOT_BONDED Remote device not bonded BT_ERROR_NOT_SUPPORTED Not supported
- Precondition:
- The state of local Bluetooth must be BT_ADAPTER_ENABLED.
- Postcondition:
- This function invokes bt_adapter_bonded_device_cb().
- See also:
- bt_adapter_bonded_device_cb()
int bt_adapter_get_local_oob_data | ( | unsigned char ** | hash, |
unsigned char ** | randomizer, | ||
int * | hash_len, | ||
int * | randomizer_len | ||
) |
Gets the Hash and Randmoizer value, synchronously.
- Since :
- 2.3
- Parameters:
-
[out] hash The hash value received from the controller [out] randomizer The randomizer value received from the controller [out] hash_len The length of the hash value [out] randomizer_len The length of the randomizer value
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
BT_ERROR_NONE Successful BT_ERROR_NOT_INITIALIZED Not initialized BT_ERROR_INVALID_PARAMETER Invalid parameter BT_ERROR_NOT_ENABLED Not enabled BT_ERROR_OPERATION_FAILED Operation failed BT_ERROR_NOT_SUPPORTED Not supported
- Precondition:
- The state of local Bluetooth must be BT_ADAPTER_ENABLED.
- The Bluetooth service must be initialized with bt_initialize().
- See also:
- bt_initialize()
int bt_adapter_get_local_oob_ext_data | ( | unsigned char ** | hash192, |
unsigned char ** | randomizer192, | ||
int * | hash192_len, | ||
int * | randomizer192_len, | ||
unsigned char ** | hash256, | ||
unsigned char ** | randomizer256, | ||
int * | hash256_len, | ||
int * | randomizer256_len | ||
) |
Gets the Hash and Randmoizer value, synchronously.
- Since :
- 3.0
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/bluetooth
- Remarks:
- The hash192, randomizer192, hash256 and randomizer256 must be released using free().
- Parameters:
-
[out] hash192 The hash value derived from the P-192 public key [out] randomizer192 The randomizer value associated with the P-192 public key [out] hash192_len The length of hash192 [out] randomizer192_len The length of randomizer192 [out] hash256 The hash value derived from the P-256 public key [out] randomizer256 The randomizer value associated with the P-256 public key [out] hash256_len The length of hash256 [out] randomizer256_len The length of randomizer256
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
BT_ERROR_NONE Successful BT_ERROR_NOT_INITIALIZED Not initialized BT_ERROR_INVALID_PARAMETER Invalid parameter BT_ERROR_NOT_ENABLED Not enabled BT_ERROR_OPERATION_FAILED Operation failed BT_ERROR_NOT_SUPPORTED Not supported
- Precondition:
- The state of local Bluetooth must be BT_ADAPTER_ENABLED.
- The Bluetooth service must be initialized with bt_initialize().
- See also:
- bt_initialize()
int bt_adapter_get_name | ( | char ** | local_name | ) |
Gets the name of local Bluetooth adapter.
Use this function to get the friendly name associated with Bluetooth device, retrieved by the remote Bluetooth devices.
- Since :
- 2.3
- Remarks:
- The local_name must be released with free() by you.
- Parameters:
-
[out] local_name The local device name
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
BT_ERROR_NONE Successful BT_ERROR_NOT_INITIALIZED Not initialized BT_ERROR_INVALID_PARAMETER Invalid parameter BT_ERROR_NOT_ENABLED Not enabled BT_ERROR_OUT_OF_MEMORY Out of memory BT_ERROR_OPERATION_FAILED Operation failed BT_ERROR_NOT_SUPPORTED Not supported
- Precondition:
- The state of local Bluetooth must be BT_ADAPTER_ENABLED.
- See also:
- bt_adapter_set_name()
int bt_adapter_get_state | ( | bt_adapter_state_e * | adapter_state | ) |
Gets the current state of local Bluetooth adapter.
- Since :
- 2.3
- Parameters:
-
[out] adapter_state The current adapter state
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
BT_ERROR_NONE Successful BT_ERROR_NOT_INITIALIZED Not initialized BT_ERROR_INVALID_PARAMETER Invalid parameter BT_ERROR_NOT_SUPPORTED Not supported
- Precondition:
- Bluetooth service must be initialized with bt_initialize().
- See also:
- bt_initialize()
int bt_adapter_get_visibility | ( | bt_adapter_visibility_mode_e * | mode, |
int * | duration | ||
) |
Gets the visibility mode of local Bluetooth adapter.
- Since :
- 2.3
- Parameters:
-
[out] mode The visibility mode of the Bluetooth device [out] duration The duration until the visibility mode is changed to BT_ADAPTER_VISIBILITY_MODE_NON_DISCOVERABLE (in seconds). duration is valid only if mode is BT_ADAPTER_VISIBILITY_MODE_LIMITED_DISCOVERABLE. This value can be NULL
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
BT_ERROR_NONE Successful BT_ERROR_NOT_INITIALIZED Not initialized BT_ERROR_INVALID_PARAMETER Invalid parameter BT_ERROR_NOT_ENABLED Not enabled BT_ERROR_OPERATION_FAILED Operation failed BT_ERROR_NOT_SUPPORTED Not supported
- Precondition:
- The state of local Bluetooth must be BT_ADAPTER_ENABLED.
int bt_adapter_is_discovering | ( | bool * | is_discovering | ) |
Checks if the device discovery is in progress or not.
- Since :
- 2.3
- Remarks:
- If Bluetooth discovery is in progress, other operations are not allowed and you have to either stop the discovery operation, or wait for it to be finished, before performing other operations.
- Parameters:
-
[out] is_discovering The discovering status: ( true
= in progress ,false
= not in progress )
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
BT_ERROR_NONE Successful BT_ERROR_NOT_INITIALIZED Not initialized BT_ERROR_INVALID_PARAMETER Invalid parameter BT_ERROR_NOT_ENABLED Not enabled BT_ERROR_OPERATION_FAILED Operation failed BT_ERROR_NOT_SUPPORTED Not supported
- Precondition:
- The state of local Bluetooth must be BT_ADAPTER_ENABLED.
int bt_adapter_is_service_used | ( | const char * | service_uuid, |
bool * | used | ||
) |
Checks whether the UUID of service is used or not.
- Since :
- 2.3
- Parameters:
-
[in] service_uuid The UUID of service [out] used Indicates whether the service is used or not
- Returns:
true
on success, otherwisefalse
-
0
on success, otherwise a negative error value
- Return values:
-
BT_ERROR_NONE Successful BT_ERROR_NOT_INITIALIZED Not initialized BT_ERROR_INVALID_PARAMETER Invalid parameter BT_ERROR_NOT_ENABLED Not enabled BT_ERROR_OPERATION_FAILED Operation failed BT_ERROR_NOT_SUPPORTED Not supported
int bt_adapter_remove_remote_oob_data | ( | const char * | remote_address | ) |
Deletes the Hash and Randomizer value, synchronously.
- Since :
- 2.3
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/bluetooth
- Parameters:
-
[in] remote_address Remote device address
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
BT_ERROR_NONE Successful BT_ERROR_NOT_INITIALIZED Not initialized BT_ERROR_INVALID_PARAMETER Invalid parameter BT_ERROR_NOT_ENABLED Not enabled BT_ERROR_OPERATION_FAILED Operation failed BT_ERROR_PERMISSION_DENIED Permission denied BT_ERROR_NOT_SUPPORTED Not supported
- Precondition:
- The state of local Bluetooth must be BT_ADAPTER_ENABLED.
- The Bluetooth service must be initialized with bt_initialize().
- See also:
- bt_initialize()
int bt_adapter_set_device_discovery_state_changed_cb | ( | bt_adapter_device_discovery_state_changed_cb | callback, |
void * | user_data | ||
) |
Registers a callback function to be invoked when the device discovery state changes.
- Since :
- 2.3
- Parameters:
-
[in] callback The callback function to register [in] user_data The user data to be passed to the callback function
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
BT_ERROR_NONE Successful BT_ERROR_NOT_INITIALIZED Not initialized BT_ERROR_INVALID_PARAMETER Invalid parameter BT_ERROR_NOT_SUPPORTED Not supported
- Precondition:
- The Bluetooth service must be initialized with bt_initialize().
- Postcondition:
- bt_adapter_device_discovery_state_changed_cb() will be invoked.
int bt_adapter_set_name | ( | const char * | local_name | ) |
Sets the name of local Bluetooth adapter.
- Since :
- 2.3
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/bluetooth
- Parameters:
-
[in] local_name The name of the Bluetooth device.
The maximum length is 248 characters
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
BT_ERROR_NONE Successful BT_ERROR_NOT_INITIALIZED Not initialized BT_ERROR_INVALID_PARAMETER Invalid parameter BT_ERROR_NOT_ENABLED Not enabled BT_ERROR_OPERATION_FAILED Operation failed BT_ERROR_PERMISSION_DENIED Permission denied BT_ERROR_NOT_SUPPORTED Not supported
- Precondition:
- The state of local Bluetooth must be BT_ADAPTER_ENABLED.
- Postcondition:
- bt_adapter_name_changed_cb() will be invoked if this function returns BT_ERROR_NONE.
int bt_adapter_set_name_changed_cb | ( | bt_adapter_name_changed_cb | callback, |
void * | user_data | ||
) |
Registers a callback function to be invoked when the name of Bluetooth adapter changes.
- Since :
- 2.3
- Parameters:
-
[in] callback The callback function to invoke [in] user_data The user data to be passed to the callback function
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
BT_ERROR_NONE Successful BT_ERROR_NOT_INITIALIZED Not initialized BT_ERROR_INVALID_PARAMETER Invalid parameter BT_ERROR_NOT_SUPPORTED Not supported
- Precondition:
- The Bluetooth service must be initialized with bt_initialize().
- Postcondition:
- bt_adapter_name_changed_cb() will be invoked.
int bt_adapter_set_remote_oob_data | ( | const char * | remote_address, |
unsigned char * | hash, | ||
unsigned char * | randomizer, | ||
int | hash_len, | ||
int | randomizer_len | ||
) |
Sets the Hash and Randmoizer value, synchronously.
- Since :
- 2.3
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/bluetooth
- Parameters:
-
[in] remote_address Remote device address [in] hash The hash value received from the controller [in] randomizer The randomizer value received from the controller [in] hash_len The length of the hash value. Allowed value is 16 [in] randomizer_len The length of the randomizer value. Allowed value is 16
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
BT_ERROR_NONE Successful BT_ERROR_NOT_INITIALIZED Not initialized BT_ERROR_INVALID_PARAMETER Invalid parameter BT_ERROR_NOT_ENABLED Not enabled BT_ERROR_OPERATION_FAILED Operation failed BT_ERROR_PERMISSION_DENIED Permission denied BT_ERROR_NOT_SUPPORTED Not supported
- Precondition:
- The state of local Bluetooth must be BT_ADAPTER_ENABLED.
- The Bluetooth service must be initialized with bt_initialize().
- See also:
- bt_initialize()
int bt_adapter_set_remote_oob_ext_data | ( | const char * | remote_address, |
const unsigned char * | hash192, | ||
const unsigned char * | randomizer192, | ||
int | hash192_len, | ||
int | randomizer192_len, | ||
const unsigned char * | hash256, | ||
const unsigned char * | randomizer256, | ||
int | hash256_len, | ||
int | randomizer256_len | ||
) |
Sets the Hash and Randmoizer value, synchronously.
- Since :
- 3.0
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/bluetooth
- Parameters:
-
[in] remote_address Remote device address [in] hash192 The P-192 hash value received via OOB from remote device [in] randomizer192 The P-192 randomizer value received via OOB from remote device [in] hash192_len The length of hash192 [in] randomizer192_len The length of randomizer192 [in] hash256 The P-256 hash value received via OOB from remote device [in] randomizer256 The P-256 randomizer value received via OOB from remote device [in] hash256_len The length of hash256 [in] randomizer256_len The length of randomizer256
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
BT_ERROR_NONE Successful BT_ERROR_NOT_INITIALIZED Not initialized BT_ERROR_INVALID_PARAMETER Invalid parameter BT_ERROR_NOT_ENABLED Not enabled BT_ERROR_OPERATION_FAILED Operation failed BT_ERROR_PERMISSION_DENIED Permission denied BT_ERROR_NOT_SUPPORTED Not supported
- Precondition:
- The state of local Bluetooth must be BT_ADAPTER_ENABLED.
- The Bluetooth service must be initialized with bt_initialize().
- See also:
- bt_initialize()
int bt_adapter_set_state_changed_cb | ( | bt_adapter_state_changed_cb | callback, |
void * | user_data | ||
) |
Registers a callback function to be invoked when the Bluetooth adapter state changes.
- Since :
- 2.3
- Parameters:
-
[in] callback The callback function to invoke [in] user_data The user data to be passed to the callback function
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
BT_ERROR_NONE Successful BT_ERROR_NOT_INITIALIZED Not initialized BT_ERROR_INVALID_PARAMETER Invalid parameter BT_ERROR_NOT_SUPPORTED Not supported
- Precondition:
- The Bluetooth service must be initialized with bt_initialize().
- Postcondition:
- bt_adapter_state_changed_cb() will be invoked.
int bt_adapter_set_visibility_duration_changed_cb | ( | bt_adapter_visibility_duration_changed_cb | callback, |
void * | user_data | ||
) |
Registers a callback function to be invoked every second. Until the visibility mode is changed from BT_ADAPTER_VISIBILITY_MODE_LIMITED_DISCOVERABLE to BT_ADAPTER_VISIBILITY_MODE_NON_DISCOVERABLE.
When you set visibility mode as BT_ADAPTER_VISIBILITY_MODE_LIMITED_DISCOVERABLE, callback will be called every second until visibility mode is changed to BT_ADAPTER_VISIBILITY_MODE_NON_DISCOVERABLE.
- Since :
- 2.3
- Parameters:
-
[in] callback The callback function to register [in] user_data The user data to be passed to the callback function
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
BT_ERROR_NONE Successful BT_ERROR_NOT_INITIALIZED Not initialized BT_ERROR_INVALID_PARAMETER Invalid parameter BT_ERROR_NOT_SUPPORTED Not supported
- Precondition:
- The Bluetooth service must be initialized by bt_initialize().
- Postcondition:
- bt_adapter_visibility_duration_changed_cb() will be invoked.
int bt_adapter_set_visibility_mode_changed_cb | ( | bt_adapter_visibility_mode_changed_cb | callback, |
void * | user_data | ||
) |
Registers a callback function to be invoked when the visibility mode changes.
- Since :
- 2.3
- Parameters:
-
[in] callback The callback function to register [in] user_data The user data to be passed to the callback function
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
BT_ERROR_NONE Successful BT_ERROR_NOT_INITIALIZED Not initialized BT_ERROR_INVALID_PARAMETER Invalid parameter BT_ERROR_NOT_SUPPORTED Not supported
- Precondition:
- The Bluetooth service must be initialized with bt_initialize().
- Postcondition:
- bt_adapter_visibility_mode_changed_cb() will be invoked.
int bt_adapter_start_device_discovery | ( | void | ) |
Starts the device discovery, asynchronously.
If a device is discovered, bt_adapter_device_discovery_state_changed_cb() will be invoked with BT_ADAPTER_DEVICE_DISCOVERY_FOUND, and then bt_adapter_device_discovery_state_changed_cb() will be called with BT_ADAPTER_DEVICE_DISCOVERY_FINISHED in case of the completion or cancellation of the discovery.
- Since :
- 2.3
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/bluetooth
- Remarks:
- To connect to peer Bluetooth device, you need to know its Bluetooth address.
The device discovery can be stopped by bt_adapter_stop_device_discovery().
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
BT_ERROR_NONE Successful BT_ERROR_NOT_INITIALIZED Not initialized BT_ERROR_NOT_ENABLED Not enabled BT_ERROR_NOW_IN_PROGRESS Operation is now in progress BT_ERROR_OPERATION_FAILED Operation failed BT_ERROR_PERMISSION_DENIED Permission denied BT_ERROR_NOT_SUPPORTED Not supported
- Precondition:
- The state of local Bluetooth must be BT_ADAPTER_ENABLED.
- Postcondition:
- This function invokes bt_adapter_device_discovery_state_changed_cb().
int bt_adapter_stop_device_discovery | ( | void | ) |
Stops the device discovery, asynchronously.
- Since :
- 2.3
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/bluetooth
- Remarks:
- The device discovery process will take 10 ~ 20 seconds to get all the devices in vicinity.
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
BT_ERROR_NONE Successful BT_ERROR_NOT_INITIALIZED Not initialized BT_ERROR_NOT_ENABLED Not enabled BT_ERROR_NOT_IN_PROGRESS Operation is not in progress BT_ERROR_OPERATION_FAILED Operation failed BT_ERROR_PERMISSION_DENIED Permission denied BT_ERROR_NOT_SUPPORTED Not supported
- Precondition:
- The device discovery must be in progress with bt_adapter_start_device_discovery().
- Postcondition:
- This function invokes bt_adapter_device_discovery_state_changed_cb().
int bt_adapter_unset_device_discovery_state_changed_cb | ( | void | ) |
Unregisters the callback function.
- Since :
- 2.3
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
BT_ERROR_NONE Successful BT_ERROR_NOT_INITIALIZED Not initialized BT_ERROR_NOT_SUPPORTED Not supported
- Precondition:
- The Bluetooth service must be initialized with bt_initialize().
int bt_adapter_unset_name_changed_cb | ( | void | ) |
Unregisters the callback function.
- Since :
- 2.3
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
BT_ERROR_NONE Successful BT_ERROR_NOT_INITIALIZED Not initialized BT_ERROR_NOT_SUPPORTED Not supported
- Precondition:
- The Bluetooth service must be initialized with bt_initialize().
int bt_adapter_unset_state_changed_cb | ( | void | ) |
Unregisters the callback function.
- Since :
- 2.3
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
BT_ERROR_NONE Successful BT_ERROR_NOT_INITIALIZED Not initialized BT_ERROR_NOT_SUPPORTED Not supported
- Precondition:
- The Bluetooth service must be initialized with bt_initialize().
int bt_adapter_unset_visibility_duration_changed_cb | ( | void | ) |
Unregisters the callback function.
- Since :
- 2.3
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
BT_ERROR_NONE Successful BT_ERROR_NOT_INITIALIZED Not initialized BT_ERROR_NOT_SUPPORTED Not supported
- Precondition:
- The Bluetooth service must be initialized with bt_initialize().
int bt_adapter_unset_visibility_mode_changed_cb | ( | void | ) |
Unregisters the callback function.
- Since :
- 2.3
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
BT_ERROR_NONE Successful BT_ERROR_NOT_INITIALIZED Not initialized BT_ERROR_NOT_SUPPORTED Not supported
- Precondition:
- The Bluetooth service must be initialized with bt_initialize().