Skip to content

Native port is not opened? #3

Description

@JudeBautista

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();

}

}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions