public class TestModbus extends Object
| Modifier and Type | Class and Description |
|---|---|
protected static class |
TestModbus.OnOff |
| Modifier and Type | Field and Description |
|---|---|
protected Modbus |
mod |
protected PrintStream |
out |
| Constructor and Description |
|---|
TestModbus()
Constructor.
|
TestModbus(Modbus mbus)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes connection to a device.
|
void |
coilRead(int addr,
int nmbr,
int count)
Reads a set of coil values.
|
void |
coilWrite(int addr,
int nmbr,
int... values)
Writes a set of coils.
|
void |
discRead(int addr,
int nmbr,
int count)
Reads a set of discrete values.
|
void |
inpRead(int addr,
int nmbr,
int count)
Reads a set of input values.
|
void |
open(Modbus.ConnType type,
String ident)
Opens connection to a device.
|
void |
open(Modbus.ConnType type,
String ident,
int param)
Opens connection to a device.
|
void |
open(Modbus.ConnType type,
String ident,
int baud,
org.lsst.ccs.drivers.ascii.Ascii.DataBits dbits,
org.lsst.ccs.drivers.ascii.Ascii.StopBits sbits,
org.lsst.ccs.drivers.ascii.Ascii.Parity parity,
org.lsst.ccs.drivers.ascii.Ascii.FlowCtrl flow)
Opens connection to a serially-connected device.
|
void |
regRead(int addr,
int nmbr,
int count)
Reads a set of register values.
|
void |
regWrite(int addr,
int nmbr,
int... values)
Writes a set of registers.
|
void |
setAddress(TestModbus.OnOff mode)
Sets the address mode.
|
void |
setTimeout(double timeout)
Sets the timeout.
|
void |
showAddress()
Shows the address mode.
|
protected final PrintStream out
protected final Modbus mod
public TestModbus()
public TestModbus(Modbus mbus)
mbus - The Modbus object@Command(name="open",
description="Open connection to general device")
public void open(@Argument(name="type",description="Connection type")
Modbus.ConnType type,
@Argument(name="ident",description="Device identifier")
String ident)
throws org.lsst.ccs.drivers.commons.DriverException
type - The connection typeident - The device identificationorg.lsst.ccs.drivers.commons.DriverException@Command(name="open",
description="Open connection to general device")
public void open(@Argument(name="type",description="Connection type")
Modbus.ConnType type,
@Argument(name="ident",description="Device identifier")
String ident,
@Argument(name="param",description="Device parameter")
int param)
throws org.lsst.ccs.drivers.commons.DriverException
type - The connection typeident - The device identificationparam - The device parameterorg.lsst.ccs.drivers.commons.DriverException@Command(name="open",
description="Open connection to serial device")
public void open(@Argument(name="type",description="Connection type: net, serial or ftdi")
Modbus.ConnType type,
@Argument(name="ident",description="Device identifier")
String ident,
@Argument(name="baud",description="Baud rate")
int baud,
@Argument(name="dbits",description="The number of data bits")
org.lsst.ccs.drivers.ascii.Ascii.DataBits dbits,
@Argument(name="sbits",description="The number of stop bits")
org.lsst.ccs.drivers.ascii.Ascii.StopBits sbits,
@Argument(name="parity",description="The parity")
org.lsst.ccs.drivers.ascii.Ascii.Parity parity,
@Argument(name="flow",description="The flow control")
org.lsst.ccs.drivers.ascii.Ascii.FlowCtrl flow)
throws org.lsst.ccs.drivers.commons.DriverException
type - The connection typeident - The device identificationbaud - The baud ratedbits - The number of data bits (eight or seven)sbits - The number of stop bits (one or two)parity - The parity (none, odd, even, mark or space)flow - The flow control (none, xon, rts or dtr)org.lsst.ccs.drivers.commons.DriverException@Command(name="close",
description="Close connection to device")
public void close()
throws org.lsst.ccs.drivers.commons.DriverException
org.lsst.ccs.drivers.commons.DriverException@Command(name="setaddress",
description="Set the address mode")
public void setAddress(@Argument(name="mode",description="The address mode: off or on")
TestModbus.OnOff mode)
throws org.lsst.ccs.drivers.commons.DriverException
org.lsst.ccs.drivers.commons.DriverException@Command(name="showaddress",
description="Show the address mode")
public void showAddress()
throws org.lsst.ccs.drivers.commons.DriverException
org.lsst.ccs.drivers.commons.DriverException@Command(name="settimeout",
description="Set the timeout")
public void setTimeout(@Argument(name="timeout",description="The timeout (sec)")
double timeout)
throws org.lsst.ccs.drivers.commons.DriverException
org.lsst.ccs.drivers.commons.DriverException@Command(name="coilread",
description="Read a set of coils")
public void coilRead(@Argument(name="address",description="The Modbus address")
int addr,
@Argument(name="number",description="First coil to read")
int nmbr,
@Argument(name="count",description="Number of coils to read")
int count)
throws org.lsst.ccs.drivers.commons.DriverException
org.lsst.ccs.drivers.commons.DriverException@Command(name="discread",
description="Read a set of discretes")
public void discRead(@Argument(name="address",description="The Modbus address")
int addr,
@Argument(name="number",description="First discrete to read")
int nmbr,
@Argument(name="count",description="Number of discretes to read")
int count)
throws org.lsst.ccs.drivers.commons.DriverException
org.lsst.ccs.drivers.commons.DriverException@Command(name="regread",
description="Read a set of registers")
public void regRead(@Argument(name="address",description="The Modbus address")
int addr,
@Argument(name="number",description="First register to read")
int nmbr,
@Argument(name="count",description="Number of registers to read")
int count)
throws org.lsst.ccs.drivers.commons.DriverException
org.lsst.ccs.drivers.commons.DriverException@Command(name="inpread",
description="Read a set of inputs")
public void inpRead(@Argument(name="address",description="The Modbus address")
int addr,
@Argument(name="number",description="First input to read")
int nmbr,
@Argument(name="count",description="Number of inputs to read")
int count)
throws org.lsst.ccs.drivers.commons.DriverException
org.lsst.ccs.drivers.commons.DriverException@Command(name="coilwrite",
description="Write a set of coils")
public void coilWrite(@Argument(name="address",description="The Modbus address")
int addr,
@Argument(name="number",description="First coil to write")
int nmbr,
@Argument(name="values",description="Values to write")
int... values)
throws org.lsst.ccs.drivers.commons.DriverException
org.lsst.ccs.drivers.commons.DriverException@Command(name="regwrite",
description="Write a set of registers")
public void regWrite(@Argument(name="address",description="The Modbus address")
int addr,
@Argument(name="number",description="First register to write")
int nmbr,
@Argument(name="values",description="Values to write")
int... values)
throws org.lsst.ccs.drivers.commons.DriverException
org.lsst.ccs.drivers.commons.DriverExceptionCopyright © 2018 LSST. All rights reserved.