|
jamod at SF | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.wimpi.modbus.msg.ModbusMessageImpl net.wimpi.modbus.msg.ModbusResponse net.wimpi.modbus.msg.ReadCoilsResponse
Class implementing a ReadCoilsResponse. The implementation directly correlates with the class 1 function read coils (FC 1). It encapsulates the corresponding response message.
Coils are understood as bits that can be manipulated (i.e. set or unset).
Constructor Summary | |
ReadCoilsResponse()
Constructs a new ReadCoilsResponse instance. |
|
ReadCoilsResponse(int count)
Constructs a new ReadCoilsResponse instance with a given count of coils (i.e. bits). |
Method Summary | |
int |
getBitCount()
Returns the number of bits (i.e. coils) read with the request. |
BitVector |
getCoils()
Returns the BitVector that stores the collection of bits that have been read. |
boolean |
getCoilStatus(int index)
Convenience method that returns the state of the bit at the given index. |
void |
readData(java.io.DataInput din)
Reads the subclass specific data from the given DataInput instance. |
void |
setCoilStatus(int index,
boolean b)
Sets the status of the given coil. |
void |
writeData(java.io.DataOutput dout)
Writes the subclass specific data to the given DataOutput. |
Methods inherited from class net.wimpi.modbus.msg.ModbusResponse |
createModbusResponse, setMessage |
Methods inherited from class net.wimpi.modbus.msg.ModbusMessageImpl |
getDataLength, getFunctionCode, getHexMessage, getOutputLength, getProtocolID, getTransactionID, getUnitID, isHeadless, readFrom, setDataLength, setFunctionCode, setHeadless, setHeadless, setProtocolID, setTransactionID, setUnitID, writeTo |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ReadCoilsResponse()
public ReadCoilsResponse(int count)
count
- the number of bits to be read.Method Detail |
public int getBitCount()
public BitVector getCoils()
public boolean getCoilStatus(int index) throws java.lang.IndexOutOfBoundsException
index
- the index of the coil for which
the status should be returned.
java.lang.IndexOutOfBoundsException
- if the
index is out of boundspublic void setCoilStatus(int index, boolean b)
index
- the index of the coil to be set.b
- true if to be set, false for reset.public void writeData(java.io.DataOutput dout) throws java.io.IOException
ModbusMessageImpl
writeData
in class ModbusMessageImpl
dout
- the DataOutput to be written to.
java.io.IOException
- if an I/O related error occurs.public void readData(java.io.DataInput din) throws java.io.IOException
ModbusMessageImpl
readData
in class ModbusMessageImpl
din
- the DataInput to read from.
java.io.IOException
- if an I/O related error occurs.
|
jamod at SF | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |