Tabnine Logo
UsbDevice.getProductId
Code IndexAdd Tabnine 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)

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

  • Start an intent from android
  • scheduleAtFixedRate (Timer)
  • compareTo (BigDecimal)
  • startActivity (Activity)
  • Kernel (java.awt.image)
  • Timer (java.util)
    Timers schedule one-shot or recurring TimerTask for execution. Prefer java.util.concurrent.Scheduled
  • Modifier (javassist)
    The Modifier class provides static methods and constants to decode class and member access modifiers
  • JTextField (javax.swing)
  • Get (org.apache.hadoop.hbase.client)
    Used to perform Get operations on a single row. To get everything for a row, instantiate a Get objec
  • Location (org.springframework.beans.factory.parsing)
    Class that models an arbitrary location in a Resource.Typically used to track the location of proble
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now