-
- All Implemented Interfaces:
-
java.io.Closeable,java.lang.AutoCloseable
public interface UsbCommunication implements Closeable
This Interface describes a low level device to perform USB transfers. At the moment only bulk IN and OUT transfer are supported. Every class that follows com.github.mjdev.libaums.driver.BlockDeviceDriver can use this to communicate with the underlying USB stack.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classUsbCommunication.Companion
-
Method Summary
Modifier and Type Method Description abstract IntegerbulkOutTransfer(ByteBuffer src)Performs a bulk out transfer beginning at the offset specified in the bufferof lengthbuffer#remaining().abstract IntegerbulkInTransfer(ByteBuffer dest)Performs a bulk in transfer beginning at offset zero in the bufferof lengthbuffer#remaining().abstract IntegercontrolTransfer(Integer requestType, Integer request, Integer value, Integer index, ByteArray buffer, Integer length)Performs a control transaction on endpoint zero for this device. abstract UnitresetDevice()Performs the recovery reset procedure in case the communication is stalled abstract UnitclearFeatureHalt(UsbEndpoint endpoint)Attempts to clear the HALT feature from the specified USB endpoint abstract UsbEndpointgetInEndpoint()abstract UsbEndpointgetOutEndpoint()abstract UsbInterfacegetUsbInterface()-
-
Method Detail
-
bulkOutTransfer
abstract Integer bulkOutTransfer(ByteBuffer src)
Performs a bulk out transfer beginning at the offset specified in the
bufferof lengthbuffer#remaining().- Parameters:
src- The data to transfer.
-
bulkInTransfer
abstract Integer bulkInTransfer(ByteBuffer dest)
Performs a bulk in transfer beginning at offset zero in the
bufferof lengthbuffer#remaining().- Parameters:
dest- The buffer where data should be transferred.
-
controlTransfer
abstract Integer controlTransfer(Integer requestType, Integer request, Integer value, Integer index, ByteArray buffer, Integer length)
Performs a control transaction on endpoint zero for this device.
- Parameters:
requestType- request type for this transactionrequest- request ID for this transactionvalue- value field for this transactionindex- index field for this transactionbuffer- buffer for data portion of transaction, or null if no data needs to be sent or receivedlength- the length of the data to send or receive
-
resetDevice
abstract Unit resetDevice()
Performs the recovery reset procedure in case the communication is stalled
-
clearFeatureHalt
abstract Unit clearFeatureHalt(UsbEndpoint endpoint)
Attempts to clear the HALT feature from the specified USB endpoint
- Parameters:
endpoint- the USB endpoint to clear the HALT feature from
-
getInEndpoint
abstract UsbEndpoint getInEndpoint()
-
getOutEndpoint
abstract UsbEndpoint getOutEndpoint()
-
getUsbInterface
abstract UsbInterface getUsbInterface()
-
-
-
-