Check support before getting some value 86/118886/4 accepted/tizen/common/20170315.124745 accepted/tizen/ivi/20170315.104256 accepted/tizen/mobile/20170315.104208 accepted/tizen/tv/20170315.104225 accepted/tizen/unified/20170315.104314 accepted/tizen/wearable/20170315.104248 submit/tizen/20170315.004113
authorKichan Kwon <k_c.kwon@samsung.com>
Tue, 14 Mar 2017 10:24:39 +0000 (19:24 +0900)
committerKichan Kwon <k_c.kwon@samsung.com>
Tue, 14 Mar 2017 10:32:16 +0000 (19:32 +0900)
- Some features aren't supported but these vconf value is existed
- Therefore, we check support by using system-info

Change-Id: I8a77ed61472842d4861c99cb527973dc8365bc43
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
CMakeLists.txt
packaging/capi-system-runtime-info.spec
src/runtime_info_connectivity.c
src/runtime_info_location.c

index d596761..cacd1a6 100755 (executable)
@@ -10,7 +10,7 @@ SET(PREFIX ${CMAKE_INSTALL_PREFIX})
 SET(INC_DIR include)
 INCLUDE_DIRECTORIES(${INC_DIR})
 
-SET(requires "dlog vconf capi-base-common edbus")
+SET(requires "dlog vconf capi-base-common edbus capi-system-info")
 SET(pc_requires "capi-base-common")
 
 INCLUDE(FindPkgConfig)
index 6d8c32d..8674643 100644 (file)
@@ -12,6 +12,7 @@ BuildRequires:  pkgconfig(dlog)
 BuildRequires:  pkgconfig(vconf)
 BuildRequires:  pkgconfig(capi-base-common)
 BuildRequires: pkgconfig(edbus)
+BuildRequires:  pkgconfig(capi-system-info)
 Requires(post): /sbin/ldconfig  
 Requires(postun): /sbin/ldconfig
 
index a7a101d..1324758 100644 (file)
@@ -24,6 +24,8 @@
 #include <runtime_info.h>
 #include <runtime_info_private.h>
 
+#include <system_info.h>
+
 #ifdef LOG_TAG
 #undef LOG_TAG
 #endif
@@ -80,6 +82,14 @@ int runtime_info_wifi_hotspot_get_value(runtime_info_value_h value)
 {
        int vconf_value;
        int ret;
+       bool supported;
+
+       ret = system_info_get_platform_bool("http://tizen.org/feature/network.tethering.wifi", &supported);
+       if (ret != SYSTEM_INFO_ERROR_NONE)
+               return RUNTIME_INFO_ERROR_IO_ERROR;
+
+       if (!supported)
+               return RUNTIME_INFO_ERROR_NOT_SUPPORTED;
 
        ret = runtime_info_vconf_get_value_int(VCONF_WIFI_HOTSPOT_ENABLED, &vconf_value);
        if (ret == RUNTIME_INFO_ERROR_NONE)
@@ -102,6 +112,14 @@ int runtime_info_bt_hotspot_get_value(runtime_info_value_h value)
 {
        int vconf_value;
        int ret;
+       bool supported;
+
+       ret = system_info_get_platform_bool("http://tizen.org/feature/network.tethering.bluetooth", &supported);
+       if (ret != SYSTEM_INFO_ERROR_NONE)
+               return RUNTIME_INFO_ERROR_IO_ERROR;
+
+       if (!supported)
+               return RUNTIME_INFO_ERROR_NOT_SUPPORTED;
 
        ret = runtime_info_vconf_get_value_int(VCONF_BT_HOTSPOT_ENABLED, &vconf_value);
        if (ret == RUNTIME_INFO_ERROR_NONE)
@@ -124,6 +142,14 @@ int runtime_info_usb_hotspot_get_value(runtime_info_value_h value)
 {
        int vconf_value;
        int ret;
+       bool supported;
+
+       ret = system_info_get_platform_bool("http://tizen.org/feature/network.tethering.usb", &supported);
+       if (ret != SYSTEM_INFO_ERROR_NONE)
+               return RUNTIME_INFO_ERROR_IO_ERROR;
+
+       if (!supported)
+               return RUNTIME_INFO_ERROR_NOT_SUPPORTED;
 
        ret = runtime_info_vconf_get_value_int(VCONF_USB_HOTSPOT_ENABLED, &vconf_value);
        if (ret == RUNTIME_INFO_ERROR_NONE)
index e276bd8..608ccdc 100644 (file)
@@ -24,6 +24,8 @@
 #include <runtime_info.h>
 #include <runtime_info_private.h>
 
+#include <system_info.h>
+
 #ifdef LOG_TAG
 #undef LOG_TAG
 #endif
@@ -59,6 +61,14 @@ int runtime_info_location_network_get_value(runtime_info_value_h value)
 {
        int vconf_value;
        int ret;
+       bool supported;
+
+       ret = system_info_get_platform_bool("http://tizen.org/feature/location.wps", &supported);
+       if (ret != SYSTEM_INFO_ERROR_NONE)
+               return RUNTIME_INFO_ERROR_IO_ERROR;
+
+       if (!supported)
+               return RUNTIME_INFO_ERROR_NOT_SUPPORTED;
 
        ret = runtime_info_vconf_get_value_int(VCONF_LOCATION_NETWORK_ENABLED, &vconf_value);
        if (ret == RUNTIME_INFO_ERROR_NONE)