Skip to content

Commit 6d8b828

Browse files
blackspherefollowerqdot
authored andcommitted
Correcting the KiirooCmd message
The schema states that this should contain a string named Command rather than a uint named Position. To handle this is a non-breaking way, the Position setter/getter has been preseved, but stores the uint value in the Command string. Fixes #221
1 parent dd083b1 commit 6d8b828

1 file changed

Lines changed: 14 additions & 4 deletions

File tree

Buttplug.Core/Messages/Messages.cs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -315,20 +315,30 @@ public LovenseCmd(uint aDeviceIndex, string aDeviceCmd, uint aId = ButtplugConst
315315

316316
public class KiirooCmd : ButtplugDeviceMessage
317317
{
318-
private uint _positionImpl;
319-
320318
[JsonProperty(Required = Required.Always)]
319+
public string Command;
320+
321+
[JsonIgnore]
321322
public uint Position
322323
{
323-
get => _positionImpl;
324+
get
325+
{
326+
if (uint.TryParse(Command, out uint pos) && pos <= 4)
327+
{
328+
return pos;
329+
}
330+
331+
return 0;
332+
}
333+
324334
set
325335
{
326336
if (value > 4)
327337
{
328338
throw new ArgumentException("KiirooRawCmd Position cannot be greater than 4");
329339
}
330340

331-
_positionImpl = value;
341+
Command = value.ToString();
332342
}
333343
}
334344

0 commit comments

Comments
 (0)