Class SchemaDevice
-
- All Implemented Interfaces:
public class SchemaDevice
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final classSchemaDevice.TestResultpublic classSchemaDevice.SchemaDeviceBuilder
-
Field Summary
Fields Modifier and Type Field Description public final static IntegerCURRENT_SCHEMA_FEATURE_LEVELprivate IntegermaxRegistersPerModbusRequestprivate final IntegerschemaFeatureLevelprivate final List<Block>blocksprivate final IntegermaxBlockIdLengthprivate InstantlastFieldModificationTimestampprivate ModbusDevicemodbusDeviceprivate ModbusBlockFetchermodbusBlockFetcherprivate final List<Field>fieldsprivate final List<TestScenario>testsprivate Stringdescription
-
Constructor Summary
Constructors Constructor Description SchemaDevice(String description, Integer maxRegistersPerModbusRequest)SchemaDevice(String description)SchemaDevice()
-
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 IntegergetSchemaFeatureLevel()The Modbus Schema level of the schema device. final List<Block>getBlocks()final IntegergetMaxBlockIdLength()final InstantgetLastFieldModificationTimestamp()If a field was added or removed this should trigger updates and reinitializations in other parts final UnitsetLastFieldModificationTimestamp(Instant lastFieldModificationTimestamp)If a field was added or removed this should trigger updates and reinitializations in other parts final ModbusDevicegetModbusDevice()final UnitsetModbusDevice(ModbusDevice modbusDevice)final ModbusBlockFetchergetModbusBlockFetcher()final UnitsetModbusBlockFetcher(ModbusBlockFetcher modbusBlockFetcher)final List<Field>getFields()final List<TestScenario>getTests()final StringgetDescription()A human-readable description of this schema device. final UnitsetDescription(String description)A human-readable description of this schema device. final UnitclearModbusBlocks()final ModbusBlock<?, ?, ?>getModbusBlock(AddressClass addressClass)final UnitaddBlock(Block newBlock)final BlockgetBlock(String blockId)final UnitaFieldWasChanged()final Booleaninitialize()Verify the basics final BooleaninitializeAndVerify()Verify the basics final StringinitializationProblems()final SchemaDeviceconnectBase(ModbusDevice modbusDevice)final SchemaDeviceconnect(ModbusDevice modbusDevice, Integer allowedGapReadSize)final SchemaDeviceconnect(ModbusDevice modbusDevice)final List<ModbusQuery>update(Long maxAge)Update all registers related to the needed fields to be updated with a maximum age of the provided milliseconds final List<ModbusQuery>update()Update all registers related to the needed fields to be updated with a maximum age of the provided milliseconds final List<ModbusQuery>update(Field field)Update all registers related to the specified field final List<ModbusQuery>updateAll(Long maxAge)Make sure all registers mentioned in all known fields are retrieved. final List<ModbusQuery>updateAll()Make sure all registers mentioned in all known fields are retrieved. 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 <Error class: unknown class>neededFields()Get the list of needed fields final UnitaddTestScenario(TestScenario testScenario)final UnitcreateTestsUsingCurrentRealData()final TestScenarioResultsListverifyProvidedTests()Check if the basic parameters of the defined testcases are valid without actually running the tests. StringtoString()final static SchemaDevice.SchemaDeviceBuilderbuilder()-
-
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)
-
getSchemaFeatureLevel
final Integer getSchemaFeatureLevel()
The Modbus Schema level of the schema device. A Modbus Schema level is the set of available converter methods, return types, etc.
A schema device uses a set of converter methods (i.e. the version)
A code generator supports a set of converter methods. A schema device with level 5 will work with a code generator that supports level 10 A schema device with level 10 will NOT work with a code generator that supports level 5
-
getMaxBlockIdLength
final Integer getMaxBlockIdLength()
-
getLastFieldModificationTimestamp
final Instant getLastFieldModificationTimestamp()
If a field was added or removed this should trigger updates and reinitializations in other parts
-
setLastFieldModificationTimestamp
final Unit setLastFieldModificationTimestamp(Instant lastFieldModificationTimestamp)
If a field was added or removed this should trigger updates and reinitializations in other parts
-
getModbusDevice
final ModbusDevice getModbusDevice()
-
setModbusDevice
final Unit setModbusDevice(ModbusDevice modbusDevice)
-
getModbusBlockFetcher
final ModbusBlockFetcher getModbusBlockFetcher()
-
setModbusBlockFetcher
final Unit setModbusBlockFetcher(ModbusBlockFetcher modbusBlockFetcher)
-
getTests
final List<TestScenario> getTests()
-
getDescription
final String getDescription()
A human-readable description of this schema device.
-
setDescription
final Unit setDescription(String description)
A human-readable description of this schema device.
-
clearModbusBlocks
final Unit clearModbusBlocks()
-
getModbusBlock
final ModbusBlock<?, ?, ?> getModbusBlock(AddressClass addressClass)
-
aFieldWasChanged
final Unit aFieldWasChanged()
-
initialize
final Boolean initialize()
Verify the basics
-
initializeAndVerify
final Boolean initializeAndVerify()
Verify the basics
-
initializationProblems
final String initializationProblems()
-
connectBase
final SchemaDevice connectBase(ModbusDevice modbusDevice)
-
connect
@JvmOverloads() final SchemaDevice connect(ModbusDevice modbusDevice, Integer allowedGapReadSize)
-
connect
@JvmOverloads() final SchemaDevice connect(ModbusDevice modbusDevice)
-
update
@JvmOverloads() final List<ModbusQuery> 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<ModbusQuery> 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)
-
update
final List<ModbusQuery> update(Field field)
Update all registers related to the specified field
- Parameters:
field- the Field that must be updated- Returns:
A (possibly empty) list of all fetches that have been done (with duration and status)
-
updateAll
@JvmOverloads() final List<ModbusQuery> updateAll(Long maxAge)
Make sure all registers mentioned in all known fields are retrieved.
- Returns:
A (possibly empty) list of all fetches that have been done (with duration and status)
-
updateAll
@JvmOverloads() final List<ModbusQuery> updateAll()
Make sure all registers mentioned in all known fields are retrieved.
- Returns:
A (possibly empty) list of all fetches that have been done (with duration and status)
-
unNeed
final Unit unNeed(Field field)
- Parameters:
field- The field that no longer needs to be kept up-to-date
-
neededFields
final <Error class: unknown class> neededFields()
Get the list of needed fields
-
addTestScenario
final Unit addTestScenario(TestScenario testScenario)
-
createTestsUsingCurrentRealData
final Unit createTestsUsingCurrentRealData()
-
verifyProvidedTests
final TestScenarioResultsList verifyProvidedTests()
Check if the basic parameters of the defined testcases are valid without actually running the tests.
-
builder
final static SchemaDevice.SchemaDeviceBuilder builder()
-
-
-
-