aboutsummaryrefslogtreecommitdiffstats
path: root/src/policy_manager/policy_manager.cpp
diff options
context:
space:
mode:
authorYuta Doi <yuta-d@witz-inc.co.jp>2018-05-10 13:10:28 +0900
committerYuta Doi <yuta-d@witz-inc.co.jp>2018-05-10 13:10:28 +0900
commit2ea71aa957634ce69681ae34abace0566d52b744 (patch)
treeb9d9ee097a78d3d21ee07d85193a2e2e6862fce6 /src/policy_manager/policy_manager.cpp
parent0dcb9ae1f99cffcafac62a324f8f054cc212a880 (diff)
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 <yuta-d@witz-inc.co.jp>
Diffstat (limited to 'src/policy_manager/policy_manager.cpp')
-rw-r--r--src/policy_manager/policy_manager.cpp20
1 files changed, 15 insertions, 5 deletions
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!!");
@@ -187,6 +186,19 @@ int PolicyManager::checkPolicy(json_object* json_in, json_object** json_out) {
json_object_array_add(json_layer, json_tmp);
// {
+ // "restriction": {
+ // "is_changed": <bool>,
+ // "state": <const char*>
+ // }
+ // },
+ 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": <bool>,
// "state": <const char*>
@@ -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;
}