Move VCONF values from lbs-server-plugin-replay 04/318304/4 accepted/tizen_unified accepted/tizen_unified_toolchain accepted/tizen_unified_x accepted/tizen_unified_x_asan accepted/tizen/9.0/unified/20241030.233254 accepted/tizen/unified/20241015.153116 accepted/tizen/unified/20241017.172701 accepted/tizen/unified/toolchain/20241022.122655 accepted/tizen/unified/toolchain/20241022.123058 accepted/tizen/unified/x/20241016.070840 accepted/tizen/unified/x/20241016.070857 accepted/tizen/unified/x/asan/20241022.113552 tizen_9.0_m2_release
authorAbhimanyu Swami <abhimanyu1.s@samsung.com>
Thu, 26 Sep 2024 13:48:49 +0000 (19:18 +0530)
committerAbhimanyu Swami <abhimanyu1.s@samsung.com>
Fri, 4 Oct 2024 10:06:28 +0000 (15:36 +0530)
Change-Id: Ibc12d5df2af3e67655f36470168cd62624a40851
Signed-off-by: Abhimanyu Swami <abhimanyu1.s@samsung.com>
CMakeLists.txt
lbs-server/src/server.c
packaging/lbs-server.spec

index b98006f31b14cd11bf5fda1169729ac21f630ec2..30e2d43f6f939543a321476189ab7be04b5e0246 100755 (executable)
@@ -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")
 
index 7171e9d36ce3621ba2f4429b6b9435a70cdd7393..801f7950ac85a83b7dc8b17ffe55470a1ce2a947 100755 (executable)
@@ -52,6 +52,7 @@
 #include <vconf.h>
 #include <vconf-keys.h>
 #include <dlog.h>
+#include <dd-display.h>
 
 #include <glib.h>
 #include <glib-object.h>
@@ -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;
index 838b49dc91353b893fc5c68391c4184552e1024c..52058c07dcd19fcfb13d165af0ae752e1576b0f6 100755 (executable)
@@ -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