]> nmode's Git Repositories - signal-cli/blobdiff - src/main/java/org/asamk/Signal.java
Return struct instead of object path directly for dbus list devices
[signal-cli] / src / main / java / org / asamk / Signal.java
index 1d8d04a3fe4505cfd9bc26f4c64c7372ebfba35c..2f81c196e714950dff561c48586c7e64578d925b 100644 (file)
@@ -3,7 +3,9 @@ package org.asamk;
 import org.asamk.signal.commands.exceptions.IOErrorException;
 
 import org.freedesktop.dbus.DBusPath;
 import org.asamk.signal.commands.exceptions.IOErrorException;
 
 import org.freedesktop.dbus.DBusPath;
+import org.freedesktop.dbus.Struct;
 import org.freedesktop.dbus.annotations.DBusProperty;
 import org.freedesktop.dbus.annotations.DBusProperty;
+import org.freedesktop.dbus.annotations.Position;
 import org.freedesktop.dbus.exceptions.DBusException;
 import org.freedesktop.dbus.exceptions.DBusExecutionException;
 import org.freedesktop.dbus.interfaces.DBusInterface;
 import org.freedesktop.dbus.exceptions.DBusException;
 import org.freedesktop.dbus.exceptions.DBusExecutionException;
 import org.freedesktop.dbus.interfaces.DBusInterface;
@@ -104,7 +106,7 @@ public interface Signal extends DBusInterface {
 
     DBusPath getDevice(long deviceId);
 
 
     DBusPath getDevice(long deviceId);
 
-    List<DBusPath> listDevices() throws Error.Failure;
+    List<StructDevice> listDevices() throws Error.Failure;
 
     DBusPath getThisDevice();
 
 
     DBusPath getThisDevice();
 
@@ -262,6 +264,36 @@ public interface Signal extends DBusInterface {
         }
     }
 
         }
     }
 
+    class StructDevice extends Struct {
+
+        @Position(0)
+        DBusPath objectPath;
+
+        @Position(1)
+        Long id;
+
+        @Position(2)
+        String name;
+
+        public StructDevice(final DBusPath objectPath, final Long id, final String name) {
+            this.objectPath = objectPath;
+            this.id = id;
+            this.name = name;
+        }
+
+        public DBusPath getObjectPath() {
+            return objectPath;
+        }
+
+        public Long getId() {
+            return id;
+        }
+
+        public String getName() {
+            return name;
+        }
+    }
+
     @DBusProperty(name = "Id", type = Long.class, access = DBusProperty.Access.READ)
     @DBusProperty(name = "Name", type = String.class)
     @DBusProperty(name = "Created", type = String.class, access = DBusProperty.Access.READ)
     @DBusProperty(name = "Id", type = Long.class, access = DBusProperty.Access.READ)
     @DBusProperty(name = "Name", type = String.class)
     @DBusProperty(name = "Created", type = String.class, access = DBusProperty.Access.READ)