Modify tfeature init sequence
[platform/core/telephony/tel-plugin-database.git] / feature / tfeature.c
index 36d40ec..df6ebdb 100644 (file)
@@ -28,9 +28,9 @@
 #include <dlog.h>
 
 #define TFEATURE_LOG_TAG "TFEATURE"
-#define TFEATURE_INFO(fmt,args...) do { RLOG(LOG_INFO, TFEATURE_LOG_TAG, fmt "\n", ##args); } while (0)
-#define TFEATURE_WARN(fmt,args...) do { RLOG(LOG_WARN, TFEATURE_LOG_TAG, fmt "\n", ##args); } while (0)
-#define TFEATURE_ERR(fmt,args...) do { RLOG(LOG_ERROR, TFEATURE_LOG_TAG, fmt "\n", ##args); } while (0)
+#define TFEATURE_INFO(fmt, args...) do { RLOG(LOG_INFO, TFEATURE_LOG_TAG, fmt "\n", ##args); } while (0)
+#define TFEATURE_WARN(fmt, args...) do { RLOG(LOG_WARN, TFEATURE_LOG_TAG, fmt "\n", ##args); } while (0)
+#define TFEATURE_ERR(fmt, args...) do { RLOG(LOG_ERROR, TFEATURE_LOG_TAG, fmt "\n", ##args); } while (0)
 
 #define FEATURE_BITS                   (sizeof(unsigned char) * 8)
 #define MAX_FEATURE_LIST_BYTES (FEATURE_BITS * 4)
@@ -50,7 +50,7 @@ typedef struct {
        unsigned char feature_list[MAX_FEATURE_LIST_BYTES];     // support 255 (2 ^ FEATURE_BITS) features
 } q_feature_info;
 
-static q_feature_info features = {FALSE, {0,}};
+static q_feature_info features = {FALSE, {0,} };
 
 static void _tfeature_check_default_feature(void)
 {
@@ -94,37 +94,16 @@ static void _tfeature_check_build_feature(void)
 #endif
 }
 
-static void _tfeature_check_model_config()
+static void _tfeature_check_platform_feature()
 {
-       char *model_name;
        int ret;
+       char *model_name;
        bool b_lte_supported = false;
        bool b_gsm_supported = false;
        bool b_umts_suported = false;
        bool b_cdma_supported = false;
 
        ret = system_info_get_platform_string("http://tizen.org/system/model_name", &model_name);
-       if (SYSTEM_INFO_ERROR_NONE == ret && model_name) {
-               TFEATURE_INFO("model_name[%s]", model_name);
-               free(model_name);
-       }
-       system_info_get_platform_bool("tizen.org/feature/network.telephony.service.cdma", &b_cdma_supported);
-       system_info_get_platform_bool("tizen.org/feature/network.telephony.service.gsm", &b_gsm_supported);
-       system_info_get_platform_bool("tizen.org/feature/network.telephony.service.umts", &b_umts_suported);
-       system_info_get_platform_bool("tizen.org/feature/network.telephony.service.lte", &b_lte_supported);
-
-       if(true == b_lte_supported && false == b_gsm_supported && false == b_umts_suported && false == b_cdma_supported){
-               TFEATURE_INFO("LTE only model");
-               SET_FEATURE(TFEATURE_DEVICE_LTE_ONLY);
-       }
-}
-
-static void _tfeature_check_platform_feature()
-{
-       int ret;
-       char *model_name;
-
-       ret = system_info_get_platform_string("http://tizen.org/system/model_name", &model_name);
        if (ret != SYSTEM_INFO_ERROR_NONE) {
                TFEATURE_INFO("system_info_get_platform_string() failed!!! (%d,%s)", ret, get_error_message(ret));
                return;
@@ -137,6 +116,21 @@ static void _tfeature_check_platform_feature()
        }
 
        free(model_name);
+
+       system_info_get_platform_bool("tizen.org/feature/network.telephony.service.cdma", &b_cdma_supported);
+       system_info_get_platform_bool("tizen.org/feature/network.telephony.service.gsm", &b_gsm_supported);
+       system_info_get_platform_bool("tizen.org/feature/network.telephony.service.umts", &b_umts_suported);
+       system_info_get_platform_bool("tizen.org/feature/network.telephony.service.lte", &b_lte_supported);
+
+       if (true == b_lte_supported) {
+               TFEATURE_INFO("LTE SUPPORTED");
+               SET_FEATURE(TFEATURE_DEVICE_LTE_SUPPORTED);
+       }
+
+       if (true == b_lte_supported && false == b_gsm_supported && false == b_umts_suported && false == b_cdma_supported) {
+               TFEATURE_INFO("LTE only model");
+               SET_FEATURE(TFEATURE_DEVICE_LTE_ONLY);
+       }
 }
 
 static void _tfeature_print_hex_dump()
@@ -156,7 +150,7 @@ static void _tfeature_print_hex_dump()
                                memset(buf, 0, 255);
                                g_snprintf(buf, 255, "%s%04X: ", "[FEATURE_LIST]", i + 1);
                        } else {
-                               g_strlcat (buf, "  ", 255);
+                               g_strlcat(buf, "  ", 255);
                        }
                }
        }
@@ -168,7 +162,6 @@ static void _tfeature_init(void)
 {
        _tfeature_check_default_feature();
        _tfeature_check_build_feature();
-       _tfeature_check_model_config();
        _tfeature_check_platform_feature();
 
        _tfeature_print_hex_dump();
@@ -181,6 +174,7 @@ tfeature_support tfeature_is_supported(tfeature_name feature)
 
        if (!features.valid) {
                _tfeature_init();
+               TFEATURE_INFO("TFEATURE INITIALIZED!!!");
        }
 
        if (features.valid && feature < TFEATURE_MAX_VALUE) {