mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-25 16:43:28 +00:00
att_server: document delayed write
This commit is contained in:
parent
4431fb7a03
commit
d72e9d4b1d
@ -633,6 +633,8 @@ Similar to other protocols, it might be not possible to send any time.
|
||||
To send a Notification, you can call *att_server_request_to_send_notification*
|
||||
to request a callback, when yuo can send the Notification.
|
||||
|
||||
### Deferred Handling of ATT Read / Write Requests
|
||||
|
||||
If your application cannot handle an ATT Read Request in the *att_read_callback*
|
||||
in some situations, you can enable support for this by adding ENABLE_ATT_DELAYED_RESPONSE
|
||||
to *btstack_config.h*. Now, you can store the requested attribute handle and return
|
||||
@ -646,6 +648,12 @@ When you've got the data for all requested attributes ready, you can call
|
||||
Please keep in mind that there is only one active ATT operation and that it has a 30 second
|
||||
timeout after which the ATT server is considered defunct by the GATT Client.
|
||||
|
||||
Similarly, you can return ATT_ERROR_WRITE_RESPONSE_PENDING in the *att_write_callback*.
|
||||
The ATT Server will not respond to the ATT Client in this case and wait for your code to
|
||||
call *att_server_response_ready*, which then triggers the *att_write_callback* again.
|
||||
|
||||
Please have a look at the [ATT Delayed Response example](../examples/examples/#sec:attdelayedresponseExample).
|
||||
|
||||
### Implementing Standard GATT Services {#sec:GATTStandardServices}
|
||||
|
||||
Implementation of a standard GATT Service consists of the following 4 steps:
|
||||
|
@ -127,13 +127,17 @@ typedef struct att_connection {
|
||||
#define ATT_READ_RESPONSE_PENDING 0xffffu
|
||||
|
||||
// internally used to signal write response pending
|
||||
// To ask ATT Server to defer the write response, you can return ATT_ERROR_WRITE_RESPONSE_PENDING in your att_write_callback
|
||||
#define ATT_INTERNAL_WRITE_RESPONSE_PENDING 0xfffeu
|
||||
|
||||
/**
|
||||
* @brief ATT Client Read Callback for Dynamic Data
|
||||
* - if buffer == NULL, don't copy data, just return size of value
|
||||
* - if buffer != NULL, copy data and return number bytes copied
|
||||
*
|
||||
* If ENABLE_ATT_DELAYED_READ_RESPONSE is defined, you may return ATT_READ_RESPONSE_PENDING if data isn't available yet
|
||||
* and call att_server_response_ready to re-trigger the callback.
|
||||
*
|
||||
* @param con_handle of hci le connection
|
||||
* @param attribute_handle to be read
|
||||
* @param offset defines start of attribute value
|
||||
@ -152,6 +156,9 @@ typedef uint16_t (*att_read_callback_t)(hci_con_handle_t con_handle, uint16_t at
|
||||
*
|
||||
* If the additional validation step is not needed, just return 0 for all callbacks with transaction mode ATT_TRANSACTION_MODE_VALIDATE.
|
||||
*
|
||||
* If ENABLE_ATT_DELAYED_READ_RESPONSE is defined, you may return ATT_ERROR_WRITE_RESPONSE_PENDING if data isn't available yet
|
||||
* and call att_server_response_ready to re-trigger the callback.
|
||||
*
|
||||
* @param con_handle of hci le connection
|
||||
* @param attribute_handle to be written
|
||||
* @param transaction - ATT_TRANSACTION_MODE_NONE for regular writes. For prepared writes: ATT_TRANSACTION_MODE_ACTIVE, ATT_TRANSACTION_MODE_VALIDATE, ATT_TRANSACTION_MODE_EXECUTE, ATT_TRANSACTION_MODE_CANCEL
|
||||
|
Loading…
x
Reference in New Issue
Block a user