Class ModbusRegisterArray
java.lang.Object
org.openhab.core.io.transport.modbus.ModbusRegisterArray
Immutable
ModbusRegisterArray
implementation- Author:
- Sami Salonen - Initial contribution
-
Constructor Summary
ConstructorDescriptionModbusRegisterArray
(byte... bytes) ModbusRegisterArray
(int... registerValues) Construct plainModbusRegisterArray
array from register values -
Method Summary
Modifier and TypeMethodDescriptionboolean
byte[]
getBytes()
Return bytes representing the registers Index 0: hi-byte of 1st register Index 1: low-byte of 1st register Index 3: hi-byte of 2nd register Index 4: low-byte of 2nd register ...int
getRegister
(int i) Get register index i as unsigned integerint
hashCode()
int
size()
Get number of registers stored in this instanceGet register data as a hex string For example, 04 45 00 00toString()
-
Constructor Details
-
ModbusRegisterArray
public ModbusRegisterArray(byte... bytes) -
ModbusRegisterArray
public ModbusRegisterArray(int... registerValues) Construct plainModbusRegisterArray
array from register values- Parameters:
registerValues
- register values, eachint
corresponding to one register
-
-
Method Details
-
getRegister
public int getRegister(int i) Get register index i as unsigned integer- Parameters:
i
- register index- Returns:
- register value interpreted as unsigned integer (big-endian byte ordering)
-
getBytes
public byte[] getBytes()Return bytes representing the registers Index 0: hi-byte of 1st register Index 1: low-byte of 1st register Index 3: hi-byte of 2nd register Index 4: low-byte of 2nd register ...- Returns:
- set of bytes
-
size
public int size()Get number of registers stored in this instance- Returns:
-
toString
-
toHexString
Get register data as a hex string For example, 04 45 00 00- Returns:
- string representing the bytes of the register array
-
hashCode
public int hashCode() -
equals
-