Compare commits
122 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3d0464f379 | |||
| d1b5652228 | |||
| 65e06f2d6c | |||
| b27e50275d | |||
| a101d3a2d7 | |||
| d7637928b7 | |||
| 486a9205ee | |||
| 2c2c59290e | |||
| 70e615bb4e | |||
| 43ec63b0f5 | |||
| f354bcdee1 | |||
| e32c2aa50a | |||
| 795dc0c741 | |||
| 22a8a794ba | |||
| c6b54e273d | |||
| 7eec6c0008 | |||
| f9bb2aa879 | |||
| 18ea52c972 | |||
| f4eafa668d | |||
| 53abdba374 | |||
| fdd008fcfb | |||
| eaeae4d66b | |||
| 6ac80c408c | |||
| 9c5620edee | |||
| ad40eb8b9a | |||
| aca01de4ee | |||
| 384deecc3f | |||
| b27adf2649 | |||
| 2776b469c8 | |||
| fc3c91b975 | |||
| e7c81aba24 | |||
| a15bf22785 | |||
| ed84313c2e | |||
| e4af93dd07 | |||
| 5538f51cf0 | |||
| d0f12a604a | |||
| 178ef8b11d | |||
| 0835431e76 | |||
| bf6203d901 | |||
| 51bf99cb8c | |||
| 8713154e84 | |||
| 75b6f0b4b4 | |||
| 032fb2e8a8 | |||
| a5773aaaa9 | |||
| f88ad13f0d | |||
| 9dde0d9e81 | |||
| acc935248b | |||
| cdf1066e4e | |||
| f57a73843a | |||
| b0ef75ae66 | |||
| 136ccc8fa9 | |||
| e9491da707 | |||
| db06002ebf | |||
| ca1b7f8883 | |||
| 14b5651795 | |||
| 1186924761 | |||
| 1616ddbc21 | |||
| 79a404e78a | |||
| 9cd547c204 | |||
| f140e8aee1 | |||
| a9f57b7ad2 | |||
| c7fa7ab095 | |||
| 778b36b7f5 | |||
| 447ff3ace9 | |||
| c848ebd9be | |||
| d9acad1caa | |||
| f827a1ea3a | |||
| 26b94de48c | |||
| 779d314748 | |||
| 199b068e94 | |||
| e8f3b00912 | |||
| 579ea164f8 | |||
| 902d6bbc6e | |||
| 927d6bce47 | |||
| 65afa07125 | |||
| 58992c2947 | |||
| 1297b5eb78 | |||
| cd8330196e | |||
| 9042c76d48 | |||
| 4126b2ee44 | |||
| ca0028f08d | |||
| a59ecaf21d | |||
| 1b73bb62b6 | |||
| c34ed41ddf | |||
| d0406b32dd | |||
| b33d1741c4 | |||
| d728dbe272 | |||
| 47d0a047a5 | |||
| 83dd7d87f0 | |||
| 03f2022f2f | |||
| 89600c463b | |||
| 92ab807eae | |||
| a2fcaac2a9 | |||
| da4e4fd81a | |||
| 4266139429 | |||
| 1dc7d7142a | |||
| b9f1dd9d61 | |||
| 6c25373d7f | |||
| c19115f252 | |||
| 9c4329deed | |||
| a563a77554 | |||
| f9792b22bc | |||
| 8d097fefe1 | |||
| 71ed5cc58b | |||
| d6cec4d63e | |||
| 139191a1ce | |||
| 946fb4b141 | |||
| 3d47e03240 | |||
| 855a21122a | |||
| 2c7de157e8 | |||
| 1e59d5610e | |||
| bd8476e11a | |||
| 3e00398af0 | |||
| 2ab9cfb9c8 | |||
| 894b78d9f1 | |||
| b9522ae2a2 | |||
| 07665b7617 | |||
| 6130cb6d64 | |||
| d925312403 | |||
| 5a18577552 | |||
| c7f1a4272f | |||
| 6601fa6205 |
+1
-1
@@ -109,6 +109,7 @@ _TeamCity*
|
|||||||
_NCrunch_*
|
_NCrunch_*
|
||||||
.*crunch*.local.xml
|
.*crunch*.local.xml
|
||||||
nCrunchTemp_*
|
nCrunchTemp_*
|
||||||
|
*ncrunchsolution.user
|
||||||
|
|
||||||
# MightyMoose
|
# MightyMoose
|
||||||
*.mm.*
|
*.mm.*
|
||||||
@@ -217,5 +218,4 @@ _Pvt_Extensions
|
|||||||
|
|
||||||
# nCrunch items
|
# nCrunch items
|
||||||
*.ncrunchsolution
|
*.ncrunchsolution
|
||||||
*.DotSettings
|
|
||||||
*.ncrunchproject
|
*.ncrunchproject
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<Import Project="..\packages\NUnit.3.12.0\build\NUnit.props" Condition="Exists('..\packages\NUnit.3.12.0\build\NUnit.props')" />
|
<Import Project="..\packages\NUnit.3.13.0\build\NUnit.props" Condition="Exists('..\packages\NUnit.3.13.0\build\NUnit.props')" />
|
||||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
@@ -54,22 +54,25 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="Castle.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
|
<Reference Include="Castle.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Castle.Core.4.4.0\lib\net45\Castle.Core.dll</HintPath>
|
<HintPath>..\packages\Castle.Core.4.4.1\lib\net45\Castle.Core.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Moq, Version=4.13.0.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
|
<Reference Include="JetBrains.Annotations, Version=2020.3.0.0, Culture=neutral, PublicKeyToken=1010a0d8d6380325, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Moq.4.13.0\lib\net45\Moq.dll</HintPath>
|
<HintPath>..\packages\JetBrains.Annotations.2020.3.0\lib\net20\JetBrains.Annotations.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="nunit.framework, Version=3.12.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
|
<Reference Include="Moq, Version=4.15.0.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\NUnit.3.12.0\lib\net45\nunit.framework.dll</HintPath>
|
<HintPath>..\packages\Moq.4.15.2\lib\net45\Moq.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="nunit.framework, Version=3.13.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\NUnit.3.13.0\lib\net45\nunit.framework.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Configuration" />
|
<Reference Include="System.Configuration" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.5.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.6.0\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.5.0.0\lib\net45\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.3\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll</HintPath>
|
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Xml.Linq" />
|
<Reference Include="System.Xml.Linq" />
|
||||||
<Reference Include="System.Data.DataSetExtensions" />
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
@@ -87,6 +90,10 @@
|
|||||||
<Project>{64308775-bd4a-469c-bcab-3ed830b811af}</Project>
|
<Project>{64308775-bd4a-469c-bcab-3ed830b811af}</Project>
|
||||||
<Name>Meade.net.Telescope</Name>
|
<Name>Meade.net.Telescope</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\Meade.net\Meade.net.csproj">
|
||||||
|
<Project>{3689a2cb-94c5-4012-a5cf-7e7d1dd27143}</Project>
|
||||||
|
<Name>Meade.net</Name>
|
||||||
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="app.config" />
|
<None Include="app.config" />
|
||||||
@@ -97,6 +104,6 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Error Condition="!Exists('..\packages\NUnit.3.12.0\build\NUnit.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NUnit.3.12.0\build\NUnit.props'))" />
|
<Error Condition="!Exists('..\packages\NUnit.3.13.0\build\NUnit.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NUnit.3.13.0\build\NUnit.props'))" />
|
||||||
</Target>
|
</Target>
|
||||||
</Project>
|
</Project>
|
||||||
@@ -18,14 +18,14 @@ namespace AstroMath.UnitTests
|
|||||||
[Test]
|
[Test]
|
||||||
public void DegreesToRadians()
|
public void DegreesToRadians()
|
||||||
{
|
{
|
||||||
var radians = _astroMath.DegreesToRadians(90);
|
var radians = 90.0.DegreesToRadians();
|
||||||
Assert.That(radians, Is.EqualTo(1.5707963267948966));
|
Assert.That(radians, Is.EqualTo(1.5707963267948966));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void RadiansToDegrees()
|
public void RadiansToDegrees()
|
||||||
{
|
{
|
||||||
var degrees = _astroMath.RadiansToDegrees(1.5707963267948966);
|
var degrees = 1.5707963267948966.RadiansToDegrees();
|
||||||
Assert.That(degrees, Is.EqualTo(90));
|
Assert.That(degrees, Is.EqualTo(90));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -34,7 +34,7 @@ namespace AstroMath.UnitTests
|
|||||||
public void DateTimeToDecimalHours_book()
|
public void DateTimeToDecimalHours_book()
|
||||||
{
|
{
|
||||||
DateTime dateTime = new DateTime(2019, 05, 18, 18, 31, 27, DateTimeKind.Utc);
|
DateTime dateTime = new DateTime(2019, 05, 18, 18, 31, 27, DateTimeKind.Utc);
|
||||||
var decimalHours = _astroMath.DateTimeToDecimalHours(dateTime);
|
var decimalHours = dateTime.DateTimeToDecimalHours();
|
||||||
|
|
||||||
Assert.That(decimalHours, Is.EqualTo(18.524166666666666));
|
Assert.That(decimalHours, Is.EqualTo(18.524166666666666));
|
||||||
}
|
}
|
||||||
@@ -43,7 +43,7 @@ namespace AstroMath.UnitTests
|
|||||||
public void DateTimeToDecimalHours()
|
public void DateTimeToDecimalHours()
|
||||||
{
|
{
|
||||||
DateTime dateTime = new DateTime(2019, 05, 18, 22, 26, 15, DateTimeKind.Utc);
|
DateTime dateTime = new DateTime(2019, 05, 18, 22, 26, 15, DateTimeKind.Utc);
|
||||||
var decimalHours = _astroMath.DateTimeToDecimalHours(dateTime);
|
var decimalHours = dateTime.DateTimeToDecimalHours();
|
||||||
|
|
||||||
Assert.That(decimalHours, Is.EqualTo(22.4375));
|
Assert.That(decimalHours, Is.EqualTo(22.4375));
|
||||||
}
|
}
|
||||||
@@ -52,7 +52,7 @@ namespace AstroMath.UnitTests
|
|||||||
public void UTtoGST_book()
|
public void UTtoGST_book()
|
||||||
{
|
{
|
||||||
DateTime dateTime = new DateTime(1980, 04, 22, 14, 36, 51, 670, DateTimeKind.Utc);
|
DateTime dateTime = new DateTime(1980, 04, 22, 14, 36, 51, 670, DateTimeKind.Utc);
|
||||||
double gst = _astroMath.UTtoGst(dateTime);
|
double gst = dateTime.UTtoGst();
|
||||||
|
|
||||||
Assert.That(gst, Is.EqualTo(4.667932706211154));
|
Assert.That(gst, Is.EqualTo(4.667932706211154));
|
||||||
}
|
}
|
||||||
@@ -61,7 +61,7 @@ namespace AstroMath.UnitTests
|
|||||||
public void UTtoGst()
|
public void UTtoGst()
|
||||||
{
|
{
|
||||||
DateTime dateTime = new DateTime(2019, 05, 18, 22, 26, 15, DateTimeKind.Utc);
|
DateTime dateTime = new DateTime(2019, 05, 18, 22, 26, 15, DateTimeKind.Utc);
|
||||||
double gst = _astroMath.UTtoGst(dateTime);
|
double gst = dateTime.UTtoGst();
|
||||||
|
|
||||||
Assert.That(gst, Is.EqualTo(14.191879687876451));
|
Assert.That(gst, Is.EqualTo(14.191879687876451));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||||
<bindingRedirect oldVersion="0.0.0.0-4.0.5.0" newVersion="4.0.5.0" />
|
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
</assemblyBinding>
|
</assemblyBinding>
|
||||||
</runtime>
|
</runtime>
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="Castle.Core" version="4.4.0" targetFramework="net472" />
|
<package id="Castle.Core" version="4.4.1" targetFramework="net472" />
|
||||||
<package id="Moq" version="4.13.0" targetFramework="net472" />
|
<package id="JetBrains.Annotations" version="2020.3.0" targetFramework="net472" />
|
||||||
<package id="NUnit" version="3.12.0" targetFramework="net472" />
|
<package id="Moq" version="4.15.2" targetFramework="net472" />
|
||||||
<package id="System.Runtime.CompilerServices.Unsafe" version="4.6.0" targetFramework="net472" />
|
<package id="NUnit" version="3.13.0" targetFramework="net472" />
|
||||||
<package id="System.Threading.Tasks.Extensions" version="4.5.3" 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" />
|
||||||
</packages>
|
</packages>
|
||||||
@@ -59,6 +59,9 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="ASCOM.DeviceInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL" />
|
<Reference Include="ASCOM.DeviceInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL" />
|
||||||
<Reference Include="ASCOM.DriverAccess, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL" />
|
<Reference Include="ASCOM.DriverAccess, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL" />
|
||||||
|
<Reference Include="JetBrains.Annotations, Version=2020.3.0.0, Culture=neutral, PublicKeyToken=1010a0d8d6380325, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\JetBrains.Annotations.2020.3.0\lib\net20\JetBrains.Annotations.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
<Reference Include="System.Xml.Linq" />
|
<Reference Include="System.Xml.Linq" />
|
||||||
@@ -72,6 +75,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="app.config" />
|
<None Include="app.config" />
|
||||||
|
<None Include="packages.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<!-- 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.
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<packages>
|
||||||
|
<package id="JetBrains.Annotations" version="2020.3.0" targetFramework="net45" />
|
||||||
|
</packages>
|
||||||
@@ -27,8 +27,15 @@ namespace Meade.net.Focuser.UnitTests
|
|||||||
{
|
{
|
||||||
TraceLogger = false,
|
TraceLogger = false,
|
||||||
ComPort = "TestCom1",
|
ComPort = "TestCom1",
|
||||||
|
Speed = 9600,
|
||||||
|
Parity = "None",
|
||||||
|
Handshake = "None",
|
||||||
|
StopBits = "One",
|
||||||
|
DataBits = 8,
|
||||||
|
|
||||||
GuideRateArcSecondsPerSecond = 1.23,
|
GuideRateArcSecondsPerSecond = 1.23,
|
||||||
Precision = "Unchanged"
|
Precision = "Unchanged",
|
||||||
|
GuidingStyle = "Auto"
|
||||||
};
|
};
|
||||||
|
|
||||||
_utilMock = new Mock<IUtil>();
|
_utilMock = new Mock<IUtil>();
|
||||||
@@ -102,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]
|
||||||
@@ -123,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]
|
||||||
@@ -152,11 +163,11 @@ namespace Meade.net.Focuser.UnitTests
|
|||||||
|
|
||||||
ConnectFocuser();
|
ConnectFocuser();
|
||||||
|
|
||||||
_sharedResourcesWrapperMock.Setup(x => x.SendString(sendMessage)).Returns(() => expectedMessage);
|
_sharedResourcesWrapperMock.Setup(x => x.SendString(sendMessage, true)).Returns(() => expectedMessage);
|
||||||
|
|
||||||
var actualMessage = _focuser.CommandString(sendMessage, true);
|
var actualMessage = _focuser.CommandString(sendMessage, true);
|
||||||
|
|
||||||
_sharedResourcesWrapperMock.Verify(x => x.SendString(sendMessage), Times.Once);
|
_sharedResourcesWrapperMock.Verify(x => x.SendString(sendMessage, true), Times.Once);
|
||||||
Assert.That(actualMessage, Is.EqualTo(expectedMessage));
|
Assert.That(actualMessage, Is.EqualTo(expectedMessage));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -181,7 +192,7 @@ namespace Meade.net.Focuser.UnitTests
|
|||||||
_sharedResourcesWrapperMock.Setup(x => x.FirmwareVersion).Returns(firmware);
|
_sharedResourcesWrapperMock.Setup(x => x.FirmwareVersion).Returns(firmware);
|
||||||
_focuser.Connected = true;
|
_focuser.Connected = true;
|
||||||
|
|
||||||
_sharedResourcesWrapperMock.Verify(x => x.Connect("Serial", It.IsAny<string>()), Times.Once);
|
_sharedResourcesWrapperMock.Verify(x => x.Connect("Serial", It.IsAny<string>(), It.IsAny<ITraceLogger>()), Times.Once);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -189,20 +200,20 @@ namespace Meade.net.Focuser.UnitTests
|
|||||||
public void Connected_Set_SettingTrueWhenTrue_ThenDoesNothing()
|
public void Connected_Set_SettingTrueWhenTrue_ThenDoesNothing()
|
||||||
{
|
{
|
||||||
ConnectFocuser();
|
ConnectFocuser();
|
||||||
_sharedResourcesWrapperMock.Verify(x => x.Connect(It.IsAny<string>(), It.IsAny<string>()), Times.Once);
|
_sharedResourcesWrapperMock.Verify(x => x.Connect(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<ITraceLogger>()), Times.Once);
|
||||||
|
|
||||||
//act
|
//act
|
||||||
_focuser.Connected = true;
|
_focuser.Connected = true;
|
||||||
|
|
||||||
//assert
|
//assert
|
||||||
_sharedResourcesWrapperMock.Verify(x => x.Connect(It.IsAny<string>(), It.IsAny<string>()), Times.Once);
|
_sharedResourcesWrapperMock.Verify(x => x.Connect(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<ITraceLogger>()), Times.Once);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void Connected_Set_SettingFalseWhenTrue_ThenDisconnects()
|
public void Connected_Set_SettingFalseWhenTrue_ThenDisconnects()
|
||||||
{
|
{
|
||||||
ConnectFocuser();
|
ConnectFocuser();
|
||||||
_sharedResourcesWrapperMock.Verify(x => x.Connect(It.IsAny<string>(), It.IsAny<string>()), Times.Once);
|
_sharedResourcesWrapperMock.Verify(x => x.Connect(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<ITraceLogger>()), Times.Once);
|
||||||
|
|
||||||
//act
|
//act
|
||||||
_focuser.Connected = false;
|
_focuser.Connected = false;
|
||||||
@@ -312,8 +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);
|
||||||
_utilMock.Verify( x => x.WaitForMilliseconds(250), Times.AtLeastOnce);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -328,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)]
|
||||||
@@ -388,34 +398,65 @@ 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;
|
||||||
|
|
||||||
ConnectFocuser();
|
ConnectFocuser();
|
||||||
|
|
||||||
_focuser.Move(position);
|
_focuser.Move(position);
|
||||||
|
|
||||||
if (position < 0)
|
if (position < 0)
|
||||||
{
|
{
|
||||||
_sharedResourcesWrapperMock.Verify( x => x.SendBlind("#:F-#"), Times.AtLeastOnce);
|
_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.AtLeastOnce);
|
_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(250), Times.AtLeastOnce);
|
|
||||||
|
|
||||||
|
_utilMock.Verify(x => x.WaitForMilliseconds(Math.Abs(position)), Times.Once);
|
||||||
|
_utilMock.Verify(x => x.WaitForMilliseconds(Math.Abs(_profileProperties.BacklashCompensation)), Times.Never);
|
||||||
_utilMock.Verify(x => x.WaitForMilliseconds(100), Times.Once());
|
_utilMock.Verify(x => x.WaitForMilliseconds(100), Times.Once());
|
||||||
_utilMock.Verify(x => x.WaitForMilliseconds(1000), Times.Once());
|
}
|
||||||
|
|
||||||
|
[TestCase(200)]
|
||||||
|
[TestCase(-200)]
|
||||||
|
public void Move_WhenIncrementIsNot0_ThenMovesFocuserAndStopsFocuserWithBacklashCompensation(int position)
|
||||||
|
{
|
||||||
|
_profileProperties.BacklashCompensation = 3000;
|
||||||
|
|
||||||
|
ConnectFocuser();
|
||||||
|
|
||||||
|
_focuser.Move(position);
|
||||||
|
|
||||||
|
if (position < 0)
|
||||||
|
{
|
||||||
|
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("F-", false), Times.Once);
|
||||||
|
_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(_profileProperties.BacklashCompensation)), Times.Never);
|
||||||
|
_utilMock.Verify(x => x.WaitForMilliseconds(100), Times.Exactly(1));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("F-", false), 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(_profileProperties.BacklashCompensation), Times.Once);
|
||||||
|
_utilMock.Verify(x => x.WaitForMilliseconds(100), Times.Exactly(2));
|
||||||
|
}
|
||||||
|
|
||||||
|
_sharedResourcesWrapperMock.Verify(x => x.Lock(It.IsAny<Action>()), Times.Once);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -466,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."));
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<Import Project="..\packages\NUnit.3.12.0\build\NUnit.props" Condition="Exists('..\packages\NUnit.3.12.0\build\NUnit.props')" />
|
<Import Project="..\packages\NUnit.3.13.0\build\NUnit.props" Condition="Exists('..\packages\NUnit.3.13.0\build\NUnit.props')" />
|
||||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
@@ -36,55 +36,58 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="ASCOM.Astrometry, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
<Reference Include="ASCOM.Astrometry, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Astrometry.dll</HintPath>
|
<HintPath>..\packages\ASCOM.Platform.6.5.1\lib\net40\ASCOM.Astrometry.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="ASCOM.Attributes, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
<Reference Include="ASCOM.Attributes, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Attributes.dll</HintPath>
|
<HintPath>..\packages\ASCOM.Platform.6.5.1\lib\net40\ASCOM.Attributes.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="ASCOM.Cache, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
<Reference Include="ASCOM.Cache, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Cache.dll</HintPath>
|
<HintPath>..\packages\ASCOM.Platform.6.5.1\lib\net40\ASCOM.Cache.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="ASCOM.Controls, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
<Reference Include="ASCOM.Controls, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Controls.dll</HintPath>
|
<HintPath>..\packages\ASCOM.Platform.6.5.1\lib\net40\ASCOM.Controls.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="ASCOM.DeviceInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
<Reference Include="ASCOM.DeviceInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.DeviceInterfaces.dll</HintPath>
|
<HintPath>..\packages\ASCOM.Platform.6.5.1\lib\net40\ASCOM.DeviceInterfaces.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="ASCOM.DriverAccess, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
<Reference Include="ASCOM.DriverAccess, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.DriverAccess.dll</HintPath>
|
<HintPath>..\packages\ASCOM.Platform.6.5.1\lib\net40\ASCOM.DriverAccess.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="ASCOM.Exceptions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
<Reference Include="ASCOM.Exceptions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Exceptions.dll</HintPath>
|
<HintPath>..\packages\ASCOM.Platform.6.5.1\lib\net40\ASCOM.Exceptions.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="ASCOM.Internal.Extensions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
<Reference Include="ASCOM.Internal.Extensions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Internal.Extensions.dll</HintPath>
|
<HintPath>..\packages\ASCOM.Platform.6.5.1\lib\net40\ASCOM.Internal.Extensions.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="ASCOM.SettingsProvider, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
<Reference Include="ASCOM.SettingsProvider, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.SettingsProvider.dll</HintPath>
|
<HintPath>..\packages\ASCOM.Platform.6.5.1\lib\net40\ASCOM.SettingsProvider.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="ASCOM.Utilities, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
<Reference Include="ASCOM.Utilities, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Utilities.dll</HintPath>
|
<HintPath>..\packages\ASCOM.Platform.6.5.1\lib\net40\ASCOM.Utilities.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="ASCOM.Utilities.Video, Version=6.1.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
<Reference Include="ASCOM.Utilities.Video, Version=6.1.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Utilities.Video.dll</HintPath>
|
<HintPath>..\packages\ASCOM.Platform.6.5.1\lib\net40\ASCOM.Utilities.Video.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Castle.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
|
<Reference Include="Castle.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Castle.Core.4.4.0\lib\net45\Castle.Core.dll</HintPath>
|
<HintPath>..\packages\Castle.Core.4.4.1\lib\net45\Castle.Core.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Moq, Version=4.13.0.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
|
<Reference Include="JetBrains.Annotations, Version=2020.3.0.0, Culture=neutral, PublicKeyToken=1010a0d8d6380325, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Moq.4.13.0\lib\net45\Moq.dll</HintPath>
|
<HintPath>..\packages\JetBrains.Annotations.2020.3.0\lib\net20\JetBrains.Annotations.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="nunit.framework, Version=3.12.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
|
<Reference Include="Moq, Version=4.15.0.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\NUnit.3.12.0\lib\net45\nunit.framework.dll</HintPath>
|
<HintPath>..\packages\Moq.4.15.2\lib\net45\Moq.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="nunit.framework, Version=3.13.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\NUnit.3.13.0\lib\net45\nunit.framework.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Configuration" />
|
<Reference Include="System.Configuration" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.5.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.6.0\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.5.0.0\lib\net45\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.3\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll</HintPath>
|
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Xml.Linq" />
|
<Reference Include="System.Xml.Linq" />
|
||||||
<Reference Include="System.Data.DataSetExtensions" />
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
@@ -117,6 +120,6 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Error Condition="!Exists('..\packages\NUnit.3.12.0\build\NUnit.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NUnit.3.12.0\build\NUnit.props'))" />
|
<Error Condition="!Exists('..\packages\NUnit.3.13.0\build\NUnit.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NUnit.3.13.0\build\NUnit.props'))" />
|
||||||
</Target>
|
</Target>
|
||||||
</Project>
|
</Project>
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||||
<bindingRedirect oldVersion="0.0.0.0-4.0.5.0" newVersion="4.0.5.0" />
|
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
</assemblyBinding>
|
</assemblyBinding>
|
||||||
</runtime>
|
</runtime>
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="ASCOM.Platform" version="6.4.2" targetFramework="net472" />
|
<package id="ASCOM.Platform" version="6.5.1" targetFramework="net472" />
|
||||||
<package id="Castle.Core" version="4.4.0" targetFramework="net472" />
|
<package id="Castle.Core" version="4.4.1" targetFramework="net472" />
|
||||||
<package id="Moq" version="4.13.0" targetFramework="net472" />
|
<package id="JetBrains.Annotations" version="2020.3.0" targetFramework="net472" />
|
||||||
<package id="NUnit" version="3.12.0" targetFramework="net472" />
|
<package id="Moq" version="4.15.2" targetFramework="net472" />
|
||||||
<package id="System.Runtime.CompilerServices.Unsafe" version="4.6.0" targetFramework="net472" />
|
<package id="NUnit" version="3.13.0" targetFramework="net472" />
|
||||||
<package id="System.Threading.Tasks.Extensions" version="4.5.3" 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" />
|
||||||
</packages>
|
</packages>
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<Import Project="..\packages\NUnit.3.12.0\build\NUnit.props" Condition="Exists('..\packages\NUnit.3.12.0\build\NUnit.props')" />
|
<Import Project="..\packages\NUnit.3.13.0\build\NUnit.props" Condition="Exists('..\packages\NUnit.3.13.0\build\NUnit.props')" />
|
||||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
@@ -57,55 +57,58 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="ASCOM.Astrometry, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
<Reference Include="ASCOM.Astrometry, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Astrometry.dll</HintPath>
|
<HintPath>..\packages\ASCOM.Platform.6.5.1\lib\net40\ASCOM.Astrometry.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="ASCOM.Attributes, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
<Reference Include="ASCOM.Attributes, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Attributes.dll</HintPath>
|
<HintPath>..\packages\ASCOM.Platform.6.5.1\lib\net40\ASCOM.Attributes.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="ASCOM.Cache, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
<Reference Include="ASCOM.Cache, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Cache.dll</HintPath>
|
<HintPath>..\packages\ASCOM.Platform.6.5.1\lib\net40\ASCOM.Cache.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="ASCOM.Controls, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
<Reference Include="ASCOM.Controls, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Controls.dll</HintPath>
|
<HintPath>..\packages\ASCOM.Platform.6.5.1\lib\net40\ASCOM.Controls.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="ASCOM.DeviceInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
<Reference Include="ASCOM.DeviceInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.DeviceInterfaces.dll</HintPath>
|
<HintPath>..\packages\ASCOM.Platform.6.5.1\lib\net40\ASCOM.DeviceInterfaces.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="ASCOM.DriverAccess, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
<Reference Include="ASCOM.DriverAccess, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.DriverAccess.dll</HintPath>
|
<HintPath>..\packages\ASCOM.Platform.6.5.1\lib\net40\ASCOM.DriverAccess.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="ASCOM.Exceptions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
<Reference Include="ASCOM.Exceptions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Exceptions.dll</HintPath>
|
<HintPath>..\packages\ASCOM.Platform.6.5.1\lib\net40\ASCOM.Exceptions.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="ASCOM.Internal.Extensions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
<Reference Include="ASCOM.Internal.Extensions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Internal.Extensions.dll</HintPath>
|
<HintPath>..\packages\ASCOM.Platform.6.5.1\lib\net40\ASCOM.Internal.Extensions.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="ASCOM.SettingsProvider, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
<Reference Include="ASCOM.SettingsProvider, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.SettingsProvider.dll</HintPath>
|
<HintPath>..\packages\ASCOM.Platform.6.5.1\lib\net40\ASCOM.SettingsProvider.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="ASCOM.Utilities, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
<Reference Include="ASCOM.Utilities, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Utilities.dll</HintPath>
|
<HintPath>..\packages\ASCOM.Platform.6.5.1\lib\net40\ASCOM.Utilities.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="ASCOM.Utilities.Video, Version=6.1.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
<Reference Include="ASCOM.Utilities.Video, Version=6.1.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Utilities.Video.dll</HintPath>
|
<HintPath>..\packages\ASCOM.Platform.6.5.1\lib\net40\ASCOM.Utilities.Video.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Castle.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
|
<Reference Include="Castle.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Castle.Core.4.4.0\lib\net45\Castle.Core.dll</HintPath>
|
<HintPath>..\packages\Castle.Core.4.4.1\lib\net45\Castle.Core.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Moq, Version=4.13.0.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
|
<Reference Include="JetBrains.Annotations, Version=2020.3.0.0, Culture=neutral, PublicKeyToken=1010a0d8d6380325, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Moq.4.13.0\lib\net45\Moq.dll</HintPath>
|
<HintPath>..\packages\JetBrains.Annotations.2020.3.0\lib\net20\JetBrains.Annotations.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="nunit.framework, Version=3.12.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
|
<Reference Include="Moq, Version=4.15.0.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\NUnit.3.12.0\lib\net40\nunit.framework.dll</HintPath>
|
<HintPath>..\packages\Moq.4.15.2\lib\net45\Moq.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="nunit.framework, Version=3.13.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\NUnit.3.13.0\lib\net45\nunit.framework.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Configuration" />
|
<Reference Include="System.Configuration" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.5.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.6.0\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.5.0.0\lib\net45\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.3\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll</HintPath>
|
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Xml.Linq" />
|
<Reference Include="System.Xml.Linq" />
|
||||||
<Reference Include="System.Data.DataSetExtensions" />
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
@@ -137,6 +140,6 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Error Condition="!Exists('..\packages\NUnit.3.12.0\build\NUnit.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NUnit.3.12.0\build\NUnit.props'))" />
|
<Error Condition="!Exists('..\packages\NUnit.3.13.0\build\NUnit.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NUnit.3.13.0\build\NUnit.props'))" />
|
||||||
</Target>
|
</Target>
|
||||||
</Project>
|
</Project>
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -4,7 +4,7 @@
|
|||||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||||
<bindingRedirect oldVersion="0.0.0.0-4.0.5.0" newVersion="4.0.5.0" />
|
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="ASCOM.Platform" version="6.4.2" targetFramework="net472" />
|
<package id="ASCOM.Platform" version="6.5.1" targetFramework="net472" />
|
||||||
<package id="Castle.Core" version="4.4.0" targetFramework="net45" />
|
<package id="Castle.Core" version="4.4.1" targetFramework="net472" />
|
||||||
<package id="Moq" version="4.13.0" targetFramework="net472" />
|
<package id="JetBrains.Annotations" version="2020.3.0" targetFramework="net472" />
|
||||||
<package id="NUnit" version="3.12.0" targetFramework="net40" requireReinstallation="true" />
|
<package id="Moq" version="4.15.2" targetFramework="net472" />
|
||||||
<package id="System.Runtime.CompilerServices.Unsafe" version="4.6.0" targetFramework="net472" />
|
<package id="NUnit" version="3.13.0" targetFramework="net472" />
|
||||||
<package id="System.Threading.Tasks.Extensions" version="4.5.3" 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" />
|
||||||
</packages>
|
</packages>
|
||||||
@@ -0,0 +1,79 @@
|
|||||||
|
using System;
|
||||||
|
using ASCOM.Utilities;
|
||||||
|
|
||||||
|
namespace ASCOM.Meade.net.AstroMaths
|
||||||
|
{
|
||||||
|
public static class AstroMathExtensions
|
||||||
|
{
|
||||||
|
public static double DegreesToRadians(this double degrees)
|
||||||
|
{
|
||||||
|
return (Math.PI / 180) * degrees;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static double RadiansToDegrees(this double radians)
|
||||||
|
{
|
||||||
|
double degrees = (180 / Math.PI) * radians;
|
||||||
|
return degrees;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static double DateTimeToDecimalHours(this DateTime utcDateTime)
|
||||||
|
{
|
||||||
|
double sec = utcDateTime.Second;
|
||||||
|
double min = utcDateTime.Minute;
|
||||||
|
double hour = utcDateTime.Hour;
|
||||||
|
|
||||||
|
var a = Math.Abs(sec) / 60;
|
||||||
|
var b = (Math.Abs(min) + a) / 60;
|
||||||
|
var c = Math.Abs(hour) + b;
|
||||||
|
|
||||||
|
var d = c;
|
||||||
|
|
||||||
|
if ((hour < 0) || (min < 0) || (sec < 0))
|
||||||
|
d = -c;
|
||||||
|
|
||||||
|
return d;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static double UTtoGst( this DateTime utcDateTime)
|
||||||
|
{
|
||||||
|
Util util = new Util();
|
||||||
|
|
||||||
|
var jd = util.DateUTCToJulian(utcDateTime) - 0.5;
|
||||||
|
if ((jd % 1) <= 0.5)
|
||||||
|
jd = Math.Floor(jd);
|
||||||
|
else
|
||||||
|
jd = Math.Floor(jd) + 0.5;
|
||||||
|
|
||||||
|
var s = jd - 2451545.0;
|
||||||
|
var t = s / 36525.0;
|
||||||
|
var t0 = 6.697374558 + (2400.051336 * t) + (0.000025862 * (t * t));
|
||||||
|
|
||||||
|
while (t0 < 0)
|
||||||
|
{
|
||||||
|
t0 += 24;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (t0 >= 24)
|
||||||
|
{
|
||||||
|
t0 -= 24;
|
||||||
|
}
|
||||||
|
|
||||||
|
var ut = utcDateTime.DateTimeToDecimalHours();
|
||||||
|
var a = ut * 1.002737909;
|
||||||
|
|
||||||
|
var t1 = t0 + a;
|
||||||
|
|
||||||
|
while (t1 < 0)
|
||||||
|
{
|
||||||
|
t1 += 24;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (t1 >= 24)
|
||||||
|
{
|
||||||
|
t1 -= 24;
|
||||||
|
}
|
||||||
|
|
||||||
|
return t1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using ASCOM.Utilities;
|
|
||||||
|
|
||||||
namespace ASCOM.Meade.net.AstroMaths
|
namespace ASCOM.Meade.net.AstroMaths
|
||||||
{
|
{
|
||||||
@@ -10,7 +9,7 @@ namespace ASCOM.Meade.net.AstroMaths
|
|||||||
public double RightAscensionToHourAngle(DateTime utcDateTime, double longitude, double rightAscension)
|
public double RightAscensionToHourAngle(DateTime utcDateTime, double longitude, double rightAscension)
|
||||||
{
|
{
|
||||||
//var ut = DateTimeToDecimalHours( utcDateTime);
|
//var ut = DateTimeToDecimalHours( utcDateTime);
|
||||||
var gst = UTtoGst( utcDateTime);
|
var gst = utcDateTime.UTtoGst();
|
||||||
var lst = GsTtoLst( gst, longitude);
|
var lst = GsTtoLst( gst, longitude);
|
||||||
var raHours = rightAscension;
|
var raHours = rightAscension;
|
||||||
var h1 = lst - raHours;
|
var h1 = lst - raHours;
|
||||||
@@ -24,7 +23,7 @@ namespace ASCOM.Meade.net.AstroMaths
|
|||||||
|
|
||||||
private double HourAngleToRightAscension(DateTime utcDateTime, double longitude, double hourAngle )
|
private double HourAngleToRightAscension(DateTime utcDateTime, double longitude, double hourAngle )
|
||||||
{
|
{
|
||||||
var gst = UTtoGst(utcDateTime);
|
var gst = utcDateTime.UTtoGst();
|
||||||
var lst = GsTtoLst( gst, longitude);
|
var lst = GsTtoLst( gst, longitude);
|
||||||
var raHours = hourAngle;
|
var raHours = hourAngle;
|
||||||
var h1 = lst - raHours;
|
var h1 = lst - raHours;
|
||||||
@@ -39,17 +38,17 @@ namespace ASCOM.Meade.net.AstroMaths
|
|||||||
|
|
||||||
public EquatorialCoordinates ConvertHozToEq( DateTime utcDateTime, double latitude, double longitude, HorizonCoordinates altAz)
|
public EquatorialCoordinates ConvertHozToEq( DateTime utcDateTime, double latitude, double longitude, HorizonCoordinates altAz)
|
||||||
{
|
{
|
||||||
var az = DegreesToRadians(altAz.Azimuth);
|
var az = altAz.Azimuth.DegreesToRadians();
|
||||||
var alt = DegreesToRadians(altAz.Altitude);
|
var alt = altAz.Altitude.DegreesToRadians();
|
||||||
var lat = DegreesToRadians(latitude);
|
var lat = latitude.DegreesToRadians();
|
||||||
|
|
||||||
var sinDec = Math.Sin(alt) * Math.Sin(lat) + Math.Cos(alt) * Math.Cos(lat) * Math.Cos(az);
|
var sinDec = Math.Sin(alt) * Math.Sin(lat) + Math.Cos(alt) * Math.Cos(lat) * Math.Cos(az);
|
||||||
var dec = RadiansToDegrees(Math.Asin(sinDec));
|
var dec = Math.Asin(sinDec).RadiansToDegrees();
|
||||||
|
|
||||||
var y = -Math.Cos(alt) * Math.Cos(lat) * Math.Sin(az);
|
var y = -Math.Cos(alt) * Math.Cos(lat) * Math.Sin(az);
|
||||||
var x = Math.Sin(alt) - Math.Sin(lat) * sinDec;
|
var x = Math.Sin(alt) - Math.Sin(lat) * sinDec;
|
||||||
var upperA = Math.Atan2(y,x);
|
var upperA = Math.Atan2(y,x);
|
||||||
var upperB = RadiansToDegrees(upperA);
|
var upperB = upperA.RadiansToDegrees();
|
||||||
|
|
||||||
var ha = upperB;
|
var ha = upperB;
|
||||||
|
|
||||||
@@ -72,19 +71,20 @@ namespace ASCOM.Meade.net.AstroMaths
|
|||||||
public HorizonCoordinates ConvertEqToHoz(double hourAngle, double latitude, EquatorialCoordinates raDec)
|
public HorizonCoordinates ConvertEqToHoz(double hourAngle, double latitude, EquatorialCoordinates raDec)
|
||||||
{
|
{
|
||||||
var h = hourAngle * 15;
|
var h = hourAngle * 15;
|
||||||
var h1 = DegreesToRadians(h);
|
var h1 = h.DegreesToRadians();
|
||||||
var d = DegreesToRadians(raDec.Declination);
|
var d = raDec.Declination.DegreesToRadians();
|
||||||
var lat = DegreesToRadians(latitude);
|
var lat = latitude.DegreesToRadians();
|
||||||
var sinA = Math.Sin(d) * Math.Sin(lat) + Math.Cos(d) * Math.Cos(lat) * Math.Cos(h1);
|
var sinA = Math.Sin(d) * Math.Sin(lat) + Math.Cos(d) * Math.Cos(lat) * Math.Cos(h1);
|
||||||
|
|
||||||
var y = -Math.Cos(d) * Math.Cos(lat) * Math.Sin(h1);
|
var y = -Math.Cos(d) * Math.Cos(lat) * Math.Sin(h1);
|
||||||
var x = Math.Sin(d) - Math.Sin(lat) * sinA;
|
var x = Math.Sin(d) - Math.Sin(lat) * sinA;
|
||||||
var upperA = Math.Atan2(y, x);
|
var upperA = Math.Atan2(y, x);
|
||||||
var upperB = RadiansToDegrees(upperA);
|
var upperB = upperA.RadiansToDegrees();
|
||||||
|
|
||||||
var horizonCoordinates = new HorizonCoordinates
|
var horizonCoordinates = new HorizonCoordinates
|
||||||
{
|
{
|
||||||
Altitude = RadiansToDegrees(Math.Asin(sinA)), Azimuth = upperB
|
Altitude = Math.Asin(sinA).RadiansToDegrees(),
|
||||||
|
Azimuth = upperB
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -96,82 +96,6 @@ namespace ASCOM.Meade.net.AstroMaths
|
|||||||
return horizonCoordinates;
|
return horizonCoordinates;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//todo convert to extension method
|
|
||||||
public double DegreesToRadians(double degrees)
|
|
||||||
{
|
|
||||||
return (Math.PI / 180) * degrees;
|
|
||||||
}
|
|
||||||
|
|
||||||
//todo convert to extension method
|
|
||||||
public double RadiansToDegrees(double radians)
|
|
||||||
{
|
|
||||||
double degrees = (180 / Math.PI) * radians;
|
|
||||||
return degrees;
|
|
||||||
}
|
|
||||||
|
|
||||||
//todo convert to extension method
|
|
||||||
public double DateTimeToDecimalHours( DateTime utcDateTime)
|
|
||||||
{
|
|
||||||
double sec = utcDateTime.Second;
|
|
||||||
double min = utcDateTime.Minute;
|
|
||||||
double hour = utcDateTime.Hour;
|
|
||||||
|
|
||||||
var a = Math.Abs(sec) / 60;
|
|
||||||
var b = (Math.Abs(min) + a) / 60;
|
|
||||||
var c = Math.Abs(hour) + b;
|
|
||||||
|
|
||||||
var d = c;
|
|
||||||
|
|
||||||
if ((hour < 0) || (min < 0) || (sec < 0))
|
|
||||||
d = -c;
|
|
||||||
|
|
||||||
return d;
|
|
||||||
}
|
|
||||||
|
|
||||||
//todo convert to extension method
|
|
||||||
public double UTtoGst(DateTime utcDateTime)
|
|
||||||
{
|
|
||||||
Util util = new Util();
|
|
||||||
|
|
||||||
var jd = util.DateUTCToJulian(utcDateTime) - 0.5;
|
|
||||||
if ((jd % 1) <= 0.5 )
|
|
||||||
jd = Math.Floor( jd );
|
|
||||||
else
|
|
||||||
jd = Math.Floor( jd ) + 0.5;
|
|
||||||
|
|
||||||
var s = jd - 2451545.0;
|
|
||||||
var t = s / 36525.0;
|
|
||||||
var t0 = 6.697374558 + (2400.051336 * t ) +(0.000025862 * (t * t) );
|
|
||||||
|
|
||||||
while (t0 < 0)
|
|
||||||
{
|
|
||||||
t0 += 24;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (t0 >= 24)
|
|
||||||
{
|
|
||||||
t0 -= 24;
|
|
||||||
}
|
|
||||||
|
|
||||||
var ut = DateTimeToDecimalHours(utcDateTime);
|
|
||||||
var a = ut * 1.002737909;
|
|
||||||
|
|
||||||
var t1 = t0 + a;
|
|
||||||
|
|
||||||
while (t1 < 0)
|
|
||||||
{
|
|
||||||
t1 += 24;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (t1 >= 24)
|
|
||||||
{
|
|
||||||
t1 -= 24;
|
|
||||||
}
|
|
||||||
|
|
||||||
return t1;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double GsTtoLst(double gst, double longitude)
|
public double GsTtoLst(double gst, double longitude)
|
||||||
{
|
{
|
||||||
var l = longitude/ 15;
|
var l = longitude/ 15;
|
||||||
@@ -189,4 +113,4 @@ namespace ASCOM.Meade.net.AstroMaths
|
|||||||
return lst;
|
return lst;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace ASCOM.Meade.net
|
||||||
|
{
|
||||||
|
public class Clock : IClock
|
||||||
|
{
|
||||||
|
public DateTime UtcNow => DateTime.UtcNow;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace ASCOM.Meade.net
|
||||||
|
{
|
||||||
|
public interface IClock
|
||||||
|
{
|
||||||
|
DateTime UtcNow { get; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
<UpgradeBackupLocation>
|
<UpgradeBackupLocation>
|
||||||
</UpgradeBackupLocation>
|
</UpgradeBackupLocation>
|
||||||
<OldToolsVersion>3.5</OldToolsVersion>
|
<OldToolsVersion>3.5</OldToolsVersion>
|
||||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||||
<ApplicationIcon>ASCOM.ico</ApplicationIcon>
|
<ApplicationIcon>ASCOM.ico</ApplicationIcon>
|
||||||
<SignAssembly>true</SignAssembly>
|
<SignAssembly>true</SignAssembly>
|
||||||
<AssemblyOriginatorKeyFile>ASCOMDriverTemplate.snk</AssemblyOriginatorKeyFile>
|
<AssemblyOriginatorKeyFile>ASCOMDriverTemplate.snk</AssemblyOriginatorKeyFile>
|
||||||
@@ -71,37 +71,40 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="ASCOM.Astrometry, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
<Reference Include="ASCOM.Astrometry, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Astrometry.dll</HintPath>
|
<HintPath>..\packages\ASCOM.Platform.6.5.1\lib\net40\ASCOM.Astrometry.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="ASCOM.Attributes, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
<Reference Include="ASCOM.Attributes, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Attributes.dll</HintPath>
|
<HintPath>..\packages\ASCOM.Platform.6.5.1\lib\net40\ASCOM.Attributes.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="ASCOM.Cache, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
<Reference Include="ASCOM.Cache, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Cache.dll</HintPath>
|
<HintPath>..\packages\ASCOM.Platform.6.5.1\lib\net40\ASCOM.Cache.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="ASCOM.Controls, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
<Reference Include="ASCOM.Controls, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Controls.dll</HintPath>
|
<HintPath>..\packages\ASCOM.Platform.6.5.1\lib\net40\ASCOM.Controls.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="ASCOM.DeviceInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
<Reference Include="ASCOM.DeviceInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.DeviceInterfaces.dll</HintPath>
|
<HintPath>..\packages\ASCOM.Platform.6.5.1\lib\net40\ASCOM.DeviceInterfaces.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="ASCOM.DriverAccess, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
<Reference Include="ASCOM.DriverAccess, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.DriverAccess.dll</HintPath>
|
<HintPath>..\packages\ASCOM.Platform.6.5.1\lib\net40\ASCOM.DriverAccess.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="ASCOM.Exceptions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
<Reference Include="ASCOM.Exceptions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Exceptions.dll</HintPath>
|
<HintPath>..\packages\ASCOM.Platform.6.5.1\lib\net40\ASCOM.Exceptions.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="ASCOM.Internal.Extensions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
<Reference Include="ASCOM.Internal.Extensions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Internal.Extensions.dll</HintPath>
|
<HintPath>..\packages\ASCOM.Platform.6.5.1\lib\net40\ASCOM.Internal.Extensions.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="ASCOM.SettingsProvider, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
<Reference Include="ASCOM.SettingsProvider, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.SettingsProvider.dll</HintPath>
|
<HintPath>..\packages\ASCOM.Platform.6.5.1\lib\net40\ASCOM.SettingsProvider.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="ASCOM.Utilities, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
<Reference Include="ASCOM.Utilities, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Utilities.dll</HintPath>
|
<HintPath>..\packages\ASCOM.Platform.6.5.1\lib\net40\ASCOM.Utilities.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="ASCOM.Utilities.Video, Version=6.1.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
<Reference Include="ASCOM.Utilities.Video, Version=6.1.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Utilities.Video.dll</HintPath>
|
<HintPath>..\packages\ASCOM.Platform.6.5.1\lib\net40\ASCOM.Utilities.Video.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="JetBrains.Annotations, Version=2020.3.0.0, Culture=neutral, PublicKeyToken=1010a0d8d6380325, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\JetBrains.Annotations.2020.3.0\lib\net20\JetBrains.Annotations.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.configuration" />
|
<Reference Include="System.configuration" />
|
||||||
@@ -116,12 +119,14 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="AstroMaths\AltitudeData.cs" />
|
<Compile Include="AstroMaths\AltitudeData.cs" />
|
||||||
|
<Compile Include="AstroMaths\AstroMathExtensions.cs" />
|
||||||
<Compile Include="AstroMaths\AstroMaths.cs" />
|
<Compile Include="AstroMaths\AstroMaths.cs" />
|
||||||
<Compile Include="AstroMaths\EquatorialCoordinates.cs" />
|
<Compile Include="AstroMaths\EquatorialCoordinates.cs" />
|
||||||
<Compile Include="AstroMaths\HorizonCoordinates.cs" />
|
|
||||||
<Compile Include="AstroMaths\IAstroMaths.cs" />
|
<Compile Include="AstroMaths\IAstroMaths.cs" />
|
||||||
|
<Compile Include="Clock.cs" />
|
||||||
<Compile Include="ComparisonResult.cs" />
|
<Compile Include="ComparisonResult.cs" />
|
||||||
<Compile Include="DoubleExtensions.cs" />
|
<Compile Include="DoubleExtensions.cs" />
|
||||||
|
<Compile Include="IClock.cs" />
|
||||||
<Compile Include="StringExtensions.cs" />
|
<Compile Include="StringExtensions.cs" />
|
||||||
<Compile Include="Telescope.cs" />
|
<Compile Include="Telescope.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ using System.Runtime.InteropServices;
|
|||||||
// set of attributes. Change these attribute values to modify the information
|
// set of attributes. Change these attribute values to modify the information
|
||||||
// associated with an assembly.
|
// associated with an assembly.
|
||||||
//
|
//
|
||||||
// TODO - Add your authorship information here
|
|
||||||
[assembly: AssemblyTitle("ASCOM.Meade.net.Telescope")]
|
[assembly: AssemblyTitle("ASCOM.Meade.net.Telescope")]
|
||||||
[assembly: AssemblyDescription("ASCOM Telescope driver for Meade.net")]
|
[assembly: AssemblyDescription("ASCOM Telescope driver for Meade.net")]
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
@@ -33,6 +32,5 @@ using System.Runtime.InteropServices;
|
|||||||
// You can specify all the values or you can default the Revision and Build Numbers
|
// You can specify all the values or you can default the Revision and Build Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
//
|
//
|
||||||
// TODO - Set your driver's version here
|
|
||||||
[assembly: AssemblyVersion("0.0.0.0")]
|
[assembly: AssemblyVersion("0.0.0.0")]
|
||||||
[assembly: AssemblyFileVersion("0.0.0.0")]
|
[assembly: AssemblyFileVersion("0.0.0.0")]
|
||||||
|
|||||||
+1
-1
@@ -12,7 +12,7 @@ namespace ASCOM.Meade.net.Properties {
|
|||||||
|
|
||||||
|
|
||||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.0.0.0")]
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.4.0.0")]
|
||||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||||
|
|
||||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ namespace ASCOM.Meade.net
|
|||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
// TODO Add any required object cleanup here
|
// Add any required object cleanup here
|
||||||
}
|
}
|
||||||
|
|
||||||
public double Maximum { get; set; }
|
public double Maximum { get; set; }
|
||||||
@@ -106,7 +106,7 @@ namespace ASCOM.Meade.net
|
|||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
// TODO Add any required object cleanup here
|
// Add any required object cleanup here
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerator GetEnumerator()
|
public IEnumerator GetEnumerator()
|
||||||
@@ -176,7 +176,7 @@ namespace ASCOM.Meade.net
|
|||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
// TODO Add any required object cleanup here
|
// Add any required object cleanup here
|
||||||
}
|
}
|
||||||
|
|
||||||
public DriveRates this[int index] => _trackingRates[index - 1];
|
public DriveRates this[int index] => _trackingRates[index - 1];
|
||||||
|
|||||||
+1019
-539
File diff suppressed because it is too large
Load Diff
@@ -5,4 +5,4 @@
|
|||||||
<section name="ASCOM.DeviceName.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
|
<section name="ASCOM.DeviceName.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
|
||||||
</sectionGroup>
|
</sectionGroup>
|
||||||
</configSections>
|
</configSections>
|
||||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/></startup></configuration>
|
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/></startup></configuration>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="ASCOM.Platform" version="6.4.2" targetFramework="net40" />
|
<package id="ASCOM.Platform" version="6.5.1" targetFramework="net472" />
|
||||||
|
<package id="JetBrains.Annotations" version="2020.3.0" targetFramework="net472" />
|
||||||
</packages>
|
</packages>
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<Import Project="..\packages\NUnit.3.12.0\build\NUnit.props" Condition="Exists('..\packages\NUnit.3.12.0\build\NUnit.props')" />
|
<Import Project="..\packages\NUnit.3.13.0\build\NUnit.props" Condition="Exists('..\packages\NUnit.3.13.0\build\NUnit.props')" />
|
||||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
@@ -35,55 +35,58 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="ASCOM.Astrometry, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
<Reference Include="ASCOM.Astrometry, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Astrometry.dll</HintPath>
|
<HintPath>..\packages\ASCOM.Platform.6.5.1\lib\net40\ASCOM.Astrometry.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="ASCOM.Attributes, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
<Reference Include="ASCOM.Attributes, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Attributes.dll</HintPath>
|
<HintPath>..\packages\ASCOM.Platform.6.5.1\lib\net40\ASCOM.Attributes.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="ASCOM.Cache, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
<Reference Include="ASCOM.Cache, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Cache.dll</HintPath>
|
<HintPath>..\packages\ASCOM.Platform.6.5.1\lib\net40\ASCOM.Cache.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="ASCOM.Controls, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
<Reference Include="ASCOM.Controls, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Controls.dll</HintPath>
|
<HintPath>..\packages\ASCOM.Platform.6.5.1\lib\net40\ASCOM.Controls.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="ASCOM.DeviceInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
<Reference Include="ASCOM.DeviceInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.DeviceInterfaces.dll</HintPath>
|
<HintPath>..\packages\ASCOM.Platform.6.5.1\lib\net40\ASCOM.DeviceInterfaces.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="ASCOM.DriverAccess, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
<Reference Include="ASCOM.DriverAccess, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.DriverAccess.dll</HintPath>
|
<HintPath>..\packages\ASCOM.Platform.6.5.1\lib\net40\ASCOM.DriverAccess.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="ASCOM.Exceptions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
<Reference Include="ASCOM.Exceptions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Exceptions.dll</HintPath>
|
<HintPath>..\packages\ASCOM.Platform.6.5.1\lib\net40\ASCOM.Exceptions.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="ASCOM.Internal.Extensions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
<Reference Include="ASCOM.Internal.Extensions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Internal.Extensions.dll</HintPath>
|
<HintPath>..\packages\ASCOM.Platform.6.5.1\lib\net40\ASCOM.Internal.Extensions.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="ASCOM.SettingsProvider, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
<Reference Include="ASCOM.SettingsProvider, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.SettingsProvider.dll</HintPath>
|
<HintPath>..\packages\ASCOM.Platform.6.5.1\lib\net40\ASCOM.SettingsProvider.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="ASCOM.Utilities, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
<Reference Include="ASCOM.Utilities, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Utilities.dll</HintPath>
|
<HintPath>..\packages\ASCOM.Platform.6.5.1\lib\net40\ASCOM.Utilities.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="ASCOM.Utilities.Video, Version=6.1.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
<Reference Include="ASCOM.Utilities.Video, Version=6.1.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Utilities.Video.dll</HintPath>
|
<HintPath>..\packages\ASCOM.Platform.6.5.1\lib\net40\ASCOM.Utilities.Video.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Castle.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
|
<Reference Include="Castle.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Castle.Core.4.4.0\lib\net45\Castle.Core.dll</HintPath>
|
<HintPath>..\packages\Castle.Core.4.4.1\lib\net45\Castle.Core.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Moq, Version=4.13.0.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
|
<Reference Include="JetBrains.Annotations, Version=2020.3.0.0, Culture=neutral, PublicKeyToken=1010a0d8d6380325, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Moq.4.13.0\lib\net45\Moq.dll</HintPath>
|
<HintPath>..\packages\JetBrains.Annotations.2020.3.0\lib\net20\JetBrains.Annotations.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="nunit.framework, Version=3.12.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
|
<Reference Include="Moq, Version=4.15.0.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\NUnit.3.12.0\lib\net45\nunit.framework.dll</HintPath>
|
<HintPath>..\packages\Moq.4.15.2\lib\net45\Moq.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="nunit.framework, Version=3.13.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\NUnit.3.13.0\lib\net45\nunit.framework.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Configuration" />
|
<Reference Include="System.Configuration" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.5.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.6.0\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.5.0.0\lib\net45\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.3\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll</HintPath>
|
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Xml.Linq" />
|
<Reference Include="System.Xml.Linq" />
|
||||||
<Reference Include="System.Data.DataSetExtensions" />
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
@@ -112,6 +115,6 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Error Condition="!Exists('..\packages\NUnit.3.12.0\build\NUnit.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NUnit.3.12.0\build\NUnit.props'))" />
|
<Error Condition="!Exists('..\packages\NUnit.3.13.0\build\NUnit.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NUnit.3.13.0\build\NUnit.props'))" />
|
||||||
</Target>
|
</Target>
|
||||||
</Project>
|
</Project>
|
||||||
@@ -13,6 +13,7 @@ namespace Meade.net.UnitTests
|
|||||||
public class SharedResourcesUnitTests
|
public class SharedResourcesUnitTests
|
||||||
{
|
{
|
||||||
private Mock<ISerial> _serialMock;
|
private Mock<ISerial> _serialMock;
|
||||||
|
private Mock<ITraceLogger> _traceLoggerMock;
|
||||||
|
|
||||||
[SetUp]
|
[SetUp]
|
||||||
public void Setup()
|
public void Setup()
|
||||||
@@ -20,6 +21,8 @@ namespace Meade.net.UnitTests
|
|||||||
_serialMock = new Mock<ISerial>();
|
_serialMock = new Mock<ISerial>();
|
||||||
_serialMock.SetupAllProperties();
|
_serialMock.SetupAllProperties();
|
||||||
|
|
||||||
|
_traceLoggerMock = new Mock<ITraceLogger>();
|
||||||
|
|
||||||
SharedResources.SharedSerial = _serialMock.Object;
|
SharedResources.SharedSerial = _serialMock.Object;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -29,42 +32,44 @@ namespace Meade.net.UnitTests
|
|||||||
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));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[TestCase(true, "Test")]
|
||||||
public void SendString_WhenCalled_ThenSendsMessageAndReadsResultUntilTerminatorFound()
|
[TestCase(false, "#:Test#")]
|
||||||
|
public void SendString_WhenCalled_ThenSendsMessageAndReadsResultUntilTerminatorFound(bool includePrefix, string expectedMessage)
|
||||||
{
|
{
|
||||||
var expectedMessage = "Test";
|
var transmitMessage = "Test";
|
||||||
var expectedResult = "TestMessage#";
|
var expectedResult = "TestMessage#";
|
||||||
|
|
||||||
_serialMock.Setup(x => x.ReceiveTerminated("#")).Returns(expectedResult);
|
_serialMock.Setup(x => x.ReceiveTerminated("#")).Returns(expectedResult);
|
||||||
|
|
||||||
var result = SharedResources.SendString(expectedMessage);
|
var result = SharedResources.SendString(transmitMessage, includePrefix);
|
||||||
|
|
||||||
_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);
|
||||||
@@ -120,9 +125,21 @@ namespace Meade.net.UnitTests
|
|||||||
|
|
||||||
Assert.That(profeWrapper.DeviceType, Is.EqualTo("Telescope"));
|
Assert.That(profeWrapper.DeviceType, Is.EqualTo("Telescope"));
|
||||||
profileWrapperMock.Verify( x => x.WriteValue(DriverId, "Trace Level", profileProperties.TraceLogger.ToString()), Times.Once);
|
profileWrapperMock.Verify( x => x.WriteValue(DriverId, "Trace Level", profileProperties.TraceLogger.ToString()), Times.Once);
|
||||||
|
|
||||||
profileWrapperMock.Verify(x => x.WriteValue(DriverId, "COM Port", profileProperties.ComPort), Times.Once);
|
profileWrapperMock.Verify(x => x.WriteValue(DriverId, "COM Port", profileProperties.ComPort), Times.Once);
|
||||||
|
profileWrapperMock.Verify(x => x.WriteValue(DriverId, "Speed", profileProperties.Speed.ToString()), Times.Once);
|
||||||
|
profileWrapperMock.Verify(x => x.WriteValue(DriverId, "Data Bits", profileProperties.DataBits.ToString()), Times.Once);
|
||||||
|
profileWrapperMock.Verify(x => x.WriteValue(DriverId, "Stop Bits", profileProperties.StopBits), Times.Once);
|
||||||
|
profileWrapperMock.Verify(x => x.WriteValue(DriverId, "Hand Shake", profileProperties.Handshake), Times.Once);
|
||||||
|
profileWrapperMock.Verify(x => x.WriteValue(DriverId, "Parity", profileProperties.Parity), Times.Once);
|
||||||
|
profileWrapperMock.Verify(x => x.WriteValue(DriverId, "Rts / Dtr", profileProperties.RtsDtrEnabled.ToString()), Times.Once);
|
||||||
|
|
||||||
profileWrapperMock.Verify(x => x.WriteValue(DriverId, "Guide Rate Arc Seconds Per Second", profileProperties.GuideRateArcSecondsPerSecond.ToString(CultureInfo.CurrentCulture)), Times.Once);
|
profileWrapperMock.Verify(x => x.WriteValue(DriverId, "Guide Rate Arc Seconds Per Second", profileProperties.GuideRateArcSecondsPerSecond.ToString(CultureInfo.CurrentCulture)), Times.Once);
|
||||||
profileWrapperMock.Verify(x => x.WriteValue(DriverId, "Precision", profileProperties.Precision), Times.Once);
|
profileWrapperMock.Verify(x => x.WriteValue(DriverId, "Precision", profileProperties.Precision), Times.Once);
|
||||||
|
profileWrapperMock.Verify(x => x.WriteValue(DriverId, "Guiding Style", profileProperties.GuidingStyle), Times.Once);
|
||||||
|
|
||||||
|
profileWrapperMock.Verify(x => x.WriteValue(DriverId, "Backlash Compensation", profileProperties.BacklashCompensation.ToString(CultureInfo.CurrentCulture)), Times.Once);
|
||||||
|
profileWrapperMock.Verify(x => x.WriteValue(DriverId, "Reverse Focuser Direction", profileProperties.ReverseFocusDirection.ToString()), Times.Once);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -130,11 +147,234 @@ namespace Meade.net.UnitTests
|
|||||||
{
|
{
|
||||||
string DriverId = "ASCOM.MeadeGeneric.Telescope";
|
string DriverId = "ASCOM.MeadeGeneric.Telescope";
|
||||||
|
|
||||||
|
string TraceStateDefault = "false";
|
||||||
|
|
||||||
string ComPortDefault = "COM1";
|
string ComPortDefault = "COM1";
|
||||||
|
string SpeedDefault = "9600";
|
||||||
|
string DataBitsDefault = "8";
|
||||||
|
string StopBitsDefault = "One";
|
||||||
|
string HandshakeDefault = "None";
|
||||||
|
string ParityDefault = "None";
|
||||||
|
string RtsDtrEnabledDefault = "true";
|
||||||
|
|
||||||
|
string GuideRateProfileNameDefault = "10.077939"; //67% of sidereal rate
|
||||||
|
string PrecisionDefault = "Unchanged";
|
||||||
|
string GuidingStyleDefault = "Auto";
|
||||||
|
|
||||||
|
string BacklashCompensationDefault = "3000";
|
||||||
|
string ReverseFocuserDiectionDefault = "true";
|
||||||
|
|
||||||
|
string SendDateTimeDefault = "true";
|
||||||
|
string SkipPromptsDefault = "true";
|
||||||
|
|
||||||
|
string ParkedBehaviourDefault = "No Coordinates";
|
||||||
|
string ParkedAltDefault = "0";
|
||||||
|
string ParkedAzimuthDefault = "180";
|
||||||
|
|
||||||
|
Mock<IProfileWrapper> profileWrapperMock = new Mock<IProfileWrapper>();
|
||||||
|
profileWrapperMock.SetupAllProperties();
|
||||||
|
|
||||||
|
profileWrapperMock.Setup(x => x.GetValue(DriverId, "Trace Level", string.Empty, TraceStateDefault))
|
||||||
|
.Returns(() =>
|
||||||
|
TraceStateDefault);
|
||||||
|
profileWrapperMock.Setup(x => x.GetValue(DriverId, "COM Port", string.Empty, ComPortDefault))
|
||||||
|
.Returns(ComPortDefault);
|
||||||
|
profileWrapperMock
|
||||||
|
.Setup(x => x.GetValue(DriverId, "Guide Rate Arc Seconds Per Second", string.Empty,
|
||||||
|
GuideRateProfileNameDefault)).Returns(GuideRateProfileNameDefault);
|
||||||
|
profileWrapperMock.Setup(x => x.GetValue(DriverId, "Precision", string.Empty, PrecisionDefault))
|
||||||
|
.Returns(PrecisionDefault);
|
||||||
|
profileWrapperMock.Setup(x => x.GetValue(DriverId, "Guiding Style", string.Empty, GuidingStyleDefault))
|
||||||
|
.Returns(GuidingStyleDefault);
|
||||||
|
profileWrapperMock.Setup(x =>
|
||||||
|
x.GetValue(DriverId, "Backlash Compensation", string.Empty, BacklashCompensationDefault))
|
||||||
|
.Returns(BacklashCompensationDefault);
|
||||||
|
profileWrapperMock.Setup(x =>
|
||||||
|
x.GetValue(DriverId, "Reverse Focuser Direction", string.Empty, "true"))
|
||||||
|
.Returns(() => ReverseFocuserDiectionDefault);
|
||||||
|
profileWrapperMock.Setup(x =>
|
||||||
|
x.GetValue(DriverId, "Speed", string.Empty, SpeedDefault))
|
||||||
|
.Returns(() => SpeedDefault);
|
||||||
|
profileWrapperMock.Setup(x =>
|
||||||
|
x.GetValue(DriverId, "Data Bits", string.Empty, DataBitsDefault))
|
||||||
|
.Returns(() => DataBitsDefault);
|
||||||
|
profileWrapperMock.Setup(x =>
|
||||||
|
x.GetValue(DriverId, "Stop Bits", string.Empty, StopBitsDefault))
|
||||||
|
.Returns(() => StopBitsDefault);
|
||||||
|
profileWrapperMock.Setup(x =>
|
||||||
|
x.GetValue(DriverId, "Hand Shake", string.Empty, HandshakeDefault))
|
||||||
|
.Returns(() => HandshakeDefault);
|
||||||
|
profileWrapperMock.Setup(x =>
|
||||||
|
x.GetValue(DriverId, "Parity", string.Empty, ParityDefault))
|
||||||
|
.Returns(() => ParityDefault);
|
||||||
|
profileWrapperMock.Setup(x =>
|
||||||
|
x.GetValue(DriverId, "Rts / Dtr", string.Empty, "false"))
|
||||||
|
.Returns(() => RtsDtrEnabledDefault);
|
||||||
|
|
||||||
|
profileWrapperMock.Setup(x =>
|
||||||
|
x.GetValue(DriverId, "Parked Behaviour", string.Empty, ParkedBehaviourDefault))
|
||||||
|
.Returns(() => ParityDefault);
|
||||||
|
profileWrapperMock.Setup(x =>
|
||||||
|
x.GetValue(DriverId, "Parked Altitude", string.Empty, ParkedAltDefault))
|
||||||
|
.Returns(() => ParkedAltDefault);
|
||||||
|
profileWrapperMock.Setup(x =>
|
||||||
|
x.GetValue(DriverId, "Parked Azimuth", string.Empty, ParkedAzimuthDefault))
|
||||||
|
.Returns(() => ParkedAzimuthDefault);
|
||||||
|
|
||||||
|
profileWrapperMock.Setup(x =>
|
||||||
|
x.GetValue(DriverId, "Send Date and time on connect", string.Empty, "false"))
|
||||||
|
.Returns(() => SendDateTimeDefault);
|
||||||
|
|
||||||
|
profileWrapperMock.Setup(x =>
|
||||||
|
x.GetValue(DriverId, "Skip date prompts on connect", string.Empty, "false"))
|
||||||
|
.Returns(() => SkipPromptsDefault);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
IProfileWrapper profeWrapper = profileWrapperMock.Object;
|
||||||
|
|
||||||
|
Mock<IProfileFactory> profileFactoryMock = new Mock<IProfileFactory>();
|
||||||
|
profileFactoryMock.Setup(x => x.Create()).Returns(profileWrapperMock.Object);
|
||||||
|
|
||||||
|
SharedResources.ProfileFactory = profileFactoryMock.Object;
|
||||||
|
|
||||||
|
var profileProperties = SharedResources.ReadProfile();
|
||||||
|
|
||||||
|
Assert.That(profeWrapper.DeviceType, Is.EqualTo("Telescope"));
|
||||||
|
|
||||||
|
Assert.That(profileProperties.TraceLogger, Is.EqualTo(bool.Parse(TraceStateDefault)));
|
||||||
|
|
||||||
|
Assert.That(profileProperties.ComPort, Is.EqualTo(ComPortDefault));
|
||||||
|
|
||||||
|
Assert.That(profileProperties.GuideRateArcSecondsPerSecond,
|
||||||
|
Is.EqualTo(double.Parse(GuideRateProfileNameDefault)));
|
||||||
|
Assert.That(profileProperties.Precision, Is.EqualTo(PrecisionDefault));
|
||||||
|
Assert.That(profileProperties.GuidingStyle, Is.EqualTo(GuidingStyleDefault));
|
||||||
|
|
||||||
|
Assert.That(profileProperties.BacklashCompensation, Is.EqualTo(int.Parse(BacklashCompensationDefault)));
|
||||||
|
Assert.That(profileProperties.ReverseFocusDirection, Is.EqualTo(bool.Parse(ReverseFocuserDiectionDefault)));
|
||||||
|
|
||||||
|
Assert.That(profileProperties.Speed, Is.EqualTo(int.Parse(SpeedDefault)));
|
||||||
|
Assert.That(profileProperties.DataBits, Is.EqualTo(int.Parse(DataBitsDefault)));
|
||||||
|
Assert.That(profileProperties.StopBits, Is.EqualTo(StopBitsDefault));
|
||||||
|
Assert.That(profileProperties.Handshake, Is.EqualTo(HandshakeDefault));
|
||||||
|
Assert.That(profileProperties.Parity, Is.EqualTo(ParityDefault));
|
||||||
|
Assert.That(profileProperties.RtsDtrEnabled, Is.EqualTo(bool.Parse(RtsDtrEnabledDefault)));
|
||||||
|
|
||||||
|
Assert.That(profileProperties.SendDateTime, Is.EqualTo(bool.Parse(SendDateTimeDefault)));
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestCase("TCP")]
|
||||||
|
[TestCase("Carrier Pigeon")]
|
||||||
|
public void Connect_WhenDeviceIdIsNotSerial_ThenThrowsException( string deviceId)
|
||||||
|
{
|
||||||
|
var result = Assert.Throws<ArgumentException>( () => { SharedResources.Connect(deviceId, string.Empty, _traceLoggerMock.Object); } );
|
||||||
|
|
||||||
|
Assert.That( result.Message, Is.EqualTo($"deviceId {deviceId} not currently supported") );
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void Connect_WhenDeviceIdIsSerialButGVPEchos_ThenThrowsException()
|
||||||
|
{
|
||||||
|
string deviceId = "Serial";
|
||||||
|
string DriverId = "ASCOM.MeadeGeneric.Telescope";
|
||||||
|
|
||||||
|
string ComPortDefault = "COM1";
|
||||||
|
string SpeedDefault = "9600";
|
||||||
|
string DataBitsDefault = "8";
|
||||||
|
string StopBitsDefault = "One";
|
||||||
|
string HandshakeDefault = "None";
|
||||||
|
string ParityDefault = "None";
|
||||||
|
string RtsDtrEnabledDefault = "false";
|
||||||
|
|
||||||
string TraceStateDefault = "false";
|
string TraceStateDefault = "false";
|
||||||
string GuideRateProfileNameDefault = "10.077939"; //67% of sidereal rate
|
string GuideRateProfileNameDefault = "10.077939"; //67% of sidereal rate
|
||||||
string PrecisionDefault = "Unchanged";
|
string PrecisionDefault = "Unchanged";
|
||||||
|
|
||||||
|
string ParkedBehaviourDefault = "No Coordinates";
|
||||||
|
string ParkedAltDefault = "0";
|
||||||
|
string ParkedAzimuthDefault = "180";
|
||||||
|
|
||||||
|
Mock<IProfileWrapper> profileWrapperMock = new Mock<IProfileWrapper>();
|
||||||
|
profileWrapperMock.SetupAllProperties();
|
||||||
|
|
||||||
|
profileWrapperMock.Setup(x => x.GetValue(DriverId, "Trace Level", string.Empty, TraceStateDefault))
|
||||||
|
.Returns(TraceStateDefault);
|
||||||
|
profileWrapperMock.Setup(x => x.GetValue(DriverId, "COM Port", string.Empty, ComPortDefault))
|
||||||
|
.Returns(ComPortDefault);
|
||||||
|
profileWrapperMock.Setup(x =>
|
||||||
|
x.GetValue(DriverId, "Speed", string.Empty, SpeedDefault))
|
||||||
|
.Returns(() => SpeedDefault);
|
||||||
|
profileWrapperMock.Setup(x =>
|
||||||
|
x.GetValue(DriverId, "Data Bits", string.Empty, DataBitsDefault))
|
||||||
|
.Returns(() => DataBitsDefault);
|
||||||
|
profileWrapperMock.Setup(x =>
|
||||||
|
x.GetValue(DriverId, "Stop Bits", string.Empty, StopBitsDefault))
|
||||||
|
.Returns(() => StopBitsDefault);
|
||||||
|
profileWrapperMock.Setup(x =>
|
||||||
|
x.GetValue(DriverId, "Hand Shake", string.Empty, HandshakeDefault))
|
||||||
|
.Returns(() => HandshakeDefault);
|
||||||
|
profileWrapperMock.Setup(x =>
|
||||||
|
x.GetValue(DriverId, "Parity", string.Empty, ParityDefault))
|
||||||
|
.Returns(() => ParityDefault);
|
||||||
|
profileWrapperMock.Setup(x =>
|
||||||
|
x.GetValue(DriverId, "Rts / Dtr", string.Empty, RtsDtrEnabledDefault))
|
||||||
|
.Returns(() => RtsDtrEnabledDefault);
|
||||||
|
|
||||||
|
profileWrapperMock
|
||||||
|
.Setup(x => x.GetValue(DriverId, "Guide Rate Arc Seconds Per Second", string.Empty,
|
||||||
|
GuideRateProfileNameDefault)).Returns(GuideRateProfileNameDefault);
|
||||||
|
profileWrapperMock.Setup(x => x.GetValue(DriverId, "Precision", string.Empty, PrecisionDefault))
|
||||||
|
.Returns(PrecisionDefault);
|
||||||
|
|
||||||
|
profileWrapperMock.Setup(x =>
|
||||||
|
x.GetValue(DriverId, "Parked Behaviour", string.Empty, ParkedBehaviourDefault))
|
||||||
|
.Returns(() => ParityDefault);
|
||||||
|
profileWrapperMock.Setup(x =>
|
||||||
|
x.GetValue(DriverId, "Parked Altitude", string.Empty, ParkedAltDefault))
|
||||||
|
.Returns(() => ParkedAltDefault);
|
||||||
|
profileWrapperMock.Setup(x =>
|
||||||
|
x.GetValue(DriverId, "Parked Azimuth", string.Empty, ParkedAzimuthDefault))
|
||||||
|
.Returns(() => ParkedAzimuthDefault);
|
||||||
|
|
||||||
|
Mock<IProfileFactory> profileFactoryMock = new Mock<IProfileFactory>();
|
||||||
|
profileFactoryMock.Setup(x => x.Create()).Returns(profileWrapperMock.Object);
|
||||||
|
|
||||||
|
SharedResources.ProfileFactory = profileFactoryMock.Object;
|
||||||
|
|
||||||
|
string serialPortReturn = string.Empty;
|
||||||
|
|
||||||
|
_serialMock.Setup(x => x.Transmit("#:GVP#")).Callback(() => { serialPortReturn = ":GVP#"; });
|
||||||
|
_serialMock.Setup(x => x.Transmit("#:GG#")).Callback(() => { serialPortReturn = "0"; });
|
||||||
|
_serialMock.Setup(x => x.ReceiveTerminated("#")).Returns( () => serialPortReturn);
|
||||||
|
|
||||||
|
var result = Assert.Throws<Exception>(() => { SharedResources.Connect(deviceId, string.Empty, _traceLoggerMock.Object); });
|
||||||
|
Assert.That(result.Message, Is.EqualTo("Serial port is looping back data, something is wrong with the hardware."));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void Connect_WhenDeviceIdIsSerialButGVPNotSupported_ThenConnectsAndSetsProductToLX200Classic()
|
||||||
|
{
|
||||||
|
string deviceId = "Serial";
|
||||||
|
string DriverId = "ASCOM.MeadeGeneric.Telescope";
|
||||||
|
|
||||||
|
string TraceStateDefault = "false";
|
||||||
|
|
||||||
|
string ComPortDefault = "COM1";
|
||||||
|
string SpeedDefault = "9600";
|
||||||
|
string DataBitsDefault = "8";
|
||||||
|
string StopBitsDefault = "One";
|
||||||
|
string HandshakeDefault = "None";
|
||||||
|
string ParityDefault = "None";
|
||||||
|
string RtsDtrEnabledDefault = "false";
|
||||||
|
|
||||||
|
string GuideRateProfileNameDefault = "10.077939"; //67% of sidereal rate
|
||||||
|
string PrecisionDefault = "Unchanged";
|
||||||
|
|
||||||
|
string ParkedBehaviourDefault = "No Coordinates";
|
||||||
|
string ParkedAltDefault = "0";
|
||||||
|
string ParkedAzimuthDefault = "180";
|
||||||
|
|
||||||
Mock<IProfileWrapper> profileWrapperMock = new Mock<IProfileWrapper>();
|
Mock<IProfileWrapper> profileWrapperMock = new Mock<IProfileWrapper>();
|
||||||
profileWrapperMock.SetupAllProperties();
|
profileWrapperMock.SetupAllProperties();
|
||||||
|
|
||||||
@@ -147,57 +387,34 @@ namespace Meade.net.UnitTests
|
|||||||
GuideRateProfileNameDefault)).Returns(GuideRateProfileNameDefault);
|
GuideRateProfileNameDefault)).Returns(GuideRateProfileNameDefault);
|
||||||
profileWrapperMock.Setup(x => x.GetValue(DriverId, "Precision", string.Empty, PrecisionDefault))
|
profileWrapperMock.Setup(x => x.GetValue(DriverId, "Precision", string.Empty, PrecisionDefault))
|
||||||
.Returns(PrecisionDefault);
|
.Returns(PrecisionDefault);
|
||||||
|
profileWrapperMock.Setup(x =>
|
||||||
|
x.GetValue(DriverId, "Speed", string.Empty, SpeedDefault))
|
||||||
|
.Returns(() => SpeedDefault);
|
||||||
|
profileWrapperMock.Setup(x =>
|
||||||
|
x.GetValue(DriverId, "Data Bits", string.Empty, DataBitsDefault))
|
||||||
|
.Returns(() => DataBitsDefault);
|
||||||
|
profileWrapperMock.Setup(x =>
|
||||||
|
x.GetValue(DriverId, "Stop Bits", string.Empty, StopBitsDefault))
|
||||||
|
.Returns(() => StopBitsDefault);
|
||||||
|
profileWrapperMock.Setup(x =>
|
||||||
|
x.GetValue(DriverId, "Hand Shake", string.Empty, HandshakeDefault))
|
||||||
|
.Returns(() => HandshakeDefault);
|
||||||
|
profileWrapperMock.Setup(x =>
|
||||||
|
x.GetValue(DriverId, "Parity", string.Empty, ParityDefault))
|
||||||
|
.Returns(() => ParityDefault);
|
||||||
|
profileWrapperMock.Setup(x =>
|
||||||
|
x.GetValue(DriverId, "Rts / Dtr", string.Empty, RtsDtrEnabledDefault))
|
||||||
|
.Returns(() => RtsDtrEnabledDefault);
|
||||||
|
|
||||||
IProfileWrapper profeWrapper = profileWrapperMock.Object;
|
profileWrapperMock.Setup(x =>
|
||||||
|
x.GetValue(DriverId, "Parked Behaviour", string.Empty, ParkedBehaviourDefault))
|
||||||
Mock<IProfileFactory> profileFactoryMock = new Mock<IProfileFactory>();
|
.Returns(() => ParityDefault);
|
||||||
profileFactoryMock.Setup(x => x.Create()).Returns(profileWrapperMock.Object);
|
profileWrapperMock.Setup(x =>
|
||||||
|
x.GetValue(DriverId, "Parked Altitude", string.Empty, ParkedAltDefault))
|
||||||
SharedResources.ProfileFactory = profileFactoryMock.Object;
|
.Returns(() => ParkedAltDefault);
|
||||||
|
profileWrapperMock.Setup(x =>
|
||||||
var profileProperties = SharedResources.ReadProfile();
|
x.GetValue(DriverId, "Parked Azimuth", string.Empty, ParkedAzimuthDefault))
|
||||||
|
.Returns(() => ParkedAzimuthDefault);
|
||||||
Assert.That(profeWrapper.DeviceType, Is.EqualTo("Telescope"));
|
|
||||||
Assert.That(profileProperties.ComPort, Is.EqualTo(ComPortDefault));
|
|
||||||
Assert.That(profileProperties.GuideRateArcSecondsPerSecond,
|
|
||||||
Is.EqualTo(double.Parse(GuideRateProfileNameDefault)));
|
|
||||||
Assert.That(profileProperties.TraceLogger, Is.EqualTo(bool.Parse(TraceStateDefault)));
|
|
||||||
Assert.That(profileProperties.Precision, Is.EqualTo(PrecisionDefault));
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestCase("TCP")]
|
|
||||||
[TestCase("Carrier Pigeon")]
|
|
||||||
public void Connect_WhenDeviceIdIsNotSerial_ThenThrowsException( string deviceId)
|
|
||||||
{
|
|
||||||
var result = Assert.Throws<ArgumentException>( () => { SharedResources.Connect(deviceId, string.Empty); } );
|
|
||||||
|
|
||||||
Assert.That( result.Message, Is.EqualTo($"deviceId {deviceId} not currently supported") );
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void Connect_WhenDeviceIdIsSerialButGVPEchos_ThenThrowsException()
|
|
||||||
{
|
|
||||||
string deviceId = "Serial";
|
|
||||||
|
|
||||||
string driverDriverId = "ASCOM.MeadeGeneric.Telescope";
|
|
||||||
|
|
||||||
string ComPortDefault = "COM1";
|
|
||||||
string TraceStateDefault = "false";
|
|
||||||
string GuideRateProfileNameDefault = "10.077939"; //67% of sidereal rate
|
|
||||||
string PrecisionDefault = "Unchanged";
|
|
||||||
|
|
||||||
Mock<IProfileWrapper> profileWrapperMock = new Mock<IProfileWrapper>();
|
|
||||||
profileWrapperMock.SetupAllProperties();
|
|
||||||
|
|
||||||
profileWrapperMock.Setup(x => x.GetValue(driverDriverId, "Trace Level", string.Empty, TraceStateDefault))
|
|
||||||
.Returns(TraceStateDefault);
|
|
||||||
profileWrapperMock.Setup(x => x.GetValue(driverDriverId, "COM Port", string.Empty, ComPortDefault))
|
|
||||||
.Returns(ComPortDefault);
|
|
||||||
profileWrapperMock
|
|
||||||
.Setup(x => x.GetValue(driverDriverId, "Guide Rate Arc Seconds Per Second", string.Empty,
|
|
||||||
GuideRateProfileNameDefault)).Returns(GuideRateProfileNameDefault);
|
|
||||||
profileWrapperMock.Setup(x => x.GetValue(driverDriverId, "Precision", string.Empty, PrecisionDefault))
|
|
||||||
.Returns(PrecisionDefault);
|
|
||||||
|
|
||||||
Mock<IProfileFactory> profileFactoryMock = new Mock<IProfileFactory>();
|
Mock<IProfileFactory> profileFactoryMock = new Mock<IProfileFactory>();
|
||||||
profileFactoryMock.Setup(x => x.Create()).Returns(profileWrapperMock.Object);
|
profileFactoryMock.Setup(x => x.Create()).Returns(profileWrapperMock.Object);
|
||||||
@@ -206,52 +423,25 @@ namespace Meade.net.UnitTests
|
|||||||
|
|
||||||
string serialPortReturn = string.Empty;
|
string serialPortReturn = string.Empty;
|
||||||
|
|
||||||
_serialMock.Setup(x => x.Transmit(":GVP#")).Callback(() => { serialPortReturn = ":GVP#"; });
|
_serialMock.Setup(x => x.Transmit("#:GVP#")).Callback(() => {
|
||||||
_serialMock.Setup(x => x.ReceiveTerminated("#")).Returns( () => serialPortReturn);
|
serialPortReturn = string.Empty;
|
||||||
|
throw new Exception("Testerror");
|
||||||
|
});
|
||||||
|
_serialMock.Setup(x => x.Transmit("#:GG#")).Callback(() => { serialPortReturn = "0"; });
|
||||||
|
_serialMock.Setup(x => x.ReceiveTerminated("#")).Returns(() => serialPortReturn);
|
||||||
|
|
||||||
var result = Assert.Throws<Exception>(() => { SharedResources.Connect(deviceId, string.Empty); });
|
var connectionResult = SharedResources.Connect(deviceId, string.Empty, _traceLoggerMock.Object);
|
||||||
Assert.That(result.Message, Is.EqualTo("Serial port is looping back data, something is wrong with the hardware."));
|
try
|
||||||
}
|
{
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void Connect_WhenDeviceIdIsSerialButGVPNotSupported_ThenConnectsAndSetsProductToLX200Classic()
|
|
||||||
{
|
|
||||||
string deviceId = "Serial";
|
|
||||||
|
|
||||||
string driverDriverId = "ASCOM.MeadeGeneric.Telescope";
|
Assert.That(connectionResult.SameDevice, Is.EqualTo(1));
|
||||||
|
Assert.That(SharedResources.ProductName, Is.EqualTo(TelescopeList.LX200CLASSIC));
|
||||||
string ComPortDefault = "COM1";
|
}
|
||||||
string TraceStateDefault = "false";
|
finally
|
||||||
string GuideRateProfileNameDefault = "10.077939"; //67% of sidereal rate
|
{
|
||||||
string PrecisionDefault = "Unchanged";
|
SharedResources.Disconnect(deviceId, String.Empty);
|
||||||
|
}
|
||||||
Mock<IProfileWrapper> profileWrapperMock = new Mock<IProfileWrapper>();
|
|
||||||
profileWrapperMock.SetupAllProperties();
|
|
||||||
|
|
||||||
profileWrapperMock.Setup(x => x.GetValue(driverDriverId, "Trace Level", string.Empty, TraceStateDefault))
|
|
||||||
.Returns(TraceStateDefault);
|
|
||||||
profileWrapperMock.Setup(x => x.GetValue(driverDriverId, "COM Port", string.Empty, ComPortDefault))
|
|
||||||
.Returns(ComPortDefault);
|
|
||||||
profileWrapperMock
|
|
||||||
.Setup(x => x.GetValue(driverDriverId, "Guide Rate Arc Seconds Per Second", string.Empty,
|
|
||||||
GuideRateProfileNameDefault)).Returns(GuideRateProfileNameDefault);
|
|
||||||
profileWrapperMock.Setup(x => x.GetValue(driverDriverId, "Precision", string.Empty, PrecisionDefault))
|
|
||||||
.Returns(PrecisionDefault);
|
|
||||||
|
|
||||||
Mock<IProfileFactory> profileFactoryMock = new Mock<IProfileFactory>();
|
|
||||||
profileFactoryMock.Setup(x => x.Create()).Returns(profileWrapperMock.Object);
|
|
||||||
|
|
||||||
SharedResources.ProfileFactory = profileFactoryMock.Object;
|
|
||||||
|
|
||||||
_serialMock.Setup(x => x.Transmit(":GVP#")).Callback(() => { });
|
|
||||||
_serialMock.Setup(x => x.ReceiveTerminated("#")).Returns(() => throw new Exception("Testerror"));
|
|
||||||
|
|
||||||
var connectionResult = SharedResources.Connect(deviceId, string.Empty);
|
|
||||||
|
|
||||||
Assert.That(connectionResult.SameDevice, Is.EqualTo(1));
|
|
||||||
Assert.That(SharedResources.ProductName, Is.EqualTo(TelescopeList.LX200CLASSIC));
|
|
||||||
|
|
||||||
SharedResources.Disconnect(deviceId, String.Empty);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -259,25 +449,65 @@ namespace Meade.net.UnitTests
|
|||||||
{
|
{
|
||||||
string deviceId = "Serial";
|
string deviceId = "Serial";
|
||||||
|
|
||||||
string driverDriverId = "ASCOM.MeadeGeneric.Telescope";
|
string DriverId = "ASCOM.MeadeGeneric.Telescope";
|
||||||
|
|
||||||
|
string TraceStateDefault = "false";
|
||||||
|
|
||||||
string ComPortDefault = "COM1";
|
string ComPortDefault = "COM1";
|
||||||
string TraceStateDefault = "false";
|
string SpeedDefault = "9600";
|
||||||
|
string DataBitsDefault = "8";
|
||||||
|
string StopBitsDefault = "One";
|
||||||
|
string HandshakeDefault = "None";
|
||||||
|
string ParityDefault = "None";
|
||||||
|
string RtsDtrEnabledDefault = "false";
|
||||||
|
|
||||||
string GuideRateProfileNameDefault = "10.077939"; //67% of sidereal rate
|
string GuideRateProfileNameDefault = "10.077939"; //67% of sidereal rate
|
||||||
string PrecisionDefault = "Unchanged";
|
string PrecisionDefault = "Unchanged";
|
||||||
|
|
||||||
|
string ParkedBehaviourDefault = "No Coordinates";
|
||||||
|
string ParkedAltDefault = "0";
|
||||||
|
string ParkedAzimuthDefault = "180";
|
||||||
|
|
||||||
Mock<IProfileWrapper> profileWrapperMock = new Mock<IProfileWrapper>();
|
Mock<IProfileWrapper> profileWrapperMock = new Mock<IProfileWrapper>();
|
||||||
profileWrapperMock.SetupAllProperties();
|
profileWrapperMock.SetupAllProperties();
|
||||||
|
|
||||||
profileWrapperMock.Setup(x => x.GetValue(driverDriverId, "Trace Level", string.Empty, TraceStateDefault))
|
profileWrapperMock.Setup(x => x.GetValue(DriverId, "Trace Level", string.Empty, TraceStateDefault))
|
||||||
.Returns(TraceStateDefault);
|
.Returns(TraceStateDefault);
|
||||||
profileWrapperMock.Setup(x => x.GetValue(driverDriverId, "COM Port", string.Empty, ComPortDefault))
|
profileWrapperMock.Setup(x => x.GetValue(DriverId, "COM Port", string.Empty, ComPortDefault))
|
||||||
.Returns(ComPortDefault);
|
.Returns(ComPortDefault);
|
||||||
profileWrapperMock
|
profileWrapperMock
|
||||||
.Setup(x => x.GetValue(driverDriverId, "Guide Rate Arc Seconds Per Second", string.Empty,
|
.Setup(x => x.GetValue(DriverId, "Guide Rate Arc Seconds Per Second", string.Empty,
|
||||||
GuideRateProfileNameDefault)).Returns(GuideRateProfileNameDefault);
|
GuideRateProfileNameDefault)).Returns(GuideRateProfileNameDefault);
|
||||||
profileWrapperMock.Setup(x => x.GetValue(driverDriverId, "Precision", string.Empty, PrecisionDefault))
|
profileWrapperMock.Setup(x => x.GetValue(DriverId, "Precision", string.Empty, PrecisionDefault))
|
||||||
.Returns(PrecisionDefault);
|
.Returns(PrecisionDefault);
|
||||||
|
profileWrapperMock.Setup(x =>
|
||||||
|
x.GetValue(DriverId, "Speed", string.Empty, SpeedDefault))
|
||||||
|
.Returns(() => SpeedDefault);
|
||||||
|
profileWrapperMock.Setup(x =>
|
||||||
|
x.GetValue(DriverId, "Data Bits", string.Empty, DataBitsDefault))
|
||||||
|
.Returns(() => DataBitsDefault);
|
||||||
|
profileWrapperMock.Setup(x =>
|
||||||
|
x.GetValue(DriverId, "Stop Bits", string.Empty, StopBitsDefault))
|
||||||
|
.Returns(() => StopBitsDefault);
|
||||||
|
profileWrapperMock.Setup(x =>
|
||||||
|
x.GetValue(DriverId, "Hand Shake", string.Empty, HandshakeDefault))
|
||||||
|
.Returns(() => HandshakeDefault);
|
||||||
|
profileWrapperMock.Setup(x =>
|
||||||
|
x.GetValue(DriverId, "Parity", string.Empty, ParityDefault))
|
||||||
|
.Returns(() => ParityDefault);
|
||||||
|
profileWrapperMock.Setup(x =>
|
||||||
|
x.GetValue(DriverId, "Rts / Dtr", string.Empty, RtsDtrEnabledDefault))
|
||||||
|
.Returns(() => RtsDtrEnabledDefault);
|
||||||
|
|
||||||
|
profileWrapperMock.Setup(x =>
|
||||||
|
x.GetValue(DriverId, "Parked Behaviour", string.Empty, ParkedBehaviourDefault))
|
||||||
|
.Returns(() => ParityDefault);
|
||||||
|
profileWrapperMock.Setup(x =>
|
||||||
|
x.GetValue(DriverId, "Parked Altitude", string.Empty, ParkedAltDefault))
|
||||||
|
.Returns(() => ParkedAltDefault);
|
||||||
|
profileWrapperMock.Setup(x =>
|
||||||
|
x.GetValue(DriverId, "Parked Azimuth", string.Empty, ParkedAzimuthDefault))
|
||||||
|
.Returns(() => ParkedAzimuthDefault);
|
||||||
|
|
||||||
Mock<IProfileFactory> profileFactoryMock = new Mock<IProfileFactory>();
|
Mock<IProfileFactory> profileFactoryMock = new Mock<IProfileFactory>();
|
||||||
profileFactoryMock.Setup(x => x.Create()).Returns(profileWrapperMock.Object);
|
profileFactoryMock.Setup(x => x.Create()).Returns(profileWrapperMock.Object);
|
||||||
@@ -286,17 +516,107 @@ namespace Meade.net.UnitTests
|
|||||||
|
|
||||||
string serialPortReturn = string.Empty;
|
string serialPortReturn = string.Empty;
|
||||||
|
|
||||||
_serialMock.Setup(x => x.Transmit(":GVP#")).Callback(() => { serialPortReturn = TelescopeList.Autostar497; });
|
_serialMock.Setup(x => x.Transmit("#:GVP#")).Callback(() => { serialPortReturn = TelescopeList.Autostar497; });
|
||||||
_serialMock.Setup(x => x.Transmit(":GVN#")).Callback(() => { serialPortReturn = TelescopeList.Autostar497_43Eg; });
|
_serialMock.Setup(x => x.Transmit("#:GVN#")).Callback(() => { serialPortReturn = TelescopeList.Autostar497_43Eg; });
|
||||||
|
_serialMock.Setup(x => x.Transmit("#:GG#")).Callback(() => { serialPortReturn = "0"; });
|
||||||
_serialMock.Setup(x => x.ReceiveTerminated("#")).Returns(() => serialPortReturn);
|
_serialMock.Setup(x => x.ReceiveTerminated("#")).Returns(() => serialPortReturn);
|
||||||
|
|
||||||
var connectionResult = SharedResources.Connect(deviceId, string.Empty);
|
var connectionResult = SharedResources.Connect(deviceId, string.Empty, _traceLoggerMock.Object);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Assert.That(connectionResult.SameDevice, Is.EqualTo(1));
|
||||||
|
Assert.That(SharedResources.ProductName, Is.EqualTo(TelescopeList.Autostar497));
|
||||||
|
Assert.That(SharedResources.FirmwareVersion, Is.EqualTo(TelescopeList.Autostar497_43Eg));
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
SharedResources.Disconnect(deviceId, String.Empty);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Assert.That(connectionResult.SameDevice, Is.EqualTo(1));
|
[Test]
|
||||||
Assert.That(SharedResources.ProductName, Is.EqualTo(TelescopeList.Autostar497));
|
public void Connect_WhenSerialPortIsNotRespondingCorrectly_ThenExceptionThrown()
|
||||||
Assert.That(SharedResources.FirmwareVersion, Is.EqualTo(TelescopeList.Autostar497_43Eg));
|
{
|
||||||
|
string deviceId = "Serial";
|
||||||
|
|
||||||
SharedResources.Disconnect(deviceId, String.Empty);
|
string DriverId = "ASCOM.MeadeGeneric.Telescope";
|
||||||
|
|
||||||
|
string TraceStateDefault = "false";
|
||||||
|
|
||||||
|
string ComPortDefault = "COM1";
|
||||||
|
string SpeedDefault = "9600";
|
||||||
|
string DataBitsDefault = "8";
|
||||||
|
string StopBitsDefault = "One";
|
||||||
|
string HandshakeDefault = "None";
|
||||||
|
string ParityDefault = "None";
|
||||||
|
string RtsDtrEnabledDefault = "false";
|
||||||
|
|
||||||
|
string GuideRateProfileNameDefault = "10.077939"; //67% of sidereal rate
|
||||||
|
string PrecisionDefault = "Unchanged";
|
||||||
|
|
||||||
|
string ParkedBehaviourDefault = "No Coordinates";
|
||||||
|
string ParkedAltDefault = "0";
|
||||||
|
string ParkedAzimuthDefault = "180";
|
||||||
|
|
||||||
|
Mock<IProfileWrapper> profileWrapperMock = new Mock<IProfileWrapper>();
|
||||||
|
profileWrapperMock.SetupAllProperties();
|
||||||
|
|
||||||
|
profileWrapperMock.Setup(x => x.GetValue(DriverId, "Trace Level", string.Empty, TraceStateDefault))
|
||||||
|
.Returns(TraceStateDefault);
|
||||||
|
profileWrapperMock.Setup(x => x.GetValue(DriverId, "COM Port", string.Empty, ComPortDefault))
|
||||||
|
.Returns(ComPortDefault);
|
||||||
|
profileWrapperMock
|
||||||
|
.Setup(x => x.GetValue(DriverId, "Guide Rate Arc Seconds Per Second", string.Empty,
|
||||||
|
GuideRateProfileNameDefault)).Returns(GuideRateProfileNameDefault);
|
||||||
|
profileWrapperMock.Setup(x => x.GetValue(DriverId, "Precision", string.Empty, PrecisionDefault))
|
||||||
|
.Returns(PrecisionDefault);
|
||||||
|
profileWrapperMock.Setup(x =>
|
||||||
|
x.GetValue(DriverId, "Speed", string.Empty, SpeedDefault))
|
||||||
|
.Returns(() => SpeedDefault);
|
||||||
|
profileWrapperMock.Setup(x =>
|
||||||
|
x.GetValue(DriverId, "Data Bits", string.Empty, DataBitsDefault))
|
||||||
|
.Returns(() => DataBitsDefault);
|
||||||
|
profileWrapperMock.Setup(x =>
|
||||||
|
x.GetValue(DriverId, "Stop Bits", string.Empty, StopBitsDefault))
|
||||||
|
.Returns(() => StopBitsDefault);
|
||||||
|
profileWrapperMock.Setup(x =>
|
||||||
|
x.GetValue(DriverId, "Hand Shake", string.Empty, HandshakeDefault))
|
||||||
|
.Returns(() => HandshakeDefault);
|
||||||
|
profileWrapperMock.Setup(x =>
|
||||||
|
x.GetValue(DriverId, "Parity", string.Empty, ParityDefault))
|
||||||
|
.Returns(() => ParityDefault);
|
||||||
|
profileWrapperMock.Setup(x =>
|
||||||
|
x.GetValue(DriverId, "Rts / Dtr", string.Empty, RtsDtrEnabledDefault))
|
||||||
|
.Returns(() => RtsDtrEnabledDefault);
|
||||||
|
profileWrapperMock.Setup(x =>
|
||||||
|
x.GetValue(DriverId, "Parked Behaviour", string.Empty, ParkedBehaviourDefault))
|
||||||
|
.Returns(() => ParityDefault);
|
||||||
|
profileWrapperMock.Setup(x =>
|
||||||
|
x.GetValue(DriverId, "Parked Altitude", string.Empty, ParkedAltDefault))
|
||||||
|
.Returns(() => ParkedAltDefault);
|
||||||
|
profileWrapperMock.Setup(x =>
|
||||||
|
x.GetValue(DriverId, "Parked Azimuth", string.Empty, ParkedAzimuthDefault))
|
||||||
|
.Returns(() => ParkedAzimuthDefault);
|
||||||
|
|
||||||
|
Mock<IProfileFactory> profileFactoryMock = new Mock<IProfileFactory>();
|
||||||
|
profileFactoryMock.Setup(x => x.Create()).Returns(profileWrapperMock.Object);
|
||||||
|
|
||||||
|
SharedResources.ProfileFactory = profileFactoryMock.Object;
|
||||||
|
|
||||||
|
string serialPortReturn = string.Empty;
|
||||||
|
|
||||||
|
_serialMock.Setup(x => x.Transmit("#:GVP#")).Callback(() => { serialPortReturn = TelescopeList.Autostar497; });
|
||||||
|
_serialMock.Setup(x => x.Transmit("#:GVN#")).Callback(() => { serialPortReturn = TelescopeList.Autostar497_43Eg; });
|
||||||
|
_serialMock.Setup(x => x.Transmit("#:GG#")).Callback(() => { serialPortReturn = ""; });
|
||||||
|
_serialMock.Setup(x => x.ReceiveTerminated("#")).Returns(() => serialPortReturn);
|
||||||
|
|
||||||
|
var result = Assert.Throws<Exception>(() =>
|
||||||
|
{
|
||||||
|
SharedResources.Connect(deviceId, string.Empty, _traceLoggerMock.Object);
|
||||||
|
});
|
||||||
|
Assert.That(result.Message, Is.EqualTo("Unable to decode response from the telescope, This is likely a hardware serial communications error."));
|
||||||
|
|
||||||
|
_traceLoggerMock.Verify( x => x.LogIssue("Connect", "Unable to decode response from the telescope, This is likely a hardware serial communications error."), Times.Once);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||||
<bindingRedirect oldVersion="0.0.0.0-4.0.5.0" newVersion="4.0.5.0" />
|
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
</assemblyBinding>
|
</assemblyBinding>
|
||||||
</runtime>
|
</runtime>
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="ASCOM.Platform" version="6.4.2" targetFramework="net472" />
|
<package id="ASCOM.Platform" version="6.5.1" targetFramework="net472" />
|
||||||
<package id="Castle.Core" version="4.4.0" targetFramework="net472" />
|
<package id="Castle.Core" version="4.4.1" targetFramework="net472" />
|
||||||
<package id="Moq" version="4.13.0" targetFramework="net472" />
|
<package id="JetBrains.Annotations" version="2020.3.0" targetFramework="net472" />
|
||||||
<package id="NUnit" version="3.12.0" targetFramework="net472" />
|
<package id="Moq" version="4.15.2" targetFramework="net472" />
|
||||||
<package id="System.Runtime.CompilerServices.Unsafe" version="4.6.0" targetFramework="net472" />
|
<package id="NUnit" version="3.13.0" targetFramework="net472" />
|
||||||
<package id="System.Threading.Tasks.Extensions" version="4.5.3" 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" />
|
||||||
</packages>
|
</packages>
|
||||||
+111
-183
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using ASCOM.DeviceInterface;
|
using ASCOM.DeviceInterface;
|
||||||
@@ -19,7 +18,7 @@ namespace ASCOM.Meade.net
|
|||||||
// The ClassInterface/None addribute prevents an empty interface called
|
// The ClassInterface/None addribute prevents an empty interface called
|
||||||
// _Meade.net from being created and used as the [default] interface
|
// _Meade.net from being created and used as the [default] interface
|
||||||
//
|
//
|
||||||
// TODO Replace the not implemented exceptions with code to implement the function or
|
// Replace the not implemented exceptions with code to implement the function or
|
||||||
// throw the appropriate ASCOM exception.
|
// throw the appropriate ASCOM exception.
|
||||||
//
|
//
|
||||||
|
|
||||||
@@ -31,7 +30,7 @@ namespace ASCOM.Meade.net
|
|||||||
[ServedClassName("Meade Generic")]
|
[ServedClassName("Meade Generic")]
|
||||||
[ClassInterface(ClassInterfaceType.None)]
|
[ClassInterface(ClassInterfaceType.None)]
|
||||||
[ComVisible(true)]
|
[ComVisible(true)]
|
||||||
public class Focuser : ReferenceCountedObjectBase, IFocuserV3
|
public class Focuser : MeadeTelescopeBase, IFocuserV3
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ASCOM DeviceID (COM ProgID) for this driver.
|
/// ASCOM DeviceID (COM ProgID) for this driver.
|
||||||
@@ -39,26 +38,12 @@ namespace ASCOM.Meade.net
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
//internal static string driverID = "ASCOM.Meade.net.Focuser";
|
//internal static string driverID = "ASCOM.Meade.net.Focuser";
|
||||||
private static readonly string DriverId = Marshal.GenerateProgIdForType(MethodBase.GetCurrentMethod().DeclaringType ?? throw new System.InvalidOperationException());
|
private static readonly string DriverId = Marshal.GenerateProgIdForType(MethodBase.GetCurrentMethod().DeclaringType ?? throw new System.InvalidOperationException());
|
||||||
// TODO Change the descriptive string for your driver then remove this line
|
|
||||||
/// <summary>
|
|
||||||
/// Driver description that displays in the ASCOM Chooser.
|
|
||||||
/// </summary>
|
|
||||||
private static readonly string DriverDescription = "Meade Generic";
|
|
||||||
|
|
||||||
private static string _comPort; // Variables to hold the currrent device configuration
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 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>
|
|
||||||
/// Variable to hold the trace logger object (creates a diagnostic log file with information that you specify)
|
|
||||||
/// </summary>
|
|
||||||
private static TraceLogger _tl;
|
|
||||||
|
|
||||||
private readonly ISharedResourcesWrapper _sharedResourcesWrapper;
|
|
||||||
|
|
||||||
/// <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.
|
||||||
@@ -68,33 +53,17 @@ namespace ASCOM.Meade.net
|
|||||||
//todo move this out to IOC
|
//todo move this out to IOC
|
||||||
var util = new Util(); //Initialise util object
|
var util = new Util(); //Initialise util object
|
||||||
_utilities = util;
|
_utilities = util;
|
||||||
_sharedResourcesWrapper = new SharedResourcesWrapper();
|
|
||||||
|
|
||||||
Initialise();
|
Initialise(nameof(Focuser));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Focuser(IUtil util, ISharedResourcesWrapper sharedResourcesWrapper)
|
public Focuser(IUtil util, ISharedResourcesWrapper sharedResourcesWrapper) : base(sharedResourcesWrapper)
|
||||||
{
|
{
|
||||||
_utilities = util;
|
_utilities = util;
|
||||||
_sharedResourcesWrapper = sharedResourcesWrapper;
|
|
||||||
|
|
||||||
Initialise();
|
Initialise(nameof(Focuser));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Initialise()
|
|
||||||
{
|
|
||||||
//todo move the TraceLogger out to a factory class.
|
|
||||||
_tl = new TraceLogger("", "Meade.Generic.focusser");
|
|
||||||
|
|
||||||
ReadProfile(); // Read device configuration from the ASCOM Profile store
|
|
||||||
|
|
||||||
IsConnected = false; // Initialise connected to false
|
|
||||||
|
|
||||||
LogMessage("Focuser", "Completed initialisation");
|
|
||||||
LogMessage("Focuser", $"Driver version: {DriverVersion}");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// PUBLIC COM INTERFACE IFocuserV3 IMPLEMENTATION
|
// PUBLIC COM INTERFACE IFocuserV3 IMPLEMENTATION
|
||||||
//
|
//
|
||||||
@@ -109,17 +78,17 @@ namespace ASCOM.Meade.net
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void SetupDialog()
|
public void SetupDialog()
|
||||||
{
|
{
|
||||||
_tl.LogMessage("SetupDialog", "Opening setup dialog");
|
Tl.LogMessage("SetupDialog", "Opening setup dialog");
|
||||||
_sharedResourcesWrapper.SetupDialog();
|
SharedResourcesWrapper.SetupDialog();
|
||||||
ReadProfile();
|
ReadProfile();
|
||||||
_tl.LogMessage("SetupDialog", "complete");
|
Tl.LogMessage("SetupDialog", "complete");
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList SupportedActions
|
public ArrayList SupportedActions
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
_tl.LogMessage("SupportedActions Get", "Returning empty arraylist");
|
Tl.LogMessage("SupportedActions Get", "Returning empty arraylist");
|
||||||
return new ArrayList();
|
return new ArrayList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -132,41 +101,48 @@ 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);
|
||||||
// TODO 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");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
// Clean up the tracelogger and util objects
|
// Clean up the tracelogger and util objects
|
||||||
_tl.Enabled = false;
|
Tl.Enabled = false;
|
||||||
_tl.Dispose();
|
Tl.Dispose();
|
||||||
_tl = null;
|
Tl = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Connected
|
public bool Connected
|
||||||
@@ -178,7 +154,7 @@ namespace ASCOM.Meade.net
|
|||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
_tl.LogMessage("Connected", "Set {0}", value);
|
Tl.LogMessage("Connected", "Set {0}", value);
|
||||||
if (value == IsConnected)
|
if (value == IsConnected)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -187,63 +163,31 @@ namespace ASCOM.Meade.net
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
ReadProfile();
|
ReadProfile();
|
||||||
_sharedResourcesWrapper.Connect("Serial", DriverId);
|
SharedResourcesWrapper.Connect("Serial", DriverId, Tl);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
IsConnected = true;
|
IsConnected = true;
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
_sharedResourcesWrapper.Disconnect("Serial", DriverId);
|
SharedResourcesWrapper.Disconnect("Serial", DriverId);
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LogMessage("Connected Set", "Error connecting to port {0} - {1}", _comPort, ex.Message);
|
LogMessage("Connected Set", "Error connecting to port {0} - {1}", ComPort, ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LogMessage("Connected Set", "Disconnecting from port {0}", _comPort);
|
LogMessage("Connected Set", "Disconnecting from port {0}", ComPort);
|
||||||
_sharedResourcesWrapper.Disconnect("Serial", DriverId);
|
SharedResourcesWrapper.Disconnect("Serial", DriverId);
|
||||||
IsConnected = false;
|
IsConnected = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Description
|
|
||||||
{
|
|
||||||
// TODO customise this device description
|
|
||||||
get
|
|
||||||
{
|
|
||||||
_tl.LogMessage("Description Get", DriverDescription);
|
|
||||||
return DriverDescription;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public string DriverInfo
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
// TODO customise this driver description
|
|
||||||
string driverInfo = $"{Description} .net driver. Version: {DriverVersion}";
|
|
||||||
LogMessage("DriverInfo Get", driverInfo);
|
|
||||||
return driverInfo;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public string DriverVersion
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
Version version = Assembly.GetExecutingAssembly().GetName().Version;
|
|
||||||
string driverVersion = $"{version.Major}.{version.Minor}.{version.Build}.{version.Revision}";
|
|
||||||
LogMessage("DriverVersion Get", driverVersion);
|
|
||||||
return driverVersion;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public short InterfaceVersion
|
public short InterfaceVersion
|
||||||
{
|
{
|
||||||
// set by the driver wizard
|
// set by the driver wizard
|
||||||
@@ -260,7 +204,7 @@ namespace ASCOM.Meade.net
|
|||||||
{
|
{
|
||||||
//string name = "Short driver name - please customise";
|
//string name = "Short driver name - please customise";
|
||||||
string name = DriverDescription;
|
string name = DriverDescription;
|
||||||
_tl.LogMessage("Name Get", name);
|
Tl.LogMessage("Name Get", name);
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -275,35 +219,29 @@ namespace ASCOM.Meade.net
|
|||||||
{
|
{
|
||||||
CheckConnected("Absolute Get");
|
CheckConnected("Absolute Get");
|
||||||
|
|
||||||
_tl.LogMessage("Absolute Get", false.ToString());
|
Tl.LogMessage("Absolute Get", false.ToString());
|
||||||
return false; // This is a relative focuser
|
return false; // This is a relative focuser
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Halt()
|
public void Halt()
|
||||||
{
|
{
|
||||||
_tl.LogMessage("Halt", "Halting");
|
Tl.LogMessage("Halt", "Halting");
|
||||||
|
|
||||||
CheckConnected("Halt");
|
CheckConnected("Halt");
|
||||||
|
|
||||||
//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.
|
||||||
//todo make this mockable
|
|
||||||
Stopwatch stopwatch = Stopwatch.StartNew();
|
|
||||||
while (stopwatch.ElapsedMilliseconds < 1000)
|
|
||||||
{
|
|
||||||
_sharedResourcesWrapper.SendBlind(":FQ#");
|
|
||||||
//:FQ# Halt Focuser Motion
|
|
||||||
//Returns: Nothing
|
|
||||||
|
|
||||||
_utilities.WaitForMilliseconds(250);
|
SharedResourcesWrapper.SendBlind("FQ");
|
||||||
}
|
//:FQ# Halt Focuser Motion
|
||||||
|
//Returns: Nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsMoving
|
public bool IsMoving
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
_tl.LogMessage("IsMoving Get", false.ToString());
|
Tl.LogMessage("IsMoving Get", false.ToString());
|
||||||
return false; // This focuser always moves instantaneously so no need for IsMoving ever to be True
|
return false; // This focuser always moves instantaneously so no need for IsMoving ever to be True
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -312,12 +250,12 @@ namespace ASCOM.Meade.net
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
_tl.LogMessage("Link Get", Connected.ToString());
|
Tl.LogMessage("Link Get", Connected.ToString());
|
||||||
return Connected; // Direct function to the connected method, the Link method is just here for backwards compatibility
|
return Connected; // Direct function to the connected method, the Link method is just here for backwards compatibility
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
_tl.LogMessage("Link Set", value.ToString());
|
Tl.LogMessage("Link Set", value.ToString());
|
||||||
Connected = value; // Direct function to the connected method, the Link method is just here for backwards compatibility
|
Connected = value; // Direct function to the connected method, the Link method is just here for backwards compatibility
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -327,30 +265,27 @@ namespace ASCOM.Meade.net
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
_tl.LogMessage("MaxIncrement Get", _maxIncrement.ToString());
|
Tl.LogMessage("MaxIncrement Get", _maxIncrement.ToString());
|
||||||
return _maxIncrement; // Maximum change in one move
|
return _maxIncrement; // Maximum change in one move
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly int _maxStep = 7000;
|
private readonly int _maxStep = 7000;
|
||||||
|
|
||||||
public int MaxStep
|
public int MaxStep
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
_tl.LogMessage("MaxStep Get", _maxStep.ToString());
|
Tl.LogMessage("MaxStep Get", _maxStep.ToString());
|
||||||
return _maxStep;
|
return _maxStep;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Move(int position)
|
public void Move(int position)
|
||||||
{
|
{
|
||||||
_tl.LogMessage("Move", position.ToString());
|
Tl.LogMessage("Move", position.ToString());
|
||||||
CheckConnected("Move");
|
CheckConnected("Move");
|
||||||
|
|
||||||
//todo implement backlash compensation
|
|
||||||
//todo implement direction reverse
|
|
||||||
//todo implement dynamic braking
|
|
||||||
|
|
||||||
if (position < -MaxIncrement || position > MaxIncrement)
|
if (position < -MaxIncrement || position > MaxIncrement)
|
||||||
{
|
{
|
||||||
throw new InvalidValueException($"position out of range {-MaxIncrement} < {position} < {MaxIncrement}");
|
throw new InvalidValueException($"position out of range {-MaxIncrement} < {position} < {MaxIncrement}");
|
||||||
@@ -359,45 +294,75 @@ namespace ASCOM.Meade.net
|
|||||||
if (position == 0)
|
if (position == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
MoveFocuser(position > 0, Math.Abs(position));
|
var direction = position > 0;
|
||||||
|
if (ReverseFocusDirection)
|
||||||
|
direction = !direction;
|
||||||
|
|
||||||
|
SharedResourcesWrapper.Lock(() =>
|
||||||
|
{
|
||||||
|
//backlash compensation.
|
||||||
|
var backlashCompensationSteps = direction ? Math.Abs(BacklashCompensation) : 0;
|
||||||
|
|
||||||
|
var steps = Math.Abs(position) + backlashCompensationSteps;
|
||||||
|
|
||||||
|
|
||||||
|
MoveFocuser(direction, steps);
|
||||||
|
|
||||||
|
|
||||||
|
//todo refactor the backlash compensation to combine the commands into as few moves as practicle.
|
||||||
|
//ApplyBacklashCompensation(direction);
|
||||||
|
if (direction & backlashCompensationSteps != 0)
|
||||||
|
{
|
||||||
|
Tl.LogMessage("Move", "Applying backlash compensation");
|
||||||
|
MoveFocuser(!direction, backlashCompensationSteps);
|
||||||
|
}
|
||||||
|
|
||||||
|
DynamicBreaking(direction);
|
||||||
|
//todo implement dynamic braking
|
||||||
|
//dynamic breaking is sending the command to move in the opposite direction immediatly followed by the command to stop.
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DynamicBreaking(bool directionOut)
|
||||||
|
{
|
||||||
|
if (!UseDynamicBreaking)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Tl.LogMessage("Move", "Applying dynamic breaking");
|
||||||
|
|
||||||
|
PerformFocuserMove(directionOut);
|
||||||
|
Halt();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void MoveFocuser(bool directionOut, int steps)
|
private void MoveFocuser(bool directionOut, int steps)
|
||||||
{
|
{
|
||||||
_sharedResourcesWrapper.Lock(() =>
|
//_sharedResourcesWrapper.SendBlind("FF");
|
||||||
{
|
//:FF# Set Focus speed to fastest setting
|
||||||
//_sharedResourcesWrapper.SendBlind("#:FF#");
|
//Returns: Nothing
|
||||||
//:FF# Set Focus speed to fastest setting
|
|
||||||
//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);
|
||||||
|
|
||||||
//A Single focus command sometimes gets lost on the #909, so sending lots of them solves the issue.
|
_utilities.WaitForMilliseconds(steps);
|
||||||
//todo make this mockable
|
|
||||||
Stopwatch stopwatch = Stopwatch.StartNew();
|
|
||||||
while (stopwatch.ElapsedMilliseconds < steps)
|
|
||||||
{
|
|
||||||
_sharedResourcesWrapper.SendBlind(directionOut ? "#:F+#" : "#:F-#");
|
|
||||||
//:F+# Start Focuser moving inward (toward objective)
|
|
||||||
//Returns: None
|
|
||||||
|
|
||||||
//:F-# Start Focuser moving outward (away from objective)
|
Halt();
|
||||||
//Returns: None
|
}
|
||||||
|
|
||||||
_utilities.WaitForMilliseconds(250);
|
private void PerformFocuserMove(bool directionOut)
|
||||||
}
|
{
|
||||||
|
SharedResourcesWrapper.SendBlind(directionOut ? "F+" : "F-");
|
||||||
|
//:F+# Start Focuser moving inward (toward objective)
|
||||||
|
//Returns: None
|
||||||
|
|
||||||
Halt();
|
//:F-# Start Focuser moving outward (away from objective)
|
||||||
|
//Returns: None
|
||||||
//This gives the focuser time to physically stop.
|
|
||||||
_utilities.WaitForMilliseconds(1000);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int Position => throw new PropertyNotImplementedException("Position", false);
|
public int Position => throw new PropertyNotImplementedException("Position", false);
|
||||||
@@ -406,7 +371,7 @@ namespace ASCOM.Meade.net
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
_tl.LogMessage("StepSize Get", "Not implemented");
|
Tl.LogMessage("StepSize Get", "Not implemented");
|
||||||
throw new PropertyNotImplementedException("StepSize", false);
|
throw new PropertyNotImplementedException("StepSize", false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -415,13 +380,13 @@ namespace ASCOM.Meade.net
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
_tl.LogMessage("TempComp Get", false.ToString());
|
Tl.LogMessage("TempComp Get", false.ToString());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// ReSharper disable once ValueParameterNotUsed
|
// ReSharper disable once ValueParameterNotUsed
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
_tl.LogMessage("TempComp Set", "Not implemented");
|
Tl.LogMessage("TempComp Set", "Not implemented");
|
||||||
throw new PropertyNotImplementedException("TempComp", false);
|
throw new PropertyNotImplementedException("TempComp", false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -430,7 +395,7 @@ namespace ASCOM.Meade.net
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
_tl.LogMessage("TempCompAvailable Get", false.ToString());
|
Tl.LogMessage("TempCompAvailable Get", false.ToString());
|
||||||
return false; // Temperature compensation is not available in this driver
|
return false; // Temperature compensation is not available in this driver
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -439,7 +404,7 @@ namespace ASCOM.Meade.net
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
_tl.LogMessage("Temperature Get", "Not implemented");
|
Tl.LogMessage("Temperature Get", "Not implemented");
|
||||||
throw new PropertyNotImplementedException("Temperature", false);
|
throw new PropertyNotImplementedException("Temperature", false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -452,13 +417,6 @@ namespace ASCOM.Meade.net
|
|||||||
|
|
||||||
#region ASCOM Registration
|
#region ASCOM Registration
|
||||||
|
|
||||||
private static IProfileFactory _profileFactory;
|
|
||||||
public static IProfileFactory ProfileFactory
|
|
||||||
{
|
|
||||||
get => _profileFactory ?? (_profileFactory = new ProfileFactory());
|
|
||||||
set => _profileFactory = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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.
|
||||||
//
|
//
|
||||||
@@ -471,7 +429,7 @@ namespace ASCOM.Meade.net
|
|||||||
{
|
{
|
||||||
using (IProfileWrapper p = ProfileFactory.Create())
|
using (IProfileWrapper p = ProfileFactory.Create())
|
||||||
{
|
{
|
||||||
p.DeviceType = "Focuser";
|
p.DeviceType = nameof(Focuser);
|
||||||
if (bRegister)
|
if (bRegister)
|
||||||
{
|
{
|
||||||
p.Register(DriverId, DriverDescription);
|
p.Register(DriverId, DriverDescription);
|
||||||
@@ -530,12 +488,7 @@ namespace ASCOM.Meade.net
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns true if there is a valid connection to the driver hardware
|
|
||||||
/// </summary>
|
|
||||||
private bool IsConnected { get; set; }
|
|
||||||
|
|
||||||
/// <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>
|
||||||
@@ -547,31 +500,6 @@ namespace ASCOM.Meade.net
|
|||||||
throw new NotConnectedException($"Not connected to focuser when trying to execute: {message}");
|
throw new NotConnectedException($"Not connected to focuser when trying to execute: {message}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Read the device configuration from the ASCOM Profile store
|
|
||||||
/// </summary>
|
|
||||||
private void ReadProfile()
|
|
||||||
{
|
|
||||||
var profileProperties = _sharedResourcesWrapper.ReadProfile();
|
|
||||||
_tl.Enabled = profileProperties.TraceLogger;
|
|
||||||
_comPort = profileProperties.ComPort;
|
|
||||||
|
|
||||||
LogMessage("ReadProfile", $"Trace logger enabled: {_tl.Enabled}");
|
|
||||||
LogMessage("ReadProfile", $"Com Port: {_comPort}");
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Log helper function that takes formatted strings and arguments
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="identifier"></param>
|
|
||||||
/// <param name="message"></param>
|
|
||||||
/// <param name="args"></param>
|
|
||||||
private static void LogMessage(string identifier, string message, params object[] args)
|
|
||||||
{
|
|
||||||
var msg = string.Format(message, args);
|
|
||||||
_tl.LogMessage(identifier, msg);
|
|
||||||
}
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
<UpgradeBackupLocation>
|
<UpgradeBackupLocation>
|
||||||
</UpgradeBackupLocation>
|
</UpgradeBackupLocation>
|
||||||
<OldToolsVersion>3.5</OldToolsVersion>
|
<OldToolsVersion>3.5</OldToolsVersion>
|
||||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||||
<ApplicationIcon>ASCOM.ico</ApplicationIcon>
|
<ApplicationIcon>ASCOM.ico</ApplicationIcon>
|
||||||
<SignAssembly>true</SignAssembly>
|
<SignAssembly>true</SignAssembly>
|
||||||
<AssemblyOriginatorKeyFile>ASCOMDriverTemplate.snk</AssemblyOriginatorKeyFile>
|
<AssemblyOriginatorKeyFile>ASCOMDriverTemplate.snk</AssemblyOriginatorKeyFile>
|
||||||
@@ -83,37 +83,40 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="ASCOM.Astrometry, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
<Reference Include="ASCOM.Astrometry, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Astrometry.dll</HintPath>
|
<HintPath>..\packages\ASCOM.Platform.6.5.1\lib\net40\ASCOM.Astrometry.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="ASCOM.Attributes, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
<Reference Include="ASCOM.Attributes, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Attributes.dll</HintPath>
|
<HintPath>..\packages\ASCOM.Platform.6.5.1\lib\net40\ASCOM.Attributes.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="ASCOM.Cache, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
<Reference Include="ASCOM.Cache, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Cache.dll</HintPath>
|
<HintPath>..\packages\ASCOM.Platform.6.5.1\lib\net40\ASCOM.Cache.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="ASCOM.Controls, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
<Reference Include="ASCOM.Controls, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Controls.dll</HintPath>
|
<HintPath>..\packages\ASCOM.Platform.6.5.1\lib\net40\ASCOM.Controls.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="ASCOM.DeviceInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
<Reference Include="ASCOM.DeviceInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.DeviceInterfaces.dll</HintPath>
|
<HintPath>..\packages\ASCOM.Platform.6.5.1\lib\net40\ASCOM.DeviceInterfaces.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="ASCOM.DriverAccess, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
<Reference Include="ASCOM.DriverAccess, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.DriverAccess.dll</HintPath>
|
<HintPath>..\packages\ASCOM.Platform.6.5.1\lib\net40\ASCOM.DriverAccess.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="ASCOM.Exceptions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
<Reference Include="ASCOM.Exceptions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Exceptions.dll</HintPath>
|
<HintPath>..\packages\ASCOM.Platform.6.5.1\lib\net40\ASCOM.Exceptions.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="ASCOM.Internal.Extensions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
<Reference Include="ASCOM.Internal.Extensions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Internal.Extensions.dll</HintPath>
|
<HintPath>..\packages\ASCOM.Platform.6.5.1\lib\net40\ASCOM.Internal.Extensions.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="ASCOM.SettingsProvider, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
<Reference Include="ASCOM.SettingsProvider, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.SettingsProvider.dll</HintPath>
|
<HintPath>..\packages\ASCOM.Platform.6.5.1\lib\net40\ASCOM.SettingsProvider.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="ASCOM.Utilities, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
<Reference Include="ASCOM.Utilities, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Utilities.dll</HintPath>
|
<HintPath>..\packages\ASCOM.Platform.6.5.1\lib\net40\ASCOM.Utilities.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="ASCOM.Utilities.Video, Version=6.1.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
<Reference Include="ASCOM.Utilities.Video, Version=6.1.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Utilities.Video.dll</HintPath>
|
<HintPath>..\packages\ASCOM.Platform.6.5.1\lib\net40\ASCOM.Utilities.Video.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="JetBrains.Annotations, Version=2020.3.0.0, Culture=neutral, PublicKeyToken=1010a0d8d6380325, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\JetBrains.Annotations.2020.3.0\lib\net20\JetBrains.Annotations.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.configuration" />
|
<Reference Include="System.configuration" />
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ using System.Runtime.InteropServices;
|
|||||||
// set of attributes. Change these attribute values to modify the information
|
// set of attributes. Change these attribute values to modify the information
|
||||||
// associated with an assembly.
|
// associated with an assembly.
|
||||||
//
|
//
|
||||||
// TODO - Add your authorship information here
|
|
||||||
[assembly: AssemblyTitle("ASCOM.Meade.net.Focuser")]
|
[assembly: AssemblyTitle("ASCOM.Meade.net.Focuser")]
|
||||||
[assembly: AssemblyDescription("ASCOM Focuser driver for Meade.net")]
|
[assembly: AssemblyDescription("ASCOM Focuser driver for Meade.net")]
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
@@ -33,6 +32,5 @@ using System.Runtime.InteropServices;
|
|||||||
// You can specify all the values or you can default the Revision and Build Numbers
|
// You can specify all the values or you can default the Revision and Build Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
//
|
//
|
||||||
// TODO - Set your driver's version here
|
|
||||||
[assembly: AssemblyVersion("0.0.0.0")]
|
[assembly: AssemblyVersion("0.0.0.0")]
|
||||||
[assembly: AssemblyFileVersion("0.0.0.0")]
|
[assembly: AssemblyFileVersion("0.0.0.0")]
|
||||||
|
|||||||
+1
-1
@@ -12,7 +12,7 @@ namespace ASCOM.Meade.net.Properties {
|
|||||||
|
|
||||||
|
|
||||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.0.0.0")]
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.4.0.0")]
|
||||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||||
|
|
||||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||||
|
|||||||
@@ -5,4 +5,4 @@
|
|||||||
<section name="ASCOM.DeviceName.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
|
<section name="ASCOM.DeviceName.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
|
||||||
</sectionGroup>
|
</sectionGroup>
|
||||||
</configSections>
|
</configSections>
|
||||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/></startup></configuration>
|
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/></startup></configuration>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="ASCOM.Platform" version="6.4.2" targetFramework="net40" />
|
<package id="ASCOM.Platform" version="6.5.1" targetFramework="net472" />
|
||||||
|
<package id="JetBrains.Annotations" version="2020.3.0" targetFramework="net472" />
|
||||||
</packages>
|
</packages>
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||||
|
<s:Boolean x:Key="/Default/Housekeeping/ExcludedProjects/ProjectMasksToIgnore/=_002A_002A_005C_002A_002EUnitTests/@EntryIndexedValue">False</s:Boolean>
|
||||||
|
<s:Boolean x:Key="/Default/Housekeeping/ExcludedProjects/ProjectMasksToIgnore/=_002A_002A_005C_002A_002EUnitTests/@EntryIndexRemoved">True</s:Boolean>
|
||||||
|
<s:Boolean x:Key="/Default/Housekeeping/ExcludedProjects/ProjectMasksToIgnore/=_002A_002EUnitTests_002E_002A/@EntryIndexedValue">True</s:Boolean>
|
||||||
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=ASCOM/@EntryIndexedValue">True</s:Boolean>
|
||||||
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=Autostar/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
<SolutionConfiguration>
|
|
||||||
<Settings>
|
|
||||||
<AutoEnable>True</AutoEnable>
|
|
||||||
<CurrentEngineMode>Run all tests automatically [Global]</CurrentEngineMode>
|
|
||||||
<MetricsTreeShowTestProjects>False</MetricsTreeShowTestProjects>
|
|
||||||
<StatusIndicatorSplitterDistance>25</StatusIndicatorSplitterDistance>
|
|
||||||
<TestsWindowMenuOptions>
|
|
||||||
<VerticalSplitMenuOption>false</VerticalSplitMenuOption>
|
|
||||||
<ShowPassingTestsMenuOption>false</ShowPassingTestsMenuOption>
|
|
||||||
<ShowFailingTestsMenuOption>true</ShowFailingTestsMenuOption>
|
|
||||||
<ShowUnexecutedTestsMenuOption>true</ShowUnexecutedTestsMenuOption>
|
|
||||||
<ShowIgnoredTestsMenuOption>false</ShowIgnoredTestsMenuOption>
|
|
||||||
</TestsWindowMenuOptions>
|
|
||||||
<TestsWindowSplitterDistance>544</TestsWindowSplitterDistance>
|
|
||||||
</Settings>
|
|
||||||
</SolutionConfiguration>
|
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
namespace ASCOM.Meade.net
|
||||||
|
{
|
||||||
|
public static class EnumExtensionMethods
|
||||||
|
{
|
||||||
|
public static string GetDescription(this Enum GenericEnum)
|
||||||
|
{
|
||||||
|
var genericEnumType = GenericEnum.GetType();
|
||||||
|
var memberInfo = genericEnumType.GetMember(GenericEnum.ToString());
|
||||||
|
if (memberInfo.Length > 0)
|
||||||
|
{
|
||||||
|
var _Attribs = memberInfo[0]
|
||||||
|
.GetCustomAttributes(typeof(System.ComponentModel.DescriptionAttribute), false);
|
||||||
|
if (_Attribs.Any())
|
||||||
|
{
|
||||||
|
return ((System.ComponentModel.DescriptionAttribute) _Attribs.ElementAt(0)).Description;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return GenericEnum.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static T GetValueFromDescription<T>( string description) where T : Enum
|
||||||
|
{
|
||||||
|
foreach (T value in Enum.GetValues(typeof(T)))
|
||||||
|
{
|
||||||
|
if (value.GetDescription() == description)
|
||||||
|
{
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return default;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+18
-13
@@ -337,18 +337,23 @@ namespace ASCOM.Meade.net
|
|||||||
{
|
{
|
||||||
key?.SetValue(null, progid); // Could be assyTitle/Desc??, but .NET components show ProgId here
|
key?.SetValue(null, progid); // Could be assyTitle/Desc??, but .NET components show ProgId here
|
||||||
key?.SetValue("AppId", _sAppId);
|
key?.SetValue("AppId", _sAppId);
|
||||||
using (RegistryKey key2 = key.CreateSubKey("Implemented Categories"))
|
if (key != null)
|
||||||
{
|
{
|
||||||
key2?.CreateSubKey("{62C8FE65-4EBB-45e7-B440-6E39B2CDBF29}");
|
using (RegistryKey key2 = key.CreateSubKey("Implemented Categories"))
|
||||||
}
|
{
|
||||||
using (RegistryKey key2 = key.CreateSubKey("ProgId"))
|
key2?.CreateSubKey("{62C8FE65-4EBB-45e7-B440-6E39B2CDBF29}");
|
||||||
{
|
}
|
||||||
key2?.SetValue(null, progid);
|
|
||||||
}
|
using (RegistryKey key2 = key.CreateSubKey("ProgId"))
|
||||||
key.CreateSubKey("Programmable");
|
{
|
||||||
using (RegistryKey key2 = key.CreateSubKey("LocalServer32"))
|
key2?.SetValue(null, progid);
|
||||||
{
|
}
|
||||||
key2?.SetValue(null, Application.ExecutablePath);
|
|
||||||
|
key.CreateSubKey("Programmable");
|
||||||
|
using (RegistryKey key2 = key.CreateSubKey("LocalServer32"))
|
||||||
|
{
|
||||||
|
key2?.SetValue(null, Application.ExecutablePath);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
@@ -390,7 +395,7 @@ namespace ASCOM.Meade.net
|
|||||||
//
|
//
|
||||||
// Remove all traces of this from the registry.
|
// Remove all traces of this from the registry.
|
||||||
//
|
//
|
||||||
// **TODO** If the above does AppID/DCOM stuff, this would have
|
// If the above does AppID/DCOM stuff, this would have
|
||||||
// to remove that stuff too.
|
// to remove that stuff too.
|
||||||
//
|
//
|
||||||
private static void UnregisterObjects()
|
private static void UnregisterObjects()
|
||||||
@@ -494,7 +499,7 @@ namespace ASCOM.Meade.net
|
|||||||
bool bRet = true;
|
bool bRet = true;
|
||||||
|
|
||||||
//
|
//
|
||||||
//**TODO** -Embedding is "ActiveX start". Prohibit non_AX starting?
|
// -Embedding is "ActiveX start". Prohibit non_AX starting?
|
||||||
//
|
//
|
||||||
if (args.Length > 0)
|
if (args.Length > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
+21
-12
@@ -10,7 +10,7 @@
|
|||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
<RootNamespace>ASCOM.Meade.net</RootNamespace>
|
<RootNamespace>ASCOM.Meade.net</RootNamespace>
|
||||||
<AssemblyName>ASCOM.Meade.net.Server</AssemblyName>
|
<AssemblyName>ASCOM.Meade.net.Server</AssemblyName>
|
||||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||||
<FileUpgradeFlags>
|
<FileUpgradeFlags>
|
||||||
</FileUpgradeFlags>
|
</FileUpgradeFlags>
|
||||||
<OldToolsVersion>2.0</OldToolsVersion>
|
<OldToolsVersion>2.0</OldToolsVersion>
|
||||||
@@ -86,37 +86,40 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="ASCOM.Astrometry, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
<Reference Include="ASCOM.Astrometry, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Astrometry.dll</HintPath>
|
<HintPath>..\packages\ASCOM.Platform.6.5.1\lib\net40\ASCOM.Astrometry.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="ASCOM.Attributes, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
<Reference Include="ASCOM.Attributes, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Attributes.dll</HintPath>
|
<HintPath>..\packages\ASCOM.Platform.6.5.1\lib\net40\ASCOM.Attributes.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="ASCOM.Cache, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
<Reference Include="ASCOM.Cache, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Cache.dll</HintPath>
|
<HintPath>..\packages\ASCOM.Platform.6.5.1\lib\net40\ASCOM.Cache.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="ASCOM.Controls, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
<Reference Include="ASCOM.Controls, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Controls.dll</HintPath>
|
<HintPath>..\packages\ASCOM.Platform.6.5.1\lib\net40\ASCOM.Controls.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="ASCOM.DeviceInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
<Reference Include="ASCOM.DeviceInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.DeviceInterfaces.dll</HintPath>
|
<HintPath>..\packages\ASCOM.Platform.6.5.1\lib\net40\ASCOM.DeviceInterfaces.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="ASCOM.DriverAccess, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
<Reference Include="ASCOM.DriverAccess, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.DriverAccess.dll</HintPath>
|
<HintPath>..\packages\ASCOM.Platform.6.5.1\lib\net40\ASCOM.DriverAccess.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="ASCOM.Exceptions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
<Reference Include="ASCOM.Exceptions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Exceptions.dll</HintPath>
|
<HintPath>..\packages\ASCOM.Platform.6.5.1\lib\net40\ASCOM.Exceptions.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="ASCOM.Internal.Extensions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
<Reference Include="ASCOM.Internal.Extensions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Internal.Extensions.dll</HintPath>
|
<HintPath>..\packages\ASCOM.Platform.6.5.1\lib\net40\ASCOM.Internal.Extensions.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="ASCOM.SettingsProvider, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
<Reference Include="ASCOM.SettingsProvider, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.SettingsProvider.dll</HintPath>
|
<HintPath>..\packages\ASCOM.Platform.6.5.1\lib\net40\ASCOM.SettingsProvider.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="ASCOM.Utilities, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
<Reference Include="ASCOM.Utilities, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Utilities.dll</HintPath>
|
<HintPath>..\packages\ASCOM.Platform.6.5.1\lib\net40\ASCOM.Utilities.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="ASCOM.Utilities.Video, Version=6.1.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
<Reference Include="ASCOM.Utilities.Video, Version=6.1.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Utilities.Video.dll</HintPath>
|
<HintPath>..\packages\ASCOM.Platform.6.5.1\lib\net40\ASCOM.Utilities.Video.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="JetBrains.Annotations, Version=2020.3.0.0, Culture=neutral, PublicKeyToken=1010a0d8d6380325, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\JetBrains.Annotations.2020.3.0\lib\net20\JetBrains.Annotations.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Drawing" />
|
<Reference Include="System.Drawing" />
|
||||||
@@ -126,6 +129,7 @@
|
|||||||
<Compile Include="AssemblyInfo.cs" />
|
<Compile Include="AssemblyInfo.cs" />
|
||||||
<Compile Include="ClassFactory.cs" />
|
<Compile Include="ClassFactory.cs" />
|
||||||
<Compile Include="ConnectionInfo.cs" />
|
<Compile Include="ConnectionInfo.cs" />
|
||||||
|
<Compile Include="EnumExtensionMethods.cs" />
|
||||||
<Compile Include="frmMain.cs">
|
<Compile Include="frmMain.cs">
|
||||||
<SubType>Form</SubType>
|
<SubType>Form</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
@@ -133,7 +137,11 @@
|
|||||||
<DependentUpon>frmMain.cs</DependentUpon>
|
<DependentUpon>frmMain.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="GarbageCollection.cs" />
|
<Compile Include="GarbageCollection.cs" />
|
||||||
|
<Compile Include="AstroMaths\HorizonCoordinates.cs" />
|
||||||
<Compile Include="LocalServer.cs" />
|
<Compile Include="LocalServer.cs" />
|
||||||
|
<Compile Include="MeadeTelescopeBase.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" />
|
||||||
@@ -195,6 +203,7 @@
|
|||||||
<Install>true</Install>
|
<Install>true</Install>
|
||||||
</BootstrapperPackage>
|
</BootstrapperPackage>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup />
|
||||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||||
<!-- 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.
|
||||||
|
|||||||
@@ -0,0 +1,166 @@
|
|||||||
|
using System;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using ASCOM.Meade.net.AstroMaths;
|
||||||
|
using ASCOM.Meade.net.Wrapper;
|
||||||
|
using ASCOM.Utilities;
|
||||||
|
|
||||||
|
namespace ASCOM.Meade.net
|
||||||
|
{
|
||||||
|
[ComVisible(false)]
|
||||||
|
public class MeadeTelescopeBase : ReferenceCountedObjectBase
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Variable to hold the trace logger object (creates a diagnostic log file with information that you specify)
|
||||||
|
/// </summary>
|
||||||
|
protected static TraceLogger Tl;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Driver description that displays in the ASCOM Chooser.
|
||||||
|
/// </summary>
|
||||||
|
protected static readonly string DriverDescription = "Meade Generic";
|
||||||
|
|
||||||
|
protected static string ComPort; // Variables to hold the currrent device configuration
|
||||||
|
protected static int BacklashCompensation;
|
||||||
|
protected static bool ReverseFocusDirection;
|
||||||
|
protected static bool UseDynamicBreaking;
|
||||||
|
protected double GuideRate;
|
||||||
|
protected string Precision;
|
||||||
|
protected string GuidingStyle;
|
||||||
|
protected double SiteElevation;
|
||||||
|
protected short ProfileSettleTime;
|
||||||
|
protected bool SendDateTime;
|
||||||
|
protected ParkedBehaviour ParkedBehaviour;
|
||||||
|
protected HorizonCoordinates ParkedAltAz;
|
||||||
|
|
||||||
|
protected readonly ISharedResourcesWrapper SharedResourcesWrapper;
|
||||||
|
|
||||||
|
public MeadeTelescopeBase()
|
||||||
|
{
|
||||||
|
SharedResourcesWrapper = new SharedResourcesWrapper();
|
||||||
|
}
|
||||||
|
|
||||||
|
public MeadeTelescopeBase(ISharedResourcesWrapper sharedResourcesWrapper)
|
||||||
|
{
|
||||||
|
SharedResourcesWrapper = sharedResourcesWrapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void Initialise(string className)
|
||||||
|
{
|
||||||
|
Tl = new TraceLogger("", $"Meade.Generic.{className}");
|
||||||
|
|
||||||
|
ReadProfile(); // Read device configuration from the ASCOM Profile store
|
||||||
|
|
||||||
|
IsConnected = false; // Initialise connected to false
|
||||||
|
|
||||||
|
LogMessage(className, "Completed initialisation");
|
||||||
|
LogMessage(className, $"Driver version: {DriverVersion}");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Read the device configuration from the ASCOM Profile store
|
||||||
|
/// </summary>
|
||||||
|
protected void ReadProfile()
|
||||||
|
{
|
||||||
|
var profileProperties = SharedResourcesWrapper.ReadProfile();
|
||||||
|
Tl.Enabled = profileProperties.TraceLogger;
|
||||||
|
ComPort = profileProperties.ComPort;
|
||||||
|
BacklashCompensation = profileProperties.BacklashCompensation;
|
||||||
|
ReverseFocusDirection = profileProperties.ReverseFocusDirection;
|
||||||
|
UseDynamicBreaking = profileProperties.DynamicBreaking;
|
||||||
|
GuideRate = profileProperties.GuideRateArcSecondsPerSecond;
|
||||||
|
Precision = profileProperties.Precision;
|
||||||
|
GuidingStyle = profileProperties.GuidingStyle.ToLower();
|
||||||
|
SiteElevation = profileProperties.SiteElevation;
|
||||||
|
ProfileSettleTime = profileProperties.SettleTime;
|
||||||
|
SendDateTime = profileProperties.SendDateTime;
|
||||||
|
ParkedBehaviour = profileProperties.ParkedBehaviour;
|
||||||
|
|
||||||
|
ParkedAltAz = new HorizonCoordinates
|
||||||
|
{
|
||||||
|
Altitude = profileProperties.ParkedAlt,
|
||||||
|
Azimuth = profileProperties.ParkedAz
|
||||||
|
};
|
||||||
|
|
||||||
|
LogMessage("ReadProfile", $"Trace logger enabled: {Tl.Enabled}");
|
||||||
|
LogMessage("ReadProfile", $"Com Port: {ComPort}");
|
||||||
|
LogMessage("ReadProfile", $"Backlash Steps: {BacklashCompensation}");
|
||||||
|
LogMessage("ReadProfile", $"Dynamic breaking: {UseDynamicBreaking}");
|
||||||
|
LogMessage("ReadProfile", $"Guide Rate: {GuideRate}");
|
||||||
|
LogMessage("ReadProfile", $"Precision: {Precision}");
|
||||||
|
LogMessage("ReadProfile", $"Guiding Style: {GuidingStyle}");
|
||||||
|
LogMessage("ReadProfile", $"Site Elevation: {SiteElevation}");
|
||||||
|
LogMessage("ReadProfile", $"Settle Time after slew: {ProfileSettleTime}");
|
||||||
|
LogMessage("ReadProfile", $"Send date and time on connect: {SendDateTime}");
|
||||||
|
LogMessage("ReadProfile", $"Parked Behaviour: {ParkedBehaviour}");
|
||||||
|
LogMessage("ReadProfile", $"Parked Alt: {ParkedAltAz.Altitude}");
|
||||||
|
LogMessage("ReadProfile", $"Parked Az: {ParkedAltAz.Azimuth}");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Log helper function that takes formatted strings and arguments
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="identifier"></param>
|
||||||
|
/// <param name="message"></param>
|
||||||
|
/// <param name="args"></param>
|
||||||
|
public static void LogMessage(string identifier, string message, params object[] args)
|
||||||
|
{
|
||||||
|
var msg = string.Format(message, args);
|
||||||
|
Tl.LogMessage(identifier, msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns true if there is a valid connection to the driver hardware
|
||||||
|
/// </summary>
|
||||||
|
protected bool IsConnected { get; set; }
|
||||||
|
|
||||||
|
public string Description
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Tl.LogMessage("Description Get", DriverDescription);
|
||||||
|
return DriverDescription;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string DriverInfo
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
string driverInfo = $"{Description} .net driver. Version: {DriverVersion}";
|
||||||
|
LogMessage("DriverInfo Get", driverInfo);
|
||||||
|
return driverInfo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string DriverVersion
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Version version = Assembly.GetExecutingAssembly().GetName().Version;
|
||||||
|
string driverVersion = $"{version.Major}.{version.Minor}.{version.Build}.{version.Revision}";
|
||||||
|
LogMessage("DriverVersion Get", driverVersion);
|
||||||
|
return driverVersion;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#region ASCOM Registration
|
||||||
|
|
||||||
|
private static IProfileFactory _profileFactory;
|
||||||
|
|
||||||
|
public static IProfileFactory ProfileFactory
|
||||||
|
{
|
||||||
|
get => _profileFactory ?? (_profileFactory = new ProfileFactory());
|
||||||
|
set => _profileFactory = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
protected void UpdateSiteElevation()
|
||||||
|
{
|
||||||
|
var profileProperties = SharedResourcesWrapper.ReadProfile();
|
||||||
|
profileProperties.SiteElevation = SiteElevation;
|
||||||
|
SharedResourcesWrapper.WriteProfile(profileProperties);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using System.ComponentModel;
|
||||||
|
|
||||||
|
namespace ASCOM.Meade.net
|
||||||
|
{
|
||||||
|
public enum ParkedBehaviour
|
||||||
|
{
|
||||||
|
[Description("No Coordinates")]
|
||||||
|
NoCoordinates,
|
||||||
|
[Description("Last Good Position")]
|
||||||
|
LastGoodPosition,
|
||||||
|
[Description("Report coordinates as")]
|
||||||
|
ReportCoordinates
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,5 +7,21 @@ namespace ASCOM.Meade.net
|
|||||||
public bool TraceLogger { get; set; }
|
public bool TraceLogger { get; set; }
|
||||||
public double GuideRateArcSecondsPerSecond { get; set; }
|
public double GuideRateArcSecondsPerSecond { get; set; }
|
||||||
public string Precision { get; set; }
|
public string Precision { get; set; }
|
||||||
|
public string GuidingStyle { get; set; }
|
||||||
|
public int BacklashCompensation { get; set; }
|
||||||
|
public bool ReverseFocusDirection { get; set; }
|
||||||
|
public bool DynamicBreaking { get; set; }
|
||||||
|
public bool RtsDtrEnabled { get; set; }
|
||||||
|
public double SiteElevation { get; set; }
|
||||||
|
public short SettleTime { get; set; }
|
||||||
|
public int DataBits { get; set; }
|
||||||
|
public string StopBits { get; set; }
|
||||||
|
public string Parity { get; set; }
|
||||||
|
public int Speed { get; set; }
|
||||||
|
public string Handshake { get; set; }
|
||||||
|
public bool SendDateTime { get; set; }
|
||||||
|
public ParkedBehaviour ParkedBehaviour { get; set; }
|
||||||
|
public double ParkedAlt { get; set; }
|
||||||
|
public double ParkedAz { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+9
@@ -135,5 +135,14 @@ namespace ASCOM.Meade.net.Properties {
|
|||||||
return ResourceManager.GetString("SetupDialogForm_TextBox1_TextChanged___0_00_0___of_sidereal_rate_", resourceCulture);
|
return ResourceManager.GetString("SetupDialogForm_TextBox1_TextChanged___0_00_0___of_sidereal_rate_", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Please enter only numbers..
|
||||||
|
/// </summary>
|
||||||
|
internal static string SetupDialogForm_txtElevation_TextChanged_1_Please_enter_only_numbers_ {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("SetupDialogForm_txtElevation_TextChanged_1_Please_enter_only_numbers_", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -144,4 +144,7 @@ Valid are : -register, -unregister and -embedding</value>
|
|||||||
<data name="SetupDialogForm_SetupDialogForm__0__Settings___1__" xml:space="preserve">
|
<data name="SetupDialogForm_SetupDialogForm__0__Settings___1__" xml:space="preserve">
|
||||||
<value>{0} Settings ({1})</value>
|
<value>{0} Settings ({1})</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="SetupDialogForm_txtElevation_TextChanged_1_Please_enter_only_numbers_" xml:space="preserve">
|
||||||
|
<value>Please enter only numbers.</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
@@ -7,6 +8,7 @@ using System.Linq;
|
|||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using ASCOM.Meade.net.Properties;
|
using ASCOM.Meade.net.Properties;
|
||||||
|
using ASCOM.Utilities;
|
||||||
|
|
||||||
namespace ASCOM.Meade.net
|
namespace ASCOM.Meade.net
|
||||||
{
|
{
|
||||||
@@ -20,6 +22,33 @@ namespace ASCOM.Meade.net
|
|||||||
var assemblyInfo = new AssemblyInfo();
|
var assemblyInfo = new AssemblyInfo();
|
||||||
|
|
||||||
Text = string.Format(Resources.SetupDialogForm_SetupDialogForm__0__Settings___1__, assemblyInfo.Product, assemblyInfo.AssemblyVersion);
|
Text = string.Format(Resources.SetupDialogForm_SetupDialogForm__0__Settings___1__, assemblyInfo.Product, assemblyInfo.AssemblyVersion);
|
||||||
|
|
||||||
|
SetItemsFromEnum(cboStopBits.Items, typeof(SerialStopBits));
|
||||||
|
SetItemsFromEnum(cboParity.Items, typeof(SerialParity));
|
||||||
|
SetItemsFromEnumValues(cboSpeed.Items, typeof(SerialSpeed));
|
||||||
|
SetItemsFromEnum(cboHandShake.Items, typeof(SerialHandshake));
|
||||||
|
SetItemsFromEnum(cboParkedBehaviour.Items, typeof(ParkedBehaviour));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetItemsFromEnum(IList items, Type enumItems)
|
||||||
|
{
|
||||||
|
items.Clear();
|
||||||
|
|
||||||
|
foreach (var value in Enum.GetValues(enumItems) )
|
||||||
|
{
|
||||||
|
var val = value as Enum;
|
||||||
|
items.Add(val.GetDescription());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetItemsFromEnumValues(IList items, Type enumItems)
|
||||||
|
{
|
||||||
|
items.Clear();
|
||||||
|
|
||||||
|
foreach (int item in Enum.GetValues(enumItems))
|
||||||
|
{
|
||||||
|
items.Add(item);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed override string Text
|
public sealed override string Text
|
||||||
@@ -62,6 +91,8 @@ namespace ASCOM.Meade.net
|
|||||||
comboBoxComPort.SelectedItem = profileProperties.ComPort;
|
comboBoxComPort.SelectedItem = profileProperties.ComPort;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cbxRtsDtr.Checked = profileProperties.RtsDtrEnabled;
|
||||||
|
|
||||||
txtGuideRate.Text = profileProperties.GuideRateArcSecondsPerSecond.ToString(CultureInfo.CurrentCulture);
|
txtGuideRate.Text = profileProperties.GuideRateArcSecondsPerSecond.ToString(CultureInfo.CurrentCulture);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -71,6 +102,93 @@ namespace ASCOM.Meade.net
|
|||||||
{
|
{
|
||||||
cboPrecision.SelectedItem = "Unchanged";
|
cboPrecision.SelectedItem = "Unchanged";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
cboGuidingStyle.SelectedItem = profileProperties.GuidingStyle;
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
cboGuidingStyle.SelectedItem = "Auto";
|
||||||
|
}
|
||||||
|
|
||||||
|
numDatabits.Value = profileProperties.DataBits;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
cboStopBits.SelectedItem = profileProperties.StopBits;
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
cboStopBits.SelectedItem = "One";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
cboParity.SelectedItem = profileProperties.Parity;
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
cboParity.SelectedItem = "None";
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
cboSpeed.SelectedItem = profileProperties.Speed;
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
cboParity.SelectedItem = "9600";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
cboHandShake.SelectedItem = profileProperties.Handshake;
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
cboHandShake.SelectedItem = "None";
|
||||||
|
}
|
||||||
|
|
||||||
|
txtBacklashSteps.Text = profileProperties.BacklashCompensation.ToString(CultureInfo.CurrentCulture);
|
||||||
|
txtElevation.Text = profileProperties.SiteElevation.ToString(CultureInfo.CurrentCulture);
|
||||||
|
|
||||||
|
cbxReverseDirection.Checked = profileProperties.ReverseFocusDirection;
|
||||||
|
cbxDynamicBreaking.Checked = profileProperties.DynamicBreaking;
|
||||||
|
nudSettleTime.Value = profileProperties.SettleTime;
|
||||||
|
|
||||||
|
cbxSendDateTime.Checked = profileProperties.SendDateTime;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
cboParkedBehaviour.SelectedItem = profileProperties.ParkedBehaviour.GetDescription();
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
cboParkedBehaviour.SelectedItem = ParkedBehaviour.NoCoordinates.GetDescription();
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
txtParkedAlt.Text = profileProperties.ParkedAlt.ToString(CultureInfo.CurrentCulture);
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
txtParkedAlt.Text = "0";
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
txtParkedAz.Text = profileProperties.ParkedAz.ToString(CultureInfo.CurrentCulture);
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
txtParkedAz.Text = "180";
|
||||||
|
}
|
||||||
|
|
||||||
|
UpdateParkedItemsEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProfileProperties GetProfile()
|
public ProfileProperties GetProfile()
|
||||||
@@ -79,8 +197,24 @@ namespace ASCOM.Meade.net
|
|||||||
{
|
{
|
||||||
TraceLogger = chkTrace.Checked,
|
TraceLogger = chkTrace.Checked,
|
||||||
ComPort = comboBoxComPort.SelectedItem.ToString(),
|
ComPort = comboBoxComPort.SelectedItem.ToString(),
|
||||||
|
RtsDtrEnabled = cbxRtsDtr.Checked,
|
||||||
|
DataBits = Convert.ToInt32(numDatabits.Value),
|
||||||
|
StopBits = cboStopBits.SelectedItem.ToString(),
|
||||||
|
Parity = cboParity.SelectedItem.ToString(),
|
||||||
|
Speed = Convert.ToInt32(cboSpeed.SelectedItem),
|
||||||
|
Handshake = cboHandShake.SelectedItem.ToString(),
|
||||||
GuideRateArcSecondsPerSecond = double.Parse(txtGuideRate.Text.Trim()),
|
GuideRateArcSecondsPerSecond = double.Parse(txtGuideRate.Text.Trim()),
|
||||||
Precision = cboPrecision.SelectedItem.ToString()
|
Precision = cboPrecision.SelectedItem.ToString(),
|
||||||
|
GuidingStyle = cboGuidingStyle.SelectedItem.ToString(),
|
||||||
|
BacklashCompensation = int.Parse(txtBacklashSteps.Text),
|
||||||
|
ReverseFocusDirection = cbxReverseDirection.Checked,
|
||||||
|
DynamicBreaking = cbxDynamicBreaking.Checked,
|
||||||
|
SiteElevation = double.Parse(txtElevation.Text),
|
||||||
|
SettleTime = Convert.ToInt16(nudSettleTime.Value),
|
||||||
|
SendDateTime = cbxSendDateTime.Checked,
|
||||||
|
ParkedBehaviour = EnumExtensionMethods.GetValueFromDescription<ParkedBehaviour>(cboParkedBehaviour.SelectedItem.ToString()),
|
||||||
|
ParkedAlt = double.Parse(txtParkedAlt.Text),
|
||||||
|
ParkedAz = double.Parse(txtParkedAz.Text)
|
||||||
};
|
};
|
||||||
|
|
||||||
return profileProperties;
|
return profileProperties;
|
||||||
@@ -139,5 +273,54 @@ namespace ASCOM.Meade.net
|
|||||||
//txtGuideRate.Enabled = false;
|
//txtGuideRate.Enabled = false;
|
||||||
//cboPrecision.Enabled = false;
|
//cboPrecision.Enabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void txtElevation_TextChanged_1(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (System.Text.RegularExpressions.Regex.IsMatch(txtElevation.Text, "[^0-9]"))
|
||||||
|
{
|
||||||
|
MessageBox.Show(Resources.SetupDialogForm_txtElevation_TextChanged_1_Please_enter_only_numbers_);
|
||||||
|
txtElevation.Text = txtElevation.Text.Remove(txtElevation.Text.Length - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void txtBacklashSteps_TextChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (System.Text.RegularExpressions.Regex.IsMatch(txtBacklashSteps.Text, "[^0-9]"))
|
||||||
|
{
|
||||||
|
MessageBox.Show(Resources.SetupDialogForm_txtElevation_TextChanged_1_Please_enter_only_numbers_);
|
||||||
|
txtBacklashSteps.Text = txtElevation.Text.Remove(txtBacklashSteps.Text.Length - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void cboParkedBehaviour_SelectionChangeCommitted(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
UpdateParkedItemsEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdateParkedItemsEnabled()
|
||||||
|
{
|
||||||
|
txtParkedAlt.Enabled = cboParkedBehaviour.SelectedItem?.ToString() == "Report coordinates as";
|
||||||
|
txtParkedAz.Enabled = txtParkedAlt.Enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void txtParkedAlt_TextChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (System.Text.RegularExpressions.Regex.IsMatch(txtParkedAlt.Text, "[^0-9]"))
|
||||||
|
{
|
||||||
|
MessageBox.Show(Resources.SetupDialogForm_txtElevation_TextChanged_1_Please_enter_only_numbers_);
|
||||||
|
txtParkedAlt.Text = txtParkedAlt.Text.Remove(txtParkedAlt.Text.Length - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void txtParkedAz_TextChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (System.Text.RegularExpressions.Regex.IsMatch(txtParkedAz.Text, "[^0-9]"))
|
||||||
|
{
|
||||||
|
MessageBox.Show(Resources.SetupDialogForm_txtElevation_TextChanged_1_Please_enter_only_numbers_);
|
||||||
|
txtParkedAz.Text = txtParkedAz.Text.Remove(txtParkedAz.Text.Length - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Generated
+329
@@ -31,6 +31,7 @@ namespace ASCOM.Meade.net
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
|
this.components = new System.ComponentModel.Container();
|
||||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SetupDialogForm));
|
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SetupDialogForm));
|
||||||
this.cmdOK = new System.Windows.Forms.Button();
|
this.cmdOK = new System.Windows.Forms.Button();
|
||||||
this.cmdCancel = new System.Windows.Forms.Button();
|
this.cmdCancel = new System.Windows.Forms.Button();
|
||||||
@@ -45,7 +46,45 @@ namespace ASCOM.Meade.net
|
|||||||
this.lblPercentOfSiderealRate = new System.Windows.Forms.Label();
|
this.lblPercentOfSiderealRate = new System.Windows.Forms.Label();
|
||||||
this.label5 = new System.Windows.Forms.Label();
|
this.label5 = new System.Windows.Forms.Label();
|
||||||
this.cboPrecision = new System.Windows.Forms.ComboBox();
|
this.cboPrecision = new System.Windows.Forms.ComboBox();
|
||||||
|
this.label6 = new System.Windows.Forms.Label();
|
||||||
|
this.cboGuidingStyle = new System.Windows.Forms.ComboBox();
|
||||||
|
this.label7 = new System.Windows.Forms.Label();
|
||||||
|
this.label8 = new System.Windows.Forms.Label();
|
||||||
|
this.txtBacklashSteps = new System.Windows.Forms.TextBox();
|
||||||
|
this.label9 = new System.Windows.Forms.Label();
|
||||||
|
this.label10 = new System.Windows.Forms.Label();
|
||||||
|
this.label11 = new System.Windows.Forms.Label();
|
||||||
|
this.cbxReverseDirection = new System.Windows.Forms.CheckBox();
|
||||||
|
this.cbxDynamicBreaking = new System.Windows.Forms.CheckBox();
|
||||||
|
this.cbxRtsDtr = new System.Windows.Forms.CheckBox();
|
||||||
|
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
|
||||||
|
this.cbxSendDateTime = new System.Windows.Forms.CheckBox();
|
||||||
|
this.label12 = new System.Windows.Forms.Label();
|
||||||
|
this.txtElevation = new System.Windows.Forms.TextBox();
|
||||||
|
this.label13 = new System.Windows.Forms.Label();
|
||||||
|
this.label14 = new System.Windows.Forms.Label();
|
||||||
|
this.nudSettleTime = new System.Windows.Forms.NumericUpDown();
|
||||||
|
this.label15 = new System.Windows.Forms.Label();
|
||||||
|
this.label16 = new System.Windows.Forms.Label();
|
||||||
|
this.cboStopBits = new System.Windows.Forms.ComboBox();
|
||||||
|
this.numDatabits = new System.Windows.Forms.NumericUpDown();
|
||||||
|
this.cboParity = new System.Windows.Forms.ComboBox();
|
||||||
|
this.cboSpeed = new System.Windows.Forms.ComboBox();
|
||||||
|
this.cboHandShake = new System.Windows.Forms.ComboBox();
|
||||||
|
this.label17 = new System.Windows.Forms.Label();
|
||||||
|
this.label18 = new System.Windows.Forms.Label();
|
||||||
|
this.label19 = new System.Windows.Forms.Label();
|
||||||
|
this.label20 = new System.Windows.Forms.Label();
|
||||||
|
this.label21 = new System.Windows.Forms.Label();
|
||||||
|
this.cboParkedBehaviour = new System.Windows.Forms.ComboBox();
|
||||||
|
this.label22 = new System.Windows.Forms.Label();
|
||||||
|
this.label23 = new System.Windows.Forms.Label();
|
||||||
|
this.label24 = new System.Windows.Forms.Label();
|
||||||
|
this.txtParkedAlt = new System.Windows.Forms.TextBox();
|
||||||
|
this.txtParkedAz = new System.Windows.Forms.TextBox();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.picASCOM)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.picASCOM)).BeginInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.nudSettleTime)).BeginInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.numDatabits)).BeginInit();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// cmdOK
|
// cmdOK
|
||||||
@@ -105,6 +144,7 @@ namespace ASCOM.Meade.net
|
|||||||
//
|
//
|
||||||
resources.ApplyResources(this.txtGuideRate, "txtGuideRate");
|
resources.ApplyResources(this.txtGuideRate, "txtGuideRate");
|
||||||
this.txtGuideRate.Name = "txtGuideRate";
|
this.txtGuideRate.Name = "txtGuideRate";
|
||||||
|
this.toolTip1.SetToolTip(this.txtGuideRate, resources.GetString("txtGuideRate.ToolTip"));
|
||||||
this.txtGuideRate.TextChanged += new System.EventHandler(this.TextBox1_TextChanged);
|
this.txtGuideRate.TextChanged += new System.EventHandler(this.TextBox1_TextChanged);
|
||||||
//
|
//
|
||||||
// label4
|
// label4
|
||||||
@@ -133,10 +173,261 @@ namespace ASCOM.Meade.net
|
|||||||
resources.ApplyResources(this.cboPrecision, "cboPrecision");
|
resources.ApplyResources(this.cboPrecision, "cboPrecision");
|
||||||
this.cboPrecision.Name = "cboPrecision";
|
this.cboPrecision.Name = "cboPrecision";
|
||||||
//
|
//
|
||||||
|
// label6
|
||||||
|
//
|
||||||
|
resources.ApplyResources(this.label6, "label6");
|
||||||
|
this.label6.Name = "label6";
|
||||||
|
//
|
||||||
|
// cboGuidingStyle
|
||||||
|
//
|
||||||
|
this.cboGuidingStyle.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||||
|
this.cboGuidingStyle.FormattingEnabled = true;
|
||||||
|
this.cboGuidingStyle.Items.AddRange(new object[] {
|
||||||
|
resources.GetString("cboGuidingStyle.Items"),
|
||||||
|
resources.GetString("cboGuidingStyle.Items1"),
|
||||||
|
resources.GetString("cboGuidingStyle.Items2")});
|
||||||
|
resources.ApplyResources(this.cboGuidingStyle, "cboGuidingStyle");
|
||||||
|
this.cboGuidingStyle.Name = "cboGuidingStyle";
|
||||||
|
//
|
||||||
|
// label7
|
||||||
|
//
|
||||||
|
resources.ApplyResources(this.label7, "label7");
|
||||||
|
this.label7.Name = "label7";
|
||||||
|
//
|
||||||
|
// label8
|
||||||
|
//
|
||||||
|
resources.ApplyResources(this.label8, "label8");
|
||||||
|
this.label8.Name = "label8";
|
||||||
|
//
|
||||||
|
// txtBacklashSteps
|
||||||
|
//
|
||||||
|
resources.ApplyResources(this.txtBacklashSteps, "txtBacklashSteps");
|
||||||
|
this.txtBacklashSteps.Name = "txtBacklashSteps";
|
||||||
|
this.txtBacklashSteps.TextChanged += new System.EventHandler(this.txtBacklashSteps_TextChanged);
|
||||||
|
//
|
||||||
|
// label9
|
||||||
|
//
|
||||||
|
resources.ApplyResources(this.label9, "label9");
|
||||||
|
this.label9.Name = "label9";
|
||||||
|
//
|
||||||
|
// label10
|
||||||
|
//
|
||||||
|
resources.ApplyResources(this.label10, "label10");
|
||||||
|
this.label10.Name = "label10";
|
||||||
|
//
|
||||||
|
// label11
|
||||||
|
//
|
||||||
|
resources.ApplyResources(this.label11, "label11");
|
||||||
|
this.label11.Name = "label11";
|
||||||
|
//
|
||||||
|
// cbxReverseDirection
|
||||||
|
//
|
||||||
|
resources.ApplyResources(this.cbxReverseDirection, "cbxReverseDirection");
|
||||||
|
this.cbxReverseDirection.Name = "cbxReverseDirection";
|
||||||
|
this.cbxReverseDirection.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// cbxDynamicBreaking
|
||||||
|
//
|
||||||
|
resources.ApplyResources(this.cbxDynamicBreaking, "cbxDynamicBreaking");
|
||||||
|
this.cbxDynamicBreaking.Name = "cbxDynamicBreaking";
|
||||||
|
this.cbxDynamicBreaking.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// cbxRtsDtr
|
||||||
|
//
|
||||||
|
resources.ApplyResources(this.cbxRtsDtr, "cbxRtsDtr");
|
||||||
|
this.cbxRtsDtr.Name = "cbxRtsDtr";
|
||||||
|
this.toolTip1.SetToolTip(this.cbxRtsDtr, resources.GetString("cbxRtsDtr.ToolTip"));
|
||||||
|
this.cbxRtsDtr.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// cbxSendDateTime
|
||||||
|
//
|
||||||
|
resources.ApplyResources(this.cbxSendDateTime, "cbxSendDateTime");
|
||||||
|
this.cbxSendDateTime.Name = "cbxSendDateTime";
|
||||||
|
this.toolTip1.SetToolTip(this.cbxSendDateTime, resources.GetString("cbxSendDateTime.ToolTip"));
|
||||||
|
this.cbxSendDateTime.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// label12
|
||||||
|
//
|
||||||
|
resources.ApplyResources(this.label12, "label12");
|
||||||
|
this.label12.Name = "label12";
|
||||||
|
//
|
||||||
|
// txtElevation
|
||||||
|
//
|
||||||
|
resources.ApplyResources(this.txtElevation, "txtElevation");
|
||||||
|
this.txtElevation.Name = "txtElevation";
|
||||||
|
this.txtElevation.TextChanged += new System.EventHandler(this.txtElevation_TextChanged_1);
|
||||||
|
//
|
||||||
|
// label13
|
||||||
|
//
|
||||||
|
resources.ApplyResources(this.label13, "label13");
|
||||||
|
this.label13.Name = "label13";
|
||||||
|
//
|
||||||
|
// label14
|
||||||
|
//
|
||||||
|
resources.ApplyResources(this.label14, "label14");
|
||||||
|
this.label14.Name = "label14";
|
||||||
|
//
|
||||||
|
// nudSettleTime
|
||||||
|
//
|
||||||
|
resources.ApplyResources(this.nudSettleTime, "nudSettleTime");
|
||||||
|
this.nudSettleTime.Maximum = new decimal(new int[] {
|
||||||
|
32767,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0});
|
||||||
|
this.nudSettleTime.Name = "nudSettleTime";
|
||||||
|
//
|
||||||
|
// label15
|
||||||
|
//
|
||||||
|
resources.ApplyResources(this.label15, "label15");
|
||||||
|
this.label15.Name = "label15";
|
||||||
|
//
|
||||||
|
// label16
|
||||||
|
//
|
||||||
|
resources.ApplyResources(this.label16, "label16");
|
||||||
|
this.label16.Name = "label16";
|
||||||
|
//
|
||||||
|
// cboStopBits
|
||||||
|
//
|
||||||
|
this.cboStopBits.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||||
|
this.cboStopBits.FormattingEnabled = true;
|
||||||
|
resources.ApplyResources(this.cboStopBits, "cboStopBits");
|
||||||
|
this.cboStopBits.Name = "cboStopBits";
|
||||||
|
//
|
||||||
|
// numDatabits
|
||||||
|
//
|
||||||
|
resources.ApplyResources(this.numDatabits, "numDatabits");
|
||||||
|
this.numDatabits.Maximum = new decimal(new int[] {
|
||||||
|
32767,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0});
|
||||||
|
this.numDatabits.Name = "numDatabits";
|
||||||
|
//
|
||||||
|
// cboParity
|
||||||
|
//
|
||||||
|
this.cboParity.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||||
|
this.cboParity.FormattingEnabled = true;
|
||||||
|
resources.ApplyResources(this.cboParity, "cboParity");
|
||||||
|
this.cboParity.Name = "cboParity";
|
||||||
|
//
|
||||||
|
// cboSpeed
|
||||||
|
//
|
||||||
|
this.cboSpeed.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||||
|
this.cboSpeed.FormattingEnabled = true;
|
||||||
|
resources.ApplyResources(this.cboSpeed, "cboSpeed");
|
||||||
|
this.cboSpeed.Name = "cboSpeed";
|
||||||
|
//
|
||||||
|
// cboHandShake
|
||||||
|
//
|
||||||
|
this.cboHandShake.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||||
|
this.cboHandShake.FormattingEnabled = true;
|
||||||
|
resources.ApplyResources(this.cboHandShake, "cboHandShake");
|
||||||
|
this.cboHandShake.Name = "cboHandShake";
|
||||||
|
//
|
||||||
|
// label17
|
||||||
|
//
|
||||||
|
resources.ApplyResources(this.label17, "label17");
|
||||||
|
this.label17.Name = "label17";
|
||||||
|
//
|
||||||
|
// label18
|
||||||
|
//
|
||||||
|
resources.ApplyResources(this.label18, "label18");
|
||||||
|
this.label18.Name = "label18";
|
||||||
|
//
|
||||||
|
// label19
|
||||||
|
//
|
||||||
|
resources.ApplyResources(this.label19, "label19");
|
||||||
|
this.label19.Name = "label19";
|
||||||
|
//
|
||||||
|
// label20
|
||||||
|
//
|
||||||
|
resources.ApplyResources(this.label20, "label20");
|
||||||
|
this.label20.Name = "label20";
|
||||||
|
//
|
||||||
|
// label21
|
||||||
|
//
|
||||||
|
resources.ApplyResources(this.label21, "label21");
|
||||||
|
this.label21.Name = "label21";
|
||||||
|
//
|
||||||
|
// cboParkedBehaviour
|
||||||
|
//
|
||||||
|
this.cboParkedBehaviour.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||||
|
this.cboParkedBehaviour.FormattingEnabled = true;
|
||||||
|
this.cboParkedBehaviour.Items.AddRange(new object[] {
|
||||||
|
resources.GetString("cboParkedBehaviour.Items"),
|
||||||
|
resources.GetString("cboParkedBehaviour.Items1"),
|
||||||
|
resources.GetString("cboParkedBehaviour.Items2")});
|
||||||
|
resources.ApplyResources(this.cboParkedBehaviour, "cboParkedBehaviour");
|
||||||
|
this.cboParkedBehaviour.Name = "cboParkedBehaviour";
|
||||||
|
this.cboParkedBehaviour.SelectionChangeCommitted += new System.EventHandler(this.cboParkedBehaviour_SelectionChangeCommitted);
|
||||||
|
//
|
||||||
|
// label22
|
||||||
|
//
|
||||||
|
resources.ApplyResources(this.label22, "label22");
|
||||||
|
this.label22.Name = "label22";
|
||||||
|
//
|
||||||
|
// label23
|
||||||
|
//
|
||||||
|
resources.ApplyResources(this.label23, "label23");
|
||||||
|
this.label23.Name = "label23";
|
||||||
|
//
|
||||||
|
// label24
|
||||||
|
//
|
||||||
|
resources.ApplyResources(this.label24, "label24");
|
||||||
|
this.label24.Name = "label24";
|
||||||
|
//
|
||||||
|
// txtParkedAlt
|
||||||
|
//
|
||||||
|
resources.ApplyResources(this.txtParkedAlt, "txtParkedAlt");
|
||||||
|
this.txtParkedAlt.Name = "txtParkedAlt";
|
||||||
|
this.txtParkedAlt.TextChanged += new System.EventHandler(this.txtParkedAlt_TextChanged);
|
||||||
|
//
|
||||||
|
// txtParkedAz
|
||||||
|
//
|
||||||
|
resources.ApplyResources(this.txtParkedAz, "txtParkedAz");
|
||||||
|
this.txtParkedAz.Name = "txtParkedAz";
|
||||||
|
this.txtParkedAz.TextChanged += new System.EventHandler(this.txtParkedAz_TextChanged);
|
||||||
|
//
|
||||||
// SetupDialogForm
|
// SetupDialogForm
|
||||||
//
|
//
|
||||||
resources.ApplyResources(this, "$this");
|
resources.ApplyResources(this, "$this");
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.Controls.Add(this.txtParkedAz);
|
||||||
|
this.Controls.Add(this.txtParkedAlt);
|
||||||
|
this.Controls.Add(this.label24);
|
||||||
|
this.Controls.Add(this.label23);
|
||||||
|
this.Controls.Add(this.label22);
|
||||||
|
this.Controls.Add(this.cboParkedBehaviour);
|
||||||
|
this.Controls.Add(this.cbxSendDateTime);
|
||||||
|
this.Controls.Add(this.label21);
|
||||||
|
this.Controls.Add(this.label20);
|
||||||
|
this.Controls.Add(this.label19);
|
||||||
|
this.Controls.Add(this.label18);
|
||||||
|
this.Controls.Add(this.label17);
|
||||||
|
this.Controls.Add(this.cboHandShake);
|
||||||
|
this.Controls.Add(this.cboSpeed);
|
||||||
|
this.Controls.Add(this.cboParity);
|
||||||
|
this.Controls.Add(this.numDatabits);
|
||||||
|
this.Controls.Add(this.cboStopBits);
|
||||||
|
this.Controls.Add(this.label16);
|
||||||
|
this.Controls.Add(this.label15);
|
||||||
|
this.Controls.Add(this.nudSettleTime);
|
||||||
|
this.Controls.Add(this.label14);
|
||||||
|
this.Controls.Add(this.label13);
|
||||||
|
this.Controls.Add(this.txtElevation);
|
||||||
|
this.Controls.Add(this.label12);
|
||||||
|
this.Controls.Add(this.cbxRtsDtr);
|
||||||
|
this.Controls.Add(this.cbxDynamicBreaking);
|
||||||
|
this.Controls.Add(this.cbxReverseDirection);
|
||||||
|
this.Controls.Add(this.label11);
|
||||||
|
this.Controls.Add(this.label10);
|
||||||
|
this.Controls.Add(this.txtBacklashSteps);
|
||||||
|
this.Controls.Add(this.label9);
|
||||||
|
this.Controls.Add(this.label8);
|
||||||
|
this.Controls.Add(this.label7);
|
||||||
|
this.Controls.Add(this.cboGuidingStyle);
|
||||||
|
this.Controls.Add(this.label6);
|
||||||
this.Controls.Add(this.cboPrecision);
|
this.Controls.Add(this.cboPrecision);
|
||||||
this.Controls.Add(this.label5);
|
this.Controls.Add(this.label5);
|
||||||
this.Controls.Add(this.lblPercentOfSiderealRate);
|
this.Controls.Add(this.lblPercentOfSiderealRate);
|
||||||
@@ -158,6 +449,8 @@ namespace ASCOM.Meade.net
|
|||||||
this.TopMost = true;
|
this.TopMost = true;
|
||||||
this.Shown += new System.EventHandler(this.SetupDialogForm_Shown);
|
this.Shown += new System.EventHandler(this.SetupDialogForm_Shown);
|
||||||
((System.ComponentModel.ISupportInitialize)(this.picASCOM)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.picASCOM)).EndInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.nudSettleTime)).EndInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.numDatabits)).EndInit();
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
this.PerformLayout();
|
this.PerformLayout();
|
||||||
|
|
||||||
@@ -178,5 +471,41 @@ namespace ASCOM.Meade.net
|
|||||||
private Label lblPercentOfSiderealRate;
|
private Label lblPercentOfSiderealRate;
|
||||||
private Label label5;
|
private Label label5;
|
||||||
private ComboBox cboPrecision;
|
private ComboBox cboPrecision;
|
||||||
|
private Label label6;
|
||||||
|
private ComboBox cboGuidingStyle;
|
||||||
|
private Label label7;
|
||||||
|
private Label label8;
|
||||||
|
private TextBox txtBacklashSteps;
|
||||||
|
private Label label9;
|
||||||
|
private Label label10;
|
||||||
|
private Label label11;
|
||||||
|
private CheckBox cbxReverseDirection;
|
||||||
|
private CheckBox cbxDynamicBreaking;
|
||||||
|
private CheckBox cbxRtsDtr;
|
||||||
|
private ToolTip toolTip1;
|
||||||
|
private Label label12;
|
||||||
|
private TextBox txtElevation;
|
||||||
|
private Label label13;
|
||||||
|
private Label label14;
|
||||||
|
private NumericUpDown nudSettleTime;
|
||||||
|
private Label label15;
|
||||||
|
private Label label16;
|
||||||
|
private ComboBox cboStopBits;
|
||||||
|
private NumericUpDown numDatabits;
|
||||||
|
private ComboBox cboParity;
|
||||||
|
private ComboBox cboSpeed;
|
||||||
|
private ComboBox cboHandShake;
|
||||||
|
private Label label17;
|
||||||
|
private Label label18;
|
||||||
|
private Label label19;
|
||||||
|
private Label label20;
|
||||||
|
private Label label21;
|
||||||
|
private CheckBox cbxSendDateTime;
|
||||||
|
private ComboBox cboParkedBehaviour;
|
||||||
|
private Label label22;
|
||||||
|
private Label label23;
|
||||||
|
private Label label24;
|
||||||
|
private TextBox txtParkedAlt;
|
||||||
|
private TextBox txtParkedAz;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+985
-31
File diff suppressed because it is too large
Load Diff
+160
-20
@@ -17,6 +17,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Security.AccessControl;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using ASCOM.Meade.net.Wrapper;
|
using ASCOM.Meade.net.Wrapper;
|
||||||
using ASCOM.Utilities;
|
using ASCOM.Utilities;
|
||||||
@@ -75,12 +77,14 @@ namespace ASCOM.Meade.net
|
|||||||
set => _profileFactory = value;
|
set => _profileFactory = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SendBlind(string message)
|
//todo add code to ensure that there is a minimum gap between commands. 5ms as default.
|
||||||
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,24 +95,59 @@ 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)
|
public static string SendString(string message, bool raw = false)
|
||||||
{
|
{
|
||||||
lock (LockObject)
|
lock (LockObject)
|
||||||
{
|
{
|
||||||
SharedSerial.ClearBuffers();
|
SharedSerial.ClearBuffers();
|
||||||
SharedSerial.Transmit(message);
|
|
||||||
return SharedSerial.ReceiveTerminated("#").TrimEnd('#');
|
var encodedMessage = raw ? message : $"#:{message}#";
|
||||||
|
SharedSerial.Transmit(encodedMessage);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return SharedSerial.ReceiveTerminated("#").TrimEnd('#');
|
||||||
|
}
|
||||||
|
catch (COMException ex)
|
||||||
|
{
|
||||||
|
if (ex.Message.Contains("Timed out waiting for received data"))
|
||||||
|
throw new TimeoutException(ex.Message, ex);
|
||||||
|
|
||||||
|
throw;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
||||||
{
|
{
|
||||||
lock (LockObject)
|
lock (LockObject)
|
||||||
{
|
{
|
||||||
SharedSerial.ClearBuffers();
|
SharedSerial.ClearBuffers();
|
||||||
SharedSerial.Transmit(message);
|
|
||||||
return SharedSerial.ReceiveCounted(1);
|
var encodedMessage = raw ? command : $"#:{command}#";
|
||||||
|
SharedSerial.Transmit(encodedMessage);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return SharedSerial.ReceiveCounted(1);
|
||||||
|
}
|
||||||
|
catch (COMException ex)
|
||||||
|
{
|
||||||
|
if (ex.Message.Contains("Timed out waiting for received data"))
|
||||||
|
throw new TimeoutException(ex.Message, ex);
|
||||||
|
|
||||||
|
throw;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -136,10 +175,27 @@ namespace ASCOM.Meade.net
|
|||||||
|
|
||||||
// Constants used for Profile persistence
|
// Constants used for Profile persistence
|
||||||
private const string ComPortProfileName = "COM Port";
|
private const string ComPortProfileName = "COM Port";
|
||||||
|
private const string RtsDtrProfileName = "Rts / Dtr";
|
||||||
private const string TraceStateProfileName = "Trace Level";
|
private const string TraceStateProfileName = "Trace Level";
|
||||||
private const string GuideRateProfileName = "Guide Rate Arc Seconds Per Second";
|
private const string GuideRateProfileName = "Guide Rate Arc Seconds Per Second";
|
||||||
private const string PrecisionProfileName = "Precision";
|
private const string PrecisionProfileName = "Precision";
|
||||||
|
private const string GuidingStyleProfileName = "Guiding Style";
|
||||||
|
private const string BacklashCompensationName = "Backlash Compensation";
|
||||||
|
private const string ReverseFocusDirectionName = "Reverse Focuser Direction";
|
||||||
|
private const string DynamicBreakingName = "Dynamic Breaking";
|
||||||
|
private const string SiteElevationName = "Site Elevation";
|
||||||
|
private const string SettleTimeName = "Settle Time";
|
||||||
|
|
||||||
|
private const string SpeedName = "Speed";
|
||||||
|
private const string DataBitsName = "Data Bits";
|
||||||
|
private const string StopBitsName = "Stop Bits";
|
||||||
|
private const string HandShakeName = "Hand Shake";
|
||||||
|
private const string ParityName = "Parity";
|
||||||
|
private const string SendDateTimeName = "Send Date and time on connect";
|
||||||
|
private const string ParkedBehaviourName = "Parked Behaviour";
|
||||||
|
private const string ParkedAltName = "Parked Altitude";
|
||||||
|
private const string ParkedAzimuthName = "Parked Azimuth";
|
||||||
|
|
||||||
public static void WriteProfile(ProfileProperties profileProperties)
|
public static void WriteProfile(ProfileProperties profileProperties)
|
||||||
{
|
{
|
||||||
lock (LockObject)
|
lock (LockObject)
|
||||||
@@ -149,16 +205,48 @@ namespace ASCOM.Meade.net
|
|||||||
driverProfile.DeviceType = "Telescope";
|
driverProfile.DeviceType = "Telescope";
|
||||||
driverProfile.WriteValue(DriverId, TraceStateProfileName, profileProperties.TraceLogger.ToString());
|
driverProfile.WriteValue(DriverId, TraceStateProfileName, profileProperties.TraceLogger.ToString());
|
||||||
driverProfile.WriteValue(DriverId, ComPortProfileName, profileProperties.ComPort);
|
driverProfile.WriteValue(DriverId, ComPortProfileName, profileProperties.ComPort);
|
||||||
|
driverProfile.WriteValue(DriverId, RtsDtrProfileName, profileProperties.RtsDtrEnabled.ToString());
|
||||||
|
driverProfile.WriteValue(DriverId, SpeedName, profileProperties.Speed.ToString(CultureInfo.InvariantCulture));
|
||||||
|
driverProfile.WriteValue(DriverId, DataBitsName, profileProperties.DataBits.ToString(CultureInfo.InvariantCulture));
|
||||||
|
driverProfile.WriteValue(DriverId, StopBitsName, profileProperties.StopBits);
|
||||||
|
driverProfile.WriteValue(DriverId, HandShakeName, profileProperties.Handshake);
|
||||||
|
driverProfile.WriteValue(DriverId, ParityName, profileProperties.Parity);
|
||||||
driverProfile.WriteValue(DriverId, GuideRateProfileName, profileProperties.GuideRateArcSecondsPerSecond.ToString(CultureInfo.InvariantCulture));
|
driverProfile.WriteValue(DriverId, GuideRateProfileName, profileProperties.GuideRateArcSecondsPerSecond.ToString(CultureInfo.InvariantCulture));
|
||||||
driverProfile.WriteValue(DriverId, PrecisionProfileName, profileProperties.Precision);
|
driverProfile.WriteValue(DriverId, PrecisionProfileName, profileProperties.Precision);
|
||||||
|
driverProfile.WriteValue(DriverId, GuidingStyleProfileName, profileProperties.GuidingStyle);
|
||||||
|
driverProfile.WriteValue(DriverId, BacklashCompensationName, profileProperties.BacklashCompensation.ToString());
|
||||||
|
driverProfile.WriteValue(DriverId, ReverseFocusDirectionName, profileProperties.ReverseFocusDirection.ToString());
|
||||||
|
driverProfile.WriteValue(DriverId, DynamicBreakingName, profileProperties.DynamicBreaking.ToString());
|
||||||
|
driverProfile.WriteValue(DriverId, SiteElevationName, profileProperties.SiteElevation.ToString(CultureInfo.InvariantCulture));
|
||||||
|
driverProfile.WriteValue(DriverId, SettleTimeName, profileProperties.SettleTime.ToString());
|
||||||
|
driverProfile.WriteValue(DriverId, SendDateTimeName, profileProperties.SendDateTime.ToString());
|
||||||
|
driverProfile.WriteValue(DriverId, ParkedBehaviourName, profileProperties.ParkedBehaviour.GetDescription());
|
||||||
|
driverProfile.WriteValue(DriverId, ParkedAltName, profileProperties.ParkedAlt.ToString(CultureInfo.InvariantCulture));
|
||||||
|
driverProfile.WriteValue(DriverId, ParkedAzimuthName, profileProperties.ParkedAz.ToString(CultureInfo.InvariantCulture));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private const string ComPortDefault = "COM1";
|
private const string ComPortDefault = "COM1";
|
||||||
|
private const string RtsDtrDefault = "false";
|
||||||
private const string TraceStateDefault = "false";
|
private const string TraceStateDefault = "false";
|
||||||
private const string GuideRateProfileNameDefault = "10.077939"; //67% of sidereal rate
|
private const string GuideRateProfileNameDefault = "10.077939"; //67% of sidereal rate
|
||||||
private const string PrecisionDefault = "Unchanged";
|
private const string PrecisionDefault = "Unchanged";
|
||||||
|
private const string GuidingStyleDefault = "Auto";
|
||||||
|
private const string BacklashCompensationDefault = "3000";
|
||||||
|
private const string ReverseFocuserDiectionDefault = "true";
|
||||||
|
private const string DynamicBreakingDefault = "true";
|
||||||
|
private const string SiteElevationDefault = "0";
|
||||||
|
private const string SettleTimeDefault = "2";
|
||||||
|
private const string SpeedDefault = "9600";
|
||||||
|
private const string DataBitsDefault = "8";
|
||||||
|
private const string StopBitsDefault = "One";
|
||||||
|
private const string HandShakeDefault = "None";
|
||||||
|
private const string ParityDefault = "None";
|
||||||
|
private const string SendDateTimeDefault = "false";
|
||||||
|
private static string ParkedBehaviourDefault = "No Coordinates";
|
||||||
|
private const string ParkedAltDefault = "0";
|
||||||
|
private const string ParkedAzimuthDefault = "180";
|
||||||
|
|
||||||
public static ProfileProperties ReadProfile()
|
public static ProfileProperties ReadProfile()
|
||||||
{
|
{
|
||||||
@@ -169,9 +257,26 @@ namespace ASCOM.Meade.net
|
|||||||
{
|
{
|
||||||
driverProfile.DeviceType = "Telescope";
|
driverProfile.DeviceType = "Telescope";
|
||||||
profileProperties.ComPort = driverProfile.GetValue(DriverId, ComPortProfileName, string.Empty, ComPortDefault);
|
profileProperties.ComPort = driverProfile.GetValue(DriverId, ComPortProfileName, string.Empty, ComPortDefault);
|
||||||
|
profileProperties.RtsDtrEnabled = Convert.ToBoolean(driverProfile.GetValue(DriverId, RtsDtrProfileName, string.Empty, RtsDtrDefault));
|
||||||
profileProperties.TraceLogger = Convert.ToBoolean(driverProfile.GetValue(DriverId, TraceStateProfileName, string.Empty, TraceStateDefault));
|
profileProperties.TraceLogger = Convert.ToBoolean(driverProfile.GetValue(DriverId, TraceStateProfileName, string.Empty, TraceStateDefault));
|
||||||
profileProperties.GuideRateArcSecondsPerSecond = double.Parse(driverProfile.GetValue(DriverId, GuideRateProfileName, string.Empty, GuideRateProfileNameDefault), NumberFormatInfo.InvariantInfo);
|
profileProperties.GuideRateArcSecondsPerSecond = double.Parse(driverProfile.GetValue(DriverId, GuideRateProfileName, string.Empty, GuideRateProfileNameDefault), NumberFormatInfo.InvariantInfo);
|
||||||
profileProperties.Precision = driverProfile.GetValue(DriverId, PrecisionProfileName, string.Empty, PrecisionDefault);
|
profileProperties.Precision = driverProfile.GetValue(DriverId, PrecisionProfileName, string.Empty, PrecisionDefault);
|
||||||
|
profileProperties.GuidingStyle = driverProfile.GetValue(DriverId, GuidingStyleProfileName, string.Empty, GuidingStyleDefault);
|
||||||
|
profileProperties.BacklashCompensation = Convert.ToInt32(driverProfile.GetValue(DriverId, BacklashCompensationName, string.Empty, BacklashCompensationDefault));
|
||||||
|
profileProperties.ReverseFocusDirection = Convert.ToBoolean(driverProfile.GetValue(DriverId, ReverseFocusDirectionName, string.Empty, ReverseFocuserDiectionDefault));
|
||||||
|
profileProperties.DynamicBreaking = Convert.ToBoolean(driverProfile.GetValue(DriverId, DynamicBreakingName, string.Empty, DynamicBreakingDefault));
|
||||||
|
profileProperties.SiteElevation = Convert.ToInt32(driverProfile.GetValue(DriverId, SiteElevationName, string.Empty, SiteElevationDefault));
|
||||||
|
profileProperties.SettleTime = Convert.ToInt16(driverProfile.GetValue(DriverId, SettleTimeName, string.Empty, SettleTimeDefault));
|
||||||
|
profileProperties.StopBits = driverProfile.GetValue(DriverId, StopBitsName, string.Empty, StopBitsDefault);
|
||||||
|
profileProperties.DataBits = Convert.ToInt32(driverProfile.GetValue(DriverId, DataBitsName, string.Empty, DataBitsDefault));
|
||||||
|
profileProperties.Handshake = driverProfile.GetValue(DriverId, HandShakeName, string.Empty, HandShakeDefault);
|
||||||
|
profileProperties.Speed = Convert.ToInt32(driverProfile.GetValue(DriverId, SpeedName, string.Empty, SpeedDefault));
|
||||||
|
profileProperties.Parity = driverProfile.GetValue(DriverId, ParityName, string.Empty, ParityDefault);
|
||||||
|
profileProperties.SendDateTime = Convert.ToBoolean(driverProfile.GetValue(DriverId, SendDateTimeName, string.Empty, SendDateTimeDefault));
|
||||||
|
|
||||||
|
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.ParkedAz = double.Parse(driverProfile.GetValue(DriverId, ParkedAzimuthName, string.Empty, ParkedAzimuthDefault), NumberFormatInfo.InvariantInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
return profileProperties;
|
return profileProperties;
|
||||||
@@ -238,7 +343,8 @@ namespace ASCOM.Meade.net
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="deviceId"></param>
|
/// <param name="deviceId"></param>
|
||||||
/// <param name="driverId"></param>
|
/// <param name="driverId"></param>
|
||||||
public static ConnectionInfo Connect(string deviceId, string driverId)
|
/// <param name="traceLogger"></param>
|
||||||
|
public static ConnectionInfo Connect(string deviceId, string driverId, ITraceLogger traceLogger)
|
||||||
{
|
{
|
||||||
lock (LockObject)
|
lock (LockObject)
|
||||||
{
|
{
|
||||||
@@ -254,33 +360,57 @@ namespace ASCOM.Meade.net
|
|||||||
{
|
{
|
||||||
var profileProperties = ReadProfile();
|
var profileProperties = ReadProfile();
|
||||||
SharedSerial.PortName = profileProperties.ComPort;
|
SharedSerial.PortName = profileProperties.ComPort;
|
||||||
SharedSerial.DTREnable = false;
|
SharedSerial.DTREnable = profileProperties.RtsDtrEnabled;
|
||||||
SharedSerial.RTSEnable = false;
|
SharedSerial.RTSEnable = profileProperties.RtsDtrEnabled;
|
||||||
SharedSerial.DataBits = 8;
|
SharedSerial.DataBits = profileProperties.DataBits;
|
||||||
SharedSerial.StopBits = SerialStopBits.One;
|
SharedSerial.StopBits = (SerialStopBits)Enum.Parse(typeof(SerialStopBits), profileProperties.StopBits );
|
||||||
SharedSerial.Parity = SerialParity.None;
|
SharedSerial.Parity = (SerialParity)Enum.Parse(typeof(SerialParity), profileProperties.Parity);
|
||||||
SharedSerial.Speed = SerialSpeed.ps9600;
|
SharedSerial.Speed = (SerialSpeed)profileProperties.Speed;
|
||||||
SharedSerial.Handshake = SerialHandshake.None;
|
SharedSerial.Handshake = (SerialHandshake)Enum.Parse(typeof(SerialHandshake), profileProperties.Handshake);
|
||||||
SharedSerial.Connected = true;
|
SharedSerial.Connected = true;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ProductName = SendString(":GVP#");
|
ProductName = SendString("GVP");
|
||||||
FirmwareVersion = SendString(":GVN#");
|
FirmwareVersion = SendString("GVN");
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
traceLogger.LogIssue("Connect", $"Error getting telescope information \"{ex.Message}\" setting to LX200 Classic mode.");
|
||||||
ProductName = TelescopeList.LX200CLASSIC;
|
ProductName = TelescopeList.LX200CLASSIC;
|
||||||
FirmwareVersion = "Unknown";
|
FirmwareVersion = "Unknown";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ProductName == ":GVP")
|
if (ProductName == ":GVP")
|
||||||
{
|
{
|
||||||
|
traceLogger.LogIssue("Connect", "Serial port is looping back data, something is wrong with the hardware.");
|
||||||
//This means that the serial port is looping back what's been sent, something is very wrong.
|
//This means that the serial port is looping back what's been sent, something is very wrong.
|
||||||
SharedSerial.Connected = false;
|
SharedSerial.Connected = false;
|
||||||
|
|
||||||
throw new Exception("Serial port is looping back data, something is wrong with the hardware.");
|
throw new Exception("Serial port is looping back data, something is wrong with the hardware.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string utcOffSet = 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
|
||||||
|
//sHH# form is returned, otherwise the longer form is returned.
|
||||||
|
if (!double.TryParse(utcOffSet, out var utcOffsetHours))
|
||||||
|
{
|
||||||
|
var message = "Unable to decode response from the telescope, This is likely a hardware serial communications error.";
|
||||||
|
traceLogger.LogIssue("Connect", message);
|
||||||
|
throw new Exception(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
traceLogger.LogMessage("Connect", $"Offset from UTC: {utcOffsetHours}", false);
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
SharedSerial.Connected = false;
|
||||||
|
throw;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -363,5 +493,15 @@ namespace ASCOM.Meade.net
|
|||||||
Count = 0;
|
Count = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void SetParked(bool atPark, ParkedPosition parkedPosition)
|
||||||
|
{
|
||||||
|
IsParked = atPark;
|
||||||
|
ParkedPosition = parkedPosition;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool IsParked { get; private set; }
|
||||||
|
|
||||||
|
public static ParkedPosition ParkedPosition { get; private set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4,30 +4,32 @@
|
|||||||
{
|
{
|
||||||
#region Autostar 497/Audiostar
|
#region Autostar 497/Audiostar
|
||||||
|
|
||||||
public static readonly string Autostar497 = "Autostar";
|
public const string Autostar497 = "Autostar";
|
||||||
|
|
||||||
//Autostar/Audiostar firmware revisions
|
//Autostar/Audiostar firmware revisions
|
||||||
// ReSharper disable once InconsistentNaming
|
// ReSharper disable once InconsistentNaming
|
||||||
public static readonly string Autostar497_30Ee = "30Ee";
|
public const string Autostar497_30Ee = "30Ee";
|
||||||
// ReSharper disable once InconsistentNaming
|
// ReSharper disable once InconsistentNaming
|
||||||
public static readonly string Autostar497_31Ee = "31Ee";
|
public const string Autostar497_31Ee = "31Ee";
|
||||||
// ReSharper disable once InconsistentNaming
|
// ReSharper disable once InconsistentNaming
|
||||||
public static readonly string Autostar497_43Eg = "43Eg";
|
public const string Autostar497_43Eg = "43Eg";
|
||||||
|
|
||||||
|
// ReSharper disable once InconsistentNaming
|
||||||
|
public const string AudioStar_A4S4 = "A4S4";
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region LX200GPS
|
#region LX200GPS
|
||||||
|
|
||||||
// ReSharper disable once InconsistentNaming
|
// ReSharper disable once InconsistentNaming
|
||||||
public static readonly string LX200GPS = "LX2001";
|
public const string LX200GPS = "LX2001";
|
||||||
|
|
||||||
// ReSharper disable once InconsistentNaming
|
// ReSharper disable once InconsistentNaming
|
||||||
public static readonly string LX200GPS_42G = "4.2G";
|
public const string LX200GPS_42G = "4.2G";
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region LX200EMC
|
#region LX200EMC
|
||||||
// ReSharper disable once InconsistentNaming
|
// ReSharper disable once InconsistentNaming
|
||||||
public static readonly string LX200CLASSIC = "LX200 Classic"; //GVP command is not supported!
|
public const string LX200CLASSIC = "LX200 Classic"; //GVP command is not supported!
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using ASCOM.Utilities.Interfaces;
|
||||||
|
|
||||||
namespace ASCOM.Meade.net.Wrapper
|
namespace ASCOM.Meade.net.Wrapper
|
||||||
{
|
{
|
||||||
public interface ISharedResourcesWrapper
|
public interface ISharedResourcesWrapper
|
||||||
{
|
{
|
||||||
ConnectionInfo Connect(string deviceId, string driverId);
|
ConnectionInfo Connect(string deviceId, string driverId, ITraceLogger traceLogger);
|
||||||
void Disconnect(string deviceId, string driverId);
|
void Disconnect(string deviceId, string driverId);
|
||||||
|
|
||||||
string ProductName { get; }
|
string ProductName { get; }
|
||||||
@@ -14,9 +15,10 @@ 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);
|
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 ReadTerminated();
|
string ReadTerminated();
|
||||||
|
|
||||||
@@ -25,13 +27,17 @@ 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; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class SharedResourcesWrapper : ISharedResourcesWrapper
|
public class SharedResourcesWrapper : ISharedResourcesWrapper
|
||||||
{
|
{
|
||||||
public ConnectionInfo Connect(string deviceId, string driverId)
|
public ConnectionInfo Connect(string deviceId, string driverId, ITraceLogger traceLogger)
|
||||||
{
|
{
|
||||||
return SharedResources.Connect(deviceId, driverId);
|
return SharedResources.Connect(deviceId, driverId, traceLogger);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Disconnect(string deviceId, string driverId)
|
public void Disconnect(string deviceId, string driverId)
|
||||||
@@ -53,19 +59,24 @@ namespace ASCOM.Meade.net.Wrapper
|
|||||||
return SharedResources.Lock(func);
|
return SharedResources.Lock(func);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string SendString(string message)
|
public string SendString(string message, bool raw = false)
|
||||||
{
|
{
|
||||||
return SharedResources.SendString(message);
|
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 ReadTerminated()
|
public string ReadTerminated()
|
||||||
@@ -92,5 +103,14 @@ 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<configuration>
|
<configuration>
|
||||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/></startup></configuration>
|
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/></startup></configuration>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="ASCOM.Platform" version="6.4.2" targetFramework="net40" />
|
<package id="ASCOM.Platform" version="6.5.1" targetFramework="net472" />
|
||||||
|
<package id="JetBrains.Annotations" version="2020.3.0" targetFramework="net472" />
|
||||||
</packages>
|
</packages>
|
||||||
@@ -59,6 +59,9 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="ASCOM.DeviceInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL" />
|
<Reference Include="ASCOM.DeviceInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL" />
|
||||||
<Reference Include="ASCOM.DriverAccess, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL" />
|
<Reference Include="ASCOM.DriverAccess, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL" />
|
||||||
|
<Reference Include="JetBrains.Annotations, Version=2020.3.0.0, Culture=neutral, PublicKeyToken=1010a0d8d6380325, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\JetBrains.Annotations.2020.3.0\lib\net20\JetBrains.Annotations.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
<Reference Include="System.Xml.Linq" />
|
<Reference Include="System.Xml.Linq" />
|
||||||
@@ -72,6 +75,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="app.config" />
|
<None Include="app.config" />
|
||||||
|
<None Include="packages.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<!-- 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.
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<packages>
|
||||||
|
<package id="JetBrains.Annotations" version="2020.3.0" targetFramework="net45" />
|
||||||
|
</packages>
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<configuration>
|
||||||
|
<packageSources>
|
||||||
|
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
|
||||||
|
</packageSources>
|
||||||
|
</configuration>
|
||||||
Reference in New Issue
Block a user