public class SerialPort extends Object
Constructor and Description |
---|
SerialPort(String name)
SerialPort should only be instantiated by SerialManager
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the serial port
|
String |
getName()
Returns the name of the serial port
|
void |
open(ParcelFileDescriptor pfd,
int speed)
SerialPort should only be instantiated by SerialManager
Speed must be one of 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800, 9600,
19200, 38400, 57600, 115200, 230400, 460800, 500000, 576000, 921600, 1000000, 1152000,
1500000, 2000000, 2500000, 3000000, 3500000, 4000000
|
int |
read(ByteBuffer buffer)
Reads data into the provided buffer.
|
void |
sendBreak()
Sends a stream of zero valued bits for 0.25 to 0.5 seconds
|
void |
write(ByteBuffer buffer,
int length)
Writes data from provided buffer.
|
public SerialPort(String name)
public void open(ParcelFileDescriptor pfd, int speed) throws IOException
IOException
public void close() throws IOException
IOException
public String getName()
public int read(ByteBuffer buffer) throws IOException
Buffer.position()
on this buffer is
unchanged after a call to this method.buffer
- to read intoIOException
public void write(ByteBuffer buffer, int length) throws IOException
Buffer.position()
on this buffer is
unchanged after a call to this method.buffer
- to writelength
- number of bytes to writeIOException
public void sendBreak()