mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-04-15 23:42:52 +00:00
att_server: use att_server/att_connection in att_run_for_context
This commit is contained in:
parent
37a8059d7a
commit
cd45e970b6
@ -75,7 +75,7 @@
|
||||
#define NVN_NUM_GATT_SERVER_CCC 20
|
||||
#endif
|
||||
|
||||
static void att_run_for_context(hci_connection_t * hci_connection);
|
||||
static void att_run_for_context(att_server_t * att_server, att_connection_t * att_connection);
|
||||
static att_write_callback_t att_server_write_callback_for_handle(uint16_t handle);
|
||||
static btstack_packet_handler_t att_server_packet_handler_for_handle(uint16_t handle);
|
||||
static void att_server_handle_can_send_now(void);
|
||||
@ -379,7 +379,7 @@ static void att_event_packet_handler (uint8_t packet_type, uint16_t channel, uin
|
||||
att_server_persistent_ccc_restore(hci_connection);
|
||||
}
|
||||
}
|
||||
att_run_for_context(hci_connection);
|
||||
att_run_for_context(att_server, att_connection);
|
||||
break;
|
||||
|
||||
case HCI_EVENT_DISCONNECTION_COMPLETE:
|
||||
@ -422,7 +422,7 @@ static void att_event_packet_handler (uint8_t packet_type, uint16_t channel, uin
|
||||
att_server->ir_lookup_active = 0;
|
||||
att_server->ir_le_device_db_index = sm_event_identity_resolving_succeeded_get_index(packet);
|
||||
log_info("SM_EVENT_IDENTITY_RESOLVING_SUCCEEDED");
|
||||
att_run_for_context(hci_connection);
|
||||
att_run_for_context(att_server, att_connection);
|
||||
break;
|
||||
case SM_EVENT_IDENTITY_RESOLVING_FAILED:
|
||||
con_handle = sm_event_identity_resolving_failed_get_handle(packet);
|
||||
@ -432,7 +432,7 @@ static void att_event_packet_handler (uint8_t packet_type, uint16_t channel, uin
|
||||
log_info("SM_EVENT_IDENTITY_RESOLVING_FAILED");
|
||||
att_server->ir_lookup_active = 0;
|
||||
att_server->ir_le_device_db_index = -1;
|
||||
att_run_for_context(hci_connection);
|
||||
att_run_for_context(att_server, att_connection);
|
||||
break;
|
||||
|
||||
// Pairing started - delete stored CCC values
|
||||
@ -449,7 +449,7 @@ static void att_event_packet_handler (uint8_t packet_type, uint16_t channel, uin
|
||||
att_server->pairing_active = 1;
|
||||
log_info("SM Pairing started");
|
||||
if (att_server->ir_le_device_db_index < 0) break;
|
||||
att_server_persistent_ccc_clear(hci_connection);
|
||||
att_run_for_context(att_server, att_connection);
|
||||
// index not valid anymore
|
||||
att_server->ir_le_device_db_index = -1;
|
||||
break;
|
||||
@ -462,7 +462,7 @@ static void att_event_packet_handler (uint8_t packet_type, uint16_t channel, uin
|
||||
att_server = &hci_connection->att_server;
|
||||
att_server->pairing_active = 0;
|
||||
att_server->ir_le_device_db_index = sm_event_identity_created_get_index(packet);
|
||||
att_run_for_context(hci_connection);
|
||||
att_run_for_context(att_server, att_connection);
|
||||
break;
|
||||
|
||||
// Pairing complete (with/without bonding=storing of pairing information)
|
||||
@ -472,7 +472,7 @@ static void att_event_packet_handler (uint8_t packet_type, uint16_t channel, uin
|
||||
if (!hci_connection) return;
|
||||
att_server = &hci_connection->att_server;
|
||||
att_server->pairing_active = 0;
|
||||
att_run_for_context(hci_connection);
|
||||
att_run_for_context(att_server, att_connection);
|
||||
break;
|
||||
|
||||
// Authorization
|
||||
@ -632,9 +632,7 @@ uint8_t att_server_response_ready(hci_con_handle_t con_handle){
|
||||
}
|
||||
#endif
|
||||
|
||||
static void att_run_for_context(hci_connection_t * hci_connection){
|
||||
att_server_t * att_server = &hci_connection->att_server;
|
||||
att_connection_t * att_connection = &hci_connection->att_connection;
|
||||
static void att_run_for_context(att_server_t * att_server, att_connection_t * att_connection){
|
||||
switch (att_server->state){
|
||||
case ATT_SERVER_REQUEST_RECEIVED:
|
||||
switch (att_server->bearer_type){
|
||||
@ -881,7 +879,7 @@ static void att_server_handle_att_pdu(hci_connection_t * hci_connection, uint8_t
|
||||
att_server->request_size = size;
|
||||
(void)memcpy(att_server->request_buffer, packet, size);
|
||||
|
||||
att_run_for_context(hci_connection);
|
||||
att_run_for_context(att_server, att_connection);
|
||||
}
|
||||
|
||||
static void att_packet_handler(uint8_t packet_type, uint16_t handle, uint8_t *packet, uint16_t size){
|
||||
|
Loading…
x
Reference in New Issue
Block a user