#include "sst.h"
#include "sst_interface.h"
-#define SETTING_INCOMING_CALL_PATH "tizen.org/feature/systemsetting.incoming_call"
-#define SETTING_HOME_SCREEN_PATH "tizen.org/feature/systemsetting.home_screen"
-#define SETTING_LOCK_SCREEN_PATH "tizen.org/feature/systemsetting.lock_screen"
-#define SETTING_NOTIFICATION_EMAIL_PATH "tizen.org/feature/systemsetting.notification_email"
-#define SETTING_WIFI_PATH "tizen.org/feature/network.wifi"
-#define SETTING_FONT_PATH "tizen.org/feature/systemsetting.font"
-#define SETTING_TELEPHONY_PATH "tizen.org/feature/network.telephony"
-#define SETTING_ACCESSIBILITY_GRAYSCALE_PATH "tizen.org/feature/accessibility.grayscale"
-#define SETTING_ACCESSIBILITY_NEGATIVE_PATH "tizen.org/feature/accessibility.negative"
-#define SETTING_INPUT_ROTATING_BEZEL_PATH "tizen.org/feature/input.rotating_bezel"
-#define SETTING_PROFILE_PATH "tizen.org/feature/profile"
-
-int system_settings_feature_check_bool(char *path)
+#define SST_FEATURE_ACCESSIBILITY_GRAYSCALE "tizen.org/feature/accessibility.grayscale"
+#define SST_FEATURE_ACCESSIBILITY_NEGATIVE "tizen.org/feature/accessibility.negative"
+#define SST_FEATURE_FONT "tizen.org/feature/systemsetting.font"
+#define SST_FEATURE_HOME_SCREEN "tizen.org/feature/systemsetting.home_screen"
+#define SST_FEATURE_INCOMING_CALL "tizen.org/feature/systemsetting.incoming_call"
+#define SST_FEATURE_INPUT_ROTATING_BEZEL "tizen.org/feature/input.rotating_bezel"
+#define SST_FEATURE_LOCK_SCREEN "tizen.org/feature/systemsetting.lock_screen"
+#define SST_FEATURE_NOTIFICATION_EMAIL "tizen.org/feature/systemsetting.notification_email"
+#define SST_FEATURE_PROFILE "tizen.org/feature/profile"
+#define SST_FEATURE_TELEPHONY "tizen.org/feature/network.telephony"
+#define SST_FEATURE_WIFI "tizen.org/feature/network.wifi"
+#define SST_FEATURE_ETHERNET "tizen.org/feature/network.ethernet"
+
+static int _check_feature(const char *path)
{
bool feature_data = false;
int ret = system_info_get_platform_bool(path, &feature_data);
if (ret != SYSTEM_INFO_ERROR_NONE) {
- SST_SECURE_TRACE("Setting - reading feature data failed, %d", ret);
- return SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
+ ERR("system_info_get_platform_bool(%s) Fail(%d)", path, ret);
+ return SYSTEM_SETTINGS_ERROR_IO_ERROR;
}
- ret = (feature_data == true) ? SYSTEM_SETTINGS_ERROR_NONE : SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
-
- return ret;
+ if (feature_data) {
+ return SYSTEM_SETTINGS_ERROR_NONE;
+ } else {
+ ERR("Not Support Feature(%s)", path);
+ return SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
+ }
}
-int system_setting_feature_check_incoming_call(void *value)
+int sst_feature_check_incoming_call(void *value)
{
static bool first_query = true;
static int ret = SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
if (first_query == true) {
- ret = system_settings_feature_check_bool(SETTING_INCOMING_CALL_PATH);
+ const char *feature = SST_FEATURE_INCOMING_CALL;
+ ret = _check_feature(feature);
+ if (SYSTEM_SETTINGS_ERROR_IO_ERROR == ret) {
+ ERR("_check_feature(%s) Fail(%d)", feature, ret);
+ return SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
+ }
first_query = false;
}
return ret;
}
-int system_setting_feature_check_home_screen(void *value)
+int sst_feature_check_home_screen(void *value)
{
static bool first_query = true;
static int ret = SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
if (first_query == true) {
- ret = system_settings_feature_check_bool(SETTING_HOME_SCREEN_PATH);
+ const char *feature = SST_FEATURE_HOME_SCREEN;
+ ret = _check_feature(feature);
+ if (SYSTEM_SETTINGS_ERROR_IO_ERROR == ret) {
+ ERR("_check_feature(%s) Fail(%d)", feature, ret);
+ return SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
+ }
first_query = false;
}
return ret;
}
-int system_setting_feature_check_lock_screen(void *value)
+int sst_feature_check_lock_screen(void *value)
{
static bool first_query = true;
static int ret = SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
if (first_query == true) {
- ret = system_settings_feature_check_bool(SETTING_LOCK_SCREEN_PATH);
+ const char *feature = SST_FEATURE_LOCK_SCREEN;
+ ret = _check_feature(feature);
+ if (SYSTEM_SETTINGS_ERROR_IO_ERROR == ret) {
+ ERR("_check_feature(%s) Fail(%d)", feature, ret);
+ return SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
+ }
first_query = false;
}
return ret;
}
-int system_setting_feature_check_notification_email(void *value)
+int sst_feature_check_notification_email(void *value)
{
static bool first_query = true;
static int ret = SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
if (first_query == true) {
- ret = system_settings_feature_check_bool(SETTING_NOTIFICATION_EMAIL_PATH);
+ const char *feature = SST_FEATURE_NOTIFICATION_EMAIL;
+ ret = _check_feature(feature);
+ if (SYSTEM_SETTINGS_ERROR_IO_ERROR == ret) {
+ ERR("_check_feature(%s) Fail(%d)", feature, ret);
+ return SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
+ }
first_query = false;
}
return ret;
}
-int system_setting_feature_check_wifi(void *value)
+int sst_feature_check_wifi(void *value)
{
static bool first_query = true;
static int ret = SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
if (first_query == true) {
- ret = system_settings_feature_check_bool(SETTING_WIFI_PATH);
+ const char *feature = SST_FEATURE_WIFI;
+ ret = _check_feature(feature);
+ if (SYSTEM_SETTINGS_ERROR_IO_ERROR == ret) {
+ ERR("_check_feature(%s) Fail(%d)", feature, ret);
+ return SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
+ }
first_query = false;
}
return ret;
}
-int system_setting_feature_check_telephony(void *value)
+int sst_feature_check_telephony(void *value)
{
static bool first_query = true;
static int ret = SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
if (first_query == true) {
- ret = system_settings_feature_check_bool(SETTING_TELEPHONY_PATH);
+ const char *feature = SST_FEATURE_TELEPHONY;
+ ret = _check_feature(feature);
+ if (SYSTEM_SETTINGS_ERROR_IO_ERROR == ret) {
+ ERR("_check_feature(%s) Fail(%d)", feature, ret);
+ return SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
+ }
first_query = false;
}
return ret;
}
-int system_setting_feature_check_font(void *value)
+int sst_feature_check_font(void *value)
{
static bool first_query = true;
static int ret = SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
if (first_query == true) {
- ret = system_settings_feature_check_bool(SETTING_FONT_PATH);
+ const char *feature = SST_FEATURE_FONT;
+ ret = _check_feature(feature);
+ if (SYSTEM_SETTINGS_ERROR_IO_ERROR == ret) {
+ ERR("_check_feature(%s) Fail(%d)", feature, ret);
+ return SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
+ }
first_query = false;
}
return ret;
}
-int system_setting_feature_check_accessibility_grayscale(void *value)
+int sst_feature_check_accessibility_grayscale(void *value)
{
static bool first_query = true;
static int ret = SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
if (first_query == true) {
- ret = system_settings_feature_check_bool(SETTING_ACCESSIBILITY_GRAYSCALE_PATH);
+ const char *feature = SST_FEATURE_ACCESSIBILITY_GRAYSCALE;
+ ret = _check_feature(feature);
+ if (SYSTEM_SETTINGS_ERROR_IO_ERROR == ret) {
+ ERR("_check_feature(%s) Fail(%d)", feature, ret);
+ return SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
+ }
first_query = false;
}
return ret;
}
-int system_setting_feature_check_accessibility_negative(void *value)
+int sst_feature_check_accessibility_negative(void *value)
{
static bool first_query = true;
static int ret = SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
if (first_query == true) {
- ret = system_settings_feature_check_bool(SETTING_ACCESSIBILITY_NEGATIVE_PATH);
+ const char *feature = SST_FEATURE_ACCESSIBILITY_NEGATIVE;
+ ret = _check_feature(feature);
+ if (SYSTEM_SETTINGS_ERROR_IO_ERROR == ret) {
+ ERR("_check_feature(%s) Fail(%d)", feature, ret);
+ return SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
+ }
first_query = false;
}
return ret;
}
-int system_setting_feature_check_wearable_profile(void *value)
+int sst_feature_check_rotary(void *value)
{
static bool first_query = true;
- static int ret = SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
+ static int result = SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
if (first_query == true) {
- char *profile_data = NULL;
- int rotary_feature = SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
- ret = system_info_get_platform_string(SETTING_PROFILE_PATH, &profile_data);
+ char *profile = NULL;
+ const char *feature = SST_FEATURE_PROFILE;
+ int ret = system_info_get_platform_string(feature, &profile);
if (ret != SYSTEM_INFO_ERROR_NONE) {
- SST_SECURE_TRACE("Setting - reading profile string failed, %d", ret);
+ ERR("system_info_get_platform_string(%s) Fail(%d)", feature, ret);
+ free(profile);
return SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
}
- rotary_feature = system_settings_feature_check_bool(SETTING_INPUT_ROTATING_BEZEL_PATH);
+ if (profile && SST_EQUAL == strcmp(profile, "wearable")) {
+ int can_rotary = _check_feature(SST_FEATURE_INPUT_ROTATING_BEZEL);
+ if (can_rotary == SYSTEM_SETTINGS_ERROR_IO_ERROR) {
+ ERR("system_info_get_platform_string(%s) Fail(%d)", feature, ret);
+ free(profile);
+ return SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
+ }
+ result = can_rotary;
+ }
+ free(profile);
+ first_query = false;
+ }
- if ((rotary_feature == SYSTEM_SETTINGS_ERROR_NONE) && profile_data && !strcmp(profile_data, "wearable"))
- ret = SYSTEM_SETTINGS_ERROR_NONE;
- else
- ret = SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
+ return result;
+}
- if (profile_data)
- free(profile_data);
+int sst_feature_check_automatic_time_update(void *value)
+{
+ static bool first_query = true;
+ static int ret = SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
+ const char *feature[] = {
+ SST_FEATURE_TELEPHONY,
+ SST_FEATURE_WIFI,
+ SST_FEATURE_ETHERNET
+ };
+ int cnt = sizeof(feature) / sizeof(char*);
+ if (first_query == true) {
+ for (int i = 0 ; i < cnt ; i++) {
+ int feature_result = _check_feature(feature[i]);
+ if (SYSTEM_SETTINGS_ERROR_NONE == feature_result) {
+ ret = feature_result;
+ break;
+ }
+ if (SYSTEM_SETTINGS_ERROR_IO_ERROR == feature_result) {
+ ERR("_check_feature(%s) Fail(%d)", feature[i], ret);
+ ret = SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
+ }
+ }
first_query = false;
}