Class DummyModbusBridge
- java.lang.Object
-
- io.openems.edge.common.component.AbstractOpenemsComponent
-
- io.openems.edge.bridge.modbus.api.AbstractModbusBridge
-
- io.openems.edge.bridge.modbus.test.DummyModbusBridge
-
- All Implemented Interfaces:
BridgeModbus
,BridgeModbusTcp
,OpenemsComponent
,org.osgi.service.event.EventHandler
public class DummyModbusBridge extends AbstractModbusBridge implements BridgeModbusTcp, BridgeModbus, OpenemsComponent
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface io.openems.edge.bridge.modbus.api.BridgeModbus
BridgeModbus.ChannelId
-
Nested classes/interfaces inherited from interface io.openems.edge.bridge.modbus.api.BridgeModbusTcp
BridgeModbusTcp.ChannelId
-
Nested classes/interfaces inherited from interface io.openems.edge.common.component.OpenemsComponent
OpenemsComponent.ChannelId
-
-
Field Summary
-
Fields inherited from class io.openems.edge.bridge.modbus.api.AbstractModbusBridge
DEFAULT_RETRIES, DEFAULT_TIMEOUT, worker
-
-
Constructor Summary
Constructors Constructor Description DummyModbusBridge(java.lang.String id)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addProtocol(java.lang.String sourceId, ModbusProtocol protocol)
Adds the protocol.void
closeModbusConnection()
Closes the Modbus connection.Cycle
getCycle()
Gets theCycle
.java.net.InetAddress
getIpAddress()
Gets the IP address.com.ghgande.j2mod.modbus.io.ModbusTransaction
getNewModbusTransaction()
Creates a new Modbus Transaction on an open Modbus connection.void
removeProtocol(java.lang.String sourceId)
Removes the protocol.-
Methods inherited from class io.openems.edge.bridge.modbus.api.AbstractModbusBridge
activate, activate, deactivate, getLogVerbosity, handleEvent, invalidateElementsAfterReadErrors, logError, logInfo, logWarn
-
Methods inherited from class io.openems.edge.common.component.AbstractOpenemsComponent
_channel, activate, addChannel, addChannels, addChannels, alias, channels, getComponentContext, id, isEnabled, logDebug, modified, removeChannel
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.openems.edge.bridge.modbus.api.BridgeModbus
_setCycleTimeIsTooShort, _setExecutionDuration, getCycleTimeIsTooShort, getCycleTimeIsTooShortChannel, getExecutionDuration, getExecutionDurationChannel
-
Methods inherited from interface io.openems.edge.common.component.OpenemsComponent
_channel, _getChannelAs, alias, channel, channel, channels, debugLog, getComponentContext, getState, getStateChannel, hasFaults, id, isEnabled, serviceFactoryPid, servicePid
-
-
-
-
Method Detail
-
addProtocol
public void addProtocol(java.lang.String sourceId, ModbusProtocol protocol)
Description copied from class:AbstractModbusBridge
Adds the protocol.- Specified by:
addProtocol
in interfaceBridgeModbus
- Overrides:
addProtocol
in classAbstractModbusBridge
- Parameters:
sourceId
- Component-ID of the sourceprotocol
- the ModbusProtocol
-
removeProtocol
public void removeProtocol(java.lang.String sourceId)
Description copied from class:AbstractModbusBridge
Removes the protocol.- Specified by:
removeProtocol
in interfaceBridgeModbus
- Overrides:
removeProtocol
in classAbstractModbusBridge
- Parameters:
sourceId
- Component-ID of the source
-
getIpAddress
public java.net.InetAddress getIpAddress()
Description copied from interface:BridgeModbusTcp
Gets the IP address.- Specified by:
getIpAddress
in interfaceBridgeModbusTcp
- Returns:
- the IP address
-
getCycle
public Cycle getCycle()
Description copied from class:AbstractModbusBridge
Gets theCycle
.- Specified by:
getCycle
in classAbstractModbusBridge
- Returns:
- the Cycle
-
getNewModbusTransaction
public com.ghgande.j2mod.modbus.io.ModbusTransaction getNewModbusTransaction() throws OpenemsException
Description copied from class:AbstractModbusBridge
Creates a new Modbus Transaction on an open Modbus connection.- Specified by:
getNewModbusTransaction
in classAbstractModbusBridge
- Returns:
- the Modbus Transaction
- Throws:
OpenemsException
- on error
-
closeModbusConnection
public void closeModbusConnection()
Description copied from class:AbstractModbusBridge
Closes the Modbus connection.- Specified by:
closeModbusConnection
in classAbstractModbusBridge
-
-