Modified roaming and ground enum 70/189570/1
authorhyunuktak <hyunuk.tak@samsung.com>
Wed, 19 Sep 2018 00:50:29 +0000 (09:50 +0900)
committerhyunuktak <hyunuk.tak@samsung.com>
Wed, 19 Sep 2018 00:54:38 +0000 (09:54 +0900)
Change-Id: Ia73c2a6396897411cda1f308391cbd949883769b
Signed-off-by: hyunuktak <hyunuk.tak@samsung.com>
include/stc.h
src/internal/stc-private.c
src/stc-restriction.c
src/stc-statistics.c
test/restriction.c
test/stc_test.c

index e5b53391ef53b4f8e80aff4e61bf995a198aad1c..560a25a37164770a912efe446375f2710dfbc2fe 100755 (executable)
@@ -148,9 +148,8 @@ typedef enum {
  * @since_tizen 4.0
  */
 typedef enum {
-       STC_ROAMING_UNKNOWN,     /**< Roaming unknown */
+       STC_ROAMING_DISABLED,    /**< Not in roaming */
        STC_ROAMING_ENABLED,     /**< In roaming */
-       STC_ROAMING_DISABLED,    /**< Not in roaming */
 } stc_roaming_type_e;
 
 /**
@@ -175,9 +174,9 @@ typedef enum {
  * @since_tizen 4.0
  */
 typedef enum {
-       STC_PROCESS_STATE_UNKNOWN = 0,              /**< Unknown state */
-       STC_PROCESS_STATE_FOREGROUND = 1 << 1,      /**< Foreground state */
-       STC_PROCESS_STATE_BACKGROUND = 1 << 2,      /**< Background state */
+       STC_PROCESS_STATE_UNKNOWN,         /**< Unknown state */
+       STC_PROCESS_STATE_FOREGROUND,      /**< Foreground state */
+       STC_PROCESS_STATE_BACKGROUND,      /**< Background state */
 } stc_process_state_e;
 
 /**
index eb7fbaabadb0e51403dd67be86ab59da2014a9c9..2306c515bbee7114106e3464ae999565ae66daeb 100755 (executable)
@@ -152,12 +152,10 @@ const char *_stc_convert_iface_type_to_string(stc_iface_type_e type)
 const char *_stc_convert_roaming_to_string(stc_roaming_type_e type)
 {
        switch (type) {
-       case STC_ROAMING_UNKNOWN:
-               return "Unknown";
-       case STC_ROAMING_ENABLED:
-               return "Enable";
        case STC_ROAMING_DISABLED:
                return "Disable";
+       case STC_ROAMING_ENABLED:
+               return "Enable";
        default:
                return "Unknown";
        }
index b5ad9c3de7f410a3397951407f0232e1a3a34048..3ba77fc6bfd0c7dbdc249cb1d15341ad6deea232 100755 (executable)
@@ -234,8 +234,7 @@ static void __stc_restriction_print_rule(
        if (rule->subscriber_id[0] != '\0')
                STC_LOGD("Sub_id:    [%s]", rule->subscriber_id);
 
-       if (rule->roaming_type != STC_ROAMING_UNKNOWN)
-               STC_LOGD("Roaming:   [%s]", _stc_convert_roaming_to_string(rule->roaming_type));
+       STC_LOGD("Roaming:   [%s]", _stc_convert_roaming_to_string(rule->roaming_type));
 
        if (rule->rstn_type != STC_RSTN_TYPE_UNKNOWN)
                STC_LOGD("Type:      [%s]", _stc_convert_rstn_type_to_string(rule->rstn_type));
@@ -508,8 +507,7 @@ stc_error_e _stc_restriction_validate_rule(
                        restriction_rule->month_start_date);
        }
 
-       STC_RETURN_VAL_IF(restriction_rule->roaming_type <= STC_ROAMING_UNKNOWN ||
-               restriction_rule->roaming_type > STC_ROAMING_DISABLED,
+       STC_RETURN_VAL_IF(restriction_rule->roaming_type > STC_ROAMING_ENABLED,
                STC_ERROR_INVALID_PARAMETER,
                "Roaming type is not valid [%s]",
                _stc_convert_roaming_to_string(restriction_rule->roaming_type));
@@ -566,8 +564,7 @@ stc_error_e _stc_restriction_check_set_rule(
                "Invalid month start date [%d]",
                restriction_rule->month_start_date);
 
-       STC_RETURN_VAL_IF(restriction_rule->roaming_type <= STC_ROAMING_UNKNOWN ||
-               restriction_rule->roaming_type > STC_ROAMING_DISABLED,
+       STC_RETURN_VAL_IF(restriction_rule->roaming_type > STC_ROAMING_ENABLED,
                STC_ERROR_INVALID_PARAMETER,
                "Roaming type is not valid [%s]",
                _stc_convert_roaming_to_string(restriction_rule->roaming_type));
@@ -670,8 +667,7 @@ stc_error_e _stc_restriction_check_remove_rule(
                "Invalid rx limit [%lld] bytes",
                restriction_rule->data_warn_limit);
 
-       STC_RETURN_VAL_IF(restriction_rule->roaming_type <= STC_ROAMING_UNKNOWN ||
-               restriction_rule->roaming_type > STC_ROAMING_DISABLED,
+       STC_RETURN_VAL_IF(restriction_rule->roaming_type > STC_ROAMING_ENABLED,
                STC_ERROR_INVALID_PARAMETER,
                "Roaming type is not valid [%d]",
                restriction_rule->roaming_type);
@@ -712,8 +708,7 @@ stc_error_e _stc_restriction_check_exclude_rule(
                "Invalid rx limit [%lld] bytes",
                restriction_rule->data_warn_limit);
 
-       STC_RETURN_VAL_IF(restriction_rule->roaming_type <= STC_ROAMING_UNKNOWN ||
-               restriction_rule->roaming_type > STC_ROAMING_DISABLED,
+       STC_RETURN_VAL_IF(restriction_rule->roaming_type > STC_ROAMING_ENABLED,
                STC_ERROR_INVALID_PARAMETER,
                "Roaming type is not valid [%d]",
                restriction_rule->roaming_type);
@@ -1123,9 +1118,8 @@ EXPORT_API int stc_restriction_rule_set_roaming_type(stc_restriction_rule_h rule
                (stc_restriction_rule_s *)rule;
 
        switch (roaming_type) {
-       case STC_ROAMING_UNKNOWN:
-       case STC_ROAMING_ENABLED:
        case STC_ROAMING_DISABLED:
+       case STC_ROAMING_ENABLED:
                restriction_rule->roaming_type = roaming_type;
                break;
        default:
index 678785bab7c6edf697d3d5a7d8a84531a285a64f..d4476ed604a480b031f89db9736cc70026978c62 100755 (executable)
@@ -245,8 +245,7 @@ static void __stc_stats_print_info(stc_stats_info_s *info)
        if (info->subscriber_id[0] != '\0')
                STC_LOGD("Sub_id:   [%s]", info->subscriber_id);
 
-       if (info->roaming_type != STC_ROAMING_UNKNOWN)
-               STC_LOGD("Roaming:  [%d]", info->roaming_type);
+       STC_LOGD("Roaming:  [%d]", info->roaming_type);
 
        STC_LOGD("Received: [%lld]", info->cnt.incoming_bytes);
        STC_LOGD("Sent:     [%lld]", info->cnt.outgoing_bytes);
index 201533d81b146761b036ad5cbcae15820b7741f9..1682f34f3dddccfa34fcc721e9ef3c5e748351d2 100755 (executable)
@@ -217,7 +217,7 @@ static int __test_stc_set_restriction_rule(MManager *mm, struct menu_data *menu)
                return ret;
        }
 
-       if (roaming > STC_ROAMING_UNKNOWN && roaming <= STC_ROAMING_DISABLED) {
+       if (roaming <= STC_ROAMING_ENABLED) {
                ret = stc_restriction_rule_set_roaming_type(g_restriction_rule, roaming);
                if (ret == STC_ERROR_NONE)
                        msg(LOG_GREEN "Success to set roaming type" LOG_END);
@@ -555,7 +555,7 @@ static struct menu_data menu_restriction_rule[] = {
        { "2", "Subscriber ID", NULL, NULL, g_subscriber_id},
        { "3", "Interface type(1.Tel/2.Wifi/3.Wired/4.BT/5.All)", NULL, NULL, g_iface_type},
        { "4", "Interface name", NULL, NULL, g_iface_name},
-       { "5", "Roaming(1.Enable/2.Disable)", NULL, NULL, g_roaming},
+       { "5", "Roaming(0.Disable/1.Enable)", NULL, NULL, g_roaming},
        { "6", "Type(1.Accept/2.Drop)", NULL, NULL, g_rstn_type},
        { "7", "Data limit", NULL, NULL, g_data_limit},
        { "8", "Warn limit", NULL, NULL, g_data_warn_limit},
index 88a3638084274e56d4ca32259e9e6f8dc4bd9408..54f01bff26427f948112f4f68ba2395c219582ff 100755 (executable)
@@ -109,12 +109,10 @@ const char *test_stc_convert_iface_type_to_string(stc_iface_type_e type)
 const char *test_stc_convert_roaming_to_string(stc_roaming_type_e type)
 {
        switch (type) {
-       case STC_ROAMING_UNKNOWN:
-               return "Unknown";
-       case STC_ROAMING_ENABLED:
-               return "Enable";
        case STC_ROAMING_DISABLED:
                return "Disable";
+       case STC_ROAMING_ENABLED:
+               return "Enable";
        default:
                return "Unknown";
        }