gint fused_balance_count;
gboolean is_fused_running;
gint current_location_source;
- gint fused_test_block;
} lbs_server_s;
#ifndef TIZEN_DEVICE
break;
case LBS_SERVER_METHOD_NPS:
- LOG_NPS(DBG_LOW, "_stop_tracking NPS");
+ LOG_NPS(DBG_LOW, "stop tracking NPS [client: %d]", lbs_server->nps_client_count);
client_count_updater(lbs_server, LBS_SERVER_METHOD_NPS, _LBS_CLIENT_REMOVE, fused_mode);
static gboolean _set_current_location_source(lbs_server_s *lbs_server, gint mode)
{
+ LOG_GPS(DBG_LOW, "set current location source [%d]", mode);
if (lbs_server->current_location_source != mode) {
- LOG_GPS(DBG_LOW, "location source changed[%d]", mode);
+ LOG_GPS(DBG_LOW, "location source changed[%d -> %d]", lbs_server->current_location_source, mode);
lbs_server->current_location_source = mode;
return TRUE;
}
static gboolean select_location_source(lbs_server_s *lbs_server)
{
+ LOG_FUSED_FUNC;
/*********************************************************************************
Define all condition to select optimized location source
gps, high ==> 1(gps0, high0) 2(gps3, high0) 3(gps3, high1) 4(gps3, high3)
if (_set_current_location_source(lbs_server, LOCATION_SOURCE_NONE)) return TRUE;
}
}
+ LOG_GPS(DBG_LOW, "select location source [FALSE], keep current source [gps: %d, wps: %d]", lbs_server->gps_client_count, lbs_server->nps_client_count);
return FALSE;
}
}
}
- if (select_location_source(lbs_server))
+ if (select_location_source(lbs_server)) {
+ LOG_GPS(DBG_LOW, "select location source [TRUE] --> source changed");
return TRUE;
+ }
return FALSE;
}
free(app_id);
}
- stop_tracking(lbs_server, method, fused_mode);
+ if (LBS_SERVER_METHOD_GPS == method) {
+ if (lbs_server->gps_client_count > 0)
+ stop_tracking(lbs_server, method, fused_mode);
+ else
+ LOG_GPS(DBG_LOW, "[STOP] stop tracking is not called because [gps: 0]");
+ } else if (LBS_SERVER_METHOD_NPS == method) {
+ if (lbs_server->nps_client_count > 0)
+ stop_tracking(lbs_server, method, fused_mode);
+ else
+ LOG_GPS(DBG_LOW, "[STOP] stop tracking is not called because [wps: 0]");
+ }
}
#ifndef TIZEN_DEVICE
static gboolean gps_remove_all_clients(lbs_server_s *lbs_server)
{
- LOG_GPS(DBG_LOW, "remove_all_clients[%d] GPS", lbs_server->gps_client_count);
+ LOG_GPS(DBG_LOW, "remove_all_clients[%d] GPS, [gps client --> 0]", lbs_server->gps_client_count);
if (lbs_server->is_mock_running == LBS_SERVER_METHOD_GPS) {
mock_stop_tracking(lbs_server);
setting_ignore_key_changed(VCONFKEY_LOCATION_MOCK_ENABLED, __setting_mock_cb);
switch (method) {
case LBS_SERVER_METHOD_GPS: {
g_mutex_lock(&lbs_server->mutex);
- if (type == _LBS_CLIENT_ADD)
+ if (type == _LBS_CLIENT_ADD) {
lbs_server->gps_client_count++;
- else if (type == _LBS_CLIENT_REMOVE)
- lbs_server->gps_client_count--;
- else if (type == _LBS_CLIENT_REMOVE_ALL)
+ } else if (type == _LBS_CLIENT_REMOVE) {
+ if (lbs_server->gps_client_count > 0)
+ lbs_server->gps_client_count--;
+ } else if (type == _LBS_CLIENT_REMOVE_ALL) {
lbs_server->gps_client_count = 0;
+ }
g_mutex_unlock(&lbs_server->mutex);
break;
}
case LBS_SERVER_METHOD_NPS: {
g_mutex_lock(&lbs_server->mutex);
- if (type == _LBS_CLIENT_ADD)
+ if (type == _LBS_CLIENT_ADD) {
lbs_server->nps_client_count++;
- else if (type == _LBS_CLIENT_REMOVE)
- lbs_server->nps_client_count--;
- else if (type == _LBS_CLIENT_REMOVE_ALL)
+ } else if (type == _LBS_CLIENT_REMOVE) {
+ if (lbs_server->nps_client_count > 0)
+ lbs_server->nps_client_count--;
+ } else if (type == _LBS_CLIENT_REMOVE_ALL) {
lbs_server->nps_client_count = 0;
+ }
g_mutex_unlock(&lbs_server->mutex);
break;
LOG_GPS(DBG_ERR, "fused_balance count is negative value");
lbs_server->fused_balance_count = 0;
}
+
+ LOG_GPS(DBG_LOW, ">>> client count updater [method: %d, type: %d, gps: %d, wps: %d]",
+ method, type, lbs_server->gps_client_count, lbs_server->nps_client_count);
}