diff options
author | wang_zhiqiang <wang_zhiqiang@dl.cn.nexty-ele.com> | 2019-03-26 10:35:18 +0800 |
---|---|---|
committer | wang_zhiqiang <wang_zhiqiang@dl.cn.nexty-ele.com> | 2019-03-28 18:52:02 +0800 |
commit | aa43a07d4e86421aefec8c603018d14f5e249087 (patch) | |
tree | 8e8a509859709d908123c0fd213ad48c42b09242 /src/hs-appinfo.cpp | |
parent | 6c3015a7607c45313fa10792b9914864f8c25831 (diff) |
Change log macro to AFB_XXX
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>
Diffstat (limited to 'src/hs-appinfo.cpp')
-rw-r--r-- | src/hs-appinfo.cpp | 47 |
1 files changed, 23 insertions, 24 deletions
diff --git a/src/hs-appinfo.cpp b/src/hs-appinfo.cpp index e1c1990..700594f 100644 --- a/src/hs-appinfo.cpp +++ b/src/hs-appinfo.cpp @@ -15,8 +15,8 @@ */ #include <unistd.h> +#include <cstring> #include "hs-appinfo.h" -#include "hmi-debug.h" #include "hs-clientmanager.h" #define RETRY_CNT 10 @@ -47,7 +47,7 @@ std::string AppDetail::getProperty(std::string key) const 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)); @@ -102,7 +102,7 @@ int HS_AppInfo::init(afb_api_t api) { afmmain = new HS_AfmMainProxy(); if(afmmain == nullptr) { - HMI_ERROR("homescreen-service","Fatal Error:new HS_AfmMainProxy failed"); + AFB_ERROR("new HS_AfmMainProxy failed"); return -1; } @@ -117,11 +117,11 @@ int HS_AppInfo::init(afb_api_t api) ++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); @@ -144,7 +144,7 @@ void HS_AppInfo::onEvent(afb_api_t api, const char *event, struct json_object *o { 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); } } @@ -161,7 +161,7 @@ void HS_AppInfo::onEvent(afb_api_t api, const char *event, struct json_object *o */ 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); @@ -171,7 +171,7 @@ void HS_AppInfo::createAppDetailList(struct json_object *object) } } else { - HMI_ERROR("homescreen-service","Apps information input error."); + AFB_ERROR("Apps information input error."); } } @@ -187,23 +187,23 @@ void HS_AppInfo::createAppDetailList(struct json_object *object) */ 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; } @@ -214,7 +214,7 @@ void HS_AppInfo::updateAppDetailList(afb_api_t api, struct json_object *object) 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; } @@ -222,21 +222,21 @@ void HS_AppInfo::updateAppDetailList(afb_api_t api, struct json_object *object) 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."); } } @@ -256,7 +256,7 @@ std::string HS_AppInfo::parseAppDetail(struct json_object *object, AppDetail &in 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)); @@ -285,7 +285,7 @@ void HS_AppInfo::addAppDetail(struct json_object *object) AppDetail info; std::string appid = parseAppDetail(object, info); if(appid.empty()) { - HMI_ERROR("homescreen-service","application id error"); + AFB_ERROR("application id error"); return; } @@ -315,7 +315,7 @@ void HS_AppInfo::removeAppDetail(std::string appid) 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()); } } @@ -332,7 +332,6 @@ void HS_AppInfo::removeAppDetail(std::string appid) */ void HS_AppInfo::pushAppListChangedEvent(const char *oper, struct json_object *object) { - HMI_NOTICE("homescreen-service","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); @@ -360,7 +359,7 @@ struct json_object* HS_AppInfo::retrieveRunnables(struct json_object *obj_runnab 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)) { @@ -370,7 +369,7 @@ struct json_object* HS_AppInfo::retrieveRunnables(struct json_object *obj_runnab } } else { - HMI_ERROR("homescreen-service","Apps information input error."); + AFB_ERROR("Apps information input error."); } return j_found; } @@ -393,7 +392,7 @@ std::string HS_AppInfo::id2appid(const std::string &id) const appid = id.substr(0,pos); } else { - HMI_ERROR("homescreen-service","input id error."); + AFB_WARNING("input id error."); } return appid; } @@ -411,7 +410,7 @@ std::string HS_AppInfo::id2appid(const std::string &id) const 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; } |