summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2007-05-14 12:22:52 +0000
committerMarcel Holtmann <marcel@holtmann.org>2007-05-14 12:22:52 +0000
commit772f25e26e1d1c5982855eefd59b51c7e4aaab95 (patch)
treefe8df1faf16795e649407c6512dc1f8b096a0b2b
parent8cea4266a59e24df215febc4bfa4d98c4ad58e7c (diff)
Add GetAdapter() method to retrieve the source address
-rw-r--r--input/device.c22
-rw-r--r--input/input-api.txt30
2 files changed, 39 insertions, 13 deletions
diff --git a/input/device.c b/input/device.c
index d9f95c4e..d85aae55 100644
--- a/input/device.c
+++ b/input/device.c
@@ -850,6 +850,27 @@ static DBusHandlerResult device_is_connected(DBusConnection *conn,
return send_message_and_unref(conn, reply);
}
+static DBusHandlerResult device_get_adapter(DBusConnection *conn,
+ DBusMessage *msg, void *data)
+{
+ struct device *idev = data;
+ DBusMessage *reply;
+ char addr[18];
+ const char *paddr = addr;
+
+ ba2str(&idev->src, addr);
+
+ reply = dbus_message_new_method_return(msg);
+ if (!reply)
+ return DBUS_HANDLER_RESULT_NEED_MEMORY;
+
+ dbus_message_append_args(reply,
+ DBUS_TYPE_STRING, &paddr,
+ DBUS_TYPE_INVALID);
+
+ return send_message_and_unref(conn, reply);
+}
+
static DBusHandlerResult device_get_address(DBusConnection *conn,
DBusMessage *msg, void *data)
{
@@ -936,6 +957,7 @@ static DBusMethodVTable device_methods[] = {
{ "Connect", device_connect, "", "" },
{ "Disconnect", device_disconnect, "", "" },
{ "IsConnected", device_is_connected, "", "b" },
+ { "GetAdapter", device_get_adapter, "", "s" },
{ "GetAddress", device_get_address, "", "s" },
{ "GetName", device_get_name, "", "s" },
{ "GetProductId", device_get_product_id, "", "q" },
diff --git a/input/input-api.txt b/input/input-api.txt
index 60066eb9..13da80ba 100644
--- a/input/input-api.txt
+++ b/input/input-api.txt
@@ -7,7 +7,6 @@ Copyright (C) 2006-2007 Marcel Holtmann <marcel@holtmann.org>
Input Manager hierarchy
=======================
-Service org.bluez.input
Interface org.bluez.input.Manager
Object path /org/bluez/input
@@ -24,14 +23,14 @@ Methods array{string} ListDevices()
On success it will return the path of the
newly created device object.
- Possible errors:org.bluez.input.AlreadyExists
- org.bluez.input.NotSupported
- org.bluez.input.ConnectionAttemptFailed
- org.bluez.input.Failed
+ Possible errors: org.bluez.input.AlreadyExists
+ org.bluez.input.NotSupported
+ org.bluez.input.ConnectionAttemptFailed
+ org.bluez.input.Failed
void RemoveDevice(string path)
- Remove the input device object for a given path.
+ Remove the input device object for a given path.
Possible errors:org.bluez.input.DoesNotExist
org.bluez.input.Failed
@@ -44,11 +43,16 @@ Signals void DeviceCreated(string path)
Input Device hierarchy
======================
-Service org.bluez.input
Interface org.bluez.input.Device
Object path /org/bluez/input/{keyboard*|mouse*|...}
-Methods string GetAddress()
+Methods string GetAdapter()
+
+ Returns the adapter address.
+
+ Example: "00:11:22:33:44:55"
+
+ string GetAddress()
Returns the device address.
@@ -71,18 +75,18 @@ Methods string GetAddress()
Returns the connection status.
void Connect()
-
+
Connect to the input device.
- Possible errors:org.bluez.input.AlreadyConnected
- org.bluez.input.ConnectionAttemptFailed
+ Possible errors: org.bluez.input.AlreadyConnected
+ org.bluez.input.ConnectionAttemptFailed
void Disconnect()
Disconnect from the input device.
- Possible errors:org.bluez.input.Failed
+ Possible errors: org.bluez.input.Failed
-Signals void Connected()
+Signals void Connected()
void Disconnected()