From 8c9d0ddac1e19b106373abcd40cd93e986608e56 Mon Sep 17 00:00:00 2001 From: "hyunuk.tak" Date: Wed, 6 May 2020 18:58:10 +0900 Subject: [PATCH] Add mode to get technology state Change-Id: I63cc9312452e7aafa679f521f504de682fa196de Signed-off-by: hyunuk.tak --- include/wifi-state.h | 2 +- src/signal-handler.c | 4 ++-- src/wifi-background-scan.c | 2 +- src/wifi-bssid-scan.c | 4 ++-- src/wifi-power.c | 6 +++--- src/wifi-state.c | 10 +++++----- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/include/wifi-state.h b/include/wifi-state.h index 4f75bb9..ae39694 100755 --- a/include/wifi-state.h +++ b/include/wifi-state.h @@ -69,7 +69,7 @@ void wifi_state_set_service_state(wifi_service_state_e new_state); wifi_service_state_e wifi_state_get_service_state(void); void wifi_state_set_tech_state(wifi_tech_state_e new_state); -wifi_tech_state_e wifi_state_get_technology_state(void); +wifi_tech_state_e wifi_state_get_technology_state(bool mode); gboolean wifi_state_is_technology_available(void); void wifi_state_set_connected_essid(void); diff --git a/src/signal-handler.c b/src/signal-handler.c index 3894c48..08fd2a8 100755 --- a/src/signal-handler.c +++ b/src/signal-handler.c @@ -840,12 +840,12 @@ static void _supplicant_scan_done(GDBusConnection *conn, if (netconfig_wifi_is_bssid_scan_started() == TRUE) { netconfig_wifi_bssid_signal_scandone(); - if (wifi_state_get_technology_state() < NETCONFIG_WIFI_TECH_POWERED) + if (wifi_state_get_technology_state(FALSE) < NETCONFIG_WIFI_TECH_POWERED) return; } if (netconfig_wifi_get_bgscan_state() == TRUE) { - if (wifi_state_get_technology_state() >= + if (wifi_state_get_technology_state(FALSE) >= NETCONFIG_WIFI_TECH_POWERED) netconfig_wifi_bgscan_start(FALSE); diff --git a/src/wifi-background-scan.c b/src/wifi-background-scan.c index 09874ef..8c7f892 100755 --- a/src/wifi-background-scan.c +++ b/src/wifi-background-scan.c @@ -248,7 +248,7 @@ void netconfig_wifi_bgscan_start(gboolean immediate_scan) if (data->timer_id > 0) __netconfig_wifi_bgscan_stop_timer(data); - wifi_tech_state = wifi_state_get_technology_state(); + wifi_tech_state = wifi_state_get_technology_state(FALSE); wifi_service_state = wifi_state_get_service_state(); DBG("wifi tech state [%s] service state [%s]", _convert_wifi_technology_state_to_string(wifi_tech_state), diff --git a/src/wifi-bssid-scan.c b/src/wifi-bssid-scan.c index ea1d592..d5804d5 100755 --- a/src/wifi-bssid-scan.c +++ b/src/wifi-bssid-scan.c @@ -480,7 +480,7 @@ static int __netconfig_wifi_bssid_scan(void) if (netconfig_is_device_scanning == TRUE) return -EINPROGRESS; - wifi_tech_state = wifi_state_get_technology_state(); + wifi_tech_state = wifi_state_get_technology_state(FALSE); if (wifi_tech_state <= NETCONFIG_WIFI_TECH_OFF) err = wifi_power_driver_and_supplicant(TRUE); @@ -526,7 +526,7 @@ gboolean handle_request_bssid_scan(Wifi *wifi, GDBusMethodInvocation *context) } #endif - tech_state = wifi_state_get_technology_state(); + tech_state = wifi_state_get_technology_state(FALSE); if (tech_state <= NETCONFIG_WIFI_TECH_OFF) { #if !defined TIZEN_WEARABLE enabled = 1; diff --git a/src/wifi-power.c b/src/wifi-power.c index 2226d3a..be60606 100755 --- a/src/wifi-power.c +++ b/src/wifi-power.c @@ -175,7 +175,7 @@ static int _load_driver_and_supplicant(void) int err = 0; wifi_tech_state_e tech_state; - tech_state = wifi_state_get_technology_state(); + tech_state = wifi_state_get_technology_state(FALSE); if (tech_state > NETCONFIG_WIFI_TECH_OFF) return -EALREADY; @@ -701,7 +701,7 @@ int wifi_power_on(void) int err = 0; wifi_tech_state_e tech_state; - tech_state = wifi_state_get_technology_state(); + tech_state = wifi_state_get_technology_state(TRUE); if (tech_state >= NETCONFIG_WIFI_TECH_POWERED) { /* There can be a scenario where wifi is automatically * * activated by connman if wifi was powered in last boot. * @@ -756,7 +756,7 @@ int wifi_power_on_wearable(gboolean device_picker_test) int err = 0; wifi_tech_state_e tech_state; - tech_state = wifi_state_get_technology_state(); + tech_state = wifi_state_get_technology_state(TRUE); if (tech_state >= NETCONFIG_WIFI_TECH_POWERED) return -EALREADY; diff --git a/src/wifi-state.c b/src/wifi-state.c index c6b964f..68cc0b7 100755 --- a/src/wifi-state.c +++ b/src/wifi-state.c @@ -243,7 +243,7 @@ static gboolean _check_network_notification(gpointer data) wifi_tech_state_e tech_state; wifi_service_state_e service_state; - tech_state = wifi_state_get_technology_state(); + tech_state = wifi_state_get_technology_state(FALSE); if (tech_state < NETCONFIG_WIFI_TECH_POWERED) { DBG("Wi-Fi off or WPS only supported[%d]", tech_state); goto cleanup; @@ -430,7 +430,7 @@ void wifi_state_update_power_state(gboolean powered) * DO NOT update manually * It includes Wi-Fi state configuration */ - tech_state = wifi_state_get_technology_state(); + tech_state = wifi_state_get_technology_state(FALSE); if (powered == TRUE) { if (tech_state < NETCONFIG_WIFI_TECH_POWERED && netconfig_is_wifi_tethering_on() != TRUE) { @@ -612,7 +612,7 @@ void wifi_state_set_tech_state(wifi_tech_state_e new_state) _convert_wifi_technology_state_to_string(old_state), _convert_wifi_technology_state_to_string(new_state)); } -wifi_tech_state_e wifi_state_get_technology_state(void) +wifi_tech_state_e wifi_state_get_technology_state(bool mode) { GVariant *message = NULL, *variant; GVariantIter *iter, *next; @@ -622,7 +622,7 @@ wifi_tech_state_e wifi_state_get_technology_state(void) const char *path; gchar *key; - if (g_tech_state > NETCONFIG_WIFI_TECH_UNKNOWN) + if (!mode && g_tech_state > NETCONFIG_WIFI_TECH_UNKNOWN) return g_tech_state; message = netconfig_invoke_dbus_method(CONNMAN_SERVICE, @@ -733,7 +733,7 @@ gboolean handle_get_wifi_state(Wifi *wifi, GDBusMethodInvocation *context) GVariant *param = NULL; wifi_tech_state_e tech_state = NETCONFIG_WIFI_TECH_UNKNOWN; wifi_service_state_e service_state = NETCONFIG_WIFI_UNKNOWN; - tech_state = wifi_state_get_technology_state(); + tech_state = wifi_state_get_technology_state(FALSE); service_state = wifi_state_get_service_state(); if (tech_state == NETCONFIG_WIFI_TECH_UNKNOWN) -- 2.34.1