From: Denis Kenzior Date: Sat, 13 Feb 2010 00:29:41 +0000 (-0600) Subject: Add support for modem names X-Git-Tag: 0.18~6 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d87f285fdfcb816b3603a750cbcb3592ece2cfb3;p=platform%2Fupstream%2Fofono.git Add support for modem names --- diff --git a/include/modem.h b/include/modem.h index b2aa607..d502640 100644 --- a/include/modem.h +++ b/include/modem.h @@ -50,6 +50,8 @@ void ofono_modem_remove(struct ofono_modem *modem); void ofono_modem_set_powered(struct ofono_modem *modem, ofono_bool_t powered); ofono_bool_t ofono_modem_get_powered(struct ofono_modem *modem); +void ofono_modem_set_name(struct ofono_modem *modem, const char *name); + int ofono_modem_set_string(struct ofono_modem *modem, const char *key, const char *value); const char *ofono_modem_get_string(struct ofono_modem *modem, const char *key); diff --git a/src/modem.c b/src/modem.c index 200091a..a79577c 100644 --- a/src/modem.c +++ b/src/modem.c @@ -67,6 +67,7 @@ struct ofono_modem { const struct ofono_modem_driver *driver; void *driver_data; char *driver_type; + char *name; }; struct ofono_devinfo { @@ -394,6 +395,10 @@ static DBusMessage *modem_get_properties(DBusConnection *conn, g_free(interfaces); + if (modem->name) + ofono_dbus_dict_append(&dict, "Name", DBUS_TYPE_STRING, + &modem->name); + dbus_message_iter_close_container(&iter, &dict); return reply; @@ -1040,6 +1045,26 @@ bool ofono_modem_get_boolean(struct ofono_modem *modem, const char *key) return value; } +void ofono_modem_set_name(struct ofono_modem *modem, const char *name) +{ + if (modem->name) + g_free(modem->name); + + if (!name) + return; + + modem->name = g_strdup(name); + + if (modem->driver) { + DBusConnection *conn = ofono_dbus_get_connection(); + + ofono_dbus_signal_property_changed(conn, modem->path, + OFONO_MODEM_INTERFACE, + "Name", DBUS_TYPE_STRING, + &modem->name); + } +} + struct ofono_modem *ofono_modem_create(const char *name, const char *type) { struct ofono_modem *modem;