// this->setting = std::make_unique<LayerSetting>(name, type, begin, end);
}
+WMLayer::WMLayer(json_object* j) : before_state(), state()
+{
+ LayerSetting::MANAGEMENT_TYPE t;
+ const char* layer_name = jh::getStringFromJson(j, "name");
+ const char* role = jh::getStringFromJson(j, "role");
+ const char* type = jh::getStringFromJson(j, "type");
+ int begin = jh::getIntFromJson(j, "id_range_begin");
+ int end = jh::getIntFromJson(j, "id_range_end");
+ string name = layer_name;
+
+ if (layer_name || type || begin >=0 || end >=0)
+ {
+ HMI_ERROR("Parse Error!!");
+ }
+ if(begin > end)
+ {
+ HMI_ERROR("INVALID.");
+ }
+ string str_type = type;
+ t = (type == "tile") ? LayerSetting::TILE : LayerSetting::STACK;
+ this->setting = std::make_unique<LayerSetting>(name, t, begin, end);
+}
+
unsigned WMLayer::getNewLayerID(const std::string& role)
{
return this->setting->getNewLayerID(role);
\r
WMError LayerControl::loadLayerSetting(const string &path)\r
{\r
+ HMI_DEBUG("loading WMLayer(Application Containers) Setting from %s", path);\r
+\r
+ json_object *json_obj, *json_cfg;\r
+ int ret = jh::inputJsonFilie(path.c_str(), &json_obj);\r
+ if (0 > ret)\r
+ {\r
+ HMI_DEBUG("Could not open %s, so use default area information", path.c_str());\r
+ return WMError::FAIL;\r
+ }\r
+ HMI_INFO("json_obj dump:%s", json_object_get_string(json_obj));\r
+\r
+ if (!json_object_object_get_ex(json_obj, "mappings", &json_cfg))\r
+ {\r
+ HMI_ERROR("Parse Error!!");\r
+ return WMError::FAIL;\r
+ }\r
+\r
+ int len = json_object_array_length(json_cfg);\r
+ HMI_DEBUG("json_cfg len:%d", len);\r
+\r
+ for (int i = 0; i < len; i++)\r
+ {\r
+ json_object *json_tmp = json_object_array_get_idx(json_cfg, i);\r
+ HMI_DEBUG("> json_tmp dump:%s", json_object_get_string(json_tmp));\r
+\r
+ this->wm_layers.emplace_back(std::make_shared<WMLayer>(json_tmp));\r
+ }\r
+\r
return WMError::SUCCESS;\r
}\r
\r
int ret = jh::inputJsonFilie(path.c_str(), &json_obj);\r
if (0 > ret)\r
{\r
- HMI_DEBUG("Could not open area.db, so use default area information");\r
+ HMI_DEBUG("Could not open %s, so use default area information", path.c_str());\r
return WMError::FAIL;\r
}\r
HMI_INFO("json_obj dump:%s", json_object_get_string(json_obj));\r
\r
int len = json_object_array_length(json_cfg);\r
HMI_DEBUG("json_cfg len:%d", len);\r
- HMI_DEBUG("json_cfg dump:%s", json_object_get_string(json_cfg));\r
\r
const char *area;\r
for (int i = 0; i < len; i++)\r