Tizen Native API
5.5
|
Bluetooth GATT (Generic Attribute Profile) API provides common functions for GATT client and GATT server.
Required Header
#include <bluetooth.h>
Overview
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 both Server role and 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.
Related Features
This API is related with the following features:
- http://tizen.org/feature/network.bluetooth.le.gatt.server
- http://tizen.org/feature/network.bluetooth.le.gatt.client
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_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_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 characteristic. | |
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_characteristic_get_permissions (bt_gatt_h gatt_handle, int *permissions) |
Gets the permissions which a characteristic's GATT handle has. | |
int | bt_gatt_descriptor_get_permissions (bt_gatt_h gatt_handle, int *permissions) |
Gets the permissions which a descriptor's GATT handle has. | |
int | bt_gatt_characteristic_create (const char *uuid, int permissions, int properties, const char *value, int value_length, bt_gatt_h *characteristic) |
Creates the GATT characteristic. | |
int | bt_gatt_descriptor_create (const char *uuid, int permissions, const char *value, int value_length, bt_gatt_h *descriptor) |
Creates the GATT characteristic descriptor. | |
Typedefs | |
typedef void * | bt_gatt_h |
The handle of a service, characteristic or 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_hrp_connection_state_changed_cb )(int result, bool connected, const char *remote_address) |
Called when the connection state is 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. |
Typedef Documentation
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.
- Since :
- 2.3
- Parameters:
-
[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.
- Since :
- 2.3.1
- Parameters:
-
[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 void* bt_gatt_h |
The handle of a service, characteristic or descriptor.
- Since :
- 2.3.1
typedef void(* bt_hrp_connection_state_changed_cb)(int result, bool connected, const char *remote_address) |
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.
- Since :
- 4.0
- Parameters:
-
[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.
Enumeration Type Documentation
enum bt_data_type_float_e |
enum bt_data_type_int_e |
Enumerations of the integer type for GATT handle's value.
- Since :
- 2.3.1
enum bt_gatt_permission_e |
Enumerations of the attribute's permission.
- Since :
- 3.0
- Enumerator:
enum bt_gatt_property_e |
Enumerations of the characteristic's property.
- Since :
- 2.3.1
- Enumerator:
enum bt_gatt_type_e |
enum bt_gatt_write_type_e |
Function Documentation
int bt_gatt_characteristic_create | ( | const char * | uuid, |
int | permissions, | ||
int | properties, | ||
const char * | value, | ||
int | value_length, | ||
bt_gatt_h * | characteristic | ||
) |
Creates the GATT characteristic.
- Since :
- 3.0
- Remarks:
- The permissions can be one or more values of bt_gatt_permission_e, combined with bitwise 'or'.
-
The properties can be one or more values of bt_gatt_property_e, combined with bitwise 'or'.
- The characteristic should be destroyed by using bt_gatt_characteristic_destroy().
- Parameters:
-
[in] uuid The UUID of the characteristic [in] permissions the permissions of the characteristic [in] properties The properties of the characteristic [in] value The value(byte stream) of the characteristic [in] value_length The length of value [out] characteristic The GATT handle of the created characteristic
- Returns:
- 0 on success, otherwise a negative error value
- Return values:
-
BT_ERROR_NONE Successful BT_ERROR_INVALID_PARAMETER Invalid parameter BT_ERROR_OUT_OF_MEMORY Out of memory BT_ERROR_NOT_SUPPORTED Not supported
- See also:
- bt_gatt_characteristic_destroy()
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.
- Since :
- 2.3.1
- Parameters:
-
[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
- Returns:
- 0 on success, otherwise a negative error value
- Return values:
-
BT_ERROR_NONE Successful BT_ERROR_INVALID_PARAMETER Invalid parameter BT_ERROR_NOT_SUPPORTED Not supported
- See also:
- bt_gatt_foreach_cb()
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.
- Since :
- 2.3.1
- Remarks:
- The returned GATT handle must not be freed by application.
It will be freed when an associated client is destroyed by bt_gatt_client_destroy().
If there are multiple descriptors which have same UUID, only the first matched one will be returned.
- Parameters:
-
[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
- Returns:
- 0 on success, otherwise a negative error value
- Return values:
-
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_permissions | ( | bt_gatt_h | gatt_handle, |
int * | permissions | ||
) |
Gets the permissions which a characteristic's GATT handle has.
- Since :
- 3.0
- Remarks:
- The permissions can be one or more values of bt_gatt_permission_e, combined with bitwise 'or'.
- Parameters:
-
[in] gatt_handle The handle of a characteristic [out] permissions The permissions which a characteristic's GATT handle has
- 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_gatt_characteristic_get_properties | ( | bt_gatt_h | characteristic, |
int * | properties | ||
) |
Gets the properties which a characteristic's GATT handle has.
- Since :
- 2.3.1
- Parameters:
-
[in] characteristic The characteristic's GATT handle [out] properties The properties which a characteristic's GATT handle has
- Returns:
- 0 on success, otherwise a negative error value
- Return values:
-
BT_ERROR_NONE Successful BT_ERROR_INVALID_PARAMETER Invalid parameter BT_ERROR_NOT_SUPPORTED Not supported
- See also:
- bt_gatt_property_e
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.
- Since :
- 2.3.1
- Remarks:
- The returned GATT handle must not be freed by application.
It will be freed when an associated client is destroyed by bt_gatt_client_destroy().
- Parameters:
-
[in] characteristic The characteristic's GATT handle [out] service The service's GATT handle which characteristic belongs to
- 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_gatt_characteristic_get_write_type | ( | bt_gatt_h | characteristic, |
bt_gatt_write_type_e * | write_type | ||
) |
Gets the write type of the specified characteristic.
- Since :
- 2.3.1
- Parameters:
-
[in] characteristic The characteristic's GATT handle [out] write_type The write type of the specified characteristic
- Returns:
- 0 on success, otherwise a negative error value
- Return values:
-
BT_ERROR_NONE Successful BT_ERROR_INVALID_PARAMETER Invalid parameter BT_ERROR_NOT_SUPPORTED Not supported
- See also:
- bt_gatt_write_type_e
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 characteristic.
- Since :
- 2.3.1
- Parameters:
-
[in] characteristic The characteristic's GATT handle [in] write_type The write type to be updated
- 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_gatt_descriptor_create | ( | const char * | uuid, |
int | permissions, | ||
const char * | value, | ||
int | value_length, | ||
bt_gatt_h * | descriptor | ||
) |
Creates the GATT characteristic descriptor.
- Since :
- 3.0
- Remarks:
- The permissions can be one or more values of bt_gatt_permission_e, combined with bitwise 'or'.
- The descriptor should be destroyed by using bt_gatt_descriptor_destroy().
- Parameters:
-
[in] uuid The UUID of the descriptor [in] permissions The permissions of the descriptor [in] value The value(byte stream) associated with the descriptor [in] value_length The length of value [out] descriptor The GATT handle of the created characteristic descriptor
- Returns:
- 0 on success, otherwise a negative error value
- Return values:
-
BT_ERROR_NONE Successful BT_ERROR_INVALID_PARAMETER Invalid parameter BT_ERROR_OUT_OF_MEMORY Out of memory BT_ERROR_NOT_SUPPORTED Not supported
- See also:
- bt_gatt_descriptor_destroy()
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.
- Since :
- 2.3.1
- Remarks:
- The returned GATT handle must not be freed by application.
It will be freed when an associated client is destroyed by bt_gatt_client_destroy().
- Parameters:
-
[in] descriptor The descriptor's GATT handle [out] characteristic The characteristic's GATT handle which descriptor belongs to
- 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_gatt_descriptor_get_permissions | ( | bt_gatt_h | gatt_handle, |
int * | permissions | ||
) |
Gets the permissions which a descriptor's GATT handle has.
- Since :
- 3.0
- Remarks:
- The permissions can be one or more values of bt_gatt_permission_e, combined with bitwise 'or'.
- Parameters:
-
[in] gatt_handle The handle of a descriptor [out] permissions The permissions which a descriptor's GATT handle has
- 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_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.
- Since :
- 2.3.1
- Remarks:
- This function returns a locally saved value in gatt_handle.
When gatt_handle is associated with bt_gatt_client_h, bt_gatt_client_read_value() must be used prior to this function
in order to get the remote device's current value.
- Parameters:
-
[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
- 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_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.
- Since :
- 2.3.1
- Remarks:
- This function returns a locally saved value in gatt_handle.
When gatt_handle is associated with bt_gatt_client_h, bt_gatt_client_read_value() must be used prior to this function
in order to get the remote device's current value.
- Parameters:
-
[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
- 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_gatt_get_type | ( | bt_gatt_h | gatt_handle, |
bt_gatt_type_e * | gatt_type | ||
) |
Gets the type of GATT handle.
- Since :
- 2.3.1
- Parameters:
-
[in] gatt_handle The GATT handle [out] gatt_type The type of gatt_handle
- 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_gatt_get_uuid | ( | bt_gatt_h | gatt_handle, |
char ** | uuid | ||
) |
Gets the UUID of a service, characteristic or descriptor's GATT handle.
- Since :
- 2.3.1
- Remarks:
- uuid must be released using free().
16-bit UUID or 128-bit UUID is supported. (e.g. 2A19, 00002A19-0000-1000-8000-00805F9B34FB).
- Parameters:
-
[in] gatt_handle The handle of a service, characteristic or descriptor [out] uuid The string of the UUID of gatt_handle
- 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_gatt_get_value | ( | bt_gatt_h | gatt_handle, |
char ** | value, | ||
int * | value_length | ||
) |
Gets the value of a characteristic or descriptor's GATT handle.
- Since :
- 2.3.1
- Remarks:
- value must be released using free().
When gatt_handle is associated with bt_gatt_client_h, bt_gatt_client_read_value() must be used prior to this function
in order to get the remote device's current value.
- Parameters:
-
[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
- 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_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.
- Since :
- 2.3.1
- Parameters:
-
[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
- Returns:
- 0 on success, otherwise a negative error value
- Return values:
-
BT_ERROR_NONE Successful BT_ERROR_INVALID_PARAMETER Invalid parameter BT_ERROR_NOT_SUPPORTED Not supported
- See also:
- bt_gatt_foreach_cb()
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.
- Since :
- 2.3.1
- Parameters:
-
[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
- Returns:
- 0 on success, otherwise a negative error value
- Return values:
-
BT_ERROR_NONE Successful BT_ERROR_INVALID_PARAMETER Invalid parameter BT_ERROR_NOT_SUPPORTED Not supported
- See also:
- bt_gatt_foreach_cb()
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.
- Since :
- 2.3.1
- Remarks:
- The returned GATT handle must not be freed by application.
It will be freed when an associated client is destroyed by bt_gatt_client_destroy().
If there are multiple characteristics which have same UUID, only the first matched one will be returned.
- Parameters:
-
[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
- Returns:
- 0 on success, otherwise a negative error value
- Return values:
-
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_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.
- Since :
- 2.3.1
- Remarks:
- The returned GATT handle must not be freed by application.
It will be freed when an associated client is destroyed by bt_gatt_client_destroy().
If there are multiple included services which have same UUID, only the first matched one will be returned.
- Parameters:
-
[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
- Returns:
- 0 on success, otherwise a negative error value
- Return values:
-
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_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.
- Since :
- 2.3.1
- Remarks:
- This function updates a value of gatt_handle locally.
When gatt_handle is associated with bt_gatt_client_h, bt_gatt_client_write_value() can be used after this function
in order to update the remote device's value.
- Parameters:
-
[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
- Returns:
- 0 on success, otherwise a negative error value
- Return values:
-
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.
- Since :
- 2.3.1
- Remarks:
- This function updates a value of gatt_handle locally.
When gatt_handle is associated with bt_gatt_client_h, bt_gatt_client_write_value() can be used after this function
in order to update the remote device's value.
- Parameters:
-
[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
- Returns:
- 0 on success, otherwise a negative error value
- Return values:
-
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.
- Since :
- 2.3.1
- Remarks:
- This function updates a value of gatt_handle locally.
When gatt_handle is associated with bt_gatt_client_h, bt_gatt_client_write_value() can be used after this function
in order to update the remote device's value.
- Parameters:
-
[in] gatt_handle The handle of a characteristic or descriptor [in] value The value to be updated [in] value_length The length of value
- Returns:
- 0 on success, otherwise a negative error value
- Return values:
-
BT_ERROR_NONE Successful BT_ERROR_INVALID_PARAMETER Invalid parameter BT_ERROR_OPERATION_FAILED Operation failed BT_ERROR_NOT_SUPPORTED Not supported