return STC_CALLBACK_CONTINUE;
}
+void __test_stc_get_stats_finished_cb(stc_error_e result,
+ stc_all_stats_info_h info, void *user_data)
+{
+ if (result != STC_ERROR_NONE) {
+ msg("Response get stats finished error " LOG_RED "[%s]" LOG_END,
+ test_stc_convert_error_type_to_string(result));
+ return;
+ }
+
+ int ret = STC_ERROR_NONE;
+
+ ret = stc_foreach_all_stats(info, __test_stc_stats_info_cb, NULL);
+ if (ret == STC_ERROR_NONE)
+ msg(LOG_GREEN "Success to get all stats info" LOG_END);
+ else
+ msg("Fail to Success to get all stats info " LOG_RED "[%s]" LOG_END,
+ test_stc_convert_error_type_to_string(ret));
+
+ return;
+}
+
static int __test_stc_set_reset_rule(MManager *mm, struct menu_data *menu)
{
int ret = STC_ERROR_NONE;
return ret;
}
-static int __test_stc_foreach_stats(MManager *mm, struct menu_data *menu)
+static int __test_stc_stats_get_all(MManager *mm, struct menu_data *menu)
{
int ret = STC_ERROR_NONE;
time_t from = 0;
msg("Fail to set time interval " LOG_RED "[%s]" LOG_END,
test_stc_convert_error_type_to_string(ret));
- ret = stc_foreach_stats(g_stc,
+ ret = stc_get_all_stats(g_stc,
g_stats_rule,
- __test_stc_stats_info_cb,
+ __test_stc_get_stats_finished_cb,
NULL);
if (ret == STC_ERROR_NONE)
msg(LOG_GREEN "Success to request stats all info" LOG_END);
static struct menu_data menu_stats[] = {
{ "1", LOG_LIGHTMAGENTA "[Set]" LOG_END " stats rule", menu_stats_rule, NULL, NULL},
{ "2", LOG_LIGHTBLUE "[Get]" LOG_END " stats", NULL, __test_stc_stats_get, NULL},
- { "3", LOG_LIGHTBLUE "[Get]" LOG_END " all stats", NULL, __test_stc_foreach_stats, NULL},
+ { "3", LOG_LIGHTBLUE "[Get]" LOG_END " all stats", NULL, __test_stc_stats_get_all, NULL},
{ "4", LOG_LIGHTBLUE "[Get]" LOG_END " total stats", NULL, __test_stc_stats_get_total, NULL},
{ NULL, NULL, },
};