#include <regex>
#include "wm_layer.hpp"
-#include "wayland_ivi_wm.hpp"
#include "json_helper.hpp"
-#include "hmi-debug.h"
+#include "util.hpp"
using std::string;
using std::vector;
}
// generate new ivi layer id
ret = id_list.back() + 1;
- HMI_INFO("wm", "generate ivi_layer_id : %d on the layer: %s", ret, this->name.c_str());
+ HMI_INFO("generate ivi_layer_id : %d on the layer: %s", ret, this->name.c_str());
auto id_found = std::find(id_list.begin(), id_list.end(), ret);
if( (ret > this->idEnd()) || (id_found != id_list.cend()) )
{
- HMI_NOTICE("wm", "id %d is not available then generate new id", ret);
+ HMI_NOTICE("id %d is not available then generate new id", ret);
ret = 0;
for(unsigned i = this->idBegin(); i < this->idEnd(); i++)
{
auto ret_found = std::find(id_list.begin(), id_list.end(), i);
if(ret_found == id_list.cend())
{
- HMI_INFO("wm", "set new id: %d", i);
+ HMI_INFO("set new id: %d", i);
ret = i;
break;
}
}
else
{
- HMI_ERROR("wm", "failed to get New ID");
+ HMI_ERROR("failed to get New ID");
}
return ret;
}
// 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);
+ this->setting->appendRole(role);
+}
+
unsigned WMLayer::getNewLayerID(const std::string& role)
{
return this->setting->getNewLayerID(role);