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.cpp5
-rw-r--r--src/policy_manager/zipc/dummy_stm.c4
-rw-r--r--src/policy_manager/zipc/dummy_stm.h94
3 files changed, 72 insertions, 31 deletions
diff --git a/src/policy_manager/policy_manager.cpp b/src/policy_manager/policy_manager.cpp
index cc7cd75..1bc97b5 100644
--- a/src/policy_manager/policy_manager.cpp
+++ b/src/policy_manager/policy_manager.cpp
@@ -89,7 +89,7 @@ int PolicyManager::initialize() {
int ret = 0;
// Create convert map
- for (unsigned int i=0; i<STM_NUM_EVT; i++) {
+ for (int i = stm::gStmEventNoMin; i <= stm::gStmEventNoMax; i++) {
HMI_DEBUG("wm:pm", "event name:%s no:%d", stm::gStmEventName[i], stm::gStmEventNo[i]);
this->eventname2no_[stm::gStmEventName[i]] = stm::gStmEventNo[i];
}
@@ -99,7 +99,7 @@ int PolicyManager::initialize() {
this->categoryname2no_[stm::gStmCategoryName[i]] = stm::gStmCategoryNo[i];
}
- for (unsigned int i=0; i<STM_NUM_ARA; i++) {
+ for (int i = stm::gStmAreaNoMin; i <= stm::gStmAreaNoMax; i++) {
HMI_DEBUG("wm:pm", "area name:%s no:%d", stm::gStmAreaName[i], stm::gStmAreaNo[i]);
this->areaname2no_[stm::gStmAreaName[i]] = stm::gStmAreaNo[i];
}
@@ -203,7 +203,6 @@ static void addStateToJson(const char* layer_name, unsigned int changed,
json_object_object_add(*json_out, "areas", json_areas);
}
-
static int checkPolicyEntry(int event, uint64_t delay_ms, std::string role);
static int checkPolicy(sd_event_source *source, void *data) {
HMI_DEBUG("wm:pm", "Call");
diff --git a/src/policy_manager/zipc/dummy_stm.c b/src/policy_manager/zipc/dummy_stm.c
index 3596de9..50b4586 100644
--- a/src/policy_manager/zipc/dummy_stm.c
+++ b/src/policy_manager/zipc/dummy_stm.c
@@ -3,6 +3,7 @@
#include "hmi-debug.h"
const char* gStmEventName[] = {
+ "none",
"activate",
"deactivate",
"trans_gear_neutral",
@@ -21,6 +22,7 @@ const char* gStmEventName[] = {
};
const int gStmEventNo[] = {
+ STM_EVT_NO_NONE,
STM_EVT_NO_ACTIVATE,
STM_EVT_NO_DEACTIVATE,
STM_EVT_NO_TRANS_GEAR_N,
@@ -63,6 +65,7 @@ const int gStmCategoryNo[] = {
};
const char* gStmAreaName[] = {
+ "none",
"fullscreen",
"normal",
"split.main",
@@ -74,6 +77,7 @@ const char* gStmAreaName[] = {
};
const int gStmAreaNo[] = {
+ STM_ARA_NO_NONE,
STM_ARA_NO_FULL,
STM_ARA_NO_NORMAL,
STM_ARA_NO_SPLIT_MAIN,
diff --git a/src/policy_manager/zipc/dummy_stm.h b/src/policy_manager/zipc/dummy_stm.h
index cf29bbd..73feed9 100644
--- a/src/policy_manager/zipc/dummy_stm.h
+++ b/src/policy_manager/zipc/dummy_stm.h
@@ -24,21 +24,22 @@
#define STM_FALSE 0
// Event number
-#define STM_EVT_NO_ACTIVATE 0x01
-#define STM_EVT_NO_DEACTIVATE 0x02
-#define STM_EVT_NO_TRANS_GEAR_N 0x03
-#define STM_EVT_NO_TRANS_GEAR_NOT_N 0x04
-#define STM_EVT_NO_PARKING_BRAKE_OFF 0x05
-#define STM_EVT_NO_PARKING_BRAKE_ON 0x06
-#define STM_EVT_NO_ACCEL_PEDAL_OFF 0x07
-#define STM_EVT_NO_ACCEL_PEDAL_ON 0x08
-#define STM_EVT_NO_TIMER_EXPIRED 0x09
-#define STM_EVT_NO_LAMP_OFF 0x0A
-#define STM_EVT_NO_LAMP_ON 0x0B
-#define STM_EVT_NO_LIGHTSTATUS_BRAKE_OFF 0x0C
-#define STM_EVT_NO_LIGHTSTATUS_BRAKE_ON 0x0D
-#define STM_EVT_NO_RESTRICTION_MODE_OFF 0x0E
-#define STM_EVT_NO_RESTRICTION_MODE_ON 0x0F
+#define STM_EVT_NO_NONE 0x01
+#define STM_EVT_NO_ACTIVATE 0x02
+#define STM_EVT_NO_DEACTIVATE 0x03
+#define STM_EVT_NO_TRANS_GEAR_N 0x04
+#define STM_EVT_NO_TRANS_GEAR_NOT_N 0x05
+#define STM_EVT_NO_PARKING_BRAKE_OFF 0x06
+#define STM_EVT_NO_PARKING_BRAKE_ON 0x07
+#define STM_EVT_NO_ACCEL_PEDAL_OFF 0x08
+#define STM_EVT_NO_ACCEL_PEDAL_ON 0x09
+#define STM_EVT_NO_TIMER_EXPIRED 0x0A
+#define STM_EVT_NO_LAMP_OFF 0x0B
+#define STM_EVT_NO_LAMP_ON 0x0C
+#define STM_EVT_NO_LIGHTSTATUS_BRAKE_OFF 0x0D
+#define STM_EVT_NO_LIGHTSTATUS_BRAKE_ON 0x0E
+#define STM_EVT_NO_RESTRICTION_MODE_OFF 0x0F
+#define STM_EVT_NO_RESTRICTION_MODE_ON 0x10
// Category number
#define STM_CTG_NO_NONE 0x0100
@@ -52,25 +53,21 @@
#define STM_CTG_NO_SYSTEM 0x0900
// Area number
-#define STM_ARA_NO_FULL 0x010000
-#define STM_ARA_NO_NORMAL 0x020000
-#define STM_ARA_NO_SPLIT_MAIN 0x030000
-#define STM_ARA_NO_SPLIT_SUB 0x040000
-#define STM_ARA_NO_ON_SCREEN 0x050000
-#define STM_ARA_NO_RESTRICTION_NORMAL 0x060000
-#define STM_ARA_NO_RESTRICTION_SPLIT_MAIN 0x070000
-#define STM_ARA_NO_RESTRICTION_SPLIT_SUB 0x080000
+#define STM_ARA_NO_NONE 0x010000
+#define STM_ARA_NO_FULL 0x020000
+#define STM_ARA_NO_NORMAL 0x030000
+#define STM_ARA_NO_SPLIT_MAIN 0x040000
+#define STM_ARA_NO_SPLIT_SUB 0x050000
+#define STM_ARA_NO_ON_SCREEN 0x060000
+#define STM_ARA_NO_RESTRICTION_NORMAL 0x070000
+#define STM_ARA_NO_RESTRICTION_SPLIT_MAIN 0x080000
+#define STM_ARA_NO_RESTRICTION_SPLIT_SUB 0x090000
// Mask
#define STM_MSK_EVT_NO 0x0000FF
#define STM_MSK_CTG_NO 0x00FF00
#define STM_MSK_ARA_NO 0xFF0000
-// Number of events, categories and areas
-#define STM_NUM_EVT 15
-//#define STM_NUM_CTG 9
-#define STM_NUM_ARA 8
-
// Enum for state
enum stm_trans_gear_state_ {
gStmTransGearStateNoN = 0,
@@ -124,6 +121,30 @@ enum stm_layout_ {
gStmLayoutNoSystem,
};
+enum stm_event_ {
+ gStmEventNoNone = 0,
+ gStmEventNoActive,
+ gStmEventNoDeactive,
+ gStmEventNoTransGearN,
+ gStmEventNoTransGearNotN,
+ gStmEventNoParkingBrakeOff,
+ gStmEventNoParkingBrakeOn,
+ gStmEventNoAccelPedalOff,
+ gStmEventNoAccelPedalOn,
+ gStmEventNoTimerExpired,
+ gStmEventNoLampOff,
+ gStmEventNoLampOn,
+ gStmEventNoLightstatusBrakeOff,
+ gStmEventNoLightstatusBrakeOn,
+ gStmEventNoRestrictionModeOff,
+ gStmEventNoRestrictionModeOn,
+
+ gStmEventNoNum,
+
+ gStmEventNoMin = gStmEventNoNone,
+ gStmEventNoMax = gStmEventNoNum - 1,
+};
+
enum stm_category_ {
gStmCategoryNoNone = 0,
gStmCategoryNoHomescreen,
@@ -140,6 +161,23 @@ enum stm_category_ {
gStmCategoryNoMax = gStmCategoryNoNum - 1,
};
+enum stm_area_ {
+ gStmAreaNoNone = 0,
+ gStmAreaNoFullscreen,
+ gStmAreaNoNormal,
+ gStmAreaNoSplitMain,
+ gStmAreaNoSplitSub,
+ gStmAreaNoOnScreen,
+ gStmAreaNoRestrictionNormal,
+ gStmAreaNoRestrictionSplitMain,
+ gStmAreaNoRestrictionSplitSub,
+
+ gStmAreaNoNum,
+
+ gStmAreaNoMin = gStmAreaNoNone,
+ gStmAreaNoMax = gStmAreaNoNum - 1,
+};
+
enum stm_layer_ {
gStmLayerNoNone = 0,
gStmLayerNoHomescreen,