public class RobotUsbDevicePretendModernRobotics extends java.lang.Object implements RobotUsbDevice
RobotUsbDevice.Channel, RobotUsbDevice.FirmwareVersion, RobotUsbDevice.USBIdentifiers| Modifier and Type | Field and Description |
|---|---|
protected CircularByteBuffer |
circularByteBuffer |
protected boolean |
debugRetainBuffers |
protected DeviceManager.UsbDeviceType |
deviceType |
protected RobotUsbDevice.FirmwareVersion |
firmwareVersion |
protected boolean |
interruptRequested |
protected MarkedItemQueue |
markedItemQueue |
protected ModernRoboticsDatagram.AllocationContext<ModernRoboticsRequest> |
requestAllocationContext |
protected ModernRoboticsDatagram.AllocationContext<ModernRoboticsResponse> |
responseAllocationContext |
protected SerialNumber |
serialNumber |
| Constructor and Description |
|---|
RobotUsbDevicePretendModernRobotics(SerialNumber serialNumber) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the device
|
boolean |
getDebugRetainBuffers() |
DeviceManager.UsbDeviceType |
getDeviceType() |
RobotUsbDevice.FirmwareVersion |
getFirmwareVersion()
Returns the firmware version of this USB device, or null if no such version is known.
|
java.lang.String |
getProductName() |
SerialNumber |
getSerialNumber() |
RobotUsbDevice.USBIdentifiers |
getUsbIdentifiers()
Returns the USB-level vendor and product id of this device.
|
boolean |
isAttached()
Returns whether or not this USB device is known to be physically attached
|
boolean |
isOpen()
Returns whether the device is open or not
|
void |
logRetainedBuffers(long nsOrigin,
long nsTimerExpire,
java.lang.String tag,
java.lang.String format,
java.lang.Object... args) |
boolean |
mightBeAtUsbPacketStart()
Answers as to whether we're it's probably the case we're at the start of a Usb
packet.
|
int |
read(byte[] bytes,
int ibFirst,
int cbToRead,
long timeout,
TimeWindow timeWindow)
Reads a requested number of bytes from the device.
|
void |
requestReadInterrupt(boolean interruptRequested)
Interrupts any reads that are currently pending inside the device, possibly waiting
on a perhaps lengthy timeout.
|
void |
resetAndFlushBuffers()
Resets the remote USB device comm-layer as best we can.
|
void |
setBaudRate(int i)
Sets the rate of data transmission used to communicate with the device.
|
void |
setBreak(boolean enable)
Sets or unsets a break state on the communication line
|
void |
setDataCharacteristics(byte b,
byte b1,
byte b2)
Set the Data Characteristics
|
void |
setDebugRetainBuffers(boolean retain) |
void |
setDeviceType(DeviceManager.UsbDeviceType deviceType) |
void |
setFirmwareVersion(RobotUsbDevice.FirmwareVersion version)
Sets the firmware version of this USB device.
|
void |
setLatencyTimer(int i)
Set the latency timer
|
void |
skipToLikelyUsbPacketStart()
Skips to the beginning of a USB packet, if not already there.
|
void |
write(byte[] bytes)
Write to device
|
protected RobotUsbDevice.FirmwareVersion firmwareVersion
protected CircularByteBuffer circularByteBuffer
protected MarkedItemQueue markedItemQueue
protected boolean interruptRequested
protected SerialNumber serialNumber
protected DeviceManager.UsbDeviceType deviceType
protected boolean debugRetainBuffers
protected ModernRoboticsDatagram.AllocationContext<ModernRoboticsRequest> requestAllocationContext
protected ModernRoboticsDatagram.AllocationContext<ModernRoboticsResponse> responseAllocationContext
public RobotUsbDevicePretendModernRobotics(SerialNumber serialNumber)
public SerialNumber getSerialNumber()
getSerialNumber in interface RobotUsbDevicepublic java.lang.String getProductName()
getProductName in interface RobotUsbDevicepublic void setDeviceType(DeviceManager.UsbDeviceType deviceType)
setDeviceType in interface RobotUsbDevicepublic DeviceManager.UsbDeviceType getDeviceType()
getDeviceType in interface RobotUsbDevicepublic void close()
RobotUsbDeviceclose in interface RobotUsbDevicepublic boolean isOpen()
RobotUsbDeviceisOpen in interface RobotUsbDevicepublic boolean isAttached()
RobotUsbDeviceisAttached in interface RobotUsbDevicepublic void setDebugRetainBuffers(boolean retain)
setDebugRetainBuffers in interface RobotUsbDevicepublic boolean getDebugRetainBuffers()
getDebugRetainBuffers in interface RobotUsbDevicepublic void logRetainedBuffers(long nsOrigin,
long nsTimerExpire,
java.lang.String tag,
java.lang.String format,
java.lang.Object... args)
logRetainedBuffers in interface RobotUsbDevicepublic void setBaudRate(int i)
RobotUsbDevicesetBaudRate in interface RobotUsbDevicei - baud ratepublic void setDataCharacteristics(byte b,
byte b1,
byte b2)
RobotUsbDevicesetDataCharacteristics in interface RobotUsbDeviceb - data bitsb1 - stop bitsb2 - paritypublic void setLatencyTimer(int i)
RobotUsbDevicesetLatencyTimer in interface RobotUsbDevicei - latency timerpublic void setBreak(boolean enable)
RobotUsbDevicesetBreak in interface RobotUsbDeviceenable - whether or not to set a break statepublic void skipToLikelyUsbPacketStart()
RobotUsbDeviceskipToLikelyUsbPacketStart in interface RobotUsbDevicepublic boolean mightBeAtUsbPacketStart()
RobotUsbDevicemightBeAtUsbPacketStart in interface RobotUsbDevicepublic void write(byte[] bytes)
RobotUsbDevicewrite in interface RobotUsbDevicebytes - byte arraypublic int read(byte[] bytes,
int ibFirst,
int cbToRead,
long timeout,
TimeWindow timeWindow)
RobotUsbDeviceread in interface RobotUsbDevicebytes - byte array into which to read the dataibFirst - first index in data at which to read the datacbToRead - number of bytes to readtimeout - amount of time to wait, in ms, for data to become available to readtimeWindow - optional place to return information as to when the data was readpublic void resetAndFlushBuffers()
RobotUsbDeviceresetAndFlushBuffers in interface RobotUsbDevicepublic RobotUsbDevice.FirmwareVersion getFirmwareVersion()
RobotUsbDevicegetFirmwareVersion in interface RobotUsbDeviceRobotUsbDevice.setFirmwareVersion(FirmwareVersion)public void setFirmwareVersion(RobotUsbDevice.FirmwareVersion version)
RobotUsbDevicesetFirmwareVersion in interface RobotUsbDeviceRobotUsbDevice.getFirmwareVersion()public void requestReadInterrupt(boolean interruptRequested)
RobotUsbDevicerequestReadInterrupt in interface RobotUsbDevicepublic RobotUsbDevice.USBIdentifiers getUsbIdentifiers()
RobotUsbDevicegetUsbIdentifiers in interface RobotUsbDevice