kopia lustrzana https://github.com/felHR85/UsbSerial
Serial Buffer class
rodzic
dc96106718
commit
5754c972cf
Plik binarny nie jest wyświetlany.
Plik binarny nie jest wyświetlany.
Plik binarny nie jest wyświetlany.
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue