diff options
author | Samuel Ortiz <sameo@linux.intel.com> | 2011-09-08 08:00:49 +0200 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2011-09-12 12:06:01 +0200 |
commit | 66e533a6d154ad264b26ce63c3e1b7c908aa266c (patch) | |
tree | 46a68ad6fffb4987901788809c95ab762677f969 /gsupplicant | |
parent | 9b2a72efbf273815b19f3292617bbc9564a67b22 (diff) | |
download | connman-66e533a6d154ad264b26ce63c3e1b7c908aa266c.tar.gz connman-66e533a6d154ad264b26ce63c3e1b7c908aa266c.tar.bz2 connman-66e533a6d154ad264b26ce63c3e1b7c908aa266c.zip |
gsupplicant: Implement network properties changes notification
This is only used for propagatong signal changes for now.
Diffstat (limited to 'gsupplicant')
-rw-r--r-- | gsupplicant/gsupplicant.h | 2 | ||||
-rw-r--r-- | gsupplicant/supplicant.c | 15 |
2 files changed, 17 insertions, 0 deletions
diff --git a/gsupplicant/gsupplicant.h b/gsupplicant/gsupplicant.h index 5c453aac..c39d5966 100644 --- a/gsupplicant/gsupplicant.h +++ b/gsupplicant/gsupplicant.h @@ -208,6 +208,8 @@ struct _GSupplicantCallbacks { void (*scan_finished) (GSupplicantInterface *interface); void (*network_added) (GSupplicantNetwork *network); void (*network_removed) (GSupplicantNetwork *network); + void (*network_changed) (GSupplicantNetwork *network, + const char *property); void (*debug) (const char *str); }; diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c index 55e0abe1..30bdd811 100644 --- a/gsupplicant/supplicant.c +++ b/gsupplicant/supplicant.c @@ -408,6 +408,18 @@ static void callback_network_removed(GSupplicantNetwork *network) callbacks_pointer->network_removed(network); } +static void callback_network_changed(GSupplicantNetwork *network, + const char *property) +{ + if (callbacks_pointer == NULL) + return; + + if (callbacks_pointer->network_changed == NULL) + return; + + callbacks_pointer->network_changed(network, property); +} + static void remove_interface(gpointer data) { GSupplicantInterface *interface = data; @@ -1028,6 +1040,7 @@ done: if (bss->signal > network->signal) { network->signal = bss->signal; network->best_bss = bss; + callback_network_changed(network, "Signal"); } g_hash_table_replace(interface->bss_mapping, bss->path, network); @@ -1896,6 +1909,8 @@ static void signal_bss_changed(const char *path, DBusMessageIter *iter) } SUPPLICANT_DBG("New network signal for %s %d dBm", network->ssid, network->signal); + + callback_network_changed(network, "Signal"); } static void wps_credentials(const char *key, DBusMessageIter *iter, |