Tizen Native API
|
Functions | |
int | bt_gatt_foreach_primary_services (const char *remote_address, bt_gatt_primary_service_cb callback, void *user_data) |
Gets the primary services of GATT(Generic Attribute Profile). | |
int | bt_gatt_discover_characteristics (bt_gatt_attribute_h service, bt_gatt_characteristics_discovered_cb callback, void *user_data) |
Discovers the characteristics in service, asynchronously. | |
int | bt_gatt_get_service_uuid (bt_gatt_attribute_h service, char **uuid) |
Gets the UUID of service. | |
int | bt_gatt_foreach_included_services (bt_gatt_attribute_h service, bt_gatt_included_service_cb callback, void *user_data) |
Gets the included services in service. | |
int | bt_gatt_set_characteristic_changed_cb (bt_gatt_characteristic_changed_cb callback, void *user_data) |
Registers a callback function that will be invoked when a characteristic value is changed. | |
int | bt_gatt_unset_characteristic_changed_cb (void) |
Unregisters a callback function that will be invoked when a characteristic is changed. | |
int | bt_gatt_watch_characteristic_changes (bt_gatt_attribute_h service) |
Watches all the characteristic value changes of the service. | |
int | bt_gatt_unwatch_characteristic_changes (bt_gatt_attribute_h service) |
Remove watching of all the characteristic value changes of the service. | |
int | bt_gatt_get_characteristic_declaration (bt_gatt_attribute_h characteristic, char **uuid, unsigned char **value, int *value_length) |
Gets the characteristic declaration. | |
int | bt_gatt_set_characteristic_value (bt_gatt_attribute_h characteristic, const unsigned char *value, int value_length) |
Sets the value of characteristic. | |
int | bt_gatt_set_characteristic_value_request (bt_gatt_attribute_h characteristic, const unsigned char *value, int value_length, bt_gatt_characteristic_write_cb callback) |
Sets the value of characteristic request. | |
int | bt_gatt_clone_attribute_handle (bt_gatt_attribute_h *clone, bt_gatt_attribute_h origin) |
Clones the attribute handle. | |
int | bt_gatt_destroy_attribute_handle (bt_gatt_attribute_h handle) |
Destroys the attribute handle. | |
int | bt_gatt_read_characteristic_value (bt_gatt_attribute_h char_handle, bt_gatt_characteristic_read_cb callback) |
Reads the value of characteristic from remote device. | |
int | bt_gatt_discover_characteristic_descriptor (bt_gatt_attribute_h characteristic_handle, bt_gatt_characteristic_descriptor_discovered_cb callback, void *user_data) |
Discovers the characteristic descriptors of a characteristic within its definition, asynchronously. | |
int | bt_gatt_get_value (bt_gatt_h gatt_handle, char **value, int *value_length) |
Gets the value of a characteristic or descriptor's GATT handle. | |
int | bt_gatt_get_int_value (bt_gatt_h gatt_handle, bt_data_type_int_e type, int offset, int *value) |
Gets the value of a characteristic or descriptor's GATT handle as an integer type. | |
int | bt_gatt_get_float_value (bt_gatt_h gatt_handle, bt_data_type_float_e type, int offset, float *value) |
Gets the value of a characteristic or descriptor's GATT handle as a float type. | |
int | bt_gatt_set_value (bt_gatt_h gatt_handle, const char *value, int value_length) |
Updates the value of a characteristic or descriptor's GATT handle. | |
int | bt_gatt_set_int_value (bt_gatt_h gatt_handle, bt_data_type_int_e type, int value, int offset) |
Updates the value of a characteristic or descriptor's GATT handle using a integer type's value. | |
int | bt_gatt_set_float_value (bt_gatt_h gatt_handle, bt_data_type_float_e type, int mantissa, int exponent, int offset) |
Updates the value of a characteristic or descriptor's GATT handle using a float type's value. | |
int | bt_gatt_get_uuid (bt_gatt_h gatt_handle, char **uuid) |
Gets the UUID of a service, characteristic or descriptor's GATT handle. | |
int | bt_gatt_get_type (bt_gatt_h gatt_handle, bt_gatt_type_e *gatt_type) |
Gets the type of GATT handle. | |
int | bt_gatt_service_get_client (bt_gatt_h service, bt_gatt_client_h *client) |
Gets the GATT client handle which the specified service belongs to. | |
int | bt_gatt_service_get_characteristic (bt_gatt_h service, const char *uuid, bt_gatt_h *characteristic) |
Gets a characteristic's GATT handle which has specific UUID. | |
int | bt_gatt_service_foreach_characteristics (bt_gatt_h service, bt_gatt_foreach_cb callback, void *user_data) |
Invokes callback function on each characteristic that belongs to the specified service. | |
int | bt_gatt_service_get_included_service (bt_gatt_h service, const char *uuid, bt_gatt_h *included_service) |
Gets an included service's GATT handle which has specific UUID. | |
int | bt_gatt_service_foreach_included_services (bt_gatt_h service, bt_gatt_foreach_cb callback, void *user_data) |
Invokes callback function on each included service that belongs to the specified service. | |
int | bt_gatt_characteristic_get_service (bt_gatt_h characteristic, bt_gatt_h *service) |
Gets the service's GATT handle which the specified characteristic belongs to. | |
int | bt_gatt_characteristic_get_properties (bt_gatt_h characteristic, int *properties) |
Gets the properties which a characteristic's GATT handle has. | |
int | bt_gatt_characteristic_get_write_type (bt_gatt_h characteristic, bt_gatt_write_type_e *write_type) |
Gets the write type of the specified characteristic. | |
int | bt_gatt_characteristic_set_write_type (bt_gatt_h characteristic, bt_gatt_write_type_e write_type) |
Updates the write type of the specified charateristic. | |
int | bt_gatt_characteristic_get_descriptor (bt_gatt_h characteristic, const char *uuid, bt_gatt_h *descriptor) |
Gets a descriptor's GATT handle which has specific UUID. | |
int | bt_gatt_characteristic_foreach_descriptors (bt_gatt_h characteristic, bt_gatt_foreach_cb callback, void *user_data) |
Invokes callback function on each descriptor that belongs to the specified characteristic. | |
int | bt_gatt_descriptor_get_characteristic (bt_gatt_h descriptor, bt_gatt_h *characteristic) |
Gets the characteristic's GATT handle which the specified descriptor belongs to. | |
int | bt_gatt_client_create (const char *remote_address, bt_gatt_client_h *client) |
Creates the GATT client handle. | |
int | bt_gatt_client_destroy (bt_gatt_client_h client) |
Destroys the GATT client's handle. | |
int | bt_gatt_client_get_remote_address (bt_gatt_client_h client, char **remote_address) |
Gets the address of remote device. | |
int | bt_gatt_client_read_value (bt_gatt_h gatt_handle, bt_gatt_client_request_completed_cb callback, void *user_data) |
Reads the value of a characteristic or descriptor from the remote device asynchronously. | |
int | bt_gatt_client_write_value (bt_gatt_h gatt_handle, bt_gatt_client_request_completed_cb callback, void *user_data) |
Writes the value of a characteristic or descriptor to the remote device asynchronously. | |
int | bt_gatt_client_set_characteristic_value_changed_cb (bt_gatt_h characteristic, bt_gatt_client_characteristic_value_changed_cb callback, void *user_data) |
Registers a callback function to be invoked when the characteristic value is changed on the remote device. | |
int | bt_gatt_client_unset_characteristic_value_changed_cb (bt_gatt_h characteristic) |
Unregisters a callback function to be invoked when the characteristic value is changed on the remote device. | |
int | bt_gatt_client_get_service (bt_gatt_client_h client, const char *uuid, bt_gatt_h *service) |
Gets a service's GATT handle which has specific UUID. | |
int | bt_gatt_client_foreach_services (bt_gatt_client_h client, bt_gatt_foreach_cb callback, void *user_data) |
Invokes callback function on each service that belongs to the specified GATT client. | |
int | bt_gatt_connect (const char *address, bool auto_connect) |
Connect to a specific LE based service on a remote bluetooth dievice address, asynchronously. | |
int | bt_gatt_disconnect (const char *address) |
Disconnect to LE connection with the given remote Bluetooth dievice address, asynchronously. | |
int | bt_gatt_set_connection_state_changed_cb (bt_gatt_connection_state_changed_cb callback, void *user_data) |
Registers a callback function that will be invoked when the connection state is changed. | |
int | bt_gatt_unset_connection_state_changed_cb (void) |
Unregisters a callback function that will be invoked when the connection state is changed. | |
Typedefs | |
typedef void * | bt_gatt_attribute_h |
The attribute handle of GATT(Generic Attribute Profile) | |
typedef bool(* | bt_gatt_primary_service_cb )(bt_gatt_attribute_h service, void *user_data) |
Called when you get the primary services repeatedly. | |
typedef bool(* | bt_gatt_characteristics_discovered_cb )(int result, int index, int total, bt_gatt_attribute_h characteristic, void *user_data) |
Called after the characteristics are discovered by bt_gatt_discover_characteristics(). | |
typedef bool(* | bt_gatt_included_service_cb )(bt_gatt_attribute_h service, void *user_data) |
Called when you get the included services repeatedly. | |
typedef void(* | bt_gatt_characteristic_changed_cb )(bt_gatt_attribute_h characteristic, unsigned char *value, int value_length, void *user_data) |
Called when a characteristic in service is changed. | |
typedef void(* | bt_gatt_characteristic_write_cb )(void *user_data) |
Called when a characteristic value is written. | |
typedef void(* | bt_gatt_characteristic_read_cb )(unsigned char *value, int value_length, void *user_data) |
Called when a characteristic value is read. | |
typedef void(* | bt_gatt_characteristic_descriptor_discovered_cb )(int result, unsigned char characteristic_format, int total, bt_gatt_attribute_h characteristic_descriptor, void *user_data) |
Called after the characteristics descriptors are discovered by bt_gatt_discover_characteristic_descriptor(). | |
typedef bool(* | bt_gatt_foreach_cb )(int total, int index, bt_gatt_h gatt_handle, void *user_data) |
Called when you get GATT handles repeatedly. | |
typedef void(* | bt_gatt_client_request_completed_cb )(int result, bt_gatt_h request_handle, void *user_data) |
Called when the client request(e.g. read / write) has been completed. | |
typedef void(* | bt_gatt_client_characteristic_value_changed_cb )(bt_gatt_h characteristic, char *value, int len, void *user_data) |
Called when a value of a watched characteristic's GATT handle has been changed. | |
typedef void(* | bt_gatt_connection_state_changed_cb )(int result, bool connected, const char *remote_address, void *user_data) |
Called when the connection state is changed. |
Bluetooth GATT(Generic Attribute Profile) API provides functions for discovering, reading and modifying attributes.
#include <bluetooth.h>
Two roles are defined for devices that implement GATT. The Server is the device that accepts incoming commands and requests from the client and sends responses, indications and notifications to a client. The Client is the device that initiates commands and requests towards the server and can receive responses, indications and notifications sent by the server. This API supports the Client role in GATT.
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.
typedef void* bt_gatt_attribute_h |
The attribute handle of GATT(Generic Attribute Profile)
typedef void(* bt_gatt_characteristic_changed_cb)(bt_gatt_attribute_h characteristic, unsigned char *value, int value_length, void *user_data) |
Called when a characteristic in service is changed.
[in] | characteristic | The attribute handle of characteristic |
[in] | value | The value of characteristic (byte array) |
[in] | value_length | The length of value |
[in] | user_data | The user data passed from the callback registration function |
typedef void(* bt_gatt_characteristic_descriptor_discovered_cb)(int result, unsigned char characteristic_format, int total, bt_gatt_attribute_h characteristic_descriptor, void *user_data) |
Called after the characteristics descriptors are discovered by bt_gatt_discover_characteristic_descriptor().
[in] | result | The result of discovering |
[in] | characteristic_format | The format of the information data. characteristic_format = 0x01 indicates UUIDs are 16-bits characteristic_format = 0x02 indicates UUIDs are 128-bits |
[in] | total | The total number of elements in characteristic_descriptor |
[in] | characteristic | descriptor The attribute handle and the UUID of characteristic descriptor |
[in] | user_data | The user data passed from the request function |
typedef void(* bt_gatt_characteristic_read_cb)(unsigned char *value, int value_length, void *user_data) |
Called when a characteristic value is read.
[in] | value | The value of characteristic (byte array) |
[in] | value_length | The length of value |
[in] | user_data | The user data passed from the foreach function |
typedef void(* bt_gatt_characteristic_write_cb)(void *user_data) |
Called when a characteristic value is written.
typedef bool(* bt_gatt_characteristics_discovered_cb)(int result, int index, int total, bt_gatt_attribute_h characteristic, void *user_data) |
Called after the characteristics are discovered by bt_gatt_discover_characteristics().
[in] | result | The result of discovering |
[in] | index | The index of characteristics in a service, starts from 0 |
[in] | total | The total number of characteristics in a service |
[in] | characteristic | The attribute handle of characteristic |
[in] | user_data | The user data passed from the request function |
true
to continue with the next iteration of the loop, false
to break out of the loop. typedef void(* bt_gatt_client_characteristic_value_changed_cb)(bt_gatt_h characteristic, char *value, int len, void *user_data) |
Called when a value of a watched characteristic's GATT handle has been changed.
[in] | characteristic | The characteristic's GATT handle of which value change is informed. It has an old value. |
[in] | value | The new value |
[in] | len | The length of value |
[in] | user_data | The user data passed from the registering function |
typedef void(* bt_gatt_client_request_completed_cb)(int result, bt_gatt_h request_handle, void *user_data) |
Called when the client request(e.g. read / write) has been completed.
[in] | result | The result of a request |
[in] | request_handle | The requesting GATT handle |
[in] | user_data | The user data passed from the requesting function |
typedef void(* bt_gatt_connection_state_changed_cb)(int result, bool connected, const char *remote_address, void *user_data) |
Called when the connection state is changed.
This callback is called when the connection state is changed. When you called bt_gatt_connect() or bt_gatt_disconnect(), this callback is also called with error result even though these functions fail.
[in] | result | The result of changing the connection state. |
[in] | connected | The state to be changed, true means connected state, Otherwise, false. |
[in] | remote_address | The remote_address |
[in] | user_data | The user data passed from the callback registration function. |
typedef bool(* bt_gatt_foreach_cb)(int total, int index, bt_gatt_h gatt_handle, void *user_data) |
Called when you get GATT handles repeatedly.
[in] | total | The total number of GATT handles to be called |
[in] | index | The index of current GATT handle. It starts from 0. |
[in] | gatt_handle | The GATT handle |
[in] | user_data | The user data passed from the foreach function |
typedef bool(* bt_gatt_included_service_cb)(bt_gatt_attribute_h service, void *user_data) |
Called when you get the included services repeatedly.
[in] | service | The attribute handle of service |
[in] | user_data | The user data passed from the foreach function |
true
to continue with the next iteration of the loop, false
to break out of the loop. typedef bool(* bt_gatt_primary_service_cb)(bt_gatt_attribute_h service, void *user_data) |
Called when you get the primary services repeatedly.
[in] | service | The attribute handle of service |
[in] | user_data | The user data passed from the foreach function |
true
to continue with the next iteration of the loop, false
to break out of the loop. enum bt_data_type_float_e |
enum bt_data_type_int_e |
Enumerations of the integer type for GATT handle's value.
enum bt_gatt_property_e |
Enumerations of the characteristic's property.
enum bt_gatt_type_e |
enum bt_gatt_write_type_e |
int bt_gatt_characteristic_foreach_descriptors | ( | bt_gatt_h | characteristic, |
bt_gatt_foreach_cb | callback, | ||
void * | user_data | ||
) |
Invokes callback function on each descriptor that belongs to the specified characteristic.
[in] | characteristic | The characteristic's GATT handle |
[in] | callback | The function to be invoked on each descriptor |
[in] | user_data | The user data to be passed to callback function |
BT_ERROR_NONE | Successful |
BT_ERROR_INVALID_PARAMETER | Invalid parameter |
BT_ERROR_NOT_SUPPORTED | Not supported |
int bt_gatt_characteristic_get_descriptor | ( | bt_gatt_h | characteristic, |
const char * | uuid, | ||
bt_gatt_h * | descriptor | ||
) |
Gets a descriptor's GATT handle which has specific UUID.
[in] | characteristic | The characteristic's GATT handle |
[in] | uuid | The descriptor's GATT handle which has this UUID will be returned if it exists |
[out] | descriptor | The descriptor's GATT handle which has uuid if it exists |
BT_ERROR_NONE | Successful |
BT_ERROR_INVALID_PARAMETER | Invalid parameter |
BT_ERROR_NO_DATA | No data available |
BT_ERROR_NOT_SUPPORTED | Not supported |
int bt_gatt_characteristic_get_properties | ( | bt_gatt_h | characteristic, |
int * | properties | ||
) |
Gets the properties which a characteristic's GATT handle has.
[in] | characteristic | The characteristic's GATT handle |
[out] | properties | The properties which a characteristic's GATT handle has |
BT_ERROR_NONE | Successful |
BT_ERROR_INVALID_PARAMETER | Invalid parameter |
BT_ERROR_NOT_SUPPORTED | Not supported |
int bt_gatt_characteristic_get_service | ( | bt_gatt_h | characteristic, |
bt_gatt_h * | service | ||
) |
Gets the service's GATT handle which the specified characteristic belongs to.
[in] | characteristic | The characteristic's GATT handle |
[out] | service | The service's GATT handle which characteristic belongs to |
BT_ERROR_NONE | Successful |
BT_ERROR_INVALID_PARAMETER | Invalid parameter |
BT_ERROR_NOT_SUPPORTED | Not supported |
int bt_gatt_characteristic_get_write_type | ( | bt_gatt_h | characteristic, |
bt_gatt_write_type_e * | write_type | ||
) |
Gets the write type of the specified characteristic.
[in] | characteristic | The characteristic's GATT handle |
[out] | write_type | The write type of the specified characteristic |
BT_ERROR_NONE | Successful |
BT_ERROR_INVALID_PARAMETER | Invalid parameter |
BT_ERROR_NOT_SUPPORTED | Not supported |
int bt_gatt_characteristic_set_write_type | ( | bt_gatt_h | characteristic, |
bt_gatt_write_type_e | write_type | ||
) |
Updates the write type of the specified charateristic.
[in] | characteristic | The characteristic's GATT handle |
[in] | write_type | The write type to be updated |
BT_ERROR_NONE | Successful |
BT_ERROR_INVALID_PARAMETER | Invalid parameter |
BT_ERROR_NOT_SUPPORTED | Not supported |
int bt_gatt_client_create | ( | const char * | remote_address, |
bt_gatt_client_h * | client | ||
) |
Creates the GATT client handle.
[in] | remote_address | The address of the remote device |
[out] | client | The created GATT client's handle |
BT_ERROR_NONE | Successful |
BT_ERROR_INVALID_PARAMETER | Invalid parameter |
BT_ERROR_OUT_OF_MEMORY | Out of memory |
BT_ERROR_ALREADY_DONE | Operation is already done |
BT_ERROR_NOT_SUPPORTED | Not supported |
int bt_gatt_client_destroy | ( | bt_gatt_client_h | client | ) |
Destroys the GATT client's handle.
[in] | client | The GATT client's handle |
BT_ERROR_NONE | Successful |
BT_ERROR_INVALID_PARAMETER | Invalid parameter |
BT_ERROR_NOT_SUPPORTED | Not supported |
int bt_gatt_client_foreach_services | ( | bt_gatt_client_h | client, |
bt_gatt_foreach_cb | callback, | ||
void * | user_data | ||
) |
Invokes callback function on each service that belongs to the specified GATT client.
[in] | client | The GATT client's handle |
[in] | callback | The function to be invoked on each service |
[in] | user_data | The user data to be passed to callback function |
BT_ERROR_NONE | Successful |
BT_ERROR_INVALID_PARAMETER | Invalid parameter |
BT_ERROR_NOT_SUPPORTED | Not supported |
int bt_gatt_client_get_remote_address | ( | bt_gatt_client_h | client, |
char ** | remote_address | ||
) |
Gets the address of remote device.
[in] | client | The created GATT client's handle |
[out] | remote_address | The address of the remote device which is associated with client |
BT_ERROR_NONE | Successful |
BT_ERROR_INVALID_PARAMETER | Invalid parameter |
BT_ERROR_NOT_SUPPORTED | Not supported |
int bt_gatt_client_get_service | ( | bt_gatt_client_h | client, |
const char * | uuid, | ||
bt_gatt_h * | service | ||
) |
Gets a service's GATT handle which has specific UUID.
[in] | client | The GATT client's handle |
[in] | uuid | The serivce's GATT handle which has this UUID will be returned if it exists |
[out] | service | The service's GATT handle which has uuid if it exists |
BT_ERROR_NONE | Successful |
BT_ERROR_INVALID_PARAMETER | Invalid parameter |
BT_ERROR_NO_DATA | No data available |
BT_ERROR_NOT_SUPPORTED | Not supported |
int bt_gatt_client_read_value | ( | bt_gatt_h | gatt_handle, |
bt_gatt_client_request_completed_cb | callback, | ||
void * | user_data | ||
) |
Reads the value of a characteristic or descriptor from the remote device asynchronously.
[in] | gatt_handle | The GATT handle of a characteristic or descriptor |
[in] | callback | When a read request is completed, this callback function will be called |
[in] | user_data | The user data to be passed to callback function |
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_NOW_IN_PROGRESS | Operation now in progress |
BT_ERROR_PERMISSION_DENIED | Permission denied |
BT_ERROR_NOT_SUPPORTED | Not supported |
int bt_gatt_client_set_characteristic_value_changed_cb | ( | bt_gatt_h | characteristic, |
bt_gatt_client_characteristic_value_changed_cb | callback, | ||
void * | user_data | ||
) |
Registers a callback function to be invoked when the characteristic value is changed on the remote device.
[in] | characteristic | The characteristic's GATT handle |
[in] | callback | The callback to be invoked when the value is changed and it is informed |
[in] | user_data | The user data to be passed to callback function |
BT_ERROR_NONE | Successful |
BT_ERROR_NOT_INITIALIZED | Not initialized |
BT_ERROR_INVALID_PARAMETER | Invalid parameter |
BT_ERROR_NOT_SUPPORTED | Not supported |
int bt_gatt_client_unset_characteristic_value_changed_cb | ( | bt_gatt_h | characteristic | ) |
Unregisters a callback function to be invoked when the characteristic value is changed on the remote device.
[in] | characteristic | The characteristic's GATT handle, whose value change will not be informed |
BT_ERROR_NONE | Successful |
BT_ERROR_NOT_INITIALIZED | Not initialized |
BT_ERROR_INVALID_PARAMETER | Invalid parameter |
BT_ERROR_NOT_SUPPORTED | Not supported |
int bt_gatt_client_write_value | ( | bt_gatt_h | gatt_handle, |
bt_gatt_client_request_completed_cb | callback, | ||
void * | user_data | ||
) |
Writes the value of a characteristic or descriptor to the remote device asynchronously.
[in] | gatt_handle | The GATT handle of a characteristic or descriptor |
[in] | callback | When a write request is completed, this callback function will be called |
[in] | user_data | The user data to be passed to callback function |
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_NOW_IN_PROGRESS | Operation now in progress |
BT_ERROR_PERMISSION_DENIED | Permission denied |
BT_ERROR_NOT_SUPPORTED | Not supported |
int bt_gatt_clone_attribute_handle | ( | bt_gatt_attribute_h * | clone, |
bt_gatt_attribute_h | origin | ||
) |
Clones the attribute handle.
[out] | clone | The cloned attribute handle |
[in] | origin | The origin attribute handle |
BT_ERROR_NONE | Successful |
BT_ERROR_INVALID_PARAMETER | Invalid parameter |
BT_ERROR_OUT_OF_MEMORY | Out of memory |
BT_ERROR_NOT_SUPPORTED | Not supported |
int bt_gatt_connect | ( | const char * | address, |
bool | auto_connect | ||
) |
Connect to a specific LE based service on a remote bluetooth dievice address, asynchronously.
[in] | address | The address of the remote Bluetooth device. |
[in] | auto_connect | The flag of the auto connection. |
BT_ERROR_NONE | Successful |
BT_ERROR_NOT_INITIALIZED | Not initialized |
BT_ERROR_NOT_ENABLED | Not enabled |
BT_ERROR_INVALID_PARAMETER | Invalid paramater |
BT_ERROR_OPERATION_FAILED | Operation failed |
BT_ERROR_PERMISSION_DENIED | Permission denied |
BT_ERROR_NOT_SUPPORTED | Not supported |
int bt_gatt_descriptor_get_characteristic | ( | bt_gatt_h | descriptor, |
bt_gatt_h * | characteristic | ||
) |
Gets the characteristic's GATT handle which the specified descriptor belongs to.
[in] | descriptor | The descriptor's GATT handle |
[out] | characteristic | The characteristic's GATT handle which descriptor belongs to |
BT_ERROR_NONE | Successful |
BT_ERROR_INVALID_PARAMETER | Invalid parameter |
BT_ERROR_NOT_SUPPORTED | Not supported |
int bt_gatt_destroy_attribute_handle | ( | bt_gatt_attribute_h | handle | ) |
Destroys the attribute handle.
[in] | handle | The attribute handle |
BT_ERROR_NONE | Successful |
BT_ERROR_INVALID_PARAMETER | Invalid parameter |
BT_ERROR_NOT_SUPPORTED | Not supported |
int bt_gatt_disconnect | ( | const char * | address | ) |
Disconnect to LE connection with the given remote Bluetooth dievice address, asynchronously.
[in] | address | The address of the remote Bluetooth device |
BT_ERROR_NONE | Successful |
BT_ERROR_NOT_INITIALIZED | Not initialized |
BT_ERROR_NOT_ENABLED | Not enabled |
BT_ERROR_INVALID_PARAMETER | Invalid paramater |
BT_ERROR_OPERATION_FAILED | Operation failed |
BT_ERROR_PERMISSION_DENIED | Permission denied |
BT_ERROR_NOT_SUPPORTED | Not supported |
int bt_gatt_discover_characteristic_descriptor | ( | bt_gatt_attribute_h | characteristic_handle, |
bt_gatt_characteristic_descriptor_discovered_cb | callback, | ||
void * | user_data | ||
) |
Discovers the characteristic descriptors of a characteristic within its definition, asynchronously.
[in] | characteristic_handle | The attribute handle of characteristic |
[in] | callback | The result callback |
[in] | user_data | The user data to be passed to the callback function |
BT_ERROR_NONE | Successful |
BT_ERROR_NOT_INITIALIZED | Not initialized |
BT_ERROR_INVALID_PARAMETER | Invalid parameter |
BT_ERROR_OPERATION_FAILED | Operation failed |
BT_ERROR_PERMISSION_DENIED | Permission denied |
BT_ERROR_NOT_SUPPORTED | Not supported |
int bt_gatt_discover_characteristics | ( | bt_gatt_attribute_h | service, |
bt_gatt_characteristics_discovered_cb | callback, | ||
void * | user_data | ||
) |
Discovers the characteristics in service, asynchronously.
[in] | service | The attribute handle of service |
[in] | callback | The result callback |
[in] | user_data | The user data to be passed to the callback function |
BT_ERROR_NONE | Successful |
BT_ERROR_NOT_INITIALIZED | Not initialized |
BT_ERROR_INVALID_PARAMETER | Invalid parameter |
BT_ERROR_OPERATION_FAILED | Operation failed |
BT_ERROR_PERMISSION_DENIED | Permission denied |
BT_ERROR_NOT_SUPPORTED | Not supported |
int bt_gatt_foreach_included_services | ( | bt_gatt_attribute_h | service, |
bt_gatt_included_service_cb | callback, | ||
void * | user_data | ||
) |
Gets the included services in service.
[in] | service | The attribute handle of service |
[in] | callback | The callback function to invoke |
[in] | user_data | The user data to be passed to the callback function |
BT_ERROR_NONE | Successful |
BT_ERROR_INVALID_PARAMETER | Invalid parameter |
BT_ERROR_NOT_INITIALIZED | Not initialized |
BT_ERROR_NOT_ENABLED | Not enabled |
BT_ERROR_OPERATION_FAILED | Operation failed |
BT_ERROR_PERMISSION_DENIED | Permission denied |
BT_ERROR_NOT_SUPPORTED | Not supported |
int bt_gatt_foreach_primary_services | ( | const char * | remote_address, |
bt_gatt_primary_service_cb | callback, | ||
void * | user_data | ||
) |
Gets the primary services of GATT(Generic Attribute Profile).
[in] | remote_address | The address of the remote device |
[in] | callback | The callback function to invoke |
[in] | user_data | The user data to be passed to the callback function |
BT_ERROR_NONE | Successful |
BT_ERROR_INVALID_PARAMETER | Invalid parameter |
BT_ERROR_NOT_INITIALIZED | Not initialized |
BT_ERROR_NOT_ENABLED | Not enabled |
BT_ERROR_OPERATION_FAILED | Operation failed |
BT_ERROR_PERMISSION_DENIED | Permission denied |
BT_ERROR_NOT_SUPPORTED | Not supported |
int bt_gatt_get_characteristic_declaration | ( | bt_gatt_attribute_h | characteristic, |
char ** | uuid, | ||
unsigned char ** | value, | ||
int * | value_length | ||
) |
Gets the characteristic declaration.
[in] | characteristic | The attribute handle of characteristic |
[out] | uuid | The UUID of service |
[out] | value | The value of characteristic (byte array) |
[out] | value_length | The length of value |
BT_ERROR_NONE | Successful |
BT_ERROR_NOT_INITIALIZED | Not initialized |
BT_ERROR_INVALID_PARAMETER | Invalid parameter |
BT_ERROR_OPERATION_FAILED | Operation failed |
BT_ERROR_OUT_OF_MEMORY | Out of memory |
BT_ERROR_PERMISSION_DENIED | Permission denied |
BT_ERROR_NOT_SUPPORTED | Not supported |
int bt_gatt_get_float_value | ( | bt_gatt_h | gatt_handle, |
bt_data_type_float_e | type, | ||
int | offset, | ||
float * | value | ||
) |
Gets the value of a characteristic or descriptor's GATT handle as a float type.
[in] | gatt_handle | The handle of a characteristic or descriptor |
[in] | type | The type of a saved value in gatt_handle |
[in] | offset | The offset from where a value will be read from gatt_handle as an integer type |
[out] | value | The float type's value of gatt_handle |
BT_ERROR_NONE | Successful |
BT_ERROR_INVALID_PARAMETER | Invalid parameter |
BT_ERROR_NOT_SUPPORTED | Not supported |
int bt_gatt_get_int_value | ( | bt_gatt_h | gatt_handle, |
bt_data_type_int_e | type, | ||
int | offset, | ||
int * | value | ||
) |
Gets the value of a characteristic or descriptor's GATT handle as an integer type.
[in] | gatt_handle | The handle of a characteristic or descriptor |
[in] | type | The type of a saved value in gatt_handle |
[in] | offset | The offset from where a value will be read from gatt_handle as an integer type |
[out] | value | The integer type's value of gatt_handle |
BT_ERROR_NONE | Successful |
BT_ERROR_INVALID_PARAMETER | Invalid parameter |
BT_ERROR_NOT_SUPPORTED | Not supported |
int bt_gatt_get_service_uuid | ( | bt_gatt_attribute_h | service, |
char ** | uuid | ||
) |
Gets the UUID of service.
[in] | service | The attribute handle of service |
[out] | uuid | The UUID of service |
BT_ERROR_NONE | Successful |
BT_ERROR_NOT_INITIALIZED | Not initialized |
BT_ERROR_INVALID_PARAMETER | Invalid parameter |
BT_ERROR_OPERATION_FAILED | Operation failed |
BT_ERROR_OUT_OF_MEMORY | Out of memory |
BT_ERROR_PERMISSION_DENIED | Permission denied |
BT_ERROR_NOT_SUPPORTED | Not supported |
int bt_gatt_get_type | ( | bt_gatt_h | gatt_handle, |
bt_gatt_type_e * | gatt_type | ||
) |
Gets the type of GATT handle.
[in] | gatt_handle | The GATT handle |
[out] | gatt_type | The type of gatt_handle |
BT_ERROR_NONE | Successful |
BT_ERROR_INVALID_PARAMETER | Invalid parameter |
BT_ERROR_NOT_SUPPORTED | Not supported |
int bt_gatt_get_uuid | ( | bt_gatt_h | gatt_handle, |
char ** | uuid | ||
) |
Gets the UUID of a service, characteristic or descriptor's GATT handle.
[in] | gatt_handle | The handle of a service, characteristic or descriptor |
[out] | uuid | The string of the UUID of gatt_handle |
BT_ERROR_NONE | Successful |
BT_ERROR_INVALID_PARAMETER | Invalid parameter |
BT_ERROR_NOT_SUPPORTED | Not supported |
int bt_gatt_get_value | ( | bt_gatt_h | gatt_handle, |
char ** | value, | ||
int * | value_length | ||
) |
Gets the value of a characteristic or descriptor's GATT handle.
[in] | gatt_handle | The handle of a characteristic or descriptor |
[out] | value | The value of gatt_handle. It is a byte stream type. |
[out] | value_length | The length of value |
BT_ERROR_NONE | Successful |
BT_ERROR_INVALID_PARAMETER | Invalid parameter |
BT_ERROR_NOT_SUPPORTED | Not supported |
int bt_gatt_read_characteristic_value | ( | bt_gatt_attribute_h | char_handle, |
bt_gatt_characteristic_read_cb | callback | ||
) |
Reads the value of characteristic from remote device.
[in] | char_handle | The attribute handle of characteristic |
[in] | callback | The result callback |
BT_ERROR_NONE | Successful |
BT_ERROR_NOT_INITIALIZED | Not initialized |
BT_ERROR_INVALID_PARAMETER | Invalid parameter |
BT_ERROR_OPERATION_FAILED | Operation failed |
BT_ERROR_PERMISSION_DENIED | Permission denied |
BT_ERROR_NOT_SUPPORTED | Not supported |
int bt_gatt_service_foreach_characteristics | ( | bt_gatt_h | service, |
bt_gatt_foreach_cb | callback, | ||
void * | user_data | ||
) |
Invokes callback function on each characteristic that belongs to the specified service.
[in] | service | The service's GATT handle |
[in] | callback | The function to be invoked on each characteristic |
[in] | user_data | The user data to be passed to callback function |
BT_ERROR_NONE | Successful |
BT_ERROR_INVALID_PARAMETER | Invalid parameter |
BT_ERROR_NOT_SUPPORTED | Not supported |
int bt_gatt_service_foreach_included_services | ( | bt_gatt_h | service, |
bt_gatt_foreach_cb | callback, | ||
void * | user_data | ||
) |
Invokes callback function on each included service that belongs to the specified service.
[in] | service | The service's GATT handle |
[in] | callback | The function to be invoked on each included service |
[in] | user_data | The user data to be passed to the callback function |
BT_ERROR_NONE | Successful |
BT_ERROR_INVALID_PARAMETER | Invalid parameter |
BT_ERROR_NOT_SUPPORTED | Not supported |
int bt_gatt_service_get_characteristic | ( | bt_gatt_h | service, |
const char * | uuid, | ||
bt_gatt_h * | characteristic | ||
) |
Gets a characteristic's GATT handle which has specific UUID.
[in] | service | The service's GATT handle |
[in] | uuid | The characteristic's GATT handle which has this UUID will be returned if it exists |
[out] | characteristic | The characteristic's GATT handle which has uuid if it exists |
BT_ERROR_NONE | Successful |
BT_ERROR_INVALID_PARAMETER | Invalid parameter |
BT_ERROR_NO_DATA | No data available |
BT_ERROR_NOT_SUPPORTED | Not supported |
int bt_gatt_service_get_client | ( | bt_gatt_h | service, |
bt_gatt_client_h * | client | ||
) |
Gets the GATT client handle which the specified service belongs to.
[in] | service | The service's GATT handle |
[out] | client | The GATT client handle which service belongs to |
BT_ERROR_NONE | Successful |
BT_ERROR_INVALID_PARAMETER | Invalid parameter |
BT_ERROR_NOT_SUPPORTED | Not supported |
int bt_gatt_service_get_included_service | ( | bt_gatt_h | service, |
const char * | uuid, | ||
bt_gatt_h * | included_service | ||
) |
Gets an included service's GATT handle which has specific UUID.
[in] | service | The service's GATT handle |
[in] | uuid | The included service's GATT handle which has this UUID will be returned if it exists |
[out] | included_service | The included service's GATT handle which has uuid if it exists |
BT_ERROR_NONE | Successful |
BT_ERROR_INVALID_PARAMETER | Invalid parameter |
BT_ERROR_NO_DATA | No data available |
BT_ERROR_NOT_SUPPORTED | Not supported |
int bt_gatt_set_characteristic_changed_cb | ( | bt_gatt_characteristic_changed_cb | callback, |
void * | user_data | ||
) |
Registers a callback function that will be invoked when a characteristic value is changed.
[in] | callback | The callback function to register |
[in] | user_data | The user data to be passed to the callback function |
BT_ERROR_NONE | Successful |
BT_ERROR_NOT_INITIALIZED | Not initialized |
BT_ERROR_INVALID_PARAMETER | Invalid parameter |
BT_ERROR_NOT_SUPPORTED | Not supported |
int bt_gatt_set_characteristic_value | ( | bt_gatt_attribute_h | characteristic, |
const unsigned char * | value, | ||
int | value_length | ||
) |
Sets the value of characteristic.
[in] | characteristic | The attribute handle of characteristic |
[in] | value | The value of characteristic (byte array) |
[in] | value_length | The length of value |
BT_ERROR_NONE | Successful |
BT_ERROR_NOT_INITIALIZED | Not initialized |
BT_ERROR_INVALID_PARAMETER | Invalid parameter |
BT_ERROR_OPERATION_FAILED | Operation failed |
BT_ERROR_PERMISSION_DENIED | Permission denied |
BT_ERROR_NOT_SUPPORTED | Not supported |
int bt_gatt_set_characteristic_value_request | ( | bt_gatt_attribute_h | characteristic, |
const unsigned char * | value, | ||
int | value_length, | ||
bt_gatt_characteristic_write_cb | callback | ||
) |
Sets the value of characteristic request.
[in] | characteristic | The attribute handle of characteristic |
[in] | value | The value of characteristic (byte array) |
[in] | value_length | The length of value |
[in] | callback | The result callback |
BT_ERROR_NONE | Successful |
BT_ERROR_NOT_INITIALIZED | Not initialized |
BT_ERROR_INVALID_PARAMETER | Invalid parameter |
BT_ERROR_OPERATION_FAILED | Operation failed |
BT_ERROR_PERMISSION_DENIED | Permission denied |
BT_ERROR_NOT_SUPPORTED | Not supported |
int bt_gatt_set_connection_state_changed_cb | ( | bt_gatt_connection_state_changed_cb | callback, |
void * | user_data | ||
) |
Registers a callback function that will be invoked when the connection state is changed.
[in] | callback | The callback function to register. |
[in] | user_data | The user data to be passed to the callback function. |
BT_ERROR_NONE | Successful |
BT_ERROR_NOT_INITIALIZED | Not initialized |
BT_ERROR_INVALID_PARAMETER | Invalid paramater |
BT_ERROR_NOT_SUPPORTED | Not supported |
int bt_gatt_set_float_value | ( | bt_gatt_h | gatt_handle, |
bt_data_type_float_e | type, | ||
int | mantissa, | ||
int | exponent, | ||
int | offset | ||
) |
Updates the value of a characteristic or descriptor's GATT handle using a float type's value.
[in] | gatt_handle | The handle of a characteristic or descriptor |
[in] | type | mantissa and exponent will be saved in gatt_handle as this type |
[in] | mantissa | The mantissa of float type's value to be updated |
[in] | exponent | The exponent of float type's value to be updated |
[in] | offset | The offset from where mantissa and exponent will be saved in gatt_handle |
BT_ERROR_NONE | Successful |
BT_ERROR_INVALID_PARAMETER | Invalid parameter |
BT_ERROR_OPERATION_FAILED | Operation failed |
BT_ERROR_NOT_SUPPORTED | Not supported |
int bt_gatt_set_int_value | ( | bt_gatt_h | gatt_handle, |
bt_data_type_int_e | type, | ||
int | value, | ||
int | offset | ||
) |
Updates the value of a characteristic or descriptor's GATT handle using a integer type's value.
[in] | gatt_handle | The handle of a characteristic or descriptor |
[in] | type | value will be saved in gatt_handle as this type |
[in] | value | The integer type's value to be updated |
[in] | offset | The offset from where value will be saved in gatt_handle |
BT_ERROR_NONE | Successful |
BT_ERROR_INVALID_PARAMETER | Invalid parameter |
BT_ERROR_OPERATION_FAILED | Operation failed |
BT_ERROR_NOT_SUPPORTED | Not supported |
int bt_gatt_set_value | ( | bt_gatt_h | gatt_handle, |
const char * | value, | ||
int | value_length | ||
) |
Updates the value of a characteristic or descriptor's GATT handle.
[in] | gatt_handle | The handle of a characteristic or descriptor |
[in] | value | The value to be updated |
[in] | value_length | The length of value |
BT_ERROR_NONE | Successful |
BT_ERROR_INVALID_PARAMETER | Invalid parameter |
BT_ERROR_OPERATION_FAILED | Operation failed |
BT_ERROR_NOT_SUPPORTED | Not supported |
int bt_gatt_unset_characteristic_changed_cb | ( | void | ) |
Unregisters a callback function that will be invoked when a characteristic is changed.
BT_ERROR_NONE | Successful |
BT_ERROR_NOT_INITIALIZED | Not initialized |
BT_ERROR_NOT_SUPPORTED | Not supported |
int bt_gatt_unset_connection_state_changed_cb | ( | void | ) |
Unregisters a callback function that will be invoked when the connection state is changed.
BT_ERROR_NONE | Successful |
BT_ERROR_NOT_INITIALIZED | Not initialized |
BT_ERROR_NOT_SUPPORTED | Not supported |
int bt_gatt_unwatch_characteristic_changes | ( | bt_gatt_attribute_h | service | ) |
Remove watching of all the characteristic value changes of the service.
[in] | service | The attribute handle of service |
BT_ERROR_NONE | Successful |
BT_ERROR_NOT_INITIALIZED | Not initialized |
BT_ERROR_INVALID_PARAMETER | Invalid parameter |
BT_ERROR_PERMISSION_DENIED | Permission denied |
BT_ERROR_NOT_SUPPORTED | Not supported |
int bt_gatt_watch_characteristic_changes | ( | bt_gatt_attribute_h | service | ) |
Watches all the characteristic value changes of the service.
[in] | service | The attribute handle of service |
BT_ERROR_NONE | Successful |
BT_ERROR_NOT_INITIALIZED | Not initialized |
BT_ERROR_INVALID_PARAMETER | Invalid parameter |
BT_ERROR_PERMISSION_DENIED | Permission denied |
BT_ERROR_NOT_SUPPORTED | Not supported |