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

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

Best Java code snippets using android.hardware.usb.UsbDevice.getDeviceName (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: robolectric/robolectric

/**
 * Adds a USB device into available USB devices map with permission value. If the USB device
 * already exists, updates the USB device with new permission value.
 */
public void addOrUpdateUsbDevice(UsbDevice usbDevice, boolean hasPermission) {
 Preconditions.checkNotNull(usbDevice);
 Preconditions.checkNotNull(usbDevice.getDeviceName());
 usbDevices.put(usbDevice.getDeviceName(), usbDevice);
 if (hasPermission) {
  grantPermission(usbDevice);
 } else {
  revokePermission(usbDevice, RuntimeEnvironment.application.getPackageName());
 }
}
origin: robolectric/robolectric

/** Removes a USB device from available USB devices map. */
public void removeUsbDevice(UsbDevice usbDevice) {
 Preconditions.checkNotNull(usbDevice);
 usbDevices.remove(usbDevice.getDeviceName());
 revokePermission(usbDevice, RuntimeEnvironment.application.getPackageName());
}
origin: square/assertj-android

public UsbDeviceAssert hasDeviceName(String name) {
 isNotNull();
 String actualName = actual.getDeviceName();
 assertThat(actualName) //
   .overridingErrorMessage("Expected device name <%s> but was <%s>.", name, actualName) //
   .isEqualTo(name);
 return this;
}
origin: robolectric/robolectric

@Before
public void setUp() {
 MockitoAnnotations.initMocks(this);
 usbManager =
   (UsbManager)
     ApplicationProvider.getApplicationContext().getSystemService(Context.USB_SERVICE);
 when(usbDevice1.getDeviceName()).thenReturn(DEVICE_NAME_1);
 when(usbDevice2.getDeviceName()).thenReturn(DEVICE_NAME_2);
}
origin: stackoverflow.com

public OpenDevice openDevice(UsbDevice device) {
   UsbDeviceConnection connection = mUsbManager.openDevice(device);
   Log.i("USB","Device name="+device.getDeviceName());
   int bus = getBusNumber(device.getDeviceName());
   int address = getAddress(device.getDeviceName());
   return new OpenDevice(device, connection, bus, address);
 }
origin: grzegorznittner/chanu

/**
 * Retrieves an {@link android.mtp.MtpDevice} object for the USB device
 * with the given ID.
 *
 * @param id the ID of the USB device
 * @return the MtpDevice, or null if it does not exist
 */
public MtpDevice getDevice(int id) {
  synchronized (mDevices) {
    return mDevices.get(UsbDevice.getDeviceName(id));
  }
}
origin: kshoji/USB-MIDI-Driver

/**
 * Get the device name(linux device path)
 *
 * @return the device name(linux device path)
 */
@NonNull
public String getDeviceAddress() {
  return usbDevice.getDeviceName();
}
origin: stackoverflow.com

 @Override
protected void onResume() {
  super.onResume();

  Intent intent = getIntent();
  if (intent != null) {
    Log.d("onResume", "intent: " + intent.toString());
    if (intent.getAction().equals(UsbManager.ACTION_USB_DEVICE_ATTACHED)) {
      UsbDevice usbDevice = intent.getParcelableExtra(UsbManager.EXTRA_DEVICE);
      if (usbDevice != null) {
        Log.d("onResume", "USB device attached: name: " + usbDevice.getDeviceName());
origin: jamorham/xDrip-plus

@Override
public String toString() {
  return String.format("<%s device_name=%s device_id=%s port_number=%s>",
      getClass().getSimpleName(), mDevice.getDeviceName(),
      mDevice.getDeviceId(), mPortNumber);
}
origin: NightscoutFoundation/xDrip

@Override
public String toString() {
  return String.format("<%s device_name=%s device_id=%s port_number=%s>",
      getClass().getSimpleName(), mDevice.getDeviceName(),
      mDevice.getDeviceId(), mPortNumber);
}
origin: com.squareup.assertj/assertj-android

public UsbDeviceAssert hasDeviceName(String name) {
 isNotNull();
 String actualName = actual.getDeviceName();
 assertThat(actualName) //
   .overridingErrorMessage("Expected device name <%s> but was <%s>.", name, actualName) //
   .isEqualTo(name);
 return this;
}
origin: org.robolectric/shadows-framework

/** Removes a USB device from available USB devices map. */
public void removeUsbDevice(UsbDevice usbDevice) {
 Preconditions.checkNotNull(usbDevice);
 usbDevices.remove(usbDevice.getDeviceName());
 revokePermission(usbDevice, RuntimeEnvironment.application.getPackageName());
}
origin: kshoji/USB-MIDI-Driver

@Override
public void onMidiSystemExclusive(@NonNull final MidiInputDevice sender, int cable, final byte[] systemExclusive) {
  midiInputEventHandler.sendMessage(Message.obtain(midiInputEventHandler, 0, "SystemExclusive from: " + sender.getUsbDevice().getDeviceName() + ", cable: " + cable + ", data:" + Arrays.toString(systemExclusive)));
  if (thruToggleButton != null && thruToggleButton.isChecked() && getMidiOutputDeviceFromSpinner() != null) {
    getMidiOutputDeviceFromSpinner().sendMidiSystemExclusive(cable, systemExclusive);
    midiOutputEventHandler.sendMessage(Message.obtain(midiOutputEventHandler, 0, "SystemExclusive from: " + sender.getUsbDevice().getDeviceName() + ", cable: " + cable + ", data:" + Arrays.toString(systemExclusive)));
  }
}
origin: kshoji/USB-MIDI-Driver

@Override
public void onMidiPitchWheel(@NonNull final MidiInputDevice sender, int cable, int channel, int amount) {
  midiInputEventHandler.sendMessage(Message.obtain(midiInputEventHandler, 0, "PitchWheel from: " + sender.getUsbDevice().getDeviceName() + ", cable: " + cable + ", channel: " + channel + ", amount: " + amount));
  if (thruToggleButton != null && thruToggleButton.isChecked() && getMidiOutputDeviceFromSpinner() != null) {
    getMidiOutputDeviceFromSpinner().sendMidiPitchWheel(cable, channel, amount);
    midiOutputEventHandler.sendMessage(Message.obtain(midiOutputEventHandler, 0, "PitchWheel from: " + sender.getUsbDevice().getDeviceName() + ", cable: " + cable + ", channel: " + channel + ", amount: " + amount));
  }
}
origin: kshoji/USB-MIDI-Driver

@Override
public void onMidiPolyphonicAftertouch(@NonNull final MidiInputDevice sender, int cable, int channel, int note, int pressure) {
  midiInputEventHandler.sendMessage(Message.obtain(midiInputEventHandler, 0, "PolyphonicAftertouch from: " + sender.getUsbDevice().getDeviceName() + ", cable: " + cable + ", channel: " + channel + ", note: " + note + ", pressure: " + pressure));
  if (thruToggleButton != null && thruToggleButton.isChecked() && getMidiOutputDeviceFromSpinner() != null) {
    getMidiOutputDeviceFromSpinner().sendMidiPolyphonicAftertouch(cable, channel, note, pressure);
    midiOutputEventHandler.sendMessage(Message.obtain(midiOutputEventHandler, 0, "PolyphonicAftertouch from: " + sender.getUsbDevice().getDeviceName() + ", cable: " + cable + ", channel: " + channel + ", note: " + note + ", pressure: " + pressure));
  }
}
origin: kshoji/USB-MIDI-Driver

@Override
public void onMidiMiscellaneousFunctionCodes(@NonNull final MidiInputDevice sender, int cable, int byte1, int byte2, int byte3) {
  midiInputEventHandler.sendMessage(Message.obtain(midiInputEventHandler, 0, "MiscellaneousFunctionCodes from: " + sender.getUsbDevice().getDeviceName() + ", cable: " + cable + ", byte1: " + byte1 + ", byte2: " + byte2 + ", byte3: " + byte3));
  if (thruToggleButton != null && thruToggleButton.isChecked() && getMidiOutputDeviceFromSpinner() != null) {
    getMidiOutputDeviceFromSpinner().sendMidiMiscellaneousFunctionCodes(cable, byte1, byte2, byte3);
    midiOutputEventHandler.sendMessage(Message.obtain(midiOutputEventHandler, 0, "MiscellaneousFunctionCodes from: " + sender.getUsbDevice().getDeviceName() + ", cable: " + cable + ", byte1: " + byte1 + ", byte2: " + byte2 + ", byte3: " + byte3));
  }
}
origin: kshoji/USB-MIDI-Driver

@Override
public void onMidiMiscellaneousFunctionCodes(@NonNull final MidiInputDevice sender, int cable, int byte1, int byte2, int byte3) {
  midiInputEventHandler.sendMessage(Message.obtain(midiInputEventHandler, 0, "MiscellaneousFunctionCodes from: " + sender.getUsbDevice().getDeviceName() + ", cable: " + cable + ", byte1: " + byte1 + ", byte2: " + byte2 + ", byte3: " + byte3));
  if (thruToggleButton != null && thruToggleButton.isChecked() && getMidiOutputDeviceFromSpinner() != null) {
    getMidiOutputDeviceFromSpinner().sendMidiMiscellaneousFunctionCodes(cable, byte1, byte2, byte3);
    midiOutputEventHandler.sendMessage(Message.obtain(midiOutputEventHandler, 0, "MiscellaneousFunctionCodes from: " + sender.getUsbDevice().getDeviceName() + ", cable: " + cable + ", byte1: " + byte1 + ", byte2: " + byte2 + ", byte3: " + byte3));
  }
}
origin: kshoji/USB-MIDI-Driver

@Override
public void onMidiControlChange(@NonNull final MidiInputDevice sender, int cable, int channel, int function, int value) {
  midiInputEventHandler.sendMessage(Message.obtain(midiInputEventHandler, 0, "ControlChange from: " + sender.getUsbDevice().getDeviceName() + ", cable: " + cable + ", channel: " + channel + ", function: " + function + ", value: " + value));
  if (thruToggleButton != null && thruToggleButton.isChecked() && getMidiOutputDeviceFromSpinner() != null) {
    getMidiOutputDeviceFromSpinner().sendMidiControlChange(cable, channel, function, value);
    midiOutputEventHandler.sendMessage(Message.obtain(midiOutputEventHandler, 0, "ControlChange from: " + sender.getUsbDevice().getDeviceName() + ", cable: " + cable + ", channel: " + channel + ", function: " + function + ", value: " + value));
  }
}
origin: grzegorznittner/chanu

  public BitmapRegionDecoder run(JobContext jc) {
    byte[] bytes = mMtpContext.getMtpClient().getObject(
        UsbDevice.getDeviceName(mDeviceId), mObjectId, mObjectSize);
    return DecodeUtils.requestCreateBitmapRegionDecoder(
        jc, bytes, 0, bytes.length, false);
  }
};
origin: kshoji/USB-MIDI-Driver

@Override
public void onMidiOutputDeviceAttached(@NonNull final MidiOutputDevice midiOutputDevice) {
  if (connectedDevicesAdapter != null) {
    connectedDevicesAdapter.remove(midiOutputDevice.getUsbDevice());
    connectedDevicesAdapter.add(midiOutputDevice.getUsbDevice());
    connectedDevicesAdapter.notifyDataSetChanged();
  }
  Toast.makeText(MIDIDriverMultipleSampleActivity.this, "USB MIDI Device " + midiOutputDevice.getUsbDevice().getDeviceName() + " has been attached.", Toast.LENGTH_LONG).show();
}
android.hardware.usbUsbDevicegetDeviceName

Popular methods of UsbDevice

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

Popular in Java

  • Creating JSON documents from java classes using gson
  • setScale (BigDecimal)
  • scheduleAtFixedRate (Timer)
    Schedules the specified task for repeated fixed-rate execution, beginning after the specified delay.
  • getSharedPreferences (Context)
  • Point (java.awt)
    A point representing a location in (x, y) coordinate space, specified in integer precision.
  • InputStreamReader (java.io)
    An InputStreamReader is a bridge from byte streams to character streams: It reads bytes and decodes
  • OutputStream (java.io)
    A writable sink for bytes.Most clients will use output streams that write data to the file system (
  • MessageFormat (java.text)
    MessageFormat provides a means to produce concatenated messages in language-neutral way. Use this to
  • TimeUnit (java.util.concurrent)
    A TimeUnit represents time durations at a given unit of granularity and provides utility methods to
  • JFileChooser (javax.swing)
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