diff options
author | 2019-06-03 17:59:13 +0900 | |
---|---|---|
committer | 2019-06-03 17:59:13 +0900 | |
commit | 98006b6538c5be44350746ec3756f004a5c68af8 (patch) | |
tree | f76ed8991d3837678c00722a23b779c4e2dcb67b /policy_manager/policy_manager.hpp | |
parent | b6644e5cffa84e40d62e38f4ee0c14e64e0faf48 (diff) |
Add boot sequence and multi ecu transfer
Signed-off-by: fukubayashi.akio <fukubayashi.akio@genetec.co.jp>
Diffstat (limited to 'policy_manager/policy_manager.hpp')
-rw-r--r-- | policy_manager/policy_manager.hpp | 47 |
1 files changed, 37 insertions, 10 deletions
diff --git a/policy_manager/policy_manager.hpp b/policy_manager/policy_manager.hpp index 798b706..f3ec0f9 100644 --- a/policy_manager/policy_manager.hpp +++ b/policy_manager/policy_manager.hpp @@ -31,7 +31,7 @@ class PolicyManager { public: explicit PolicyManager(); - ~PolicyManager() = default; + ~PolicyManager(); using Handler = std::function<void(json_object *)>; @@ -41,7 +41,7 @@ class PolicyManager Handler onError; } CallbackTable; - int initialize(); + int initialize(std::string ecu_name); void registerCallback(CallbackTable callback_table); int setInputEventData(json_object *json_in); int executeStateTransition(); @@ -87,10 +87,19 @@ class PolicyManager bool changed; } LayerState; + typedef struct Mode + { + std::string state; + bool changed; + } Mode; + typedef std::vector<std::string> Areas; typedef std::vector<std::string> Categories; typedef std::vector<std::string> Roles; + StmState *p_crr_state; + StmState *p_prv_state; + // Convert map std::unordered_map<std::string, int> eventname2no; std::unordered_map<std::string, int> categoryname2no; @@ -107,27 +116,45 @@ class PolicyManager CallbackTable callback; + std::unordered_map<std::string, Mode> prv_car_elements; + std::unordered_map<std::string, Mode> crr_car_elements; + std::unordered_map<std::string, LayerState> prv_layers; std::unordered_map<std::string, LayerState> crr_layers; + std::unordered_map<std::string, LayerState> prv_layers_car_stop; + std::unordered_map<std::string, LayoutState> default_layouts; - std::map<std::string, Roles> invisible_role_history; + std::map<std::string, Roles> crr_invisible_role_history; + std::map<std::string, Roles> prv_invisible_role_history; + + std::string ecu_name; void initializeState(); + void initializeModeState(); void initializeLayerState(); - void updateState(int event_id, StmState crr_state); - void updateLayer(int event_id, StmState crr_state); + void updateState(int event_id); + void updateModeState(); + void updateLayer(int event_id); int updateLayout(int event_id, int layer_no, std::string crr_layout_name, LayoutState &crr_layout_state); - void createOutputInformation(StmState crr_state, json_object **json_out); + void createOutputInformation(json_object **json_out); + void controlTimerEvent(); int setStateTransitionProcessToSystemd(int event, uint64_t delay_ms, std::string role); void pushInvisibleRoleHistory(std::string category, std::string role); std::string popInvisibleRoleHistory(std::string category); - int loadRoleDb(); - int loadStateDb(); + bool changedRestrictionModeTo2On(); + bool changedRestrictionMode2OnToOther(); + // bool changedLightstatusBrakeOffToOn(); + // bool changedLightstatusBrakeOnToOff(); + bool changedAccelPedalOffToOn(); + bool changedAccelPedalOnToOff(); + + int loadRolesConfigFile(); + int loadLayoutsConfigFile(); void dumpLayerState(std::unordered_map<std::string, LayerState> &layers); void dumpInvisibleRoleHistory(); @@ -142,8 +169,8 @@ class PolicyManager std::vector<std::string> parseString(std::string str, char delimiter); std::string deleteSpace(std::string str); - static const char *kDefaultRoleDb; - static const char *kDefaultStateDb; + static const char *kDefaultRolesConfig; + static const char *kDefaultLayoutsConfig; }; #endif // TMCAGLWM_POLICY_MANAGER_HPP |