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
17package android.media.midi;
18
19import android.bluetooth.BluetoothDevice;
20import android.media.midi.IMidiDeviceListener;
21import android.media.midi.IMidiDeviceOpenCallback;
22import android.media.midi.IMidiDeviceServer;
23import android.media.midi.IMidiDeviceServer;
24import android.media.midi.MidiDeviceInfo;
25import android.media.midi.MidiDeviceStatus;
26import android.os.Bundle;
27import android.os.IBinder;
28
29/** @hide */
30interface IMidiManager
31{
32    MidiDeviceInfo[] getDevices();
33
34    // for device creation & removal notifications
35    void registerListener(IBinder clientToken, in IMidiDeviceListener listener);
36    void unregisterListener(IBinder clientToken, in IMidiDeviceListener listener);
37
38    void openDevice(IBinder clientToken, in MidiDeviceInfo device, in IMidiDeviceOpenCallback callback);
39    void openBluetoothDevice(IBinder clientToken, in BluetoothDevice bluetoothDevice,
40            in IMidiDeviceOpenCallback callback);
41    void closeDevice(IBinder clientToken, IBinder deviceToken);
42
43    // for registering built-in MIDI devices
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
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
53    MidiDeviceInfo getServiceDeviceInfo(String packageName, String className);
54
55    // used for client's to retrieve a device's MidiDeviceStatus
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
60    void setDeviceStatus(in IMidiDeviceServer server, in MidiDeviceStatus status);
61}
62