renamed RobotType to RobotMode and inserted in all constructors where not present yet

main
Jonas Arnold 4 years ago
parent fcc6e9c503
commit 24f3de6e23
  1. 9
      ADIS_Csharp/RaspiControl/ChallengeFactory.cs
  2. 4
      ADIS_Csharp/RobotClientWpf/ChallengeFactory.cs
  3. 4
      ADIS_Csharp/RobotConsoleClient/Program.cs
  4. 12
      ADIS_Csharp/RobotLib/Robot.cs
  5. 4
      ADIS_Csharp/RobotLib/RobotMode.cs

@ -1,10 +1,5 @@
using RobotLib.Communication; using RobotLib.Communication;
using RobotLib; using RobotLib;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RaspiControl { namespace RaspiControl {
internal class ChallengeFactory { internal class ChallengeFactory {
@ -14,8 +9,8 @@ namespace RaspiControl {
public ChallengeFactory() { public ChallengeFactory() {
this.PublisherSubscriber = MqttPublisherSubscriber.Instance; this.PublisherSubscriber = MqttPublisherSubscriber.Instance;
this.RobotStationary = new Robot(this.PublisherSubscriber); this.RobotStationary = new Robot(this.PublisherSubscriber, RobotMode.Stationary);
this.RobotMobile = new Robot(this.PublisherSubscriber); this.RobotMobile = new Robot(this.PublisherSubscriber, RobotMode.Mobile);
} }
} }
} }

@ -12,8 +12,8 @@ namespace RobotClientWpf
public ChallengeFactory() public ChallengeFactory()
{ {
this.PublisherSubscriber = MqttPublisherSubscriber.Instance; this.PublisherSubscriber = MqttPublisherSubscriber.Instance;
this.RobotStationary = new Robot(this.PublisherSubscriber, RobotTypes.Stationary); this.RobotStationary = new Robot(this.PublisherSubscriber, RobotMode.Stationary);
this.RobotMobile = new Robot(this.PublisherSubscriber, RobotTypes.Mobile); this.RobotMobile = new Robot(this.PublisherSubscriber, RobotMode.Mobile);
} }
} }
} }

@ -9,8 +9,8 @@ namespace RobotConsoleClient
{ {
var com = MqttPublisherSubscriber.Instance; var com = MqttPublisherSubscriber.Instance;
com.Connect("192.168.20.22", "ADIS", "TEST"); com.Connect("192.168.20.22", "ADIS", "TEST");
var robotStationary = new Robot(com); var robotStationary = new Robot(com, RobotMode.Stationary);
var robotMobile = new Robot(com); var robotMobile = new Robot(com, RobotMode.Mobile);
robotStationary.SplitFlap.SplitFlapDisplayChanged += SplitFlap_SplitFlapDisplayChanged; robotStationary.SplitFlap.SplitFlapDisplayChanged += SplitFlap_SplitFlapDisplayChanged;
//Console.ReadLine(); //Console.ReadLine();
Thread.Sleep(1000); Thread.Sleep(1000);

@ -8,23 +8,23 @@ namespace RobotLib
{ {
public class Robot public class Robot
{ {
public Robot(IPublisherSubscriber com, RobotTypes type) public Robot(IPublisherSubscriber com, RobotMode type)
{ {
Com = com; Com = com;
Type = type; Type = type;
if(type == RobotTypes.Undefined) if(type == RobotMode.Undefined)
{ {
throw new System.ArgumentException("Undefined robot type, must define type!"); throw new System.ArgumentException("Undefined robot mode, must define mode!");
} }
if(type == RobotTypes.Mobile) if(type == RobotMode.Mobile)
{ {
//Buzzer = new DevBuzzer(Com); //Buzzer = new DevBuzzer(Com);
Battery = new DevBattery(Com); Battery = new DevBattery(Com);
LineSensor = new DevLineSensor(com); LineSensor = new DevLineSensor(com);
Movement = new DevMovement(com); Movement = new DevMovement(com);
} }
else if(type == RobotTypes.Stationary) else if(type == RobotMode.Stationary)
{ {
SplitFlap = new DevSplitFlap(com); SplitFlap = new DevSplitFlap(com);
} }
@ -38,7 +38,7 @@ namespace RobotLib
} }
public IPublisherSubscriber Com { get; } public IPublisherSubscriber Com { get; }
public RobotTypes Type { get; } public RobotMode Type { get; }
//public DevBuzzer Buzzer { get; } //public DevBuzzer Buzzer { get; }
public DevBattery Battery { get; } public DevBattery Battery { get; }

@ -1,9 +1,9 @@
namespace RobotLib namespace RobotLib
{ {
public enum RobotTypes public enum RobotMode
{ {
Undefined = 0, Undefined = 0,
Mobile = 1, Mobile = 1,
Stationary Stationary = 2
} }
} }
Loading…
Cancel
Save