Added extra # in front of every command as recommended by Meade.

This commit is contained in:
2019-09-30 23:27:18 +01:00
parent 0ea195e073
commit 97e77c839a
4 changed files with 260 additions and 260 deletions
@@ -401,13 +401,13 @@ namespace Meade.net.Focuser.UnitTests
if (position < 0)
{
_sharedResourcesWrapperMock.Verify( x => x.SendBlind(":F-#"), Times.AtLeastOnce);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":F+#"), Times.Never);
_sharedResourcesWrapperMock.Verify( x => x.SendBlind("#:F-#"), Times.AtLeastOnce);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("#:F+#"), Times.Never);
}
else
{
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":F-#"), Times.Never);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":F+#"), Times.AtLeastOnce);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("#:F-#"), Times.Never);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("#:F+#"), Times.AtLeastOnce);
}
_sharedResourcesWrapperMock.Verify( x => x.Lock(It.IsAny<Action>()), Times.Once);
@@ -42,7 +42,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(); });
@@ -117,36 +117,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();
@@ -167,7 +167,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")]
@@ -182,10 +182,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)
{
ConnectTelescope();
@@ -211,10 +211,10 @@ namespace Meade.net.Telescope.UnitTests
Assert.That(exception.Message, Is.EqualTo($"Site {parameters} not allowed, must be between 1 and 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)
{
ConnectTelescope();
@@ -352,8 +352,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);
}
}
@@ -368,9 +368,9 @@ namespace Meade.net.Telescope.UnitTests
_telescope.Connected = true;
_sharedResourcesWrapperMock.Verify( x => x.Connect("Serial", It.IsAny<string>()), 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]
@@ -384,8 +384,8 @@ namespace Meade.net.Telescope.UnitTests
_telescope.Connected = true;
_sharedResourcesWrapperMock.Verify(x => x.Connect("Serial", It.IsAny<string>()), 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);
}
@@ -449,37 +449,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]
@@ -521,7 +521,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]
@@ -621,9 +621,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);
@@ -791,7 +791,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)]
@@ -803,7 +803,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;
@@ -819,7 +819,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)]
@@ -835,7 +835,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]
@@ -944,7 +944,7 @@ namespace Meade.net.Telescope.UnitTests
var expectedResult = 12.34;
ConnectTelescope();
_sharedResourcesWrapperMock.Setup(x => x.SendString(":GD#")).Returns(declincationString);
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:GD#")).Returns(declincationString);
_utilMock.Setup(x => x.DMSToDegrees(declincationString)).Returns(expectedResult);
var actualResult = _telescope.Declination;
@@ -1059,7 +1059,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));
}
@@ -1092,7 +1092,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));
}
@@ -1114,23 +1114,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();
@@ -1141,10 +1141,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)
@@ -1152,31 +1152,31 @@ namespace Meade.net.Telescope.UnitTests
case TelescopeAxes.axisPrimary:
if (rate == 0)
{
_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);
}
else if (rate > 0)
{
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":Me#"), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("#:Me#"), Times.Once);
}
else
{
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":Mw#"), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("#:Mw#"), Times.Once);
}
break;
case TelescopeAxes.axisSecondary:
if (rate == 0)
{
_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);
}
else if (rate > 0)
{
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":Mn#"), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("#:Mn#"), Times.Once);
}
else
{
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":Ms#"), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("#:Ms#"), Times.Once);
}
break;
default:
@@ -1221,11 +1221,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);
}
@@ -1236,7 +1236,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);
@@ -1244,7 +1244,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);
}
@@ -1283,7 +1283,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);
}
@@ -1317,10 +1317,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)]
@@ -1353,10 +1353,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]
@@ -1378,12 +1378,12 @@ namespace Meade.net.Telescope.UnitTests
ConnectTelescope();
_sharedResourcesWrapperMock.Setup(x => x.SendString(":GR#")).Returns(telescopeRaResult);
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:GR#")).Returns(telescopeRaResult);
_utilMock.Setup(x => x.HMSToHours(telescopeRaResult)).Returns(hmsResult);
var result = _telescope.RightAscension;
_sharedResourcesWrapperMock.Verify( x => x.SendString(":GR#"), Times.Once);
_sharedResourcesWrapperMock.Verify( x => x.SendString("#:GR#"), Times.Once);
_utilMock.Verify( x => x.HMSToHours(telescopeRaResult), Times.Once);
Assert.That(result,Is.EqualTo(hmsResult));
@@ -1506,12 +1506,12 @@ namespace Meade.net.Telescope.UnitTests
var siteLatitudeValue = 123.45;
ConnectTelescope();
_sharedResourcesWrapperMock.Setup(x => x.SendString(":Gt#")).Returns(siteLatitudeString);
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:Gt#")).Returns(siteLatitudeString);
_utilMock.Setup(x => x.DMSToDegrees(siteLatitudeString)).Returns(siteLatitudeValue);
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));
}
@@ -1554,8 +1554,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)
{
ConnectTelescope();
@@ -1590,7 +1590,7 @@ namespace Meade.net.Telescope.UnitTests
ConnectTelescope();
_sharedResourcesWrapperMock.Setup(x => x.SendString(":Gg#")).Returns(telescopeLongitude);
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:Gg#")).Returns(telescopeLongitude);
_utilMock.Setup(x => x.DMSToDegrees(telescopeLongitude)).Returns(telescopeLongitudeValue);
var result = _telescope.SiteLongitude;
@@ -1634,7 +1634,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)
{
ConnectTelescope();
@@ -1668,12 +1668,12 @@ namespace Meade.net.Telescope.UnitTests
{
ConnectTelescope();
_sharedResourcesWrapperMock.Setup(x => x.SendString(":CM#")).Returns(string.Empty);
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:CM#")).Returns(string.Empty);
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]
@@ -1681,11 +1681,11 @@ namespace Meade.net.Telescope.UnitTests
{
ConnectTelescope();
_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'#");
Assert.DoesNotThrow(() => { _telescope.SyncToTarget(); });
_sharedResourcesWrapperMock.Verify(x => x.SendString(":CM#"), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.SendString("#:CM#"), Times.Once);
}
[Test]
@@ -1724,10 +1724,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)
{
ConnectTelescope();
@@ -1753,7 +1753,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)
{
ConnectTelescope();
@@ -1804,8 +1804,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)
{
ConnectTelescope();
@@ -1831,7 +1831,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)
{
ConnectTelescope();
@@ -1868,8 +1868,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();
@@ -1939,9 +1939,9 @@ namespace Meade.net.Telescope.UnitTests
{
ConnectTelescope();
_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);
var result = _telescope.UTCDate;
@@ -1974,8 +1974,8 @@ namespace Meade.net.Telescope.UnitTests
ConnectTelescope();
_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");
var exception = Assert.Throws<InvalidOperationException>(() => { _telescope.UTCDate = newDate; } );
@@ -1993,9 +1993,9 @@ namespace Meade.net.Telescope.UnitTests
ConnectTelescope();
_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");
var exception = Assert.Throws<InvalidOperationException>(() => { _telescope.UTCDate = newDate; });
@@ -2015,9 +2015,9 @@ namespace Meade.net.Telescope.UnitTests
ConnectTelescope();
_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");
_telescope.UTCDate = newDate;
@@ -2036,14 +2036,14 @@ namespace Meade.net.Telescope.UnitTests
ConnectTelescope();
_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");
_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));
}
@@ -2055,7 +2055,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]
@@ -2067,7 +2067,7 @@ 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]
@@ -2075,13 +2075,13 @@ namespace Meade.net.Telescope.UnitTests
{
ConnectTelescope();
_sharedResourcesWrapperMock.Setup(x => x.SendString(":D#")).Returns("|");
_sharedResourcesWrapperMock.Setup(x => x.SendString("#:D#")).Returns("|");
var result = _telescope.Slewing;
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)]
@@ -2097,7 +2097,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);
}
@@ -2150,11 +2150,11 @@ namespace Meade.net.Telescope.UnitTests
_telescope.TargetRightAscension = 2;
_telescope.TargetDeclination = 1;
_sharedResourcesWrapperMock.Setup(x => x.SendChar(":MS#")).Returns("0");
_sharedResourcesWrapperMock.Setup(x => x.SendChar("#:MS#")).Returns("0");
_telescope.SlewToTargetAsync();
_sharedResourcesWrapperMock.Verify(x => x.SendChar(":MS#"), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.SendChar("#:MS#"), Times.Once);
}
[Test]
@@ -2165,7 +2165,7 @@ namespace Meade.net.Telescope.UnitTests
_telescope.TargetRightAscension = 2;
_telescope.TargetDeclination = 1;
_sharedResourcesWrapperMock.Setup(x => x.SendChar(":MS#")).Returns("1");
_sharedResourcesWrapperMock.Setup(x => x.SendChar("#:MS#")).Returns("1");
_sharedResourcesWrapperMock.Setup(x => x.ReadTerminated()).Returns("Below horizon");
@@ -2181,7 +2181,7 @@ namespace Meade.net.Telescope.UnitTests
_telescope.TargetRightAscension = 2;
_telescope.TargetDeclination = 1;
_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");
@@ -2204,11 +2204,11 @@ namespace Meade.net.Telescope.UnitTests
_telescope.TargetRightAscension = 2;
_telescope.TargetDeclination = 1;
_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)
@@ -2236,11 +2236,11 @@ namespace Meade.net.Telescope.UnitTests
ConnectTelescope();
_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)
@@ -2254,7 +2254,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]
@@ -2272,11 +2272,11 @@ namespace Meade.net.Telescope.UnitTests
ConnectTelescope();
_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)
@@ -2287,7 +2287,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));
}
@@ -2345,21 +2345,21 @@ namespace Meade.net.Telescope.UnitTests
ConnectTelescope();
_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");
_telescope.SlewToAltAzAsync(azimuth, altitude);
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]
@@ -2379,19 +2379,19 @@ namespace Meade.net.Telescope.UnitTests
ConnectTelescope();
_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)
@@ -2403,7 +2403,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));
}
@@ -2433,14 +2433,14 @@ namespace Meade.net.Telescope.UnitTests
ConnectTelescope();
_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);
@@ -2478,14 +2478,14 @@ namespace Meade.net.Telescope.UnitTests
ConnectTelescope();
_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);
@@ -2511,12 +2511,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);
}
}
}
+83 -83
View File
@@ -169,68 +169,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);
@@ -492,7 +492,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.
@@ -502,7 +502,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
@@ -514,7 +514,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.
@@ -559,7 +559,7 @@ namespace ASCOM.Meade.net
if (site > 4)
throw new ArgumentOutOfRangeException(nameof(site), site, Resources.Telescope_SelectSite_Site_cannot_be_higher_than_4);
_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
@@ -578,7 +578,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:
@@ -586,7 +586,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:
@@ -594,7 +594,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:
@@ -602,7 +602,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:
@@ -631,22 +631,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.
@@ -703,11 +703,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#
@@ -727,7 +727,7 @@ namespace ASCOM.Meade.net
CheckConnected("AbortSlew");
LogMessage("AbortSlew", "Aborting slew");
_sharedResourcesWrapper.SendBlind(":Q#");
_sharedResourcesWrapper.SendBlind("#:Q#");
//:Q# Halt all current slewing
//Returns:Nothing
@@ -756,7 +756,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:
@@ -798,13 +798,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;
@@ -828,7 +828,7 @@ namespace ASCOM.Meade.net
return altAz.Altitude;
////todo 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.
@@ -913,7 +913,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.
@@ -1095,7 +1095,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.
@@ -1183,7 +1183,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
@@ -1264,22 +1264,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;
@@ -1293,23 +1293,23 @@ namespace ASCOM.Meade.net
if (rate == 0)
{
_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
}
else if (rate > 0)
{
_sharedResourcesWrapper.SendBlind(":Me#");
_sharedResourcesWrapper.SendBlind("#:Me#");
//:Me# Move Telescope East at current slew rate
//Returns: Nothing
_movingPrimary = true;
}
else
{
_sharedResourcesWrapper.SendBlind(":Mw#");
_sharedResourcesWrapper.SendBlind("#:Mw#");
//:Mw# Move Telescope West at current slew rate
//Returns: Nothing
_movingPrimary = true;
@@ -1320,23 +1320,23 @@ namespace ASCOM.Meade.net
if (rate == 0)
{
_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
}
else if (rate > 0)
{
_sharedResourcesWrapper.SendBlind(":Mn#");
_sharedResourcesWrapper.SendBlind("#:Mn#");
//:Mn# Move Telescope North at current slew rate
//Returns: Nothing
_movingSecondary = true;
}
else
{
_sharedResourcesWrapper.SendBlind(":Ms#");
_sharedResourcesWrapper.SendBlind("#:Ms#");
//:Ms# Move Telescope South at current slew rate
//Returns: Nothing
_movingSecondary = true;
@@ -1356,7 +1356,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;
@@ -1389,7 +1389,7 @@ namespace ASCOM.Meade.net
if (_userNewerPulseGuiding && duration < 10000)
{
LogMessage("PulseGuide", "Using new pulse guiding technique");
_sharedResourcesWrapper.SendBlind($":Mg{d}{duration:0000}#");
_sharedResourcesWrapper.SendBlind($"#:Mg{d}{duration:0000}#");
//:MgnDDDD#
//:MgsDDDD#
//:MgeDDDD#
@@ -1405,10 +1405,10 @@ namespace ASCOM.Meade.net
LogMessage("PulseGuide", "Using old pulse guiding technique");
_sharedResourcesWrapper.Lock(() =>
{
_sharedResourcesWrapper.SendBlind(":RG#"); //Make sure we are at guide rate
_sharedResourcesWrapper.SendBlind("#:RG#"); //Make sure we are at guide rate
//:RG# Set Slew rate to Guiding Rate (slowest)
//Returns: Nothing
_sharedResourcesWrapper.SendBlind($":M{d}#");
_sharedResourcesWrapper.SendBlind($"#:M{d}#");
//:Me# Move Telescope East at current slew rate
//Returns: Nothing
//:Mn# Move Telescope North at current slew rate
@@ -1418,7 +1418,7 @@ namespace ASCOM.Meade.net
//:Mw# Move Telescope West at current slew rate
//Returns: Nothing
_utilities.WaitForMilliseconds(duration);
_sharedResourcesWrapper.SendBlind($":Q{d}#");
_sharedResourcesWrapper.SendBlind($"#:Q{d}#");
//:Qe# Halt eastward Slews
//Returns: Nothing
//:Qn# Halt northward Slews
@@ -1436,7 +1436,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
@@ -1532,7 +1532,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.
@@ -1558,7 +1558,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#
@@ -1577,7 +1577,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
@@ -1613,7 +1613,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#
@@ -1671,7 +1671,7 @@ namespace ASCOM.Meade.net
// var dms = _utilities.DegreesToDMS(value, "*", "'", "",0);
// var s = value < 0 ? string.Empty : "+";
// var result = _sharedResourcesWrapper.SendChar($":Sa{s}{dms}#");
// var result = _sharedResourcesWrapper.SendChar($"#:Sa{s}{dms}#");
// //:SasDD*MM#
// //Set target object altitude to sDD*MM# or sDD*MMSS# [LX 16”, Autostar, Autostar II]
// //Returns:
@@ -1699,7 +1699,7 @@ namespace ASCOM.Meade.net
// var dms = _utilitiesExtra.DegreesToDM(value, "*" );
// var result = _sharedResourcesWrapper.SendChar($":Sz{dms}#");
// var result = _sharedResourcesWrapper.SendChar($"#:Sz{dms}#");
// //:SzDDD*MM#
// //Sets the target Object Azimuth[LX 16” and Autostar II only]
// //Returns:
@@ -1761,7 +1761,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
@@ -1792,7 +1792,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
@@ -1880,7 +1880,7 @@ namespace ASCOM.Meade.net
CheckConnected("Slewing Get");
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.
@@ -1923,7 +1923,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.
@@ -1941,7 +1941,7 @@ namespace ASCOM.Meade.net
if (_targetDeclination == 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.
@@ -1969,7 +1969,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);
@@ -1996,7 +1996,7 @@ namespace ASCOM.Meade.net
if (_targetRightAscension == 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
@@ -2020,7 +2020,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.
@@ -2058,7 +2058,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);
@@ -2080,17 +2080,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;
@@ -2122,7 +2122,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
@@ -2151,11 +2151,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
@@ -2196,7 +2196,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
@@ -2208,7 +2208,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
+2 -2
View File
@@ -365,7 +365,7 @@ namespace ASCOM.Meade.net
{
_sharedResourcesWrapper.Lock(() =>
{
//_sharedResourcesWrapper.SendBlind(":FF#");
//_sharedResourcesWrapper.SendBlind("#:FF#");
//:FF# Set Focus speed to fastest setting
//Returns: Nothing
@@ -382,7 +382,7 @@ namespace ASCOM.Meade.net
Stopwatch stopwatch = Stopwatch.StartNew();
while (stopwatch.ElapsedMilliseconds < steps)
{
_sharedResourcesWrapper.SendBlind(directionOut ? ":F+#" : ":F-#");
_sharedResourcesWrapper.SendBlind(directionOut ? "#:F+#" : "#:F-#");
//:F+# Start Focuser moving inward (toward objective)
//Returns: None