aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorYuta Doi <yuta-d@witz-inc.co.jp>2018-05-09 13:34:19 +0900
committerYuta Doi <yuta-d@witz-inc.co.jp>2018-05-09 13:34:19 +0900
commita660fd2bc4e232dd8bb61febd1eae1e26d674804 (patch)
tree36362f2462d4eb37d3b5eacf300896e4d3c1c5e1 /src
parenta98320a337645609da7060b20478969196cc2f4e (diff)
Add parking brake ON/OFF event
Change-Id: I3b9face35972a275918ac4f95f4a97df035ee924 Signed-off-by: Yuta Doi <yuta-d@witz-inc.co.jp>
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/app.cpp42
-rw-r--r--src/app.hpp7
-rw-r--r--src/low_can_client.cpp47
-rw-r--r--src/low_can_client.hpp7
-rw-r--r--src/main.cpp18
-rw-r--r--src/policy_manager/policy_manager.cpp135
-rw-r--r--src/policy_manager/policy_manager.hpp6
-rw-r--r--src/policy_manager/zipc/dummy_stm.c89
-rw-r--r--src/policy_manager/zipc/dummy_stm.h64
10 files changed, 268 insertions, 149 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 0ce8bb8..60c9394 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -66,7 +66,7 @@ target_link_libraries(${TARGETS_WM}
${AFB_LIBRARIES}
${WLC_LIBRARIES}
${SD_LIBRARIES}
- ${PLUGIN_PM}
+ ${PLUGIN_PM}
)
target_compile_definitions(${TARGETS_WM}
diff --git a/src/app.cpp b/src/app.cpp
index 20f5b56..afd690f 100644
--- a/src/app.cpp
+++ b/src/app.cpp
@@ -351,14 +351,40 @@ void App::allocateWindowResource(char const *event, char const *drawing_name,
// Release json_object
json_object_put(json_in);
- // Cat state
+ // Check parking brake state
+ json_object* json_parking_brake;
+ if (!json_object_object_get_ex(json_out, "parking_brake", &json_parking_brake)) {
+ reply("Not found key \"parking_brake\"");
+ return;
+ }
+
+ json_bool is_changed;
+ is_changed = jh::getBoolFromJson(json_parking_brake, "is_changed");
+ if (is_changed) {
+ // Update parking brake state
+ std::string parking_brake_state = jh::getStringFromJson(json_parking_brake, "state");
+ HMI_DEBUG("wm", "parking_brake_state: %s", parking_brake_state.c_str());
+
+ // Emit parking brake event
+ if ("parking_brake_off" == parking_brake_state) {
+ this->emitParkingBrakeOff();
+ }
+ else if ("parking_brake_on" == parking_brake_state) {
+ this->emitParkingBrakeOn();
+ }
+ else {
+ reply("Unknown parking brake state");
+ return;
+ }
+ }
+
+ // Check car state
json_object* json_car;
if (!json_object_object_get_ex(json_out, "car", &json_car)) {
reply("Not found key \"car\"");
return;
}
- json_bool is_changed;
is_changed = jh::getBoolFromJson(json_car, "is_changed");
if (is_changed) {
// Update car state
@@ -378,7 +404,7 @@ void App::allocateWindowResource(char const *event, char const *drawing_name,
}
}
- // Lamp state
+ // Check lamp state
json_object* json_lamp;
if (!json_object_object_get_ex(json_out, "lamp", &json_lamp)) {
reply("Not found key \"lamp\"");
@@ -587,6 +613,16 @@ void App::emitHeadlampOn() {
this->send_event(kListEventName[Event_HeadlampOn]);
}
+void App::emitParkingBrakeOff() {
+ // Send ParkingBrakeOff event for all application
+ this->send_event(kListEventName[Event_ParkingBrakeOff]);
+}
+
+void App::emitParkingBrakeOn() {
+ // Send ParkingBrakeOn event for all application
+ this->send_event(kListEventName[Event_ParkingBrakeOn]);
+}
+
void App::emitCarStop() {
// Send CarStop event for all application
this->send_event(kListEventName[Event_CarStop]);
diff --git a/src/app.hpp b/src/app.hpp
index 9ab1280..57ffee2 100644
--- a/src/app.hpp
+++ b/src/app.hpp
@@ -148,6 +148,9 @@ struct App {
Event_HeadlampOff,
Event_HeadlampOn,
+ Event_ParkingBrakeOff,
+ Event_ParkingBrakeOn,
+
Event_CarStop,
Event_CarRun,
@@ -163,6 +166,8 @@ struct App {
"flushdraw",
"headlamp_off",
"headlamp_on",
+ "parking_brake_off",
+ "parking_brake_on",
"car_stop",
"car_run",
};
@@ -269,6 +274,8 @@ private:
void emit_visible(char const *label);
void emitHeadlampOff();
void emitHeadlampOn();
+ void emitParkingBrakeOff();
+ void emitParkingBrakeOn();
void emitCarStop();
void emitCarRun();
diff --git a/src/low_can_client.cpp b/src/low_can_client.cpp
index 23a39e2..2db565c 100644
--- a/src/low_can_client.cpp
+++ b/src/low_can_client.cpp
@@ -29,7 +29,7 @@ namespace wm {
LowCanClient::LowCanClient() :
vehicle_speed_(0),
trans_gear_pos_(0),
- park_brake_status_(TRUE),
+ parking_brake_status_(TRUE),
headlamp_status_(FALSE),
prv_car_state_("car_stop"),
crr_car_state_("car_stop"),
@@ -102,10 +102,10 @@ void LowCanClient::analyzeCanSignal(struct json_object *object) {
else if (strstr(name, "parking_brake_status")) {
HMI_DEBUG("wm:lcc", "Receive parking brake status");
// Update parking gear status
- json_bool park_brake = jh::getBoolFromJson(object, "value");
- if (this->park_brake_status_ != park_brake) {
- this->park_brake_status_ = park_brake;
- HMI_DEBUG("wm:lcc", "Update parking brake status:%d", this->park_brake_status_);
+ json_bool parking_brake = jh::getBoolFromJson(object, "value");
+ if (this->parking_brake_status_ != parking_brake) {
+ this->parking_brake_status_ = parking_brake;
+ HMI_DEBUG("wm:lcc", "Update parking brake status:%d", this->parking_brake_status_);
}
}
else if (strstr(name, "headlamp_status")) {
@@ -118,8 +118,17 @@ void LowCanClient::analyzeCanSignal(struct json_object *object) {
}
}
+ // Update parking brake state
+ if (this->parking_brake_status_) {
+ this->crr_parking_brake_state_ = "parking_brake_on";
+ }
+ else {
+ this->crr_parking_brake_state_ = "parking_brake_off";
+ }
+ HMI_DEBUG("wm:lcc", "Current parking brake state:%s", this->crr_parking_brake_state_.c_str());
+
// Update car state
- if ((0 == this->vehicle_speed_) || (true == this->park_brake_status_)) {
+ if ((0 == this->vehicle_speed_) || (true == this->parking_brake_status_)) {
this->crr_car_state_ = "car_stop";
}
else {
@@ -136,6 +145,15 @@ void LowCanClient::analyzeCanSignal(struct json_object *object) {
}
HMI_DEBUG("wm:lcc", "Current lamp state:%s", this->crr_lamp_state_.c_str());
+ // If parking brake state is changed,
+ // backup current state for previous state and set flag
+ if (this->prv_parking_brake_state_ != this->crr_parking_brake_state_) {
+ HMI_DEBUG("wm:lcc", "Parking Brake state is changed: %s -> %s",
+ this->prv_parking_brake_state_.c_str(), this->crr_parking_brake_state_.c_str());
+ this->prv_parking_brake_state_ = this->crr_parking_brake_state_;
+ this->is_changed_parking_brake_state_ = true;
+ }
+
// If car state is changed,
// backup current state for previous state and set flag
if (this->prv_car_state_ != this->crr_car_state_) {
@@ -155,6 +173,13 @@ void LowCanClient::analyzeCanSignal(struct json_object *object) {
}
}
+bool LowCanClient::isChangedParkingBrakeState() {
+ HMI_DEBUG("wm:lcc", "Call");
+
+ // Return changed flag
+ return this->is_changed_parking_brake_state_;
+}
+
bool LowCanClient::isChangedCarState() {
HMI_DEBUG("wm:lcc", "Call");
@@ -169,6 +194,16 @@ bool LowCanClient::isChangedLampState() {
return this->is_changed_lamp_state_;
}
+const char* LowCanClient::getCurrentParkingBrakeState() {
+ HMI_DEBUG("wm:lcc", "Call");
+
+ // Clear changed flag
+ this->is_changed_parking_brake_state_ = false;
+
+ // Return current parking brake state
+ return this->crr_parking_brake_state_.c_str();
+}
+
const char* LowCanClient::getCurrentCarState() {
HMI_DEBUG("wm:lcc", "Call");
diff --git a/src/low_can_client.hpp b/src/low_can_client.hpp
index 5119c23..ea441be 100644
--- a/src/low_can_client.hpp
+++ b/src/low_can_client.hpp
@@ -32,8 +32,10 @@ public:
void initialize();
void analyzeCanSignal(struct json_object *object);
+ bool isChangedParkingBrakeState();
bool isChangedCarState();
bool isChangedLampState();
+ const char* getCurrentParkingBrakeState();
const char* getCurrentCarState();
const char* getCurrentLampState();
@@ -54,14 +56,17 @@ private:
int vehicle_speed_;
int trans_gear_pos_;
- json_bool park_brake_status_;
+ json_bool parking_brake_status_;
json_bool headlamp_status_;
+ std::string prv_parking_brake_state_;
+ std::string crr_parking_brake_state_;
std::string prv_car_state_;
std::string crr_car_state_;
std::string prv_lamp_state_;
std::string crr_lamp_state_;
+ bool is_changed_parking_brake_state_;
bool is_changed_car_state_;
bool is_changed_lamp_state_;
};
diff --git a/src/main.cpp b/src/main.cpp
index 067a006..7abdfb0 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -667,7 +667,23 @@ void on_event(const char *event, struct json_object *object){
// Analyze low can signal
g_afb_instance->lcc_.analyzeCanSignal(object);
- if (g_afb_instance->lcc_.isChangedCarState()) {
+ if (g_afb_instance->lcc_.isChangedParkingBrakeState()) {
+ // If parking brake state is changed
+ HMI_DEBUG("wm", "Parking Brake state is changed");
+
+ // Get parking brake state
+ const char* parking_brake_state = g_afb_instance->lcc_.getCurrentParkingBrakeState();
+
+ // Allocate window resource
+ g_afb_instance->app.allocateWindowResource(parking_brake_state, nullptr,
+ nullptr, nullptr,
+ [](const char* errmsg){
+ if (errmsg != nullptr) {
+ HMI_ERROR("wm", errmsg);
+ }
+ });
+ }
+ else if (g_afb_instance->lcc_.isChangedCarState()) {
// If car state is changed
HMI_DEBUG("wm", "Car state is changed");
diff --git a/src/policy_manager/policy_manager.cpp b/src/policy_manager/policy_manager.cpp
index 61d1d7c..47d9eac 100644
--- a/src/policy_manager/policy_manager.cpp
+++ b/src/policy_manager/policy_manager.cpp
@@ -20,92 +20,14 @@
#include <istream>
#include <json-c/json.h>
#include "policy_manager.hpp"
+#if 0
+extern "C" {
#include "dummy_stm.h"
+}
+#endif
#include "hmi-debug.h"
-namespace {
-
-static const char* kEventName[] = {
- "activate",
- "deactivate",
- "car_stop",
- "car_run",
- "timer_expired",
- "lamp_off",
- "lamp_on"
-};
-
-static const int kEventNo[] = {
- STM_EVT_NO_ACTIVATE,
- STM_EVT_NO_DEACTIVATE,
- STM_EVT_NO_CAR_STOP,
- STM_EVT_NO_CAR_RUN,
- STM_EVT_NO_TIMER_EXPIRED,
- STM_EVT_NO_LAMP_OFF,
- STM_EVT_NO_LAMP_ON
-};
-
-static const char* kCategoryName[] = {
- "homescreen",
- "map",
- "general",
- "splitable",
- "popup",
- "system_alert"
-};
-
-static const int kCategoryNo[] = {
- 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
-};
-
-static const char* kAreaName[] = {
- "full",
- "normal",
- "split.main",
- "split.sub",
- "onscreen"
-};
-
-static const int kAreaNo[] = {
- STM_ARA_NO_FULL,
- STM_ARA_NO_NORMAL,
- STM_ARA_NO_SPLIT_MAIN,
- STM_ARA_NO_SPLIT_SUB,
- STM_ARA_NO_ON_SCREEN
-};
-
-// String for state
-const char* gStmCarStateNo2Name[] = {
- "car_stop",
- "car_run"
-};
-
-const char* gStmLampStateNo2Name[] = {
- "lamp_off",
- "lamp_on"
-};
-
-const char* gStmLayoutNo2Name[] = {
- "none",
- "pu",
- "sa",
- "m1",
- "m2",
- "mf",
- "s1",
- "s2",
- "g",
- "hs",
-};
-
-} // namespace
-
PolicyManager::PolicyManager() :
eventname2no_(),
categoryname2no_(),
@@ -124,19 +46,19 @@ int PolicyManager::initialize() {
int ret = 0;
// Create convert map
- for (unsigned int i=0; i<(sizeof(kEventNo)/sizeof(int)); i++) {
- HMI_DEBUG("wm:pm", "event name:%s no:%d", kEventName[i], kEventNo[i]);
- this->eventname2no_[kEventName[i]] = kEventNo[i];
+ for (unsigned int i=0; i<STM_NUM_EVT; i++) {
+ HMI_DEBUG("wm:pm", "event name:%s no:%d", stm::gStmEventName[i], stm::gStmEventNo[i]);
+ this->eventname2no_[stm::gStmEventName[i]] = stm::gStmEventNo[i];
}
- for (unsigned int i=0; i<(sizeof(kCategoryNo)/sizeof(int)); i++) {
- HMI_DEBUG("wm:pm", "category name:%s no:%d", kCategoryName[i], kCategoryNo[i]);
- this->categoryname2no_[kCategoryName[i]] = kCategoryNo[i];
+ for (unsigned int i=0; i<STM_NUM_CTG; i++) {
+ HMI_DEBUG("wm:pm", "category name:%s no:%d", stm::gStmCategoryName[i], stm::gStmCategoryNo[i]);
+ this->categoryname2no_[stm::gStmCategoryName[i]] = stm::gStmCategoryNo[i];
}
- for (unsigned int i=0; i<(sizeof(kAreaNo)/sizeof(int)); i++) {
- HMI_DEBUG("wm:pm", "area name:%s no:%d", kAreaName[i], kAreaNo[i]);
- this->areaname2no_[kAreaName[i]] = kAreaNo[i];
+ for (unsigned int i=0; i<STM_NUM_ARA; i++) {
+ HMI_DEBUG("wm:pm", "area name:%s no:%d", stm::gStmAreaName[i], stm::gStmAreaNo[i]);
+ this->areaname2no_[stm::gStmAreaName[i]] = stm::gStmAreaNo[i];
}
// Load role.db
@@ -210,30 +132,43 @@ int PolicyManager::checkPolicy(json_object* json_in, json_object** json_out) {
// Create result
// {
+ // "parking_brake": {
+ // "is_changed": <bool>,
+ // "state": <const char*>
+ // },
+ HMI_DEBUG("wm", "parking brake state (is_changed:%d state:%d:%s)",
+ this->current_state_.parking_brake.is_changed,
+ this->current_state_.parking_brake.state,
+ stm::gStmCarStateNo2Name[this->current_state_.parking_brake.state]);
+ this->addStateToJson("parking_brake",
+ this->current_state_.parking_brake.is_changed,
+ stm::gStmParkingBrakeStateNo2Name[this->current_state_.parking_brake.state],
+ json_out);
+
// "car": {
// "is_changed": <bool>,
// "state": <const char*>
// },
- HMI_DEBUG("wm", "@@@@@ car state (is_changed:%d state:%d:%s)",
+ HMI_DEBUG("wm", "car state (is_changed:%d state:%d:%s)",
this->current_state_.car.is_changed,
this->current_state_.car.state,
- gStmCarStateNo2Name[this->current_state_.car.state]);
+ stm::gStmCarStateNo2Name[this->current_state_.car.state]);
this->addStateToJson("car",
this->current_state_.car.is_changed,
- gStmCarStateNo2Name[this->current_state_.car.state],
+ stm::gStmCarStateNo2Name[this->current_state_.car.state],
json_out);
// "lamp": {
// "is_changed": <bool>,
// "state": <const char*>
// },
- HMI_DEBUG("wm", "@@@@@ lamp state (is_changed:%d state:%d:%s)",
+ HMI_DEBUG("wm", "lamp state (is_changed:%d state:%d:%s)",
this->current_state_.lamp.is_changed,
this->current_state_.lamp.state,
- gStmLampStateNo2Name[this->current_state_.lamp.state]);
+ stm::gStmLampStateNo2Name[this->current_state_.lamp.state]);
this->addStateToJson("lamp",
this->current_state_.lamp.is_changed,
- gStmLampStateNo2Name[this->current_state_.lamp.state],
+ stm::gStmLampStateNo2Name[this->current_state_.lamp.state],
json_out);
// "layers": [
@@ -247,7 +182,7 @@ int PolicyManager::checkPolicy(json_object* json_in, json_object** json_out) {
json_object* json_tmp = json_object_new_object();
this->addStateToJson("on_screen",
this->current_state_.layer.on_screen.is_changed,
- gStmLayoutNo2Name[this->current_state_.layer.on_screen.state],
+ stm::gStmLayoutNo2Name[this->current_state_.layer.on_screen.state],
&json_tmp);
json_object_array_add(json_layer, json_tmp);
@@ -260,7 +195,7 @@ int PolicyManager::checkPolicy(json_object* json_in, json_object** json_out) {
json_tmp = json_object_new_object();
this->addStateToJson("apps",
this->current_state_.layer.apps.is_changed,
- gStmLayoutNo2Name[this->current_state_.layer.apps.state],
+ stm::gStmLayoutNo2Name[this->current_state_.layer.apps.state],
&json_tmp);
json_object_array_add(json_layer, json_tmp);
@@ -275,7 +210,7 @@ int PolicyManager::checkPolicy(json_object* json_in, json_object** json_out) {
json_tmp = json_object_new_object();
this->addStateToJson("homescreen",
this->current_state_.layer.homescreen.is_changed,
- gStmLayoutNo2Name[this->current_state_.layer.homescreen.state],
+ stm::gStmLayoutNo2Name[this->current_state_.layer.homescreen.state],
&json_tmp);
json_object_array_add(json_layer, json_tmp);
diff --git a/src/policy_manager/policy_manager.hpp b/src/policy_manager/policy_manager.hpp
index 500120c..e3ee621 100644
--- a/src/policy_manager/policy_manager.hpp
+++ b/src/policy_manager/policy_manager.hpp
@@ -21,11 +21,11 @@
#include <unordered_map>
#include <vector>
-//namespace stm {
+namespace stm {
extern "C" {
#include "dummy_stm.h"
}
-//} // namespace stm
+} // namespace stm
class PolicyManager {
@@ -52,7 +52,7 @@ private:
std::unordered_map<std::string, std::string> category2role_;
std::unordered_map<std::string, std::string> role2defaultarea_;
- stm_state_t current_state_;
+ stm::stm_state_t current_state_;
// Load role.db
int loadRoleDb();
diff --git a/src/policy_manager/zipc/dummy_stm.c b/src/policy_manager/zipc/dummy_stm.c
index 3c9cba2..78e25d7 100644
--- a/src/policy_manager/zipc/dummy_stm.c
+++ b/src/policy_manager/zipc/dummy_stm.c
@@ -1,7 +1,93 @@
-
#include <string.h>
#include "dummy_stm.h"
+const char* gStmEventName[] = {
+ "activate",
+ "deactivate",
+ "parking_brake_off",
+ "parking_brake_on",
+ "car_stop",
+ "car_run",
+ "timer_expired",
+ "lamp_off",
+ "lamp_on"
+};
+
+const int gStmEventNo[] = {
+ STM_EVT_NO_ACTIVATE,
+ STM_EVT_NO_DEACTIVATE,
+ STM_EVT_NO_PARKING_BRAKE_OFF,
+ STM_EVT_NO_PARKING_BRAKE_ON,
+ STM_EVT_NO_CAR_STOP,
+ STM_EVT_NO_CAR_RUN,
+ STM_EVT_NO_TIMER_EXPIRED,
+ STM_EVT_NO_LAMP_OFF,
+ STM_EVT_NO_LAMP_ON
+};
+
+const char* gStmCategoryName[] = {
+ "homescreen",
+ "map",
+ "general",
+ "splitable",
+ "popup",
+ "system_alert"
+};
+
+const int gStmCategoryNo[] = {
+ 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
+};
+
+const char* gStmAreaName[] = {
+ "full",
+ "normal",
+ "split.main",
+ "split.sub",
+ "onscreen"
+};
+
+const int gStmAreaNo[] = {
+ STM_ARA_NO_FULL,
+ STM_ARA_NO_NORMAL,
+ STM_ARA_NO_SPLIT_MAIN,
+ STM_ARA_NO_SPLIT_SUB,
+ STM_ARA_NO_ON_SCREEN
+};
+
+// String for state
+const char* gStmParkingBrakeStateNo2Name[] = {
+ "parking_brake_off",
+ "parking_brake_on"
+};
+
+const char* gStmCarStateNo2Name[] = {
+ "car_stop",
+ "car_run"
+};
+
+const char* gStmLampStateNo2Name[] = {
+ "lamp_off",
+ "lamp_on"
+};
+
+const char* gStmLayoutNo2Name[] = {
+ "none",
+ "pu",
+ "sa",
+ "m1",
+ "m2",
+ "mf",
+ "s1",
+ "s2",
+ "g",
+ "hs",
+};
+
stm_state_t g_crr_state = {0};
stm_state_t g_prv_state = {0};
int g_prv_apps_state_car_stop = 0;
@@ -209,4 +295,3 @@ int stmTransitionState(int event, stm_state_t* state) {
return 0;
}
-
diff --git a/src/policy_manager/zipc/dummy_stm.h b/src/policy_manager/zipc/dummy_stm.h
index 18af99b..ae438db 100644
--- a/src/policy_manager/zipc/dummy_stm.h
+++ b/src/policy_manager/zipc/dummy_stm.h
@@ -24,13 +24,15 @@
#define STM_FALSE 0
// Event number
-#define STM_EVT_NO_ACTIVATE 0x01
-#define STM_EVT_NO_DEACTIVATE 0x02
-#define STM_EVT_NO_CAR_STOP 0x03
-#define STM_EVT_NO_CAR_RUN 0x04
-#define STM_EVT_NO_TIMER_EXPIRED 0x05
-#define STM_EVT_NO_LAMP_OFF 0x06
-#define STM_EVT_NO_LAMP_ON 0x07
+#define STM_EVT_NO_ACTIVATE 0x01
+#define STM_EVT_NO_DEACTIVATE 0x02
+#define STM_EVT_NO_PARKING_BRAKE_OFF 0x03
+#define STM_EVT_NO_PARKING_BRAKE_ON 0x04
+#define STM_EVT_NO_CAR_STOP 0x05
+#define STM_EVT_NO_CAR_RUN 0x06
+#define STM_EVT_NO_TIMER_EXPIRED 0x07
+#define STM_EVT_NO_LAMP_OFF 0x08
+#define STM_EVT_NO_LAMP_ON 0x09
// Category number
#define STM_CTG_NO_HOMESCREEN 0x0100
@@ -52,7 +54,17 @@
#define STM_MSK_CTG_NO 0x00FF00
#define STM_MSK_ARA_NO 0xFF0000
+// Number of events, categories and areas
+#define STM_NUM_EVT 9
+#define STM_NUM_CTG 6
+#define STM_NUM_ARA 5
+
// Enum for state
+enum stm_parking_brake_state_ {
+ gStmParkingBrakeStateNoOff = 0,
+ gStmParkingBrakeStateNoOn
+};
+
enum stm_car_state_ {
gStmCarStateNoStop = 0,
gStmCarStateNoRun
@@ -77,32 +89,20 @@ enum stm_layout_ {
};
-#if 0
-// String for state
-const char* gStmCarStateNo2Name[] {
- "car_stop",
- "car_run"
-};
+extern const char* gStmEventName[];
+extern const int gStmEventNo[];
+extern const char* gStmCategoryName[];
+extern const int gStmCategoryNo[];
+extern const char* gStmAreaName[];
+extern const int gStmAreaNo[];
-const char* gStmLampStateNo2Name[] {
- "lamp_off",
- "lamp_on"
-};
-
-const char* gStmLayoutNo2Name[] {
- "none",
- "pu",
- "sa",
- "m1",
- "m2",
- "mf",
- "s1",
- "s2",
- "g",
- "hs",
-};
-#endif
+// String for state
+extern const char* gStmParkingBrakeStateNo2Name[];
+extern const char* gStmCarStateNo2Name[];
+extern const char* gStmLampStateNo2Name[];
+extern const char* gStmLayoutNo2Name[];
+// Struct for state
typedef struct stm_base_state_ {
int is_changed;
int state;
@@ -114,8 +114,8 @@ typedef struct stm_layer_state_ {
stm_base_state homescreen;
} stm_layer_state;
-// Struct for state
typedef struct {
+ stm_base_state parking_brake;
stm_base_state car;
stm_base_state lamp;
stm_layer_state layer;