kopia lustrzana https://github.com/felHR85/UsbSerial
Request codes and some default values
rodzic
0ea9e59eee
commit
6727c2e669
Plik binarny nie jest wyświetlany.
Plik binarny nie jest wyświetlany.
Plik binarny nie jest wyświetlany.
|
|
@ -2,13 +2,48 @@ package com.felhr.usbserial;
|
|||
|
||||
import android.hardware.usb.UsbDevice;
|
||||
import android.hardware.usb.UsbDeviceConnection;
|
||||
import android.hardware.usb.UsbEndpoint;
|
||||
import android.hardware.usb.UsbInterface;
|
||||
|
||||
public class CP2102SerialDevice extends UsbSerialDevice
|
||||
{
|
||||
private static final int CP210x_IFC_ENABLE = 0x00;
|
||||
private static final int CP210x_SET_BAUDDIV = 0x01;
|
||||
private static final int CP210x_SET_LINE_CTL = 0x03;
|
||||
private static final int CP210x_SET_MHS = 0x07;
|
||||
private static final int CP210x_SET_BAUDRATE = 0x1E;
|
||||
private static final int CP210x_SET_FLOW = 0x13;
|
||||
private static final int CP210x_SET_XON = 0x09;
|
||||
private static final int CP210x_SET_XOFF = 0x0A;
|
||||
|
||||
private static final int CP210x_REQTYPE_HOST2DEVICE = 0x41;
|
||||
|
||||
/***
|
||||
* Default Serial Configuration
|
||||
* Baud rate: 9600
|
||||
* Data bits: 8
|
||||
* Stop bits: 1
|
||||
* Parity: None
|
||||
* Flow Control: Off
|
||||
*/
|
||||
private static final int CP210x_UART_ENABLE = 0x0001;
|
||||
private static final int CP210x_UART_DISABLE = 0x0000;
|
||||
private static final int CP210x_LINE_CTL_DEFAULT = 0x0800;
|
||||
private static final int CP210x_MHS_DEFAULT = 0x0000;
|
||||
private static final int CP210x_MHS_DTR = 0x0001;
|
||||
private static final int CP210x_MHS_RTS = 0x0010;
|
||||
private static final int CP210x_MHS_ALL = 0x0011;
|
||||
private static final int CP210x_XON = 0x0000;
|
||||
private static final int CP210x_XOFF = 0x0000;
|
||||
|
||||
private UsbInterface mInterface;
|
||||
private UsbEndpoint inEndpoint;
|
||||
private UsbEndpoint outEndpoint;
|
||||
|
||||
public CP2102SerialDevice(UsbDevice device, UsbDeviceConnection connection)
|
||||
{
|
||||
super(device, connection);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -66,5 +101,10 @@ public class CP2102SerialDevice extends UsbSerialDevice
|
|||
{
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
|
||||
private int setControlCommand(int request, int value, byte[] data)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ public class SerialBuffer
|
|||
{
|
||||
private static final int DEFAULT_WRITE_BUFFER_SIZE = 16 * 1024;
|
||||
private static final int DEFAULT_READ_BUFFER_SIZE = 16 * 1024;
|
||||
|
||||
private ByteBuffer writeBuffer;
|
||||
private ByteBuffer readBuffer;
|
||||
private Object mReadLock;
|
||||
|
|
|
|||
Ładowanie…
Reference in New Issue