|
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.langner.jmatic2.RK512
This class is used for communication with SIMATIC S5® or S7® PLCs utilizing the RK512 protocol via the Langner 3964NET gateway.
3964NET is a gateway for connecting serial devices using the 3964R protocol to a TCP/IP network.
Scheme:
|PLC|<-- serial RK512 over 3964R -->|3964NET|<-- RK512 over TCP/IP -->|JMatic application|
| Constructor Summary | |
RK512(RK512NETSettings settings)
Constructs an initialized object. |
|
| Method Summary | |
void |
addListener(RK512Listener listener)
Registers an event listener (required only when using the asynchronous RK512 methods such as readDB). |
void |
connect()
Establishes a connection to the 3964NET gateway. |
void |
disconnect()
Disconnects from the 3964NET gateway. |
java.lang.String |
getLastError()
Returns the last error. |
boolean |
isConnected()
Returns the connection status. |
void |
readCounter(int address)
Requests data of one PLC counter cell (asynchronous). |
int |
readCounterWait(int address,
byte[] data)
Requests data of one PLC counter cell (synchronous). |
void |
readDB(int dbnumber,
int offset,
int length)
Requests data from a specific PLC data block (asynchronous). |
int |
readDBWait(int dbnumber,
int offset,
int length,
byte[] data)
Requests data from a specific PLC data block (synchronous). |
void |
readInput(int address,
int length)
Requests input data from a specific PLC address (asynchronous). |
int |
readInputWait(int address,
int length,
byte[] data)
Requests input data from a specific PLC address (synchronous). |
void |
readMemoryBytes(int address,
int length)
Requests PLC flag data (asynchronous). |
int |
readMemoryBytesWait(int address,
int length,
byte[] data)
Requests PLC flag data (synchronous). |
void |
readOutput(int address,
int length)
Requests output data from a specific PLC address (asynchronous). |
int |
readOutputWait(int address,
int length,
byte[] data)
Requests output data from a specific PLC address (synchronous). |
void |
readTimer(int address)
Requests the data of one PLC timer cell (asynchronous). |
int |
readTimerWait(int address,
byte[] data)
Requests the data of one PLC timer cell (synchronous). |
void |
removeListener(RK512Listener listener)
Removes an event listener. |
void |
writeDB(int dbnumber,
int offset,
int length,
byte[] data)
Transmits data to a specific PLC data block (asynchronous). |
int |
writeDBWait(int dbnumber,
int offset,
int length,
byte[] data)
Transmits data to a specific PLC data block (synchronous). |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public RK512(RK512NETSettings settings)
throws JMaticException
settings - Object with the connection settings| Method Detail |
public boolean isConnected()
connect,
disconnect
public void connect()
throws JMaticException
RK512NETSettings object.
JMaticException - if the connect attempt failsisConnected,
disconnect
public void disconnect()
throws JMaticException
JMaticException - if the disconnect failsisConnected,
connect
public int writeDBWait(int dbnumber,
int offset,
int length,
byte[] data)
throws JMaticException
dbnumber - Target data block (DB). Possible values: 0..255.offset - Target word offset address in DB.data - Array of transmit datalength - The number of bytes of the array data that are to be sent (Possible values: 2..65534)..
NOTE: The length parameter must be an even number, because data blocks (DB) are working with word length.
JMaticException - if the RK512 object is not connected or the parameters are out of range
public void writeDB(int dbnumber,
int offset,
int length,
byte[] data)
throws JMaticException
RK512Listener will inform your application about the success
of this action. Other RK512 methods cannot be called until the action was confirmed with
the dataSent or an error was signaled.
dbnumber - Target data block (DB). Possible values are 1..255.offset - Traget word offset address in the DB.data - Array of transmit datalength - The number of bytes of the array data that are to be sent (Possible values: 2..4096).
NOTE: The length parameter must be an even number, because data blocks (DB) are working with word length.
JMaticException - if the RK512 object is not connected or the parameters are out of range
public int readDBWait(int dbnumber,
int offset,
int length,
byte[] data)
throws JMaticException
dbnumber - Target data block (DB). Possible values: 0..255.offset - Target word offset address in DB.data - Array for the requested data.length - The number of requested bytes (Possible values: 2..4096).
NOTE: The length parameter must be an even number, because data blocks (DB) are working with word length.
JMaticException - if the RK512 object is not connected or the parameters are out of range
public void readDB(int dbnumber,
int offset,
int length)
throws JMaticException
dataReceived. Other RK512 methods cannot be
called until the requested data was received or an error was signaled.
dbnumber - Target data block (DB).offset - Target word offset in DB.length - The number of requested bytes (Possible values: 2..4096).
JMaticException - if the RK512 object is not connected or the parameters are out of range
public int readOutputWait(int address,
int length,
byte[] data)
throws JMaticException
address - Target Output byte address.data - Array for the requested data.length - The number of requested bytes.
JMaticException - if the RK512 object is not connected or the parameters are out of range
public void readOutput(int address,
int length)
throws JMaticException
dataReceived. Other RK512 methods cannot be
called until the requested data was received or an error was signaled.
address - Target Output byte address.length - The number of requested bytes.
JMaticException - if the RK512 object is not connected or the parameters are out of range
public int readInputWait(int address,
int length,
byte[] data)
throws JMaticException
address - Target Input byte address.data - Array for the requested data.length - The number of requested bytes.
JMaticException - if the RK512 object is not connected or the parameters are out of range
public void readInput(int address,
int length)
throws JMaticException
dataReceived.
Other RK512 methods cannot be called until the requested data was received or an error was signaled.
address - Target Input byte address.length - The number of requested bytes.
JMaticException - if the RK512 object is not connected or the parameters are out of range
public int readMemoryBytesWait(int address,
int length,
byte[] data)
throws JMaticException
address - Target Memory byte address.data - Array for the requested data.length - The number of requested bytes.
JMaticException - if the RK512 object is not connected or the parameters are out of range
public void readMemoryBytes(int address,
int length)
throws JMaticException
dataReceived.
Other RK512 methods cannot be called until the requested data was received or an error was signaled.
address - Target Memory byte address.length - The number of requested bytes.
JMaticException - if the RK512 object is not connected or the parameters are out of range
public int readCounterWait(int address,
byte[] data)
throws JMaticException
address - Counter number.data - Array for the requested data.
JMaticException - if the RK512 object is not connected or the parameters are out of range
public void readCounter(int address)
throws JMaticException
dataReceived.
Other RK512 methods cannot be called until the requested data was received or an error was signaled.
address - Counter number.
JMaticException - if the RK512 object is not connected or the parameters are out of range
public int readTimerWait(int address,
byte[] data)
throws JMaticException
address - Timer number.data - Array for the requested data.
JMaticException - if the RK512 object is not connected or the parameters are out of range
public void readTimer(int address)
throws JMaticException
dataReceived.
Other RK512 methods cannot be called until the requested data was received or an error was signaled.
address - Timer number.
JMaticException - if the RK512 object is not connected or the parameters are out of rangepublic void addListener(RK512Listener listener)
listener - The object that shall be informed about incoming data and errors.
If it is already in the list, it will not be added a second time.public void removeListener(RK512Listener listener)
listener - The object that shall be removed.
If it is not in the list, this function does nothing.public java.lang.String getLastError()
|
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||