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

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
  • onCreateOptionsMenu (Activity)
  • requestLocationUpdates (LocationManager)
  • getSupportFragmentManager (FragmentActivity)
  • VirtualMachine (com.sun.tools.attach)
    A Java virtual machine. A VirtualMachine represents a Java virtual machine to which this Java vir
  • FileInputStream (java.io)
    An input stream that reads bytes from a file. File file = ...finally if (in != null) in.clos
  • ServerSocket (java.net)
    This class represents a server-side socket that waits for incoming client connections. A ServerSocke
  • Enumeration (java.util)
    A legacy iteration interface.New code should use Iterator instead. Iterator replaces the enumeration
  • LinkedList (java.util)
    Doubly-linked list implementation of the List and Dequeinterfaces. Implements all optional list oper
  • TreeSet (java.util)
    TreeSet is an implementation of SortedSet. All optional operations (adding and removing) are support
  • From CI to AI: The AI layer in your organization
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