public abstract class TcpMaster extends AbstractSimulatingDriver implements Initializable
| Modifier and Type | Field and Description |
|---|---|
private static int |
DEFMODBUSPORT
Default moxa port.
|
private static boolean |
DEFPERSISTENT
Default persistent.
|
static String |
KEY_MODBUSIP
Points to the IP-address of the moxa module (tested with IP.IP.IP.IP)
|
static String |
KEY_MODBUSPORT
Point to the port of the moxa connection.
|
static String |
KEY_MODBUSTIMEOUT
Allowed timeout for the connection, probably milliseconds.
|
static String |
KEY_PERSISTENT
If true, connection is held open after first open.
|
private com.ghgande.j2mod.modbus.net.TCPMasterConnection |
moxa
The connection to the modbus slave.
|
private com.ghgande.j2mod.modbus.io.ModbusTCPTransaction |
talk
The transaction for the modbus commands.
|
KEY_KEEPCOMMANDTIMESKEY_DRIVERNAMEKEY_LISTSEPARATOR, KEY_MAPKEYVALUECHAR, KEY_MAPSEPARATORCONFIG, KEY_CLASS| Modifier | Constructor and Description |
|---|---|
protected |
TcpMaster(Map<String,String> prop)
Creates a new generic modbus driver as a modbus master (CLient)
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
close()
We close the connection if the tcp master is not null.
|
(package private) com.ghgande.j2mod.modbus.io.ModbusTCPTransaction |
getTransaction()
ACess to the transport layer of the modbus.
|
void |
init()
If no explicit name is set, we use the IP-address as a driver name.
|
boolean |
isOpen()
We are considered open if the tcp master is not null and connected.
|
boolean |
open()
We open the connection by issuing a library command.
|
String |
toString() |
accelerate, addCommandTime, exit, getAcceleration, getCommandTimeAverage, getCommandTimeRandomSample, getCommandTimeSigma, getSimulationStart, isSimulate, preserve, restore, simulateSince, startSimulate, stopSimulatecreateDriver, equals, getDriverName, hashCodeaugment, augment, augment, augment, augment, clone, defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsEnums, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, initProperties, isNew, parseObject, parseObject, reload, reload, removeProperty, requires, rescanned, setObject, setProperties, setProperty, stringPropertiespublic static final String KEY_MODBUSIP
public static final String KEY_MODBUSPORT
public static final String KEY_MODBUSTIMEOUT
public static final String KEY_PERSISTENT
private static final int DEFMODBUSPORT
private static final boolean DEFPERSISTENT
private transient com.ghgande.j2mod.modbus.net.TCPMasterConnection moxa
talk.private transient com.ghgande.j2mod.modbus.io.ModbusTCPTransaction talk
public void init()
throws InitException
init in interface InitializableInitExceptioncom.ghgande.j2mod.modbus.io.ModbusTCPTransaction getTransaction()
Note: Synchronize on it, if multiple thread are using the same modbus slave.
public boolean open()
throws IOException
open in interface DriverIOExceptionpublic boolean close()
throws IOException
close in interface DriverIOExceptionpublic boolean isOpen()
public String toString()
toString in class PropertyContainer