[PATCH 04/15] emulator: Add get properities for emulator
Zhenhua Zhang
zhenhua.zhang at intel.com
Wed Jul 7 03:01:41 PDT 2010
oFono properties:
"Powered": Whether the emulator is powered on.
"Type": Type could be one of supported emulator type, default is DUN.
---
src/emulator.c | 28 +++++++++++++++++++++++++++-
1 files changed, 27 insertions(+), 1 deletions(-)
diff --git a/src/emulator.c b/src/emulator.c
index 7551eb6..86a2eee 100644
--- a/src/emulator.c
+++ b/src/emulator.c
@@ -288,7 +288,33 @@ error:
static DBusMessage *emulator_get_properties(DBusConnection *conn,
DBusMessage *msg, void *data)
{
- return dbus_message_new_method_return(msg);
+ struct ofono_emulator *e = data;
+ DBusMessage *reply;
+ DBusMessageIter iter;
+ DBusMessageIter dict;
+ const char *type_str;
+ int type;
+
+ reply = dbus_message_new_method_return(msg);
+ if (!reply)
+ return NULL;
+
+ dbus_message_iter_init_append(reply, &iter);
+
+ dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY,
+ OFONO_PROPERTIES_ARRAY_SIGNATURE,
+ &dict);
+
+ ofono_dbus_dict_append(&dict, "Powered", DBUS_TYPE_BOOLEAN,
+ &e->powered);
+
+ type = e->driver->type;
+ type_str = ofono_emulator_type_to_str(type);
+ ofono_dbus_dict_append(&dict, "Type", DBUS_TYPE_STRING, &type_str);
+
+ dbus_message_iter_close_container(&iter, &dict);
+
+ return reply;
}
static DBusMessage *emulator_enable(DBusConnection *conn,
--
1.6.3.3
More information about the ofono
mailing list