Downloaded jssc and added it to my project in android studio.
SerialPort sp = new SerialPort("COM1");
try {
if (sp!=null && sp.isOpened ()) {
sp.closePort();
}
try{
sp.openPort();
sp.setParams(9600,8,1,0);
}catch (Error f){
Log.d("Trace", f.getMessage());
}
sp.closePort();
}catch (SerialPortException e){
Log.d("Trace", e.getMessage());
}
Tried running this as a static function from my onCreate function.
On sp.openPort() I get the error
No implementation found for long jssc.SerialNativeInterface.openPort(java.lang.String, boolean) (tried Java_jssc_SerialNativeInterface_openPort and Java_jssc_SerialNativeInterface_openPort__Ljava_lang_String_2Z)
I've already made a SSh connection with jsch and to open the socket I had to make a new thread. Didn't work when I did it for jssc.
When I run through Putty I connect using COM1.
Thanks in advance
Edit
After some more debugging I've found that this:
String[] portNames = SerialPortList.getPortNames();
Doesn't display any ports.
If I go to Device manager in Ports I can now see COM1 and COM4.
Any advice?