hypfvieh / dbus-java

Improved version of java DBus library provided by freedesktop.org (https://dbus.freedesktop.org/doc/dbus-java/)
https://hypfvieh.github.io/dbus-java/
MIT License
185 stars 73 forks source link

InterfaceCodeGenerator produces interfaces with errors. #88

Closed yyvus closed 4 years ago

yyvus commented 4 years ago

I run the main function of InterfaceCodeGenerator.java using the below arguments. This generated the NetworkManager interface.

--system --outputDir /tmp org.freedesktop.NetworkManager /org/freedesktop/NetworkManager --inputFile PATH/org.freedesktop.NetworkManager.xml

I then obtained a interface with the following issues:

Please correct me if I did something wrong.

Below full output of the above command:

import java.util.List;
import java.util.Map;
import org.freedesktop.dbus.DBusPath;
import org.freedesktop.dbus.interfaces.DBusInterface;
import org.freedesktop.dbus.messages.DBusSignal;
import org.freedesktop.dbus.types.UInt32;
import org.freedesktop.dbus.types.Variant;

/**
 * Auto-generated class.
 */
public interface NetworkManager extends DBusInterface {

    public void Reload(UInt32 flags);
    public List<DBusPath> GetDevices();
    public List<DBusPath> GetAllDevices();
    public DBusPath GetDeviceByIpIface(String iface);
    public DBusPath ActivateConnection(DBusPath connection, DBusPath device, DBusPath specificObject);
    public DBusPath AddAndActivateConnection(Map<String, Map<String, Variant<?>>> connection, DBusPath device, DBusPath specificObject);
    public DBusPath AddAndActivateConnection2(Map<String, Map<String, Variant<?>>> connection, DBusPath device, DBusPath specificObject, Map<String, Variant<?>> options);
    public void DeactivateConnection(DBusPath activeConnection);
    public void Sleep(boolean sleep);
    public void Enable(boolean enable);
    public Map<String> GetPermissions();
    public void SetLogging(String level, String domains);
    public String GetLogging();
    public UInt32 CheckConnectivity();
    public UInt32 state();
    public DBusPath CheckpointCreate(List<DBusPath> devices, UInt32 rollbackTimeout, UInt32 flags);
    public void CheckpointDestroy(DBusPath checkpoint);
    public Map<String, UInt32> CheckpointRollback(DBusPath checkpoint);
    public void CheckpointAdjustRollbackTimeout(DBusPath checkpoint, UInt32 addTimeout);

    public static class StateChanged extends DBusSignal {

        private final UInt32 state;

        StateChanged(String _path, String _interfaceNameUInt32 _state) {
            super(_path, _interfaceName);
            this.state = _state;
        }

        public UInt32 getState() {
            return state;
        }

    }

    public static class PropertiesChanged extends DBusSignal {

        private final Map<String, Variant<?>> properties;

        PropertiesChanged(String _path, String _interfaceNameMap<String, Variant<?>> _properties) {
            super(_path, _interfaceName);
            this.properties = _properties;
        }

        public Map<String, Variant<?>> getProperties() {
            return properties;
        }

    }

    public static class DeviceAdded extends DBusSignal {

        private final DBusPath devicePath;

        DeviceAdded(String _path, String _interfaceNameDBusPath _devicePath) {
            super(_path, _interfaceName);
            this.devicePath = _devicePath;
        }

        public DBusPath getDevicePath() {
            return devicePath;
        }

    }

    public static class DeviceRemoved extends DBusSignal {

        private final DBusPath devicePath;

        DeviceRemoved(String _path, String _interfaceNameDBusPath _devicePath) {
            super(_path, _interfaceName);
            this.devicePath = _devicePath;
        }

        public DBusPath getDevicePath() {
            return devicePath;
        }

    }
}