fused : fix balanced callback to support intended interval 84/140384/2 accepted/tizen/unified/20170726.135905 submit/tizen/20170726.061953
authorkj7.sung <kj7.sung@samsung.com>
Tue, 25 Jul 2017 02:27:56 +0000 (11:27 +0900)
committerkj7.sung <kj7.sung@samsung.com>
Tue, 25 Jul 2017 08:31:38 +0000 (17:31 +0900)
Change-Id: Ib8f2f5da508b248c8aa725d1b9b03e75e61e2280
Signed-off-by: kj7.sung <kj7.sung@samsung.com>
lbs-server/src/lbs_server.c
module/fused_module.c

index 3b20213..0f26aa4 100644 (file)
@@ -462,9 +462,9 @@ static void start_tracking(lbs_server_s *lbs_server, lbs_server_method_e method,
                if (lbs_server->is_mock_running != MOCK_RUNNING_OFF && lbs_server->is_gps_running == FALSE && lbs_server->is_nps_running == FALSE)
                        mock_start_tracking(lbs_server);
 
-               if (location_source_selector(lbs_server, fused_mode) == TRUE) {
+               if (location_source_selector(lbs_server, fused_mode) == TRUE)
                        plugin_status_controller(lbs_server);
-               }
+
                break;
 
        case LBS_SERVER_METHOD_NPS:
@@ -473,9 +473,8 @@ static void start_tracking(lbs_server_s *lbs_server, lbs_server_method_e method,
                if (lbs_server->is_mock_running != MOCK_RUNNING_OFF && lbs_server->is_gps_running == FALSE && lbs_server->is_nps_running == FALSE)
                        mock_start_tracking(lbs_server);
 
-               if (location_source_selector(lbs_server, fused_mode) == TRUE) {
+               if (location_source_selector(lbs_server, fused_mode) == TRUE)
                        plugin_status_controller(lbs_server);
-               }
 
                if (nps_is_dummy_plugin_module() != TRUE)
                        nps_offline_location(lbs_server);
@@ -491,7 +490,6 @@ static void start_tracking(lbs_server_s *lbs_server, lbs_server_method_e method,
                LOG_GPS(DBG_LOW, "start_tracking Invalid");
                break;
        }
-
 }
 
 static gboolean nps_plugin_stop(lbs_server_s *lbs_server)
@@ -539,9 +537,8 @@ static void stop_tracking(lbs_server_s *lbs_server, lbs_server_method_e method,
 
                client_count_updater(lbs_server, LBS_SERVER_METHOD_GPS, _LBS_CLIENT_REMOVE, fused_mode);
 
-               if (location_source_selector(lbs_server, fused_mode) == TRUE) {
+               if (location_source_selector(lbs_server, fused_mode) == TRUE)
                        plugin_status_controller(lbs_server);
-               }
 
                if (lbs_server->is_gps_running == FALSE) {
                        lbs_server->status = LBS_STATUS_UNAVAILABLE;
@@ -554,9 +551,9 @@ static void stop_tracking(lbs_server_s *lbs_server, lbs_server_method_e method,
 
                client_count_updater(lbs_server, LBS_SERVER_METHOD_NPS, _LBS_CLIENT_REMOVE, fused_mode);
 
-               if (location_source_selector(lbs_server, fused_mode) == TRUE) {
+               if (location_source_selector(lbs_server, fused_mode) == TRUE)
                        plugin_status_controller(lbs_server);
-               }
+
                break;
 
        case LBS_SERVER_METHOD_PASSIVE:
@@ -619,7 +616,7 @@ static gboolean location_source_selector(lbs_server_s *lbs_server, gint fused_mo
                else
                        lbs_server->fused_optimized_mode = LOCATION_FUSED_NONE;
 
-               LOG_GPS(DBG_LOW, "---- fused_optimized_mode [high: %d, balanced: %d, mode: %d]",
+               LOG_GPS(DBG_LOW, "fused_optimized_mode [high: %d, balanced: %d, mode: %d]",
                        lbs_server->fused_high_count, lbs_server->fused_balanced_count, lbs_server->fused_optimized_mode);
 #endif
        }
@@ -734,44 +731,36 @@ static void plugin_status_controller(lbs_server_s *lbs_server)
 {
        LOG_FUNC;
        if (lbs_server->current_location_source == LOCATION_SOURCE_GPS) {
-               LOG_FUSED(DBG_LOW, ">>>  --- LOCATION_SOURCE_GPS");
-               if (lbs_server->is_gps_running == FALSE) {
+               LOG_FUSED(DBG_LOW, ">>> LOCATION_SOURCE_GPS");
+               if (lbs_server->is_gps_running == FALSE)
                        gps_plugin_start(lbs_server);
-               }
-               if (lbs_server->is_nps_running) {
-                       LOG_FUSED(DBG_LOW, ">>> WPS stopped from Location source controller !!!");
+
+               if (lbs_server->is_nps_running)
                        nps_plugin_stop(lbs_server);
-               }
+
        } else if (lbs_server->current_location_source == LOCATION_SOURCE_WPS) {
-               LOG_FUSED(DBG_LOW, ">>>  --- LOCATION_SOURCE_WPS");
-               if (lbs_server->is_gps_running) {
-                       LOG_FUSED(DBG_LOW, ">>> GPS stopped from Location source controller !!!");
+               LOG_FUSED(DBG_LOW, ">>> LOCATION_SOURCE_WPS");
+               if (lbs_server->is_gps_running)
                        gps_plugin_stop(lbs_server);
-               }
-               if (lbs_server->is_nps_running == FALSE) {
-                       LOG_FUSED(DBG_LOW, ">>> WPS started from Location source controller !!!");
+
+               if (lbs_server->is_nps_running == FALSE)
                        nps_plugin_start(lbs_server);
-               }
+
        } else if (lbs_server->current_location_source == LOCATION_SOURCE_BOTH) {
-               LOG_FUSED(DBG_LOW, ">>>  --- LOCATION_SOURCE_BOTH");
-               if (lbs_server->is_gps_running == FALSE) {
-                       LOG_FUSED(DBG_LOW, ">>> GPS stopped from Location source controller !!!");
+               LOG_FUSED(DBG_LOW, ">>> LOCATION_SOURCE_BOTH");
+               if (lbs_server->is_gps_running == FALSE)
                        gps_plugin_start(lbs_server);
-               }
-               if (lbs_server->is_nps_running == FALSE) {
-                       LOG_FUSED(DBG_LOW, ">>> WPS started from Location source controller !!!");
+
+               if (lbs_server->is_nps_running == FALSE)
                        nps_plugin_start(lbs_server);
-               }
+
        } else if (lbs_server->current_location_source == LOCATION_SOURCE_NONE) {
-               LOG_FUSED(DBG_LOW, ">>>  --- LOCATION_SOURCE_NONE");
-               if (lbs_server->is_gps_running) {
-                       LOG_FUSED(DBG_LOW, ">>> GPS stopped from Location source controller !!!");
+               LOG_FUSED(DBG_LOW, ">>> LOCATION_SOURCE_NONE");
+               if (lbs_server->is_gps_running)
                        gps_plugin_stop(lbs_server);
-               }
-               if (lbs_server->is_nps_running) {
-                       LOG_FUSED(DBG_LOW, ">>> WPS stopped from Location source controller !!!");
+
+               if (lbs_server->is_nps_running)
                        nps_plugin_stop(lbs_server);
-               }
        }
 }
 
@@ -1888,12 +1877,12 @@ static void client_count_updater(lbs_server_s *lbs_server, lbs_server_method_e m
        }
 
        if (lbs_server->fused_high_count < 0) {
-               LOG_GPS(DBG_ERR, "---- fused_high count is negative value");
+               LOG_GPS(DBG_ERR, "fused_high count is negative value");
                lbs_server->fused_high_count = 0;
        }
 
        if (lbs_server->fused_balanced_count < 0) {
-               LOG_GPS(DBG_ERR, "---- fused_balanced count is negative value");
+               LOG_GPS(DBG_ERR, "fused_balanced count is negative value");
                lbs_server->fused_balanced_count = 0;
        }
 }
index 2ab68fe..0b5ea06 100644 (file)
@@ -62,7 +62,7 @@ static void position_callback(GVariant *param, void *user_data)
 
 //     MOD_FUSED_LOGD("position_callback [method: %d] GPS=0, WPS=1/AGPS=2/GEOFENCE/MOCK/FUSED", method);
 
-       if (method != LBS_CLIENT_METHOD_GPS && method != LBS_CLIENT_METHOD_NPS) {
+       if (method != LBS_CLIENT_METHOD_FUSED) {
                if (method != LBS_CLIENT_METHOD_MOCK) {
                        MOD_FUSED_LOGD("Method is not LBS_CLIENT_METHOD_FUSED: %d", method);
                        return;