mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-01 01:13:23 +00:00
mesh: extract mesh_upper_transport_pdu_free
This commit is contained in:
parent
600d87833a
commit
b707feff7b
@ -489,9 +489,24 @@ void mesh_upper_transport_message_received(mesh_pdu_t * pdu){
|
|||||||
mesh_transport_run();
|
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_network_pdu_t * network_pdu;
|
||||||
mesh_transport_pdu_t * transport_pdu;
|
mesh_transport_pdu_t * transport_pdu;
|
||||||
|
switch (pdu->pdu_type) {
|
||||||
|
case MESH_PDU_TYPE_NETWORK:
|
||||||
|
network_pdu = (mesh_network_pdu_t *) pdu;
|
||||||
|
mesh_network_pdu_free(network_pdu);
|
||||||
|
break;
|
||||||
|
case MESH_PDU_TYPE_TRANSPORT:
|
||||||
|
transport_pdu = (mesh_transport_pdu_t *) pdu;
|
||||||
|
mesh_transport_pdu_free(transport_pdu);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
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){
|
switch (callback_type){
|
||||||
case MESH_TRANSPORT_PDU_RECEIVED:
|
case MESH_TRANSPORT_PDU_RECEIVED:
|
||||||
mesh_upper_transport_message_received(pdu);
|
mesh_upper_transport_message_received(pdu);
|
||||||
@ -501,18 +516,7 @@ void mesh_upper_transport_pdu_handler(mesh_transport_callback_type_t callback_ty
|
|||||||
if (higher_layer_handler){
|
if (higher_layer_handler){
|
||||||
higher_layer_handler(callback_type, status, pdu);
|
higher_layer_handler(callback_type, status, pdu);
|
||||||
} else {
|
} else {
|
||||||
switch (pdu->pdu_type) {
|
mesh_upper_transport_pdu_free(pdu);
|
||||||
case MESH_PDU_TYPE_NETWORK:
|
|
||||||
network_pdu = (mesh_network_pdu_t *) pdu;
|
|
||||||
mesh_network_pdu_free(network_pdu);
|
|
||||||
break;
|
|
||||||
case MESH_PDU_TYPE_TRANSPORT:
|
|
||||||
transport_pdu = (mesh_transport_pdu_t *) pdu;
|
|
||||||
mesh_transport_pdu_free(transport_pdu);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -48,6 +48,7 @@ extern "C"
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "mesh/mesh_network.h"
|
#include "mesh/mesh_network.h"
|
||||||
|
#include "mesh/mesh_lower_transport.h"
|
||||||
|
|
||||||
void mesh_upper_transport_init();
|
void mesh_upper_transport_init();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user