IT. Expert System.

Android Reference

UsbDeviceConnection


android.hardware.usb

Class UsbDeviceConnection

    • Constructor Detail

      • UsbDeviceConnection

        public UsbDeviceConnection(UsbDevice device)
        UsbDevice should only be instantiated by UsbService implementation
    • Method Detail

      • close

        public void close()
        Releases all system resources related to the device. Once the object is closed it cannot be used again. The client must call UsbManager.openDevice(android.hardware.usb.UsbDevice) again to retrieve a new instance to reestablish communication with the device.
      • getFileDescriptor

        public int getFileDescriptor()
        Returns the native file descriptor for the device, or -1 if the device is not opened. This is intended for passing to native code to access the device.
        Returns:
        the native file descriptor
      • getRawDescriptors

        public byte[] getRawDescriptors()
        Returns the raw USB descriptors for the device. This can be used to access descriptors not supported directly via the higher level APIs.
        Returns:
        raw USB descriptors
      • claimInterface

        public boolean claimInterface(UsbInterface intf,
                             boolean force)
        Claims exclusive access to a UsbInterface. This must be done before sending or receiving data on any UsbEndpoints belonging to the interface.
        Parameters:
        intf - the interface to claim
        force - true to disconnect kernel driver if necessary
        Returns:
        true if the interface was successfully claimed
      • releaseInterface

        public boolean releaseInterface(UsbInterface intf)
        Releases exclusive access to a UsbInterface.
        Returns:
        true if the interface was successfully released
      • controlTransfer

        public int controlTransfer(int requestType,
                          int request,
                          int value,
                          int index,
                          byte[] buffer,
                          int length,
                          int timeout)
        Performs a control transaction on endpoint zero for this device. The direction of the transfer is determined by the request type. If requestType & UsbConstants.USB_ENDPOINT_DIR_MASK is UsbConstants.USB_DIR_OUT, then the transfer is a write, and if it is UsbConstants.USB_DIR_IN, then the transfer is a read.
        Parameters:
        requestType - request type for this transaction
        request - request ID for this transaction
        value - value field for this transaction
        index - index field for this transaction
        buffer - buffer for data portion of transaction, or null if no data needs to be sent or received
        length - the length of the data to send or receive
        timeout - in milliseconds
        Returns:
        length of data transferred (or zero) for success, or negative value for failure
      • bulkTransfer

        public int bulkTransfer(UsbEndpoint endpoint,
                       byte[] buffer,
                       int length,
                       int timeout)
        Performs a bulk transaction on the given endpoint. The direction of the transfer is determined by the direction of the endpoint
        Parameters:
        endpoint - the endpoint for this transaction
        buffer - buffer for data to send or receive,
        length - the length of the data to send or receive
        timeout - in milliseconds
        Returns:
        length of data transferred (or zero) for success, or negative value for failure
      • getSerial

        public String getSerial()
        Returns the serial number for the device. This will return null if the device has not been opened.
        Returns:
        the device serial number


Content

Android Reference

Java basics

Java Enterprise Edition (EE)

Java Standard Edition (SE)

SQL

HTML

PHP

CSS

Java Script

MYSQL

JQUERY

VBS

REGEX

C

C++

C#

Design patterns

RFC (standard status)

RFC (proposed standard status)

RFC (draft standard status)

RFC (informational status)

RFC (experimental status)

RFC (best current practice status)

RFC (historic status)

RFC (unknown status)

IT dictionary

License.
All information of this service is derived from the free sources and is provided solely in the form of quotations. This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 154 / 158674407. Delta: 0.04374 с