From 98904423896b2255a8776c65cb96845e30ff4521 Mon Sep 17 00:00:00 2001 From: Seonah Moon Date: Wed, 29 Apr 2020 14:36:14 +0900 Subject: [PATCH] Use system-info API to get model name Change-Id: I7da2499c2ff96b2ba3c66981808a243e14d0f6cb --- CMakeLists.txt | 1 + packaging/wifi-efl-ug.spec | 3 +- sources/libraries/Common/common_utils.c | 69 +-------------------------------- 3 files changed, 5 insertions(+), 68 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dfa2a57..62076a5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 diff --git a/packaging/wifi-efl-ug.spec b/packaging/wifi-efl-ug.spec index e4c8617..cc80655 100644 --- a/packaging/wifi-efl-ug.spec +++ b/packaging/wifi-efl-ug.spec @@ -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 diff --git a/sources/libraries/Common/common_utils.c b/sources/libraries/Common/common_utils.c index b95292d..a938520 100755 --- a/sources/libraries/Common/common_utils.c +++ b/sources/libraries/Common/common_utils.c @@ -25,6 +25,7 @@ #include #include #include +#include #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) -- 2.7.4