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

registerReadCallback not receiving any data #126

Closed
mvaljento opened this issue Nov 23, 2020 · 2 comments
Closed

registerReadCallback not receiving any data #126

mvaljento opened this issue Nov 23, 2020 · 2 comments

Comments

@mvaljento
Copy link

mvaljento commented Nov 23, 2020

I'm using cordovarduino 0.0.10 with Ionic 5 along with @ionic-native/serial 5.30.0. I'm connecting to a FTDI device through USB on PWA running Android 8. I also tested on Android 10.

I'm managing to establish a connection and receive "registerReadCallback: true" from registerReadCallback. However, after that I receive no data in the callback even though the device should be sending serial data. I tested that it's sending data with a serial terminal app.

Changing dtr and rts attributes made no difference. Baudrate and other settings are correct since I took them from the terminal app and the connection is established.

Calling serial.read at any time results in an empty ArrayBuffer.

this.serial.requestPermission({
        vid: MY_VID,
        pid: MY_PID,
        driver: 'FtdiSerialDriver',
      }).then(() => {
        console.log('[Serial] permission granted');
        this.serial.open({
          baudRate: 115200,
          dataBits: 8,
          stopBits: 1,
          parity: 0,
          dtr: true,
          rts: false,
          sleepOnPause: true // The port with automatically close, and resume once the app is brought back to foreground.
        }).then(() => {
          console.log('Serial connection opened');
          this.serial.registerReadCallback().subscribe((data) => {
            console.log('[Serial] event', data);
          });
          resolve(this.serial);
        }).catch((error: any) => {
          console.error('[Serial] open error', error);
          reject();
        });
      }).catch((error: any) => {
        console.error('[Serial] permission error', error);
        reject();
      });
@mvaljento
Copy link
Author

This was not a bug. Another process was consuming the messages.

@joeyoyo
Copy link

joeyoyo commented Nov 30, 2020

Have you solved this problem? I had the same problem, sending a 96 bytes message to the board using the writeHex method, However , i can not receive "registerReadCallback: true" from registerReadCallback. But other bytes can

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

2 participants