fix callback port number & betweeny bug
[platform/core/api/system-settings.git] / src / system_setting_platform.c
index 4219bbb..e0fd469 100644 (file)
        } while (0);
 #define FREE(arg) __FREE(free, arg)
 
+#ifdef SETTING_ARCH_64
+#define SETTING_UTILS_SO_FILE_PATH "/usr/lib64/libsystem-settings-util.so.0.1.0"
+#else
+#define SETTING_UTILS_SO_FILE_PATH "/usr/lib/libsystem-settings-util.so.0.1.0"
+#endif
 
 int _is_file_accessible(const char *path);
 
@@ -161,11 +166,12 @@ int system_setting_get_font_size(system_settings_key_e key, system_setting_data_
 {
        SETTING_TRACE_BEGIN;
        int vconf_value;
+       int ** val = (int**)value;
 
        if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, &vconf_value)) {
                return SYSTEM_SETTINGS_ERROR_IO_ERROR;
        }
-       *value = (void *)vconf_value;
+       **val = vconf_value;
 
        return SYSTEM_SETTINGS_ERROR_NONE;
 }
@@ -520,7 +526,7 @@ static bool dl_is_supported_image_type_load(char *path)
        bool ret = false;
        bool (*image_type_check)(char *path);
 
-       handle = dlopen("/usr/lib/libsystem-settings-util.so.0.1.0",  RTLD_LAZY);
+       handle = dlopen(SETTING_UTILS_SO_FILE_PATH,  RTLD_LAZY);
        if (!handle) {
                SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
                return false;
@@ -548,7 +554,7 @@ static int dl_is_available_font(char *str)
        int ret = false;
        int (*check_available_font)(char *font_name);
 
-       handle = dlopen("/usr/lib/libsystem-settings-util.so.0.1.0",  RTLD_LAZY);
+       handle = dlopen(SETTING_UTILS_SO_FILE_PATH,  RTLD_LAZY);
        if (!handle) {
                SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
                return false;
@@ -575,7 +581,7 @@ static void dl_font_size_set()
        char *error;
        void (*set_font_size)();
 
-       handle = dlopen("/usr/lib/libsystem-settings-util.so.0.1.0",  RTLD_LAZY);
+       handle = dlopen(SETTING_UTILS_SO_FILE_PATH,  RTLD_LAZY);
        if (!handle) {
                SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
                return;
@@ -602,7 +608,7 @@ static void dl_font_config_set_notification()
        char *error;
        void (*set_font_nodification)();
 
-       handle = dlopen("/usr/lib/libsystem-settings-util.so.0.1.0",  RTLD_LAZY);
+       handle = dlopen(SETTING_UTILS_SO_FILE_PATH,  RTLD_LAZY);
        if (!handle) {
                SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
                return;
@@ -630,7 +636,7 @@ static bool dl_font_config_set(char *font_name)
        bool ret = false;
        bool (*check_font_type)(char *font_name);
 
-       handle = dlopen("/usr/lib/libsystem-settings-util.so.0.1.0",  RTLD_LAZY);
+       handle = dlopen(SETTING_UTILS_SO_FILE_PATH,  RTLD_LAZY);
        if (!handle) {
                SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
                return false;
@@ -658,7 +664,7 @@ static char *dl_get_font_info(char *str)
        char *ret = NULL;
        char *(*get_font_info)();
 
-       handle = dlopen("/usr/lib/libsystem-settings-util.so.0.1.0",  RTLD_LAZY);
+       handle = dlopen(SETTING_UTILS_SO_FILE_PATH,  RTLD_LAZY);
        if (!handle) {
                SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
                return false;
@@ -969,7 +975,7 @@ int system_setting_set_font_size(system_settings_key_e key, system_setting_data_
 {
        SETTING_TRACE_BEGIN;
        int *vconf_value;
-       vconf_value = (int *)value;
+       vconf_value = *(int **)value;
 
        if (*vconf_value < 0 || *vconf_value > SYSTEM_SETTINGS_FONT_SIZE_GIANT) {
                return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
@@ -1607,8 +1613,9 @@ int system_setting_get_time_changed(system_settings_key_e key, system_setting_da
 {
        SETTING_TRACE_BEGIN;
        time_t cur_tick;
+       int ** val = (int**)value;
        cur_tick = time(NULL);
-       *value = (void *)cur_tick;
+       **val = cur_tick;
        /* struct tm * localtime = time (cur_tick); */
        /* printf("%s\n", ctime(&cur_tick); */
        return SYSTEM_SETTINGS_ERROR_NONE;
@@ -1824,11 +1831,12 @@ int system_setting_get_screen_backlight_time(system_settings_key_e key, system_s
 {
        SETTING_TRACE_BEGIN;
        int vconf_value;
+       int ** val = (int**)value;
 
        if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL, &vconf_value)) {
                return SYSTEM_SETTINGS_ERROR_IO_ERROR;
        }
-       *value = (void *)vconf_value;
+       **val = vconf_value;
 
        return SYSTEM_SETTINGS_ERROR_NONE;
 }
@@ -1839,9 +1847,9 @@ int system_setting_set_screen_backlight_time(system_settings_key_e key, system_s
 {
        SETTING_TRACE_BEGIN;
        int *vconf_value;
-       vconf_value = (int *)value;
+       vconf_value = *(int **)value;
 
-       if (!(*vconf_value > 0 && *vconf_value < 600)) {
+       if (!(*vconf_value > 0 && *vconf_value <= 600)) {
                SETTING_TRACE(" ERR Betweeny here  0 ~ 600");
                return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
        }
@@ -1857,7 +1865,7 @@ int system_setting_set_screen_backlight_time(system_settings_key_e key, system_s
 int system_setting_set_changed_callback_screen_backlight_time(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
 {
        SETTING_TRACE_BEGIN;
-       return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL, SYSTEM_SETTINGS_KEY_DISPLAY_SCREEN_ROTATION_AUTO, 2, user_data);
+       return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL, SYSTEM_SETTINGS_KEY_SCREEN_BACKLIGHT_TIME, 2, user_data);
 }
 
 int system_setting_unset_changed_callback_screen_backlight_time(system_settings_key_e key)
@@ -1887,10 +1895,13 @@ int system_setting_set_sound_notification(system_settings_key_e key, system_sett
 
        int is_load = _is_file_accessible(vconf_value);
        if (is_load == 0) {
+               //SETTING_TRACE(" system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, %s) TRY", vconf_value);
                if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, vconf_value)) {
+                       //SETTING_TRACE(" system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, %s) FAIL", vconf_value);
                        return SYSTEM_SETTINGS_ERROR_IO_ERROR;
                }
        } else {
+               //SETTING_TRACE(" is_file_accessibile FAILED - system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, %s) FAIL", vconf_value);
                return SYSTEM_SETTINGS_ERROR_IO_ERROR;
        }
 
@@ -1901,7 +1912,7 @@ int system_setting_set_sound_notification(system_settings_key_e key, system_sett
 int system_setting_set_changed_callback_sound_notification(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
 {
        SETTING_TRACE_BEGIN;
-       return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE, 0, user_data);
+       return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, SYSTEM_SETTINGS_KEY_SOUND_NOTIFICATION, 0, user_data);
 }
 
 int system_setting_unset_changed_callback_sound_notification(system_settings_key_e key)
@@ -1913,12 +1924,13 @@ int system_setting_unset_changed_callback_sound_notification(system_settings_key
 int system_setting_get_notification_repetition_period(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
 {
        SETTING_TRACE_BEGIN;
+       int ** val = (int**)value;
        int vconf_value;
 
        if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_NOTI_MSG_ALERT_REP_TYPE_INT, &vconf_value)) {
                return SYSTEM_SETTINGS_ERROR_IO_ERROR;
        }
-       *value = (void *)vconf_value;
+       **val = vconf_value;
 
        return SYSTEM_SETTINGS_ERROR_NONE;
 }
@@ -1928,7 +1940,7 @@ int system_setting_set_notification_repetition_period(system_settings_key_e key,
 {
        SETTING_TRACE_BEGIN;
        int *vconf_value;
-       vconf_value = (int *)value;
+       vconf_value = *(int **)value;
 
        if (system_setting_vconf_set_value_int(VCONFKEY_SETAPPL_NOTI_MSG_ALERT_REP_TYPE_INT, *vconf_value)) {
                return SYSTEM_SETTINGS_ERROR_IO_ERROR;
@@ -2044,11 +2056,12 @@ int system_setting_unset_changed_callback_network_wifi_notification(system_setti
 int system_setting_get_lock_state(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
 {
        int vconf_value;
+       int ** val = (int**)value;
 
        if (system_setting_vconf_get_value_int(VCONFKEY_IDLE_LOCK_STATE_READ_ONLY, &vconf_value)) {
                return SYSTEM_SETTINGS_ERROR_IO_ERROR;
        }
-       *value = (void *)vconf_value;
+       **val = vconf_value;
 
        return SYSTEM_SETTINGS_ERROR_NONE;
 }
@@ -2059,7 +2072,7 @@ int system_setting_set_lock_state(system_settings_key_e key, system_setting_data
 {
        SETTING_TRACE_BEGIN;
        int *vconf_value;
-       vconf_value = (int *)value;
+       vconf_value = *(int **)value;
 
        if (system_setting_vconf_set_value_int(VCONFKEY_IDLE_LOCK_STATE_READ_ONLY, *vconf_value)) {
                return SYSTEM_SETTINGS_ERROR_IO_ERROR;