diff options
author | Yuta Doi <yuta-d@witz-inc.co.jp> | 2018-06-20 21:56:36 +0900 |
---|---|---|
committer | Yuta Doi <yuta-d@witz-inc.co.jp> | 2018-06-20 21:56:36 +0900 |
commit | aab3a29a957c7063c53290b911e1b59bc8666268 (patch) | |
tree | 05eb50aa6b3af8da28cf4f08e4668d81b0665e34 /src/policy_manager | |
parent | d2ea0d3f12d8c9708071d921f543e64b4252cfd1 (diff) |
Modify process of analyzing current state in ResourceManager
Change-Id: I29115b7b5edbe66849de928a5b58e595c16fadaa
Signed-off-by: Yuta Doi <yuta-d@witz-inc.co.jp>
Diffstat (limited to 'src/policy_manager')
-rw-r--r-- | src/policy_manager/policy_manager.cpp | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/policy_manager/policy_manager.cpp b/src/policy_manager/policy_manager.cpp index fb468df..ddcb1d6 100644 --- a/src/policy_manager/policy_manager.cpp +++ b/src/policy_manager/policy_manager.cpp @@ -194,19 +194,15 @@ int PolicyManager::initializeSdEventLoop() { } static void addStateToJson( - const char* key, int is_changed, std::string state, json_object** json_out) { - if ((nullptr == key) || (nullptr == json_out)) { - HMI_ERROR("wm:pm", "Argument is nullptr!!!"); + const char* name, int changed, std::string state, json_object** json_out) { + if ((nullptr == name) || (1 < changed) || (nullptr == json_out)) { + HMI_ERROR("wm:pm", "Invalid argument!!!"); return; } - json_object* json_obj = json_object_new_object(); - json_object_object_add(json_obj, "is_changed", json_object_new_boolean(is_changed)); - if (is_changed) { - HMI_DEBUG("wm:pm", "%s: state changed (%s)", key, state.c_str()); - json_object_object_add(json_obj, "state", json_object_new_string(state.c_str())); - } - json_object_object_add(*json_out, key, json_obj); + json_object_object_add(*json_out, "name", json_object_new_string(name)); + json_object_object_add(*json_out, "state", json_object_new_string(state.c_str())); + json_object_object_add(*json_out, "changed", json_object_new_boolean(changed)); } static void addStateToJson(const char* layer_name, unsigned int changed, |