Compare commits
38 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8d8b50957c | |||
| faa6ad757e | |||
| 64df8282a0 | |||
| 8478af26bf | |||
| 77c87a51fa | |||
| 631aa91d94 | |||
| 90713de34b | |||
| a3408a86c3 | |||
| 74440b6b3b | |||
| f1d100892b | |||
| c6baab2b12 | |||
| f47b205025 | |||
| 6c27499769 | |||
| 6dff32505e | |||
| 7afd364efa | |||
| 6fc476b031 | |||
| af750549fe | |||
| 2e3572375f | |||
| b23da15022 | |||
| 0b75b8d2cd | |||
| 036a9d7116 | |||
| 6c769f3649 | |||
| bdbd206a54 | |||
| 1684bd60bd | |||
| 8c4b08d0c6 | |||
| fe3c106954 | |||
| 3d0464f379 | |||
| d1b5652228 | |||
| 65e06f2d6c | |||
| b27e50275d | |||
| a101d3a2d7 | |||
| d7637928b7 | |||
| 486a9205ee | |||
| 2c2c59290e | |||
| 70e615bb4e | |||
| 8c94fd6b71 | |||
| a2abbbb3d0 | |||
| 21e7bcd530 |
@@ -123,7 +123,8 @@ namespace AstroMath.UnitTests
|
|||||||
|
|
||||||
var altAz = _astroMath.ConvertEqToHoz(hourAngle, latitude, equatorialCoordinates);
|
var altAz = _astroMath.ConvertEqToHoz(hourAngle, latitude, equatorialCoordinates);
|
||||||
|
|
||||||
Assert.That(altAz.Altitude, Is.EqualTo(20.958562421092779));
|
Assert.That(altAz.Altitude, Is.GreaterThan(20.958562421092770));
|
||||||
|
Assert.That(altAz.Altitude, Is.LessThanOrEqualTo(20.958562421092779));
|
||||||
Assert.That(altAz.Azimuth, Is.EqualTo(281.2728706962269));
|
Assert.That(altAz.Azimuth, Is.EqualTo(281.2728706962269));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -109,16 +109,17 @@ namespace Meade.net.Focuser.UnitTests
|
|||||||
Assert.That(exception.Message, Is.EqualTo("Not connected to focuser when trying to execute: CommandBlind"));
|
Assert.That(exception.Message, Is.EqualTo("Not connected to focuser when trying to execute: CommandBlind"));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[TestCase(false)]
|
||||||
public void CommandBlind_WhenConnected_ThenSendsExpectedMessage()
|
[TestCase(true)]
|
||||||
|
public void CommandBlind_WhenConnected_ThenSendsExpectedMessage(bool raw)
|
||||||
{
|
{
|
||||||
string expectedMessage = "test blind Message";
|
string expectedMessage = "test blind Message";
|
||||||
|
|
||||||
ConnectFocuser();
|
ConnectFocuser();
|
||||||
|
|
||||||
_focuser.CommandBlind(expectedMessage, true);
|
_focuser.CommandBlind(expectedMessage, raw);
|
||||||
|
|
||||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(expectedMessage), Times.Once);
|
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(expectedMessage, raw), Times.Once);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -130,16 +131,19 @@ namespace Meade.net.Focuser.UnitTests
|
|||||||
Assert.That(exception.Message, Is.EqualTo("Not connected to focuser when trying to execute: CommandBool"));
|
Assert.That(exception.Message, Is.EqualTo("Not connected to focuser when trying to execute: CommandBool"));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[TestCase(false)]
|
||||||
public void CommandBool_WhenConnected_ThenSendsExpectedMessage()
|
[TestCase(true)]
|
||||||
|
public void CommandBool_WhenConnected_ThenSendsExpectedMessage(bool raw)
|
||||||
{
|
{
|
||||||
string expectedMessage = "test blind Message";
|
string expectedMessage = "test blind Message";
|
||||||
|
_sharedResourcesWrapperMock.Setup(x => x.SendBool(expectedMessage, raw)).Returns(true);
|
||||||
|
|
||||||
ConnectFocuser();
|
ConnectFocuser();
|
||||||
|
|
||||||
var exception = Assert.Throws<MethodNotImplementedException>(() => { _focuser.CommandBool(expectedMessage, true); });
|
var result = _focuser.CommandBool(expectedMessage, raw);
|
||||||
|
|
||||||
Assert.That(exception.Message, Is.EqualTo("Method CommandBool is not implemented in this driver."));
|
_sharedResourcesWrapperMock.Verify(x => x.SendBool(expectedMessage, raw), Times.Once);
|
||||||
|
Assert.That(result, Is.True);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -319,7 +323,7 @@ namespace Meade.net.Focuser.UnitTests
|
|||||||
|
|
||||||
_focuser.Halt();
|
_focuser.Halt();
|
||||||
|
|
||||||
_sharedResourcesWrapperMock.Verify( x => x.SendBlind(":FQ#"), Times.AtLeastOnce);
|
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("FQ", false), Times.AtLeastOnce);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -334,13 +338,13 @@ namespace Meade.net.Focuser.UnitTests
|
|||||||
|
|
||||||
[TestCase(false)]
|
[TestCase(false)]
|
||||||
[TestCase(true)]
|
[TestCase(true)]
|
||||||
public void Link_Get_ReturnsSameValueAsConnected( bool connected)
|
public void Link_Get_ReturnsSameValueAsConnected(bool connected)
|
||||||
{
|
{
|
||||||
_sharedResourcesWrapperMock.Setup(x => x.ProductName).Returns(() => TelescopeList.Autostar497);
|
_sharedResourcesWrapperMock.Setup(x => x.ProductName).Returns(() => TelescopeList.Autostar497);
|
||||||
_sharedResourcesWrapperMock.Setup(x => x.FirmwareVersion).Returns(() => TelescopeList.Autostar497_31Ee);
|
_sharedResourcesWrapperMock.Setup(x => x.FirmwareVersion).Returns(() => TelescopeList.Autostar497_31Ee);
|
||||||
_focuser.Connected = connected;
|
_focuser.Connected = connected;
|
||||||
|
|
||||||
Assert.That( _focuser.Link, Is.EqualTo(connected));
|
Assert.That(_focuser.Link, Is.EqualTo(connected));
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestCase(false)]
|
[TestCase(false)]
|
||||||
@@ -394,12 +398,12 @@ namespace Meade.net.Focuser.UnitTests
|
|||||||
|
|
||||||
_focuser.Move(0);
|
_focuser.Move(0);
|
||||||
|
|
||||||
_utilMock.Verify( x => x.WaitForMilliseconds(It.IsAny<int>()), Times.Never);
|
_utilMock.Verify(x => x.WaitForMilliseconds(It.IsAny<int>()), Times.Never);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestCase(200)]
|
[TestCase(200)]
|
||||||
[TestCase(-200)]
|
[TestCase(-200)]
|
||||||
public void Move_WhenIncrementIsNot0_ThenMovesFocuserAndStopsFocuser( int position)
|
public void Move_WhenIncrementIsNot0_ThenMovesFocuserAndStopsFocuser(int position)
|
||||||
{
|
{
|
||||||
_profileProperties.BacklashCompensation = 0;
|
_profileProperties.BacklashCompensation = 0;
|
||||||
|
|
||||||
@@ -409,16 +413,16 @@ namespace Meade.net.Focuser.UnitTests
|
|||||||
|
|
||||||
if (position < 0)
|
if (position < 0)
|
||||||
{
|
{
|
||||||
_sharedResourcesWrapperMock.Verify( x => x.SendBlind(":F-#"), Times.Once);
|
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("F-", false), Times.Once);
|
||||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":F+#"), Times.Never);
|
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("F+", false), Times.Never);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":F-#"), Times.Never);
|
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("F-", false), Times.Never);
|
||||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":F+#"), Times.Once);
|
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("F+", false), Times.Once);
|
||||||
}
|
}
|
||||||
|
|
||||||
_sharedResourcesWrapperMock.Verify( x => x.Lock(It.IsAny<Action>()), Times.Once);
|
_sharedResourcesWrapperMock.Verify(x => x.Lock(It.IsAny<Action>()), Times.Once);
|
||||||
|
|
||||||
_utilMock.Verify(x => x.WaitForMilliseconds(Math.Abs(position)), Times.Once);
|
_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(Math.Abs(_profileProperties.BacklashCompensation)), Times.Never);
|
||||||
@@ -437,16 +441,16 @@ namespace Meade.net.Focuser.UnitTests
|
|||||||
|
|
||||||
if (position < 0)
|
if (position < 0)
|
||||||
{
|
{
|
||||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":F-#"), Times.Once);
|
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("F-", false), Times.Once);
|
||||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":F+#"), Times.Never);
|
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("F+", false), Times.Never);
|
||||||
_utilMock.Verify(x => x.WaitForMilliseconds(Math.Abs(position)), Times.Once);
|
_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(Math.Abs(_profileProperties.BacklashCompensation)), Times.Never);
|
||||||
_utilMock.Verify(x => x.WaitForMilliseconds(100), Times.Exactly(1));
|
_utilMock.Verify(x => x.WaitForMilliseconds(100), Times.Exactly(1));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":F-#"), Times.Once);
|
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("F-", false), Times.Once);
|
||||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":F+#"), Times.Once);
|
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("F+", false), Times.Once);
|
||||||
_utilMock.Verify(x => x.WaitForMilliseconds(Math.Abs(position) + _profileProperties.BacklashCompensation), 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(_profileProperties.BacklashCompensation), Times.Once);
|
||||||
_utilMock.Verify(x => x.WaitForMilliseconds(100), Times.Exactly(2));
|
_utilMock.Verify(x => x.WaitForMilliseconds(100), Times.Exactly(2));
|
||||||
@@ -503,7 +507,7 @@ namespace Meade.net.Focuser.UnitTests
|
|||||||
{
|
{
|
||||||
var exception = Assert.Throws<PropertyNotImplementedException>(() =>
|
var exception = Assert.Throws<PropertyNotImplementedException>(() =>
|
||||||
{
|
{
|
||||||
var result = _focuser.Temperature;
|
var result = _focuser.Temperature;
|
||||||
Assert.Fail($"{result} should not have a value");
|
Assert.Fail($"{result} should not have a value");
|
||||||
});
|
});
|
||||||
Assert.That(exception.Message, Is.EqualTo("Property read Temperature is not implemented in this driver."));
|
Assert.That(exception.Message, Is.EqualTo("Property read Temperature is not implemented in this driver."));
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,12 @@
|
|||||||
|
namespace ASCOM.Meade.net
|
||||||
|
{
|
||||||
|
public enum Alignment
|
||||||
|
{
|
||||||
|
NeedsAlignment,
|
||||||
|
OneStarAligned,
|
||||||
|
TwoStarAligned,
|
||||||
|
ThreeStarAligned,
|
||||||
|
AlignedOnHome,
|
||||||
|
ScopeWasParked,
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
using ASCOM.DeviceInterface;
|
||||||
|
|
||||||
|
namespace ASCOM.Meade.net
|
||||||
|
{
|
||||||
|
public class AlignmentStatus
|
||||||
|
{
|
||||||
|
public AlignmentModes AlignmentMode { get; set; }
|
||||||
|
public bool Tracking { get; set; }
|
||||||
|
public Alignment Status { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -62,7 +62,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||||
<OutputPath>..\bin\Release\</OutputPath>
|
<OutputPath>..\bin\Release\</OutputPath>
|
||||||
<Prefer32Bit>false</Prefer32Bit>
|
<Prefer32Bit>true</Prefer32Bit>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||||
<OutputPath>..\bin\Debug\</OutputPath>
|
<OutputPath>..\bin\Debug\</OutputPath>
|
||||||
@@ -118,6 +118,8 @@
|
|||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Include="Alignment.cs" />
|
||||||
|
<Compile Include="AlignmentStatus.cs" />
|
||||||
<Compile Include="AstroMaths\AltitudeData.cs" />
|
<Compile Include="AstroMaths\AltitudeData.cs" />
|
||||||
<Compile Include="AstroMaths\AstroMathExtensions.cs" />
|
<Compile Include="AstroMaths\AstroMathExtensions.cs" />
|
||||||
<Compile Include="AstroMaths\AstroMaths.cs" />
|
<Compile Include="AstroMaths\AstroMaths.cs" />
|
||||||
@@ -190,7 +192,7 @@
|
|||||||
<PreBuildEvent>
|
<PreBuildEvent>
|
||||||
</PreBuildEvent>
|
</PreBuildEvent>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
<Target Name="BeforeBuild">
|
<Target Name="BeforeBuild">
|
||||||
</Target>
|
</Target>
|
||||||
|
|||||||
+549
-387
File diff suppressed because it is too large
Load Diff
@@ -98,6 +98,10 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="SharedResourcesUnitTests.cs" />
|
<Compile Include="SharedResourcesUnitTests.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
<Compile Include="ThreadSafeBoolTests.cs" />
|
||||||
|
<Compile Include="ThreadSafeDateTimeTests.cs" />
|
||||||
|
<Compile Include="ThreadSafeEnumTests.cs" />
|
||||||
|
<Compile Include="ThreadSafeNullableDoubleTests.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Meade.net\Meade.net.csproj">
|
<ProjectReference Include="..\Meade.net\Meade.net.csproj">
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
using ASCOM.DeviceInterface;
|
||||||
using ASCOM.Meade.net;
|
using ASCOM.Meade.net;
|
||||||
using ASCOM.Meade.net.Wrapper;
|
using ASCOM.Meade.net.Wrapper;
|
||||||
using ASCOM.Utilities.Interfaces;
|
using ASCOM.Utilities.Interfaces;
|
||||||
@@ -29,38 +30,39 @@ namespace Meade.net.UnitTests
|
|||||||
[Test]
|
[Test]
|
||||||
public void CheckThatSerialPortIsSetToUseMock()
|
public void CheckThatSerialPortIsSetToUseMock()
|
||||||
{
|
{
|
||||||
Assert.That(SharedResources.SharedSerial,Is.EqualTo(_serialMock.Object));
|
Assert.That(SharedResources.SharedSerial, Is.EqualTo(_serialMock.Object));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[TestCase(true, "Test")]
|
||||||
public void SendBlind_WhenCalled_Then_ClearsBuffersAndSendsMessage()
|
[TestCase(false, "#:Test#")]
|
||||||
|
public void SendBlind_WhenCalled_Then_ClearsBuffersAndSendsMessage(bool raw, string expectedMessage)
|
||||||
{
|
{
|
||||||
var expectedMessage = "Test";
|
var sendMessage = "Test";
|
||||||
|
SharedResources.SendBlind(sendMessage, raw);
|
||||||
SharedResources.SendBlind(expectedMessage);
|
|
||||||
|
|
||||||
_serialMock.Verify(x=> x.ClearBuffers(), Times.Once);
|
_serialMock.Verify(x=> x.ClearBuffers(), Times.Once);
|
||||||
_serialMock.Verify(x=>x.Transmit(expectedMessage), Times.Once);
|
_serialMock.Verify(x=>x.Transmit(expectedMessage), Times.Once);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[TestCase(false, "#:Test#")]
|
||||||
public void SendChar_WhenCalled_ThenSendsMessageAndReadsExpectedNumberOfCharacters()
|
[TestCase(true, "Test")]
|
||||||
|
public void SendChar_WhenCalled_ThenSendsMessageAndReadsExpectedNumberOfCharacters(bool raw, string expectedCommand)
|
||||||
{
|
{
|
||||||
var expectedMessage = "Test";
|
var command = "Test";
|
||||||
var expectedResult = "A";
|
var expectedResult = "A";
|
||||||
|
|
||||||
_serialMock.Setup(x => x.ReceiveCounted(1)).Returns(expectedResult);
|
_serialMock.Setup(x => x.ReceiveCounted(1)).Returns(expectedResult);
|
||||||
|
|
||||||
var result = SharedResources.SendChar(expectedMessage);
|
var result = SharedResources.SendChar(command, raw);
|
||||||
|
|
||||||
_serialMock.Verify(x => x.ClearBuffers(), Times.Once);
|
_serialMock.Verify(x => x.ClearBuffers(), Times.Once);
|
||||||
_serialMock.Verify(x => x.Transmit(expectedMessage), Times.Once);
|
_serialMock.Verify(x => x.Transmit(expectedCommand), Times.Once);
|
||||||
_serialMock.Verify(x => x.ReceiveCounted(1), Times.Once);
|
_serialMock.Verify(x => x.ReceiveCounted(1), Times.Once);
|
||||||
Assert.That(result, Is.EqualTo(expectedResult));
|
Assert.That(result, Is.EqualTo(expectedResult));
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestCase(false, "Test")]
|
[TestCase(true, "Test")]
|
||||||
[TestCase(true, "#Test")]
|
[TestCase(false, "#:Test#")]
|
||||||
public void SendString_WhenCalled_ThenSendsMessageAndReadsResultUntilTerminatorFound(bool includePrefix, string expectedMessage)
|
public void SendString_WhenCalled_ThenSendsMessageAndReadsResultUntilTerminatorFound(bool includePrefix, string expectedMessage)
|
||||||
{
|
{
|
||||||
var transmitMessage = "Test";
|
var transmitMessage = "Test";
|
||||||
@@ -159,7 +161,7 @@ namespace Meade.net.UnitTests
|
|||||||
string GuideRateProfileNameDefault = "10.077939"; //67% of sidereal rate
|
string GuideRateProfileNameDefault = "10.077939"; //67% of sidereal rate
|
||||||
string PrecisionDefault = "Unchanged";
|
string PrecisionDefault = "Unchanged";
|
||||||
string GuidingStyleDefault = "Auto";
|
string GuidingStyleDefault = "Auto";
|
||||||
|
|
||||||
string BacklashCompensationDefault = "3000";
|
string BacklashCompensationDefault = "3000";
|
||||||
string ReverseFocuserDiectionDefault = "true";
|
string ReverseFocuserDiectionDefault = "true";
|
||||||
|
|
||||||
@@ -238,15 +240,15 @@ namespace Meade.net.UnitTests
|
|||||||
SharedResources.ProfileFactory = profileFactoryMock.Object;
|
SharedResources.ProfileFactory = profileFactoryMock.Object;
|
||||||
|
|
||||||
var profileProperties = SharedResources.ReadProfile();
|
var profileProperties = SharedResources.ReadProfile();
|
||||||
|
|
||||||
Assert.That(profeWrapper.DeviceType, Is.EqualTo("Telescope"));
|
Assert.That(profeWrapper.DeviceType, Is.EqualTo("Telescope"));
|
||||||
|
|
||||||
Assert.That(profileProperties.TraceLogger, Is.EqualTo(bool.Parse(TraceStateDefault)));
|
Assert.That(profileProperties.TraceLogger, Is.EqualTo(bool.Parse(TraceStateDefault)));
|
||||||
|
|
||||||
Assert.That(profileProperties.ComPort, Is.EqualTo(ComPortDefault));
|
Assert.That(profileProperties.ComPort, Is.EqualTo(ComPortDefault));
|
||||||
|
|
||||||
Assert.That(profileProperties.GuideRateArcSecondsPerSecond,
|
Assert.That(profileProperties.GuideRateArcSecondsPerSecond,
|
||||||
Is.EqualTo(double.Parse(GuideRateProfileNameDefault)));
|
Is.EqualTo(double.Parse(GuideRateProfileNameDefault)));
|
||||||
Assert.That(profileProperties.Precision, Is.EqualTo(PrecisionDefault));
|
Assert.That(profileProperties.Precision, Is.EqualTo(PrecisionDefault));
|
||||||
Assert.That(profileProperties.GuidingStyle, Is.EqualTo(GuidingStyleDefault));
|
Assert.That(profileProperties.GuidingStyle, Is.EqualTo(GuidingStyleDefault));
|
||||||
|
|
||||||
@@ -422,7 +424,7 @@ namespace Meade.net.UnitTests
|
|||||||
|
|
||||||
string serialPortReturn = string.Empty;
|
string serialPortReturn = string.Empty;
|
||||||
|
|
||||||
_serialMock.Setup(x => x.Transmit("#:GVP#")).Callback(() => {
|
_serialMock.Setup(x => x.Transmit("#:GVP#")).Callback(() => {
|
||||||
serialPortReturn = string.Empty;
|
serialPortReturn = string.Empty;
|
||||||
throw new Exception("Testerror");
|
throw new Exception("Testerror");
|
||||||
});
|
});
|
||||||
@@ -617,5 +619,41 @@ namespace Meade.net.UnitTests
|
|||||||
|
|
||||||
_traceLoggerMock.Verify( x => x.LogIssue("Connect", "Unable to decode response from the telescope, This is likely a hardware serial communications error."), Times.Once);
|
_traceLoggerMock.Verify( x => x.LogIssue("Connect", "Unable to decode response from the telescope, This is likely a hardware serial communications error."), Times.Once);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void CheckIsParkedIsFalseByDefault() => Assert.That(SharedResources.IsParked, Is.False);
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void CheckParkedPositionIsNullByDefault() => Assert.That(SharedResources.ParkedPosition, Is.Null);
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void CheckIsLongFormatIsFalseByDefault() => Assert.That(SharedResources.IsLongFormat, Is.False);
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void CheckMovingPrimaryIsFalseBydefault() => Assert.That(SharedResources.MovingPrimary, Is.False);
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void CheckMovingSecondaryIsFalseBydefault() => Assert.That(SharedResources.MovingSecondary, Is.False);
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void CheckSideOfPierIsUnknownByDefault() => Assert.That(SharedResources.SideOfPier, Is.EqualTo(PierSide.pierUnknown));
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void CheckSlewSettleTimeIsZeroByDefault() => Assert.That(SharedResources.SlewSettleTime, Is.EqualTo((short)0));
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void CheckEarliestNonNonSlewingTimeIsMinValueByDefault() => Assert.That(SharedResources.EarliestNonSlewingTime, Is.EqualTo(DateTime.MinValue));
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void CheckTargetDeclinationIsNullByDefault() => Assert.That(SharedResources.TargetDeclination.HasValue, Is.False);
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void CheckTargetRightAscensionIsNullByDefault() => Assert.That(SharedResources.TargetRightAscension.HasValue, Is.False);
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void CheckIsTargetCoordinateInitRequired() => Assert.That(SharedResources.IsTargetCoordinateInitRequired, Is.True);
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void CheckIsGuiding() => Assert.That(SharedResources.IsGuiding, Is.False);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,39 @@
|
|||||||
|
using ASCOM.Meade.net;
|
||||||
|
using NUnit.Framework;
|
||||||
|
|
||||||
|
namespace Meade.net.UnitTests
|
||||||
|
{
|
||||||
|
public class ThreadSafeBoolTests
|
||||||
|
{
|
||||||
|
[TestCase(false)]
|
||||||
|
[TestCase(true)]
|
||||||
|
public void When_Assigned_ThenValueIsSame(bool value)
|
||||||
|
{
|
||||||
|
// given
|
||||||
|
ThreadSafeValue<bool> sut = value;
|
||||||
|
|
||||||
|
// when
|
||||||
|
bool actual = sut;
|
||||||
|
|
||||||
|
// then
|
||||||
|
Assert.That(actual, Is.EqualTo(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestCase(false, false)]
|
||||||
|
[TestCase(false, true)]
|
||||||
|
[TestCase(true, false)]
|
||||||
|
[TestCase(true, true)]
|
||||||
|
public void When_SetValue_ThenValueIsUpdated(bool initialValue, bool setValue)
|
||||||
|
{
|
||||||
|
// given
|
||||||
|
ThreadSafeValue<bool> sut = initialValue;
|
||||||
|
|
||||||
|
// when
|
||||||
|
sut.Set(setValue);
|
||||||
|
bool afterset = sut;
|
||||||
|
|
||||||
|
// then
|
||||||
|
Assert.That(afterset, Is.EqualTo(setValue));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
using ASCOM.Meade.net;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Globalization;
|
||||||
|
|
||||||
|
namespace Meade.net.UnitTests
|
||||||
|
{
|
||||||
|
public class ThreadSafeDateTimeTests
|
||||||
|
{
|
||||||
|
[TestCaseSource(nameof(DateTimeSource))]
|
||||||
|
public void When_Assigned_ThenValueIsSame(DateTime value)
|
||||||
|
{
|
||||||
|
// given
|
||||||
|
ThreadSafeValue<DateTime> sut = value;
|
||||||
|
|
||||||
|
// when
|
||||||
|
DateTime actual = sut;
|
||||||
|
|
||||||
|
// then
|
||||||
|
Assert.That(actual, Is.EqualTo(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestCaseSource(nameof(DateTimeSetSource))]
|
||||||
|
public void When_SetValue_ThenValueIsUpdated(DateTime initialValue, DateTime setValue)
|
||||||
|
{
|
||||||
|
// given
|
||||||
|
ThreadSafeValue<DateTime> sut = initialValue;
|
||||||
|
|
||||||
|
// when
|
||||||
|
sut.Set(setValue);
|
||||||
|
DateTime afterset = sut;
|
||||||
|
|
||||||
|
// then
|
||||||
|
Assert.That(afterset, Is.EqualTo(setValue));
|
||||||
|
}
|
||||||
|
|
||||||
|
static readonly DateTime Example1 = DateTimeOffset.Parse("2012-05-09T02:10:31.296761Z", CultureInfo.InvariantCulture).UtcDateTime;
|
||||||
|
static readonly DateTime Example2 = DateTimeOffset.Parse("2051-03-09T23:15:11.556081Z", CultureInfo.InvariantCulture).UtcDateTime;
|
||||||
|
|
||||||
|
static IEnumerable<DateTime> DateTimeSource => new[]
|
||||||
|
{
|
||||||
|
DateTime.MinValue,
|
||||||
|
Example1,
|
||||||
|
Example2
|
||||||
|
};
|
||||||
|
|
||||||
|
static IEnumerable<TestCaseData> DateTimeSetSource => new[]
|
||||||
|
{
|
||||||
|
new TestCaseData(DateTime.MinValue, Example1),
|
||||||
|
new TestCaseData(DateTime.MinValue, Example2),
|
||||||
|
new TestCaseData(DateTime.MinValue, DateTime.MinValue),
|
||||||
|
new TestCaseData(Example1, Example1),
|
||||||
|
new TestCaseData(Example1, Example2),
|
||||||
|
new TestCaseData(Example1, DateTime.MinValue),
|
||||||
|
new TestCaseData(Example2, Example1),
|
||||||
|
new TestCaseData(Example2, Example2),
|
||||||
|
new TestCaseData(Example2, DateTime.MinValue)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
using ASCOM.DeviceInterface;
|
||||||
|
using ASCOM.Meade.net;
|
||||||
|
using NUnit.Framework;
|
||||||
|
|
||||||
|
namespace Meade.net.UnitTests
|
||||||
|
{
|
||||||
|
public class ThreadSafeEnumTests
|
||||||
|
{
|
||||||
|
[TestCase(PierSide.pierUnknown)]
|
||||||
|
[TestCase(PierSide.pierEast)]
|
||||||
|
[TestCase(PierSide.pierWest)]
|
||||||
|
public void When_Assigned_ThenValueIsSame(PierSide value)
|
||||||
|
{
|
||||||
|
// given
|
||||||
|
ThreadSafeValue<PierSide> sut = value;
|
||||||
|
|
||||||
|
// when
|
||||||
|
PierSide actual = sut;
|
||||||
|
|
||||||
|
// then
|
||||||
|
Assert.That(actual, Is.EqualTo(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestCase(PierSide.pierUnknown, PierSide.pierUnknown)]
|
||||||
|
[TestCase(PierSide.pierUnknown, PierSide.pierEast)]
|
||||||
|
[TestCase(PierSide.pierUnknown, PierSide.pierWest)]
|
||||||
|
[TestCase(PierSide.pierEast, PierSide.pierUnknown)]
|
||||||
|
[TestCase(PierSide.pierEast, PierSide.pierEast)]
|
||||||
|
[TestCase(PierSide.pierEast, PierSide.pierWest)]
|
||||||
|
[TestCase(PierSide.pierWest, PierSide.pierUnknown)]
|
||||||
|
[TestCase(PierSide.pierWest, PierSide.pierEast)]
|
||||||
|
[TestCase(PierSide.pierWest, PierSide.pierWest)]
|
||||||
|
public void When_SetValue_ThenValueIsUpdated(PierSide initialValue, PierSide setValue)
|
||||||
|
{
|
||||||
|
// given
|
||||||
|
ThreadSafeValue<PierSide> sut = initialValue;
|
||||||
|
|
||||||
|
// when
|
||||||
|
sut.Set(setValue);
|
||||||
|
PierSide afterset = sut;
|
||||||
|
|
||||||
|
// then
|
||||||
|
Assert.That(afterset, Is.EqualTo(setValue));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
using ASCOM.Meade.net;
|
||||||
|
using NUnit.Framework;
|
||||||
|
|
||||||
|
namespace Meade.net.UnitTests
|
||||||
|
{
|
||||||
|
public class ThreadSafeNullableDoubleTests
|
||||||
|
{
|
||||||
|
[TestCase(0.1d)]
|
||||||
|
[TestCase(-12.34d)]
|
||||||
|
[TestCase(0d)]
|
||||||
|
[TestCase(null)]
|
||||||
|
public void When_Assigned_ThenValueIsSame(double? value)
|
||||||
|
{
|
||||||
|
// given
|
||||||
|
ThreadSafeValue<double?> sut = value;
|
||||||
|
|
||||||
|
// when
|
||||||
|
double? actual = sut;
|
||||||
|
|
||||||
|
// then
|
||||||
|
Assert.That(actual, Is.EqualTo(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestCase(0.1d, 0.2d)]
|
||||||
|
[TestCase(-12.34d, 5d)]
|
||||||
|
[TestCase(0d, 1d)]
|
||||||
|
[TestCase(null, 2d)]
|
||||||
|
[TestCase(0.1d, null)]
|
||||||
|
[TestCase(-12.34d, null)]
|
||||||
|
[TestCase(0d, null)]
|
||||||
|
[TestCase(null, null)]
|
||||||
|
public void When_SetValue_ThenValueIsUpdated(double? initialValue, double? setValue)
|
||||||
|
{
|
||||||
|
// given
|
||||||
|
ThreadSafeValue<double?> sut = initialValue;
|
||||||
|
|
||||||
|
// when
|
||||||
|
sut.Set(setValue);
|
||||||
|
double? afterset = sut;
|
||||||
|
|
||||||
|
// then
|
||||||
|
Assert.That(afterset, Is.EqualTo(setValue));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,6 +5,7 @@
|
|||||||
<package id="JetBrains.Annotations" version="2020.3.0" targetFramework="net472" />
|
<package id="JetBrains.Annotations" version="2020.3.0" targetFramework="net472" />
|
||||||
<package id="Moq" version="4.15.2" targetFramework="net472" />
|
<package id="Moq" version="4.15.2" targetFramework="net472" />
|
||||||
<package id="NUnit" version="3.13.0" targetFramework="net472" />
|
<package id="NUnit" version="3.13.0" targetFramework="net472" />
|
||||||
|
<package id="NUnit.ConsoleRunner" version="3.12.0" targetFramework="net472" />
|
||||||
<package id="System.Runtime.CompilerServices.Unsafe" version="5.0.0" targetFramework="net472" />
|
<package id="System.Runtime.CompilerServices.Unsafe" version="5.0.0" targetFramework="net472" />
|
||||||
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net472" />
|
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net472" />
|
||||||
</packages>
|
</packages>
|
||||||
@@ -43,7 +43,7 @@ namespace ASCOM.Meade.net
|
|||||||
/// Private variable to hold an ASCOM Utilities object
|
/// Private variable to hold an ASCOM Utilities object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly IUtil _utilities;
|
private readonly IUtil _utilities;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="Meade.net"/> class.
|
/// Initializes a new instance of the <see cref="Meade.net"/> class.
|
||||||
/// Must be public for COM registration.
|
/// Must be public for COM registration.
|
||||||
@@ -101,32 +101,39 @@ namespace ASCOM.Meade.net
|
|||||||
|
|
||||||
public void CommandBlind(string command, bool raw)
|
public void CommandBlind(string command, bool raw)
|
||||||
{
|
{
|
||||||
|
LogMessage("CommandBlind", "raw: {0} command {0}", raw, command);
|
||||||
CheckConnected("CommandBlind");
|
CheckConnected("CommandBlind");
|
||||||
// Call CommandString and return as soon as it finishes
|
// Call CommandString and return as soon as it finishes
|
||||||
//this.CommandString(command, raw);
|
//this.CommandString(command, raw);
|
||||||
SharedResourcesWrapper.SendBlind(command);
|
SharedResourcesWrapper.SendBlind(command, raw);
|
||||||
// or
|
// or
|
||||||
//throw new ASCOM.MethodNotImplementedException("CommandBlind");
|
//throw new ASCOM.MethodNotImplementedException("CommandBlind");
|
||||||
// DO NOT have both these sections! One or the other
|
// DO NOT have both these sections! One or the other
|
||||||
|
LogMessage("CommandBlind", "Completed");
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool CommandBool(string command, bool raw)
|
public bool CommandBool(string command, bool raw)
|
||||||
{
|
{
|
||||||
|
LogMessage("CommandBool", "raw: {0} command {0}", raw, command);
|
||||||
CheckConnected("CommandBool");
|
CheckConnected("CommandBool");
|
||||||
//string ret = CommandString(command, raw);
|
var result = SharedResourcesWrapper.SendBool(command, raw);
|
||||||
// decode the return string and return true or false
|
LogMessage("CommandBool", "Completed: {0}", result);
|
||||||
|
return result;
|
||||||
// or
|
// or
|
||||||
throw new MethodNotImplementedException("CommandBool");
|
//throw new MethodNotImplementedException("CommandBool");
|
||||||
// DO NOT have both these sections! One or the other
|
// DO NOT have both these sections! One or the other
|
||||||
}
|
}
|
||||||
|
|
||||||
public string CommandString(string command, bool raw)
|
public string CommandString(string command, bool raw)
|
||||||
{
|
{
|
||||||
|
LogMessage("CommandString", "raw: {0} command {0}", raw, command);
|
||||||
CheckConnected("CommandString");
|
CheckConnected("CommandString");
|
||||||
// it's a good idea to put all the low level communication with the device here,
|
// it's a good idea to put all the low level communication with the device here,
|
||||||
// then all communication calls this function
|
// then all communication calls this function
|
||||||
// you need something to ensure that only one command is in progress at a time
|
// you need something to ensure that only one command is in progress at a time
|
||||||
return SharedResourcesWrapper.SendString(command);
|
var result = SharedResourcesWrapper.SendString(command, raw);
|
||||||
|
LogMessage("CommandBool", "Completed: {0}", result);
|
||||||
|
return result;
|
||||||
//throw new ASCOM.MethodNotImplementedException("CommandString");
|
//throw new ASCOM.MethodNotImplementedException("CommandString");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -225,7 +232,7 @@ namespace ASCOM.Meade.net
|
|||||||
|
|
||||||
//todo fix this issue: A single halt command is sometimes missed by the #909 apm, so let's do it a few times to be safe.
|
//todo fix this issue: A single halt command is sometimes missed by the #909 apm, so let's do it a few times to be safe.
|
||||||
|
|
||||||
SharedResourcesWrapper.SendBlind(":FQ#");
|
SharedResourcesWrapper.SendBlind("FQ");
|
||||||
//:FQ# Halt Focuser Motion
|
//:FQ# Halt Focuser Motion
|
||||||
//Returns: Nothing
|
//Returns: Nothing
|
||||||
}
|
}
|
||||||
@@ -297,7 +304,7 @@ namespace ASCOM.Meade.net
|
|||||||
var backlashCompensationSteps = direction ? Math.Abs(BacklashCompensation) : 0;
|
var backlashCompensationSteps = direction ? Math.Abs(BacklashCompensation) : 0;
|
||||||
|
|
||||||
var steps = Math.Abs(position) + backlashCompensationSteps;
|
var steps = Math.Abs(position) + backlashCompensationSteps;
|
||||||
|
|
||||||
|
|
||||||
MoveFocuser(direction, steps);
|
MoveFocuser(direction, steps);
|
||||||
|
|
||||||
@@ -329,18 +336,18 @@ namespace ASCOM.Meade.net
|
|||||||
|
|
||||||
private void MoveFocuser(bool directionOut, int steps)
|
private void MoveFocuser(bool directionOut, int steps)
|
||||||
{
|
{
|
||||||
//_sharedResourcesWrapper.SendBlind(":FF#");
|
//_sharedResourcesWrapper.SendBlind("FF");
|
||||||
//:FF# Set Focus speed to fastest setting
|
//:FF# Set Focus speed to fastest setting
|
||||||
//Returns: Nothing
|
//Returns: Nothing
|
||||||
|
|
||||||
//:FS# Set Focus speed to slowest setting
|
//:FS# Set Focus speed to slowest setting
|
||||||
//Returns: Nothing
|
//Returns: Nothing
|
||||||
|
|
||||||
//:F<n># Autostar, Autostar II – set focuser speed to <n> where <n> is an ASCII digit 1..4
|
//:F<n># Autostar, Autostar II - set focuser speed to <n> where <n> is an ASCII digit 1..4
|
||||||
//Returns: Nothing
|
//Returns: Nothing
|
||||||
//All others – Not Supported
|
//All others - Not Supported
|
||||||
_utilities.WaitForMilliseconds(100);
|
_utilities.WaitForMilliseconds(100);
|
||||||
|
|
||||||
PerformFocuserMove(directionOut);
|
PerformFocuserMove(directionOut);
|
||||||
|
|
||||||
_utilities.WaitForMilliseconds(steps);
|
_utilities.WaitForMilliseconds(steps);
|
||||||
@@ -350,7 +357,7 @@ namespace ASCOM.Meade.net
|
|||||||
|
|
||||||
private void PerformFocuserMove(bool directionOut)
|
private void PerformFocuserMove(bool directionOut)
|
||||||
{
|
{
|
||||||
SharedResourcesWrapper.SendBlind(directionOut ? ":F+#" : ":F-#");
|
SharedResourcesWrapper.SendBlind(directionOut ? "F+" : "F-");
|
||||||
//:F+# Start Focuser moving inward (toward objective)
|
//:F+# Start Focuser moving inward (toward objective)
|
||||||
//Returns: None
|
//Returns: None
|
||||||
|
|
||||||
@@ -411,7 +418,7 @@ namespace ASCOM.Meade.net
|
|||||||
#region ASCOM Registration
|
#region ASCOM Registration
|
||||||
|
|
||||||
// Register or unregister driver for ASCOM. This is harmless if already
|
// Register or unregister driver for ASCOM. This is harmless if already
|
||||||
// registered or unregistered.
|
// registered or unregistered.
|
||||||
//
|
//
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Register or unregister the driver with the ASCOM Platform.
|
/// Register or unregister the driver with the ASCOM Platform.
|
||||||
@@ -481,7 +488,7 @@ namespace ASCOM.Meade.net
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Use this function to throw an exception if we aren't connected to the hardware
|
/// Use this function to throw an exception if we aren't connected to the hardware
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -141,10 +141,12 @@
|
|||||||
<Compile Include="LocalServer.cs" />
|
<Compile Include="LocalServer.cs" />
|
||||||
<Compile Include="MeadeTelescopeBase.cs" />
|
<Compile Include="MeadeTelescopeBase.cs" />
|
||||||
<Compile Include="ParkedBehaviour.cs" />
|
<Compile Include="ParkedBehaviour.cs" />
|
||||||
|
<Compile Include="ParkedPosition.cs" />
|
||||||
<Compile Include="ProfileFactory.cs" />
|
<Compile Include="ProfileFactory.cs" />
|
||||||
<Compile Include="ProfileProperties.cs" />
|
<Compile Include="ProfileProperties.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="TelescopeList.cs" />
|
<Compile Include="TelescopeList.cs" />
|
||||||
|
<Compile Include="ThreadSafeValue.cs" />
|
||||||
<Compile Include="Win32Utilities.cs" />
|
<Compile Include="Win32Utilities.cs" />
|
||||||
<Compile Include="Wrapper\IProfileWrapper.cs" />
|
<Compile Include="Wrapper\IProfileWrapper.cs" />
|
||||||
<Compile Include="Wrapper\SharedResourcesWrapper.cs" />
|
<Compile Include="Wrapper\SharedResourcesWrapper.cs" />
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ namespace ASCOM.Meade.net
|
|||||||
protected ParkedBehaviour ParkedBehaviour;
|
protected ParkedBehaviour ParkedBehaviour;
|
||||||
protected HorizonCoordinates ParkedAltAz;
|
protected HorizonCoordinates ParkedAltAz;
|
||||||
|
|
||||||
protected readonly ISharedResourcesWrapper SharedResourcesWrapper;
|
protected readonly ISharedResourcesWrapper SharedResourcesWrapper;
|
||||||
|
|
||||||
public MeadeTelescopeBase()
|
public MeadeTelescopeBase()
|
||||||
{
|
{
|
||||||
@@ -81,7 +81,7 @@ namespace ASCOM.Meade.net
|
|||||||
Altitude = profileProperties.ParkedAlt,
|
Altitude = profileProperties.ParkedAlt,
|
||||||
Azimuth = profileProperties.ParkedAz
|
Azimuth = profileProperties.ParkedAz
|
||||||
};
|
};
|
||||||
|
|
||||||
LogMessage("ReadProfile", $"Trace logger enabled: {Tl.Enabled}");
|
LogMessage("ReadProfile", $"Trace logger enabled: {Tl.Enabled}");
|
||||||
LogMessage("ReadProfile", $"Com Port: {ComPort}");
|
LogMessage("ReadProfile", $"Com Port: {ComPort}");
|
||||||
LogMessage("ReadProfile", $"Backlash Steps: {BacklashCompensation}");
|
LogMessage("ReadProfile", $"Backlash Steps: {BacklashCompensation}");
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
namespace ASCOM.Meade.net
|
||||||
|
{
|
||||||
|
public class ParkedPosition
|
||||||
|
{
|
||||||
|
public double Altitude { get; set; }
|
||||||
|
public double Azimuth { get; set; }
|
||||||
|
public double RightAscension { get; set; }
|
||||||
|
public double Declination { get; set; }
|
||||||
|
public double SiteLongitude { get; set; }
|
||||||
|
public double SiteLatitude { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
+135
-24
@@ -4,7 +4,7 @@
|
|||||||
// ================
|
// ================
|
||||||
//
|
//
|
||||||
// This class is a container for all shared resources that may be needed
|
// This class is a container for all shared resources that may be needed
|
||||||
// by the drivers served by the Local Server.
|
// by the drivers served by the Local Server.
|
||||||
//
|
//
|
||||||
// NOTES:
|
// NOTES:
|
||||||
//
|
//
|
||||||
@@ -18,7 +18,10 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Security.AccessControl;
|
||||||
|
using System.Threading;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
using ASCOM.DeviceInterface;
|
||||||
using ASCOM.Meade.net.Wrapper;
|
using ASCOM.Meade.net.Wrapper;
|
||||||
using ASCOM.Utilities;
|
using ASCOM.Utilities;
|
||||||
using ASCOM.Utilities.Interfaces;
|
using ASCOM.Utilities.Interfaces;
|
||||||
@@ -48,7 +51,7 @@ namespace ASCOM.Meade.net
|
|||||||
#region single serial port connector
|
#region single serial port connector
|
||||||
|
|
||||||
//
|
//
|
||||||
// this region shows a way that a single serial port could be connected to by multiple
|
// this region shows a way that a single serial port could be connected to by multiple
|
||||||
// drivers.
|
// drivers.
|
||||||
//
|
//
|
||||||
// Connected is used to handle the connections to the port.
|
// Connected is used to handle the connections to the port.
|
||||||
@@ -72,17 +75,18 @@ namespace ASCOM.Meade.net
|
|||||||
|
|
||||||
public static IProfileFactory ProfileFactory
|
public static IProfileFactory ProfileFactory
|
||||||
{
|
{
|
||||||
get => _profileFactory ?? ( _profileFactory = new ProfileFactory());
|
get => _profileFactory ?? (_profileFactory = new ProfileFactory());
|
||||||
set => _profileFactory = value;
|
set => _profileFactory = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
//todo add code to ensure that there is a minimum gap between commands. 5ms as default.
|
//todo add code to ensure that there is a minimum gap between commands. 5ms as default.
|
||||||
public static void SendBlind(string message)
|
public static void SendBlind(string message, bool raw = false)
|
||||||
{
|
{
|
||||||
lock (LockObject)
|
lock (LockObject)
|
||||||
{
|
{
|
||||||
SharedSerial.ClearBuffers();
|
SharedSerial.ClearBuffers();
|
||||||
SharedSerial.Transmit(message);
|
var encodedMessage = raw ? message : $"#:{message}#";
|
||||||
|
SharedSerial.Transmit(encodedMessage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,14 +97,16 @@ namespace ASCOM.Meade.net
|
|||||||
/// and that the reply will always be terminated by a "#" character.
|
/// and that the reply will always be terminated by a "#" character.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="message"></param>
|
/// <param name="message"></param>
|
||||||
|
/// <param name="raw"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static string SendString(string message, bool includePrefix = true)
|
public static string SendString(string message, bool raw = false)
|
||||||
{
|
{
|
||||||
lock (LockObject)
|
lock (LockObject)
|
||||||
{
|
{
|
||||||
SharedSerial.ClearBuffers();
|
SharedSerial.ClearBuffers();
|
||||||
|
|
||||||
SharedSerial.Transmit(includePrefix ? $"#{message}" : message);
|
var encodedMessage = raw ? message : $"#:{message}#";
|
||||||
|
SharedSerial.Transmit(encodedMessage);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -116,23 +122,34 @@ namespace ASCOM.Meade.net
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string SendChar(string message)
|
public static bool SendBool(string command, bool raw = false)
|
||||||
|
{
|
||||||
|
var result = SendChar(command, raw);
|
||||||
|
|
||||||
|
return result == "1";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string SendChar(string command, bool raw = false)
|
||||||
|
{
|
||||||
|
return SendChars(command, raw, count: 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string SendChars(string command, bool raw = false, int count = 1)
|
||||||
{
|
{
|
||||||
lock (LockObject)
|
lock (LockObject)
|
||||||
{
|
{
|
||||||
SharedSerial.ClearBuffers();
|
SharedSerial.ClearBuffers();
|
||||||
SharedSerial.Transmit(message);
|
|
||||||
|
var encodedMessage = raw ? command : $"#:{command}#";
|
||||||
|
SharedSerial.Transmit(encodedMessage);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return SharedSerial.ReceiveCounted(1);
|
return SharedSerial.ReceiveCounted(count);
|
||||||
}
|
}
|
||||||
catch (COMException ex)
|
catch (COMException ex) when (ex.Message.Contains("Timed out waiting for received data"))
|
||||||
{
|
{
|
||||||
if (ex.Message.Contains("Timed out waiting for received data"))
|
throw new TimeoutException(ex.Message, ex);
|
||||||
throw new TimeoutException(ex.Message, ex);
|
|
||||||
|
|
||||||
throw;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -230,7 +247,7 @@ namespace ASCOM.Meade.net
|
|||||||
private const string HandShakeDefault = "None";
|
private const string HandShakeDefault = "None";
|
||||||
private const string ParityDefault = "None";
|
private const string ParityDefault = "None";
|
||||||
private const string SendDateTimeDefault = "false";
|
private const string SendDateTimeDefault = "false";
|
||||||
private static string ParkedBehaviourDefault = "No Coordinates";
|
private const string ParkedBehaviourDefault = "No Coordinates";
|
||||||
private const string ParkedAltDefault = "0";
|
private const string ParkedAltDefault = "0";
|
||||||
private const string ParkedAzimuthDefault = "180";
|
private const string ParkedAzimuthDefault = "180";
|
||||||
|
|
||||||
@@ -259,7 +276,7 @@ namespace ASCOM.Meade.net
|
|||||||
profileProperties.Speed = Convert.ToInt32(driverProfile.GetValue(DriverId, SpeedName, string.Empty, SpeedDefault));
|
profileProperties.Speed = Convert.ToInt32(driverProfile.GetValue(DriverId, SpeedName, string.Empty, SpeedDefault));
|
||||||
profileProperties.Parity = driverProfile.GetValue(DriverId, ParityName, string.Empty, ParityDefault);
|
profileProperties.Parity = driverProfile.GetValue(DriverId, ParityName, string.Empty, ParityDefault);
|
||||||
profileProperties.SendDateTime = Convert.ToBoolean(driverProfile.GetValue(DriverId, SendDateTimeName, string.Empty, SendDateTimeDefault));
|
profileProperties.SendDateTime = Convert.ToBoolean(driverProfile.GetValue(DriverId, SendDateTimeName, string.Empty, SendDateTimeDefault));
|
||||||
|
|
||||||
profileProperties.ParkedBehaviour = EnumExtensionMethods.GetValueFromDescription<ParkedBehaviour>(driverProfile.GetValue(DriverId, ParkedBehaviourName, string.Empty, ParkedBehaviourDefault));
|
profileProperties.ParkedBehaviour = EnumExtensionMethods.GetValueFromDescription<ParkedBehaviour>(driverProfile.GetValue(DriverId, ParkedBehaviourName, string.Empty, ParkedBehaviourDefault));
|
||||||
profileProperties.ParkedAlt = double.Parse(driverProfile.GetValue(DriverId, ParkedAltName, string.Empty, ParkedAltDefault), NumberFormatInfo.InvariantInfo);
|
profileProperties.ParkedAlt = double.Parse(driverProfile.GetValue(DriverId, ParkedAltName, string.Empty, ParkedAltDefault), NumberFormatInfo.InvariantInfo);
|
||||||
profileProperties.ParkedAz = double.Parse(driverProfile.GetValue(DriverId, ParkedAzimuthName, string.Empty, ParkedAzimuthDefault), NumberFormatInfo.InvariantInfo);
|
profileProperties.ParkedAz = double.Parse(driverProfile.GetValue(DriverId, ParkedAzimuthName, string.Empty, ParkedAzimuthDefault), NumberFormatInfo.InvariantInfo);
|
||||||
@@ -297,7 +314,7 @@ namespace ASCOM.Meade.net
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Multi Driver handling
|
#region Multi Driver handling
|
||||||
|
|
||||||
public static string ProductName { get; private set; } = string.Empty;
|
public static string ProductName { get; private set; } = string.Empty;
|
||||||
@@ -320,7 +337,7 @@ namespace ASCOM.Meade.net
|
|||||||
private static readonly Dictionary<string, DeviceHardware> ConnectedDevices = new Dictionary<string, DeviceHardware>();
|
private static readonly Dictionary<string, DeviceHardware> ConnectedDevices = new Dictionary<string, DeviceHardware>();
|
||||||
|
|
||||||
private static readonly Dictionary<string, DeviceHardware> ConnectedDeviceIds = new Dictionary<string, DeviceHardware>();
|
private static readonly Dictionary<string, DeviceHardware> ConnectedDeviceIds = new Dictionary<string, DeviceHardware>();
|
||||||
private static IProfileFactory _profileFactory ;
|
private static IProfileFactory _profileFactory;
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -336,7 +353,7 @@ namespace ASCOM.Meade.net
|
|||||||
{
|
{
|
||||||
if (!ConnectedDevices.ContainsKey(deviceId))
|
if (!ConnectedDevices.ContainsKey(deviceId))
|
||||||
ConnectedDevices.Add(deviceId, new DeviceHardware());
|
ConnectedDevices.Add(deviceId, new DeviceHardware());
|
||||||
|
|
||||||
if (!ConnectedDeviceIds.ContainsKey(driverId))
|
if (!ConnectedDeviceIds.ContainsKey(driverId))
|
||||||
ConnectedDeviceIds.Add(driverId, new DeviceHardware());
|
ConnectedDeviceIds.Add(driverId, new DeviceHardware());
|
||||||
|
|
||||||
@@ -349,7 +366,7 @@ namespace ASCOM.Meade.net
|
|||||||
SharedSerial.DTREnable = profileProperties.RtsDtrEnabled;
|
SharedSerial.DTREnable = profileProperties.RtsDtrEnabled;
|
||||||
SharedSerial.RTSEnable = profileProperties.RtsDtrEnabled;
|
SharedSerial.RTSEnable = profileProperties.RtsDtrEnabled;
|
||||||
SharedSerial.DataBits = profileProperties.DataBits;
|
SharedSerial.DataBits = profileProperties.DataBits;
|
||||||
SharedSerial.StopBits = (SerialStopBits)Enum.Parse(typeof(SerialStopBits), profileProperties.StopBits );
|
SharedSerial.StopBits = (SerialStopBits)Enum.Parse(typeof(SerialStopBits), profileProperties.StopBits);
|
||||||
SharedSerial.Parity = (SerialParity)Enum.Parse(typeof(SerialParity), profileProperties.Parity);
|
SharedSerial.Parity = (SerialParity)Enum.Parse(typeof(SerialParity), profileProperties.Parity);
|
||||||
SharedSerial.Speed = (SerialSpeed)profileProperties.Speed;
|
SharedSerial.Speed = (SerialSpeed)profileProperties.Speed;
|
||||||
SharedSerial.Handshake = (SerialHandshake)Enum.Parse(typeof(SerialHandshake), profileProperties.Handshake);
|
SharedSerial.Handshake = (SerialHandshake)Enum.Parse(typeof(SerialHandshake), profileProperties.Handshake);
|
||||||
@@ -357,8 +374,8 @@ namespace ASCOM.Meade.net
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ProductName = SendString(":GVP#");
|
ProductName = SendString("GVP");
|
||||||
FirmwareVersion = SendString(":GVN#");
|
FirmwareVersion = SendString("GVN");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -378,7 +395,7 @@ namespace ASCOM.Meade.net
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string utcOffSet = SendString(":GG#");
|
string utcOffSet = SendString("GG");
|
||||||
//:GG# Get UTC offset time
|
//:GG# Get UTC offset time
|
||||||
//Returns: sHH# or sHH.H#
|
//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
|
//The number of decimal hours to add to local time to convert it to UTC. If the number is a whole number the
|
||||||
@@ -479,5 +496,99 @@ namespace ASCOM.Meade.net
|
|||||||
Count = 0;
|
Count = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void SetParked(bool atPark, ParkedPosition parkedPosition)
|
||||||
|
{
|
||||||
|
IsParked = atPark;
|
||||||
|
ParkedPosition = parkedPosition;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static readonly ThreadSafeValue<bool> _isParked = false;
|
||||||
|
public static bool IsParked
|
||||||
|
{
|
||||||
|
get => _isParked;
|
||||||
|
private set => _isParked.Set(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static ParkedPosition _parkedPosition;
|
||||||
|
public static ParkedPosition ParkedPosition
|
||||||
|
{
|
||||||
|
get => _parkedPosition;
|
||||||
|
private set => Interlocked.Exchange(ref _parkedPosition, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static readonly ThreadSafeValue<PierSide> _sideOfPier = PierSide.pierUnknown;
|
||||||
|
/// <summary>
|
||||||
|
/// Start with <see cref="PierSide.pierUnknown"/>.
|
||||||
|
/// As we do not know the physical declination axis position, we have to keep track manually.
|
||||||
|
/// </summary>
|
||||||
|
public static PierSide SideOfPier
|
||||||
|
{
|
||||||
|
get => _sideOfPier;
|
||||||
|
internal set => _sideOfPier.Set(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static readonly ThreadSafeValue<double?> _targetRightAscension = null as double?;
|
||||||
|
public static double? TargetRightAscension
|
||||||
|
{
|
||||||
|
get => _targetRightAscension;
|
||||||
|
internal set => _targetRightAscension.Set(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static readonly ThreadSafeValue<double?> _targetDeclination = null as double?;
|
||||||
|
public static double? TargetDeclination
|
||||||
|
{
|
||||||
|
get => _targetDeclination;
|
||||||
|
internal set => _targetDeclination.Set(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int _slewSettleTime;
|
||||||
|
public static short SlewSettleTime
|
||||||
|
{
|
||||||
|
get => Convert.ToInt16(_slewSettleTime);
|
||||||
|
internal set => Interlocked.Exchange(ref _slewSettleTime, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static readonly ThreadSafeValue<bool> _isLongFormat = false;
|
||||||
|
public static bool IsLongFormat
|
||||||
|
{
|
||||||
|
get => _isLongFormat;
|
||||||
|
internal set => _isLongFormat.Set(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static readonly ThreadSafeValue<bool> _movingPrimary = false;
|
||||||
|
public static bool MovingPrimary
|
||||||
|
{
|
||||||
|
get => _movingPrimary;
|
||||||
|
internal set => _movingPrimary.Set(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static readonly ThreadSafeValue<bool> _movingSecondary = false;
|
||||||
|
public static bool MovingSecondary
|
||||||
|
{
|
||||||
|
get => _movingSecondary;
|
||||||
|
internal set => _movingSecondary.Set(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static readonly ThreadSafeValue<DateTime> _earliestNonSlewingTime = DateTime.MinValue;
|
||||||
|
public static DateTime EarliestNonSlewingTime
|
||||||
|
{
|
||||||
|
get => _earliestNonSlewingTime;
|
||||||
|
internal set => _earliestNonSlewingTime.Set(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static readonly ThreadSafeValue<bool> _isTargetCoordinateInitRequired = true;
|
||||||
|
public static bool IsTargetCoordinateInitRequired
|
||||||
|
{
|
||||||
|
get => _isTargetCoordinateInitRequired;
|
||||||
|
internal set => _isTargetCoordinateInitRequired.Set(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static readonly ThreadSafeValue<bool> _isGuiding = false;
|
||||||
|
public static bool IsGuiding
|
||||||
|
{
|
||||||
|
get => _isGuiding;
|
||||||
|
internal set => _isGuiding.Set(value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
using JetBrains.Annotations;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
|
namespace ASCOM.Meade.net
|
||||||
|
{
|
||||||
|
public class ThreadSafeValue<T>
|
||||||
|
{
|
||||||
|
private object _value;
|
||||||
|
|
||||||
|
public ThreadSafeValue(in T value) => _value = value;
|
||||||
|
|
||||||
|
public void Set(in T value) => Interlocked.Exchange(ref _value, value);
|
||||||
|
|
||||||
|
public static implicit operator ThreadSafeValue<T>(in T value) => new ThreadSafeValue<T>(value);
|
||||||
|
|
||||||
|
public static implicit operator T([NotNull] ThreadSafeValue<T> @this) => (T)(@this?._value ?? default);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using ASCOM.DeviceInterface;
|
||||||
using ASCOM.Utilities.Interfaces;
|
using ASCOM.Utilities.Interfaces;
|
||||||
|
|
||||||
namespace ASCOM.Meade.net.Wrapper
|
namespace ASCOM.Meade.net.Wrapper
|
||||||
@@ -15,9 +16,11 @@ namespace ASCOM.Meade.net.Wrapper
|
|||||||
void Lock(Action action);
|
void Lock(Action action);
|
||||||
T Lock<T>(Func<T> func);
|
T Lock<T>(Func<T> func);
|
||||||
|
|
||||||
string SendString(string message, bool includePrefix = true);
|
string SendString(string message, bool raw = false);
|
||||||
void SendBlind(string message);
|
void SendBlind(string message, bool raw = false);
|
||||||
string SendChar(string message);
|
bool SendBool(string command, bool raw = false);
|
||||||
|
string SendChar(string message, bool raw = false);
|
||||||
|
string SendChars(string message, bool raw = false, int count = 1);
|
||||||
|
|
||||||
string ReadTerminated();
|
string ReadTerminated();
|
||||||
|
|
||||||
@@ -26,6 +29,28 @@ namespace ASCOM.Meade.net.Wrapper
|
|||||||
void SetupDialog();
|
void SetupDialog();
|
||||||
void WriteProfile(ProfileProperties profileProperties);
|
void WriteProfile(ProfileProperties profileProperties);
|
||||||
void ReadCharacters(int throwAwayCharacters);
|
void ReadCharacters(int throwAwayCharacters);
|
||||||
|
|
||||||
|
void SetParked(bool atPark, ParkedPosition parkedPosition);
|
||||||
|
bool IsParked { get; }
|
||||||
|
ParkedPosition ParkedPosition { get; }
|
||||||
|
|
||||||
|
PierSide SideOfPier { get; set; }
|
||||||
|
double? TargetRightAscension { get; set; }
|
||||||
|
double? TargetDeclination { get; set; }
|
||||||
|
|
||||||
|
short SlewSettleTime { get; set; }
|
||||||
|
|
||||||
|
bool IsLongFormat { get; set; }
|
||||||
|
|
||||||
|
bool MovingPrimary { get; set; }
|
||||||
|
|
||||||
|
bool MovingSecondary { get; set; }
|
||||||
|
|
||||||
|
DateTime EarliestNonSlewingTime { get; set; }
|
||||||
|
|
||||||
|
bool IsTargetCoordinateInitRequired { get; set; }
|
||||||
|
|
||||||
|
bool IsGuiding { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class SharedResourcesWrapper : ISharedResourcesWrapper
|
public class SharedResourcesWrapper : ISharedResourcesWrapper
|
||||||
@@ -54,19 +79,29 @@ namespace ASCOM.Meade.net.Wrapper
|
|||||||
return SharedResources.Lock(func);
|
return SharedResources.Lock(func);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string SendString(string message, bool includePrefix = true)
|
public string SendString(string message, bool raw = false)
|
||||||
{
|
{
|
||||||
return SharedResources.SendString(message, includePrefix);
|
return SharedResources.SendString(message, raw);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendBlind(string message)
|
public void SendBlind(string message, bool raw = false)
|
||||||
{
|
{
|
||||||
SharedResources.SendBlind(message);
|
SharedResources.SendBlind(message, raw);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string SendChar(string message)
|
public bool SendBool(string command, bool raw = false)
|
||||||
{
|
{
|
||||||
return SharedResources.SendChar(message);
|
return SharedResources.SendBool(command, raw);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string SendChar(string message, bool raw = false)
|
||||||
|
{
|
||||||
|
return SharedResources.SendChar(message, raw);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string SendChars(string message, bool raw = false, int count = 1)
|
||||||
|
{
|
||||||
|
return SharedResources.SendChars(message, raw, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string ReadTerminated()
|
public string ReadTerminated()
|
||||||
@@ -93,5 +128,74 @@ namespace ASCOM.Meade.net.Wrapper
|
|||||||
{
|
{
|
||||||
SharedResources.WriteProfile(profileProperties);
|
SharedResources.WriteProfile(profileProperties);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetParked(bool atPark, ParkedPosition parkedPosition)
|
||||||
|
{
|
||||||
|
SharedResources.SetParked(atPark, parkedPosition);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsParked => SharedResources.IsParked;
|
||||||
|
|
||||||
|
public ParkedPosition ParkedPosition => SharedResources.ParkedPosition;
|
||||||
|
|
||||||
|
public PierSide SideOfPier
|
||||||
|
{
|
||||||
|
get => SharedResources.SideOfPier;
|
||||||
|
set => SharedResources.SideOfPier = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double? TargetRightAscension
|
||||||
|
{
|
||||||
|
get => SharedResources.TargetRightAscension;
|
||||||
|
set => SharedResources.TargetRightAscension = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double? TargetDeclination
|
||||||
|
{
|
||||||
|
get => SharedResources.TargetDeclination;
|
||||||
|
set => SharedResources.TargetDeclination = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public short SlewSettleTime
|
||||||
|
{
|
||||||
|
get => SharedResources.SlewSettleTime;
|
||||||
|
set => SharedResources.SlewSettleTime = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsLongFormat
|
||||||
|
{
|
||||||
|
get => SharedResources.IsLongFormat;
|
||||||
|
set => SharedResources.IsLongFormat = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool MovingPrimary
|
||||||
|
{
|
||||||
|
get => SharedResources.MovingPrimary;
|
||||||
|
set => SharedResources.MovingPrimary = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool MovingSecondary
|
||||||
|
{
|
||||||
|
get => SharedResources.MovingSecondary;
|
||||||
|
set => SharedResources.MovingSecondary = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DateTime EarliestNonSlewingTime
|
||||||
|
{
|
||||||
|
get => SharedResources.EarliestNonSlewingTime;
|
||||||
|
set => SharedResources.EarliestNonSlewingTime = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsTargetCoordinateInitRequired
|
||||||
|
{
|
||||||
|
get => SharedResources.IsTargetCoordinateInitRequired;
|
||||||
|
set => SharedResources.IsTargetCoordinateInitRequired = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsGuiding
|
||||||
|
{
|
||||||
|
get => SharedResources.IsGuiding;
|
||||||
|
set => SharedResources.IsGuiding = value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user