Skip to content

Commit

Permalink
Add SystemTrainMotor (#107)
Browse files Browse the repository at this point in the history
#104 non-breaking
  • Loading branch information
rickjansen-dev authored Oct 12, 2020
1 parent bcc2065 commit 96d1f75
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/SharpBrick.PoweredUp/Devices/DeviceFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public Type GetTypeFromDeviceType(DeviceType deviceType)
DeviceType.Voltage => typeof(Voltage),
DeviceType.Current => typeof(Current),
DeviceType.RgbLight => typeof(RgbLight),
DeviceType.SystemTrainMotor => typeof(SystemTrainMotor),
DeviceType.TechnicLargeLinearMotor => typeof(TechnicLargeLinearMotor),
DeviceType.TechnicXLargeLinearMotor => typeof(TechnicXLargeLinearMotor),
DeviceType.TechnicMediumHubGestureSensor => typeof(TechnicMediumHubGestureSensor),
Expand All @@ -50,6 +51,7 @@ public static DeviceType GetDeviceTypeFromType(Type type)
nameof(Voltage) => DeviceType.Voltage,
nameof(Current) => DeviceType.Current,
nameof(RgbLight) => DeviceType.RgbLight,
nameof(SystemTrainMotor) => DeviceType.SystemTrainMotor,
nameof(TechnicLargeLinearMotor) => DeviceType.TechnicLargeLinearMotor,
nameof(TechnicXLargeLinearMotor) => DeviceType.TechnicXLargeLinearMotor,
nameof(TechnicMediumHubGestureSensor) => DeviceType.TechnicMediumHubGestureSensor,
Expand Down
32 changes: 32 additions & 0 deletions src/SharpBrick.PoweredUp/Devices/SystemTrainMotor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using SharpBrick.PoweredUp.Protocol;
using SharpBrick.PoweredUp.Utils;

using System;
using System.Collections.Generic;
using System.Linq;

namespace SharpBrick.PoweredUp
{
public class SystemTrainMotor : BasicMotor, IPoweredUpDevice
{
public SystemTrainMotor()
: base()
{ }
public SystemTrainMotor(ILegoWirelessProtocol protocol, byte hubId, byte portId)
: base(protocol, hubId, portId)
{ }

public IEnumerable<byte[]> GetStaticPortInfoMessages(Version softwareVersion, Version hardwareVersion, SystemType systemType)
=> @"
0B-00-43-00-01-01-01-00-00-01-00
05-00-43-00-02
12-00-44-00-00-00-4C-50-46-32-2D-54-52-41-49-4E-00-00
0E-00-44-00-00-01-00-00-C8-C2-00-00-C8-42
0E-00-44-00-00-02-00-00-C8-C2-00-00-C8-42
0E-00-44-00-00-03-00-00-C8-C2-00-00-C8-42
0B-00-44-00-00-04-00-00-00-00-00
08-00-44-00-00-05-00-18
0A-00-44-00-00-80-01-00-04-00
".Trim().Split("\n").Select(s => BytesStringUtil.StringToData(s));
}
}

0 comments on commit 96d1f75

Please sign in to comment.