if (r != JOB_ERROR_NONE)
return job_error(r, __FUNCTION__, __LINE__, NULL);
- job_info->battery_not_low = battery_not_low;
+ job_info->battery_not_low = battery_not_low; /* LCOV_EXCL_LINE */
- return JOB_ERROR_NONE;
+ return JOB_ERROR_NONE; /* LCOV_EXCL_LINE */
}
int job_info_is_requires_battery_not_low(job_info_h job_info,
if (r != JOB_ERROR_NONE)
return job_error(r, __FUNCTION__, __LINE__, NULL);
- job_info->charging = charging;
+ job_info->charging = charging; /* LCOV_EXCL_LINE */
- return JOB_ERROR_NONE;
+ return JOB_ERROR_NONE; /* LCOV_EXCL_LINE */
}
int job_info_is_requires_charging(job_info_h job_info, int *charging)
}
if (job_info->job_id) {
+ /* LCOV_EXCL_START */
info->job_id = strdup(job_info->job_id);
if (info->job_id == NULL) {
- /* LCOV_EXCL_START */
free(info);
return job_error(JOB_ERROR_OUT_OF_MEMORY, __FUNCTION__,
__LINE__, NULL);
- /* LCOV_EXCL_STOP */
}
+ /* LCOV_EXCL_STOP */
}
info->interval = job_info->interval;
return JOB_ERROR_NONE;
}
+/* LCOV_EXCL_START */
int job_info_get_trigger_list(job_info_h job_info, bool **trigger_list)
{
if (job_info == NULL || trigger_list == NULL) {
- /* LCOV_EXCL_START */
return job_error(JOB_ERROR_INVALID_PARAMETER, __FUNCTION__,
__LINE__, NULL);
- /* LCOV_EXCL_STOP */
}
*trigger_list = job_info->trigger_list;
return JOB_ERROR_NONE;
}
+/* LCOV_EXCL_STOP */
int job_info_set_job_id(job_info_h job_info, const char *job_id)
{
static void __set_requires_value(const char *str, int *value)
{
if (str && strcmp(str, "true") == 0)
- *value = true;
+ *value = true; /* LCOV_EXCL_LINE */
else if (str && strcmp(str, "false") == 0)
- *value = false;
+ *value = false; /* LCOV_EXCL_LINE */
else
*value = -1;
}
val = bundle_get_val(b, AUL_K_JOB_PERSISTENT);
if (val)
- job_info->persistent = true;
+ job_info->persistent = true; /* LCOV_EXCL_LINE */
val = bundle_get_val(b, AUL_K_JOB_IS_ONCE);
if (val)
- job_info->once = true;
+ job_info->once = true; /* LCOV_EXCL_LINE */
val = bundle_get_val(b, AUL_K_JOB_REQ_TIMEOUT);
if (val && isdigit(*val))
- job_info->timeout = strtoul(val, NULL, 10);
+ job_info->timeout = strtoul(val, NULL, 10); /* LCOV_EXCL_LINE */
val = bundle_get_val(b, AUL_K_JOB_REQ_BATTERY_NOT_LOW);
__set_requires_value(val, &job_info->battery_not_low);
for (i = 0; i < ARRAY_SIZE(key_list); ++i) {
val = bundle_get_val(b, key_list[i]);
if (val)
- job_info->trigger_list[i] = true;
+ job_info->trigger_list[i] = true; /* LCOV_EXCL_LINE */
}
}
r = ctx_sched_job_get_user_data(job, (char **)&b_raw, &len);
if (r != 0) {
+ /* LCOV_EXCL_START */
_E("Failed to get user data");
return NULL;
+ /* LCOV_EXCL_STOP */
}
b = bundle_decode(b_raw, len);
return b;
}
+/* LCOV_EXCL_START */
static void __add_job(ctx_sched_job_h job)
{
bundle *b = NULL;
b = __get_bundle_from_job(job);
if (b == NULL) {
- /* LCOV_EXCL_START */
ctx_sched_job_destroy(job);
return;
- /* LCOV_EXCL_STOP */
}
job_id = bundle_get_val(b, AUL_K_JOB_ID);
if (job_id == NULL) {
- /* LCOV_EXCL_START */
ctx_sched_job_destroy(job);
bundle_free(b);
return;
- /* LCOV_EXCL_STOP */
}
if (!g_hash_table_contains(__handle.job_id_table, job_id))
b = __get_bundle_from_job(job);
if (b == NULL) {
- /* LCOV_EXCL_START */
ctx_sched_job_destroy(job);
return;
- /* LCOV_EXCL_STOP */
}
job_id = bundle_get_val(b, AUL_K_JOB_ID);
if (job_id == NULL) {
- /* LCOV_EXCL_START */
ctx_sched_job_destroy(job);
bundle_free(b);
return;
- /* LCOV_EXCL_STOP */
}
service_app_job_raise(SERVICE_APP_JOB_STATUS_STOP, job_id, b);
ctx_sched_job_destroy(job);
bundle_free(b);
}
+/* LCOV_EXCL_STOP */
static int __init_scheduler(ctx_sched_h *scheduler)
{
r = bundle_encode(b, &b_raw, &len);
if (r != BUNDLE_ERROR_NONE) {
+ /* LCOV_EXCL_START */
_E("Failed to encode bundle");
return JOB_ERROR_IO_ERROR;
+ /* LCOV_EXCL_STOP */
}
r = ctx_sched_job_set_user_data(job, (const char *)b_raw, len);
r = ctx_sched_get_job(__handle.scheduler, id, &job);
if (r != 0) {
+ /* LCOV_EXCL_START */
g_hash_table_remove(__handle.job_id_table, job_id);
return false;
+ /* LCOV_EXCL_STOP */
}
ctx_sched_job_destroy(job);
}
if (persistent)
- bundle_add(b, AUL_K_JOB_PERSISTENT, "true");
+ bundle_add(b, AUL_K_JOB_PERSISTENT, "true"); /* LCOV_EXCL_LINE */
return JOB_ERROR_NONE;
}
}
if (once)
- bundle_add(b, AUL_K_JOB_IS_ONCE, "true");
+ bundle_add(b, AUL_K_JOB_IS_ONCE, "true"); /* LCOV_EXCL_LINE */
return JOB_ERROR_NONE;
}
}
if (timeout) {
+ /* LCOV_EXCL_START */
snprintf(buf, sizeof(buf), "%u", timeout);
bundle_add(b, AUL_K_JOB_REQ_TIMEOUT, buf);
+ /* LCOV_EXCL_STOP */
}
return JOB_ERROR_NONE;
}
+/* LCOV_EXCL_START */
static int __add_str_attr_ne(ctx_sched_job_context_h context,
const char *name, const char *value)
{
r = ctx_sched_job_context_prepare_attribute_str(context, name);
if (r != 0) {
- /* LCOV_EXCL_START */
_E("Failed to prepare string attribute(%s) - %d", name, r);
return r;
- /* LCOV_EXCL_STOP */
}
r = ctx_sched_job_context_attribute_add_ne_str(context, name, value);
if (r != 0) {
- /* LCOV_EXCL_START */
_E("Failed to add string value(%s) - %d", value, r);
return r;
- /* LCOV_EXCL_STOP */
}
return JOB_ERROR_NONE;
r = ctx_sched_job_context_prepare_attribute_str(context, name);
if (r != 0) {
- /* LCOV_EXCL_START */
_E("Failed to prepare string attribute(%s) - %d", name, r);
return r;
- /* LCOV_EXCL_STOP */
}
r = ctx_sched_job_context_attribute_add_eq_str(context, name, value);
if (r != 0) {
- /* LCOV_EXCL_START */
_E("Failed to add string value(%s) - %d", value, r);
return r;
- /* LCOV_EXCL_STOP */
}
return JOB_ERROR_NONE;
r = ctx_sched_job_context_prepare_attribute_int(context, name);
if (r != 0) {
- /* LCOV_EXCL_START */
_E("Failed to prepare integer attribute(%s) - %d", name, r);
return r;
- /* LCOV_EXCL_STOP */
}
r = ctx_sched_job_context_attribute_add_eq_int(context, name, value);
if (r != 0) {
- /* LCOV_EXCL_START */
_E("Failed to add integer value(%d) - %d", value, r);
return r;
- /* LCOV_EXCL_STOP */
}
return JOB_ERROR_NONE;
}
+/* LCOV_EXCL_STOP */
static int __job_add_requires_battery_not_low(ctx_sched_job_h job,
job_info_h job_info, void *data)
if (battery_not_low == -1)
return JOB_ERROR_NONE;
+ /* LCOV_EXCL_START */
r = ctx_sched_job_requirement_create(CTX_SCHED_URI_BATTERY, false,
&requirement);
if (r != 0) {
- /* LCOV_EXCL_START */
_E("Failed to create requirement (%d)", r);
return r;
- /* LCOV_EXCL_STOP */
}
if (battery_not_low) {
r = __add_str_attr_ne(requirement, CTX_SCHED_ATTR_NAME_LEVEL,
CTX_SCHED_ATTR_VALUE_HIGH);
}
+
if (r != JOB_ERROR_NONE) {
- /* LCOV_EXCL_START */
ctx_sched_job_context_destroy(requirement);
return r;
- /* LCOV_EXCL_STOP */
}
r = ctx_sched_job_add_requirement(job, requirement);
if (r != 0) {
- /* LCOV_EXCL_START */
_E("Failed to add requirement (%d)", r);
ctx_sched_job_context_destroy(requirement);
return r;
- /* LCOV_EXCL_STOP */
}
if (battery_not_low)
bundle_add(b, AUL_K_JOB_REQ_BATTERY_NOT_LOW, "false");
return JOB_ERROR_NONE;
+ /* LCOV_EXCL_STOP */
}
static int __job_add_requires_charging(ctx_sched_job_h job,
if (charging == -1)
return JOB_ERROR_NONE;
+ /* LCOV_EXCL_START */
r = ctx_sched_job_requirement_create(CTX_SCHED_URI_BATTERY, false,
&requirement);
if (r != 0) {
- /* LCOV_EXCL_START */
_E("Failed to create requirement (%d)", r);
return r;
- /* LCOV_EXCL_STOP */
}
r = __add_int_attr_eq(requirement, CTX_SCHED_ATTR_NAME_IS_CHARGING,
charging);
if (r != JOB_ERROR_NONE) {
- /* LCOV_EXCL_START */
ctx_sched_job_context_destroy(requirement);
return r;
- /* LCOV_EXCL_STOP */
}
r = ctx_sched_job_add_requirement(job, requirement);
if (r != 0) {
- /* LCOV_EXCL_START */
_E("Failed to add requirement (%d)", r);
ctx_sched_job_context_destroy(requirement);
return r;
- /* LCOV_EXCL_STOP */
}
if (charging)
bundle_add(b, AUL_K_JOB_REQ_CHARGING, "false");
return JOB_ERROR_NONE;
+ /* LCOV_EXCL_STOP */
}
static int __job_add_requires_wifi_connection(ctx_sched_job_h job,
if (wifi_connection == -1)
return JOB_ERROR_NONE;
+ /* LCOV_EXCL_START */
r = ctx_sched_job_requirement_create(CTX_SCHED_URI_WIFI, false,
&requirement);
if (r != 0) {
- /* LCOV_EXCL_START */
_E("Failed to create requirement (%d)", r);
return r;
- /* LCOV_EXCL_STOP */
}
if (wifi_connection) {
r = __add_str_attr_ne(requirement, CTX_SCHED_ATTR_NAME_STATE,
CTX_SCHED_ATTR_VALUE_CONNECTED);
}
+
if (r != JOB_ERROR_NONE) {
- /* LCOV_EXCL_START */
ctx_sched_job_context_destroy(requirement);
return r;
- /* LCOV_EXCL_STOP */
}
r = ctx_sched_job_add_requirement(job, requirement);
if (r != 0) {
- /* LCOV_EXCL_START */
_E("Failed to add requirement (%d)", r);
ctx_sched_job_context_destroy(requirement);
return r;
- /* LCOV_EXCL_STOP */
}
if (wifi_connection)
bundle_add(b, AUL_K_JOB_REQ_WIFI_CONNECTION, "false");
return JOB_ERROR_NONE;
+ /* LCOV_EXCL_STOP */
}
+/* LCOV_EXCL_START */
static int __add_trigger_event(ctx_sched_job_h job, job_trigger_event_e event,
bundle *b)
{
r = ctx_sched_job_trigger_create(job_trigger_map[event].uri,
&trigger);
if (r != 0) {
- /* LCOV_EXCL_START */
_E("Failed to create trigger (%d)", r);
return r;
- /* LCOV_EXCL_STOP */
}
if (job_trigger_map[event].attr_type == ATTR_TYPE_INTEGER) {
r = ctx_sched_job_add_trigger(job, trigger);
if (r != 0) {
- /* LCOV_EXCL_START */
_E("Failed to add trigger (%d)", r);
ctx_sched_job_context_destroy(trigger);
return r;
- /* LCOV_EXCL_STOP */
}
bundle_add(b, job_trigger_map[event].key, "true");
return JOB_ERROR_NONE;
}
+/* LCOV_EXCL_STOP */
static int __job_add_trigger_events(ctx_sched_job_h job,
job_info_h job_info, void *data)
if (interval != 0)
return JOB_ERROR_NONE;
+ /* LCOV_EXCL_START */
r = job_info_get_trigger_list(job_info, &trigger_list);
if (r != JOB_ERROR_NONE)
return r;
}
return JOB_ERROR_NONE;
+ /* LCOV_EXCL_STOP */
}
static job_add_cb job_constructor[] = {
job_info_get_periodic(job_info, &interval);
if (interval == 0) {
- r = ctx_sched_job_create_on_demand(&job);
+ r = ctx_sched_job_create_on_demand(&job); /* LCOV_EXCL_LINE */
} else {
snprintf(buf, sizeof(buf), "%u", interval);
bundle_add(b, AUL_K_JOB_PERIODIC, buf);
return JOB_ERROR_NONE;
}
+/* LCOV_EXCL_START*/
static int __job_service_cb(int event, const char *job_id, bundle *job_data,
void *user_data)
{
return 0;
}
+/* LCOV_EXCL_STOP */
static struct job_service_s *__create_job_service(const char *job_id,
job_service_callback_s *callback, void *user_data)
int r;
if (uri == NULL) {
+ /* LCOV_EXCL_START */
return job_error(JOB_ERROR_INVALID_PARAMETER, __FUNCTION__,
__LINE__, NULL);
+ /* LCOV_EXCL_STOP */
}
if (!__handle.initialized) {
int r;
if (uri == NULL) {
+ /* LCOV_EXCL_START */
return job_error(JOB_ERROR_INVALID_PARAMETER, __FUNCTION__,
__LINE__, NULL);
+ /* LCOV_EXCL_STOP */
}
if (!__handle.initialized) {
_I("Cynara initialized");
return 0;
-err:
+
/* LCOV_EXCL_START */
+err:
if (conf)
cynara_configuration_destroy(conf);