Serial Buffer class

pull/4/head
Felipe Herranz 2014-03-21 13:53:24 +01:00
rodzic dc96106718
commit 5754c972cf
5 zmienionych plików z 51 dodań i 3 usunięć

Plik binarny nie jest wyświetlany.

Plik binarny nie jest wyświetlany.

Wyświetl plik

@ -0,0 +1,36 @@
package com.felhr.usbserial;
public class SerialBuffer
{
private static final int DEFAULT_WRITE_BUFFER_SIZE = 16 * 1024;
private static final int DEFAULT_READ_BUFFER_SIZE = 16 * 1024;
private byte[] writeBuffer;
private byte[] readBuffer;
private Object mReadLock;
private Object mWriteLock;
public SerialBuffer(Object mReadLock, Object mWriteLock)
{
writeBuffer = new byte[DEFAULT_WRITE_BUFFER_SIZE];
readBuffer = new byte[DEFAULT_READ_BUFFER_SIZE];
this.mReadLock = mReadLock;
this.mWriteLock = mWriteLock;
}
public void putWriteBuffer(byte[] data)
{
synchronized(mWriteLock)
{
// TO-DO
}
}
public byte[] getWriteBuffer()
{
// TO-DO
return null;
}
}

Wyświetl plik

@ -1,11 +1,23 @@
package com.felhr.usbserial;
public abstract class UsbSerialDevice
import android.hardware.usb.UsbDevice;
import android.hardware.usb.UsbDeviceConnection;
public abstract class UsbSerialDevice implements UsbSerialInterface
{
private UsbDevice device;
private UsbDeviceConnection connection;
public UsbSerialDevice()
private Object readBufferLock;
private Object writeBufferLock;
public UsbSerialDevice(UsbDevice device, UsbDeviceConnection connection)
{
this.device = device;
this.connection = connection;
this.readBufferLock = new Object();
this.writeBufferLock = new Object();
}
}