[modbus] fix defaults for tcp and serial things and some other minor cleanup (#10147)
* [modbus] More strict nullness. Remove apache.commons.lang from itests * [modbus] Defaults for tcp and serial things according to docs * [modbus] further explicit defaults * [modbus] document default encoding for serial. RTU is pretty much the only one used in the field. Previous default was ascii implicitly. * [modbus] verify defaults are used for undefined configuration parameters Signed-off-by: Sami Salonen <ssalonen@gmail.com>
This commit is contained in:
@@ -146,7 +146,7 @@ Basic parameters
|
||||
| stopBits | text | ✓ | | Stop bits. Valid values are: `"1.0"`, `"1.5"`, `"2.0"`. | |
|
||||
| parity | text | ✓ | | Parity. Valid values are: `"none"`, `"even"`, `"odd"`. | |
|
||||
| dataBits | integer | ✓ | | Data bits. Valid values are: `5`, `6`, `7` and `8`. | |
|
||||
| encoding | text | ✓ | | Encoding. Valid values are: `"ascii"`, `"rtu"`, `"bin"`. | |
|
||||
| encoding | text | | `"rtu"` | Encoding. Valid values are: `"ascii"`, `"rtu"`, `"bin"`. | |
|
||||
| echo | boolean | | `false` | Flag for setting the RS485 echo mode. This controls whether we should try to read back whatever we send on the line, before reading the response. Valid values are: `true`, `false`. | |
|
||||
|
||||
Advanced parameters
|
||||
|
||||
@@ -24,19 +24,19 @@ import org.eclipse.jdt.annotation.Nullable;
|
||||
@NonNullByDefault
|
||||
public class ModbusSerialConfiguration {
|
||||
private @Nullable String port;
|
||||
private int id;
|
||||
private int id = 1;
|
||||
private int baud;
|
||||
private @Nullable String stopBits;
|
||||
private @Nullable String parity;
|
||||
private int dataBits;
|
||||
private @Nullable String encoding;
|
||||
private String encoding = "rtu";
|
||||
private boolean echo;
|
||||
private int receiveTimeoutMillis;
|
||||
private @Nullable String flowControlIn;
|
||||
private @Nullable String flowControlOut;
|
||||
private int timeBetweenTransactionsMillis;
|
||||
private int connectMaxTries;
|
||||
private int connectTimeoutMillis;
|
||||
private int receiveTimeoutMillis = 1500;
|
||||
private String flowControlIn = "none";
|
||||
private String flowControlOut = "none";
|
||||
private int timeBetweenTransactionsMillis = 35;
|
||||
private int connectMaxTries = 1;
|
||||
private int connectTimeoutMillis = 10_000;
|
||||
private boolean enableDiscovery;
|
||||
|
||||
public @Nullable String getPort() {
|
||||
|
||||
@@ -25,12 +25,12 @@ import org.eclipse.jdt.annotation.Nullable;
|
||||
public class ModbusTcpConfiguration {
|
||||
private @Nullable String host;
|
||||
private int port;
|
||||
private int id;
|
||||
private int timeBetweenTransactionsMillis;
|
||||
private int id = 1;
|
||||
private int timeBetweenTransactionsMillis = 60;
|
||||
private int timeBetweenReconnectMillis;
|
||||
private int connectMaxTries;
|
||||
private int connectMaxTries = 1;
|
||||
private int reconnectAfterMillis;
|
||||
private int connectTimeoutMillis;
|
||||
private int connectTimeoutMillis = 10_000;
|
||||
private boolean enableDiscovery;
|
||||
private boolean rtuEncoded;
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ public abstract class AbstractModbusEndpointThingHandler<E extends ModbusSlaveEn
|
||||
protected volatile @Nullable C config;
|
||||
protected volatile @Nullable E endpoint;
|
||||
protected ModbusManager modbusManager;
|
||||
protected volatile @Nullable EndpointPoolConfiguration poolConfiguration;
|
||||
protected volatile @NonNullByDefault({}) EndpointPoolConfiguration poolConfiguration;
|
||||
private final Logger logger = LoggerFactory.getLogger(AbstractModbusEndpointThingHandler.class);
|
||||
private @NonNullByDefault({}) ModbusCommunicationInterface comms;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user