diff --git a/test/mesh/mesh.c b/test/mesh/mesh.c index c31a60425..2d27329e1 100644 --- a/test/mesh/mesh.c +++ b/test/mesh/mesh.c @@ -138,6 +138,22 @@ static void hci_packet_handler (uint8_t packet_type, uint16_t channel, uint8_t * } } +static mesh_model_t mesh_configuration_server_model; +static mesh_model_t mesh_health_server_model; + +static mesh_configuration_server_model_context_t mesh_configuration_server_model_context; + +static void mesh_node_setup_default_models(void){ + // configure Config Server + mesh_configuration_server_model.model_identifier = mesh_model_get_model_identifier_bluetooth_sig(MESH_SIG_MODEL_ID_CONFIGURATION_SERVER); + mesh_configuration_server_model.model_data = &mesh_configuration_server_model_context; + mesh_configuration_server_model.operations = mesh_configuration_server_get_operations(); + mesh_element_add_model(mesh_node_get_primary_element(), &mesh_configuration_server_model); + + // Config Health Server + mesh_health_server_model.model_identifier = mesh_model_get_model_identifier_bluetooth_sig(MESH_SIG_MODEL_ID_HEALTH_SERVER); + mesh_element_add_model(mesh_node_get_primary_element(), &mesh_health_server_model); +} void mesh_init(void){ @@ -172,6 +188,8 @@ void mesh_init(void){ // Access layer mesh_access_init(); + + mesh_node_setup_default_models(); } /** diff --git a/test/mesh/mesh_pts.c b/test/mesh/mesh_pts.c index 2939c321d..aac7762a4 100644 --- a/test/mesh/mesh_pts.c +++ b/test/mesh/mesh_pts.c @@ -539,23 +539,6 @@ static void stdin_process(char cmd){ } } -static mesh_model_t mesh_configuration_server_model; -static mesh_model_t mesh_health_server_model; - -static mesh_configuration_server_model_context_t mesh_configuration_server_model_context; - -static void mesh_node_setup_default_models(void){ - // configure Config Server - mesh_configuration_server_model.model_identifier = mesh_model_get_model_identifier_bluetooth_sig(MESH_SIG_MODEL_ID_CONFIGURATION_SERVER); - mesh_configuration_server_model.model_data = &mesh_configuration_server_model_context; - mesh_configuration_server_model.operations = mesh_configuration_server_get_operations(); - mesh_element_add_model(mesh_node_get_primary_element(), &mesh_configuration_server_model); - - // Config Health Server - mesh_health_server_model.model_identifier = mesh_model_get_model_identifier_bluetooth_sig(MESH_SIG_MODEL_ID_HEALTH_SERVER); - mesh_element_add_model(mesh_node_get_primary_element(), &mesh_health_server_model); -} - int btstack_main(void); int btstack_main(void) { @@ -592,9 +575,6 @@ int btstack_main(void) // Provisioning in device role mesh_register_provisioning_device_packet_handler(&mesh_provisioning_message_handler); - // Setup default models on primary element - mesh_node_setup_default_models(); - // Loc - bottom - https://www.bluetooth.com/specifications/assigned-numbers/gatt-namespace-descriptors mesh_node_set_element_location(mesh_node_get_primary_element(), 0x103);