This patch adds the D-Bus parsing of the arguments included in the
"Register" method of the Handsfree Audio Manager method.
---
plugins/hfp_audio.c | 25 ++++++++++++++++++++++---
1 file changed, 22 insertions(+), 3 deletions(-)
diff --git a/plugins/hfp_audio.c b/plugins/hfp_audio.c
index e3646e5..7b334e2 100644
--- a/plugins/hfp_audio.c
+++ b/plugins/hfp_audio.c
@@ -46,9 +46,28 @@ static DBusMessage *am_get_cards(DBusConnection *conn,
static DBusMessage *am_agent_register(DBusConnection *conn,
DBusMessage *msg, void *user_data)
{
- return g_dbus_create_error(msg, OFONO_ERROR_INTERFACE
- ".NotImplemented",
- "Implementation not provided");
+ const char *path;
+ unsigned char *codecs;
+ DBusMessageIter iter, array;
+ int length;
+
+ if (dbus_message_iter_init(msg, &iter) == FALSE)
+ goto invalid_args;
+
+ dbus_message_iter_get_basic(&iter, &path);
+
+ dbus_message_iter_next(&iter);
+ dbus_message_iter_recurse(&iter, &array);
+ dbus_message_iter_get_fixed_array(&array, &codecs, &length);
+
+ if (length == 0)
+ goto invalid_args;
+
+ return dbus_message_new_method_return(msg);
+
+invalid_args:
+ return g_dbus_create_error(msg, OFONO_ERROR_INTERFACE ".Rejected",
+ "Invalid arguments in method call");
}
static DBusMessage *am_agent_unregister(DBusConnection *conn,
--
1.7.11.7
_______________________________________________
ofono mailing list
[email protected]
http://lists.ofono.org/listinfo/ofono