|
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.ModbusRequest net.wimpi.modbus.msg.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 ReadCoilsRequest 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. bits) to be written. |
Method Summary | |
ModbusResponse |
createResponse()
Returns the ModbusResponse that represents the answer to this ModbusRequest. |
int |
getBitCount()
Returns the number of bits (i.e. input discretes) read with the request. |
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(java.io.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(java.io.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, 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 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 java.lang.IndexOutOfBoundsException
index
- the index of the coil to be tested.
java.lang.IndexOutOfBoundsException
- if the given index is out of bounds.public void setCoilStatus(int index, boolean b) throws java.lang.IndexOutOfBoundsException
index
- the index of the coil to be set/reset.b
- true if to be set, false for reset.
java.lang.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(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 |