yhirano | bc742d8 | 2015-09-17 07:41:44 -0700 | [diff] [blame] | 1 | // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef MEDIA_MIDI_MIDI_DEVICE_ANDROID_H_ |
| 6 | #define MEDIA_MIDI_MIDI_DEVICE_ANDROID_H_ |
| 7 | |
| 8 | #include <jni.h> |
| 9 | #include <string> |
| 10 | |
| 11 | #include "base/android/scoped_java_ref.h" |
glevin | 2482133 | 2017-05-18 08:19:18 -0700 | [diff] [blame^] | 12 | #include "base/memory/scoped_vector.h" |
yhirano | bc742d8 | 2015-09-17 07:41:44 -0700 | [diff] [blame] | 13 | #include "media/midi/midi_input_port_android.h" |
| 14 | |
yhirano | bc742d8 | 2015-09-17 07:41:44 -0700 | [diff] [blame] | 15 | namespace midi { |
| 16 | |
| 17 | class MidiOutputPortAndroid; |
| 18 | |
| 19 | class MidiDeviceAndroid final { |
| 20 | public: |
| 21 | MidiDeviceAndroid(JNIEnv* env, |
| 22 | jobject raw_device, |
| 23 | MidiInputPortAndroid::Delegate* delegate); |
| 24 | ~MidiDeviceAndroid(); |
| 25 | |
| 26 | std::string GetManufacturer(); |
| 27 | std::string GetProductName(); |
| 28 | std::string GetDeviceVersion(); |
| 29 | |
glevin | 2482133 | 2017-05-18 08:19:18 -0700 | [diff] [blame^] | 30 | const ScopedVector<MidiInputPortAndroid>& input_ports() const { |
yhirano | bc742d8 | 2015-09-17 07:41:44 -0700 | [diff] [blame] | 31 | return input_ports_; |
| 32 | } |
glevin | 2482133 | 2017-05-18 08:19:18 -0700 | [diff] [blame^] | 33 | const ScopedVector<MidiOutputPortAndroid>& output_ports() const { |
yhirano | bc742d8 | 2015-09-17 07:41:44 -0700 | [diff] [blame] | 34 | return output_ports_; |
| 35 | } |
| 36 | bool HasRawDevice(JNIEnv* env, jobject raw_device) const { |
| 37 | return env->IsSameObject(raw_device_.obj(), raw_device); |
| 38 | } |
| 39 | |
yhirano | bc742d8 | 2015-09-17 07:41:44 -0700 | [diff] [blame] | 40 | private: |
| 41 | base::android::ScopedJavaGlobalRef<jobject> raw_device_; |
glevin | 2482133 | 2017-05-18 08:19:18 -0700 | [diff] [blame^] | 42 | ScopedVector<MidiInputPortAndroid> input_ports_; |
| 43 | ScopedVector<MidiOutputPortAndroid> output_ports_; |
yhirano | bc742d8 | 2015-09-17 07:41:44 -0700 | [diff] [blame] | 44 | }; |
| 45 | |
| 46 | } // namespace midi |
yhirano | bc742d8 | 2015-09-17 07:41:44 -0700 | [diff] [blame] | 47 | |
| 48 | #endif // MEDIA_MIDI_MIDI_DEVICE_ANDROID_H_ |