* @see stc_reset_rule_set_imsi()
* @see stc_reset_rule_set_iface_type()
* @see stc_reset_rule_set_time_interval()
- * @see stc_reset_rule_set_connection_period()
* @see stc_reset_rule_get_app_id()
* @see stc_reset_rule_get_imsi()
* @see stc_reset_rule_get_iface_type()
* @see stc_reset_rule_get_time_interval()
- * @see stc_reset_rule_get_connection_period()
*/
int stc_reset_stats(stc_h stc, stc_reset_rule_h rule);
time_t from, time_t to);
/**
- * @brief Sets the connection period for reset rule.
- * @since_tizen 4.0
- * @privlevel platform
- * @privilege %http://tizen.org/privilege/network.get
- *
- * @param[in] rule The reset rule handle
- * @param[in] period The connection period
- *
- * @return 0 on success, otherwise a negative error value
- * @retval #STC_ERROR_NONE Successful
- * @retval #STC_ERROR_OPERATION_FAILED General error
- * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #STC_ERROR_INVALID_OPERATION Invalid operation
- * @retval #STC_ERROR_NOT_INITIALIZED Not initialized
- * @retval #STC_ERROR_NOT_SUPPORTED Not supported
- * @retval #STC_ERROR_PERMISSION_DENIED Permission denied
- *
- * @see #stc_reset_rule_h
- * @see #stc_conn_period_e
- * @see stc_reset_rule_create()
- * @see stc_reset_rule_destroy()
- * @see stc_reset_rule_get_connection_period()
- */
-int stc_reset_rule_set_connection_period(stc_reset_rule_h rule,
- stc_conn_period_e period);
-
-/**
* @brief Gets the application ID for reset.
* @since_tizen 4.0
* @privlevel platform
time_t *from, time_t *to);
/**
- * @brief Gets the connection period for reset rule.
- * @since_tizen 4.0
- * @privlevel platform
- * @privilege %http://tizen.org/privilege/network.get
- *
- * @param[in] rule The reset rule handle
- * @param[out] period The connection period
- *
- * @return 0 on success, otherwise a negative error value
- * @retval #STC_ERROR_NONE Successful
- * @retval #STC_ERROR_OPERATION_FAILED General error
- * @retval #STC_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #STC_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #STC_ERROR_INVALID_OPERATION Invalid operation
- * @retval #STC_ERROR_NOT_INITIALIZED Not initialized
- * @retval #STC_ERROR_NOT_SUPPORTED Not supported
- * @retval #STC_ERROR_PERMISSION_DENIED Permission denied
- *
- * @see #stc_reset_rule_h
- * @see #stc_conn_period_e
- * @see stc_reset_rule_create()
- * @see stc_reset_rule_destroy()
- * @see stc_reset_rule_set_connection_period()
- */
-int stc_reset_rule_get_connection_period(stc_reset_rule_h rule,
- stc_conn_period_e *period);
-
-
-/**
* @}
*/
Name: capi-network-stc
Summary: A Smart Traffic Control (STC) libraries in Native API
-Version: 0.0.15
+Version: 0.0.16
Release: 1
Group: Network & Connectivity/API
License: Apache-2.0
#define STC_RESET_RULE_IFTYPE "iftype"
#define STC_RESET_RULE_INTERVAL_FROM "from"
#define STC_RESET_RULE_INTERVAL_TO "to"
-#define STC_RESET_RULE_CONNECION_STATE "connection_state"
typedef struct {
char app_id[STC_APP_ID_LEN];
char imsi[STC_IMSI_LEN];
stc_iface_type_e iface_type;
stc_time_interval_s interval;
- stc_conn_period_e conn_period;
} stc_reset_rule_s;
/*****************************************************************************
g_variant_new_uint16(reset_rule->iface_type));
}
- if (reset_rule->conn_period != STC_CONN_PERIOD_UNKNOWN) {
- g_variant_builder_add(builder, "{sv}",
- STC_RESET_RULE_CONNECION_STATE,
- g_variant_new_int32(reset_rule->conn_period));
- }
-
*params = g_variant_new("(@a{sv})", g_variant_builder_end(builder));
g_variant_builder_unref(builder);
}
return STC_ERROR_NONE;
}
-EXPORT_API int stc_reset_rule_set_connection_period(stc_reset_rule_h rule,
- stc_conn_period_e period)
-{
- CHECK_FEATURE_SUPPORTED(TIZEN_FEATURE_STC);
-
- if (rule == NULL) {
- STC_LOGE("Invalid parameter");
- return STC_ERROR_INVALID_PARAMETER;
- }
-
- stc_reset_rule_s *reset_rule = rule;
-
- switch (period) {
- case STC_CONN_PERIOD_UNKNOWN:
- case STC_CONN_PERIOD_LAST_RECEIVED_DATA:
- case STC_CONN_PERIOD_LAST_SENT_DATA:
- case STC_CONN_PERIOD_TOTAL_RECEIVED_DATA:
- case STC_CONN_PERIOD_TOTAL_SENT_DATA:
- reset_rule->conn_period = period;
- break;
- default:
- STC_LOGE("Invalid parameter");
- return STC_ERROR_INVALID_PARAMETER;
- }
-
- STC_LOGI("Connection period [%s]",
- _stc_convert_connection_period_to_string(reset_rule->conn_period));
-
- return STC_ERROR_NONE;
-}
-
EXPORT_API int stc_reset_rule_get_app_id(stc_reset_rule_h rule, char **app_id)
{
CHECK_FEATURE_SUPPORTED(TIZEN_FEATURE_STC);
return STC_ERROR_NONE;
}
-
-EXPORT_API int stc_reset_rule_get_connection_period(stc_reset_rule_h rule,
- stc_conn_period_e *period)
-{
- CHECK_FEATURE_SUPPORTED(TIZEN_FEATURE_STC);
-
- if (rule == NULL) {
- STC_LOGE("Invalid parameter");
- return STC_ERROR_INVALID_PARAMETER;
- }
-
- stc_reset_rule_s *reset_rule = (stc_reset_rule_s *)rule;
-
- *period = reset_rule->conn_period;
-
- STC_LOGI("Connection period [%s]",
- _stc_convert_connection_period_to_string(*period));
-
- return STC_ERROR_NONE;
-}
//LCOV_EXCL_STOP
static char g_reset_app_id[MENU_DATA_SIZE] = "";
static char g_reset_imsi[MENU_DATA_SIZE] = "";
static char g_reset_iface_type[MENU_DATA_SIZE] = "0";
-static char g_reset_conn_period[MENU_DATA_SIZE] = "0";
static char g_stats_app_id[MENU_DATA_SIZE] = "";
static char g_stats_iface_type[MENU_DATA_SIZE] = "0";
{
int ret = STC_ERROR_NONE;
stc_iface_type_e iface_type = (int)strtol(g_reset_iface_type, NULL, 10);
- stc_conn_period_e conn_period =
- (int)strtol(g_reset_conn_period, NULL, 10);
char *app_id = NULL;
char *imsi = NULL;
}
}
- if (conn_period > STC_CONN_PERIOD_UNKNOWN &&
- conn_period <= STC_CONN_PERIOD_TOTAL_SENT_DATA) {
- ret = stc_reset_rule_set_connection_period(g_reset_rule, conn_period);
- if (ret == STC_ERROR_NONE)
- msg(LOG_GREEN "Success to set time period" LOG_END);
- else {
- msg("Fail to set time period " LOG_RED "[%s]" LOG_END,
- test_stc_convert_error_type_to_string(ret));
- return ret;
- }
- }
-
msg(HR_SINGLE);
ret = stc_reset_rule_get_app_id(g_reset_rule, &app_id);
msg("Iftype: " LOG_CYAN "[%s]" LOG_END,
test_stc_convert_iface_type_to_string(iface_type));
- ret = stc_reset_rule_get_connection_period(g_reset_rule, &conn_period);
- if (ret == STC_ERROR_NONE)
- msg("Conn period: " LOG_CYAN "[%s]" LOG_END,
- test_stc_convert_period_to_string(conn_period));
-
msg(HR_SINGLE);
return STC_ERROR_NONE;
{ "1", "Application ID", NULL, NULL, g_reset_app_id},
{ "2", "Imsi", NULL, NULL, g_reset_imsi},
{ "3", "Interface type (1.Tel/2.Wifi/3.Wired/4.BT/5.All)", NULL, NULL, g_reset_iface_type},
- { "4", "Connection state", NULL, NULL, g_reset_conn_period},
{ "s", LOG_LIGHTMAGENTA "[Set]" LOG_END, NULL, __test_stc_set_reset_rule, NULL},
{ NULL, NULL, },
};