1. using binder log macro instead of HMI_LOG.
2. unify log using level as below:
AFB_ERROR: fatal error or serious error may occur.
AFB_WARNING: input parameter error or not serious error.
AFB_NOTICE: alert sth.
AFB_INFO: print input argument or sth else.
AFB_DEBUG: prompt for calling location.
3. delete hmi-debug.h.
Change-Id: I203864ced39c418d2f792faa50ab2c009deb9d02
Signed-off-by: wang_zhiqiang <wang_zhiqiang@dl.cn.nexty-ele.com>
+++ /dev/null
-/*
- * 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__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#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__)
-
-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);
-}
-
-#ifdef __cplusplus
-}
-#endif
-#endif //__HMI_DEBUG_H__
\ No newline at end of file
#include <memory>
#include <algorithm>
#include "hs-helper.h"
-#include "hmi-debug.h"
#include "hs-clientmanager.h"
#include "hs-appinfo.h"
int hs_instance::init(afb_api_t api)
{
if(client_manager == nullptr) {
- HMI_ERROR("homescreen-service","FATAL ERROR: client_manager is nullptr.");
+ AFB_ERROR("FATAL ERROR: client_manager is nullptr.");
return -1;
}
client_manager->init();
if(app_info == nullptr) {
- HMI_ERROR("homescreen-service","FATAL ERROR: app_info is nullptr.");
+ AFB_ERROR("FATAL ERROR: app_info is nullptr.");
return -1;
}
app_info->init(api);
{
static int pingcount = 0;
afb_req_success_f(request, json_object_new_int(pingcount), "Ping count = %d", pingcount);
- HMI_NOTICE("homescreen-service","Verbosity macro at level notice invoked at ping invocation count = %d", pingcount);
+ AFB_DEBUG("Verbosity macro at level notice invoked at ping invocation count = %d", pingcount);
pingcount++;
}
*/
static void tap_shortcut (afb_req_t request)
{
- HMI_NOTICE("homescreen-service","called.");
+ AFB_DEBUG("called.");
int ret = 0;
const char* value = afb_req_value(request, _application_id);
if (value) {
- HMI_NOTICE("homescreen-service","request appid = %s.", value);
+ AFB_INFO("request appid = %s.", value);
ret = g_hs_instance->client_manager->handleRequest(request, __FUNCTION__, value);
if(ret == AFB_REQ_NOT_STARTED_APPLICATION) {
std::string id = g_hs_instance->app_info->getAppProperty(value, _keyId);
*/
static void on_screen_message (afb_req_t request)
{
- HMI_NOTICE("homescreen-service","called.");
+ AFB_DEBUG("called.");
int ret = g_hs_instance->client_manager->handleRequest(request, __FUNCTION__);
if (ret) {
afb_req_fail_f(request, "failed", "called %s, Unknown parameter", __FUNCTION__);
*/
static void on_screen_reply (afb_req_t request)
{
- HMI_NOTICE("homescreen-service","called.");
+ AFB_DEBUG("called.");
int ret = g_hs_instance->client_manager->handleRequest(request, __FUNCTION__);
if (ret) {
afb_req_fail_f(request, "failed", "called %s, Unknown parameter", __FUNCTION__);
*/
static void subscribe(afb_req_t request)
{
- HMI_NOTICE("homescreen-service","called.");
+ AFB_DEBUG("called.");
int ret = 0;
std::string req_appid = std::move(get_application_id(request));
if(!req_appid.empty()) {
*/
static void unsubscribe(afb_req_t request)
{
- HMI_NOTICE("homescreen-service","called.");
+ AFB_DEBUG("called.");
int ret = 0;
std::string req_appid = std::move(get_application_id(request));
if(!req_appid.empty()) {
*/
static void showWindow(afb_req_t request)
{
- HMI_NOTICE("homescreen-service","called.");
+ AFB_DEBUG("called.");
int ret = 0;
const char* value = afb_req_value(request, _application_id);
if (value) {
*/
static void hideWindow(afb_req_t request)
{
- HMI_NOTICE("homescreen-service","called.");
+ AFB_DEBUG("called.");
int ret = 0;
const char* value = afb_req_value(request, _application_id);
if (value) {
*/
static void replyShowWindow(afb_req_t request)
{
- HMI_NOTICE("homescreen-service","called.");
+ AFB_DEBUG("called.");
int ret = 0;
const char* value = afb_req_value(request, _application_id);
if (value) {
*/
static void showNotification(afb_req_t request)
{
- HMI_NOTICE("homescreen-service","called.");
+ AFB_DEBUG("called.");
int ret = g_hs_instance->client_manager->handleRequest(request, __FUNCTION__, "homescreen");
if (ret) {
afb_req_fail_f(request, "failed", "called %s, Unknown parameter", __FUNCTION__);
*/
static void showInformation(afb_req_t request)
{
- HMI_NOTICE("homescreen-service","called.");
+ AFB_DEBUG("called.");
int ret = g_hs_instance->client_manager->handleRequest(request, __FUNCTION__, "homescreen");
if (ret) {
afb_req_fail_f(request, "failed", "called %s, Unknown parameter", __FUNCTION__);
*/
static void getRunnables(afb_req_t request)
{
- HMI_NOTICE("homescreen-service","called.");
+ AFB_DEBUG("called.");
struct json_object* j_runnable = json_object_new_array();
g_hs_instance->app_info->getRunnables(&j_runnable);
*/
static int preinit(afb_api_t api)
{
- HMI_NOTICE("homescreen-service","binding preinit (was register)");
+ AFB_DEBUG("binding preinit (was register)");
return 0;
}
*/
static int init(afb_api_t api)
{
- HMI_NOTICE("homescreen-service","binding init");
+ AFB_DEBUG("binding init");
if(g_hs_instance != nullptr) {
- HMI_WARNING("homescreen-service", "g_hs_instance isn't null.");
+ AFB_WARNING( "g_hs_instance isn't null.");
delete g_hs_instance->client_manager;
delete g_hs_instance->app_info;
delete g_hs_instance;
}
g_hs_instance = new hs_instance();
if(g_hs_instance == nullptr) {
- HMI_ERROR("homescreen-service", "Fatal Error: new g_hs_instance failed.");
+ AFB_ERROR( "Fatal Error: new g_hs_instance failed.");
return -1;
}
*/
static void onevent(afb_api_t api, const char *event, struct json_object *object)
{
- HMI_NOTICE("homescreen-service","on_event %s", event);
+ AFB_DEBUG("on_event %s", event);
g_hs_instance->app_info->onEvent(api, event, object);
}
*/
#include <unistd.h>
+#include <cstring>
#include "hs-appinfo.h"
-#include "hmi-debug.h"
#include "hs-clientmanager.h"
#define RETRY_CNT 10
struct json_object *j_obj;
struct json_object *j_detail = json_tokener_parse(this->detail.c_str());
if(json_object_object_get_ex(j_detail, key.c_str(), &j_obj) == 0) {
- HMI_ERROR("homescreen-service","can't find key=%s.", key.c_str());
+ AFB_WARNING("can't find key=%s.", key.c_str());
return std::string();
}
return std::string(json_object_get_string(j_obj));
{
afmmain = new HS_AfmMainProxy();
if(afmmain == nullptr) {
- HMI_ERROR("homescreen-service","Fatal Error:new HS_AfmMainProxy failed");
+ AFB_ERROR("Fatal Error:new HS_AfmMainProxy failed");
return -1;
}
++retry;
if(retry == RETRY_CNT) {
- HMI_ERROR("homescreen-service","get runnables list failed");
+ AFB_ERROR("get runnables list failed");
json_object_put(j_runnable);
return -1;
}
- HMI_NOTICE("homescreen-service","retry to get runnables list %d", retry);
+ AFB_DEBUG("retry to get runnables list %d", retry);
usleep(100000); // 100ms
} while(1);
{
auto ip = concerned_event_list.find(std::string(event));
if(ip != concerned_event_list.end()) {
- HMI_NOTICE("homescreen-service","[%s] event received.", event);
+ AFB_INFO("[%s] event received.", event);
(this->*(ip->second))(api, object);
}
}
*/
void HS_AppInfo::createAppDetailList(struct json_object *object)
{
- HMI_NOTICE("homescreen-service","applist:%s", json_object_to_json_string(object));
+ AFB_DEBUG("applist:%s", json_object_to_json_string(object));
if(json_object_get_type(object) == json_type_array) {
int array_len = json_object_array_length(object);
}
}
else {
- HMI_ERROR("homescreen-service","Apps information input error.");
+ AFB_ERROR("Apps information input error.");
}
}
*/
void HS_AppInfo::updateAppDetailList(afb_api_t api, struct json_object *object)
{
- HMI_NOTICE("homescreen-service","update:%s", json_object_to_json_string(object));
+ AFB_DEBUG("update:%s", json_object_to_json_string(object));
if(json_object_get_type(object) != json_type_object) {
- HMI_ERROR("homescreen-service","input detail object error.");
+ AFB_ERROR("input detail object error.");
return;
}
struct json_object *obj_oper, *obj_data;
if(json_object_object_get_ex(object, _keyOperation, &obj_oper) == 0
|| json_object_object_get_ex(object, _keyData, &obj_data) == 0) {
- HMI_ERROR("homescreen-service","can't find key=%s, %s.", _keyOperation, _keyData);
+ AFB_ERROR("can't find key=%s, %s.", _keyOperation, _keyData);
return;
}
std::string id = json_object_get_string(obj_data);
std::string appid = id2appid(id);
if(isPeripheryApp(appid.c_str())) {
- HMI_NOTICE("homescreen-service", "install/uninstall application is periphery.");
+ AFB_INFO( "install/uninstall application is periphery.");
return;
}
if(!ret) {
struct json_object *j_found = retrieveRunnables(j_runnable, id);
if(j_found == nullptr) {
- HMI_NOTICE("homescreen-service", "installed application isn't runnables.");
+ AFB_INFO( "installed application isn't runnables.");
json_object_put(j_runnable);
return;
}
pushAppListChangedEvent(_keyInstall, j_found);
}
else {
- HMI_ERROR("homescreen-service","get runnalbes failed.");
+ AFB_ERROR("get runnalbes failed.");
}
json_object_put(j_runnable);
}
else if(oper == _keyUninstall) {
std::string appid_checked = checkAppId(appid);
if(appid_checked.empty()) {
- HMI_NOTICE("homescreen-service","uninstalled application isn't in runnables list, appid=%s.", appid.c_str());
+ AFB_INFO("uninstalled application isn't in runnables list, appid=%s.", appid.c_str());
return;
}
pushAppListChangedEvent(_keyUninstall, obj_data);
removeAppDetail(appid);
}
else {
- HMI_ERROR("homescreen-service","operation error.");
+ AFB_ERROR("operation error.");
}
}
struct json_object *name, *id;
if(json_object_object_get_ex(object, _keyName, &name) == 0
|| json_object_object_get_ex(object, _keyId, &id) == 0) {
- HMI_ERROR("homescreen-service","can't find key=%s, %s.", _keyName, _keyId);
+ AFB_ERROR("can't find key=%s, %s.", _keyName, _keyId);
return std::string();
}
std::string appid = id2appid(json_object_get_string(id));
AppDetail info;
std::string appid = parseAppDetail(object, info);
if(appid.empty()) {
- HMI_ERROR("homescreen-service","application id error");
+ AFB_ERROR("application id error");
return;
}
app_detail_list.erase(it);
}
else {
- HMI_WARNING("homescreen-service","erase application(%s) wasn't in applist.", appid.c_str());
+ AFB_WARNING("erase application(%s) wasn't in applist.", appid.c_str());
}
}
*/
void HS_AppInfo::pushAppListChangedEvent(const char *oper, struct json_object *object)
{
- HMI_NOTICE("homescreen-service","called.");
+ AFB_DEBUG("called.");
struct json_object *push_obj = json_object_new_object();
json_object_object_add(push_obj, _keyOperation, json_object_new_string(oper));
json_object_object_add(push_obj, _keyData, object);
struct json_object *obj = json_object_array_get_idx(obj_runnables, i);
struct json_object *j_id;
if(json_object_object_get_ex(obj, _keyId, &j_id) == 0) {
- HMI_WARNING("homescreen-service","can't find id.");
+ AFB_WARNING("can't find id.");
continue;
}
if(id == json_object_get_string(j_id)) {
}
}
else {
- HMI_ERROR("homescreen-service","Apps information input error.");
+ AFB_ERROR("Apps information input error.");
}
return j_found;
}
appid = id.substr(0,pos);
}
else {
- HMI_ERROR("homescreen-service","input id error.");
+ AFB_WARNING("input id error.");
}
return appid;
}
void HS_AppInfo::getRunnables(struct json_object **object)
{
if(json_object_get_type(*object) != json_type_array) {
- HMI_ERROR("homescreen-service","json type error.");
+ AFB_ERROR("json type error.");
return;
}
* limitations under the License.
*/
+#include <cstring>
#include "hs-client.h"
#include "hs-helper.h"
-#include "hmi-debug.h"
static const char _event[] = "event";
static const char _type[] = "type";
*/
HS_Client::HS_Client(afb_req_t request, std::string id) : my_id(id)
{
- HMI_NOTICE("homescreen-service","called.");
+ AFB_DEBUG("called.");
my_event = afb_api_make_event(request->api, id.c_str());
}
*/
HS_Client::~HS_Client()
{
- HMI_NOTICE("homescreen-service","called.");
+ AFB_DEBUG("called.");
afb_event_unref(my_event);
}
*/
int HS_Client::tap_shortcut(afb_req_t request)
{
- HMI_NOTICE("homescreen-service","request appid = %s.", my_id.c_str());
+ AFB_INFO("request appid = %s.", my_id.c_str());
struct json_object* push_obj = json_object_new_object();
hs_add_object_to_json_object_str( push_obj, 4, _application_id, my_id.c_str(),
_type, __FUNCTION__);
int ret = 0;
const char* value = afb_req_value(request, _display_message);
if (value) {
- HMI_NOTICE("homescreen-service","push %s event message [%s].", __FUNCTION__, value);
+ AFB_INFO("push %s event message [%s].", __FUNCTION__, value);
struct json_object* push_obj = json_object_new_object();
hs_add_object_to_json_object_str( push_obj, 4, _display_message, value,
_type, __FUNCTION__);
afb_event_push(my_event, push_obj);
}
else {
- HMI_NOTICE("homescreen-service","Please input display_message");
+ AFB_WARNING("Please input display_message");
ret = AFB_EVENT_BAD_REQUEST;
}
return ret;
int ret = 0;
const char* value = afb_req_value(request, _reply_message);
if (value) {
- HMI_NOTICE("homescreen-service","push %s event message [%s].", __FUNCTION__, value);
+ AFB_INFO("push %s event message [%s].", __FUNCTION__, value);
struct json_object* push_obj = json_object_new_object();
hs_add_object_to_json_object_str( push_obj, 4, _reply_message, value,
_type, __FUNCTION__);
afb_event_push(my_event, push_obj);
}
else {
- HMI_NOTICE("homescreen-service","Please input reply_message");
+ AFB_WARNING("Please input reply_message");
ret = AFB_EVENT_BAD_REQUEST;
}
return ret;
*/
int HS_Client::subscribe(afb_req_t request)
{
- HMI_NOTICE("homescreen-service"," called.");
+ AFB_DEBUG(" called.");
int ret = 0;
const char *value = afb_req_value(request, _event);
if(value) {
- HMI_NOTICE("homescreen-service","subscribe event %s", value);
+ AFB_INFO("subscribe event %s", value);
if(!isSupportEvent(value)) {
- HMI_NOTICE("homescreen-service","subscibe event isn't existing.");
+ AFB_WARNING("subscibe event isn't existing.");
ret = AFB_EVENT_BAD_REQUEST;
}
else {
}
}
else {
- HMI_NOTICE("homescreen-service","Please input event name");
+ AFB_WARNING("Please input event name");
ret = AFB_EVENT_BAD_REQUEST;
}
return ret;
*/
int HS_Client::unsubscribe(afb_req_t request)
{
- HMI_NOTICE("homescreen-service"," called.");
+ AFB_DEBUG(" called.");
int ret = 0;
const char *value = afb_req_value(request, _event);
if(value) {
- HMI_NOTICE("homescreen-service","unsubscribe %s event", value);
+ AFB_INFO("unsubscribe %s event", value);
event_list.erase(std::string(value));
if(event_list.empty()) {
ret = afb_req_unsubscribe(request, my_event);
}
}
else {
- HMI_NOTICE("homescreen-service","Please input event name");
+ AFB_WARNING("Please input event name");
ret = AFB_EVENT_BAD_REQUEST;
}
return ret;
*/
int HS_Client::showWindow(afb_req_t request)
{
- HMI_NOTICE("homescreen-service","%s application_id = %s.", __FUNCTION__, my_id.c_str());
+ AFB_INFO("%s application_id = %s.", __FUNCTION__, my_id.c_str());
int ret = 0;
struct json_object* push_obj = json_object_new_object();
hs_add_object_to_json_object_str( push_obj, 4, _application_id, my_id.c_str(), _type, __FUNCTION__);
if(param) {
std::string req_appid = std::move(get_application_id(request));
if(req_appid.empty()) {
- HMI_NOTICE("homescreen-service","can't get application identifier");
+ AFB_WARNING("can't get application identifier");
return AFB_REQ_GETAPPLICATIONID_ERROR;
}
afb_event_push(my_event, push_obj);
}
else {
- HMI_ERROR("homescreen-service","please input correct parameter.");
+ AFB_WARNING("please input correct parameter.");
ret = AFB_EVENT_BAD_REQUEST;
}
return ret;
*/
int HS_Client::hideWindow(afb_req_t request)
{
- HMI_NOTICE("homescreen-service"," called.");
+ AFB_DEBUG(" called.");
std::string req_appid = std::move(get_application_id(request));
if(req_appid.empty()) {
- HMI_NOTICE("homescreen-service","can't get application identifier");
+ AFB_WARNING("can't get application identifier");
return AFB_REQ_GETAPPLICATIONID_ERROR;
}
*/
int HS_Client::replyShowWindow(afb_req_t request)
{
- HMI_NOTICE("homescreen-service","%s application_id = %s.", __FUNCTION__, my_id.c_str());
+ AFB_INFO("%s application_id = %s.", __FUNCTION__, my_id.c_str());
int ret = 0;
struct json_object* push_obj = json_object_new_object();
hs_add_object_to_json_object_str( push_obj, 4, _application_id, my_id.c_str(), _type, __FUNCTION__);
afb_event_push(my_event, push_obj);
}
else {
- HMI_ERROR("homescreen-service","please input correct parameter.");
+ AFB_WARNING("please input correct parameter.");
ret = AFB_EVENT_BAD_REQUEST;
}
return ret;
*/
int HS_Client::showNotification(afb_req_t request)
{
- HMI_NOTICE("homescreen-service"," called.");
+ AFB_DEBUG(" called.");
int ret = 0;
const char *value = afb_req_value(request, _text);
if(value) {
- HMI_NOTICE("homescreen-service","text is %s", value);
+ AFB_INFO("text is %s", value);
std::string appid =std::move(get_application_id(request));
if(appid.empty()) {
- HMI_NOTICE("homescreen-service","can't get application identifier");
+ AFB_WARNING("can't get application identifier");
return AFB_REQ_GETAPPLICATIONID_ERROR;
}
afb_event_push(my_event, push_obj);
}
else {
- HMI_NOTICE("homescreen-service","please input icon.");
+ AFB_WARNING("please input icon.");
ret = AFB_REQ_SHOWNOTIFICATION_ERROR;
}
}
else {
- HMI_NOTICE("homescreen-service","please input text.");
+ AFB_WARNING("please input text.");
ret = AFB_REQ_SHOWNOTIFICATION_ERROR;
}
*/
int HS_Client::showInformation(afb_req_t request)
{
- HMI_NOTICE("homescreen-service"," called.");
+ AFB_DEBUG(" called.");
int ret = 0;
const char *value = afb_req_value(request, _info);
if(value) {
- HMI_NOTICE("homescreen-service","info is %s", value);
+ AFB_INFO("info is %s", value);
std::string appid = std::move(get_application_id(request));
if(appid.empty()) {
- HMI_NOTICE("homescreen-service","can't get application identifier");
+ AFB_WARNING("can't get application identifier");
return AFB_REQ_GETAPPLICATIONID_ERROR;
}
afb_event_push(my_event, push_obj);
}
else {
- HMI_NOTICE("homescreen-service","please input information.");
+ AFB_WARNING("please input information.");
ret = AFB_REQ_SHOWINFORMATION_ERROR;
}
*/
int HS_Client::handleRequest(afb_req_t request, const char *verb)
{
- HMI_NOTICE("homescreen-service","called.");
+ AFB_DEBUG("called.");
if((strcasecmp(verb, "subscribe") && strcasecmp(verb, "unsubscribe")) && !checkEvent(verb))
return 0;
int ret = AFB_EVENT_BAD_REQUEST;
auto ip = func_list.find(std::string(verb));
if(ip != func_list.end() && ip->second != nullptr) {
- HMI_NOTICE("homescreen-service","[%s]verb found", verb);
+ AFB_INFO("[%s]verb found", verb);
ret = (this->*(ip->second))(request);
}
return ret;
if(!checkEvent(event))
return 0;
- HMI_NOTICE("homescreen-service","called, event=%s.",event);
+ AFB_INFO("called, event=%s.",event);
struct json_object* push_obj = json_object_new_object();
hs_add_object_to_json_object_str( push_obj, 4, _application_id, my_id.c_str(), _type, event);
if(param != nullptr)
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
+#include <cstring>
#include <algorithm>
#include "hs-clientmanager.h"
-#include "hmi-debug.h"
static const char _homescreen[] = "homescreen";
*/
int HS_ClientManager::init(void)
{
- HMI_NOTICE("homescreen-service","called.");
+ AFB_NOTICE("called.");
}
/**
HS_ClientCtxt *ctxt = (HS_ClientCtxt *)afb_req_context_get(req);
if (!ctxt)
{
- HMI_NOTICE("homescreen-service", "create new session for %s", appid.c_str());
+ AFB_INFO( "create new session for %s", appid.c_str());
HS_ClientCtxt *ctxt = new HS_ClientCtxt(appid.c_str());
afb_req_session_set_LOA(req, 1);
afb_req_context_set(req, ctxt, cbRemoveClientCtxt);
HS_ClientCtxt *ctxt = (HS_ClientCtxt *)data;
if(ctxt == nullptr)
{
- HMI_ERROR("homescreen-service", "data is nullptr");
+ AFB_WARNING( "data is nullptr");
return;
}
- HMI_NOTICE("homescreen-service", "remove app %s", ctxt->id.c_str());
+ AFB_INFO( "remove app %s", ctxt->id.c_str());
std::lock_guard<std::mutex> lock(this->mtx);
removeClient(ctxt->id);
delete appid2ctxt[ctxt->id];
*/
int HS_ClientManager::handleRequest(afb_req_t request, const char *verb, const char *appid)
{
- HMI_NOTICE("homescreen-service","verb=[%s],appid=[%s].", verb, appid);
+ AFB_INFO("verb=[%s],appid=[%s].", verb, appid);
int ret = 0;
std::lock_guard<std::mutex> lock(this->mtx);
if(appid == nullptr) {
ret = client->handleRequest(request, "subscribe");
}
else {
- HMI_NOTICE("homescreen-service","not exist session");
+ AFB_NOTICE("not exist session");
ret = AFB_REQ_NOT_STARTED_APPLICATION;
}
}
int HS_ClientManager::pushEvent(const char *event, struct json_object *param, std::string appid)
{
if(event == nullptr) {
- HMI_ERROR("homescreen-service","event name is null.");
+ AFB_WARNING("event name is null.");
return -1;
}
*/
#include "hs-proxy.h"
-#include "hmi-debug.h"
const char _afm_main[] = "afm-main";
*/
static void api_callback(void *closure, struct json_object *object, const char *error, const char *info, afb_api_t api)
{
- HMI_DEBUG("homescreen-service","asynchronous call, error=%s, info=%s, object=%s.", error, info, json_object_get_string(object));
+ AFB_INFO("asynchronous call, error=%s, info=%s, object=%s.", error, info, json_object_get_string(object));
}
/**
*/
static void api_call(afb_api_t api, const char *service, const char *verb, struct json_object *args)
{
- HMI_DEBUG("homescreen-service","service=%s verb=%s, args=%s.", service, verb, json_object_get_string(args));
+ AFB_INFO("service=%s verb=%s, args=%s.", service, verb, json_object_get_string(args));
afb_api_call(api, service, verb, args, api_callback, nullptr);
}
{
char *error = nullptr, *info = nullptr;
int ret = afb_api_call_sync(api, service, verb, args, object, &error, &info);
- HMI_DEBUG("homescreen-service","synchronous call, error=%s, info=%s.", error, info);
+ AFB_INFO("synchronous call, error=%s, info=%s.", error, info);
return ret;
}