1

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?

3
  • 1
    You have to import JSSC as NDK to make this work with Android.
    – ShekharKG
    Jul 11, 2018 at 10:41
  • Thanks @ShekharKG. I had kind of left this project as I was pulling my hair out over it. I will definetly go back and have a look at this. Thanks again
    – O.B
    Jul 11, 2018 at 13:38
  • @ShekharKG do you have more information how to proceed to import jssc as NDK?
    – tryp
    Jul 26, 2019 at 10:28

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.