From 3cc1bdbc6efdb268be16e7184709eeb4ecf9b944 Mon Sep 17 00:00:00 2001 From: Phil Burk Date: Wed, 29 Jul 2015 15:04:32 -0700 Subject: MIDI docs BTLE: how to open BTLE MIDI devices Adds crucial information including required permissions, MIDI UUID, and call to openBluetoothDevice(). Bug: 22606182 Change-Id: I47393bd0ecc2601906f6e50075d694c9cc17c993 Signed-off-by: Phil Burk --- media/java/android/media/midi/package.html | 51 +++++++++++++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) (limited to 'media') diff --git a/media/java/android/media/midi/package.html b/media/java/android/media/midi/package.html index 673c4ba..9750880 100644 --- a/media/java/android/media/midi/package.html +++ b/media/java/android/media/midi/package.html @@ -31,7 +31,7 @@ capabilities, etc.
  • Timestamps to avoid jitter.
  • Support creation of virtual MIDI devices that can be connected to other devices. An example might be a synthesizer app that can be controlled by a composing app.
  • -
  • Support direction connection or “patching” of devices for lower latency.
  • +
  • Support direct connection or “patching” of devices for lower latency.
  • Transports Supported

    @@ -338,5 +338,54 @@ public class MidiSynthDeviceService extends MidiDeviceService { } } + +

    Using MIDI Over Bluetooth LE

    + +

    MIDI devices can be connected to Android using Bluetooth LE.

    + +

    Before using the device, the app must scan for available BTLE devices and then allow +the user to connect. An example program +will be provided so look for it on the Android developer website.

    + +

    Request Location Permission for BTLE

    + +

    Applications that scan for Bluetooth devices must request permission in the +manifest file. This LOCATION permission is required because it may be possible to +guess the location of an Android device by seeing which BTLE devices are nearby.

    + +
    +<uses-permission android:name="android.permission.BLUETOOTH"/>
    +<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
    +<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
    +
    + +

    Apps must also request location permission from the user at run-time. +See the documentation for Activity.requestPermissions() for details and an example. +

    + +

    Scan for MIDI Devices

    + +

    The app will only want to see MIDI devices and not mice or other non-MIDI devices. +So construct a ScanFilter using the UUID for standard MIDI over BTLE.

    + +
    +MIDI over BTLE UUID = "03B80E5A-EDE8-4B33-A751-6CE34EC4C700"
    +
    + +

    Open a MIDI Bluetooth Device

    + +

    See the documentation for android.bluetooth.le.BluetoothLeScanner.startScan() +method for details. When the user selects a MIDI/BTLE device then you can open it +using the MidiManager.

    + +
    +m.openBluetoothDevice(bluetoothDevice, callback, handler);
    +
    + +

    Once the MIDI/BTLE device has been opened by one app then it will also become available to other +apps using the +MIDI device discovery calls described above. +

    + -- cgit v1.1