Class NativeSerialDevice

    • Constructor Detail

      • NativeSerialDevice

        public NativeSerialDevice​(String deviceFile,
                                  int baud,
                                  SerialConstants.DataBits dataBits,
                                  SerialConstants.StopBits stopBits,
                                  SerialConstants.Parity parity,
                                  boolean readBlocking,
                                  int minReadChars,
                                  int readTimeoutMillis)
        Open a new serial device
        Parameters:
        deviceFile - Serial device filename including path, e.g. /dev/ttyACM0
        baud - Default is 9600.
        dataBits - The number of data bits to use per word; default is 8, values from 5 to 8 are acceptable.
        stopBits - The number of stop bits; default is 1, but 2 bits can also be used or even 1.5 on Windows machines.
        parity - Specifies how error detection is carried out; valid values are NO_PARITY, EVEN_PARITY, ODD_PARITY, MARK_PARITY, and SPACE_PARITY
        readBlocking - Should blocking I/O be used for read operations?
        minReadChars - Minimum number of characters to read
        readTimeoutMillis - Duration in milliseconds for read timeouts; must be in units of 100.
    • Method Detail

      • read

        public int read()
      • readByte

        public byte readByte()
      • writeByte

        public void writeByte​(byte value)
      • read

        public int read​(byte[] buffer)
      • write

        public void write​(byte[] data)
      • bytesAvailable

        public int bytesAvailable()
      • getDeviceFile

        public String getDeviceFile()