From f18cf9fece21ba6415b8e6321542f9256cbce972 Mon Sep 17 00:00:00 2001 From: Matthias Ringwald Date: Mon, 17 Jun 2019 15:14:12 +0200 Subject: [PATCH] mesh: add mesh_configuration_server_feature_changed --- test/mesh/mesh_configuration_server.c | 9 +++++++++ test/mesh/mesh_configuration_server.h | 4 +++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/test/mesh/mesh_configuration_server.c b/test/mesh/mesh_configuration_server.c index 334f86ee1..c70f52202 100644 --- a/test/mesh/mesh_configuration_server.c +++ b/test/mesh/mesh_configuration_server.c @@ -1744,6 +1744,15 @@ static void config_heartbeat_publication_emit(mesh_heartbeat_publication_t * mes mesh_heartbeat_publication->count--; } } +void mesh_configuration_server_feature_changed(void){ + mesh_model_t * mesh_model = mesh_model_get_configuration_server(); + mesh_heartbeat_publication_t * mesh_heartbeat_publication = &((mesh_configuration_server_model_context_t*) mesh_model->model_data)->heartbeat_publication; + + // active features + uint16_t active_features = mesh_foundation_get_features(); + if (mesh_heartbeat_publication->active_features == active_features) return; + config_heartbeat_publication_emit(mesh_heartbeat_publication); +} static void config_heartbeat_publication_timeout_handler(btstack_timer_source_t * ts){ diff --git a/test/mesh/mesh_configuration_server.h b/test/mesh/mesh_configuration_server.h index 33ab7c6e9..c2218f39f 100644 --- a/test/mesh/mesh_configuration_server.h +++ b/test/mesh/mesh_configuration_server.h @@ -74,13 +74,15 @@ typedef struct { typedef struct { mesh_heartbeat_publication_t heartbeat_publication; mesh_heartbeat_subscription_t heartbeat_subscription; - + } mesh_configuration_server_model_context_t; // API const mesh_operation_t * mesh_configuration_server_get_operations(void); +void mesh_configuration_server_feature_changed(void); + void mesh_load_virtual_addresses(void); void mesh_delete_virtual_addresses(void);