Closed MarijaJankovic623 closed 6 years ago
Please show the code of your structure and your signal, so I can try to reproduce the error.
Code for my custom signal:
import org.freedesktop.dbus.DBusInterface;
import org.freedesktop.dbus.DBusInterfaceName;
import org.freedesktop.dbus.DBusSignal;
import org.freedesktop.dbus.exceptions.DBusException;
@DBusInterfaceName("org.freedesktop.systemd1")
public interface DBus extends DBusInterface {
public static final String DBUS = "org.freedesktop.systemd1";
public static final String DBUS_PATH = "/org/freedesktop/systemd1";
public class ownerDataSignal extends DBusSignal {
private final OwnerInformationStruct ownerInformationStruct;
public ownerDataSignal(OwnerInformationStruct ownerInformationStruct)
throws DBusException {
super(DBUS, DBUS_PATH, DBUS, "ownerDataSignal", "r", ownerInformationStruct);
this.ownerInformationStruct = ownerInformationStruct;
}
}
}
Code for my custom structure:
import org.freedesktop.dbus.Position;
import org.freedesktop.dbus.Struct;
import org.freedesktop.dbus.UInt32;
public final class OwnerInformationStruct extends Struct {
@Position(0)
public final UInt32 error;
@Position(1)
public final String name;
@Position(2)
public final String address;
public OwnerInformationStruct(UInt32 error, String name, String address) {
this.error = error;
this.name = name;
this.address = address;
}
}
Code from where I'm sending a signal:
OwnerInformationStruct ownerInformationStruct = new OwnerInformationStruct(new UInt32(1), "TEST", "TEST");
public void run() {
DBusConnection conn;
try {
conn = DBusConnection.getConnection(DBusConnection.SYSTEM);
conn.sendSignal(new DBus.ownerDataSignal(ownerInformationStruct));
} catch (DBusException e) {
e.printStackTrace();
}
}
Error that I get:
org.freedesktop.dbus.exceptions.FatalDBusException: Underlying transport returned EOF
I managed to resolve my issue, to send as sig value "(iss)". Thank you.
Hello,
When I try to send my custom structure, that extends Structure from your library, and send it as a parameter of my custom signal, extended from DBusSignal, I always get EOF error.
I think that there is some problem with parameter sig in the constructor of DBusSignal, when I pass "r", "(" or "(r)" I get EOF exception, and when I pass ")" nothing happens, a message is not added to the queue for sending at all.