1
0
mirror of https://bitbucket.org/cjdskunkworks/lynxastrodewcontroller.git synced 2026-05-03 17:28:52 +00:00

Version 1 of the LynxAstro.DewController.Switch driver

This commit is contained in:
2021-02-17 19:48:23 +00:00
parent 7be023be2c
commit 7fe6d52363
65 changed files with 6381 additions and 0 deletions
@@ -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>ASCOM.LynxAstro.DewController</RootNamespace>
<AssemblyName>ASCOM.LynxAstro.DewController.TestConsole</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>AnyCPU</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,78 @@
// 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 Switch
// 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.Switch.Choose("");
if (string.IsNullOrEmpty(id))
return;
// create this device
ASCOM.DriverAccess.Switch device = new ASCOM.DriverAccess.Switch(id);
#else
// this can be replaced by this code, it avoids the chooser and creates the driver class directly.
ASCOM.DriverAccess.Switch device = new ASCOM.DriverAccess.Switch("ASCOM.LynxAstro.DewController.Switch");
#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("Number of switches: " + device.MaxSwitch);
for (short i = 0; i < device.MaxSwitch; i++)
{
var min = device.MinSwitchValue(i);
var max = device.MaxSwitchValue(i);
var step = device.SwitchStep(i);
var value = device.GetSwitchValue(i);
Console.WriteLine($"switch {i}: {min} - {max} stepsize {step}: {value}");
}
for (short i = 0; i < device.MaxSwitch; i++)
{
device.SetSwitchValue(i, 500);
}
for (short i = 0; i < device.MaxSwitch; i++)
{
var min = device.MinSwitchValue(i);
var max = device.MaxSwitchValue(i);
var step = device.SwitchStep(i);
var value = device.GetSwitchValue(i);
Console.WriteLine($"switch {i}: {min} - {max} stepsize {step}: {value}");
}
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("LynxAstro.DewController Test Application")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("ASCOM Initiative")]
[assembly: AssemblyProduct("LynxAstro.DewController")]
[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,3 @@
<?xml version="1.0"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/></startup></configuration>