From 97cc3738fb7d5aa515e53954e2c26b5a20f94360 Mon Sep 17 00:00:00 2001 From: Kichan Kwon Date: Mon, 14 May 2018 13:43:15 +0900 Subject: [PATCH] Check support if we can - Wi-Fi, Bluetooth, GPS, location, auto rotation and battery Change-Id: Id3fe52bb59bfc058128790f73dab793eeb50eed4 Signed-off-by: Kichan Kwon --- src/runtime_info_connectivity.c | 6 ++++++ src/runtime_info_location.c | 2 ++ src/runtime_info_system.c | 6 ++++++ 3 files changed, 14 insertions(+) diff --git a/src/runtime_info_connectivity.c b/src/runtime_info_connectivity.c index a9c1f84..3961db6 100644 --- a/src/runtime_info_connectivity.c +++ b/src/runtime_info_connectivity.c @@ -44,6 +44,8 @@ int runtime_info_wifi_status_get_value(runtime_info_value_h value) int vconf_value; int ret; + RETURN_ERROR_IF_NOT_SUPPORTED("http://tizen.org/feature/network.wifi"); + ret = runtime_info_vconf_get_value_int(VCONF_WIFI_STATUS, &vconf_value); if (ret != RUNTIME_INFO_ERROR_NONE) return ret; @@ -84,6 +86,8 @@ int runtime_info_bt_enabled_get_value(runtime_info_value_h value) int vconf_value; int ret; + RETURN_ERROR_IF_NOT_SUPPORTED("http://tizen.org/feature/network.bluetooth"); + ret = runtime_info_vconf_get_value_int(VCONF_BT_ENABLED, &vconf_value); if (ret != RUNTIME_INFO_ERROR_NONE) return ret; @@ -238,6 +242,8 @@ int runtime_info_gps_status_get_value(runtime_info_value_h value) int vconf_value; int ret; + RETURN_ERROR_IF_NOT_SUPPORTED("http://tizen.org/feature/location.gps"); + ret = runtime_info_vconf_get_value_int(VCONF_GPS_STATUS, &vconf_value); if (ret != RUNTIME_INFO_ERROR_NONE) return ret; diff --git a/src/runtime_info_location.c b/src/runtime_info_location.c index a74b006..3acddf7 100644 --- a/src/runtime_info_location.c +++ b/src/runtime_info_location.c @@ -41,6 +41,8 @@ int runtime_info_location_service_get_value(runtime_info_value_h value) LOGW("DEPRECATION WARNING: RUNTIME_INFO_KEY_LOCATION_SERVICE_ENABLED is deprecated and will be removed from next release."); + RETURN_ERROR_IF_NOT_SUPPORTED("http://tizen.org/feature/location"); + ret = runtime_info_vconf_get_value_int(VCONF_LOCATION_SERVICE_ENABLED, &vconf_value); if (ret == RUNTIME_INFO_ERROR_NONE) value->b = vconf_value; diff --git a/src/runtime_info_system.c b/src/runtime_info_system.c index 74f0ffe..cd9d678 100644 --- a/src/runtime_info_system.c +++ b/src/runtime_info_system.c @@ -94,6 +94,8 @@ int runtime_info_auto_rotation_enabled_get_value(runtime_info_value_h value) int vconf_value; int ret; + RETURN_ERROR_IF_NOT_SUPPORTED("http://tizen.org/feature/screen.auto_rotation"); + ret = runtime_info_vconf_get_value_bool(VCONF_ROTATION_LOCK_ENABLED, &vconf_value); if (ret == RUNTIME_INFO_ERROR_NONE) value->b = (bool)vconf_value; @@ -116,6 +118,8 @@ int runtime_info_battery_charging_get_value(runtime_info_value_h value) int vconf_value; int ret; + RETURN_ERROR_IF_NOT_SUPPORTED("http://tizen.org/feature/battery"); + ret = runtime_info_vconf_get_value_int(VCONF_BATTERY_CHARGING, &vconf_value); if (ret == RUNTIME_INFO_ERROR_NONE) value->b = vconf_value; @@ -237,6 +241,8 @@ int runtime_info_charger_connected_get_value(runtime_info_value_h value) int vconf_value; int ret; + RETURN_ERROR_IF_NOT_SUPPORTED("http://tizen.org/feature/battery"); + ret = runtime_info_vconf_get_value_int(VCONF_CHARGER_CONNECTED, &vconf_value); if (ret != RUNTIME_INFO_ERROR_NONE) return ret; -- 2.7.4