Use system-info API to get model name 10/232210/3 submit/tizen/20200506.042825
authorSeonah Moon <seonah1.moon@samsung.com>
Wed, 29 Apr 2020 05:36:14 +0000 (14:36 +0900)
committerSeonah Moon <seonah1.moon@samsung.com>
Wed, 29 Apr 2020 05:38:50 +0000 (14:38 +0900)
Change-Id: I7da2499c2ff96b2ba3c66981808a243e14d0f6cb

CMakeLists.txt
packaging/wifi-efl-ug.spec
sources/libraries/Common/common_utils.c

index dfa2a57..62076a5 100644 (file)
@@ -24,6 +24,7 @@ pkg_check_modules(pkgs REQUIRED
        ui-gadget-1
        capi-network-connection
        capi-network-wifi-manager
+       capi-system-info
        sensor
        openssl1.1
        cert-svc-vcore
index e4c8617..cc80655 100644 (file)
@@ -1,6 +1,6 @@
 Name:          wifi-efl-ug
 Summary:       Wi-Fi UI Gadget for TIZEN
-Version:       1.0.243
+Version:       1.0.244
 Release:       1
 Group:         App/Network
 License:       Flora-1.1
@@ -23,6 +23,7 @@ BuildRequires:        pkgconfig(capi-ui-efl-util)
 BuildRequires: pkgconfig(feedback)
 BuildRequires: pkgconfig(efl-extension)
 BuildRequires: pkgconfig(aul)
+BuildRequires: pkgconfig(capi-system-info)
 #BuildRequires:  pkgconfig(setting-common-internal)
 #BuildRequires:  pkgconfig(setting-lite-common-internal)
 BuildRequires: cmake
index b95292d..a938520 100755 (executable)
@@ -25,6 +25,7 @@
 #include <libxml/xmlmemory.h>
 #include <libxml/parser.h>
 #include <libxml/tree.h>
+#include <system_info.h>
 
 #include "common.h"
 #include "ug_wifi.h"
@@ -750,72 +751,6 @@ int common_utils_get_sim_state(void)
        return value;
 }
 
-static inline int __get_model_from_model_config_xml(const char *field, char **value)
-{
-       char *node_name = NULL;
-       char *node_value = NULL;
-       xmlNode *cur_node = NULL;
-       xmlNodePtr cur_ptr = NULL;
-       xmlNodePtr model_ptr = NULL;
-       xmlDocPtr xml_doc = NULL;
-
-       xml_doc = xmlParseFile(MODEL_CONFIG_FILE);
-       if (xml_doc == NULL)
-               return -1;
-
-       cur_ptr = xmlDocGetRootElement(xml_doc);
-       if (cur_ptr == NULL) {
-               xmlFreeDoc(xml_doc);
-               return -1;
-       }
-
-       for (cur_node = cur_ptr; cur_node; cur_node = cur_node->next) {
-               if (!xmlStrcmp(cur_ptr->name, (const xmlChar*)MODEL_CONFIG_TAG))
-                       break;
-       }
-
-       cur_ptr = cur_ptr->xmlChildrenNode;
-       for (cur_node = cur_ptr; cur_node; cur_node = cur_node->next) {
-               if (!xmlStrcmp(cur_node->name, (const xmlChar*)FEATURE_TAG)) {
-                       model_ptr = cur_node;
-                       break;
-               }
-       }
-
-       if (model_ptr == NULL) {
-               xmlFreeDoc(xml_doc);
-               return -1;
-       }
-
-       if (model_ptr) {
-               cur_ptr = model_ptr->xmlChildrenNode;
-
-               for (cur_node = cur_ptr; cur_node; cur_node = cur_node->next) {
-                       if (cur_node->type == XML_ELEMENT_NODE) {
-                               node_name = (char *)xmlGetProp(cur_node, (const xmlChar*)"name");
-                               if (node_name == NULL) {
-                                       xmlFreeDoc(xml_doc);
-                                       return -1;
-                               }
-
-                               if (!strncmp(node_name, field, strlen(node_name))) {
-                                       node_value = (char *)xmlNodeListGetString(xml_doc, cur_node->xmlChildrenNode, 1);
-                                       if (node_value) {
-                                               *value = strdup(node_value);
-                                               free(node_name);
-                                               free(node_value);
-                                               break;
-                                       }
-                               }
-                               free(node_name);
-                       }
-               }
-       }
-
-       xmlFreeDoc(xml_doc);
-       return 0;
-}
-
 Eina_Bool _is_emulator(void)
 {
        char *model_name = NULL;
@@ -825,7 +760,7 @@ Eina_Bool _is_emulator(void)
        else if (emulator == TIZEN_MODEL_NOT_EMULATOR)
                return EINA_FALSE;
 
-       if (__get_model_from_model_config_xml("tizen.org/system/model_name", &model_name) < 0)
+       if (system_info_get_platform_string("http://tizen.org/system/model_name", &model_name) < 0)
                return EINA_FALSE;
 
        if (model_name == NULL)