Include signal strength for reported networks
authorMarcel Holtmann <marcel@holtmann.org>
Wed, 16 Jan 2008 05:59:22 +0000 (06:59 +0100)
committerMarcel Holtmann <marcel@holtmann.org>
Wed, 16 Jan 2008 05:59:22 +0000 (06:59 +0100)
include/iface.h
plugins/80211.c
src/iface.c

index 57a4d72..6a80178 100644 (file)
@@ -153,6 +153,9 @@ extern void connman_iface_indicate_carrier_on(struct connman_iface *iface);
 extern void connman_iface_indicate_carrier_off(struct connman_iface *iface);
 extern void connman_iface_indicate_configured(struct connman_iface *iface);
 
+extern void connman_iface_indicate_station(struct connman_iface *iface,
+                                               const char *name, int strength);
+
 extern int connman_iface_get_ipv4(struct connman_iface *iface,
                                                struct connman_ipv4 *ipv4);
 extern int connman_iface_set_ipv4(struct connman_iface *iface,
index a94551d..53b36b6 100644 (file)
@@ -70,8 +70,10 @@ static void report_station(struct connman_iface *iface,
        if (station == NULL)
                return;
 
-       if (station->name)
-               connman_iface_indicate_station(iface, station->name);
+       if (station->name == NULL)
+               return;
+
+       connman_iface_indicate_station(iface, station->name, station->qual);
 }
 
 static struct station_data *create_station(struct iface_data *iface,
index 1662fb7..a412dab 100644 (file)
@@ -289,7 +289,7 @@ void connman_iface_indicate_configured(struct connman_iface *iface)
        }
 }
 
-static void append_station(DBusMessage *reply, const char *name)
+static void append_station(DBusMessage *reply, const char *name, int signal)
 {
        DBusMessageIter array, dict;
 
@@ -301,12 +301,13 @@ static void append_station(DBusMessage *reply, const char *name)
                        DBUS_DICT_ENTRY_END_CHAR_AS_STRING, &dict);
 
        append_entry(&dict, "ESSID", DBUS_TYPE_STRING, &name);
+       append_entry(&dict, "Signal", DBUS_TYPE_UINT16, &signal);
 
        dbus_message_iter_close_container(&array, &dict);
 }
 
 void connman_iface_indicate_station(struct connman_iface *iface,
-                                                       const char *name)
+                                               const char *name, int strength)
 {
        DBusMessage *signal;
 
@@ -317,7 +318,7 @@ void connman_iface_indicate_station(struct connman_iface *iface,
        if (signal == NULL)
                return;
 
-       append_station(signal, name);
+       append_station(signal, name, strength);
 
        dbus_connection_send(connection, signal, NULL);
        dbus_message_unref(signal);