#define STATISTICS_DBUS_ERROR_NAME "net.stc.statistics.Error.Failed"
-#define STC_DBUS_REPLY(invocation, parameters) \
- g_dbus_method_invocation_return_value((invocation), parameters);
-
#define STC_STATISTICS_DBUS_REPLY_ERROR(invocation, err_num) \
g_dbus_method_invocation_return_dbus_error((invocation), \
STATISTICS_DBUS_ERROR_NAME, \
"OUT_OF_MEMORY",
"INVALID_PARAMETER",
"NO_DATA",
+ "ALREADY_DATA",
"UNINITIALIZED",
+ "PERMISSION_DENIED",
"NOTIMPL"
};
rule->iftype = g_variant_get_uint16(value);
STC_LOGD("iftype: [%u]", (unsigned int) rule->iftype);
+ } else if (!g_strcmp0(key, "app_id")) {
+ gsize length = 0;
+ rule->app_id = g_variant_dup_string(value, &length);
+ STC_LOGD("app_id: [%s]", rule->app_id);
+
+ } else if (!g_strcmp0(key, "granularity")) {
+ rule->granularity = g_variant_get_int32(value);
+ STC_LOGD("granularity: [%d]", rule->granularity);
+
} else {
STC_LOGD("Unknown select rule"); //LCOV_EXCL_LINE
}
GVariant *return_parameters = NULL;
stc_error_e ret;
+ stc_set_keep_alive(TRUE);
+
/* Total statistics since epoch */
rule.from = epoch;
rule.to = cur_time;
if (ret < STC_ERROR_NONE) {
g_variant_builder_unref(builder); //LCOV_EXCL_LINE
STC_STATISTICS_DBUS_REPLY_ERROR(invocation, ret); //LCOV_EXCL_LINE
+ g_free(rule.app_id);
__STC_LOG_FUNC_EXIT__; //LCOV_EXCL_LINE
return TRUE; //LCOV_EXCL_LINE
}
DEBUG_GDBUS_VARIANT("Return parameters: ", return_parameters);
STC_DBUS_REPLY(invocation, return_parameters);
+ g_free(rule.app_id);
__STC_LOG_FUNC_EXIT__;
return TRUE;
}
gboolean handle_statistics_init(StcStatistics *object,
- GDBusMethodInvocation *invocation)
+ GDBusMethodInvocation *invocation)
{
__STC_LOG_FUNC_ENTER__;
+ stc_set_keep_alive(TRUE);
+
STC_LOGI("stc statistics initialized");
stc_statistics_complete_init(object, invocation);
GVariant *return_parameters = NULL;
stc_error_e ret;
+ stc_set_keep_alive(TRUE);
+
/* Total statistics since epoch */
rule.from = epoch;
rule.to = cur_time;
if (ret < STC_ERROR_NONE) {
g_variant_builder_unref(builder); //LCOV_EXCL_LINE
STC_STATISTICS_DBUS_REPLY_ERROR(invocation, ret); //LCOV_EXCL_LINE
+ g_free(rule.app_id);
__STC_LOG_FUNC_EXIT__; //LCOV_EXCL_LINE
return TRUE; //LCOV_EXCL_LINE
}
DEBUG_GDBUS_VARIANT("Return parameters: ", return_parameters);
STC_DBUS_REPLY(invocation, return_parameters);
+ g_free(rule.app_id);
__STC_LOG_FUNC_EXIT__;
return TRUE;
}
GVariant *return_parameters = NULL;
stc_error_e ret;
+ stc_set_keep_alive(TRUE);
+
if (reset_rule != NULL) {
DEBUG_GDBUS_VARIANT("Selection rule: ", reset_rule);
GVariantIter *iter = NULL;