jserialcomm 2.6.2 problem
See original GitHub issueon jserialcomm 2.6.2, have problem with SetComPortParameter.
My java code `/** * Open Serial Port for communication * @param serialname : serial port name * @param baudrate : baud rate, typically 4800, 9600, 144400, 19200, 38400, 57600, 115200 * @param databit : data bit length , typically 8 * @param stopbit : typically 1 * @param parity : 0 = None, 1 = Odd, 2 = Even, 3 = Mark, 4 = Space * @return true if success */ public boolean Open(String serialname, int baudrate, int databit, int stopbit, int parity) { sp = new SerialParameters();
sp.setDataBits(databit);
sp.setDevice(serialname);
sp.setStopBits(stopbit);
sp.setBaudRate(BaudRate.getBaudRate(baudrate));
sp.setParity(Parity.getParity(parity));
SerialUtils.setSerialPortFactoryJSerialComm();
try {
modbus = ModbusSlaveFactory.createModbusSlaveRTU(sp);
modbus.addListener(listener);
modbus.listen();
return true;
} catch (SerialPortException e) {
raise_log("Open failed, Msg : "+e.getMessage());
return false;
} catch (ModbusIOException e) {
raise_log("Modbus Listen failed, Msg : "+e.getMessage());
return false;
}
}`
Log :
java.lang.NoSuchMethodError: com.fazecast.jSerialComm.SerialPort.setComPortParameters(IIII)V at com.intelligt.modbus.jlibmodbus.serial.SerialPortJSerialComm.open(SerialPortJSerialComm.java:71) at com.intelligt.modbus.jlibmodbus.net.ModbusConnectionSerial.openImpl(ModbusConnectionSerial.java:60) at com.intelligt.modbus.jlibmodbus.net.ModbusConnection.open(ModbusConnection.java:45) at com.intelligt.modbus.jlibmodbus.slave.RequestHandlerSerial.run(RequestHandlerSerial.java:51) at java.lang.Thread.run(Thread.java:748)
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:8 (2 by maintainers)
Top GitHub Comments
it’s still alive!)
I guess this project is dead.