mesh: improve _reset functions for unit tests in mesh_network and btstack_crypto

This commit is contained in:
Matthias Ringwald 2019-08-20 18:07:43 +02:00
parent 5d948fde5b
commit fde19096d3
3 changed files with 16 additions and 0 deletions

View File

@ -1220,3 +1220,7 @@ void btstack_crypto_ecc_p256_set_key(const uint8_t * public_key, const uint8_t *
int btstack_crypto_idle(void){
return btstack_linked_list_empty(&btstack_crypto_operations);
}
void btstack_crypto_reset(void){
btstack_crypto_operations = NULL;
btstack_crypto_wait_for_hci_result = 0;
}

View File

@ -275,6 +275,7 @@ void btstack_crypto_ecc_p256_set_key(const uint8_t * public_key, const uint8_t *
// Unit testing
int btstack_crypto_idle(void);
void btstack_crypto_reset(void);
#if defined __cplusplus
}

View File

@ -1090,12 +1090,23 @@ void mesh_network_dump(void){
mesh_network_dump_network_pdus("network_pdus_outgoing_adv", &network_pdus_outgoing_adv);
printf("network_pdu_in_validation: \n");
mesh_network_dump_network_pdu(network_pdu_in_validation);
printf("gatt_bearer_network_pdu: \n");
mesh_network_dump_network_pdu(gatt_bearer_network_pdu);
printf("adv_bearer_network_pdu: \n");
mesh_network_dump_network_pdu(adv_bearer_network_pdu);
}
void mesh_network_reset(void){
mesh_network_reset_network_pdus(&network_pdus_received);
mesh_network_reset_network_pdus(&network_pdus_queued);
mesh_network_reset_network_pdus(&network_pdus_outgoing_gatt);
mesh_network_reset_network_pdus(&network_pdus_outgoing_adv);
if (adv_bearer_network_pdu){
mesh_network_pdu_free(adv_bearer_network_pdu);
}
if (gatt_bearer_network_pdu){
mesh_network_pdu_free(gatt_bearer_network_pdu);
}
mesh_crypto_active = 0;
}
// buffer pool