summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRadoslaw Czerski <r.czerski@samsung.com>2016-02-03 20:00:31 +0100
committerLukasz Stanislawski <l.stanislaws@samsung.com>2016-02-08 06:09:10 -0800
commitc198eccab52ffd258370a901bc76cc97ef3a3cf6 (patch)
tree6fcdcbd13dbcc63d8d4804404cc977ea109ca00e /src
parentfc81bca303df69443728cb2634d4f4a35b116758 (diff)
downloadindicator-win-c198eccab52ffd258370a901bc76cc97ef3a3cf6.tar.gz
indicator-win-c198eccab52ffd258370a901bc76cc97ef3a3cf6.tar.bz2
indicator-win-c198eccab52ffd258370a901bc76cc97ef3a3cf6.zip
Vconf removed. Runtime info and display modules used instead.
Change-Id: I173b8676e11d733e80812edaf279d4ff5cc1b523 Signed-off-by: Radoslaw Czerski <r.czerski@samsung.com>
Diffstat (limited to 'src')
-rw-r--r--src/modules/setting/gps.c92
1 files changed, 25 insertions, 67 deletions
diff --git a/src/modules/setting/gps.c b/src/modules/setting/gps.c
index 99e9dda..1953fbc 100644
--- a/src/modules/setting/gps.c
+++ b/src/modules/setting/gps.c
@@ -20,8 +20,8 @@
#include <stdio.h>
#include <stdlib.h>
-#include <vconf.h>
#include <runtime_info.h>
+#include <device/display.h>
#include "common.h"
#include "indicator.h"
@@ -87,9 +87,7 @@ static void show_image_icon(void *data, int index)
index = LEVEL_GPS_SEARCHING;
if(prevIndex == index)
- {
return;
- }
gps.img_obj.data = icon_path[index];
icon_show(&gps);
@@ -111,27 +109,21 @@ static void icon_animation_set(enum indicator_icon_ani type)
static int indicator_gps_state_get(void)
{
- int gps_status = 0;
+ runtime_info_gps_status_e gps_status = 0;
int status = 0;
- if (runtime_info_get_value_int(RUNTIME_INFO_KEY_GPS_STATUS, &gps_status) < 0)
+ if (runtime_info_get_value_int(RUNTIME_INFO_KEY_GPS_STATUS, (int *)&gps_status) < 0)
{
ERR("Error getting RUNTIME_INFO_KEY_GPS_STATUS value");
return 0;
}
- if(gps_status == VCONFKEY_LOCATION_GPS_CONNECTED)
- {
+ if(gps_status == RUNTIME_INFO_GPS_STATUS_CONNECTED)
status = IND_POSITION_STATE_CONNECTED;
- }
- else if(gps_status == VCONFKEY_LOCATION_GPS_SEARCHING)
- {
+ else if(gps_status == RUNTIME_INFO_GPS_STATUS_SEARCHING)
status = IND_POSITION_STATE_SEARCHING;
- }
else
- {
status = IND_POSITION_STATE_OFF;
- }
return status;
}
@@ -139,19 +131,33 @@ static int indicator_gps_state_get(void)
static void _gps_state_icon_set(int status, void *data)
{
DBG("GPS STATUS: %d", status);
+ int ret;
+ display_state_e display_state = DISPLAY_STATE_NORMAL;
switch (status) {
case IND_POSITION_STATE_OFF:
hide_image_icon();
break;
+
case IND_POSITION_STATE_CONNECTED:
show_image_icon(data, LEVEL_GPS_ON);
icon_animation_set(ICON_ANI_NONE);
break;
+
case IND_POSITION_STATE_SEARCHING:
- show_image_icon(data, LEVEL_GPS_SEARCHING);
- icon_animation_set(ICON_ANI_BLINK);
+ ret = device_display_get_state(&display_state);
+ retm_if(ret != DEVICE_ERROR_NONE, "device_display_get_state failed[%s]", get_error_message(ret));
+
+ if(display_state == DISPLAY_STATE_SCREEN_OFF) {
+ show_image_icon(data, LEVEL_GPS_SEARCHING);
+ icon_animation_set(ICON_ANI_NONE);
+ }
+ else {
+ show_image_icon(data, LEVEL_GPS_SEARCHING);
+ icon_animation_set(ICON_ANI_BLINK);
+ }
break;
+
default:
hide_image_icon();
ERR("Invalid value!");
@@ -161,8 +167,6 @@ static void _gps_state_icon_set(int status, void *data)
return;
}
-
-
void _gps_status_changed_cb(runtime_info_key_e key, void *data)
{
ret_if(!data);
@@ -178,59 +182,21 @@ void _gps_status_changed_cb(runtime_info_key_e key, void *data)
return;
}
-
-
-static void indicator_gps_pm_state_change_cb(keynode_t *node, void *data)
-{
- int status = 0;
- retif(data == NULL, , "Invalid parameter!");
-
- if (vconf_get_int(VCONFKEY_PM_STATE, &status) < 0)
- {
- ERR("Error getting VCONFKEY_PM_STATE value");
- return;
- }
-
- if(status == VCONFKEY_PM_STATE_LCDOFF)
- {
- int gps_status = 0;
- if (runtime_info_get_value_int(RUNTIME_INFO_KEY_GPS_STATUS, &gps_status) < 0)
- {
- ERR("Error getting RUNTIME_INFO_KEY_GPS_STATUS value");
- return;
- }
-
- switch (gps_status) {
- case IND_POSITION_STATE_SEARCHING:
- show_image_icon(data, LEVEL_GPS_SEARCHING);
- icon_animation_set(ICON_ANI_NONE);
- break;
- case IND_POSITION_STATE_OFF:
- case IND_POSITION_STATE_CONNECTED:
- default:
- break;
- }
- }
-}
-
-
-
static int _wake_up_cb(void *data)
{
- if (updated_while_lcd_off == 0 && gps.obj_exist == EINA_FALSE) {
+ if (updated_while_lcd_off == 0 && gps.obj_exist == EINA_FALSE)
return OK;
- }
if (updated_while_lcd_off == 0 && gps.obj_exist == EINA_TRUE) {
int gps_status = 0;
runtime_info_get_value_int(RUNTIME_INFO_KEY_GPS_STATUS, &gps_status);
switch (gps_status) {
- case IND_POSITION_STATE_SEARCHING:
+ case RUNTIME_INFO_GPS_STATUS_SEARCHING:
icon_animation_set(ICON_ANI_BLINK);
break;
- case IND_POSITION_STATE_OFF:
- case IND_POSITION_STATE_CONNECTED:
+ case RUNTIME_INFO_GPS_STATUS_DISABLED:
+ case RUNTIME_INFO_GPS_STATUS_CONNECTED:
default:
break;
}
@@ -242,8 +208,6 @@ static int _wake_up_cb(void *data)
return OK;
}
-
-
static int register_gps_module(void *data)
{
int ret;
@@ -254,9 +218,6 @@ static int register_gps_module(void *data)
ret = runtime_info_set_changed_cb(RUNTIME_INFO_KEY_GPS_STATUS, _gps_status_changed_cb, data);
- ret = vconf_notify_key_changed(VCONFKEY_PM_STATE,
- indicator_gps_pm_state_change_cb, data);
-
_gps_state_icon_set(indicator_gps_state_get(), data);
return ret;
@@ -268,8 +229,5 @@ static int unregister_gps_module(void)
ret = runtime_info_unset_changed_cb(RUNTIME_INFO_KEY_GPS_STATUS);
- ret = ret | vconf_ignore_key_changed(VCONFKEY_PM_STATE,
- indicator_gps_pm_state_change_cb);
-
return ret;
}