Skip to content

Commit f9ccfd3

Browse files
committed
mpf: Update API to .dev.55.
1 parent 4b9aad4 commit f9ccfd3

File tree

4 files changed

+28
-1
lines changed

4 files changed

+28
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Or, if you already have it:
4040

4141
`pip install mpf mpf-mc --pre --upgrade`
4242

43-
After that, `mpf --version` should return at least **MPF v0.55.0-dev.12**.
43+
After that, `mpf --version` should return at least **MPF v0.55.0-dev.37**.
4444

4545
## Usage
4646

VisualPinball.Engine.Mpf.Test/Program.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ public static async Task Main(string[] args)
6969
mpfApi.Client.OnFadeLight += (_, request) => {
7070
Console.WriteLine($"[MPF] light fades ({request.CommonFadeMs}ms):");
7171
};
72+
mpfApi.Client.OnDmdFrame += (_, request) => {
73+
Console.WriteLine($"[MPF] new DMD frame!");
74+
};
7275

7376
var descr = mpfApi.GetMachineDescription();
7477
Console.WriteLine($"Description: {descr} in {s.ElapsedMilliseconds}ms");

VisualPinball.Engine.Mpf/MpfClient.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ public class MpfClient
3030
public event EventHandler<DisableCoilRequest> OnDisableCoil;
3131
public event EventHandler<ConfigureHardwareRuleRequest> OnConfigureHardwareRule;
3232
public event EventHandler<RemoveHardwareRuleRequest> OnRemoveHardwareRule;
33+
public event EventHandler<SetDmdFrameRequest> OnDmdFrame;
3334

3435
private Channel _channel;
3536
private MpfHardwareService.MpfHardwareServiceClient _client;
@@ -96,6 +97,9 @@ private async void ReceiveCommands()
9697
case Commands.CommandOneofCase.RemoveHardwareRule:
9798
OnRemoveHardwareRule?.Invoke(this, commands.RemoveHardwareRule);
9899
break;
100+
case Commands.CommandOneofCase.DmdFrameRequest:
101+
OnDmdFrame?.Invoke(this, commands.DmdFrameRequest);
102+
break;
99103
default:
100104
throw new ArgumentOutOfRangeException();
101105
}

VisualPinball.Engine.Mpf/protos/platform.proto

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,23 @@ message LightDescription {
3434
string hardware_channel_color = 3;
3535
}
3636

37+
message DmdDescription {
38+
enum ColorMapping {
39+
BW = 0;
40+
RGB = 1;
41+
}
42+
43+
string name = 1;
44+
ColorMapping color_mapping = 2;
45+
uint32 width = 3;
46+
uint32 height = 4;
47+
}
48+
3749
message MachineDescription {
3850
repeated SwitchDescription switches = 1;
3951
repeated CoilDescription coils = 2;
4052
repeated LightDescription lights = 3;
53+
repeated DmdDescription dmds = 4;
4154
}
4255

4356
// Platform streams switch changes to MPF
@@ -47,6 +60,12 @@ message SwitchChanges {
4760
uint64 change_time = 3;
4861
}
4962

63+
message SetDmdFrameRequest {
64+
string name = 1;
65+
bytes frame = 2;
66+
float brightness = 3;
67+
}
68+
5069
message Commands {
5170
oneof command {
5271
FadeLightRequest fade_light = 1;
@@ -55,6 +74,7 @@ message Commands {
5574
DisableCoilRequest disable_coil = 4;
5675
ConfigureHardwareRuleRequest configure_hardware_rule = 5;
5776
RemoveHardwareRuleRequest remove_hardware_rule = 6;
77+
SetDmdFrameRequest dmd_frame_request = 7;
5878
}
5979
}
6080

0 commit comments

Comments
 (0)