Package nl.basjes.modbus.schema.fetcher
Class RegisterBlockFetcher
-
- All Implemented Interfaces:
public class RegisterBlockFetcherA RegisterBlockFetcher needs to have a Schema, a target RegisterBlock and a ModbusDevice
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final classRegisterBlockFetcher.FetchBatch
-
Field Summary
Fields Modifier and Type Field Description public final static LongFORCE_UPDATE_MAX_AGEprivate final List<Field>neededFields
-
Constructor Summary
Constructors Constructor Description RegisterBlockFetcher(SchemaDevice schemaDevice, ModbusDevice modbusDevice)
-
Method Summary
Modifier and Type Method Description final List<Field>getNeededFields()final Unitinitialize()final Unitneed(Field field)final UnitunNeed(Field field)final UnitneedAll()We want all fields to be kept up-to-date final UnitunNeedAll()We no longer want all fields to be kept up-to-date final UnitupdateAll(Long maxAge)Make sure all registers mentioned in all known fields are retrieved. final UnitupdateAll()Make sure all registers mentioned in all known fields are retrieved. final Unitupdate(Field field)We force an immediate update of all registers needed for the provided field. final Unitupdate(Long maxAge)Update all registers related to the needed fields to be updated with a maximum age of the provided milliseconds List<RegisterBlockFetcher.FetchBatch>calculateFetchBatches(Long maxAge)Determine which sets of registers need to be retrieved again. -
-
Constructor Detail
-
RegisterBlockFetcher
RegisterBlockFetcher(SchemaDevice schemaDevice, ModbusDevice modbusDevice)
-
-
Method Detail
-
getNeededFields
final List<Field> getNeededFields()
-
initialize
final Unit initialize()
-
unNeed
final Unit unNeed(Field field)
- Parameters:
field- The field that no longer needs to be kept up-to-date
-
updateAll
@JvmOverloads() final Unit updateAll(Long maxAge)
Make sure all registers mentioned in all known fields are retrieved.
-
updateAll
@JvmOverloads() final Unit updateAll()
Make sure all registers mentioned in all known fields are retrieved.
-
update
final Unit update(Field field)
We force an immediate update of all registers needed for the provided field. No batching, buffering or any optimization is done.
- Parameters:
field- The field that must be updated
-
update
final Unit update(Long maxAge)
Update all registers related to the needed fields to be updated with a maximum age of the provided milliseconds
- Parameters:
maxAge- maximum age of the fields in milliseconds
-
calculateFetchBatches
List<RegisterBlockFetcher.FetchBatch> calculateFetchBatches(Long maxAge)
Determine which sets of registers need to be retrieved again.
- Parameters:
maxAge- The maximum age (in milliseconds) of the data for it to need an update.- Returns:
The list of address ranges that must be retrieved (Sorted by the start address)
-
-
-
-