mesh: use mesh_transport_pdu instead of mesh_access_pdu

This commit is contained in:
Matthias Ringwald 2018-11-09 20:11:03 +01:00
parent 0d374fc949
commit df5d954deb
4 changed files with 25 additions and 25 deletions

View File

@ -72,7 +72,7 @@ typedef struct {
// pdu
uint16_t len;
uint8_t data[MESH_ACCESS_PAYLOAD_MAX];
} mesh_access_pdu_t;
} mesh_transport_pdu_t;
//
typedef struct {

View File

@ -938,40 +938,40 @@ void btstack_memory_mesh_network_pdu_free(mesh_network_pdu_t *mesh_network_pdu){
#endif
// MARK: mesh_access_pdu_t
#if !defined(HAVE_MALLOC) && !defined(MAX_NR_MESH_ACCESS_PDUS)
#if defined(MAX_NO_MESH_ACCESS_PDUS)
#error "Deprecated MAX_NO_MESH_ACCESS_PDUS defined instead of MAX_NR_MESH_ACCESS_PDUS. Please update your btstack_config.h to use MAX_NR_MESH_ACCESS_PDUS."
// MARK: mesh_transport_pdu_t
#if !defined(HAVE_MALLOC) && !defined(MAX_NR_MESH_TRANSPORT_PDUS)
#if defined(MAX_NO_MESH_TRANSPORT_PDUS)
#error "Deprecated MAX_NO_MESH_TRANSPORT_PDUS defined instead of MAX_NR_MESH_TRANSPORT_PDUS. Please update your btstack_config.h to use MAX_NR_MESH_TRANSPORT_PDUS."
#else
#define MAX_NR_MESH_ACCESS_PDUS 0
#define MAX_NR_MESH_TRANSPORT_PDUS 0
#endif
#endif
#ifdef MAX_NR_MESH_ACCESS_PDUS
#if MAX_NR_MESH_ACCESS_PDUS > 0
static mesh_access_pdu_t mesh_access_pdu_storage[MAX_NR_MESH_ACCESS_PDUS];
static btstack_memory_pool_t mesh_access_pdu_pool;
mesh_access_pdu_t * btstack_memory_mesh_access_pdu_get(void){
return (mesh_access_pdu_t *) btstack_memory_pool_get(&mesh_access_pdu_pool);
#ifdef MAX_NR_MESH_TRANSPORT_PDUS
#if MAX_NR_MESH_TRANSPORT_PDUS > 0
static mesh_transport_pdu_t mesh_transport_pdu_storage[MAX_NR_MESH_TRANSPORT_PDUS];
static btstack_memory_pool_t mesh_transport_pdu_pool;
mesh_transport_pdu_t * btstack_memory_mesh_transport_pdu_get(void){
return (mesh_transport_pdu_t *) btstack_memory_pool_get(&mesh_transport_pdu_pool);
}
void btstack_memory_mesh_access_pdu_free(mesh_access_pdu_t *mesh_access_pdu){
btstack_memory_pool_free(&mesh_access_pdu_pool, mesh_access_pdu);
void btstack_memory_mesh_transport_pdu_free(mesh_transport_pdu_t *mesh_transport_pdu){
btstack_memory_pool_free(&mesh_transport_pdu_pool, mesh_transport_pdu);
}
#else
mesh_access_pdu_t * btstack_memory_mesh_access_pdu_get(void){
mesh_transport_pdu_t * btstack_memory_mesh_transport_pdu_get(void){
return NULL;
}
void btstack_memory_mesh_access_pdu_free(mesh_access_pdu_t *mesh_access_pdu){
void btstack_memory_mesh_transport_pdu_free(mesh_transport_pdu_t *mesh_transport_pdu){
// silence compiler warning about unused parameter in a portable way
(void) mesh_access_pdu;
(void) mesh_transport_pdu;
};
#endif
#elif defined(HAVE_MALLOC)
mesh_access_pdu_t * btstack_memory_mesh_access_pdu_get(void){
return (mesh_access_pdu_t*) malloc(sizeof(mesh_access_pdu_t));
mesh_transport_pdu_t * btstack_memory_mesh_transport_pdu_get(void){
return (mesh_transport_pdu_t*) malloc(sizeof(mesh_transport_pdu_t));
}
void btstack_memory_mesh_access_pdu_free(mesh_access_pdu_t *mesh_access_pdu){
free(mesh_access_pdu);
void btstack_memory_mesh_transport_pdu_free(mesh_transport_pdu_t *mesh_transport_pdu){
free(mesh_transport_pdu);
}
#endif

View File

@ -151,11 +151,11 @@ sm_lookup_entry_t * btstack_memory_sm_lookup_entry_get(void);
void btstack_memory_sm_lookup_entry_free(sm_lookup_entry_t *sm_lookup_entry);
#endif
#ifdef ENABLE_MESH
// mesh_network_pdu, mesh_access_pdu, mesh_network_key
// mesh_network_pdu, mesh_transport_pdu, mesh_network_key
mesh_network_pdu_t * btstack_memory_mesh_network_pdu_get(void);
void btstack_memory_mesh_network_pdu_free(mesh_network_pdu_t *mesh_network_pdu);
mesh_access_pdu_t * btstack_memory_mesh_access_pdu_get(void);
void btstack_memory_mesh_access_pdu_free(mesh_access_pdu_t *mesh_access_pdu);
mesh_transport_pdu_t * btstack_memory_mesh_transport_pdu_get(void);
void btstack_memory_mesh_transport_pdu_free(mesh_transport_pdu_t *mesh_transport_pdu);
mesh_network_key_t * btstack_memory_mesh_network_key_get(void);
void btstack_memory_mesh_network_key_free(mesh_network_key_t *mesh_network_key);
#endif

View File

@ -208,7 +208,7 @@ list_of_le_structs = [
["gatt_client", "whitelist_entry", "sm_lookup_entry"],
]
list_of_mesh_structs = [
['mesh_network_pdu', 'mesh_access_pdu', 'mesh_network_key']
['mesh_network_pdu', 'mesh_transport_pdu', 'mesh_network_key']
]
btstack_root = os.path.abspath(os.path.dirname(sys.argv[0]) + '/..')