This email list is read-only.  Emails sent to this list will be discarded
----------------------------------
 src/connection.c |    6 ++++++
 src/element.c    |    4 ++++
 src/network.c    |    9 ++++++++-
 3 files changed, 18 insertions(+), 1 deletions(-)

New commits:
commit 839885f14c8b7bc9957b944e5c450bf921d47fe8
Author: Marcel Holtmann <[email protected]>
Date:   Tue Jan 6 00:45:06 2009 +0100

    Allow retrieving static properties with byte values

commit 5d659bf8a8ba8f85e0d004956257ccb6d5507bef
Author: Marcel Holtmann <[email protected]>
Date:   Mon Jan 5 23:59:35 2009 +0100

    Add support for connection strength property


Diff in this email is a maximum of 400 lines.
diff --git a/src/connection.c b/src/connection.c
index 7344cd4..0b3e59c 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -205,6 +205,7 @@ static DBusMessage *get_properties(DBusConnection *conn,
        struct connman_element *element = data;
        DBusMessage *reply;
        DBusMessageIter array, dict;
+       connman_uint8_t strength = 0;
        const char *type = NULL, *method = NULL;
        const char *address = NULL, *netmask = NULL, *gateway = NULL;
 
@@ -227,6 +228,11 @@ static DBusMessage *get_properties(DBusConnection *conn,
                connman_dbus_dict_append_variant(&dict, "Type",
                                                DBUS_TYPE_STRING, &type);
 
+       connman_element_get_static_property(element, "Strength", &strength);
+       if (strength > 0)
+               connman_dbus_dict_append_variant(&dict, "Strength",
+                                               DBUS_TYPE_BYTE, &strength);
+
        if (element->devname != NULL)
                connman_dbus_dict_append_variant(&dict, "Interface",
                                        DBUS_TYPE_STRING, &element->devname);
diff --git a/src/element.c b/src/element.c
index 03bb5f5..ba94705 100644
--- a/src/element.c
+++ b/src/element.c
@@ -1033,6 +1033,10 @@ gboolean connman_element_get_static_property(struct 
connman_element *element,
                                *((char **) value) = property->value;
                                found = TRUE;
                                break;
+                       case DBUS_TYPE_BYTE:
+                               memcpy(value, property->value, 1);
+                               found = TRUE;
+                               break;
                        }
                        break;
                }
diff --git a/src/network.c b/src/network.c
index 1bfc46d..c60cfa4 100644
--- a/src/network.c
+++ b/src/network.c
@@ -352,6 +352,7 @@ struct connman_network *connman_network_create(const char 
*identifier,
                                                enum connman_network_type type)
 {
        struct connman_network *network;
+       connman_uint8_t strength = 0;
        const char *str;
 
        DBG("identifier %s type %d", identifier, type);
@@ -376,6 +377,9 @@ struct connman_network *connman_network_create(const char 
*identifier,
                connman_element_add_static_property(&network->element,
                                        "Type", DBUS_TYPE_STRING, &str);
 
+       connman_element_add_static_property(&network->element,
+                                       "Strength", DBUS_TYPE_BYTE, &strength);
+
        network->type = type;
        network->identifier = g_strdup(identifier);
 
@@ -619,8 +623,11 @@ int connman_network_set_uint8(struct connman_network 
*network,
 {
        DBG("network %p key %s value %d", network, key, value);
 
-       if (g_str_equal(key, "Strength") == TRUE)
+       if (g_str_equal(key, "Strength") == TRUE) {
                network->strength = value;
+               connman_element_set_static_property(&network->element,
+                                       "Strength", DBUS_TYPE_BYTE, &value);
+       }
 
        return 0;
 }
_______________________________________________
Commits mailing list
[email protected]
https://lists.moblin.org/mailman/listinfo/commits

Reply via email to