79a77d4e1d
Feature/LocalServer * Major refactor. Switching over to a local server hub style driver allowing multiple programs to control the telescope at one time without the need for the POTH Hub * Unified the setup dialog * Implemented shared serial port, Both Telescope and Driver can connect at the same time. * Ported the focuser implementation from the non server based version. * Ported the telescope driver code. * Fixed problem with # not being stripped from the returned string ends. Fixed issue with RA being returned as degress rather than hours. * Telescope passes validation * Added a lock around the focuser move. * Reimplemented CommandBlind and CommandString * Corrected version information * Removed the Altitude support as there's a bug in the Autostar and Audiostar firmware
56 lines
1.9 KiB
C#
56 lines
1.9 KiB
C#
// 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;
|
|
using System.Threading;
|
|
using ASCOM.DriverAccess;
|
|
|
|
namespace ASCOM
|
|
{
|
|
class Program
|
|
{
|
|
static void Main(string[] args)
|
|
{
|
|
// Uncomment the code that's required
|
|
#if UseChooser
|
|
// choose the device
|
|
string id = ASCOM.DriverAccess.Focuser.Choose("ASCOM.MeadeGeneric.Focuser");
|
|
if (string.IsNullOrEmpty(id))
|
|
return;
|
|
// create this device
|
|
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");
|
|
#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;
|
|
|
|
device.Move(2000);
|
|
Thread.Sleep(2000);
|
|
device.Move(-2000);
|
|
|
|
device.Connected = false;
|
|
Console.WriteLine("Press Enter to finish");
|
|
Console.ReadLine();
|
|
}
|
|
}
|
|
}
|