Package org.osgi.service.serial
Interface SerialDevice
public interface SerialDevice
SerialDevice is a service representing a device performing serial
communication.
- "ThreadSafe"
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionGets the Serial port configuration.Returns an input stream.Returns an output stream.booleanisCTS()Returns the CTS state.booleanisDSR()Returns the DSR state.booleanisDTR()Returns the DTR state.booleanisRTS()Returns the DTS state.voidsetConfiguration(SerialPortConfiguration configuration) Sets the Serial port configuration.voidsetDTR(boolean dtr) Sets the DTR state.voidsetRTS(boolean rts) Sets the RTS state.
-
Field Details
-
DEVICE_CATEGORY
Constant for the value of the service propertyDEVICE_CATEGORYused for all Serial devices.A Serial base driver bundle must set this property key.
-
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
Returns an input stream.- Returns:
- An input stream.
- Throws:
IOException- if an I/O error occurred.
-
getOutputStream
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
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
Sets the DTR state.- Parameters:
dtr-truefor DTR on;falsefor DTR for off.- Throws:
SerialDeviceException- If the parameter is not supported.
-
setRTS
Sets the RTS state.- Parameters:
rts-truefor RTS on;falsefor RTS for off.- Throws:
SerialDeviceException- If the parameter is not supported.
-