public final class WriteMultipleCoilsRequest extends ModbusRequest
| Constructor and Description |
|---|
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. bits) to be written.
|
| Modifier and Type | Method and Description |
|---|---|
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(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.
|
createExceptionResponse, createModbusRequestgetDataLength, getFunctionCode, getHexMessage, getOutputLength, getProtocolID, getTransactionID, getUnitID, isHeadless, readFrom, setDataLength, setFunctionCode, setHeadless, setHeadless, setProtocolID, setTransactionID, setUnitID, writeTopublic 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.public ModbusResponse createResponse()
ModbusRequestThe implementation should take care about assembling the reply to this ModbusRequest.
createResponse in class ModbusRequestpublic 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
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.