+ HMI_DEBUG("wm:pm", "parking brake state (is_changed:%d state:%d:%s)",
+ crr_state.parking_brake.is_changed,
+ crr_state.parking_brake.state,
+ stm::gStmParkingBrakeStateNo2Name[crr_state.parking_brake.state]);
+ HMI_DEBUG("wm:pm", "accelerator pedal state (is_changed:%d state:%d:%s)",
+ crr_state.accel_pedal.is_changed,
+ crr_state.accel_pedal.state,
+ stm::gStmAccelPedalStateNo2Name[crr_state.accel_pedal.state]);
+ HMI_DEBUG("wm:pm", "lightstatus brake state (is_changed:%d state:%d:%s)",
+ crr_state.lightstatus_brake.is_changed,
+ crr_state.lightstatus_brake.state,
+ stm::gStmLightstatusBrakeStateNo2Name[crr_state.lightstatus_brake.state]);
+ HMI_DEBUG("wm:pm", "car state (is_changed:%d state:%d:%s)",
+ crr_state.car.is_changed,
+ crr_state.car.state,
+ stm::gStmCarStateNo2Name[crr_state.car.state]);
+ HMI_DEBUG("wm:pm", "lamp state (is_changed:%d state:%d:%s)",
+ crr_state.lamp.is_changed,
+ crr_state.lamp.state,
+ stm::gStmLampStateNo2Name[crr_state.lamp.state]);
+ HMI_DEBUG("wm:pm", "restriction mode state (is_changed:%d state:%d:%s)",
+ crr_state.restriction_mode.is_changed,
+ crr_state.restriction_mode.state,
+ stm::gStmRestrictionModeStateNo2Name[crr_state.restriction_mode.state]);
+ HMI_DEBUG("wm:pm", "homescreen state (is_changed:%d state:%d:%s)",
+ crr_state.layer[stm::gStmLayerNoHomescreen].is_changed,
+ crr_state.layer[stm::gStmLayerNoHomescreen].state,
+ stm::gStmLayoutNo2Name[crr_state.layer[stm::gStmLayerNoHomescreen].state]);
+ HMI_DEBUG("wm:pm", "apps state (is_changed:%d state:%d:%s)",
+ crr_state.layer[stm::gStmLayerNoApps].is_changed,
+ crr_state.layer[stm::gStmLayerNoApps].state,
+ stm::gStmLayoutNo2Name[crr_state.layer[stm::gStmLayerNoApps].state]);
+ HMI_DEBUG("wm:pm", "restriction state (is_changed:%d state:%d:%s)",
+ crr_state.layer[stm::gStmLayerNoRestriction].is_changed,
+ crr_state.layer[stm::gStmLayerNoRestriction].state,
+ stm::gStmLayoutNo2Name[crr_state.layer[stm::gStmLayerNoRestriction].state]);
+ HMI_DEBUG("wm:pm", "on_screen state (is_changed:%d state:%d:%s)",
+ crr_state.layer[stm::gStmLayerNoOnScreen].is_changed,
+ crr_state.layer[stm::gStmLayerNoOnScreen].state,
+ stm::gStmLayoutNo2Name[crr_state.layer[stm::gStmLayerNoOnScreen].state]);
+
+#if 0 // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
+ // Store previous layers
+ pm::g_prv_layers = pm::g_crr_layers;
+
+ std::string layer_name = "homescreen";
+
+ // changed?
+ if (crr_state.layer[stm::gStmLayerNoHomescreen].is_changed) {
+ // Get previous layout name of this layer
+ pm::LayoutState prv_layout_state = pm::g_prv_layers[layer_name];
+ std::string prv_layout_name = prv_homescreen_layout_state.first();
+
+ // Get current layout name of this layer
+ std::string crr_layout_name = std::string(stm::gStmLayoutNo2Name[crr_state.layer[stm::gStmLayerNoHomescreen].state]);
+
+ // Compare layout name
+ pm::LayoutState crr_layout_state;
+ if ("none" == crr_layout_name) {
+ // If current layout is "none",
+ // current areas is set with "none"
+ HMI_DEBUG("wm:pm", "Current layout is \"none\"");
+ HMI_DEBUG("wm:lm", "Current layout is \"none\"");
+ pm::AppAttribute crr_app_attribute;
+ pm::AreasState crr_areas_state;
+ crr_app_attribute["role"] = "none";
+ crr_areas_state["none"] = "none";
+ crr_layout_state["none"] = crr_areas_state;
+ }
+ else {
+ if (prv_layout_name == crr_layout_name) {
+ // If previous layout is same with current,
+ // previous areas are copied to current
+ crr_layout_state[crr_layout_name] = pm::g_prv_layers[layer_name][crr_layout_name];
+ }
+ else {
+ // If previous layout is same with current,
+ // previous areas are copied to current
+ crr_layout_state[crr_layout_name] = this->default_layout_state[crr_layout_name];
+ }
+
+ // Update role in new area
+#if 1
+ if (crr_state.restriction_mode.is_changed) {
+ // Updating role is not necessary
+ // because new_role is not specified
+ // when restriction mode is changed
+ HMI_DEBUG("wm:lm", "Updating role is not necessary because new_role is not specified when restriction mode is changed");
+#else
+ if (crr_state.car.is_changed) {
+ // Updating role is not necessary
+ // because new_role is not specified
+ // when car state is changed
+ HMI_DEBUG("wm:lm", "Updating role is not necessary because new_role is not specified when car state is changed");
+#endif
+ }
+ else {
+ HMI_DEBUG("wm:lm", "Get new_area for new role");
+ // Get new_area for new role
+ std::string new_area = this->getAreaName(this->layout_define_[crr_layout_name],
+ new_role, category);
+
+ if ("none" == new_area) {
+ HMI_DEBUG("wm:lm", "It is not necessary to update role of areas in this layer, because new_role is not specified for this layer");
+ }
+ else {
+ // Is there new_area?
+ // if there is new_area, set new role there
+
+ // if NOT, find same category of new_role
+ // pop old role and shift area
+ // push new role and set area
+
+
+ // Update role in new area
+ // because new_role is specified for this layer
+ TypeRolCtg crr_role;
+ crr_role["role"] = std::string(new_role);
+ crr_layout[crr_layout_name][new_area] = crr_role;
+ }
+ }
+ }
+ }
+
+ // Update current layout of this layer
+ pm::g_crr_layers[layer_name] = crr_layout_state;
+
+ }
+#endif // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
+
+ json_object* json_out = json_object_new_object();
+