Started working on getting the basic communications with the scope working.
Working on routines to get and set the date and time in the handbox.
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
<#
|
||||
This script initializes a bare minimum set of registry entries required for ASCOM.Utilities.Profile to work
|
||||
without throwing any exceptions. When building on a build server, or on a computer without the ASCOM Platform installed,
|
||||
it may be useful to execute this script as a build step prior to running any unit tests, or calling any code that relies on
|
||||
ASCOM.Utilities.Profile. The alternative is to install the ASCOM Platform on the build agent.
|
||||
|
||||
NOTE: This script equires elevated permissions because it creates registry keys in the LocalMachine hive.
|
||||
#>
|
||||
|
||||
$wow = Test-Path HKLM:\SOFTWARE\Wow6432Node
|
||||
if ($wow)
|
||||
{
|
||||
$root = "HKLM:\SOFTWARE\Wow6432Node"
|
||||
}
|
||||
else
|
||||
{
|
||||
$root = "HKLM:\SOFTWARE"
|
||||
}
|
||||
$ascomRoot = $root + "\ASCOM"
|
||||
|
||||
if (Test-Path $ascomRoot)
|
||||
{
|
||||
<# Don't upset an already-existing ASCOM registry #>
|
||||
exit
|
||||
}
|
||||
|
||||
<# Create the ASCOM root key and set it's ACL to allow all users read/write access #>
|
||||
New-Item -Path $root -Name ASCOM –Force
|
||||
$ascomAcl = Get-Acl $ascomRoot
|
||||
$aclRule = New-Object System.Security.AccessControl.RegistryAccessRule ("Users","FullControl","Allow")
|
||||
$ascomAcl.SetAccessRule($aclRule)
|
||||
$ascomAcl | Set-Acl -Path $ascomRoot
|
||||
|
||||
<# Now create the bare minimum keys required so that ASCOM.Utilities.Profile doesn't crash and burn #>
|
||||
New-ItemProperty -Path $ascomRoot -Name PlatformVersion -Value "6.1" -PropertyType String –Force
|
||||
New-ItemProperty -Path $ascomRoot -Name SerTraceFile -Value "C:\SerialTraceAuto.txt" -PropertyType String –Force
|
||||
@@ -0,0 +1,125 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\packages\NUnit.3.11.0\build\NUnit.props" Condition="Exists('..\packages\NUnit.3.11.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>{9638DA27-77C7-4B30-A730-6E7159A4A09F}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>MeadeAutostar497.UnitTests</RootNamespace>
|
||||
<AssemblyName>MeadeAutostar497.UnitTests</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.6.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>
|
||||
</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>
|
||||
<ItemGroup>
|
||||
<Reference Include="ASCOM.Astrometry, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Astrometry.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="ASCOM.Attributes, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Attributes.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="ASCOM.Cache, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Cache.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="ASCOM.Controls, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Controls.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="ASCOM.DeviceInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.DeviceInterfaces.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="ASCOM.DriverAccess, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.DriverAccess.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="ASCOM.Exceptions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Exceptions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="ASCOM.Internal.Extensions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Internal.Extensions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="ASCOM.SettingsProvider, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.SettingsProvider.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="ASCOM.Utilities, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Utilities.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="ASCOM.Utilities.Video, Version=6.1.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\ASCOM.Platform.6.4.2\lib\net40\ASCOM.Utilities.Video.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Castle.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Castle.Core.4.3.1\lib\net45\Castle.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<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="nunit.framework, Version=3.11.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NUnit.3.11.0\lib\net45\nunit.framework.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.IO.Compression" />
|
||||
<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\netstandard1.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Runtime.Serialization" />
|
||||
<Reference Include="System.ServiceModel" />
|
||||
<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\portable-net45+win8+wp8+wpa81\System.Threading.Tasks.Extensions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Transactions" />
|
||||
<Reference Include="System.Windows" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="WindowsBase" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="TelescopeControllerUnitTests.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\MeadeAutostar497\MeadeAutostar497.csproj">
|
||||
<Project>{64308775-bd4a-469c-bcab-3ed830b811af}</Project>
|
||||
<Name>MeadeAutostar497</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<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.11.0\build\NUnit.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NUnit.3.11.0\build\NUnit.props'))" />
|
||||
</Target>
|
||||
</Project>
|
||||
@@ -0,0 +1,36 @@
|
||||
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("MeadeAutostar497.UnitTests")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("MeadeAutostar497.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("9638da27-77c7-4b30-a730-6e7159a4a09f")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
@@ -0,0 +1,151 @@
|
||||
using System.Collections.Generic;
|
||||
using ASCOM;
|
||||
using ASCOM.MeadeAutostar497.Controller;
|
||||
using ASCOM.Utilities;
|
||||
using ASCOM.Utilities.Interfaces;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace MeadeAutostar497.UnitTests
|
||||
{
|
||||
[TestFixture]
|
||||
public class TelescopeControllerUnitTests
|
||||
{
|
||||
private Mock<ISerial> serialMock;
|
||||
|
||||
private readonly List<string> _availableComPorts = new List<string> { "COM1", "COM2", "COM3" };
|
||||
private TelescopeController _telescopeController;
|
||||
|
||||
private string transmittedString;
|
||||
private string stringToRecieve;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
transmittedString = string.Empty;
|
||||
stringToRecieve = string.Empty;
|
||||
|
||||
serialMock = new Mock<ISerial>();
|
||||
serialMock.SetupAllProperties();
|
||||
|
||||
serialMock.Setup(x => x.AvailableComPorts).Returns( () => _availableComPorts.ToArray());
|
||||
serialMock.Setup(X => X.Transmit(It.IsAny<string>())).Callback<string>(str => { transmittedString = str; });
|
||||
serialMock.Setup(X => X.Receive()).Returns(() => stringToRecieve);
|
||||
|
||||
_telescopeController = TelescopeController.Instance;
|
||||
_telescopeController.SerialPort = serialMock.Object;
|
||||
}
|
||||
|
||||
[TearDown]
|
||||
public void TearDown()
|
||||
{
|
||||
_telescopeController.Connected = false;
|
||||
_telescopeController.Port = "COM1";
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ImplementsExpectedInterfaces()
|
||||
{
|
||||
Assert.That(_telescopeController, Is.Not.Null);
|
||||
Assert.That(_telescopeController, Is.AssignableTo<ITelescopeController>());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NotConnectedByDefault()
|
||||
{
|
||||
Assert.That(_telescopeController.Connected, Is.False);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ConnectedCanBeSetTrue()
|
||||
{
|
||||
stringToRecieve = "test#";
|
||||
|
||||
_telescopeController.Connected = true;
|
||||
Assert.That(_telescopeController.Connected, Is.True);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void EnsureThatTheSerialCommunicationsAreSetCorrectly()
|
||||
{
|
||||
Assert.That(serialMock.Object.Connected, Is.False);
|
||||
|
||||
stringToRecieve = "test#";
|
||||
|
||||
_telescopeController.Connected = true;
|
||||
Assert.That(_telescopeController.Connected, Is.True);
|
||||
|
||||
Assert.That(serialMock.Object.DTREnable, Is.False);
|
||||
Assert.That(serialMock.Object.RTSEnable, Is.False);
|
||||
Assert.That(serialMock.Object.Speed, Is.EqualTo(SerialSpeed.ps9600));
|
||||
Assert.That(serialMock.Object.DataBits, Is.EqualTo(8));
|
||||
Assert.That(serialMock.Object.StopBits, Is.EqualTo(SerialStopBits.One));
|
||||
Assert.That(serialMock.Object.Parity, Is.EqualTo(SerialParity.None));
|
||||
Assert.That(serialMock.Object.PortName, Is.EqualTo(_telescopeController.Port));
|
||||
Assert.That(serialMock.Object.Connected, Is.True);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void WhenOpensComPortToNonAutostarThrowException()
|
||||
{
|
||||
Assert.That(serialMock.Object.Connected, Is.False);
|
||||
var exception = Assert.Throws<InvalidOperationException>(() => { _telescopeController.Connected = true; });
|
||||
|
||||
Assert.That(exception.Message, Is.EqualTo("Failed to communicate with telescope."));
|
||||
|
||||
Assert.That(_telescopeController.Connected, Is.False);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CannotChangeSerialPortObjectWhenConnected()
|
||||
{
|
||||
stringToRecieve = "test#";
|
||||
|
||||
_telescopeController.Connected = true;
|
||||
|
||||
Mock<ISerial> newSerialMock = new Mock<ISerial>();
|
||||
|
||||
var exception = Assert.Throws<InvalidOperationException>( () => { _telescopeController.SerialPort = newSerialMock.Object; });
|
||||
|
||||
Assert.That(exception, Is.Not.Null);
|
||||
Assert.That(exception.Message, Is.EqualTo("Please disconnect before changing the serial engine."));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void PortIsSetToCom1ByDefault()
|
||||
{
|
||||
Assert.That(_telescopeController.Port, Is.EqualTo("COM1"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SettingPortToValidPortAllowed()
|
||||
{
|
||||
_telescopeController.Port = "COM2";
|
||||
|
||||
Assert.That(_telescopeController.Port, Is.EqualTo("COM2"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SettingPortToValidPortWhenConnectedFails()
|
||||
{
|
||||
stringToRecieve = "test#";
|
||||
|
||||
_telescopeController.Connected = true;
|
||||
var exception = Assert.Throws<InvalidOperationException>( () => _telescopeController.Port = "COM2");
|
||||
|
||||
Assert.That(exception.Message, Is.EqualTo("Please disconnect from the scope before changing port."));
|
||||
|
||||
Assert.That(_telescopeController.Port, Is.EqualTo("COM1")); //port hasn't changed
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SettingPortToInavalidPortFails()
|
||||
{
|
||||
var exception = Assert.Throws<InvalidOperationException>(() => _telescopeController.Port = "COM5");
|
||||
|
||||
Assert.That(exception.Message, Is.EqualTo("Unable to select port COM5 as it does not exist."));
|
||||
|
||||
Assert.That(_telescopeController.Port, Is.EqualTo("COM1")); //port hasn't changed
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="ASCOM.Platform" version="6.4.2" targetFramework="net45" />
|
||||
<package id="Castle.Core" version="4.3.1" targetFramework="net45" />
|
||||
<package id="Moq" version="4.10.1" targetFramework="net45" />
|
||||
<package id="NUnit" version="3.11.0" targetFramework="net45" />
|
||||
<package id="System.Runtime.CompilerServices.Unsafe" version="4.5.0" targetFramework="net45" requireReinstallation="true" />
|
||||
<package id="System.Threading.Tasks.Extensions" version="4.5.1" targetFramework="net45" requireReinstallation="true" />
|
||||
</packages>
|
||||
@@ -5,16 +5,40 @@ VisualStudioVersion = 15.0.28307.136
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MeadeAutostar497", "MeadeAutostar497\MeadeAutostar497.csproj", "{64308775-BD4A-469C-BCAB-3ED830B811AF}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MeadeAutostar497.UnitTests", "MeadeAutostar497.UnitTests\MeadeAutostar497.UnitTests.csproj", "{9638DA27-77C7-4B30-A730-6E7159A4A09F}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestConsole", "TestConsole\TestConsole.csproj", "{D5207217-61C7-4E94-8097-91DBACE57D2A}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Debug|x86 = Debug|x86
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{64308775-BD4A-469C-BCAB-3ED830B811AF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{64308775-BD4A-469C-BCAB-3ED830B811AF}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{64308775-BD4A-469C-BCAB-3ED830B811AF}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{64308775-BD4A-469C-BCAB-3ED830B811AF}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{64308775-BD4A-469C-BCAB-3ED830B811AF}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{64308775-BD4A-469C-BCAB-3ED830B811AF}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{64308775-BD4A-469C-BCAB-3ED830B811AF}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{64308775-BD4A-469C-BCAB-3ED830B811AF}.Release|x86.Build.0 = Release|Any CPU
|
||||
{9638DA27-77C7-4B30-A730-6E7159A4A09F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{9638DA27-77C7-4B30-A730-6E7159A4A09F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{9638DA27-77C7-4B30-A730-6E7159A4A09F}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{9638DA27-77C7-4B30-A730-6E7159A4A09F}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{9638DA27-77C7-4B30-A730-6E7159A4A09F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{9638DA27-77C7-4B30-A730-6E7159A4A09F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{9638DA27-77C7-4B30-A730-6E7159A4A09F}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{9638DA27-77C7-4B30-A730-6E7159A4A09F}.Release|x86.Build.0 = Release|Any CPU
|
||||
{D5207217-61C7-4E94-8097-91DBACE57D2A}.Debug|Any CPU.ActiveCfg = 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|x86
|
||||
{D5207217-61C7-4E94-8097-91DBACE57D2A}.Release|x86.ActiveCfg = Release|x86
|
||||
{D5207217-61C7-4E94-8097-91DBACE57D2A}.Release|x86.Build.0 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace ASCOM.MeadeAutostar497
|
||||
/// <summary>
|
||||
/// Driver description that displays in the ASCOM Chooser.
|
||||
/// </summary>
|
||||
private static string driverDescription = "ASCOM Telescope Driver for Meade Autostar 497 based telescopes.";
|
||||
private static string driverDescription = "Meade Autostar 497 .net";
|
||||
|
||||
internal static string comPortProfileName = "COM Port"; // Constants used for Profile persistence
|
||||
internal static string comPortDefault = "COM1";
|
||||
@@ -221,6 +221,7 @@ namespace ASCOM.MeadeAutostar497
|
||||
if (value)
|
||||
{
|
||||
LogMessage("Connected Set", "Connecting to port {0}", comPort);
|
||||
_telescopeController.Port = comPort;
|
||||
_telescopeController.Connected = true;
|
||||
}
|
||||
else
|
||||
@@ -810,8 +811,10 @@ namespace ASCOM.MeadeAutostar497
|
||||
{
|
||||
get
|
||||
{
|
||||
tl.LogMessage("Slewing Get", "Not implemented");
|
||||
throw new ASCOM.PropertyNotImplementedException("Slewing", false);
|
||||
tl.LogMessage("Slewing Get", "Started");
|
||||
var result = _telescopeController.Slewing;
|
||||
tl.LogMessage("Slewing Get", $"Result = {result}");
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -908,14 +911,17 @@ namespace ASCOM.MeadeAutostar497
|
||||
{
|
||||
get
|
||||
{
|
||||
DateTime utcDate = DateTime.UtcNow;
|
||||
tl.LogMessage("TrackingRates", "Get - " + Format("MM/dd/yy HH:mm:ss", utcDate));
|
||||
tl.LogMessage("UTCDate", "Get started");
|
||||
|
||||
var utcDate = _telescopeController.utcDate;
|
||||
tl.LogMessage("UTCDate", "Get - " + Format("MM/dd/yy HH:mm:ss", utcDate));
|
||||
return utcDate;
|
||||
}
|
||||
set
|
||||
{
|
||||
tl.LogMessage("UTCDate Set", "Not implemented");
|
||||
throw new ASCOM.PropertyNotImplementedException("UTCDate", true);
|
||||
tl.LogMessage("UTCDate", "Set - " + Format("MM/dd/yy HH:mm:ss", value));
|
||||
_telescopeController.utcDate = value;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using ASCOM.Utilities.Interfaces;
|
||||
using System;
|
||||
using ASCOM.Utilities.Interfaces;
|
||||
|
||||
namespace ASCOM.MeadeAutostar497.Controller
|
||||
{
|
||||
@@ -9,5 +10,7 @@ namespace ASCOM.MeadeAutostar497.Controller
|
||||
bool Connected { get; set; }
|
||||
|
||||
string CommandString(string command, bool raw);
|
||||
bool Slewing { get; }
|
||||
DateTime utcDate { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,8 @@
|
||||
using System;
|
||||
using System.Configuration;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using ASCOM.Utilities;
|
||||
using ASCOM.Utilities.Interfaces;
|
||||
|
||||
@@ -10,6 +14,8 @@ namespace ASCOM.MeadeAutostar497.Controller
|
||||
|
||||
public static TelescopeController Instance => lazy.Value;
|
||||
|
||||
private Mutex serialMutex = new Mutex();
|
||||
|
||||
private ISerial _serialPort;
|
||||
public ISerial SerialPort
|
||||
{
|
||||
@@ -22,7 +28,7 @@ namespace ASCOM.MeadeAutostar497.Controller
|
||||
if (_serialPort != null)
|
||||
{
|
||||
if (_serialPort.Connected)
|
||||
throw new InvalidOperationException("Please disconnect before changing the port.");
|
||||
throw new InvalidOperationException("Please disconnect before changing the serial engine.");
|
||||
}
|
||||
|
||||
_serialPort = value;
|
||||
@@ -40,10 +46,18 @@ namespace ASCOM.MeadeAutostar497.Controller
|
||||
if (Connected)
|
||||
throw new InvalidOperationException("Please disconnect from the scope before changing port.");
|
||||
|
||||
if (!ValidPort(value))
|
||||
throw new InvalidOperationException($"Unable to select port {value} as it does not exist.");
|
||||
|
||||
_port = value;
|
||||
}
|
||||
}
|
||||
|
||||
private bool ValidPort(string value)
|
||||
{
|
||||
return SerialPort.AvailableComPorts.Contains(value);
|
||||
}
|
||||
|
||||
public bool Connected
|
||||
{
|
||||
get => SerialPort.Connected;
|
||||
@@ -55,16 +69,24 @@ namespace ASCOM.MeadeAutostar497.Controller
|
||||
if (value)
|
||||
{
|
||||
//Connecting
|
||||
SerialPort.DTREnable = false;
|
||||
SerialPort.RTSEnable = false;
|
||||
SerialPort.Speed = SerialSpeed.ps9600;
|
||||
SerialPort.DataBits = 8;
|
||||
SerialPort.StopBits = SerialStopBits.One;
|
||||
SerialPort.Parity = SerialParity.None;
|
||||
SerialPort.PortName = Port;
|
||||
SerialPort.Connected = true;
|
||||
try
|
||||
{
|
||||
SerialPort.DTREnable = false;
|
||||
SerialPort.RTSEnable = false;
|
||||
SerialPort.Speed = SerialSpeed.ps9600;
|
||||
SerialPort.DataBits = 8;
|
||||
SerialPort.StopBits = SerialStopBits.One;
|
||||
SerialPort.Parity = SerialParity.None;
|
||||
SerialPort.PortName = Port;
|
||||
SerialPort.Connected = true;
|
||||
|
||||
//todo perform test to ensure that connection has been made correctly.
|
||||
TestConnectionActive();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
SerialPort.Connected = false;
|
||||
throw;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -74,13 +96,100 @@ namespace ASCOM.MeadeAutostar497.Controller
|
||||
}
|
||||
}
|
||||
|
||||
private void TestConnectionActive()
|
||||
{
|
||||
var firmwareVersionNumber = CommandString("GVN");
|
||||
if (string.IsNullOrEmpty(firmwareVersionNumber))
|
||||
{
|
||||
throw new InvalidOperationException("Failed to communicate with telescope.");
|
||||
}
|
||||
}
|
||||
|
||||
public string CommandString(string command)
|
||||
{
|
||||
return CommandString($"#:{command}#", false);
|
||||
}
|
||||
|
||||
public string CommandString(string command, bool raw)
|
||||
{
|
||||
// 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
|
||||
return SerialCommand(command, true);
|
||||
}
|
||||
|
||||
throw new ASCOM.MethodNotImplementedException("CommandString");
|
||||
public bool Slewing
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!Connected) return false;
|
||||
|
||||
var result = CommandString("D");
|
||||
return result != string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
public DateTime utcDate
|
||||
{
|
||||
get
|
||||
{
|
||||
string telescopeDate = CommandString("GC");
|
||||
string telescopeTime = CommandString("GL");
|
||||
|
||||
int month = telescopeDate.Substring(0, 2).ToInteger();
|
||||
int day = telescopeDate.Substring(3, 2).ToInteger();
|
||||
int year = telescopeDate.Substring(6, 2).ToInteger();
|
||||
|
||||
if (year < 2000) //This is a hack that will work until the end of the century
|
||||
{
|
||||
year = year + 2000;
|
||||
}
|
||||
|
||||
int hour = telescopeTime.Substring(0, 2).ToInteger();
|
||||
int minute = telescopeTime.Substring(3, 2).ToInteger();
|
||||
int second = telescopeTime.Substring(6, 2).ToInteger();
|
||||
|
||||
var newDate = new DateTime(year, month, day, hour, minute, second, DateTimeKind.Utc);
|
||||
|
||||
return newDate;
|
||||
}
|
||||
set
|
||||
{
|
||||
//var result = SerialCommand(":SLHH:MM:SS#", true);
|
||||
var timeResult = SerialCommand($"#:SL{value:hh:mm:ss}#", true);
|
||||
if (timeResult != "1")
|
||||
{
|
||||
throw new InvalidOperationException("Failed to set local time");
|
||||
}
|
||||
|
||||
var dateResult = SerialCommand($"#:SC{value:MM/dd/yy}#", true);
|
||||
if (dateResult.Substring(0,1) != "1")
|
||||
{
|
||||
throw new InvalidOperationException("Failed to set local time");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private string SerialCommand(string command, bool expectsResult )
|
||||
{
|
||||
serialMutex.WaitOne();
|
||||
try
|
||||
{
|
||||
SerialPort.Transmit(command);
|
||||
if (expectsResult)
|
||||
{
|
||||
string result = SerialPort.ReceiveTerminated("#");
|
||||
|
||||
return result;
|
||||
}
|
||||
return string.Empty;
|
||||
}
|
||||
finally
|
||||
{
|
||||
SerialPort.ClearBuffers();
|
||||
serialMutex.ReleaseMutex();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="12.0">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
@@ -15,7 +15,7 @@
|
||||
<UpgradeBackupLocation>
|
||||
</UpgradeBackupLocation>
|
||||
<OldToolsVersion>3.5</OldToolsVersion>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
|
||||
<ApplicationIcon>ASCOM.ico</ApplicationIcon>
|
||||
<SignAssembly>true</SignAssembly>
|
||||
<AssemblyOriginatorKeyFile>ASCOMDriverTemplate.snk</AssemblyOriginatorKeyFile>
|
||||
@@ -34,7 +34,8 @@
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
|
||||
<TargetFrameworkProfile>
|
||||
</TargetFrameworkProfile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
@@ -46,6 +47,7 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<RegisterForComInterop>true</RegisterForComInterop>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
@@ -56,6 +58,7 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<RegisterForComInterop>false</RegisterForComInterop>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="ASCOM.Astrometry, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL" />
|
||||
@@ -66,6 +69,7 @@
|
||||
<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="Microsoft.CSharp" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.configuration" />
|
||||
<Reference Include="System.Configuration.Install" />
|
||||
@@ -74,13 +78,20 @@
|
||||
</Reference>
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.IO.Compression" />
|
||||
<Reference Include="System.Runtime.Serialization" />
|
||||
<Reference Include="System.ServiceModel" />
|
||||
<Reference Include="System.Transactions" />
|
||||
<Reference Include="System.Windows" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="WindowsBase" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="AscomClasses\Telescope.cs" />
|
||||
<Compile Include="Controller\ITelescopeController.cs" />
|
||||
<Compile Include="Controller\TelescopeController.cs" />
|
||||
<Compile Include="StringExtensions.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
|
||||
@@ -8,11 +8,11 @@ using System.Runtime.InteropServices;
|
||||
//
|
||||
// TODO - Add your authorship information here
|
||||
[assembly: AssemblyTitle("ASCOM.MeadeAutostar497.Telescope")]
|
||||
[assembly: AssemblyDescription("ASCOM Telescope driver for MeadeAutostar497")]
|
||||
[assembly: AssemblyDescription("ASCOM MeadeAutostar497 .net")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("The ASCOM Initiative")]
|
||||
[assembly: AssemblyCompany("Cjdawson.com")]
|
||||
[assembly: AssemblyProduct("ASCOM Telescope driver for MeadeAutostar497")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2019 The ASCOM Initiative")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2019 cjdawson.com")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
@@ -35,5 +35,5 @@ using System.Runtime.InteropServices;
|
||||
// by using the '*' as shown below:
|
||||
//
|
||||
// TODO - Set your driver's version here
|
||||
[assembly: AssemblyVersion("6.4.0.0")]
|
||||
[assembly: AssemblyFileVersion("6.4.0.0")]
|
||||
[assembly: AssemblyVersion("0.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("0.0.0.0")]
|
||||
|
||||
+24
-37
@@ -1,18 +1,17 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.18052
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace ASCOM.MeadeAutostar497.Properties
|
||||
{
|
||||
namespace ASCOM.MeadeAutostar497.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
@@ -20,74 +19,62 @@ namespace ASCOM.MeadeAutostar497.Properties
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources
|
||||
{
|
||||
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources()
|
||||
{
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager
|
||||
{
|
||||
get
|
||||
{
|
||||
if (object.ReferenceEquals(resourceMan, null))
|
||||
{
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ASCOM.MeadeAutostar497.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture
|
||||
{
|
||||
get
|
||||
{
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set
|
||||
{
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap ASCOM
|
||||
{
|
||||
get
|
||||
{
|
||||
internal static System.Drawing.Bitmap ASCOM {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("ASCOM", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
|
||||
/// </summary>
|
||||
internal static System.Drawing.Icon DefaultIcon
|
||||
{
|
||||
get
|
||||
{
|
||||
internal static System.Drawing.Icon DefaultIcon {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("DefaultIcon", resourceCulture);
|
||||
return ((System.Drawing.Icon)(obj));
|
||||
}
|
||||
|
||||
+10
-14
@@ -1,28 +1,24 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.18052
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace ASCOM.MeadeAutostar497.Properties
|
||||
{
|
||||
|
||||
|
||||
namespace ASCOM.MeadeAutostar497.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
|
||||
{
|
||||
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default
|
||||
{
|
||||
get
|
||||
{
|
||||
|
||||
public static Settings Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ASCOM.MeadeAutostar497
|
||||
{
|
||||
public static class StringExtensions
|
||||
{
|
||||
public static int ToInteger(this string str)
|
||||
{
|
||||
return int.Parse(str);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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.0,Profile=Client"/></startup></configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2"/></startup></configuration>
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
// This implements a console application that can be used to test an ASCOM driver
|
||||
//
|
||||
|
||||
// This is used to define code in the template that is specific to one class implementation
|
||||
// unused code can be deleted and this definition removed.
|
||||
|
||||
#define Telescope
|
||||
// remove this to bypass the code that uses the chooser to select the driver
|
||||
#define UseChooser
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace ASCOM
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
// Uncomment the code that's required
|
||||
#if UseChooser
|
||||
// choose the device
|
||||
string id = ASCOM.DriverAccess.Telescope.Choose("ASCOM.MeadeAutostar497.Telescope");
|
||||
if (string.IsNullOrEmpty(id))
|
||||
return;
|
||||
// create this device
|
||||
ASCOM.DriverAccess.Telescope device = new ASCOM.DriverAccess.Telescope(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.MeadeAutostar497.Telescope");
|
||||
#endif
|
||||
// now run some tests, adding code to your driver so that the tests will pass.
|
||||
// these first tests are common to all drivers.
|
||||
Console.WriteLine("name " + device.Name);
|
||||
Console.WriteLine("description " + device.Description);
|
||||
Console.WriteLine("DriverInfo " + device.DriverInfo);
|
||||
Console.WriteLine("driverVersion " + device.DriverVersion);
|
||||
|
||||
// TODO add more code to test the driver.
|
||||
device.Connected = true;
|
||||
|
||||
//Console.WriteLine(device.Slewing);
|
||||
|
||||
device.UTCDate = DateTime.UtcNow;
|
||||
|
||||
Console.WriteLine(device.UTCDate);
|
||||
|
||||
device.Connected = false;
|
||||
Console.WriteLine("Press Enter to finish");
|
||||
Console.ReadLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
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("q Test Application")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("ASCOM Initiative")]
|
||||
[assembly: AssemblyProduct("q")]
|
||||
[assembly: AssemblyCopyright("Copyright © ASCOM Initiative 2014")]
|
||||
[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("c7008f94-e3b9-4481-b720-3b56557860c6")]
|
||||
|
||||
// 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("6.4.0.0")]
|
||||
[assembly: AssemblyFileVersion("6.4.0.0")]
|
||||
@@ -0,0 +1,64 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{D5207217-61C7-4E94-8097-91DBACE57D2A}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>TestConsole</RootNamespace>
|
||||
<AssemblyName>TestConsole</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile>
|
||||
</TargetFrameworkProfile>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<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>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<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="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.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.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
@@ -0,0 +1,3 @@
|
||||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6"/></startup></configuration>
|
||||
Reference in New Issue
Block a user