mesh: single mesh_upper_transport_message_processed_by_higher_layer instead of segmented/unsegmented

This commit is contained in:
Matthias Ringwald 2019-04-22 19:44:56 +02:00
parent 9cee7f1f66
commit c4e43a88c2
4 changed files with 12 additions and 21 deletions

View File

@ -1791,14 +1791,9 @@ static void mesh_access_process(mesh_pdu_t * pdu){
printf("Message not handled\n"); printf("Message not handled\n");
} }
static void mesh_segmented_message_handler(mesh_transport_pdu_t *transport_pdu){ static void mesh_access_message_process_handler(mesh_pdu_t *pdu){
mesh_access_process((mesh_pdu_t*) transport_pdu); mesh_access_process(pdu);
mesh_upper_transport_segmented_message_processed_by_higher_layer(transport_pdu); mesh_upper_transport_message_processed_by_higher_layer(pdu);
}
static void mesh_unsegmented_message_handler(mesh_network_pdu_t *network_pdu){
mesh_access_process((mesh_pdu_t*) network_pdu);
mesh_upper_transport_unsegmented_message_processed_by_higher_layer(network_pdu);
} }
static btstack_crypto_aes128_cmac_t salt_request; static btstack_crypto_aes128_cmac_t salt_request;
@ -1854,7 +1849,7 @@ int btstack_main(void)
// Transport layers (lower + upper)) // Transport layers (lower + upper))
mesh_transport_init(); mesh_transport_init();
mesh_upper_transport_register_access_message_handler(&mesh_segmented_message_handler); mesh_upper_transport_register_access_message_handler(&mesh_access_message_process_handler);
// PTS Virtual Address Label UUID - without Config Model, PTS uses our device uuid // PTS Virtual Address Label UUID - without Config Model, PTS uses our device uuid
btstack_parse_hex("001BDC0810210B0E0A0C000B0E0A0C00", 16, label_uuid); btstack_parse_hex("001BDC0810210B0E0A0C000B0E0A0C00", 16, label_uuid);

View File

@ -177,13 +177,13 @@ static void test_upper_transport_access_message_handler(mesh_pdu_t * pdu){
transport_pdu = (mesh_transport_pdu_t *) pdu; transport_pdu = (mesh_transport_pdu_t *) pdu;
recv_upper_transport_pdu_len = transport_pdu->len; recv_upper_transport_pdu_len = transport_pdu->len;
memcpy(recv_upper_transport_pdu_data, transport_pdu->data, recv_upper_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); mesh_upper_transport_message_processed_by_higher_layer(pdu);
break; break;
case MESH_PDU_TYPE_NETWORK: case MESH_PDU_TYPE_NETWORK:
network_pdu = (mesh_network_pdu_t *) pdu; network_pdu = (mesh_network_pdu_t *) pdu;
recv_upper_transport_pdu_len = mesh_network_pdu_len(network_pdu) - 1; 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); 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); mesh_upper_transport_message_processed_by_higher_layer(pdu);
break; break;
default: default:
break; break;
@ -198,13 +198,13 @@ static void test_upper_transport_control_message_handler(mesh_pdu_t * pdu){
transport_pdu = (mesh_transport_pdu_t *) pdu; transport_pdu = (mesh_transport_pdu_t *) pdu;
recv_upper_transport_pdu_len = transport_pdu->len; recv_upper_transport_pdu_len = transport_pdu->len;
memcpy(recv_upper_transport_pdu_data, transport_pdu->data, recv_upper_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); mesh_upper_transport_message_processed_by_higher_layer(pdu);
break; break;
case MESH_PDU_TYPE_NETWORK: case MESH_PDU_TYPE_NETWORK:
network_pdu = (mesh_network_pdu_t *) pdu; network_pdu = (mesh_network_pdu_t *) pdu;
recv_upper_transport_pdu_len = mesh_network_pdu_len(network_pdu); 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); memcpy(recv_upper_transport_pdu_data, mesh_network_pdu_data(network_pdu), recv_upper_transport_pdu_len);
mesh_upper_transport_unsegmented_message_processed_by_higher_layer(network_pdu); mesh_upper_transport_message_processed_by_higher_layer(pdu);
break; break;
default: default:
break; break;

View File

@ -317,11 +317,8 @@ 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){ void mesh_upper_transport_message_processed_by_higher_layer(mesh_pdu_t * pdu){
mesh_upper_transport_process_segmented_message_done(transport_pdu); mesh_upper_transport_process_unsegmented_message_done(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){ static void mesh_upper_transport_validate_segmented_message_digest(void * arg){

View File

@ -57,6 +57,8 @@ void mesh_transport_set_device_key(const uint8_t * device_key);
void mesh_application_key_set(uint16_t appkey_index, uint8_t aid, const uint8_t * application_key); void mesh_application_key_set(uint16_t appkey_index, uint8_t aid, const uint8_t * application_key);
void mesh_upper_transport_message_processed_by_higher_layer(mesh_pdu_t * pdu);
// Control PDUs // Control PDUs
void mesh_upper_transport_register_control_message_handler(void (*callback)(mesh_pdu_t * pdu)); void mesh_upper_transport_register_control_message_handler(void (*callback)(mesh_pdu_t * pdu));
@ -93,9 +95,6 @@ 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_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 // Virtual Address Management
// //