mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-02-10 06:40:23 +00:00
ATT Server: return error if request to send now for Notification or Indication already registered
This commit is contained in:
parent
d58a1b5f11
commit
c37df6f63f
@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
||||
- GAP: support reading RSSI for Classic+LE using gap_read_rssi. Emits GAP_EVENT_RSSI_MEASUREMENT
|
||||
- GAP: support setting Link Supervision Timetout for outgoing Classic connections using gap_set_link_supervision_timeout
|
||||
- Linked List: return if item was added for `btstack_linked_list_add[_tail]`
|
||||
- ATT Server: return error if request to send now for Notification or Indication already registered
|
||||
|
||||
## Changed
|
||||
- Bluetooth and BTstack Error Codes and Events: collect status codes in bluetooth.h and events in btstack_defines.h
|
||||
|
@ -1139,17 +1139,25 @@ void att_server_request_can_send_now_event(hci_con_handle_t con_handle){
|
||||
int att_server_request_to_send_notification(btstack_context_callback_registration_t * callback_registration, hci_con_handle_t con_handle){
|
||||
att_server_t * att_server = att_server_for_handle(con_handle);
|
||||
if (!att_server) return ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER;
|
||||
btstack_linked_list_add_tail(&att_server->notification_requests, (btstack_linked_item_t*) callback_registration);
|
||||
bool added = btstack_linked_list_add_tail(&att_server->notification_requests, (btstack_linked_item_t*) callback_registration);
|
||||
att_server_request_can_send_now(att_server);
|
||||
return ERROR_CODE_SUCCESS;
|
||||
if (added){
|
||||
return ERROR_CODE_SUCCESS;
|
||||
} else {
|
||||
return ERROR_CODE_COMMAND_DISALLOWED;
|
||||
}
|
||||
}
|
||||
|
||||
int att_server_request_to_send_indication(btstack_context_callback_registration_t * callback_registration, hci_con_handle_t con_handle){
|
||||
att_server_t * att_server = att_server_for_handle(con_handle);
|
||||
if (!att_server) return ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER;
|
||||
btstack_linked_list_add_tail(&att_server->indication_requests, (btstack_linked_item_t*) callback_registration);
|
||||
bool added = btstack_linked_list_add_tail(&att_server->indication_requests, (btstack_linked_item_t*) callback_registration);
|
||||
att_server_request_can_send_now(att_server);
|
||||
return ERROR_CODE_SUCCESS;
|
||||
if (added){
|
||||
return ERROR_CODE_SUCCESS;
|
||||
} else {
|
||||
return ERROR_CODE_COMMAND_DISALLOWED;
|
||||
}
|
||||
}
|
||||
|
||||
int att_server_notify(hci_con_handle_t con_handle, uint16_t attribute_handle, const uint8_t *value, uint16_t value_len){
|
||||
|
@ -91,7 +91,7 @@ uint16_t att_server_get_mtu(hci_con_handle_t con_handle);
|
||||
* @note callback might happend during call to this function
|
||||
* @param callback_registration to point to callback function and context information
|
||||
* @param con_handle
|
||||
* @return 0 if ok, error otherwise
|
||||
* @return ERROR_CODE_SUCCESS if ok, ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if handle unknown, and ERROR_CODE_COMMAND_DISALLOWED if callback already registered
|
||||
*/
|
||||
int att_server_request_to_send_notification(btstack_context_callback_registration_t * callback_registration, hci_con_handle_t con_handle);
|
||||
|
||||
@ -100,7 +100,7 @@ int att_server_request_to_send_notification(btstack_context_callback_registratio
|
||||
* @note callback might happend during call to this function
|
||||
* @param callback_registration to point to callback function and context information
|
||||
* @param con_handle
|
||||
* @return 0 if ok, error otherwise
|
||||
* @return ERROR_CODE_SUCCESS if ok, ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if handle unknown, and ERROR_CODE_COMMAND_DISALLOWED if callback already registered
|
||||
*/
|
||||
int att_server_request_to_send_indication(btstack_context_callback_registration_t * callback_registration, hci_con_handle_t con_handle);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user