Compare commits

..

2 Commits

Author SHA1 Message Date
ColinD 7759862f79 Upgated version numbers to 0.6.0.1 2019-06-09 15:48:14 +01:00
ColinD 58c75794bc Added check for Ascom platform 6.4 SP 1 or higher. 2019-06-09 15:43:32 +01:00
121 changed files with 3425 additions and 14466 deletions
+1 -1
View File
@@ -109,7 +109,6 @@ _TeamCity*
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
*ncrunchsolution.user
# MightyMoose
*.mm.*
@@ -218,4 +217,5 @@ _Pvt_Extensions
# nCrunch items
*.ncrunchsolution
*.DotSettings
*.ncrunchproject
+12 -20
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\NUnit.3.13.0\build\NUnit.props" Condition="Exists('..\packages\NUnit.3.13.0\build\NUnit.props')" />
<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>
@@ -39,7 +39,7 @@
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
@@ -54,25 +54,22 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="Castle.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
<HintPath>..\packages\Castle.Core.4.4.1\lib\net45\Castle.Core.dll</HintPath>
<HintPath>..\packages\Castle.Core.4.3.1\lib\net45\Castle.Core.dll</HintPath>
</Reference>
<Reference Include="JetBrains.Annotations, Version=2020.3.0.0, Culture=neutral, PublicKeyToken=1010a0d8d6380325, processorArchitecture=MSIL">
<HintPath>..\packages\JetBrains.Annotations.2020.3.0\lib\net20\JetBrains.Annotations.dll</HintPath>
<Reference Include="Moq, Version=4.10.0.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
<HintPath>..\packages\Moq.4.10.1\lib\net45\Moq.dll</HintPath>
</Reference>
<Reference Include="Moq, Version=4.15.0.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
<HintPath>..\packages\Moq.4.15.2\lib\net45\Moq.dll</HintPath>
</Reference>
<Reference Include="nunit.framework, Version=3.13.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\packages\NUnit.3.13.0\lib\net45\nunit.framework.dll</HintPath>
<Reference 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=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.5.0.0\lib\net45\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.5.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.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.1\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
@@ -90,13 +87,8 @@
<Project>{64308775-bd4a-469c-bcab-3ed830b811af}</Project>
<Name>Meade.net.Telescope</Name>
</ProjectReference>
<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="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
@@ -104,6 +96,6 @@
<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.13.0\build\NUnit.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NUnit.3.13.0\build\NUnit.props'))" />
<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>
+19 -24
View File
@@ -1,5 +1,5 @@
using System;
using ASCOM.Meade.net.AstroMaths;
using ASCOM.Meade.net;
using NUnit.Framework;
namespace AstroMath.UnitTests
@@ -18,14 +18,14 @@ namespace AstroMath.UnitTests
[Test]
public void DegreesToRadians()
{
var radians = 90.0.DegreesToRadians();
var radians = _astroMath.DegreesToRadians(90);
Assert.That(radians, Is.EqualTo(1.5707963267948966));
}
[Test]
public void RadiansToDegrees()
{
var degrees = 1.5707963267948966.RadiansToDegrees();
var degrees = _astroMath.RadiansToDegrees(1.5707963267948966);
Assert.That(degrees, Is.EqualTo(90));
}
@@ -34,7 +34,7 @@ namespace AstroMath.UnitTests
public void DateTimeToDecimalHours_book()
{
DateTime dateTime = new DateTime(2019, 05, 18, 18, 31, 27, DateTimeKind.Utc);
var decimalHours = dateTime.DateTimeToDecimalHours();
var decimalHours = _astroMath.DateTimeToDecimalHours(dateTime);
Assert.That(decimalHours, Is.EqualTo(18.524166666666666));
}
@@ -43,7 +43,7 @@ namespace AstroMath.UnitTests
public void DateTimeToDecimalHours()
{
DateTime dateTime = new DateTime(2019, 05, 18, 22, 26, 15, DateTimeKind.Utc);
var decimalHours = dateTime.DateTimeToDecimalHours();
var decimalHours = _astroMath.DateTimeToDecimalHours(dateTime);
Assert.That(decimalHours, Is.EqualTo(22.4375));
}
@@ -52,16 +52,16 @@ namespace AstroMath.UnitTests
public void UTtoGST_book()
{
DateTime dateTime = new DateTime(1980, 04, 22, 14, 36, 51, 670, DateTimeKind.Utc);
double gst = dateTime.UTtoGst();
double gst = _astroMath.UTtoGST(dateTime);
Assert.That(gst, Is.EqualTo(4.667932706211154));
}
[Test]
public void UTtoGst()
public void UTtoGST()
{
DateTime dateTime = new DateTime(2019, 05, 18, 22, 26, 15, DateTimeKind.Utc);
double gst = dateTime.UTtoGst();
double gst = _astroMath.UTtoGST(dateTime);
Assert.That(gst, Is.EqualTo(14.191879687876451));
}
@@ -71,16 +71,16 @@ namespace AstroMath.UnitTests
{
double gst = 4.668119;
var longitude = -64;
var lst = _astroMath.GsTtoLst(gst, longitude);
var lst = _astroMath.GSTtoLST(gst, longitude);
Assert.That(lst, Is.EqualTo(0.4014523333333333));
}
[Test]
public void GsTtoLst()
public void GSTtoLST()
{
double gst = 14.257589512545053;
var longitude = -1.7833333333333332;
var lst = _astroMath.GsTtoLst(gst, longitude);
var lst = _astroMath.GSTtoLST(gst, longitude);
Assert.That(lst, Is.EqualTo(14.138700623656163));
}
@@ -113,18 +113,15 @@ namespace AstroMath.UnitTests
{
var latitude = 52.0;
var equatorialCoordinates = new EquatorialCoordinates
{
RightAscension = 5.862222222222222, //5 51' 44"
Declination = 23.21944444444444 //23 13' 10"
};
EquatorialCoordinates equatorialCoordinates = new EquatorialCoordinates();
equatorialCoordinates.RightAscension = 5.862222222222222;//5 51' 44"
equatorialCoordinates.Declination = 23.21944444444444;//23 13' 10"
const double hourAngle = 5.682222;
var hourAngle = 5.682222;
var altAz = _astroMath.ConvertEqToHoz(hourAngle, latitude, equatorialCoordinates);
Assert.That(altAz.Altitude, Is.GreaterThan(20.958562421092770));
Assert.That(altAz.Altitude, Is.LessThanOrEqualTo(20.958562421092779));
Assert.That(altAz.Altitude, Is.EqualTo(20.958562421092779));
Assert.That(altAz.Azimuth, Is.EqualTo(281.2728706962269));
}
@@ -134,11 +131,9 @@ namespace AstroMath.UnitTests
DateTime dateTime = new DateTime(2019, 05, 18, 22, 26, 15, DateTimeKind.Utc);
var longitude = -1.7833333333333332;
var latitude = 52.0;
EquatorialCoordinates equatorialCoordinates = new EquatorialCoordinates
{
RightAscension = 4.15361111111111,
Declination = 30.0019444444444
};
EquatorialCoordinates equatorialCoordinates = new EquatorialCoordinates();
equatorialCoordinates.RightAscension = 4.15361111111111;
equatorialCoordinates.Declination = 30.0019444444444;
var hourAngle = _astroMath.RightAscensionToHourAngle(dateTime, longitude, equatorialCoordinates.RightAscension);
var altaz = _astroMath.ConvertEqToHoz(hourAngle, latitude, equatorialCoordinates);
@@ -1,4 +1,5 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
@@ -31,5 +32,5 @@ using System.Runtime.InteropServices;
// 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("0.0.0.0")]
[assembly: AssemblyFileVersion("0.0.0.0")]
[assembly: AssemblyVersion("0.6.0.1")]
[assembly: AssemblyFileVersion("0.6.0.1")]
-15
View File
@@ -1,15 +0,0 @@
<?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-5.0.0.0" newVersion="5.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
+5 -6
View File
@@ -1,9 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Castle.Core" version="4.4.1" targetFramework="net472" />
<package id="JetBrains.Annotations" version="2020.3.0" targetFramework="net472" />
<package id="Moq" version="4.15.2" targetFramework="net472" />
<package id="NUnit" version="3.13.0" targetFramework="net472" />
<package id="System.Runtime.CompilerServices.Unsafe" version="5.0.0" targetFramework="net472" />
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net472" />
<package id="Castle.Core" version="4.3.1" targetFramework="net472" />
<package id="Moq" version="4.10.1" targetFramework="net472" />
<package id="NUnit" version="3.12.0" targetFramework="net472" />
<package id="System.Runtime.CompilerServices.Unsafe" version="4.5.0" targetFramework="net472" />
<package id="System.Threading.Tasks.Extensions" version="4.5.1" targetFramework="net472" />
</packages>
+1 -25
View File
@@ -10,7 +10,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ASCOM.MeadeGeneric</RootNamespace>
<AssemblyName>ASCOM.MeadeGeneric.Test</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
@@ -36,32 +36,9 @@
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="ASCOM.DeviceInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL" />
<Reference Include="ASCOM.DriverAccess, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL" />
<Reference Include="JetBrains.Annotations, Version=2020.3.0.0, Culture=neutral, PublicKeyToken=1010a0d8d6380325, processorArchitecture=MSIL">
<HintPath>..\packages\JetBrains.Annotations.2020.3.0\lib\net20\JetBrains.Annotations.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
@@ -75,7 +52,6 @@
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+8 -5
View File
@@ -9,23 +9,26 @@
#define UseChooser
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using ASCOM.DriverAccess;
namespace ASCOM.MeadeGeneric
namespace ASCOM
{
public static class Program
class Program
{
public static void Main()
static void Main(string[] args)
{
// Uncomment the code that's required
#if UseChooser
// choose the device
string id = Focuser.Choose("ASCOM.MeadeGeneric.Focuser");
string id = ASCOM.DriverAccess.Focuser.Choose("ASCOM.MeadeGeneric.Focuser");
if (string.IsNullOrEmpty(id))
return;
// create this device
Focuser device = new Focuser(id);
ASCOM.DriverAccess.Focuser device = new ASCOM.DriverAccess.Focuser(id);
#else
// 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.MeadeGeneric.Telescope");
@@ -1,4 +1,5 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
@@ -31,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("0.0.0.0")]
[assembly: AssemblyFileVersion("0.0.0.0")]
[assembly: AssemblyVersion("0.6.0.1")]
[assembly: AssemblyFileVersion("0.6.0.1")]
+1 -1
View File
@@ -1,3 +1,3 @@
<?xml version="1.0"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/></startup></configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
-4
View File
@@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="JetBrains.Annotations" version="2020.3.0" targetFramework="net45" />
</packages>
-46
View File
@@ -1,46 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<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>{7A63F045-FC76-47B9-9DC6-59FA4B758FBB}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Meade.net.Common</RootNamespace>
<AssemblyName>Meade.net.Common</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</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="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
@@ -1,36 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
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.Common")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Meade.net.Common")]
[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("7a63f045-fc76-47b9-9dc6-59fa4b758fbb")]
// 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")]
@@ -1,36 +0,0 @@
<#
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
@@ -1,510 +0,0 @@
using System;
using System.Reflection;
using ASCOM;
using ASCOM.DeviceInterface;
using ASCOM.Meade.net;
using ASCOM.Meade.net.Wrapper;
using ASCOM.Utilities.Interfaces;
using Moq;
using NUnit.Framework;
namespace Meade.net.Focuser.UnitTests
{
[TestFixture]
public class FocuserUnitTests
{
private Mock<IUtil> _utilMock;
private Mock<ISharedResourcesWrapper> _sharedResourcesWrapperMock;
private ProfileProperties _profileProperties;
private ASCOM.Meade.net.Focuser _focuser;
[SetUp]
public void Setup()
{
_profileProperties = new ProfileProperties
{
TraceLogger = false,
ComPort = "TestCom1",
Speed = 9600,
Parity = "None",
Handshake = "None",
StopBits = "One",
DataBits = 8,
GuideRateArcSecondsPerSecond = 1.23,
Precision = "Unchanged",
GuidingStyle = "Auto"
};
_utilMock = new Mock<IUtil>();
_sharedResourcesWrapperMock = new Mock<ISharedResourcesWrapper>();
_sharedResourcesWrapperMock.Setup(x => x.ReadProfile()).Returns(() => _profileProperties);
_focuser = new ASCOM.Meade.net.Focuser(_utilMock.Object, _sharedResourcesWrapperMock.Object);
}
private void ConnectFocuser()
{
_sharedResourcesWrapperMock.Setup(x => x.ProductName).Returns(() => TelescopeList.Autostar497);
_sharedResourcesWrapperMock.Setup(x => x.FirmwareVersion).Returns(() => TelescopeList.Autostar497_31Ee);
_focuser.Connected = true;
}
[Test]
public void CheckThatClassCreatedProperly()
{
Assert.That(_focuser, Is.Not.Null);
}
[Test]
public void NotConnectedByDefault()
{
Assert.That(_focuser.Connected, Is.False);
}
[Test]
public void SetupDialog()
{
_sharedResourcesWrapperMock.Verify(x => x.ReadProfile(), Times.Once);
_focuser.SetupDialog();
_sharedResourcesWrapperMock.Verify(x => x.SetupDialog(), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.ReadProfile(), Times.Exactly(2));
}
[Test]
public void SupportedActions()
{
var supportedActions = _focuser.SupportedActions;
Assert.That(supportedActions, Is.Not.Null);
Assert.That(supportedActions.Count, Is.EqualTo(0));
}
[Test]
public void Action_WhenNotConnected_ThrowsNotConnectedException()
{
var actionName = "Action";
Assert.Throws<ActionNotImplementedException>(() =>
{
var actualResult = _focuser.Action(actionName, string.Empty);
Assert.Fail($"{actualResult} should not have a value");
});
}
[Test]
public void CommandBlind_WhenNotConnected_ThenThrowsNotConnectedException()
{
string expectedMessage = "test blind Message";
var exception = Assert.Throws<NotConnectedException>(() => { _focuser.CommandBlind(expectedMessage, true); });
Assert.That(exception.Message, Is.EqualTo("Not connected to focuser when trying to execute: CommandBlind"));
}
[TestCase(false)]
[TestCase(true)]
public void CommandBlind_WhenConnected_ThenSendsExpectedMessage(bool raw)
{
string expectedMessage = "test blind Message";
ConnectFocuser();
_focuser.CommandBlind(expectedMessage, raw);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(expectedMessage, raw), Times.Once);
}
[Test]
public void CommandBool_WhenNotConnected_ThenThrowsNotConnectedException()
{
string expectedMessage = "test blind Message";
var exception = Assert.Throws<NotConnectedException>(() => { _focuser.CommandBool(expectedMessage, true); });
Assert.That(exception.Message, Is.EqualTo("Not connected to focuser when trying to execute: CommandBool"));
}
[TestCase(false)]
[TestCase(true)]
public void CommandBool_WhenConnected_ThenSendsExpectedMessage(bool raw)
{
string expectedMessage = "test blind Message";
_sharedResourcesWrapperMock.Setup(x => x.SendBool(expectedMessage, raw)).Returns(true);
ConnectFocuser();
var result = _focuser.CommandBool(expectedMessage, raw);
_sharedResourcesWrapperMock.Verify(x => x.SendBool(expectedMessage, raw), Times.Once);
Assert.That(result, Is.True);
}
[Test]
public void CommandString_WhenNotConnected_ThenThrowsNotConnectedException()
{
string expectedMessage = "test blind Message";
var exception = Assert.Throws<NotConnectedException>(() => { _focuser.CommandString(expectedMessage, true); });
Assert.That(exception.Message, Is.EqualTo("Not connected to focuser when trying to execute: CommandString"));
}
[Test]
public void CommandString_WhenConnected_ThenSendsExpectedMessage()
{
string expectedMessage = "expected result message";
string sendMessage = "test blind Message";
ConnectFocuser();
_sharedResourcesWrapperMock.Setup(x => x.SendString(sendMessage, true)).Returns(() => expectedMessage);
var actualMessage = _focuser.CommandString(sendMessage, true);
_sharedResourcesWrapperMock.Verify(x => x.SendString(sendMessage, true), Times.Once);
Assert.That(actualMessage, Is.EqualTo(expectedMessage));
}
[TestCase(true)]
[TestCase(false)]
public void Connected_Get_ReturnsExpectedValue(bool expectedConnected)
{
_sharedResourcesWrapperMock.Setup(x => x.ProductName).Returns(() => TelescopeList.Autostar497);
_sharedResourcesWrapperMock.Setup(x => x.FirmwareVersion).Returns(() => TelescopeList.Autostar497_31Ee);
_focuser.Connected = expectedConnected;
Assert.That(_focuser.Connected, Is.EqualTo(expectedConnected));
}
[Test]
public void Connected_Set_WhenConnecting_Then_ConnectsToSerialDevice()
{
var productName = "LX2001";
var firmware = string.Empty;
_sharedResourcesWrapperMock.Setup(x => x.ProductName).Returns(productName);
_sharedResourcesWrapperMock.Setup(x => x.FirmwareVersion).Returns(firmware);
_focuser.Connected = true;
_sharedResourcesWrapperMock.Verify(x => x.Connect("Serial", It.IsAny<string>(), It.IsAny<ITraceLogger>()), Times.Once);
}
[Test]
public void Connected_Set_SettingTrueWhenTrue_ThenDoesNothing()
{
ConnectFocuser();
_sharedResourcesWrapperMock.Verify(x => x.Connect(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<ITraceLogger>()), Times.Once);
//act
_focuser.Connected = true;
//assert
_sharedResourcesWrapperMock.Verify(x => x.Connect(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<ITraceLogger>()), Times.Once);
}
[Test]
public void Connected_Set_SettingFalseWhenTrue_ThenDisconnects()
{
ConnectFocuser();
_sharedResourcesWrapperMock.Verify(x => x.Connect(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<ITraceLogger>()), Times.Once);
//act
_focuser.Connected = false;
//assert
_sharedResourcesWrapperMock.Verify(x => x.Disconnect(It.IsAny<string>(), It.IsAny<string>()), Times.Once());
}
//Commented out for now as the catch after connect is currently unreachable code.
//[Test]
//public void Connected_Set_WhenFailsToConnect_ThenDisconnects()
//{
// _sharedResourcesWrapperMock.Setup(x => x.ProductName).Returns(() => TelescopeList.Autostar497);
// _sharedResourcesWrapperMock.Setup(x => x.FirmwareVersion).Returns(() => TelescopeList.Autostar497_31Ee);
// _sharedResourcesWrapperMock.Setup(x => x.SendString(It.IsAny<string>())).Throws(new Exception("TestFailed"));
// //act
// _focuser.Connected = true;
// //assert
// _sharedResourcesWrapperMock.Verify(x => x.Disconnect(It.IsAny<string>(), It.IsAny<string>()), Times.Once());
//}
[Test]
public void Description_Get()
{
var expectedDescription = "Meade Generic";
var description = _focuser.Description;
Assert.That(description, Is.EqualTo(expectedDescription));
}
[Test]
public void DriverVersion_Get()
{
Version version = Assembly.GetAssembly(typeof(ASCOM.Meade.net.Focuser)).GetName().Version;
string exptectedDriverInfo = $"{version.Major}.{version.Minor}.{version.Build}.{version.Revision}";
var driverVersion = _focuser.DriverVersion;
Assert.That(driverVersion, Is.EqualTo(exptectedDriverInfo));
}
[Test]
public void DriverInfo_Get()
{
string exptectedDriverInfo = $"{_focuser.Description} .net driver. Version: {_focuser.DriverVersion}";
var driverInfo = _focuser.DriverInfo;
Assert.That(driverInfo, Is.EqualTo(exptectedDriverInfo));
}
[Test]
public void InterfaceVersion_Get()
{
var interfaceVersion = _focuser.InterfaceVersion;
Assert.That(interfaceVersion, Is.EqualTo(3));
Assert.That(_focuser, Is.AssignableTo<IFocuserV3>());
}
[Test]
public void Name_Get()
{
string expectedName = "Meade Generic";
var name = _focuser.Name;
Assert.That(name, Is.EqualTo(expectedName));
}
[Test]
public void Absolute_Get_WhenNotConnected_ThenThrowsException()
{
var exception = Assert.Throws<NotConnectedException>(() =>
{
var result = _focuser.Absolute;
Assert.Fail($"{result} should not have a value");
});
Assert.That(exception.Message, Is.EqualTo("Not connected to focuser when trying to execute: Absolute Get"));
}
[Test]
public void Absolute_Get_WhenConnected_ThenReturnsFalse()
{
ConnectFocuser();
var result = _focuser.Absolute;
Assert.That(result, Is.False);
}
[Test]
public void Halt_WhenNotConnected_ThenThrowsException()
{
var exception = Assert.Throws<NotConnectedException>(() => { _focuser.Halt(); });
Assert.That(exception.Message, Is.EqualTo("Not connected to focuser when trying to execute: Halt"));
}
[Test]
public void Halt_WhenConnected_ThenSendsHaltCommand()
{
ConnectFocuser();
_focuser.Halt();
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("FQ", false), Times.AtLeastOnce);
}
[Test]
public void IsMoving_WhenCalled_ThenReturnsFalse()
{
ConnectFocuser();
var result = _focuser.IsMoving;
Assert.That(result, Is.False);
}
[TestCase(false)]
[TestCase(true)]
public void Link_Get_ReturnsSameValueAsConnected(bool connected)
{
_sharedResourcesWrapperMock.Setup(x => x.ProductName).Returns(() => TelescopeList.Autostar497);
_sharedResourcesWrapperMock.Setup(x => x.FirmwareVersion).Returns(() => TelescopeList.Autostar497_31Ee);
_focuser.Connected = connected;
Assert.That(_focuser.Link, Is.EqualTo(connected));
}
[TestCase(false)]
[TestCase(true)]
public void Link_Set_WhenSet_ThenSetsConnectedState(bool connected)
{
_sharedResourcesWrapperMock.Setup(x => x.ProductName).Returns(() => TelescopeList.Autostar497);
_sharedResourcesWrapperMock.Setup(x => x.FirmwareVersion).Returns(() => TelescopeList.Autostar497_31Ee);
_focuser.Link = connected;
Assert.That(_focuser.Link, Is.EqualTo(connected));
}
[Test]
public void MaxIncrement_WhenCalled_ThenReturnsExpectedValue()
{
var result = _focuser.MaxIncrement;
Assert.That(result, Is.EqualTo(7000));
}
[Test]
public void MaxStep_WhenCalled_ThenReturnsExpectedValue()
{
var result = _focuser.MaxStep;
Assert.That(result, Is.EqualTo(7000));
}
[Test]
public void Move_WhenNotConnected_ThenThrowsException()
{
var exception = Assert.Throws<NotConnectedException>(() => { _focuser.Move(0); });
Assert.That(exception.Message, Is.EqualTo("Not connected to focuser when trying to execute: Move"));
}
[TestCase(-7001)]
[TestCase(7001)]
public void Move_WhenLargerThanMaxIncrement_ThenThrowsException(int position)
{
ConnectFocuser();
var exception = Assert.Throws<InvalidValueException>(() => { _focuser.Move(position); });
Assert.That(exception.Message, Is.EqualTo($"position out of range -{_focuser.MaxIncrement} < {position} < {_focuser.MaxIncrement}"));
}
[Test]
public void Move_WhenIncrementIs0_ThenDoesNothing()
{
ConnectFocuser();
_focuser.Move(0);
_utilMock.Verify(x => x.WaitForMilliseconds(It.IsAny<int>()), Times.Never);
}
[TestCase(200)]
[TestCase(-200)]
public void Move_WhenIncrementIsNot0_ThenMovesFocuserAndStopsFocuser(int position)
{
_profileProperties.BacklashCompensation = 0;
ConnectFocuser();
_focuser.Move(position);
if (position < 0)
{
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("F-", false), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("F+", false), Times.Never);
}
else
{
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("F-", false), Times.Never);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("F+", false), Times.Once);
}
_utilMock.Verify(x => x.WaitForMilliseconds(Math.Abs(position)), Times.Once);
_utilMock.Verify(x => x.WaitForMilliseconds(Math.Abs(_profileProperties.BacklashCompensation)), Times.Never);
_utilMock.Verify(x => x.WaitForMilliseconds(100), Times.Once());
}
[TestCase(200)]
[TestCase(-200)]
public void Move_WhenIncrementIsNot0_ThenMovesFocuserAndStopsFocuserWithBacklashCompensation(int position)
{
_profileProperties.BacklashCompensation = 3000;
ConnectFocuser();
_focuser.Move(position);
if (position < 0)
{
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("F-", false), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("F+", false), Times.Never);
_utilMock.Verify(x => x.WaitForMilliseconds(Math.Abs(position)), Times.Once);
_utilMock.Verify(x => x.WaitForMilliseconds(Math.Abs(_profileProperties.BacklashCompensation)), Times.Never);
_utilMock.Verify(x => x.WaitForMilliseconds(100), Times.Exactly(1));
}
else
{
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("F-", false), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("F+", false), Times.Once);
_utilMock.Verify(x => x.WaitForMilliseconds(Math.Abs(position) + _profileProperties.BacklashCompensation), Times.Once);
_utilMock.Verify(x => x.WaitForMilliseconds(_profileProperties.BacklashCompensation), Times.Once);
_utilMock.Verify(x => x.WaitForMilliseconds(100), Times.Exactly(2));
}
}
[Test]
public void Position_WhenCalled_ThenThrowsException()
{
var exception = Assert.Throws<PropertyNotImplementedException>(() =>
{
var result = _focuser.Position;
Assert.Fail($"{result} should not have a value");
});
Assert.That(exception.Message, Is.EqualTo("Property read Position is not implemented in this driver."));
}
[Test]
public void StepSize_WhenCalled_ThenThrowsException()
{
var exception = Assert.Throws<PropertyNotImplementedException>(() =>
{
var result = _focuser.StepSize;
Assert.Fail($"{result} should not have a value");
});
Assert.That(exception.Message, Is.EqualTo("Property read StepSize is not implemented in this driver."));
}
[Test]
public void TempComp_WhenRead_ThenReturnsFalse()
{
var result = _focuser.TempComp;
Assert.That(result, Is.False);
}
[Test]
public void TempComp_WhenWrite_ThenThrowsException()
{
var exception = Assert.Throws<PropertyNotImplementedException>(() => { _focuser.TempComp = false; });
Assert.That(exception.Message, Is.EqualTo("Property read TempComp is not implemented in this driver."));
}
[Test]
public void TempCompAvailable_WhenRead_ThenReturnsFalse()
{
var result = _focuser.TempCompAvailable;
Assert.That(result, Is.False);
}
[Test]
public void Temperature_WhenCalled_ThenThrowsException()
{
var exception = Assert.Throws<PropertyNotImplementedException>(() =>
{
var result = _focuser.Temperature;
Assert.Fail($"{result} should not have a value");
});
Assert.That(exception.Message, Is.EqualTo("Property read Temperature is not implemented in this driver."));
}
}
}
@@ -1,125 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\NUnit.3.13.0\build\NUnit.props" Condition="Exists('..\packages\NUnit.3.13.0\build\NUnit.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{A3991FA7-23C3-405A-96F9-5AB03AC58F30}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Meade.net.Focuser.UnitTests</RootNamespace>
<AssemblyName>Meade.net.Focuser.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>
<PlatformTarget>AnyCPU</PlatformTarget>
</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.5.1\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.5.1\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.5.1\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.5.1\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.5.1\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.5.1\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.5.1\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.5.1\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.5.1\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.5.1\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.5.1\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.1\lib\net45\Castle.Core.dll</HintPath>
</Reference>
<Reference Include="JetBrains.Annotations, Version=2020.3.0.0, Culture=neutral, PublicKeyToken=1010a0d8d6380325, processorArchitecture=MSIL">
<HintPath>..\packages\JetBrains.Annotations.2020.3.0\lib\net20\JetBrains.Annotations.dll</HintPath>
</Reference>
<Reference Include="Moq, Version=4.15.0.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
<HintPath>..\packages\Moq.4.15.2\lib\net45\Moq.dll</HintPath>
</Reference>
<Reference Include="nunit.framework, Version=3.13.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\packages\NUnit.3.13.0\lib\net45\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.5.0.0\lib\net45\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.4\lib\net461\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="FocuserUnitTests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="BootstrapAscomProfileStore.ps1" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Meade.net.focuser\Meade.net.focuser.csproj">
<Project>{a97e3aec-f11d-49da-b259-de99da813a86}</Project>
<Name>Meade.net.focuser</Name>
</ProjectReference>
<ProjectReference Include="..\Meade.net\Meade.net.csproj">
<Project>{3689a2cb-94c5-4012-a5cf-7e7d1dd27143}</Project>
<Name>Meade.net</Name>
</ProjectReference>
</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.13.0\build\NUnit.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NUnit.3.13.0\build\NUnit.props'))" />
</Target>
</Project>
@@ -1,35 +0,0 @@
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.Focuser.UnitTests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Meade.net.Focuser.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("a3991fa7-23c3-405a-96f9-5ab03ac58f30")]
// 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")]
-15
View File
@@ -1,15 +0,0 @@
<?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-5.0.0.0" newVersion="5.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
@@ -1,10 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="ASCOM.Platform" version="6.5.1" targetFramework="net472" />
<package id="Castle.Core" version="4.4.1" targetFramework="net472" />
<package id="JetBrains.Annotations" version="2020.3.0" targetFramework="net472" />
<package id="Moq" version="4.15.2" targetFramework="net472" />
<package id="NUnit" version="3.13.0" targetFramework="net472" />
<package id="System.Runtime.CompilerServices.Unsafe" version="5.0.0" targetFramework="net472" />
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net472" />
</packages>
+35
View File
@@ -18,6 +18,41 @@
Vital="yes"
Assembly=".net"
AssemblyApplication="filFocuserDriverAssembly" />
<!-- Registry entries suitable for a LocalServer served class -->
<!-- HKCR\CLSID\{driver-guid} -->
<RegistryKey Root="HKCR" Key="CLSID">
<RegistryKey Key="$(var.FocuserDriverClassId)">
<RegistryValue Value="$(var.FocuserDriverProgId)" Type="string"/>
<RegistryValue Name="AppId" Value="$(var.LocalServerAppId)" Type="string"/>
<RegistryKey Key="Implemented Categories">
<RegistryKey Key="{62C8FE65-4EBB-45e7-B440-6E39B2CDBF29}"
ForceCreateOnInstall="yes"
ForceDeleteOnUninstall="yes"/>
</RegistryKey>
<RegistryKey Key="ProgId">
<RegistryValue Value="$(var.FocuserDriverProgId)" Type="string"/>
</RegistryKey>
<RegistryKey Key="Programmable"
ForceCreateOnInstall="yes"
ForceDeleteOnUninstall="yes" />
<RegistryKey Key="LocalServer32">
<RegistryValue Value="[#filLocalServerAssembly]" Type="string"/>
</RegistryKey>
</RegistryKey>
</RegistryKey>
<!-- HKCR\{driver-prog-id} -->
<RegistryKey Root="HKCR" Key="$(var.FocuserDriverProgId)">
<RegistryValue Value="$(var.FocuserDriverDescription)" Type="string"/>
<RegistryKey Key="CLSID">
<RegistryValue Value="$(var.FocuserDriverClassId)" Type="string" />
</RegistryKey>
</RegistryKey>
<!--Register the driver with the ASCOM Profile-->
<RegistryKey Root="HKLM" Key="SOFTWARE\ASCOM\Focuser Drivers\$(var.FocuserDriverProgId)">
<RegistryValue Value="$(var.FocuserDriverDescription)" Type="string"/>
</RegistryKey>
</Component>
</ComponentGroup>
</Fragment>
+15 -25
View File
@@ -12,31 +12,21 @@
Assembly=".net"
AssemblyApplication="filLocalServerAssembly" />
</Component>
<Component Id="cmpLocalServerRegistry" Win64="no">
<!-- LocalServer32 COM Registration -->
<RegistryKey Root="HKCR" Key="AppID" >
<!-- HKCR\AppID\{my-app-id} -->
<RegistryKey Key="$(var.LocalServerAppId)">
<RegistryValue Value="$(var.InstallName)" Type="string"/>
<RegistryValue Name="AppID" Value="$(var.LocalServerAppId)" Type="string"/>
<RegistryValue Name="AuthenticationLevel" Value="1" Type="integer"/>
</RegistryKey>
<!-- HKCR\AppID\{exe-name} -->
<RegistryKey Key="$(var.Meade.net.TargetFileName)">
<RegistryValue Name="AppID" Value="$(var.LocalServerAppId)" Type="string"/>
</RegistryKey>
</RegistryKey>
</Component>
</ComponentGroup>
<CustomAction Id="RegisterEXE"
Directory="INSTALLFOLDER"
ExeCommand="&quot;[#filLocalServerAssembly]&quot; /register"
Execute="deferred"
Return="ignore"
Impersonate="no"
/>
<CustomAction Id="UnRegisterEXE"
Directory="INSTALLFOLDER"
ExeCommand="&quot;[#filLocalServerAssembly]&quot; /unregister"
Execute="deferred"
Return="ignore"
Impersonate="no"
/>
<InstallExecuteSequence>
<Custom Action='RegisterEXE' Before="InstallFinalize">
<![CDATA[(NOT Installed)]]>
</Custom>
<Custom Action="UnRegisterEXE" After="InstallInitialize">
<![CDATA[(REMOVE ~= "ALL" AND NOT UPGRADINGPRODUCTCODE)]]>
</Custom>
</InstallExecuteSequence>
</Fragment>
</Wix>
+35
View File
@@ -18,6 +18,41 @@
Vital="yes"
Assembly=".net"
AssemblyApplication="filTelescopeDriverAssembly" />
<!-- Registry entries suitable for a LocalServer served class -->
<!-- HKCR\CLSID\{driver-guid} -->
<RegistryKey Root="HKCR" Key="CLSID">
<RegistryKey Key="$(var.TelescopeDriverClassId)">
<RegistryValue Value="$(var.TelescopeDriverProgId)" Type="string"/>
<RegistryValue Name="AppId" Value="$(var.LocalServerAppId)" Type="string"/>
<RegistryKey Key="Implemented Categories">
<RegistryKey Key="{62C8FE65-4EBB-45e7-B440-6E39B2CDBF29}"
ForceCreateOnInstall="yes"
ForceDeleteOnUninstall="yes"/>
</RegistryKey>
<RegistryKey Key="ProgId">
<RegistryValue Value="$(var.TelescopeDriverProgId)" Type="string"/>
</RegistryKey>
<RegistryKey Key="Programmable"
ForceCreateOnInstall="yes"
ForceDeleteOnUninstall="yes" />
<RegistryKey Key="LocalServer32">
<RegistryValue Value="[#filLocalServerAssembly]" Type="string"/>
</RegistryKey>
</RegistryKey>
</RegistryKey>
<!-- HKCR\{driver-prog-id} -->
<RegistryKey Root="HKCR" Key="$(var.TelescopeDriverProgId)">
<RegistryValue Value="$(var.TelescopeDriverDescription)" Type="string"/>
<RegistryKey Key="CLSID">
<RegistryValue Value="$(var.TelescopeDriverClassId)" Type="string" />
</RegistryKey>
</RegistryKey>
<!--Register the driver with the ASCOM Profile-->
<RegistryKey Root="HKLM" Key="SOFTWARE\ASCOM\Telescope Drivers\$(var.TelescopeDriverProgId)">
<RegistryValue Value="$(var.TelescopeDriverDescription)" Type="string"/>
</RegistryKey>
</Component>
</ComponentGroup>
</Fragment>
+3 -3
View File
@@ -11,7 +11,7 @@
UpgradeCode must be unique to this product and should not be changed for the product lifetime.
-->
<?define InstallName = "ASCOM Meade Generic" ?>
<?define InstallName = "ASCOM Meade.net" ?>
<?define Manufacturer = "cjdawson.com" ?>
<?define UpgradeCode = "{57597bb6-f207-4998-97f4-8a041950d062}" ?>
<?define INSTALLFOLDER = "$(var.InstallName)" ?>
@@ -43,6 +43,6 @@
<!-- <?endif ?> -->
<!-- Set installer version based on the file version of the main assembly. -->
<?define ProductVersion="!(bind.FileVersion.filLocalServerAssembly)"?>
<!--<?define ProductVersion="0.7.0.0"?>-->
<!--<?define ProductVersion="!(bind.FileVersion.filLocalServerAssembly)"?>-->
<?define ProductVersion="0.6.0.1"?>
</Include>
Binary file not shown.
-1
View File
@@ -48,7 +48,6 @@
</ItemGroup>
<ItemGroup>
<Content Include="Config.wxi" />
<Content Include="License.rtf" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Meade.net.focuser\Meade.net.focuser.csproj">
+9 -5
View File
@@ -25,12 +25,17 @@
<![CDATA[Installed OR ASCOMPLATFORMVERSION >= "6.4.1"]]>
</Condition>
<PropertyRef Id="NETFRAMEWORK45"/>
<Condition Message="This application requires .NET Framework 4.5 or higher. Please install the .NET Framework then run this installer again.">
<![CDATA[Installed OR NETFRAMEWORK45]]>
<PropertyRef Id="NETFRAMEWORK40FULL"/>
<Condition Message="This application requires .NET Framework 4.0 or higher. Please install the .NET Framework then run this installer again.">
<![CDATA[Installed OR NETFRAMEWORK40FULL]]>
</Condition>
<!-- <Condition Message="Please use the correct installer for your operating system - x86 for 32-bit, x64 for 64-bit.">
<!--todo create a method to check if ASCOM is installed.-->
<!--<Condition Message="This application requires ASCOM Platform 6.4 or later. Please install this and try again.">
<![CDATA[Installed or WIX_IS_NETFRAMEWORK_471_OR_LATER_INSTALLED]]>
</Condition>-->
<!-- <Condition Message="Please use the correct installer for your operating system - x86 for 32-bit, x64 for 64-bit.">
<?if $(var.Win64) = "yes" ?>
VersionNT64
<?else?>
@@ -41,7 +46,6 @@
<UIRef Id="InstallationUI"/>
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER" />
<WixVariable Id="WixUILicenseRtf" Value="License.rtf" />
<FeatureGroupRef Id="fgRoot"/>
</Product>
@@ -1,36 +0,0 @@
<#
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
@@ -1,145 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\NUnit.3.13.0\build\NUnit.props" Condition="Exists('..\packages\NUnit.3.13.0\build\NUnit.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{B7EEEEFD-5BFF-443D-981C-7B8AB5DFDE33}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Meade.net.Telescope.UnitTests</RootNamespace>
<AssemblyName>Meade.net.Telescope.UnitTests</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
<TargetFrameworkProfile />
</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>
<Prefer32Bit>false</Prefer32Bit>
<PlatformTarget>AnyCPU</PlatformTarget>
</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>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="ASCOM.Astrometry, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.5.1\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.5.1\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.5.1\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.5.1\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.5.1\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.5.1\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.5.1\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.5.1\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.5.1\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.5.1\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.5.1\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.1\lib\net45\Castle.Core.dll</HintPath>
</Reference>
<Reference Include="JetBrains.Annotations, Version=2020.3.0.0, Culture=neutral, PublicKeyToken=1010a0d8d6380325, processorArchitecture=MSIL">
<HintPath>..\packages\JetBrains.Annotations.2020.3.0\lib\net20\JetBrains.Annotations.dll</HintPath>
</Reference>
<Reference Include="Moq, Version=4.15.0.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
<HintPath>..\packages\Moq.4.15.2\lib\net45\Moq.dll</HintPath>
</Reference>
<Reference Include="nunit.framework, Version=3.13.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\packages\NUnit.3.13.0\lib\net45\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.5.0.0\lib\net45\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.4\lib\net461\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.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="TelescopeUnitTests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Meade.net.Telescope\Meade.net.Telescope.csproj">
<Project>{64308775-bd4a-469c-bcab-3ed830b811af}</Project>
<Name>Meade.net.Telescope</Name>
</ProjectReference>
<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.13.0\build\NUnit.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NUnit.3.13.0\build\NUnit.props'))" />
</Target>
</Project>
@@ -1,35 +0,0 @@
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.Telescope.UnitTests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Meade.net.Telescope.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("b7eeeefd-5bff-443d-981c-7b8ab5dfde33")]
// 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("0.0.0.0")]
[assembly: AssemblyFileVersion("0.0.0.0")]
File diff suppressed because it is too large Load Diff
-15
View File
@@ -1,15 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
</dependentAssembly>
<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>
</assemblyBinding>
</runtime>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" /></startup></configuration>
@@ -1,10 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="ASCOM.Platform" version="6.5.1" targetFramework="net472" />
<package id="Castle.Core" version="4.4.1" targetFramework="net472" />
<package id="JetBrains.Annotations" version="2020.3.0" targetFramework="net472" />
<package id="Moq" version="4.15.2" targetFramework="net472" />
<package id="NUnit" version="3.13.0" targetFramework="net472" />
<package id="System.Runtime.CompilerServices.Unsafe" version="5.0.0" targetFramework="net472" />
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net472" />
</packages>
-12
View File
@@ -1,12 +0,0 @@
namespace ASCOM.Meade.net
{
public enum Alignment
{
NeedsAlignment,
OneStarAligned,
TwoStarAligned,
ThreeStarAligned,
AlignedOnHome,
ScopeWasParked,
}
}
-16
View File
@@ -1,16 +0,0 @@
using ASCOM.DeviceInterface;
namespace ASCOM.Meade.net
{
public class AlignmentStatus
{
public AlignmentModes AlignmentMode { get; set; }
public bool Tracking { get; set; }
public Alignment Status { get; set; }
public override string ToString()
{
return $"AlignmentStatus AlignmentMode={AlignmentMode};Tracking={Tracking};Status={Status}";
}
}
}
+212
View File
@@ -0,0 +1,212 @@
using System;
using ASCOM.Utilities;
namespace ASCOM.Meade.net
{
public class EquatorialCoordinates
{
public double RightAscension { get; set; }
public double Declination { get; set; }
}
public class HorizonCoordinates
{
public double Altitude { get; set; }
public double Azimuth { get; set; }
}
public class AltitudeData
{
public DateTime UtcDateTime { get; set; }
public double SiteLatitude { get; set; }
public double SiteLongitude { get; set; }
public EquatorialCoordinates equatorialCoordinates { get; set; }
}
public class AstroMaths
{
//returns the decimal hour angle for given right ascension on a given datetime for a given logitude.
public double RightAscensionToHourAngle(DateTime utcDateTime, double longitude, double rightAscension)
{
var ut = DateTimeToDecimalHours( utcDateTime);
var gst = UTtoGST( utcDateTime);
var lst = GSTtoLST( gst, longitude);
var raHours = rightAscension;
var h1 = lst - raHours;
var h = h1;
if (h < 0)
h = h + 24;
return h;
}
public double HourAngleToRightAscension(DateTime utcDateTime, double longitude, double hourAngle )
{
var gst = UTtoGST(utcDateTime);
var lst = GSTtoLST( gst, longitude);
var raHours = hourAngle;
var h1 = lst - raHours;
var h = h1;
if (h1 < 0)
{
h += 24;
}
return h;
}
public EquatorialCoordinates ConvertHozToEq( DateTime utcDateTime, double latitude, double longitude, HorizonCoordinates altAz)
{
var az = DegreesToRadians(altAz.Azimuth);
var alt = DegreesToRadians(altAz.Altitude);
var lat = DegreesToRadians(latitude);
var sinDec = Math.Sin(alt) * Math.Sin(lat) + Math.Cos(alt) * Math.Cos(lat) * Math.Cos(az);
var dec = RadiansToDegrees(Math.Asin(sinDec));
var y = -Math.Cos(alt) * Math.Cos(lat) * Math.Sin(az);
var x = Math.Sin(alt) - Math.Sin(lat) * sinDec;
var upperA = Math.Atan2(y,x);
var upperB = RadiansToDegrees(upperA);
var ha = upperB;
if (upperB < 0)
{
ha += 360;
}
ha = ha / 15;
EquatorialCoordinates equatorialCoordinates = new EquatorialCoordinates
{
RightAscension = HourAngleToRightAscension( utcDateTime, longitude, ha ),
Declination = dec
};
return equatorialCoordinates;
}
public HorizonCoordinates ConvertEqToHoz(double hourAngle, double latitude, EquatorialCoordinates raDec)
{
var h = hourAngle * 15;
var h1 = DegreesToRadians(h);
var d = DegreesToRadians(raDec.Declination);
var lat = DegreesToRadians(latitude);
var sinA = Math.Sin(d) * Math.Sin(lat) + Math.Cos(d) * Math.Cos(lat) * Math.Cos(h1);
var y = -Math.Cos(d) * Math.Cos(lat) * Math.Sin(h1);
var x = Math.Sin(d) - Math.Sin(lat) * sinA;
var upperA = Math.Atan2(y, x);
var upperB = RadiansToDegrees(upperA);
var horizonCoordinates = new HorizonCoordinates();
horizonCoordinates.Altitude = RadiansToDegrees(Math.Asin(sinA));
horizonCoordinates.Azimuth = upperB;
if (upperB < 0)
{
horizonCoordinates.Azimuth = 360 + horizonCoordinates.Azimuth;
}
return horizonCoordinates;
}
//todo convert to extension method
public double DegreesToRadians(double degrees)
{
return (Math.PI / 180) * degrees;
}
//todo convert to extension method
public double RadiansToDegrees(double radians)
{
double degrees = (180 / Math.PI) * radians;
return (degrees);
}
//todo convert to extension method
public double DateTimeToDecimalHours( DateTime utcDateTime)
{
double sec = utcDateTime.Second;
double min = utcDateTime.Minute;
double hour = utcDateTime.Hour;
var a = Math.Abs(sec) / 60;
var b = (Math.Abs(min) + a) / 60;
var c = Math.Abs(hour) + b;
var d = c;
if ((hour < 0) || (min < 0) || (sec < 0))
d = -c;
return d;
}
//todo convert to extension method
public double UTtoGST(DateTime utcDateTime)
{
Util util = new Util();
var jd = util.DateUTCToJulian(utcDateTime) - 0.5;
if ((jd % 1) <= 0.5 )
jd = Math.Floor( jd );
else
jd = Math.Floor( jd ) + 0.5;
var s = jd - 2451545.0;
var t = s / 36525.0;
var t0 = 6.697374558 + (2400.051336 * t ) +(0.000025862 * (t * t) );
while (t0 < 0)
{
t0 += 24;
}
while (t0 >= 24)
{
t0 -= 24;
}
var ut = DateTimeToDecimalHours(utcDateTime);
var a = ut * 1.002737909;
var t1 = t0 + a;
while (t1 < 0)
{
t1 += 24;
}
while (t1 >= 24)
{
t1 -= 24;
}
return t1;
}
public double GSTtoLST(double gst, double longitude)
{
var l = longitude/ 15;
var lst = gst + l;
while (lst < 0 )
{
lst += 24;
}
while (lst >= 24)
{
lst -= 24;
}
return lst;
}
}
}
@@ -1,12 +0,0 @@
using System;
namespace ASCOM.Meade.net.AstroMaths
{
public class AltitudeData
{
public DateTime UtcDateTime { get; set; }
public double SiteLatitude { get; set; }
public double SiteLongitude { get; set; }
public EquatorialCoordinates EquatorialCoordinates { get; set; }
}
}
@@ -1,79 +0,0 @@
using System;
using ASCOM.Utilities;
namespace ASCOM.Meade.net.AstroMaths
{
public static class AstroMathExtensions
{
public static double DegreesToRadians(this double degrees)
{
return (Math.PI / 180) * degrees;
}
public static double RadiansToDegrees(this double radians)
{
double degrees = (180 / Math.PI) * radians;
return degrees;
}
public static double DateTimeToDecimalHours(this DateTime utcDateTime)
{
double sec = utcDateTime.Second;
double min = utcDateTime.Minute;
double hour = utcDateTime.Hour;
var a = Math.Abs(sec) / 60;
var b = (Math.Abs(min) + a) / 60;
var c = Math.Abs(hour) + b;
var d = c;
if ((hour < 0) || (min < 0) || (sec < 0))
d = -c;
return d;
}
public static double UTtoGst( this DateTime utcDateTime)
{
Util util = new Util();
var jd = util.DateUTCToJulian(utcDateTime) - 0.5;
if ((jd % 1) <= 0.5)
jd = Math.Floor(jd);
else
jd = Math.Floor(jd) + 0.5;
var s = jd - 2451545.0;
var t = s / 36525.0;
var t0 = 6.697374558 + (2400.051336 * t) + (0.000025862 * (t * t));
while (t0 < 0)
{
t0 += 24;
}
while (t0 >= 24)
{
t0 -= 24;
}
var ut = utcDateTime.DateTimeToDecimalHours();
var a = ut * 1.002737909;
var t1 = t0 + a;
while (t1 < 0)
{
t1 += 24;
}
while (t1 >= 24)
{
t1 -= 24;
}
return t1;
}
}
}
@@ -1,116 +0,0 @@
using System;
namespace ASCOM.Meade.net.AstroMaths
{
public class AstroMaths : IAstroMaths
{
//returns the decimal hour angle for given right ascension on a given datetime for a given logitude.
public double RightAscensionToHourAngle(DateTime utcDateTime, double longitude, double rightAscension)
{
//var ut = DateTimeToDecimalHours( utcDateTime);
var gst = utcDateTime.UTtoGst();
var lst = GsTtoLst( gst, longitude);
var raHours = rightAscension;
var h1 = lst - raHours;
var h = h1;
if (h < 0)
h = h + 24;
return h;
}
private double HourAngleToRightAscension(DateTime utcDateTime, double longitude, double hourAngle )
{
var gst = utcDateTime.UTtoGst();
var lst = GsTtoLst( gst, longitude);
var raHours = hourAngle;
var h1 = lst - raHours;
var h = h1;
if (h1 < 0)
{
h += 24;
}
return h;
}
public EquatorialCoordinates ConvertHozToEq( DateTime utcDateTime, double latitude, double longitude, HorizonCoordinates altAz)
{
var az = altAz.Azimuth.DegreesToRadians();
var alt = altAz.Altitude.DegreesToRadians();
var lat = latitude.DegreesToRadians();
var sinDec = Math.Sin(alt) * Math.Sin(lat) + Math.Cos(alt) * Math.Cos(lat) * Math.Cos(az);
var dec = Math.Asin(sinDec).RadiansToDegrees();
var y = -Math.Cos(alt) * Math.Cos(lat) * Math.Sin(az);
var x = Math.Sin(alt) - Math.Sin(lat) * sinDec;
var upperA = Math.Atan2(y,x);
var upperB = upperA.RadiansToDegrees();
var ha = upperB;
if (upperB < 0)
{
ha += 360;
}
ha = ha / 15;
EquatorialCoordinates equatorialCoordinates = new EquatorialCoordinates
{
RightAscension = HourAngleToRightAscension( utcDateTime, longitude, ha ),
Declination = dec
};
return equatorialCoordinates;
}
public HorizonCoordinates ConvertEqToHoz(double hourAngle, double latitude, EquatorialCoordinates raDec)
{
var h = hourAngle * 15;
var h1 = h.DegreesToRadians();
var d = raDec.Declination.DegreesToRadians();
var lat = latitude.DegreesToRadians();
var sinA = Math.Sin(d) * Math.Sin(lat) + Math.Cos(d) * Math.Cos(lat) * Math.Cos(h1);
var y = -Math.Cos(d) * Math.Cos(lat) * Math.Sin(h1);
var x = Math.Sin(d) - Math.Sin(lat) * sinA;
var upperA = Math.Atan2(y, x);
var upperB = upperA.RadiansToDegrees();
var horizonCoordinates = new HorizonCoordinates
{
Altitude = Math.Asin(sinA).RadiansToDegrees(),
Azimuth = upperB
};
if (upperB < 0)
{
horizonCoordinates.Azimuth = 360 + horizonCoordinates.Azimuth;
}
return horizonCoordinates;
}
public double GsTtoLst(double gst, double longitude)
{
var l = longitude/ 15;
var lst = gst + l;
while (lst < 0 )
{
lst += 24;
}
while (lst >= 24)
{
lst -= 24;
}
return lst;
}
}
}
@@ -1,8 +0,0 @@
namespace ASCOM.Meade.net.AstroMaths
{
public class EquatorialCoordinates
{
public double RightAscension { get; set; }
public double Declination { get; set; }
}
}
@@ -1,17 +0,0 @@
using System;
namespace ASCOM.Meade.net.AstroMaths
{
public interface IAstroMaths
{
double RightAscensionToHourAngle(DateTime utcDateTime, double longitude, double rightAscension);
//double HourAngleToRightAscension(DateTime utcDateTime, double longitude, double hourAngle );
EquatorialCoordinates ConvertHozToEq( DateTime utcDateTime, double latitude, double longitude, HorizonCoordinates altAz);
HorizonCoordinates ConvertEqToHoz(double hourAngle, double latitude, EquatorialCoordinates raDec);
//double DegreesToRadians(double degrees);
//double RadiansToDegrees(double radians);
//double DateTimeToDecimalHours( DateTime utcDateTime);
//double UTtoGst(DateTime utcDateTime);
//double GsTtoLst(double gst, double longitude);
}
}
@@ -1,36 +0,0 @@
<#
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
-9
View File
@@ -1,9 +0,0 @@
using System;
namespace ASCOM.Meade.net
{
public class Clock : IClock
{
public DateTime UtcNow => DateTime.UtcNow;
}
}
-9
View File
@@ -1,9 +0,0 @@
namespace ASCOM.Meade.net
{
public enum ComparisonResult
{
Lower,
Equals,
Greater
}
}
-27
View File
@@ -1,27 +0,0 @@
namespace ASCOM.Meade.net
{
public static class DoubleExtensions
{
public static bool InRange(this double value, double low, double high)
{
if (value < low)
return false;
if (value > high)
return false;
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;
}
}
}
@@ -1,10 +0,0 @@
namespace System
{
static class DoubelExtensions
{
public static bool Between(this double value, double lower, double higher)
{
return value >= lower & value <= higher;
}
}
}
-9
View File
@@ -1,9 +0,0 @@
using System;
namespace ASCOM.Meade.net
{
public interface IClock
{
DateTime UtcNow { get; }
}
}
+14 -61
View File
@@ -15,7 +15,7 @@
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<OldToolsVersion>3.5</OldToolsVersion>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<ApplicationIcon>ASCOM.ico</ApplicationIcon>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>ASCOMDriverTemplate.snk</AssemblyOriginatorKeyFile>
@@ -46,7 +46,7 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<RegisterForComInterop>true</RegisterForComInterop>
<PlatformTarget>AnyCPU</PlatformTarget>
<PlatformTarget>x86</PlatformTarget>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
@@ -62,50 +62,20 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>..\bin\Release\</OutputPath>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<OutputPath>..\bin\Debug\</OutputPath>
<PlatformTarget>AnyCPU</PlatformTarget>
<Prefer32Bit>false</Prefer32Bit>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<Reference Include="ASCOM.Astrometry, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.5.1\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.5.1\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.5.1\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.5.1\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.5.1\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.5.1\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.5.1\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.5.1\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.5.1\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.5.1\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.5.1\lib\net40\ASCOM.Utilities.Video.dll</HintPath>
</Reference>
<Reference Include="JetBrains.Annotations, Version=2020.3.0.0, Culture=neutral, PublicKeyToken=1010a0d8d6380325, processorArchitecture=MSIL">
<HintPath>..\packages\JetBrains.Annotations.2020.3.0\lib\net20\JetBrains.Annotations.dll</HintPath>
</Reference>
<Reference Include="ASCOM.Astrometry, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL" />
<Reference Include="ASCOM.Attributes, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL" />
<Reference Include="ASCOM.Controls, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL" />
<Reference Include="ASCOM.DeviceInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL" />
<Reference Include="ASCOM.Exceptions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL" />
<Reference Include="ASCOM.SettingsProvider, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL" />
<Reference Include="ASCOM.Utilities, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL" />
<Reference Include="ASCOM.Utilities.Video, Version=6.1.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL" />
<Reference Include="System" />
<Reference Include="System.configuration" />
<Reference Include="System.Configuration.Install" />
@@ -118,18 +88,7 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Alignment.cs" />
<Compile Include="AlignmentStatus.cs" />
<Compile Include="AstroMaths\AltitudeData.cs" />
<Compile Include="AstroMaths\AstroMathExtensions.cs" />
<Compile Include="AstroMaths\AstroMaths.cs" />
<Compile Include="AstroMaths\EquatorialCoordinates.cs" />
<Compile Include="AstroMaths\IAstroMaths.cs" />
<Compile Include="Clock.cs" />
<Compile Include="ComparisonResult.cs" />
<Compile Include="DoubleExtensions.cs" />
<Compile Include="ExtensionMethods\DoubelExtensions.cs" />
<Compile Include="IClock.cs" />
<Compile Include="AstroMaths.cs" />
<Compile Include="StringExtensions.cs" />
<Compile Include="Telescope.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
@@ -156,13 +115,12 @@
<None Include="app.config" />
<None Include="ASCOM.png" />
<None Include="ASCOMDriverTemplate.snk" />
<None Include="BootstrapAscomProfileStore.ps1" />
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Content Include="ASCOM.ico" />
<Content Include="ReadMe.htm" />
<None Include="Resources\ASCOM.bmp" />
</ItemGroup>
<ItemGroup>
@@ -188,17 +146,12 @@
<Name>Meade.net</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PreBuildEvent>
</PreBuildEvent>
</PropertyGroup>
<PropertyGroup>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
@@ -1,5 +0,0 @@
<ProjectConfiguration>
<Settings>
<UseCPUArchitecture>x86</UseCPUArchitecture>
</Settings>
</ProjectConfiguration>
@@ -1,10 +1,12 @@
using System.Reflection;
using System.Runtime.CompilerServices;
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.
//
// TODO - Add your authorship information here
[assembly: AssemblyTitle("ASCOM.Meade.net.Telescope")]
[assembly: AssemblyDescription("ASCOM Telescope driver for Meade.net")]
[assembly: AssemblyConfiguration("")]
@@ -17,7 +19,7 @@ using System.Runtime.InteropServices;
// 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)]
[assembly: ComVisible(true)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("8b9fccb9-87ae-42f7-90af-079e13de6efb")]
@@ -32,5 +34,6 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
//
[assembly: AssemblyVersion("0.0.0.0")]
[assembly: AssemblyFileVersion("0.0.0.0")]
// TODO - Set your driver's version here
[assembly: AssemblyVersion("0.6.0.1")]
[assembly: AssemblyFileVersion("0.6.0.1")]
-27
View File
@@ -79,32 +79,5 @@ namespace ASCOM.Meade.net.Properties {
return ((System.Drawing.Icon)(obj));
}
}
/// <summary>
/// Looks up a localized string similar to Site out of range.
/// </summary>
internal static string Telescope_GetSiteName_Site_out_of_range {
get {
return ResourceManager.GetString("Telescope_GetSiteName_Site_out_of_range", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Site cannot be higher than 4.
/// </summary>
internal static string Telescope_SelectSite_Site_cannot_be_higher_than_4 {
get {
return ResourceManager.GetString("Telescope_SelectSite_Site_cannot_be_higher_than_4", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Site cannot be lower than 1.
/// </summary>
internal static string Telescope_SelectSite_Site_cannot_be_lower_than_1 {
get {
return ResourceManager.GetString("Telescope_SelectSite_Site_cannot_be_lower_than_1", resourceCulture);
}
}
}
}
@@ -124,13 +124,4 @@
<data name="DefaultIcon" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\ASCOM.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Telescope_SelectSite_Site_cannot_be_lower_than_1" xml:space="preserve">
<value>Site cannot be lower than 1</value>
</data>
<data name="Telescope_SelectSite_Site_cannot_be_higher_than_4" xml:space="preserve">
<value>Site cannot be higher than 4</value>
</data>
<data name="Telescope_GetSiteName_Site_out_of_range" xml:space="preserve">
<value>Site out of range</value>
</data>
</root>
+1 -1
View File
@@ -12,7 +12,7 @@ namespace ASCOM.Meade.net.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.4.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+66 -51
View File
@@ -1,7 +1,11 @@
using System.Collections;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using System.Threading;
using ASCOM.DeviceInterface;
using System.Collections;
using System.Threading;
namespace ASCOM.Meade.net
{
@@ -17,28 +21,39 @@ namespace ASCOM.Meade.net
[Guid("288838d1-bbf9-4ce0-9ee1-86ecf38b45c9")]
[ClassInterface(ClassInterfaceType.None)]
[ComVisible(true)]
public class Rate : IRate
public class Rate : ASCOM.DeviceInterface.IRate
{
private double maximum = 0;
private double minimum = 0;
//
// Default constructor - Internal prevents public creation
// of instances. These are values for AxisRates.
//
internal Rate(double minimum, double maximum)
{
Maximum = maximum;
Minimum = minimum;
this.maximum = maximum;
this.minimum = minimum;
}
#region Implementation of IRate
public void Dispose()
{
// Add any required object cleanup here
// TODO Add any required object cleanup here
}
public double Maximum { get; set; }
public double Maximum
{
get { return this.maximum; }
set { this.maximum = value; }
}
public double Minimum { get; set; }
public double Minimum
{
get { return this.minimum; }
set { this.minimum = value; }
}
#endregion
}
@@ -59,8 +74,8 @@ namespace ASCOM.Meade.net
[ComVisible(true)]
public class AxisRates : IAxisRates, IEnumerable
{
private TelescopeAxes _axis;
private readonly Rate[] _rates;
private TelescopeAxes axis;
private readonly Rate[] rates;
//
// Constructor - Internal prevents public creation
@@ -68,7 +83,7 @@ namespace ASCOM.Meade.net
//
internal AxisRates(TelescopeAxes axis)
{
_axis = axis;
this.axis = axis;
//
// This collection must hold zero or more Rate objects describing the
// rates of motion ranges for the Telescope.MoveAxis() method
@@ -82,39 +97,44 @@ namespace ASCOM.Meade.net
switch (axis)
{
case TelescopeAxes.axisPrimary:
case TelescopeAxes.axisSecondary:
// 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) }
//this.rates = new Rate[0];
_rates = new[] { new Rate(1, 1), new Rate(2, 2), new Rate(3, 3), new Rate(4, 4) };
this.rates = new Rate[] { new Rate(1, 1), new Rate(2, 2), new Rate(3, 3), new Rate(4, 4) };
break;
case TelescopeAxes.axisSecondary:
// TODO Initialize this array with any Secondary axis rates that your driver may provide
//this.rates = new Rate[0];
this.rates = new Rate[] { new Rate(1, 1), new Rate(2, 2), new Rate(3, 3), new Rate(4, 4) };
break;
//// TODO Initialize this array with any Secondary axis rates that your driver may provide
////this.rates = new Rate[0];
//_rates = new[] { new Rate(1, 1), new Rate(2, 2), new Rate(3, 3), new Rate(4, 4) };
//break;
case TelescopeAxes.axisTertiary:
// TODO Initialize this array with any Tertiary axis rates that your driver may provide
_rates = new Rate[0];
this.rates = new Rate[0];
break;
}
}
#region IAxisRates Members
public int Count => _rates.Length;
public int Count
{
get { return this.rates.Length; }
}
public void Dispose()
{
// Add any required object cleanup here
// TODO Add any required object cleanup here
}
public IEnumerator GetEnumerator()
{
return _rates.GetEnumerator();
return rates.GetEnumerator();
}
public IRate this[int index] => _rates[index - 1];
public IRate this[int index]
{
get { return this.rates[index - 1]; } // 1-based
}
#endregion
}
@@ -139,51 +159,49 @@ namespace ASCOM.Meade.net
[ComVisible(true)]
public class TrackingRates : ITrackingRates, IEnumerable, IEnumerator
{
private readonly DriveRates[] _trackingRates;
private readonly DriveRates[] trackingRates;
// this is used to make the index thread safe
private readonly ThreadLocal<int> _pos = new ThreadLocal<int>(() => -1);
private static readonly object LockObj = new object();
private readonly ThreadLocal<int> pos = new ThreadLocal<int>(() => { return -1; });
private static readonly object lockObj = new object();
//
// Default constructor - Internal prevents public creation
// of instances. Returned by Telescope.AxisRates.
//
internal TrackingRates(bool supportsLunar)
internal TrackingRates()
{
//
// This array must hold ONE or more DriveRates values, indicating
// the tracking rates supported by your telescope. The one value
// (tracking rate) that MUST be supported is driveSidereal!
//
if (supportsLunar)
{
_trackingRates = new[] {DriveRates.driveSidereal, DriveRates.driveLunar};
}
else
_trackingRates = new[] { DriveRates.driveSidereal };
this.trackingRates = new[] { DriveRates.driveSidereal, DriveRates.driveLunar };
// TODO Initialize this array with any additional tracking rates that your driver may provide
}
#region ITrackingRates Members
public int Count => _trackingRates.Length;
public int Count
{
get { return this.trackingRates.Length; }
}
public IEnumerator GetEnumerator()
{
lock (LockObj)
{
_pos.Value = -1;
}
return this;
pos.Value = -1;
return this as IEnumerator;
}
public void Dispose()
{
// Add any required object cleanup here
// TODO Add any required object cleanup here
}
public DriveRates this[int index] => _trackingRates[index - 1];
public DriveRates this[int index]
{
get { return this.trackingRates[index - 1]; } // 1-based
}
#endregion
@@ -193,22 +211,22 @@ namespace ASCOM.Meade.net
{
get
{
lock (LockObj)
lock (lockObj)
{
if (_pos.Value < 0 || _pos.Value >= _trackingRates.Length)
if (pos.Value < 0 || pos.Value >= trackingRates.Length)
{
throw new System.InvalidOperationException();
}
return _trackingRates[_pos.Value];
return trackingRates[pos.Value];
}
}
}
public bool MoveNext()
{
lock (LockObj)
lock (lockObj)
{
if (++_pos.Value >= _trackingRates.Length)
if (++pos.Value >= trackingRates.Length)
{
return false;
}
@@ -218,10 +236,7 @@ namespace ASCOM.Meade.net
public void Reset()
{
lock (LockObj)
{
_pos.Value = -1;
}
pos.Value = -1;
}
#endregion
}
+147
View File
@@ -0,0 +1,147 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=windows-1252">
<TITLE>Untitled Document</TITLE>
<META NAME="GENERATOR" CONTENT="OpenOffice.org 3.2 (Win32)">
<META NAME="CREATED" CONTENT="0;0">
<META NAME="CHANGEDBY" CONTENT="Chris Rowland">
<META NAME="CHANGED" CONTENT="20110918;14150500">
<STYLE TYPE="text/css">
<!--
@page { margin: 2cm }
P { font-family: "Verdana", "Arial", "Helvetica", sans-serif; font-weight: normal }
TD P { font-family: "Verdana", "Arial", "Helvetica", sans-serif; font-weight: normal }
H3 { font-family: "Arial", "Helvetica", sans-serif }
H2 { font-family: "Arial", "Helvetica", sans-serif }
H4 { font-family: "Arial", "Helvetica", sans-serif }
TD P.note { background: #33ffff; font-family: "Verdana", "Arial", "Helvetica", sans-serif; font-weight: normal }
TD P.underline { font-family: "Verdana", "Arial", "Helvetica", sans-serif; font-weight: normal; text-decoration: underline }
-->
</STYLE>
</HEAD>
<BODY LANG="en-GB" DIR="LTR">
<TABLE WIDTH=100% BORDER=0 CELLPADDING=4 CELLSPACING=0>
<TR>
<TD>
<H2>ASCOM Telescope Driver (C#)</H2>
</TD>
</TR>
</TABLE>
<P><BR><BR>
</P>
<H4>You have just created the skeleton of an ASCOM
Telescope driver in C#. It produces an in-process
(assembly) based driver.</H4>
<HR>
<P CLASS="note">Prior to developing your first driver, please
familiarize yourself with the <A HREF="http://ascom-standards.org/developer.html">developer
information we've provided</A> at the ASCOM Initiative web site
(internet required).
</P>
<P CLASS="underline">You must do the following in order to complete
your implementation:</P>
<OL>
<LI><P STYLE="margin-bottom: 0cm">Switch to the Debug configuration
and build the template now. It should build without errors.
</P>
<LI><P STYLE="margin-bottom: 0cm">Add a test project to the
solution. There are templates that can be used to add either a
console or a Windows Forms application:</P>
</OL>
<UL>
<LI><P STYLE="margin-bottom: 0cm">Select the <FONT FACE="Consolas, monospace">ASCOM
Test Forms App (CS)</FONT> or <FONT FACE="Consolas, monospace">ASCOM
Test Console App (CS)</FONT> template.</P>
<LI><P STYLE="margin-bottom: 0cm">Set a name for the test
application and click on OK.</P>
<LI><P STYLE="margin-bottom: 0cm">In the Wizard: set the same device
type and model name as for the driver and select Create to build the
test project.</P>
<LI><P STYLE="margin-bottom: 0cm">Set the Test Application to Run at
Startup.</P>
<LI><P STYLE="margin-bottom: 0cm">Click on Debug and the test
application should run. You should be able to select your
application in the chooser. Selecting Properties should show the
default setup dialog for your driver.</P>
<LI><P STYLE="margin-bottom: 0cm">Trying to continue will generate
errors because the additional properties have not been implemented.</P>
</UL>
<OL START=4>
<LI><P STYLE="margin-bottom: 0cm">Go through the Driver.cs file and
replace the System.NotImplemented exceptions with code to implement
your driver's functionality. See the ASCOM ITelescopeV3
spec. If a property or method is not implemented in your driver the
System.NotImplemented exception must be replaced by an
ASCOM.PropertyNotImplemented or ASCOM.MethodNotImplemented
exception.</P>
<LI><P>Customize the Setup Dialog (SetupDialogForm) to provide the
settings and other controls for your driver. You can bind settings
directly to controls on your dialog form, there's no need to manage
settings manually. A custom Settings class takes care of managing
your settings behind the scenes.
</P>
</OL>
<H3>Notes:</H3>
<UL>
<LI><P STYLE="margin-bottom: 0cm">Successfully building the driver,
as well as using <FONT FACE="Lucida Console, Courier New, Courier, monospace">regasm</FONT>
on the assembly, registers it for both COM and ASCOM (the Chooser).
See the code in the ASCOM Registration region of Driver.vb.
</P>
<LI><P STYLE="margin-bottom: 0cm">Doing a Clean for the project, as
well doing a <FONT FACE="Lucida Console, Courier New, Courier, monospace">regasm
-u</FONT> on the assembly, unregisters it for both COM and ASCOM
(the Chooser).
</P>
<LI><P>Place a breakpoint in your driver class constructor, then
start debugging (go, F5). Your breakpoint will be hit when the test
application creates an instance of your driver (after selecting it
in the Chooser). You can now single step, examine variables, etc.
Please review the test application and make changes and additions to
activate various parts of your driver during debugging.</P>
<LI><P>The project's Debug configuration is already configured (The
test application creates an instance of your driver (after selecting
it in the Chooser). You can now single step, examine variables, etc.
Please review the test application and feel free to make changes and
additions to activate various parts of your driver during debugging.
</P>
</UL>
<DIV ALIGN=RIGHT>
<TABLE WIDTH=100% BORDER=0 CELLPADDING=4 CELLSPACING=0>
<TR>
<TD>
<TABLE WIDTH=100% BORDER=0 CELLPADDING=4 CELLSPACING=0>
<TR>
<TD>
<H3>ASCOM Initiative</H3>
</TD>
<TD>
<IMG SRC="ASCOM.png" NAME="graphics1" ALIGN=RIGHT WIDTH=48 HEIGHT=56 BORDER=0></TD>
</TR>
</TABLE>
<P><BR><BR>
</P>
</TD>
</TR>
<TR>
<TD>
<P>The ASCOM Initiative consists of a group of astronomy software
developers and instrument vendors whose goals are to promote the
driver/client model and scripting automation.
</P>
<P>See the <A HREF="http://ascom-standards.org/" TARGET="browser">ASCOM
web site</A> for more information. Please participate in the
<A HREF="http://tech.groups.yahoo.com/group/ASCOM-Talk" TARGET="browser">ASCOM-Talk
Yahoo Group</A>.
</P>
</TD>
</TR>
</TABLE>
</DIV>
<P><BR><BR>
</P><P>
<BR><BR>
</P>
</BODY>
</HTML>
-23
View File
@@ -6,28 +6,5 @@ namespace ASCOM.Meade.net
{
return int.Parse(str);
}
//public static double ToDouble(this string str)
//{
// return double.Parse(str);
//}
public static int Position(this string str, char find, int instance)
{
var currentInstance = 0;
for (var i = 0; i < str.Length; i++)
{
if (str[i] == find)
{
currentInstance++;
if (currentInstance == instance)
{
return i;
}
}
}
return -1;
}
}
}
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"/>
</sectionGroup>
</configSections>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/></startup></configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
-5
View File
@@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="ASCOM.Platform" version="6.5.1" targetFramework="net472" />
<package id="JetBrains.Annotations" version="2020.3.0" targetFramework="net472" />
</packages>
@@ -1,36 +0,0 @@
<#
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
@@ -1,124 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\NUnit.3.13.0\build\NUnit.props" Condition="Exists('..\packages\NUnit.3.13.0\build\NUnit.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<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.5.1\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.5.1\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.5.1\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.5.1\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.5.1\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.5.1\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.5.1\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.5.1\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.5.1\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.5.1\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.5.1\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.1\lib\net45\Castle.Core.dll</HintPath>
</Reference>
<Reference Include="JetBrains.Annotations, Version=2020.3.0.0, Culture=neutral, PublicKeyToken=1010a0d8d6380325, processorArchitecture=MSIL">
<HintPath>..\packages\JetBrains.Annotations.2020.3.0\lib\net20\JetBrains.Annotations.dll</HintPath>
</Reference>
<Reference Include="Moq, Version=4.15.0.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
<HintPath>..\packages\Moq.4.15.2\lib\net45\Moq.dll</HintPath>
</Reference>
<Reference Include="nunit.framework, Version=3.13.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\packages\NUnit.3.13.0\lib\net45\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.5.0.0\lib\net45\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.4\lib\net461\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" />
<Compile Include="ThreadSafeBoolTests.cs" />
<Compile Include="ThreadSafeDateTimeTests.cs" />
<Compile Include="ThreadSafeEnumTests.cs" />
<Compile Include="ThreadSafeNullableDoubleTests.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.13.0\build\NUnit.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NUnit.3.13.0\build\NUnit.props'))" />
</Target>
</Project>
@@ -1,35 +0,0 @@
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")]
File diff suppressed because it is too large Load Diff
@@ -1,39 +0,0 @@
using ASCOM.Meade.net;
using NUnit.Framework;
namespace Meade.net.UnitTests
{
public class ThreadSafeBoolTests
{
[TestCase(false)]
[TestCase(true)]
public void When_Assigned_ThenValueIsSame(bool value)
{
// given
ThreadSafeValue<bool> sut = value;
// when
bool actual = sut;
// then
Assert.That(actual, Is.EqualTo(value));
}
[TestCase(false, false)]
[TestCase(false, true)]
[TestCase(true, false)]
[TestCase(true, true)]
public void When_SetValue_ThenValueIsUpdated(bool initialValue, bool setValue)
{
// given
ThreadSafeValue<bool> sut = initialValue;
// when
sut.Set(setValue);
bool afterset = sut;
// then
Assert.That(afterset, Is.EqualTo(setValue));
}
}
}
@@ -1,61 +0,0 @@
using ASCOM.Meade.net;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Globalization;
namespace Meade.net.UnitTests
{
public class ThreadSafeDateTimeTests
{
[TestCaseSource(nameof(DateTimeSource))]
public void When_Assigned_ThenValueIsSame(DateTime value)
{
// given
ThreadSafeValue<DateTime> sut = value;
// when
DateTime actual = sut;
// then
Assert.That(actual, Is.EqualTo(value));
}
[TestCaseSource(nameof(DateTimeSetSource))]
public void When_SetValue_ThenValueIsUpdated(DateTime initialValue, DateTime setValue)
{
// given
ThreadSafeValue<DateTime> sut = initialValue;
// when
sut.Set(setValue);
DateTime afterset = sut;
// then
Assert.That(afterset, Is.EqualTo(setValue));
}
static readonly DateTime Example1 = DateTimeOffset.Parse("2012-05-09T02:10:31.296761Z", CultureInfo.InvariantCulture).UtcDateTime;
static readonly DateTime Example2 = DateTimeOffset.Parse("2051-03-09T23:15:11.556081Z", CultureInfo.InvariantCulture).UtcDateTime;
static IEnumerable<DateTime> DateTimeSource => new[]
{
DateTime.MinValue,
Example1,
Example2
};
static IEnumerable<TestCaseData> DateTimeSetSource => new[]
{
new TestCaseData(DateTime.MinValue, Example1),
new TestCaseData(DateTime.MinValue, Example2),
new TestCaseData(DateTime.MinValue, DateTime.MinValue),
new TestCaseData(Example1, Example1),
new TestCaseData(Example1, Example2),
new TestCaseData(Example1, DateTime.MinValue),
new TestCaseData(Example2, Example1),
new TestCaseData(Example2, Example2),
new TestCaseData(Example2, DateTime.MinValue)
};
}
}
@@ -1,46 +0,0 @@
using ASCOM.DeviceInterface;
using ASCOM.Meade.net;
using NUnit.Framework;
namespace Meade.net.UnitTests
{
public class ThreadSafeEnumTests
{
[TestCase(PierSide.pierUnknown)]
[TestCase(PierSide.pierEast)]
[TestCase(PierSide.pierWest)]
public void When_Assigned_ThenValueIsSame(PierSide value)
{
// given
ThreadSafeValue<PierSide> sut = value;
// when
PierSide actual = sut;
// then
Assert.That(actual, Is.EqualTo(value));
}
[TestCase(PierSide.pierUnknown, PierSide.pierUnknown)]
[TestCase(PierSide.pierUnknown, PierSide.pierEast)]
[TestCase(PierSide.pierUnknown, PierSide.pierWest)]
[TestCase(PierSide.pierEast, PierSide.pierUnknown)]
[TestCase(PierSide.pierEast, PierSide.pierEast)]
[TestCase(PierSide.pierEast, PierSide.pierWest)]
[TestCase(PierSide.pierWest, PierSide.pierUnknown)]
[TestCase(PierSide.pierWest, PierSide.pierEast)]
[TestCase(PierSide.pierWest, PierSide.pierWest)]
public void When_SetValue_ThenValueIsUpdated(PierSide initialValue, PierSide setValue)
{
// given
ThreadSafeValue<PierSide> sut = initialValue;
// when
sut.Set(setValue);
PierSide afterset = sut;
// then
Assert.That(afterset, Is.EqualTo(setValue));
}
}
}
@@ -1,45 +0,0 @@
using ASCOM.Meade.net;
using NUnit.Framework;
namespace Meade.net.UnitTests
{
public class ThreadSafeNullableDoubleTests
{
[TestCase(0.1d)]
[TestCase(-12.34d)]
[TestCase(0d)]
[TestCase(null)]
public void When_Assigned_ThenValueIsSame(double? value)
{
// given
ThreadSafeValue<double?> sut = value;
// when
double? actual = sut;
// then
Assert.That(actual, Is.EqualTo(value));
}
[TestCase(0.1d, 0.2d)]
[TestCase(-12.34d, 5d)]
[TestCase(0d, 1d)]
[TestCase(null, 2d)]
[TestCase(0.1d, null)]
[TestCase(-12.34d, null)]
[TestCase(0d, null)]
[TestCase(null, null)]
public void When_SetValue_ThenValueIsUpdated(double? initialValue, double? setValue)
{
// given
ThreadSafeValue<double?> sut = initialValue;
// when
sut.Set(setValue);
double? afterset = sut;
// then
Assert.That(afterset, Is.EqualTo(setValue));
}
}
}
-15
View File
@@ -1,15 +0,0 @@
<?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-5.0.0.0" newVersion="5.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
-11
View File
@@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="ASCOM.Platform" version="6.5.1" targetFramework="net472" />
<package id="Castle.Core" version="4.4.1" targetFramework="net472" />
<package id="JetBrains.Annotations" version="2020.3.0" targetFramework="net472" />
<package id="Moq" version="4.15.2" targetFramework="net472" />
<package id="NUnit" version="3.13.0" targetFramework="net472" />
<package id="NUnit.ConsoleRunner" version="3.12.0" targetFramework="net472" />
<package id="System.Runtime.CompilerServices.Unsafe" version="5.0.0" targetFramework="net472" />
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net472" />
</packages>
@@ -1,36 +0,0 @@
<#
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
+299 -150
View File
@@ -1,12 +1,45 @@
//tabs=4
// --------------------------------------------------------------------------------
// TODO fill in this information for your driver, then remove this line!
//
// ASCOM Focuser driver for Meade.net
//
// Description: Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam
// nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam
// erat, sed diam voluptua. At vero eos et accusam et justo duo
// dolores et ea rebum. Stet clita kasd gubergren, no sea takimata
// sanctus est Lorem ipsum dolor sit amet.
//
// Implements: ASCOM Focuser interface version: <To be completed by driver developer>
// Author: (XXX) Your N. Here <your@email.here>
//
// Edit Log:
//
// Date Who Vers Description
// ----------- --- ----- -------------------------------------------------------
// dd-mmm-yyyy XXX 6.0.0 Initial edit, created from ASCOM driver template
// --------------------------------------------------------------------------------
//
// This is used to define code in the template that is specific to one class implementation
// unused code canbe deleted and this definition removed.
#define Focuser
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using System.Runtime.InteropServices;
using ASCOM;
using ASCOM.Astrometry;
using ASCOM.Astrometry.AstroUtils;
using ASCOM.Utilities;
using ASCOM.DeviceInterface;
using System.Globalization;
using System.Collections;
using System.Reflection;
using System.Runtime.InteropServices;
using ASCOM.DeviceInterface;
using ASCOM.Meade.net.Wrapper;
using ASCOM.Utilities;
using ASCOM.Utilities.Interfaces;
namespace ASCOM.Meade.net
@@ -18,7 +51,7 @@ namespace ASCOM.Meade.net
// The ClassInterface/None addribute prevents an empty interface called
// _Meade.net from being created and used as the [default] interface
//
// Replace the not implemented exceptions with code to implement the function or
// TODO Replace the not implemented exceptions with code to implement the function or
// throw the appropriate ASCOM exception.
//
@@ -27,22 +60,48 @@ namespace ASCOM.Meade.net
/// </summary>
[Guid("a32ac647-bf0f-42f9-8ab0-d166fa5884ad")]
[ProgId("ASCOM.MeadeGeneric.focuser")]
[ServedClassName("Meade Generic")]
[ServedClassName("Meade.net Focuser")]
[ClassInterface(ClassInterfaceType.None)]
[ComVisible(true)]
public class Focuser : MeadeTelescopeBase, IFocuserV3
public class Focuser : ReferenceCountedObjectBase, IFocuserV3
{
/// <summary>
/// ASCOM DeviceID (COM ProgID) for this driver.
/// The DeviceID is used by ASCOM applications to load the driver at runtime.
/// </summary>
//internal static string driverID = "ASCOM.Meade.net.Focuser";
private static readonly string DriverId = Marshal.GenerateProgIdForType(MethodBase.GetCurrentMethod().DeclaringType ?? throw new System.InvalidOperationException());
internal static string driverID = Marshal.GenerateProgIdForType(MethodBase.GetCurrentMethod().DeclaringType);
// TODO Change the descriptive string for your driver then remove this line
/// <summary>
/// Driver description that displays in the ASCOM Chooser.
/// </summary>
private static string driverDescription = "Meade Generic";
internal static string comPortProfileName = "COM Port"; // Constants used for Profile persistence
internal static string comPortDefault = "COM1";
internal static string traceStateProfileName = "Trace Level";
internal static string traceStateDefault = "false";
internal static string comPort; // Variables to hold the currrent device configuration
/// <summary>
/// Private variable to hold the connected state
/// </summary>
private bool connectedState;
/// <summary>
/// Private variable to hold an ASCOM Utilities object
/// </summary>
private readonly IUtil _utilities;
private Util utilities;
/// <summary>
/// Private variable to hold an ASCOM AstroUtilities object to provide the Range method
/// </summary>
private AstroUtils astroUtilities;
/// <summary>
/// Variable to hold the trace logger object (creates a diagnostic log file with information that you specify)
/// </summary>
internal static TraceLogger tl;
/// <summary>
/// Initializes a new instance of the <see cref="Meade.net"/> class.
@@ -50,19 +109,18 @@ namespace ASCOM.Meade.net
/// </summary>
public Focuser()
{
//todo move this out to IOC
var util = new Util(); //Initialise util object
_utilities = util;
tl = new TraceLogger("", "Meade.net.focusser");
ReadProfile(); // Read device configuration from the ASCOM Profile store
Initialise(nameof(Focuser));
tl.LogMessage("Focuser", "Starting initialisation");
connectedState = false; // Initialise connected to false
utilities = new Util(); //Initialise util object
astroUtilities = new AstroUtils(); // Initialise astro utilities object
tl.LogMessage("Focuser", "Completed initialisation");
}
public Focuser(IUtil util, ISharedResourcesWrapper sharedResourcesWrapper) : base(sharedResourcesWrapper)
{
_utilities = util;
Initialise(nameof(Focuser));
}
//
// PUBLIC COM INTERFACE IFocuserV3 IMPLEMENTATION
@@ -78,17 +136,17 @@ namespace ASCOM.Meade.net
/// </summary>
public void SetupDialog()
{
Tl.LogMessage("SetupDialog", "Opening setup dialog");
SharedResourcesWrapper.SetupDialog();
tl.LogMessage("SetupDialog", "Opening setup dialog");
SharedResources.SetupDialog();
ReadProfile();
Tl.LogMessage("SetupDialog", "complete");
tl.LogMessage("SetupDialog", "complete");
}
public ArrayList SupportedActions
{
get
{
Tl.LogMessage("SupportedActions Get", "Returning empty arraylist");
tl.LogMessage("SupportedActions Get", "Returning empty arraylist");
return new ArrayList();
}
}
@@ -96,53 +154,51 @@ namespace ASCOM.Meade.net
public string Action(string actionName, string actionParameters)
{
LogMessage("", "Action {0}, parameters {1} not implemented", actionName, actionParameters);
throw new ActionNotImplementedException();
throw new ASCOM.ActionNotImplementedException("Action " + actionName + " is not implemented by this driver");
}
public void CommandBlind(string command, bool raw)
{
LogMessage("CommandBlind", "raw: {0} command {0}", raw, command);
CheckConnected("CommandBlind");
// Call CommandString and return as soon as it finishes
//this.CommandString(command, raw);
SharedResourcesWrapper.SendBlind(command, raw);
SharedResources.SendBlind(command);
// or
//throw new ASCOM.MethodNotImplementedException("CommandBlind");
// DO NOT have both these sections! One or the other
LogMessage("CommandBlind", "Completed");
}
public bool CommandBool(string command, bool raw)
{
LogMessage("CommandBool", "raw: {0} command {0}", raw, command);
CheckConnected("CommandBool");
var result = SharedResourcesWrapper.SendBool(command, raw);
LogMessage("CommandBool", "Completed: {0}", result);
return result;
//string ret = CommandString(command, raw);
// TODO decode the return string and return true or false
// or
//throw new MethodNotImplementedException("CommandBool");
throw new ASCOM.MethodNotImplementedException("CommandBool");
// DO NOT have both these sections! One or the other
}
public string CommandString(string command, bool raw)
{
LogMessage("CommandString", "raw: {0} command {0}", raw, command);
CheckConnected("CommandString");
// it's a good idea to put all the low level communication with the device here,
// then all communication calls this function
// you need something to ensure that only one command is in progress at a time
var result = SharedResourcesWrapper.SendString(command, raw);
LogMessage("CommandBool", "Completed: {0}", result);
return result;
//throw new ASCOM.MethodNotImplementedException("CommandString");
return SharedResources.SendString(command);
throw new ASCOM.MethodNotImplementedException("CommandString");
}
public void Dispose()
{
// Clean up the tracelogger and util objects
Tl.Enabled = false;
Tl.Dispose();
Tl = null;
tl.Enabled = false;
tl.Dispose();
tl = null;
utilities.Dispose();
utilities = null;
astroUtilities.Dispose();
astroUtilities = null;
}
public bool Connected
@@ -154,7 +210,7 @@ namespace ASCOM.Meade.net
}
set
{
Tl.LogMessage("Connected", "Set {0}", value);
tl.LogMessage("Connected", "Set {0}", value);
if (value == IsConnected)
return;
@@ -162,32 +218,98 @@ namespace ASCOM.Meade.net
{
try
{
ReadProfile();
SharedResourcesWrapper.Connect("Serial", DriverId, Tl);
SharedResources.Connect("Serial");
try
{
IsConnected = true;
SelectSite(1);
SetLongFormat(true);
connectedState = true;
}
catch (Exception)
{
SharedResourcesWrapper.Disconnect("Serial", DriverId);
SharedResources.Disconnect("Serial");
throw;
}
}
catch (Exception ex)
{
LogMessage("Connected Set", "Error connecting to port {0} - {1}", _profileProperties.ComPort, ex.Message);
LogMessage("Connected Set", "Error connecting to port {0} - {1}", comPort, ex.Message);
}
}
else
{
LogMessage("Connected Set", "Disconnecting from port {0}", _profileProperties.ComPort);
SharedResourcesWrapper.Disconnect("Serial", DriverId);
IsConnected = false;
LogMessage("Connected Set", "Disconnecting from port {0}", comPort);
SharedResources.Disconnect("Serial");
connectedState = false;
}
}
}
private void SetLongFormat(bool setLongFormat)
{
SharedResources.Lock(() =>
{
var result = SharedResources.SendString(":GZ#");
//:GZ# Get telescope azimuth
//Returns: DDD*MM#T or DDD*MMSS#
//The current telescope Azimuth depending on the selected precision.
bool isLongFormat = result.Length > 6;
if (isLongFormat != setLongFormat)
{
utilities.WaitForMilliseconds(500);
SharedResources.SendBlind(":U#");
//:U# Toggle between low/hi precision positions
//Low - RA displays and messages HH:MM.T sDD*MM
//High - Dec / Az / El displays and messages HH:MM: SS sDD*MM:SS
// Returns Nothing
}
});
}
private void SelectSite(int site)
{
SharedResources.SendBlind($":W{site}#");
//:W<n>#
//Set current site to<n>, an ASCII digit in the range 1..4
//Returns: Nothing
}
public string Description
{
// TODO customise this device description
get
{
tl.LogMessage("Description Get", driverDescription);
return driverDescription;
}
}
public string DriverInfo
{
get
{
Version version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
// TODO customise this driver description
string driverInfo = "Information about the driver itself. Version: " + String.Format(CultureInfo.InvariantCulture, "{0}.{1}", version.Major, version.Minor);
tl.LogMessage("DriverInfo Get", driverInfo);
return driverInfo;
}
}
public string DriverVersion
{
get
{
Version version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
string driverVersion = String.Format(CultureInfo.InvariantCulture, "{0}.{1}", version.Major, version.Minor);
tl.LogMessage("DriverVersion Get", driverVersion);
return driverVersion;
}
}
public short InterfaceVersion
{
// set by the driver wizard
@@ -203,8 +325,8 @@ namespace ASCOM.Meade.net
get
{
//string name = "Short driver name - please customise";
string name = DriverDescription;
Tl.LogMessage("Name Get", name);
string name = driverDescription;
tl.LogMessage("Name Get", name);
return name;
}
}
@@ -217,31 +339,34 @@ namespace ASCOM.Meade.net
{
get
{
CheckConnected("Absolute Get");
Tl.LogMessage("Absolute Get", false.ToString());
tl.LogMessage("Absolute Get", false.ToString());
return false; // This is a relative focuser
}
}
public void Halt()
{
Tl.LogMessage("Halt", "Halting");
tl.LogMessage("Halt", "Halting");
CheckConnected("Halt");
//todo fix this issue: A single halt command is sometimes missed by the #909 apm, so let's do it a few times to be safe.
//A single halt command is sometimes missed by the #909 apm, so let's do it a few times to be safe.
Stopwatch stopwatch = Stopwatch.StartNew();
while (stopwatch.ElapsedMilliseconds < 1000)
{
SharedResources.SendBlind(":FQ#");
//:FQ# Halt Focuser Motion
//Returns: Nothing
SharedResourcesWrapper.SendBlind("FQ");
//:FQ# Halt Focuser Motion
//Returns: Nothing
utilities.WaitForMilliseconds(250);
}
}
public bool IsMoving
{
get
{
Tl.LogMessage("IsMoving Get", false.ToString());
tl.LogMessage("IsMoving Get", false.ToString());
return false; // This focuser always moves instantaneously so no need for IsMoving ever to be True
}
}
@@ -250,13 +375,13 @@ namespace ASCOM.Meade.net
{
get
{
Tl.LogMessage("Link Get", Connected.ToString());
return Connected; // Direct function to the connected method, the Link method is just here for backwards compatibility
tl.LogMessage("Link Get", this.Connected.ToString());
return this.Connected; // Direct function to the connected method, the Link method is just here for backwards compatibility
}
set
{
Tl.LogMessage("Link Set", value.ToString());
Connected = value; // Direct function to the connected method, the Link method is just here for backwards compatibility
tl.LogMessage("Link Set", value.ToString());
this.Connected = value; // Direct function to the connected method, the Link method is just here for backwards compatibility
}
}
@@ -265,111 +390,102 @@ namespace ASCOM.Meade.net
{
get
{
Tl.LogMessage("MaxIncrement Get", _maxIncrement.ToString());
tl.LogMessage("MaxIncrement Get", _maxIncrement.ToString());
return _maxIncrement; // Maximum change in one move
}
}
private readonly int _maxStep = 7000;
public int MaxStep
{
get
{
Tl.LogMessage("MaxStep Get", _maxStep.ToString());
tl.LogMessage("MaxStep Get", _maxStep.ToString());
return _maxStep;
}
}
public void Move(int position)
public void Move(int Position)
{
Tl.LogMessage("Move", position.ToString());
tl.LogMessage("Move", Position.ToString());
CheckConnected("Move");
if (position < -MaxIncrement || position > MaxIncrement)
{
throw new InvalidValueException($"position out of range {-MaxIncrement} < {position} < {MaxIncrement}");
}
if (position == 0)
return;
var direction = position > 0;
if (_profileProperties.ReverseFocusDirection)
direction = !direction;
//backlash compensation.
var backlashCompensationSteps = direction ? Math.Abs(_profileProperties.BacklashCompensation) : 0;
var steps = Math.Abs(position) + backlashCompensationSteps;
MoveFocuser(direction, steps);
//todo refactor the backlash compensation to combine the commands into as few moves as practicle.
//ApplyBacklashCompensation(direction);
if (direction & backlashCompensationSteps != 0)
{
Tl.LogMessage("Move", "Applying backlash compensation");
MoveFocuser(!direction, backlashCompensationSteps);
}
DynamicBreaking(direction);
//todo implement backlash compensation
//todo implement direction reverse
//todo implement dynamic braking
//dynamic breaking is sending the command to move in the opposite direction immediatly followed by the command to stop.
}
private void DynamicBreaking(bool directionOut)
{
if (!_profileProperties.DynamicBreaking)
if (Position < -MaxIncrement || Position > MaxIncrement)
{
throw new ASCOM.InvalidValueException($"position out of range {-MaxIncrement} < {Position} < {MaxIncrement}");
}
if (Position == 0)
return;
Tl.LogMessage("Move", "Applying dynamic breaking");
PerformFocuserMove(directionOut);
Halt();
if (Position > 0)
{
//desired move direction is out
MoveFocuser(true, Math.Abs(Position));
}
else
{
//desired move direction is in
MoveFocuser(false, Math.Abs(Position));
}
}
private void MoveFocuser(bool directionOut, int steps)
{
//_sharedResourcesWrapper.SendBlind("FF");
//:FF# Set Focus speed to fastest setting
//Returns: Nothing
SharedResources.Lock(() =>
{
//SharedResources.SendBlind(":FF#");
//:FF# Set Focus speed to fastest setting
//Returns: Nothing
//:FS# Set Focus speed to slowest setting
//Returns: Nothing
//:FS# Set Focus speed to slowest setting
//Returns: Nothing
//:F<n># Autostar, Autostar II - set focuser speed to <n> where <n> is an ASCII digit 1..4
//Returns: Nothing
//All others - Not Supported
_utilities.WaitForMilliseconds(100);
//:F<n># Autostar, Autostar II set focuser speed to <n> where <n> is an ASCII digit 1..4
//Returns: Nothing
//All others Not Supported
utilities.WaitForMilliseconds(100);
PerformFocuserMove(directionOut);
//A Single focus command sometimes gets lost on the #909, so sending lots of them solves the issue.
Stopwatch stopwatch = Stopwatch.StartNew();
while (stopwatch.ElapsedMilliseconds < steps)
{
SharedResources.SendBlind(directionOut ? ":F+#" : ":F-#");
//:F+# Start Focuser moving inward (toward objective)
//Returns: None
_utilities.WaitForMilliseconds(steps);
//:F-# Start Focuser moving outward (away from objective)
//Returns: None
Halt();
utilities.WaitForMilliseconds(250);
}
Halt();
//This gives the focuser time to physically stop.
utilities.WaitForMilliseconds(1000);
});
}
private void PerformFocuserMove(bool directionOut)
public int Position
{
SharedResourcesWrapper.SendBlind(directionOut ? "F+" : "F-");
//:F+# Start Focuser moving inward (toward objective)
//Returns: None
//:F-# Start Focuser moving outward (away from objective)
//Returns: None
get
{
throw new ASCOM.PropertyNotImplementedException("Position", false);
//return focuserPosition; // Return the focuser position
}
}
public int Position => throw new PropertyNotImplementedException("Position", false);
public double StepSize
{
get
{
Tl.LogMessage("StepSize Get", "Not implemented");
throw new PropertyNotImplementedException("StepSize", false);
tl.LogMessage("StepSize Get", "Not implemented");
throw new ASCOM.PropertyNotImplementedException("StepSize", false);
}
}
@@ -377,14 +493,13 @@ namespace ASCOM.Meade.net
{
get
{
Tl.LogMessage("TempComp Get", false.ToString());
tl.LogMessage("TempComp Get", false.ToString());
return false;
}
// ReSharper disable once ValueParameterNotUsed
set
{
Tl.LogMessage("TempComp Set", "Not implemented");
throw new PropertyNotImplementedException("TempComp", false);
tl.LogMessage("TempComp Set", "Not implemented");
throw new ASCOM.PropertyNotImplementedException("TempComp", false);
}
}
@@ -392,7 +507,7 @@ namespace ASCOM.Meade.net
{
get
{
Tl.LogMessage("TempCompAvailable Get", false.ToString());
tl.LogMessage("TempCompAvailable Get", false.ToString());
return false; // Temperature compensation is not available in this driver
}
}
@@ -401,8 +516,8 @@ namespace ASCOM.Meade.net
{
get
{
Tl.LogMessage("Temperature Get", "Not implemented");
throw new PropertyNotImplementedException("Temperature", false);
tl.LogMessage("Temperature Get", "Not implemented");
throw new ASCOM.PropertyNotImplementedException("Temperature", false);
}
}
@@ -415,25 +530,25 @@ namespace ASCOM.Meade.net
#region ASCOM Registration
// Register or unregister driver for ASCOM. This is harmless if already
// registered or unregistered.
// registered or unregistered.
//
/// <summary>
/// Register or unregister the driver with the ASCOM Platform.
/// This is harmless if the driver is already registered/unregistered.
/// </summary>
/// <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 (IProfileWrapper p = ProfileFactory.Create())
using (var P = new ASCOM.Utilities.Profile())
{
p.DeviceType = nameof(Focuser);
P.DeviceType = "Focuser";
if (bRegister)
{
p.Register(DriverId, DriverDescription);
P.Register(driverID, driverDescription);
}
else
{
p.Unregister(DriverId);
P.Unregister(driverID);
}
}
}
@@ -456,9 +571,9 @@ namespace ASCOM.Meade.net
/// This technique should mean that it is never necessary to manually register a driver with ASCOM.
/// </remarks>
[ComRegisterFunction]
public static void RegisterAscom(Type t)
public static void RegisterASCOM(Type t)
{
RegUnregAscom(true);
RegUnregASCOM(true);
}
/// <summary>
@@ -479,13 +594,25 @@ namespace ASCOM.Meade.net
/// This technique should mean that it is never necessary to manually unregister a driver from ASCOM.
/// </remarks>
[ComUnregisterFunction]
public static void UnregisterAscom(Type t)
public static void UnregisterASCOM(Type t)
{
RegUnregAscom(false);
RegUnregASCOM(false);
}
#endregion
/// <summary>
/// Returns true if there is a valid connection to the driver hardware
/// </summary>
private bool IsConnected
{
get
{
// TODO check that the driver hardware connection exists and is connected to the hardware
return connectedState;
}
}
/// <summary>
/// Use this function to throw an exception if we aren't connected to the hardware
/// </summary>
@@ -494,9 +621,31 @@ namespace ASCOM.Meade.net
{
if (!IsConnected)
{
throw new NotConnectedException($"Not connected to focuser when trying to execute: {message}");
throw new ASCOM.NotConnectedException(message);
}
}
/// <summary>
/// Read the device configuration from the ASCOM Profile store
/// </summary>
internal void ReadProfile()
{
var profileProperties = SharedResources.ReadProfile();
tl.Enabled = profileProperties.TraceLogger;
comPort = profileProperties.ComPort;
}
/// <summary>
/// Log helper function that takes formatted strings and arguments
/// </summary>
/// <param name="identifier"></param>
/// <param name="message"></param>
/// <param name="args"></param>
internal static void LogMessage(string identifier, string message, params object[] args)
{
var msg = string.Format(message, args);
tl.LogMessage(identifier, msg);
}
#endregion
}
}
+11 -42
View File
@@ -15,7 +15,7 @@
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<OldToolsVersion>3.5</OldToolsVersion>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<ApplicationIcon>ASCOM.ico</ApplicationIcon>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>ASCOMDriverTemplate.snk</AssemblyOriginatorKeyFile>
@@ -66,10 +66,9 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<RegisterForComInterop>true</RegisterForComInterop>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>..\bin\Release\</OutputPath>
@@ -79,45 +78,16 @@
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="ASCOM.Astrometry, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.5.1\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.5.1\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.5.1\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.5.1\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.5.1\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.5.1\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.5.1\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.5.1\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.5.1\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.5.1\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.5.1\lib\net40\ASCOM.Utilities.Video.dll</HintPath>
</Reference>
<Reference Include="JetBrains.Annotations, Version=2020.3.0.0, Culture=neutral, PublicKeyToken=1010a0d8d6380325, processorArchitecture=MSIL">
<HintPath>..\packages\JetBrains.Annotations.2020.3.0\lib\net20\JetBrains.Annotations.dll</HintPath>
</Reference>
<Reference Include="ASCOM.Astrometry, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL" />
<Reference Include="ASCOM.Attributes, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL" />
<Reference Include="ASCOM.Controls, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL" />
<Reference Include="ASCOM.DeviceInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL" />
<Reference Include="ASCOM.Exceptions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL" />
<Reference Include="ASCOM.SettingsProvider, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL" />
<Reference Include="ASCOM.Utilities, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL" />
<Reference Include="ASCOM.Utilities.Video, Version=6.1.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL" />
<Reference Include="System" />
<Reference Include="System.configuration" />
<Reference Include="System.Configuration.Install" />
@@ -154,13 +124,12 @@
<None Include="app.config" />
<None Include="ASCOM.png" />
<None Include="ASCOMDriverTemplate.snk" />
<None Include="BootstrapAscomProfileStore.ps1" />
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Content Include="ASCOM.ico" />
<Content Include="ReadMe.htm" />
<None Include="Resources\ASCOM.bmp" />
</ItemGroup>
<ItemGroup>
@@ -1,5 +0,0 @@
<ProjectConfiguration>
<Settings>
<UseCPUArchitecture>x86</UseCPUArchitecture>
</Settings>
</ProjectConfiguration>
+6 -3
View File
@@ -1,10 +1,12 @@
using System.Reflection;
using System.Runtime.CompilerServices;
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.
//
// TODO - Add your authorship information here
[assembly: AssemblyTitle("ASCOM.Meade.net.Focuser")]
[assembly: AssemblyDescription("ASCOM Focuser driver for Meade.net")]
[assembly: AssemblyConfiguration("")]
@@ -17,7 +19,7 @@ using System.Runtime.InteropServices;
// 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)]
[assembly: ComVisible(true)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("4ad7a6d4-6d54-4a9a-bbf3-895353e318f8")]
@@ -32,5 +34,6 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
//
[assembly: AssemblyVersion("0.0.0.0")]
[assembly: AssemblyFileVersion("0.0.0.0")]
// TODO - Set your driver's version here
[assembly: AssemblyVersion("0.6.0.1")]
[assembly: AssemblyFileVersion("0.6.0.1")]
+1 -1
View File
@@ -12,7 +12,7 @@ namespace ASCOM.Meade.net.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.4.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+147
View File
@@ -0,0 +1,147 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=windows-1252">
<TITLE>Untitled Document</TITLE>
<META NAME="GENERATOR" CONTENT="OpenOffice.org 3.2 (Win32)">
<META NAME="CREATED" CONTENT="0;0">
<META NAME="CHANGEDBY" CONTENT="Chris Rowland">
<META NAME="CHANGED" CONTENT="20110918;14150500">
<STYLE TYPE="text/css">
<!--
@page { margin: 2cm }
P { font-family: "Verdana", "Arial", "Helvetica", sans-serif; font-weight: normal }
TD P { font-family: "Verdana", "Arial", "Helvetica", sans-serif; font-weight: normal }
H3 { font-family: "Arial", "Helvetica", sans-serif }
H2 { font-family: "Arial", "Helvetica", sans-serif }
H4 { font-family: "Arial", "Helvetica", sans-serif }
TD P.note { background: #33ffff; font-family: "Verdana", "Arial", "Helvetica", sans-serif; font-weight: normal }
TD P.underline { font-family: "Verdana", "Arial", "Helvetica", sans-serif; font-weight: normal; text-decoration: underline }
-->
</STYLE>
</HEAD>
<BODY LANG="en-GB" DIR="LTR">
<TABLE WIDTH=100% BORDER=0 CELLPADDING=4 CELLSPACING=0>
<TR>
<TD>
<H2>ASCOM Focuser Driver (C#)</H2>
</TD>
</TR>
</TABLE>
<P><BR><BR>
</P>
<H4>You have just created the skeleton of an ASCOM
Focuser driver in C#. It produces an in-process
(assembly) based driver.</H4>
<HR>
<P CLASS="note">Prior to developing your first driver, please
familiarize yourself with the <A HREF="http://ascom-standards.org/developer.html">developer
information we've provided</A> at the ASCOM Initiative web site
(internet required).
</P>
<P CLASS="underline">You must do the following in order to complete
your implementation:</P>
<OL>
<LI><P STYLE="margin-bottom: 0cm">Switch to the Debug configuration
and build the template now. It should build without errors.
</P>
<LI><P STYLE="margin-bottom: 0cm">Add a test project to the
solution. There are templates that can be used to add either a
console or a Windows Forms application:</P>
</OL>
<UL>
<LI><P STYLE="margin-bottom: 0cm">Select the <FONT FACE="Consolas, monospace">ASCOM
Test Forms App (CS)</FONT> or <FONT FACE="Consolas, monospace">ASCOM
Test Console App (CS)</FONT> template.</P>
<LI><P STYLE="margin-bottom: 0cm">Set a name for the test
application and click on OK.</P>
<LI><P STYLE="margin-bottom: 0cm">In the Wizard: set the same device
type and model name as for the driver and select Create to build the
test project.</P>
<LI><P STYLE="margin-bottom: 0cm">Set the Test Application to Run at
Startup.</P>
<LI><P STYLE="margin-bottom: 0cm">Click on Debug and the test
application should run. You should be able to select your
application in the chooser. Selecting Properties should show the
default setup dialog for your driver.</P>
<LI><P STYLE="margin-bottom: 0cm">Trying to continue will generate
errors because the additional properties have not been implemented.</P>
</UL>
<OL START=4>
<LI><P STYLE="margin-bottom: 0cm">Go through the Driver.cs file and
replace the System.NotImplemented exceptions with code to implement
your driver's functionality. See the ASCOM IFocuserV3
spec. If a property or method is not implemented in your driver the
System.NotImplemented exception must be replaced by an
ASCOM.PropertyNotImplemented or ASCOM.MethodNotImplemented
exception.</P>
<LI><P>Customize the Setup Dialog (SetupDialogForm) to provide the
settings and other controls for your driver. You can bind settings
directly to controls on your dialog form, there's no need to manage
settings manually. A custom Settings class takes care of managing
your settings behind the scenes.
</P>
</OL>
<H3>Notes:</H3>
<UL>
<LI><P STYLE="margin-bottom: 0cm">Successfully building the driver,
as well as using <FONT FACE="Lucida Console, Courier New, Courier, monospace">regasm</FONT>
on the assembly, registers it for both COM and ASCOM (the Chooser).
See the code in the ASCOM Registration region of Driver.vb.
</P>
<LI><P STYLE="margin-bottom: 0cm">Doing a Clean for the project, as
well doing a <FONT FACE="Lucida Console, Courier New, Courier, monospace">regasm
-u</FONT> on the assembly, unregisters it for both COM and ASCOM
(the Chooser).
</P>
<LI><P>Place a breakpoint in your driver class constructor, then
start debugging (go, F5). Your breakpoint will be hit when the test
application creates an instance of your driver (after selecting it
in the Chooser). You can now single step, examine variables, etc.
Please review the test application and make changes and additions to
activate various parts of your driver during debugging.</P>
<LI><P>The project's Debug configuration is already configured (The
test application creates an instance of your driver (after selecting
it in the Chooser). You can now single step, examine variables, etc.
Please review the test application and feel free to make changes and
additions to activate various parts of your driver during debugging.
</P>
</UL>
<DIV ALIGN=RIGHT>
<TABLE WIDTH=100% BORDER=0 CELLPADDING=4 CELLSPACING=0>
<TR>
<TD>
<TABLE WIDTH=100% BORDER=0 CELLPADDING=4 CELLSPACING=0>
<TR>
<TD>
<H3>ASCOM Initiative</H3>
</TD>
<TD>
<IMG SRC="ASCOM.png" NAME="graphics1" ALIGN=RIGHT WIDTH=48 HEIGHT=56 BORDER=0></TD>
</TR>
</TABLE>
<P><BR><BR>
</P>
</TD>
</TR>
<TR>
<TD>
<P>The ASCOM Initiative consists of a group of astronomy software
developers and instrument vendors whose goals are to promote the
driver/client model and scripting automation.
</P>
<P>See the <A HREF="http://ascom-standards.org/" TARGET="browser">ASCOM
web site</A> for more information. Please participate in the
<A HREF="http://tech.groups.yahoo.com/group/ASCOM-Talk" TARGET="browser">ASCOM-Talk
Yahoo Group</A>.
</P>
</TD>
</TR>
</TABLE>
</DIV>
<P><BR><BR>
</P><P>
<BR><BR>
</P>
</BODY>
</HTML>
+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"/>
</sectionGroup>
</configSections>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/></startup></configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
-5
View File
@@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="ASCOM.Platform" version="6.5.1" targetFramework="net472" />
<package id="JetBrains.Annotations" version="2020.3.0" targetFramework="net472" />
</packages>
+6 -54
View File
@@ -21,12 +21,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AstroMath.UnitTests", "Astr
EndProject
Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "Meade.net.Setup", "Meade.net.Setup\Meade.net.Setup.wixproj", "{8EEB5C25-8394-4257-8E57-CDED47CB6F1B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Meade.net.Telescope.UnitTests", "Meade.net.Telescope.UnitTests\Meade.net.Telescope.UnitTests.csproj", "{B7EEEEFD-5BFF-443D-981C-7B8AB5DFDE33}"
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}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Meade.net.UnitTests", "Meade.net.UnitTests\Meade.net.UnitTests.csproj", "{21EF28B4-D574-4A2D-A61D-5DF96AF46AB2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -73,23 +67,21 @@ Global
{A97E3AEC-F11D-49DA-B259-DE99DA813A86}.Release|x64.Build.0 = Release|Any CPU
{A97E3AEC-F11D-49DA-B259-DE99DA813A86}.Release|x86.ActiveCfg = Release|x86
{A97E3AEC-F11D-49DA-B259-DE99DA813A86}.Release|x86.Build.0 = Release|x86
{D5207217-61C7-4E94-8097-91DBACE57D2A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D5207217-61C7-4E94-8097-91DBACE57D2A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D5207217-61C7-4E94-8097-91DBACE57D2A}.Debug|Any CPU.ActiveCfg = Debug|x86
{D5207217-61C7-4E94-8097-91DBACE57D2A}.Debug|x64.ActiveCfg = Debug|x86
{D5207217-61C7-4E94-8097-91DBACE57D2A}.Debug|x64.Build.0 = Debug|x86
{D5207217-61C7-4E94-8097-91DBACE57D2A}.Debug|x86.ActiveCfg = Debug|x86
{D5207217-61C7-4E94-8097-91DBACE57D2A}.Debug|x86.Build.0 = Debug|x86
{D5207217-61C7-4E94-8097-91DBACE57D2A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D5207217-61C7-4E94-8097-91DBACE57D2A}.Release|Any CPU.ActiveCfg = Release|x86
{D5207217-61C7-4E94-8097-91DBACE57D2A}.Release|x64.ActiveCfg = Release|x86
{D5207217-61C7-4E94-8097-91DBACE57D2A}.Release|x86.ActiveCfg = Release|x86
{D5207217-61C7-4E94-8097-91DBACE57D2A}.Release|x86.Build.0 = Release|x86
{AABC96B8-C462-4B3A-9B5F-2929E3CB7A49}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AABC96B8-C462-4B3A-9B5F-2929E3CB7A49}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AABC96B8-C462-4B3A-9B5F-2929E3CB7A49}.Debug|Any CPU.ActiveCfg = Debug|x86
{AABC96B8-C462-4B3A-9B5F-2929E3CB7A49}.Debug|x64.ActiveCfg = Debug|x86
{AABC96B8-C462-4B3A-9B5F-2929E3CB7A49}.Debug|x64.Build.0 = Debug|x86
{AABC96B8-C462-4B3A-9B5F-2929E3CB7A49}.Debug|x86.ActiveCfg = Debug|x86
{AABC96B8-C462-4B3A-9B5F-2929E3CB7A49}.Debug|x86.Build.0 = Debug|x86
{AABC96B8-C462-4B3A-9B5F-2929E3CB7A49}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AABC96B8-C462-4B3A-9B5F-2929E3CB7A49}.Release|Any CPU.ActiveCfg = Release|x86
{AABC96B8-C462-4B3A-9B5F-2929E3CB7A49}.Release|x64.ActiveCfg = Release|x86
{AABC96B8-C462-4B3A-9B5F-2929E3CB7A49}.Release|x86.ActiveCfg = Release|x86
{AABC96B8-C462-4B3A-9B5F-2929E3CB7A49}.Release|x86.Build.0 = Release|x86
@@ -105,52 +97,15 @@ Global
{AD4959DD-33D7-4C3F-8DB0-7361D8E74A95}.Release|x64.Build.0 = Release|Any CPU
{AD4959DD-33D7-4C3F-8DB0-7361D8E74A95}.Release|x86.ActiveCfg = Release|x86
{AD4959DD-33D7-4C3F-8DB0-7361D8E74A95}.Release|x86.Build.0 = Release|x86
{8EEB5C25-8394-4257-8E57-CDED47CB6F1B}.Debug|Any CPU.ActiveCfg = Debug|x86
{8EEB5C25-8394-4257-8E57-CDED47CB6F1B}.Debug|Any CPU.Build.0 = Debug|x86
{8EEB5C25-8394-4257-8E57-CDED47CB6F1B}.Debug|Any CPU.ActiveCfg = Debug|x64
{8EEB5C25-8394-4257-8E57-CDED47CB6F1B}.Debug|Any CPU.Build.0 = Debug|x64
{8EEB5C25-8394-4257-8E57-CDED47CB6F1B}.Debug|x64.ActiveCfg = Debug|x64
{8EEB5C25-8394-4257-8E57-CDED47CB6F1B}.Debug|x86.ActiveCfg = Debug|x86
{8EEB5C25-8394-4257-8E57-CDED47CB6F1B}.Debug|x86.Build.0 = Debug|x86
{8EEB5C25-8394-4257-8E57-CDED47CB6F1B}.Release|Any CPU.ActiveCfg = Release|x86
{8EEB5C25-8394-4257-8E57-CDED47CB6F1B}.Release|Any CPU.Build.0 = Release|x86
{8EEB5C25-8394-4257-8E57-CDED47CB6F1B}.Release|x64.ActiveCfg = Release|x86
{8EEB5C25-8394-4257-8E57-CDED47CB6F1B}.Release|x86.ActiveCfg = Release|x86
{8EEB5C25-8394-4257-8E57-CDED47CB6F1B}.Release|x86.Build.0 = Release|x86
{B7EEEEFD-5BFF-443D-981C-7B8AB5DFDE33}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B7EEEEFD-5BFF-443D-981C-7B8AB5DFDE33}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B7EEEEFD-5BFF-443D-981C-7B8AB5DFDE33}.Debug|x64.ActiveCfg = Debug|Any CPU
{B7EEEEFD-5BFF-443D-981C-7B8AB5DFDE33}.Debug|x64.Build.0 = Debug|Any CPU
{B7EEEEFD-5BFF-443D-981C-7B8AB5DFDE33}.Debug|x86.ActiveCfg = Debug|Any CPU
{B7EEEEFD-5BFF-443D-981C-7B8AB5DFDE33}.Debug|x86.Build.0 = Debug|Any CPU
{B7EEEEFD-5BFF-443D-981C-7B8AB5DFDE33}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B7EEEEFD-5BFF-443D-981C-7B8AB5DFDE33}.Release|Any CPU.Build.0 = Release|Any CPU
{B7EEEEFD-5BFF-443D-981C-7B8AB5DFDE33}.Release|x64.ActiveCfg = Release|Any CPU
{B7EEEEFD-5BFF-443D-981C-7B8AB5DFDE33}.Release|x64.Build.0 = Release|Any CPU
{B7EEEEFD-5BFF-443D-981C-7B8AB5DFDE33}.Release|x86.ActiveCfg = Release|x86
{B7EEEEFD-5BFF-443D-981C-7B8AB5DFDE33}.Release|x86.Build.0 = Release|x86
{A3991FA7-23C3-405A-96F9-5AB03AC58F30}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A3991FA7-23C3-405A-96F9-5AB03AC58F30}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A3991FA7-23C3-405A-96F9-5AB03AC58F30}.Debug|x64.ActiveCfg = Debug|Any CPU
{A3991FA7-23C3-405A-96F9-5AB03AC58F30}.Debug|x64.Build.0 = Debug|Any CPU
{A3991FA7-23C3-405A-96F9-5AB03AC58F30}.Debug|x86.ActiveCfg = Debug|Any CPU
{A3991FA7-23C3-405A-96F9-5AB03AC58F30}.Debug|x86.Build.0 = Debug|Any CPU
{A3991FA7-23C3-405A-96F9-5AB03AC58F30}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A3991FA7-23C3-405A-96F9-5AB03AC58F30}.Release|Any CPU.Build.0 = Release|Any CPU
{A3991FA7-23C3-405A-96F9-5AB03AC58F30}.Release|x64.ActiveCfg = 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.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
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -159,9 +114,6 @@ Global
{D5207217-61C7-4E94-8097-91DBACE57D2A} = {BF650D97-AF98-4638-9C55-21311C6D88DA}
{AABC96B8-C462-4B3A-9B5F-2929E3CB7A49} = {BF650D97-AF98-4638-9C55-21311C6D88DA}
{AD4959DD-33D7-4C3F-8DB0-7361D8E74A95} = {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}
{21EF28B4-D574-4A2D-A61D-5DF96AF46AB2} = {0958D817-269C-44BE-BEFB-F3E6A409DE91}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {3C0509DC-C7F5-48DC-920D-DCFD9C879BD2}
-6
View File
@@ -1,6 +0,0 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/Housekeeping/ExcludedProjects/ProjectMasksToIgnore/=_002A_002A_005C_002A_002EUnitTests/@EntryIndexedValue">False</s:Boolean>
<s:Boolean x:Key="/Default/Housekeeping/ExcludedProjects/ProjectMasksToIgnore/=_002A_002A_005C_002A_002EUnitTests/@EntryIndexRemoved">True</s:Boolean>
<s:Boolean x:Key="/Default/Housekeeping/ExcludedProjects/ProjectMasksToIgnore/=_002A_002EUnitTests_002E_002A/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=ASCOM/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Autostar/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
-11
View File
@@ -1,11 +0,0 @@
<SolutionConfiguration>
<Settings>
<AllowParallelTestExecution>True</AllowParallelTestExecution>
<CopyReferencedAssembliesToWorkspace>True</CopyReferencedAssembliesToWorkspace>
<MetricsExclusionList>
<Value>FocuserTestConsole\FocuserTestConsole.csproj</Value>
<Value>TelescopeTestConsole\TelescopeTestConsole.csproj</Value>
</MetricsExclusionList>
<SolutionConfigured>True</SolutionConfigured>
</Settings>
</SolutionConfiguration>
-91
View File
@@ -1,91 +0,0 @@
using System;
using System.Reflection;
namespace ASCOM.Meade.net
{
public class AssemblyInfo
{
// The assembly information values.
//public readonly string Title = string.Empty;
//public readonly string Description = string.Empty;
//public readonly string Company = string.Empty;
public readonly string Product = string.Empty;
//public readonly string Copyright = string.Empty;
//public readonly string Trademark = string.Empty;
public readonly string AssemblyVersion;
//public readonly string FileVersion = string.Empty;
//public readonly string Guid = string.Empty;
//public readonly string NeutralLanguage = string.Empty;
//public readonly bool IsComVisible;
// Return a particular assembly attribute value.
private T GetAssemblyAttribute<T>(Assembly assembly)
where T : Attribute
{
// Get attributes of this type.
object[] attributes = assembly.GetCustomAttributes(typeof(T), true);
// If we didn't get anything, return null.
if (attributes.Length == 0)
return null;
// Convert the first attribute value into
// the desired type and return it.
return (T)attributes[0];
}
// Constructors.
public AssemblyInfo()
: this(Assembly.GetExecutingAssembly())
{
}
private AssemblyInfo(Assembly assembly)
{
// Get values from the assembly.
//var titleAttr = GetAssemblyAttribute<AssemblyTitleAttribute>(assembly);
//if (titleAttr != null)
// Title = titleAttr.Title;
//var assemblyAttr = GetAssemblyAttribute<AssemblyDescriptionAttribute>(assembly);
//if (assemblyAttr != null)
// Description = assemblyAttr.Description;
//var companyAttr =GetAssemblyAttribute<AssemblyCompanyAttribute>(assembly);
//if (companyAttr != null)
// Company = companyAttr.Company;
var productAttr = GetAssemblyAttribute<AssemblyProductAttribute>(assembly);
if (productAttr != null)
Product = productAttr.Product;
//var copyrightAttr = GetAssemblyAttribute<AssemblyCopyrightAttribute>(assembly);
//if (copyrightAttr != null)
// Copyright = copyrightAttr.Copyright;
//var trademarkAttr = GetAssemblyAttribute<AssemblyTrademarkAttribute>(assembly);
//if (trademarkAttr != null)
// Trademark = trademarkAttr.Trademark;
var version = assembly.GetName().Version;
AssemblyVersion = $"{version.Major}.{version.Minor}.{version.Build}.{version.Revision}";
//var fileVersionAttr = GetAssemblyAttribute<AssemblyFileVersionAttribute>(assembly);
//if (fileVersionAttr != null) FileVersion =
// fileVersionAttr.Version;
//var guidAttr = GetAssemblyAttribute<GuidAttribute>(assembly);
//if (guidAttr != null)
// Guid = guidAttr.Value;
//var languageAttr = GetAssemblyAttribute<NeutralResourcesLanguageAttribute>(assembly);
//if (languageAttr != null)
// NeutralLanguage = languageAttr.CultureName;
//var comAttr = GetAssemblyAttribute<ComVisibleAttribute>(assembly);
//if (comAttr != null)
// IsComVisible = comAttr.Value;
}
}
}
@@ -1,8 +0,0 @@
namespace ASCOM.Meade.net.AstroMaths
{
public class HorizonCoordinates
{
public double Altitude { get; set; }
public double Azimuth { get; set; }
}
}
-36
View File
@@ -1,36 +0,0 @@
<#
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
+81 -69
View File
@@ -1,8 +1,6 @@
using System;
using System.Collections;
using System.Runtime.InteropServices;
// ReSharper disable UnusedMember.Local
// ReSharper disable UnusedMember.Global
using System.Collections;
namespace ASCOM.Meade.net
{
@@ -35,43 +33,43 @@ namespace ASCOM.Meade.net
#region Access to ole32.dll functions for class factories
// Define two common GUID objects for public usage.
private static readonly Guid IidIUnknown = new Guid("{00000000-0000-0000-C000-000000000046}");
private static readonly Guid IidIDispatch = new Guid("{00020400-0000-0000-C000-000000000046}");
public static Guid IID_IUnknown = new Guid("{00000000-0000-0000-C000-000000000046}");
public static Guid IID_IDispatch = new Guid("{00020400-0000-0000-C000-000000000046}");
[Flags]
enum Clsctx : uint
enum CLSCTX : uint
{
ClsctxInprocServer = 0x1,
ClsctxInprocHandler = 0x2,
ClsctxLocalServer = 0x4,
ClsctxInprocServer16 = 0x8,
ClsctxRemoteServer = 0x10,
ClsctxInprocHandler16 = 0x20,
ClsctxReserved1 = 0x40,
ClsctxReserved2 = 0x80,
ClsctxReserved3 = 0x100,
ClsctxReserved4 = 0x200,
ClsctxNoCodeDownload = 0x400,
ClsctxReserved5 = 0x800,
ClsctxNoCustomMarshal = 0x1000,
ClsctxEnableCodeDownload = 0x2000,
ClsctxNoFailureLog = 0x4000,
ClsctxDisableAaa = 0x8000,
ClsctxEnableAaa = 0x10000,
ClsctxFromDefaultContext = 0x20000,
ClsctxInproc = ClsctxInprocServer | ClsctxInprocHandler,
ClsctxServer = ClsctxInprocServer | ClsctxLocalServer | ClsctxRemoteServer,
ClsctxAll = ClsctxServer | ClsctxInprocHandler
CLSCTX_INPROC_SERVER = 0x1,
CLSCTX_INPROC_HANDLER = 0x2,
CLSCTX_LOCAL_SERVER = 0x4,
CLSCTX_INPROC_SERVER16 = 0x8,
CLSCTX_REMOTE_SERVER = 0x10,
CLSCTX_INPROC_HANDLER16 = 0x20,
CLSCTX_RESERVED1 = 0x40,
CLSCTX_RESERVED2 = 0x80,
CLSCTX_RESERVED3 = 0x100,
CLSCTX_RESERVED4 = 0x200,
CLSCTX_NO_CODE_DOWNLOAD = 0x400,
CLSCTX_RESERVED5 = 0x800,
CLSCTX_NO_CUSTOM_MARSHAL = 0x1000,
CLSCTX_ENABLE_CODE_DOWNLOAD = 0x2000,
CLSCTX_NO_FAILURE_LOG = 0x4000,
CLSCTX_DISABLE_AAA = 0x8000,
CLSCTX_ENABLE_AAA = 0x10000,
CLSCTX_FROM_DEFAULT_CONTEXT = 0x20000,
CLSCTX_INPROC = CLSCTX_INPROC_SERVER | CLSCTX_INPROC_HANDLER,
CLSCTX_SERVER = CLSCTX_INPROC_SERVER | CLSCTX_LOCAL_SERVER | CLSCTX_REMOTE_SERVER,
CLSCTX_ALL = CLSCTX_SERVER | CLSCTX_INPROC_HANDLER
}
[Flags]
enum Regcls : uint
enum REGCLS : uint
{
RegclsSingleuse = 0,
RegclsMultipleuse = 1,
RegclsMultiSeparate = 2,
RegclsSuspended = 4,
RegclsSurrogate = 8
REGCLS_SINGLEUSE = 0,
REGCLS_MULTIPLEUSE = 1,
REGCLS_MULTI_SEPARATE = 2,
REGCLS_SUSPENDED = 4,
REGCLS_SURROGATE = 8
}
//
// CoRegisterClassObject() is used to register a Class Factory
@@ -111,70 +109,83 @@ namespace ASCOM.Meade.net
#region Constructor and Private ClassFactory Data
private readonly Type _mClassType;
private Guid _mClassId;
private readonly ArrayList _mInterfaceTypes;
private uint _mCookie;
//private readonly string _mProgid;
protected Type m_ClassType;
protected Guid m_ClassId;
protected ArrayList m_InterfaceTypes;
protected uint m_ClassContext;
protected uint m_Flags;
protected UInt32 m_locked = 0;
protected uint m_Cookie;
protected string m_progid;
public ClassFactory(Type type)
{
if (type == null)
throw new ArgumentNullException(nameof(type));
_mClassType = type;
throw new ArgumentNullException("type");
m_ClassType = type;
//PWGS Get the ProgID from the MetaData
//_mProgid = Marshal.GenerateProgIdForType(type);
_mClassId = Marshal.GenerateGuidForType(type); // Should be nailed down by [Guid(...)]
ClassContext = (uint)Clsctx.ClsctxLocalServer; // Default
Flags = (uint)Regcls.RegclsMultipleuse | // Default
(uint)Regcls.RegclsSuspended;
_mInterfaceTypes = new ArrayList();
m_progid = Marshal.GenerateProgIdForType(type);
m_ClassId = Marshal.GenerateGuidForType(type); // Should be nailed down by [Guid(...)]
m_ClassContext = (uint)CLSCTX.CLSCTX_LOCAL_SERVER; // Default
m_Flags = (uint)REGCLS.REGCLS_MULTIPLEUSE | // Default
(uint)REGCLS.REGCLS_SUSPENDED;
m_InterfaceTypes = new ArrayList();
foreach (Type T in type.GetInterfaces()) // Save all of the implemented interfaces
_mInterfaceTypes.Add(T);
m_InterfaceTypes.Add(T);
}
#endregion
#region Common ClassFactory Methods
private uint ClassContext { get; }
public uint ClassContext
{
get { return m_ClassContext; }
set { m_ClassContext = value; }
}
public Guid ClassId
{
get => _mClassId;
set => _mClassId = value;
get { return m_ClassId; }
set { m_ClassId = value; }
}
private uint Flags { get; }
public uint Flags
{
get { return m_Flags; }
set { m_Flags = value; }
}
public bool RegisterClassObject()
{
// Register the class factory
int i = CoRegisterClassObject
(
ref _mClassId,
ref m_ClassId,
this,
ClassContext,
Flags,
out _mCookie
m_ClassContext,
m_Flags,
out m_Cookie
);
return i == 0;
return (i == 0);
}
public void RevokeClassObject()
public bool RevokeClassObject()
{
CoRevokeClassObject(_mCookie);
int i = CoRevokeClassObject(m_Cookie);
return (i == 0);
}
public static void ResumeClassObjects()
public static bool ResumeClassObjects()
{
CoResumeClassObjects();
int i = CoResumeClassObjects();
return (i == 0);
}
public static void SuspendClassObjects()
public static bool SuspendClassObjects()
{
CoSuspendClassObjects();
int i = CoSuspendClassObjects();
return (i == 0);
}
#endregion
@@ -190,24 +201,25 @@ namespace ASCOM.Meade.net
//
// Handle specific requests for implemented interfaces
//
foreach (Type iType in _mInterfaceTypes)
foreach (Type iType in m_InterfaceTypes)
{
if (riid == Marshal.GenerateGuidForType(iType))
{
ppvObject = Marshal.GetComInterfaceForObject(Activator.CreateInstance(_mClassType), iType);
ppvObject = Marshal.GetComInterfaceForObject(Activator.CreateInstance(m_ClassType), iType);
return;
}
}
//
// Handle requests for IDispatch or IUnknown on the class
//
if (riid == IidIDispatch)
if (riid == IID_IDispatch)
{
ppvObject = Marshal.GetIDispatchForObject(Activator.CreateInstance(_mClassType));
ppvObject = Marshal.GetIDispatchForObject(Activator.CreateInstance(m_ClassType));
return;
}
else if (riid == IidIUnknown)
else if (riid == IID_IUnknown)
{
ppvObject = Marshal.GetIUnknownForObject(Activator.CreateInstance(_mClassType));
ppvObject = Marshal.GetIUnknownForObject(Activator.CreateInstance(m_ClassType));
}
else
{
-8
View File
@@ -1,8 +0,0 @@
namespace ASCOM.Meade.net
{
public class ConnectionInfo
{
//public int Connections { get; set; }
public int SameDevice { get; set; }
}
}
-39
View File
@@ -1,39 +0,0 @@
using System;
using System.Linq;
using System.Reflection;
namespace ASCOM.Meade.net
{
public static class EnumExtensionMethods
{
public static string GetDescription(this Enum GenericEnum)
{
var genericEnumType = GenericEnum.GetType();
var memberInfo = genericEnumType.GetMember(GenericEnum.ToString());
if (memberInfo.Length > 0)
{
var _Attribs = memberInfo[0]
.GetCustomAttributes(typeof(System.ComponentModel.DescriptionAttribute), false);
if (_Attribs.Any())
{
return ((System.ComponentModel.DescriptionAttribute) _Attribs.ElementAt(0)).Description;
}
}
return GenericEnum.ToString();
}
public static T GetValueFromDescription<T>( string description) where T : Enum
{
foreach (T value in Enum.GetValues(typeof(T)))
{
if (value.GetDescription() == description)
{
return value;
}
}
return default;
}
}
}
+16 -14
View File
@@ -8,33 +8,35 @@ namespace ASCOM.Meade.net
/// </summary>
class GarbageCollection
{
private bool _mbContinueThread;
private readonly int _miInterval;
private readonly ManualResetEvent _mEventThreadEnded;
protected bool m_bContinueThread;
protected bool m_GCWatchStopped;
protected int m_iInterval;
protected ManualResetEvent m_EventThreadEnded;
public GarbageCollection(int iInterval)
{
_mbContinueThread = true;
_miInterval = iInterval;
_mEventThreadEnded = new ManualResetEvent(false);
m_bContinueThread = true;
m_GCWatchStopped = false;
m_iInterval = iInterval;
m_EventThreadEnded = new ManualResetEvent(false);
}
public void GcWatch()
public void GCWatch()
{
// Pause for a moment to provide a delay to make threads more apparent.
while (ContinueThread())
{
GC.Collect();
Thread.Sleep(_miInterval);
Thread.Sleep(m_iInterval);
}
_mEventThreadEnded.Set();
m_EventThreadEnded.Set();
}
private bool ContinueThread()
protected bool ContinueThread()
{
lock (this)
{
return _mbContinueThread;
return m_bContinueThread;
}
}
@@ -42,14 +44,14 @@ namespace ASCOM.Meade.net
{
lock (this)
{
_mbContinueThread = false;
m_bContinueThread = false;
}
}
public void WaitForThreadToStop()
{
_mEventThreadEnded.WaitOne();
_mEventThreadEnded.Reset();
m_EventThreadEnded.WaitOne();
m_EventThreadEnded.Reset();
}
}
}
+190 -148
View File
@@ -12,45 +12,92 @@
// Modified by Chris Rowland and Peter Simpson to allow use with multiple devices of the same type March 2011
//
//
using System;
using System.Collections;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Security.Principal;
using System.Threading;
using System.Windows.Forms;
using ASCOM.Meade.net.Properties;
using System.Drawing;
using System.Collections;
using System.Runtime.InteropServices;
using System.Reflection;
using ASCOM.Utilities;
using Microsoft.Win32;
using System.Text;
using System.Threading;
using System.Security.Principal;
using System.Diagnostics;
using ASCOM;
namespace ASCOM.Meade.net
{
public static class Server
{
private const string DriverName = "Meade Generic";
#region Access to kernel32.dll, user32.dll, and ole32.dll functions
[Flags]
enum CLSCTX : uint
{
CLSCTX_INPROC_SERVER = 0x1,
CLSCTX_INPROC_HANDLER = 0x2,
CLSCTX_LOCAL_SERVER = 0x4,
CLSCTX_INPROC_SERVER16 = 0x8,
CLSCTX_REMOTE_SERVER = 0x10,
CLSCTX_INPROC_HANDLER16 = 0x20,
CLSCTX_RESERVED1 = 0x40,
CLSCTX_RESERVED2 = 0x80,
CLSCTX_RESERVED3 = 0x100,
CLSCTX_RESERVED4 = 0x200,
CLSCTX_NO_CODE_DOWNLOAD = 0x400,
CLSCTX_RESERVED5 = 0x800,
CLSCTX_NO_CUSTOM_MARSHAL = 0x1000,
CLSCTX_ENABLE_CODE_DOWNLOAD = 0x2000,
CLSCTX_NO_FAILURE_LOG = 0x4000,
CLSCTX_DISABLE_AAA = 0x8000,
CLSCTX_ENABLE_AAA = 0x10000,
CLSCTX_FROM_DEFAULT_CONTEXT = 0x20000,
CLSCTX_INPROC = CLSCTX_INPROC_SERVER | CLSCTX_INPROC_HANDLER,
CLSCTX_SERVER = CLSCTX_INPROC_SERVER | CLSCTX_LOCAL_SERVER | CLSCTX_REMOTE_SERVER,
CLSCTX_ALL = CLSCTX_SERVER | CLSCTX_INPROC_HANDLER
}
//// CoInitializeEx() can be used to set the apartment model
//// of individual threads.
//[DllImport("ole32.dll")]
//static extern int CoInitializeEx(IntPtr pvReserved, uint dwCoInit);
[Flags]
enum COINIT : uint
{
/// Initializes the thread for multi-threaded object concurrency.
COINIT_MULTITHREADED = 0x0,
/// Initializes the thread for apartment-threaded object concurrency.
COINIT_APARTMENTTHREADED = 0x2,
/// Disables DDE for Ole1 support.
COINIT_DISABLE_OLE1DDE = 0x4,
/// Trades memory for speed.
COINIT_SPEED_OVER_MEMORY = 0x8
}
//// CoUninitialize() is used to uninitialize a COM thread.
//[DllImport("ole32.dll")]
//static extern void CoUninitialize();
[Flags]
enum REGCLS : uint
{
REGCLS_SINGLEUSE = 0,
REGCLS_MULTIPLEUSE = 1,
REGCLS_MULTI_SEPARATE = 2,
REGCLS_SUSPENDED = 4,
REGCLS_SURROGATE = 8
}
// CoInitializeEx() can be used to set the apartment model
// of individual threads.
[DllImport("ole32.dll")]
static extern int CoInitializeEx(IntPtr pvReserved, uint dwCoInit);
// CoUninitialize() is used to uninitialize a COM thread.
[DllImport("ole32.dll")]
static extern void CoUninitialize();
// PostThreadMessage() allows us to post a Windows Message to
// a specific thread (identified by its thread id).
// We will need this API to post a WM_QUIT message to the main
// thread in order to terminate this application.
[DllImport("user32.dll")]
static extern bool PostThreadMessage(uint idThread, uint msg, UIntPtr wParam,
static extern bool PostThreadMessage(uint idThread, uint Msg, UIntPtr wParam,
IntPtr lParam);
// GetCurrentThreadId() allows us to obtain the thread id of the
@@ -61,76 +108,76 @@ namespace ASCOM.Meade.net
#endregion
#region Private Data
private static int _objsInUse; // Keeps a count on the total number of objects alive.
private static int _serverLocks; // Keeps a lock count on this application.
private static FrmMain _sMainForm; // Reference to our main form
//private static ArrayList _sComObjectAssys; // Dynamically loaded assemblies containing served COM objects
private static ArrayList _sComObjectTypes; // Served COM object types
private static ArrayList _sClassFactories; // Served COM object class factories
private static string _sAppId = "{4e68ec46-5ffc-49e7-b298-38a548df0bfd}"; // Our AppId
private static readonly Object LockObject = new object();
private static int objsInUse; // Keeps a count on the total number of objects alive.
private static int serverLocks; // Keeps a lock count on this application.
private static frmMain s_MainForm = null; // Reference to our main form
private static ArrayList s_ComObjectAssys; // Dynamically loaded assemblies containing served COM objects
private static ArrayList s_ComObjectTypes; // Served COM object types
private static ArrayList s_ClassFactories; // Served COM object class factories
private static string s_appId = "{4e68ec46-5ffc-49e7-b298-38a548df0bfd}"; // Our AppId
private static readonly Object lockObject = new object();
#endregion
// This property returns the main thread's id.
private static uint MainThreadId { get; set; } // Stores the main thread's thread id.
public static uint MainThreadId { get; private set; } // Stores the main thread's thread id.
// Used to tell if started by COM or manually
private static bool StartedByCom { get; set; } // True if server started by COM (-embedding)
public static bool StartedByCOM { get; private set; } // True if server started by COM (-embedding)
#region Server Lock, Object Counting, and AutoQuit on COM startup
// Returns the total number of objects alive currently.
private static int ObjectsCount
public static int ObjectsCount
{
get
{
lock (LockObject)
lock (lockObject)
{
return _objsInUse;
return objsInUse;
}
}
}
// This method performs a thread-safe incrementation of the objects count.
public static void CountObject()
public static int CountObject()
{
// Increment the global count of objects.
Interlocked.Increment(ref _objsInUse);
return Interlocked.Increment(ref objsInUse);
}
// This method performs a thread-safe decrementation the objects count.
public static void UncountObject()
public static int UncountObject()
{
// Decrement the global count of objects.
Interlocked.Decrement(ref _objsInUse);
return Interlocked.Decrement(ref objsInUse);
}
// Returns the current server lock count.
private static int ServerLockCount
public static int ServerLockCount
{
get
{
lock (LockObject)
lock (lockObject)
{
return _serverLocks;
return serverLocks;
}
}
}
// This method performs a thread-safe incrementation the
// server lock count.
public static void CountLock()
public static int CountLock()
{
// Increment the global lock count of this server.
Interlocked.Increment(ref _serverLocks);
return Interlocked.Increment(ref serverLocks);
}
// This method performs a thread-safe decrementation the
// server lock count.
public static void UncountLock()
public static int UncountLock()
{
// Decrement the global lock count of this server.
Interlocked.Decrement(ref _serverLocks);
return Interlocked.Decrement(ref serverLocks);
}
// AttemptToTerminateServer() will check to see if the objects count and the server
@@ -142,11 +189,11 @@ namespace ASCOM.Meade.net
//
public static void ExitIf()
{
lock (LockObject)
lock (lockObject)
{
if ((ObjectsCount <= 0) && (ServerLockCount <= 0))
{
if (StartedByCom)
if (StartedByCOM)
{
UIntPtr wParam = new UIntPtr(0);
IntPtr lParam = new IntPtr(0);
@@ -169,14 +216,12 @@ namespace ASCOM.Meade.net
//
private static bool LoadComObjectAssemblies()
{
//_sComObjectAssys = new ArrayList();
_sComObjectTypes = new ArrayList();
s_ComObjectAssys = new ArrayList();
s_ComObjectTypes = new ArrayList();
// put everything into one folder, the same as the server.
string assyPath = Assembly.GetEntryAssembly()?.Location;
string assyPath = Assembly.GetEntryAssembly().Location;
assyPath = Path.GetDirectoryName(assyPath);
if (assyPath == null)
throw new System.InvalidOperationException();
DirectoryInfo d = new DirectoryInfo(assyPath);
foreach (FileInfo fi in d.GetFiles("*.dll"))
@@ -201,8 +246,8 @@ namespace ASCOM.Meade.net
if (attrbutes.Length > 0)
{
//MessageBox.Show("Adding Type: " + type.Name + " " + type.FullName);
_sComObjectTypes.Add(type); //PWGS - much simpler
//_sComObjectAssys.Add(so);
s_ComObjectTypes.Add(type); //PWGS - much simpler
s_ComObjectAssys.Add(so);
}
}
}
@@ -210,13 +255,15 @@ namespace ASCOM.Meade.net
{
// Probably an attempt to load a Win32 DLL (i.e. not a .net assembly)
// Just swallow the exception and continue to the next item.
continue;
}
catch (Exception e)
{
MessageBox.Show(string.Format(Resources.Server_LoadComObjectAssemblies_Failed_to_load_served_COM_class_assembly__0_____1_, fi.Name, e.Message),
DriverName, MessageBoxButtons.OK, MessageBoxIcon.Stop);
MessageBox.Show("Failed to load served COM class assembly " + fi.Name + " - " + e.Message,
"Meade.net", MessageBoxButtons.OK, MessageBoxIcon.Stop);
return false;
}
}
return true;
}
@@ -241,22 +288,22 @@ namespace ASCOM.Meade.net
//
private static void ElevateSelf(string arg)
{
var si = new ProcessStartInfo
{
Arguments = arg,
WorkingDirectory = Environment.CurrentDirectory,
FileName = Application.ExecutablePath,
Verb = "runas"
};
ProcessStartInfo si = new ProcessStartInfo();
si.Arguments = arg;
si.WorkingDirectory = Environment.CurrentDirectory;
si.FileName = Application.ExecutablePath;
si.Verb = "runas";
try { Process.Start(si); }
catch (Win32Exception)
catch (System.ComponentModel.Win32Exception)
{
MessageBox.Show(string.Format(Resources.Server_ElevateSelf_The__0__was_not__1__because_you_did_not_allow_it_, DriverName, (arg == "/register" ? "registered" : "unregistered")), DriverName, MessageBoxButtons.OK, MessageBoxIcon.Warning);
MessageBox.Show("The Meade.net was not " + (arg == "/register" ? "registered" : "unregistered") +
" because you did not allow it.", "Meade.net", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString(), DriverName, MessageBoxButtons.OK, MessageBoxIcon.Stop);
MessageBox.Show(ex.ToString(), "Meade.net", MessageBoxButtons.OK, MessageBoxIcon.Stop);
}
return;
}
//
@@ -295,32 +342,35 @@ namespace ASCOM.Meade.net
//
// HKCR\APPID\appid
//
using (RegistryKey key = Registry.ClassesRoot.CreateSubKey("APPID\\" + _sAppId))
using (RegistryKey key = Registry.ClassesRoot.CreateSubKey("APPID\\" + s_appId))
{
key?.SetValue(null, assyDescription);
key?.SetValue("AppID", _sAppId);
key?.SetValue("AuthenticationLevel", 1, RegistryValueKind.DWord);
key.SetValue(null, assyDescription);
key.SetValue("AppID", s_appId);
key.SetValue("AuthenticationLevel", 1, RegistryValueKind.DWord);
}
//
// HKCR\APPID\exename.ext
//
using (RegistryKey key = Registry.ClassesRoot.CreateSubKey(
$"APPID\\{Application.ExecutablePath.Substring(Application.ExecutablePath.LastIndexOf('\\') + 1)}"))
using (RegistryKey key = Registry.ClassesRoot.CreateSubKey(string.Format("APPID\\{0}",
Application.ExecutablePath.Substring(Application.ExecutablePath.LastIndexOf('\\') + 1))))
{
key?.SetValue("AppID", _sAppId);
key.SetValue("AppID", s_appId);
}
}
catch (Exception ex)
{
MessageBox.Show(string.Format(Resources.Server_RegisterObjects_, ex),
DriverName, MessageBoxButtons.OK, MessageBoxIcon.Stop);
MessageBox.Show("Error while registering the server:\n" + ex.ToString(),
"Meade.net", MessageBoxButtons.OK, MessageBoxIcon.Stop);
return;
}
finally
{
}
//
// For each of the driver assemblies
//
foreach (Type type in _sComObjectTypes)
foreach (Type type in s_ComObjectTypes)
{
bool bFail = false;
try
@@ -333,27 +383,22 @@ namespace ASCOM.Meade.net
//PWGS Generate device type from the Class name
string deviceType = type.Name;
using (RegistryKey key = Registry.ClassesRoot.CreateSubKey($"CLSID\\{clsid}"))
using (RegistryKey key = Registry.ClassesRoot.CreateSubKey(string.Format("CLSID\\{0}", clsid)))
{
key?.SetValue(null, progid); // Could be assyTitle/Desc??, but .NET components show ProgId here
key?.SetValue("AppId", _sAppId);
if (key != null)
key.SetValue(null, progid); // Could be assyTitle/Desc??, but .NET components show ProgId here
key.SetValue("AppId", s_appId);
using (RegistryKey key2 = key.CreateSubKey("Implemented Categories"))
{
using (RegistryKey key2 = key.CreateSubKey("Implemented Categories"))
{
key2?.CreateSubKey("{62C8FE65-4EBB-45e7-B440-6E39B2CDBF29}");
}
using (RegistryKey key2 = key.CreateSubKey("ProgId"))
{
key2?.SetValue(null, progid);
}
key.CreateSubKey("Programmable");
using (RegistryKey key2 = key.CreateSubKey("LocalServer32"))
{
key2?.SetValue(null, Application.ExecutablePath);
}
key2.CreateSubKey("{62C8FE65-4EBB-45e7-B440-6E39B2CDBF29}");
}
using (RegistryKey key2 = key.CreateSubKey("ProgId"))
{
key2.SetValue(null, progid);
}
key.CreateSubKey("Programmable");
using (RegistryKey key2 = key.CreateSubKey("LocalServer32"))
{
key2.SetValue(null, Application.ExecutablePath);
}
}
//
@@ -361,33 +406,35 @@ namespace ASCOM.Meade.net
//
using (RegistryKey key = Registry.ClassesRoot.CreateSubKey(progid))
{
key?.SetValue(null, assyTitle);
key.SetValue(null, assyTitle);
using (RegistryKey key2 = key.CreateSubKey("CLSID"))
{
key2?.SetValue(null, clsid);
key2.SetValue(null, clsid);
}
}
//
// ASCOM
//
//assy = type.Assembly;
assy = type.Assembly;
// Pull the display name from the ServedClassName attribute.
attr = Attribute.GetCustomAttribute(type, typeof(ServedClassNameAttribute)); //PWGS Changed to search type for attribute rather than assembly
string chooserName = ((ServedClassNameAttribute)attr).DisplayName ?? "MultiServer";
using (var p = new Profile())
using (var P = new ASCOM.Utilities.Profile())
{
p.DeviceType = deviceType;
p.Register(progid, chooserName);
P.DeviceType = deviceType;
P.Register(progid, chooserName);
}
}
catch (Exception ex)
{
MessageBox.Show(string.Format(Resources.Server_RegisterObjects_, ex),
DriverName, MessageBoxButtons.OK, MessageBoxIcon.Stop);
MessageBox.Show("Error while registering the server:\n" + ex.ToString(),
"Meade.net", MessageBoxButtons.OK, MessageBoxIcon.Stop);
bFail = true;
}
finally
{
}
if (bFail) break;
}
}
@@ -395,7 +442,7 @@ namespace ASCOM.Meade.net
//
// Remove all traces of this from the registry.
//
// If the above does AppID/DCOM stuff, this would have
// **TODO** If the above does AppID/DCOM stuff, this would have
// to remove that stuff too.
//
private static void UnregisterObjects()
@@ -409,14 +456,14 @@ namespace ASCOM.Meade.net
//
// Local server's DCOM/AppID information
//
Registry.ClassesRoot.DeleteSubKey($"APPID\\{_sAppId}", false);
Registry.ClassesRoot.DeleteSubKey(
$"APPID\\{Application.ExecutablePath.Substring(Application.ExecutablePath.LastIndexOf('\\') + 1)}", false);
Registry.ClassesRoot.DeleteSubKey(string.Format("APPID\\{0}", s_appId), false);
Registry.ClassesRoot.DeleteSubKey(string.Format("APPID\\{0}",
Application.ExecutablePath.Substring(Application.ExecutablePath.LastIndexOf('\\') + 1)), false);
//
// For each of the driver assemblies
//
foreach (Type type in _sComObjectTypes)
foreach (Type type in s_ComObjectTypes)
{
string clsid = Marshal.GenerateGuidForType(type).ToString("B");
string progid = Marshal.GenerateProgIdForType(type);
@@ -427,32 +474,29 @@ namespace ASCOM.Meade.net
//
// HKCR\progid
//
Registry.ClassesRoot.DeleteSubKey($"{progid}\\CLSID", false);
Registry.ClassesRoot.DeleteSubKey(String.Format("{0}\\CLSID", progid), false);
Registry.ClassesRoot.DeleteSubKey(progid, false);
//
// HKCR\CLSID\clsid
//
Registry.ClassesRoot.DeleteSubKey($"CLSID\\{clsid}\\Implemented Categories\\{{62C8FE65-4EBB-45e7-B440-6E39B2CDBF29}}", false);
Registry.ClassesRoot.DeleteSubKey($"CLSID\\{clsid}\\Implemented Categories", false);
Registry.ClassesRoot.DeleteSubKey($"CLSID\\{clsid}\\ProgId", false);
Registry.ClassesRoot.DeleteSubKey($"CLSID\\{clsid}\\LocalServer32", false);
Registry.ClassesRoot.DeleteSubKey($"CLSID\\{clsid}\\Programmable", false);
Registry.ClassesRoot.DeleteSubKey($"CLSID\\{clsid}", false);
Registry.ClassesRoot.DeleteSubKey(String.Format("CLSID\\{0}\\Implemented Categories\\{{62C8FE65-4EBB-45e7-B440-6E39B2CDBF29}}", clsid), false);
Registry.ClassesRoot.DeleteSubKey(String.Format("CLSID\\{0}\\Implemented Categories", clsid), false);
Registry.ClassesRoot.DeleteSubKey(String.Format("CLSID\\{0}\\ProgId", clsid), false);
Registry.ClassesRoot.DeleteSubKey(String.Format("CLSID\\{0}\\LocalServer32", clsid), false);
Registry.ClassesRoot.DeleteSubKey(String.Format("CLSID\\{0}\\Programmable", clsid), false);
Registry.ClassesRoot.DeleteSubKey(String.Format("CLSID\\{0}", clsid), false);
try
{
//
// ASCOM
//
using (var p = new Profile())
using (var P = new ASCOM.Utilities.Profile())
{
p.DeviceType = deviceType;
p.Unregister(progid);
P.DeviceType = deviceType;
P.Unregister(progid);
}
}
catch (Exception)
{
// ignored
}
catch (Exception) { }
}
}
#endregion
@@ -463,27 +507,28 @@ namespace ASCOM.Meade.net
// that we serve. This requires the class facgtory name to be
// equal to the served class name + "ClassFactory".
//
private static void RegisterClassFactories()
private static bool RegisterClassFactories()
{
_sClassFactories = new ArrayList();
foreach (Type type in _sComObjectTypes)
s_ClassFactories = new ArrayList();
foreach (Type type in s_ComObjectTypes)
{
ClassFactory factory = new ClassFactory(type); // Use default context & flags
_sClassFactories.Add(factory);
s_ClassFactories.Add(factory);
if (!factory.RegisterClassObject())
{
MessageBox.Show(string.Format(Resources.Server_RegisterClassFactories_Failed_to_register_class_factory_for__0_, type.Name),
DriverName, MessageBoxButtons.OK, MessageBoxIcon.Stop);
return;
MessageBox.Show("Failed to register class factory for " + type.Name,
"Meade.net", MessageBoxButtons.OK, MessageBoxIcon.Stop);
return false;
}
}
ClassFactory.ResumeClassObjects(); // Served objects now go live
return true;
}
private static void RevokeClassFactories()
{
ClassFactory.SuspendClassObjects(); // Prevent race conditions
foreach (ClassFactory factory in _sClassFactories)
foreach (ClassFactory factory in s_ClassFactories)
factory.RevokeClassObject();
}
#endregion
@@ -499,7 +544,7 @@ namespace ASCOM.Meade.net
bool bRet = true;
//
// -Embedding is "ActiveX start". Prohibit non_AX starting?
//**TODO** -Embedding is "ActiveX start". Prohibit non_AX starting?
//
if (args.Length > 0)
{
@@ -507,7 +552,7 @@ namespace ASCOM.Meade.net
switch (args[0].ToLower())
{
case "-embedding":
StartedByCom = true; // Indicate COM started us
StartedByCOM = true; // Indicate COM started us
break;
case "-register":
@@ -527,14 +572,13 @@ namespace ASCOM.Meade.net
break;
default:
MessageBox.Show(
string.Format(Resources.Server_ProcessArguments_, args[0]),
DriverName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
MessageBox.Show("Unknown argument: " + args[0] + "\nValid are : -register, -unregister and -embedding",
"Meade.net", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
break;
}
}
else
StartedByCom = false;
StartedByCOM = false;
return bRet;
}
@@ -554,26 +598,24 @@ namespace ASCOM.Meade.net
if (!ProcessArguments(args)) return; // Register/Unregister
// Initialize critical member variables.
_objsInUse = 0;
_serverLocks = 0;
objsInUse = 0;
serverLocks = 0;
MainThreadId = GetCurrentThreadId();
Thread.CurrentThread.Name = "Main Thread";
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
_sMainForm = new FrmMain();
if (StartedByCom) _sMainForm.WindowState = FormWindowState.Minimized;
s_MainForm = new frmMain();
if (StartedByCOM) s_MainForm.WindowState = FormWindowState.Minimized;
// Register the class factories of the served objects
RegisterClassFactories();
// Start up the garbage collection thread.
var garbageCollector = new GarbageCollection(1000);
var gcThread = new Thread(garbageCollector.GcWatch)
{
Name = "Garbage Collection Thread"
};
gcThread.Start();
GarbageCollection GarbageCollector = new GarbageCollection(1000);
Thread GCThread = new Thread(new ThreadStart(GarbageCollector.GCWatch));
GCThread.Name = "Garbage Collection Thread";
GCThread.Start();
//
// Start the message loop. This serializes incoming calls to our
@@ -581,7 +623,7 @@ namespace ASCOM.Meade.net
//
try
{
Application.Run(_sMainForm);
Application.Run(s_MainForm);
}
finally
{
@@ -591,8 +633,8 @@ namespace ASCOM.Meade.net
RevokeClassFactories();
// Now stop the Garbage Collector thread.
garbageCollector.StopThread();
garbageCollector.WaitForThreadToStop();
GarbageCollector.StopThread();
GarbageCollector.WaitForThreadToStop();
}
}
#endregion
@@ -0,0 +1,36 @@
using System.Globalization;
using System.Threading;
using System.Resources;
using System.Reflection;
namespace ASCOM.Meade.net.Localization
{
internal class LocalisationHelper
{
private const string LocalizationNamespace = "LocalisationTest.Localization.Resources.Localization";
ResourceManager _resourceManager;
public LocalisationHelper()
{
_resourceManager = new ResourceManager(LocalizationNamespace, Assembly.GetExecutingAssembly());
SetLocalisation(CultureInfo.CurrentCulture.Name);
}
internal void SetLocalisation(string name)
{
var cultureInfo = new CultureInfo(name);
//CultureInfo.DefaultThreadCurrentCulture = cultureInfo;
//CultureInfo.DefaultThreadCurrentUICulture = cultureInfo;
Thread.CurrentThread.CurrentCulture = cultureInfo;
Thread.CurrentThread.CurrentUICulture = cultureInfo;
}
internal string GetString(string key)
{
return _resourceManager.GetString(key);
}
}
}
+8 -56
View File
@@ -10,7 +10,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ASCOM.Meade.net</RootNamespace>
<AssemblyName>ASCOM.Meade.net.Server</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileUpgradeFlags>
</FileUpgradeFlags>
<OldToolsVersion>2.0</OldToolsVersion>
@@ -43,7 +43,6 @@
<PlatformTarget>AnyCPU</PlatformTarget>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@@ -69,7 +68,7 @@
<OutputPath>..\bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
@@ -82,54 +81,18 @@
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="ASCOM.Astrometry, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
<HintPath>..\packages\ASCOM.Platform.6.5.1\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.5.1\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.5.1\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.5.1\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.5.1\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.5.1\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.5.1\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.5.1\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.5.1\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.5.1\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.5.1\lib\net40\ASCOM.Utilities.Video.dll</HintPath>
</Reference>
<Reference Include="JetBrains.Annotations, Version=2020.3.0.0, Culture=neutral, PublicKeyToken=1010a0d8d6380325, processorArchitecture=MSIL">
<HintPath>..\packages\JetBrains.Annotations.2020.3.0\lib\net20\JetBrains.Annotations.dll</HintPath>
</Reference>
<Reference Include="ASCOM.Attributes, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL" />
<Reference Include="ASCOM.DeviceInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL" />
<Reference Include="ASCOM.Exceptions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL" />
<Reference Include="ASCOM.Utilities, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL" />
<Reference Include="System" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
</ItemGroup>
<ItemGroup>
<Compile Include="AssemblyInfo.cs" />
<Compile Include="ClassFactory.cs" />
<Compile Include="ConnectionInfo.cs" />
<Compile Include="EnumExtensionMethods.cs" />
<Compile Include="frmMain.cs">
<SubType>Form</SubType>
</Compile>
@@ -137,19 +100,9 @@
<DependentUpon>frmMain.cs</DependentUpon>
</Compile>
<Compile Include="GarbageCollection.cs" />
<Compile Include="AstroMaths\HorizonCoordinates.cs" />
<Compile Include="Localization\LocalisationHelper.cs" />
<Compile Include="LocalServer.cs" />
<Compile Include="MeadeTelescopeBase.cs" />
<Compile Include="ParkedBehaviour.cs" />
<Compile Include="ParkedPosition.cs" />
<Compile Include="ProfileFactory.cs" />
<Compile Include="ProfileProperties.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="TelescopeList.cs" />
<Compile Include="ThreadSafeValue.cs" />
<Compile Include="Win32Utilities.cs" />
<Compile Include="Wrapper\IProfileWrapper.cs" />
<Compile Include="Wrapper\SharedResourcesWrapper.cs" />
<EmbeddedResource Include="frmMain.resx">
<SubType>Designer</SubType>
<DependentUpon>frmMain.cs</DependentUpon>
@@ -179,8 +132,7 @@
<ItemGroup>
<Content Include="ASCOM.ico" />
<Content Include="ASCOM.png" />
<None Include="BootstrapAscomProfileStore.ps1" />
<None Include="packages.config" />
<Content Include="ReadMe.htm" />
<None Include="Resources\ASCOM.bmp" />
</ItemGroup>
<ItemGroup>
-139
View File
@@ -1,139 +0,0 @@
using System;
using System.Reflection;
using System.Runtime.InteropServices;
using ASCOM.Meade.net.Wrapper;
using ASCOM.Utilities;
namespace ASCOM.Meade.net
{
[ComVisible(false)]
public class MeadeTelescopeBase : ReferenceCountedObjectBase
{
/// <summary>
/// Variable to hold the trace logger object (creates a diagnostic log file with information that you specify)
/// </summary>
protected static TraceLogger Tl;
/// <summary>
/// Driver description that displays in the ASCOM Chooser.
/// </summary>
protected static readonly string DriverDescription = "Meade Generic";
protected readonly ISharedResourcesWrapper SharedResourcesWrapper;
protected ProfileProperties _profileProperties;
public MeadeTelescopeBase()
{
SharedResourcesWrapper = new SharedResourcesWrapper();
}
public MeadeTelescopeBase(ISharedResourcesWrapper sharedResourcesWrapper)
{
SharedResourcesWrapper = sharedResourcesWrapper;
}
protected void Initialise(string className)
{
Tl = new TraceLogger("", $"Meade.Generic.{className}");
ReadProfile(); // Read device configuration from the ASCOM Profile store
IsConnected = false; // Initialise connected to false
LogMessage(className, "Completed initialisation");
LogMessage(className, $"Driver version: {DriverVersion}");
}
/// <summary>
/// Read the device configuration from the ASCOM Profile store
/// </summary>
protected void ReadProfile()
{
_profileProperties = SharedResourcesWrapper.ReadProfile();
Tl.Enabled = _profileProperties.TraceLogger;
LogMessage("ReadProfile", $"Trace logger enabled: {Tl.Enabled}");
LogMessage("ReadProfile", $"Com Port: {_profileProperties.ComPort}");
LogMessage("ReadProfile", $"Backlash Steps: {_profileProperties.BacklashCompensation}");
LogMessage("ReadProfile", $"Dynamic breaking: {_profileProperties.DynamicBreaking}");
LogMessage("ReadProfile", $"Guide Rate: {_profileProperties.GuideRateArcSecondsPerSecond}");
LogMessage("ReadProfile", $"Precision: {_profileProperties.Precision}");
LogMessage("ReadProfile", $"Guiding Style: {_profileProperties.GuidingStyle}");
LogMessage("ReadProfile", $"Site Elevation: {_profileProperties.SiteElevation}");
LogMessage("ReadProfile", $"Settle Time after slew: {_profileProperties.SettleTime}");
LogMessage("ReadProfile", $"Send date and time on connect: {_profileProperties.SendDateTime}");
LogMessage("ReadProfile", $"Parked Behaviour: {_profileProperties.ParkedBehaviour}");
LogMessage("ReadProfile", $"Parked Alt: {_profileProperties.ParkedAlt}");
LogMessage("ReadProfile", $"Parked Az: {_profileProperties.ParkedAz}");
LogMessage("ReadProfile", $"Focal Length: {_profileProperties.FocalLength}");
LogMessage("ReadProfile", $"Aperture Area: {_profileProperties.ApertureArea}");
LogMessage("ReadProfile", $"Aperture Area: {_profileProperties.ApertureDiameter}");
}
/// <summary>
/// Log helper function that takes formatted strings and arguments
/// </summary>
/// <param name="identifier"></param>
/// <param name="message"></param>
/// <param name="args"></param>
public static void LogMessage(string identifier, string message, params object[] args)
{
var msg = string.Format(message, args);
Tl.LogMessage(identifier, msg);
}
/// <summary>
/// Returns true if there is a valid connection to the driver hardware
/// </summary>
protected bool IsConnected { get; set; }
public string Description
{
get
{
Tl.LogMessage("Description Get", DriverDescription);
return DriverDescription;
}
}
public string DriverInfo
{
get
{
string driverInfo = $"{Description} .net driver. Version: {DriverVersion}";
LogMessage("DriverInfo Get", driverInfo);
return driverInfo;
}
}
public string DriverVersion
{
get
{
Version version = Assembly.GetExecutingAssembly().GetName().Version;
string driverVersion = $"{version.Major}.{version.Minor}.{version.Build}.{version.Revision}";
LogMessage("DriverVersion Get", driverVersion);
return driverVersion;
}
}
#region ASCOM Registration
private static IProfileFactory _profileFactory;
public static IProfileFactory ProfileFactory
{
get => _profileFactory ?? (_profileFactory = new ProfileFactory());
set => _profileFactory = value;
}
#endregion
protected void UpdateSiteElevation()
{
var profileProperties = SharedResourcesWrapper.ReadProfile();
profileProperties.SiteElevation = _profileProperties.SiteElevation;
SharedResourcesWrapper.WriteProfile(profileProperties);
}
}
}
-14
View File
@@ -1,14 +0,0 @@
using System.ComponentModel;
namespace ASCOM.Meade.net
{
public enum ParkedBehaviour
{
[Description("No Coordinates")]
NoCoordinates,
[Description("Last Good Position")]
LastGoodPosition,
[Description("Report coordinates as")]
ReportCoordinates
}
}
-12
View File
@@ -1,12 +0,0 @@
namespace ASCOM.Meade.net
{
public class ParkedPosition
{
public double Altitude { get; set; }
public double Azimuth { get; set; }
public double RightAscension { get; set; }
public double Declination { get; set; }
public double SiteLongitude { get; set; }
public double SiteLatitude { get; set; }
}
}
-17
View File
@@ -1,17 +0,0 @@
using ASCOM.Meade.net.Wrapper;
namespace ASCOM.Meade.net
{
public interface IProfileFactory
{
IProfileWrapper Create();
}
public class ProfileFactory : IProfileFactory
{
public IProfileWrapper Create()
{
return new ProfileWrapper();
}
}
}
-30
View File
@@ -1,30 +0,0 @@
namespace ASCOM.Meade.net
{
public class ProfileProperties
{
// properies that are part of the profile
public string ComPort { get; set; }
public bool TraceLogger { get; set; }
public double GuideRateArcSecondsPerSecond { get; set; }
public string Precision { get; set; }
public string GuidingStyle { get; set; }
public int BacklashCompensation { get; set; }
public bool ReverseFocusDirection { get; set; }
public bool DynamicBreaking { get; set; }
public bool RtsDtrEnabled { get; set; }
public double SiteElevation { get; set; }
public short SettleTime { get; set; }
public int DataBits { get; set; }
public string StopBits { get; set; }
public string Parity { get; set; }
public int Speed { get; set; }
public string Handshake { get; set; }
public bool SendDateTime { get; set; }
public ParkedBehaviour ParkedBehaviour { get; set; }
public double ParkedAlt { get; set; }
public double ParkedAz { get; set; }
public double FocalLength { get; set; }
public double ApertureArea { get; set; }
public double ApertureDiameter { get; set; }
}
}
+5 -4
View File
@@ -1,4 +1,5 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
@@ -8,7 +9,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyDescription("ASCOM multi-interface server for Meade.net")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("cjdawson.com")]
[assembly: AssemblyProduct("ASCOM Meade Generic")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("Copyright © 2019 cjdawson.com")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
@@ -20,7 +21,7 @@ using System.Runtime.InteropServices;
// Build Number
// Revision
//
[assembly: AssemblyVersion("0.0.0.0")]
[assembly: AssemblyFileVersion("0.0.0.0")]
[assembly: AssemblyVersion("0.6.0.1")]
[assembly: AssemblyFileVersion("0.6.0.1")]
[assembly: ComVisible(false)]
[assembly: ComVisibleAttribute(false)]
-84
View File
@@ -69,89 +69,5 @@ namespace ASCOM.Meade.net.Properties {
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized string similar to The {0} was not {1} because you did not allow it..
/// </summary>
internal static string Server_ElevateSelf_The__0__was_not__1__because_you_did_not_allow_it_ {
get {
return ResourceManager.GetString("Server_ElevateSelf_The__0__was_not__1__because_you_did_not_allow_it_", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Failed to load served COM class assembly {0} - {1}.
/// </summary>
internal static string Server_LoadComObjectAssemblies_Failed_to_load_served_COM_class_assembly__0_____1_ {
get {
return ResourceManager.GetString("Server_LoadComObjectAssemblies_Failed_to_load_served_COM_class_assembly__0_____1_" +
"", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Unknown argument: {0}
///Valid are : -register, -unregister and -embedding.
/// </summary>
internal static string Server_ProcessArguments_ {
get {
return ResourceManager.GetString("Server_ProcessArguments_", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Failed to register class factory for {0}.
/// </summary>
internal static string Server_RegisterClassFactories_Failed_to_register_class_factory_for__0_ {
get {
return ResourceManager.GetString("Server_RegisterClassFactories_Failed_to_register_class_factory_for__0_", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Error while registering the server:
///{0}.
/// </summary>
internal static string Server_RegisterObjects_ {
get {
return ResourceManager.GetString("Server_RegisterObjects_", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to {0} Settings ({1}).
/// </summary>
internal static string SetupDialogForm_SetupDialogForm__0__Settings___1__ {
get {
return ResourceManager.GetString("SetupDialogForm_SetupDialogForm__0__Settings___1__", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to ({0:00.0}% of sidereal rate).
/// </summary>
internal static string SetupDialogForm_TextBox1_TextChanged___0_00_0___of_sidereal_rate_ {
get {
return ResourceManager.GetString("SetupDialogForm_TextBox1_TextChanged___0_00_0___of_sidereal_rate_", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Please enter only numbers..
/// </summary>
internal static string SetupDialogForm_txtElevation_TextChanged_1_Please_enter_only_numbers_ {
get {
return ResourceManager.GetString("SetupDialogForm_txtElevation_TextChanged_1_Please_enter_only_numbers_", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Please enter only numbers..
/// </summary>
internal static string SetupDialogForm_txtFocalLength_TextChanged_1_Please_enter_only_numbers_ {
get {
return ResourceManager.GetString("SetupDialogForm_txtFocalLength_TextChanged_1_Please_enter_only_numbers_", resourceCulture);
}
}
}
}
-29
View File
@@ -121,33 +121,4 @@
<data name="ASCOM" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\ASCOM.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Server_ProcessArguments_" xml:space="preserve">
<value>Unknown argument: {0}
Valid are : -register, -unregister and -embedding</value>
</data>
<data name="Server_RegisterClassFactories_Failed_to_register_class_factory_for__0_" xml:space="preserve">
<value>Failed to register class factory for {0}</value>
</data>
<data name="Server_RegisterObjects_" xml:space="preserve">
<value>Error while registering the server:
{0}</value>
</data>
<data name="Server_ElevateSelf_The__0__was_not__1__because_you_did_not_allow_it_" xml:space="preserve">
<value>The {0} was not {1} because you did not allow it.</value>
</data>
<data name="Server_LoadComObjectAssemblies_Failed_to_load_served_COM_class_assembly__0_____1_" xml:space="preserve">
<value>Failed to load served COM class assembly {0} - {1}</value>
</data>
<data name="SetupDialogForm_TextBox1_TextChanged___0_00_0___of_sidereal_rate_" xml:space="preserve">
<value>({0:00.0}% of sidereal rate)</value>
</data>
<data name="SetupDialogForm_SetupDialogForm__0__Settings___1__" xml:space="preserve">
<value>{0} Settings ({1})</value>
</data>
<data name="SetupDialogForm_txtElevation_TextChanged_1_Please_enter_only_numbers_" xml:space="preserve">
<value>Please enter only numbers.</value>
</data>
<data name="SetupDialogForm_txtFocalLength_TextChanged_1_Please_enter_only_numbers_" xml:space="preserve">
<value>Please enter only numbers.</value>
</data>
</root>
+666
View File
@@ -0,0 +1,666 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=windows-1252"/>
<TITLE>Untitled Document</TITLE>
<META NAME="GENERATOR" CONTENT="OpenOffice.org 3.2 (Win32)"/>
<META NAME="CREATED" CONTENT="0;0"/>
<META NAME="CHANGEDBY" CONTENT="Chris Rowland"/>
<META NAME="CHANGED" CONTENT="20110422;10442800"/>
<META NAME="CHANGEDBY" CONTENT="Chris Rowland"/>
<STYLE TYPE="text/css">
<!--
@page { margin: 2cm }
P { font-family: "Verdana", "Arial", "Helvetica", sans-serif; font-weight: normal }
TD P { font-family: "Verdana", "Arial", "Helvetica", sans-serif; font-weight: normal }
H3 { font-family: "Arial", "Helvetica", sans-serif }
H2 { font-family: "Arial", "Helvetica", sans-serif }
H4 { font-family: "Arial", "Helvetica", sans-serif }
PRE { margin-left: 0.18cm; margin-right: 0.18cm; margin-top: 0.18cm; margin-bottom: 0.18cm; background: #ccffff }
PRE.western { font-weight: normal }
PRE.cjk { font-family: "NSimSun", monospace; font-weight: normal }
PRE.ctl { font-weight: normal }
EM.underline { text-decoration: underline }
-->
</STYLE>
</HEAD>
<BODY LANG="en-GB" DIR="LTR">
<TABLE WIDTH="100%" BORDER="0" CELLPADDING="4" CELLSPACING="0" STYLE="page-break-before: always">
<TR>
<TD>
<H2>
ASCOM LocalServer (singleton) Host
</H2>
</TD>
</TR>
</TABLE>
<P>
<BR/>
<BR/>
</P>
<H4>
You have just created a local server (singleton) host for one or
more ASCOM driver classes.
</H4>
<HR/>
<P>
This project implements an ASCOM host server for one or more
driver classes in a single-instance executable. It can be used to
serve multiple instances of a single driver class (hub), provide
driver services for multiple devices (e.g., Telescope and Focuser) to
multiple applications and allow multiple devices of the same type to
be connected. In the latter scenario, the multiple driver classes
will often share one or more resources such as the serial connection
and a microcontroller in the combined device. From the client's
perspective, using the drivers served by the local server is exactly
the same as if the drivers are loaded into the client's process space
(in-proc servers).
</P>
<P STYLE="margin-left: 0.42cm; margin-right: 0.42cm; border: 1px solid #000000; padding: 0.21cm">
<STRONG>
<SPAN STYLE="background: #ffee88">NOTE:</SPAN>
</STRONG>
<SPAN STYLE="background: #ffee88">
Unless you are prepared to handle all of the timing issues that arise
when multiple clients are accessing the properties and methods of
your driver(s), stop now. Just because the local server serializes
the calls to your driver(s)' properties and methods does not mean
that there will be no timing or concurrency issues.<BR/>
&nbsp;<BR/>For
example, suppose the hub serves instances of a Telescope driver. One
client sets the TargetRightAscension property, then another sets
TargetRightAscension to a different value, then the first client sets
TargetDeclination, then the first client calls SlewToTarget()
followed by the second client calling SlewToTarget(). Besides the
first client's slew command sending the scope to the wrong (and
possibly dangerous) coordinates, there is the problem of the second
client trying to slew a slewing scope. Local server drivers are
tricky to get right. There is no such thing as &quot;ignorance is
bliss&quot; here.
</SPAN>
</P>
<P STYLE="margin-left: 0.42cm; margin-right: 0.42cm; border: 1px solid #000000; padding: 0.21cm">
<SPAN STYLE="background: #ffee88">
This implementation has changed
from what was defined for Platform 5.5 as follows:
</SPAN>
</P>
<P STYLE="margin-left: 0.42cm; margin-right: 0.42cm; border: 1px solid #000000; padding: 0.21cm">
<SPAN STYLE="background: #ffee88">
The drivers are now installed in
the same folder as the local server executable. This makes deployment
cleaner because the whole driver can exist in a single folder
independently of other drivers.
</SPAN>
</P>
<P STYLE="margin-left: 0.42cm; margin-right: 0.42cm; border: 1px solid #000000; padding: 0.21cm">
<SPAN STYLE="background: #ffee88">
The ProgId and friendly name as
displayed by the Chooser are defined using attributes. This allows
driver dlls to be identified clearly and so avoids confusion with
other dlls that may be required such as interop dlls.
</SPAN>
</P>
<P STYLE="margin-left: 0.42cm; margin-right: 0.42cm; border: 1px solid #000000; padding: 0.21cm">
<SPAN STYLE="background: #ffee88">
Some changes have been made that
will facilitate generating multiple drivers of the same type.
</SPAN>
</P>
<P STYLE="margin-left: 0.42cm; margin-right: 0.42cm; border: 1px solid #000000; padding: 0.21cm">
<SPAN STYLE="background: #ffee88">
I've put some additional advice and
comments in the notes below <I>in italics.</I>
</SPAN>
</P>
<P>
You're probably anxious to get going, but you really should read
through the <A HREF="#theory">Theory of Operation</A> and <A HREF="#details">
Detailed
Use and Deployment
</A> below.
</P>
<P>You must do the following in order to complete your local server:</P>
<OL>
<LI>
<P STYLE="margin-bottom: 0cm">
In the local server's project
properties, Application tab, change BOTH the AssemblyName and the
default assembly name to ASCOM.xxx (e.g., ASCOM.SuperScope). <I>
This
may be done by default now.
</I>
</P>
</LI>
<LI>
<P STYLE="margin-bottom: 0cm">
Add one or more driver skeleton
projects using the in-proc templates. You may use either the C# or
VB templates. Project name is not important (not used in ProgID)
choose something like TelescopeDriver. You will be changing the
substituted project name in these projects below. If you ensure that
the LocalServer and all the driver projects have the same NameSpace
e.g. ASCOM.SuperScope the renaming in section 6a will not be
required.
</P>
</LI>
<LI>
<P STYLE="margin-bottom: 0cm">
Develop and debug these driver
projects as normal in-process assemblies. This will be much simpler
because the driver and test code can be debugged in the same
process.
</P>
</LI>
<LI>
<P STYLE="margin-bottom: 0cm">
Build the LocalServer.
</P>
</LI>
<LI>
<P STYLE="margin-bottom: 0cm">
Set a reference to the local
server <STRONG>project</STRONG> in each of the driver skeleton
projects.
</P>
</LI>
<LI>
<P STYLE="margin-bottom: 0cm">In each skeleton driver project:</P>
<OL TYPE="a">
<LI>
<P STYLE="margin-bottom: 0cm">
Do a Find In Files for the
project name of the skeleton driver (e.g., TelescopeDriver) and
change it to match the project name of your local server (e.g.
SuperScope). You don't have to do this in the ReadMe.html file.
Everywhere else, however, is IMPORTANT. This sets the correct
namespace, progID, etc. If you're a bit more brave, you can use
Replace in Files. <I>
This may not be needed if the correct
namespace and naming conventions have been followed when the
drivers and local server were generated.
</I>
</P>
</LI>
<LI>
<P STYLE="margin-bottom: 0cm">
In project properties,
Application tab, change the assembly name to
ASCOM.<EM CLASS="underline">localserverprojectname</EM>.<EM>drivertype</EM>,
(e.g., ASCOM.SuperScope.Telescope).
</P>
</LI>
<LI>
<P STYLE="margin-bottom: 0cm">
In project properties,
Application tab, click Assembly Information...
</P>
<UL>
<LI>
<P STYLE="margin-bottom: 0cm">
Assure that Make assembly COM
visible is <STRONG>on</STRONG> (it should already be on).
</P>
</LI>
<LI>
<P STYLE="margin-bottom: 0cm">
Edit the Product Name to be the
&quot;friendly name&quot; of your driver as will be shown in the
Chooser. <I>
Not used now, use the ServedClassName attribute
instead.
</I>
</P>
</LI>
</UL>
</LI>
<LI>
<P STYLE="margin-bottom: 0cm">
In project properties, Build tab,
turn <STRONG>off</STRONG> Register for COM Interop.
</P>
</LI>
<LI>
<P>
Modify the driver class declaration to inherit from
ReferenceCountedObjectBase. Examples:<BR/>C#:
</P>
<PRE CLASS="western">
public class Telescope :
ReferenceCountedObjectBase,
ITelescope
</PRE>
<P>
VB:
</P>
<PRE CLASS="western">
Public Class Telescope
'==================================
Inherits ReferenceCountedObjectBase
Implements ITelescope
'==================================
</PRE>
</LI>
<LI>
<P STYLE="margin-bottom: 0cm">
In driver.cs/driver.vb, remove
the entire ASCOM Registration region
</P>
</LI>
<LI>
<P STYLE="margin-bottom: 0cm">
In driver.cs/driver.vb, remove
the private strings for driver ID and driver description. <I>
They
may be needed internally, and if so should be set from the
associated attributes, ServedClassName for the description and
ProgId for the driver Id.
</I>
</P>
</LI>
<LI>
<P STYLE="margin-bottom: 0cm">
Modify the class attributes by
adding the ServedClassName and ProgID attributes. The
ServedClassName attribute must be the friendly name shown as the
device name in the Chooser and the ProgId the progid of the driver
e.g. ASCOM.SuperScope.Telescope. The class header should look like
this:
</P>
<P STYLE="margin-bottom: 0cm">C#:</P>
<PRE CLASS="western" STYLE="margin-right: 0.16cm">
<FONT FACE="Consolas" SIZE="2" STYLE="font-size: 9pt">
[<FONT COLOR="#2b91af">Guid</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#a31515">&quot;0AE8B38D-10A1-4A8D-A5B7-1B050F74B48B&quot;</FONT><FONT COLOR="#000000">)] // set by the template</FONT>
<FONT COLOR="#000000">[</FONT><FONT COLOR="#2b91af">ProgId</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#a31515">&quot;ASCOM.SuperScope.Telescope&quot;</FONT><FONT COLOR="#000000">)]</FONT>
<FONT COLOR="#000000">[</FONT><FONT COLOR="#2b91af">ServedClassName</FONT><FONT COLOR="#000000"> (</FONT><FONT COLOR="#a31515">&quot;Super Scope Telescope&quot;</FONT><FONT COLOR="#000000">)]</FONT>
<FONT COLOR="#000000">[</FONT><FONT COLOR="#2b91af">ClassInterface</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#2b91af">ClassInterfaceType</FONT><FONT COLOR="#000000">.None)]</FONT>
<FONT COLOR="#0000ff">public </FONT><FONT COLOR="#0000ff">class </FONT><FONT COLOR="#2b91af">Telescope </FONT><FONT COLOR="#000000">: </FONT><FONT COLOR="#2b91af">ReferenceCountedObjectBase</FONT><FONT COLOR="#000000"> , </FONT><FONT COLOR="#2b91af">ITelescope</FONT>
</FONT>
</PRE>
</LI>
</OL>
</LI>
</OL>
<P STYLE="margin-bottom: 0cm">
<BR/>
</P>
<OL>
<OL TYPE="a">
<P>VB:</P>
<PRE CLASS="western">
<FONT FACE="Consolas" SIZE="2" STYLE="font-size: 9pt">
&lt;Guid(&ldquo;<FONT COLOR="#a31515">0AE8B38D-10A1-4A8D-A5B7-1B050F74B48B</FONT>&rdquo;)&gt;
&lt;ProgId(&ldquo;ASCOM.SuperScope.Telescope&rdquo;)&gt;
&lt;ServedClassName(&ldquo;Super Scope Telescope&rdquo;)&gt;
Public Class Telescope
'==================================
Inherits ReferenceCountedObjectBase
Implements ITelescope
'==================================
</FONT>
</PRE>
</OL>
</OL>
<P STYLE="margin-left: 2.5cm">
Add the following line to the driver
constructor, this sets the driver ID using the ProgId Attribute:
</P>
<OL>
<OL TYPE="a">
<P>C#</P>
<PRE CLASS="western">
<FONT FACE="Consolas" SIZE="2" STYLE="font-size: 9pt">
s_csDriverID = <FONT COLOR="#2b91af">Marshal</FONT><FONT COLOR="#000000">.GenerateProgIdForType(</FONT><FONT COLOR="#0000ff">this</FONT><FONT COLOR="#000000">.GetType());</FONT>
</FONT>
</PRE>
<P>VB:</P>
<PRE CLASS="western">
<FONT FACE="Consolas" SIZE="2" STYLE="font-size: 9pt">
s_csDriverID = <FONT COLOR="#2b91af">Marshal</FONT><FONT COLOR="#000000">.GenerateProgIdForType(</FONT><FONT COLOR="#0000ff">Me</FONT><FONT COLOR="#000000">.GetType())</FONT>
</FONT>
</PRE>
</OL>
<LI>
<P STYLE="margin-bottom: 0cm">
Unless you're writing a
single-driver hub, you will have two or more driver types (e.g.
Telescope and Focuser) and thus two or more driver assembly projects
added. Presumably, these drivers need to share some resources (e.g.
a single COM port via Helper.Serial). <U>
Put shared resources into
the SharedResources class provided
</U>. There are some examples that
should give a clue, modify and delete these as required.
</P>
</LI>
<LI>
<P STYLE="margin-bottom: 0cm">
A shared serial port is already
provided (see SharedResources.cs) as <FONT FACE="Lucida Console, Courier New, Courier, monospace">SharedResources.SharedSerial</FONT>
and it is an ASCOM Helper Serial object. You may wish to define
additional shared resources in static member variables with public
static accessor properties as is already done for SharedSerial.
Unfortunately, if you are a Visual Basic programmer, you will have
to make these additions in C#.
</P>
</LI>
<LI>
<P STYLE="margin-bottom: 0cm">
If you are writing a hub and don't
need the serial port, in SharedResources.cs you can remove the
public static SharedSerial property, the m_SharedSerial member in
the private data region, and the line in main that initializes it.
If you don't need any other shared resources for your hub, then you
can remove the SharedResources.cs file completely.
</P>
</LI>
<LI>
<P STYLE="margin-bottom: 0cm">
If you modified the LocalServer,
build it again now. This will refresh the stuff that's visible to
the drivers.
</P>
</LI>
<LI>
<P STYLE="margin-bottom: 0cm">
Build the driver skeletons to
verify that you got all of the namespace and other variable changes.
</P>
</LI>
<LI>
<P>
The local server dynamically loads the driver assemblies from
the same folder as the local server executable. <BR/>
<BR/>During
development, you'll need to add a post-build task to each of your
driver assembly projects which puts a copy of the driver assembly
into the local server executable folder. Here is an example:
</P>
<PRE CLASS="western"> copy &quot;$(TargetPath)&quot; &quot;$(SolutionDir)\SuperScope\$(OutDir)\$(TargetFileName)&quot;</PRE>
<P STYLE="margin-bottom: 0cm">
This assumes that the server project is called &ldquo;SuperScope&rdquo;,
and handles using the debug or release build.<BR/>
Note the quotes for
possible path elements with spaces in them. <I>
An alternative is to
set the build path to the required destination instead of the
default path.
</I>
</P>
</LI>
<LI>
<P STYLE="margin-bottom: 0cm">
<I>
Make sure the drivers are
registered through the local server by running it with the /register
parameter, see below for details.
</I>
</P>
</LI>
<LI>
<P STYLE="margin-bottom: 0cm">
<SPAN STYLE="background: #ffff00">IMPORTANT:</SPAN>
With a local server based driver (or hub) it is possible for
multiple clients to control the device(s). It is up to you to
safeguard against abuse. <I>
The sort of thing that's needed is to
have a counter of the number of connections to a device, the
connection is only fully broken when the number of connections is
zero. You may also need code to prevent several drivers from talking
to the hardware at the same time, the lock pattern is useful for
that.
</I>
</P>
</LI>
<LI>
<P>
You may want to add controls and/or status information to the
main form frmMain of the local server. Please resist the temptation
to turn the local server's main form into a graphical device control
panel. Instead, make a separate application that uses the served
driver(s). <U>A driver is not a program!</U>
</P>
</LI>
</OL>
<H3>Notes</H3>
<UL>
<LI>
<P STYLE="margin-bottom: 0cm">
The local server handles all of
the registration and unregistration for each of its served driver
classes, including the ASCOM Chooser info and the DCOM/AppID info
needed for activation from TheSky. By running the server from a
command line and giving /register or /unregister as the command line
option, it will register or unregister all served classes
(respectively). <SPAN STYLE="background: #ffff00">
Never use REGASM
on the local server executable!
</SPAN> <I>
This can be done in the
Visual Studio IDE by setting the server project to run as startup
and setting the command line argument to /register in Debug &ndash;
Start Options.
</I>
</P>
</LI>
<LI>
<P STYLE="margin-bottom: 0cm">
When you make the installer for
your local server based driver/hub, do not let it register the
executable for COM. Instead, have it activate the installed local
server with the /register option.
</P>
</LI>
<LI>
<P>
The ASCOM registration uses the ServedClassName attribute as
the friendly name that will show in the chooser and the ProgId
attribute as the driver Id.
</P>
</LI>
<LI>
<P>
The best deployment way is to install all the files in a
folder that's a sub folder of the main driver, so the SuperScope
driver files will be in the folder ...\ASCOM\Telescope\SuperScope.
This can be done in the Inno script by changing the DefaultDirName
like this:<BR/>
DefaultDirName=&quot;{cf}\ASCOM\Telescope\SuperScope&quot;<BR/>then
the files can all be installed with DestDir: {app};
</P>
</LI>
</UL>
<H3>
<A NAME="theory"></A>Theory of Operation
</H3>
<P>
The local server is an executable which can provide multiple
instances of multiple drivers to multiple clients. This capability is
needed for two applications:
</P>
<UL>
<LI>
<P STYLE="margin-bottom: 0cm">
A hub, which allows multiple
clients to share a single device
</P>
</LI>
<LI>
<P>
A device which provides multiple services, such as a
telescope which has a focuser built-in where both the telescope and
focuser are controlled by the same serial connection and different
client programs need to control to the focuser and telescope.
</P>
</LI>
</UL>
<P>
By simply dropping suitably developed driver assemblies into the
same folder as the local server executable, the local server will
find them and register them for COM and ASCOM and serve any number of
instances of the drivers' interfaces to any number of client
programs. It does this by locating and loading the driver assemblies,
analysing them to detect their classes and interfaces, and
implementing a class factory that can create instances of them for
clients.
</P>
<P>
A driver is an assembly which contains a class that <EM>implements</EM>
one of the ASCOM standard driver interfaces and <EM>inherits</EM> the
ReferenceCountedObjectBase class of the local server. Apart from
that, driver assemblies are identical to those that are used
in-process (DLL-type). The instructions above detail the steps needed
to convert an in-process driver into one that can be served by the
local server.
</P>
<P>
The name of the local server is important, so we provide it as a
<EM>template</EM> from which you can create a local server for your
produce. To make this clear, let's assume that your company AlphaTech
produces a telescope system which contains a microcontroller that is
able to control not only the telescope mount, but also a focuser and
a camera rotator. The mount, focuser, and rotator are all controlled
via commands sent through a common serial line connecting the
computer to the microcontroller, so you need a local server. In
ASCOM, then, you probably want your system to appear as
AlphaTech.Telescope, AlphaTech.Focuser, and AlphaTech.Rotator. Then
you would name the local server AlphaTech. Be sure to give this due
consideration before creating the template, the project name is the
name of your local server. <I>
Is this still correct? I get the
impression that ASCOM.AlphaTech.Server would be OK.
</I>
</P>
<P>
The fact that driver classes inherit from the local server's
ReferenceCountedObjectBase class allows the local server to maintain
a reference count on the driver class. If a client creates an
instance of a served driver, the local server automatically starts up
and provides an instance of the class to the client. Once started the
local server can provide additional instances of any of its served
driver classes. If the reference count of all served classes drops to
zero as a result of clients releasing their instances, the local
server will automatically exit.
</P>
<P>
Registration services provided include not only the basic COM
class registration, but also DCOM/AppID info needed to use the served
classes from outbound connections from Software Bisque's TheSky. It
also registers the served classes for the ASCOM Chooser. The
&quot;friendly&quot; name of each served driver that appears in the
chooser comes from the driver's ServedClassName attribute. This also
used to identify a driver so that non driver dlls, such as Interop
dlls can be ignored. The COM ProgID for each served driver is
specified in the ProgId attribute - ASCOM.<EM>localservername</EM>.<EM>drivertype</EM>,
for example, ASCOM.AlphaTech.Telescope, where AlphaTech is the local
server name and Telescope is the type of the driver. Unregistering
removes all of this information from the system. Specifying the
ProgId as an attribute allows multiple driver assemblies to be
generated using the same source and namespace. This is used to
provide multiple instances of the same driver, each with a different
ProgId and so able to be registered separately.
</P>
<P>
Driver DLLs are identified for registering/unregistering because
they contain a type with the ServedClassName attribute. Only these
will be registered for Com and ASCOM. This has changed; in Platform
5 there was no attribute and the local server attempted to register
all dlls. The new behaviour allows support dlls such as interop dlls
to be included without them being registered incorrectly. There was
also an interim version where the ServedClassName attribute was on
the assembly, not the class. <I>
All these previous versions, and the
new drivers will operate together with Platform 6, the changes are
local to the individual drivers.
</I>
</P>
<H3>
<A NAME="details"></A>Detailed Use and Deployment
</H3>
<P>
Once you have built your local server and the served driver class
assemblies, here's how to use it. To register the served classes,
activate the local server from a shell command line with the option
/register (or /regserver, for VB6 compatibility):
</P>
<PRE CLASS="western">
C:\xxx&gt; <EM>localserver</EM>.exe /register
</PRE>
<P>
To unregister the local server and its drivers, activate the local
server from a shell command line with the option /unregister (or
/unregserver for VB6 compatibility):
</P>
<PRE CLASS="western">
C:\xxx&gt; <EM>localserver</EM>.exe /unregister
</PRE>
<P>
When the operating system starts the local server in response to a
client creating one of it's served driver classes, the command option
/embedding is included. The local server's code detects this and sets
a variable that you can use.
</P>
<P STYLE="margin-bottom: 0cm">
When deploying a hub or set of drivers
with the local server, you'll have to arrange for the local server
and the driver assemblies to be placed together in a folder in the
ASCOM driver folder. Any support files, such as Interop DLLs can be
put in the same fiolder. That's all you need to do, the local server
will find them in the same folder as it is located in.
</P>
<DIV ALIGN="RIGHT">
<TABLE WIDTH="100"% BORDER="0" CELLPADDING="4" CELLSPACING="0">
<TR>
<TD>
<TABLE WIDTH="100"% BORDER="0" CELLPADDING="4" CELLSPACING="0">
<TR>
<TD>
<H3>ASCOM Initiative</H3>
</TD>
<TD>
<IMG SRC="ASCOM.png" NAME="graphics1" ALIGN="RIGHT" WIDTH="48" HEIGHT="56" BORDER="0"/>
</TD>
</TR>
</TABLE>
<P>
<BR/>
<BR/>
</P>
</TD>
</TR>
<TR>
<TD>
<P>
The ASCOM Initiative consists of a group of astronomy software
developers and instrument vendors whose goals are to promote the
driver/client model and scripting automation.
</P>
<P>
See the <A HREF="http://ascom-standards.org/" TARGET="browser">
ASCOM
web site
</A> for more information. Please participate in the
<A HREF="http://tech.groups.yahoo.com/group/ASCOM-Talk" TARGET="browser">
ASCOM-Talk
Yahoo Group
</A>.
</P>
</TD>
</TR>
</TABLE>
</DIV>
<P>
<BR/>
<BR/>
</P>
<P>
<BR/>
<BR/>
</P>
</BODY>
</HTML>
+1
View File
@@ -1,3 +1,4 @@
using System;
using System.Runtime.InteropServices;
namespace ASCOM.Meade.net

Some files were not shown because too many files have changed in this diff Show More