mesh: store element ref in model

This commit is contained in:
Matthias Ringwald 2019-06-10 22:46:33 +02:00
parent 2ea7db52ab
commit a66a8cb39b
3 changed files with 9 additions and 5 deletions

View File

@ -133,6 +133,7 @@ void mesh_element_add_model(mesh_element_t * element, mesh_model_t * mesh_model)
element->models_count_vendor++;
}
mesh_model->mid = mid_counter++;
mesh_model->element = element;
btstack_linked_list_add_tail(&element->models, (btstack_linked_item_t *) mesh_model);
}

View File

@ -52,6 +52,9 @@ extern "C"
#define MESH_APPKEY_INVALID 0xffffu
struct mesh_model;
struct mesh_element;
typedef struct {
uint16_t address;
uint16_t appkey_index;
@ -61,9 +64,6 @@ typedef struct {
uint8_t retransmit;
} mesh_publication_model_t;
struct mesh_model;
typedef void (*mesh_operation_handler)(struct mesh_model * mesh_model, mesh_pdu_t * pdu);
typedef struct {
@ -76,6 +76,9 @@ typedef struct mesh_model {
// linked list item
btstack_linked_item_t item;
// element
struct mesh_element * element;
// internal model enumeration
uint16_t mid;
@ -106,7 +109,7 @@ typedef struct {
btstack_linked_list_iterator_t it;
} mesh_element_iterator_t;
typedef struct {
typedef struct mesh_element {
// linked list item
btstack_linked_item_t item;

View File

@ -1813,5 +1813,5 @@ const static mesh_operation_t mesh_configuration_server_model_operations[] = {
};
const mesh_operation_t * mesh_configuration_server_get_operations(void){
return &mesh_configuration_server_model_operations;
return mesh_configuration_server_model_operations;
}