Package org.osgi.service.serial
Interface SerialDevice
-
public interface SerialDevice
SerialDevice is a service representing a device performing serial communication.- Author:
- $Id: f81e8f2088bf55d4c085a03891bf6b3f849dea51 $
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
DEVICE_CATEGORY
Constant for the value of the service propertyDEVICE_CATEGORY
used for all Serial devices.static java.lang.String
SERIAL_COMPORT
Service property for the serial comport.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description SerialPortConfiguration
getConfiguration()
Gets the Serial port configuration.java.io.InputStream
getInputStream()
Returns an input stream.java.io.OutputStream
getOutputStream()
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 Detail
-
DEVICE_CATEGORY
static final java.lang.String 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.
- See Also:
Constants.DEVICE_CATEGORY
, Constant Field Values
-
SERIAL_COMPORT
static final java.lang.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:
- Constant Field Values
-
-
Method Detail
-
getInputStream
java.io.InputStream getInputStream() throws java.io.IOException
Returns an input stream.- Returns:
- An input stream.
- Throws:
java.io.IOException
- if an I/O error occurred.
-
getOutputStream
java.io.OutputStream getOutputStream() throws java.io.IOException
Returns an output stream.- Returns:
- An output stream.
- Throws:
java.io.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.
-
-