aboutsummaryrefslogtreecommitdiffstats
path: root/src/policy_manager
diff options
context:
space:
mode:
Diffstat (limited to 'src/policy_manager')
-rw-r--r--src/policy_manager/policy_manager.cpp34
1 files changed, 30 insertions, 4 deletions
diff --git a/src/policy_manager/policy_manager.cpp b/src/policy_manager/policy_manager.cpp
index b55a44d..2e4a6f9 100644
--- a/src/policy_manager/policy_manager.cpp
+++ b/src/policy_manager/policy_manager.cpp
@@ -175,6 +175,28 @@ static void addStateToJson(
json_object_object_add(*json_out, key, json_obj);
}
+static void addStateToJson(const char* layer_name, unsigned int changed,
+ pm::AreaList area_list, json_object** json_out) {
+ if ((nullptr == layer_name) || (1 < changed) || (nullptr == json_out)) {
+ HMI_ERROR("wm:pm", "Invalid argument!!!");
+ return;
+ }
+
+ json_object* json_areas = json_object_new_array();
+ json_object* json_tmp;
+ for (pm::AreaState as : area_list) {
+ json_tmp = json_object_new_object();
+ json_object_object_add(json_tmp, "name", json_object_new_string(as.name.c_str()));
+ json_object_object_add(json_tmp, "role", json_object_new_string(as.role.c_str()));
+ json_object_array_add(json_areas, json_tmp);
+ }
+
+ json_object_object_add(*json_out, "name", json_object_new_string(layer_name));
+ json_object_object_add(*json_out, "changed", json_object_new_boolean(changed));
+ json_object_object_add(*json_out, "areas", json_areas);
+}
+
+
static int checkPolicyEntry(int event, uint64_t delay_ms, const char* role);
static int checkPolicy(sd_event_source *source, void *data) {
HMI_DEBUG("wm:pm", "Call");
@@ -516,12 +538,16 @@ static int checkPolicy(sd_event_source *source, void *data) {
// {
// "homescreen": {
- // "is_changed": <bool>,
- // "state": <const char*>
+ // "changed": <bool>,
+ // "areas": [
+ // {
+ // "name":<const char*>,
+ // "role":<const char*>
+ // }.
+ // ...
+ // ]
// }
// },
- // ]
- // }
json_tmp = json_object_new_object();
addStateToJson("homescreen",
crr_state.layer[stm::gStmLayerNoHomescreen].is_changed,