|
|
 |
|
|
 |
Serial Protocols
Function Documentation
| synchronized void openProtocol |
( |
String |
portName, |
|
|
int |
baudRate, |
|
|
int |
dataBits, |
|
|
int |
stopBits, |
|
|
int |
parity |
|
) |
throws IOException, UnsupportedCommOperationException, PortInUseException [inherited] |
|
|
|
Opens a Modbus serial port with specific port parameters.
This function opens the serial port. After a port has been opened data and control functions can be used.
- Note:
- The default time-out for the data transfer is 1000 ms.
The default poll delay is 0 ms.
Automatic retries are switched off (retry count is 0).
- Parameters:
-
| portName | Serial port identifier (e.g. "COM1", "/dev/ser1 or /dev/ttyS0") |
| baudRate | The port baudRate in bps (typically 1200 - 19200) |
| dataBits | DATABITS_7: 7 data bits (ASCII protocol only), DATABITS_8: data bits |
| stopBits | STOPBITS_1: 1 stop bit, STOPBITS_1_5: 1.5 stop bits, STOPBITS_2: 2 stop bits |
| parity | PARITY_NONE: no parity, PARITY_ODD: odd parity, PARITY_EVEN: even parity, PARITY_MARK: mark parity, PARITY_SPACE: space parity |
- Exceptions:
-
| IOException | An I/O error occured |
| UnsupportedCommOperationException | A communication parameter is not supported |
| PortInUseException | Port is already used by somedbody else |
| IllegalArgumentException | A parameter is invalid |
Reimplemented in MbusAsciiMasterProtocol, and MbusRtuMasterProtocol. |
| synchronized void openProtocol |
( |
String |
portName, |
|
|
int |
baudRate |
|
) |
throws Exception, PortInUseException, UnsupportedCommOperationException [inherited] |
|
|
|
Opens a Modbus serial port with default port parameters.
This function opens the serial port with 8 databits, 1 stopbit and no parity. After a port has been opened, data and control functions can be used.
- Note:
- The default time-out for the data transfer is 1000 ms.
The default poll delay is 0 ms.
Automatic retries are switched off (retry count is 0).
- Parameters:
-
| portName | Serial port identifier (e.g. "COM1", "/dev/ser1 or /dev/ttyS0") |
| baudRate | The port baudRate in bps (typically 1200 - 9600) |
- Exceptions:
-
| IOException | An I/O error occured |
| UnsupportedCommOperationException | A communication parameter is out of range |
| PortInUseException | Port is already used by somebody else |
| InvalidParameterException | A parameter is invalid |
|
| synchronized void closeProtocol |
( |
|
) |
throws IOException [virtual, inherited] |
|
|
|
Closes the serial port and releases any system resources associated with the port.
- Exceptions:
-
| IOException | An I/O error occured |
Implements MbusMasterFunctions. |
| boolean isOpen |
( |
|
) |
[virtual, inherited] |
|
|
|
Returns whether the port is open or not.
- Return values:
-
| true | = open |
| false | = closed |
Implements MbusMasterFunctions. |
|
 |
|