att_server: set att_connection for att_run_for_context

This commit is contained in:
Matthias Ringwald 2023-06-19 20:58:04 +02:00
parent 1e57435b5a
commit acb2a5779a

View File

@ -462,6 +462,7 @@ static void att_event_packet_handler (uint8_t packet_type, uint16_t channel, uin
con_handle = sm_event_identity_created_get_handle(packet);
hci_connection = hci_connection_for_handle(con_handle);
if (!hci_connection) return;
att_connection = &hci_connection->att_connection;
att_server = &hci_connection->att_server;
att_server->ir_lookup_active = 0;
att_server->ir_le_device_db_index = sm_event_identity_resolving_succeeded_get_index(packet);
@ -472,6 +473,7 @@ static void att_event_packet_handler (uint8_t packet_type, uint16_t channel, uin
con_handle = sm_event_identity_resolving_failed_get_handle(packet);
hci_connection = hci_connection_for_handle(con_handle);
if (!hci_connection) break;
att_connection = &hci_connection->att_connection;
att_server = &hci_connection->att_server;
log_info("SM_EVENT_IDENTITY_RESOLVING_FAILED");
att_server->ir_lookup_active = 0;
@ -491,6 +493,7 @@ static void att_event_packet_handler (uint8_t packet_type, uint16_t channel, uin
if (!hci_connection) break;
att_server = &hci_connection->att_server;
att_server->pairing_active = 1;
att_connection = &hci_connection->att_connection;
log_info("SM Pairing started");
if (att_server->ir_le_device_db_index < 0) break;
att_run_for_context(att_server, att_connection);
@ -503,6 +506,7 @@ static void att_event_packet_handler (uint8_t packet_type, uint16_t channel, uin
con_handle = sm_event_identity_created_get_handle(packet);
hci_connection = hci_connection_for_handle(con_handle);
if (!hci_connection) return;
att_connection = &hci_connection->att_connection;
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);
@ -514,6 +518,7 @@ static void att_event_packet_handler (uint8_t packet_type, uint16_t channel, uin
con_handle = sm_event_pairing_complete_get_handle(packet);
hci_connection = hci_connection_for_handle(con_handle);
if (!hci_connection) return;
att_connection = &hci_connection->att_connection;
att_server = &hci_connection->att_server;
att_server->pairing_active = 0;
att_run_for_context(att_server, att_connection);
@ -524,8 +529,8 @@ static void att_event_packet_handler (uint8_t packet_type, uint16_t channel, uin
con_handle = sm_event_authorization_result_get_handle(packet);
hci_connection = hci_connection_for_handle(con_handle);
if (!hci_connection) break;
att_server = &hci_connection->att_server;
att_connection = &hci_connection->att_connection;
att_server = &hci_connection->att_server;
att_connection->authorized = sm_event_authorization_result_get_authorization_result(packet);
att_server_request_can_send_now(att_server, att_connection);
break;