Skip to content

Commit f554d5b

Browse files
committed
Allow PiShock to be executed over serial
1 parent 5a75f62 commit f554d5b

File tree

3 files changed

+247
-61
lines changed

3 files changed

+247
-61
lines changed

VRCOSC.App/SDK/Providers/PiShock/LegacyPiShockRequests.cs

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -36,25 +36,10 @@ public class ShockerInfoPiShockRequest : BasePiShockRequest
3636
{
3737
}
3838

39-
public class ShockPiShockRequest : ActionPiShockRequest
40-
{
41-
protected override PiShockMode Mode => PiShockMode.Shock;
42-
43-
[JsonProperty("Intensity")]
44-
public string Intensity = null!;
45-
}
46-
4739
public class VibratePiShockRequest : ActionPiShockRequest
4840
{
4941
protected override PiShockMode Mode => PiShockMode.Vibrate;
5042

5143
[JsonProperty("Intensity")]
5244
public string Intensity = null!;
53-
}
54-
55-
public class BeepPiShockRequest : ActionPiShockRequest
56-
{
57-
protected override PiShockMode Mode => PiShockMode.Beep;
58-
}
59-
60-
public record LegacyPiShockResponse(bool Success, string Message, int FinalDuration = -1, int FinalIntensity = -1);
45+
}

VRCOSC.App/SDK/Providers/PiShock/PiShockOperations.cs

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,4 +81,44 @@ internal record PiShockPublishCommandLogData
8181

8282
[JsonProperty("o")]
8383
public required string Origin;
84+
}
85+
86+
[JsonObject(MemberSerialization.OptIn)]
87+
internal record PiShockSerialCommand
88+
{
89+
[JsonProperty("cmd")]
90+
public required string Command;
91+
92+
[JsonProperty("value")]
93+
public PiShockSerialBody? Body;
94+
}
95+
96+
[JsonObject(MemberSerialization.OptIn)]
97+
internal record PiShockSerialBody
98+
{
99+
[JsonProperty("id")]
100+
public required int ShockerId;
101+
102+
[JsonProperty("op")]
103+
public required string Op;
104+
105+
[JsonProperty("duration")]
106+
public required int Duration;
107+
108+
[JsonProperty("intensity")]
109+
public required int Intensity;
110+
}
111+
112+
[JsonObject(MemberSerialization.OptIn)]
113+
internal record PiShockSerialTerminalInfoResponse
114+
{
115+
[JsonProperty("shockers")]
116+
public List<PiShockSerialTerminalInfoShocker> Shockers = [];
117+
}
118+
119+
[JsonObject(MemberSerialization.OptIn)]
120+
internal record PiShockSerialTerminalInfoShocker
121+
{
122+
[JsonProperty("id")]
123+
public int ShockerId;
84124
}

0 commit comments

Comments
 (0)