From 2ea71aa957634ce69681ae34abace0566d52b744 Mon Sep 17 00:00:00 2001 From: Yuta Doi Date: Thu, 10 May 2018 13:10:28 +0900 Subject: Modify for restriction role - Add policy for restriction to dummy stm. - Add the function which inputs json file because json_object_from_file can not allows up to only 4KB file. - Bug fix in json files. - Delete unexpected characters. - Delete description because it does not follow the format of json array. Change-Id: I2f8fba1d1001cf244e2531fe3a1a738d5a48091b Signed-off-by: Yuta Doi --- src/policy_manager/policy_manager.cpp | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'src/policy_manager/policy_manager.cpp') diff --git a/src/policy_manager/policy_manager.cpp b/src/policy_manager/policy_manager.cpp index 9ece573..3b0eac6 100644 --- a/src/policy_manager/policy_manager.cpp +++ b/src/policy_manager/policy_manager.cpp @@ -68,9 +68,8 @@ int PolicyManager::initialize() { return ret; } - // TODO: // Initialize StateTransitioner - // stmInitialize(); + stm::stmInitialize(); return ret; } @@ -123,7 +122,7 @@ int PolicyManager::checkPolicy(json_object* json_in, json_object** json_out) { // Transition state HMI_DEBUG("wm:pm", "set event:0x%x", (event_no | category_no | area_no)); - int ret = stmTransitionState((event_no | category_no | area_no), + int ret = stm::stmTransitionState((event_no | category_no | area_no), &(this->current_state_)); if (0 > ret) { HMI_ERROR("wm:pm", "Error!!"); @@ -186,6 +185,19 @@ int PolicyManager::checkPolicy(json_object* json_in, json_object** json_out) { &json_tmp); json_object_array_add(json_layer, json_tmp); + // { + // "restriction": { + // "is_changed": , + // "state": + // } + // }, + json_tmp = json_object_new_object(); + this->addStateToJson("restriction", + this->current_state_.layer.restriction.is_changed, + stm::gStmLayoutNo2Name[this->current_state_.layer.restriction.state], + &json_tmp); + json_object_array_add(json_layer, json_tmp); + // { // "apps": { // "is_changed": , @@ -217,8 +229,6 @@ int PolicyManager::checkPolicy(json_object* json_in, json_object** json_out) { // Add json array of layer json_object_object_add(*json_out, "layers", json_layer); - HMI_DEBUG("wm:pm", "json_out.dump:%s", json_object_get_string(*json_out)); - return 0; } -- cgit 1.2.3-korg