}
private static void configureSerial(Config configuration) {
ModbusFactory factory = new ModbusFactory();
SerialParameters params = new SerialParameters();
String port = configuration.getStringProperty("port", "/dev/ttyUSB10");
int baudrate = configuration.getIntProperty("baudrate", 19200);
System.out.println("baudrate: " + baudrate);
int databits = configuration.getIntProperty("data-bits", SerialPort.DATABITS_8);
System.out.println("databits: " + databits);
int parity = configuration.getIntProperty("parity", SerialPort.PARITY_EVEN);
System.out.println("parity: " + parity);
int stopbits = configuration.getIntProperty("stop-bits", SerialPort.STOPBITS_1);
System.out.println("stopbits: " + stopbits);
params.setCommPortId(port);
params.setBaudRate(baudrate);
params.setDataBits(databits);
params.setParity(parity);
params.setStopBits(stopbits);
master = factory.createRtuMaster(params, SerialMaster.SYNC_FUNCTION);
connectionInfo = "Serial Connection to: " + port;
}