|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--net.sourceforge.jmodbus.ModbusCoilBank
Class to represent the coils (1 bit data items) in a Modbus device. The class uses boolean varibales internally to represent coils as the minimum block allocation of memory for a JVM is 4 bytes so type does not matter. Thus booleans were chosed to make logic comparisons easy.
| Constructor Summary | |
ModbusCoilBank(int coils_size)
Class constructor that, given the size of the coil bank required, will allocate suficient memory for the coil bank and initilize all the values to zero |
|
| Method Summary | |
boolean |
getCoil(int index)
Gets the value of a particular coil. |
boolean[] |
getCoils(int index,
int length)
Gets the value of a particular block of coils. |
int |
getNumberCoils()
Get the size of this bank of coils. |
void |
setCoil(int index,
boolean value)
Sets the value of a particular coil. |
void |
setCoils(int index,
boolean[] coil_set)
Sets the value of a particular block of coils. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public ModbusCoilBank(int coils_size)
coils_size - The number of coils to be created in
this coil bank.| Method Detail |
public int getNumberCoils()
public boolean getCoil(int index)
NOTE: Attempting to get a coil outside the range of this coil bank will result in a ArrayIndexOutOfBoundsException being thrown
index - The address of the desired coil (note that
this is a zero based index)
public void setCoil(int index,
boolean value)
NOTE: Attempting to set a coil outside the range of this coil bank will result in a ArrayIndexOutOfBoundsException being thrown
index - The address of the desired coil (note that
this is a zero based index)value - The value of the coil to be set.
public boolean[] getCoils(int index,
int length)
NOTE: Attempting to get a coil outside the range of this coil bank will result in a ArrayIndexOutOfBoundsException being thrown
index - The address of the desired starting coil (note
that this is a zero based index)length - The number of coils to be retrieved
public void setCoils(int index,
boolean[] coil_set)
NOTE: Attempting to set a coil outside the range of this coil bank will result in a ArrayIndexOutOfBoundsException being thrown
index - The address of the desired starting coil (note
that this is a zero based index)coil_set - Array of booleans containing the values
of the coils to be set.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||