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 
34     // for device creation & removal notifications
registerListener(IBinder clientToken, in IMidiDeviceListener listener)35     void registerListener(IBinder clientToken, in IMidiDeviceListener listener);
unregisterListener(IBinder clientToken, in IMidiDeviceListener listener)36     void unregisterListener(IBinder clientToken, in IMidiDeviceListener listener);
37 
openDevice(IBinder clientToken, in MidiDeviceInfo device, in IMidiDeviceOpenCallback callback)38     void openDevice(IBinder clientToken, in MidiDeviceInfo device, in IMidiDeviceOpenCallback callback);
openBluetoothDevice(IBinder clientToken, in BluetoothDevice bluetoothDevice, in IMidiDeviceOpenCallback callback)39     void openBluetoothDevice(IBinder clientToken, in BluetoothDevice bluetoothDevice,
40             in IMidiDeviceOpenCallback callback);
closeDevice(IBinder clientToken, IBinder deviceToken)41     void closeDevice(IBinder clientToken, IBinder deviceToken);
42 
43     // 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)44     MidiDeviceInfo registerDeviceServer(in IMidiDeviceServer server, int numInputPorts,
45             int numOutputPorts, in String[] inputPortNames, in String[] outputPortNames,
46             in Bundle properties, int type);
47 
48     // for unregistering built-in MIDI devices
unregisterDeviceServer(in IMidiDeviceServer server)49     void unregisterDeviceServer(in IMidiDeviceServer server);
50 
51     // used by MidiDeviceService to access the MidiDeviceInfo that was created based on its
52     // manifest's meta-data
getServiceDeviceInfo(String packageName, String className)53     MidiDeviceInfo getServiceDeviceInfo(String packageName, String className);
54 
55     // used for client's to retrieve a device's MidiDeviceStatus
getDeviceStatus(in MidiDeviceInfo deviceInfo)56     MidiDeviceStatus getDeviceStatus(in MidiDeviceInfo deviceInfo);
57 
58     // used by MIDI devices to report their status
59     // the token is used by MidiService for death notification
setDeviceStatus(in IMidiDeviceServer server, in MidiDeviceStatus status)60     void setDeviceStatus(in IMidiDeviceServer server, in MidiDeviceStatus status);
61 }
62