summaryrefslogtreecommitdiffstats
path: root/src/layers.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/layers.cpp')
-rw-r--r--src/layers.cpp40
1 files changed, 19 insertions, 21 deletions
diff --git a/src/layers.cpp b/src/layers.cpp
index b7a0fa2..e1a232a 100644
--- a/src/layers.cpp
+++ b/src/layers.cpp
@@ -18,7 +18,7 @@
#include "layers.hpp"
#include "json_helper.hpp"
-#include "hmi-debug.h"
+#include "util.hpp"
namespace wm
{
@@ -31,7 +31,7 @@ layer::layer(nlohmann::json const &j)
this->name = j["name"];
this->layer_id = j["layer_id"];
- HMI_DEBUG("wm", "layer_id:%d name:%s", this->layer_id, this->name.c_str());
+ HMI_DEBUG("layer_id:%d name:%s", this->layer_id, this->name.c_str());
}
struct result<struct layer_map> to_layer_map(nlohmann::json const &j)
@@ -108,11 +108,11 @@ optional<int> layer_map::get_layer_id(std::string const &role)
auto re = std::regex(r.first);
if (std::regex_match(role, re))
{
- HMI_DEBUG("wm", "role %s matches layer %d", role.c_str(), r.second);
+ HMI_DEBUG("role %s matches layer %d", role.c_str(), r.second);
return optional<int>(r.second);
}
}
- HMI_DEBUG("wm", "role %s does NOT match any layer", role.c_str());
+ HMI_DEBUG("role %s does NOT match any layer", role.c_str());
return nullopt;
}
@@ -168,7 +168,7 @@ void layer_map::setupArea(double scaling)
i.second.w = static_cast<int>(scaling * i.second.w + 0.5);
i.second.h = static_cast<int>(scaling * i.second.h + 0.5);
- HMI_DEBUG("wm:lm", "area:%s size(after) : x:%d y:%d w:%d h:%d",
+ HMI_DEBUG("area:%s size(after) : x:%d y:%d w:%d h:%d",
i.first.c_str(), i.second.x, i.second.y, i.second.w, i.second.h);
}
}
@@ -180,16 +180,14 @@ compositor::rect layer_map::getAreaSize(const std::string &area)
int layer_map::loadAreaDb()
{
- HMI_DEBUG("wm:lm", "Call");
-
// Get afm application installed dir
char const *afm_app_install_dir = getenv("AFM_APP_INSTALL_DIR");
- HMI_DEBUG("wm:lm", "afm_app_install_dir:%s", afm_app_install_dir);
+ HMI_DEBUG("afm_app_install_dir:%s", afm_app_install_dir);
std::string file_name;
if (!afm_app_install_dir)
{
- HMI_ERROR("wm:lm", "AFM_APP_INSTALL_DIR is not defined");
+ HMI_ERROR("AFM_APP_INSTALL_DIR is not defined");
}
else
{
@@ -201,45 +199,45 @@ int layer_map::loadAreaDb()
int ret = jh::inputJsonFilie(file_name.c_str(), &json_obj);
if (0 > ret)
{
- HMI_DEBUG("wm:lm", "Could not open area.db, so use default area information");
+ HMI_DEBUG("Could not open area.db, so use default area information");
json_obj = json_tokener_parse(kDefaultAreaDb);
}
- HMI_DEBUG("wm:lm", "json_obj dump:%s", json_object_get_string(json_obj));
+ HMI_DEBUG("json_obj dump:%s", json_object_get_string(json_obj));
// Perse areas
- HMI_DEBUG("wm:lm", "Perse areas");
+ HMI_DEBUG("Perse areas");
json_object *json_cfg;
if (!json_object_object_get_ex(json_obj, "areas", &json_cfg))
{
- HMI_ERROR("wm:lm", "Parse Error!!");
+ HMI_ERROR("Parse Error!!");
return -1;
}
int len = json_object_array_length(json_cfg);
- HMI_DEBUG("wm:lm", "json_cfg len:%d", len);
- HMI_DEBUG("wm:lm", "json_cfg dump:%s", json_object_get_string(json_cfg));
+ HMI_DEBUG("json_cfg len:%d", len);
+ HMI_DEBUG("json_cfg dump:%s", json_object_get_string(json_cfg));
const char *area;
for (int i = 0; i < len; i++)
{
json_object *json_tmp = json_object_array_get_idx(json_cfg, i);
- HMI_DEBUG("wm:lm", "> json_tmp dump:%s", json_object_get_string(json_tmp));
+ HMI_DEBUG("> json_tmp dump:%s", json_object_get_string(json_tmp));
area = jh::getStringFromJson(json_tmp, "name");
if (nullptr == area)
{
- HMI_ERROR("wm:lm", "Parse Error!!");
+ HMI_ERROR("Parse Error!!");
return -1;
}
- HMI_DEBUG("wm:lm", "> area:%s", area);
+ HMI_DEBUG("> area:%s", area);
json_object *json_rect;
if (!json_object_object_get_ex(json_tmp, "rect", &json_rect))
{
- HMI_ERROR("wm:lm", "Parse Error!!");
+ HMI_ERROR("Parse Error!!");
return -1;
}
- HMI_DEBUG("wm:lm", "> json_rect dump:%s", json_object_get_string(json_rect));
+ HMI_DEBUG("> json_rect dump:%s", json_object_get_string(json_rect));
compositor::rect area_size;
area_size.x = jh::getIntFromJson(json_rect, "x");
@@ -254,7 +252,7 @@ int layer_map::loadAreaDb()
for (auto itr = this->area2size.begin();
itr != this->area2size.end(); ++itr)
{
- HMI_DEBUG("wm:lm", "area:%s x:%d y:%d w:%d h:%d",
+ HMI_DEBUG("area:%s x:%d y:%d w:%d h:%d",
itr->first.c_str(), itr->second.x, itr->second.y,
itr->second.w, itr->second.h);
}