Package io.openems.edge.bridge.modbus
Class BridgeModbusSerialImpl
java.lang.Object
io.openems.edge.common.component.AbstractOpenemsComponent
io.openems.edge.bridge.modbus.api.AbstractModbusBridge
io.openems.edge.bridge.modbus.BridgeModbusSerialImpl
- All Implemented Interfaces:
BridgeModbus
,BridgeModbusSerial
,OpenemsComponent
,org.osgi.service.event.EventHandler
public class BridgeModbusSerialImpl
extends AbstractModbusBridge
implements BridgeModbus, BridgeModbusSerial, OpenemsComponent, org.osgi.service.event.EventHandler
Provides a service for connecting to, querying and writing to a Modbus/RTU
device.
-
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.BridgeModbusSerial
BridgeModbusSerial.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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Closes the Modbus connection.protected void
Handles @Deactivate of implementations.int
Gets the Baudrate (e.g.int
Gets the Databits (e.g.com.ghgande.j2mod.modbus.io.ModbusTransaction
Creates a new Modbus Transaction on an open Modbus connection.Gets the Parity.Gets the Port-Name (e.g.Gets the Stopbits.Methods inherited from class io.openems.edge.bridge.modbus.api.AbstractModbusBridge
activate, activate, addProtocol, debugLog, getLogVerbosity, handleEvent, invalidateElementsAfterReadErrors, modified, modified, removeProtocol, retryModbusCommunication
Methods inherited from class io.openems.edge.common.component.AbstractOpenemsComponent
_channel, activate, addChannel, addChannels, addChannels, alias, channels, getComponentContext, id, isEnabled, logDebug, logError, logInfo, logWarn, 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
_setCycleDelay, _setCycleTimeIsTooShort, addProtocol, getCycleDelay, getCycleDelayChannel, getCycleTimeIsTooShort, getCycleTimeIsTooShortChannel, removeProtocol, retryModbusCommunication
Methods inherited from interface org.osgi.service.event.EventHandler
handleEvent
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
-
Constructor Details
-
BridgeModbusSerialImpl
public BridgeModbusSerialImpl()
-
-
Method Details
-
deactivate
protected void deactivate()Description copied from class:AbstractOpenemsComponent
Handles @Deactivate of implementations. Prints log output.- Overrides:
deactivate
in classAbstractModbusBridge
-
closeModbusConnection
public void closeModbusConnection()Description copied from class:AbstractModbusBridge
Closes the Modbus connection.- Specified by:
closeModbusConnection
in classAbstractModbusBridge
-
getNewModbusTransaction
public com.ghgande.j2mod.modbus.io.ModbusTransaction getNewModbusTransaction() throws OpenemsExceptionDescription 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
-
getBaudrate
public int getBaudrate()Description copied from interface:BridgeModbusSerial
Gets the Baudrate (e.g. 9600).- Specified by:
getBaudrate
in interfaceBridgeModbusSerial
- Returns:
- the Baudrate
-
getDatabits
public int getDatabits()Description copied from interface:BridgeModbusSerial
Gets the Databits (e.g. 8).- Specified by:
getDatabits
in interfaceBridgeModbusSerial
- Returns:
- the Databits
-
getParity
Description copied from interface:BridgeModbusSerial
Gets the Parity.- Specified by:
getParity
in interfaceBridgeModbusSerial
- Returns:
- the Parity.
-
getPortName
Description copied from interface:BridgeModbusSerial
Gets the Port-Name (e.g. '/dev/ttyUSB0' or 'COM3').- Specified by:
getPortName
in interfaceBridgeModbusSerial
- Returns:
- the Port-Name
-
getStopbits
Description copied from interface:BridgeModbusSerial
Gets the Stopbits.- Specified by:
getStopbits
in interfaceBridgeModbusSerial
- Returns:
- the Stopbits
-