I'm using jamod (ModBus api) with a Beaglebone Black which runs on Android. I successfully used it for ModBus TCP Slave app. It worked like a charm. Now I'm trying to use it for Modbus serial slave app. But I am having an error. I think the problem is portname. I'm not realy sure what to use as a portname. Here is the code I tried:
ModbusSerialListener listener = null;
SimpleProcessImage spi = null;
spi = new SimpleProcessImage();
spi.addRegister(new SimpleRegister(45));
spi.addRegister(new SimpleRegister(56));
spi.addDigitalOut(new SimpleDigitalOut(false));
spi.addDigitalOut(new SimpleDigitalOut(false));
ModbusCoupler.getReference().setProcessImage(spi);
ModbusCoupler.getReference().setMaster(false);
ModbusCoupler.getReference().setUnitID(1);
SerialParameters params = new SerialParameters();
params.setPortName("/dev/ttyO0");
params.setBaudRate(9600);
params.setDatabits(8);
params.setParity("None");
params.setStopbits(1);
params.setEncoding("ascii");
params.setEcho(false);
listener = new ModbusSerialListener(params);
listener.setListening(true);
Error: java.lang.NoClassDefFoundError: net.wimpi.modbus.net.SerialConnection . And I'm getting it at "listener = new ModbusSerialListener(params);" part.
----------------------Edit ----------------------
I found what causes the problem. jamod trying to use javax.comm api. Since there isn't one on Android, the app crashes. Is there any way to import javax.comm into a project??