Skip to content

Commit 7ff0907

Browse files
committed
Add project files.
1 parent a25249b commit 7ff0907

5 files changed

Lines changed: 197 additions & 0 deletions

File tree

SafetyMonitorTester.sln

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.6.33801.468
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SafetyMonitorTester", "SafetyMonitorTester\SafetyMonitorTester.csproj", "{D5207217-61C7-4E94-8097-91DBACE57D2A}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|x86 = Debug|x86
11+
Release|x86 = Release|x86
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{D5207217-61C7-4E94-8097-91DBACE57D2A}.Debug|x86.ActiveCfg = Debug|x86
15+
{D5207217-61C7-4E94-8097-91DBACE57D2A}.Debug|x86.Build.0 = Debug|x86
16+
{D5207217-61C7-4E94-8097-91DBACE57D2A}.Release|x86.ActiveCfg = Release|x86
17+
{D5207217-61C7-4E94-8097-91DBACE57D2A}.Release|x86.Build.0 = Release|x86
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {816EC16C-BB93-4485-A6AB-CB06618BB8CE}
24+
EndGlobalSection
25+
EndGlobal

SafetyMonitorTester/Program.cs

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
// This is a console application that can be used to test an ASCOM driver
2+
3+
// Remove the "#define UseChooser" line to bypass the code that uses the chooser to select the driver and replace it with code that accesses the driver directly via its ProgId.
4+
// #define UseChooser
5+
6+
using System;
7+
using System.Collections.Generic;
8+
using System.Linq;
9+
using System.Text;
10+
11+
namespace ASCOM
12+
{
13+
internal class Program
14+
{
15+
static void Main(string[] args)
16+
{
17+
#if UseChooser
18+
// Choose the device
19+
string id = ASCOM.DriverAccess.SafetyMonitor.Choose("");
20+
21+
// Exit if no device was selected
22+
if (string.IsNullOrEmpty(id))
23+
return;
24+
25+
// Create this device
26+
ASCOM.DriverAccess.SafetyMonitor device = new ASCOM.DriverAccess.SafetyMonitor(id);
27+
#else
28+
// Create the driver class directly.
29+
ASCOM.DriverAccess.SafetyMonitor device = new ASCOM.DriverAccess.SafetyMonitor("ASCOM.Simulator.SafetyMonitor");
30+
#endif
31+
32+
// Connect to the device
33+
device.Connected = true;
34+
35+
// Now exercise some calls that are common to all drivers.
36+
Console.WriteLine($"Name: {device.Name}");
37+
Console.WriteLine($"Description: {device.Description}");
38+
Console.WriteLine($"DriverInfo: {device.DriverInfo}");
39+
Console.WriteLine($"DriverVersion: {device.DriverVersion}");
40+
Console.WriteLine($"InterfaceVersion: {device.InterfaceVersion}");
41+
42+
//
43+
// TODO add more code to test your driver.
44+
//
45+
try
46+
{
47+
48+
// Disconnect from the device
49+
device.Connected = false;
50+
Console.WriteLine("Set connected false");
51+
52+
device.Connect();
53+
do
54+
{
55+
Console.WriteLine("Waiting for 100ms");
56+
System.Threading.Thread.Sleep(100);
57+
} while (device.Connecting);
58+
Console.WriteLine("Device connected!");
59+
60+
}
61+
catch (Exception ex)
62+
{
63+
Console.WriteLine($"{ex}");
64+
}
65+
66+
67+
Console.WriteLine("Press Enter to finish");
68+
Console.ReadLine();
69+
}
70+
}
71+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
5+
// General Information about an assembly is controlled through the following
6+
// set of attributes. Change these attribute values to modify the information
7+
// associated with an assembly.
8+
[assembly: AssemblyTitle("TestConsoleApp(CS)")]
9+
[assembly: AssemblyDescription("")]
10+
[assembly: AssemblyConfiguration("")]
11+
[assembly: AssemblyCompany("Peter Simpson")]
12+
[assembly: AssemblyProduct("TestConsoleApp(CS)")]
13+
[assembly: AssemblyCopyright("Copyright © Peter Simpson 2022")]
14+
[assembly: AssemblyTrademark("")]
15+
[assembly: AssemblyCulture("")]
16+
17+
// Setting ComVisible to false makes the types in this assembly not visible
18+
// to COM components. If you need to access a type in this assembly from
19+
// COM, set the ComVisible attribute to true on that type.
20+
[assembly: ComVisible(false)]
21+
22+
// The following GUID is for the ID of the typelib if this project is exposed to COM
23+
[assembly: Guid("1d704121-f745-4734-b8b1-cd6866af3afa")]
24+
25+
// Version information for an assembly consists of the following four values:
26+
//
27+
// Major Version
28+
// Minor Version
29+
// Build Number
30+
// Revision
31+
//
32+
// You can specify all the values or you can default the Build and Revision Numbers
33+
// by using the '*' as shown below:
34+
// [assembly: AssemblyVersion("1.0.*")]
35+
[assembly: AssemblyVersion("1.0.0.0")]
36+
[assembly: AssemblyFileVersion("1.0.0.0")]
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5+
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
6+
<ProductVersion>8.0.30703</ProductVersion>
7+
<SchemaVersion>2.0</SchemaVersion>
8+
<ProjectGuid>{D5207217-61C7-4E94-8097-91DBACE57D2A}</ProjectGuid>
9+
<OutputType>Exe</OutputType>
10+
<AppDesignerFolder>Properties</AppDesignerFolder>
11+
<RootNamespace>ASCOM.Test</RootNamespace>
12+
<AssemblyName>ASCOM.Test.Test</AssemblyName>
13+
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
14+
<TargetFrameworkProfile>
15+
</TargetFrameworkProfile>
16+
<FileAlignment>512</FileAlignment>
17+
</PropertyGroup>
18+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
19+
<PlatformTarget>x86</PlatformTarget>
20+
<DebugSymbols>true</DebugSymbols>
21+
<DebugType>full</DebugType>
22+
<Optimize>false</Optimize>
23+
<OutputPath>bin\Debug\</OutputPath>
24+
<DefineConstants>DEBUG;TRACE</DefineConstants>
25+
<ErrorReport>prompt</ErrorReport>
26+
<WarningLevel>4</WarningLevel>
27+
</PropertyGroup>
28+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
29+
<PlatformTarget>x86</PlatformTarget>
30+
<DebugType>pdbonly</DebugType>
31+
<Optimize>true</Optimize>
32+
<OutputPath>bin\Release\</OutputPath>
33+
<DefineConstants>TRACE</DefineConstants>
34+
<ErrorReport>prompt</ErrorReport>
35+
<WarningLevel>4</WarningLevel>
36+
</PropertyGroup>
37+
<ItemGroup>
38+
<Reference Include="ASCOM.DeviceInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL" />
39+
<Reference Include="ASCOM.DriverAccess, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7, processorArchitecture=MSIL" />
40+
<Reference Include="System" />
41+
<Reference Include="System.Core" />
42+
<Reference Include="System.Xml.Linq" />
43+
<Reference Include="System.Data.DataSetExtensions" />
44+
<Reference Include="System.Data" />
45+
<Reference Include="System.Xml" />
46+
</ItemGroup>
47+
<ItemGroup>
48+
<Compile Include="Program.cs" />
49+
<Compile Include="Properties\AssemblyInfo.cs" />
50+
</ItemGroup>
51+
<ItemGroup>
52+
<None Include="app.config" />
53+
</ItemGroup>
54+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
55+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
56+
Other similar extension points exist, see Microsoft.Common.targets.
57+
<Target Name="BeforeBuild">
58+
</Target>
59+
<Target Name="AfterBuild">
60+
</Target>
61+
-->
62+
</Project>

SafetyMonitorTester/app.config

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<?xml version="1.0"?>
2+
<configuration>
3+
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>

0 commit comments

Comments
 (0)