|
||||||||||
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.ModbusRequest net.wimpi.modbus.msg.WriteMultipleCoilsRequest
public final class WriteMultipleCoilsRequest
Class implementing a WriteMultipleCoilsRequest. The implementation directly correlates with the class 1 function write multiple coils (FC 15). It encapsulates the corresponding request message.
Coils are understood as bits that can be manipulated (i.e. set or unset).
Constructor Summary | |
---|---|
WriteMultipleCoilsRequest()
Constructs a new WriteMultipleCoilsRequest instance. |
|
WriteMultipleCoilsRequest(int ref,
BitVector bv)
Constructs a new WriteMultipleCoilsRequest instance with given reference and coil status. |
|
WriteMultipleCoilsRequest(int ref,
int count)
Constructs a new WriteMultipleCoilsRequest instance with a given reference and count of coils (i.e. |
Method Summary | |
---|---|
ModbusResponse |
createResponse()
Returns the ModbusResponse that represents the answer to this ModbusRequest. |
int |
getBitCount()
Returns the number of bits (i.e. |
int |
getByteCount()
Returns the number of bytes required for packing the coil bits. |
BitVector |
getCoils()
Returns the BitVector instance holding coil status information. |
boolean |
getCoilStatus(int index)
Returns the status of the given coil. |
int |
getReference()
Returns the reference of the register to to start reading from with this ReadCoilsRequest. |
void |
readData(DataInput din)
Reads the subclass specific data from the given DataInput instance. |
void |
setCoils(BitVector bv)
Sets the BitVector instance holding coil status information. |
void |
setCoilStatus(int index,
boolean b)
Sets the coil status of the given coil. |
void |
setReference(int ref)
Sets the reference of the register to start reading from with this ReadCoilsRequest. |
void |
writeData(DataOutput dout)
Writes the subclass specific data to the given DataOutput. |
Methods inherited from class net.wimpi.modbus.msg.ModbusRequest |
---|
createExceptionResponse, createModbusRequest |
Methods inherited from class net.wimpi.modbus.msg.ModbusMessageImpl |
---|
getDataLength, getFunctionCode, getHexMessage, getOutputLength, getProtocolID, getTransactionID, getUnitID, isHeadless, readFrom, setDataLength, setHeadless, setProtocolID, setTransactionID, setUnitID, writeTo |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public WriteMultipleCoilsRequest()
public WriteMultipleCoilsRequest(int ref, int count)
ref
- the index of the first coil to be written.count
- the number of coils to be written.public WriteMultipleCoilsRequest(int ref, BitVector bv)
ref
- the index of the first coil to be written.bv
- the coils to be written.Method Detail |
---|
public ModbusResponse createResponse()
ModbusRequest
The implementation should take care about assembling the reply to this ModbusRequest.
createResponse
in class ModbusRequest
public void setReference(int ref)
ref
- the reference of the register
to start reading from.public int getReference()
public int getBitCount()
public int getByteCount()
public boolean getCoilStatus(int index) throws IndexOutOfBoundsException
index
- the index of the coil to be tested.
IndexOutOfBoundsException
- if the given index is out of bounds.public void setCoilStatus(int index, boolean b) throws IndexOutOfBoundsException
index
- the index of the coil to be set/reset.b
- true if to be set, false for reset.
IndexOutOfBoundsException
- if the given index is out of bounds.public BitVector getCoils()
public void setCoils(BitVector bv)
bv
- a BitVector instance holding coil status info.public void writeData(DataOutput dout) throws IOException
ModbusMessageImpl
writeData
in class ModbusMessageImpl
dout
- the DataOutput to be written to.
IOException
- if an I/O related error occurs.public void readData(DataInput din) throws IOException
ModbusMessageImpl
readData
in class ModbusMessageImpl
din
- the DataInput to read from.
IOException
- if an I/O related error occurs.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |