Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Native port is not opened? #3

Open
JudeBautista opened this issue Nov 26, 2018 · 0 comments
Open

Native port is not opened? #3

JudeBautista opened this issue Nov 26, 2018 · 0 comments

Comments

@JudeBautista
Copy link

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

}

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant