Commits

Christian Specht  committed 652a3c5 Draft

extract interface from CommandCenter

  • Participants
  • Parent commits 22cf43d

Comments (0)

Files changed (3)

File src/MissileSharp/CommandCenter.cs

     /// <summary>
     /// Controls an USB missile launcher
     /// </summary>
-    public class CommandCenter : IDisposable
+    public class CommandCenter : ICommandCenter, IDisposable
     {
         IHidDevice device;
         ILauncherModel launcher;
         /// Move up for X milliseconds
         /// </summary>
         /// <param name="milliseconds">Time to move</param>
-        public CommandCenter Up(int milliseconds)
+        public ICommandCenter Up(int milliseconds)
         {
             SendMoveCommand(launcher.Up, milliseconds);
             return this;
         /// Move down for X milliseconds
         /// </summary>
         /// <param name="milliseconds">Time to move</param>
-        public CommandCenter Down(int milliseconds)
+        public ICommandCenter Down(int milliseconds)
         {
             SendMoveCommand(launcher.Down, milliseconds);
             return this;
         /// Turn left for X milliseconds
         /// </summary>
         /// <param name="milliseconds">Time to move</param>
-        public CommandCenter Left(int milliseconds)
+        public ICommandCenter Left(int milliseconds)
         {
             SendMoveCommand(launcher.Left, milliseconds);
             return this;
         /// Turn right for X milliseconds
         /// </summary>
         /// <param name="milliseconds">Time to move</param>
-        public CommandCenter Right(int milliseconds)
+        public ICommandCenter Right(int milliseconds)
         {
             SendMoveCommand(launcher.Right, milliseconds);
             return this;
         /// <summary>
         /// Reset the launcher position (=move to bottom left)
         /// </summary>
-        public CommandCenter Reset()
+        public ICommandCenter Reset()
         {
             Down(launcher.ResetTimeDown);
             Left(launcher.ResetTimeLeft);
         /// Fire X missiles
         /// </summary>
         /// <param name="numberOfShots">Number of missiles to fire</param>
-        public CommandCenter Fire(int numberOfShots)
+        public ICommandCenter Fire(int numberOfShots)
         {
             if (numberOfShots < launcher.MinNumberOfShots)
             {

File src/MissileSharp/ICommandCenter.cs

+using System;
+using System.Collections.Generic;
+
+namespace MissileSharp
+{
+    public interface ICommandCenter : IDisposable
+    {
+        bool IsReady { get; }
+
+        void RunCommand(LauncherCommand command);
+
+        void RunCommandSet(IEnumerable<LauncherCommand> commands);
+
+        void RunCommandSet(string commandSetName);
+
+        bool LoadCommandSets(string pathToConfigFile);
+
+        bool LoadCommandSets(string[] configFileLines);
+
+        List<string> GetLoadedCommandSetNames();
+
+        ICommandCenter Up(int milliseconds);
+
+        ICommandCenter Down(int milliseconds);
+
+        ICommandCenter Left(int milliseconds);
+
+        ICommandCenter Right(int milliseconds);
+
+        ICommandCenter Reset();
+
+        ICommandCenter Fire(int numberOfShots);
+    }
+}

File src/MissileSharp/MissileSharp.csproj

     <Compile Include="Command.cs" />
     <Compile Include="ConfigReader.cs" />
     <Compile Include="HidLibraryDevice.cs" />
+    <Compile Include="ICommandCenter.cs" />
     <Compile Include="IHidDevice.cs" />
     <Compile Include="ILauncherModel.cs" />
     <Compile Include="CommandCenter.cs" />