diff --git a/lib/flutter_midi_command_platform_interface.dart b/lib/flutter_midi_command_platform_interface.dart index 9e010d5..b5f81a1 100644 --- a/lib/flutter_midi_command_platform_interface.dart +++ b/lib/flutter_midi_command_platform_interface.dart @@ -124,4 +124,15 @@ abstract class MidiCommandPlatform extends PlatformInterface { throw UnimplementedError( 'setNetworkSessionEnabled has not been implemented.'); } + + /// Returns the current state of the raw MIDI receiving flag. + Future getRawMidiDataReceivingEnabled(String deviceId) { + throw UnimplementedError('getRawMidiDataReceivingEnabled has not been implemented.'); + } + + /// When enabled all incoming MIDI packets are transmitted exactly as received, + /// without compiling them into well formed MIDI messages. + Future setRawMidiDataReceivingEnabled(String deviceId, bool enabled) { + throw UnimplementedError('setRawMidiDataReceivingEnabled has not been implemented.'); + } } diff --git a/lib/method_channel_midi_command.dart b/lib/method_channel_midi_command.dart index 475494d..b0c6954 100644 --- a/lib/method_channel_midi_command.dart +++ b/lib/method_channel_midi_command.dart @@ -35,7 +35,7 @@ class MethodChannelMidiCommand extends MidiCommandPlatform { if (portList == null) return []; var ports = portList.map((e) { var portMap = (e as Map).cast(); - return MidiPort(portMap["id"] as int, type); + return MidiPort(portMap["id"] as int, type, portMap['name'] as String); }); return ports.toList(growable: false); } @@ -171,4 +171,17 @@ class MethodChannelMidiCommand extends MidiCommandPlatform { void setNetworkSessionEnabled(bool enabled) { _methodChannel.invokeMethod('enableNetworkSession', enabled); } + + /// Returns the current state of the raw MIDI message receiving flag. + Future getRawMidiDataReceivingEnabled(String deviceId) { + return _methodChannel.invokeMethod('isRawMidiDataReceivingEnabled', {'deviceId': deviceId}); + } + + /// Sets the enabled state of raw MIDI data recieving. + Future setRawMidiDataReceivingEnabled(String deviceId, bool enabled) { + return _methodChannel.invokeMethod( + 'enableRawMidiDataReceiving', + {'deviceId': deviceId, 'enabled': enabled}, + ); + } } diff --git a/lib/midi_port.dart b/lib/midi_port.dart index b50360d..23f6caf 100644 --- a/lib/midi_port.dart +++ b/lib/midi_port.dart @@ -4,10 +4,11 @@ class MidiPort { MidiPortType type; int id; bool connected = false; + String name; - MidiPort(this.id, this.type); + MidiPort(this.id, this.type, this.name); Map get toDictionary { - return {"id": id, "type": type.toString(), "connected": connected}; + return {"id": id, "name": name, "type": type.toString(), "connected": connected}; } }