Package org.osgi.service.serial
Interface SerialDevice
-
public interface SerialDeviceSerialDevice is a service representing a device performing serial communication.- Author:
- $Id: f81e8f2088bf55d4c085a03891bf6b3f849dea51 $
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringDEVICE_CATEGORYConstant for the value of the service propertyDEVICE_CATEGORYused for all Serial devices.static java.lang.StringSERIAL_COMPORTService property for the serial comport.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description SerialPortConfigurationgetConfiguration()Gets the Serial port configuration.java.io.InputStreamgetInputStream()Returns an input stream.java.io.OutputStreamgetOutputStream()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 Detail
-
DEVICE_CATEGORY
static final java.lang.String 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.
- 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.IOExceptionReturns 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.IOExceptionReturns 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 SerialDeviceExceptionSets the DTR state.- Parameters:
dtr-truefor DTR on;falsefor DTR for off.- Throws:
SerialDeviceException- If the parameter is not supported.
-
setRTS
void setRTS(boolean rts) throws SerialDeviceExceptionSets the RTS state.- Parameters:
rts-truefor RTS on;falsefor RTS for off.- Throws:
SerialDeviceException- If the parameter is not supported.
-
-