public final class ReadInputDiscretesResponse extends ModbusResponse
Input Discretes are understood as bits that cannot be manipulated (i.e. set or unset).
| Constructor and Description |
|---|
ReadInputDiscretesResponse()
Constructs a new ReadInputDiscretesResponse
instance.
|
ReadInputDiscretesResponse(int count)
Constructs a new ReadInputDiscretesResponse
instance with a given count of input discretes
(i.e. bits).
|
| Modifier and Type | Method and Description |
|---|---|
int |
getBitCount()
Returns the number of bits (i.e. input discretes)
read with the request.
|
BitVector |
getDiscretes()
Returns the BitVector that stores
the collection of bits that have been read.
|
boolean |
getDiscreteStatus(int index)
Convenience method that returns the state
of the bit at the given index.
|
void |
readData(DataInput din)
Reads the subclass specific data from the given DataInput instance.
|
void |
setBitCount(int count)
Sets the number of bits in this response.
|
void |
setDiscreteStatus(int index,
boolean b)
Sets the status of the given input discrete.
|
void |
writeData(DataOutput dout)
Writes the subclass specific data to the given DataOutput.
|
createModbusResponse, setMessagegetDataLength, getFunctionCode, getHexMessage, getOutputLength, getProtocolID, getTransactionID, getUnitID, isHeadless, readFrom, setDataLength, setFunctionCode, setHeadless, setHeadless, setProtocolID, setTransactionID, setUnitID, writeTopublic ReadInputDiscretesResponse()
public ReadInputDiscretesResponse(int count)
count - the number of bits to be read.public int getBitCount()
public void setBitCount(int count)
count - the number of response bits as int.public BitVector getDiscretes()
public boolean getDiscreteStatus(int index)
throws IndexOutOfBoundsException
index - the index of the input discrete for which the status should be returned.IndexOutOfBoundsException - if the index is out of boundspublic void setDiscreteStatus(int index,
boolean b)
throws IndexOutOfBoundsException
index - the index of the input discrete to be set.b - true if to be set, false if to be reset.IndexOutOfBoundsException - if the given index exceeds bounds.public void writeData(DataOutput dout) throws IOException
ModbusMessageImplwriteData in class ModbusMessageImpldout - the DataOutput to be written to.IOException - if an I/O related error occurs.public void readData(DataInput din) throws IOException
ModbusMessageImplreadData in class ModbusMessageImpldin - the DataInput to read from.IOException - if an I/O related error occurs.Copyright © 2017. All rights reserved.