aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/hmi-debug.h117
-rw-r--r--policy_manager/CMakeLists.txt1
-rw-r--r--policy_manager/policy_manager.cpp186
-rw-r--r--src/applist.cpp6
-rw-r--r--src/json_helper.cpp20
-rw-r--r--src/json_helper.hpp8
-rw-r--r--src/layers.cpp40
-rw-r--r--src/main.cpp82
-rw-r--r--src/pm_wrapper.cpp32
-rw-r--r--src/util.cpp89
-rw-r--r--src/util.hpp97
-rw-r--r--src/wayland_ivi_wm.cpp76
-rw-r--r--src/window_manager.cpp112
-rw-r--r--src/window_manager.hpp16
-rw-r--r--src/wm_client.cpp18
15 files changed, 368 insertions, 532 deletions
diff --git a/include/hmi-debug.h b/include/hmi-debug.h
deleted file mode 100644
index 697ac80..0000000
--- a/include/hmi-debug.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Copyright (c) 2017 TOYOTA MOTOR CORPORATION
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __HMI_DEBUG_H__
-#define __HMI_DEBUG_H__
-
-#include <time.h>
-#include <stdio.h>
-#include <stdarg.h>
-#include <string.h>
-#include <stdlib.h>
-
-enum LOG_LEVEL{
- LOG_LEVEL_NONE = 0,
- LOG_LEVEL_ERROR,
- LOG_LEVEL_WARNING,
- LOG_LEVEL_NOTICE,
- LOG_LEVEL_INFO,
- LOG_LEVEL_DEBUG,
- LOG_LEVEL_MAX = LOG_LEVEL_DEBUG
-};
-
-#define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
-
-#define HMI_ERROR(prefix, args,...) _HMI_LOG(LOG_LEVEL_ERROR, __FILENAME__, __FUNCTION__, __LINE__, prefix, args, ##__VA_ARGS__)
-#define HMI_WARNING(prefix, args,...) _HMI_LOG(LOG_LEVEL_WARNING, __FILENAME__, __FUNCTION__,__LINE__, prefix, args,##__VA_ARGS__)
-#define HMI_NOTICE(prefix, args,...) _HMI_LOG(LOG_LEVEL_NOTICE, __FILENAME__, __FUNCTION__,__LINE__, prefix, args,##__VA_ARGS__)
-#define HMI_INFO(prefix, args,...) _HMI_LOG(LOG_LEVEL_INFO, __FILENAME__, __FUNCTION__,__LINE__, prefix, args,##__VA_ARGS__)
-#define HMI_DEBUG(prefix, args,...) _HMI_LOG(LOG_LEVEL_DEBUG, __FILENAME__, __FUNCTION__,__LINE__, prefix, args,##__VA_ARGS__)
-
-#define HMI_SEQ_ERROR(seq_num, args,...) _HMI_SEQ_LOG(LOG_LEVEL_ERROR, __FILENAME__, __FUNCTION__, __LINE__, seq_num, args, ##__VA_ARGS__)
-#define HMI_SEQ_WARNING(seq_num, args,...) _HMI_SEQ_LOG(LOG_LEVEL_WARNING, __FILENAME__, __FUNCTION__, __LINE__, seq_num, args, ##__VA_ARGS__)
-#define HMI_SEQ_NOTICE(seq_num, args,...) _HMI_SEQ_LOG(LOG_LEVEL_NOTICE, __FILENAME__, __FUNCTION__, __LINE__, seq_num, args, ##__VA_ARGS__)
-#define HMI_SEQ_INFO(seq_num, args,...) _HMI_SEQ_LOG(LOG_LEVEL_INFO, __FILENAME__, __FUNCTION__, __LINE__, seq_num, args, ##__VA_ARGS__)
-#define HMI_SEQ_DEBUG(seq_num, args,...) _HMI_SEQ_LOG(LOG_LEVEL_DEBUG, __FILENAME__, __FUNCTION__, __LINE__, seq_num, args, ##__VA_ARGS__)
-
-#define DUMP(args, ...) _DUMP(LOG_LEVEL_DEBUG, args, ##__VA_ARGS__)
-
-static char ERROR_FLAG[6][20] = {"NONE", "ERROR", "WARNING", "NOTICE", "INFO", "DEBUG"};
-
-static void _HMI_LOG(enum LOG_LEVEL level, const char* file, const char* func, const int line, const char* prefix, const char* log, ...)
-{
- const int log_level = (getenv("USE_HMI_DEBUG") == NULL)?LOG_LEVEL_ERROR:atoi(getenv("USE_HMI_DEBUG"));
- if(log_level < level)
- {
- return;
- }
-
- char *message;
- struct timespec tp;
- unsigned int time;
-
- clock_gettime(CLOCK_REALTIME, &tp);
- time = (tp.tv_sec * 1000000L) + (tp.tv_nsec / 1000);
-
- va_list args;
- va_start(args, log);
- if (log == NULL || vasprintf(&message, log, args) < 0)
- message = NULL;
- fprintf(stderr, "[%10.3f] [%s %s] [%s, %s(), Line:%d] >>> %s \n", time / 1000.0, prefix, ERROR_FLAG[level], file, func, line, message);
- va_end(args);
- free(message);
-}
-
-static void _HMI_SEQ_LOG(enum LOG_LEVEL level, const char* file, const char* func, const int line, unsigned seq_num, const char* log, ...){
- const int log_level = (getenv("USE_HMI_DEBUG") == NULL) ? LOG_LEVEL_ERROR:atoi(getenv("USE_HMI_DEBUG"));
- if(log_level < level)
- {
- return;
- }
-
- char *message;
- struct timespec tp;
- unsigned int time;
-
- clock_gettime(CLOCK_REALTIME, &tp);
- time = (tp.tv_sec * 1000000L) + (tp.tv_nsec / 1000);
-
- va_list args;
- va_start(args, log);
- if (log == NULL || vasprintf(&message, log, args) < 0)
- message = NULL;
- fprintf(stderr, "[%10.3f] [wm %s] [%s, %s(), Line:%d] >>> req %d: %s \n", time / 1000.0, ERROR_FLAG[level], file, func, line, seq_num, message);
- va_end(args);
- free(message);
-}
-
-static void _DUMP(enum LOG_LEVEL level, const char *log, ...)
-{
- const int log_level = (getenv("USE_HMI_DEBUG") == NULL) ? LOG_LEVEL_ERROR : atoi(getenv("USE_HMI_DEBUG"));
- if (log_level < level)
- {
- return;
- }
- char *message;
- va_list args;
- va_start(args, log);
- if (log == NULL || vasprintf(&message, log, args) < 0)
- message = NULL;
- fprintf(stderr, "%s \n", message);
- va_end(args);
- free(message);
-}
-#endif //__HMI_DEBUG_H__ \ No newline at end of file
diff --git a/policy_manager/CMakeLists.txt b/policy_manager/CMakeLists.txt
index 584d311..3ec4c39 100644
--- a/policy_manager/CMakeLists.txt
+++ b/policy_manager/CMakeLists.txt
@@ -45,6 +45,7 @@ add_library(${TARGETS_PM}
SHARED
policy_manager.cpp
stm/stm.c
+ ../src/util.cpp
)
target_include_directories(${TARGETS_PM}
diff --git a/policy_manager/policy_manager.cpp b/policy_manager/policy_manager.cpp
index c7bb007..999bc87 100644
--- a/policy_manager/policy_manager.cpp
+++ b/policy_manager/policy_manager.cpp
@@ -22,7 +22,7 @@
#include <algorithm>
#include <json-c/json.h>
#include "policy_manager.hpp"
-#include "hmi-debug.h"
+#include "util.hpp"
extern "C"
{
@@ -68,19 +68,19 @@ int PolicyManager::initialize()
// Create convert map
for (int i = StmEvtNoMin; i <= StmEvtNoMax; i++)
{
- HMI_DEBUG("wm:pm", "event name:%s no:%d", kStmEventName[i], i);
+ HMI_DEBUG("event name:%s no:%d", kStmEventName[i], i);
this->eventname2no[kStmEventName[i]] = i;
}
for (int i = StmCtgNoMin; i <= StmCtgNoMax; i++)
{
- HMI_DEBUG("wm:pm", "category name:%s no:%d", kStmCategoryName[i], i);
+ HMI_DEBUG("category name:%s no:%d", kStmCategoryName[i], i);
this->categoryname2no[kStmCategoryName[i]] = i;
}
for (int i = StmAreaNoMin; i <= StmAreaNoMax; i++)
{
- HMI_DEBUG("wm:pm", "area name:%s no:%d", kStmAreaName[i], i);
+ HMI_DEBUG("area name:%s no:%d", kStmAreaName[i], i);
this->areaname2no[kStmAreaName[i]] = i;
}
@@ -88,7 +88,7 @@ int PolicyManager::initialize()
ret = this->loadRoleDb();
if (0 > ret)
{
- HMI_ERROR("wm:pm", "Load roles.db Error!!");
+ HMI_ERROR("Load roles.db Error!!");
return ret;
}
@@ -96,7 +96,7 @@ int PolicyManager::initialize()
ret = this->loadStateDb();
if (0 > ret)
{
- HMI_ERROR("wm:pm", "Load states.db Error!!");
+ HMI_ERROR("Load states.db Error!!");
return ret;
}
@@ -123,7 +123,7 @@ int PolicyManager::setInputEventData(json_object *json_in)
// Check arguments
if (nullptr == json_in)
{
- HMI_ERROR("wm:pm", "Argument is NULL!!");
+ HMI_ERROR("Argument is NULL!!");
return -1;
}
@@ -137,17 +137,17 @@ int PolicyManager::setInputEventData(json_object *json_in)
if (this->eventname2no.end() != itr)
{
event_no = this->eventname2no[event];
- HMI_DEBUG("wm:pm", "event(%s:%d)", event, event_no);
+ HMI_DEBUG("event(%s:%d)", event, event_no);
}
else
{
- HMI_ERROR("wm:pm", "Invalid event name!!");
+ HMI_ERROR("Invalid event name!!");
return -1;
}
}
else
{
- HMI_ERROR("wm:pm", "Event is not set!!");
+ HMI_ERROR("Event is not set!!");
return -1;
}
@@ -157,7 +157,7 @@ int PolicyManager::setInputEventData(json_object *json_in)
int category_no = StmCtgNoNone;
if (nullptr != role)
{
- HMI_DEBUG("wm:pm", "role(%s)", role);
+ HMI_DEBUG("role(%s)", role);
// Convert role to category
auto itr = this->role2category.find(role);
@@ -170,7 +170,7 @@ int PolicyManager::setInputEventData(json_object *json_in)
itr = this->role2category.find("fallback");
if (this->role2category.end() != itr)
{
- HMI_DEBUG("wm:pm", "Role:%s is not registered in roles.db, fallback as normal app", role);
+ HMI_DEBUG("Role:%s is not registered in roles.db, fallback as normal app", role);
category = this->role2category["fallback"];
}
}
@@ -179,7 +179,7 @@ int PolicyManager::setInputEventData(json_object *json_in)
{
// Convert name to number
category_no = categoryname2no[category];
- HMI_DEBUG("wm:pm", "category(%s:%d)", category.c_str(), category_no);
+ HMI_DEBUG("category(%s:%d)", category.c_str(), category_no);
}
}
if (StmCtgNoNone == category_no)
@@ -205,7 +205,7 @@ int PolicyManager::setInputEventData(json_object *json_in)
area = this->category2areas[category].front().c_str();
area_no = this->areaname2no[area];
}
- HMI_DEBUG("wm:pm", "area(%s:%d)", area, area_no);
+ HMI_DEBUG("area(%s:%d)", area, area_no);
}
// Set event info to the queue
@@ -237,17 +237,17 @@ int PolicyManager::executeStateTransition()
void PolicyManager::undoState()
{
- HMI_DEBUG("wm:pm", "Undo State !!!");
+ HMI_DEBUG("Undo State !!!");
// Undo state of STM
stmUndoState();
- HMI_DEBUG("wm:pm", ">>>>>>>>>> BEFORE UNDO");
+ HMI_DEBUG(">>>>>>>>>> BEFORE UNDO");
this->dumpLayerState(this->crr_layers);
this->crr_layers = this->prv_layers;
- HMI_DEBUG("wm:pm", ">>>>>>>>>> AFTER UNDO");
+ HMI_DEBUG(">>>>>>>>>> AFTER UNDO");
this->dumpLayerState(this->crr_layers);
}
@@ -282,7 +282,7 @@ void PolicyManager::addStateToJson(const char *name, bool changed,
{
if ((nullptr == name) || (nullptr == json_out))
{
- HMI_ERROR("wm:pm", "Invalid argument!!!");
+ HMI_ERROR("Invalid argument!!!");
return;
}
@@ -296,7 +296,7 @@ void PolicyManager::addStateToJson(const char *layer_name, bool changed,
{
if ((nullptr == layer_name) || (nullptr == json_out))
{
- HMI_ERROR("wm:pm", "Invalid argument!!!");
+ HMI_ERROR("Invalid argument!!!");
return;
}
@@ -325,7 +325,7 @@ void PolicyManager::updateLayer(int event_id, StmState crr_state)
for (int layer_no = StmLayerNoMin;
layer_no <= StmLayerNoMax; layer_no++)
{
- HMI_DEBUG("wm:pm", ">>> LAYER:%s CHANGED:%d LAYOUT:%s",
+ HMI_DEBUG(">>> LAYER:%s CHANGED:%d LAYOUT:%s",
kStmLayerName[layer_no], crr_state.layer[layer_no].changed,
kStmLayoutName[crr_state.layer[layer_no].state]);
}
@@ -343,7 +343,7 @@ void PolicyManager::updateLayer(int event_id, StmState crr_state)
int changed = crr_state.layer[layer_no].changed;
if (changed)
{
- HMI_DEBUG("wm:pm", ">>>>>>>>>> Update layout of layer:%s", layer_name);
+ HMI_DEBUG(">>>>>>>>>> Update layout of layer:%s", layer_name);
// Get current layout name of this layer
int crr_layout_state_no = crr_state.layer[layer_no].state;
@@ -363,10 +363,10 @@ void PolicyManager::updateLayer(int event_id, StmState crr_state)
// Erase role for the event_id from list
this->req_role_list.erase(event_id);
- HMI_DEBUG("wm:pm", ">>>>>>>>>> DUMP LAYERS (BEFORE)");
+ HMI_DEBUG(">>>>>>>>>> DUMP LAYERS (BEFORE)");
this->dumpLayerState(this->prv_layers);
- HMI_DEBUG("wm:pm", ">>>>>>>>>> DUMP LAYERS (AFTER)");
+ HMI_DEBUG(">>>>>>>>>> DUMP LAYERS (AFTER)");
this->dumpLayerState(this->crr_layers);
this->dumpInvisibleRoleHistory();
@@ -405,17 +405,17 @@ int PolicyManager::updateLayout(int event_id, int layer_no,
crr_layout_state = prv_layout_state;
changed = 1;
- HMI_DEBUG("wm:pm", "-- layout name previous:%s current:%s",
+ HMI_DEBUG("-- layout name previous:%s current:%s",
prv_layout_name.c_str(), crr_layout_name.c_str());
if (prv_layout_name == crr_layout_name)
{
- HMI_DEBUG("wm:pm", "---- Previous layout is same with current");
+ HMI_DEBUG("---- Previous layout is same with current");
}
else
{
// If previous layout is NOT same with current,
// current areas is set with default value
- HMI_DEBUG("wm:pm", "---- Previous layout is NOT same with current");
+ HMI_DEBUG("---- Previous layout is NOT same with current");
crr_layout_state.name = this->default_layouts[crr_layout_name].name;
crr_layout_state.category_num = this->default_layouts[crr_layout_name].category_num;
crr_layout_state.area_list = this->default_layouts[crr_layout_name].area_list;
@@ -434,7 +434,7 @@ int PolicyManager::updateLayout(int event_id, int layer_no,
// }
// const char *ctg = kStmCategoryName[ctg_no];
- HMI_DEBUG("wm:pm", "-- Create candidate list for ctg:%s", ctg.c_str());
+ HMI_DEBUG("-- Create candidate list for ctg:%s", ctg.c_str());
AreaList tmp_cand_list;
int candidate_num = 0;
@@ -447,7 +447,7 @@ int PolicyManager::updateLayout(int event_id, int layer_no,
std::string used_role = "";
if ((ctg == req_ctg) && ("activate" == req_evt))
{
- HMI_DEBUG("wm:pm", "---- Requested event is activate");
+ HMI_DEBUG("---- Requested event is activate");
for (AreaState &as : crr_layout_state.area_list)
{
if (as.category == req_ctg)
@@ -459,7 +459,7 @@ int PolicyManager::updateLayout(int event_id, int layer_no,
as.role = req_role;
used_role = req_role;
blank_num--;
- HMI_DEBUG("wm:pm", "------ Update current layout: area:%s category:%s role:%s",
+ HMI_DEBUG("------ Update current layout: area:%s category:%s role:%s",
as.name.c_str(), as.category.c_str(), as.role.c_str());
break;
}
@@ -476,7 +476,7 @@ int PolicyManager::updateLayout(int event_id, int layer_no,
// If there is the category
// which is same with new category and not used for updating yet,
// push it to list
- HMI_DEBUG("wm:pm", "---- Push previous(category:%s role:%s) to candidate list",
+ HMI_DEBUG("---- Push previous(category:%s role:%s) to candidate list",
area_state.category.c_str(), area_state.role.c_str());
tmp_cand_list.push_back(area_state);
candidate_num++;
@@ -488,7 +488,7 @@ int PolicyManager::updateLayout(int event_id, int layer_no,
// so push requested role to candidate list
if (request_for_this_layer && ("" == used_role))
{
- HMI_DEBUG("wm:pm", "---- Push request(area:%s category:%s role:%s) to candidate list",
+ HMI_DEBUG("---- Push request(area:%s category:%s role:%s) to candidate list",
req_area.c_str(), req_ctg.c_str(), req_role.c_str());
AreaState area_state;
area_state.name = req_area;
@@ -498,7 +498,7 @@ int PolicyManager::updateLayout(int event_id, int layer_no,
candidate_num++;
}
- HMI_DEBUG("wm:pm", "---- blank_num:%d candidate_num:%d", blank_num, candidate_num);
+ HMI_DEBUG("---- blank_num:%d candidate_num:%d", blank_num, candidate_num);
// Compare number of candidate/blank,
// And remove role in order of the oldest as necessary
@@ -514,10 +514,10 @@ int PolicyManager::updateLayout(int event_id, int layer_no,
area_state.role = this->popInvisibleRoleHistory(ctg);
if ("" == area_state.role)
{
- HMI_ERROR("wm:pm", "There is no role in history stack!!");
+ HMI_ERROR("There is no role in history stack!!");
}
tmp_cand_list.push_back(area_state);
- HMI_DEBUG("wm:pm", "------ Add role:%s to candidate list",
+ HMI_DEBUG("------ Add role:%s to candidate list",
area_state.role.c_str());
candidate_num++;
}
@@ -528,7 +528,7 @@ int PolicyManager::updateLayout(int event_id, int layer_no,
while (candidate_num != blank_num)
{
std::string removed_role = tmp_cand_list.begin()->role;
- HMI_DEBUG("wm:pm", "------ Remove the oldest role:%s from candidate list",
+ HMI_DEBUG("------ Remove the oldest role:%s from candidate list",
removed_role.c_str());
tmp_cand_list.erase(tmp_cand_list.begin());
candidate_num--;
@@ -555,14 +555,14 @@ int PolicyManager::updateLayout(int event_id, int layer_no,
}
// Update areas
- HMI_DEBUG("wm:pm", "-- Update areas by using candidate list");
+ HMI_DEBUG("-- Update areas by using candidate list");
for (AreaState &as : crr_layout_state.area_list)
{
- HMI_DEBUG("wm:pm", "---- Check area:%s category:%s role:%s",
+ HMI_DEBUG("---- Check area:%s category:%s role:%s",
as.name.c_str(), as.category.c_str(), as.role.c_str());
if ("" == as.role)
{
- HMI_DEBUG("wm:pm", "------ Update this area with role:%s",
+ HMI_DEBUG("------ Update this area with role:%s",
cand_list[as.category].begin()->role.c_str());
as.role = cand_list[as.category].begin()->role;
cand_list[as.category].erase(cand_list[as.category].begin());
@@ -610,7 +610,7 @@ void PolicyManager::createOutputInformation(StmState crr_state, json_object **js
int PolicyManager::transitionState(sd_event_source *source, void *data)
{
- HMI_DEBUG("wm:pm", ">>>>>>>>>> START STATE TRANSITION");
+ HMI_DEBUG(">>>>>>>>>> START STATE TRANSITION");
int event_id = *((int *)data);
@@ -618,7 +618,7 @@ int PolicyManager::transitionState(sd_event_source *source, void *data)
event_no = STM_GET_EVENT_FROM_ID(event_id);
category_no = STM_GET_CATEGORY_FROM_ID(event_id);
area_no = STM_GET_AREA_FROM_ID(event_id);
- HMI_DEBUG("wm:pm", ">>>>>>>>>> EVENT:%s CATEGORY:%s AREA:%s",
+ HMI_DEBUG(">>>>>>>>>> EVENT:%s CATEGORY:%s AREA:%s",
kStmEventName[event_no],
kStmCategoryName[category_no],
kStmAreaName[area_no]);
@@ -628,7 +628,7 @@ int PolicyManager::transitionState(sd_event_source *source, void *data)
int ret = stmTransitionState(event_id, &crr_state);
if (0 > ret)
{
- HMI_ERROR("wm:pm", "Failed transition state");
+ HMI_ERROR("Failed transition state");
if (nullptr != this->callback.onError)
{
json_object *json_out = json_object_new_object();
@@ -674,13 +674,13 @@ int PolicyManager::transitionState(sd_event_source *source, void *data)
this->event_source_list.erase(event_id);
}
- HMI_DEBUG("wm:pm", ">>>>>>>>>> FINISH STATE TRANSITION");
+ HMI_DEBUG(">>>>>>>>>> FINISH STATE TRANSITION");
return 0;
}
int PolicyManager::timerEvent(sd_event_source *source, uint64_t usec, void *data)
{
- HMI_DEBUG("wm:pm", "Call");
+ HMI_DEBUG("Call");
int ret = this->transitionState(source, data);
return ret;
@@ -733,11 +733,11 @@ int PolicyManager::loadRoleDb()
// Get afm application installed dir
char const *afm_app_install_dir = getenv("AFM_APP_INSTALL_DIR");
- HMI_DEBUG("wm:pm", "afm_app_install_dir:%s", afm_app_install_dir);
+ HMI_DEBUG("afm_app_install_dir:%s", afm_app_install_dir);
if (!afm_app_install_dir)
{
- HMI_ERROR("wm:pm", "AFM_APP_INSTALL_DIR is not defined");
+ HMI_ERROR("AFM_APP_INSTALL_DIR is not defined");
}
else
{
@@ -749,21 +749,21 @@ int PolicyManager::loadRoleDb()
int ret = this->inputJsonFilie(file_name.c_str(), &json_obj);
if (0 > ret)
{
- HMI_ERROR("wm:pm", "Could not open roles.db, so use default role information");
+ HMI_ERROR("Could not open roles.db, so use default role information");
json_obj = json_tokener_parse(kDefaultRoleDb);
}
- HMI_DEBUG("wm:pm", "json_obj dump:%s", json_object_get_string(json_obj));
+ HMI_DEBUG("json_obj dump:%s", json_object_get_string(json_obj));
json_object *json_roles;
if (!json_object_object_get_ex(json_obj, "roles", &json_roles))
{
- HMI_ERROR("wm:pm", "Parse Error!!");
+ HMI_ERROR("Parse Error!!");
return -1;
}
int len = json_object_array_length(json_roles);
- HMI_DEBUG("wm:pm", "json_cfg len:%d", len);
- HMI_DEBUG("wm:pm", "json_cfg dump:%s", json_object_get_string(json_roles));
+ HMI_DEBUG("json_cfg len:%d", len);
+ HMI_DEBUG("json_cfg dump:%s", json_object_get_string(json_roles));
json_object *json_tmp;
const char *category;
@@ -782,7 +782,7 @@ int PolicyManager::loadRoleDb()
if ((nullptr == category) || (nullptr == roles) ||
(nullptr == areas) || (nullptr == layer))
{
- HMI_ERROR("wm:pm", "Parse Error!!");
+ HMI_ERROR("Parse Error!!");
return -1;
}
@@ -805,24 +805,24 @@ int PolicyManager::loadRoleDb()
}
// Check
- HMI_DEBUG("wm:pm", "Check role2category");
+ HMI_DEBUG("Check role2category");
for (const auto &x : this->role2category)
{
- HMI_DEBUG("wm:pm", "key:%s, val:%s", x.first.c_str(), x.second.c_str());
+ HMI_DEBUG("key:%s, val:%s", x.first.c_str(), x.second.c_str());
}
- HMI_DEBUG("wm:pm", "Check category2role");
+ HMI_DEBUG("Check category2role");
for (const auto &x : this->category2role)
{
- HMI_DEBUG("wm:pm", "key:%s, val:%s", x.first.c_str(), x.second.c_str());
+ HMI_DEBUG("key:%s, val:%s", x.first.c_str(), x.second.c_str());
}
- HMI_DEBUG("wm:pm", "Check category2areas");
+ HMI_DEBUG("Check category2areas");
for (const auto &x : this->category2areas)
{
for (const auto &y : x.second)
{
- HMI_DEBUG("wm:pm", "key:%s, val:%s", x.first.c_str(), y.c_str());
+ HMI_DEBUG("key:%s, val:%s", x.first.c_str(), y.c_str());
}
}
return 0;
@@ -830,16 +830,16 @@ int PolicyManager::loadRoleDb()
int PolicyManager::loadStateDb()
{
- HMI_DEBUG("wm:pm", "Call");
+ HMI_DEBUG("Call");
// Get afm application installed dir
char const *afm_app_install_dir = getenv("AFM_APP_INSTALL_DIR");
- HMI_DEBUG("wm:pm", "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:pm", "AFM_APP_INSTALL_DIR is not defined");
+ HMI_ERROR("AFM_APP_INSTALL_DIR is not defined");
}
else
{
@@ -851,23 +851,23 @@ int PolicyManager::loadStateDb()
int ret = this->inputJsonFilie(file_name.c_str(), &json_obj);
if (0 > ret)
{
- HMI_DEBUG("wm:pm", "Could not open states.db, so use default layout information");
+ HMI_DEBUG("Could not open states.db, so use default layout information");
json_obj = json_tokener_parse(kDefaultStateDb);
}
- HMI_DEBUG("wm:pm", "json_obj dump:%s", json_object_get_string(json_obj));
+ HMI_DEBUG("json_obj dump:%s", json_object_get_string(json_obj));
// Perse states
- HMI_DEBUG("wm:pm", "Perse states");
+ HMI_DEBUG("Perse states");
json_object *json_cfg;
if (!json_object_object_get_ex(json_obj, "states", &json_cfg))
{
- HMI_ERROR("wm:pm", "Parse Error!!");
+ HMI_ERROR("Parse Error!!");
return -1;
}
int len = json_object_array_length(json_cfg);
- HMI_DEBUG("wm:pm", "json_cfg len:%d", len);
- HMI_DEBUG("wm:pm", "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 *layout;
const char *role;
@@ -879,21 +879,21 @@ int PolicyManager::loadStateDb()
layout = this->getStringFromJson(json_tmp, "name");
if (nullptr == layout)
{
- HMI_ERROR("wm:pm", "Parse Error!!");
+ HMI_ERROR("Parse Error!!");
return -1;
}
- HMI_DEBUG("wm:pm", "> layout:%s", layout);
+ HMI_DEBUG("> layout:%s", layout);
json_object *json_area_array;
if (!json_object_object_get_ex(json_tmp, "areas", &json_area_array))
{
- HMI_ERROR("wm:pm", "Parse Error!!");
+ HMI_ERROR("Parse Error!!");
return -1;
}
int len_area = json_object_array_length(json_area_array);
- HMI_DEBUG("wm:pm", "json_area_array len:%d", len_area);
- HMI_DEBUG("wm:pm", "json_area_array dump:%s", json_object_get_string(json_area_array));
+ HMI_DEBUG("json_area_array len:%d", len_area);
+ HMI_DEBUG("json_area_array dump:%s", json_object_get_string(json_area_array));
LayoutState layout_state;
AreaState area_state;
@@ -913,22 +913,22 @@ int PolicyManager::loadStateDb()
const char *area = this->getStringFromJson(json_area, "name");
if (nullptr == area)
{
- HMI_ERROR("wm:pm", "Parse Error!!");
+ HMI_ERROR("Parse Error!!");
return -1;
}
area_state.name = std::string(area);
- HMI_DEBUG("wm:pm", ">> area:%s", area);
+ HMI_DEBUG(">> area:%s", area);
// Get app attribute of the area
category = this->getStringFromJson(json_area, "category");
if (nullptr == category)
{
- HMI_ERROR("wm:pm", "Parse Error!!");
+ HMI_ERROR("Parse Error!!");
return -1;
}
area_state.category = std::string(category);
category_num[category]++;
- HMI_DEBUG("wm:pm", ">>> category:%s", category);
+ HMI_DEBUG(">>> category:%s", category);
role = this->getStringFromJson(json_area, "role");
if (nullptr != role)
@@ -940,7 +940,7 @@ int PolicyManager::loadStateDb()
{
area_state.role = std::string("");
}
- HMI_DEBUG("wm:pm", ">>> role:%s", role);
+ HMI_DEBUG(">>> role:%s", role);
layout_state.area_list.push_back(area_state);
}
@@ -960,14 +960,14 @@ int PolicyManager::loadStateDb()
for (auto itr_layout = this->default_layouts.begin();
itr_layout != this->default_layouts.end(); ++itr_layout)
{
- HMI_DEBUG("wm:pm", ">>> layout:%s", itr_layout->first.c_str());
+ HMI_DEBUG(">>> layout:%s", itr_layout->first.c_str());
for (auto itr_area = itr_layout->second.area_list.begin();
itr_area != itr_layout->second.area_list.end(); ++itr_area)
{
- HMI_DEBUG("wm:pm", ">>> >>> area :%s", itr_area->name.c_str());
- HMI_DEBUG("wm:pm", ">>> >>> category:%s", itr_area->category.c_str());
- HMI_DEBUG("wm:pm", ">>> >>> role :%s", itr_area->role.c_str());
+ HMI_DEBUG(">>> >>> area :%s", itr_area->name.c_str());
+ HMI_DEBUG(">>> >>> category:%s", itr_area->category.c_str());
+ HMI_DEBUG(">>> >>> role :%s", itr_area->role.c_str());
}
}
@@ -1017,7 +1017,7 @@ const char *PolicyManager::getStringFromJson(json_object *obj, const char *key)
json_object *tmp;
if (!json_object_object_get_ex(obj, key, &tmp))
{
- HMI_DEBUG("wm:pm", "Not found key \"%s\"", key);
+ HMI_DEBUG("Not found key \"%s\"", key);
return nullptr;
}
@@ -1029,13 +1029,13 @@ int PolicyManager::inputJsonFilie(const char *file, json_object **obj)
const int input_size = 128;
int ret = -1;
- HMI_DEBUG("wm:pm", "Input file: %s", file);
+ HMI_DEBUG("Input file: %s", file);
// Open json file
FILE *fp = fopen(file, "rb");
if (nullptr == fp)
{
- HMI_ERROR("wm:pm", "Could not open file");
+ HMI_ERROR("Could not open file");
return ret;
}
@@ -1050,7 +1050,7 @@ int PolicyManager::inputJsonFilie(const char *file, json_object **obj)
*obj = json_tokener_parse_ex(tokener, buffer, len);
if (nullptr != *obj)
{
- HMI_DEBUG("wm:pm", "File input is success");
+ HMI_DEBUG("File input is success");
ret = 0;
break;
}
@@ -1058,9 +1058,9 @@ int PolicyManager::inputJsonFilie(const char *file, json_object **obj)
json_error = json_tokener_get_error(tokener);
if ((json_tokener_continue != json_error) || (input_size > len))
{
- HMI_ERROR("wm:pm", "Failed to parse file (byte:%d err:%s)",
+ HMI_ERROR("Failed to parse file (byte:%d err:%s)",
(input_size * block_cnt), json_tokener_error_desc(json_error));
- HMI_ERROR("wm:pm", "\n%s", buffer);
+ HMI_ERROR("\n%s", buffer);
*obj = nullptr;
break;
}
@@ -1078,8 +1078,8 @@ int PolicyManager::inputJsonFilie(const char *file, json_object **obj)
void PolicyManager::dumpLayerState(std::unordered_map<std::string, LayerState> &layers)
{
- HMI_DEBUG("wm:pm", "-------------------------------------------------------------------------------------------------------");
- HMI_DEBUG("wm:pm", "|%-15s|%s|%-20s|%-20s|%-20s|%-20s|",
+ HMI_DEBUG("-------------------------------------------------------------------------------------------------------");
+ HMI_DEBUG("|%-15s|%s|%-20s|%-20s|%-20s|%-20s|",
"LAYER", "C", "LAYOUT", "AREA", "CATEGORY", "ROLE");
for (const auto &itr : layers)
{
@@ -1093,21 +1093,21 @@ void PolicyManager::dumpLayerState(std::unordered_map<std::string, LayerState> &
if (first)
{
first = false;
- HMI_DEBUG("wm:pm", "|%-15s|%1s|%-20s|%-20s|%-20s|%-20s|",
+ HMI_DEBUG("|%-15s|%1s|%-20s|%-20s|%-20s|%-20s|",
layer, changed, layout,
as.name.c_str(), as.category.c_str(), as.role.c_str());
}
else
- HMI_DEBUG("wm:pm", "|%-15s|%1s|%-20s|%-20s|%-20s|%-20s|",
+ HMI_DEBUG("|%-15s|%1s|%-20s|%-20s|%-20s|%-20s|",
"", "", "", as.name.c_str(), as.category.c_str(), as.role.c_str());
}
}
- HMI_DEBUG("wm:pm", "-------------------------------------------------------------------------------------------------------");
+ HMI_DEBUG("-------------------------------------------------------------------------------------------------------");
}
void PolicyManager::dumpInvisibleRoleHistory()
{
- HMI_DEBUG("wm:pm", ">>>>>>>>>> DUMP INVISIBLE ROLE HISTORY ( category [older > newer] )");
+ HMI_DEBUG(">>>>>>>>>> DUMP INVISIBLE ROLE HISTORY ( category [older > newer] )");
for (int ctg_no = StmCtgNoMin; ctg_no <= StmCtgNoMax; ctg_no++)
{
if (ctg_no == StmCtgNoNone)
@@ -1120,7 +1120,7 @@ void PolicyManager::dumpInvisibleRoleHistory()
str += (i + " > ");
str += "]";
- HMI_DEBUG("wm:pm", "%s", str.c_str());
+ HMI_DEBUG("%s", str.c_str());
}
}
diff --git a/src/applist.cpp b/src/applist.cpp
index a5ae9f0..f0dade0 100644
--- a/src/applist.cpp
+++ b/src/applist.cpp
@@ -16,7 +16,7 @@
#include <iostream>
#include <algorithm>
#include "applist.hpp"
-#include "../include/hmi-debug.h"
+#include "util.hpp"
using std::shared_ptr;
using std::string;
@@ -82,7 +82,7 @@ void AppList::removeClient(const string &appid)
{
std::lock_guard<std::mutex> lock(this->mtx);
this->app2client.erase(appid);
- HMI_INFO("wm", "Remove client %s", appid.c_str());
+ HMI_INFO("Remove client %s", appid.c_str());
}
/**
@@ -111,7 +111,7 @@ void AppList::removeSurface(unsigned surface){
{
ret = x.second->removeSurfaceIfExist(surface);
if(ret){
- HMI_DEBUG("wm", "remove surface %d from Client %s finish",
+ HMI_DEBUG("remove surface %d from Client %s finish",
surface, x.second->appID().c_str());
break;
}
diff --git a/src/json_helper.cpp b/src/json_helper.cpp
index b97f21d..cf13363 100644
--- a/src/json_helper.cpp
+++ b/src/json_helper.cpp
@@ -15,9 +15,7 @@
*/
#include "json_helper.hpp"
-#include "hmi-debug.h"
-
-#include <json.h>
+#include "util.hpp"
json_object *to_json(compositor::surface_properties const &s)
{
@@ -117,7 +115,7 @@ const char* getStringFromJson(json_object* obj, const char* key)
json_object* tmp;
if (!json_object_object_get_ex(obj, key, &tmp))
{
- HMI_DEBUG("wm:jh", "Not found key \"%s\"", key);
+ HMI_DEBUG("Not found key \"%s\"", key);
return nullptr;
}
@@ -129,7 +127,7 @@ int getIntFromJson(json_object *obj, const char *key)
json_object *tmp;
if (!json_object_object_get_ex(obj, key, &tmp))
{
- HMI_DEBUG("wm:jh", "Not found key \"%s\"", key);
+ HMI_DEBUG("Not found key \"%s\"", key);
return 0;
}
@@ -141,7 +139,7 @@ json_bool getBoolFromJson(json_object *obj, const char *key)
json_object *tmp;
if (!json_object_object_get_ex(obj, key, &tmp))
{
- HMI_DEBUG("wm:jh", "Not found key \"%s\"", key);
+ HMI_DEBUG("Not found key \"%s\"", key);
return FALSE;
}
@@ -153,13 +151,13 @@ int inputJsonFilie(const char* file, json_object** obj)
const int input_size = 128;
int ret = -1;
- HMI_DEBUG("wm:jh", "Input file: %s", file);
+ HMI_DEBUG("Input file: %s", file);
// Open json file
FILE *fp = fopen(file, "rb");
if (nullptr == fp)
{
- HMI_ERROR("wm:jh", "Could not open file");
+ HMI_ERROR("Could not open file");
return ret;
}
@@ -174,7 +172,7 @@ int inputJsonFilie(const char* file, json_object** obj)
*obj = json_tokener_parse_ex(tokener, buffer, len);
if (nullptr != *obj)
{
- HMI_DEBUG("wm:jh", "File input is success");
+ HMI_DEBUG("File input is success");
ret = 0;
break;
}
@@ -183,9 +181,9 @@ int inputJsonFilie(const char* file, json_object** obj)
if ((json_tokener_continue != json_error)
|| (input_size > len))
{
- HMI_ERROR("wm:jh", "Failed to parse file (byte:%d err:%s)",
+ HMI_ERROR("Failed to parse file (byte:%d err:%s)",
(input_size * block_cnt), json_tokener_error_desc(json_error));
- HMI_ERROR("wm:jh", "\n%s", buffer);
+ HMI_ERROR("\n%s", buffer);
*obj = nullptr;
break;
}
diff --git a/src/json_helper.hpp b/src/json_helper.hpp
index 5333130..2321f8b 100644
--- a/src/json_helper.hpp
+++ b/src/json_helper.hpp
@@ -14,11 +14,11 @@
* limitations under the License.
*/
-#ifndef TMCAGLWM_JSON_HELPER_HPP
-#define TMCAGLWM_JSON_HELPER_HPP
+#ifndef JSON_HELPER_HPP
+#define JSON_HELPER_HPP
#include <json-c/json.h>
-#include "../include/json.hpp"
+#include <vector>
#include "wayland_ivi_wm.hpp"
struct json_object;
@@ -34,4 +34,4 @@ json_bool getBoolFromJson(json_object *obj, const char *key);
int inputJsonFilie(const char* file, json_object** obj);
} // namespace jh
-#endif // TMCAGLWM_JSON_HELPER_HPP
+#endif // JSON_HELPER_HPP
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);
}
diff --git a/src/main.cpp b/src/main.cpp
index 0447f86..0e3c587 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -18,7 +18,6 @@
#include <algorithm>
#include <mutex>
#include <json.h>
-#include "../include/json.hpp"
#include "window_manager.hpp"
#include "json_helper.hpp"
#include "wayland_ivi_wm.hpp"
@@ -61,11 +60,9 @@ int afb_instance::init()
int display_event_callback(sd_event_source *evs, int /*fd*/, uint32_t events,
void * /*data*/)
{
- ST();
-
if ((events & EPOLLHUP) != 0)
{
- HMI_ERROR("wm", "The compositor hung up, dying now.");
+ HMI_ERROR("The compositor hung up, dying now.");
delete g_afb_instance;
g_afb_instance = nullptr;
goto error;
@@ -74,17 +71,14 @@ int display_event_callback(sd_event_source *evs, int /*fd*/, uint32_t events,
if ((events & EPOLLIN) != 0u)
{
{
- STN(display_read_events);
g_afb_instance->wmgr.display->read_events();
g_afb_instance->wmgr.set_pending_events();
}
{
// We want do dispatch pending wayland events from within
// the API context
- STN(winman_ping_api_call);
afb_service_call("windowmanager", "ping", json_object_new_object(),
[](void *c, int st, json_object *j) {
- STN(winman_ping_api_call_return);
},
nullptr);
}
@@ -103,17 +97,17 @@ error:
int _binding_init()
{
- HMI_NOTICE("wm", "WinMan ver. %s", WINMAN_VERSION_STRING);
+ HMI_NOTICE("WinMan ver. %s", WINMAN_VERSION_STRING);
if (g_afb_instance != nullptr)
{
- HMI_ERROR("wm", "Wayland context already initialized?");
+ HMI_ERROR("Wayland context already initialized?");
return 0;
}
if (getenv("XDG_RUNTIME_DIR") == nullptr)
{
- HMI_ERROR("wm", "Environment variable XDG_RUNTIME_DIR not set");
+ HMI_ERROR("Environment variable XDG_RUNTIME_DIR not set");
goto error;
}
@@ -126,10 +120,10 @@ int _binding_init()
cnt++;
if (20 <= cnt)
{
- HMI_ERROR("wm", "Could not connect to compositor");
+ HMI_ERROR("Could not connect to compositor");
goto error;
}
- HMI_ERROR("wm", "Wait to start weston ...");
+ HMI_ERROR("Wait to start weston ...");
sleep(1);
delete g_afb_instance;
g_afb_instance = new afb_instance;
@@ -138,7 +132,7 @@ int _binding_init()
if (g_afb_instance->init() == -1)
{
- HMI_ERROR("wm", "Could not connect to compositor");
+ HMI_ERROR("Could not connect to compositor");
goto error;
}
@@ -148,7 +142,7 @@ int _binding_init()
display_event_callback, g_afb_instance);
if (ret < 0)
{
- HMI_ERROR("wm", "Could not initialize afb_instance event handler: %d", -ret);
+ HMI_ERROR("Could not initialize afb_instance event handler: %d", -ret);
goto error;
}
}
@@ -171,7 +165,7 @@ int binding_init() noexcept
}
catch (std::exception &e)
{
- HMI_ERROR("wm", "Uncaught exception in binding_init(): %s", e.what());
+ HMI_ERROR("Uncaught exception in binding_init(): %s", e.what());
}
return -1;
}
@@ -183,7 +177,7 @@ static void cbRemoveClientCtxt(void *data)
{
return;
}
- HMI_DEBUG("wm", "remove app %s", ctxt->name.c_str());
+ HMI_DEBUG("remove app %s", ctxt->name.c_str());
// Policy Manager does not know this app was killed,
// so notify it by deactivate request.
@@ -192,7 +186,7 @@ static void cbRemoveClientCtxt(void *data)
[](const char *errmsg) {
if (errmsg != nullptr)
{
- HMI_ERROR("wm", errmsg);
+ HMI_ERROR(errmsg);
return;
}
});
@@ -209,7 +203,7 @@ static void createSecurityContext(afb_req req, const char* appid, const char* ro
// Create Security Context at first time
const char *new_role = g_afb_instance->wmgr.convertRoleOldToNew(role);
WMClientCtxt *ctxt = new WMClientCtxt(appid, new_role);
- HMI_DEBUG("wm", "create session for %s", ctxt->name.c_str());
+ HMI_DEBUG("create session for %s", ctxt->name.c_str());
afb_req_session_set_LOA(req, 1);
afb_req_context_set(req, ctxt, cbRemoveClientCtxt);
}
@@ -218,9 +212,6 @@ static void createSecurityContext(afb_req req, const char* appid, const char* ro
void windowmanager_requestsurface(afb_req req) noexcept
{
std::lock_guard<std::mutex> guard(binding_m);
-#ifdef ST
- ST();
-#endif
if (g_afb_instance == nullptr)
{
afb_req_fail(req, "failed", "Binding not initialized, did the compositor die?");
@@ -259,9 +250,6 @@ void windowmanager_requestsurface(afb_req req) noexcept
void windowmanager_requestsurfacexdg(afb_req req) noexcept
{
std::lock_guard<std::mutex> guard(binding_m);
-#ifdef ST
- ST();
-#endif
if (g_afb_instance == nullptr)
{
afb_req_fail(req, "failed", "Binding not initialized, did the compositor die?");
@@ -311,9 +299,6 @@ void windowmanager_requestsurfacexdg(afb_req req) noexcept
void windowmanager_activatewindow(afb_req req) noexcept
{
std::lock_guard<std::mutex> guard(binding_m);
-#ifdef ST
- ST();
-#endif
if (g_afb_instance == nullptr)
{
afb_req_fail(req, "failed", "Binding not initialized, did the compositor die?");
@@ -342,7 +327,7 @@ void windowmanager_activatewindow(afb_req req) noexcept
[&req](const char *errmsg) {
if (errmsg != nullptr)
{
- HMI_ERROR("wm", errmsg);
+ HMI_ERROR(errmsg);
afb_req_fail(req, "failed", errmsg);
return;
}
@@ -351,7 +336,7 @@ void windowmanager_activatewindow(afb_req req) noexcept
}
catch (std::exception &e)
{
- HMI_WARNING("wm", "failed: Uncaught exception while calling activatesurface: %s", e.what());
+ HMI_WARNING("failed: Uncaught exception while calling activatesurface: %s", e.what());
g_afb_instance->wmgr.exceptionProcessForTransition();
return;
}
@@ -360,9 +345,6 @@ void windowmanager_activatewindow(afb_req req) noexcept
void windowmanager_deactivatewindow(afb_req req) noexcept
{
std::lock_guard<std::mutex> guard(binding_m);
-#ifdef ST
- ST();
-#endif
if (g_afb_instance == nullptr)
{
afb_req_fail(req, "failed", "Binding not initialized, did the compositor die?");
@@ -383,7 +365,7 @@ void windowmanager_deactivatewindow(afb_req req) noexcept
[&req](const char *errmsg) {
if (errmsg != nullptr)
{
- HMI_ERROR("wm", errmsg);
+ HMI_ERROR(errmsg);
afb_req_fail(req, "failed", errmsg);
return;
}
@@ -392,7 +374,7 @@ void windowmanager_deactivatewindow(afb_req req) noexcept
}
catch (std::exception &e)
{
- HMI_WARNING("wm", "failed: Uncaught exception while calling deactivatesurface: %s", e.what());
+ HMI_WARNING("failed: Uncaught exception while calling deactivatesurface: %s", e.what());
g_afb_instance->wmgr.exceptionProcessForTransition();
return;
}
@@ -401,9 +383,6 @@ void windowmanager_deactivatewindow(afb_req req) noexcept
void windowmanager_enddraw(afb_req req) noexcept
{
std::lock_guard<std::mutex> guard(binding_m);
-#ifdef ST
- ST();
-#endif
if (g_afb_instance == nullptr)
{
afb_req_fail(req, "failed", "Binding not initialized, did the compositor die?");
@@ -425,7 +404,7 @@ void windowmanager_enddraw(afb_req req) noexcept
}
catch (std::exception &e)
{
- HMI_WARNING("wm", "failed: Uncaught exception while calling enddraw: %s", e.what());
+ HMI_WARNING("failed: Uncaught exception while calling enddraw: %s", e.what());
g_afb_instance->wmgr.exceptionProcessForTransition();
return;
}
@@ -434,9 +413,6 @@ void windowmanager_enddraw(afb_req req) noexcept
void windowmanager_getdisplayinfo_thunk(afb_req req) noexcept
{
std::lock_guard<std::mutex> guard(binding_m);
-#ifdef ST
- ST();
-#endif
if (g_afb_instance == nullptr)
{
afb_req_fail(req, "failed", "Binding not initialized, did the compositor die?");
@@ -464,9 +440,6 @@ void windowmanager_getdisplayinfo_thunk(afb_req req) noexcept
void windowmanager_getareainfo_thunk(afb_req req) noexcept
{
std::lock_guard<std::mutex> guard(binding_m);
-#ifdef ST
- ST();
-#endif
if (g_afb_instance == nullptr)
{
afb_req_fail(req, "failed", "Binding not initialized, did the compositor die?");
@@ -504,9 +477,6 @@ void windowmanager_getareainfo_thunk(afb_req req) noexcept
void windowmanager_wm_subscribe(afb_req req) noexcept
{
std::lock_guard<std::mutex> guard(binding_m);
-#ifdef ST
- ST();
-#endif
if (g_afb_instance == nullptr)
{
afb_req_fail(req, "failed", "Binding not initialized, did the compositor die?");
@@ -543,9 +513,6 @@ void windowmanager_wm_subscribe(afb_req req) noexcept
void windowmanager_list_drawing_names(afb_req req) noexcept
{
std::lock_guard<std::mutex> guard(binding_m);
-#ifdef ST
- ST();
-#endif
if (g_afb_instance == nullptr)
{
afb_req_fail(req, "failed", "Binding not initialized, did the compositor die?");
@@ -575,9 +542,6 @@ void windowmanager_list_drawing_names(afb_req req) noexcept
void windowmanager_ping(afb_req req) noexcept
{
std::lock_guard<std::mutex> guard(binding_m);
-#ifdef ST
- ST();
-#endif
if (g_afb_instance == nullptr)
{
afb_req_fail(req, "failed", "Binding not initialized, did the compositor die?");
@@ -601,9 +565,6 @@ void windowmanager_ping(afb_req req) noexcept
void windowmanager_debug_status(afb_req req) noexcept
{
std::lock_guard<std::mutex> guard(binding_m);
-#ifdef ST
- ST();
-#endif
if (g_afb_instance == nullptr)
{
afb_req_fail(req, "failed", "Binding not initialized, did the compositor die?");
@@ -630,9 +591,6 @@ void windowmanager_debug_status(afb_req req) noexcept
void windowmanager_debug_layers(afb_req req) noexcept
{
std::lock_guard<std::mutex> guard(binding_m);
-#ifdef ST
- ST();
-#endif
if (g_afb_instance == nullptr)
{
afb_req_fail(req, "failed", "Binding not initialized, did the compositor die?");
@@ -655,9 +613,6 @@ void windowmanager_debug_layers(afb_req req) noexcept
void windowmanager_debug_surfaces(afb_req req) noexcept
{
std::lock_guard<std::mutex> guard(binding_m);
-#ifdef ST
- ST();
-#endif
if (g_afb_instance == nullptr)
{
afb_req_fail(req, "failed", "Binding not initialized, did the compositor die?");
@@ -686,9 +641,6 @@ void windowmanager_debug_surfaces(afb_req req) noexcept
void windowmanager_debug_terminate(afb_req req) noexcept
{
std::lock_guard<std::mutex> guard(binding_m);
-#ifdef ST
- ST();
-#endif
if (g_afb_instance == nullptr)
{
afb_req_fail(req, "failed", "Binding not initialized, did the compositor die?");
diff --git a/src/pm_wrapper.cpp b/src/pm_wrapper.cpp
index 1454bf9..d71e91f 100644
--- a/src/pm_wrapper.cpp
+++ b/src/pm_wrapper.cpp
@@ -16,7 +16,7 @@
#include "pm_wrapper.hpp"
#include "json_helper.hpp"
-#include "hmi-debug.h"
+#include "util.hpp"
namespace wm
{
@@ -33,7 +33,7 @@ static void onStateTransitioned(json_object *json_out)
static void onError(json_object *json_out)
{
- HMI_DEBUG("wm", "error message from PolicyManager:%s",
+ HMI_DEBUG("error message from PolicyManager:%s",
json_object_get_string(json_out));
g_context->processError();
@@ -50,7 +50,7 @@ int PMWrapper::initialize()
ret = this->pm.initialize();
if (0 > ret)
{
- HMI_ERROR("wm:pmw", "Faild to initialize PolicyManager");
+ HMI_ERROR("Faild to initialize PolicyManager");
}
g_context = this;
@@ -95,7 +95,7 @@ int PMWrapper::setInputEventData(Task task, std::string role, std::string area)
ret = this->pm.setInputEventData(json_in);
if (0 > ret)
{
- HMI_ERROR("wm:pmw", "Faild to set input event data to PolicyManager");
+ HMI_ERROR("Faild to set input event data to PolicyManager");
}
json_object_put(json_in);
@@ -108,7 +108,7 @@ int PMWrapper::executeStateTransition()
ret = this->pm.executeStateTransition();
if (0 > ret)
{
- HMI_ERROR("wm:pmw", "Failed to execute state transition for PolicyManager");
+ HMI_ERROR("Failed to execute state transition for PolicyManager");
}
return ret;
@@ -125,7 +125,7 @@ void PMWrapper::updateStates(json_object *json_out)
{
std::vector<WMAction> actions;
- HMI_DEBUG("wm", "json_out dump:%s", json_object_get_string(json_out));
+ HMI_DEBUG("json_out dump:%s", json_object_get_string(json_out));
this->createLayoutChangeAction(json_out, actions);
@@ -138,12 +138,12 @@ void PMWrapper::createLayoutChangeAction(json_object *json_out, std::vector<WMAc
json_object *json_layers;
if (!json_object_object_get_ex(json_out, "layers", &json_layers))
{
- HMI_DEBUG("wm", "Not found key \"layers\"");
+ HMI_DEBUG("Not found key \"layers\"");
return;
}
int len = json_object_array_length(json_layers);
- HMI_DEBUG("wm", "json_layers len:%d", len);
+ HMI_DEBUG("json_layers len:%d", len);
for (int i = 0; i < len; i++)
{
@@ -151,19 +151,19 @@ void PMWrapper::createLayoutChangeAction(json_object *json_out, std::vector<WMAc
std::string layer_name = jh::getStringFromJson(json_tmp, "name");
json_bool changed = jh::getBoolFromJson(json_tmp, "changed");
- HMI_DEBUG("wm", "layer:%s changed:%d", layer_name.c_str(), changed);
+ HMI_DEBUG("layer:%s changed:%d", layer_name.c_str(), changed);
if (changed)
{
json_object *json_areas;
if (!json_object_object_get_ex(json_tmp, "areas", &json_areas))
{
- HMI_DEBUG("wm", "Not found key \"areas\"");
+ HMI_DEBUG("Not found key \"areas\"");
return;
}
int len = json_object_array_length(json_areas);
- HMI_DEBUG("wm", "json_layers len:%d", len);
+ HMI_DEBUG("json_layers len:%d", len);
// Store previous role state in this layer
this->prvlayer2rolestate[layer_name] = this->crrlayer2rolestate[layer_name];
@@ -180,13 +180,13 @@ void PMWrapper::createLayoutChangeAction(json_object *json_out, std::vector<WMAc
crr_roles[role_name] = area_name;
auto i_prv = prv_roles.find(role_name);
- HMI_DEBUG("wm", "current role:%s area:%s",
+ HMI_DEBUG("current role:%s area:%s",
role_name.c_str(), area_name.c_str());
// If current role does not exist in previous
if (prv_roles.end() == i_prv)
{
- HMI_DEBUG("wm", "current role does not exist in previous");
+ HMI_DEBUG("current role does not exist in previous");
// Set activate action
bool end_draw_finished = false;
@@ -202,13 +202,13 @@ void PMWrapper::createLayoutChangeAction(json_object *json_out, std::vector<WMAc
}
else
{
- HMI_DEBUG("wm", "previous role:%s area:%s",
+ HMI_DEBUG("previous role:%s area:%s",
i_prv->first.c_str(), i_prv->second.c_str());
// If current role exists in previous and area is different with previous
if (area_name != i_prv->second)
{
- HMI_DEBUG("wm", "current role exists in previous and area is different with previous");
+ HMI_DEBUG("current role exists in previous and area is different with previous");
// Set activate action
bool end_draw_finished = false;
@@ -232,7 +232,7 @@ void PMWrapper::createLayoutChangeAction(json_object *json_out, std::vector<WMAc
// because these are not displayed in current layout
for (auto i_prv : prv_roles)
{
- HMI_DEBUG("wm", "Deactivate role:%s", i_prv.first.c_str());
+ HMI_DEBUG("Deactivate role:%s", i_prv.first.c_str());
// Set deactivate action
bool end_draw_finished = true;
diff --git a/src/util.cpp b/src/util.cpp
index 672b089..37977f2 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -16,30 +16,14 @@
#include "util.hpp"
-#include <cerrno>
-#include <cstdarg>
-#include <cstdio>
-#include <cstdlib>
-#include <ctime>
+#include <time.h>
+#include <stdio.h>
+#include <stdarg.h>
+#include <stdlib.h>
#include <unistd.h>
-#ifdef SCOPE_TRACING
-thread_local int ScopeTrace::indent = 0;
-ScopeTrace::ScopeTrace(char const *func) : f(func)
-{
- fprintf(stderr, "%lu %*s%s -->\n", pthread_self(), 2 * indent++, "", this->f);
-}
-ScopeTrace::~ScopeTrace() { fprintf(stderr, "%lu %*s%s <--\n", pthread_self(), 2 * --indent, "", this->f); }
-#endif
-
-unique_fd::~unique_fd()
-{
- if (this->fd != -1)
- {
- close(this->fd);
- }
-}
+static char ERROR_FLAG[6][20] = {"NONE", "ERROR", "WARNING", "NOTICE", "INFO", "DEBUG"};
void rectangle::fit(unsigned long to_width, unsigned long to_height)
{
@@ -93,3 +77,66 @@ void rectangle::set_aspect(double ratio)
}
}
+void _HMI_LOG(enum LOG_LEVEL level, const char* file, const char* func, const int line, const char* prefix, const char* log, ...)
+{
+ const int log_level = (getenv("USE_HMI_DEBUG") == NULL)?LOG_LEVEL_ERROR:atoi(getenv("USE_HMI_DEBUG"));
+ if(log_level < level)
+ {
+ return;
+ }
+
+ char *message;
+ struct timespec tp;
+ unsigned int time;
+
+ clock_gettime(CLOCK_REALTIME, &tp);
+ time = (tp.tv_sec * 1000000L) + (tp.tv_nsec / 1000);
+
+ va_list args;
+ va_start(args, log);
+ if (log == NULL || vasprintf(&message, log, args) < 0)
+ message = NULL;
+ fprintf(stderr, "[%10.3f] [%s %s] [%s, %s(), Line:%d] >>> %s \n", time / 1000.0, prefix, ERROR_FLAG[level], file, func, line, message);
+ va_end(args);
+ free(message);
+}
+
+void _HMI_SEQ_LOG(enum LOG_LEVEL level, const char* file, const char* func, const int line, unsigned seq_num, const char* log, ...){
+ const int log_level = (getenv("USE_HMI_DEBUG") == NULL) ? LOG_LEVEL_ERROR:atoi(getenv("USE_HMI_DEBUG"));
+ if(log_level < level)
+ {
+ return;
+ }
+
+ char *message;
+ struct timespec tp;
+ unsigned int time;
+
+ clock_gettime(CLOCK_REALTIME, &tp);
+ time = (tp.tv_sec * 1000000L) + (tp.tv_nsec / 1000);
+
+ va_list args;
+ va_start(args, log);
+ if (log == NULL || vasprintf(&message, log, args) < 0)
+ message = NULL;
+ fprintf(stderr, "[%10.3f] [wm %s] [%s, %s(), Line:%d] >>> req %d: %s \n", time / 1000.0, ERROR_FLAG[level], file, func, line, seq_num, message);
+ va_end(args);
+ free(message);
+}
+
+void _DUMP(enum LOG_LEVEL level, const char *log, ...)
+{
+ const int log_level = (getenv("USE_HMI_DEBUG") == NULL) ? LOG_LEVEL_ERROR : atoi(getenv("USE_HMI_DEBUG"));
+ if (log_level < level)
+ {
+ return;
+ }
+ char *message;
+ va_list args;
+ va_start(args, log);
+ if (log == NULL || vasprintf(&message, log, args) < 0)
+ message = NULL;
+ fprintf(stderr, "%s \n", message);
+ va_end(args);
+ free(message);
+} \ No newline at end of file
diff --git a/src/util.hpp b/src/util.hpp
index 2f17845..812a130 100644
--- a/src/util.hpp
+++ b/src/util.hpp
@@ -19,75 +19,38 @@
#include <functional>
#include <thread>
-#include <vector>
-
#include <sys/poll.h>
-
-#ifndef DO_NOT_USE_AFB
-extern "C"
-{
-#include <afb/afb-binding.h>
+#include <string.h>
+
+#define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
+
+#define HMI_ERROR(args,...) _HMI_LOG(LOG_LEVEL_ERROR, __FILENAME__, __FUNCTION__, __LINE__,"wm",args, ##__VA_ARGS__)
+#define HMI_WARNING(args,...) _HMI_LOG(LOG_LEVEL_WARNING, __FILENAME__, __FUNCTION__,__LINE__, "wm", args,##__VA_ARGS__)
+#define HMI_NOTICE(args,...) _HMI_LOG(LOG_LEVEL_NOTICE, __FILENAME__, __FUNCTION__,__LINE__, "wm", args,##__VA_ARGS__)
+#define HMI_INFO(args,...) _HMI_LOG(LOG_LEVEL_INFO, __FILENAME__, __FUNCTION__,__LINE__, "wm", args,##__VA_ARGS__)
+#define HMI_DEBUG(args,...) _HMI_LOG(LOG_LEVEL_DEBUG, __FILENAME__, __FUNCTION__,__LINE__, "wm", args,##__VA_ARGS__)
+
+#define HMI_SEQ_ERROR(seq_num, args,...) _HMI_SEQ_LOG(LOG_LEVEL_ERROR, __FILENAME__, __FUNCTION__, __LINE__, seq_num, args, ##__VA_ARGS__)
+#define HMI_SEQ_WARNING(seq_num, args,...) _HMI_SEQ_LOG(LOG_LEVEL_WARNING, __FILENAME__, __FUNCTION__, __LINE__, seq_num, args, ##__VA_ARGS__)
+#define HMI_SEQ_NOTICE(seq_num, args,...) _HMI_SEQ_LOG(LOG_LEVEL_NOTICE, __FILENAME__, __FUNCTION__, __LINE__, seq_num, args, ##__VA_ARGS__)
+#define HMI_SEQ_INFO(seq_num, args,...) _HMI_SEQ_LOG(LOG_LEVEL_INFO, __FILENAME__, __FUNCTION__, __LINE__, seq_num, args, ##__VA_ARGS__)
+#define HMI_SEQ_DEBUG(seq_num, args,...) _HMI_SEQ_LOG(LOG_LEVEL_DEBUG, __FILENAME__, __FUNCTION__, __LINE__, seq_num, args, ##__VA_ARGS__)
+
+#define DUMP(args, ...) _DUMP(LOG_LEVEL_DEBUG, args, ##__VA_ARGS__)
+
+enum LOG_LEVEL{
+ LOG_LEVEL_NONE = 0,
+ LOG_LEVEL_ERROR,
+ LOG_LEVEL_WARNING,
+ LOG_LEVEL_NOTICE,
+ LOG_LEVEL_INFO,
+ LOG_LEVEL_DEBUG,
+ LOG_LEVEL_MAX = LOG_LEVEL_DEBUG
};
-#endif
-
-#define CONCAT_(X, Y) X##Y
-#define CONCAT(X, Y) CONCAT_(X, Y)
-
-#ifdef __GNUC__
-#define ATTR_FORMAT(stringindex, firsttocheck) \
- __attribute__((format(printf, stringindex, firsttocheck)))
-#define ATTR_NORETURN __attribute__((noreturn))
-#else
-#define ATTR_FORMAT(stringindex, firsttocheck)
-#define ATTR_NORETURN
-#endif
-
-#ifdef AFB_BINDING_VERSION
-#define lognotice(...) AFB_NOTICE(__VA_ARGS__)
-#define logerror(...) AFB_ERROR(__VA_ARGS__)
-#define fatal(...) \
- do \
- { \
- AFB_ERROR(__VA_ARGS__); \
- abort(); \
- } while (0)
-#else
-#define lognotice(...)
-#define logerror(...)
-#define fatal(...) \
- do \
- { \
- abort(); \
- } while (0)
-#endif
-
-#ifdef DEBUG_OUTPUT
-#ifdef AFB_BINDING_VERSION
-#define logdebug(...) AFB_DEBUG(__VA_ARGS__)
-#else
-#define logdebug(...)
-#endif
-#else
-#define logdebug(...)
-#endif
-
-#ifndef SCOPE_TRACING
-#define ST()
-#define STN(N)
-#else
-#define ST() \
- ScopeTrace __attribute__((unused)) CONCAT(trace_scope_, __LINE__)(__func__)
-#define STN(N) \
- ScopeTrace __attribute__((unused)) CONCAT(named_trace_scope_, __LINE__)(#N)
-
-struct ScopeTrace
-{
- thread_local static int indent;
- char const *f{};
- explicit ScopeTrace(char const *func);
- ~ScopeTrace();
-};
-#endif
+
+void _HMI_LOG(enum LOG_LEVEL level, const char* file, const char* func, const int line, const char* prefix, const char* log, ...);
+void _HMI_SEQ_LOG(enum LOG_LEVEL level, const char* file, const char* func, const int line, unsigned seq_num, const char* log, ...);
+void _DUMP(enum LOG_LEVEL level, const char *log, ...);
/**
* @struct unique_fd
diff --git a/src/wayland_ivi_wm.cpp b/src/wayland_ivi_wm.cpp
index 8b04c64..bbf745b 100644
--- a/src/wayland_ivi_wm.cpp
+++ b/src/wayland_ivi_wm.cpp
@@ -15,7 +15,6 @@
*/
#include "wayland_ivi_wm.hpp"
-#include "hmi-debug.h"
/**
* namespace wl
@@ -41,10 +40,8 @@ int display::dispatch_pending() { return wl_display_dispatch_pending(this->d.get
int display::read_events()
{
- ST();
while (wl_display_prepare_read(this->d.get()) == -1)
{
- STN(pending_events_dispatch);
if (wl_display_dispatch_pending(this->d.get()) == -1)
{
return -1;
@@ -112,7 +109,7 @@ void registry::global_created(uint32_t name, char const *iface, uint32_t v)
{
b->second(this->proxy.get(), name, v);
}
- HMI_DEBUG("wm", "wl::registry @ %p global n %u i %s v %u", this->proxy.get(), name,
+ HMI_DEBUG("wl::registry @ %p global n %u i %s v %u", this->proxy.get(), name,
iface, v);
}
@@ -163,8 +160,7 @@ void output::geometry(int32_t x, int32_t y, int32_t pw, int32_t ph,
int32_t subpel, char const *make, char const *model,
int32_t tx)
{
- HMI_DEBUG("wm",
- "wl::output %s @ %p x %i y %i w %i h %i spel %x make %s model %s tx %i",
+ HMI_DEBUG("wl::output %s @ %p x %i y %i w %i h %i spel %x make %s model %s tx %i",
__func__, this->proxy.get(), x, y, pw, ph, subpel, make, model, tx);
this->physical_width = pw;
this->physical_height = ph;
@@ -173,7 +169,7 @@ void output::geometry(int32_t x, int32_t y, int32_t pw, int32_t ph,
void output::mode(uint32_t flags, int32_t w, int32_t h, int32_t r)
{
- HMI_DEBUG("wm", "wl::output %s @ %p f %x w %i h %i r %i", __func__,
+ HMI_DEBUG("wl::output %s @ %p f %x w %i h %i r %i", __func__,
this->proxy.get(), flags, w, h, r);
if ((flags & WL_OUTPUT_MODE_CURRENT) != 0u)
{
@@ -185,7 +181,7 @@ void output::mode(uint32_t flags, int32_t w, int32_t h, int32_t r)
void output::done()
{
- HMI_DEBUG("wm", "wl::output %s @ %p done", __func__, this->proxy.get());
+ HMI_DEBUG("wl::output %s @ %p done", __func__, this->proxy.get());
// Pivot and flipped
if (this->transform == WL_OUTPUT_TRANSFORM_90 ||
this->transform == WL_OUTPUT_TRANSFORM_270 ||
@@ -199,7 +195,7 @@ void output::done()
void output::scale(int32_t factor)
{
- HMI_DEBUG("wm", "wl::output %s @ %p f %i", __func__, this->proxy.get(), factor);
+ HMI_DEBUG("wl::output %s @ %p f %i", __func__, this->proxy.get(), factor);
}
} // namespace wl
@@ -363,14 +359,14 @@ void layer_added(void *data,
struct ivi_wm_screen *ivi_wm_screen,
uint32_t layer_id)
{
- HMI_DEBUG("wm", "added layer_id:%d", layer_id);
+ HMI_DEBUG("added layer_id:%d", layer_id);
}
void connector_name(void *data,
struct ivi_wm_screen *ivi_wm_screen,
const char *process_name)
{
- HMI_DEBUG("wm", "process_name:%s", process_name);
+ HMI_DEBUG("process_name:%s", process_name);
}
void screen_error(void *data,
@@ -378,7 +374,7 @@ void screen_error(void *data,
uint32_t error,
const char *message)
{
- HMI_DEBUG("wm", "screen error:%d message:%s", error, message);
+ HMI_DEBUG("screen error:%d message:%s", error, message);
}
constexpr struct ivi_wm_screen_listener screen_listener = {
@@ -400,7 +396,7 @@ surface::surface(uint32_t i, struct controller *c)
void surface::set_visibility(uint32_t visibility)
{
- HMI_DEBUG("wm", "compositor::surface id:%d v:%d", this->id, visibility);
+ HMI_DEBUG("compositor::surface id:%d v:%d", this->id, visibility);
ivi_wm_set_surface_visibility(this->parent->proxy.get(), this->id, visibility);
}
@@ -459,7 +455,7 @@ screen::screen(uint32_t i, struct controller *c, struct wl_output *o)
: wayland_proxy(ivi_wm_create_screen(c->proxy.get(), o)),
controller_child(c, i)
{
- HMI_DEBUG("wm", "compositor::screen @ %p id %u o %p", this->proxy.get(), i, o);
+ HMI_DEBUG("compositor::screen @ %p id %u o %p", this->proxy.get(), i, o);
// Add listener for screen
ivi_wm_screen_add_listener(this->proxy.get(), &screen_listener, this);
@@ -469,7 +465,7 @@ void screen::clear() { ivi_wm_screen_clear(this->proxy.get()); }
void screen::screen_created(struct screen *screen, uint32_t id)
{
- HMI_DEBUG("wm", "compositor::screen @ %p screen %u (%x) @ %p", this->proxy.get(),
+ HMI_DEBUG("compositor::screen @ %p screen %u (%x) @ %p", this->proxy.get(),
id, id, screen);
this->id = id;
this->parent->screens[id] = screen;
@@ -484,7 +480,7 @@ void screen::set_render_order(std::vector<uint32_t> const &ro)
for (i = 0; i < ro.size(); i++)
{
- HMI_DEBUG("wm", "compositor::screen @ %p add layer %u", this->proxy.get(), ro[i]);
+ HMI_DEBUG("compositor::screen @ %p add layer %u", this->proxy.get(), ro[i]);
// Add the layer to screen render order at nearest z-position
ivi_wm_screen_add_layer(this->proxy.get(), ro[i]);
}
@@ -538,10 +534,10 @@ void controller::get_surface_properties(uint32_t surface_id, int param)
void controller::layer_created(uint32_t id)
{
- HMI_DEBUG("wm", "compositor::controller @ %p layer %u (%x)", this->proxy.get(), id, id);
+ HMI_DEBUG("compositor::controller @ %p layer %u (%x)", this->proxy.get(), id, id);
if (this->layers.find(id) != this->layers.end())
{
- HMI_DEBUG("wm", "WindowManager has created layer %u (%x) already", id, id);
+ HMI_DEBUG("WindowManager has created layer %u (%x) already", id, id);
}
else
{
@@ -552,13 +548,13 @@ void controller::layer_created(uint32_t id)
void controller::layer_error_detected(uint32_t object_id,
uint32_t error_code, const char *error_text)
{
- HMI_DEBUG("wm", "compositor::controller @ %p error o %d c %d text %s",
+ HMI_DEBUG("compositor::controller @ %p error o %d c %d text %s",
this->proxy.get(), object_id, error_code, error_text);
}
void controller::surface_visibility_changed(uint32_t id, int32_t visibility)
{
- HMI_DEBUG("wm", "compositor::surface %s @ %d v %i", __func__, id,
+ HMI_DEBUG("compositor::surface %s @ %d v %i", __func__, id,
visibility);
this->sprops[id].visibility = visibility;
this->chooks->surface_visibility(id, visibility);
@@ -566,7 +562,7 @@ void controller::surface_visibility_changed(uint32_t id, int32_t visibility)
void controller::surface_opacity_changed(uint32_t id, float opacity)
{
- HMI_DEBUG("wm", "compositor::surface %s @ %d o %f",
+ HMI_DEBUG("compositor::surface %s @ %d o %f",
__func__, id, opacity);
this->sprops[id].opacity = opacity;
}
@@ -575,7 +571,7 @@ void controller::surface_source_rectangle_changed(uint32_t id, int32_t x,
int32_t y, int32_t width,
int32_t height)
{
- HMI_DEBUG("wm", "compositor::surface %s @ %d x %i y %i w %i h %i", __func__,
+ HMI_DEBUG("compositor::surface %s @ %d x %i y %i w %i h %i", __func__,
id, x, y, width, height);
this->sprops[id].src_rect = rect{width, height, x, y};
}
@@ -584,7 +580,7 @@ void controller::surface_destination_rectangle_changed(uint32_t id, int32_t x,
int32_t y, int32_t width,
int32_t height)
{
- HMI_DEBUG("wm", "compositor::surface %s @ %d x %i y %i w %i h %i", __func__,
+ HMI_DEBUG("compositor::surface %s @ %d x %i y %i w %i h %i", __func__,
id, x, y, width, height);
this->sprops[id].dst_rect = rect{width, height, x, y};
this->chooks->surface_destination_rectangle(id, x, y, width, height);
@@ -593,7 +589,7 @@ void controller::surface_destination_rectangle_changed(uint32_t id, int32_t x,
void controller::surface_size_changed(uint32_t id, int32_t width,
int32_t height)
{
- HMI_DEBUG("wm", "compositor::surface %s @ %d w %i h %i", __func__, id,
+ HMI_DEBUG("compositor::surface %s @ %d w %i h %i", __func__, id,
width, height);
this->sprops[id].size = size{uint32_t(width), uint32_t(height)};
this->surfaces[id]->set_source_rectangle(0, 0, width, height);
@@ -601,20 +597,20 @@ void controller::surface_size_changed(uint32_t id, int32_t width,
void controller::surface_added_to_layer(uint32_t layer_id, uint32_t surface_id)
{
- HMI_DEBUG("wm", "compositor::surface %s @ %d l %u",
+ HMI_DEBUG("compositor::surface %s @ %d l %u",
__func__, layer_id, surface_id);
}
void controller::surface_stats_received(uint32_t surface_id,
uint32_t frame_count, uint32_t pid)
{
- HMI_DEBUG("wm", "compositor::surface %s @ %d f %u pid %u",
+ HMI_DEBUG("compositor::surface %s @ %d f %u pid %u",
__func__, surface_id, frame_count, pid);
}
void controller::surface_created(uint32_t id)
{
- HMI_DEBUG("wm", "compositor::controller @ %p surface %u (%x)", this->proxy.get(), id,
+ HMI_DEBUG("compositor::controller @ %p surface %u (%x)", this->proxy.get(), id,
id);
if (this->surfaces.find(id) == this->surfaces.end())
{
@@ -632,7 +628,7 @@ void controller::surface_created(uint32_t id)
void controller::surface_destroyed(uint32_t surface_id)
{
- HMI_DEBUG("wm", "compositor::surface %s @ %d", __func__, surface_id);
+ HMI_DEBUG("compositor::surface %s @ %d", __func__, surface_id);
this->chooks->surface_removed(surface_id);
this->sprops.erase(surface_id);
this->surfaces.erase(surface_id);
@@ -641,19 +637,19 @@ void controller::surface_destroyed(uint32_t surface_id)
void controller::surface_error_detected(uint32_t object_id,
uint32_t error_code, const char *error_text)
{
- HMI_DEBUG("wm", "compositor::controller @ %p error o %d c %d text %s",
+ HMI_DEBUG("compositor::controller @ %p error o %d c %d text %s",
this->proxy.get(), object_id, error_code, error_text);
}
void controller::layer_visibility_changed(uint32_t layer_id, int32_t visibility)
{
- HMI_DEBUG("wm", "compositor::layer %s @ %d v %i", __func__, layer_id, visibility);
+ HMI_DEBUG("compositor::layer %s @ %d v %i", __func__, layer_id, visibility);
this->lprops[layer_id].visibility = visibility;
}
void controller::layer_opacity_changed(uint32_t layer_id, float opacity)
{
- HMI_DEBUG("wm", "compositor::layer %s @ %d o %f", __func__, layer_id, opacity);
+ HMI_DEBUG("compositor::layer %s @ %d o %f", __func__, layer_id, opacity);
this->lprops[layer_id].opacity = opacity;
}
@@ -661,7 +657,7 @@ void controller::layer_source_rectangle_changed(uint32_t layer_id,
int32_t x, int32_t y,
int32_t width, int32_t height)
{
- HMI_DEBUG("wm", "compositor::layer %s @ %d x %i y %i w %i h %i",
+ HMI_DEBUG("compositor::layer %s @ %d x %i y %i w %i h %i",
__func__, layer_id, x, y, width, height);
this->lprops[layer_id].src_rect = rect{width, height, x, y};
}
@@ -670,14 +666,14 @@ void controller::layer_destination_rectangle_changed(uint32_t layer_id,
int32_t x, int32_t y,
int32_t width, int32_t height)
{
- HMI_DEBUG("wm", "compositor::layer %s @ %d x %i y %i w %i h %i",
+ HMI_DEBUG("compositor::layer %s @ %d x %i y %i w %i h %i",
__func__, layer_id, x, y, width, height);
this->lprops[layer_id].dst_rect = rect{width, height, x, y};
}
void controller::layer_destroyed(uint32_t layer_id)
{
- HMI_DEBUG("wm", "compositor::layer %s @ %d", __func__, layer_id);
+ HMI_DEBUG("compositor::layer %s @ %d", __func__, layer_id);
this->lprops.erase(layer_id);
this->layers.erase(layer_id);
}
@@ -685,40 +681,40 @@ void controller::layer_destroyed(uint32_t layer_id)
void controller::add_proxy_to_sid_mapping(struct ivi_wm *p,
uint32_t id)
{
- HMI_DEBUG("wm", "Add surface proxy mapping for %p (%u)", p, id);
+ HMI_DEBUG("Add surface proxy mapping for %p (%u)", p, id);
this->surface_proxy_to_id[uintptr_t(p)] = id;
this->sprops[id].id = id;
}
void controller::remove_proxy_to_sid_mapping(struct ivi_wm *p)
{
- HMI_DEBUG("wm", "Remove surface proxy mapping for %p", p);
+ HMI_DEBUG("Remove surface proxy mapping for %p", p);
this->surface_proxy_to_id.erase(uintptr_t(p));
}
void controller::add_proxy_to_lid_mapping(struct ivi_wm *p,
uint32_t id)
{
- HMI_DEBUG("wm", "Add layer proxy mapping for %p (%u)", p, id);
+ HMI_DEBUG("Add layer proxy mapping for %p (%u)", p, id);
this->layer_proxy_to_id[uintptr_t(p)] = id;
this->lprops[id].id = id;
}
void controller::remove_proxy_to_lid_mapping(struct ivi_wm *p)
{
- HMI_DEBUG("wm", "Remove layer proxy mapping for %p", p);
+ HMI_DEBUG("Remove layer proxy mapping for %p", p);
this->layer_proxy_to_id.erase(uintptr_t(p));
}
void controller::add_proxy_to_id_mapping(struct wl_output *p, uint32_t id)
{
- HMI_DEBUG("wm", "Add screen proxy mapping for %p (%u)", p, id);
+ HMI_DEBUG("Add screen proxy mapping for %p (%u)", p, id);
this->screen_proxy_to_id[uintptr_t(p)] = id;
}
void controller::remove_proxy_to_id_mapping(struct wl_output *p)
{
- HMI_DEBUG("wm", "Remove screen proxy mapping for %p", p);
+ HMI_DEBUG("Remove screen proxy mapping for %p", p);
this->screen_proxy_to_id.erase(uintptr_t(p));
}
diff --git a/src/window_manager.cpp b/src/window_manager.cpp
index 42930dc..a852529 100644
--- a/src/window_manager.cpp
+++ b/src/window_manager.cpp
@@ -68,7 +68,7 @@ result<json> file_to_json(char const *filename)
std::ifstream i(filename);
if (i.fail())
{
- HMI_DEBUG("wm", "Could not open config file, so use default layer information");
+ HMI_DEBUG("Could not open config file, so use default layer information");
j = default_layers_json;
}
else
@@ -81,7 +81,7 @@ result<json> file_to_json(char const *filename)
struct result<layer_map> load_layer_map(char const *filename)
{
- HMI_DEBUG("wm", "loading IDs from %s", filename);
+ HMI_DEBUG("loading IDs from %s", filename);
auto j = file_to_json(filename);
if (j.is_err())
@@ -95,7 +95,7 @@ struct result<layer_map> load_layer_map(char const *filename)
static int processTimerHandler(sd_event_source *s, uint64_t usec, void *userdata)
{
- HMI_NOTICE("wm", "Time out occurs because the client replys endDraw slow, so revert the request");
+ HMI_NOTICE("Time out occurs because the client replys endDraw slow, so revert the request");
reinterpret_cast<wm::WindowManager *>(userdata)->timerHandler();
return 0;
}
@@ -127,7 +127,7 @@ WindowManager::WindowManager(wl::display *d)
std::string path;
if (!path_layers_json)
{
- HMI_ERROR("wm", "AFM_APP_INSTALL_DIR is not defined");
+ HMI_ERROR("AFM_APP_INSTALL_DIR is not defined");
path = std::string(path_layers_json);
}
else
@@ -145,13 +145,13 @@ WindowManager::WindowManager(wl::display *d)
}
else
{
- HMI_ERROR("wm", "%s", l.err().value());
+ HMI_ERROR("%s", l.err().value());
}
}
}
catch (std::exception &e)
{
- HMI_ERROR("wm", "Loading of configuration failed: %s", e.what());
+ HMI_ERROR("Loading of configuration failed: %s", e.what());
}
}
@@ -164,7 +164,7 @@ int WindowManager::init()
if (this->layers.mapping.empty())
{
- HMI_ERROR("wm", "No surface -> layer mapping loaded");
+ HMI_ERROR("No surface -> layer mapping loaded");
return -1;
}
@@ -252,7 +252,7 @@ result<int> WindowManager::api_request_surface(char const *appid, char const *dr
* register drawing_name as fallback and make it displayed.
*/
lid = this->layers.get_layer_id(std::string("fallback"));
- HMI_DEBUG("wm", "%s is not registered in layers.json, then fallback as normal app", role);
+ HMI_DEBUG("%s is not registered in layers.json, then fallback as normal app", role);
if (!lid)
{
return Err<int>("Drawing name does not match any role, fallback is disabled");
@@ -271,7 +271,7 @@ result<int> WindowManager::api_request_surface(char const *appid, char const *dr
this->layers.main_surface_name == drawing_name)
{
this->layers.main_surface = id;
- HMI_DEBUG("wm", "Set main_surface id to %u", id);
+ HMI_DEBUG("Set main_surface id to %u", id);
}
// add client into the db
@@ -291,8 +291,6 @@ result<int> WindowManager::api_request_surface(char const *appid, char const *dr
char const *WindowManager::api_request_surface(char const *appid, char const *drawing_name,
char const *ivi_id)
{
- ST();
-
// TODO: application requests by old role,
// so convert role old to new
const char *role = this->convertRoleOldToNew(drawing_name);
@@ -306,7 +304,7 @@ char const *WindowManager::api_request_surface(char const *appid, char const *dr
* register drawing_name as fallback and make it displayed.
*/
lid = this->layers.get_layer_id(std::string("fallback"));
- HMI_DEBUG("wm", "%s is not registered in layers.json, then fallback as normal app", role);
+ HMI_DEBUG("%s is not registered in layers.json, then fallback as normal app", role);
if (!lid)
{
return "Drawing name does not match any role, fallback is disabled";
@@ -325,7 +323,7 @@ char const *WindowManager::api_request_surface(char const *appid, char const *dr
this->layers.add_surface(sid, *lid);
// this surface is already created
- HMI_DEBUG("wm", "surface_id is %u, layer_id is %u", sid, *lid);
+ HMI_DEBUG("surface_id is %u, layer_id is %u", sid, *lid);
this->controller->layers[*lid]->add_surface(sid);
this->layout_commit();
@@ -343,8 +341,6 @@ char const *WindowManager::api_request_surface(char const *appid, char const *dr
void WindowManager::api_activate_surface(char const *appid, char const *drawing_name,
char const *drawing_area, const reply_func &reply)
{
- ST();
-
// TODO: application requests by old role,
// so convert role old to new
const char *c_role = this->convertRoleOldToNew(drawing_name);
@@ -360,7 +356,7 @@ void WindowManager::api_activate_surface(char const *appid, char const *drawing_
if(ret != WMError::SUCCESS)
{
- HMI_ERROR("wm", errorDescription(ret));
+ HMI_ERROR(errorDescription(ret));
reply("Failed to set request");
return;
}
@@ -390,8 +386,6 @@ void WindowManager::api_activate_surface(char const *appid, char const *drawing_
void WindowManager::api_deactivate_surface(char const *appid, char const *drawing_name,
const reply_func &reply)
{
- ST();
-
// TODO: application requests by old role,
// so convert role old to new
const char *c_role = this->convertRoleOldToNew(drawing_name);
@@ -410,7 +404,7 @@ void WindowManager::api_deactivate_surface(char const *appid, char const *drawin
if (ret != WMError::SUCCESS)
{
- HMI_ERROR("wm", errorDescription(ret));
+ HMI_ERROR(errorDescription(ret));
reply("Failed to set request");
return;
}
@@ -450,7 +444,7 @@ void WindowManager::api_enddraw(char const *appid, char const *drawing_name)
if (!result)
{
- HMI_ERROR("wm", "%s is not in transition state", id.c_str());
+ HMI_ERROR("%s is not in transition state", id.c_str());
return;
}
@@ -504,7 +498,7 @@ result<json_object *> WindowManager::api_get_display_info()
result<json_object *> WindowManager::api_get_area_info(char const *drawing_name)
{
- HMI_DEBUG("wm", "called");
+ HMI_DEBUG("called");
// TODO: application requests by old role,
// so convert role old to new
@@ -543,7 +537,7 @@ void WindowManager::api_ping() { this->dispatch_pending_events(); }
void WindowManager::send_event(char const *evname, char const *label)
{
- HMI_DEBUG("wm", "%s: %s(%s)", __func__, evname, label);
+ HMI_DEBUG("%s: %s(%s)", __func__, evname, label);
json_object *j = json_object_new_object();
json_object_object_add(j, kKeyDrawingName, json_object_new_string(label));
@@ -551,14 +545,14 @@ void WindowManager::send_event(char const *evname, char const *label)
int ret = afb_event_push(this->map_afb_event[evname], j);
if (ret != 0)
{
- HMI_DEBUG("wm", "afb_event_push failed: %m");
+ HMI_DEBUG("afb_event_push failed: %m");
}
}
void WindowManager::send_event(char const *evname, char const *label, char const *area,
int x, int y, int w, int h)
{
- HMI_DEBUG("wm", "%s: %s(%s, %s) x:%d y:%d w:%d h:%d",
+ HMI_DEBUG("%s: %s(%s, %s) x:%d y:%d w:%d h:%d",
__func__, evname, label, area, x, y, w, h);
json_object *j_rect = json_object_new_object();
@@ -575,7 +569,7 @@ void WindowManager::send_event(char const *evname, char const *label, char const
int ret = afb_event_push(this->map_afb_event[evname], j);
if (ret != 0)
{
- HMI_DEBUG("wm", "afb_event_push failed: %m");
+ HMI_DEBUG("afb_event_push failed: %m");
}
}
@@ -589,12 +583,12 @@ void WindowManager::surface_created(uint32_t surface_id)
auto layer_id = this->layers.get_layer_id(surface_id);
if (!layer_id)
{
- HMI_DEBUG("wm", "Newly created surfce %d is not associated with any layer!",
+ HMI_DEBUG("Newly created surfce %d is not associated with any layer!",
surface_id);
return;
}
- HMI_DEBUG("wm", "surface_id is %u, layer_id is %u", surface_id, *layer_id);
+ HMI_DEBUG("surface_id is %u, layer_id is %u", surface_id, *layer_id);
this->controller->layers[*layer_id]->add_surface(surface_id);
this->layout_commit();
@@ -602,7 +596,7 @@ void WindowManager::surface_created(uint32_t surface_id)
void WindowManager::surface_removed(uint32_t surface_id)
{
- HMI_DEBUG("wm", "Delete surface_id %u", surface_id);
+ HMI_DEBUG("Delete surface_id %u", surface_id);
this->id_alloc.remove_id(surface_id);
this->layers.remove_surface(surface_id);
g_app_list.removeSurface(surface_id);
@@ -610,7 +604,7 @@ void WindowManager::surface_removed(uint32_t surface_id)
void WindowManager::removeClient(const std::string &appid)
{
- HMI_DEBUG("wm", "Remove clinet %s from list", appid.c_str());
+ HMI_DEBUG("Remove clinet %s from list", appid.c_str());
g_app_list.removeClient(appid);
}
@@ -751,13 +745,13 @@ int WindowManager::init_layers()
{
if (!this->controller)
{
- HMI_ERROR("wm", "ivi_controller global not available");
+ HMI_ERROR("ivi_controller global not available");
return -1;
}
if (this->outputs.empty())
{
- HMI_ERROR("wm", "no output was set up!");
+ HMI_ERROR("no output was set up!");
return -1;
}
@@ -773,7 +767,7 @@ int WindowManager::init_layers()
uint32_t(o->physical_height)};
- HMI_DEBUG("wm", "SCALING: screen (%dx%d), physical (%dx%d)",
+ HMI_DEBUG("SCALING: screen (%dx%d), physical (%dx%d)",
o->width, o->height, o->physical_width, o->physical_height);
this->layers.loadAreaDb();
@@ -784,7 +778,7 @@ int WindowManager::init_layers()
dp_bg.set_aspect(static_cast<double>(css_bg.w) / css_bg.h);
dp_bg.fit(o->width, o->height);
dp_bg.center(o->width, o->height);
- HMI_DEBUG("wm", "SCALING: CSS BG(%dx%d) -> DDP %dx%d,(%dx%d)",
+ HMI_DEBUG("SCALING: CSS BG(%dx%d) -> DDP %dx%d,(%dx%d)",
css_bg.w, css_bg.h, dp_bg.left(), dp_bg.top(), dp_bg.width(), dp_bg.height());
// Clear scene
@@ -800,7 +794,7 @@ int WindowManager::init_layers()
auto &l = layers[i.second.layer_id];
l->set_destination_rectangle(dp_bg.left(), dp_bg.top(), dp_bg.width(), dp_bg.height());
l->set_visibility(1);
- HMI_DEBUG("wm", "Setting up layer %s (%d) for surface role match \"%s\"",
+ HMI_DEBUG("Setting up layer %s (%d) for surface role match \"%s\"",
i.second.name.c_str(), i.second.layer_id, i.second.role.c_str());
}
@@ -819,7 +813,7 @@ void WindowManager::surface_set_layout(int surface_id, const std::string& area)
{
if (!this->controller->surface_exists(surface_id))
{
- HMI_ERROR("wm", "Surface %d does not exist", surface_id);
+ HMI_ERROR("Surface %d does not exist", surface_id);
return;
}
@@ -827,7 +821,7 @@ void WindowManager::surface_set_layout(int surface_id, const std::string& area)
if (!o_layer_id)
{
- HMI_ERROR("wm", "Surface %d is not associated with any layer!", surface_id);
+ HMI_ERROR("Surface %d is not associated with any layer!", surface_id);
return;
}
@@ -844,7 +838,7 @@ void WindowManager::surface_set_layout(int surface_id, const std::string& area)
int w = rect.w;
int h = rect.h;
- HMI_DEBUG("wm", "surface_set_layout for surface %u on layer %u", surface_id,
+ HMI_DEBUG("surface_set_layout for surface %u on layer %u", surface_id,
layer_id);
// set destination to the display rectangle
@@ -856,7 +850,7 @@ void WindowManager::surface_set_layout(int surface_id, const std::string& area)
this->area_info[surface_id].w = w;
this->area_info[surface_id].h = h;
- HMI_DEBUG("wm", "Surface %u now on layer %u with rect { %d, %d, %d, %d }",
+ HMI_DEBUG("Surface %u now on layer %u with rect { %d, %d, %d, %d }",
surface_id, layer_id, x, y, w, h);
}
@@ -928,16 +922,16 @@ void WindowManager::activate(int id)
this->surface_bg.erase(i);
// Remove from BG layer (999)
- HMI_DEBUG("wm", "Remove %s(%d) from BG layer", label, id);
+ HMI_DEBUG("Remove %s(%d) from BG layer", label, id);
this->controller->layers[999]->remove_surface(id);
// Add to FG layer (1001)
- HMI_DEBUG("wm", "Add %s(%d) to FG layer", label, id);
+ HMI_DEBUG("Add %s(%d) to FG layer", label, id);
this->controller->layers[1001]->add_surface(id);
for (int j : this->surface_bg)
{
- HMI_DEBUG("wm", "Stored id:%d", j);
+ HMI_DEBUG("Stored id:%d", j);
}
break;
}
@@ -975,16 +969,16 @@ void WindowManager::deactivate(int id)
this->surface_bg.push_back(id);
// Remove from FG layer (1001)
- HMI_DEBUG("wm", "Remove %s(%d) from FG layer", label, id);
+ HMI_DEBUG("Remove %s(%d) from FG layer", label, id);
this->controller->layers[1001]->remove_surface(id);
// Add to BG layer (999)
- HMI_DEBUG("wm", "Add %s(%d) to BG layer", label, id);
+ HMI_DEBUG("Add %s(%d) to BG layer", label, id);
this->controller->layers[999]->add_surface(id);
for (int j : surface_bg)
{
- HMI_DEBUG("wm", "Stored id:%d", j);
+ HMI_DEBUG("Stored id:%d", j);
}
}
else
@@ -1281,7 +1275,7 @@ void WindowManager::emitScreenUpdated(unsigned req_num)
this->map_afb_event[kListEventName[Event_ScreenUpdated]], j);
if (ret != 0)
{
- HMI_DEBUG("wm", "afb_event_push failed: %m");
+ HMI_DEBUG("afb_event_push failed: %m");
}
}
@@ -1289,7 +1283,7 @@ void WindowManager::setTimer()
{
struct timespec ts;
if (clock_gettime(CLOCK_BOOTTIME, &ts) != 0) {
- HMI_ERROR("wm", "Could't set time (clock_gettime() returns with error");
+ HMI_ERROR("Could't set time (clock_gettime() returns with error");
return;
}
@@ -1301,7 +1295,7 @@ void WindowManager::setTimer()
CLOCK_BOOTTIME, (uint64_t)(ts.tv_sec + kTimeOut) * 1000000ULL, 1, processTimerHandler, this);
if (ret < 0)
{
- HMI_ERROR("wm", "Could't set timer");
+ HMI_ERROR("Could't set timer");
}
}
else
@@ -1364,7 +1358,7 @@ const char* WindowManager::convertRoleOldToNew(char const *old_role)
new_role = old_role;
}
- HMI_DEBUG("wm", "old:%s -> new:%s", old_role, new_role);
+ HMI_DEBUG("old:%s -> new:%s", old_role, new_role);
return new_role;
}
@@ -1373,12 +1367,12 @@ int WindowManager::loadOldRoleDb()
{
// Get afm application installed dir
char const *afm_app_install_dir = getenv("AFM_APP_INSTALL_DIR");
- HMI_DEBUG("wm", "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", "AFM_APP_INSTALL_DIR is not defined");
+ HMI_ERROR("AFM_APP_INSTALL_DIR is not defined");
}
else
{
@@ -1390,22 +1384,22 @@ int WindowManager::loadOldRoleDb()
int ret = jh::inputJsonFilie(file_name.c_str(), &json_obj);
if (0 > ret)
{
- HMI_ERROR("wm", "Could not open old_role.db, so use default old_role information");
+ HMI_ERROR("Could not open old_role.db, so use default old_role information");
json_obj = json_tokener_parse(kDefaultOldRoleDb);
}
- HMI_DEBUG("wm", "json_obj dump:%s", json_object_get_string(json_obj));
+ HMI_DEBUG("json_obj dump:%s", json_object_get_string(json_obj));
// Perse apps
json_object* json_cfg;
if (!json_object_object_get_ex(json_obj, "old_roles", &json_cfg))
{
- HMI_ERROR("wm", "Parse Error!!");
+ HMI_ERROR("Parse Error!!");
return -1;
}
int len = json_object_array_length(json_cfg);
- HMI_DEBUG("wm", "json_cfg len:%d", len);
- HMI_DEBUG("wm", "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));
for (int i=0; i<len; i++)
{
@@ -1414,14 +1408,14 @@ int WindowManager::loadOldRoleDb()
const char* old_role = jh::getStringFromJson(json_tmp, "name");
if (nullptr == old_role)
{
- HMI_ERROR("wm", "Parse Error!!");
+ HMI_ERROR("Parse Error!!");
return -1;
}
const char* new_role = jh::getStringFromJson(json_tmp, "new");
if (nullptr == new_role)
{
- HMI_ERROR("wm", "Parse Error!!");
+ HMI_ERROR("Parse Error!!");
return -1;
}
@@ -1432,7 +1426,7 @@ int WindowManager::loadOldRoleDb()
for(auto itr = this->roleold2new.begin();
itr != this->roleold2new.end(); ++itr)
{
- HMI_DEBUG("wm", ">>> role old:%s new:%s",
+ HMI_DEBUG(">>> role old:%s new:%s",
itr->first.c_str(), itr->second.c_str());
}
@@ -1462,7 +1456,7 @@ const char *WindowManager::check_surface_exist(const char *drawing_name)
return "Surface is not on any layer!";
}
- HMI_DEBUG("wm", "surface %d is detected", *surface_id);
+ HMI_DEBUG("surface %d is detected", *surface_id);
return nullptr;
}
diff --git a/src/window_manager.hpp b/src/window_manager.hpp
index 6cbd355..f23719f 100644
--- a/src/window_manager.hpp
+++ b/src/window_manager.hpp
@@ -14,21 +14,25 @@
* limitations under the License.
*/
-#ifndef TMCAGLWM_APP_HPP
-#define TMCAGLWM_APP_HPP
+#ifndef WINDOW_MANAGER_HPP
+#define WINDOW_MANAGER_HPP
#include <atomic>
#include <memory>
#include <unordered_map>
#include <experimental/optional>
+#include "util.hpp"
#include "controller_hooks.hpp"
#include "layers.hpp"
#include "layout.hpp"
#include "wayland_ivi_wm.hpp"
#include "pm_wrapper.hpp"
-#include "hmi-debug.h"
#include "request.hpp"
#include "wm_error.hpp"
+extern "C"
+{
+#include <afb/afb-binding.h>
+}
struct json_object;
@@ -88,7 +92,7 @@ struct id_allocator
unsigned sid = this->next++;
this->id2name[sid] = name;
this->name2id[name] = sid;
- HMI_DEBUG("wm", "allocated new id %u with name %s", sid, name.c_str());
+ HMI_DEBUG("allocated new id %u with name %s", sid, name.c_str());
return sid;
}
@@ -97,7 +101,7 @@ struct id_allocator
{
this->id2name[sid] = name;
this->name2id[name] = sid;
- HMI_DEBUG("wm", "register id %u with name %s", sid, name.c_str());
+ HMI_DEBUG("register id %u with name %s", sid, name.c_str());
return;
}
@@ -286,4 +290,4 @@ class WindowManager
} // namespace wm
-#endif // TMCAGLWM_APP_HPP
+#endif // WINDOW_MANAGER_HPP
diff --git a/src/wm_client.cpp b/src/wm_client.cpp
index 09e2e00..2e12a69 100644
--- a/src/wm_client.cpp
+++ b/src/wm_client.cpp
@@ -16,7 +16,7 @@
#include <json-c/json.h>
#include "wm_client.hpp"
-#include "hmi-debug.h"
+#include "util.hpp"
#define INVALID_SURFACE_ID 0
@@ -137,10 +137,10 @@ void WMClient::registerLayer(unsigned layer)
*/
bool WMClient::addSurface(const string &role, unsigned surface)
{
- HMI_DEBUG("wm", "Add role %s with surface %d", role.c_str(), surface);
+ HMI_DEBUG("Add role %s with surface %d", role.c_str(), surface);
if (0 != this->role2surface.count(role))
{
- HMI_NOTICE("wm", "override surfaceID %d with %d", this->role2surface[role], surface);
+ HMI_NOTICE("override surfaceID %d with %d", this->role2surface[role], surface);
}
this->role2surface[role] = surface;
return true;
@@ -153,7 +153,7 @@ bool WMClient::removeSurfaceIfExist(unsigned surface)
{
if (surface == x.second)
{
- HMI_INFO("wm", "Remove surface from client %s: role %s, surface: %d",
+ HMI_INFO("Remove surface from client %s: role %s, surface: %d",
this->id.c_str(), x.first.c_str(), x.second);
this->role2surface.erase(x.first);
ret = true;
@@ -178,13 +178,13 @@ bool WMClient::removeRole(const string &role)
bool WMClient::subscribe(afb_req req, const string &evname)
{
if(evname != kKeyError){
- HMI_DEBUG("wm", "error is only enabeled for now");
+ HMI_DEBUG("error is only enabeled for now");
return false;
}
int ret = afb_req_subscribe(req, this->event2list[evname]);
if (ret)
{
- HMI_DEBUG("wm", "Failed to subscribe %s", evname.c_str());
+ HMI_DEBUG("Failed to subscribe %s", evname.c_str());
return false;
}
return true;
@@ -193,18 +193,18 @@ bool WMClient::subscribe(afb_req req, const string &evname)
void WMClient::emitError(WM_CLIENT_ERROR_EVENT ev)
{
if (!afb_event_is_valid(this->event2list[kKeyError])){
- HMI_ERROR("wm", "event err is not valid");
+ HMI_ERROR("event err is not valid");
return;
}
json_object *j = json_object_new_object();
json_object_object_add(j, kKeyError, json_object_new_int(ev));
json_object_object_add(j, kKeyErrorDesc, json_object_new_string(kErrorDescription[ev].c_str()));
- HMI_DEBUG("wm", "error: %d, description:%s", ev, kErrorDescription[ev].c_str());
+ HMI_DEBUG("error: %d, description:%s", ev, kErrorDescription[ev].c_str());
int ret = afb_event_push(this->event2list[kKeyError], j);
if (ret != 0)
{
- HMI_DEBUG("wm", "afb_event_push failed: %m");
+ HMI_DEBUG("afb_event_push failed: %m");
}
}
#endif