This email list is read-only.  Emails sent to this list will be discarded
----------------------------------
 plugins/wifi.c     |    4 ++--
 src/element.c      |   28 ++++++++++++----------------
 test/list-networks |   18 +++++++++++++++++-
 3 files changed, 31 insertions(+), 19 deletions(-)

New commits:
commit 32cf3a028ebabc6c43bfa348b1513ebb407a7460
Author: Marcel Holtmann <[EMAIL PROTECTED]>
Date:   Tue Dec 9 02:16:33 2008 +0100

    Show signal strength correctly and parse SSID value

commit cd762b0091f6fda81e2a49b2e339abd1a446bc00
Author: Marcel Holtmann <[EMAIL PROTECTED]>
Date:   Tue Dec 9 01:55:26 2008 +0100

    Include signal strength property

commit 70f5d6b292a3b1e32aa2cfc6900506c35267b31b
Author: Marcel Holtmann <[EMAIL PROTECTED]>
Date:   Tue Dec 9 01:54:55 2008 +0100

    Fix handling of properties with byte values


Diff in this email is a maximum of 400 lines.
diff --git a/plugins/wifi.c b/plugins/wifi.c
index 7d17ae2..5462bf2 100644
--- a/plugins/wifi.c
+++ b/plugins/wifi.c
@@ -239,8 +239,8 @@ static void scan_result(struct connman_element *parent,
 
                strength = network->quality;
 
-               //connman_element_add_static_property(element, "WiFi.Strength",
-               //                              DBUS_TYPE_BYTE, &strength);
+               connman_element_add_static_property(element, "WiFi.Strength",
+                                               DBUS_TYPE_BYTE, &strength);
 
                //connman_element_add_static_property(element, "WiFi.Noise",
                //                      DBUS_TYPE_INT32, &network->noise);
diff --git a/src/element.c b/src/element.c
index 00da43a..407afc7 100644
--- a/src/element.c
+++ b/src/element.c
@@ -186,12 +186,20 @@ static void append_property(DBusMessageIter *dict,
        if (property->value == NULL)
                return;
 
-       if (property->type == DBUS_TYPE_ARRAY)
+       switch (property->type) {
+       case DBUS_TYPE_ARRAY:
                connman_dbus_dict_append_array(dict, property->name,
                        property->subtype, &property->value, property->size);
-       else
+               break;
+       case DBUS_TYPE_STRING:
                connman_dbus_dict_append_variant(dict, property->name,
                                        property->type, &property->value);
+               break;
+       default:
+               connman_dbus_dict_append_variant(dict, property->name,
+                                       property->type, property->value);
+               break;
+       }
 }
 
 static void add_common_properties(struct connman_element *element,
@@ -1068,8 +1076,7 @@ int connman_element_add_static_property(struct 
connman_element *element,
 
        DBG("element %p name %s", element, element->name);
 
-       if (type != DBUS_TYPE_STRING && type != DBUS_TYPE_BYTE &&
-                                               type != DBUS_TYPE_INT32)
+       if (type != DBUS_TYPE_STRING && type != DBUS_TYPE_BYTE)
                return -EINVAL;
 
        property = g_try_new0(struct connman_property, 1);
@@ -1092,11 +1099,6 @@ int connman_element_add_static_property(struct 
connman_element *element,
                if (property->value != NULL)
                        memcpy(property->value, value, 1);
                break;
-       case DBUS_TYPE_INT32:
-               property->value = g_try_malloc(sizeof(gint32));
-               if (property->value != NULL)
-                       memcpy(property->value, value, sizeof(gint32));
-               break;
        }
 
        __connman_element_lock(element);
@@ -1438,15 +1440,9 @@ gboolean connman_element_get_static_property(struct 
connman_element *element,
                        switch (property->type) {
                        case DBUS_TYPE_STRING:
                                *((char **) value) = property->value;
-                               break;
-                       case DBUS_TYPE_BYTE:
-                               *((guint8 *) value) = *((guint8 *) 
property->value);
-                               break;
-                       case DBUS_TYPE_INT32:
-                               *((gint32 *) value) = *((gint32 *) 
property->value);
+                               found = TRUE;
                                break;
                        }
-                       found = TRUE;
                        break;
                }
        }
diff --git a/test/list-networks b/test/list-networks
index 3b29a8e..8f7e01b 100755
--- a/test/list-networks
+++ b/test/list-networks
@@ -1,6 +1,7 @@
 #!/usr/bin/python
 
 import dbus
+import string
 
 bus = dbus.SystemBus()
 
@@ -9,6 +10,15 @@ manager = dbus.Interface(bus.get_object("org.moblin.connman", 
"/"),
 
 properties = manager.GetProperties()
 
+def convert_ssid(ssid_list):
+       ssid = ""
+       for byte in ssid_list:
+               if (str(byte) in string.printable):
+                       ssid = ssid + str(byte)
+               else:
+                       ssid = ssid + "."
+       return ssid
+
 for path in properties["Devices"]:
        device = dbus.Interface(bus.get_object("org.moblin.connman", path),
                                                "org.moblin.connman.Device")
@@ -29,6 +39,12 @@ for path in properties["Devices"]:
                print "    [ %s ]" % (path)
 
                for key in properties.keys():
-                       print "        %s = %s" % (key, properties[key])
+                       if (key == "WiFi.SSID"):
+                               ssid = convert_ssid(properties[key])
+                               print "        %s = [ %s ]" % (key, ssid)
+                       elif (key == "WiFi.Strength"):
+                               print "        %s = %d" % (key, properties[key])
+                       else:
+                               print "        %s = %s" % (key, properties[key])
 
        print
_______________________________________________
Commits mailing list
[email protected]
https://lists.moblin.org/mailman/listinfo/commits

Reply via email to