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.cpp156
-rw-r--r--src/policy_manager/zipc/dummy_stm.c539
-rw-r--r--src/policy_manager/zipc/dummy_stm.h286
3 files changed, 491 insertions, 490 deletions
diff --git a/src/policy_manager/policy_manager.cpp b/src/policy_manager/policy_manager.cpp
index 1c2acb4..d4aab12 100644
--- a/src/policy_manager/policy_manager.cpp
+++ b/src/policy_manager/policy_manager.cpp
@@ -92,19 +92,19 @@ int PolicyManager::initialize() {
int ret = 0;
// Create convert map
- for (int i = stm::STM_EVT_NO_MIN; i <= stm::STM_EVT_NO_MAX; i++) {
- HMI_DEBUG("wm:pm", "event name:%s no:%d", stm::gStmEventName[i], i);
- this->eventname2no[stm::gStmEventName[i]] = i;
+ for (int i = stm::StmEvtNoMin; i <= stm::StmEvtNoMax; i++) {
+ HMI_DEBUG("wm:pm", "event name:%s no:%d", stm::kStmEventName[i], i);
+ this->eventname2no[stm::kStmEventName[i]] = i;
}
- for (int i = stm::STM_CTG_NO_MIN; i <= stm::STM_CTG_NO_MAX; i++) {
- HMI_DEBUG("wm:pm", "category name:%s no:%d", stm::gStmCategoryName[i], i);
- this->categoryname2no[stm::gStmCategoryName[i]] = i;
+ for (int i = stm::StmCtgNoMin; i <= stm::StmCtgNoMax; i++) {
+ HMI_DEBUG("wm:pm", "category name:%s no:%d", stm::kStmCategoryName[i], i);
+ this->categoryname2no[stm::kStmCategoryName[i]] = i;
}
- for (int i = stm::STM_AREA_NO_MIN; i <= stm::STM_AREA_NO_MAX; i++) {
- HMI_DEBUG("wm:pm", "area name:%s no:%d", stm::gStmAreaName[i], i);
- this->areaname2no[stm::gStmAreaName[i]] = i;
+ for (int i = stm::StmAreaNoMin; i <= stm::StmAreaNoMax; i++) {
+ HMI_DEBUG("wm:pm", "area name:%s no:%d", stm::kStmAreaName[i], i);
+ this->areaname2no[stm::kStmAreaName[i]] = i;
}
// Load role.db
@@ -142,8 +142,8 @@ static void initializeLocalCarElementState() {
init_car_ele.state = "none";
init_car_ele.changed = false;
- for (int i = stm::gStmCarElementNoMin; i <= stm::gStmCarElementNoMax; i++) {
- const char* car_ele_name = stm::gStmCarElementName[i];
+ for (int i = stm::StmCarElementNoMin; i <= stm::StmCarElementNoMax; i++) {
+ const char* car_ele_name = stm::kStmCarElementName[i];
pm::g_crr_car_elements[car_ele_name] = init_car_ele;
}
@@ -153,14 +153,14 @@ static void initializeLocalCarElementState() {
static void initializeLocalLayerState() {
pm::AreaState init_area;
pm::LayoutState init_layout;
- init_area.name = stm::gStmAreaName[stm::STM_AREA_NO_NONE];
+ init_area.name = stm::kStmAreaName[stm::StmAreaNoNone];
init_area.category = "";
init_area.role = "";
- init_layout.name = stm::gStmLayoutName[stm::gStmLayoutNoNone];
+ init_layout.name = stm::kStmLayoutName[stm::StmLayoutNoNone];
init_layout.area_list.push_back(init_area);
- for (int i = stm::gStmLayerNoMin; i <= stm::gStmLayerNoMax; i++) {
- const char* layer_name = stm::gStmLayerName[i];
+ for (int i = stm::StmLayerNoMin; i <= stm::StmLayerNoMax; i++) {
+ const char* layer_name = stm::kStmLayerName[i];
pm::g_crr_layers[layer_name].name = layer_name;
pm::g_crr_layers[layer_name].layout_state = init_layout;
pm::g_crr_layers[layer_name].changed = false;
@@ -226,7 +226,7 @@ static void addStateToJson(const char* layer_name, bool changed,
json_object_object_add(*json_out, "areas", json_areas);
}
-static void updateLocalCarElementState(stm::stm_state_t crr_state) {
+static void updateLocalCarElementState(stm::StmState crr_state) {
int car_state_no;
std::string car_state;
bool changed;
@@ -236,12 +236,12 @@ static void updateLocalCarElementState(stm::stm_state_t crr_state) {
// Update car elements
HMI_DEBUG("wm:pm", ">>> CAR ELEMENT");
- for (int car_ele_no = stm::gStmCarElementNoMin;
- car_ele_no <= stm::gStmCarElementNoMax; car_ele_no++) {
- const char* car_ele_name = stm::gStmCarElementName[car_ele_no];
+ for (int car_ele_no = stm::StmCarElementNoMin;
+ car_ele_no <= stm::StmCarElementNoMax; car_ele_no++) {
+ const char* car_ele_name = stm::kStmCarElementName[car_ele_no];
car_state_no = crr_state.car_element[car_ele_no].state;
- car_state = stm::gStmCarStateNameList[car_ele_no][car_state_no];
+ car_state = stm::kStmCarStateNameList[car_ele_no][car_state_no];
changed = (crr_state.car_element[car_ele_no].changed) ? true : false;
pm::g_crr_car_elements[car_ele_name].state = car_state;
@@ -253,16 +253,16 @@ static void updateLocalCarElementState(stm::stm_state_t crr_state) {
}
}
-static void updateLocalLayerState(int event_data, stm::stm_state_t crr_state) {
+static void updateLocalLayerState(int event_data, stm::StmState crr_state) {
int event_no, category_no, area_no;
- event_no = GET_EVENT_FROM_ID(event_data);
- category_no = GET_CATEGORY_FROM_ID(event_data);
- area_no = GET_AREA_FROM_ID(event_data);
+ event_no = STM_GET_EVENT_FROM_ID(event_data);
+ category_no = STM_GET_CATEGORY_FROM_ID(event_data);
+ area_no = STM_GET_AREA_FROM_ID(event_data);
- std::string req_evt = stm::gStmEventName[event_no];
- std::string req_ctg = stm::gStmCategoryName[category_no];
- std::string req_area = stm::gStmAreaName[area_no];
+ std::string req_evt = stm::kStmEventName[event_no];
+ std::string req_ctg = stm::kStmCategoryName[category_no];
+ std::string req_area = stm::kStmAreaName[area_no];
std::string req_role = pm::g_req_role_list[event_data];
HMI_DEBUG("wm:pm", "REQ: event:%s role:%s category:%s area:%s",
req_evt.c_str(), req_role.c_str(), req_ctg.c_str(), req_area.c_str());
@@ -271,16 +271,16 @@ static void updateLocalLayerState(int event_data, stm::stm_state_t crr_state) {
pm::g_prv_layers = pm::g_crr_layers;
// Update layers
- for (int layer_no = stm::gStmLayerNoMin;
- layer_no <= stm::gStmLayerNoMax; layer_no++) {
- const char* layer_name = stm::gStmLayerName[layer_no];
+ for (int layer_no = stm::StmLayerNoMin;
+ layer_no <= stm::StmLayerNoMax; layer_no++) {
+ const char* layer_name = stm::kStmLayerName[layer_no];
HMI_DEBUG("wm:pm", "LAYER:%s", layer_name);
#if 1
// If restriction mode is changed off -> on,
// store current state for state of restriction mode off
- if ((crr_state.car_element[stm::gStmCarElementNoRestrictionMode].changed)
- && (stm::gStmRestrictionModeStateNoOn == crr_state.car_element[stm::gStmCarElementNoRestrictionMode].state)) {
+ if ((crr_state.car_element[stm::StmCarElementNoRestrictionMode].changed)
+ && (stm::StmRestrictionModeSttNoOn == crr_state.car_element[stm::StmCarElementNoRestrictionMode].state)) {
HMI_DEBUG("wm:pm", "Store current state for state of restriction mode off");
pm::g_prv_layers_car_stop[layer_name] = pm::g_crr_layers[layer_name];
}
@@ -288,7 +288,7 @@ static void updateLocalLayerState(int event_data, stm::stm_state_t crr_state) {
// If car state is changed car_stop -> car_run,
// store current state for state of car stop
if ((crr_state.car.changed)
- && (stm::gStmRunningNoRun == crr_state.car.state)) {
+ && (stm::StmRunningNoRun == crr_state.car.state)) {
HMI_DEBUG("wm:pm", "Store current state for state of car stop");
pm::g_prv_layers_car_stop[layer_name] = pm::g_crr_layers[layer_name];
}
@@ -305,18 +305,18 @@ static void updateLocalLayerState(int event_data, stm::stm_state_t crr_state) {
// Get current layout name of this layer
int crr_layout_state_no = crr_state.layer[layer_no].state;
- std::string crr_layout_name = std::string(stm::gStmLayoutName[crr_layout_state_no]);
+ std::string crr_layout_name = std::string(stm::kStmLayoutName[crr_layout_state_no]);
pm::LayoutState crr_layout_state;
#if 1
- if ((crr_state.car_element[stm::gStmCarElementNoRestrictionMode].changed)
- && (stm::gStmRestrictionModeStateNoOff == crr_state.car_element[stm::gStmCarElementNoRestrictionMode].state)) {
+ if ((crr_state.car_element[stm::StmCarElementNoRestrictionMode].changed)
+ && (stm::StmRestrictionModeSttNoOff == crr_state.car_element[stm::StmCarElementNoRestrictionMode].state)) {
// If restriction mode is changed on -> off,
// restore state of restriction mode off
HMI_DEBUG("wm:pm", "Restriction mode is changed on -> off, so restore state of restriction mode off");
#else
- if ((crr_state.car_element[gStmCarElementNoRunning].changed)
- && (stm::gStmCarElementNoStop == crr_state.car_element[gStmCarElementNoRunning].state)) {
+ if ((crr_state.car_element[stm::StmCarElementNoRunning].changed)
+ && (stm::StmCarElementNoStop == crr_state.car_element[stm::StmCarElementNoRunning].state)) {
// If car state is changed car_run -> car_stop,
// restore state of car stop
HMI_DEBUG("wm:pm", "Car state is changed car_run -> car_stop, so restore state of car stop");
@@ -324,12 +324,12 @@ static void updateLocalLayerState(int event_data, stm::stm_state_t crr_state) {
crr_layout_state = pm::g_prv_layers_car_stop[layer_name].layout_state;
crr_layout_name = crr_layout_state.name;
if ((prv_layout_name == crr_layout_name)
- && (stm::gStmAreaName[stm::STM_AREA_NO_NONE] == crr_layout_name)) {
+ && (stm::kStmAreaName[stm::StmAreaNoNone] == crr_layout_name)) {
changed = 0;
}
}
else if ((prv_layout_name == crr_layout_name)
- && (stm::gStmAreaName[stm::STM_AREA_NO_NONE] == crr_layout_name)) {
+ && (stm::kStmAreaName[stm::StmAreaNoNone] == crr_layout_name)) {
// Copy previous layout state for current
crr_layout_state = prv_layout_state;
changed = 0;
@@ -354,9 +354,9 @@ static void updateLocalLayerState(int event_data, stm::stm_state_t crr_state) {
// Create candidate list
std::map<std::string, pm::AreaList> cand_list;
- for (int ctg_no=stm::STM_CTG_NO_MIN;
- ctg_no<=stm::STM_CTG_NO_MAX; ctg_no++) {
- const char* ctg = stm::gStmCategoryName[ctg_no];
+ for (int ctg_no=stm::StmCtgNoMin;
+ ctg_no<=stm::StmCtgNoMax; ctg_no++) {
+ const char* ctg = stm::kStmCategoryName[ctg_no];
HMI_DEBUG("wm:pm", "ctg:%s", ctg);
// Create candidate list for category from the previous displayed categories
@@ -491,12 +491,12 @@ static void updateLocalLayerState(int event_data, stm::stm_state_t crr_state) {
}
}
-static void updateLocalState(int event_data, stm::stm_state_t crr_state) {
+static void updateLocalState(int event_data, stm::StmState crr_state) {
updateLocalCarElementState(crr_state);
updateLocalLayerState(event_data, crr_state);
}
-static void createOutputInformation(stm::stm_state_t crr_state, json_object **json_out) {
+static void createOutputInformation(stm::StmState crr_state, json_object **json_out) {
json_object* json_tmp;
// Create car element information
@@ -511,9 +511,9 @@ static void createOutputInformation(stm::stm_state_t crr_state, json_object **js
// },
json_object* json_car_ele = json_object_new_array();
const char* car_ele_name;
- for (int car_ele_no = stm::gStmCarElementNoMin;
- car_ele_no <= stm::gStmCarElementNoMax; car_ele_no++) {
- car_ele_name = stm::gStmCarElementName[car_ele_no];
+ for (int car_ele_no = stm::StmCarElementNoMin;
+ car_ele_no <= stm::StmCarElementNoMax; car_ele_no++) {
+ car_ele_name = stm::kStmCarElementName[car_ele_no];
json_tmp = json_object_new_object();
addStateToJson(car_ele_name,
pm::g_crr_car_elements[car_ele_name].changed,
@@ -541,9 +541,9 @@ static void createOutputInformation(stm::stm_state_t crr_state, json_object **js
// ...
json_object* json_layer = json_object_new_array();
const char* layer_name;
- for (int layer_no = stm::gStmLayerNoMin;
- layer_no <= stm::gStmLayerNoMax; layer_no++) {
- layer_name = stm::gStmLayerName[layer_no];
+ for (int layer_no = stm::StmLayerNoMin;
+ layer_no <= stm::StmLayerNoMax; layer_no++) {
+ layer_name = stm::kStmLayerName[layer_no];
json_tmp = json_object_new_object();
addStateToJson(layer_name,
pm::g_crr_layers[layer_name].changed,
@@ -555,19 +555,19 @@ static void createOutputInformation(stm::stm_state_t crr_state, json_object **js
}
static int checkPolicyEntry(int event, uint64_t delay_ms, std::string role);
-static void controlTimerEvent(stm::stm_state_t crr_state) {
- if (crr_state.car_element[stm::gStmCarElementNoRunning].changed) {
- if (stm::gStmRunningNoRun == crr_state.car_element[stm::gStmCarElementNoRunning].state) {
+static void controlTimerEvent(stm::StmState crr_state) {
+ if (crr_state.car_element[stm::StmCarElementNoRunning].changed) {
+ if (stm::StmRunningNoRun == crr_state.car_element[stm::StmCarElementNoRunning].state) {
// Set delay event(restriction mode on)
- checkPolicyEntry(stm::STM_EVT_NO_RESTRICTION_MODE_ON, 3000, "");
+ checkPolicyEntry(stm::StmEvtNoRestrictionModeOn, 3000, "");
}
- else if (stm::gStmRunningNoStop == crr_state.car_element[stm::gStmCarElementNoRunning].state) {
+ else if (stm::StmRunningNoStop == crr_state.car_element[stm::StmCarElementNoRunning].state) {
// Stop timer for restriction on event
- if (pm::event_source_list.find(stm::STM_EVT_NO_RESTRICTION_MODE_ON)
+ if (pm::event_source_list.find(stm::StmEvtNoRestrictionModeOn)
!= pm::event_source_list.end()) {
HMI_DEBUG("wm:pm", "Stop timer for restriction on");
sd_event_source *event_source
- = pm::event_source_list[stm::STM_EVT_NO_RESTRICTION_MODE_ON];
+ = pm::event_source_list[stm::StmEvtNoRestrictionModeOn];
int ret = sd_event_source_set_enabled(event_source, SD_EVENT_OFF);
if (0 > ret) {
HMI_ERROR("wm:pm", "Failed to stop timer");
@@ -575,7 +575,7 @@ static void controlTimerEvent(stm::stm_state_t crr_state) {
}
// Set event(restriction mode off)
- checkPolicyEntry(stm::STM_EVT_NO_RESTRICTION_MODE_OFF, 0, "");
+ checkPolicyEntry(stm::StmEvtNoRestrictionModeOff, 0, "");
}
}
}
@@ -587,16 +587,16 @@ static int checkPolicy(sd_event_source *source, void *data) {
int event_data = *((int*)data);
int event_no, category_no, area_no;
- event_no = GET_EVENT_FROM_ID(event_data);
- category_no = GET_CATEGORY_FROM_ID(event_data);
- area_no = GET_AREA_FROM_ID(event_data);
+ event_no = STM_GET_EVENT_FROM_ID(event_data);
+ category_no = STM_GET_CATEGORY_FROM_ID(event_data);
+ area_no = STM_GET_AREA_FROM_ID(event_data);
HMI_DEBUG("wm:pm", ">>>>>>>>>> event:%s category:%s area:%s",
- stm::gStmEventName[event_no],
- stm::gStmCategoryName[category_no],
- stm::gStmAreaName[area_no]);
+ stm::kStmEventName[event_no],
+ stm::kStmCategoryName[category_no],
+ stm::kStmAreaName[area_no]);
// Transition state
- stm::stm_state_t crr_state;
+ stm::StmState crr_state;
int ret = stm::stmTransitionState(event_data, &crr_state);
if (0 > ret) {
HMI_ERROR("wm:pm", "Failed transition state");
@@ -605,11 +605,11 @@ static int checkPolicy(sd_event_source *source, void *data) {
json_object_object_add(json_out, "message",
json_object_new_string("Failed to transition state"));
json_object_object_add(json_out, "event",
- json_object_new_string(stm::gStmEventName[event_no]));
+ json_object_new_string(stm::kStmEventName[event_no]));
json_object_object_add(json_out, "role",
json_object_new_string(pm::g_req_role_list[event_data].c_str()));
json_object_object_add(json_out, "area",
- json_object_new_string(stm::gStmAreaName[area_no]));
+ json_object_new_string(stm::kStmAreaName[area_no]));
pm::callback.onError(json_out);
json_object_put(json_out);
}
@@ -718,7 +718,7 @@ int PolicyManager::setInputEventData(json_object* json_in) {
// Get event from json_object
const char* event = this->getStringFromJson(json_in, "event");
- int event_no = stm::STM_EVT_NO_NONE;
+ int event_no = stm::StmEvtNoNone;
if (nullptr != event) {
// Convert name to number
auto itr = this->eventname2no.find(event);
@@ -738,7 +738,7 @@ int PolicyManager::setInputEventData(json_object* json_in) {
// Get role from json_object
const char* role = this->getStringFromJson(json_in, "role");
- int category_no = stm::STM_CTG_NO_NONE;
+ int category_no = stm::StmCtgNoNone;
if (nullptr != role) {
HMI_DEBUG("wm:pm", "role(%s)", role);
@@ -754,13 +754,13 @@ int PolicyManager::setInputEventData(json_object* json_in) {
}
}
- if (stm::STM_CTG_NO_NONE == category_no) {
+ if (stm::StmCtgNoNone == category_no) {
role = "";
}
// Get areat from json_object
const char* area = this->getStringFromJson(json_in, "area");
- int area_no = stm::STM_AREA_NO_NONE;
+ int area_no = stm::StmAreaNoNone;
if (nullptr != area) {
auto itr = this->areaname2no.find(area);
if (this->areaname2no.end() != itr) {
@@ -770,8 +770,8 @@ int PolicyManager::setInputEventData(json_object* json_in) {
}
// If role is set and area is not set, use default area
- if ((stm::STM_AREA_NO_NONE == area_no)
- && (stm::STM_CTG_NO_NONE != category_no)) {
+ if ((stm::StmAreaNoNone == area_no)
+ && (stm::StmCtgNoNone != category_no)) {
std::string def_area = this->role2defaultarea[role];
area_no = this->areaname2no[def_area];
HMI_DEBUG("wm:pm", "area(%s:%d)", def_area.c_str(), area_no);
@@ -779,7 +779,7 @@ int PolicyManager::setInputEventData(json_object* json_in) {
// Set event info to the queue
EventInfo event_info;
- int event_id = CREATE_EVENT_ID(event_no, category_no, area_no);
+ int event_id = STM_CREATE_EVENT_ID(event_no, category_no, area_no);
event_info.event = event_id;
event_info.role = std::string(role);
event_info.delay = 0;
@@ -969,9 +969,9 @@ int PolicyManager::loadLayoutDb() {
pm::LayoutState layout_state;
pm::AreaState area_state;
std::map<std::string, int> category_num;
- for (int ctg_no = stm::STM_CTG_NO_MIN;
- ctg_no <= stm::STM_CTG_NO_MAX; ctg_no++) {
- const char* ctg_name = stm::gStmCategoryName[ctg_no];
+ for (int ctg_no = stm::StmCtgNoMin;
+ ctg_no <= stm::StmCtgNoMax; ctg_no++) {
+ const char* ctg_name = stm::kStmCategoryName[ctg_no];
category_num[ctg_name] = 0;
}
diff --git a/src/policy_manager/zipc/dummy_stm.c b/src/policy_manager/zipc/dummy_stm.c
index 6847e15..e90da3c 100644
--- a/src/policy_manager/zipc/dummy_stm.c
+++ b/src/policy_manager/zipc/dummy_stm.c
@@ -2,7 +2,7 @@
#include "dummy_stm.h"
#include "hmi-debug.h"
-const char* gStmEventName[] = {
+const char* kStmEventName[] = {
"none",
"activate",
"deactivate",
@@ -12,7 +12,6 @@ const char* gStmEventName[] = {
"parking_brake_on",
"accel_pedal_off",
"accel_pedal_on",
- "timer_expired",
"lamp_off",
"lamp_on",
"lightstatus_brake_off",
@@ -21,7 +20,7 @@ const char* gStmEventName[] = {
"restriction_mode_on",
};
-const char* gStmCategoryName[] = {
+const char* kStmCategoryName[] = {
"none",
"homescreen",
"map",
@@ -33,7 +32,7 @@ const char* gStmCategoryName[] = {
"system",
};
-const char* gStmAreaName[] = {
+const char* kStmAreaName[] = {
"none",
"fullscreen",
"normal",
@@ -46,42 +45,42 @@ const char* gStmAreaName[] = {
};
// String for state
-const char* gStmTransGearStateName[] = {
+const char* kStmTransGearStateName[] = {
"neutral",
"not_neutral"
};
-const char* gStmParkingBrakeStateName[] = {
+const char* kStmParkingBrakeStateName[] = {
"off",
"on"
};
-const char* gStmAccelPedalStateName[] = {
+const char* kStmAccelPedalStateName[] = {
"off",
"on"
};
-const char* gStmRunningStateNo2Name[] = {
+const char* kStmRunningSttNo2Name[] = {
"stop",
"run"
};
-const char* gStmLampStateName[] = {
+const char* kStmLampStateName[] = {
"off",
"on"
};
-const char* gStmLightstatusBrakeStateName[] = {
+const char* kStmLightstatusBrakeStateName[] = {
"off",
"on"
};
-const char* gStmRestrictionModeStateName[] = {
+const char* kStmRestrictionModeStateName[] = {
"off",
"on"
};
-const char* gStmLayoutName[] = {
+const char* kStmLayoutName[] = {
"none",
"pop_up",
"system_alert",
@@ -98,14 +97,14 @@ const char* gStmLayoutName[] = {
"system.normal",
};
-const char* gStmLayerName[] = {
+const char* kStmLayerName[] = {
"homescreen",
"apps",
"restriction",
"on_screen",
};
-const char* gStmCarElementName[] = {
+const char* kStmCarElementName[] = {
"trans_gear",
"parking_brake",
"accel_pedal",
@@ -115,141 +114,141 @@ const char* gStmCarElementName[] = {
"restriction_mode",
};
-const char** gStmCarStateNameList[] = {
- gStmTransGearStateName,
- gStmParkingBrakeStateName,
- gStmAccelPedalStateName,
- gStmRunningStateNo2Name,
- gStmLampStateName,
- gStmLightstatusBrakeStateName,
- gStmRestrictionModeStateName,
+const char** kStmCarStateNameList[] = {
+ kStmTransGearStateName,
+ kStmParkingBrakeStateName,
+ kStmAccelPedalStateName,
+ kStmRunningSttNo2Name,
+ kStmLampStateName,
+ kStmLightstatusBrakeStateName,
+ kStmRestrictionModeStateName,
};
-stm_state_t g_crr_state;
-stm_state_t g_prv_state;
-int g_prv_on_screen_state_car_stop = 0;
-int g_prv_restriction_state_car_stop = 0;
-int g_prv_apps_state_car_stop = 0;
-int g_map_is_activated = STM_FALSE;
+static StmState g_crr_state;
+static StmState g_prv_state;
+static int g_prv_on_screen_state_car_stop = 0;
+static int g_prv_restriction_state_car_stop = 0;
+static int g_prv_apps_state_car_stop = 0;
+static int g_map_is_activated = STM_FALSE;
void stmInitialize() {
// Initialize previous state
memset(&g_prv_state, 0, sizeof(g_prv_state));
- g_prv_state.layer[gStmLayerNoOnScreen].state = gStmLayoutNoNone;
- g_prv_state.layer[gStmLayerNoRestriction].state = gStmLayoutNoNone;
- g_prv_state.layer[gStmLayerNoApps].state = gStmLayoutNoNone;
- g_prv_state.layer[gStmLayerNoHomescreen].state = gStmLayoutNoNone;
- g_prv_state.car_element[gStmCarElementNoTransGear].state = gStmTransGearStateNoN;
- g_prv_state.car_element[gStmCarElementNoLightstatusBrake].state = gStmLightstatusBrakeStateNoOn;
- g_prv_state.car_element[gStmCarElementNoAccelPedal].state = gStmAccelPedalStateNoOff;
- g_prv_state.car_element[gStmCarElementNoRunning].state = gStmRunningNoStop;
- g_prv_state.car_element[gStmCarElementNoLamp].state = gStmLampStateNoOff;
- g_prv_state.car_element[gStmCarElementNoParkingBrake].state = gStmParkingBrakeStateNoOn;
- g_prv_state.car_element[gStmCarElementNoRestrictionMode].state = gStmRestrictionModeStateNoOff;
+ g_prv_state.layer[StmLayerNoOnScreen].state = StmLayoutNoNone;
+ g_prv_state.layer[StmLayerNoRestriction].state = StmLayoutNoNone;
+ g_prv_state.layer[StmLayerNoApps].state = StmLayoutNoNone;
+ g_prv_state.layer[StmLayerNoHomescreen].state = StmLayoutNoNone;
+ g_prv_state.car_element[StmCarElementNoTransGear].state = StmTransGearSttNoN;
+ g_prv_state.car_element[StmCarElementNoLightstatusBrake].state = StmLightstatusBrakeSttNoOn;
+ g_prv_state.car_element[StmCarElementNoAccelPedal].state = StmAccelPedalSttNoOff;
+ g_prv_state.car_element[StmCarElementNoRunning].state = StmRunningNoStop;
+ g_prv_state.car_element[StmCarElementNoLamp].state = StmLampSttNoOff;
+ g_prv_state.car_element[StmCarElementNoParkingBrake].state = StmParkingBrakeSttNoOn;
+ g_prv_state.car_element[StmCarElementNoRestrictionMode].state = StmRestrictionModeSttNoOff;
// Initialize current state
g_crr_state = g_prv_state;
}
-int stmTransitionState(int event, stm_state_t* state) {
+int stmTransitionState(int event, StmState* state) {
int event_no, category_no, area_no;
int on_screen_state, restriction_state, apps_state;
int trans_gear_state, parking_brake_state, lightstatus_brake_state, accel_pedal_state, car_state, lamp_state, restriction_mode_state;
- event_no = GET_EVENT_FROM_ID(event);
- category_no = GET_CATEGORY_FROM_ID(event);
- area_no = GET_AREA_FROM_ID(event);
+ event_no = STM_GET_EVENT_FROM_ID(event);
+ category_no = STM_GET_CATEGORY_FROM_ID(event);
+ area_no = STM_GET_AREA_FROM_ID(event);
// Backup previous state
g_prv_state = g_crr_state;
// Get previous state
- on_screen_state = g_prv_state.layer[gStmLayerNoOnScreen].state;
- restriction_state = g_prv_state.layer[gStmLayerNoRestriction].state;
- apps_state = g_prv_state.layer[gStmLayerNoApps].state;
- trans_gear_state = g_prv_state.car_element[gStmCarElementNoTransGear].state;
- parking_brake_state = g_prv_state.car_element[gStmCarElementNoParkingBrake].state;
- accel_pedal_state = g_prv_state.car_element[gStmCarElementNoAccelPedal].state;
- car_state = g_prv_state.car_element[gStmCarElementNoRunning].state;
- lamp_state = g_prv_state.car_element[gStmCarElementNoLamp].state;
- lightstatus_brake_state = g_prv_state.car_element[gStmCarElementNoLightstatusBrake].state;
- restriction_mode_state = g_prv_state.car_element[gStmCarElementNoRestrictionMode].state;
+ on_screen_state = g_prv_state.layer[StmLayerNoOnScreen].state;
+ restriction_state = g_prv_state.layer[StmLayerNoRestriction].state;
+ apps_state = g_prv_state.layer[StmLayerNoApps].state;
+ trans_gear_state = g_prv_state.car_element[StmCarElementNoTransGear].state;
+ parking_brake_state = g_prv_state.car_element[StmCarElementNoParkingBrake].state;
+ accel_pedal_state = g_prv_state.car_element[StmCarElementNoAccelPedal].state;
+ car_state = g_prv_state.car_element[StmCarElementNoRunning].state;
+ lamp_state = g_prv_state.car_element[StmCarElementNoLamp].state;
+ lightstatus_brake_state = g_prv_state.car_element[StmCarElementNoLightstatusBrake].state;
+ restriction_mode_state = g_prv_state.car_element[StmCarElementNoRestrictionMode].state;
// Clear flags
- g_crr_state.layer[gStmLayerNoOnScreen].changed = STM_FALSE;
- g_crr_state.layer[gStmLayerNoRestriction].changed = STM_FALSE;
- g_crr_state.layer[gStmLayerNoApps].changed = STM_FALSE;
- g_crr_state.layer[gStmLayerNoHomescreen].changed = STM_FALSE;
- g_crr_state.car_element[gStmCarElementNoTransGear].changed = STM_FALSE;
- g_crr_state.car_element[gStmCarElementNoParkingBrake].changed = STM_FALSE;
- g_crr_state.car_element[gStmCarElementNoLightstatusBrake].changed = STM_FALSE;
- g_crr_state.car_element[gStmCarElementNoAccelPedal].changed = STM_FALSE;
- g_crr_state.car_element[gStmCarElementNoRunning].changed = STM_FALSE;
- g_crr_state.car_element[gStmCarElementNoLamp].changed = STM_FALSE;
- g_crr_state.car_element[gStmCarElementNoRestrictionMode].changed = STM_FALSE;
+ g_crr_state.layer[StmLayerNoOnScreen].changed = STM_FALSE;
+ g_crr_state.layer[StmLayerNoRestriction].changed = STM_FALSE;
+ g_crr_state.layer[StmLayerNoApps].changed = STM_FALSE;
+ g_crr_state.layer[StmLayerNoHomescreen].changed = STM_FALSE;
+ g_crr_state.car_element[StmCarElementNoTransGear].changed = STM_FALSE;
+ g_crr_state.car_element[StmCarElementNoParkingBrake].changed = STM_FALSE;
+ g_crr_state.car_element[StmCarElementNoLightstatusBrake].changed = STM_FALSE;
+ g_crr_state.car_element[StmCarElementNoAccelPedal].changed = STM_FALSE;
+ g_crr_state.car_element[StmCarElementNoRunning].changed = STM_FALSE;
+ g_crr_state.car_element[StmCarElementNoLamp].changed = STM_FALSE;
+ g_crr_state.car_element[StmCarElementNoRestrictionMode].changed = STM_FALSE;
// Set car state
switch (event_no) {
- case STM_EVT_NO_TRANS_GEAR_N:
- if (gStmTransGearStateNoN != trans_gear_state) {
- g_crr_state.car_element[gStmCarElementNoTransGear].state = gStmTransGearStateNoN;
- g_crr_state.car_element[gStmCarElementNoTransGear].changed = STM_TRUE;
+ case StmEvtNoTransGearN:
+ if (StmTransGearSttNoN != trans_gear_state) {
+ g_crr_state.car_element[StmCarElementNoTransGear].state = StmTransGearSttNoN;
+ g_crr_state.car_element[StmCarElementNoTransGear].changed = STM_TRUE;
}
break;
- case STM_EVT_NO_TRANS_GEAR_NOT_N:
- if (gStmTransGearStateNoNotN != trans_gear_state) {
- g_crr_state.car_element[gStmCarElementNoTransGear].state = gStmTransGearStateNoNotN;
- g_crr_state.car_element[gStmCarElementNoTransGear].changed = STM_TRUE;
+ case StmEvtNoTransGearNotN:
+ if (StmTransGearSttNoNotN != trans_gear_state) {
+ g_crr_state.car_element[StmCarElementNoTransGear].state = StmTransGearSttNoNotN;
+ g_crr_state.car_element[StmCarElementNoTransGear].changed = STM_TRUE;
}
break;
- case STM_EVT_NO_PARKING_BRAKE_OFF:
- if (gStmParkingBrakeStateNoOff != parking_brake_state) {
- g_crr_state.car_element[gStmCarElementNoParkingBrake].state = gStmParkingBrakeStateNoOff;
- g_crr_state.car_element[gStmCarElementNoParkingBrake].changed = STM_TRUE;
+ case StmEvtNoParkingBrakeOff:
+ if (StmParkingBrakeSttNoOff != parking_brake_state) {
+ g_crr_state.car_element[StmCarElementNoParkingBrake].state = StmParkingBrakeSttNoOff;
+ g_crr_state.car_element[StmCarElementNoParkingBrake].changed = STM_TRUE;
}
break;
- case STM_EVT_NO_PARKING_BRAKE_ON:
- if (gStmParkingBrakeStateNoOn != parking_brake_state) {
- g_crr_state.car_element[gStmCarElementNoParkingBrake].state = gStmParkingBrakeStateNoOn;
- g_crr_state.car_element[gStmCarElementNoParkingBrake].changed = STM_TRUE;
+ case StmEvtNoParkingBrakeOn:
+ if (StmParkingBrakeSttNoOn != parking_brake_state) {
+ g_crr_state.car_element[StmCarElementNoParkingBrake].state = StmParkingBrakeSttNoOn;
+ g_crr_state.car_element[StmCarElementNoParkingBrake].changed = STM_TRUE;
}
break;
- case STM_EVT_NO_ACCEL_PEDAL_OFF:
- if (gStmAccelPedalStateNoOff != accel_pedal_state) {
- g_crr_state.car_element[gStmCarElementNoAccelPedal].state = gStmAccelPedalStateNoOff;
- g_crr_state.car_element[gStmCarElementNoAccelPedal].changed = STM_TRUE;
+ case StmEvtNoAccelPedalOff:
+ if (StmAccelPedalSttNoOff != accel_pedal_state) {
+ g_crr_state.car_element[StmCarElementNoAccelPedal].state = StmAccelPedalSttNoOff;
+ g_crr_state.car_element[StmCarElementNoAccelPedal].changed = STM_TRUE;
}
break;
- case STM_EVT_NO_ACCEL_PEDAL_ON:
- if (gStmAccelPedalStateNoOn != accel_pedal_state) {
- g_crr_state.car_element[gStmCarElementNoAccelPedal].state = gStmAccelPedalStateNoOn;
- g_crr_state.car_element[gStmCarElementNoAccelPedal].changed = STM_TRUE;
+ case StmEvtNoAccelPedalOn:
+ if (StmAccelPedalSttNoOn != accel_pedal_state) {
+ g_crr_state.car_element[StmCarElementNoAccelPedal].state = StmAccelPedalSttNoOn;
+ g_crr_state.car_element[StmCarElementNoAccelPedal].changed = STM_TRUE;
}
break;
- case STM_EVT_NO_LAMP_OFF:
- if (gStmLampStateNoOff != lamp_state) {
- g_crr_state.car_element[gStmCarElementNoLamp].state = gStmLampStateNoOff;
- g_crr_state.car_element[gStmCarElementNoLamp].changed = STM_TRUE;
+ case StmEvtNoLampOff:
+ if (StmLampSttNoOff != lamp_state) {
+ g_crr_state.car_element[StmCarElementNoLamp].state = StmLampSttNoOff;
+ g_crr_state.car_element[StmCarElementNoLamp].changed = STM_TRUE;
}
break;
- case STM_EVT_NO_LAMP_ON:
- if (gStmLampStateNoOn != lamp_state) {
- g_crr_state.car_element[gStmCarElementNoLamp].state = gStmLampStateNoOn;
- g_crr_state.car_element[gStmCarElementNoLamp].changed = STM_TRUE;
+ case StmEvtNoLampOn:
+ if (StmLampSttNoOn != lamp_state) {
+ g_crr_state.car_element[StmCarElementNoLamp].state = StmLampSttNoOn;
+ g_crr_state.car_element[StmCarElementNoLamp].changed = STM_TRUE;
}
break;
- case STM_EVT_NO_LIGHTSTATUS_BRAKE_OFF:
- if (gStmLightstatusBrakeStateNoOff != lightstatus_brake_state) {
- g_crr_state.car_element[gStmCarElementNoLightstatusBrake].state = gStmLightstatusBrakeStateNoOff;
- g_crr_state.car_element[gStmCarElementNoLightstatusBrake].changed = STM_TRUE;
+ case StmEvtNoLightstatusBrakeOff:
+ if (StmLightstatusBrakeSttNoOff != lightstatus_brake_state) {
+ g_crr_state.car_element[StmCarElementNoLightstatusBrake].state = StmLightstatusBrakeSttNoOff;
+ g_crr_state.car_element[StmCarElementNoLightstatusBrake].changed = STM_TRUE;
}
break;
- case STM_EVT_NO_LIGHTSTATUS_BRAKE_ON:
- if (gStmLightstatusBrakeStateNoOn != lightstatus_brake_state) {
- g_crr_state.car_element[gStmCarElementNoLightstatusBrake].state = gStmLightstatusBrakeStateNoOn;
- g_crr_state.car_element[gStmCarElementNoLightstatusBrake].changed = STM_TRUE;
+ case StmEvtNoLightstatusBrakeOn:
+ if (StmLightstatusBrakeSttNoOn != lightstatus_brake_state) {
+ g_crr_state.car_element[StmCarElementNoLightstatusBrake].state = StmLightstatusBrakeSttNoOn;
+ g_crr_state.car_element[StmCarElementNoLightstatusBrake].changed = STM_TRUE;
}
break;
default:
@@ -258,133 +257,133 @@ int stmTransitionState(int event, stm_state_t* state) {
}
#if 1 // FOR ALS
- if (g_crr_state.car_element[gStmCarElementNoLightstatusBrake].changed
- || g_crr_state.car_element[gStmCarElementNoAccelPedal].changed) {
- if ((gStmLightstatusBrakeStateNoOff == g_crr_state.car_element[gStmCarElementNoLightstatusBrake].state)
- && (gStmAccelPedalStateNoOn == g_crr_state.car_element[gStmCarElementNoAccelPedal].state)){
+ if (g_crr_state.car_element[StmCarElementNoLightstatusBrake].changed
+ || g_crr_state.car_element[StmCarElementNoAccelPedal].changed) {
+ if ((StmLightstatusBrakeSttNoOff == g_crr_state.car_element[StmCarElementNoLightstatusBrake].state)
+ && (StmAccelPedalSttNoOn == g_crr_state.car_element[StmCarElementNoAccelPedal].state)){
#else
- if (g_crr_state.car_element[gStmCarElementNoParkingBrake].changed
- || g_crr_state.car_element[gStmCarElementNoTransGear].changed) {
- if ((gStmParkingBrakeStateNoOff == g_crr_state.car_element[gStmCarElementNoParkingBrake].state)
- && (gStmTransGearStateNoNotN == g_crr_state.car_element[gStmCarElementNoTransGear].state)){
+ if (g_crr_state.car_element[StmCarElementNoParkingBrake].changed
+ || g_crr_state.car_element[StmCarElementNoTransGear].changed) {
+ if ((StmParkingBrakeSttNoOff == g_crr_state.car_element[StmCarElementNoParkingBrake].state)
+ && (StmTransGearSttNoNotN == g_crr_state.car_element[StmCarElementNoTransGear].state)){
#endif
- if (gStmRunningNoRun != car_state) {
+ if (StmRunningNoRun != car_state) {
// Car state is changed stop -> run
- g_crr_state.car_element[gStmCarElementNoRunning].state = gStmRunningNoRun;
- g_crr_state.car_element[gStmCarElementNoRunning].changed = STM_TRUE;
+ g_crr_state.car_element[StmCarElementNoRunning].state = StmRunningNoRun;
+ g_crr_state.car_element[StmCarElementNoRunning].changed = STM_TRUE;
}
}
else {
- if (gStmRunningNoStop != car_state) {
+ if (StmRunningNoStop != car_state) {
// Car state is changed run -> stop
- g_crr_state.car_element[gStmCarElementNoRunning].state = gStmRunningNoStop;
- g_crr_state.car_element[gStmCarElementNoRunning].changed = STM_TRUE;
+ g_crr_state.car_element[StmCarElementNoRunning].state = StmRunningNoStop;
+ g_crr_state.car_element[StmCarElementNoRunning].changed = STM_TRUE;
}
}
}
// Set restriction mode
- if ((STM_EVT_NO_RESTRICTION_MODE_ON == event_no)
- && (gStmRestrictionModeStateNoOn != restriction_mode_state)) {
+ if ((StmEvtNoRestrictionModeOn == event_no)
+ && (StmRestrictionModeSttNoOn != restriction_mode_state)) {
HMI_DEBUG("wm:pm:stm", "Restriction mode OFF -> ON");
// Restriction mode is changed OFF -> ON
- g_crr_state.car_element[gStmCarElementNoRestrictionMode].state = gStmRestrictionModeStateNoOn;
- g_crr_state.car_element[gStmCarElementNoRestrictionMode].changed = STM_TRUE;
+ g_crr_state.car_element[StmCarElementNoRestrictionMode].state = StmRestrictionModeSttNoOn;
+ g_crr_state.car_element[StmCarElementNoRestrictionMode].changed = STM_TRUE;
// Update on screen layer
g_prv_on_screen_state_car_stop = on_screen_state;
- g_crr_state.layer[gStmLayerNoOnScreen].state = gStmLayoutNoNone;
- g_crr_state.layer[gStmLayerNoOnScreen].changed = STM_TRUE;
+ g_crr_state.layer[StmLayerNoOnScreen].state = StmLayoutNoNone;
+ g_crr_state.layer[StmLayerNoOnScreen].changed = STM_TRUE;
// Update restriction layer
g_prv_restriction_state_car_stop = restriction_state;
- g_crr_state.layer[gStmLayerNoRestriction].state = gStmLayoutNoNone;
- g_crr_state.layer[gStmLayerNoRestriction].changed = STM_TRUE;
+ g_crr_state.layer[StmLayerNoRestriction].state = StmLayoutNoNone;
+ g_crr_state.layer[StmLayerNoRestriction].changed = STM_TRUE;
// Update apps layer
g_prv_apps_state_car_stop = apps_state;
if ((STM_TRUE == g_map_is_activated)
- && (gStmLayoutNoSysNml != apps_state)) {
- g_crr_state.layer[gStmLayerNoApps].state = gStmLayoutNoMapNml;
- g_crr_state.layer[gStmLayerNoApps].changed = STM_TRUE;
+ && (StmLayoutNoSysNml != apps_state)) {
+ g_crr_state.layer[StmLayerNoApps].state = StmLayoutNoMapNml;
+ g_crr_state.layer[StmLayerNoApps].changed = STM_TRUE;
}
}
- else if ((STM_EVT_NO_RESTRICTION_MODE_OFF == event_no)
- && (gStmRestrictionModeStateNoOff != restriction_mode_state)) {
+ else if ((StmEvtNoRestrictionModeOff == event_no)
+ && (StmRestrictionModeSttNoOff != restriction_mode_state)) {
HMI_DEBUG("wm:pm:stm", "Restriction mode ON -> OFF");
// Restriction mode is changed ON -> OFF
- g_crr_state.car_element[gStmCarElementNoRestrictionMode].state = gStmRestrictionModeStateNoOff;
- g_crr_state.car_element[gStmCarElementNoRestrictionMode].changed = STM_TRUE;
+ g_crr_state.car_element[StmCarElementNoRestrictionMode].state = StmRestrictionModeSttNoOff;
+ g_crr_state.car_element[StmCarElementNoRestrictionMode].changed = STM_TRUE;
// Update on screen layer
- g_crr_state.layer[gStmLayerNoOnScreen].state = g_prv_on_screen_state_car_stop;
- g_crr_state.layer[gStmLayerNoOnScreen].changed = STM_TRUE;
+ g_crr_state.layer[StmLayerNoOnScreen].state = g_prv_on_screen_state_car_stop;
+ g_crr_state.layer[StmLayerNoOnScreen].changed = STM_TRUE;
// Update restriction layer
- g_crr_state.layer[gStmLayerNoRestriction].state = g_prv_restriction_state_car_stop;
- g_crr_state.layer[gStmLayerNoRestriction].changed = STM_TRUE;
+ g_crr_state.layer[StmLayerNoRestriction].state = g_prv_restriction_state_car_stop;
+ g_crr_state.layer[StmLayerNoRestriction].changed = STM_TRUE;
// Update apps layer
if (STM_TRUE == g_map_is_activated) {
- g_crr_state.layer[gStmLayerNoApps].state = g_prv_apps_state_car_stop;
- g_crr_state.layer[gStmLayerNoApps].changed = STM_TRUE;
+ g_crr_state.layer[StmLayerNoApps].state = g_prv_apps_state_car_stop;
+ g_crr_state.layer[StmLayerNoApps].changed = STM_TRUE;
}
}
// Set apps/homescreen layer
switch (event_no) {
- case STM_EVT_NO_ACTIVATE:
- if (gStmRestrictionModeStateNoOff == restriction_mode_state) {
+ case StmEvtNoActivate:
+ if (StmRestrictionModeSttNoOff == restriction_mode_state) {
switch (category_no) {
- case STM_CTG_NO_HOMESCREEN:
+ case StmCtgNoHomescreen:
// Homescreen layer
- g_crr_state.layer[gStmLayerNoHomescreen].state = gStmLayoutNoHms;
- g_crr_state.layer[gStmLayerNoHomescreen].changed = STM_TRUE;
+ g_crr_state.layer[StmLayerNoHomescreen].state = StmLayoutNoHms;
+ g_crr_state.layer[StmLayerNoHomescreen].changed = STM_TRUE;
// Apps layer
- if (gStmLayoutNoNone != apps_state) {
- g_crr_state.layer[gStmLayerNoApps].state = gStmLayoutNoNone;
- g_crr_state.layer[gStmLayerNoApps].changed = STM_TRUE;
+ if (StmLayoutNoNone != apps_state) {
+ g_crr_state.layer[StmLayerNoApps].state = StmLayoutNoNone;
+ g_crr_state.layer[StmLayerNoApps].changed = STM_TRUE;
}
break;
- case STM_CTG_NO_MAP:
+ case StmCtgNoMap:
switch (area_no) {
- case STM_AREA_NO_FULL:
+ case StmAreaNoFullscreen:
// Apps layer
switch (apps_state) {
- case gStmLayoutNoMapFll:
+ case StmLayoutNoMapFll:
// nop
break;
default:
- g_crr_state.layer[gStmLayerNoApps].state = gStmLayoutNoMapFll;
- g_crr_state.layer[gStmLayerNoApps].changed = STM_TRUE;
+ g_crr_state.layer[StmLayerNoApps].state = StmLayoutNoMapFll;
+ g_crr_state.layer[StmLayerNoApps].changed = STM_TRUE;
break;
}
break;
- case STM_AREA_NO_NORMAL:
+ case StmAreaNoNormal:
// Apps layer
switch (apps_state) {
- case gStmLayoutNoMapNml:
+ case StmLayoutNoMapNml:
// nop
break;
- case gStmLayoutNoSplNml:
- g_crr_state.layer[gStmLayerNoApps].state = gStmLayoutNoMapSpl;
- g_crr_state.layer[gStmLayerNoApps].changed = STM_TRUE;
+ case StmLayoutNoSplNml:
+ g_crr_state.layer[StmLayerNoApps].state = StmLayoutNoMapSpl;
+ g_crr_state.layer[StmLayerNoApps].changed = STM_TRUE;
break;
default:
- g_crr_state.layer[gStmLayerNoApps].state = gStmLayoutNoMapNml;
- g_crr_state.layer[gStmLayerNoApps].changed = STM_TRUE;
+ g_crr_state.layer[StmLayerNoApps].state = StmLayoutNoMapNml;
+ g_crr_state.layer[StmLayerNoApps].changed = STM_TRUE;
}
break;
- case STM_AREA_NO_SPLIT_MAIN:
+ case StmAreaNoSplitMain:
// Apps layer
switch (apps_state) {
- case gStmLayoutNoSplNml:
- case gStmLayoutNoSplSpl:
- g_crr_state.layer[gStmLayerNoApps].state = gStmLayoutNoSplSpl;
- g_crr_state.layer[gStmLayerNoApps].changed = STM_TRUE;
+ case StmLayoutNoSplNml:
+ case StmLayoutNoSplSpl:
+ g_crr_state.layer[StmLayerNoApps].state = StmLayoutNoSplSpl;
+ g_crr_state.layer[StmLayerNoApps].changed = STM_TRUE;
break;
default:
// nop
@@ -393,17 +392,17 @@ int stmTransitionState(int event, stm_state_t* state) {
break;
}
break;
- case STM_CTG_NO_GENERAL:
+ case StmCtgNoGeneral:
switch (area_no) {
- case STM_AREA_NO_NORMAL:
+ case StmAreaNoNormal:
// Apps layer
switch (apps_state) {
- case gStmLayoutNoMapFll:
+ case StmLayoutNoMapFll:
// nop
break;
default:
- g_crr_state.layer[gStmLayerNoApps].state = gStmLayoutNoGenNml;
- g_crr_state.layer[gStmLayerNoApps].changed = STM_TRUE;
+ g_crr_state.layer[StmLayerNoApps].state = StmLayoutNoGenNml;
+ g_crr_state.layer[StmLayerNoApps].changed = STM_TRUE;
break;
}
break;
@@ -412,17 +411,17 @@ int stmTransitionState(int event, stm_state_t* state) {
break;
}
break;
- case STM_CTG_NO_SYSTEM:
+ case StmCtgNoSYSTEM:
switch (area_no) {
- case STM_AREA_NO_NORMAL:
+ case StmAreaNoNormal:
// Apps layer
switch (apps_state) {
- case gStmLayoutNoMapFll:
+ case StmLayoutNoMapFll:
// nop
break;
default:
- g_crr_state.layer[gStmLayerNoApps].state = gStmLayoutNoSysNml;
- g_crr_state.layer[gStmLayerNoApps].changed = STM_TRUE;
+ g_crr_state.layer[StmLayerNoApps].state = StmLayoutNoSysNml;
+ g_crr_state.layer[StmLayerNoApps].changed = STM_TRUE;
break;
}
break;
@@ -431,59 +430,59 @@ int stmTransitionState(int event, stm_state_t* state) {
break;
}
break;
- case STM_CTG_NO_SPLITABLE:
+ case StmCtgNoSplitable:
switch (area_no) {
- case STM_AREA_NO_NORMAL:
+ case StmAreaNoNormal:
// Apps layer
switch (apps_state) {
- case gStmLayoutNoMapNml:
- g_crr_state.layer[gStmLayerNoApps].state = gStmLayoutNoMapSpl;
- g_crr_state.layer[gStmLayerNoApps].changed = STM_TRUE;
+ case StmLayoutNoMapNml:
+ g_crr_state.layer[StmLayerNoApps].state = StmLayoutNoMapSpl;
+ g_crr_state.layer[StmLayerNoApps].changed = STM_TRUE;
break;
- case gStmLayoutNoMapFll:
- case gStmLayoutNoSplNml:
+ case StmLayoutNoMapFll:
+ case StmLayoutNoSplNml:
// nop
break;
default:
- g_crr_state.layer[gStmLayerNoApps].state = gStmLayoutNoSplNml;
- g_crr_state.layer[gStmLayerNoApps].changed = STM_TRUE;
+ g_crr_state.layer[StmLayerNoApps].state = StmLayoutNoSplNml;
+ g_crr_state.layer[StmLayerNoApps].changed = STM_TRUE;
break;
}
break;
- case STM_AREA_NO_SPLIT_MAIN:
+ case StmAreaNoSplitMain:
// Apps layer
switch (apps_state) {
- case gStmLayoutNoSplNml:
- g_crr_state.layer[gStmLayerNoApps].state = gStmLayoutNoSplSpl;
- g_crr_state.layer[gStmLayerNoApps].changed = STM_TRUE;
+ case StmLayoutNoSplNml:
+ g_crr_state.layer[StmLayerNoApps].state = StmLayoutNoSplSpl;
+ g_crr_state.layer[StmLayerNoApps].changed = STM_TRUE;
break;
- case gStmLayoutNoSplSpl:
- g_crr_state.layer[gStmLayerNoApps].state = gStmLayoutNoSplSpl;
- g_crr_state.layer[gStmLayerNoApps].changed = STM_TRUE;
+ case StmLayoutNoSplSpl:
+ g_crr_state.layer[StmLayerNoApps].state = StmLayoutNoSplSpl;
+ g_crr_state.layer[StmLayerNoApps].changed = STM_TRUE;
break;
default:
// nop
break;
}
break;
- case STM_AREA_NO_SPLIT_SUB:
+ case StmAreaNoSplitSub:
// Apps layer
switch (apps_state) {
- case gStmLayoutNoMapNml:
- g_crr_state.layer[gStmLayerNoApps].state = gStmLayoutNoMapSpl;
- g_crr_state.layer[gStmLayerNoApps].changed = STM_TRUE;
+ case StmLayoutNoMapNml:
+ g_crr_state.layer[StmLayerNoApps].state = StmLayoutNoMapSpl;
+ g_crr_state.layer[StmLayerNoApps].changed = STM_TRUE;
break;
- case gStmLayoutNoMapSpl:
- g_crr_state.layer[gStmLayerNoApps].state = gStmLayoutNoMapSpl;
- g_crr_state.layer[gStmLayerNoApps].changed = STM_TRUE;
+ case StmLayoutNoMapSpl:
+ g_crr_state.layer[StmLayerNoApps].state = StmLayoutNoMapSpl;
+ g_crr_state.layer[StmLayerNoApps].changed = STM_TRUE;
break;
- case gStmLayoutNoSplNml:
- g_crr_state.layer[gStmLayerNoApps].state = gStmLayoutNoSplSpl;
- g_crr_state.layer[gStmLayerNoApps].changed = STM_TRUE;
+ case StmLayoutNoSplNml:
+ g_crr_state.layer[StmLayerNoApps].state = StmLayoutNoSplSpl;
+ g_crr_state.layer[StmLayerNoApps].changed = STM_TRUE;
break;
- case gStmLayoutNoSplSpl:
- g_crr_state.layer[gStmLayerNoApps].state = gStmLayoutNoSplSpl;
- g_crr_state.layer[gStmLayerNoApps].changed = STM_TRUE;
+ case StmLayoutNoSplSpl:
+ g_crr_state.layer[StmLayerNoApps].state = StmLayoutNoSplSpl;
+ g_crr_state.layer[StmLayerNoApps].changed = STM_TRUE;
break;
default:
// nop
@@ -501,36 +500,36 @@ int stmTransitionState(int event, stm_state_t* state) {
}
break;
}
- else { // (gStmRestrictionModeStateNoOn == restriction_mode_state)
+ else { // (StmRestrictionModeSttNoOn == restriction_mode_state)
switch (category_no) {
- case STM_CTG_NO_MAP:
+ case StmCtgNoMap:
switch (area_no) {
- case STM_AREA_NO_FULL:
- case STM_AREA_NO_NORMAL:
- case STM_AREA_NO_SPLIT_MAIN:
+ case StmAreaNoFullscreen:
+ case StmAreaNoNormal:
+ case StmAreaNoSplitMain:
// Apps layer
switch (apps_state) {
- case gStmLayoutNoMapNml:
+ case StmLayoutNoMapNml:
// nop
break;
default:
- g_crr_state.layer[gStmLayerNoApps].state = gStmLayoutNoMapNml;
- g_crr_state.layer[gStmLayerNoApps].changed = STM_TRUE;
+ g_crr_state.layer[StmLayerNoApps].state = StmLayoutNoMapNml;
+ g_crr_state.layer[StmLayerNoApps].changed = STM_TRUE;
}
break;
}
break;
- case STM_CTG_NO_SYSTEM:
+ case StmCtgNoSYSTEM:
switch (area_no) {
- case STM_AREA_NO_NORMAL:
+ case StmAreaNoNormal:
// Apps layer
switch (apps_state) {
- case gStmLayoutNoMapFll:
+ case StmLayoutNoMapFll:
// nop
break;
default:
- g_crr_state.layer[gStmLayerNoApps].state = gStmLayoutNoSysNml;
- g_crr_state.layer[gStmLayerNoApps].changed = STM_TRUE;
+ g_crr_state.layer[StmLayerNoApps].state = StmLayoutNoSysNml;
+ g_crr_state.layer[StmLayerNoApps].changed = STM_TRUE;
break;
}
break;
@@ -541,7 +540,7 @@ int stmTransitionState(int event, stm_state_t* state) {
break;
}
}
- case STM_EVT_NO_DEACTIVATE:
+ case StmEvtNoDeactivate:
switch (category_no) {
default:
// nop
@@ -555,20 +554,20 @@ int stmTransitionState(int event, stm_state_t* state) {
// Set restriction layer
- if (STM_CTG_NO_RESTRICTION == category_no) {
- if (STM_EVT_NO_ACTIVATE == event_no) {
- if (gStmLightstatusBrakeStateNoOff == g_crr_state.car_element[gStmCarElementNoLightstatusBrake].state) {
+ if (StmCtgNoRestriction == category_no) {
+ if (StmEvtNoActivate == event_no) {
+ if (StmLightstatusBrakeSttNoOff == g_crr_state.car_element[StmCarElementNoLightstatusBrake].state) {
switch (area_no) {
- case STM_AREA_NO_RESTRICTION_NORMAL:
+ case StmAreaNoRestrictionNormal:
switch (restriction_state) {
- case gStmLayoutNoNone:
- if (g_crr_state.layer[gStmLayerNoApps].state == gStmLayoutNoSplNml) {
- g_crr_state.layer[gStmLayerNoRestriction].state = gStmLayoutNoRstNml;
- g_crr_state.layer[gStmLayerNoRestriction].changed = STM_TRUE;
+ case StmLayoutNoNone:
+ if (g_crr_state.layer[StmLayerNoApps].state == StmLayoutNoSplNml) {
+ g_crr_state.layer[StmLayerNoRestriction].state = StmLayoutNoRstNml;
+ g_crr_state.layer[StmLayerNoRestriction].changed = STM_TRUE;
}
- else if (g_crr_state.layer[gStmLayerNoApps].state == gStmLayoutNoMapSpl) {
- g_crr_state.layer[gStmLayerNoRestriction].state = gStmLayoutNoRstSplSub;
- g_crr_state.layer[gStmLayerNoRestriction].changed = STM_TRUE;
+ else if (g_crr_state.layer[StmLayerNoApps].state == StmLayoutNoMapSpl) {
+ g_crr_state.layer[StmLayerNoRestriction].state = StmLayoutNoRstSplSub;
+ g_crr_state.layer[StmLayerNoRestriction].changed = STM_TRUE;
}
break;
default:
@@ -576,23 +575,23 @@ int stmTransitionState(int event, stm_state_t* state) {
break;
}
break;
- case STM_AREA_NO_RESTRICTION_SPLIT_MAIN:
+ case StmAreaNoRestrictionSplitMain:
switch (restriction_state) {
- case gStmLayoutNoNone:
- g_crr_state.layer[gStmLayerNoRestriction].state = gStmLayoutNoRstSplMain;
- g_crr_state.layer[gStmLayerNoRestriction].changed = STM_TRUE;
+ case StmLayoutNoNone:
+ g_crr_state.layer[StmLayerNoRestriction].state = StmLayoutNoRstSplMain;
+ g_crr_state.layer[StmLayerNoRestriction].changed = STM_TRUE;
break;
default:
// nop
break;
}
break;
- case STM_AREA_NO_RESTRICTION_SPLIT_SUB:
+ case StmAreaNoRestrictionSplitSub:
switch (restriction_state) {
- case gStmLayoutNoNone:
- if (g_crr_state.layer[gStmLayerNoApps].state == gStmLayoutNoMapSpl) {
- g_crr_state.layer[gStmLayerNoRestriction].state = gStmLayoutNoRstSplSub;
- g_crr_state.layer[gStmLayerNoRestriction].changed = STM_TRUE;
+ case StmLayoutNoNone:
+ if (g_crr_state.layer[StmLayerNoApps].state == StmLayoutNoMapSpl) {
+ g_crr_state.layer[StmLayerNoRestriction].state = StmLayoutNoRstSplSub;
+ g_crr_state.layer[StmLayerNoRestriction].changed = STM_TRUE;
}
break;
default:
@@ -606,13 +605,13 @@ int stmTransitionState(int event, stm_state_t* state) {
}
}
}
- else if (STM_EVT_NO_DEACTIVATE == event_no) {
+ else if (StmEvtNoDeactivate == event_no) {
switch (restriction_state) {
- case gStmLayoutNoRstNml:
- case gStmLayoutNoRstSplMain:
- case gStmLayoutNoRstSplSub:
- g_crr_state.layer[gStmLayerNoRestriction].state = gStmLayoutNoNone;
- g_crr_state.layer[gStmLayerNoRestriction].changed = STM_TRUE;
+ case StmLayoutNoRstNml:
+ case StmLayoutNoRstSplMain:
+ case StmLayoutNoRstSplSub:
+ g_crr_state.layer[StmLayerNoRestriction].state = StmLayoutNoNone;
+ g_crr_state.layer[StmLayerNoRestriction].changed = STM_TRUE;
break;
default:
// nop
@@ -620,49 +619,49 @@ int stmTransitionState(int event, stm_state_t* state) {
}
}
}
- else if (g_crr_state.layer[gStmLayerNoApps].changed) {
- if (gStmLightstatusBrakeStateNoOff == g_crr_state.car_element[gStmCarElementNoLightstatusBrake].state) {
- if (gStmLayoutNoMapSpl == g_crr_state.layer[gStmLayerNoApps].state) {
- g_crr_state.layer[gStmLayerNoRestriction].state = gStmLayoutNoRstSplSub;
- g_crr_state.layer[gStmLayerNoRestriction].changed = STM_TRUE;
+ else if (g_crr_state.layer[StmLayerNoApps].changed) {
+ if (StmLightstatusBrakeSttNoOff == g_crr_state.car_element[StmCarElementNoLightstatusBrake].state) {
+ if (StmLayoutNoMapSpl == g_crr_state.layer[StmLayerNoApps].state) {
+ g_crr_state.layer[StmLayerNoRestriction].state = StmLayoutNoRstSplSub;
+ g_crr_state.layer[StmLayerNoRestriction].changed = STM_TRUE;
}
- else if (gStmLayoutNoSplNml == g_crr_state.layer[gStmLayerNoApps].state) {
- g_crr_state.layer[gStmLayerNoRestriction].state = gStmLayoutNoRstNml;
- g_crr_state.layer[gStmLayerNoRestriction].changed = STM_TRUE;
+ else if (StmLayoutNoSplNml == g_crr_state.layer[StmLayerNoApps].state) {
+ g_crr_state.layer[StmLayerNoRestriction].state = StmLayoutNoRstNml;
+ g_crr_state.layer[StmLayerNoRestriction].changed = STM_TRUE;
}
else {
- if (gStmLayoutNoNone != g_crr_state.layer[gStmLayerNoRestriction].state) {
- g_crr_state.layer[gStmLayerNoRestriction].state = gStmLayoutNoNone;
- g_crr_state.layer[gStmLayerNoRestriction].changed = STM_TRUE;
+ if (StmLayoutNoNone != g_crr_state.layer[StmLayerNoRestriction].state) {
+ g_crr_state.layer[StmLayerNoRestriction].state = StmLayoutNoNone;
+ g_crr_state.layer[StmLayerNoRestriction].changed = STM_TRUE;
}
}
}
else {
- if (gStmLayoutNoNone != g_crr_state.layer[gStmLayerNoRestriction].state) {
- g_crr_state.layer[gStmLayerNoRestriction].state = gStmLayoutNoNone;
- g_crr_state.layer[gStmLayerNoRestriction].changed = STM_TRUE;
+ if (StmLayoutNoNone != g_crr_state.layer[StmLayerNoRestriction].state) {
+ g_crr_state.layer[StmLayerNoRestriction].state = StmLayoutNoNone;
+ g_crr_state.layer[StmLayerNoRestriction].changed = STM_TRUE;
}
}
}
// Set on screen layer
- if (STM_CTG_NO_POPUP == category_no) {
- if (STM_EVT_NO_ACTIVATE == event_no) {
+ if (StmCtgNoPopUp == category_no) {
+ if (StmEvtNoActivate == event_no) {
switch (on_screen_state) {
- case gStmLayoutNoNone:
- g_crr_state.layer[gStmLayerNoOnScreen].state = gStmLayoutNoPopUp;
- g_crr_state.layer[gStmLayerNoOnScreen].changed = STM_TRUE;
+ case StmLayoutNoNone:
+ g_crr_state.layer[StmLayerNoOnScreen].state = StmLayoutNoPopUp;
+ g_crr_state.layer[StmLayerNoOnScreen].changed = STM_TRUE;
break;
default:
// nop
break;
}
}
- else if (STM_EVT_NO_DEACTIVATE == event_no) {
+ else if (StmEvtNoDeactivate == event_no) {
switch (on_screen_state) {
- case gStmLayoutNoPopUp:
- g_crr_state.layer[gStmLayerNoOnScreen].state = gStmLayoutNoNone;
- g_crr_state.layer[gStmLayerNoOnScreen].changed = STM_TRUE;
+ case StmLayoutNoPopUp:
+ g_crr_state.layer[StmLayerNoOnScreen].state = StmLayoutNoNone;
+ g_crr_state.layer[StmLayerNoOnScreen].changed = STM_TRUE;
break;
default:
// nop
@@ -675,10 +674,10 @@ int stmTransitionState(int event, stm_state_t* state) {
memcpy(state, &g_crr_state, sizeof(g_crr_state));
if ((STM_FALSE == g_map_is_activated)
- && (STM_TRUE == g_crr_state.layer[gStmLayerNoApps].changed)
- && ((gStmLayoutNoMapNml == g_crr_state.layer[gStmLayerNoApps].state)
- || (gStmLayoutNoMapSpl == g_crr_state.layer[gStmLayerNoApps].state)
- || (gStmLayoutNoMapFll == g_crr_state.layer[gStmLayerNoApps].state))) {
+ && (STM_TRUE == g_crr_state.layer[StmLayerNoApps].changed)
+ && ((StmLayoutNoMapNml == g_crr_state.layer[StmLayerNoApps].state)
+ || (StmLayoutNoMapSpl == g_crr_state.layer[StmLayerNoApps].state)
+ || (StmLayoutNoMapFll == g_crr_state.layer[StmLayerNoApps].state))) {
g_map_is_activated = STM_TRUE;
}
diff --git a/src/policy_manager/zipc/dummy_stm.h b/src/policy_manager/zipc/dummy_stm.h
index a7f3032..97f6a5a 100644
--- a/src/policy_manager/zipc/dummy_stm.h
+++ b/src/policy_manager/zipc/dummy_stm.h
@@ -17,193 +17,195 @@
#ifndef TMCAGLWM_DUMMY_STM_HPP
#define TMCAGLWM_DUMMY_STM_HPP
-// TODO: This file should be existed in STM
-//
#define STM_TRUE 1
#define STM_FALSE 0
-// Event number
-enum STM_EVT_NO {
- STM_EVT_NO_NONE = 0,
- STM_EVT_NO_ACTIVATE,
- STM_EVT_NO_DEACTIVATE,
- STM_EVT_NO_TRANS_GEAR_N,
- STM_EVT_NO_TRANS_GEAR_NOT_N,
- STM_EVT_NO_PARKING_BRAKE_OFF,
- STM_EVT_NO_PARKING_BRAKE_ON,
- STM_EVT_NO_ACCEL_PEDAL_OFF,
- STM_EVT_NO_ACCEL_PEDAL_ON,
- STM_EVT_NO_TIMER_EXPIRED,
- STM_EVT_NO_LAMP_OFF,
- STM_EVT_NO_LAMP_ON,
- STM_EVT_NO_LIGHTSTATUS_BRAKE_OFF,
- STM_EVT_NO_LIGHTSTATUS_BRAKE_ON,
- STM_EVT_NO_RESTRICTION_MODE_OFF,
- STM_EVT_NO_RESTRICTION_MODE_ON,
-
- STM_EVT_NO_NUM,
-
- STM_EVT_NO_MIN = STM_EVT_NO_NONE,
- STM_EVT_NO_MAX = STM_EVT_NO_NUM - 1,
-};
-
-// Category number
-enum STM_CTG_NO {
- STM_CTG_NO_NONE = 0,
- STM_CTG_NO_HOMESCREEN,
- STM_CTG_NO_MAP,
- STM_CTG_NO_GENERAL,
- STM_CTG_NO_SPLITABLE,
- STM_CTG_NO_POPUP,
- STM_CTG_NO_SYSTEM_ALERT,
- STM_CTG_NO_RESTRICTION,
- STM_CTG_NO_SYSTEM,
-
- STM_CTG_NO_NUM,
-
- STM_CTG_NO_MIN = STM_CTG_NO_NONE,
- STM_CTG_NO_MAX = STM_CTG_NO_NUM - 1,
-};
-
-// Area number
-enum STM_AREA_NO {
- STM_AREA_NO_NONE = 0,
- STM_AREA_NO_FULL,
- STM_AREA_NO_NORMAL,
- STM_AREA_NO_SPLIT_MAIN,
- STM_AREA_NO_SPLIT_SUB,
- STM_AREA_NO_POP_UP,
- STM_AREA_NO_RESTRICTION_NORMAL,
- STM_AREA_NO_RESTRICTION_SPLIT_MAIN,
- STM_AREA_NO_RESTRICTION_SPLIT_SUB,
-
- STM_AREA_NO_NUM,
-
- STM_AREA_NO_MIN = STM_AREA_NO_NONE,
- STM_AREA_NO_MAX = STM_AREA_NO_NUM - 1,
-};
-
-#define CREATE_EVENT_ID(evt, ctg, area) \
+#define STM_CREATE_EVENT_ID(evt, ctg, area) \
((evt) | ((ctg) << 8) | ((area) << 16))
-#define GET_EVENT_FROM_ID(id) \
+#define STM_GET_EVENT_FROM_ID(id) \
((id) & 0xFF)
-#define GET_CATEGORY_FROM_ID(id) \
+#define STM_GET_CATEGORY_FROM_ID(id) \
(((id) >> 8) & 0xFF)
-#define GET_AREA_FROM_ID(id) \
+#define STM_GET_AREA_FROM_ID(id) \
(((id) >> 16) & 0xFF)
-// Enum for state
-enum stm_trans_gear_state_ {
- gStmTransGearStateNoN = 0,
- gStmTransGearStateNoNotN
+// Event number
+enum StmEvtNo {
+ StmEvtNoNone = 0,
+ StmEvtNoActivate,
+ StmEvtNoDeactivate,
+ StmEvtNoTransGearN,
+ StmEvtNoTransGearNotN,
+ StmEvtNoParkingBrakeOff,
+ StmEvtNoParkingBrakeOn,
+ StmEvtNoAccelPedalOff,
+ StmEvtNoAccelPedalOn,
+ StmEvtNoLampOff,
+ StmEvtNoLampOn,
+ StmEvtNoLightstatusBrakeOff,
+ StmEvtNoLightstatusBrakeOn,
+ StmEvtNoRestrictionModeOff,
+ StmEvtNoRestrictionModeOn,
+
+ StmEvtNoNum,
+
+ StmEvtNoMin = StmEvtNoNone,
+ StmEvtNoMax = StmEvtNoNum - 1,
};
-enum stm_parking_brake_state_ {
- gStmParkingBrakeStateNoOff = 0,
- gStmParkingBrakeStateNoOn
+// Category number
+enum StmCtgNo {
+ StmCtgNoNone = 0,
+ StmCtgNoHomescreen,
+ StmCtgNoMap,
+ StmCtgNoGeneral,
+ StmCtgNoSplitable,
+ StmCtgNoPopUp,
+ StmCtgNoSystemAlert,
+ StmCtgNoRestriction,
+ StmCtgNoSYSTEM,
+
+ StmCtgNoNum,
+
+ StmCtgNoMin = StmCtgNoNone,
+ StmCtgNoMax = StmCtgNoNum - 1,
};
-enum stm_accel_pedal_state_ {
- gStmAccelPedalStateNoOff = 0,
- gStmAccelPedalStateNoOn
+// Area number
+enum StmAreaNo {
+ StmAreaNoNone = 0,
+ StmAreaNoFullscreen,
+ StmAreaNoNormal,
+ StmAreaNoSplitMain,
+ StmAreaNoSplitSub,
+ StmAreaNoPopUp,
+ StmAreaNoRestrictionNormal,
+ StmAreaNoRestrictionSplitMain,
+ StmAreaNoRestrictionSplitSub,
+
+ StmAreaNoNum,
+
+ StmAreaNoMin = StmAreaNoNone,
+ StmAreaNoMax = StmAreaNoNum - 1,
};
-enum stm_car_state_ {
- gStmRunningNoStop = 0,
- gStmRunningNoRun
-};
+// Layer number
+enum StmLayerNo {
+ StmLayerNoHomescreen = 0,
+ StmLayerNoApps,
+ StmLayerNoRestriction,
+ StmLayerNoOnScreen,
+
+ StmLayerNoNum,
-enum stm_lamp_state_ {
- gStmLampStateNoOff = 0,
- gStmLampStateNoOn
+ StmLayerNoMin = StmLayerNoHomescreen,
+ StmLayerNoMax = StmLayerNoNum - 1,
};
-enum stm_lightstatus_brake_state_ {
- gStmLightstatusBrakeStateNoOff = 0,
- gStmLightstatusBrakeStateNoOn
+// Layout number
+enum StmLayoutNo {
+ StmLayoutNoNone = 0,
+ StmLayoutNoPopUp,
+ StmLayoutNoSysAlt,
+ StmLayoutNoMapNml,
+ StmLayoutNoMapSpl,
+ StmLayoutNoMapFll,
+ StmLayoutNoSplNml,
+ StmLayoutNoSplSpl,
+ StmLayoutNoGenNml,
+ StmLayoutNoHms,
+ StmLayoutNoRstNml,
+ StmLayoutNoRstSplMain,
+ StmLayoutNoRstSplSub,
+ StmLayoutNoSysNml,
+
+ StmLayoutNoNum,
+
+ StmLayoutNoMin = StmLayoutNoNone,
+ StmLayoutNoMax = StmLayoutNoNum - 1,
};
-enum stm_restriction_mode_state_ {
- gStmRestrictionModeStateNoOff = 0,
- gStmRestrictionModeStateNoOn
+// Car element number
+enum StmCarElementNo {
+ StmCarElementNoTransGear = 0,
+ StmCarElementNoParkingBrake,
+ StmCarElementNoAccelPedal,
+ StmCarElementNoRunning,
+ StmCarElementNoLamp,
+ StmCarElementNoLightstatusBrake,
+ StmCarElementNoRestrictionMode,
+
+ StmCarElementNoNum,
+
+ StmCarElementNoMin = StmCarElementNoTransGear,
+ StmCarElementNoMax = StmCarElementNoNum - 1,
};
-enum stm_layout_ {
- gStmLayoutNoNone = 0,
- gStmLayoutNoPopUp,
- gStmLayoutNoSysAlt,
- gStmLayoutNoMapNml,
- gStmLayoutNoMapSpl,
- gStmLayoutNoMapFll,
- gStmLayoutNoSplNml,
- gStmLayoutNoSplSpl,
- gStmLayoutNoGenNml,
- gStmLayoutNoHms,
- gStmLayoutNoRstNml,
- gStmLayoutNoRstSplMain,
- gStmLayoutNoRstSplSub,
- gStmLayoutNoSysNml,
-
- gStmLayoutNoNum,
-
- gStmLayoutNoMin = gStmLayoutNoNone,
- gStmLayoutNoMax = gStmLayoutNoNum - 1,
+// Enum for car element state
+enum StmTransGearStt {
+ StmTransGearSttNoN = 0,
+ StmTransGearSttNoNotN
};
-enum stm_layer_ {
- gStmLayerNoHomescreen = 0,
- gStmLayerNoApps,
- gStmLayerNoRestriction,
- gStmLayerNoOnScreen,
+enum StmParkingBrakeStt {
+ StmParkingBrakeSttNoOff = 0,
+ StmParkingBrakeSttNoOn
+};
- gStmLayerNoNum,
+enum StmAccelPedalStt {
+ StmAccelPedalSttNoOff = 0,
+ StmAccelPedalSttNoOn
+};
- gStmLayerNoMin = gStmLayerNoHomescreen,
- gStmLayerNoMax = gStmLayerNoNum - 1,
+enum StmCarStt {
+ StmRunningNoStop = 0,
+ StmRunningNoRun
};
-enum stm_car_element_ {
- gStmCarElementNoTransGear = 0,
- gStmCarElementNoParkingBrake,
- gStmCarElementNoAccelPedal,
- gStmCarElementNoRunning,
- gStmCarElementNoLamp,
- gStmCarElementNoLightstatusBrake,
- gStmCarElementNoRestrictionMode,
+enum StmLampStt {
+ StmLampSttNoOff = 0,
+ StmLampSttNoOn
+};
- gStmCarElementNoNum,
+enum StmLightstatusBrakeStt {
+ StmLightstatusBrakeSttNoOff = 0,
+ StmLightstatusBrakeSttNoOn
+};
- gStmCarElementNoMin = gStmCarElementNoTransGear,
- gStmCarElementNoMax = gStmCarElementNoNum - 1,
+enum StmRestrictionModeSttNo {
+ StmRestrictionModeSttNoOff = 0,
+ StmRestrictionModeSttNoOn
};
// String for state
-extern const char* gStmEventName[];
-extern const char* gStmCategoryName[];
-extern const char* gStmAreaName[];
-extern const char* gStmLayoutName[];
-extern const char* gStmLayerName[];
-extern const char* gStmCarElementName[];
-extern const char** gStmCarStateNameList[];
+extern const char* kStmEventName[];
+extern const char* kStmCategoryName[];
+extern const char* kStmAreaName[];
+extern const char* kStmLayoutName[];
+extern const char* kStmLayerName[];
+extern const char* kStmCarElementName[];
+extern const char** kStmCarStateNameList[];
// Struct for state
-typedef struct stm_base_state_ {
+typedef struct StmBaseState {
int changed;
int state;
-} stm_base_state;
+} StmBaseState;
typedef struct {
- stm_base_state car_element[gStmCarElementNoNum];
- stm_base_state layer[gStmLayerNoNum];
-} stm_state_t;
+ StmBaseState car_element[StmCarElementNoNum];
+ StmBaseState layer[StmLayerNoNum];
+} StmState;
+// API
void stmInitialize();
-int stmTransitionState(int event_no, stm_state_t* state);
+int stmTransitionState(int event_no, StmState* state);
void stmUndoState();
+
#endif // TMCAGLWM_DUMMY_STM_HPP