Package org.osgi.service.serial
Interface SerialDevice
public interface SerialDevice
SerialDevice is a service representing a device performing serial
communication.
- "ThreadSafe"
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionGets the Serial port configuration.Returns an input stream.Returns an output stream.boolean
isCTS()
Returns the CTS state.boolean
isDSR()
Returns the DSR state.boolean
isDTR()
Returns the DTR state.boolean
isRTS()
Returns the DTS state.void
setConfiguration
(SerialPortConfiguration configuration) Sets the Serial port configuration.void
setDTR
(boolean dtr) Sets the DTR state.void
setRTS
(boolean rts) Sets the RTS state.
-
Field Details
-
DEVICE_CATEGORY
Constant for the value of the service propertyDEVICE_CATEGORY
used 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
-true
for DTR on;false
for DTR for off.- Throws:
SerialDeviceException
- If the parameter is not supported.
-
setRTS
Sets the RTS state.- Parameters:
rts
-true
for RTS on;false
for RTS for off.- Throws:
SerialDeviceException
- If the parameter is not supported.
-