dotstack API Reference
1.10.37
|
This module describes functions and data structures used to implement an ATT client (central). More...
Modules | |
Configuration | |
This module describes parameters used to configure ATT client layer. | |
Data Structures | |
struct | bt_att_find_info_response_t |
Structure to store response to a "find info" request. More... | |
struct | bt_att_find_by_type_value_response_t |
Structure to store response to a "find by type value" request. More... | |
struct | bt_att_read_by_type_response_t |
Structure to store response to a "read by type" request. More... | |
struct | bt_att_read_by_group_type_response_t |
Structure to store response to a "read by group type" request. More... | |
struct | bt_att_client_evt_mtu_response_t |
Parameter to ATT_CLIENT_EVT_EXCHANGE_MTU_RESPONSE event. More... | |
struct | bt_att_client_evt_info_response_t |
Parameter to ATT_CLIENT_EVT_FIND_INFO_RESPONSE event. More... | |
struct | bt_att_client_evt_find_by_type_value_response_t |
Parameter to ATT_CLIENT_EVT_FIND_BY_TYPE_VALUE_RESPONSE event. More... | |
struct | bt_att_client_evt_read_by_type_response_t |
Parameter to ATT_CLIENT_EVT_READ_BY_TYPE_RESPONSE event. More... | |
struct | bt_att_client_evt_read_response_t |
Parameter to ATT_CLIENT_EVT_READ_RESPONSE event. More... | |
struct | bt_att_client_evt_read_blob_response_t |
Parameter to ATT_CLIENT_EVT_READ_BLOB_RESPONSE event. More... | |
struct | bt_att_client_evt_read_multiple_response_t |
Parameter to ATT_CLIENT_EVT_READ_MULTIPLE_RESPONSE event. More... | |
struct | bt_att_client_evt_read_by_group_type_response_t |
Parameter to ATT_CLIENT_EVT_READ_BY_GROUP_TYPE_RESPONSE event. More... | |
struct | bt_att_client_evt_write_response_t |
Parameter to ATT_CLIENT_EVT_WRITE_RESPONSE event. More... | |
struct | bt_att_client_evt_prepare_write_response_t |
Parameter to ATT_CLIENT_EVT_PREPARE_WRITE_RESPONSE event. More... | |
struct | bt_att_client_evt_execute_write_response_t |
Parameter to ATT_CLIENT_EVT_EXECUTE_WRITE_RESPONSE event. More... | |
struct | bt_att_client_evt_value_notification_t |
Parameter to ATT_CLIENT_EVT_VALUE_NOTIFICATION event. More... | |
struct | bt_att_client_evt_value_indication_t |
Parameter to ATT_CLIENT_EVT_VALUE_INDICATION event. More... | |
struct | bt_att_client_evt_conn_param_update_t |
Parameter to ATT_CLIENT_EVT_CONN_PARAM_UPDATE_REQUEST event. More... | |
struct | bt_att_client_evt_conn_param_update_completed_t |
Parameter to ATT_CLIENT_EVT_CONN_PARAM_UPDATE_COMPLETED event. More... | |
struct | bt_att_client_evt_write_cmd_sent_t |
Parameter to ATT_CLIENT_EVT_WRITE_COMMAND_SENT event. More... | |
struct | bt_att_client_evt_signed_write_cmd_sent_t |
Parameter to ATT_CLIENT_EVT_SIGNED_WRITE_COMMAND_SENT event. More... | |
union | bt_att_client_evt_t |
Parameter to ATT client application callback. More... | |
Functions | |
bt_bool | bt_att_client_init (void) |
Initialize the ATT client. More... | |
bt_att_client_mgr_t * | bt_att_get_client_mgr (void) |
Return a pointer to an instance of the ATT client manager. More... | |
bt_att_client_session_t * | bt_att_client_allocate_session (bt_att_client_session_callback_fp callback, void *callback_param) |
Allocate ATT client session. More... | |
void | bt_att_client_free_session (bt_att_client_session_t *session) |
Destroy ATT client session. More... | |
bt_bool | bt_att_client_connect (bt_att_client_session_t *session, bt_bdaddr_t *addr) |
Connect to a remote device (peripheral). More... | |
bt_bool | bt_att_client_disconnect (bt_att_client_session_t *session) |
Disconnect from a remote device. More... | |
bt_bool | bt_att_client_exchange_mtu (bt_att_client_session_t *session, bt_uint mtu) |
Exchange MTU. More... | |
bt_bool | bt_att_client_find_info (bt_att_client_session_t *session, bt_uint start_handle, bt_uint end_handle, bt_att_find_info_response_t *result, bt_uint max_results) |
Find Information. More... | |
bt_bool | bt_att_client_find_by_type_value (bt_att_client_session_t *session, bt_uint start_handle, bt_uint end_handle, bt_uint type, const bt_byte *value, bt_uint len, bt_att_find_by_type_value_response_t *result, bt_uint max_results) |
Find By Type Value. More... | |
bt_bool | bt_att_client_read_by_type (bt_att_client_session_t *session, bt_uint start_handle, bt_uint end_handle, bt_uint type, bt_att_read_by_type_response_t *result, bt_uint max_results) |
Read By Type (16-bit). More... | |
bt_bool | bt_att_client_read_by_type_80 (bt_att_client_session_t *session, bt_uint start_handle, bt_uint end_handle, bt_uuid_t *type, bt_att_read_by_type_response_t *result, bt_uint max_results) |
Read By Type (128-bit). More... | |
bt_bool | bt_att_client_read (bt_att_client_session_t *session, bt_uint handle) |
Read Attribute value. More... | |
bt_bool | bt_att_client_read_blob (bt_att_client_session_t *session, bt_uint handle, bt_uint offset) |
Read Blob. More... | |
bt_bool | bt_att_client_read_multiple (bt_att_client_session_t *session, const bt_uint *handles, bt_uint count) |
Read Multiple. More... | |
bt_bool | bt_att_client_read_by_group_type (bt_att_client_session_t *session, bt_uint start_handle, bt_uint end_handle, bt_uint group_type, bt_att_read_by_group_type_response_t *result, bt_uint max_results) |
Read By Group Type (16-bit). More... | |
bt_bool | bt_att_client_read_by_group_type_80 (bt_att_client_session_t *session, bt_uint start_handle, bt_uint end_handle, bt_uuid_t *group_type, bt_att_read_by_group_type_response_t *result, bt_uint max_results) |
Read By Group Type (128-bit). More... | |
bt_bool | bt_att_client_write (bt_att_client_session_t *session, bt_uint handle, const bt_byte *value, bt_uint len) |
Write Attribute Value. More... | |
bt_bool | bt_att_client_write_cmd (bt_att_client_session_t *session, bt_uint handle, const bt_byte *value, bt_uint len) |
Write Command. More... | |
bt_bool | bt_att_client_signed_write (bt_att_client_session_t *session, bt_uint handle, const bt_byte *value, bt_uint len, const bt_byte *signature) |
Signed Write Command. More... | |
bt_bool | bt_att_client_prepare_write (bt_att_client_session_t *session, bt_uint handle, bt_uint value_offset, const bt_byte *value, bt_uint len) |
Prepare Write. More... | |
bt_bool | bt_att_client_execute_write (bt_att_client_session_t *session, bt_byte flags) |
Execute Write. More... | |
bt_bool | bt_att_client_accept_conn_param_update (bt_att_client_session_t *session, bt_uint min_interval, bt_uint max_interval, bt_uint slave_latency, bt_uint supervision_timeout, bt_uint min_ce_length, bt_uint max_ce_length) |
Accept connection parameters update. More... | |
void | bt_att_client_reject_conn_param_update (bt_att_client_session_t *session) |
Reject connection parameters update. More... | |
bt_bdaddr_t * | bt_att_client_get_remote_address (const bt_att_client_session_t *session) |
Get the address of the remote device this device is connected to. More... | |
Events | |
#define | ATT_CLIENT_SESSION_EVT_SESSION_CONNECTED 1 |
This event is generated when client connected to the server. | |
#define | ATT_CLIENT_SESSION_EVT_SESSION_DISCONNECTED 2 |
This event is generated when client disconnected from the server. | |
#define | ATT_CLIENT_SESSION_EVT_CONNECTION_FAILED 3 |
This event is generated when client failed to connect to the server. | |
#define | ATT_CLIENT_SESSION_EVT_TRAN_TIMEOUT 7 |
This event is generated if operation (find, read, write) timed out. | |
#define | ATT_CLIENT_EVT_EXCHANGE_MTU_RESPONSE 10 |
This event is generated when client received a response (either positive or negative) to a "exchange MTU" request. | |
#define | ATT_CLIENT_EVT_FIND_INFO_RESPONSE 11 |
This event is generated when client received a response (either positive or negative) to a "find info" request. | |
#define | ATT_CLIENT_EVT_FIND_BY_TYPE_VALUE_RESPONSE 12 |
This event is generated when client received a response (either positive or negative) to a "find by type value" request. | |
#define | ATT_CLIENT_EVT_READ_BY_TYPE_RESPONSE 13 |
This event is generated when client received a response (either positive or negative) to a "read by type" request. | |
#define | ATT_CLIENT_EVT_READ_RESPONSE 14 |
This event is generated when client received a response (either positive or negative) to a "read" request. | |
#define | ATT_CLIENT_EVT_READ_BLOB_RESPONSE 15 |
This event is generated when client received a response (either positive or negative) to a "read blob" request. | |
#define | ATT_CLIENT_EVT_READ_MULTIPLE_RESPONSE 16 |
This event is generated when client received a response (either positive or negative) to a "read multiple" request. | |
#define | ATT_CLIENT_EVT_READ_BY_GROUP_TYPE_RESPONSE 17 |
This event is generated when client received a response (either positive or negative) to a "read by group type" request. | |
#define | ATT_CLIENT_EVT_WRITE_RESPONSE 18 |
This event is generated when client received a response (either positive or negative) to a "write" request. | |
#define | ATT_CLIENT_EVT_PREPARE_WRITE_RESPONSE 19 |
This event is generated when client received a response (either positive or negative) to a "preapare write" request. | |
#define | ATT_CLIENT_EVT_EXECUTE_WRITE_RESPONSE 20 |
This event is generated when client received a response (either positive or negative) to a "execute write" request. | |
#define | ATT_CLIENT_EVT_VALUE_NOTIFICATION 21 |
This event is generated when client received attribute value notification. | |
#define | ATT_CLIENT_EVT_VALUE_INDICATION 22 |
This event is generated when client received attribute value indication. | |
#define | ATT_CLIENT_EVT_WRITE_COMMAND_SENT 23 |
This event is generated when a write command has been sent. | |
#define | ATT_CLIENT_EVT_SIGNED_WRITE_COMMAND_SENT 24 |
This event is generated when a signed write command has been sent. | |
#define | ATT_CLIENT_EVT_CONN_PARAM_UPDATE_REQUEST 50 |
This event is generated when client received a "connection parameter update" request. | |
#define | ATT_CLIENT_EVT_CONN_PARAM_UPDATE_COMPLETED 51 |
This event is generated after the new connection parameters have been sent. | |
This module describes functions and data structures used to implement an ATT client (central).
bt_bool bt_att_client_accept_conn_param_update | ( | bt_att_client_session_t * | session, |
bt_uint | min_interval, | ||
bt_uint | max_interval, | ||
bt_uint | slave_latency, | ||
bt_uint | supervision_timeout, | ||
bt_uint | min_ce_length, | ||
bt_uint | max_ce_length | ||
) |
Accept connection parameters update.
When a server sends "connection parameters update" request a ATT_CLIENT_EVT_CONN_PARAM_UPDATE_REQUEST event is generated. Client has to either accept the request or deny it. bt_att_client_accept_conn_param_update
is used to accept the request.
session | ATT session. |
min_interval | Minimum connection interval expressed in 1.25ms units. |
max_interval | Maximum connection interval expressed in 1.25ms units. |
slave_latency | Slave latency expressed as number of connection events. |
supervision_timeout | Link supervision timeout expressed in 10ms units. |
min_ce_length | Information parameter about the minimum length of connection needed for this LE connection expressed in 0.625ms units. |
max_ce_length | Information parameter about the maximum length of connection needed for this LE connection expressed in 0.625ms units. |
TRUE
if a request has been sent. FALSE
otherwise. No events will be generated. bt_att_client_session_t* bt_att_client_allocate_session | ( | bt_att_client_session_callback_fp | callback, |
void * | callback_param | ||
) |
Allocate ATT client session.
This function allocates a new ATT client session.
callback | The callback function that will be called when the ATT client generates an event. |
callback_param | A pointer to arbitrary data to be passed to the callback callback. |
NULL
otherwise. bt_bool bt_att_client_connect | ( | bt_att_client_session_t * | session, |
bt_bdaddr_t * | addr | ||
) |
Connect to a remote device (peripheral).
This function establishes a connection to a remote device specified by the addr
. If connection cannot be initiated for some reason, for example, there is not enough resources, it returns FALSE and no events are generated. Otherwise the result of an attempt to connect to the remote device is reported via the ATT client callback. The events generated will either be ATT_CLIENT_SESSION_EVT_SESSION_CONNECTED or ATT_CLIENT_SESSION_EVT_CONNECTION_FAILED.
session | ATT session. |
addr | The address of a remote device. |
TRUE
if connection establishment has been started. FALSE
otherwise. bt_bool bt_att_client_disconnect | ( | bt_att_client_session_t * | session | ) |
Disconnect from a remote device.
This function closes a connection to a remote device. After the connection has been terminated the ATT client callback is called with ATT_CLIENT_SESSION_EVT_SESSION_CONNECTED event.
session | ATT session. |
TRUE
if disconnection has been started. FALSE
otherwise. No events will be generated. bt_bool bt_att_client_exchange_mtu | ( | bt_att_client_session_t * | session, |
bt_uint | mtu | ||
) |
Exchange MTU.
This function informs the server about the client's MTU. In response to the "exchange MTU" request the server sends its MTU to the client.
session | ATT session. |
mtu | Client's MTU. |
TRUE
if a request has been sent. FALSE
otherwise. No events will be generated. bt_bool bt_att_client_execute_write | ( | bt_att_client_session_t * | session, |
bt_byte | flags | ||
) |
Execute Write.
This function sends a "execute write request to the client. ATT_CLIENT_EVT_EXECUTE_WRITE_RESPONSE event is generated when the response from the client has been received.
session | ATT session. |
flags | This can be one of the following values:
|
TRUE
if a request has been sent. FALSE
otherwise. No events will be generated. bt_bool bt_att_client_find_by_type_value | ( | bt_att_client_session_t * | session, |
bt_uint | start_handle, | ||
bt_uint | end_handle, | ||
bt_uint | type, | ||
const bt_byte * | value, | ||
bt_uint | len, | ||
bt_att_find_by_type_value_response_t * | result, | ||
bt_uint | max_results | ||
) |
Find By Type Value.
This function sends a "find by type value request to the client. ATT_CLIENT_EVT_FIND_BY_TYPE_VALUE_RESPONSE event is generated when the response from the client has been received.
session | ATT session. |
start_handle | First requested handle number. |
end_handle | Last requested handle number. |
type | Attribute type. |
value | Attribute value to find. |
len | Length of the value . |
result | Pointer to a buffer where response will be stored. |
max_result | The maximum number of responses that result can store. |
TRUE
if a request has been sent. FALSE
otherwise. No events will be generated. bt_bool bt_att_client_find_info | ( | bt_att_client_session_t * | session, |
bt_uint | start_handle, | ||
bt_uint | end_handle, | ||
bt_att_find_info_response_t * | result, | ||
bt_uint | max_results | ||
) |
Find Information.
This function sends a "find information request to the client. ATT_CLIENT_EVT_FIND_INFO_RESPONSE event is generated when the response from the client has been received.
session | ATT session. |
start_handle | First requested handle number. |
end_handle | Last requested handle number. |
result | Pointer to a buffer where response will be stored. |
max_result | The maximum number of responses that result can store. |
TRUE
if a request has been sent. FALSE
otherwise. No events will be generated. void bt_att_client_free_session | ( | bt_att_client_session_t * | session | ) |
Destroy ATT client session.
This function frees memory used by the session. The session has to exist and be in the "idle" state for this function to succeed. I.e. the session has to be disconnected before this function can be called.
session | ATT session. |
TRUE
if the function succeeds. FALSE
otherwise. bt_bdaddr_t* bt_att_client_get_remote_address | ( | const bt_att_client_session_t * | session | ) |
Get the address of the remote device this device is connected to.
session | ATT client session. |
A
pointer to bt_bdaddr structure that contains the address of the remote device. bt_bool bt_att_client_init | ( | void | ) |
Initialize the ATT client.
This function initializes the ATT client of the stack. It must be called prior to any other ATT client function can be called.
bt_bool bt_att_client_prepare_write | ( | bt_att_client_session_t * | session, |
bt_uint | handle, | ||
bt_uint | value_offset, | ||
const bt_byte * | value, | ||
bt_uint | len | ||
) |
Prepare Write.
This function sends a "prepare write request to the client. ATT_CLIENT_EVT_PREPARE_WRITE_RESPONSE event is generated when the response from the client has been received.
session | ATT session. |
handle | The handle of the attribute to be written. |
value_offset | The offset of the first octet to be written. |
value | The value to be written to the attribute. |
len | The length of the value . |
TRUE
if a request has been sent. FALSE
otherwise. No events will be generated. bt_bool bt_att_client_read | ( | bt_att_client_session_t * | session, |
bt_uint | handle | ||
) |
Read Attribute value.
This function sends a "read request to the client. ATT_CLIENT_EVT_READ_RESPONSE event is generated when the response from the client has been received.
session | ATT session. |
handle | The handle of the attribute to be read. |
TRUE
if a request has been sent. FALSE
otherwise. No events will be generated. bt_bool bt_att_client_read_blob | ( | bt_att_client_session_t * | session, |
bt_uint | handle, | ||
bt_uint | offset | ||
) |
Read Blob.
This function sends a "read blob request to the client. ATT_CLIENT_EVT_READ_BLOB_RESPONSE event is generated when the response from the client has been received.
session | ATT session. |
handle | The handle of the attribute to be read. |
offset | The offset of the first octet to be read. |
TRUE
if a request has been sent. FALSE
otherwise. No events will be generated. bt_bool bt_att_client_read_by_group_type | ( | bt_att_client_session_t * | session, |
bt_uint | start_handle, | ||
bt_uint | end_handle, | ||
bt_uint | group_type, | ||
bt_att_read_by_group_type_response_t * | result, | ||
bt_uint | max_results | ||
) |
Read By Group Type (16-bit).
This function sends a "read by group type request to the client. ATT_CLIENT_EVT_READ_BY_GROUP_TYPE_RESPONSE event is generated when the response from the client has been received.
session | ATT session. |
start_handle | First requested handle number. |
end_handle | Last requested handle number. |
group_type | 16-bit Attribute Group Type. |
result | Pointer to a buffer where response will be stored. |
max_result | The maximum number of responses that result can store. |
TRUE
if a request has been sent. FALSE
otherwise. No events will be generated. bt_bool bt_att_client_read_by_group_type_80 | ( | bt_att_client_session_t * | session, |
bt_uint | start_handle, | ||
bt_uint | end_handle, | ||
bt_uuid_t * | group_type, | ||
bt_att_read_by_group_type_response_t * | result, | ||
bt_uint | max_results | ||
) |
Read By Group Type (128-bit).
This function sends a "read by group type request to the client. ATT_CLIENT_EVT_READ_BY_GROUP_TYPE_RESPONSE event is generated when the response from the client has been received.
session | ATT session. |
start_handle | First requested handle number. |
end_handle | Last requested handle number. |
group_type | 128-bit Attribute Group Type. |
result | Pointer to a buffer where response will be stored. |
max_result | The maximum number of responses that result can store. |
TRUE
if a request has been sent. FALSE
otherwise. No events will be generated. bt_bool bt_att_client_read_by_type | ( | bt_att_client_session_t * | session, |
bt_uint | start_handle, | ||
bt_uint | end_handle, | ||
bt_uint | type, | ||
bt_att_read_by_type_response_t * | result, | ||
bt_uint | max_results | ||
) |
Read By Type (16-bit).
This function sends a "read by type request to the client. ATT_CLIENT_EVT_READ_BY_TYPE_RESPONSE event is generated when the response from the client has been received.
session | ATT session. |
start_handle | First requested handle number. |
end_handle | Last requested handle number. |
type | 16-bit attribute type. |
result | Pointer to a buffer where response will be stored. |
max_result | The maximum number of responses that result can store. |
TRUE
if a request has been sent. FALSE
otherwise. No events will be generated. bt_bool bt_att_client_read_by_type_80 | ( | bt_att_client_session_t * | session, |
bt_uint | start_handle, | ||
bt_uint | end_handle, | ||
bt_uuid_t * | type, | ||
bt_att_read_by_type_response_t * | result, | ||
bt_uint | max_results | ||
) |
Read By Type (128-bit).
This function sends a "read by type request to the client. ATT_CLIENT_EVT_READ_BY_TYPE_RESPONSE event is generated when the response from the client has been received.
session | ATT session. |
start_handle | First requested handle number. |
end_handle | Last requested handle number. |
type | 128-bit attribute type. |
result | Pointer to a buffer where response will be stored. |
max_result | The maximum number of responses that result can store. |
TRUE
if a request has been sent. FALSE
otherwise. No events will be generated. bt_bool bt_att_client_read_multiple | ( | bt_att_client_session_t * | session, |
const bt_uint * | handles, | ||
bt_uint | count | ||
) |
Read Multiple.
This function sends a "read blob request to the client. ATT_CLIENT_EVT_READ_MULTIPLE_RESPONSE event is generated when the response from the client has been received.
session | ATT session. |
handles | The list of two or more handles. |
count | The number of handles in handles . |
TRUE
if a request has been sent. FALSE
otherwise. No events will be generated. void bt_att_client_reject_conn_param_update | ( | bt_att_client_session_t * | session | ) |
Reject connection parameters update.
When a server sends "connection parameters update" request a ATT_CLIENT_EVT_CONN_PARAM_UPDATE_REQUEST event is generated. Client has to either accept the request or deny it. bt_att_client_reject_conn_param_update
is used to deny the request.
session | ATT session. |
TRUE
if a request has been sent. FALSE
otherwise. No events will be generated. bt_bool bt_att_client_signed_write | ( | bt_att_client_session_t * | session, |
bt_uint | handle, | ||
const bt_byte * | value, | ||
bt_uint | len, | ||
const bt_byte * | signature | ||
) |
Signed Write Command.
This function sends a "signed write command request to the client. No event is generated.
session | ATT session. |
handle | The handle of the attribute to be written. |
value | The value to be written to the attribute. |
len | The length of the value . |
signature | Authentication signature (12 bytes). |
TRUE
if a request has been sent. FALSE
otherwise. No events will be generated. bt_bool bt_att_client_write | ( | bt_att_client_session_t * | session, |
bt_uint | handle, | ||
const bt_byte * | value, | ||
bt_uint | len | ||
) |
Write Attribute Value.
This function sends a "write request to the client. ATT_CLIENT_EVT_WRITE_RESPONSE event is generated when the response from the client has been received.
session | ATT session. |
handle | The handle of the attribute to be written. |
value | The value to be written to the attribute. |
len | The length of the value . |
TRUE
if a request has been sent. FALSE
otherwise. No events will be generated. bt_bool bt_att_client_write_cmd | ( | bt_att_client_session_t * | session, |
bt_uint | handle, | ||
const bt_byte * | value, | ||
bt_uint | len | ||
) |
Write Command.
This function sends a "write command request to the client. No event is generated.
session | ATT session. |
handle | The handle of the attribute to be written. |
value | The value to be written to the attribute. |
len | The length of the value . |
TRUE
if a request has been sent. FALSE
otherwise. No events will be generated. bt_att_client_mgr_t* bt_att_get_client_mgr | ( | void | ) |
Return a pointer to an instance of the ATT client manager.
This function returns a pointer to an instance of the ATT client manager. There is only one instance of the manager allocated by the stack.