Added in API level 37
Summary: Methods | Inherited Methods
SerialManager
public final class SerialManager
extends Object
| java.lang.Object | |
| ↳ | android.hardware.serial.SerialManager |
This class allows you to communicate with Serial ports.
Summary
Public methods | |
|---|---|
List<SerialPort> | getPorts() Enumerates serial ports. |
void | registerSerialPortListener(Executor executor, SerialPortListener listener) Register a listener to monitor serial port connections and disconnections. |
void | unregisterSerialPortListener(SerialPortListener listener) Unregister a listener that monitored serial port connections and disconnections. |
Inherited methods | |
|---|---|
Public methods
getPorts
Added in API level 37
public List<SerialPort> getPorts ()
Enumerates serial ports.
| Returns | |
|---|---|
List<SerialPort> | This value cannot be null. |
registerSerialPortListener
Added in API level 37
public void registerSerialPortListener (Executor executor, SerialPortListener listener)
Register a listener to monitor serial port connections and disconnections.
| Parameters | |
|---|---|
executor | Executor: This value cannot be null. Callback and listener events are dispatched through this Executor, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use Context.getMainExecutor(). Otherwise, provide an Executor that dispatches to an appropriate thread. |
listener | SerialPortListener: This value cannot be null. |
| Throws | |
|---|---|
IllegalStateException | if this listener has already been registered. |
unregisterSerialPortListener
Added in API level 37
public void unregisterSerialPortListener (SerialPortListener listener)
Unregister a listener that monitored serial port connections and disconnections.
| Parameters | |
|---|---|
listener | SerialPortListener: This value cannot be null. |