Top Description Fields Methods
org.osgi.service.serial

public Interface SerialDevice

Imports
java.io.IOException, .InputStream, .OutputStream

SerialDevice is a service representing a device performing serial communication.
Author
$Id: f81e8f2088bf55d4c085a03891bf6b3f849dea51 $

Field Summary

Modifier and TypeField and Description
public static final String
DEVICE_CATEGORY

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

public static final String
SERIAL_COMPORT

Service property for the serial comport.

Method Summary

Modifier and TypeMethod and Description
public SerialPortConfiguration

Returns:

The SerialPortConfiguration object containing the configuration.
getConfiguration
()

Gets the Serial port configuration.

public InputStream

Returns:

An input stream.
getInputStream
()

Returns an input stream.

public OutputStream

Returns:

An output stream.
getOutputStream
()

Returns an output stream.

public boolean

Returns:

The CTS state.
isCTS
()

Returns the CTS state.

public boolean

Returns:

The DSR state.
isDSR
()

Returns the DSR state.

public boolean

Returns:

The DTR state.
isDTR
()

Returns the DTR state.

public boolean

Returns:

The DTS state.
isRTS
()

Returns the DTS state.

public void
setConfiguration(SerialPortConfiguration
The SerialPortConfiguration object containing the configuration.
configuration
)

Sets the Serial port configuration.

public void
setDTR(boolean
true for DTR on; false for DTR for off.
dtr
)

Sets the DTR state.

public void
setRTS(boolean
true for RTS on; false for RTS for off.
rts
)

Sets the RTS state.

Field Detail

DEVICE_CATEGORYback to summary
public 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
org.osgi.service.device.Constants#DEVICE_CATEGORY
SERIAL_COMPORTback to summary
public 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".

Method Detail

getConfigurationback to summary
public SerialPortConfiguration getConfiguration()

Gets the Serial port configuration.

Returns:SerialPortConfiguration

The SerialPortConfiguration object containing the configuration.

getInputStreamback to summary
public InputStream getInputStream() throws IOException

Returns an input stream.

Returns:InputStream

An input stream.

Exceptions
IOException:
if an I/O error occurred.
getOutputStreamback to summary
public OutputStream getOutputStream() throws IOException

Returns an output stream.

Returns:OutputStream

An output stream.

Exceptions
IOException:
If an I/O error occurred.
isCTSback to summary
public boolean isCTS()

Returns the CTS state.

Returns:boolean

The CTS state.

isDSRback to summary
public boolean isDSR()

Returns the DSR state.

Returns:boolean

The DSR state.

isDTRback to summary
public boolean isDTR()

Returns the DTR state.

Returns:boolean

The DTR state.

isRTSback to summary
public boolean isRTS()

Returns the DTS state.

Returns:boolean

The DTS state.

setConfigurationback to summary
public void setConfiguration(SerialPortConfiguration configuration) throws SerialDeviceException

Sets the Serial port configuration.

Parameters
configuration:SerialPortConfiguration

The SerialPortConfiguration object containing the configuration.

Exceptions
SerialDeviceException:
If the parameter is specified incorrectly or the parameter is not supported.
setDTRback to summary
public void setDTR(boolean dtr) throws SerialDeviceException

Sets the DTR state.

Parameters
dtr:boolean

true for DTR on; false for DTR for off.

Exceptions
SerialDeviceException:
If the parameter is not supported.
setRTSback to summary
public void setRTS(boolean rts) throws SerialDeviceException

Sets the RTS state.

Parameters
rts:boolean

true for RTS on; false for RTS for off.

Exceptions
SerialDeviceException:
If the parameter is not supported.