Removed all # symbols from before the commands, as they're not really needed.

This commit is contained in:
2020-09-03 18:35:40 +01:00
parent 1dc7d7142a
commit 4266139429
10 changed files with 359 additions and 299 deletions
@@ -402,13 +402,13 @@ namespace Meade.net.Focuser.UnitTests
if (position < 0)
{
_sharedResourcesWrapperMock.Verify( x => x.SendBlind("#:F-#"), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("#:F+#"), Times.Never);
_sharedResourcesWrapperMock.Verify( x => x.SendBlind(":F-#"), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":F+#"), Times.Never);
}
else
{
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("#:F-#"), Times.Never);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("#:F+#"), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":F-#"), Times.Never);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":F+#"), Times.Once);
}
_sharedResourcesWrapperMock.Verify( x => x.Lock(It.IsAny<Action>()), Times.Once);
@@ -430,16 +430,16 @@ namespace Meade.net.Focuser.UnitTests
if (position < 0)
{
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("#:F-#"), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("#:F+#"), Times.Never);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":F-#"), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":F+#"), Times.Never);
_utilMock.Verify(x => x.WaitForMilliseconds(Math.Abs(position)), Times.Once);
_utilMock.Verify(x => x.WaitForMilliseconds(Math.Abs(_profileProperties.BacklashCompensation)), Times.Never);
_utilMock.Verify(x => x.WaitForMilliseconds(100), Times.Exactly(1));
}
else
{
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("#:F-#"), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("#:F+#"), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":F-#"), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":F+#"), Times.Once);
_utilMock.Verify(x => x.WaitForMilliseconds(Math.Abs(position) + _profileProperties.BacklashCompensation), Times.Once);
_utilMock.Verify(x => x.WaitForMilliseconds(_profileProperties.BacklashCompensation), Times.Once);
_utilMock.Verify(x => x.WaitForMilliseconds(100), Times.Exactly(2));
@@ -43,7 +43,7 @@ namespace Meade.net.Telescope.UnitTests
_astroUtilsMock = new Mock<IAstroUtils>();
_sharedResourcesWrapperMock = new Mock<ISharedResourcesWrapper>();
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:GZ#")).Returns("DDD*MMSS");
_sharedResourcesWrapperMock.Setup(x => x.SendString(":GZ#")).Returns("DDD*MMSS");
_sharedResourcesWrapperMock.Setup(x => x.ReadProfile()).Returns(() =>_profileProperties);
_sharedResourcesWrapperMock.Setup(x => x.Lock(It.IsAny<Action>())).Callback<Action>(action => { action(); });
@@ -122,36 +122,36 @@ namespace Meade.net.Telescope.UnitTests
public void Action_Handbox_ReadDisplay()
{
string expectedResult = "test result string";
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:ED#")).Returns(expectedResult);
_sharedResourcesWrapperMock.Setup(x => x.SendString(":ED#")).Returns(expectedResult);
_telescope.Connected = true;
var actualResult = _telescope.Action("handbox", "readdisplay");
_sharedResourcesWrapperMock.Verify(x => x.SendString("#:ED#"), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.SendString(":ED#"), Times.Once);
Assert.That(actualResult, Is.EqualTo(expectedResult));
}
[TestCase("enter", "#:EK13#")]
[TestCase("mode", "#:EK9#")]
[TestCase("longMode", "#:EK11#")]
[TestCase("goto", "#:EK24#")]
[TestCase("0", "#:EK48#")]
[TestCase("1", "#:EK49#")]
[TestCase("2", "#:EK50#")]
[TestCase("3", "#:EK51#")]
[TestCase("4", "#:EK52#")]
[TestCase("5", "#:EK53#")]
[TestCase("6", "#:EK54#")]
[TestCase("7", "#:EK55#")]
[TestCase("8", "#:EK56#")]
[TestCase("9", "#:EK57#")]
[TestCase("up", "#:EK94#")]
[TestCase("down", "#:EK118#")]
[TestCase("back", "#:EK87#")]
[TestCase("forward", "#:EK69#")]
[TestCase("?", "#:EK63#")]
[TestCase("enter", ":EK13#")]
[TestCase("mode", ":EK9#")]
[TestCase("longMode", ":EK11#")]
[TestCase("goto", ":EK24#")]
[TestCase("0", ":EK48#")]
[TestCase("1", ":EK49#")]
[TestCase("2", ":EK50#")]
[TestCase("3", ":EK51#")]
[TestCase("4", ":EK52#")]
[TestCase("5", ":EK53#")]
[TestCase("6", ":EK54#")]
[TestCase("7", ":EK55#")]
[TestCase("8", ":EK56#")]
[TestCase("9", ":EK57#")]
[TestCase("up", ":EK94#")]
[TestCase("down", ":EK118#")]
[TestCase("back", ":EK87#")]
[TestCase("forward", ":EK69#")]
[TestCase("?", ":EK63#")]
public void Action_Handbox_WhenCalling_ThenSendsAppropriateBlindCommands(string action, string expectedString)
{
ConnectTelescope();
@@ -172,7 +172,7 @@ namespace Meade.net.Telescope.UnitTests
string parameters = $"select {site}";
_telescope.Action("site", parameters);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind($"#:W{site}#"), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind($":W{site}#"), Times.Once);
}
[TestCase("0")]
@@ -187,10 +187,10 @@ namespace Meade.net.Telescope.UnitTests
Assert.That(exception.Message, Is.EqualTo($"Site {parameters} not allowed, must be between 1 and 4"));
}
[TestCase("1", "#:GM#", "Home")]
[TestCase("2", "#:GN#", "Club")]
[TestCase("3", "#:GO#", "GPS")]
[TestCase("4", "#:GP#", "Parents")]
[TestCase("1", ":GM#", "Home")]
[TestCase("2", ":GN#", "Club")]
[TestCase("3", ":GO#", "GPS")]
[TestCase("4", ":GP#", "Parents")]
public void Action_Site_GetName_WhenCallingWithValidValues_ThenSelectsCorrectSite(string site, string telescopeCommand, string siteName)
{
_sharedResourcesWrapperMock.Setup(x => x.SendString(telescopeCommand)).Returns(siteName);
@@ -227,10 +227,10 @@ namespace Meade.net.Telescope.UnitTests
Assert.That(result, Is.EqualTo("4"));
}
[TestCase("1", "#:SMHome#", "Home")]
[TestCase("2", "#:SNClub#", "Club")]
[TestCase("3", "#:SOGPS Site#", "GPS Site")]
[TestCase("4", "#:SPParents#", "Parents")]
[TestCase("1", ":SMHome#", "Home")]
[TestCase("2", ":SNClub#", "Club")]
[TestCase("3", ":SOGPS Site#", "GPS Site")]
[TestCase("4", ":SPParents#", "Parents")]
public void Action_Site_SetName_WhenCallingWithValidValues_ThenSelectsCorrectSite(string site, string telescopeCommand, string siteName)
{
@@ -369,8 +369,8 @@ namespace Meade.net.Telescope.UnitTests
if (expectedConnected)
{
_sharedResourcesWrapperMock.Verify(x => x.SendString("#:GZ#"), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind($"#:Rg{_profileProperties.GuideRateArcSecondsPerSecond:00.0}#"), Times.Never);
_sharedResourcesWrapperMock.Verify(x => x.SendString(":GZ#"), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind($":Rg{_profileProperties.GuideRateArcSecondsPerSecond:00.0}#"), Times.Never);
}
}
@@ -385,9 +385,9 @@ namespace Meade.net.Telescope.UnitTests
_telescope.Connected = true;
_sharedResourcesWrapperMock.Verify( x => x.Connect("Serial", It.IsAny<string>(), It.IsAny<ITraceLogger>()), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.SendString("#:GZ#"), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.SendString(":GZ#"), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind($"#:Rg{_profileProperties.GuideRateArcSecondsPerSecond:00.0}#"),Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind($":Rg{_profileProperties.GuideRateArcSecondsPerSecond:00.0}#"),Times.Once);
}
[Test]
@@ -401,8 +401,8 @@ namespace Meade.net.Telescope.UnitTests
_telescope.Connected = true;
_sharedResourcesWrapperMock.Verify(x => x.Connect("Serial", It.IsAny<string>(), It.IsAny<ITraceLogger>()), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.SendString("#:GZ#"), Times.Never);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind($"#:Rg{_profileProperties.GuideRateArcSecondsPerSecond:00.0}#"), Times.Never);
_sharedResourcesWrapperMock.Verify(x => x.SendString(":GZ#"), Times.Never);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind($":Rg{_profileProperties.GuideRateArcSecondsPerSecond:00.0}#"), Times.Never);
}
@@ -473,37 +473,37 @@ namespace Meade.net.Telescope.UnitTests
[Test]
public void SetLongFormatFalse_WhenTelescopeReturnsShortFormat_ThenDoesNothing()
{
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:GZ#")).Returns("DDD*MM");
_sharedResourcesWrapperMock.Setup(x => x.SendString(":GZ#")).Returns("DDD*MM");
_telescope.SetLongFormat(false);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("#:U#"),Times.Never);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":U#"),Times.Never);
}
[Test]
public void SetLongFormatFalse_WhenTelescopeReturnsLongFormat_ThenTogglesPrecision()
{
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:GZ#")).Returns("DDD*MMSS");
_sharedResourcesWrapperMock.Setup(x => x.SendString(":GZ#")).Returns("DDD*MMSS");
_telescope.SetLongFormat(false);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("#:U#"), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":U#"), Times.Once);
}
[Test]
public void SetLongFormatTrue_WhenTelescopeReturnsLongFormat_ThenDoesNothing()
{
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:GZ#")).Returns("DDD*MMSS");
_sharedResourcesWrapperMock.Setup(x => x.SendString(":GZ#")).Returns("DDD*MMSS");
_telescope.SetLongFormat(true);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("#:U#"), Times.Never);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":U#"), Times.Never);
}
[Test]
public void SetLongFormatTrue_WhenTelescopeReturnsShortFormat_ThenTogglesPrecision()
{
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:GZ#")).Returns("DDD*MM");
_sharedResourcesWrapperMock.Setup(x => x.SendString(":GZ#")).Returns("DDD*MM");
_telescope.SetLongFormat(true);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("#:U#"), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":U#"), Times.Once);
}
[Test]
@@ -545,7 +545,7 @@ namespace Meade.net.Telescope.UnitTests
_telescope.SelectSite(site);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind($"#:W{site}#"), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind($":W{site}#"), Times.Once);
}
[Test]
@@ -645,9 +645,9 @@ namespace Meade.net.Telescope.UnitTests
Assert.That(exception.Message, Is.EqualTo("Not connected to telescope when trying to execute: AlignmentMode Set"));
}
[TestCase("AUTOSTAR", "43Eg", AlignmentModes.algAltAz, "#:AA#")]
[TestCase("AUTOSTAR", "43Eg", AlignmentModes.algPolar, "#:AP#")]
[TestCase("AUTOSTAR", "43Eg", AlignmentModes.algGermanPolar, "#:AP#")]
[TestCase("AUTOSTAR", "43Eg", AlignmentModes.algAltAz, ":AA#")]
[TestCase("AUTOSTAR", "43Eg", AlignmentModes.algPolar, ":AP#")]
[TestCase("AUTOSTAR", "43Eg", AlignmentModes.algGermanPolar, ":AP#")]
public void AlignmentMode_Set_WhenConnected_ThenSendsExpectedCommand(string productName, string firmware, AlignmentModes alignmentMode, string expectedCommand)
{
_sharedResourcesWrapperMock.Setup(x => x.ProductName).Returns(productName);
@@ -815,7 +815,7 @@ namespace Meade.net.Telescope.UnitTests
{
_telescope.Connected = true;
_sharedResourcesWrapperMock.Verify( x => x.SendString("#:P#"), Times.Never);
_sharedResourcesWrapperMock.Verify( x => x.SendString(":P#"), Times.Never);
}
[TestCase("High", false, true)]
@@ -827,7 +827,7 @@ namespace Meade.net.Telescope.UnitTests
_profileProperties.Precision = desiredPresision;
var currentPrecision = telescopePrecision;
_sharedResourcesWrapperMock.Setup(x => x.SendChar("#:P#")).Returns(() =>
_sharedResourcesWrapperMock.Setup(x => x.SendChar(":P#")).Returns(() =>
{
currentPrecision = !currentPrecision;
@@ -843,7 +843,7 @@ namespace Meade.net.Telescope.UnitTests
_telescope.Connected = true;
Assert.That(currentPrecision, Is.EqualTo(finalPrecision));
_sharedResourcesWrapperMock.Verify(x => x.SendChar("#:P#"), Times.AtLeastOnce);
_sharedResourcesWrapperMock.Verify(x => x.SendChar(":P#"), Times.AtLeastOnce);
}
[TestCase("High", false, true)]
@@ -859,7 +859,7 @@ namespace Meade.net.Telescope.UnitTests
_telescope.Connected = true;
_sharedResourcesWrapperMock.Verify(x => x.SendChar("#:P#"), Times.Never);
_sharedResourcesWrapperMock.Verify(x => x.SendChar(":P#"), Times.Never);
}
[Test]
@@ -966,7 +966,7 @@ namespace Meade.net.Telescope.UnitTests
public void Declination_Get_WhenConnected_ThenReadsValueFromScope(string declincationString)
{
var expectedResult = 12.34;
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:GD#")).Returns(declincationString);
_sharedResourcesWrapperMock.Setup(x => x.SendString(":GD#")).Returns(declincationString);
_utilMock.Setup(x => x.DMSToDegrees(declincationString)).Returns(expectedResult);
ConnectTelescope();
@@ -981,14 +981,14 @@ namespace Meade.net.Telescope.UnitTests
var telescopeRaResult = "s12*3456";
var dmsResult = 1.2;
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:GD#")).Returns(telescopeRaResult);
_sharedResourcesWrapperMock.Setup(x => x.SendString(":GD#")).Returns(telescopeRaResult);
_utilMock.Setup(x => x.DMSToDegrees(telescopeRaResult)).Returns(dmsResult);
ConnectTelescope();
var result = _telescope.Declination;
_sharedResourcesWrapperMock.Verify(x => x.SendString("#:GD#"), Times.Exactly(2));
_sharedResourcesWrapperMock.Verify(x => x.SendString(":GD#"), Times.Exactly(2));
_utilMock.Verify(x => x.DMSToDegrees(telescopeRaResult), Times.Exactly(2));
Assert.That(result, Is.EqualTo(dmsResult));
@@ -1102,7 +1102,7 @@ namespace Meade.net.Telescope.UnitTests
_telescope.GuideRateDeclination = newGuideRate;
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("#:Rg01.2#"), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":Rg01.2#"), Times.Once);
Assert.That(_telescope.GuideRateDeclination, Is.EqualTo(newGuideRate));
}
@@ -1135,7 +1135,7 @@ namespace Meade.net.Telescope.UnitTests
_telescope.GuideRateRightAscension = newGuideRate;
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("#:Rg01.2#"), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":Rg01.2#"), Times.Once);
Assert.That(_telescope.GuideRateDeclination, Is.EqualTo(newGuideRate));
}
@@ -1157,23 +1157,23 @@ namespace Meade.net.Telescope.UnitTests
}
[TestCase( 0, "", TelescopeAxes.axisPrimary)]
[TestCase( 1, "#:RG#", TelescopeAxes.axisPrimary)]
[TestCase(-1, "#:RG#", TelescopeAxes.axisPrimary)]
[TestCase( 2, "#:RC#", TelescopeAxes.axisPrimary)]
[TestCase(-2, "#:RC#", TelescopeAxes.axisPrimary)]
[TestCase( 3, "#:RM#", TelescopeAxes.axisPrimary)]
[TestCase(-3, "#:RM#", TelescopeAxes.axisPrimary)]
[TestCase( 4, "#:RS#", TelescopeAxes.axisPrimary)]
[TestCase(-4, "#:RS#", TelescopeAxes.axisPrimary)]
[TestCase( 1, ":RG#", TelescopeAxes.axisPrimary)]
[TestCase(-1, ":RG#", TelescopeAxes.axisPrimary)]
[TestCase( 2, ":RC#", TelescopeAxes.axisPrimary)]
[TestCase(-2, ":RC#", TelescopeAxes.axisPrimary)]
[TestCase( 3, ":RM#", TelescopeAxes.axisPrimary)]
[TestCase(-3, ":RM#", TelescopeAxes.axisPrimary)]
[TestCase( 4, ":RS#", TelescopeAxes.axisPrimary)]
[TestCase(-4, ":RS#", TelescopeAxes.axisPrimary)]
[TestCase(0, "", TelescopeAxes.axisSecondary)]
[TestCase(1, "#:RG#", TelescopeAxes.axisSecondary)]
[TestCase(-1, "#:RG#", TelescopeAxes.axisSecondary)]
[TestCase(2, "#:RC#", TelescopeAxes.axisSecondary)]
[TestCase(-2, "#:RC#", TelescopeAxes.axisSecondary)]
[TestCase(3, "#:RM#", TelescopeAxes.axisSecondary)]
[TestCase(-3, "#:RM#", TelescopeAxes.axisSecondary)]
[TestCase(4, "#:RS#", TelescopeAxes.axisSecondary)]
[TestCase(-4, "#:RS#", TelescopeAxes.axisSecondary)]
[TestCase(1, ":RG#", TelescopeAxes.axisSecondary)]
[TestCase(-1, ":RG#", TelescopeAxes.axisSecondary)]
[TestCase(2, ":RC#", TelescopeAxes.axisSecondary)]
[TestCase(-2, ":RC#", TelescopeAxes.axisSecondary)]
[TestCase(3, ":RM#", TelescopeAxes.axisSecondary)]
[TestCase(-3, ":RM#", TelescopeAxes.axisSecondary)]
[TestCase(4, ":RS#", TelescopeAxes.axisSecondary)]
[TestCase(-4, ":RS#", TelescopeAxes.axisSecondary)]
public void MoveAxis_WhenConnected_ThenExecutesCorrectCommandSequence(double rate, string slewRateCommand, TelescopeAxes axis)
{
ConnectTelescope();
@@ -1184,10 +1184,10 @@ namespace Meade.net.Telescope.UnitTests
_sharedResourcesWrapperMock.Verify( x => x.SendBlind(slewRateCommand), Times.Once);
else
{
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("#:RG#"), Times.Never);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("#:RC#"), Times.Never);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("#:RM#"), Times.Never);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("#:RS#"), Times.Never);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":RG#"), Times.Never);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":RC#"), Times.Never);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":RM#"), Times.Never);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":RS#"), Times.Never);
}
switch (axis)
@@ -1196,14 +1196,14 @@ namespace Meade.net.Telescope.UnitTests
switch (rate.Compare(0))
{
case ComparisonResult.Equals:
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("#:Qe#"), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("#:Qw#"), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":Qe#"), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":Qw#"), Times.Once);
break;
case ComparisonResult.Greater:
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("#:Me#"), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":Me#"), Times.Once);
break;
case ComparisonResult.Lower:
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("#:Mw#"), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":Mw#"), Times.Once);
break;
}
break;
@@ -1211,14 +1211,14 @@ namespace Meade.net.Telescope.UnitTests
switch (rate.Compare(0))
{
case ComparisonResult.Equals:
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("#:Qn#"), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("#:Qs#"), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":Qn#"), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":Qs#"), Times.Once);
break;
case ComparisonResult.Greater:
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("#:Mn#"), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":Mn#"), Times.Once);
break;
case ComparisonResult.Lower:
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("#:Ms#"), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":Ms#"), Times.Once);
break;
}
break;
@@ -1264,11 +1264,11 @@ namespace Meade.net.Telescope.UnitTests
{
ConnectTelescope();
Assert.That(_telescope.AtPark, Is.False);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("#:hP#"), Times.Never);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":hP#"), Times.Never);
_telescope.Park();
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("#:hP#"), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":hP#"), Times.Once);
Assert.That(_telescope.AtPark, Is.True);
}
@@ -1279,7 +1279,7 @@ namespace Meade.net.Telescope.UnitTests
_telescope.Park();
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("#:hP#"), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":hP#"), Times.Once);
Assert.That(_telescope.AtPark, Is.True);
@@ -1287,7 +1287,7 @@ namespace Meade.net.Telescope.UnitTests
_telescope.Park();
//no change from previous state.
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("#:hP#"), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":hP#"), Times.Once);
Assert.That(_telescope.AtPark, Is.True);
}
@@ -1326,7 +1326,7 @@ namespace Meade.net.Telescope.UnitTests
break;
}
_sharedResourcesWrapperMock.Verify(x => x.SendBlind($"#:Mg{d}{duration:0000}#"));
_sharedResourcesWrapperMock.Verify(x => x.SendBlind($":Mg{d}{duration:0000}#"));
_utilMock.Verify( x => x.WaitForMilliseconds(duration), Times.Once);
}
@@ -1336,7 +1336,7 @@ namespace Meade.net.Telescope.UnitTests
[TestCase(GuideDirections.guideSouth)]
public void PulseGuide_WhenSlewingAndPulseGuideAttempted_ThenThrowsExpectedException(GuideDirections direction)
{
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:D#")).Returns("|");
_sharedResourcesWrapperMock.Setup(x => x.SendString(":D#")).Returns("|");
var duration = 0;
ConnectTelescope();
@@ -1352,7 +1352,7 @@ namespace Meade.net.Telescope.UnitTests
[TestCase(GuideDirections.guideSouth, TelescopeAxes.axisSecondary)]
public void PulseGuide_WhenMovingAxisAndPulseGuideAttempted_ThenThrowsExpectedException(GuideDirections direction, TelescopeAxes axes)
{
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:D#")).Returns("");
_sharedResourcesWrapperMock.Setup(x => x.SendString(":D#")).Returns("");
var duration = 0;
ConnectTelescope();
@@ -1417,10 +1417,10 @@ namespace Meade.net.Telescope.UnitTests
break;
}
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("#:RG#"));
_sharedResourcesWrapperMock.Verify(x => x.SendBlind($"#:M{d}#"));
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":RG#"));
_sharedResourcesWrapperMock.Verify(x => x.SendBlind($":M{d}#"));
_utilMock.Verify(x => x.WaitForMilliseconds(duration), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind($"#:Q{d}#"));
_sharedResourcesWrapperMock.Verify(x => x.SendBlind($":Q{d}#"));
}
[TestCase(GuideDirections.guideEast)]
@@ -1453,10 +1453,10 @@ namespace Meade.net.Telescope.UnitTests
break;
}
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("#:RG#"));
_sharedResourcesWrapperMock.Verify(x => x.SendBlind($"#:M{d}#"));
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":RG#"));
_sharedResourcesWrapperMock.Verify(x => x.SendBlind($":M{d}#"));
_utilMock.Verify(x => x.WaitForMilliseconds(duration), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind($"#:Q{d}#"));
_sharedResourcesWrapperMock.Verify(x => x.SendBlind($":Q{d}#"));
}
[Test]
@@ -1476,14 +1476,14 @@ namespace Meade.net.Telescope.UnitTests
var telescopeRaResult = "HH:MM:SS";
var hmsResult = 1.2;
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:GR#")).Returns(telescopeRaResult);
_sharedResourcesWrapperMock.Setup(x => x.SendString(":GR#")).Returns(telescopeRaResult);
_utilMock.Setup(x => x.HMSToHours(telescopeRaResult)).Returns(hmsResult);
ConnectTelescope();
var result = _telescope.RightAscension;
_sharedResourcesWrapperMock.Verify( x => x.SendString("#:GR#"), Times.Exactly(2));
_sharedResourcesWrapperMock.Verify( x => x.SendString(":GR#"), Times.Exactly(2));
_utilMock.Verify( x => x.HMSToHours(telescopeRaResult), Times.Exactly(2));
Assert.That(result,Is.EqualTo(hmsResult));
@@ -1605,14 +1605,14 @@ namespace Meade.net.Telescope.UnitTests
var siteLatitudeString = "testLatString";
var siteLatitudeValue = 123.45;
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:Gt#")).Returns(siteLatitudeString);
_sharedResourcesWrapperMock.Setup(x => x.SendString(":Gt#")).Returns(siteLatitudeString);
_utilMock.Setup(x => x.DMSToDegrees(siteLatitudeString)).Returns(siteLatitudeValue);
ConnectTelescope();
var result = _telescope.SiteLatitude;
_sharedResourcesWrapperMock.Verify( x => x.SendString("#:Gt#"), Times.Once);
_sharedResourcesWrapperMock.Verify( x => x.SendString(":Gt#"), Times.Once);
Assert.That(result,Is.EqualTo(siteLatitudeValue));
}
@@ -1655,8 +1655,8 @@ namespace Meade.net.Telescope.UnitTests
Assert.That(exception.Message, Is.EqualTo("Failed to set site latitude."));
}
[TestCase(-10.5, "#:St-10*30#")]
[TestCase(20.75, "#:St+20*45#")]
[TestCase(-10.5, ":St-10*30#")]
[TestCase(20.75, ":St+20*45#")]
public void SiteLatitude_Set_WhenValidValues_ThenValueSentToTelescope(double siteLatitude, string expectedCommand)
{
_sharedResourcesWrapperMock.Setup(x => x.SendChar(expectedCommand)).Returns("1");
@@ -1688,7 +1688,7 @@ namespace Meade.net.Telescope.UnitTests
{
var telescopeLongitude = "testLongitude";
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:Gg#")).Returns(telescopeLongitude);
_sharedResourcesWrapperMock.Setup(x => x.SendString(":Gg#")).Returns(telescopeLongitude);
_utilMock.Setup(x => x.DMSToDegrees(telescopeLongitude)).Returns(telescopeLongitudeValue);
ConnectTelescope();
@@ -1735,7 +1735,7 @@ namespace Meade.net.Telescope.UnitTests
Assert.That(exception.Message, Is.EqualTo("Failed to set site longitude."));
}
[TestCase(10, "#:Sg350*00#")]
[TestCase(10, ":Sg350*00#")]
public void SiteLongitude_Set_WhenConnectedAndTelescopeFails_ThenThrowsException(double longitude, string expectedCommand)
{
_sharedResourcesWrapperMock.Setup(x => x.SendChar(expectedCommand)).Returns("1");
@@ -1767,26 +1767,26 @@ namespace Meade.net.Telescope.UnitTests
[Test]
public void SyncToTarget_WhenSyncToTargetFails_ThenThrowsException()
{
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:CM#")).Returns(string.Empty);
_sharedResourcesWrapperMock.Setup(x => x.SendString(":CM#")).Returns(string.Empty);
ConnectTelescope();
var exception = Assert.Throws<InvalidOperationException>(() => { _telescope.SyncToTarget(); } );
Assert.That(exception.Message, Is.EqualTo("Unable to perform sync"));
_sharedResourcesWrapperMock.Verify(x => x.SendString("#:CM#"), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.SendString(":CM#"), Times.Once);
}
[Test]
public void SyncToTarget_WhenSyncToTargetWorks_ThennoExceptionThrown()
{
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:CM#")).Returns(" M31 EX GAL MAG 3.5 SZ178.0'#");
_sharedResourcesWrapperMock.Setup(x => x.SendString(":CM#")).Returns(" M31 EX GAL MAG 3.5 SZ178.0'#");
ConnectTelescope();
Assert.DoesNotThrow(() => { _telescope.SyncToTarget(); });
_sharedResourcesWrapperMock.Verify(x => x.SendString("#:CM#"), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.SendString(":CM#"), Times.Once);
}
[Test]
@@ -1825,10 +1825,10 @@ namespace Meade.net.Telescope.UnitTests
Assert.That(exception.Message, Is.EqualTo("Target declination invalid"));
}
[TestCase(-30.5, "-30*30:00", "#:Sd-30*30:00#")]
[TestCase(30.5, "30*30:00", "#:Sd+30*30:00#")]
[TestCase(-75.25, "-75*15:00", "#:Sd-75*15:00#")]
[TestCase(50, "50*00:00", "#:Sd+50*00:00#")]
[TestCase(-30.5, "-30*30:00", ":Sd-30*30:00#")]
[TestCase(30.5, "30*30:00", ":Sd+30*30:00#")]
[TestCase(-75.25, "-75*15:00", ":Sd-75*15:00#")]
[TestCase(50, "50*00:00", ":Sd+50*00:00#")]
public void TargetDeclination_Set_WhenValueOK_ThenSetsNewTargetDeclination( double declination,string decstring, string commandString)
{
@@ -1855,7 +1855,7 @@ namespace Meade.net.Telescope.UnitTests
Assert.That(exception.Message, Is.EqualTo("Target not set"));
}
[TestCase(50, "50*00:00", "#:Sd+50*00:00#")]
[TestCase(50, "50*00:00", ":Sd+50*00:00#")]
public void TargetDeclination_Get_WhenValueOK_ThenSetsNewTargetDeclination(double declination, string decstring, string commandString)
{
_utilMock.Setup(x => x.DegreesToDMS(declination, "*", ":", ":", 2)).Returns(decstring);
@@ -1906,8 +1906,8 @@ namespace Meade.net.Telescope.UnitTests
Assert.That(exception.Message, Is.EqualTo("Failed to set TargetRightAscension."));
}
[TestCase(5.5, "05:30:00", "#:Sr05:30:00#")]
[TestCase(10, "10:00:00", "#:Sr10:00:00#")]
[TestCase(5.5, "05:30:00", ":Sr05:30:00#")]
[TestCase(10, "10:00:00", ":Sr10:00:00#")]
public void TargetRightAscension_Set_WhenValueOK_ThenSetsNewTargetDeclination(double rightAscension, string hms, string commandString)
{
_utilMock.Setup(x => x.HoursToHMS(rightAscension, ":", ":", ":", 2)).Returns(hms);
@@ -1933,7 +1933,7 @@ namespace Meade.net.Telescope.UnitTests
Assert.That(exception.Message, Is.EqualTo("Target not set"));
}
[TestCase(15, "15:00:00", "#:Sr15:00:00#")]
[TestCase(15, "15:00:00", ":Sr15:00:00#")]
public void TargetRightAscension_Get_WhenValueOK_ThenSetsNewTargetDeclination(double rightAscension, string hms, string commandString)
{
_utilMock.Setup(x => x.HoursToHMS(rightAscension, ":", ":", ":", 2)).Returns(hms);
@@ -1970,8 +1970,8 @@ namespace Meade.net.Telescope.UnitTests
Assert.That(exception.Message, Is.EqualTo("Not connected to telescope when trying to execute: TrackingRate Set"));
}
[TestCase(DriveRates.driveSidereal, "#:TQ#")]
[TestCase(DriveRates.driveLunar, "#:TL#")]
[TestCase(DriveRates.driveSidereal, ":TQ#")]
[TestCase(DriveRates.driveLunar, ":TL#")]
public void TrackingRate_Set_WhenConnected_ThenSendsCommandToTelescope(DriveRates rate, string commandString)
{
ConnectTelescope();
@@ -2039,9 +2039,9 @@ namespace Meade.net.Telescope.UnitTests
public void UTCDate_Get_WhenConnected_ThenReturnsUTCDateTime(string telescopeDate, string telescopeTime,
string telescopeUtcCorrection, int year, int month, int day, int hour, int min, int second)
{
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:GC#")).Returns(telescopeDate);
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:GL#")).Returns(telescopeTime);
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:GG#")).Returns(telescopeUtcCorrection);
_sharedResourcesWrapperMock.Setup(x => x.SendString(":GC#")).Returns(telescopeDate);
_sharedResourcesWrapperMock.Setup(x => x.SendString(":GL#")).Returns(telescopeTime);
_sharedResourcesWrapperMock.Setup(x => x.SendString(":GG#")).Returns(telescopeUtcCorrection);
ConnectTelescope();
@@ -2074,8 +2074,8 @@ namespace Meade.net.Telescope.UnitTests
var newDate = new DateTime(year, month, day, hour, min, second, DateTimeKind.Local) + utcCorrection;
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:GG#")).Returns(telescopeUtcCorrection);
_sharedResourcesWrapperMock.Setup(x => x.SendChar($"#:SL{telescopeTime}#")).Returns("0");
_sharedResourcesWrapperMock.Setup(x => x.SendString(":GG#")).Returns(telescopeUtcCorrection);
_sharedResourcesWrapperMock.Setup(x => x.SendChar($":SL{telescopeTime}#")).Returns("0");
ConnectTelescope();
@@ -2093,9 +2093,9 @@ namespace Meade.net.Telescope.UnitTests
var newDate = new DateTime(year, month, day, hour, min, second, DateTimeKind.Local) + utcCorrection;
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:GG#")).Returns(telescopeUtcCorrection);
_sharedResourcesWrapperMock.Setup(x => x.SendChar($"#:SL{telescopeTime}#")).Returns("1");
_sharedResourcesWrapperMock.Setup(x => x.SendChar($"#:SC{newDate:MM/dd/yy}#")).Returns("0");
_sharedResourcesWrapperMock.Setup(x => x.SendString(":GG#")).Returns(telescopeUtcCorrection);
_sharedResourcesWrapperMock.Setup(x => x.SendChar($":SL{telescopeTime}#")).Returns("1");
_sharedResourcesWrapperMock.Setup(x => x.SendChar($":SC{newDate:MM/dd/yy}#")).Returns("0");
ConnectTelescope();
@@ -2115,9 +2115,9 @@ namespace Meade.net.Telescope.UnitTests
var newDate = new DateTime(year, month, day, hour, min, second, DateTimeKind.Local) + utcCorrection;
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:GG#")).Returns(telescopeUtcCorrection);
_sharedResourcesWrapperMock.Setup(x => x.SendChar($"#:SL{telescopeTime}#")).Returns("1");
_sharedResourcesWrapperMock.Setup(x => x.SendChar($"#:SC{telescopeDate}#")).Returns("1");
_sharedResourcesWrapperMock.Setup(x => x.SendString(":GG#")).Returns(telescopeUtcCorrection);
_sharedResourcesWrapperMock.Setup(x => x.SendChar($":SL{telescopeTime}#")).Returns("1");
_sharedResourcesWrapperMock.Setup(x => x.SendChar($":SC{telescopeDate}#")).Returns("1");
ConnectTelescope();
@@ -2136,16 +2136,16 @@ namespace Meade.net.Telescope.UnitTests
string dec = "-30*30:00";
_utilMock.Setup(x => x.HoursToHMS(rightAscension, ":", ":", ":", 2)).Returns(hms);
_sharedResourcesWrapperMock.Setup(x => x.SendChar($"#:Sr{hms}#")).Returns("1");
_sharedResourcesWrapperMock.Setup(x => x.SendChar($":Sr{hms}#")).Returns("1");
_utilMock.Setup(x => x.DegreesToDMS(declination, "*", ":", ":", 2)).Returns(dec);
_sharedResourcesWrapperMock.Setup(x => x.SendChar($"#:Sd{dec}#")).Returns("1");
_sharedResourcesWrapperMock.Setup(x => x.SendChar($":Sd{dec}#")).Returns("1");
ConnectTelescope();
_telescope.SyncToCoordinates(rightAscension, declination);
_sharedResourcesWrapperMock.Verify( x => x.SendString("#:CM#"), Times.Once);
_sharedResourcesWrapperMock.Verify( x => x.SendString(":CM#"), Times.Once);
Assert.That(_telescope.TargetRightAscension, Is.EqualTo(rightAscension));
Assert.That(_telescope.TargetDeclination, Is.EqualTo(declination));
}
@@ -2157,7 +2157,7 @@ namespace Meade.net.Telescope.UnitTests
Assert.That(result, Is.False);
_sharedResourcesWrapperMock.Verify(x => x.SendString("#:D#"), Times.Never);
_sharedResourcesWrapperMock.Verify(x => x.SendString(":D#"), Times.Never);
}
[Test]
@@ -2169,13 +2169,13 @@ namespace Meade.net.Telescope.UnitTests
Assert.That(result, Is.False);
_sharedResourcesWrapperMock.Verify(x => x.SendString("#:D#"), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.SendString(":D#"), Times.Once);
}
[Test]
public void Slewing_WhenTelescopeIsSlewing_ThenReturnsTrue()
{
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:D#")).Returns("|");
_sharedResourcesWrapperMock.Setup(x => x.SendString(":D#")).Returns("|");
ConnectTelescope();
@@ -2183,7 +2183,7 @@ namespace Meade.net.Telescope.UnitTests
Assert.That(result, Is.True);
_sharedResourcesWrapperMock.Verify(x => x.SendString("#:D#"),Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.SendString(":D#"),Times.Once);
}
[TestCase(1, TelescopeAxes.axisPrimary)]
@@ -2199,7 +2199,7 @@ namespace Meade.net.Telescope.UnitTests
var result = _telescope.Slewing;
Assert.That(result, Is.True);
_sharedResourcesWrapperMock.Verify(x => x.SendString("#:D#"), Times.Never);
_sharedResourcesWrapperMock.Verify(x => x.SendString(":D#"), Times.Never);
}
@@ -2247,7 +2247,7 @@ namespace Meade.net.Telescope.UnitTests
[Test]
public void SlewToTargetAsync_WhenTargetSetAndSlewIsPossible_ThenAttemptsSlew()
{
_sharedResourcesWrapperMock.Setup(x => x.SendChar("#:MS#")).Returns("0");
_sharedResourcesWrapperMock.Setup(x => x.SendChar(":MS#")).Returns("0");
ConnectTelescope();
@@ -2257,13 +2257,13 @@ namespace Meade.net.Telescope.UnitTests
_telescope.SlewToTargetAsync();
_sharedResourcesWrapperMock.Verify(x => x.SendChar("#:MS#"), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.SendChar(":MS#"), Times.Once);
}
[Test]
public void SlewToTargetAsync_WhenTargetBelowHorizon_ThenThrowsException()
{
_sharedResourcesWrapperMock.Setup(x => x.SendChar("#:MS#")).Returns("1");
_sharedResourcesWrapperMock.Setup(x => x.SendChar(":MS#")).Returns("1");
_sharedResourcesWrapperMock.Setup(x => x.ReadTerminated()).Returns("Below horizon");
ConnectTelescope();
@@ -2278,7 +2278,7 @@ namespace Meade.net.Telescope.UnitTests
[Test]
public void SlewToTargetAsync_WhenTargetBelowElevation_ThenThrowsException()
{
_sharedResourcesWrapperMock.Setup(x => x.SendChar("#:MS#")).Returns("2");
_sharedResourcesWrapperMock.Setup(x => x.SendChar(":MS#")).Returns("2");
_sharedResourcesWrapperMock.Setup(x => x.ReadTerminated()).Returns("Above below elevation");
ConnectTelescope();
@@ -2293,7 +2293,7 @@ namespace Meade.net.Telescope.UnitTests
[Test]
public void SlewToTargetAsync_WhenTelescopeCanHitTripod_ThenThrowsException()
{
_sharedResourcesWrapperMock.Setup(x => x.SendChar("#:MS#")).Returns("3");
_sharedResourcesWrapperMock.Setup(x => x.SendChar(":MS#")).Returns("3");
_sharedResourcesWrapperMock.Setup(x => x.ReadTerminated()).Returns("the telescope can hit the tripod");
ConnectTelescope();
@@ -2315,11 +2315,11 @@ namespace Meade.net.Telescope.UnitTests
[Test]
public void SlewToTarget_WhenSlewing_ThenWaitsForTheSlewToComplete()
{
_sharedResourcesWrapperMock.Setup(x => x.SendChar("#:MS#")).Returns("0");
_sharedResourcesWrapperMock.Setup(x => x.SendChar(":MS#")).Returns("0");
var slewCounter = 0;
var iterations = 10;
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:D#")).Returns(() =>
_sharedResourcesWrapperMock.Setup(x => x.SendString(":D#")).Returns(() =>
{
slewCounter++;
if (slewCounter <= iterations)
@@ -2350,11 +2350,11 @@ namespace Meade.net.Telescope.UnitTests
var rightAscension = 1;
var declination = 2;
_sharedResourcesWrapperMock.Setup(x => x.SendChar("#:MS#")).Returns("0");
_sharedResourcesWrapperMock.Setup(x => x.SendChar(":MS#")).Returns("0");
//var slewCounter = 0;
//var iterations = 10;
//_sharedResourcesWrapperMock.Setup(x => x.SendString("#:D#")).Returns(() =>
//_sharedResourcesWrapperMock.Setup(x => x.SendString(":D#")).Returns(() =>
//{
// slewCounter++;
// if (slewCounter <= iterations)
@@ -2370,7 +2370,7 @@ namespace Meade.net.Telescope.UnitTests
//_utilMock.Verify(x => x.WaitForMilliseconds(It.IsAny<int>()), Times.Exactly(iterations));
Assert.That(_telescope.TargetRightAscension, Is.EqualTo(rightAscension));
Assert.That(_telescope.TargetDeclination, Is.EqualTo(declination));
_sharedResourcesWrapperMock.Verify( x => x.SendChar("#:MS#"), Times.Once);
_sharedResourcesWrapperMock.Verify( x => x.SendChar(":MS#"), Times.Once);
}
[Test]
@@ -2386,11 +2386,11 @@ namespace Meade.net.Telescope.UnitTests
var rightAscension = 1;
var declination = 2;
_sharedResourcesWrapperMock.Setup(x => x.SendChar("#:MS#")).Returns("0");
_sharedResourcesWrapperMock.Setup(x => x.SendChar(":MS#")).Returns("0");
var slewCounter = 0;
var iterations = 10;
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:D#")).Returns(() =>
_sharedResourcesWrapperMock.Setup(x => x.SendString(":D#")).Returns(() =>
{
slewCounter++;
if (slewCounter <= iterations)
@@ -2403,7 +2403,7 @@ namespace Meade.net.Telescope.UnitTests
_telescope.SlewToCoordinates(rightAscension, declination);
Assert.That(_telescope.TargetRightAscension, Is.EqualTo(rightAscension));
Assert.That(_telescope.TargetDeclination, Is.EqualTo(declination));
_sharedResourcesWrapperMock.Verify(x => x.SendChar("#:MS#"), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.SendChar(":MS#"), Times.Once);
_utilMock.Verify(x => x.WaitForMilliseconds(It.IsAny<int>()), Times.Exactly(iterations));
}
@@ -2459,15 +2459,15 @@ namespace Meade.net.Telescope.UnitTests
var rightAscension = 20;
var declination = 10;
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:GC#")).Returns("10/15/20");
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:GL#")).Returns("20:15:10");
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:GG#")).Returns("-1.0");
_sharedResourcesWrapperMock.Setup(x => x.SendString(":GC#")).Returns("10/15/20");
_sharedResourcesWrapperMock.Setup(x => x.SendString(":GL#")).Returns("20:15:10");
_sharedResourcesWrapperMock.Setup(x => x.SendString(":GG#")).Returns("-1.0");
_astroMathsMock
.Setup(x => x.ConvertHozToEq(It.IsAny<DateTime>(), It.IsAny<double>(), It.IsAny<double>(),
It.IsAny<HorizonCoordinates>())).Returns(new EquatorialCoordinates { Declination = declination, RightAscension = rightAscension });
_sharedResourcesWrapperMock.Setup(x => x.SendChar("#:MS#")).Returns("0");
_sharedResourcesWrapperMock.Setup(x => x.SendChar(":MS#")).Returns("0");
ConnectTelescope();
@@ -2475,7 +2475,7 @@ namespace Meade.net.Telescope.UnitTests
Assert.That(_telescope.TargetRightAscension, Is.EqualTo(rightAscension));
Assert.That(_telescope.TargetDeclination, Is.EqualTo(declination));
_sharedResourcesWrapperMock.Verify(x => x.SendChar("#:MS#"), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.SendChar(":MS#"), Times.Once);
}
[Test]
@@ -2493,19 +2493,19 @@ namespace Meade.net.Telescope.UnitTests
var azimuth = 30;
var altitude = 40;
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:GC#")).Returns("10/15/20");
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:GL#")).Returns("20:15:10");
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:GG#")).Returns("-1.0");
_sharedResourcesWrapperMock.Setup(x => x.SendString(":GC#")).Returns("10/15/20");
_sharedResourcesWrapperMock.Setup(x => x.SendString(":GL#")).Returns("20:15:10");
_sharedResourcesWrapperMock.Setup(x => x.SendString(":GG#")).Returns("-1.0");
_astroMathsMock
.Setup(x => x.ConvertHozToEq(It.IsAny<DateTime>(), It.IsAny<double>(), It.IsAny<double>(),
It.IsAny<HorizonCoordinates>())).Returns(new EquatorialCoordinates { Declination = declination, RightAscension = rightAscension });
_sharedResourcesWrapperMock.Setup(x => x.SendChar("#:MS#")).Returns("0");
_sharedResourcesWrapperMock.Setup(x => x.SendChar(":MS#")).Returns("0");
var slewCounter = 0;
var iterations = 10;
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:D#")).Returns(() =>
_sharedResourcesWrapperMock.Setup(x => x.SendString(":D#")).Returns(() =>
{
slewCounter++;
if (slewCounter <= iterations)
@@ -2519,7 +2519,7 @@ namespace Meade.net.Telescope.UnitTests
Assert.That(_telescope.TargetRightAscension, Is.EqualTo(rightAscension));
Assert.That(_telescope.TargetDeclination, Is.EqualTo(declination));
_sharedResourcesWrapperMock.Verify(x => x.SendChar("#:MS#"), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.SendChar(":MS#"), Times.Once);
_utilMock.Verify(x => x.WaitForMilliseconds(It.IsAny<int>()), Times.Exactly(iterations));
}
@@ -2547,14 +2547,14 @@ namespace Meade.net.Telescope.UnitTests
var mockHourAngle = 3;
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:GC#")).Returns("10/15/20");
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:GL#")).Returns("20:15:10");
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:GG#")).Returns("-1.0");
_sharedResourcesWrapperMock.Setup(x => x.SendString(":GC#")).Returns("10/15/20");
_sharedResourcesWrapperMock.Setup(x => x.SendString(":GL#")).Returns("20:15:10");
_sharedResourcesWrapperMock.Setup(x => x.SendString(":GG#")).Returns("-1.0");
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:Gg#")).Returns(telescopeLongitude);
_sharedResourcesWrapperMock.Setup(x => x.SendString(":Gg#")).Returns(telescopeLongitude);
_utilMock.Setup(x => x.DMSToDegrees(telescopeLongitude)).Returns(telescopeLongitudeValue);
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:GR#")).Returns(telescopeLatitude);
_sharedResourcesWrapperMock.Setup(x => x.SendString(":GR#")).Returns(telescopeLatitude);
_utilMock.Setup(x => x.HMSToHours(telescopeLatitude)).Returns(telescopeLatitudeValue);
_astroMathsMock.Setup(x => x.RightAscensionToHourAngle(It.IsAny<DateTime>(), It.IsAny<double>(), It.IsAny<double>())).Returns(mockHourAngle);
@@ -2592,14 +2592,14 @@ namespace Meade.net.Telescope.UnitTests
var mockHourAngle = 3;
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:GC#")).Returns("10/15/20");
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:GL#")).Returns("20:15:10");
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:GG#")).Returns("-1.0");
_sharedResourcesWrapperMock.Setup(x => x.SendString(":GC#")).Returns("10/15/20");
_sharedResourcesWrapperMock.Setup(x => x.SendString(":GL#")).Returns("20:15:10");
_sharedResourcesWrapperMock.Setup(x => x.SendString(":GG#")).Returns("-1.0");
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:Gg#")).Returns(telescopeLongitude);
_sharedResourcesWrapperMock.Setup(x => x.SendString(":Gg#")).Returns(telescopeLongitude);
_utilMock.Setup(x => x.DMSToDegrees(telescopeLongitude)).Returns(telescopeLongitudeValue);
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:GR#")).Returns(telescopeLatitude);
_sharedResourcesWrapperMock.Setup(x => x.SendString(":GR#")).Returns(telescopeLatitude);
_utilMock.Setup(x => x.HMSToHours(telescopeLatitude)).Returns(telescopeLatitudeValue);
_astroMathsMock.Setup(x => x.RightAscensionToHourAngle(It.IsAny<DateTime>(), It.IsAny<double>(), It.IsAny<double>())).Returns(mockHourAngle);
@@ -2627,12 +2627,12 @@ namespace Meade.net.Telescope.UnitTests
_telescope.AbortSlew();
_sharedResourcesWrapperMock.Verify( x => x.SendBlind("#:Q#"),Times.Once);
_sharedResourcesWrapperMock.Verify( x => x.SendBlind(":Q#"),Times.Once);
var isSloSlewing = _telescope.Slewing;
Assert.That(isSloSlewing, Is.False);
_sharedResourcesWrapperMock.Verify( x => x.SendString("#:D#"), Times.Once);
_sharedResourcesWrapperMock.Verify( x => x.SendString(":D#"), Times.Once);
}
}
}
+78 -78
View File
@@ -202,68 +202,68 @@ namespace ASCOM.Meade.net
{
//Read the screen
case "readdisplay":
var output = _sharedResourcesWrapper.SendString("#:ED#");
var output = _sharedResourcesWrapper.SendString(":ED#");
return output;
//top row of buttons
case "enter":
_sharedResourcesWrapper.SendBlind("#:EK13#");
_sharedResourcesWrapper.SendBlind(":EK13#");
break;
case "mode":
_sharedResourcesWrapper.SendBlind("#:EK9#");
_sharedResourcesWrapper.SendBlind(":EK9#");
break;
case "longmode":
_sharedResourcesWrapper.SendBlind("#:EK11#");
_sharedResourcesWrapper.SendBlind(":EK11#");
break;
case "goto":
_sharedResourcesWrapper.SendBlind("#:EK24#");
_sharedResourcesWrapper.SendBlind(":EK24#");
break;
case "0": //light and 0
_sharedResourcesWrapper.SendBlind("#:EK48#");
_sharedResourcesWrapper.SendBlind(":EK48#");
break;
case "1":
_sharedResourcesWrapper.SendBlind("#:EK49#");
_sharedResourcesWrapper.SendBlind(":EK49#");
break;
case "2":
_sharedResourcesWrapper.SendBlind("#:EK50#");
_sharedResourcesWrapper.SendBlind(":EK50#");
break;
case "3":
_sharedResourcesWrapper.SendBlind("#:EK51#");
_sharedResourcesWrapper.SendBlind(":EK51#");
break;
case "4":
_sharedResourcesWrapper.SendBlind("#:EK52#");
_sharedResourcesWrapper.SendBlind(":EK52#");
break;
case "5":
_sharedResourcesWrapper.SendBlind("#:EK53#");
_sharedResourcesWrapper.SendBlind(":EK53#");
break;
case "6":
_sharedResourcesWrapper.SendBlind("#:EK54#");
_sharedResourcesWrapper.SendBlind(":EK54#");
break;
case "7":
_sharedResourcesWrapper.SendBlind("#:EK55#");
_sharedResourcesWrapper.SendBlind(":EK55#");
break;
case "8":
_sharedResourcesWrapper.SendBlind("#:EK56#");
_sharedResourcesWrapper.SendBlind(":EK56#");
break;
case "9":
_sharedResourcesWrapper.SendBlind("#:EK57#");
_sharedResourcesWrapper.SendBlind(":EK57#");
break;
case "up":
_sharedResourcesWrapper.SendBlind("#:EK94#");
_sharedResourcesWrapper.SendBlind(":EK94#");
break;
case "down":
_sharedResourcesWrapper.SendBlind("#:EK118#");
_sharedResourcesWrapper.SendBlind(":EK118#");
break;
case "back":
_sharedResourcesWrapper.SendBlind("#:EK87#");
_sharedResourcesWrapper.SendBlind(":EK87#");
break;
case "forward":
_sharedResourcesWrapper.SendBlind("#:EK69#");
_sharedResourcesWrapper.SendBlind(":EK69#");
break;
case "?":
_sharedResourcesWrapper.SendBlind("#:EK63#");
_sharedResourcesWrapper.SendBlind(":EK63#");
break;
default:
LogMessage("", "Action {0}, parameters {1} not implemented", actionName, actionParameters);
@@ -541,7 +541,7 @@ namespace ASCOM.Meade.net
_sharedResourcesWrapper.Lock(() =>
{
var result = _sharedResourcesWrapper.SendString("#:GZ#");
var result = _sharedResourcesWrapper.SendString(":GZ#");
//:GZ# Get telescope azimuth
//Returns: DDD*MM# or DDD*MMSS#
//The current telescope Azimuth depending on the selected precision.
@@ -551,7 +551,7 @@ namespace ASCOM.Meade.net
if (IsLongFormat != setLongFormat)
{
_utilities.WaitForMilliseconds(500);
_sharedResourcesWrapper.SendBlind("#:U#");
_sharedResourcesWrapper.SendBlind(":U#");
//:U# Toggle between low/hi precision positions
//Low - RA displays and messages HH:MM.T sDD*MM
//High - Dec / Az / El displays and messages HH:MM: SS sDD*MM:SS
@@ -565,7 +565,7 @@ namespace ASCOM.Meade.net
private bool TogglePrecision()
{
LogMessage("TogglePrecision", "Toggling slewing precision");
var result = _sharedResourcesWrapper.SendChar("#:P#");
var result = _sharedResourcesWrapper.SendChar(":P#");
//:P# Toggles High Precsion Pointing. When High precision pointing is enabled scope will first allow the operator to center a nearby bright star before moving to the actual target.
//Returns: <string>
//“HIGH PRECISION” Current setting after this command.
@@ -605,7 +605,7 @@ namespace ASCOM.Meade.net
{
CheckConnectedAndValidateSite(site, "SelectSite");
_sharedResourcesWrapper.SendBlind($"#:W{site}#");
_sharedResourcesWrapper.SendBlind($":W{site}#");
//:W<n>#
//Set current site to<n>, an ASCII digit in the range 1..4
//Returns: Nothing
@@ -631,7 +631,7 @@ namespace ASCOM.Meade.net
switch (site)
{
case 1:
command = $"#:SM{sitename}#";
command = $":SM{sitename}#";
//:SM<string>#
//Set site 1s name to be<string>.LX200s only accept 3 character strings. Other scopes accept up to 15 characters.
// Returns:
@@ -639,7 +639,7 @@ namespace ASCOM.Meade.net
//1 - Valid
break;
case 2:
command = $"#:SN{sitename}#";
command = $":SN{sitename}#";
//:SN<string>#
//Set site 2s name to be<string>.LX200s only accept 3 character strings. Other scopes accept up to 15 characters.
// Returns:
@@ -647,7 +647,7 @@ namespace ASCOM.Meade.net
//1 - Valid
break;
case 3:
command = $"#:SO{sitename}#";
command = $":SO{sitename}#";
//:SO<string>#
//Set site 3s name to be<string>.LX200s only accept 3 character strings. Other scopes accept up to 15 characters.
// Returns:
@@ -655,7 +655,7 @@ namespace ASCOM.Meade.net
//1 - Valid
break;
case 4:
command = $"#:SP{sitename}#";
command = $":SP{sitename}#";
//:SP<string>#
//Set site 4s name to be<string>.LX200s only accept 3 character strings. Other scopes accept up to 15 characters.
// Returns:
@@ -680,22 +680,22 @@ namespace ASCOM.Meade.net
switch (site)
{
case 1:
return _sharedResourcesWrapper.SendString("#:GM#");
return _sharedResourcesWrapper.SendString(":GM#");
//:GM# Get Site 1 Name
//Returns: <string>#
//A # terminated string with the name of the requested site.
case 2:
return _sharedResourcesWrapper.SendString("#:GN#");
return _sharedResourcesWrapper.SendString(":GN#");
//:GN# Get Site 2 Name
//Returns: <string>#
//A # terminated string with the name of the requested site.
case 3:
return _sharedResourcesWrapper.SendString("#:GO#");
return _sharedResourcesWrapper.SendString(":GO#");
//:GO# Get Site 3 Name
//Returns: <string>#
//A # terminated string with the name of the requested site.
case 4:
return _sharedResourcesWrapper.SendString("#:GP#");
return _sharedResourcesWrapper.SendString(":GP#");
//:GP# Get Site 4 Name
//Returns: <string>#
//A # terminated string with the name of the requested site.
@@ -750,11 +750,11 @@ namespace ASCOM.Meade.net
{
//string name = "Short driver name - please customise";
//var telescopeProduceName = _sharedResourcesWrapper.SendString("#:GVP#");
//var telescopeProduceName = _sharedResourcesWrapper.SendString(":GVP#");
////:GVP# Get Telescope Product Name
////Returns: <string>#
//var firmwareVersion = _sharedResourcesWrapper.SendString("#:GVN#");
//var firmwareVersion = _sharedResourcesWrapper.SendString(":GVN#");
////:GVN# Get Telescope Firmware Number
////Returns: dd.d#
@@ -774,7 +774,7 @@ namespace ASCOM.Meade.net
CheckConnected("AbortSlew");
LogMessage("AbortSlew", "Aborting slew");
_sharedResourcesWrapper.SendBlind("#:Q#");
_sharedResourcesWrapper.SendBlind(":Q#");
//:Q# Halt all current slewing
//Returns:Nothing
@@ -803,7 +803,7 @@ namespace ASCOM.Meade.net
//todo implement GW Command - Supported in Autostar 43Eg and above
//if FirmwareIsGreaterThan(TelescopeList.Autostar497_43EG)
//{
//var alignmentString = SerialPort.CommandTerminated("#:GW#", "#");
//var alignmentString = SerialPort.CommandTerminated(":GW#", "#");
//:GW# Get Scope Alignment Status
//Returns: <mount><tracking><alignment>#
// where:
@@ -843,13 +843,13 @@ namespace ASCOM.Meade.net
switch (value)
{
case AlignmentModes.algAltAz:
_sharedResourcesWrapper.SendBlind("#:AA#");
_sharedResourcesWrapper.SendBlind(":AA#");
//:AA# Sets telescope the AltAz alignment mode
//Returns: nothing
break;
case AlignmentModes.algPolar:
case AlignmentModes.algGermanPolar:
_sharedResourcesWrapper.SendBlind("#:AP#");
_sharedResourcesWrapper.SendBlind(":AP#");
//:AP# Sets telescope to Polar alignment mode
//Returns: nothing
break;
@@ -873,7 +873,7 @@ namespace ASCOM.Meade.net
return altAz.Altitude;
//firmware bug in 44Eg, :GA# is returning the dec, not the altitude!
//var result = _sharedResourcesWrapper.SendString("#:GA#");
//var result = _sharedResourcesWrapper.SendString(":GA#");
////:GA# Get Telescope Altitude
////Returns: sDD* MM# or sDD*MMSS#
////The current scope altitude. The returned format depending on the current precision setting.
@@ -963,7 +963,7 @@ namespace ASCOM.Meade.net
{
CheckConnected("Azimuth Get");
//var result = _sharedResourcesWrapper.SendString("#:GZ#");
//var result = _sharedResourcesWrapper.SendString(":GZ#");
//:GZ# Get telescope azimuth
//Returns: DDD*MM#T or DDD*MMSS#
//The current telescope Azimuth depending on the selected precision.
@@ -1145,7 +1145,7 @@ namespace ASCOM.Meade.net
{
CheckConnected("Declination Get");
var result = _sharedResourcesWrapper.SendString("#:GD#");
var result = _sharedResourcesWrapper.SendString(":GD#");
//:GD# Get Telescope Declination.
//Returns: sDD*MM# or sDD*MMSS#
//Depending upon the current precision setting for the telescope.
@@ -1233,7 +1233,7 @@ namespace ASCOM.Meade.net
}
LogMessage($"{propertyName} Set", $"Setting new guiderate {value.ToString(CultureInfo.CurrentCulture)} arc seconds/second ({value.ToString(CultureInfo.CurrentCulture)} degrees/second)");
_sharedResourcesWrapper.SendBlind($"#:Rg{value:00.0}#");
_sharedResourcesWrapper.SendBlind($":Rg{value:00.0}#");
//:RgSS.S#
//Set guide rate to +/ -SS.S to arc seconds per second.This rate is added to or subtracted from the current tracking
//Rates when the CCD guider or handbox guider buttons are pressed when the guide rate is selected.Rate shall not exceed
@@ -1314,22 +1314,22 @@ namespace ASCOM.Meade.net
//do nothing, it's ok this time as we're halting the slew.
break;
case 1:
_sharedResourcesWrapper.SendBlind("#:RG#");
_sharedResourcesWrapper.SendBlind(":RG#");
//:RG# Set Slew rate to Guiding Rate (slowest)
//Returns: Nothing
break;
case 2:
_sharedResourcesWrapper.SendBlind("#:RC#");
_sharedResourcesWrapper.SendBlind(":RC#");
//:RC# Set Slew rate to Centering rate (2nd slowest)
//Returns: Nothing
break;
case 3:
_sharedResourcesWrapper.SendBlind("#:RM#");
_sharedResourcesWrapper.SendBlind(":RM#");
//:RM# Set Slew rate to Find Rate (2nd Fastest)
//Returns: Nothing
break;
case 4:
_sharedResourcesWrapper.SendBlind("#:RS#");
_sharedResourcesWrapper.SendBlind(":RS#");
//:RS# Set Slew rate to max (fastest)
//Returns: Nothing
break;
@@ -1344,22 +1344,22 @@ namespace ASCOM.Meade.net
{
case ComparisonResult.Equals:
_movingPrimary = false;
_sharedResourcesWrapper.SendBlind("#:Qe#");
_sharedResourcesWrapper.SendBlind(":Qe#");
//:Qe# Halt eastward Slews
//Returns: Nothing
_sharedResourcesWrapper.SendBlind("#:Qw#");
_sharedResourcesWrapper.SendBlind(":Qw#");
//:Qw# Halt westward Slews
//Returns: Nothing
break;
case ComparisonResult.Greater:
_sharedResourcesWrapper.SendBlind("#:Me#");
_sharedResourcesWrapper.SendBlind(":Me#");
//:Me# Move Telescope East at current slew rate
//Returns: Nothing
_movingPrimary = true;
break;
case ComparisonResult.Lower:
_sharedResourcesWrapper.SendBlind("#:Mw#");
_sharedResourcesWrapper.SendBlind(":Mw#");
//:Mw# Move Telescope West at current slew rate
//Returns: Nothing
_movingPrimary = true;
@@ -1371,21 +1371,21 @@ namespace ASCOM.Meade.net
{
case ComparisonResult.Equals:
_movingSecondary = false;
_sharedResourcesWrapper.SendBlind("#:Qn#");
_sharedResourcesWrapper.SendBlind(":Qn#");
//:Qn# Halt northward Slews
//Returns: Nothing
_sharedResourcesWrapper.SendBlind("#:Qs#");
_sharedResourcesWrapper.SendBlind(":Qs#");
//:Qs# Halt southward Slews
//Returns: Nothing
break;
case ComparisonResult.Greater:
_sharedResourcesWrapper.SendBlind("#:Mn#");
_sharedResourcesWrapper.SendBlind(":Mn#");
//:Mn# Move Telescope North at current slew rate
//Returns: Nothing
_movingSecondary = true;
break;
case ComparisonResult.Lower:
_sharedResourcesWrapper.SendBlind("#:Ms#");
_sharedResourcesWrapper.SendBlind(":Ms#");
//:Ms# Move Telescope South at current slew rate
//Returns: Nothing
_movingSecondary = true;
@@ -1407,7 +1407,7 @@ namespace ASCOM.Meade.net
if (AtPark)
return;
_sharedResourcesWrapper.SendBlind("#:hP#");
_sharedResourcesWrapper.SendBlind(":hP#");
//:hP# Autostar, Autostar II and LX 16”Slew to Park Position
//Returns: Nothing
AtPark = true;
@@ -1457,7 +1457,7 @@ namespace ASCOM.Meade.net
}
LogMessage("PulseGuide", "Using new pulse guiding technique");
_sharedResourcesWrapper.SendBlind($"#:Mg{d}{duration:0000}#");
_sharedResourcesWrapper.SendBlind($":Mg{d}{duration:0000}#");
//:MgnDDDD#
//:MgsDDDD#
//:MgeDDDD#
@@ -1522,7 +1522,7 @@ namespace ASCOM.Meade.net
get
{
CheckConnected("RightAscension Get");
var result = _sharedResourcesWrapper.SendString("#:GR#");
var result = _sharedResourcesWrapper.SendString(":GR#");
//:GR# Get Telescope RA
//Returns: HH:MM.T# or HH:MM:SS#
//Depending which precision is set for the telescope
@@ -1618,7 +1618,7 @@ namespace ASCOM.Meade.net
{
CheckConnected("SiteLatitude Get");
var latitude = _sharedResourcesWrapper.SendString("#:Gt#");
var latitude = _sharedResourcesWrapper.SendString(":Gt#");
//:Gt# Get Current Site Latitude
//Returns: sDD* MM#
//The latitude of the current site. Positive inplies North latitude.
@@ -1644,7 +1644,7 @@ namespace ASCOM.Meade.net
var absValue = Math.Abs(value);
int d = Convert.ToInt32(Math.Floor(absValue));
int m = Convert.ToInt32(60 * (absValue - d));
var commandString = $"#:St{sign}{d:00}*{m:00}#";
var commandString = $":St{sign}{d:00}*{m:00}#";
var result = _sharedResourcesWrapper.SendChar(commandString);
//:StsDD*MM#
@@ -1663,7 +1663,7 @@ namespace ASCOM.Meade.net
{
CheckConnected("SiteLongitude Get");
var longitude = _sharedResourcesWrapper.SendString("#:Gg#");
var longitude = _sharedResourcesWrapper.SendString(":Gg#");
//:Gg# Get Current Site Longitude
//Returns: sDDD*MM#
//The current site Longitude. East Longitudes are expressed as negative
@@ -1699,7 +1699,7 @@ namespace ASCOM.Meade.net
int d = Convert.ToInt32(Math.Floor(newLongitude));
int m = Convert.ToInt32(60 * (newLongitude - d));
var commandstring = $"#:Sg{d:000}*{m:00}#";
var commandstring = $":Sg{d:000}*{m:00}#";
var result = _sharedResourcesWrapper.SendChar(commandstring);
//:SgDDD*MM#
@@ -1789,7 +1789,7 @@ namespace ASCOM.Meade.net
switch (polar)
{
case true:
var response = _sharedResourcesWrapper.SendChar("#:MS#");
var response = _sharedResourcesWrapper.SendChar(":MS#");
//:MS# Slew to Target Object
//Returns:
//0 Slew is Possible
@@ -1825,7 +1825,7 @@ namespace ASCOM.Meade.net
break;
case false:
var maResponse = _sharedResourcesWrapper.SendChar("#:MA#");
var maResponse = _sharedResourcesWrapper.SendChar(":MA#");
//:MA# Autostar, LX 16”, Autostar II Slew to target Alt and Az
//Returns:
//0 - No fault
@@ -1925,7 +1925,7 @@ namespace ASCOM.Meade.net
if (_isGuiding)
return false;
var result = _sharedResourcesWrapper.SendString("#:D#");
var result = _sharedResourcesWrapper.SendString(":D#");
//:D# Requests a string of bars indicating the distance to the current target location.
//Returns:
//LX200's a string of bar characters indicating the distance.
@@ -1967,7 +1967,7 @@ namespace ASCOM.Meade.net
LogMessage("SyncToTarget", "Executing");
CheckConnected("SyncToTarget");
var result = _sharedResourcesWrapper.SendString("#:CM#");
var result = _sharedResourcesWrapper.SendString(":CM#");
//:CM# Synchronizes the telescope's position with the currently selected database object's coordinates.
//Returns:
//LX200's - a "#" terminated string with the name of the object that was synced.
@@ -1985,7 +1985,7 @@ namespace ASCOM.Meade.net
if (_targetDeclination.Equals(InvalidParameter))
throw new InvalidOperationException("Target not set");
//var result = SerialPort.CommandTerminated("#:Gd#", "#");
//var result = SerialPort.CommandTerminated(":Gd#", "#");
////:Gd# Get Currently Selected Object/Target Declination
////Returns: sDD* MM# or sDD*MMSS#
////Depending upon the current precision setting for the telescope.
@@ -2013,7 +2013,7 @@ namespace ASCOM.Meade.net
var dms = _utilities.DegreesToDMS(value, "*", ":", ":", 2);
var s = value < 0 ? string.Empty : "+";
var command = $"#:Sd{s}{dms}#";
var command = $":Sd{s}{dms}#";
LogMessage("TargetDeclination Set", $"{command}");
var result = _sharedResourcesWrapper.SendChar(command);
@@ -2040,7 +2040,7 @@ namespace ASCOM.Meade.net
if (_targetRightAscension.Equals(InvalidParameter))
throw new InvalidOperationException("Target not set");
//var result = SerialPort.CommandTerminated("#:Gr#", "#");
//var result = SerialPort.CommandTerminated(":Gr#", "#");
////:Gr# Get current/target object RA
////Returns: HH: MM.T# or HH:MM:SS
////Depending upon which precision is set for the telescope
@@ -2064,7 +2064,7 @@ namespace ASCOM.Meade.net
//todo implement the low precision version
var hms = _utilities.HoursToHMS(value, ":", ":", ":", 2);
var response = _sharedResourcesWrapper.SendChar($"#:Sr{hms}#");
var response = _sharedResourcesWrapper.SendChar($":Sr{hms}#");
//:SrHH:MM.T#
//:SrHH:MM:SS#
//Set target object RA to HH:MM.T or HH: MM: SS depending on the current precision setting.
@@ -2103,7 +2103,7 @@ namespace ASCOM.Meade.net
get
{
//todo implement this with the GW command
//var result = SerialPort.CommandTerminated("#:GT#", "#");
//var result = SerialPort.CommandTerminated(":GT#", "#");
//double rate = double.Parse(result);
@@ -2125,17 +2125,17 @@ namespace ASCOM.Meade.net
switch (value)
{
case DriveRates.driveSidereal:
_sharedResourcesWrapper.SendBlind("#:TQ#");
_sharedResourcesWrapper.SendBlind(":TQ#");
//:TQ# Selects sidereal tracking rate
//Returns: Nothing
break;
case DriveRates.driveLunar:
_sharedResourcesWrapper.SendBlind("#:TL#");
_sharedResourcesWrapper.SendBlind(":TL#");
//:TL# Set Lunar Tracking Rage
//Returns: Nothing
break;
//case DriveRates.driveSolar:
// SerialPort.Command("#:TS#");
// SerialPort.Command(":TS#");
// //:TS# Select Solar tracking rate. [LS Only]
// //Returns: Nothing
// break;
@@ -2167,7 +2167,7 @@ namespace ASCOM.Meade.net
private TimeSpan GetUtcCorrection()
{
string utcOffSet = _sharedResourcesWrapper.SendString("#:GG#");
string utcOffSet = _sharedResourcesWrapper.SendString(":GG#");
//:GG# Get UTC offset time
//Returns: sHH# or sHH.H#
//The number of decimal hours to add to local time to convert it to UTC. If the number is a whole number the
@@ -2196,11 +2196,11 @@ namespace ASCOM.Meade.net
{
var tdd = new TelescopeDateDetails
{
TelescopeDate = _sharedResourcesWrapper.SendString("#:GC#"),
TelescopeDate = _sharedResourcesWrapper.SendString(":GC#"),
//:GC# Get current date.
//Returns: MM/DD/YY#
//The current local calendar date for the telescope.
TelescopeTime = _sharedResourcesWrapper.SendString("#:GL#"),
TelescopeTime = _sharedResourcesWrapper.SendString(":GL#"),
//:GL# Get Local Time in 24 hour format
//Returns: HH:MM:SS#
//The Local Time in 24 - hour Format
@@ -2241,7 +2241,7 @@ namespace ASCOM.Meade.net
var utcCorrection = GetUtcCorrection();
var localDateTime = value - utcCorrection;
string localStingCommand = $"#:SL{localDateTime:HH:mm:ss}#";
string localStingCommand = $":SL{localDateTime:HH:mm:ss}#";
var timeResult = _sharedResourcesWrapper.SendChar(localStingCommand);
//:SLHH:MM:SS#
//Set the local Time
@@ -2253,7 +2253,7 @@ namespace ASCOM.Meade.net
throw new InvalidOperationException("Failed to set local time");
}
string localDateCommand = $"#:SC{localDateTime:MM/dd/yy}#";
string localDateCommand = $":SC{localDateTime:MM/dd/yy}#";
var dateResult = _sharedResourcesWrapper.SendChar(localDateCommand);
//:SCMM/DD/YY#
//Change Handbox Date to MM/DD/YY
+27 -10
View File
@@ -50,6 +50,8 @@ namespace ASCOM.Meade.net
private static bool _reverseFocusDirection;
private static bool _useDynamicBreaking;
/// <summary>
/// Private variable to hold an ASCOM Utilities object
/// </summary>
@@ -372,19 +374,27 @@ namespace ASCOM.Meade.net
_tl.LogMessage("Move", "Applying backlash compensation");
MoveFocuser(!direction, backlashCompensationSteps);
}
//This gives the focuser time to physically stop. Not sure if this is really needed.
//_utilities.WaitForMilliseconds(1000);
DynamicBreaking(direction);
//todo implement dynamic braking
//dynamic breaking is sending the command to move in the opposite direction immediatly followed by the command to stop.
});
}
private void DynamicBreaking(bool directionOut)
{
if (!_useDynamicBreaking)
return;
_tl.LogMessage("Move", "Applying dynamic breaking");
PerformFocuserMove(directionOut);
Halt();
}
private void MoveFocuser(bool directionOut, int steps)
{
//_sharedResourcesWrapper.SendBlind("#:FF#");
//_sharedResourcesWrapper.SendBlind(":FF#");
//:FF# Set Focus speed to fastest setting
//Returns: Nothing
@@ -396,16 +406,21 @@ namespace ASCOM.Meade.net
//All others Not Supported
_utilities.WaitForMilliseconds(100);
_sharedResourcesWrapper.SendBlind(directionOut ? "#:F+#" : "#:F-#");
PerformFocuserMove(directionOut);
_utilities.WaitForMilliseconds(steps);
Halt();
}
private void PerformFocuserMove(bool directionOut)
{
_sharedResourcesWrapper.SendBlind(directionOut ? ":F+#" : ":F-#");
//:F+# Start Focuser moving inward (toward objective)
//Returns: None
//:F-# Start Focuser moving outward (away from objective)
//Returns: None
_utilities.WaitForMilliseconds(steps);
Halt();
}
public int Position => throw new PropertyNotImplementedException("Position", false);
@@ -566,10 +581,12 @@ namespace ASCOM.Meade.net
_comPort = profileProperties.ComPort;
_backlashCompensation = profileProperties.BacklashCompensation;
_reverseFocusDirection = profileProperties.ReverseFocusDirection;
_useDynamicBreaking = profileProperties.DynamicBreaking;
LogMessage("ReadProfile", $"Trace logger enabled: {_tl.Enabled}");
LogMessage("ReadProfile", $"Com Port: {_comPort}");
LogMessage("ReadProfile", $"Backlash Steps: {_backlashCompensation}");
LogMessage("ReadProfile", $"Dynamic breaking: {_useDynamicBreaking}");
}
/// <summary>
+1 -1
View File
@@ -3,7 +3,7 @@
<AutoEnable>True</AutoEnable>
<CurrentEngineMode>Run all tests automatically [Global]</CurrentEngineMode>
<MetricsTreeShowTestProjects>False</MetricsTreeShowTestProjects>
<StatusIndicatorSplitterDistance>25</StatusIndicatorSplitterDistance>
<StatusIndicatorSplitterDistance>80</StatusIndicatorSplitterDistance>
<TestsWindowMenuOptions>
<VerticalSplitMenuOption>false</VerticalSplitMenuOption>
<ShowPassingTestsMenuOption>false</ShowPassingTestsMenuOption>
+1
View File
@@ -10,5 +10,6 @@ namespace ASCOM.Meade.net
public string GuidingStyle { get; set; }
public int BacklashCompensation { get; set; }
public bool ReverseFocusDirection { get; set; }
public bool DynamicBreaking { get; set; }
}
}
+4 -2
View File
@@ -84,6 +84,7 @@ namespace ASCOM.Meade.net
txtBacklashSteps.Text = profileProperties.BacklashCompensation.ToString(CultureInfo.CurrentCulture);
cbxReverseDirection.Checked = profileProperties.ReverseFocusDirection;
cbxDynamicBreaking.Checked = profileProperties.DynamicBreaking;
}
public ProfileProperties GetProfile()
@@ -96,8 +97,9 @@ namespace ASCOM.Meade.net
Precision = cboPrecision.SelectedItem.ToString(),
GuidingStyle = cboGuidingStyle.SelectedItem.ToString(),
BacklashCompensation = int.Parse(txtBacklashSteps.Text),
ReverseFocusDirection = cbxReverseDirection.Checked
};
ReverseFocusDirection = cbxReverseDirection.Checked,
DynamicBreaking = cbxDynamicBreaking.Checked
};
return profileProperties;
}
+9
View File
@@ -54,6 +54,7 @@ namespace ASCOM.Meade.net
this.label10 = new System.Windows.Forms.Label();
this.label11 = new System.Windows.Forms.Label();
this.cbxReverseDirection = new System.Windows.Forms.CheckBox();
this.cbxDynamicBreaking = new System.Windows.Forms.CheckBox();
((System.ComponentModel.ISupportInitialize)(this.picASCOM)).BeginInit();
this.SuspendLayout();
//
@@ -194,10 +195,17 @@ namespace ASCOM.Meade.net
this.cbxReverseDirection.Name = "cbxReverseDirection";
this.cbxReverseDirection.UseVisualStyleBackColor = true;
//
// cbxDynamicBreaking
//
resources.ApplyResources(this.cbxDynamicBreaking, "cbxDynamicBreaking");
this.cbxDynamicBreaking.Name = "cbxDynamicBreaking";
this.cbxDynamicBreaking.UseVisualStyleBackColor = true;
//
// SetupDialogForm
//
resources.ApplyResources(this, "$this");
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.cbxDynamicBreaking);
this.Controls.Add(this.cbxReverseDirection);
this.Controls.Add(this.label11);
this.Controls.Add(this.label10);
@@ -257,5 +265,6 @@ namespace ASCOM.Meade.net
private Label label10;
private Label label11;
private CheckBox cbxReverseDirection;
private CheckBox cbxDynamicBreaking;
}
}
+51 -24
View File
@@ -123,7 +123,7 @@
</data>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="cmdOK.Location" type="System.Drawing.Point, System.Drawing">
<value>281, 387</value>
<value>281, 413</value>
</data>
<data name="cmdOK.Size" type="System.Drawing.Size, System.Drawing">
<value>59, 24</value>
@@ -145,13 +145,13 @@
<value>$this</value>
</data>
<data name="&gt;&gt;cmdOK.ZOrder" xml:space="preserve">
<value>21</value>
<value>22</value>
</data>
<data name="cmdCancel.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Bottom, Right</value>
</data>
<data name="cmdCancel.Location" type="System.Drawing.Point, System.Drawing">
<value>281, 417</value>
<value>281, 443</value>
</data>
<data name="cmdCancel.Size" type="System.Drawing.Size, System.Drawing">
<value>59, 25</value>
@@ -172,7 +172,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;cmdCancel.ZOrder" xml:space="preserve">
<value>20</value>
<value>21</value>
</data>
<data name="label1.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 9</value>
@@ -196,7 +196,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;label1.ZOrder" xml:space="preserve">
<value>19</value>
<value>20</value>
</data>
<data name="picASCOM.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Top, Right</value>
@@ -223,7 +223,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;picASCOM.ZOrder" xml:space="preserve">
<value>18</value>
<value>19</value>
</data>
<data name="label2.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@@ -250,7 +250,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;label2.ZOrder" xml:space="preserve">
<value>17</value>
<value>18</value>
</data>
<data name="chkTrace.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@@ -277,7 +277,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;chkTrace.ZOrder" xml:space="preserve">
<value>16</value>
<value>17</value>
</data>
<data name="comboBoxComPort.Location" type="System.Drawing.Point, System.Drawing">
<value>97, 87</value>
@@ -298,7 +298,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;comboBoxComPort.ZOrder" xml:space="preserve">
<value>15</value>
<value>16</value>
</data>
<data name="label3.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@@ -325,7 +325,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;label3.ZOrder" xml:space="preserve">
<value>14</value>
<value>15</value>
</data>
<data name="txtGuideRate.Location" type="System.Drawing.Point, System.Drawing">
<value>97, 199</value>
@@ -349,7 +349,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;txtGuideRate.ZOrder" xml:space="preserve">
<value>13</value>
<value>14</value>
</data>
<data name="label4.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@@ -376,7 +376,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;label4.ZOrder" xml:space="preserve">
<value>12</value>
<value>13</value>
</data>
<data name="lblPercentOfSiderealRate.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@@ -403,7 +403,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;lblPercentOfSiderealRate.ZOrder" xml:space="preserve">
<value>11</value>
<value>12</value>
</data>
<data name="label5.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@@ -430,7 +430,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;label5.ZOrder" xml:space="preserve">
<value>10</value>
<value>11</value>
</data>
<data name="cboPrecision.Items" xml:space="preserve">
<value>Unchanged</value>
@@ -460,7 +460,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;cboPrecision.ZOrder" xml:space="preserve">
<value>9</value>
<value>10</value>
</data>
<data name="label6.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@@ -490,7 +490,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;label6.ZOrder" xml:space="preserve">
<value>8</value>
<value>9</value>
</data>
<data name="cboGuidingStyle.Items" xml:space="preserve">
<value>Auto</value>
@@ -520,7 +520,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;cboGuidingStyle.ZOrder" xml:space="preserve">
<value>7</value>
<value>8</value>
</data>
<data name="label7.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@@ -550,7 +550,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;label7.ZOrder" xml:space="preserve">
<value>6</value>
<value>7</value>
</data>
<data name="label8.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@@ -583,7 +583,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;label8.ZOrder" xml:space="preserve">
<value>5</value>
<value>6</value>
</data>
<data name="txtBacklashSteps.Location" type="System.Drawing.Point, System.Drawing">
<value>97, 335</value>
@@ -607,7 +607,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;txtBacklashSteps.ZOrder" xml:space="preserve">
<value>3</value>
<value>4</value>
</data>
<data name="label9.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@@ -637,7 +637,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;label9.ZOrder" xml:space="preserve">
<value>4</value>
<value>5</value>
</data>
<data name="label10.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@@ -667,7 +667,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;label10.ZOrder" xml:space="preserve">
<value>2</value>
<value>3</value>
</data>
<data name="label11.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@@ -700,7 +700,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;label11.ZOrder" xml:space="preserve">
<value>1</value>
<value>2</value>
</data>
<data name="cbxReverseDirection.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@@ -727,6 +727,33 @@
<value>$this</value>
</data>
<data name="&gt;&gt;cbxReverseDirection.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<data name="cbxDynamicBreaking.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="cbxDynamicBreaking.Location" type="System.Drawing.Point, System.Drawing">
<value>97, 384</value>
</data>
<data name="cbxDynamicBreaking.Size" type="System.Drawing.Size, System.Drawing">
<value>112, 17</value>
</data>
<data name="cbxDynamicBreaking.TabIndex" type="System.Int32, mscorlib">
<value>23</value>
</data>
<data name="cbxDynamicBreaking.Text" xml:space="preserve">
<value>Dynamic Breaking</value>
</data>
<data name="&gt;&gt;cbxDynamicBreaking.Name" xml:space="preserve">
<value>cbxDynamicBreaking</value>
</data>
<data name="&gt;&gt;cbxDynamicBreaking.Type" xml:space="preserve">
<value>System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;cbxDynamicBreaking.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;cbxDynamicBreaking.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
@@ -736,7 +763,7 @@
<value>6, 13</value>
</data>
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
<value>350, 450</value>
<value>350, 476</value>
</data>
<data name="$this.StartPosition" type="System.Windows.Forms.FormStartPosition, System.Windows.Forms">
<value>CenterScreen</value>
+4
View File
@@ -143,6 +143,7 @@ namespace ASCOM.Meade.net
private const string GuidingStyleProfileName = "Guiding Style";
private const string BacklashCompensationName = "Backlash Compensation";
private const string ReverseFocusDirectionName = "Reverse Focuser Direction";
private const string DynamicBreakingName = "Dynamic Breaking";
public static void WriteProfile(ProfileProperties profileProperties)
{
@@ -158,6 +159,7 @@ namespace ASCOM.Meade.net
driverProfile.WriteValue(DriverId, GuidingStyleProfileName, profileProperties.GuidingStyle);
driverProfile.WriteValue(DriverId, BacklashCompensationName, profileProperties.BacklashCompensation.ToString());
driverProfile.WriteValue(DriverId, ReverseFocusDirectionName, profileProperties.ReverseFocusDirection.ToString());
driverProfile.WriteValue(DriverId, DynamicBreakingName, profileProperties.DynamicBreaking.ToString());
}
}
}
@@ -169,6 +171,7 @@ namespace ASCOM.Meade.net
private const string GuidingStyleDefault = "Auto";
private const string BacklashCompensationDefault = "3000";
private const string ReverseFocuserDiectionDefault = "true";
private const string DynamicBreakingDefault = "true";
public static ProfileProperties ReadProfile()
{
@@ -185,6 +188,7 @@ namespace ASCOM.Meade.net
profileProperties.GuidingStyle = driverProfile.GetValue(DriverId, GuidingStyleProfileName, string.Empty, GuidingStyleDefault);
profileProperties.BacklashCompensation = Convert.ToInt32(driverProfile.GetValue(DriverId, BacklashCompensationName, string.Empty, BacklashCompensationDefault));
profileProperties.ReverseFocusDirection = Convert.ToBoolean(driverProfile.GetValue(DriverId, ReverseFocusDirectionName, string.Empty, ReverseFocuserDiectionDefault));
profileProperties.DynamicBreaking = Convert.ToBoolean(driverProfile.GetValue(DriverId, DynamicBreakingName, string.Empty, DynamicBreakingDefault));
}
return profileProperties;