Class ShadowUsbDeviceConnection

    • Constructor Detail

      • ShadowUsbDeviceConnection

        public ShadowUsbDeviceConnection()
    • Method Detail

      • claimInterface

        @Implementation
        protected boolean claimInterface​(UsbInterface intf,
                                         boolean force)
      • releaseInterface

        @Implementation
        protected boolean releaseInterface​(UsbInterface intf)
      • setInterface

        @Implementation(minSdk=21)
        protected boolean setInterface​(UsbInterface intf)
        No-op on Robolectrict. The real implementation would return false on Robolectric and make it impossible to test callers that expect a successful result. Always returns true.
      • controlTransfer

        @Implementation(minSdk=19)
        protected int controlTransfer​(int requestType,
                                      int request,
                                      int value,
                                      int index,
                                      byte[] buffer,
                                      int length,
                                      int timeout)
      • controlTransfer

        @Implementation(minSdk=19)
        protected int controlTransfer​(int requestType,
                                      int request,
                                      int value,
                                      int index,
                                      byte[] buffer,
                                      int offset,
                                      int length,
                                      int timeout)
      • requestWait

        @Implementation
        protected UsbRequest requestWait()
      • bulkTransfer

        @Implementation(minSdk=18)
        protected int bulkTransfer​(UsbEndpoint endpoint,
                                   byte[] buffer,
                                   int offset,
                                   int length,
                                   int timeout)
      • bulkTransfer

        @Implementation
        protected int bulkTransfer​(UsbEndpoint endpoint,
                                   byte[] buffer,
                                   int length,
                                   int timeout)
      • writeIncomingData

        public void writeIncomingData​(byte[] data)
        Passes data that can then be read by an initialized UsbRequest#queue(ByteBuffer).