From: Marcel Holtmann Date: Thu, 25 Dec 2008 18:05:22 +0000 (+0100) Subject: Add support for Name property to generic driver X-Git-Tag: accepted/2.0alpha-wayland/20121110.002834~4336 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a78d60bdd0986e79f453fe1cf41a79f8c3a68eb3;p=profile%2Fivi%2Fconnman.git Add support for Name property to generic driver --- diff --git a/src/device.c b/src/device.c index 2ac98c0..561cd35 100644 --- a/src/device.c +++ b/src/device.c @@ -44,6 +44,22 @@ struct connman_device { GSList *networks; }; +static const char *type2description(enum connman_device_type type) +{ + switch (type) { + case CONNMAN_DEVICE_TYPE_ETHERNET: + return "Ethernet"; + case CONNMAN_DEVICE_TYPE_WIFI: + return "Wireless"; + case CONNMAN_DEVICE_TYPE_WIMAX: + return "WiMAX"; + case CONNMAN_DEVICE_TYPE_BLUETOOTH: + return "Bluetooth"; + default: + return NULL; + } +} + static const char *type2string(enum connman_device_type type) { switch (type) { @@ -122,6 +138,15 @@ static DBusMessage *get_properties(DBusConnection *conn, DBUS_TYPE_STRING_AS_STRING DBUS_TYPE_VARIANT_AS_STRING DBUS_DICT_ENTRY_END_CHAR_AS_STRING, &dict); + str = type2description(device->type); + if (str != NULL && device->interface != NULL) { + char *name = g_strdup_printf("%s (%s)", str, device->interface); + if (name != NULL) + connman_dbus_dict_append_variant(&dict, "Name", + DBUS_TYPE_STRING, &name); + g_free(name); + } + str = type2string(device->type); if (str != NULL) connman_dbus_dict_append_variant(&dict, "Type",