Interface SerialDevice


public interface SerialDevice
SerialDevice is a service representing a device performing serial communication.
"ThreadSafe"
  • Field Details

    • DEVICE_CATEGORY

      static final String DEVICE_CATEGORY
      Constant for the value of the service property DEVICE_CATEGORY used for all Serial devices.

      A Serial base driver bundle must set this property key.

      See Also:
    • SERIAL_COMPORT

      static final String SERIAL_COMPORT
      Service property for the serial comport.

      Represents the name of the port. The value type is String.

      For example, "/dev/ttyUSB0", "COM5", or "/dev/tty.usbserial-XXXXXX".

      See Also:
  • Method Details

    • getInputStream

      InputStream getInputStream() throws IOException
      Returns an input stream.
      Returns:
      An input stream.
      Throws:
      IOException - if an I/O error occurred.
    • getOutputStream

      OutputStream getOutputStream() throws IOException
      Returns an output stream.
      Returns:
      An output stream.
      Throws:
      IOException - If an I/O error occurred.
    • getConfiguration

      SerialPortConfiguration getConfiguration()
      Gets the Serial port configuration.
      Returns:
      The SerialPortConfiguration object containing the configuration.
    • setConfiguration

      void setConfiguration(SerialPortConfiguration configuration) throws SerialDeviceException
      Sets the Serial port configuration.
      Parameters:
      configuration - The SerialPortConfiguration object containing the configuration.
      Throws:
      SerialDeviceException - If the parameter is specified incorrectly or the parameter is not supported.
    • isDTR

      boolean isDTR()
      Returns the DTR state.
      Returns:
      The DTR state.
    • isRTS

      boolean isRTS()
      Returns the DTS state.
      Returns:
      The DTS state.
    • isDSR

      boolean isDSR()
      Returns the DSR state.
      Returns:
      The DSR state.
    • isCTS

      boolean isCTS()
      Returns the CTS state.
      Returns:
      The CTS state.
    • setDTR

      void setDTR(boolean dtr) throws SerialDeviceException
      Sets the DTR state.
      Parameters:
      dtr - true for DTR on; false for DTR for off.
      Throws:
      SerialDeviceException - If the parameter is not supported.
    • setRTS

      void setRTS(boolean rts) throws SerialDeviceException
      Sets the RTS state.
      Parameters:
      rts - true for RTS on; false for RTS for off.
      Throws:
      SerialDeviceException - If the parameter is not supported.