From 8facb3ea411e090f6a191fc09bbb2bf27ec5bb67 Mon Sep 17 00:00:00 2001 From: Matthias Ringwald Date: Tue, 17 Mar 2020 18:51:04 +0100 Subject: [PATCH] mesh: mesh-unsegmented-incoming -> mesh-unsegemented --- src/mesh/mesh_lower_transport.c | 8 ++++---- src/mesh/mesh_network.h | 4 ++-- src/mesh/mesh_upper_transport.c | 16 ++++++++-------- test/mesh/mesh_message_test.cpp | 8 ++++---- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/mesh/mesh_lower_transport.c b/src/mesh/mesh_lower_transport.c index 22080f247..97bf27ae4 100644 --- a/src/mesh/mesh_lower_transport.c +++ b/src/mesh/mesh_lower_transport.c @@ -181,7 +181,7 @@ static int lower_transport_outgoing_trasnmission_complete; // deliver to higher layer static mesh_pdu_t * mesh_lower_transport_higher_layer_pdu; static btstack_linked_list_t mesh_lower_transport_queued_for_higher_layer; -static mesh_unsegmented_incoming_pdu_t lower_transport_access_incoming_singleton; +static mesh_unsegmented_pdu_t lower_transport_access_incoming_singleton; static void mesh_lower_transport_process_segment_acknowledgement_message(mesh_network_pdu_t *network_pdu){ if (lower_transport_outgoing_message == NULL) return; @@ -244,7 +244,7 @@ static void mesh_lower_transport_deliver_to_higher_layer(void){ case MESH_MSG_TYPE_NETWORK_PDU: // unsegmented pdu mesh_lower_transport_higher_layer_pdu = (mesh_pdu_t *) &lower_transport_access_incoming_singleton; - lower_transport_access_incoming_singleton.pdu_header.pdu_type = MESH_PDU_TYPE_UNSEGMENTED_INCOMING; + lower_transport_access_incoming_singleton.pdu_header.pdu_type = MESH_PDU_TYPE_UNSEGMENTED; lower_transport_access_incoming_singleton.segment = (mesh_network_pdu_t*) pdu; break; default: @@ -642,7 +642,7 @@ static void mesh_lower_transport_process_network_pdu(mesh_network_pdu_t *network void mesh_lower_transport_message_processed_by_higher_layer(mesh_pdu_t * pdu){ btstack_assert(pdu == mesh_lower_transport_higher_layer_pdu); mesh_lower_transport_higher_layer_pdu = NULL; - mesh_unsegmented_incoming_pdu_t * unsegmented_incoming_pdu = (mesh_unsegmented_incoming_pdu_t *) pdu; + mesh_unsegmented_pdu_t * unsegmented_incoming_pdu = (mesh_unsegmented_pdu_t *) pdu; mesh_network_pdu_t * network_pdu; switch (pdu->pdu_type){ case MESH_PDU_TYPE_MESSAGE: @@ -650,7 +650,7 @@ void mesh_lower_transport_message_processed_by_higher_layer(mesh_pdu_t * pdu){ mesh_lower_transport_report_segments_as_processed((mesh_message_pdu_t *) pdu); mesh_message_pdu_free((mesh_message_pdu_t *) pdu); break; - case MESH_PDU_TYPE_UNSEGMENTED_INCOMING: + case MESH_PDU_TYPE_UNSEGMENTED: network_pdu = unsegmented_incoming_pdu->segment; unsegmented_incoming_pdu->segment = NULL; mesh_network_message_processed_by_higher_layer(network_pdu); diff --git a/src/mesh/mesh_network.h b/src/mesh/mesh_network.h index a51b32daa..5b1ec3eb9 100644 --- a/src/mesh/mesh_network.h +++ b/src/mesh/mesh_network.h @@ -70,7 +70,7 @@ typedef enum { MESH_PDU_TYPE_NETWORK = 0, MESH_PDU_TYPE_TRANSPORT, MESH_PDU_TYPE_MESSAGE, - MESH_PDU_TYPE_UNSEGMENTED_INCOMING, + MESH_PDU_TYPE_UNSEGMENTED, MESH_PDU_TYPE_ACCESS, } mesh_pdu_type_t; @@ -178,7 +178,7 @@ typedef struct { uint16_t flags; // pdu segment mesh_network_pdu_t * segment; -} mesh_unsegmented_incoming_pdu_t; +} mesh_unsegmented_pdu_t; typedef struct { // generic pdu header diff --git a/src/mesh/mesh_upper_transport.c b/src/mesh/mesh_upper_transport.c index bf0bdb5d2..91e51d513 100644 --- a/src/mesh/mesh_upper_transport.c +++ b/src/mesh/mesh_upper_transport.c @@ -79,7 +79,7 @@ static void mesh_upper_transport_run(void); static int crypto_active; -static mesh_unsegmented_incoming_pdu_t * incoming_unsegmented_pdu_raw; +static mesh_unsegmented_pdu_t * incoming_unsegmented_pdu_raw; static mesh_network_pdu_t * incoming_network_pdu_decoded; static mesh_message_pdu_t incoming_message_pdu_singleton; @@ -293,7 +293,7 @@ static void transport_segmented_setup_device_nonce(uint8_t * nonce, const mesh_p mesh_print_hex("DeviceNonce", nonce, 13); } -static void mesh_upper_unsegmented_control_message_received(mesh_unsegmented_incoming_pdu_t * unsegmented_incoming_pdu){ +static void mesh_upper_unsegmented_control_message_received(mesh_unsegmented_pdu_t * unsegmented_incoming_pdu){ if (mesh_control_message_handler){ mesh_control_message_handler((mesh_pdu_t*) unsegmented_incoming_pdu); } else { @@ -324,9 +324,9 @@ static void mesh_upper_transport_process_message_done(mesh_message_pdu_t *messag static void mesh_upper_transport_process_unsegmented_message_done(mesh_pdu_t * pdu){ btstack_assert(pdu != NULL); - btstack_assert(pdu->pdu_type == MESH_PDU_TYPE_UNSEGMENTED_INCOMING); + btstack_assert(pdu->pdu_type == MESH_PDU_TYPE_UNSEGMENTED); - mesh_unsegmented_incoming_pdu_t * unsegmented_incoming_pdu = (mesh_unsegmented_incoming_pdu_t *) pdu; + mesh_unsegmented_pdu_t * unsegmented_incoming_pdu = (mesh_unsegmented_pdu_t *) pdu; btstack_assert(unsegmented_incoming_pdu == incoming_unsegmented_pdu_raw); crypto_active = 0; @@ -1070,10 +1070,10 @@ static void mesh_upper_transport_run(void){ mesh_network_pdu_t * network_pdu; mesh_transport_pdu_t * transport_pdu; mesh_message_pdu_t * message_pdu; - mesh_unsegmented_incoming_pdu_t * unsegmented_pdu; + mesh_unsegmented_pdu_t * unsegmented_pdu; switch (pdu->pdu_type){ - case MESH_PDU_TYPE_UNSEGMENTED_INCOMING: - unsegmented_pdu = (mesh_unsegmented_incoming_pdu_t *) pdu; + case MESH_PDU_TYPE_UNSEGMENTED: + unsegmented_pdu = (mesh_unsegmented_pdu_t *) pdu; network_pdu = unsegmented_pdu->segment; btstack_assert(network_pdu != NULL); incoming_unsegmented_pdu_raw = unsegmented_pdu; @@ -1223,7 +1223,7 @@ void mesh_upper_transport_message_processed_by_higher_layer(mesh_pdu_t * pdu){ case MESH_PDU_TYPE_MESSAGE: mesh_upper_transport_process_message_done((mesh_message_pdu_t *) pdu); break; - case MESH_PDU_TYPE_UNSEGMENTED_INCOMING: + case MESH_PDU_TYPE_UNSEGMENTED: mesh_upper_transport_process_unsegmented_message_done(pdu); break; default: diff --git a/test/mesh/mesh_message_test.cpp b/test/mesh/mesh_message_test.cpp index 4cd4dd8e1..14a774c42 100644 --- a/test/mesh/mesh_message_test.cpp +++ b/test/mesh/mesh_message_test.cpp @@ -287,7 +287,7 @@ static void test_upper_transport_access_message_handler(mesh_pdu_t * pdu){ static void test_upper_transport_control_message_handler(mesh_pdu_t * pdu){ mesh_transport_pdu_t * transport_pdu; mesh_network_pdu_t * network_pdu; - mesh_unsegmented_incoming_pdu_t * unsegmented_incoming_pdu; + mesh_unsegmented_pdu_t * unsegmented_incoming_pdu; switch(pdu->pdu_type){ case MESH_PDU_TYPE_TRANSPORT: transport_pdu = (mesh_transport_pdu_t *) pdu; @@ -296,10 +296,10 @@ static void test_upper_transport_control_message_handler(mesh_pdu_t * pdu){ memcpy(recv_upper_transport_pdu_data, transport_pdu->data, recv_upper_transport_pdu_len); mesh_upper_transport_message_processed_by_higher_layer(pdu); break; - case MESH_PDU_TYPE_UNSEGMENTED_INCOMING: - unsegmented_incoming_pdu = (mesh_unsegmented_incoming_pdu_t *) pdu; + case MESH_PDU_TYPE_UNSEGMENTED: + unsegmented_incoming_pdu = (mesh_unsegmented_pdu_t *) pdu; network_pdu = unsegmented_incoming_pdu->segment; - printf("test MESH_PDU_TYPE_UNSEGMENTED_INCOMING\n"); + printf("test MESH_PDU_TYPE_UNSEGMENTED\n"); recv_upper_transport_pdu_len = mesh_network_pdu_len(network_pdu); memcpy(recv_upper_transport_pdu_data, mesh_network_pdu_data(network_pdu), recv_upper_transport_pdu_len); mesh_upper_transport_message_processed_by_higher_layer(pdu);