From: Mohamed Abbas <[email protected]>
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 c39d596..8262ad0 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_uint16_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 30bdd81..dda2c92 100644
--- a/gsupplicant/supplicant.c
+++ b/gsupplicant/supplicant.c
@@ -197,6 +197,7 @@ struct _GSupplicantNetwork {
unsigned char ssid[32];
unsigned int ssid_len;
dbus_int16_t signal;
+ dbus_uint16_t frequency;
struct g_supplicant_bss *best_bss;
GSupplicantMode mode;
GSupplicantSecurity security;
@@ -795,6 +796,14 @@ dbus_int16_t
g_supplicant_network_get_signal(GSupplicantNetwork *network)
return network->signal;
}
+dbus_uint16_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)
@@ -1019,6 +1028,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->best_bss = bss;
network->wps = FALSE;
diff --git a/plugins/wifi.c b/plugins/wifi.c
index db87f01..7ab38c5 100644
--- a/plugins/wifi.c
+++ b/plugins/wifi.c
@@ -841,6 +841,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 23916f7..a6c764c 100644
--- a/src/service.c
+++ b/src/service.c
@@ -469,6 +469,7 @@ static int service_save(struct connman_service *service)
{
GKeyFile *keyfile;
gchar *str;
+ guint freq;
const char *cst_str = NULL;
int err = 0;
@@ -518,6 +519,10 @@ static int service_save(struct connman_service *service)
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.1
_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman