Class SGrModbusGatewayRegistry
- java.lang.Object
-
- com.smartgridready.communicator.modbus.impl.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.
-
-
Constructor Summary
Constructors Constructor Description SGrModbusGatewayRegistry()Constructs a new instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ModbusGatewayattachGateway(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 ModbusGatewayRegistrydefaultInstance()Gets the default singleton instance of the Modbus gateway registry.voiddetachAllGateways()Disconnects all Modbus transport gateways.voiddetachGateway(com.smartgridready.ns.v0.ModbusInterfaceDescription interfaceDescription, java.lang.String key)Disconnects the Modbus transport gateway of a given device.voiddetachGateway(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.
-
-
-
Method Detail
-
defaultInstance
public static ModbusGatewayRegistry defaultInstance()
Gets the default singleton instance of the Modbus gateway registry.- Returns:
- an instance of
SGrModbusGatewayRegistry
-
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:ModbusGatewayRegistryUses or creates a Modbus transport gateway for a given device.- Specified by:
attachGatewayin interfaceModbusGatewayRegistry- Parameters:
interfaceDescription- the device's Modbus interface descriptiondriverFactory- the Modbus driver factorykey- 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.GenDriverExceptionDescription copied from interface:ModbusGatewayRegistryDisconnects the Modbus transport gateway of a given device.- Specified by:
detachGatewayin interfaceModbusGatewayRegistry- Parameters:
identifier- the transport identifierkey- 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.GenDriverExceptionDescription copied from interface:ModbusGatewayRegistryDisconnects the Modbus transport gateway of a given device.- Specified by:
detachGatewayin interfaceModbusGatewayRegistry- Parameters:
interfaceDescription- the device's Modbus interface descriptionkey- the unique device object key- Throws:
com.smartgridready.driver.api.common.GenDriverException- when no gateway could be detached
-
detachAllGateways
public void detachAllGateways()
Description copied from interface:ModbusGatewayRegistryDisconnects all Modbus transport gateways.- Specified by:
detachAllGatewaysin interfaceModbusGatewayRegistry
-
getAllGatewayIdentifiers
public java.util.List<java.lang.String> getAllGatewayIdentifiers()
Description copied from interface:ModbusGatewayRegistryGets all transport identifiers.- Specified by:
getAllGatewayIdentifiersin interfaceModbusGatewayRegistry- Returns:
- a list of strings
-
-