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 classRegisterBlockFetcher.FetchBatchpublic final classRegisterBlockFetcher.MergedFetchBatchWhen doing fetch optimization we are sometimes combining the FetchBatches. This is the class to hold such a combination. This is needed to be able to handle the retry in case of a read error
-
Constructor Summary
Constructors Constructor Description RegisterBlockFetcher(SchemaDevice schemaDevice, ModbusDevice modbusDevice)
-
Method Summary
Modifier and Type Method Description final List<RegisterBlockFetcher.FetchBatch>update(Field field)We force an immediate update of all registers needed for the provided field. final List<RegisterBlockFetcher.FetchBatch>update(Long maxAge)Update all registers related to the needed fields to be updated with a maximum age of the provided milliseconds final List<RegisterBlockFetcher.FetchBatch>update()Update all registers related to the needed fields to be updated with a maximum age of the provided milliseconds final RegisterBlockgetRegisters(ModbusDevice $self, RegisterBlockFetcher.FetchBatch fetchBatch)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
-
update
final List<RegisterBlockFetcher.FetchBatch> 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- Returns:
A (possibly empty) list of all fetches that have been done (with duration and status)
-
update
@JvmOverloads() final List<RegisterBlockFetcher.FetchBatch> 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- Returns:
A (possibly empty) list of all fetches that have been done (with duration and status)
-
update
@JvmOverloads() final List<RegisterBlockFetcher.FetchBatch> update()
Update all registers related to the needed fields to be updated with a maximum age of the provided milliseconds
- Returns:
A (possibly empty) list of all fetches that have been done (with duration and status)
-
getRegisters
final RegisterBlock getRegisters(ModbusDevice $self, RegisterBlockFetcher.FetchBatch fetchBatch)
-
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)
-
-
-
-