Tizen Native API
5.5
|
Bluetooth LE API provides functions for managing bonds with other devices for LE and searching for supported LE services.
#include <bluetooth.h>
Bluetooth stack architecture has been changed. Thus, GATT APIs defined in Tizen 2.3 are deprecated and new GATT client APIs are defined.
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_is_discovering (bool *is_discovering) |
Checks for the LE device discovery is in progress or not. | |
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_get_scan_result_ibeacon_report (const bt_adapter_le_device_scan_result_info_s *info, bt_adapter_le_packet_type_e pkt_type, bt_adapter_le_ibeacon_scan_result_info_s **ibeacon_info) |
Gets iBeacon format's data from the scan result information. | |
int | bt_adapter_le_free_ibeacon_report (bt_adapter_le_ibeacon_scan_result_info_s *ibeacon_info) |
Frees iBeacon 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_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_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_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. | |
int | bt_adapter_le_scan_filter_create (bt_scan_filter_h *scan_filter) |
Creates a scan filter to find only LE advertisements which match specific requirements. | |
int | bt_adapter_le_scan_filter_destroy (bt_scan_filter_h scan_filter) |
Destroys a scan filter. | |
int | bt_adapter_le_scan_filter_set_device_address (bt_scan_filter_h scan_filter, const char *address) |
Sets the device address for the advertisements filter. | |
int | bt_adapter_le_scan_filter_set_device_name (bt_scan_filter_h scan_filter, const char *name) |
Sets the device name for the advertisements filter. | |
int | bt_adapter_le_scan_filter_set_service_uuid (bt_scan_filter_h scan_filter, const char *uuid) |
Sets the service UUID for the advertisements filter. | |
int | bt_adapter_le_scan_filter_set_service_uuid_with_mask (bt_scan_filter_h scan_filter, const char *uuid, const char *mask) |
Sets the service UUID and the mask for the advertisements filter, to use for filtering by partial data. | |
int | bt_adapter_le_scan_filter_set_service_solicitation_uuid (bt_scan_filter_h scan_filter, const char *uuid) |
Sets the service solicitation UUID for the advertisements filter. | |
int | bt_adapter_le_scan_filter_set_service_solicitation_uuid_with_mask (bt_scan_filter_h scan_filter, const char *uuid, const char *mask) |
Sets the service solicitation UUID and the mask for the advertisements filter, to use for filtering by partial data. | |
int | bt_adapter_le_scan_filter_set_service_data (bt_scan_filter_h scan_filter, const char *uuid, const char *data, unsigned int data_len) |
Sets the service data for the advertisements filter. | |
int | bt_adapter_le_scan_filter_set_service_data_with_mask (bt_scan_filter_h scan_filter, const char *uuid, const char *data, unsigned int data_len, const char *mask, unsigned int mask_len) |
Sets the service data and the mask for the advertisements filter, to use for filtering by partial data. | |
int | bt_adapter_le_scan_filter_set_manufacturer_data (bt_scan_filter_h scan_filter, int manufacturer_id, const char *data, unsigned int data_len) |
Sets the manufacturer data for the advertisements filter. | |
int | bt_adapter_le_scan_filter_set_manufacturer_data_with_mask (bt_scan_filter_h scan_filter, int manufacturer_id, const char *data, unsigned int data_len, const char *mask, unsigned int mask_len) |
Sets the manufacturer data and the mask for the advertisements filter, to use for filtering by partial data. | |
int | bt_adapter_le_scan_filter_set_type (bt_scan_filter_h scan_filter, bt_adapter_le_scan_filter_type_e mode) |
Sets the scan filter type for the advertisements filter. | |
int | bt_adapter_le_scan_filter_register (bt_scan_filter_h scan_filter) |
Registers a scan filter to use for scanning. | |
int | bt_adapter_le_scan_filter_unregister (bt_scan_filter_h scan_filter) |
Unregisters all registered scan filters. | |
int | bt_adapter_le_scan_filter_unregister_all (void) |
Unregisters all registered scan filters. | |
Typedefs | |
typedef void * | bt_advertiser_h |
The handle to control Bluetooth LE advertising. | |
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 void * | bt_scan_filter_h |
The handle of a Bluetooth LE scan filter. |
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.
[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_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.
[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 |
typedef void* bt_advertiser_h |
The handle to control Bluetooth LE advertising.
typedef void* bt_scan_filter_h |
The handle of a Bluetooth LE scan filter.
Enumerations of the Bluetooth advertising filter policy.
Enumerations of the Bluetooth le scan mode.
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.
[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 |
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 |
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.
[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 |
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 |
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.
[in] | advertiser | The handle of advertiser |
[in] | pkt_type | The packet type |
[in] | uuid | The string of the service solicitation UUID. |
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 |
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.
[in] | advertiser | The handle of advertiser |
[in] | pkt_type | The packet type |
[in] | uuid | The string of the service UUID. |
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 |
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.
[in] | advertiser | The handle of advertiser |
[in] | pkt_type | The packet type to be cleared |
BT_ERROR_NONE | Successful |
BT_ERROR_NOT_INITIALIZED | Not initialized |
BT_ERROR_INVALID_PARAMETER | Invalid parameter |
BT_ERROR_NOT_SUPPORTED | Not supported |
int bt_adapter_le_create_advertiser | ( | bt_advertiser_h * | advertiser | ) |
Creates advertiser to advertise device's existence or respond to LE scanning request.
[out] | advertiser | The handle of advertiser |
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 |
int bt_adapter_le_destroy_advertiser | ( | bt_advertiser_h | advertiser | ) |
Destroys advertiser.
[out] | advertiser | The handle of advertiser |
BT_ERROR_NONE | Successful |
BT_ERROR_NOT_INITIALIZED | Not initialized |
BT_ERROR_INVALID_PARAMETER | Invalid parameter |
BT_ERROR_NOT_SUPPORTED | Not supported |
int bt_adapter_le_free_ibeacon_report | ( | bt_adapter_le_ibeacon_scan_result_info_s * | ibeacon_info | ) |
Frees iBeacon information.
[in] | ibeacon_info | The iBeacon format's scan result data |
BT_ERROR_NONE | Successful |
BT_ERROR_INVALID_PARAMETER | Invalid parameter |
BT_ERROR_NOT_SUPPORTED | Not supported |
int bt_adapter_le_free_service_data_list | ( | bt_adapter_le_service_data_s * | data_list, |
int | count | ||
) |
Frees service data list.
[in] | data_list | The list of the service data |
[in] | count | The count of the service data list |
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.
[in] | info | The scan result information |
[in] | pkt_type | The packet type |
[out] | appearance | The appearance |
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 |
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.
[in] | info | The scan result information |
[in] | pkt_type | The packet type |
[out] | name | The device name |
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 |
int bt_adapter_le_get_scan_result_ibeacon_report | ( | const bt_adapter_le_device_scan_result_info_s * | info, |
bt_adapter_le_packet_type_e | pkt_type, | ||
bt_adapter_le_ibeacon_scan_result_info_s ** | ibeacon_info | ||
) |
Gets iBeacon format's data from the scan result information.
[in] | info | The scan result information |
[in] | pkt_type | The packet type |
[out] | ibeacon_info | The iBeacon format's scan result data |
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 |
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.
[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 |
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 |
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.
[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 |
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 |
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.
[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 |
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 |
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.
[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 |
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 |
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.
[in] | info | The scan result information |
[in] | pkt_type | The packet type |
[out] | power_level | The transmission power level in dBm |
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 |
int bt_adapter_le_is_discovering | ( | bool * | is_discovering | ) |
Checks for the LE device discovery is in progress or not.
[out] | is_discovering | The discovering status: (true = in progress , false = not in progress ) |
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_le_scan_filter_create | ( | bt_scan_filter_h * | scan_filter | ) |
Creates a scan filter to find only LE advertisements which match specific requirements.
If the filter's attribute is not set, then the filter will accept all values of that attribute. If an attribute is set, the filter will accept only advertisements which match the set attribute.
For example, if device name is set with bt_adapter_le_scan_filter_set_device_name(), the filter will accept only advertisements from devices with the given name. If device name is not set, advertisements will be filtered without regard to device names.
[out] | scan_filter | The scan filter handle |
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 |
int bt_adapter_le_scan_filter_destroy | ( | bt_scan_filter_h | scan_filter | ) |
Destroys a scan filter.
[in] | scan_filter | The scan filter handle |
BT_ERROR_NONE | Successful |
BT_ERROR_NOT_INITIALIZED | Not initialized |
BT_ERROR_INVALID_PARAMETER | Invalid parameter |
BT_ERROR_NOT_SUPPORTED | Not supported |
int bt_adapter_le_scan_filter_register | ( | bt_scan_filter_h | scan_filter | ) |
Registers a scan filter to use for scanning.
If the filter is registered, it cannot be changed.
[in] | scan_filter | The scan filter handle |
BT_ERROR_NONE | Successful |
BT_ERROR_NOT_INITIALIZED | Not initialized |
BT_ERROR_INVALID_PARAMETER | Invalid parameter |
BT_ERROR_NOW_IN_PROGRESS | Scan is in progress |
BT_ERROR_NOT_SUPPORTED | Not supported |
BT_ERROR_PERMISSION_DENIED | Permission denied |
int bt_adapter_le_scan_filter_set_device_address | ( | bt_scan_filter_h | scan_filter, |
const char * | address | ||
) |
Sets the device address for the advertisements filter.
[in] | scan_filter | The scan filter handle |
[in] | address | The device address by which advertisements will be filtered |
BT_ERROR_NONE | Successful |
BT_ERROR_NOT_INITIALIZED | Not initialized |
BT_ERROR_INVALID_PARAMETER | Invalid parameter |
BT_ERROR_NOT_SUPPORTED | Not supported |
int bt_adapter_le_scan_filter_set_device_name | ( | bt_scan_filter_h | scan_filter, |
const char * | name | ||
) |
Sets the device name for the advertisements filter.
Any previously set value will be overwritten.
[in] | scan_filter | The scan filter handle |
[in] | name | The device name by which advertisements will be filtered |
BT_ERROR_NONE | Successful |
BT_ERROR_NOT_INITIALIZED | Not initialized |
BT_ERROR_INVALID_PARAMETER | Invalid parameter |
BT_ERROR_NOT_SUPPORTED | Not supported |
int bt_adapter_le_scan_filter_set_manufacturer_data | ( | bt_scan_filter_h | scan_filter, |
int | manufacturer_id, | ||
const char * | data, | ||
unsigned int | data_len | ||
) |
Sets the manufacturer data for the advertisements filter.
Any previously set value will be overwritten.
[in] | scan_filter | The scan filter handle |
[in] | manufacturer_id | The manufacturer ID (0x0000 ~ 0xFFFF) |
[in] | data | The manufacturer data (byte array) |
[in] | data_len | The length of the manufacturer data |
BT_ERROR_NONE | Successful |
BT_ERROR_NOT_INITIALIZED | Not initialized |
BT_ERROR_INVALID_PARAMETER | Invalid parameter |
BT_ERROR_NOT_SUPPORTED | Not supported |
int bt_adapter_le_scan_filter_set_manufacturer_data_with_mask | ( | bt_scan_filter_h | scan_filter, |
int | manufacturer_id, | ||
const char * | data, | ||
unsigned int | data_len, | ||
const char * | mask, | ||
unsigned int | mask_len | ||
) |
Sets the manufacturer data and the mask for the advertisements filter, to use for filtering by partial data.
Any previously set value will be overwritten. The mask works as follows: For each bit set to 1 in the mask, the corresponding bits in data and in the filtered data will have to be equal. If the mask bit is set to 0, the corresponding bits will be ignored.
[in] | scan_filter | The scan filter handle |
[in] | manufacturer_id | The manufacturer ID (0x0000 ~ 0xFFFF) |
[in] | data | The manufacturer data (byte array) |
[in] | data_len | The length of the manufacturer data |
[in] | mask | The mask by which advertisements will be filtered |
[in] | mask_len | The length of the mask |
BT_ERROR_NONE | Successful |
BT_ERROR_NOT_INITIALIZED | Not initialized |
BT_ERROR_INVALID_PARAMETER | Invalid parameter |
BT_ERROR_NOT_SUPPORTED | Not supported |
int bt_adapter_le_scan_filter_set_service_data | ( | bt_scan_filter_h | scan_filter, |
const char * | uuid, | ||
const char * | data, | ||
unsigned int | data_len | ||
) |
Sets the service data for the advertisements filter.
Any previously set value will be overwritten.
[in] | scan_filter | The scan filter handle |
[in] | uuid | The service UUID by which advertisements will be filtered |
[in] | data | The service data by which advertisements will be filtered |
[in] | data_len | The length of the service data |
BT_ERROR_NONE | Successful |
BT_ERROR_NOT_INITIALIZED | Not initialized |
BT_ERROR_INVALID_PARAMETER | Invalid parameter |
BT_ERROR_NOT_SUPPORTED | Not supported |
int bt_adapter_le_scan_filter_set_service_data_with_mask | ( | bt_scan_filter_h | scan_filter, |
const char * | uuid, | ||
const char * | data, | ||
unsigned int | data_len, | ||
const char * | mask, | ||
unsigned int | mask_len | ||
) |
Sets the service data and the mask for the advertisements filter, to use for filtering by partial data.
Any previously set value will be overwritten. The mask works as follows: For each bit set to 1 in the mask, the corresponding bits in data and in the filtered data will have to be equal. If the mask bit is set to 0, the corresponding bits will be ignored.
[in] | scan_filter | The scan filter handle |
[in] | uuid | The service UUID by which advertisements will be filtered |
[in] | data | The service data by which advertisements will be filtered |
[in] | data_len | The length of the service data |
[in] | mask | The mask by which advertisements will be filtered |
[in] | mask_len | The length of the mask |
BT_ERROR_NONE | Successful |
BT_ERROR_NOT_INITIALIZED | Not initialized |
BT_ERROR_INVALID_PARAMETER | Invalid parameter |
BT_ERROR_NOT_SUPPORTED | Not supported |
int bt_adapter_le_scan_filter_set_service_solicitation_uuid | ( | bt_scan_filter_h | scan_filter, |
const char * | uuid | ||
) |
Sets the service solicitation UUID for the advertisements filter.
Any previously set value will be overwritten.
[in] | scan_filter | The scan filter handle |
[in] | uuid | The service solicitation UUID by which advertisements will be filtered |
BT_ERROR_NONE | Successful |
BT_ERROR_NOT_INITIALIZED | Not initialized |
BT_ERROR_INVALID_PARAMETER | Invalid parameter |
BT_ERROR_NOT_SUPPORTED | Not supported |
int bt_adapter_le_scan_filter_set_service_solicitation_uuid_with_mask | ( | bt_scan_filter_h | scan_filter, |
const char * | uuid, | ||
const char * | mask | ||
) |
Sets the service solicitation UUID and the mask for the advertisements filter, to use for filtering by partial data.
Any previously set value will be overwritten. The mask works as follows: For each bit set to 1 in the mask, the corresponding bits in uuid and in the filtered data will have to be equal. If the mask bit is set to 0, the corresponding bits will be ignored.
[in] | scan_filter | The scan filter handle |
[in] | uuid | The service solicitation UUID by which advertisements will be filtered |
[in] | mask | The mask by which advertisements will be filtered |
BT_ERROR_NONE | Successful |
BT_ERROR_NOT_INITIALIZED | Not initialized |
BT_ERROR_INVALID_PARAMETER | Invalid parameter |
BT_ERROR_NOT_SUPPORTED | Not supported |
int bt_adapter_le_scan_filter_set_service_uuid | ( | bt_scan_filter_h | scan_filter, |
const char * | uuid | ||
) |
Sets the service UUID for the advertisements filter.
Any previously set value will be overwritten.
[in] | scan_filter | The scan filter handle |
[in] | uuid | The service UUID by which advertisements will be filtered |
BT_ERROR_NONE | Successful |
BT_ERROR_NOT_INITIALIZED | Not initialized |
BT_ERROR_INVALID_PARAMETER | Invalid parameter |
BT_ERROR_NOT_SUPPORTED | Not supported |
int bt_adapter_le_scan_filter_set_service_uuid_with_mask | ( | bt_scan_filter_h | scan_filter, |
const char * | uuid, | ||
const char * | mask | ||
) |
Sets the service UUID and the mask for the advertisements filter, to use for filtering by partial data.
Any previously set value will be overwritten. The mask works as follows: For each bit set to 1 in the mask, the corresponding bits in uuid and in the filtered data will have to be equal. If the mask bit is set to 0, the corresponding bits will be ignored.
[in] | scan_filter | The scan filter handle |
[in] | uuid | The service UUID by which advertisements will be filtered |
[in] | mask | The mask to filter advertisements |
BT_ERROR_NONE | Successful |
BT_ERROR_NOT_INITIALIZED | Not initialized |
BT_ERROR_INVALID_PARAMETER | Invalid parameter |
BT_ERROR_NOT_SUPPORTED | Not supported |
int bt_adapter_le_scan_filter_set_type | ( | bt_scan_filter_h | scan_filter, |
bt_adapter_le_scan_filter_type_e | mode | ||
) |
Sets the scan filter type for the advertisements filter.
The filter type is used when searching only for iBeacon or proximity type's advertising data. If the type is not set, LE scanner will search devices as with regard to other filtered attributes. If the type is set, all other attributes set for the filter are ignored.
[in] | scan_filter | The scan filter handle |
[in] | mode | The scan filter type |
BT_ERROR_NONE | Successful |
BT_ERROR_NOT_INITIALIZED | Not initialized |
BT_ERROR_INVALID_PARAMETER | Invalid parameter |
BT_ERROR_NOT_SUPPORTED | Not supported |
int bt_adapter_le_scan_filter_unregister | ( | bt_scan_filter_h | scan_filter | ) |
Unregisters all registered scan filters.
[in] | scan_filter | The scan filter handle |
BT_ERROR_NONE | Successful |
BT_ERROR_NOT_INITIALIZED | Not initialized |
BT_ERROR_INVALID_PARAMETER | Invalid parameter |
BT_ERROR_NOW_IN_PROGRESS | Scan is in progress |
BT_ERROR_NOT_SUPPORTED | Not supported |
BT_ERROR_PERMISSION_DENIED | Permission denied |
int bt_adapter_le_scan_filter_unregister_all | ( | void | ) |
Unregisters all registered scan filters.
BT_ERROR_NONE | Successful |
BT_ERROR_NOT_INITIALIZED | Not initialized |
BT_ERROR_NOW_IN_PROGRESS | Scan is in progress |
BT_ERROR_NOT_SUPPORTED | Not supported |
BT_ERROR_PERMISSION_DENIED | Permission denied |
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.
[in] | advertiser | The handle of advertiser |
[in] | pkt_type | The packet type |
[in] | appearance | The external appearance of device |
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 |
int bt_adapter_le_set_advertising_connectable | ( | bt_advertiser_h | advertiser, |
bool | connectable | ||
) |
Sets whether the advertising type should be connectable or non-connectable.
[in] | advertiser | The handle of advertiser |
[in] | connectable | The type of advertising |
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 |
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.
[in] | advertiser | The handle of advertiser |
[in] | pkt_type | The packet type |
[in] | include_name | Whether the device name should be included |
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 |
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.
[in] | advertiser | The handle of advertiser |
[in] | mode | The mode of advertising |
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 |
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.
[in] | advertiser | The handle of advertiser |
[in] | pkt_type | The packet type |
[in] | include_tx_power | Whether the transmission power level should be included |
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 |
int bt_adapter_le_set_scan_mode | ( | bt_adapter_le_scan_mode_e | scan_mode | ) |
Sets Bluetooth LE scan mode.
[in] | scan_mode | The scan mode |
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 |
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.
[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 |
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 |
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.
[in] | cb | The callback to report the result of this function |
[in] | user_data | The user data to be passed when callback is called |
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 |
int bt_adapter_le_stop_advertising | ( | bt_advertiser_h | advertiser | ) |
Stops the advertising.
[in] | advertiser | The handle of advertiser |
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 |
int bt_adapter_le_stop_scan | ( | void | ) |
Stops the LE scan.
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 |