diff --git a/src/mesh/mesh_node.c b/src/mesh/mesh_node.c index 68651e293..c325792e0 100644 --- a/src/mesh/mesh_node.c +++ b/src/mesh/mesh_node.c @@ -78,8 +78,13 @@ mesh_element_t * mesh_node_get_primary_element(void){ return &primary_element; } + +void mesh_node_set_element_location(mesh_element_t * element, uint16_t location){ + element->loc = location; +} + void mesh_node_set_primary_element_location(uint16_t location){ - primary_element.loc = location; + mesh_node_set_element_location(&primary_element, location); } mesh_element_t * mesh_node_element_for_index(uint16_t element_index){ diff --git a/src/mesh/mesh_node.h b/src/mesh/mesh_node.h index 0acf52af5..95b5b16e7 100644 --- a/src/mesh/mesh_node.h +++ b/src/mesh/mesh_node.h @@ -82,6 +82,13 @@ void mesh_node_primary_element_address_set(uint16_t unicast_address); */ void mesh_node_set_primary_element_location(uint16_t location); +/** + * @brief Set location of element + * @param element + * @param location + */ +void mesh_node_set_element_location(mesh_element_t * element, uint16_t location); + /** * @brief Get unicast address of primary element */ diff --git a/test/mesh/mesh.c b/test/mesh/mesh.c index 4194a98bd..7c0a207cb 100644 --- a/test/mesh/mesh.c +++ b/test/mesh/mesh.c @@ -675,7 +675,7 @@ int btstack_main(void) mesh_node_init(); // Loc - bottom - https://www.bluetooth.com/specifications/assigned-numbers/gatt-namespace-descriptors - mesh_node_set_primary_element_location(0x103); + mesh_node_set_element_location(mesh_node_get_primary_element(), 0x103); // Setup models mesh_configuration_server_model.model_identifier = mesh_model_get_model_identifier_bluetooth_sig(MESH_SIG_MODEL_ID_CONFIGURATION_SERVER);