Android APIs
public final class

MidiDeviceInfo

extends Object
implements Parcelable
java.lang.Object
   ↳ android.media.midi.MidiDeviceInfo

Class Overview

This class contains information to describe a MIDI device. For now we only have information that can be retrieved easily for USB devices, but we will probably expand this in the future. This class is just an immutable object to encapsulate the MIDI device description. Use the MidiDevice class to actually communicate with devices.

Summary

Nested Classes
class MidiDeviceInfo.PortInfo Contains information about an input or output port. 
Constants
String PROPERTY_BLUETOOTH_DEVICE Bundle key for the device's corresponding Bluetooth device.
String PROPERTY_MANUFACTURER Bundle key for the device's manufacturer name property.
String PROPERTY_NAME Bundle key for the device's user visible name property.
String PROPERTY_PRODUCT Bundle key for the device's product name property.
String PROPERTY_SERIAL_NUMBER Bundle key for the device's serial number property.
String PROPERTY_USB_DEVICE Bundle key for the device's corresponding USB device.
String PROPERTY_VERSION Bundle key for the device's version property.
int TYPE_BLUETOOTH Constant representing Bluetooth MIDI devices for getType()
int TYPE_USB Constant representing USB MIDI devices for getType()
int TYPE_VIRTUAL Constant representing virtual (software based) MIDI devices for getType()
[Expand]
Inherited Constants
From interface android.os.Parcelable
Fields
public static final Creator<MidiDeviceInfo> CREATOR
Public Methods
int describeContents()
Describe the kinds of special objects contained in this Parcelable's marshalled representation.
boolean equals(Object o)
Compares this instance with the specified object and indicates if they are equal.
int getId()
Returns the ID of the device.
int getInputPortCount()
Returns the device's number of input ports.
int getOutputPortCount()
Returns the device's number of output ports.
PortInfo[] getPorts()
Returns information about the device's ports.
Bundle getProperties()
Returns the Bundle containing the device's properties.
int getType()
Returns the type of the device.
int hashCode()
Returns an integer hash code for this object.
boolean isPrivate()
Returns true if the device is private.
String toString()
Returns a string containing a concise, human-readable description of this object.
void writeToParcel(Parcel parcel, int flags)
Flatten this object in to a Parcel.
[Expand]
Inherited Methods
From class java.lang.Object
From interface android.os.Parcelable

Constants

public static final String PROPERTY_BLUETOOTH_DEVICE

Added in API level 23

Bundle key for the device's corresponding Bluetooth device. The value for this property is of type BluetoothDevice. Only set for Bluetooth MIDI devices. Used with the Bundle returned by getProperties()

Constant Value: "bluetooth_device"

public static final String PROPERTY_MANUFACTURER

Added in API level 23

Bundle key for the device's manufacturer name property. The value for this property is of type String. Used with the Bundle returned by getProperties(). Matches the USB device manufacturer name string for USB MIDI devices.

Constant Value: "manufacturer"

public static final String PROPERTY_NAME

Added in API level 23

Bundle key for the device's user visible name property. The value for this property is of type String. Used with the Bundle returned by getProperties(). For USB devices, this is a concatenation of the manufacturer and product names.

Constant Value: "name"

public static final String PROPERTY_PRODUCT

Added in API level 23

Bundle key for the device's product name property. The value for this property is of type String. Used with the Bundle returned by getProperties() Matches the USB device product name string for USB MIDI devices.

Constant Value: "product"

public static final String PROPERTY_SERIAL_NUMBER

Added in API level 23

Bundle key for the device's serial number property. The value for this property is of type String. Used with the Bundle returned by getProperties() Matches the USB device serial number for USB MIDI devices.

Constant Value: "serial_number"

public static final String PROPERTY_USB_DEVICE

Added in API level 23

Bundle key for the device's corresponding USB device. The value for this property is of type UsbDevice. Only set for USB MIDI devices. Used with the Bundle returned by getProperties()

Constant Value: "usb_device"

public static final String PROPERTY_VERSION

Added in API level 23

Bundle key for the device's version property. The value for this property is of type String. Used with the Bundle returned by getProperties() Matches the USB device version number for USB MIDI devices.

Constant Value: "version"

public static final int TYPE_BLUETOOTH

Added in API level 23

Constant representing Bluetooth MIDI devices for getType()

Constant Value: 3 (0x00000003)

public static final int TYPE_USB

Added in API level 23

Constant representing USB MIDI devices for getType()

Constant Value: 1 (0x00000001)

public static final int TYPE_VIRTUAL

Added in API level 23

Constant representing virtual (software based) MIDI devices for getType()

Constant Value: 2 (0x00000002)

Fields

public static final Creator<MidiDeviceInfo> CREATOR

Added in API level 23

Public Methods

public int describeContents ()

Added in API level 23

Describe the kinds of special objects contained in this Parcelable's marshalled representation.

Returns
  • a bitmask indicating the set of special object types marshalled by the Parcelable.

public boolean equals (Object o)

Added in API level 23

Compares this instance with the specified object and indicates if they are equal. In order to be equal, o must represent the same object as this instance using a class-specific comparison. The general contract is that this comparison should be reflexive, symmetric, and transitive. Also, no object reference other than null is equal to null.

The default implementation returns true only if this == o. See Writing a correct equals method if you intend implementing your own equals method.

The general contract for the equals and hashCode() methods is that if equals returns true for any two objects, then hashCode() must return the same value for these objects. This means that subclasses of Object usually override either both methods or neither of them.

Parameters
o the object to compare this instance with.
Returns
  • true if the specified object is equal to this Object; false otherwise.

public int getId ()

Added in API level 23

Returns the ID of the device. This ID is generated by the MIDI service and is not persistent across device unplugs.

Returns
  • the device's ID

public int getInputPortCount ()

Added in API level 23

Returns the device's number of input ports.

Returns
  • the number of input ports

public int getOutputPortCount ()

Added in API level 23

Returns the device's number of output ports.

Returns
  • the number of output ports

public PortInfo[] getPorts ()

Added in API level 23

Returns information about the device's ports. The ports are in unspecified order.

Returns

public Bundle getProperties ()

Added in API level 23

Returns the Bundle containing the device's properties.

Returns
  • the device's properties

public int getType ()

Added in API level 23

Returns the type of the device.

Returns
  • the device's type

public int hashCode ()

Added in API level 23

Returns an integer hash code for this object. By contract, any two objects for which equals(Object) returns true must return the same hash code value. This means that subclasses of Object usually override both methods or neither method.

Note that hash values must not change over time unless information used in equals comparisons also changes.

See Writing a correct hashCode method if you intend implementing your own hashCode method.

Returns
  • this object's hash code.

public boolean isPrivate ()

Added in API level 23

Returns true if the device is private. Private devices are only visible and accessible to clients with the same UID as the application that is hosting the device.

Returns
  • true if the device is private

public String toString ()

Added in API level 23

Returns a string containing a concise, human-readable description of this object. Subclasses are encouraged to override this method and provide an implementation that takes into account the object's type and data. The default implementation is equivalent to the following expression:

   getClass().getName() + '@' + Integer.toHexString(hashCode())

See Writing a useful toString method if you intend implementing your own toString method.

Returns
  • a printable representation of this object.

public void writeToParcel (Parcel parcel, int flags)

Added in API level 23

Flatten this object in to a Parcel.

Parameters
parcel The Parcel in which the object should be written.
flags Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE.