Class SGrModbusGatewayRegistry

  • All Implemented Interfaces:
    ModbusGatewayRegistry

    public class SGrModbusGatewayRegistry
    extends java.lang.Object
    implements ModbusGatewayRegistry
    Default implementation of a shared Modbus gateway registry. Keeps track of multiple devices attached to the same transport.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      ModbusGateway attachGateway​(com.smartgridready.ns.v0.ModbusInterfaceDescription interfaceDescription, com.smartgridready.driver.api.modbus.GenDriverAPI4ModbusFactory driverFactory, java.lang.String key)
      Uses or creates a Modbus transport gateway for a given device.
      static ModbusGatewayRegistry defaultInstance()
      Gets the default singleton instance of the Modbus gateway registry.
      void detachAllGateways()
      Disconnects all Modbus transport gateways.
      void detachGateway​(com.smartgridready.ns.v0.ModbusInterfaceDescription interfaceDescription, java.lang.String key)
      Disconnects the Modbus transport gateway of a given device.
      void detachGateway​(java.lang.String identifier, java.lang.String key)
      Disconnects the Modbus transport gateway of a given device.
      java.util.List<java.lang.String> getAllGatewayIdentifiers()
      Gets all transport identifiers.
      • Methods inherited from class java.lang.Object

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

      • SGrModbusGatewayRegistry

        public SGrModbusGatewayRegistry()
        Constructs a new instance.
    • Method Detail

      • attachGateway

        public ModbusGateway attachGateway​(com.smartgridready.ns.v0.ModbusInterfaceDescription interfaceDescription,
                                           com.smartgridready.driver.api.modbus.GenDriverAPI4ModbusFactory driverFactory,
                                           java.lang.String key)
                                    throws com.smartgridready.driver.api.common.GenDriverException
        Description copied from interface: ModbusGatewayRegistry
        Uses or creates a Modbus transport gateway for a given device.
        Specified by:
        attachGateway in interface ModbusGatewayRegistry
        Parameters:
        interfaceDescription - the device's Modbus interface description
        driverFactory - the Modbus driver factory
        key - the unique device object key
        Returns:
        a Modbus gateway instance
        Throws:
        com.smartgridready.driver.api.common.GenDriverException - when the gateway could not be attached
      • detachGateway

        public void detachGateway​(java.lang.String identifier,
                                  java.lang.String key)
                           throws com.smartgridready.driver.api.common.GenDriverException
        Description copied from interface: ModbusGatewayRegistry
        Disconnects the Modbus transport gateway of a given device.
        Specified by:
        detachGateway in interface ModbusGatewayRegistry
        Parameters:
        identifier - the transport identifier
        key - the unique device object key
        Throws:
        com.smartgridready.driver.api.common.GenDriverException - when no gateway could be detached
      • detachGateway

        public void detachGateway​(com.smartgridready.ns.v0.ModbusInterfaceDescription interfaceDescription,
                                  java.lang.String key)
                           throws com.smartgridready.driver.api.common.GenDriverException
        Description copied from interface: ModbusGatewayRegistry
        Disconnects the Modbus transport gateway of a given device.
        Specified by:
        detachGateway in interface ModbusGatewayRegistry
        Parameters:
        interfaceDescription - the device's Modbus interface description
        key - the unique device object key
        Throws:
        com.smartgridready.driver.api.common.GenDriverException - when no gateway could be detached