Skip to content

Commit

Permalink
Updated simulator to match connection pattern for other sources
Browse files Browse the repository at this point in the history
  • Loading branch information
qkmaxware committed Nov 29, 2022
1 parent fc5d7c5 commit 1f48e91
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,7 @@ namespace Qkmaxware.Astro.Control {
/// <summary>
/// Simulated device source with a simulated connection to the source
/// </summary>
public class SimulatedDeviceSource : IServerSpecification, IServerConnection, IDeviceSource {
#region Fake Host
public string Host => "localhost";
public int Port => 0;
public bool TryConnect(out IServerConnection connection, IConnectionLogger logger = null) {
connection = this;
this.Connect();
this.InputLogger = logger;
return true;
}
#endregion
public class SimulatedDeviceConnection : IServerConnection, IDeviceSource {

#region Fake Connection

Expand Down
24 changes: 24 additions & 0 deletions src/DotnetSimulator/SimulatedDeviceServer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System.Collections.Generic;
using System.Linq;
using Qkmaxware.Astro.Control;
using Qkmaxware.Astro.Control.Devices;

namespace Qkmaxware.Astro.Control {

/// <summary>
/// Simulated device source with a simulated connection to the source
/// </summary>
public class SimulatedDeviceServer : IServerSpecification {
#region Fake Host
public string Host => "localhost";
public int Port => 0;
public bool TryConnect(out IServerConnection connection, IConnectionLogger logger = null) {
connection = new SimulatedDeviceConnection();
connection.Connect();
connection.InputLogger = logger;
return true;
}
#endregion
}

}

0 comments on commit 1f48e91

Please sign in to comment.