summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--hcid/dbus-adapter.c2
-rw-r--r--hcid/dbus-test.c43
-rw-r--r--hcid/dbus.h4
3 files changed, 49 insertions, 0 deletions
diff --git a/hcid/dbus-adapter.c b/hcid/dbus-adapter.c
index 780e82cd..c2564fe6 100644
--- a/hcid/dbus-adapter.c
+++ b/hcid/dbus-adapter.c
@@ -2688,6 +2688,8 @@ DBusHandlerResult msg_func_device(DBusConnection *conn, DBusMessage *msg, void *
return error_unknown_method(conn, msg);
} else if (!strcmp(SECURITY_INTERFACE, iface))
return handle_security_method(conn, msg, data);
+ else if (!strcmp(TEST_INTERFACE, iface))
+ return handle_test_method(conn, msg, data);
else if (!strcmp(RFCOMM_INTERFACE, iface))
return handle_rfcomm_method(conn, msg, data);
else if (!strcmp(SDP_INTERFACE, iface))
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);
+}
diff --git a/hcid/dbus.h b/hcid/dbus.h
index 05edc48b..660a0b56 100644
--- a/hcid/dbus.h
+++ b/hcid/dbus.h
@@ -42,6 +42,8 @@
#define SECURITY_INTERFACE BASE_INTERFACE ".Security"
+#define TEST_INTERFACE BASE_INTERFACE ".Test"
+
#define RFCOMM_INTERFACE BASE_INTERFACE ".RFCOMM"
#define SDP_INTERFACE BASE_INTERFACE ".SDP"
@@ -200,6 +202,8 @@ int name_listener_add(DBusConnection *connection, const char *name,
int name_listener_remove(DBusConnection *connection, const char *name,
name_cb_t func, void *user_data);
+DBusHandlerResult handle_test_method(DBusConnection *conn, DBusMessage *msg, void *data);
+
DBusHandlerResult handle_security_method(DBusConnection *conn, DBusMessage *msg, void *data);
DBusHandlerResult handle_rfcomm_method(DBusConnection *conn, DBusMessage *msg, void *data);