Get the frequncy of gsupplicant network on connman network
creation, and always save the frequency of the wifi service.
---
gsupplicant/gsupplicant.h | 1 +
gsupplicant/supplicant.c | 10 ++++++++++
plugins/wifi.c | 3 +++
src/service.c | 5 +++++
4 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/gsupplicant/gsupplicant.h b/gsupplicant/gsupplicant.h
index 5c453aa..a634141 100644
--- a/gsupplicant/gsupplicant.h
+++ b/gsupplicant/gsupplicant.h
@@ -196,6 +196,7 @@ const void
*g_supplicant_network_get_ssid(GSupplicantNetwork *network,
const char *g_supplicant_network_get_mode(GSupplicantNetwork *network);
const char *g_supplicant_network_get_security(GSupplicantNetwork *network);
dbus_int16_t g_supplicant_network_get_signal(GSupplicantNetwork *network);
+dbus_int16_t g_supplicant_network_get_frequency(GSupplicantNetwork *network);
dbus_bool_t g_supplicant_network_get_wps(GSupplicantNetwork *network);
struct _GSupplicantCallbacks {
diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c
index 485b671..e74001b 100644
--- a/gsupplicant/supplicant.c
+++ b/gsupplicant/supplicant.c
@@ -178,6 +178,7 @@ struct _GSupplicantNetwork {
unsigned char ssid[32];
unsigned int ssid_len;
dbus_int16_t signal;
+ dbus_uint16_t frequency;
GSupplicantMode mode;
GSupplicantSecurity security;
dbus_bool_t wps;
@@ -782,6 +783,14 @@ dbus_int16_t
g_supplicant_network_get_signal(GSupplicantNetwork *network)
return network->signal;
}
+dbus_int16_t g_supplicant_network_get_frequency(GSupplicantNetwork *network)
+{
+ if (network == NULL)
+ return 0;
+
+ return network->frequency;
+}
+
dbus_bool_t g_supplicant_network_get_wps(GSupplicantNetwork *network)
{
if (network == NULL)
@@ -1006,6 +1015,7 @@ static void add_bss_to_network(struct g_supplicant_bss
*bss)
network->ssid_len = bss->ssid_len;
memcpy(network->ssid, bss->ssid, bss->ssid_len);
network->signal = bss->signal;
+ network->frequency = bss->frequency;
network->wps = FALSE;
if ((bss->keymgmt & G_SUPPLICANT_KEYMGMT_WPS) != 0)
diff --git a/plugins/wifi.c b/plugins/wifi.c
index b30af22..dfeaf38 100644
--- a/plugins/wifi.c
+++ b/plugins/wifi.c
@@ -803,6 +803,9 @@ static void network_added(GSupplicantNetwork
*supplicant_network)
calculate_strength(supplicant_network));
connman_network_set_bool(network, "WiFi.WPS", wps);
+ connman_network_set_frequency(network,
+ g_supplicant_network_get_frequency(supplicant_network));
+
connman_network_set_available(network, TRUE);
if (ssid != NULL)
diff --git a/src/service.c b/src/service.c
index 31cbc44..678e1ea 100644
--- a/src/service.c
+++ b/src/service.c
@@ -5188,6 +5188,7 @@ static int service_save(struct connman_service *service)
gchar *pathname, *data = NULL;
gsize length;
gchar *str;
+ gint freq;
const char *cst_str = NULL;
int err = 0;
@@ -5254,6 +5255,10 @@ update:
g_string_free(str, TRUE);
}
+
+ freq = connman_network_get_frequency(service->network);
+ g_key_file_set_integer(keyfile, service->identifier,
+ "Frequency", freq);
}
/* fall through */
--
1.7.2.2
_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman