diff --git a/test/mesh/mesh.c b/test/mesh/mesh.c index 19e04b048..381d0a34f 100644 --- a/test/mesh/mesh.c +++ b/test/mesh/mesh.c @@ -1559,7 +1559,7 @@ static mesh_operation_t mesh_configuration_server_model_operations[] = { { 0, 0, NULL} }; -static void mesh_segmented_message_handler(mesh_transport_pdu_t *transport_pdu){ +static void mesh_segmented_message_process(mesh_transport_pdu_t *transport_pdu){ // get opcode and size uint32_t opcode = 0; uint16_t opcode_size = 0; @@ -1582,6 +1582,11 @@ static void mesh_segmented_message_handler(mesh_transport_pdu_t *transport_pdu){ printf("Message not handled\n"); } +static void mesh_segmented_message_handler(mesh_transport_pdu_t *transport_pdu){ + mesh_segmented_message_process(transport_pdu); + mesh_upper_transport_segmented_message_processed_by_higher_layer(transport_pdu); +} + static btstack_crypto_aes128_cmac_t salt_request; static uint8_t label_uuid[16]; static uint8_t salt_hash[16]; diff --git a/test/mesh/mesh_message_test.c b/test/mesh/mesh_message_test.c index c45e24a35..742b4ef55 100644 --- a/test/mesh/mesh_message_test.c +++ b/test/mesh/mesh_message_test.c @@ -177,11 +177,13 @@ static void test_upper_transport_unsegmented_callback_handler(mesh_network_pdu_t recv_upper_transport_pdu_len = mesh_network_pdu_len(network_pdu) - 1; memcpy(recv_upper_transport_pdu_data, mesh_network_pdu_data(network_pdu) + 1, recv_upper_transport_pdu_len); } + mesh_upper_transport_unsegmented_message_processed_by_higher_layer(network_pdu); } static void test_upper_transport_segmented_callback_handler(mesh_transport_pdu_t * transport_pdu){ recv_upper_transport_pdu_len = transport_pdu->len; memcpy(recv_upper_transport_pdu_data, transport_pdu->data, recv_upper_transport_pdu_len); + mesh_upper_transport_segmented_message_processed_by_higher_layer(transport_pdu); } TEST_GROUP(MessageTest){ diff --git a/test/mesh/mesh_transport.c b/test/mesh/mesh_transport.c index 0dc692507..69f8b08a3 100644 --- a/test/mesh/mesh_transport.c +++ b/test/mesh/mesh_transport.c @@ -252,9 +252,6 @@ static void mesh_upper_transport_validate_unsegmented_message_ccm(void * arg){ } printf("\n"); - - // done - mesh_upper_transport_process_unsegmented_message_done(network_pdu); } else { uint8_t afk = lower_transport_pdu[0] & 0x40; if (afk){ @@ -301,8 +298,6 @@ static void mesh_upper_transport_validate_segmented_message_ccm(void * arg){ printf("\n"); - // done - mesh_upper_transport_process_segmented_message_done(transport_pdu); } else { uint8_t akf = transport_pdu->akf_aid & 0x40; if (akf){ @@ -316,6 +311,13 @@ static void mesh_upper_transport_validate_segmented_message_ccm(void * arg){ } } +void mesh_upper_transport_segmented_message_processed_by_higher_layer(mesh_transport_pdu_t * transport_pdu){ + mesh_upper_transport_process_segmented_message_done(transport_pdu); +} +void mesh_upper_transport_unsegmented_message_processed_by_higher_layer(mesh_network_pdu_t * network_pdu){ + mesh_upper_transport_process_unsegmented_message_done(network_pdu); +} + static void mesh_upper_transport_validate_segmented_message_digest(void * arg){ mesh_transport_pdu_t * transport_pdu = (mesh_transport_pdu_t*) arg; uint8_t upper_transport_pdu_len = transport_pdu_in_validation->len - transport_pdu_in_validation->transmic_len; diff --git a/test/mesh/mesh_transport.h b/test/mesh/mesh_transport.h index bebc1766f..d079511dd 100644 --- a/test/mesh/mesh_transport.h +++ b/test/mesh/mesh_transport.h @@ -89,6 +89,9 @@ void mesh_upper_transport_send_unsegmented_access_pdu(mesh_network_pdu_t * netwo void mesh_upper_transport_send_segmented_access_pdu(mesh_transport_pdu_t * transport_pdu); +void mesh_upper_transport_segmented_message_processed_by_higher_layer(mesh_transport_pdu_t * transport_pdu); +void mesh_upper_transport_unsegmented_message_processed_by_higher_layer(mesh_network_pdu_t * network_pdu); + // // Virtual Address Management //