From: Abhimanyu Swami Date: Thu, 26 Sep 2024 13:48:49 +0000 (+0530) Subject: Move VCONF values from lbs-server-plugin-replay X-Git-Tag: accepted/tizen/unified/20241015.153116^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=93056d56725b9958bb54b6935bf7ccc0ec4cb946;p=platform%2Fcore%2Flocation%2Flbs-server.git Move VCONF values from lbs-server-plugin-replay Change-Id: Ibc12d5df2af3e67655f36470168cd62624a40851 Signed-off-by: Abhimanyu Swami --- diff --git a/CMakeLists.txt b/CMakeLists.txt index b98006f..30e2d43 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,7 @@ SET(BIN_DIR "${PREFIX}/bin") #Dependencies SET(common_dp "glib-2.0 lbs-dbus dlog gio-2.0 lbs-location hal-api-common hal-api-location") -SET(server_dp "${common_dp} tapi vconf vconf-internal-keys gthread-2.0 gio-unix-2.0 capi-network-connection capi-network-wifi-manager capi-system-info libtzplatform-config") +SET(server_dp "${common_dp} tapi vconf vconf-internal-keys gthread-2.0 gio-unix-2.0 capi-network-connection capi-network-wifi-manager capi-system-info libtzplatform-config deviced") SET(module_dp "${common_dp} gmodule-2.0") SET(haltests_dp "${server_dp} capi-system-info vconf") diff --git a/lbs-server/src/server.c b/lbs-server/src/server.c index 7171e9d..801f795 100755 --- a/lbs-server/src/server.c +++ b/lbs-server/src/server.c @@ -52,6 +52,7 @@ #include #include #include +#include #include #include @@ -171,6 +172,52 @@ static void _gps_replay_changed_cb(keynode_t *key, void *data) return; } +static void display_mode_changed_cb(keynode_t *key, void *data) +{ + gps_failure_reason_t reason_code = GPS_FAILURE_CAUSE_NORMAL; + + int lcd_mode = 0; + setting_get_int(VCONFKEY_PM_STATE, &lcd_mode); + + gboolean status = hal_location_request(GPS_ACTION_SEND_PARAMS, &lcd_mode, &reason_code); + + if (status == FALSE) { + LOG_GPS(DBG_ERR, "Main: sending GPS_ACTION_START_FACTTEST Fail !"); + return; + } + + status = hal_location_request(GPS_INDI_SUPL_VERIFICATION, NULL, &reason_code); + + if (status == FALSE) + { + LOG_GPS(DBG_ERR, "Main: sending GPS_INDI_SUPL_VERIFICATION Fail !"); + return; + } +} + +static void replay_mode_changed_cb(keynode_t *key, void *data) +{ + gps_failure_reason_t reason_code = GPS_FAILURE_CAUSE_NORMAL; + + int replay_mode = 0; + setting_get_int(VCONFKEY_LOCATION_REPLAY_MODE, &replay_mode); + + gboolean status = hal_location_request(GPS_ACTION_START_FACTTEST, &replay_mode, &reason_code); + + if (status == FALSE) { + LOG_GPS(DBG_ERR, "Main: sending GPS_ACTION_START_FACTTEST Fail !"); + return; + } + + status = hal_location_request(GPS_ACTION_STOP_FACTTEST, NULL, &reason_code); + + if (status == FALSE) + { + LOG_GPS(DBG_ERR, "Main: sending GPS_ACTION_STOP_FACTTEST Fail !"); + return; + } +} + static int _gps_server_get_gps_state() { int val; @@ -263,6 +310,56 @@ int request_start_session(int interval) LOG_GPS(DBG_LOW, "plugin_module_load failed %d", ret); return FALSE; } + + setting_notify_key_changed(VCONFKEY_PM_STATE, display_mode_changed_cb, NULL); + setting_notify_key_changed(VCONFKEY_LOCATION_REPLAY_MODE, replay_mode_changed_cb, NULL); + + char* str = NULL; + str = setting_get_string(VCONFKEY_LOCATION_NMEA_FILE_NAME); + + if(str == NULL) + { + LOG_GPS(DBG_ERR, "nmea file name returned null"); + return FALSE; + } + + status = hal_location_request(GPS_INDI_SUPL_DNSQUERY, &str, &reason_code); + + if(str) + { + free(str); + str = NULL; + } + + if (status == FALSE) { + LOG_GPS(DBG_ERR, "Main: sending GPS_INDI_SUPL_DNSQUERY Fail !"); + return FALSE; + } + + int replay_mode = 0; + setting_get_int(VCONFKEY_LOCATION_REPLAY_MODE, &replay_mode); + + status = hal_location_request(GPS_ACTION_START_FACTTEST, &replay_mode, &reason_code); + + if (status == FALSE) { + LOG_GPS(DBG_ERR, "Main: sending GPS_ACTION_START_FACTTEST Fail !"); + return FALSE; + } + + int lcd_mode = 0; + setting_get_int(VCONFKEY_PM_STATE, &lcd_mode); + + status = hal_location_request(GPS_ACTION_SEND_PARAMS, &lcd_mode, &reason_code); + + if (status == FALSE) { + LOG_GPS(DBG_ERR, "Main: sending GPS_ACTION_START_FACTTEST Fail !"); + return FALSE; + } + + //display_lock from lbs-server-plugin-replay + display_lock_state(LCD_OFF, STAY_CUR_STATE, 0); + LOG_GPS(LOG_DEBUG, "display_lock_state(LCD_OFF, STAY_CUR_STATE, 0);"); + status = hal_location_request(GPS_ACTION_START_SESSION, &gps_start_data, &reason_code); if (status == FALSE) { @@ -292,6 +389,12 @@ int request_stop_session() LOG_GPS(DBG_LOW, "plugin_module_load failed %d", ret); return 0; } + setting_ignore_key_changed(VCONFKEY_LOCATION_REPLAY_MODE, replay_mode_changed_cb); + + // display_unlock_state from lbs-server-plugin-replay + display_unlock_state(LCD_OFF, PM_RESET_TIMER); + LOG_GPS(DBG_LOW, "display_unlock_state(LCD_OFF, PM_RESET_TIMER);"); + status = hal_location_request(GPS_ACTION_STOP_SESSION, NULL, &reason_code); if (status) { @@ -337,6 +440,11 @@ int request_start_batch_session(int batch_interval, int batch_period) LOG_GPS(DBG_LOW, "plugin_module_load failed %d", ret); return FALSE; } + + //display_lock_state from lbs-server-plugin-replay + display_lock_state(LCD_OFF, STAY_CUR_STATE, 0); + LOG_GPS(LOG_DEBUG, "display_lock_state(LCD_OFF, STAY_CUR_STATE, 0);"); + status = hal_location_request(GPS_ACTION_START_BATCH, &gps_start_data, &reason_code); if (status == FALSE) { @@ -369,7 +477,12 @@ int request_stop_batch_session(int batch_interval, int batch_period, int session if( ret < 0){ LOG_GPS(DBG_LOW, "plugin_module_load failed %d", ret); return 0; - } + } + + // display_unlock_state from lbs-server-plugin-replay + display_unlock_state(LCD_OFF, PM_RESET_TIMER); + LOG_GPS(DBG_LOW, "display_unlock_state(LCD_OFF, PM_RESET_TIMER);"); + status = hal_location_request(GPS_ACTION_STOP_BATCH, &gps_start_data, &reason_code); if (status == TRUE && session_status == 0) { server->session_state = GPS_SESSION_STOPPING; diff --git a/packaging/lbs-server.spec b/packaging/lbs-server.spec index 838b49d..52058c0 100755 --- a/packaging/lbs-server.spec +++ b/packaging/lbs-server.spec @@ -28,7 +28,7 @@ BuildRequires: pkgconfig(capi-network-connection) BuildRequires: pkgconfig(hal-api-common) BuildRequires: pkgconfig(hal-api-location) BuildRequires: pkgconfig(gmock) - +BuildRequires: pkgconfig(deviced) %description LBS Server for Tizen