modem: Add Type property to GetProperties result
authorDaniel Wagner <daniel.wagner@bmw-carit.de>
Tue, 22 Nov 2011 17:10:00 +0000 (18:10 +0100)
committerDenis Kenzior <denkenz@gmail.com>
Wed, 23 Nov 2011 02:38:20 +0000 (20:38 -0600)
src/modem.c

index 344a2a6..2fabe17 100644 (file)
@@ -119,6 +119,20 @@ struct modem_property {
        void *value;
 };
 
+static const char *modem_type_to_string(enum ofono_modem_type type)
+{
+       switch (type) {
+       case OFONO_MODEM_TYPE_HARDWARE:
+               return "hardware";
+       case OFONO_MODEM_TYPE_HFP:
+               return "hfp";
+       case OFONO_MODEM_TYPE_SAP:
+               return "sap";
+       }
+
+       return "unknown";
+}
+
 unsigned int __ofono_modem_callid_next(struct ofono_modem *modem)
 {
        unsigned int i;
@@ -755,6 +769,7 @@ void __ofono_modem_append_properties(struct ofono_modem *modem,
        GSList *l;
        struct ofono_atom *devinfo_atom;
        dbus_bool_t emergency = ofono_modem_get_emergency_mode(modem);
+       const char *strtype;
 
        ofono_dbus_dict_append(dict, "Online", DBUS_TYPE_BOOLEAN,
                                &modem->online);
@@ -813,6 +828,9 @@ void __ofono_modem_append_properties(struct ofono_modem *modem,
        if (modem->name)
                ofono_dbus_dict_append(dict, "Name", DBUS_TYPE_STRING,
                                        &modem->name);
+
+       strtype = modem_type_to_string(modem->driver->modem_type);
+       ofono_dbus_dict_append(dict, "Type", DBUS_TYPE_STRING, &strtype);
 }
 
 static DBusMessage *modem_get_properties(DBusConnection *conn,