Codota Logo
UsbDevice.getProductId
Code IndexAdd Codota to your IDE (free)

How to use
getProductId
method
in
android.hardware.usb.UsbDevice

Best Java code snippets using android.hardware.usb.UsbDevice.getProductId (Showing top 20 results out of 315)

  • Common ways to obtain UsbDevice
private void myMethod () {
UsbDevice u =
  • Codota IconIntent intent;String name;intent.getParcelableExtra(name)
  • Codota IconIntent intent;String name;(UsbDevice) intent.getParcelableExtra(name)
  • Smart code suggestions by Codota
}
origin: square/assertj-android

public UsbDeviceAssert hasProductId(int id) {
 isNotNull();
 int actualId = actual.getProductId();
 assertThat(actualId) //
   .overridingErrorMessage("Expected product ID <%s> but was <%s>.", id, actualId) //
   .isEqualTo(id);
 return this;
}
origin: fossasia/pslab-android

public CommunicationHandler(UsbManager usbManager) {
  this.mUsbManager = usbManager;
  mUsbDevice = null;
  for (final UsbDevice device : mUsbManager.getDeviceList().values()) {
    Log.d(TAG, "VID : " + device.getVendorId() + "PID : " + device.getProductId());
    if (device.getVendorId() == PSLAB_VENDOR_ID && device.getProductId() == PSLAB_PRODUCT_ID) {
      Log.d(TAG, "Found PSLAB Device");
      mUsbDevice = device;
      device_found = true;
      break;
    }
  }
  mReadBuffer = new byte[DEFAULT_READ_BUFFER_SIZE];
  mWriteBuffer = new byte[DEFAULT_WRITE_BUFFER_SIZE];
}
origin: felHR85/UsbSerial

public int getPid(){
  return device.getProductId();
}
origin: google/walt

@Override
protected boolean isCompatibleUsbDevice(UsbDevice usbDevice) {
  // Allow any Teensy, but not in HalfKay bootloader mode
  // Teensy PID depends on mode (e.g: Serail + MIDI) and also changed in TeensyDuino 1.31
  return ((usbDevice.getProductId() != HALFKAY_PID) &&
      (usbDevice.getVendorId() == TEENSY_VID));
}
origin: google/walt

@Override
protected boolean isCompatibleUsbDevice(UsbDevice usbDevice) {
  return ((usbDevice.getProductId() == HALFKAY_PID) &&
      (usbDevice.getVendorId() == HALFKAY_VID));
}
origin: bitcraze/crazyflie-android-client

public static boolean isUsbDevice(UsbDevice usbDevice, int vid, int pid) {
  return usbDevice.getVendorId() == vid && usbDevice.getProductId() == pid;
}
origin: felHR85/UsbSerial

private void requestUserPermission() {
  Log.d(TAG, String.format("requestUserPermission(%X:%X)", device.getVendorId(), device.getProductId() ) );
  PendingIntent mPendingIntent = PendingIntent.getBroadcast(this, 0, new Intent(ACTION_USB_PERMISSION), 0);
  usbManager.requestPermission(device, mPendingIntent);
}
origin: felHR85/UsbSerial

private void requestUserPermission() {
  Log.d(TAG, String.format("requestUserPermission(%X:%X)", device.getVendorId(), device.getProductId() ) );
  PendingIntent mPendingIntent = PendingIntent.getBroadcast(this, 0, new Intent(ACTION_USB_PERMISSION), 0);
  usbManager.requestPermission(device, mPendingIntent);
}
origin: felHR85/UsbSerial

private void requestUserPermission() {
  Log.d(TAG, String.format("requestUserPermission(%X:%X)", device.getVendorId(), device.getProductId() ) );
  PendingIntent mPendingIntent = PendingIntent.getBroadcast(this, 0, new Intent(ACTION_USB_PERMISSION), 0);
  usbManager.requestPermission(device, mPendingIntent);
}
origin: bitcraze/crazyflie-android-client

public static List<UsbDevice> findUsbDevices(UsbManager usbManager, int vendorId, int productId) {
  List<UsbDevice> usbDeviceList = new ArrayList<UsbDevice>();
  if (usbManager != null) {
    HashMap<String, UsbDevice> deviceList = usbManager.getDeviceList();
    // Iterate over USB devices
    for (Entry<String, UsbDevice> e : deviceList.entrySet()) {
      Log.i(LOG_TAG, "String: " + e.getKey() + " " + e.getValue().getVendorId() + " " + e.getValue().getProductId());
      UsbDevice device = e.getValue();
      if (device.getVendorId() == vendorId && device.getProductId() == productId) {
        usbDeviceList.add(device);
      }
    }
  }
  return usbDeviceList;
}
origin: com.squareup.assertj/assertj-android

public UsbDeviceAssert hasProductId(int id) {
 isNotNull();
 int actualId = actual.getProductId();
 assertThat(actualId) //
   .overridingErrorMessage("Expected product ID <%s> but was <%s>.", id, actualId) //
   .isEqualTo(id);
 return this;
}
origin: openxc/openxc-android

private UsbDevice findDevice(UsbManager manager, int vendorId,
    int productId) throws DataSourceResourceException {
  Log.d(TAG, "Looking for USB device with vendor ID " + vendorId +
      " and product ID " + productId);
  for(UsbDevice candidateDevice : manager.getDeviceList().values()) {
    if(candidateDevice.getVendorId() == vendorId
        && candidateDevice.getProductId() == productId) {
      Log.d(TAG, "Found USB device " + candidateDevice);
      return candidateDevice;
    }
  }
  throw new DataSourceResourceException("USB device with vendor " +
      "ID " + vendorId + " and product ID " + productId +
      " not found");
}
origin: DeviceConnect/DeviceConnect-Android

/**
 * Delete HVC-P Device.
 * @param device device
 */
public void removeUSBDevice(final UsbDevice device) {
  HVCCameraInfo camera = mServices.remove("" + device.getDeviceId() + "_" + device.getProductId() + "_" + device.getVendorId());
  if (camera != null) {
    // デバイスとの接続切断を通知.
    notifyOnDisconnected(camera);
  }
}
origin: jamorham/xDrip-plus

public static UsbDevice getUsbDevice(final int vendorId, final int productId, final String search) {
  final UsbManager manager = (UsbManager) xdrip.getAppContext().getSystemService(Context.USB_SERVICE);
  if (manager == null) return null;
  final HashMap<String, UsbDevice> deviceList = manager.getDeviceList();
  for (Map.Entry<String, UsbDevice> entry : deviceList.entrySet()) {
    final UsbDevice device = entry.getValue();
    if (device.getVendorId() == vendorId && device.getProductId() == productId
        && device.toString().contains(search)) {
      Log.d(TAG, "Found device: " + entry.getKey() + " " + device.toString());
      return device;
    }
  }
  return null;
}
origin: NightscoutFoundation/xDrip

public static UsbDevice getUsbDevice(final int vendorId, final int productId, final String search) {
  final UsbManager manager = (UsbManager) xdrip.getAppContext().getSystemService(Context.USB_SERVICE);
  if (manager == null) return null;
  final HashMap<String, UsbDevice> deviceList = manager.getDeviceList();
  for (Map.Entry<String, UsbDevice> entry : deviceList.entrySet()) {
    final UsbDevice device = entry.getValue();
    if (device.getVendorId() == vendorId && device.getProductId() == productId
        && device.toString().contains(search)) {
      Log.d(TAG, "Found device: " + entry.getKey() + " " + device.toString());
      return device;
    }
  }
  return null;
}
origin: felHR85/UsbSerial

public static UsbSpiDevice createUsbSerialDevice(UsbDevice device, UsbDeviceConnection connection, int iface)
{
  int vid = device.getVendorId();
  int pid = device.getProductId();
  if(CP2130Ids.isDeviceSupported(vid, pid))
    return new CP2130SpiDevice(device, connection, iface);
  else
    return null;
}
origin: SachinVin/citra_android

public static boolean QueryAdapter()
{
 HashMap<String, UsbDevice> devices = manager.getDeviceList();
 for (Map.Entry<String, UsbDevice> pair : devices.entrySet())
 {
  UsbDevice dev = pair.getValue();
  if (dev.getProductId() == 0x0337 && dev.getVendorId() == 0x057e)
  {
   if (manager.hasPermission(dev))
    return true;
   else
    RequestPermission();
  }
 }
 return false;
}
origin: SachinVin/citra_android

public static boolean QueryAdapter()
{
 HashMap<String, UsbDevice> devices = manager.getDeviceList();
 for (Map.Entry<String, UsbDevice> pair : devices.entrySet())
 {
  UsbDevice dev = pair.getValue();
  if (dev.getProductId() == NINTENDO_WIIMOTE_PRODUCT_ID &&
      dev.getVendorId() == NINTENDO_VENDOR_ID)
  {
   if (manager.hasPermission(dev))
    return true;
   else
    RequestPermission();
  }
 }
 return false;
}
origin: nettoyeurny/btmidi

/**
 * Constructor for default instances of DeviceInfo, populated with numerical IDs rather than
 * human-readable names.
 */
public DeviceInfo(UsbDevice device) {
 this(asFourDigitHex(device.getVendorId()), asFourDigitHex(device.getProductId()));
}
origin: felHR85/UsbSerial

public static boolean isSupported(UsbDevice device)
{
  int vid = device.getVendorId();
  int pid = device.getProductId();
  if(FTDISioIds.isDeviceSupported(vid, pid))
    return true;
  else if(CP210xIds.isDeviceSupported(vid, pid))
    return true;
  else if(PL2303Ids.isDeviceSupported(vid, pid))
    return true;
  else if(CH34xIds.isDeviceSupported(vid, pid))
    return true;
  else if(isCdcDevice(device))
    return true;
  else
    return false;
}
android.hardware.usbUsbDevicegetProductId

Popular methods of UsbDevice

  • getVendorId
  • getDeviceName
  • getInterfaceCount
  • getInterface
  • getDeviceClass
  • getDeviceId
  • getDeviceSubclass
  • getDeviceProtocol
  • equals
  • getProductName
  • getManufacturerName
  • toString
  • getManufacturerName,
  • toString,
  • getConfiguration,
  • getConfigurationCount

Popular in Java

  • Finding current android device location
  • onRequestPermissionsResult (Fragment)
  • scheduleAtFixedRate (ScheduledExecutorService)
    Creates and executes a periodic action that becomes enabled first after the given initial delay, and
  • getContentResolver (Context)
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • Menu (java.awt)
  • InputStreamReader (java.io)
    An InputStreamReader is a bridge from byte streams to character streams: It reads bytes and decodes
  • URLEncoder (java.net)
    This class is used to encode a string using the format required by application/x-www-form-urlencoded
  • LinkedList (java.util)
    Doubly-linked list implementation of the List and Dequeinterfaces. Implements all optional list oper
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now