summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/connection.c8
-rw-r--r--src/device.c6
-rw-r--r--src/element.c4
-rw-r--r--src/network.c24
4 files changed, 41 insertions, 1 deletions
diff --git a/src/connection.c b/src/connection.c
index 01a84cc0..7344cd48 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -205,7 +205,7 @@ static DBusMessage *get_properties(DBusConnection *conn,
struct connman_element *element = data;
DBusMessage *reply;
DBusMessageIter array, dict;
- const char *method = NULL;
+ const char *type = NULL, *method = NULL;
const char *address = NULL, *netmask = NULL, *gateway = NULL;
DBG("conn %p", conn);
@@ -221,6 +221,12 @@ static DBusMessage *get_properties(DBusConnection *conn,
DBUS_TYPE_STRING_AS_STRING DBUS_TYPE_VARIANT_AS_STRING
DBUS_DICT_ENTRY_END_CHAR_AS_STRING, &dict);
+ connman_element_get_static_property(element, "Type", &type);
+
+ if (type != NULL)
+ connman_dbus_dict_append_variant(&dict, "Type",
+ DBUS_TYPE_STRING, &type);
+
if (element->devname != NULL)
connman_dbus_dict_append_variant(&dict, "Interface",
DBUS_TYPE_STRING, &element->devname);
diff --git a/src/device.c b/src/device.c
index c1aa0046..f6bad3b2 100644
--- a/src/device.c
+++ b/src/device.c
@@ -682,6 +682,7 @@ struct connman_device *connman_device_create(const char *node,
enum connman_device_type type)
{
struct connman_device *device;
+ const char *str;
DBG("node %s type %d", node, type);
@@ -700,6 +701,11 @@ struct connman_device *connman_device_create(const char *node,
device->element.device = device;
device->element.destruct = device_destruct;
+ str = type2string(type);
+ if (str != NULL)
+ connman_element_add_static_property(&device->element,
+ "Type", DBUS_TYPE_STRING, &str);
+
device->type = type;
device->mode = CONNMAN_DEVICE_MODE_UNKNOWN;
device->policy = CONNMAN_DEVICE_POLICY_AUTO;
diff --git a/src/element.c b/src/element.c
index fef78bed..03bb5f55 100644
--- a/src/element.c
+++ b/src/element.c
@@ -1040,6 +1040,10 @@ gboolean connman_element_get_static_property(struct connman_element *element,
__connman_element_unlock(element);
+ if (found == FALSE && element->parent != NULL)
+ return connman_element_get_static_property(element->parent,
+ name, value);
+
return found;
}
diff --git a/src/network.c b/src/network.c
index 9ed6dc4b..1bfc46df 100644
--- a/src/network.c
+++ b/src/network.c
@@ -56,6 +56,24 @@ struct connman_network {
} wifi;
};
+static const char *type2string(enum connman_network_type type)
+{
+ switch (type) {
+ case CONNMAN_NETWORK_TYPE_UNKNOWN:
+ case CONNMAN_NETWORK_TYPE_VENDOR:
+ break;
+ case CONNMAN_NETWORK_TYPE_WIFI:
+ return "wifi";
+ case CONNMAN_NETWORK_TYPE_BLUETOOTH_PAN:
+ case CONNMAN_NETWORK_TYPE_BLUETOOTH_DUN:
+ return "bluetooth";
+ case CONNMAN_NETWORK_TYPE_HSO:
+ return "cellular";
+ }
+
+ return NULL;
+}
+
static DBusMessage *get_properties(DBusConnection *conn,
DBusMessage *msg, void *data)
{
@@ -334,6 +352,7 @@ struct connman_network *connman_network_create(const char *identifier,
enum connman_network_type type)
{
struct connman_network *network;
+ const char *str;
DBG("identifier %s type %d", identifier, type);
@@ -352,6 +371,11 @@ struct connman_network *connman_network_create(const char *identifier,
network->element.network = network;
network->element.destruct = network_destruct;
+ str = type2string(type);
+ if (str != NULL)
+ connman_element_add_static_property(&network->element,
+ "Type", DBUS_TYPE_STRING, &str);
+
network->type = type;
network->identifier = g_strdup(identifier);