diff options
author | Yuta Doi <yuta-d@witz-inc.co.jp> | 2018-06-22 10:56:03 +0900 |
---|---|---|
committer | Yuta Doi <yuta-d@witz-inc.co.jp> | 2018-06-22 10:56:03 +0900 |
commit | 66eb61a44a67a31e1710cb28453404bfb800ca6a (patch) | |
tree | b7298860b2a7cb78f9beec7777d7ad3224effbb8 /src/policy_manager/policy_manager.cpp | |
parent | 6410fc2399e567541bbe9ee9ef3861af5eb45d84 (diff) |
Modify data type of changed flag
Change-Id: I43f260e7c854a6b5be78f860d55b813937af975f
Signed-off-by: Yuta Doi <yuta-d@witz-inc.co.jp>
Diffstat (limited to 'src/policy_manager/policy_manager.cpp')
-rw-r--r-- | src/policy_manager/policy_manager.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/policy_manager/policy_manager.cpp b/src/policy_manager/policy_manager.cpp index 390aa51..b709843 100644 --- a/src/policy_manager/policy_manager.cpp +++ b/src/policy_manager/policy_manager.cpp @@ -50,12 +50,12 @@ typedef struct LayoutState { typedef struct LayerState { std::string name; LayoutState layout_state; - int changed; + bool changed; } LayerState; typedef struct CarElement { std::string state; - int changed; + bool changed; } CarElement; struct sd_event* event_loop; @@ -140,7 +140,7 @@ int PolicyManager::initialize() { static void initializeLocalCarElementState() { pm::CarElement init_car_ele; init_car_ele.state = "none"; - init_car_ele.changed = 0; + init_car_ele.changed = false; for (int i = stm::gStmCarElementNoMin; i <= stm::gStmCarElementNoMax; i++) { const char* car_ele_name = stm::gStmCarElementName[i]; @@ -163,7 +163,7 @@ static void initializeLocalLayerState() { const char* layer_name = stm::gStmLayerName[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 = 0; + pm::g_crr_layers[layer_name].changed = false; } pm::g_prv_layers = pm::g_crr_layers; @@ -194,8 +194,8 @@ int PolicyManager::initializeSdEventLoop() { } static void addStateToJson( - const char* name, int changed, std::string state, json_object** json_out) { - if ((nullptr == name) || (1 < changed) || (nullptr == json_out)) { + const char* name, bool changed, std::string state, json_object** json_out) { + if ((nullptr == name) || (nullptr == json_out)) { HMI_ERROR("wm:pm", "Invalid argument!!!"); return; } @@ -205,9 +205,9 @@ static void addStateToJson( json_object_object_add(*json_out, "changed", json_object_new_boolean(changed)); } -static void addStateToJson(const char* layer_name, unsigned int changed, +static void addStateToJson(const char* layer_name, bool changed, pm::AreaList area_list, json_object** json_out) { - if ((nullptr == layer_name) || (1 < changed) || (nullptr == json_out)) { + if ((nullptr == layer_name) || (nullptr == json_out)) { HMI_ERROR("wm:pm", "Invalid argument!!!"); return; } @@ -242,14 +242,14 @@ static void updateLocalCarElementState(stm::stm_state_t crr_state) { car_state_no = crr_state.car_element[car_ele_no].state; car_state = stm::gStmCarStateNameList[car_ele_no][car_state_no]; - changed = crr_state.car_element[car_ele_no].changed; + changed = (crr_state.car_element[car_ele_no].changed) ? true : false; pm::g_crr_car_elements[car_ele_name].state = car_state; pm::g_crr_car_elements[car_ele_name].changed = changed; HMI_DEBUG("wm:pm", ">>> >>> NAME: %s", car_ele_name); HMI_DEBUG("wm:pm", ">>> >>> >>> STATE:%s", car_state.c_str()); - HMI_DEBUG("wm:pm", ">>> >>> >>> CHANGED:%d", changed); + HMI_DEBUG("wm:pm", ">>> >>> >>> CHANGED:%s", (changed) ? "true" : "false"); } } @@ -470,7 +470,7 @@ static void updateLocalLayerState(int event_data, stm::stm_state_t crr_state) { pm::g_crr_layers[layer_name].layout_state = crr_layout_state; } // Update changed flag - pm::g_crr_layers[layer_name].changed = changed; + pm::g_crr_layers[layer_name].changed = (changed) ? true : false; } // Erase role for the event_data from list @@ -487,7 +487,7 @@ static void updateLocalLayerState(int event_data, stm::stm_state_t crr_state) { HMI_DEBUG("wm:pm", ">>> >>> >>> >>> CTG:%s", as.category.c_str()); HMI_DEBUG("wm:pm", ">>> >>> >>> >>> ROLE:%s", as.role.c_str()); } - HMI_DEBUG("wm:pm", ">>> >>> CHANGED:%d", ls.changed); + HMI_DEBUG("wm:pm", ">>> >>> CHANGED:%s", (ls.changed) ? "true" : "false"); } } |