}
int ret = notification_set_layout(noti_handle, noti_layout);
if (ret != NOTIFICATION_ERROR_NONE) {
- LoggerE("Set notification layout error: %d", ret);
- return PlatformResult(ErrorCode::UNKNOWN_ERR,
- "Set notification layout error");
+ return LogAndCreateResult(ErrorCode::UNKNOWN_ERR,
+ "Set notification layout error",
+ ("Set notification layout error: %d", ret));
}
return PlatformResult(ErrorCode::NO_ERROR);
LoggerD("Enter");
*noti_handle = notification_create(noti_type);
if (!noti_handle) {
- LoggerE("Cannot make new notification object");
- return PlatformResult(ErrorCode::UNKNOWN_ERR,
+ return LogAndCreateResult(ErrorCode::UNKNOWN_ERR,
"Cannot make new notification object");
}
NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY |
NOTIFICATION_DISPLAY_APP_INDICATOR);
if (ret != NOTIFICATION_ERROR_NONE) {
- LoggerE("Cannot make new notification object: %d", ret);
- return PlatformResult(ErrorCode::UNKNOWN_ERR,
- "Cannot set notification display applist");
+ return LogAndCreateResult(ErrorCode::UNKNOWN_ERR,
+ "Cannot set notification display applist",
+ ("Cannot make new notification object: %d", ret));
}
}
*type = "PROGRESS";
}
} else {
- LoggerE("Notification type not found");
- return PlatformResult(ErrorCode::NOT_FOUND_ERR,
+ return LogAndCreateResult(ErrorCode::NOT_FOUND_ERR,
"Notification type not found");
}
} else if (type == "ONGOING" || type == "PROGRESS") {
*noti_type = NOTIFICATION_TYPE_ONGOING;
} else {
- LoggerI("Invalide noti type: %s", type.c_str());
- return PlatformResult(ErrorCode::TYPE_MISMATCH_ERR,
- "Invalide notification type");
+ return LogAndCreateResult(ErrorCode::TYPE_MISMATCH_ERR,
+ "Invalide notification type",
+ ("Invalide noti type: %s", type.c_str()));
}
return PlatformResult(ErrorCode::NO_ERROR);
if (notification_get_image(noti_handle, image_type, &path) !=
NOTIFICATION_ERROR_NONE) {
- LoggerE("Get notification image error, image_type: %d", image_type);
- return PlatformResult(ErrorCode::UNKNOWN_ERR,
- "Get notification image error");
+ return LogAndCreateResult(ErrorCode::UNKNOWN_ERR,
+ "Get notification image error",
+ ("Get notification image error, image_type: %d", image_type));
}
if (path) {
*image_path = path;
LoggerD("Enter");
int ret = notification_set_image(noti_handle, image_type, image_path.c_str());
if (ret != NOTIFICATION_ERROR_NONE) {
- LoggerE("Set notification image error, image_type: %d, error: %d",
- image_type,
- ret);
- return PlatformResult(ErrorCode::UNKNOWN_ERR,
- "Set notification image error");
+ return LogAndCreateResult(ErrorCode::UNKNOWN_ERR,
+ "Set notification image error",
+ ("Set notification image error, image_type: %d, error: %d",
+ image_type, ret));
}
return PlatformResult(ErrorCode::NO_ERROR);
if (notification_get_text(noti_handle, text_type, &text) !=
NOTIFICATION_ERROR_NONE) {
- LoggerE("Get notification text error, text_type: %d", text_type);
- return PlatformResult(ErrorCode::UNKNOWN_ERR,
- "Get notification text error");
+ return LogAndCreateResult(ErrorCode::UNKNOWN_ERR,
+ "Get notification text error",
+ ("Get notification text error, text_type: %d", text_type));
}
if (text)
NULL,
NOTIFICATION_VARIABLE_TYPE_NONE);
if (ret != NOTIFICATION_ERROR_NONE) {
- LoggerE("Set notification text error, text_type: %d, error: %d",
- text_type,
- ret);
- return PlatformResult(ErrorCode::UNKNOWN_ERR,
- "Set notification text error");
+ return LogAndCreateResult(ErrorCode::UNKNOWN_ERR,
+ "Set notification text error",
+ ("Set notification text error, text_type: %d, error: %d",
+ text_type, ret));
}
return PlatformResult(ErrorCode::NO_ERROR);
picojson::array* out) {
LoggerD("Enter");
if (info_map_.size() != info_sub_map_.size()) {
- LoggerE("Different notification information types element size");
- return PlatformResult(
+ return LogAndCreateResult(
ErrorCode::VALIDATION_ERR,
"Different notification information types element size");
}
++idx;
if (idx > info_map_size) {
- LoggerE("Too many values in notification detailInfo array");
- return PlatformResult(ErrorCode::INVALID_VALUES_ERR,
+ return LogAndCreateResult(ErrorCode::INVALID_VALUES_ERR,
"Too many values in notification detailInfo array");
}
}
if (notification_get_led(noti_handle, &type, (int*)&color) !=
NOTIFICATION_ERROR_NONE) {
- LoggerE("Get notification led displaying option error");
- return PlatformResult(ErrorCode::UNKNOWN_ERR,
+ return LogAndCreateResult(ErrorCode::UNKNOWN_ERR,
"Get notification led displaying option error");
}
color_str.begin(), color_str.end(), color_str.begin(), ::tolower);
if (!IsColorFormatNumberic(color_str)) {
- LoggerE("Led color is not numeric value: %s", color_str.c_str());
- return PlatformResult(ErrorCode::INVALID_VALUES_ERR,
- "Led color is not numeric value");
+ return LogAndCreateResult(ErrorCode::INVALID_VALUES_ERR,
+ "Led color is not numeric value",
+ ("Led color is not numeric value: %s", color_str.c_str()));
}
std::stringstream stream;
int ret = notification_set_led(noti_handle, type, static_cast<int>(color));
if (ret != NOTIFICATION_ERROR_NONE) {
- LoggerE("Set notification led color eror: %d", ret);
- return PlatformResult(ErrorCode::UNKNOWN_ERR,
- "Set notification led color eror");
+ return LogAndCreateResult(ErrorCode::UNKNOWN_ERR,
+ "Set notification led color eror",
+ ("Set notification led color eror: %d", ret));
}
return PlatformResult(ErrorCode::NO_ERROR);
if (notification_get_led_time_period(noti_handle, &on_time, &off_time) !=
NOTIFICATION_ERROR_NONE) {
- LoggerE("Get notification led on/off period error");
- return PlatformResult(ErrorCode::UNKNOWN_ERR,
+ return LogAndCreateResult(ErrorCode::UNKNOWN_ERR,
"Get notification led on/off period error");
}
int ret =
notification_set_led_time_period(noti_handle, on_period, off_period);
if (ret != NOTIFICATION_ERROR_NONE) {
- LoggerE("Set notification led on period error: %d", ret);
- return PlatformResult(ErrorCode::UNKNOWN_ERR,
- "Set notification led on period error");
+ return LogAndCreateResult(ErrorCode::UNKNOWN_ERR,
+ "Set notification led on period error",
+ ("Set notification led on period error: %d", ret));
}
return PlatformResult(ErrorCode::NO_ERROR);
int ret =
notification_set_led_time_period(noti_handle, on_period, off_period);
if (ret != NOTIFICATION_ERROR_NONE) {
- LoggerE("Set notification led off period error: %d", ret);
- return PlatformResult(ErrorCode::UNKNOWN_ERR,
- "Set notification led off period error");
+ return LogAndCreateResult(ErrorCode::UNKNOWN_ERR,
+ "Set notification led off period error",
+ ("Set notification led off period error: %d", ret));
}
return PlatformResult(ErrorCode::NO_ERROR);
++idx;
if (idx > thumbnails_map_size) {
- LoggerE("Too many values in notification thumbnail array");
- return PlatformResult(ErrorCode::INVALID_VALUES_ERR,
+ return LogAndCreateResult(ErrorCode::INVALID_VALUES_ERR,
"Too many values in notification thumbnail array");
}
}
if (notification_get_sound(noti_handle, &type, &path) !=
NOTIFICATION_ERROR_NONE) {
- LoggerE("Get notification sound error");
- return PlatformResult(ErrorCode::UNKNOWN_ERR,
+ return LogAndCreateResult(ErrorCode::UNKNOWN_ERR,
"Get notification sound error");
}
int ret = notification_set_sound(
noti_handle, NOTIFICATION_SOUND_TYPE_USER_DATA, sound_path.c_str());
if (ret != NOTIFICATION_ERROR_NONE) {
- LoggerE("Set notification sound error: %d", ret);
- return PlatformResult(ErrorCode::UNKNOWN_ERR,
- "Set notification sound error");
+ return LogAndCreateResult(ErrorCode::UNKNOWN_ERR,
+ "Set notification sound error",
+ ("Set notification sound error: %d", ret));
}
LoggerD("Sound path = %s", sound_path.c_str());
if (notification_get_vibration(noti_handle, &vib_type, NULL) !=
NOTIFICATION_ERROR_NONE) {
- LoggerE("Get notification vibration error");
- return PlatformResult(ErrorCode::UNKNOWN_ERR,
+ return LogAndCreateResult(ErrorCode::UNKNOWN_ERR,
"Get notification vibration error");
}
int ret = notification_set_vibration(noti_handle, vib_type, NULL);
if (ret != NOTIFICATION_ERROR_NONE) {
- LoggerE("Set notification vibration error: %d", ret);
- return PlatformResult(ErrorCode::UNKNOWN_ERR,
- "Set notification vibration error");
+ return LogAndCreateResult(ErrorCode::UNKNOWN_ERR,
+ "Set notification vibration error",
+ ("Set notification vibration error: %d", ret));
}
}
int ret = app_control_get_operation(app_handle, &operation);
if (ret != APP_CONTROL_ERROR_NONE) {
- LoggerE("Get application control operation error: %d", ret);
- return PlatformResult(ErrorCode::UNKNOWN_ERR,
- "Get application control operation error");
+ return LogAndCreateResult(ErrorCode::UNKNOWN_ERR,
+ "Get application control operation error",
+ ("Get application control operation error: %d", ret));
}
if (operation) {
out["operation"] = picojson::value(operation);
}
if (app_control_get_uri(app_handle, &uri) != APP_CONTROL_ERROR_NONE) {
- LoggerE("Get application control uri error");
- return PlatformResult(ErrorCode::UNKNOWN_ERR,
+ return LogAndCreateResult(ErrorCode::UNKNOWN_ERR,
"Get application control uri error");
}
if (uri) {
}
if (app_control_get_mime(app_handle, &mime) != APP_CONTROL_ERROR_NONE) {
- LoggerE("Get application control mime error");
- return PlatformResult(ErrorCode::UNKNOWN_ERR,
+ return LogAndCreateResult(ErrorCode::UNKNOWN_ERR,
"Get application control mime error");
}
if (mime) {
if (app_control_get_category(app_handle, &category) !=
APP_CONTROL_ERROR_NONE) {
- LoggerE("Get application control category error");
- return PlatformResult(ErrorCode::UNKNOWN_ERR,
+ return LogAndCreateResult(ErrorCode::UNKNOWN_ERR,
"Get application control category error");
}
if (category) {
if (app_control_foreach_extra_data(
app_handle, ServiceExtraDataCb, (void*)&app_control_data) !=
APP_CONTROL_ERROR_NONE) {
- LoggerE("Get application control data error");
- return PlatformResult(ErrorCode::UNKNOWN_ERR,
+ return LogAndCreateResult(ErrorCode::UNKNOWN_ERR,
"Get application control data error");
}
out["data"] = picojson::value(app_control_data);
ret = app_control_set_operation(app_handle, APP_CONTROL_OPERATION_DEFAULT);
}
if (ret != APP_CONTROL_ERROR_NONE) {
- LoggerE("Set application control operation error: %d", ret);
- return PlatformResult(ErrorCode::UNKNOWN_ERR,
- "Set application control operation error");
+ return LogAndCreateResult(ErrorCode::UNKNOWN_ERR,
+ "Set application control operation error",
+ ("Set application control operation error: %d", ret));
}
if (val.contains("uri") && !IsNull(app_ctrl, "uri")) {
const std::string& uri = common::FromJson<std::string>(app_ctrl, "uri");
ret = app_control_set_uri(app_handle, uri.c_str());
if (ret != APP_CONTROL_ERROR_NONE) {
- LoggerE("Set application control uri error: %d", ret);
- return PlatformResult(ErrorCode::UNKNOWN_ERR,
- "Set application control uri error");
+ return LogAndCreateResult(ErrorCode::UNKNOWN_ERR,
+ "Set application control uri error",
+ ("Set application control uri error: %d", ret));
}
}
const std::string& mime = common::FromJson<std::string>(app_ctrl, "mime");
ret = app_control_set_mime(app_handle, mime.c_str());
if (ret != APP_CONTROL_ERROR_NONE) {
- LoggerE("Set application control mime error: %d", ret);
- return PlatformResult(ErrorCode::UNKNOWN_ERR,
- "Set application control mime error");
+ return LogAndCreateResult(ErrorCode::UNKNOWN_ERR,
+ "Set application control mime error",
+ ("Set application control mime error: %d", ret));
}
}
common::FromJson<std::string>(app_ctrl, "category");
ret = app_control_set_category(app_handle, category.c_str());
if (ret != APP_CONTROL_ERROR_NONE) {
- LoggerE("Set application control category error: %d", ret);
- return PlatformResult(ErrorCode::UNKNOWN_ERR,
- "Set application control category error");
+ return LogAndCreateResult(ErrorCode::UNKNOWN_ERR,
+ "Set application control category error",
+ ("Set application control category error: %d", ret));
}
}
ret = app_control_add_extra_data_array(
app_handle, key.c_str(), arrayValue, values.size());
if (ret != APP_CONTROL_ERROR_NONE) {
- LoggerE("Set application control extra data error: %d", ret);
- return PlatformResult(ErrorCode::UNKNOWN_ERR,
- "Set application control extra data error");
+ return LogAndCreateResult(ErrorCode::UNKNOWN_ERR,
+ "Set application control extra data error",
+ ("Set application control extra data error: %d", ret));
}
}
if (app_control_get_app_id(app_handle, &app_id_str) !=
APP_CONTROL_ERROR_NONE) {
- LoggerE("Get applicaiton ID failed");
- return PlatformResult(ErrorCode::UNKNOWN_ERR, "Get applicaiton ID failed");
+ return LogAndCreateResult(ErrorCode::UNKNOWN_ERR, "Get applicaiton ID failed");
}
if (app_id_str != NULL) {
LoggerD("Enter");
int ret = app_control_set_app_id(app_handle, app_id.c_str());
if (ret != APP_CONTROL_ERROR_NONE) {
- LoggerE("Set applicaiton ID error: %d", ret);
- return PlatformResult(ErrorCode::UNKNOWN_ERR, "Set applicaiton ID error");
+ return LogAndCreateResult(ErrorCode::UNKNOWN_ERR, "Set applicaiton ID error",
+ ("Set applicaiton ID error: %d", ret));
}
LoggerD("Set appId = %s", app_id.c_str());
if (progess_type == kProgressTypeByte) {
if (notification_get_size(noti_handle, &tmp_progress_value) !=
NOTIFICATION_ERROR_NONE) {
- LoggerE("Get notification size error");
- return PlatformResult(ErrorCode::UNKNOWN_ERR,
+ return LogAndCreateResult(ErrorCode::UNKNOWN_ERR,
"Get notification size error");
}
} else if (progess_type == kProgressTypePercentage) {
if (notification_get_progress(noti_handle, &tmp_progress_value) !=
NOTIFICATION_ERROR_NONE) {
- LoggerE("Get notification progress error");
- return PlatformResult(ErrorCode::UNKNOWN_ERR,
+ return LogAndCreateResult(ErrorCode::UNKNOWN_ERR,
"Get notification progress error");
}
} else {
- LoggerE("Unknown notification progress type: %s ", progess_type.c_str());
- return PlatformResult(ErrorCode::UNKNOWN_ERR,
- "Unknown notification progress type");
+ return LogAndCreateResult(ErrorCode::UNKNOWN_ERR,
+ "Unknown notification progress type",
+ ("Unknown notification progress type: %s ", progess_type.c_str()));
}
LOGGER(DEBUG) << "Progress " << progess_type << " = " << tmp_progress_value;
progress_value);
}
} else {
- LoggerE("Unknown notification progress type: %s ", progress_type.c_str());
- return PlatformResult(ErrorCode::UNKNOWN_ERR,
- "Unknown notification progress type");
+ return LogAndCreateResult(ErrorCode::UNKNOWN_ERR,
+ "Unknown notification progress type",
+ ("Unknown notification progress type: %s ", progress_type.c_str()));
}
if (ret != NOTIFICATION_ERROR_NONE) {
- LoggerE("Set notification progress/size error: %d", ret);
- return PlatformResult(ErrorCode::UNKNOWN_ERR,
- "Set notification progress/size error");
+ return LogAndCreateResult(ErrorCode::UNKNOWN_ERR,
+ "Set notification progress/size error",
+ ("Set notification progress/size error: %d", ret));
}
return PlatformResult(ErrorCode::NO_ERROR);
if (notification_get_insert_time(noti_handle, posted_time) !=
NOTIFICATION_ERROR_NONE) {
- LoggerE("Get notification posted time error");
- return PlatformResult(ErrorCode::UNKNOWN_ERR,
+ return LogAndCreateResult(ErrorCode::UNKNOWN_ERR,
"Get notification posted time error");
}
LoggerD("Enter");
*noti_handle = notification_load(NULL, id);
if (NULL == *noti_handle) {
- LoggerE("Not found or removed notification id");
- return PlatformResult(ErrorCode::NOT_FOUND_ERR,
+ return LogAndCreateResult(ErrorCode::NOT_FOUND_ERR,
"Not found or removed notification id");
}
NOTIFICATION_LAUNCH_OPTION_APP_CONTROL,
static_cast<void*>(app_control));
if (ret != NOTIFICATION_ERROR_NONE) {
- LoggerE("Notification get launch option error: %d", ret);
- return PlatformResult(ErrorCode::INVALID_VALUES_ERR,
- "Notification get launch option error");
+ return LogAndCreateResult(ErrorCode::INVALID_VALUES_ERR,
+ "Notification get launch option error",
+ ("Notification get launch option error: %d", ret));
}
return PlatformResult(ErrorCode::NO_ERROR);
LoggerD("Enter");
int ret = app_control_create(app_control);
if (ret != APP_CONTROL_ERROR_NONE) {
- LoggerE("Application create error: %d", ret);
- return PlatformResult(ErrorCode::INVALID_VALUES_ERR,
- "Application create error");
+ return LogAndCreateResult(ErrorCode::INVALID_VALUES_ERR,
+ "Application create error",
+ ("Application create error: %d", ret));
}
return PlatformResult(ErrorCode::NO_ERROR);
NOTIFICATION_LAUNCH_OPTION_APP_CONTROL,
static_cast<void*>(app_control));
if (ret != APP_CONTROL_ERROR_NONE) {
- LoggerE("Notification set launch option error: %d", ret);
- return PlatformResult(ErrorCode::INVALID_VALUES_ERR,
- "Notification set launch option error");
+ return LogAndCreateResult(ErrorCode::INVALID_VALUES_ERR,
+ "Notification set launch option error",
+ ("Notification set launch option error: %d", ret));
}
return PlatformResult(ErrorCode::NO_ERROR);
notification_type_e noti_type = NOTIFICATION_TYPE_NONE;
int ret = notification_get_type(noti_handle, ¬i_type);
if (ret != NOTIFICATION_ERROR_NONE) {
- LoggerE("Notification get type error: %d", ret);
- return PlatformResult(ErrorCode::UNKNOWN_ERR,
- "Notification get type error");
+ return LogAndCreateResult(ErrorCode::UNKNOWN_ERR,
+ "Notification get type error",
+ ("Notification get type error: %d", ret));
}
notification_ly_type_e noti_layout = NOTIFICATION_LY_NONE;
ret = notification_get_layout(noti_handle, ¬i_layout);
if (ret != NOTIFICATION_ERROR_NONE) {
- LoggerE("Notification get layout error: %d", ret);
- return PlatformResult(ErrorCode::UNKNOWN_ERR,
- "Notification get layout error");
+ return LogAndCreateResult(ErrorCode::UNKNOWN_ERR,
+ "Notification get layout error",
+ ("Notification get layout error: %d", ret));
}
std::string noti_type_str;
} else {
ret = notification_insert(noti_handle, &id);
if (NOTIFICATION_ERROR_NONE != ret) {
- return PlatformResult(ErrorCode::UNKNOWN_ERR,
+ return LogAndCreateResult(ErrorCode::UNKNOWN_ERR,
"Cannot insert notification");
}
}
if (ret != NOTIFICATION_ERROR_NONE) {
- LoggerE("Post/Update notification error: %d", ret);
- return PlatformResult(ErrorCode::INVALID_VALUES_ERR,
- "Post/Update notification error");
+ return LogAndCreateResult(ErrorCode::INVALID_VALUES_ERR,
+ "Post/Update notification error",
+ ("Post/Update notification error: %d", ret));
}
time_t posted_time;