1 /*
2  * Copyright (C) 2018 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 #ifndef ANDROID_MEDIA_AMIDI_INTERNAL_H_
18 #define ANDROID_MEDIA_AMIDI_INTERNAL_H_
19 
20 #include <jni.h>
21 
22 #include "android/media/midi/BpMidiDeviceServer.h"
23 
24 typedef struct {
25     int32_t type;            /* one of AMIDI_DEVICE_TYPE_* constants */
26     int32_t inputPortCount;  /* number of input (send) ports associated with the device */
27     int32_t outputPortCount; /* number of output (received) ports associated with the device */
28 } AMidiDeviceInfo;
29 
30 struct AMidiDevice {
31     android::sp<android::media::midi::BpMidiDeviceServer>
32         server;             /* The Binder interface to the MIDI server (from the Java MidiDevice) */
33     int32_t deviceId;       /* The integer id of the device assigned in the Java API */
34     JavaVM* javaVM;         /* The Java VM (so we can obtain the JNIEnv in the
35                                AMidiDevice_close function) */
36     jobject midiDeviceObj;  /* NewGlobalRef() reference to the Java MidiDevice associated with
37                                this native AMidiDevice. */
38     AMidiDeviceInfo deviceInfo; /* Attributes of the device. */
39 };
40 
41 #endif // ANDROID_MEDIA_AMIDI_INTERNAL_H_
42