Class ModbusGateway


  • public class ModbusGateway
    extends java.lang.Object
    Implements a Modbus "gateway" wrapper, allowing shared use of Modbus RTU serial connections.
    • Constructor Summary

      Constructors 
      Constructor Description
      ModbusGateway​(java.lang.String identifier, com.smartgridready.ns.v0.ModbusInterfaceDescription interfaceDescription, com.smartgridready.driver.api.modbus.GenDriverAPI4Modbus transport)
      Constructs a new instance with no shared access.
      ModbusGateway​(java.lang.String identifier, com.smartgridready.ns.v0.ModbusInterfaceDescription interfaceDescription, com.smartgridready.driver.api.modbus.GenDriverAPI4Modbus transport, boolean shared)
      Constructs a new instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void connect​(java.lang.String key)
      Connects a specific device.
      void disconnect​(java.lang.String key)
      Disconnects a specific device.
      void disconnectAll()
      Disconnect all devices.
      boolean equals​(java.lang.Object other)  
      java.lang.String getIdentifier()
      Gets the unique identifier.
      com.smartgridready.ns.v0.ModbusInterfaceDescription getInterfaceDescription()
      Gets the interface specification.
      com.smartgridready.driver.api.modbus.GenDriverAPI4Modbus getTransport()
      Gets the wrapped driver instance.
      int hashCode()  
      boolean isConnected​(java.lang.String key)
      Tells if a specific device is connected.
      boolean isShared()
      Tells if shared access is possible.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ModbusGateway

        public ModbusGateway​(java.lang.String identifier,
                             com.smartgridready.ns.v0.ModbusInterfaceDescription interfaceDescription,
                             com.smartgridready.driver.api.modbus.GenDriverAPI4Modbus transport,
                             boolean shared)
        Constructs a new instance.
        Parameters:
        identifier - the unique identifier
        interfaceDescription - the Modbus interface specification
        transport - the wrapped driver instance
        shared - shared access allowed when true
      • ModbusGateway

        public ModbusGateway​(java.lang.String identifier,
                             com.smartgridready.ns.v0.ModbusInterfaceDescription interfaceDescription,
                             com.smartgridready.driver.api.modbus.GenDriverAPI4Modbus transport)
        Constructs a new instance with no shared access.
        Parameters:
        identifier - the unique identifier
        interfaceDescription - the Modbus interface specification
        transport - the wrapped driver instance
    • Method Detail

      • getInterfaceDescription

        public com.smartgridready.ns.v0.ModbusInterfaceDescription getInterfaceDescription()
        Gets the interface specification.
        Returns:
        an instance of ModbusInterfaceDescription
      • getTransport

        public com.smartgridready.driver.api.modbus.GenDriverAPI4Modbus getTransport()
        Gets the wrapped driver instance.
        Returns:
        an instance of GenDriverAPI4Modbus
      • getIdentifier

        public java.lang.String getIdentifier()
        Gets the unique identifier.
        Returns:
        a string
      • isShared

        public boolean isShared()
        Tells if shared access is possible.
        Returns:
        a boolean
      • isConnected

        public boolean isConnected​(java.lang.String key)
        Tells if a specific device is connected.
        Parameters:
        key - the unique identifier
        Returns:
        a boolean
      • connect

        public void connect​(java.lang.String key)
                     throws com.smartgridready.driver.api.common.GenDriverException
        Connects a specific device.
        Parameters:
        key - the unique identifier
        Throws:
        com.smartgridready.driver.api.common.GenDriverException - when connecting failed
      • disconnect

        public void disconnect​(java.lang.String key)
                        throws com.smartgridready.driver.api.common.GenDriverException
        Disconnects a specific device.
        Parameters:
        key - the unique identifier
        Throws:
        com.smartgridready.driver.api.common.GenDriverException - when disconnect failed
      • disconnectAll

        public void disconnectAll()
        Disconnect all devices.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object other)
        Overrides:
        equals in class java.lang.Object