1 /* 2 * Copyright (C) 2014 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package android.media.midi; 18 19 import android.bluetooth.BluetoothDevice; 20 import android.media.midi.IMidiDeviceListener; 21 import android.media.midi.IMidiDeviceOpenCallback; 22 import android.media.midi.IMidiDeviceServer; 23 import android.media.midi.IMidiDeviceServer; 24 import android.media.midi.MidiDeviceInfo; 25 import android.media.midi.MidiDeviceStatus; 26 import android.os.Bundle; 27 import android.os.IBinder; 28 29 /** @hide */ 30 interface IMidiManager 31 { getDevices()32 MidiDeviceInfo[] getDevices(); 33 getDevicesForTransport(int transport)34 MidiDeviceInfo[] getDevicesForTransport(int transport); 35 36 // for device creation & removal notifications registerListener(IBinder clientToken, in IMidiDeviceListener listener)37 void registerListener(IBinder clientToken, in IMidiDeviceListener listener); unregisterListener(IBinder clientToken, in IMidiDeviceListener listener)38 void unregisterListener(IBinder clientToken, in IMidiDeviceListener listener); 39 openDevice(IBinder clientToken, in MidiDeviceInfo device, in IMidiDeviceOpenCallback callback)40 void openDevice(IBinder clientToken, in MidiDeviceInfo device, in IMidiDeviceOpenCallback callback); openBluetoothDevice(IBinder clientToken, in BluetoothDevice bluetoothDevice, in IMidiDeviceOpenCallback callback)41 void openBluetoothDevice(IBinder clientToken, in BluetoothDevice bluetoothDevice, 42 in IMidiDeviceOpenCallback callback); closeDevice(IBinder clientToken, IBinder deviceToken)43 void closeDevice(IBinder clientToken, IBinder deviceToken); 44 45 // for registering built-in MIDI devices registerDeviceServer(in IMidiDeviceServer server, int numInputPorts, int numOutputPorts, in String[] inputPortNames, in String[] outputPortNames, in Bundle properties, int type, int defaultProtocol)46 MidiDeviceInfo registerDeviceServer(in IMidiDeviceServer server, int numInputPorts, 47 int numOutputPorts, in String[] inputPortNames, in String[] outputPortNames, 48 in Bundle properties, int type, int defaultProtocol); 49 50 // for unregistering built-in MIDI devices unregisterDeviceServer(in IMidiDeviceServer server)51 void unregisterDeviceServer(in IMidiDeviceServer server); 52 53 // used by MidiDeviceService to access the MidiDeviceInfo that was created based on its 54 // manifest's meta-data getServiceDeviceInfo(String packageName, String className)55 MidiDeviceInfo getServiceDeviceInfo(String packageName, String className); 56 57 // used for client's to retrieve a device's MidiDeviceStatus getDeviceStatus(in MidiDeviceInfo deviceInfo)58 MidiDeviceStatus getDeviceStatus(in MidiDeviceInfo deviceInfo); 59 60 // used by MIDI devices to report their status 61 // the token is used by MidiService for death notification setDeviceStatus(in IMidiDeviceServer server, in MidiDeviceStatus status)62 void setDeviceStatus(in IMidiDeviceServer server, in MidiDeviceStatus status); 63 64 // Updates the number of bytes sent and received updateTotalBytes(in IMidiDeviceServer server, int inputBytes, int outputBytes)65 void updateTotalBytes(in IMidiDeviceServer server, int inputBytes, int outputBytes); 66 } 67