serial-android icon indicating copy to clipboard operation
serial-android copied to clipboard

Native port is not opened?

Open JudeBautista opened this issue 7 years ago • 0 comments

Im using your library serial communication using R232,

I would like to know when i write the port, its success and trigger to my terminal device, however when i try to read the return, the error gives me

Native port is not open?

may i know how comes? because when i write my code i try to put handler, or countdown too, what will be possible can fix this?

Hope you help me this. Thank you

public void sendCommandData(final String id, final Serial port, byte[] data) { this.id = id; try { port.write(data, data.length);

    new Handler().postDelayed(new Runnable() {
        @Override
        public void run() {
            try {
                Toast.makeText(activity,""+port.read(),Toast.LENGTH_SHORT).show();
            } catch (SerialIOException e) {
                Toast.makeText(activity,""+e.getMessage(),Toast.LENGTH_SHORT).show();
            }catch (Exception e)
            {
                messageBox(activity,"Error",e.getMessage());
            }
        }
    }, 10000);

} catch (SerialIOException e) {
    e.printStackTrace();

}

}

JudeBautista avatar Nov 26 '18 13:11 JudeBautista