Package nl.basjes.modbus.device.api
Class ModbusDevice
-
- All Implemented Interfaces:
-
java.lang.AutoCloseable
public abstract class ModbusDevice implements AutoCloseable
-
-
Field Summary
Fields Modifier and Type Field Description private IntegermaxRegistersPerModbusRequestprivate final IntegermaxDiscretesPerModbusRequest
-
Constructor Summary
Constructors Constructor Description ModbusDevice()
-
Method Summary
Modifier and Type Method Description final IntegergetMaxRegistersPerModbusRequest()The maximum number of modbus registers that can be requested PER call. final UnitsetMaxRegistersPerModbusRequest(Integer maxRegistersPerModbusRequest)final IntegergetMaxDiscretesPerModbusRequest()abstract RegisterBlockgetRegisters(Address firstRegister, Integer count)Retrieve a block of 16 bit registers (Input Registers and Holding Registers). DiscreteBlockgetDiscretes(Address firstDiscrete, Integer count)Retrieve a block of 1 bit values (Coils and Discrete Inputs). abstract Unitclose()-
-
Method Detail
-
getMaxRegistersPerModbusRequest
final Integer getMaxRegistersPerModbusRequest()
The maximum number of modbus registers that can be requested PER call. Some devices do not allow the normal max of 125.
-
setMaxRegistersPerModbusRequest
final Unit setMaxRegistersPerModbusRequest(Integer maxRegistersPerModbusRequest)
-
getMaxDiscretesPerModbusRequest
final Integer getMaxDiscretesPerModbusRequest()
-
getRegisters
abstract RegisterBlock getRegisters(Address firstRegister, Integer count)
Retrieve a block of 16 bit registers (Input Registers and Holding Registers).
- Parameters:
firstRegister- The first modbus register that is desired in the output.count- The maximum number of registers to retrieve ( >= 1 ).- Returns:
A RegisterBlock with of all the retrieved values
-
getDiscretes
DiscreteBlock getDiscretes(Address firstDiscrete, Integer count)
Retrieve a block of 1 bit values (Coils and Discrete Inputs).
- Parameters:
firstDiscrete- The first modbus discrete value that is desired in the output.count- The maximum number of values to retrieve ( >= 1 ).- Returns:
A DiscreteBlock with of all the retrieved values
-
-
-
-