diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2006-09-28 15:43:03 +0000 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2006-09-28 15:43:03 +0000 |
commit | 2c3835de25734e4171c1270942b23903b527e961 (patch) | |
tree | be8ccbb2a4778e5499a3b2284a605d637152fdad /hcid/dbus-test.c | |
parent | 15d6d1fe6555ae87c440a8d1b8f0993e548564f3 (diff) |
Add basic framework for the test interface
Diffstat (limited to 'hcid/dbus-test.c')
-rw-r--r-- | hcid/dbus-test.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/hcid/dbus-test.c b/hcid/dbus-test.c index f3bf47c4..65389f39 100644 --- a/hcid/dbus-test.c +++ b/hcid/dbus-test.c @@ -27,3 +27,46 @@ #include <stdio.h> #include <errno.h> + +#include <dbus/dbus.h> + +#include "hcid.h" +#include "dbus.h" + +static DBusHandlerResult audit_device(DBusConnection *conn, + DBusMessage *msg, void *data) +{ + DBusMessage *reply; + const char *address; + + if (!dbus_message_get_args(msg, NULL, + DBUS_TYPE_STRING, &address, + DBUS_TYPE_INVALID)) + return error_invalid_arguments(conn, msg); + + reply = dbus_message_new_method_return(msg); + if (!reply) + return DBUS_HANDLER_RESULT_NEED_MEMORY; + + return send_reply_and_unref(conn, reply); +} + +static struct service_data methods[] = { + { "AuditRemoteDevice", audit_device }, + { NULL, NULL } +}; + +DBusHandlerResult handle_test_method(DBusConnection *conn, DBusMessage *msg, void *data) +{ + service_handler_func_t handler; + + if (!hcid_dbus_use_experimental()) + return error_unknown_method(conn, msg); + + handler = find_service_handler(methods, msg); + + if (handler) + return handler(conn, msg, data); + + return error_unknown_method(conn, msg); +} |