Tizen Native API
3.0
|
Bluetooth LE API provides functions for managing bonds with other devices for LE and searching for supported LE services.
Required Header
#include <bluetooth.h>
Overview
Bluetooth stack architecture has been changed. Thus, GATT APIs defined in Tizen 2.3 are deprecated and new GATT client APIs are defined.
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.
Functions | |
int | bt_adapter_le_start_device_discovery (void) |
Starts the LE device discovery. | |
int | bt_adapter_le_stop_device_discovery (void) |
Stops the LE device discovery, asynchronously. | |
int | bt_adapter_le_is_discovering (bool *is_discovering) |
Checks if the LE device discovery is in progress or not. | |
int | bt_adapter_le_set_device_discovery_state_changed_cb (bt_adapter_le_device_discovery_state_changed_cb callback, void *user_data) |
Registers a callback function to be invoked when the LE device discovery state changes. | |
int | bt_adapter_le_unset_device_discovery_state_changed_cb (void) |
Unregisters the callback function. | |
int | bt_adapter_le_start_scan (bt_adapter_le_scan_result_cb cb, void *user_data) |
Starts the LE scan to find LE advertisement. | |
int | bt_adapter_le_stop_scan (void) |
Stops the LE scan. | |
int | bt_adapter_le_get_scan_result_service_uuids (const bt_adapter_le_device_scan_result_info_s *info, bt_adapter_le_packet_type_e pkt_type, char ***uuids, int *count) |
Gets the service UUID list from the scan result information. | |
int | bt_adapter_le_get_scan_result_device_name (const bt_adapter_le_device_scan_result_info_s *info, bt_adapter_le_packet_type_e pkt_type, char **name) |
Gets the device name from the scan result information. | |
int | bt_adapter_le_get_scan_result_tx_power_level (const bt_adapter_le_device_scan_result_info_s *info, bt_adapter_le_packet_type_e pkt_type, int *power_level) |
Gets the transmission power level from the scan result information. | |
int | bt_adapter_le_get_scan_result_service_solicitation_uuids (const bt_adapter_le_device_scan_result_info_s *info, bt_adapter_le_packet_type_e pkt_type, char ***uuids, int *count) |
Gets the service solicitation UUID list from the scan result information. | |
int | bt_adapter_le_get_scan_result_service_data_list (const bt_adapter_le_device_scan_result_info_s *info, bt_adapter_le_packet_type_e pkt_type, bt_adapter_le_service_data_s **data_list, int *count) |
Gets the service data list from the scan result information. | |
int | bt_adapter_le_free_service_data_list (bt_adapter_le_service_data_s *data_list, int count) |
Frees service data list. | |
int | bt_adapter_le_get_scan_result_appearance (const bt_adapter_le_device_scan_result_info_s *info, bt_adapter_le_packet_type_e pkt_type, int *appearance) |
Gets the appearance from the scan result information. | |
int | bt_adapter_le_get_scan_result_manufacturer_data (const bt_adapter_le_device_scan_result_info_s *info, bt_adapter_le_packet_type_e pkt_type, int *manufacturer_id, char **manufacturer_data, int *manufacturer_data_len) |
Gets the manufacturer data from the scan result information. | |
int | bt_adapter_le_create_advertiser (bt_advertiser_h *advertiser) |
Creates advertiser to advertise device's existence or respond to LE scanning request. | |
int | bt_adapter_le_destroy_advertiser (bt_advertiser_h advertiser) |
Destroys advertiser. | |
int | bt_adapter_le_add_advertising_data (bt_advertiser_h advertiser, bt_adapter_le_packet_type_e pkt_type, bt_adapter_le_packet_data_type_e data_type, void *data, unsigned int data_size) |
Sets the data to be advertised or responded to scan request from LE scanning device. The maximum advertised or responded data size is 31 bytes including data type and system wide data. | |
int | bt_adapter_le_add_advertising_service_uuid (bt_advertiser_h advertiser, bt_adapter_le_packet_type_e pkt_type, const char *uuid) |
Adds a service UUID to advertise or scan response data. The maximum advertised or responded data size is 31 bytes including data type and system wide data. | |
int | bt_adapter_le_add_advertising_service_solicitation_uuid (bt_advertiser_h advertiser, bt_adapter_le_packet_type_e pkt_type, const char *uuid) |
Adds a service solicitation UUID to advertise or scan response data. The maximum advertised or responded data size is 31 bytes including data type and system wide data. | |
int | bt_adapter_le_add_advertising_service_data (bt_advertiser_h advertiser, bt_adapter_le_packet_type_e pkt_type, const char *uuid, const char *service_data, int service_data_len) |
Adds service data to advertise or scan response data. The maximum advertised or responded data size is 31 bytes including data type and system wide data. | |
int | bt_adapter_le_set_advertising_appearance (bt_advertiser_h advertiser, bt_adapter_le_packet_type_e pkt_type, int appearance) |
Sets the external appearance of this device to advertise or scan response data. Please refer to the adopted Bluetooth specification for the the appearance. | |
int | bt_adapter_le_add_advertising_manufacturer_data (bt_advertiser_h advertiser, bt_adapter_le_packet_type_e pkt_type, int manufacturer_id, const char *manufacturer_data, int manufacturer_data_len) |
Adds manufacturer specific data to advertise or scan response data. Please refer to the Bluetooth Assigned Numbers provided by the Bluetooth SIG for a list of existing company identifiers. The maximum advertised or responded data size is 31 bytes including data type and system wide data. | |
int | bt_adapter_le_set_advertising_device_name (bt_advertiser_h advertiser, bt_adapter_le_packet_type_e pkt_type, bool include_name) |
Sets whether the device name should be included in advertise or scan response data. The maximum advertised or responded data size is 31 bytes including data type and system wide data. | |
int | bt_adapter_le_set_advertising_tx_power_level (bt_advertiser_h advertiser, bt_adapter_le_packet_type_e pkt_type, bool include_tx_power) |
Sets whether the transmission power level should be included in advertise or scan response data. The maximum advertised or responded data size is 31 bytes including data type and system wide data. | |
int | bt_adapter_le_remove_advertising_data (bt_advertiser_h advertiser, bt_adapter_le_packet_type_e pkt_type, bt_adapter_le_packet_data_type_e data_type) |
Unsets the data to be advertised or responded to scan request from LE scanning device. | |
int | bt_adapter_le_clear_advertising_data (bt_advertiser_h advertiser, bt_adapter_le_packet_type_e pkt_type) |
Clears all data to be advertised or responded to scan request from LE scanning device. | |
int | bt_adapter_le_start_advertising (bt_advertiser_h advertiser, bt_adapter_le_advertising_params_s *adv_params, bt_adapter_le_advertising_state_changed_cb cb, void *user_data) |
Starts advertising with passed advertiser and advertising parameters. | |
int | bt_adapter_le_stop_advertising (bt_advertiser_h advertiser) |
Stops the advertising. | |
int | bt_adapter_le_start_advertising_new (bt_advertiser_h advertiser, bt_adapter_le_advertising_state_changed_cb cb, void *user_data) |
Starts advertising with passed advertiser and advertising parameters. | |
int | bt_adapter_le_set_advertising_mode (bt_advertiser_h advertiser, bt_adapter_le_advertising_mode_e mode) |
Sets advertising mode to control the advertising power and latency. | |
int | bt_adapter_le_set_advertising_connectable (bt_advertiser_h advertiser, bool connectable) |
Sets whether the advertising type should be connectable or non-connectable. | |
int | bt_adapter_le_set_scan_mode (bt_adapter_le_scan_mode_e scan_mode) |
Sets Bluetooth LE scan mode. | |
Typedefs | |
typedef void * | bt_advertiser_h |
The handle to control Bluetooth LE advertising. | |
typedef void * | bt_gatt_h |
The handle of a service, characteristic or descriptor. | |
typedef void * | bt_gatt_client_h |
The handle of a GATT client which is associated with a remote device. | |
typedef void(* | bt_adapter_le_device_discovery_state_changed_cb )(int result, bt_adapter_le_device_discovery_state_e discovery_state, bt_adapter_le_device_discovery_info_s *discovery_info, void *user_data) |
Called when the state of LE device discovery changes. | |
typedef void(* | bt_adapter_le_scan_result_cb )(int result, bt_adapter_le_device_scan_result_info_s *info, void *user_data) |
Called when the LE advertisement has been found. | |
typedef void(* | bt_adapter_le_advertising_state_changed_cb )(int result, bt_advertiser_h advertiser, bt_adapter_le_advertising_state_e adv_state, void *user_data) |
Called when the state of advertiser changes. |
Typedef Documentation
typedef void(* bt_adapter_le_advertising_state_changed_cb)(int result, bt_advertiser_h advertiser, bt_adapter_le_advertising_state_e adv_state, void *user_data) |
Called when the state of advertiser changes.
- Since :
- 2.3
- Parameters:
-
[out] result The result of the requested state change of advertiser [out] advertiser The handle of the state changed advertiser [out] adv_state The advertiser state to be changed [out] user_data The user data passed from the start function
typedef void(* bt_adapter_le_device_discovery_state_changed_cb)(int result, bt_adapter_le_device_discovery_state_e discovery_state, bt_adapter_le_device_discovery_info_s *discovery_info, void *user_data) |
Called when the state of LE device discovery changes.
- Deprecated:
- Deprecated since 2.3.1
- Since :
- 2.3
- Remarks:
- If discovery_state is BT_ADAPTER_LE_DEVICE_DISCOVERY_FOUND, then you can get some information, such as remote LE device address, remote device name, rssi, and bonding state.
- Parameters:
-
[in] result The result of the LE device discovery [in] discovery_state The discovery state to be changed [in] discovery_info The information of the discovered LE device
If discovery_state is BT_ADAPTER_LE_DEVICE_DISCOVERY_STARTED or BT_ADAPTER_LE_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_le_scan_result_cb)(int result, bt_adapter_le_device_scan_result_info_s *info, void *user_data) |
Called when the LE advertisement has been found.
- Since :
- 2.3.1
- Parameters:
-
[in] result The result of the LE scan [in] info The information of the found LE advertisement. [in] user_data The user data passed from the start function
- See also:
- bt_adapter_le_start_scan()
typedef void* bt_advertiser_h |
The handle to control Bluetooth LE advertising.
- Since :
- 2.3
typedef void* bt_gatt_client_h |
The handle of a GATT client which is associated with a remote device.
- Since :
- 2.3.1
typedef void* bt_gatt_h |
The handle of a service, characteristic or descriptor.
- Since :
- 2.3.1
Enumeration Type Documentation
Enumerations of the Bluetooth advertising filter policy.
- Since :
- 2.3
- Enumerator:
Enumerations of the Bluetooth advertising type.
- Deprecated:
- Deprecated since 2.3.1
- Since :
- 2.3
- Enumerator:
Enumerations of the discovery state of Bluetooth LE device.
- Deprecated:
- Deprecated since 2.3.1
- Since :
- 2.3
Enumerations of the Bluetooth LE data type that can be included in LE packets.
- Deprecated:
- Deprecated since 2.3.1
- Since :
- 2.3
Enumerations of the Bluetooth le scan mode.
- Since :
- 3.0
Function Documentation
int bt_adapter_le_add_advertising_data | ( | bt_advertiser_h | advertiser, |
bt_adapter_le_packet_type_e | pkt_type, | ||
bt_adapter_le_packet_data_type_e | data_type, | ||
void * | data, | ||
unsigned int | data_size | ||
) |
Sets the data to be advertised or responded to scan request from LE scanning device. The maximum advertised or responded data size is 31 bytes including data type and system wide data.
- Deprecated:
- Deprecated since 2.3.1
- Since :
- 2.3
- Remarks:
- In case the data_type is local name or tx power level, you don't need to input data because the data value is written automatically by system.
- Parameters:
-
[in] advertiser The handle of advertiser [in] pkt_type The packet type [in] data_type The data type that is included in packet [in] data The data to be advertised or be responded to scan request from LE scanning device, no need in case of LOCAL_NAME or TX_POWER_LEVEL [in] data_size The size of data to be set
- 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_QUOTA_EXCEEDED Quota exceeded BT_ERROR_OPERATION_FAILED Operation failed BT_ERROR_NOT_SUPPORTED Not supported
- Precondition:
- The Bluetooth service must be initialized with bt_initialize().
int bt_adapter_le_add_advertising_manufacturer_data | ( | bt_advertiser_h | advertiser, |
bt_adapter_le_packet_type_e | pkt_type, | ||
int | manufacturer_id, | ||
const char * | manufacturer_data, | ||
int | manufacturer_data_len | ||
) |
Adds manufacturer specific data to advertise or scan response data. Please refer to the Bluetooth Assigned Numbers provided by the Bluetooth SIG for a list of existing company identifiers. The maximum advertised or responded data size is 31 bytes including data type and system wide data.
- Since :
- 2.3.1
- Parameters:
-
[in] advertiser The handle of advertiser [in] pkt_type The packet type [in] manufacturer_id Manufacturer identifier [in] manufacturer_data The manufacturer specific data [in] manufacturer_data_len The data length of manufacturer data
- 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_QUOTA_EXCEEDED Quota exceeded BT_ERROR_OPERATION_FAILED Operation failed BT_ERROR_NOT_SUPPORTED Not supported
- Precondition:
- The Bluetooth service must be initialized with bt_initialize().
int bt_adapter_le_add_advertising_service_data | ( | bt_advertiser_h | advertiser, |
bt_adapter_le_packet_type_e | pkt_type, | ||
const char * | uuid, | ||
const char * | service_data, | ||
int | service_data_len | ||
) |
Adds service data to advertise or scan response data. The maximum advertised or responded data size is 31 bytes including data type and system wide data.
- Since :
- 2.3.1
- Remarks:
- 16-bit UUID is supported (e.g. 180F)
- Parameters:
-
[in] advertiser The handle of advertiser [in] pkt_type The packet type [in] uuid 16-bit UUID of the service [in] service_data The service data [in] service_data_len The data length of service data
- 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_QUOTA_EXCEEDED Quota exceeded BT_ERROR_OPERATION_FAILED Operation failed BT_ERROR_NOT_SUPPORTED Not supported
- Precondition:
- The Bluetooth service must be initialized with bt_initialize().
int bt_adapter_le_add_advertising_service_solicitation_uuid | ( | bt_advertiser_h | advertiser, |
bt_adapter_le_packet_type_e | pkt_type, | ||
const char * | uuid | ||
) |
Adds a service solicitation UUID to advertise or scan response data. The maximum advertised or responded data size is 31 bytes including data type and system wide data.
- Since :
- 2.3.1
- Remarks:
- 16-bit service solicitation UUID or 128-bit service solicitation UUID is supported (e.g. 180F, 0000180F-0000-1000-8000-00805F9B34FB)
- Parameters:
-
[in] advertiser The handle of advertiser [in] pkt_type The packet type [in] uuid The string of the service solicitation UUID
- 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_QUOTA_EXCEEDED Quota exceeded BT_ERROR_OPERATION_FAILED Operation failed BT_ERROR_NOT_SUPPORTED Not supported
- Precondition:
- The Bluetooth service must be initialized with bt_initialize().
int bt_adapter_le_add_advertising_service_uuid | ( | bt_advertiser_h | advertiser, |
bt_adapter_le_packet_type_e | pkt_type, | ||
const char * | uuid | ||
) |
Adds a service UUID to advertise or scan response data. The maximum advertised or responded data size is 31 bytes including data type and system wide data.
- Since :
- 2.3.1
- Remarks:
- 16-bit UUID or 128-bit UUID is supported. (e.g. 180F, 0000180F-0000-1000-8000-00805F9B34FB)
- Parameters:
-
[in] advertiser The handle of advertiser [in] pkt_type The packet type [in] uuid The string of the service UUID
- 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_QUOTA_EXCEEDED Quota exceeded BT_ERROR_OPERATION_FAILED Operation failed BT_ERROR_NOT_SUPPORTED Not supported
- Precondition:
- The Bluetooth service must be initialized with bt_initialize().
int bt_adapter_le_clear_advertising_data | ( | bt_advertiser_h | advertiser, |
bt_adapter_le_packet_type_e | pkt_type | ||
) |
Clears all data to be advertised or responded to scan request from LE scanning device.
- Since :
- 2.3
- Parameters:
-
[in] advertiser The handle of advertiser [in] pkt_type The packet type to be cleared
- 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().
- See also:
- bt_adapter_le_add_advertising_data()
int bt_adapter_le_create_advertiser | ( | bt_advertiser_h * | advertiser | ) |
Creates advertiser to advertise device's existence or respond to LE scanning request.
- Since :
- 2.3
- Parameters:
-
[out] advertiser The handle of advertiser
- 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_SUPPORTED Not supported
- Precondition:
- The Bluetooth service must be initialized with bt_initialize().
- See also:
- bt_adapter_le_destroy_advertiser()
int bt_adapter_le_destroy_advertiser | ( | bt_advertiser_h | advertiser | ) |
Destroys advertiser.
- Since :
- 2.3
- Parameters:
-
[out] advertiser The handle of advertiser
- 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().
- See also:
- bt_adapter_le_create_advertiser()
int bt_adapter_le_free_service_data_list | ( | bt_adapter_le_service_data_s * | data_list, |
int | count | ||
) |
Frees service data list.
- Since :
- 2.3.1
- Parameters:
-
[in] data_list The list of the service data [in] count The count of the service data list
- 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
int bt_adapter_le_get_scan_result_appearance | ( | const bt_adapter_le_device_scan_result_info_s * | info, |
bt_adapter_le_packet_type_e | pkt_type, | ||
int * | appearance | ||
) |
Gets the appearance from the scan result information.
- Since :
- 2.3.1
- Parameters:
-
[in] info The scan result information [in] pkt_type The packet type [out] appearance The appearance
- 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_NO_DATA No data available BT_ERROR_NOT_SUPPORTED Not supported
- Precondition:
- The Bluetooth service must be initialized with bt_initialize().
- See also:
- bt_adapter_le_scan_result_cb()
int bt_adapter_le_get_scan_result_device_name | ( | const bt_adapter_le_device_scan_result_info_s * | info, |
bt_adapter_le_packet_type_e | pkt_type, | ||
char ** | name | ||
) |
Gets the device name from the scan result information.
- Since :
- 2.3.1
- Remarks:
- The name must be released with free() by you.
- Parameters:
-
[in] info The scan result information [in] pkt_type The packet type [out] name The 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_NO_DATA No data available BT_ERROR_NOT_SUPPORTED Not supported
- Precondition:
- The Bluetooth service must be initialized with bt_initialize().
- See also:
- bt_adapter_le_scan_result_cb()
int bt_adapter_le_get_scan_result_manufacturer_data | ( | const bt_adapter_le_device_scan_result_info_s * | info, |
bt_adapter_le_packet_type_e | pkt_type, | ||
int * | manufacturer_id, | ||
char ** | manufacturer_data, | ||
int * | manufacturer_data_len | ||
) |
Gets the manufacturer data from the scan result information.
- Since :
- 2.3.1
- Remarks:
- The manufacturer_data must be released with free() by you.
- Parameters:
-
[in] info The scan result information [in] pkt_type The packet type [out] manufacturer_id The manufacturer ID [out] manufacturer_data The manufacturer data (byte array) [out] manufacturer_data_len The length of manufacturer data
- 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_NO_DATA No data available BT_ERROR_NOT_SUPPORTED Not supported
- Precondition:
- The Bluetooth service must be initialized with bt_initialize().
- See also:
- bt_adapter_le_scan_result_cb()
int bt_adapter_le_get_scan_result_service_data_list | ( | const bt_adapter_le_device_scan_result_info_s * | info, |
bt_adapter_le_packet_type_e | pkt_type, | ||
bt_adapter_le_service_data_s ** | data_list, | ||
int * | count | ||
) |
Gets the service data list from the scan result information.
- Since :
- 2.3.1
- Remarks:
- The data_list must be released with bt_adapter_le_free_service_data_list() by you.
- Parameters:
-
[in] info The scan result information [in] pkt_type The packet type [out] data_list The list of the service data [out] count The count of the service data list
- 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_NO_DATA No data available BT_ERROR_NOT_SUPPORTED Not supported
- Precondition:
- The Bluetooth service must be initialized with bt_initialize().
- See also:
- bt_adapter_le_scan_result_cb()
int bt_adapter_le_get_scan_result_service_solicitation_uuids | ( | const bt_adapter_le_device_scan_result_info_s * | info, |
bt_adapter_le_packet_type_e | pkt_type, | ||
char *** | uuids, | ||
int * | count | ||
) |
Gets the service solicitation UUID list from the scan result information.
- Since :
- 2.3.1
- Remarks:
- The uuids must be iterated as count and each pointed data must be released with free(). Then UUIDs must be released with free().
16-bit service solicitation UUID or 128-bit service solicitation UUID is supported. (e.g. 180F, 0000180F-0000-1000-8000-00805F9B34FB).
- Parameters:
-
[in] info The scan result information [in] pkt_type The packet type [out] uuids The list of string of the service solicitation UUID [out] count The count of the service UUIDs
- 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_NO_DATA No data available BT_ERROR_NOT_SUPPORTED Not supported
- Precondition:
- The Bluetooth service must be initialized with bt_initialize().
- See also:
- bt_adapter_le_scan_result_cb()
int bt_adapter_le_get_scan_result_service_uuids | ( | const bt_adapter_le_device_scan_result_info_s * | info, |
bt_adapter_le_packet_type_e | pkt_type, | ||
char *** | uuids, | ||
int * | count | ||
) |
Gets the service UUID list from the scan result information.
- Since :
- 2.3.1
- Remarks:
- The uuids must be iterated as count and each pointed data must be released with free(). Then UUIDs must be released with free().
16-bit service UUID or 128-bit service UUID is supported. (e.g. 180F, 0000180F-0000-1000-8000-00805F9B34FB).
- Parameters:
-
[in] info The scan result information [in] pkt_type The packet type [out] uuids The list of string of the service UUID [out] count The count of the service UUIDs
- 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_NO_DATA No data available BT_ERROR_NOT_SUPPORTED Not supported
- Precondition:
- The Bluetooth service must be initialized with bt_initialize().
- See also:
- bt_adapter_le_scan_result_cb()
int bt_adapter_le_get_scan_result_tx_power_level | ( | const bt_adapter_le_device_scan_result_info_s * | info, |
bt_adapter_le_packet_type_e | pkt_type, | ||
int * | power_level | ||
) |
Gets the transmission power level from the scan result information.
- Since :
- 2.3.1
- Parameters:
-
[in] info The scan result information [in] pkt_type The packet type [out] power_level The transmission power level in dBm
- 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_NO_DATA No data available BT_ERROR_NOT_SUPPORTED Not supported
- Precondition:
- The Bluetooth service must be initialized with bt_initialize().
- See also:
- bt_adapter_le_scan_result_cb()
int bt_adapter_le_is_discovering | ( | bool * | is_discovering | ) |
Checks if the LE device discovery is in progress or not.
- Deprecated:
- Deprecated since 2.3.1
- Since :
- 2.3
- Remarks:
- If Bluetooth LE discovery is in progress, other operations are not allowed and you have to either stop the LE 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_le_remove_advertising_data | ( | bt_advertiser_h | advertiser, |
bt_adapter_le_packet_type_e | pkt_type, | ||
bt_adapter_le_packet_data_type_e | data_type | ||
) |
Unsets the data to be advertised or responded to scan request from LE scanning device.
- Deprecated:
- Deprecated since 2.3.1
- Since :
- 2.3
- Parameters:
-
[in] advertiser The handle of advertiser [in] pkt_type The packet type [in] data_type The data type to be removed from selected packet
- 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_OPERATION_FAILED Operation failed BT_ERROR_NOT_SUPPORTED Not supported
- Precondition:
- The Bluetooth service must be initialized with bt_initialize().
int bt_adapter_le_set_advertising_appearance | ( | bt_advertiser_h | advertiser, |
bt_adapter_le_packet_type_e | pkt_type, | ||
int | appearance | ||
) |
Sets the external appearance of this device to advertise or scan response data. Please refer to the adopted Bluetooth specification for the the appearance.
- Since :
- 2.3.1
- Parameters:
-
[in] advertiser The handle of advertiser [in] pkt_type The packet type [in] appearance The external appearance of device
- 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_QUOTA_EXCEEDED Quota exceeded BT_ERROR_OPERATION_FAILED Operation failed BT_ERROR_NOT_SUPPORTED Not supported
- Precondition:
- The Bluetooth service must be initialized with bt_initialize().
int bt_adapter_le_set_advertising_connectable | ( | bt_advertiser_h | advertiser, |
bool | connectable | ||
) |
Sets whether the advertising type should be connectable or non-connectable.
- Since :
- 2.3.1
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/bluetooth
- Parameters:
-
[in] advertiser The handle of advertiser [in] connectable The type of advertising
- 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_NOW_IN_PROGRESS Operation is now in progress BT_ERROR_PERMISSION_DENIED Permission denied BT_ERROR_NOT_SUPPORTED Not supported
- Precondition:
- The Bluetooth service must be initialized with bt_initialize().
int bt_adapter_le_set_advertising_device_name | ( | bt_advertiser_h | advertiser, |
bt_adapter_le_packet_type_e | pkt_type, | ||
bool | include_name | ||
) |
Sets whether the device name should be included in advertise or scan response data. The maximum advertised or responded data size is 31 bytes including data type and system wide data.
- Since :
- 2.3.1
- Parameters:
-
[in] advertiser The handle of advertiser [in] pkt_type The packet type [in] include_name Whether the device name should be included
- 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_QUOTA_EXCEEDED Quota exceeded BT_ERROR_OPERATION_FAILED Operation failed BT_ERROR_NOT_SUPPORTED Not supported
- Precondition:
- The Bluetooth service must be initialized with bt_initialize().
int bt_adapter_le_set_advertising_mode | ( | bt_advertiser_h | advertiser, |
bt_adapter_le_advertising_mode_e | mode | ||
) |
Sets advertising mode to control the advertising power and latency.
- Since :
- 2.3.1
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/bluetooth
- Parameters:
-
[in] advertiser The handle of advertiser [in] mode The mode of advertising
- 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_NOW_IN_PROGRESS Operation is now in progress BT_ERROR_PERMISSION_DENIED Permission denied BT_ERROR_NOT_SUPPORTED Not supported
- Precondition:
- The Bluetooth service must be initialized with bt_initialize().
int bt_adapter_le_set_advertising_tx_power_level | ( | bt_advertiser_h | advertiser, |
bt_adapter_le_packet_type_e | pkt_type, | ||
bool | include_tx_power | ||
) |
Sets whether the transmission power level should be included in advertise or scan response data. The maximum advertised or responded data size is 31 bytes including data type and system wide data.
- Since :
- 2.3.1
- Parameters:
-
[in] advertiser The handle of advertiser [in] pkt_type The packet type [in] include_tx_power Whether the transmission power level should be included
- 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_QUOTA_EXCEEDED Quota exceeded BT_ERROR_OPERATION_FAILED Operation failed BT_ERROR_NOT_SUPPORTED Not supported
- Precondition:
- The Bluetooth service must be initialized with bt_initialize().
int bt_adapter_le_set_device_discovery_state_changed_cb | ( | bt_adapter_le_device_discovery_state_changed_cb | callback, |
void * | user_data | ||
) |
Registers a callback function to be invoked when the LE device discovery state changes.
- Deprecated:
- Deprecated since 2.3.1
- 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_le_device_discovery_state_changed_cb() will be invoked.
int bt_adapter_le_set_scan_mode | ( | bt_adapter_le_scan_mode_e | scan_mode | ) |
Sets Bluetooth LE scan mode.
- Since :
- 3.0
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/bluetooth
- Parameters:
-
[in] scan_mode The scan mode
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
BT_ERROR_NONE Successful BT_ERROR_NOT_ENABLED Adapter is not enabled BT_ERROR_INVALID_PARAMETER Parameter is invalid 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_le_start_advertising | ( | bt_advertiser_h | advertiser, |
bt_adapter_le_advertising_params_s * | adv_params, | ||
bt_adapter_le_advertising_state_changed_cb | cb, | ||
void * | user_data | ||
) |
Starts advertising with passed advertiser and advertising parameters.
- Deprecated:
- Deprecated since 2.3.1
Once Bluetooth advertising is started, nearby Bluetooth LE(Low Energy) supported devices can know this device's existence. And one of them can make a connection request, if it is allowed.
- Since :
- 2.3
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/bluetooth
- Parameters:
-
[in] advertiser The handle of advertiser [in] adv_params The parameters of advertising
If NULL is passed, default values which are defined in driver / controller are used[in] cb The callback to report the result of this function [in] user_data The user data to be passed when callback is called
- 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_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 Bluetooth service must be initialized with bt_initialize().
- Postcondition:
- This function invokes bt_adapter_le_advertising_state_changed_cb().
int bt_adapter_le_start_advertising_new | ( | bt_advertiser_h | advertiser, |
bt_adapter_le_advertising_state_changed_cb | cb, | ||
void * | user_data | ||
) |
Starts advertising with passed advertiser and advertising parameters.
Once Bluetooth advertising is started, nearby Bluetooth LE(Low Energy) supported devices can know this device's existence. And one of them can make a connection request, if it is allowed.
- Since :
- 2.3.1
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/bluetooth
- Parameters:
-
[in] advertiser The handle of advertiser [in] cb The callback to report the result of this function [in] user_data The user data to be passed when callback is called
- 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_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 Bluetooth service must be initialized with bt_initialize().
- Postcondition:
- This function invokes bt_adapter_le_advertising_state_changed_cb().
int bt_adapter_le_start_device_discovery | ( | void | ) |
Starts the LE device discovery.
- Deprecated:
- Deprecated since 2.3.1
If a LE device is discovered, bt_adapter_le_device_discovery_state_changed_cb() will be invoked with BT_ADAPTER_LE_DEVICE_DISCOVERY_FOUND, and then bt_adapter_le_device_discovery_state_changed_cb() will be called with BT_ADAPTER_LE_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_le_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_le_device_discovery_state_changed_cb().
int bt_adapter_le_start_scan | ( | bt_adapter_le_scan_result_cb | cb, |
void * | user_data | ||
) |
Starts the LE scan to find LE advertisement.
If a LE advertisement is found, bt_adapter_le_scan_result_cb() will be invoked.
- Since :
- 2.3.1
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/bluetooth
- Parameters:
-
[in] cb The callback to report the result of this function [in] user_data The user data to be passed when callback is called
- 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_le_scan_result_cb().
- See also:
- bt_adapter_le_scan_result_cb()
int bt_adapter_le_stop_advertising | ( | bt_advertiser_h | advertiser | ) |
Stops the advertising.
- Since :
- 2.3
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/bluetooth
- Parameters:
-
[in] advertiser The handle of advertiser
- 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_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 advertising must be going on with bt_adapter_le_start_advertising_new().
- Postcondition:
- This function invokes bt_adapter_le_advertising_state_changed_cb().
int bt_adapter_le_stop_device_discovery | ( | void | ) |
Stops the LE device discovery, asynchronously.
- Deprecated:
- Deprecated since 2.3.1
- Since :
- 2.3
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/bluetooth
- 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_le_start_device_discovery().
- Postcondition:
- This function invokes bt_adapter_le_device_discovery_state_changed_cb().
int bt_adapter_le_stop_scan | ( | void | ) |
Stops the LE scan.
- Since :
- 2.3.1
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/bluetooth
- 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 LE scan must be in progress with bt_adapter_le_start_scan().
- See also:
- bt_adapter_le_start_scan()
Unregisters the callback function.
- Deprecated:
- Deprecated since 2.3.1
- 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().