aromajoin / controller-sdk-java

Enable developers to connect and control Aroma Shooter.
https://aromajoin.com/software/sdk
Apache License 2.0
4 stars 0 forks source link

need to initialize twice to discover Aroma Shooter #3

Open danielle-h opened 2 years ago

danielle-h commented 2 years ago

Using Raspberry pi running Linux 10 (buster).

output of java -version:

openjdk version "11.0.12" 2021-07-20
OpenJDK Runtime Environment (build 11.0.12+7-post-Raspbian-2deb10u1)
OpenJDK Server VM (build 11.0.12+7-post-Raspbian-2deb10u1, mixed mode)
 private static USBASController initAromajoin() {
    USBASController usbController = new USBASController();
    usbController.scanAndConnect();
    if (!usbController.getConnectedDevices().isEmpty()) {
      for (AromaShooter aromaShooter : usbController.getConnectedDevices()) {
        System.out.println("Connected to AromaShooter: " + aromaShooter.getSerial());
      }
    }
    return usbController;
  }

This code never discovers the Aroma shooter in the first time. It always needs to be called twice.

Output first time: (see issue #2)

com.fazecast.jSerialComm.SerialPortTimeoutException: The write operation timed out before all data was written.
        at com.fazecast.jSerialComm.SerialPort$SerialPortOutputStream.write(SerialPort.java:1470)
        at com.fazecast.jSerialComm.SerialPort$SerialPortOutputStream.write(SerialPort.java:1449)
        at com.aromajoin.sdk.jvm.SerialReader.query(SerialReader.java:33)
        at com.aromajoin.sdk.jvm.usb.USBASController.scanAndConnect(USBASController.java:74)
        at worg.weizmann.App.initAromajoin(App.java:107)
        at worg.weizmann.App.main(App.java:27)

Output second time:

com.fazecast.jSerialComm.SerialPortTimeoutException: The write operation timed out before all data was written.
        at com.fazecast.jSerialComm.SerialPort$SerialPortOutputStream.write(SerialPort.java:1470)
        at com.fazecast.jSerialComm.SerialPort$SerialPortOutputStream.write(SerialPort.java:1449)
        at com.aromajoin.sdk.jvm.SerialReader.query(SerialReader.java:33)
        at com.aromajoin.sdk.jvm.usb.USBASController.scanAndConnect(USBASController.java:74)
        at worg.weizmann.App.initAromajoin(App.java:107)
        at worg.weizmann.App.main(App.java:27)
Connected to AromaShooter: ASN2A00306