Class RegisterValue
-
- All Implemented Interfaces:
-
kotlin.Comparable
public final class RegisterValue implements Comparable<RegisterValue>
Holds the single value of a single modbus register
-
-
Constructor Summary
Constructors Constructor Description RegisterValue(Address address)
-
Method Summary
Modifier and Type Method Description final StringgetFetchGroup()An identifier to that can be used to ensure some registers are retrieved together. final UnitsetFetchGroup(String fetchGroup)An identifier to that can be used to ensure some registers are retrieved together. final BooleangetImmutable()Some registers will NEVER change and thus do not need to be retrieved a second time final UnitsetImmutable(Boolean immutable)Some registers will NEVER change and thus do not need to be retrieved a second time final ShortgetValue()final StringgetComment()If a register has a comment this can be used when converting it to a String (in yaml for example) final UnitsetComment(String comment)If a register has a comment this can be used when converting it to a String (in yaml for example) final LonggetTimestamp()final UnitsetTimestamp(Long timestamp)final StringgetHexValue()final AddressgetAddress()The modbus register address. final RegisterValuesetValue(Short value)final RegisterValuesetValue(Short value, Long timestamp)final BooleanhasValue()final BooleanneedsToBeUpdated(Long now, Long maxAge)final Unitclear()StringtoString()IntegercompareTo(RegisterValue other)Booleanequals(Object other)IntegerhashCode()-
-
Constructor Detail
-
RegisterValue
RegisterValue(Address address)
-
-
Method Detail
-
getFetchGroup
final String getFetchGroup()
An identifier to that can be used to ensure some registers are retrieved together. By default, filled with a random unique value because we assume they are all independent.
-
setFetchGroup
final Unit setFetchGroup(String fetchGroup)
An identifier to that can be used to ensure some registers are retrieved together. By default, filled with a random unique value because we assume they are all independent.
-
getImmutable
final Boolean getImmutable()
Some registers will NEVER change and thus do not need to be retrieved a second time
-
setImmutable
final Unit setImmutable(Boolean immutable)
Some registers will NEVER change and thus do not need to be retrieved a second time
-
getComment
final String getComment()
If a register has a comment this can be used when converting it to a String (in yaml for example)
-
setComment
final Unit setComment(String comment)
If a register has a comment this can be used when converting it to a String (in yaml for example)
-
getTimestamp
final Long getTimestamp()
-
setTimestamp
final Unit setTimestamp(Long timestamp)
-
getHexValue
final String getHexValue()
- Returns:
The current register value as a 4 digit HEX string in uppercase. Or "----" in case of null.
-
getAddress
final Address getAddress()
The modbus register address.
-
setValue
final RegisterValue setValue(Short value)
-
setValue
final RegisterValue setValue(Short value, Long timestamp)
-
needsToBeUpdated
final Boolean needsToBeUpdated(Long now, Long maxAge)
-
compareTo
Integer compareTo(RegisterValue other)
-
-
-
-