Compare commits

..

47 Commits

Author SHA1 Message Date
ColinD 2ab9cfb9c8 Merged in develop (pull request #21)
Develop
2020-05-23 18:35:43 +00:00
ColinD 894b78d9f1 code inspections 2020-05-23 19:23:48 +01:00
ColinD b9522ae2a2 Added and error message to the trace log when the com port is failing and looping back data 2020-05-23 18:40:04 +01:00
ColinD 07665b7617 removed unused local variable 2020-02-27 23:42:23 +00:00
ColinD 6130cb6d64 Added new feature to allow the guiding style to be forced, Auto = driver decides. Pulse guiding will use the newer pulse guiding technique, Guide rate slew, will use the older technique. 2020-02-27 22:57:19 +00:00
ColinD d925312403 Merge branch 'master' into develop 2020-02-24 21:05:10 +00:00
ColinD 5a18577552 Merged in develop (pull request #20)
Develop
2020-02-24 21:01:21 +00:00
ColinD c7f1a4272f Slewing now reports false when performing a guide command using the old guiding method. 2020-02-20 21:31:09 +00:00
ColinD 6601fa6205 Added a check to ensure that pulse guide commands fail when the scope is slewing or already being moved on the same axes. 2019-12-11 23:53:37 +00:00
ColinD e2abda2d14 Merged in develop (pull request #19)
Develop
2019-12-03 21:10:42 +00:00
ColinD 97810b5575 Attempt ad fixing the double.parse error. 2019-12-02 12:39:03 +00:00
ColinD 1185770a94 Added try catch to the default constructor to show the details of an error if something goes wrong. 2019-12-01 00:11:13 +00:00
ColinD 25d88b0609 Set global com visible to false and only exposed the classes that need to be. 2019-11-30 19:15:06 +00:00
ColinD 85c77787ce Added unit test for getting site count 2019-11-12 10:35:03 +00:00
ColinD 2181ff5602 Added extra # in front of every command as recommended by Meade.
Code inspections
Duplicate reconcile
Code upgraded to use .net 4.5
Added log message for when a pulse guide move is completed that will show the difference.
.net 4.5 is not being recognised as installed, so trying a different variable.
Modified how the old guiding method is implmented - it's now much simplified and uses the same move axis commands as normal slewing, which is what it does under the hood anyway.
Modified how the RA detection is done, and changed the message logs
RA position report on connect to trigger for ALL connects.
Modified the LX200 Classic connections, so that if a :GVP is returned when :GVP# is sent, it assumes an error. A timeout will be assumed to be an LX200 Classic.
Started working on unit testing for the sharedresources class.
Changed the code to detect any exception when trying to run a :GVP after the initial connect.
Upgraded the Profile code to be contained inside a wrapper and started adding unit tests to cover.
2019-10-22 21:52:42 +00:00
ColinD 9505468efc Code inspection cleanup 2019-10-22 22:06:40 +01:00
ColinD 2cbb1fb68c Code inspection cleanup 2019-10-22 21:51:59 +01:00
ColinD ba0ae056ea Forcing the disconnect to make sure that the tests work as expected. 2019-10-22 21:40:45 +01:00
ColinD dff7bce6b0 Unit Testing for the connect method. 2019-10-22 21:27:07 +01:00
ColinD a155e27eac Upgraded the Profile code to be contained inside a wrapper and started adding unit tests to cover. 2019-10-21 21:16:09 +01:00
ColinD 438ec779b4 Changed the code to detect any exception when trying to run a :GVP after the initial connect. 2019-10-19 11:54:04 +01:00
ColinD 307517ded0 Updated nuget packages. Started working on unit testing for the sharedresources class. 2019-10-15 21:33:51 +01:00
ColinD 8efa8752df Corrected defect where the scope will not attempt to connect the serial port 2019-10-13 21:15:30 +01:00
ColinD 7f6f478dfc Modified the LX200 Classic connections, so that if a :GVP is returned when :GVP# is sent, it assumes an error. A timeout will be assumed to be an LX200 Classic. 2019-10-12 12:40:01 +01:00
ColinD 7a92581fa8 Moved the RA position report on connect to trigger for ALL connects, not just the first connection. 2019-10-05 13:47:14 +01:00
ColinD 7f8c2cb559 Removed the alignmode check as it is not supported on all telescopes.
Added current RA and dec to the log when the telescope connects.
2019-10-05 11:23:10 +01:00
ColinD 3dc87e3724 Added new alignment mode to the log 2019-10-04 20:42:46 +01:00
ColinD 670a5ccf81 Modified how the RA detection is done, and changed the message logs 2019-10-04 20:34:42 +01:00
ColinD 9af0613183 Modified how the old guiding method is implmented - it's now much simplified and uses the same move axis commands as normal slewing, which is what it does under the hood anyway. 2019-10-04 18:20:32 +01:00
ColinD 5df0e21a58 Another attempt at adding .net 4.5 checking 2019-10-03 23:34:13 +01:00
ColinD 149bad2d31 .net 4.5 is not being recognised as installed, so trying a different variable. 2019-10-03 23:12:27 +01:00
ColinD 276f0352e3 Added log message for when a pulse guide move is completed that will show the difference. 2019-10-02 18:55:24 +01:00
ColinD f22e9cdd02 Code inspections 2019-10-01 22:06:42 +01:00
ColinD ee3862f949 Code inspections 2019-10-01 22:03:57 +01:00
ColinD 2972ae31aa Code upgraded to use .net 4.5 2019-10-01 22:00:55 +01:00
ColinD 79cdd60d07 Duplicate reconcile 2019-10-01 21:51:06 +01:00
ColinD f92f21ab72 Code inspections 2019-10-01 21:44:36 +01:00
ColinD 2a56cfa700 Duplicate reconcile 2019-10-01 21:16:47 +01:00
ColinD babb2a7492 Code inspections 2019-10-01 20:57:49 +01:00
ColinD 23960d8c7c Code inspections 2019-10-01 19:42:40 +01:00
ColinD cb97358100 Code inspections 2019-10-01 19:37:39 +01:00
ColinD 28889bdb49 Code inspections 2019-10-01 19:12:34 +01:00
ColinD 5efde9f6e0 Code inspections 2019-10-01 19:03:48 +01:00
ColinD 12e46edc74 Code inspections 2019-10-01 18:55:20 +01:00
ColinD 9969fce375 Merge branch 'master' into develop 2019-09-30 23:30:44 +01:00
ColinD 97e77c839a Added extra # in front of every command as recommended by Meade. 2019-09-30 23:27:18 +01:00
ColinD 0ea195e073 Merge branch 'master' into develop 2019-09-30 22:28:10 +01:00
58 changed files with 1802 additions and 689 deletions
@@ -56,8 +56,8 @@
<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.0\lib\net45\Castle.Core.dll</HintPath>
</Reference> </Reference>
<Reference Include="Moq, Version=4.12.0.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL"> <Reference Include="Moq, Version=4.13.0.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
<HintPath>..\packages\Moq.4.12.0\lib\net45\Moq.dll</HintPath> <HintPath>..\packages\Moq.4.13.0\lib\net45\Moq.dll</HintPath>
</Reference> </Reference>
<Reference Include="nunit.framework, Version=3.12.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL"> <Reference Include="nunit.framework, Version=3.12.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\packages\NUnit.3.12.0\lib\net45\nunit.framework.dll</HintPath> <HintPath>..\packages\NUnit.3.12.0\lib\net45\nunit.framework.dll</HintPath>
@@ -65,8 +65,8 @@
<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.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> <Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.5.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.5.2\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath> <HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.6.0\lib\netstandard2.0\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.3\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll</HintPath>
+4
View File
@@ -6,6 +6,10 @@
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" /> <assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.0.1" newVersion="4.2.0.1" /> <bindingRedirect oldVersion="0.0.0.0-4.2.0.1" newVersion="4.2.0.1" />
</dependentAssembly> </dependentAssembly>
<dependentAssembly>
<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" />
</dependentAssembly>
</assemblyBinding> </assemblyBinding>
</runtime> </runtime>
</configuration> </configuration>
+2 -2
View File
@@ -1,8 +1,8 @@
<?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.0" targetFramework="net472" />
<package id="Moq" version="4.12.0" targetFramework="net472" /> <package id="Moq" version="4.13.0" targetFramework="net472" />
<package id="NUnit" version="3.12.0" targetFramework="net472" /> <package id="NUnit" version="3.12.0" targetFramework="net472" />
<package id="System.Runtime.CompilerServices.Unsafe" version="4.5.2" targetFramework="net472" /> <package id="System.Runtime.CompilerServices.Unsafe" version="4.6.0" targetFramework="net472" />
<package id="System.Threading.Tasks.Extensions" version="4.5.3" targetFramework="net472" /> <package id="System.Threading.Tasks.Extensions" version="4.5.3" targetFramework="net472" />
</packages> </packages>
+2 -1
View File
@@ -10,7 +10,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ASCOM.MeadeGeneric</RootNamespace> <RootNamespace>ASCOM.MeadeGeneric</RootNamespace>
<AssemblyName>ASCOM.MeadeGeneric.Test</AssemblyName> <AssemblyName>ASCOM.MeadeGeneric.Test</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion> <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkProfile> <TargetFrameworkProfile>
</TargetFrameworkProfile> </TargetFrameworkProfile>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
@@ -54,6 +54,7 @@
<PlatformTarget>AnyCPU</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup> </PropertyGroup>
<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" />
+2 -2
View File
@@ -14,9 +14,9 @@ using ASCOM.DriverAccess;
namespace ASCOM.MeadeGeneric namespace ASCOM.MeadeGeneric
{ {
class Program public static class Program
{ {
static void Main(string[] args) public static void Main()
{ {
// Uncomment the code that's required // Uncomment the code that's required
#if UseChooser #if UseChooser
+1 -1
View File
@@ -1,3 +1,3 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<configuration> <configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration> <startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/></startup></configuration>
@@ -181,7 +181,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 +189,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;
@@ -401,13 +401,13 @@ namespace Meade.net.Focuser.UnitTests
if (position < 0) if (position < 0)
{ {
_sharedResourcesWrapperMock.Verify( x => x.SendBlind(":F-#"), Times.AtLeastOnce); _sharedResourcesWrapperMock.Verify( x => x.SendBlind("#:F-#"), Times.AtLeastOnce);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":F+#"), Times.Never); _sharedResourcesWrapperMock.Verify(x => x.SendBlind("#:F+#"), Times.Never);
} }
else else
{ {
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":F-#"), Times.Never); _sharedResourcesWrapperMock.Verify(x => x.SendBlind("#:F-#"), Times.Never);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":F+#"), Times.AtLeastOnce); _sharedResourcesWrapperMock.Verify(x => x.SendBlind("#:F+#"), Times.AtLeastOnce);
} }
_sharedResourcesWrapperMock.Verify( x => x.Lock(It.IsAny<Action>()), Times.Once); _sharedResourcesWrapperMock.Verify( x => x.Lock(It.IsAny<Action>()), Times.Once);
@@ -71,8 +71,8 @@
<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.0\lib\net45\Castle.Core.dll</HintPath>
</Reference> </Reference>
<Reference Include="Moq, Version=4.12.0.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL"> <Reference Include="Moq, Version=4.13.0.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
<HintPath>..\packages\Moq.4.12.0\lib\net45\Moq.dll</HintPath> <HintPath>..\packages\Moq.4.13.0\lib\net45\Moq.dll</HintPath>
</Reference> </Reference>
<Reference Include="nunit.framework, Version=3.12.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL"> <Reference Include="nunit.framework, Version=3.12.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\packages\NUnit.3.12.0\lib\net45\nunit.framework.dll</HintPath> <HintPath>..\packages\NUnit.3.12.0\lib\net45\nunit.framework.dll</HintPath>
@@ -80,8 +80,8 @@
<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.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> <Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.5.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.5.2\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath> <HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.6.0\lib\netstandard2.0\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.3\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll</HintPath>
+4
View File
@@ -6,6 +6,10 @@
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" /> <assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.0.1" newVersion="4.2.0.1" /> <bindingRedirect oldVersion="0.0.0.0-4.2.0.1" newVersion="4.2.0.1" />
</dependentAssembly> </dependentAssembly>
<dependentAssembly>
<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" />
</dependentAssembly>
</assemblyBinding> </assemblyBinding>
</runtime> </runtime>
</configuration> </configuration>
+2 -2
View File
@@ -2,8 +2,8 @@
<packages> <packages>
<package id="ASCOM.Platform" version="6.4.2" targetFramework="net472" /> <package id="ASCOM.Platform" version="6.4.2" targetFramework="net472" />
<package id="Castle.Core" version="4.4.0" targetFramework="net472" /> <package id="Castle.Core" version="4.4.0" targetFramework="net472" />
<package id="Moq" version="4.12.0" targetFramework="net472" /> <package id="Moq" version="4.13.0" targetFramework="net472" />
<package id="NUnit" version="3.12.0" targetFramework="net472" /> <package id="NUnit" version="3.12.0" targetFramework="net472" />
<package id="System.Runtime.CompilerServices.Unsafe" version="4.5.2" targetFramework="net472" /> <package id="System.Runtime.CompilerServices.Unsafe" version="4.6.0" targetFramework="net472" />
<package id="System.Threading.Tasks.Extensions" version="4.5.3" targetFramework="net472" /> <package id="System.Threading.Tasks.Extensions" version="4.5.3" targetFramework="net472" />
</packages> </packages>
+3 -3
View File
@@ -25,9 +25,9 @@
<![CDATA[Installed OR ASCOMPLATFORMVERSION >= "6.4.1"]]> <![CDATA[Installed OR ASCOMPLATFORMVERSION >= "6.4.1"]]>
</Condition> </Condition>
<PropertyRef Id="NETFRAMEWORK40FULL"/> <PropertyRef Id="NETFRAMEWORK45"/>
<Condition Message="This application requires .NET Framework 4.0 or higher. Please install the .NET Framework then run this installer again."> <Condition Message="This application requires .NET Framework 4.5 or higher. Please install the .NET Framework then run this installer again.">
<![CDATA[Installed OR NETFRAMEWORK40FULL]]> <![CDATA[Installed OR NETFRAMEWORK45]]>
</Condition> </Condition>
<!-- <Condition Message="Please use the correct installer for your operating system - x86 for 32-bit, x64 for 64-bit."> <!-- <Condition Message="Please use the correct installer for your operating system - x86 for 32-bit, x64 for 64-bit.">
@@ -92,8 +92,8 @@
<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.0\lib\net45\Castle.Core.dll</HintPath>
</Reference> </Reference>
<Reference Include="Moq, Version=4.12.0.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL"> <Reference Include="Moq, Version=4.13.0.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
<HintPath>..\packages\Moq.4.12.0\lib\net45\Moq.dll</HintPath> <HintPath>..\packages\Moq.4.13.0\lib\net45\Moq.dll</HintPath>
</Reference> </Reference>
<Reference Include="nunit.framework, Version=3.12.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL"> <Reference Include="nunit.framework, Version=3.12.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\packages\NUnit.3.12.0\lib\net40\nunit.framework.dll</HintPath> <HintPath>..\packages\NUnit.3.12.0\lib\net40\nunit.framework.dll</HintPath>
@@ -101,8 +101,8 @@
<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.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> <Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.5.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.5.2\lib\netstandard1.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath> <HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.6.0\lib\netstandard2.0\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.3\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll</HintPath>
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -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.4.1" newVersion="4.0.4.1" /> <bindingRedirect oldVersion="0.0.0.0-4.0.5.0" newVersion="4.0.5.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" />
@@ -2,8 +2,8 @@
<packages> <packages>
<package id="ASCOM.Platform" version="6.4.2" targetFramework="net472" /> <package id="ASCOM.Platform" version="6.4.2" targetFramework="net472" />
<package id="Castle.Core" version="4.4.0" targetFramework="net45" /> <package id="Castle.Core" version="4.4.0" targetFramework="net45" />
<package id="Moq" version="4.12.0" targetFramework="net45" /> <package id="Moq" version="4.13.0" targetFramework="net472" />
<package id="NUnit" version="3.12.0" targetFramework="net40" requireReinstallation="true" /> <package id="NUnit" version="3.12.0" targetFramework="net40" requireReinstallation="true" />
<package id="System.Runtime.CompilerServices.Unsafe" version="4.5.2" targetFramework="net45" requireReinstallation="true" /> <package id="System.Runtime.CompilerServices.Unsafe" version="4.6.0" targetFramework="net472" />
<package id="System.Threading.Tasks.Extensions" version="4.5.3" targetFramework="net472" /> <package id="System.Threading.Tasks.Extensions" version="4.5.3" targetFramework="net472" />
</packages> </packages>
+1 -1
View File
@@ -22,7 +22,7 @@ namespace ASCOM.Meade.net.AstroMaths
return h; return h;
} }
public double HourAngleToRightAscension(DateTime utcDateTime, double longitude, double hourAngle ) private double HourAngleToRightAscension(DateTime utcDateTime, double longitude, double hourAngle )
{ {
var gst = UTtoGst(utcDateTime); var gst = UTtoGst(utcDateTime);
var lst = GsTtoLst( gst, longitude); var lst = GsTtoLst( gst, longitude);
@@ -5,13 +5,13 @@ namespace ASCOM.Meade.net.AstroMaths
public interface IAstroMaths public interface IAstroMaths
{ {
double RightAscensionToHourAngle(DateTime utcDateTime, double longitude, double rightAscension); double RightAscensionToHourAngle(DateTime utcDateTime, double longitude, double rightAscension);
double HourAngleToRightAscension(DateTime utcDateTime, double longitude, double hourAngle ); //double HourAngleToRightAscension(DateTime utcDateTime, double longitude, double hourAngle );
EquatorialCoordinates ConvertHozToEq( DateTime utcDateTime, double latitude, double longitude, HorizonCoordinates altAz); EquatorialCoordinates ConvertHozToEq( DateTime utcDateTime, double latitude, double longitude, HorizonCoordinates altAz);
HorizonCoordinates ConvertEqToHoz(double hourAngle, double latitude, EquatorialCoordinates raDec); HorizonCoordinates ConvertEqToHoz(double hourAngle, double latitude, EquatorialCoordinates raDec);
double DegreesToRadians(double degrees); //double DegreesToRadians(double degrees);
double RadiansToDegrees(double radians); //double RadiansToDegrees(double radians);
double DateTimeToDecimalHours( DateTime utcDateTime); //double DateTimeToDecimalHours( DateTime utcDateTime);
double UTtoGst(DateTime utcDateTime); //double UTtoGst(DateTime utcDateTime);
double GsTtoLst(double gst, double longitude); //double GsTtoLst(double gst, double longitude);
} }
} }
+9
View File
@@ -0,0 +1,9 @@
namespace ASCOM.Meade.net
{
public enum ComparisonResult
{
Lower,
Equals,
Greater
}
}
+13
View File
@@ -10,5 +10,18 @@ namespace ASCOM.Meade.net
return false; return false;
return true; return true;
} }
public static ComparisonResult Compare(this double value, double comparison)
{
var result = value.CompareTo(comparison);
if (result < 0)
return ComparisonResult.Lower;
if (result == 0)
return ComparisonResult.Equals;
return ComparisonResult.Greater;
}
} }
} }
@@ -15,7 +15,7 @@
<UpgradeBackupLocation> <UpgradeBackupLocation>
</UpgradeBackupLocation> </UpgradeBackupLocation>
<OldToolsVersion>3.5</OldToolsVersion> <OldToolsVersion>3.5</OldToolsVersion>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion> <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<ApplicationIcon>ASCOM.ico</ApplicationIcon> <ApplicationIcon>ASCOM.ico</ApplicationIcon>
<SignAssembly>true</SignAssembly> <SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>ASCOMDriverTemplate.snk</AssemblyOriginatorKeyFile> <AssemblyOriginatorKeyFile>ASCOMDriverTemplate.snk</AssemblyOriginatorKeyFile>
@@ -62,10 +62,12 @@
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>..\bin\Release\</OutputPath> <OutputPath>..\bin\Release\</OutputPath>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<OutputPath>..\bin\Debug\</OutputPath> <OutputPath>..\bin\Debug\</OutputPath>
<PlatformTarget>AnyCPU</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>
<Prefer32Bit>false</Prefer32Bit>
</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">
@@ -118,6 +120,7 @@
<Compile Include="AstroMaths\EquatorialCoordinates.cs" /> <Compile Include="AstroMaths\EquatorialCoordinates.cs" />
<Compile Include="AstroMaths\HorizonCoordinates.cs" /> <Compile Include="AstroMaths\HorizonCoordinates.cs" />
<Compile Include="AstroMaths\IAstroMaths.cs" /> <Compile Include="AstroMaths\IAstroMaths.cs" />
<Compile Include="ComparisonResult.cs" />
<Compile Include="DoubleExtensions.cs" /> <Compile Include="DoubleExtensions.cs" />
<Compile Include="StringExtensions.cs" /> <Compile Include="StringExtensions.cs" />
<Compile Include="Telescope.cs" /> <Compile Include="Telescope.cs" />
@@ -18,7 +18,7 @@ using System.Runtime.InteropServices;
// Setting ComVisible to false makes the types in this assembly not visible // Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from // to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type. // COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(true)] [assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM // The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("8b9fccb9-87ae-42f7-90af-079e13de6efb")] [assembly: Guid("8b9fccb9-87ae-42f7-90af-079e13de6efb")]
+19 -25
View File
@@ -8,16 +8,10 @@
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
using System.CodeDom.Compiler;
using System.ComponentModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Drawing;
using System.Globalization;
using System.Resources;
using System.Runtime.CompilerServices;
namespace ASCOM.Meade.net.Properties { namespace ASCOM.Meade.net.Properties {
using System;
/// <summary> /// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc. /// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary> /// </summary>
@@ -25,27 +19,27 @@ namespace ASCOM.Meade.net.Properties {
// class via a tool like ResGen or Visual Studio. // class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen // To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project. // with the /str option, or rebuild your VS project.
[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[DebuggerNonUserCode()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[CompilerGenerated()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources { internal class Resources {
private static ResourceManager resourceMan; private static global::System.Resources.ResourceManager resourceMan;
private static CultureInfo resourceCulture; private static global::System.Globalization.CultureInfo resourceCulture;
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() { internal Resources() {
} }
/// <summary> /// <summary>
/// Returns the cached ResourceManager instance used by this class. /// Returns the cached ResourceManager instance used by this class.
/// </summary> /// </summary>
[EditorBrowsable(EditorBrowsableState.Advanced)] [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static ResourceManager ResourceManager { internal static global::System.Resources.ResourceManager ResourceManager {
get { get {
if (ReferenceEquals(resourceMan, null)) { if (object.ReferenceEquals(resourceMan, null)) {
ResourceManager temp = new ResourceManager("ASCOM.Meade.net.Properties.Resources", typeof(Resources).Assembly); global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ASCOM.Meade.net.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp; resourceMan = temp;
} }
return resourceMan; return resourceMan;
@@ -56,8 +50,8 @@ namespace ASCOM.Meade.net.Properties {
/// Overrides the current thread's CurrentUICulture property for all /// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class. /// resource lookups using this strongly typed resource class.
/// </summary> /// </summary>
[EditorBrowsable(EditorBrowsableState.Advanced)] [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static CultureInfo Culture { internal static global::System.Globalization.CultureInfo Culture {
get { get {
return resourceCulture; return resourceCulture;
} }
@@ -69,20 +63,20 @@ namespace ASCOM.Meade.net.Properties {
/// <summary> /// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap. /// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary> /// </summary>
internal static Bitmap ASCOM { internal static System.Drawing.Bitmap ASCOM {
get { get {
object obj = ResourceManager.GetObject("ASCOM", resourceCulture); object obj = ResourceManager.GetObject("ASCOM", resourceCulture);
return ((Bitmap)(obj)); return ((System.Drawing.Bitmap)(obj));
} }
} }
/// <summary> /// <summary>
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon). /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
/// </summary> /// </summary>
internal static Icon DefaultIcon { internal static System.Drawing.Icon DefaultIcon {
get { get {
object obj = ResourceManager.GetObject("DefaultIcon", resourceCulture); object obj = ResourceManager.GetObject("DefaultIcon", resourceCulture);
return ((Icon)(obj)); return ((System.Drawing.Icon)(obj));
} }
} }
+4 -8
View File
@@ -8,18 +8,14 @@
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
using System.CodeDom.Compiler;
using System.Configuration;
using System.Runtime.CompilerServices;
namespace ASCOM.Meade.net.Properties { namespace ASCOM.Meade.net.Properties {
[CompilerGenerated()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[GeneratedCode("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.0.0.0")] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.0.0.0")]
internal sealed partial class Settings : ApplicationSettingsBase { internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(Synchronized(new Settings()))); private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default { public static Settings Default {
get { get {
+6 -5
View File
@@ -82,16 +82,17 @@ namespace ASCOM.Meade.net
switch (axis) switch (axis)
{ {
case TelescopeAxes.axisPrimary: case TelescopeAxes.axisPrimary:
case TelescopeAxes.axisSecondary:
// TODO Initialize this array with any Primary axis rates that your driver may provide // TODO Initialize this array with any Primary axis rates that your driver may provide
// Example: m_Rates = new Rate[] { new Rate(10.5, 30.2), new Rate(54.0, 43.6) } // Example: m_Rates = new Rate[] { new Rate(10.5, 30.2), new Rate(54.0, 43.6) }
//this.rates = new Rate[0]; //this.rates = new Rate[0];
_rates = new[] { new Rate(1, 1), new Rate(2, 2), new Rate(3, 3), new Rate(4, 4) }; _rates = new[] { new Rate(1, 1), new Rate(2, 2), new Rate(3, 3), new Rate(4, 4) };
break; break;
case TelescopeAxes.axisSecondary:
// TODO Initialize this array with any Secondary axis rates that your driver may provide //// TODO Initialize this array with any Secondary axis rates that your driver may provide
//this.rates = new Rate[0]; ////this.rates = new Rate[0];
_rates = new[] { new Rate(1, 1), new Rate(2, 2), new Rate(3, 3), new Rate(4, 4) }; //_rates = new[] { new Rate(1, 1), new Rate(2, 2), new Rate(3, 3), new Rate(4, 4) };
break; //break;
case TelescopeAxes.axisTertiary: case TelescopeAxes.axisTertiary:
// TODO Initialize this array with any Tertiary axis rates that your driver may provide // TODO Initialize this array with any Tertiary axis rates that your driver may provide
_rates = new Rate[0]; _rates = new Rate[0];
+4 -4
View File
@@ -7,10 +7,10 @@ namespace ASCOM.Meade.net
return int.Parse(str); return int.Parse(str);
} }
public static double ToDouble(this string str) //public static double ToDouble(this string str)
{ //{
return double.Parse(str); // return double.Parse(str);
} //}
public static int Position(this string str, char find, int instance) public static int Position(this string str, char find, int instance)
{ {
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -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.0"/></startup></configuration> <startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/></startup></configuration>
@@ -0,0 +1,36 @@
<#
This script initializes a bare minimum set of registry entries required for ASCOM.Utilities.Profile to work
without throwing any exceptions. When building on a build server, or on a computer without the ASCOM Platform installed,
it may be useful to execute this script as a build step prior to running any unit tests, or calling any code that relies on
ASCOM.Utilities.Profile. The alternative is to install the ASCOM Platform on the build agent.
NOTE: This script equires elevated permissions because it creates registry keys in the LocalMachine hive.
#>
$wow = Test-Path HKLM:\SOFTWARE\Wow6432Node
if ($wow)
{
$root = "HKLM:\SOFTWARE\Wow6432Node"
}
else
{
$root = "HKLM:\SOFTWARE"
}
$ascomRoot = $root + "\ASCOM"
if (Test-Path $ascomRoot)
{
<# Don't upset an already-existing ASCOM registry #>
exit
}
<# Create the ASCOM root key and set it's ACL to allow all users read/write access #>
New-Item -Path $root -Name ASCOM Force
$ascomAcl = Get-Acl $ascomRoot
$aclRule = New-Object System.Security.AccessControl.RegistryAccessRule ("Users","FullControl","Allow")
$ascomAcl.SetAccessRule($aclRule)
$ascomAcl | Set-Acl -Path $ascomRoot
<# Now create the bare minimum keys required so that ASCOM.Utilities.Profile doesn't crash and burn #>
New-ItemProperty -Path $ascomRoot -Name PlatformVersion -Value "6.1" -PropertyType String Force
New-ItemProperty -Path $ascomRoot -Name SerTraceFile -Value "C:\SerialTraceAuto.txt" -PropertyType String Force
@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<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="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{21EF28B4-D574-4A2D-A61D-5DF96AF46AB2}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Meade.net.UnitTests</RootNamespace>
<AssemblyName>Meade.net.UnitTests</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<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>
</Reference>
<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>
</Reference>
<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>
</Reference>
<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>
</Reference>
<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>
</Reference>
<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>
</Reference>
<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>
</Reference>
<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>
</Reference>
<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>
</Reference>
<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>
</Reference>
<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>
</Reference>
<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>
</Reference>
<Reference Include="Moq, Version=4.13.0.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
<HintPath>..\packages\Moq.4.13.0\lib\net45\Moq.dll</HintPath>
</Reference>
<Reference Include="nunit.framework, Version=3.12.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\packages\NUnit.3.12.0\lib\net45\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.5.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>
</Reference>
<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>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="SharedResourcesUnitTests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Meade.net\Meade.net.csproj">
<Project>{3689a2cb-94c5-4012-a5cf-7e7d1dd27143}</Project>
<Name>Meade.net</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="BootstrapAscomProfileStore.ps1" />
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<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>
</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'))" />
</Target>
</Project>
@@ -0,0 +1,35 @@
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Meade.net.UnitTests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Meade.net.UnitTests")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("21ef28b4-d574-4a2d-a61d-5df96af46ab2")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
@@ -0,0 +1,320 @@
using System;
using System.Globalization;
using ASCOM.Meade.net;
using ASCOM.Meade.net.Wrapper;
using ASCOM.Utilities.Interfaces;
using Moq;
using NUnit.Framework;
namespace Meade.net.UnitTests
{
[TestFixture]
public class SharedResourcesUnitTests
{
private Mock<ISerial> _serialMock;
private Mock<ITraceLogger> _traceLoggerMock;
[SetUp]
public void Setup()
{
_serialMock = new Mock<ISerial>();
_serialMock.SetupAllProperties();
_traceLoggerMock = new Mock<ITraceLogger>();
SharedResources.SharedSerial = _serialMock.Object;
}
[Test]
public void CheckThatSerialPortIsSetToUseMock()
{
Assert.That(SharedResources.SharedSerial,Is.EqualTo(_serialMock.Object));
}
[Test]
public void SendBlind_WhenCalled_Then_ClearsBuffersAndSendsMessage()
{
var expectedMessage = "Test";
SharedResources.SendBlind(expectedMessage);
_serialMock.Verify(x=> x.ClearBuffers(), Times.Once);
_serialMock.Verify(x=>x.Transmit(expectedMessage), Times.Once);
}
[Test]
public void SendChar_WhenCalled_ThenSendsMessageAndReadsExpectedNumberOfCharacters()
{
var expectedMessage = "Test";
var expectedResult = "A";
_serialMock.Setup(x => x.ReceiveCounted(1)).Returns(expectedResult);
var result = SharedResources.SendChar(expectedMessage);
_serialMock.Verify(x => x.ClearBuffers(), Times.Once);
_serialMock.Verify(x => x.Transmit(expectedMessage), Times.Once);
_serialMock.Verify(x => x.ReceiveCounted(1), Times.Once);
Assert.That(result, Is.EqualTo(expectedResult));
}
[Test]
public void SendString_WhenCalled_ThenSendsMessageAndReadsResultUntilTerminatorFound()
{
var expectedMessage = "Test";
var expectedResult = "TestMessage#";
_serialMock.Setup(x => x.ReceiveTerminated("#")).Returns(expectedResult);
var result = SharedResources.SendString(expectedMessage);
_serialMock.Verify(x => x.ClearBuffers(), Times.Once);
_serialMock.Verify(x => x.Transmit(expectedMessage), Times.Once);
_serialMock.Verify(x => x.ReceiveTerminated("#"), Times.Once);
Assert.That(result, Is.EqualTo(expectedResult.TrimEnd('#')));
}
[Test]
public void ReadTerminated_WhenCalled_ThenReadsResultUntilTerminatorFound()
{
var expectedResult = "TestMessage#";
_serialMock.Setup(x => x.ReceiveTerminated("#")).Returns(expectedResult);
var result = SharedResources.ReadTerminated();
_serialMock.Verify(x => x.ReceiveTerminated("#"), Times.Once);
Assert.That(result, Is.EqualTo(expectedResult));
}
[Test]
public void ReadCharacters_WhenCalled_ThenReadsSpecificNumberOfCharacters()
{
var numberOfCharacters = 5;
SharedResources.ReadCharacters(numberOfCharacters);
_serialMock.Verify(x => x.ReceiveCounted(numberOfCharacters), Times.Once);
}
[Test]
public void WriteProfile_WhenCalled_WritesExpectedProfileSettings()
{
string DriverId = "ASCOM.MeadeGeneric.Telescope";
Mock<IProfileWrapper> profileWrapperMock = new Mock<IProfileWrapper>();
profileWrapperMock.SetupAllProperties();
IProfileWrapper profeWrapper = profileWrapperMock.Object;
Mock<IProfileFactory> profileFactoryMock = new Mock<IProfileFactory>();
profileFactoryMock.Setup(x => x.Create()).Returns(profileWrapperMock.Object);
SharedResources.ProfileFactory = profileFactoryMock.Object;
var profileProperties = new ProfileProperties
{
TraceLogger = false,
ComPort = "TestComPort"
};
SharedResources.WriteProfile(profileProperties);
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, "COM Port", profileProperties.ComPort), 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, "Guiding Style", profileProperties.GuidingStyle), Times.Once);
}
[Test]
public void ReadProfile_WhenCalled_ReturnsExpectedDefaultValues()
{
string DriverId = "ASCOM.MeadeGeneric.Telescope";
string ComPortDefault = "COM1";
string TraceStateDefault = "false";
string GuideRateProfileNameDefault = "10.077939"; //67% of sidereal rate
string PrecisionDefault = "Unchanged";
string GuidingStyleDefault = "Auto";
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);
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.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));
Assert.That(profileProperties.GuidingStyle, Is.EqualTo(GuidingStyleDefault));
}
[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 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>();
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.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 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>();
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, _traceLoggerMock.Object);
try
{
Assert.That(connectionResult.SameDevice, Is.EqualTo(1));
Assert.That(SharedResources.ProductName, Is.EqualTo(TelescopeList.LX200CLASSIC));
}
finally
{
SharedResources.Disconnect(deviceId, String.Empty);
}
}
[Test]
public void Connect_WhenDeviceIdIsSerialButGVPIsAutostar_ThenConnectsAndSetsProductToAutostarAndFirmware()
{
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>();
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.ReceiveTerminated("#")).Returns(() => serialPortReturn);
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);
}
}
}
}
+15
View File
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.0.1" newVersion="4.2.0.1" />
</dependentAssembly>
<dependentAssembly>
<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" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
+9
View File
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="ASCOM.Platform" version="6.4.2" targetFramework="net472" />
<package id="Castle.Core" version="4.4.0" targetFramework="net472" />
<package id="Moq" version="4.13.0" targetFramework="net472" />
<package id="NUnit" version="3.12.0" targetFramework="net472" />
<package id="System.Runtime.CompilerServices.Unsafe" version="4.6.0" targetFramework="net472" />
<package id="System.Threading.Tasks.Extensions" version="4.5.3" targetFramework="net472" />
</packages>
+12 -4
View File
@@ -30,6 +30,7 @@ namespace ASCOM.Meade.net
[ProgId("ASCOM.MeadeGeneric.focuser")] [ProgId("ASCOM.MeadeGeneric.focuser")]
[ServedClassName("Meade Generic")] [ServedClassName("Meade Generic")]
[ClassInterface(ClassInterfaceType.None)] [ClassInterface(ClassInterfaceType.None)]
[ComVisible(true)]
public class Focuser : ReferenceCountedObjectBase, IFocuserV3 public class Focuser : ReferenceCountedObjectBase, IFocuserV3
{ {
/// <summary> /// <summary>
@@ -186,7 +187,7 @@ namespace ASCOM.Meade.net
try try
{ {
ReadProfile(); ReadProfile();
_sharedResourcesWrapper.Connect("Serial", DriverId); _sharedResourcesWrapper.Connect("Serial", DriverId, _tl);
try try
{ {
IsConnected = true; IsConnected = true;
@@ -365,7 +366,7 @@ namespace ASCOM.Meade.net
{ {
_sharedResourcesWrapper.Lock(() => _sharedResourcesWrapper.Lock(() =>
{ {
//_sharedResourcesWrapper.SendBlind(":FF#"); //_sharedResourcesWrapper.SendBlind("#:FF#");
//:FF# Set Focus speed to fastest setting //:FF# Set Focus speed to fastest setting
//Returns: Nothing //Returns: Nothing
@@ -382,7 +383,7 @@ namespace ASCOM.Meade.net
Stopwatch stopwatch = Stopwatch.StartNew(); Stopwatch stopwatch = Stopwatch.StartNew();
while (stopwatch.ElapsedMilliseconds < steps) while (stopwatch.ElapsedMilliseconds < steps)
{ {
_sharedResourcesWrapper.SendBlind(directionOut ? ":F+#" : ":F-#"); _sharedResourcesWrapper.SendBlind(directionOut ? "#:F+#" : "#:F-#");
//:F+# Start Focuser moving inward (toward objective) //:F+# Start Focuser moving inward (toward objective)
//Returns: None //Returns: None
@@ -451,6 +452,13 @@ 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.
// //
@@ -461,7 +469,7 @@ namespace ASCOM.Meade.net
/// <param name="bRegister">If <c>true</c>, registers the driver, otherwise unregisters it.</param> /// <param name="bRegister">If <c>true</c>, registers the driver, otherwise unregisters it.</param>
private static void RegUnregAscom(bool bRegister) private static void RegUnregAscom(bool bRegister)
{ {
using (var p = new Profile()) using (IProfileWrapper p = ProfileFactory.Create())
{ {
p.DeviceType = "Focuser"; p.DeviceType = "Focuser";
if (bRegister) if (bRegister)
+3 -1
View File
@@ -15,7 +15,7 @@
<UpgradeBackupLocation> <UpgradeBackupLocation>
</UpgradeBackupLocation> </UpgradeBackupLocation>
<OldToolsVersion>3.5</OldToolsVersion> <OldToolsVersion>3.5</OldToolsVersion>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion> <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<ApplicationIcon>ASCOM.ico</ApplicationIcon> <ApplicationIcon>ASCOM.ico</ApplicationIcon>
<SignAssembly>true</SignAssembly> <SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>ASCOMDriverTemplate.snk</AssemblyOriginatorKeyFile> <AssemblyOriginatorKeyFile>ASCOMDriverTemplate.snk</AssemblyOriginatorKeyFile>
@@ -69,6 +69,7 @@
<PlatformTarget>AnyCPU</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>..\bin\Release\</OutputPath> <OutputPath>..\bin\Release\</OutputPath>
@@ -78,6 +79,7 @@
<PlatformTarget>x86</PlatformTarget> <PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
</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">
+1 -1
View File
@@ -18,7 +18,7 @@ using System.Runtime.InteropServices;
// Setting ComVisible to false makes the types in this assembly not visible // Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from // to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type. // COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(true)] [assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM // The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("4ad7a6d4-6d54-4a9a-bbf3-895353e318f8")] [assembly: Guid("4ad7a6d4-6d54-4a9a-bbf3-895353e318f8")]
+19 -25
View File
@@ -8,16 +8,10 @@
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
using System.CodeDom.Compiler;
using System.ComponentModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Drawing;
using System.Globalization;
using System.Resources;
using System.Runtime.CompilerServices;
namespace ASCOM.Meade.net.Properties { namespace ASCOM.Meade.net.Properties {
using System;
/// <summary> /// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc. /// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary> /// </summary>
@@ -25,27 +19,27 @@ namespace ASCOM.Meade.net.Properties {
// class via a tool like ResGen or Visual Studio. // class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen // To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project. // with the /str option, or rebuild your VS project.
[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[DebuggerNonUserCode()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[CompilerGenerated()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources { internal class Resources {
private static ResourceManager resourceMan; private static global::System.Resources.ResourceManager resourceMan;
private static CultureInfo resourceCulture; private static global::System.Globalization.CultureInfo resourceCulture;
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() { internal Resources() {
} }
/// <summary> /// <summary>
/// Returns the cached ResourceManager instance used by this class. /// Returns the cached ResourceManager instance used by this class.
/// </summary> /// </summary>
[EditorBrowsable(EditorBrowsableState.Advanced)] [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static ResourceManager ResourceManager { internal static global::System.Resources.ResourceManager ResourceManager {
get { get {
if (ReferenceEquals(resourceMan, null)) { if (object.ReferenceEquals(resourceMan, null)) {
ResourceManager temp = new ResourceManager("ASCOM.Meade.net.Properties.Resources", typeof(Resources).Assembly); global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ASCOM.Meade.net.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp; resourceMan = temp;
} }
return resourceMan; return resourceMan;
@@ -56,8 +50,8 @@ namespace ASCOM.Meade.net.Properties {
/// Overrides the current thread's CurrentUICulture property for all /// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class. /// resource lookups using this strongly typed resource class.
/// </summary> /// </summary>
[EditorBrowsable(EditorBrowsableState.Advanced)] [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static CultureInfo Culture { internal static global::System.Globalization.CultureInfo Culture {
get { get {
return resourceCulture; return resourceCulture;
} }
@@ -69,20 +63,20 @@ namespace ASCOM.Meade.net.Properties {
/// <summary> /// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap. /// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary> /// </summary>
internal static Bitmap ASCOM { internal static System.Drawing.Bitmap ASCOM {
get { get {
object obj = ResourceManager.GetObject("ASCOM", resourceCulture); object obj = ResourceManager.GetObject("ASCOM", resourceCulture);
return ((Bitmap)(obj)); return ((System.Drawing.Bitmap)(obj));
} }
} }
/// <summary> /// <summary>
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon). /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
/// </summary> /// </summary>
internal static Icon DefaultIcon { internal static System.Drawing.Icon DefaultIcon {
get { get {
object obj = ResourceManager.GetObject("DefaultIcon", resourceCulture); object obj = ResourceManager.GetObject("DefaultIcon", resourceCulture);
return ((Icon)(obj)); return ((System.Drawing.Icon)(obj));
} }
} }
} }
+4 -8
View File
@@ -8,18 +8,14 @@
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
using System.CodeDom.Compiler;
using System.Configuration;
using System.Runtime.CompilerServices;
namespace ASCOM.Meade.net.Properties { namespace ASCOM.Meade.net.Properties {
[CompilerGenerated()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[GeneratedCode("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.0.0.0")] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.0.0.0")]
internal sealed partial class Settings : ApplicationSettingsBase { internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(Synchronized(new Settings()))); private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default { public static Settings Default {
get { get {
+1 -1
View File
@@ -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.0"/></startup></configuration> <startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/></startup></configuration>
+15
View File
@@ -25,6 +25,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Meade.net.Telescope.UnitTes
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Meade.net.Focuser.UnitTests", "Meade.net.Focuser.UnitTests\Meade.net.Focuser.UnitTests.csproj", "{A3991FA7-23C3-405A-96F9-5AB03AC58F30}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Meade.net.Focuser.UnitTests", "Meade.net.Focuser.UnitTests\Meade.net.Focuser.UnitTests.csproj", "{A3991FA7-23C3-405A-96F9-5AB03AC58F30}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Meade.net.UnitTests", "Meade.net.UnitTests\Meade.net.UnitTests.csproj", "{21EF28B4-D574-4A2D-A61D-5DF96AF46AB2}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@@ -137,6 +139,18 @@ Global
{A3991FA7-23C3-405A-96F9-5AB03AC58F30}.Release|x64.Build.0 = Release|Any CPU {A3991FA7-23C3-405A-96F9-5AB03AC58F30}.Release|x64.Build.0 = Release|Any CPU
{A3991FA7-23C3-405A-96F9-5AB03AC58F30}.Release|x86.ActiveCfg = Release|Any CPU {A3991FA7-23C3-405A-96F9-5AB03AC58F30}.Release|x86.ActiveCfg = Release|Any CPU
{A3991FA7-23C3-405A-96F9-5AB03AC58F30}.Release|x86.Build.0 = Release|Any CPU {A3991FA7-23C3-405A-96F9-5AB03AC58F30}.Release|x86.Build.0 = Release|Any CPU
{21EF28B4-D574-4A2D-A61D-5DF96AF46AB2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{21EF28B4-D574-4A2D-A61D-5DF96AF46AB2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{21EF28B4-D574-4A2D-A61D-5DF96AF46AB2}.Debug|x64.ActiveCfg = Debug|Any CPU
{21EF28B4-D574-4A2D-A61D-5DF96AF46AB2}.Debug|x64.Build.0 = Debug|Any CPU
{21EF28B4-D574-4A2D-A61D-5DF96AF46AB2}.Debug|x86.ActiveCfg = Debug|Any CPU
{21EF28B4-D574-4A2D-A61D-5DF96AF46AB2}.Debug|x86.Build.0 = Debug|Any CPU
{21EF28B4-D574-4A2D-A61D-5DF96AF46AB2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{21EF28B4-D574-4A2D-A61D-5DF96AF46AB2}.Release|Any CPU.Build.0 = Release|Any CPU
{21EF28B4-D574-4A2D-A61D-5DF96AF46AB2}.Release|x64.ActiveCfg = Release|Any CPU
{21EF28B4-D574-4A2D-A61D-5DF96AF46AB2}.Release|x64.Build.0 = Release|Any CPU
{21EF28B4-D574-4A2D-A61D-5DF96AF46AB2}.Release|x86.ActiveCfg = Release|Any CPU
{21EF28B4-D574-4A2D-A61D-5DF96AF46AB2}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
@@ -147,6 +161,7 @@ Global
{AD4959DD-33D7-4C3F-8DB0-7361D8E74A95} = {0958D817-269C-44BE-BEFB-F3E6A409DE91} {AD4959DD-33D7-4C3F-8DB0-7361D8E74A95} = {0958D817-269C-44BE-BEFB-F3E6A409DE91}
{B7EEEEFD-5BFF-443D-981C-7B8AB5DFDE33} = {0958D817-269C-44BE-BEFB-F3E6A409DE91} {B7EEEEFD-5BFF-443D-981C-7B8AB5DFDE33} = {0958D817-269C-44BE-BEFB-F3E6A409DE91}
{A3991FA7-23C3-405A-96F9-5AB03AC58F30} = {0958D817-269C-44BE-BEFB-F3E6A409DE91} {A3991FA7-23C3-405A-96F9-5AB03AC58F30} = {0958D817-269C-44BE-BEFB-F3E6A409DE91}
{21EF28B4-D574-4A2D-A61D-5DF96AF46AB2} = {0958D817-269C-44BE-BEFB-F3E6A409DE91}
EndGlobalSection EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {3C0509DC-C7F5-48DC-920D-DCFD9C879BD2} SolutionGuid = {3C0509DC-C7F5-48DC-920D-DCFD9C879BD2}
+4
View File
@@ -2,6 +2,10 @@
<Settings> <Settings>
<AllowParallelTestExecution>True</AllowParallelTestExecution> <AllowParallelTestExecution>True</AllowParallelTestExecution>
<CopyReferencedAssembliesToWorkspace>True</CopyReferencedAssembliesToWorkspace> <CopyReferencedAssembliesToWorkspace>True</CopyReferencedAssembliesToWorkspace>
<MetricsExclusionList>
<Value>FocuserTestConsole\FocuserTestConsole.csproj</Value>
<Value>TelescopeTestConsole\TelescopeTestConsole.csproj</Value>
</MetricsExclusionList>
<SolutionConfigured>True</SolutionConfigured> <SolutionConfigured>True</SolutionConfigured>
</Settings> </Settings>
</SolutionConfiguration> </SolutionConfiguration>
+1 -1
View File
@@ -11,6 +11,6 @@
<ShowUnexecutedTestsMenuOption>true</ShowUnexecutedTestsMenuOption> <ShowUnexecutedTestsMenuOption>true</ShowUnexecutedTestsMenuOption>
<ShowIgnoredTestsMenuOption>false</ShowIgnoredTestsMenuOption> <ShowIgnoredTestsMenuOption>false</ShowIgnoredTestsMenuOption>
</TestsWindowMenuOptions> </TestsWindowMenuOptions>
<TestsWindowSplitterDistance>451</TestsWindowSplitterDistance> <TestsWindowSplitterDistance>544</TestsWindowSplitterDistance>
</Settings> </Settings>
</SolutionConfiguration> </SolutionConfiguration>
+1 -1
View File
@@ -2,7 +2,7 @@ namespace ASCOM.Meade.net
{ {
public class ConnectionInfo public class ConnectionInfo
{ {
public int Connections { get; set; } //public int Connections { get; set; }
public int SameDevice { get; set; } public int SameDevice { get; set; }
} }
} }
+14 -12
View File
@@ -173,8 +173,10 @@ namespace ASCOM.Meade.net
_sComObjectTypes = new ArrayList(); _sComObjectTypes = new ArrayList();
// put everything into one folder, the same as the server. // put everything into one folder, the same as the server.
string assyPath = Assembly.GetEntryAssembly().Location; string assyPath = Assembly.GetEntryAssembly()?.Location;
assyPath = Path.GetDirectoryName(assyPath); assyPath = Path.GetDirectoryName(assyPath);
if (assyPath == null)
throw new System.InvalidOperationException();
DirectoryInfo d = new DirectoryInfo(assyPath); DirectoryInfo d = new DirectoryInfo(assyPath);
foreach (FileInfo fi in d.GetFiles("*.dll")) foreach (FileInfo fi in d.GetFiles("*.dll"))
@@ -295,9 +297,9 @@ namespace ASCOM.Meade.net
// //
using (RegistryKey key = Registry.ClassesRoot.CreateSubKey("APPID\\" + _sAppId)) using (RegistryKey key = Registry.ClassesRoot.CreateSubKey("APPID\\" + _sAppId))
{ {
key.SetValue(null, assyDescription); key?.SetValue(null, assyDescription);
key.SetValue("AppID", _sAppId); key?.SetValue("AppID", _sAppId);
key.SetValue("AuthenticationLevel", 1, RegistryValueKind.DWord); key?.SetValue("AuthenticationLevel", 1, RegistryValueKind.DWord);
} }
// //
// HKCR\APPID\exename.ext // HKCR\APPID\exename.ext
@@ -305,7 +307,7 @@ namespace ASCOM.Meade.net
using (RegistryKey key = Registry.ClassesRoot.CreateSubKey( using (RegistryKey key = Registry.ClassesRoot.CreateSubKey(
$"APPID\\{Application.ExecutablePath.Substring(Application.ExecutablePath.LastIndexOf('\\') + 1)}")) $"APPID\\{Application.ExecutablePath.Substring(Application.ExecutablePath.LastIndexOf('\\') + 1)}"))
{ {
key.SetValue("AppID", _sAppId); key?.SetValue("AppID", _sAppId);
} }
} }
catch (Exception ex) catch (Exception ex)
@@ -333,20 +335,20 @@ namespace ASCOM.Meade.net
using (RegistryKey key = Registry.ClassesRoot.CreateSubKey($"CLSID\\{clsid}")) using (RegistryKey key = Registry.ClassesRoot.CreateSubKey($"CLSID\\{clsid}"))
{ {
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")) using (RegistryKey key2 = key.CreateSubKey("Implemented Categories"))
{ {
key2.CreateSubKey("{62C8FE65-4EBB-45e7-B440-6E39B2CDBF29}"); key2?.CreateSubKey("{62C8FE65-4EBB-45e7-B440-6E39B2CDBF29}");
} }
using (RegistryKey key2 = key.CreateSubKey("ProgId")) using (RegistryKey key2 = key.CreateSubKey("ProgId"))
{ {
key2.SetValue(null, progid); key2?.SetValue(null, progid);
} }
key.CreateSubKey("Programmable"); key.CreateSubKey("Programmable");
using (RegistryKey key2 = key.CreateSubKey("LocalServer32")) using (RegistryKey key2 = key.CreateSubKey("LocalServer32"))
{ {
key2.SetValue(null, Application.ExecutablePath); key2?.SetValue(null, Application.ExecutablePath);
} }
} }
// //
@@ -354,10 +356,10 @@ namespace ASCOM.Meade.net
// //
using (RegistryKey key = Registry.ClassesRoot.CreateSubKey(progid)) using (RegistryKey key = Registry.ClassesRoot.CreateSubKey(progid))
{ {
key.SetValue(null, assyTitle); key?.SetValue(null, assyTitle);
using (RegistryKey key2 = key.CreateSubKey("CLSID")) using (RegistryKey key2 = key.CreateSubKey("CLSID"))
{ {
key2.SetValue(null, clsid); key2?.SetValue(null, clsid);
} }
} }
// //
+4 -1
View File
@@ -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.0</TargetFrameworkVersion> <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileUpgradeFlags> <FileUpgradeFlags>
</FileUpgradeFlags> </FileUpgradeFlags>
<OldToolsVersion>2.0</OldToolsVersion> <OldToolsVersion>2.0</OldToolsVersion>
@@ -82,6 +82,7 @@
<PlatformTarget>x86</PlatformTarget> <PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
</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">
@@ -133,10 +134,12 @@
</Compile> </Compile>
<Compile Include="GarbageCollection.cs" /> <Compile Include="GarbageCollection.cs" />
<Compile Include="LocalServer.cs" /> <Compile Include="LocalServer.cs" />
<Compile Include="ProfileFactory.cs" />
<Compile Include="ProfileProperties.cs" /> <Compile Include="ProfileProperties.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="TelescopeList.cs" /> <Compile Include="TelescopeList.cs" />
<Compile Include="Win32Utilities.cs" /> <Compile Include="Win32Utilities.cs" />
<Compile Include="Wrapper\IProfileWrapper.cs" />
<Compile Include="Wrapper\SharedResourcesWrapper.cs" /> <Compile Include="Wrapper\SharedResourcesWrapper.cs" />
<EmbeddedResource Include="frmMain.resx"> <EmbeddedResource Include="frmMain.resx">
<SubType>Designer</SubType> <SubType>Designer</SubType>
+17
View File
@@ -0,0 +1,17 @@
using ASCOM.Meade.net.Wrapper;
namespace ASCOM.Meade.net
{
public interface IProfileFactory
{
IProfileWrapper Create();
}
public class ProfileFactory : IProfileFactory
{
public IProfileWrapper Create()
{
return new ProfileWrapper();
}
}
}
+1
View File
@@ -7,5 +7,6 @@ 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; }
} }
} }
+14 -3
View File
@@ -3,6 +3,7 @@ using System.ComponentModel;
using System.Diagnostics; using System.Diagnostics;
using System.Globalization; using System.Globalization;
using System.IO.Ports; using System.IO.Ports;
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;
@@ -54,8 +55,7 @@ namespace ASCOM.Meade.net
chkTrace.Checked = profileProperties.TraceLogger; chkTrace.Checked = profileProperties.TraceLogger;
// set the list of com ports to those that are currently available // set the list of com ports to those that are currently available
comboBoxComPort.Items.Clear(); comboBoxComPort.Items.Clear();
comboBoxComPort.Items.AddRange(SerialPort comboBoxComPort.Items.AddRange(SerialPort.GetPortNames().ToArray<object>()); // use System.IO because it's static
.GetPortNames()); // use System.IO because it's static
// select the current port if possible // select the current port if possible
if (comboBoxComPort.Items.Contains(profileProperties.ComPort)) if (comboBoxComPort.Items.Contains(profileProperties.ComPort))
{ {
@@ -71,6 +71,16 @@ namespace ASCOM.Meade.net
{ {
cboPrecision.SelectedItem = "Unchanged"; cboPrecision.SelectedItem = "Unchanged";
} }
try
{
cboGuidingStyle.SelectedItem = profileProperties.GuidingStyle;
}
catch (Exception)
{
cboGuidingStyle.SelectedItem = "Auto";
}
} }
public ProfileProperties GetProfile() public ProfileProperties GetProfile()
@@ -80,7 +90,8 @@ namespace ASCOM.Meade.net
TraceLogger = chkTrace.Checked, TraceLogger = chkTrace.Checked,
ComPort = comboBoxComPort.SelectedItem.ToString(), ComPort = comboBoxComPort.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()
}; };
return profileProperties; return profileProperties;
+22
View File
@@ -45,6 +45,8 @@ 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();
((System.ComponentModel.ISupportInitialize)(this.picASCOM)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.picASCOM)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
// //
@@ -133,10 +135,28 @@ 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";
//
// 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.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);
@@ -178,5 +198,7 @@ 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;
} }
} }
+81 -21
View File
@@ -123,7 +123,7 @@
</data> </data>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="cmdOK.Location" type="System.Drawing.Point, System.Drawing"> <data name="cmdOK.Location" type="System.Drawing.Point, System.Drawing">
<value>281, 225</value> <value>281, 250</value>
</data> </data>
<data name="cmdOK.Size" type="System.Drawing.Size, System.Drawing"> <data name="cmdOK.Size" type="System.Drawing.Size, System.Drawing">
<value>59, 24</value> <value>59, 24</value>
@@ -145,13 +145,13 @@
<value>$this</value> <value>$this</value>
</data> </data>
<data name="&gt;&gt;cmdOK.ZOrder" xml:space="preserve"> <data name="&gt;&gt;cmdOK.ZOrder" xml:space="preserve">
<value>12</value> <value>14</value>
</data> </data>
<data name="cmdCancel.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms"> <data name="cmdCancel.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Bottom, Right</value> <value>Bottom, Right</value>
</data> </data>
<data name="cmdCancel.Location" type="System.Drawing.Point, System.Drawing"> <data name="cmdCancel.Location" type="System.Drawing.Point, System.Drawing">
<value>281, 255</value> <value>281, 280</value>
</data> </data>
<data name="cmdCancel.Size" type="System.Drawing.Size, System.Drawing"> <data name="cmdCancel.Size" type="System.Drawing.Size, System.Drawing">
<value>59, 25</value> <value>59, 25</value>
@@ -172,7 +172,7 @@
<value>$this</value> <value>$this</value>
</data> </data>
<data name="&gt;&gt;cmdCancel.ZOrder" xml:space="preserve"> <data name="&gt;&gt;cmdCancel.ZOrder" xml:space="preserve">
<value>11</value> <value>13</value>
</data> </data>
<data name="label1.Location" type="System.Drawing.Point, System.Drawing"> <data name="label1.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 9</value> <value>12, 9</value>
@@ -196,7 +196,7 @@
<value>$this</value> <value>$this</value>
</data> </data>
<data name="&gt;&gt;label1.ZOrder" xml:space="preserve"> <data name="&gt;&gt;label1.ZOrder" xml:space="preserve">
<value>10</value> <value>12</value>
</data> </data>
<data name="picASCOM.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms"> <data name="picASCOM.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Top, Right</value> <value>Top, Right</value>
@@ -223,7 +223,7 @@
<value>$this</value> <value>$this</value>
</data> </data>
<data name="&gt;&gt;picASCOM.ZOrder" xml:space="preserve"> <data name="&gt;&gt;picASCOM.ZOrder" xml:space="preserve">
<value>9</value> <value>11</value>
</data> </data>
<data name="label2.AutoSize" type="System.Boolean, mscorlib"> <data name="label2.AutoSize" type="System.Boolean, mscorlib">
<value>True</value> <value>True</value>
@@ -250,13 +250,13 @@
<value>$this</value> <value>$this</value>
</data> </data>
<data name="&gt;&gt;label2.ZOrder" xml:space="preserve"> <data name="&gt;&gt;label2.ZOrder" xml:space="preserve">
<value>8</value> <value>10</value>
</data> </data>
<data name="chkTrace.AutoSize" type="System.Boolean, mscorlib"> <data name="chkTrace.AutoSize" type="System.Boolean, mscorlib">
<value>True</value> <value>True</value>
</data> </data>
<data name="chkTrace.Location" type="System.Drawing.Point, System.Drawing"> <data name="chkTrace.Location" type="System.Drawing.Point, System.Drawing">
<value>77, 136</value> <value>86, 136</value>
</data> </data>
<data name="chkTrace.Size" type="System.Drawing.Size, System.Drawing"> <data name="chkTrace.Size" type="System.Drawing.Size, System.Drawing">
<value>69, 17</value> <value>69, 17</value>
@@ -277,10 +277,10 @@
<value>$this</value> <value>$this</value>
</data> </data>
<data name="&gt;&gt;chkTrace.ZOrder" xml:space="preserve"> <data name="&gt;&gt;chkTrace.ZOrder" xml:space="preserve">
<value>7</value> <value>9</value>
</data> </data>
<data name="comboBoxComPort.Location" type="System.Drawing.Point, System.Drawing"> <data name="comboBoxComPort.Location" type="System.Drawing.Point, System.Drawing">
<value>77, 87</value> <value>86, 87</value>
</data> </data>
<data name="comboBoxComPort.Size" type="System.Drawing.Size, System.Drawing"> <data name="comboBoxComPort.Size" type="System.Drawing.Size, System.Drawing">
<value>90, 21</value> <value>90, 21</value>
@@ -298,7 +298,7 @@
<value>$this</value> <value>$this</value>
</data> </data>
<data name="&gt;&gt;comboBoxComPort.ZOrder" xml:space="preserve"> <data name="&gt;&gt;comboBoxComPort.ZOrder" xml:space="preserve">
<value>6</value> <value>8</value>
</data> </data>
<data name="label3.AutoSize" type="System.Boolean, mscorlib"> <data name="label3.AutoSize" type="System.Boolean, mscorlib">
<value>True</value> <value>True</value>
@@ -325,10 +325,10 @@
<value>$this</value> <value>$this</value>
</data> </data>
<data name="&gt;&gt;label3.ZOrder" xml:space="preserve"> <data name="&gt;&gt;label3.ZOrder" xml:space="preserve">
<value>5</value> <value>7</value>
</data> </data>
<data name="txtGuideRate.Location" type="System.Drawing.Point, System.Drawing"> <data name="txtGuideRate.Location" type="System.Drawing.Point, System.Drawing">
<value>77, 159</value> <value>86, 159</value>
</data> </data>
<data name="txtGuideRate.Size" type="System.Drawing.Size, System.Drawing"> <data name="txtGuideRate.Size" type="System.Drawing.Size, System.Drawing">
<value>46, 20</value> <value>46, 20</value>
@@ -349,13 +349,13 @@
<value>$this</value> <value>$this</value>
</data> </data>
<data name="&gt;&gt;txtGuideRate.ZOrder" xml:space="preserve"> <data name="&gt;&gt;txtGuideRate.ZOrder" xml:space="preserve">
<value>4</value> <value>6</value>
</data> </data>
<data name="label4.AutoSize" type="System.Boolean, mscorlib"> <data name="label4.AutoSize" type="System.Boolean, mscorlib">
<value>True</value> <value>True</value>
</data> </data>
<data name="label4.Location" type="System.Drawing.Point, System.Drawing"> <data name="label4.Location" type="System.Drawing.Point, System.Drawing">
<value>129, 162</value> <value>138, 162</value>
</data> </data>
<data name="label4.Size" type="System.Drawing.Size, System.Drawing"> <data name="label4.Size" type="System.Drawing.Size, System.Drawing">
<value>122, 13</value> <value>122, 13</value>
@@ -376,13 +376,13 @@
<value>$this</value> <value>$this</value>
</data> </data>
<data name="&gt;&gt;label4.ZOrder" xml:space="preserve"> <data name="&gt;&gt;label4.ZOrder" xml:space="preserve">
<value>3</value> <value>5</value>
</data> </data>
<data name="lblPercentOfSiderealRate.AutoSize" type="System.Boolean, mscorlib"> <data name="lblPercentOfSiderealRate.AutoSize" type="System.Boolean, mscorlib">
<value>True</value> <value>True</value>
</data> </data>
<data name="lblPercentOfSiderealRate.Location" type="System.Drawing.Point, System.Drawing"> <data name="lblPercentOfSiderealRate.Location" type="System.Drawing.Point, System.Drawing">
<value>129, 175</value> <value>138, 175</value>
</data> </data>
<data name="lblPercentOfSiderealRate.Size" type="System.Drawing.Size, System.Drawing"> <data name="lblPercentOfSiderealRate.Size" type="System.Drawing.Size, System.Drawing">
<value>105, 13</value> <value>105, 13</value>
@@ -403,7 +403,7 @@
<value>$this</value> <value>$this</value>
</data> </data>
<data name="&gt;&gt;lblPercentOfSiderealRate.ZOrder" xml:space="preserve"> <data name="&gt;&gt;lblPercentOfSiderealRate.ZOrder" xml:space="preserve">
<value>2</value> <value>4</value>
</data> </data>
<data name="label5.AutoSize" type="System.Boolean, mscorlib"> <data name="label5.AutoSize" type="System.Boolean, mscorlib">
<value>True</value> <value>True</value>
@@ -430,7 +430,7 @@
<value>$this</value> <value>$this</value>
</data> </data>
<data name="&gt;&gt;label5.ZOrder" xml:space="preserve"> <data name="&gt;&gt;label5.ZOrder" xml:space="preserve">
<value>1</value> <value>3</value>
</data> </data>
<data name="cboPrecision.Items" xml:space="preserve"> <data name="cboPrecision.Items" xml:space="preserve">
<value>Unchanged</value> <value>Unchanged</value>
@@ -442,7 +442,7 @@
<value>High</value> <value>High</value>
</data> </data>
<data name="cboPrecision.Location" type="System.Drawing.Point, System.Drawing"> <data name="cboPrecision.Location" type="System.Drawing.Point, System.Drawing">
<value>77, 191</value> <value>86, 191</value>
</data> </data>
<data name="cboPrecision.Size" type="System.Drawing.Size, System.Drawing"> <data name="cboPrecision.Size" type="System.Drawing.Size, System.Drawing">
<value>90, 21</value> <value>90, 21</value>
@@ -460,6 +460,66 @@
<value>$this</value> <value>$this</value>
</data> </data>
<data name="&gt;&gt;cboPrecision.ZOrder" xml:space="preserve"> <data name="&gt;&gt;cboPrecision.ZOrder" xml:space="preserve">
<value>2</value>
</data>
<data name="label6.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="label6.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="label6.Location" type="System.Drawing.Point, System.Drawing">
<value>13, 221</value>
</data>
<data name="label6.Size" type="System.Drawing.Size, System.Drawing">
<value>67, 13</value>
</data>
<data name="label6.TabIndex" type="System.Int32, mscorlib">
<value>14</value>
</data>
<data name="label6.Text" xml:space="preserve">
<value>Guiding style</value>
</data>
<data name="&gt;&gt;label6.Name" xml:space="preserve">
<value>label6</value>
</data>
<data name="&gt;&gt;label6.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;label6.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;label6.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<data name="cboGuidingStyle.Items" xml:space="preserve">
<value>Auto</value>
</data>
<data name="cboGuidingStyle.Items1" xml:space="preserve">
<value>Guide rate slew</value>
</data>
<data name="cboGuidingStyle.Items2" xml:space="preserve">
<value>Pulse guiding</value>
</data>
<data name="cboGuidingStyle.Location" type="System.Drawing.Point, System.Drawing">
<value>86, 218</value>
</data>
<data name="cboGuidingStyle.Size" type="System.Drawing.Size, System.Drawing">
<value>90, 21</value>
</data>
<data name="cboGuidingStyle.TabIndex" type="System.Int32, mscorlib">
<value>15</value>
</data>
<data name="&gt;&gt;cboGuidingStyle.Name" xml:space="preserve">
<value>cboGuidingStyle</value>
</data>
<data name="&gt;&gt;cboGuidingStyle.Type" xml:space="preserve">
<value>System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;cboGuidingStyle.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;cboGuidingStyle.ZOrder" xml:space="preserve">
<value>0</value> <value>0</value>
</data> </data>
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
@@ -469,7 +529,7 @@
<value>6, 13</value> <value>6, 13</value>
</data> </data>
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing"> <data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
<value>350, 288</value> <value>350, 313</value>
</data> </data>
<data name="$this.StartPosition" type="System.Windows.Forms.FormStartPosition, System.Windows.Forms"> <data name="$this.StartPosition" type="System.Windows.Forms.FormStartPosition, System.Windows.Forms">
<value>CenterScreen</value> <value>CenterScreen</value>
+54 -14
View File
@@ -18,7 +18,9 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.Windows.Forms; using System.Windows.Forms;
using ASCOM.Meade.net.Wrapper;
using ASCOM.Utilities; using ASCOM.Utilities;
using ASCOM.Utilities.Interfaces;
namespace ASCOM.Meade.net namespace ASCOM.Meade.net
{ {
@@ -36,7 +38,7 @@ namespace ASCOM.Meade.net
private static readonly object LockObject = new object(); private static readonly object LockObject = new object();
// Shared serial port. This will allow multiple drivers to use one single serial port. // Shared serial port. This will allow multiple drivers to use one single serial port.
private static Serial _sSharedSerial; // Shared serial port private static ISerial _sSharedSerial; // Shared serial port
// //
// Public access to shared resources // Public access to shared resources
@@ -59,9 +61,19 @@ namespace ASCOM.Meade.net
// //
/// <summary> /// <summary>
/// Shared serial port /// Shared serial port. Do not directly access this method.
/// </summary> /// </summary>
private static Serial SharedSerial => _sSharedSerial ?? (_sSharedSerial = new Serial()); public static ISerial SharedSerial
{
get => _sSharedSerial ?? (_sSharedSerial = new Serial());
set => _sSharedSerial = value;
}
public static IProfileFactory ProfileFactory
{
get => _profileFactory ?? ( _profileFactory = new ProfileFactory());
set => _profileFactory = value;
}
public static void SendBlind(string message) public static void SendBlind(string message)
{ {
@@ -127,18 +139,20 @@ namespace ASCOM.Meade.net
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";
public static void WriteProfile(ProfileProperties profileProperties) public static void WriteProfile(ProfileProperties profileProperties)
{ {
lock (LockObject) lock (LockObject)
{ {
using (Profile driverProfile = new Profile()) using (IProfileWrapper driverProfile = ProfileFactory.Create())
{ {
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, GuideRateProfileName, profileProperties.GuideRateArcSecondsPerSecond.ToString(CultureInfo.CurrentCulture)); 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);
} }
} }
} }
@@ -147,19 +161,22 @@ namespace ASCOM.Meade.net
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";
public static ProfileProperties ReadProfile() public static ProfileProperties ReadProfile()
{ {
lock (LockObject) lock (LockObject)
{ {
ProfileProperties profileProperties = new ProfileProperties(); ProfileProperties profileProperties = new ProfileProperties();
using (Profile driverProfile = new Profile()) using (IProfileWrapper driverProfile = ProfileFactory.Create())
{ {
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.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)); 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);
} }
return profileProperties; return profileProperties;
@@ -217,6 +234,7 @@ namespace ASCOM.Meade.net
private static readonly Dictionary<string, DeviceHardware> ConnectedDevices = new Dictionary<string, DeviceHardware>(); private static readonly Dictionary<string, DeviceHardware> ConnectedDevices = new Dictionary<string, DeviceHardware>();
private static readonly Dictionary<string, DeviceHardware> ConnectedDeviceIds = new Dictionary<string, DeviceHardware>(); private static readonly Dictionary<string, DeviceHardware> ConnectedDeviceIds = new Dictionary<string, DeviceHardware>();
private static IProfileFactory _profileFactory ;
/// <summary> /// <summary>
@@ -225,21 +243,20 @@ 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)
{ {
if (!ConnectedDevices.ContainsKey(deviceId)) if (!ConnectedDevices.ContainsKey(deviceId))
ConnectedDevices.Add(deviceId, new DeviceHardware()); ConnectedDevices.Add(deviceId, new DeviceHardware());
ConnectedDevices[deviceId].Count++; // increment the value
if (!ConnectedDeviceIds.ContainsKey(driverId)) if (!ConnectedDeviceIds.ContainsKey(driverId))
ConnectedDeviceIds.Add(driverId, new DeviceHardware()); ConnectedDeviceIds.Add(driverId, new DeviceHardware());
ConnectedDeviceIds[driverId].Count++; // increment the value
if (deviceId == "Serial") if (deviceId == "Serial")
{ {
if (ConnectedDevices[deviceId].Count == 1) if (ConnectedDevices[deviceId].Count == 0)
{ {
var profileProperties = ReadProfile(); var profileProperties = ReadProfile();
SharedSerial.PortName = profileProperties.ComPort; SharedSerial.PortName = profileProperties.ComPort;
@@ -252,14 +269,37 @@ namespace ASCOM.Meade.net
SharedSerial.Handshake = SerialHandshake.None; SharedSerial.Handshake = SerialHandshake.None;
SharedSerial.Connected = true; SharedSerial.Connected = true;
ProductName = SendString(":GVP#"); try
FirmwareVersion = SendString(":GVN#"); {
ProductName = SendString(":GVP#");
FirmwareVersion = SendString(":GVN#");
}
catch (Exception ex)
{
traceLogger.LogIssue("Connect", $"Error getting telescope information \"{ex.Message}\" setting to LX200 Classic mode.");
ProductName = TelescopeList.LX200CLASSIC;
FirmwareVersion = "Unknown";
}
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.
SharedSerial.Connected = false;
throw new Exception("Serial port is looping back data, something is wrong with the hardware.");
}
} }
} }
else
throw new ArgumentException($"deviceId {deviceId} not currently supported");
ConnectedDevices[deviceId].Count++; // increment the value
ConnectedDeviceIds[driverId].Count++; // increment the value
return new ConnectionInfo return new ConnectionInfo
{ {
Connections = ConnectedDevices[deviceId].Count, //Connections = ConnectedDevices[deviceId].Count,
SameDevice = ConnectedDeviceIds[driverId].Count SameDevice = ConnectedDeviceIds[driverId].Count
}; };
} }
+1 -1
View File
@@ -27,7 +27,7 @@
#region LX200EMC #region LX200EMC
// ReSharper disable once InconsistentNaming // ReSharper disable once InconsistentNaming
public static readonly string LX200CLASSIC = ":GVP"; //GVP command is not supported! public static readonly string LX200CLASSIC = "LX200 Classic"; //GVP command is not supported!
#endregion #endregion
} }
} }
+139
View File
@@ -0,0 +1,139 @@
using System;
using System.Collections;
using ASCOM.Utilities;
using ASCOM.Utilities.Interfaces;
namespace ASCOM.Meade.net.Wrapper
{
public interface IProfileWrapper : IProfile, IProfileExtra, IDisposable
{
}
public class ProfileWrapper : IProfileWrapper
{
private readonly Profile _profile = new Profile();
public ArrayList RegisteredDevices(string deviceType)
{
return _profile.RegisteredDevices(deviceType);
}
public bool IsRegistered(string driverId)
{
return _profile.IsRegistered(driverId);
}
public void Register(string driverId, string descriptiveName)
{
_profile.Register(driverId, descriptiveName);
}
public void Unregister(string driverId)
{
_profile.Unregister(driverId);
}
public string GetValue(string driverId, string name, string subKey, string defaultValue)
{
return _profile.GetValue(driverId, name, subKey, defaultValue);
}
public void WriteValue(string driverId, string name, string value, string subKey)
{
_profile.WriteValue(driverId, name, value);
}
public ArrayList Values(string driverId, string subKey)
{
return _profile.Values(driverId, subKey);
}
public void DeleteValue(string driverId, string name, string subKey)
{
_profile.DeleteValue(driverId, name, subKey);
}
public void CreateSubKey(string driverId, string subKey)
{
_profile.CreateSubKey(driverId, subKey);
}
public ArrayList SubKeys(string driverId, string subKey)
{
return _profile.SubKeys(driverId, subKey);
}
public void DeleteSubKey(string driverId, string subKey)
{
_profile.DeleteSubKey(driverId, subKey);
}
public string GetProfileXML(string deviceId)
{
return _profile.GetProfileXML(deviceId);
}
public void SetProfileXML(string deviceId, string xml)
{
_profile.SetProfileXML(deviceId, xml);
}
public string DeviceType
{
get => _profile.DeviceType;
set => _profile.DeviceType = value;
}
public ArrayList RegisteredDeviceTypes => _profile.RegisteredDeviceTypes;
public void MigrateProfile(string currentPlatformVersion)
{
_profile.MigrateProfile(currentPlatformVersion);
}
public void DeleteValue(string driverId, string name)
{
_profile.DeleteValue(driverId, name);
}
public string GetValue(string driverId, string name)
{
return _profile.GetValue(driverId, name);
}
public string GetValue(string driverId, string name, string subKey)
{
return _profile.GetValue(driverId, name, subKey);
}
public ArrayList SubKeys(string driverId)
{
return _profile.SubKeys(driverId);
}
public ArrayList Values(string driverId)
{
return _profile.Values(driverId);
}
public void WriteValue(string driverId, string name, string value)
{
_profile.WriteValue(driverId, name, value);
}
public ASCOMProfile GetProfile(string driverId)
{
return _profile.GetProfile(driverId);
}
public void SetProfile(string driverId, ASCOMProfile xmlProfileKey)
{
_profile.SetProfile(driverId, xmlProfileKey);
}
public void Dispose()
{
_profile.Dispose();
}
}
}
+4 -3
View File
@@ -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; }
@@ -29,9 +30,9 @@ namespace ASCOM.Meade.net.Wrapper
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)
+1 -1
View File
@@ -1,3 +1,3 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<configuration> <configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration> <startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/></startup></configuration>
+49 -9
View File
@@ -9,26 +9,29 @@
#define UseChooser #define UseChooser
using System; using System;
using System.Linq;
using System.Threading;
using ASCOM.DeviceInterface;
using ASCOM.DriverAccess; using ASCOM.DriverAccess;
namespace ASCOM.Meade.net namespace ASCOM.Meade.net
{ {
class Program public static class Program
{ {
static void Main(string[] args) public static void Main()
{ {
// Uncomment the code that's required // Uncomment the code that's required
#if UseChooser //#if UseChooser
// choose the device // choose the device
string id = Telescope.Choose("ASCOM.MeadeGeneric.Telescope"); string id = Telescope.Choose("ASCOM.Meade.net.Telescope");
if (string.IsNullOrEmpty(id)) if (string.IsNullOrEmpty(id))
return; return;
// create this device // create this device
Telescope device = new Telescope(id); Telescope device = new Telescope(id);
#else //#else
// this can be replaced by this code, it avoids the chooser and creates the driver class directly. // this can be replaced by this code, it avoids the chooser and creates the driver class directly.
ASCOM.DriverAccess.Telescope device = new ASCOM.DriverAccess.Telescope("ASCOM.Meade.net.Telescope"); //ASCOM.DriverAccess.Telescope device = new ASCOM.DriverAccess.Telescope("ASCOM.Meade.net.Telescope");
#endif //#endif
// now run some tests, adding code to your driver so that the tests will pass. // now run some tests, adding code to your driver so that the tests will pass.
// these first tests are common to all drivers. // these first tests are common to all drivers.
@@ -50,8 +53,45 @@ namespace ASCOM.Meade.net
//Console.WriteLine($"Ra {device.RightAscension}"); //Console.WriteLine($"Ra {device.RightAscension}");
//Console.WriteLine($"Dec {device.Declination}"); //Console.WriteLine($"Dec {device.Declination}");
Console.WriteLine($"Altitude {device.Altitude}"); //Console.WriteLine($"Altitude {device.Altitude}");
Console.WriteLine($"Azimuth {device.Azimuth}"); //Console.WriteLine($"Azimuth {device.Azimuth}");
var seconds = 10;
Console.WriteLine("Slewing tests 10 second in each direction");
Console.WriteLine("test 1");
device.MoveAxis(TelescopeAxes.axisPrimary, 4);
Thread.Sleep(seconds * 1000);
device.MoveAxis(TelescopeAxes.axisPrimary, 0);
Console.WriteLine("test 2");
device.MoveAxis(TelescopeAxes.axisPrimary, -4);
Thread.Sleep(seconds * 1000);
device.MoveAxis(TelescopeAxes.axisPrimary, 0);
Console.WriteLine("test 3");
device.MoveAxis(TelescopeAxes.axisSecondary, 4);
Thread.Sleep(seconds * 1000);
device.MoveAxis(TelescopeAxes.axisSecondary, 0);
Console.WriteLine("test 4");
device.MoveAxis(TelescopeAxes.axisSecondary, -4);
Thread.Sleep(seconds * 1000);
device.MoveAxis(TelescopeAxes.axisSecondary, 0);
Console.WriteLine("Slewing tests complete");
seconds = 120;
Console.WriteLine($"Guiding for {seconds} seconds!");
foreach( var direction in Enum.GetValues(typeof(GuideDirections)).Cast<GuideDirections>())
{
Console.WriteLine($"{direction.ToString()}");
device.PulseGuide(direction, seconds* 1000);
}
Console.WriteLine("Guiding Finished");
device.Connected = false; device.Connected = false;
Console.WriteLine("Press Enter to finish"); Console.WriteLine("Press Enter to finish");
@@ -10,7 +10,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ASCOM.Meade.net</RootNamespace> <RootNamespace>ASCOM.Meade.net</RootNamespace>
<AssemblyName>ASCOM.Meade.net.Test</AssemblyName> <AssemblyName>ASCOM.Meade.net.Test</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion> <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkProfile> <TargetFrameworkProfile>
</TargetFrameworkProfile> </TargetFrameworkProfile>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
@@ -54,6 +54,7 @@
<PlatformTarget>AnyCPU</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup> </PropertyGroup>
<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" />
+1 -1
View File
@@ -1,3 +1,3 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<configuration> <configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration> <startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/></startup></configuration>