}
if (!success) {
- LogError("Platform error %d <%s>", err, msg.c_str());
+ LoggerE("Platform error %d <%s>", err, msg.c_str());
}
return msg;
static int get_current_app_id_and_pkg_id(char **app_id, char **pkg_id)
{
- LogDebug("get_current_pkg_id enter");
+ LoggerD("get_current_pkg_id enter");
int parent_pid = getppid();
- LogDebug("parent pid : " << parent_pid);
+ LoggerD("parent pid : " << parent_pid);
char *_app_id = NULL;
char *_pkg_id = NULL;
int ret = app_manager_get_app_id(parent_pid, &_app_id);
if ((ret != APP_MANAGER_ERROR_NONE) || (_app_id == NULL)) {
- LogDebug("Cannot get app id from pid : " << parent_pid);
+ LoggerD("Cannot get app id from pid : " << parent_pid);
return ret;
} else {
- LogDebug("app_id : " << _app_id);
+ LoggerD("app_id : " << _app_id);
}
ret = app_manager_get_app_info(_app_id, &handle);
if (ret != APP_MANAGER_ERROR_NONE)
{
- LogDebug("Fail to get appinfo by " << _app_id);
+ LoggerD("Fail to get appinfo by " << _app_id);
return ret;
}
ret = app_info_get_package(handle, &_pkg_id);
if ((ret != APP_MANAGER_ERROR_NONE) || (_pkg_id == NULL))
{
- LogDebug("Fail to get pkg_id by " << _app_id);
+ LoggerD("Fail to get pkg_id by " << _app_id);
}
ret = app_info_destroy(handle);
if (ret != APP_MANAGER_ERROR_NONE)
{
- LogDebug("Fail to get destory appinfo");
+ LoggerD("Fail to get destory appinfo");
return ret;
}
static void push_connection_state_cb(push_state_e state, const char *err, void *user_data)
{
- LogInfo("Push connection state cb with state: "<< state <<", err: "<< err);
+ LoggerI("Push connection state cb with state: "<< state <<", err: "<< err);
PushManager *thisPushManager = static_cast<PushManager*>(user_data);
if (!thisPushManager) {
- LogError("user_data of push_connection_state_cb() is NULL.");
+ LoggerE("user_data of push_connection_state_cb() is NULL.");
} else {
thisPushManager->m_connectionState = state;
}
char *alertMessage = NULL;
long long int date = -1;
- LogInfo("Push notification cb");
+ LoggerI("Push notification cb");
try {
PushManager *thisPushManager = static_cast<PushManager*>(user_data);
MultiCallbackUserDataPtr callback = thisPushManager->m_notificationCallback;
if (!callback) {
- LogWarning("notification callback is not set. ignored.");
+ LoggerW("notification callback is not set. ignored.");
return;
}
ret = push_get_notification_time(noti, &date);
if (ret != PUSH_ERROR_NONE) {
- LogError("Platform error while getting notification date/time. " << _get_internal_error(ret));
+ LoggerE("Platform error while getting notification date/time. " << _get_internal_error(ret));
}
PushMessage *pushMessage = new PushMessage();
callback->invokeCallback("onsuccess", pushMessageObj);
} catch (const BasePlatformException &err) {
- LogError(err.getMessage());
+ LoggerE(err.getMessage());
}
}
int ret;
char *tmp = NULL;
- LogInfo("Push registration cb");
+ LoggerI("Push registration cb");
try {
PushManager *thisPushManager = static_cast<PushManager*>(user_data);
callback->invokeCallback("onerror", errorObj);
}
} catch (const BasePlatformException &err) {
- LogError(err.getMessage());
+ LoggerE(err.getMessage());
}
}
static void push_unregistration_result_cb(push_result_e result, const char *msg, void *user_data)
{
- LogInfo("Push unregistration cb");
+ LoggerI("Push unregistration cb");
try {
PushManager *thisPushManager = static_cast<PushManager*>(user_data);
callback->invokeCallback("onerror", errorObj);
}
} catch (const BasePlatformException &err) {
- LogError(err.getMessage());
+ LoggerE(err.getMessage());
}
}
m_connectionState(PUSH_STATE_UNREGISTERED),
m_connectionHandle(NULL)
{
- LogInfo("Connecting to the push service...");
+ LoggerI("Connecting to the push service...");
int ret;
ret = get_current_app_id_and_pkg_id(&m_appId, &m_pkgId);
if (APP_ERROR_NONE != ret) {
- LogError("Error while getting app id: "<<ret);
+ LoggerE("Error while getting app id: "<<ret);
return;
}
- LogInfo("Push App id: " << m_appId);
- LogInfo("Push Package id: " << m_pkgId);
+ LoggerI("Push App id: " << m_appId);
+ LoggerI("Push Package id: " << m_pkgId);
ret = push_connect(m_pkgId, push_connection_state_cb, push_notify_cb, this, &m_connectionHandle);
if (PUSH_ERROR_NONE!=ret) {
- LogError("Error while connecting to the push service: "<< ret);
+ LoggerE("Error while connecting to the push service: "<< ret);
return;
}
}
PushManager::~PushManager()
{
- LogInfo("Disconnecting to the push service...");
+ LoggerI("Disconnecting to the push service...");
if(m_appId) {
free(m_appId);
}
PushManager *PushManager::getInstance() {
- LogInfo("Getting instance of PushManager...");
+ LoggerI("Getting instance of PushManager...");
static PushManager instance;
return &instance;
}
if (appControl->getUri().compare("") != 0) {
ret = service_set_uri(service, appControl->getUri().c_str());
if (ret != SERVICE_ERROR_NONE) {
- LogWarning("Platform error while setting uri to appControl. " << _get_internal_error(ret));
+ LoggerW("Platform error while setting uri to appControl. " << _get_internal_error(ret));
}
}
if (appControl->getMime().compare("") != 0) {
ret = service_set_mime(service, appControl->getMime().c_str());
if (ret != SERVICE_ERROR_NONE) {
- LogWarning("Platform error while setting mime to appControl. " << _get_internal_error(ret));
+ LoggerW("Platform error while setting mime to appControl. " << _get_internal_error(ret));
}
}
for (size_t i = 0; i < controlDataArray.size(); i++) {
key = controlDataArray.at(i)->getKey();
if (key.empty()) {
- LogWarning("Invalid key for " << i << " in ApplicationControl's data array.");
+ LoggerW("Invalid key for " << i << " in ApplicationControl's data array.");
} else {
std::vector<std::string> valueArray = controlDataArray.at(i)->getValue();
size_t size = valueArray.size();
if (size == 1) {
ret = service_add_extra_data(service, (const char*)key.c_str(), arr[0]);
if (ret != SERVICE_ERROR_NONE) {
- LogWarning("Platform error while adding extra data to appControl. " << _get_internal_error(ret));
+ LoggerW("Platform error while adding extra data to appControl. " << _get_internal_error(ret));
}
} else {
ret = service_add_extra_data_array(service, (const char*)key.c_str(), arr, size);
if (ret != SERVICE_ERROR_NONE) {
- LogWarning("Platform error while adding extra data array to appControl. " << _get_internal_error(ret));
+ LoggerW("Platform error while adding extra data array to appControl. " << _get_internal_error(ret));
}
}
ret = push_get_registration_id(m_connectionHandle, ®Id);
if (ret != PUSH_ERROR_NONE) {
- LogWarning("Platform error while getting registration id. " << _get_internal_error(ret));
+ LoggerW("Platform error while getting registration id. " << _get_internal_error(ret));
} else {
if (regId) {
str = regId;