Class RegisterValue
-
- All Implemented Interfaces:
-
kotlin.Comparable
public final class RegisterValue implements Comparable<RegisterValue>
Holds the single value of a single modbus register
-
-
Field Summary
Fields Modifier and Type Field Description private StringfetchGroupprivate Booleanimmutableprivate final Shortvalueprivate Stringcommentprivate LongfetchTimestampprivate final Longtimestampprivate final LongEPOCH_1900private final LongEPOCH_1888private final LongNEVER_VALID_BEFOREprivate final LongREADERROR_TIMESTAMPprivate BooleanhardReadErrorprivate final StringhexValueprivate final Addressaddress
-
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 LonggetFetchTimestamp()final UnitsetFetchTimestamp(Long fetchTimestamp)final LonggetTimestamp()final LonggetEPOCH_1900()1900-01-01T00:00:00. final LonggetEPOCH_1888()1888-08-08T08:08:08. final LonggetNEVER_VALID_BEFORE()final LonggetREADERROR_TIMESTAMP()final BooleangetHardReadError()final UnitsetHardReadError(Boolean hardReadError)final StringgetHexValue()final AddressgetAddress()The modbus register address. final RegisterValueclone()final RegisterValuesetValue(Short value)final RegisterValuesetValue(RegisterValue registerValue)final RegisterValuesetValue(Short value, Long timestamp)final BooleanhasValue()final UnitsetSoftReadError()final UnitsetHardReadError()final BooleanisReadError()final UnitclearSoftReadError()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)
-
getFetchTimestamp
final Long getFetchTimestamp()
-
setFetchTimestamp
final Unit setFetchTimestamp(Long fetchTimestamp)
-
getTimestamp
final Long getTimestamp()
-
getEPOCH_1900
final Long getEPOCH_1900()
1900-01-01T00:00:00.000Z
-
getEPOCH_1888
final Long getEPOCH_1888()
1888-08-08T08:08:08.888Z
-
getNEVER_VALID_BEFORE
final Long getNEVER_VALID_BEFORE()
-
getREADERROR_TIMESTAMP
final Long getREADERROR_TIMESTAMP()
-
getHardReadError
final Boolean getHardReadError()
-
setHardReadError
final Unit setHardReadError(Boolean hardReadError)
-
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.
-
clone
final RegisterValue clone()
-
setValue
final RegisterValue setValue(Short value)
-
setValue
final RegisterValue setValue(RegisterValue registerValue)
-
setValue
final RegisterValue setValue(Short value, Long timestamp)
-
setSoftReadError
final Unit setSoftReadError()
-
setHardReadError
final Unit setHardReadError()
-
isReadError
final Boolean isReadError()
-
clearSoftReadError
final Unit clearSoftReadError()
-
needsToBeUpdated
final Boolean needsToBeUpdated(Long now, Long maxAge)
-
compareTo
Integer compareTo(RegisterValue other)
-
-
-
-