mesh: extract mesh_upper_transport_pdu_free

This commit is contained in:
Matthias Ringwald 2019-07-08 16:24:38 +02:00
parent 600d87833a
commit b707feff7b
2 changed files with 19 additions and 14 deletions

View File

@ -489,18 +489,9 @@ void mesh_upper_transport_message_received(mesh_pdu_t * pdu){
mesh_transport_run();
}
void mesh_upper_transport_pdu_handler(mesh_transport_callback_type_t callback_type, mesh_transport_status_t status, mesh_pdu_t * pdu){
void mesh_upper_transport_pdu_free(mesh_pdu_t * pdu){
mesh_network_pdu_t * network_pdu;
mesh_transport_pdu_t * transport_pdu;
switch (callback_type){
case MESH_TRANSPORT_PDU_RECEIVED:
mesh_upper_transport_message_received(pdu);
break;
case MESH_TRANSPORT_PDU_SENT:
// notify upper layer (or just free pdu)
if (higher_layer_handler){
higher_layer_handler(callback_type, status, pdu);
} else {
switch (pdu->pdu_type) {
case MESH_PDU_TYPE_NETWORK:
network_pdu = (mesh_network_pdu_t *) pdu;
@ -514,6 +505,19 @@ void mesh_upper_transport_pdu_handler(mesh_transport_callback_type_t callback_ty
break;
}
}
void mesh_upper_transport_pdu_handler(mesh_transport_callback_type_t callback_type, mesh_transport_status_t status, mesh_pdu_t * pdu){
switch (callback_type){
case MESH_TRANSPORT_PDU_RECEIVED:
mesh_upper_transport_message_received(pdu);
break;
case MESH_TRANSPORT_PDU_SENT:
// notify upper layer (or just free pdu)
if (higher_layer_handler){
higher_layer_handler(callback_type, status, pdu);
} else {
mesh_upper_transport_pdu_free(pdu);
}
break;
default:
break;

View File

@ -48,6 +48,7 @@ extern "C"
#include <stdint.h>
#include "mesh/mesh_network.h"
#include "mesh/mesh_lower_transport.h"
void mesh_upper_transport_init();