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 RegisterBlockFetcherregisterBlockFetcherprivate 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 RegisterBlockFetchergetRegisterBlockFetcher()final UnitsetRegisterBlockFetcher(RegisterBlockFetcher registerBlockFetcher)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 RegisterBlockgetRegisterBlock(AddressClass addressClass)final UnitaddBlock(Block newBlock)final BlockgetBlock(String blockId)final UnitsortFieldsByAddress()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 Unitupdate(Long maxAge)Update all registers related to the needed fields to be updated with a maximum age of the provided milliseconds final Unitupdate()Update all registers related to the needed fields to be updated with a maximum age of the provided milliseconds final Unitupdate(Field field)Update all registers related to the specified field 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 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 List<Field>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. final StringtoTable(Boolean onlyUseFullFields)StringtoString()final UnitresolveAllImmutableFields()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)
-
getRegisterBlockFetcher
final RegisterBlockFetcher getRegisterBlockFetcher()
-
setRegisterBlockFetcher
final Unit setRegisterBlockFetcher(RegisterBlockFetcher registerBlockFetcher)
-
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.
-
getRegisterBlock
final RegisterBlock getRegisterBlock(AddressClass addressClass)
-
sortFieldsByAddress
final Unit sortFieldsByAddress()
-
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 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
-
update
@JvmOverloads() final Unit update()
Update all registers related to the needed fields to be updated with a maximum age of the provided milliseconds
-
update
final Unit update(Field field)
Update all registers related to the specified field
- Parameters:
field- the Field that must be updated
-
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.
-
unNeed
final Unit unNeed(Field field)
- Parameters:
field- The field that no longer needs to be kept up-to-date
-
neededFields
final List<Field> 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.
-
resolveAllImmutableFields
final Unit resolveAllImmutableFields()
-
builder
final static SchemaDevice.SchemaDeviceBuilder builder()
-
-
-
-