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

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

Best Java code snippets using android.hardware.usb.UsbDevice.equals (Showing top 9 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: nettoyeurny/btmidi

/**
 * Checks whether a given USB device equals the device wrapped by this instance; useful for
 * checking whether {@link UsbBroadcastHandler} callbacks are for a particular instance of
 * UsbDeviceWithInfo.
 * 
 * @param otherDevice to compare this device to
 * @return true if otherDevice equals the USB device wrapped by this instance
 */
public boolean matches(UsbDevice otherDevice) {
 return this.device.equals(otherDevice);
}
origin: jwoolston/Android-Webcam

  @Override
  public void onReceive(Context context, Intent intent) {
    if (webcam == null) {
      return;
    }
    final UsbDevice usbDevice = intent.getParcelableExtra(UsbManager.EXTRA_DEVICE);
    if (usbDevice.equals(webcam.getDevice())) {
      Timber.d("Active Webcam detached. Terminating connection.");
      stopStreaming();
    }
  }
};
origin: kshoji/USB-MIDI-Driver

/**
 * Get MIDI output device for specified UsbDevice, if available.
 *
 * @param usbDevice the UsbDevice
 * @return {@link Set<MidiOutputDevice>}
 */
@NonNull
public final Set<MidiOutputDevice> getMidiOutputDevices(@NonNull UsbDevice usbDevice) {
  if (deviceConnectionWatcher != null) {
    deviceConnectionWatcher.checkConnectedDevicesImmediately();
  }
  Set<MidiOutputDevice> result = new HashSet<>();
  for (MidiOutputDevice midiOutputDevice : midiOutputDevices) {
    if (midiOutputDevice.getUsbDevice().equals(usbDevice)) {
      result.add(midiOutputDevice);
    }
  }
  return Collections.unmodifiableSet(result);
}
origin: gigabytedevelopers/FireFiles

private void detachDevice(UsbDevice usbDevice) {
  for (Map.Entry<String, UsbPartition> root : mRoots.entrySet()) {
    if (root.getValue().device.equals(usbDevice)) {
      Log.d(TAG, "remove rootId " + root.getKey());
      mRoots.remove(root.getKey());
      mFileCache.evictAll();
      notifyRootsChanged();
      break;
    }
  }
}
origin: google/walt

  @Override
  public void onReceive(Context context, Intent intent) {
    UsbDevice usbDevice = intent.getParcelableExtra(UsbManager.EXTRA_DEVICE);
    if (isConnected() && BaseUsbConnection.this.usbDevice.equals(usbDevice)) {
      logger.log("WALT was detached");
      disconnect();
    }
  }
};
origin: kshoji/USB-MIDI-Driver

if (device.equals(grantingDevice)) {
origin: google/walt

  @Override
  public void onReceive(Context context, Intent intent) {
    if (usbDevice == null) {
      logger.log("USB device was not properly opened");
      return;
    }
    if(intent.getBooleanExtra(UsbManager.EXTRA_PERMISSION_GRANTED, false) &&
        usbDevice.equals(intent.getParcelableExtra(UsbManager.EXTRA_DEVICE))){
      usbConnection = usbManager.openDevice(usbDevice);
      BaseUsbConnection.this.context.registerReceiver(disconnectReceiver,
          new IntentFilter(UsbManager.ACTION_USB_DEVICE_DETACHED));
      onConnect();
      broadcastManager.sendBroadcast(new Intent(getConnectIntent()));
    } else {
      logger.log("Could not get permission to open the USB device");
    }
    BaseUsbConnection.this.context.unregisterReceiver(respondToUsbPermission);
  }
};
origin: TeamWalrus/Walrus

private void handleUsbDeviceDetached(Context context, UsbDevice usbDevice) {
  Iterator<Map.Entry<Integer, CardDevice>> it = cardDevices.entrySet().iterator();
  while (it.hasNext()) {
    final CardDevice cardDevice = it.next().getValue();
    if (!(cardDevice instanceof UsbCardDevice)) {
      continue;
    }
    UsbCardDevice usbCardDevice = (UsbCardDevice) cardDevice;
    if (!usbCardDevice.getUsbDevice().equals(usbDevice)) {
      continue;
    }
    it.remove();
    usbCardDevice.close();
    Intent broadcastIntent = new Intent(ACTION_UPDATE);
    broadcastIntent.putExtra(EXTRA_DEVICE_WAS_ADDED, false);
    broadcastIntent.putExtra(EXTRA_DEVICE_NAME,
        cardDevice.getClass().getAnnotation(UsbCardDevice.Metadata.class).name());
    LocalBroadcastManager.getInstance(context).sendBroadcast(broadcastIntent);
    new Handler(context.getMainLooper()).post(new Runnable() {
      @Override
      public void run() {
        // noinspection StatementWithEmptyBody
        while (cardDevices.values().remove(cardDevice)) {
        }
      }
    });
    break;
  }
  seenUsbDevices.remove(usbDevice);
}
origin: gigabytedevelopers/FireFiles

private void discoverDevice(UsbDevice device) {
  for (UsbMassStorageDevice massStorageDevice : UsbMassStorageDevice.getMassStorageDevices(getContext())) {
    if (device.equals(massStorageDevice.getUsbDevice())) {
      if (hasPermission(device)) {
        addRoot(massStorageDevice);
      } else {
        requestPermission(device);
      }
    }
  }
}
android.hardware.usbUsbDeviceequals

Popular methods of UsbDevice

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

Popular in Java

  • Updating database using SQL prepared statement
  • getSystemService (Context)
  • onRequestPermissionsResult (Fragment)
  • getSupportFragmentManager (FragmentActivity)
    Return the FragmentManager for interacting with fragments associated with this activity.
  • GridBagLayout (java.awt)
    The GridBagLayout class is a flexible layout manager that aligns components vertically and horizonta
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • DataSource (javax.sql)
    A factory for connections to the physical data source that this DataSource object represents. An alt
  • DateTimeFormat (org.joda.time.format)
    Factory that creates instances of DateTimeFormatter from patterns and styles. Datetime formatting i
  • Logger (org.slf4j)
    The main user interface to logging. It is expected that logging takes place through concrete impleme
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