Merged in develop (pull request #3)

Develop

* Removed unwanted files

* Adding git ignore file

* 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.

* Switched the serial port over to using the .net frameworks serial port.
    Extracted the serial port into it's own class and created a simpler command processing mechanism.

* Implemented AbortSlew and did some code tidy up.

* Forced all code to 64-bit only, will make this 32/64 bit before release.
    Fixed issue in the SerialProcessor when setting the time, makes sure that there's no chance of thread stealing when pulling out the junk messages
    Added ConformanceResult.txt to show the progress of the driver development

* Added code for the site latitude
    and started work on the longitude.

* Added unit tests for reading and writing the utcDate.
    Fixed a couple of defects in the code that was setting the utcDate.

* Corrected Longitude value range

* Added support for UTC offset.

* Pulse guiding support added

* Added SiteLatitude unit tests

* Added unit tests for SiteLongitude

* Added unit tests for the new Pulse guide implementation.

* Added support for AlignmentMode

* Added support for AtPark and Park

* Added support for parking the scope
    Added support for reading the scope Azimuth

* Added support for reading Declination

* Added 5 second timeout for the serial port.
    Fixed problem with the GW command not working on the Autostar 497.

* Fixed broken unit test

* Added support for altitude

* Tidying up resharper warinings

* Implemented RightAscension
    TargetRightAscension
    TargetDec
    SlewToCoord
    and SlewToCoordAsync

* Sorted out the target RA and Dec exceptions to be compliant with ascom.

* Implemented SlewToAltAz and SlewToAltAzAsync

* Implemented SyncToTarget functionality

* Implemented slew to target

* Added support for MoveAxis

* Added support for tracking rate

* Added IFocuserV3 to the driver and made sure that it's registered for ASCOM as a focuser as well.

* Fixed issue with Target RA and Dec loosing precision

* Telescope driver now passes the Ascom conformance.
This commit is contained in:
2019-05-08 17:23:13 +00:00
parent eca366dd10
commit 777adb260a
25 changed files with 3057 additions and 181 deletions
+4 -2
View File
@@ -99,11 +99,13 @@ namespace ASCOM.MeadeAutostar497
case TelescopeAxes.axisPrimary:
// 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];
//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;
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[0];
this.rates = new Rate[] { 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
+242 -91
View File
@@ -27,11 +27,7 @@
#define Telescope
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;
@@ -60,7 +56,7 @@ namespace ASCOM.MeadeAutostar497
/// </summary>
[Guid("58e4fe97-1760-4e22-8ecd-2225876aeefc")]
[ClassInterface(ClassInterfaceType.None)]
public class Telescope : ITelescopeV3
public class Telescope : ITelescopeV3, IFocuserV3
{
private ITelescopeController _telescopeController;
@@ -73,7 +69,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";
@@ -169,9 +165,9 @@ namespace ASCOM.MeadeAutostar497
{
CheckConnected("CommandBlind");
// Call CommandString and return as soon as it finishes
this.CommandString(command, raw);
//this.CommandString(command, raw);
// or
//throw new ASCOM.MethodNotImplementedException("CommandBlind");
throw new ASCOM.MethodNotImplementedException("CommandBlind");
// DO NOT have both these sections! One or the other
}
@@ -187,8 +183,11 @@ namespace ASCOM.MeadeAutostar497
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
CheckConnected("CommandString");
return _telescopeController.CommandString(command, raw);
throw new ASCOM.MethodNotImplementedException("CommandString");
}
public void Dispose()
@@ -221,6 +220,7 @@ namespace ASCOM.MeadeAutostar497
if (value)
{
LogMessage("Connected Set", "Connecting to port {0}", comPort);
_telescopeController.Port = comPort;
_telescopeController.Connected = true;
}
else
@@ -289,16 +289,18 @@ namespace ASCOM.MeadeAutostar497
#region ITelescope Implementation
public void AbortSlew()
{
tl.LogMessage("AbortSlew", "Not implemented");
throw new ASCOM.MethodNotImplementedException("AbortSlew");
tl.LogMessage("AbortSlew", "Aborting slew");
_telescopeController.AbortSlew();
}
public AlignmentModes AlignmentMode
{
get
{
tl.LogMessage("AlignmentMode Get", "Not implemented");
throw new ASCOM.PropertyNotImplementedException("AlignmentMode", false);
tl.LogMessage("AlignmentMode Get", "Getting alignmode");
var alignmode = _telescopeController.AlignmentMode;
tl.LogMessage("AlignmentMode Get", $"alignmode = {alignmode}");
return alignmode;
}
}
@@ -306,8 +308,9 @@ namespace ASCOM.MeadeAutostar497
{
get
{
tl.LogMessage("Altitude", "Not implemented");
throw new ASCOM.PropertyNotImplementedException("Altitude", false);
var alt = _telescopeController.Altitude;
tl.LogMessage("Altitude", $"{alt}");
return alt;
}
}
@@ -342,8 +345,9 @@ namespace ASCOM.MeadeAutostar497
{
get
{
tl.LogMessage("AtPark", "Get - " + false.ToString());
return false;
var atPatk = _telescopeController.AtPark;
tl.LogMessage("AtPark", "Get - " + atPatk.ToString());
return atPatk;
}
}
@@ -357,8 +361,9 @@ namespace ASCOM.MeadeAutostar497
{
get
{
tl.LogMessage("Azimuth Get", "Not implemented");
throw new ASCOM.PropertyNotImplementedException("Azimuth", false);
var az = _telescopeController.Azimuth;
tl.LogMessage("Azimuth Get", $"{az}");
return az;
}
}
@@ -376,9 +381,9 @@ namespace ASCOM.MeadeAutostar497
tl.LogMessage("CanMoveAxis", "Get - " + Axis.ToString());
switch (Axis)
{
case TelescopeAxes.axisPrimary: return false;
case TelescopeAxes.axisSecondary: return false;
case TelescopeAxes.axisTertiary: return false;
case TelescopeAxes.axisPrimary: return true; //RA or AZ
case TelescopeAxes.axisSecondary: return true; //Dev or Alt
case TelescopeAxes.axisTertiary: return false; //rotator / derotator
default: throw new InvalidValueException("CanMoveAxis", Axis.ToString(), "0 to 2");
}
}
@@ -387,8 +392,8 @@ namespace ASCOM.MeadeAutostar497
{
get
{
tl.LogMessage("CanPark", "Get - " + false.ToString());
return false;
tl.LogMessage("CanPark", "Get - " + true.ToString());
return true;
}
}
@@ -396,8 +401,8 @@ namespace ASCOM.MeadeAutostar497
{
get
{
tl.LogMessage("CanPulseGuide", "Get - " + false.ToString());
return false;
tl.LogMessage("CanPulseGuide", "Get - " + true.ToString());
return true;
}
}
@@ -459,8 +464,8 @@ namespace ASCOM.MeadeAutostar497
{
get
{
tl.LogMessage("CanSlew", "Get - " + false.ToString());
return false;
tl.LogMessage("CanSlew", "Get - " + true.ToString());
return true;
}
}
@@ -468,8 +473,8 @@ namespace ASCOM.MeadeAutostar497
{
get
{
tl.LogMessage("CanSlewAltAz", "Get - " + false.ToString());
return false;
tl.LogMessage("CanSlewAltAz", "Get - " + true.ToString());
return true;
}
}
@@ -477,8 +482,8 @@ namespace ASCOM.MeadeAutostar497
{
get
{
tl.LogMessage("CanSlewAltAzAsync", "Get - " + false.ToString());
return false;
tl.LogMessage("CanSlewAltAzAsync", "Get - " + true.ToString());
return true;
}
}
@@ -486,8 +491,8 @@ namespace ASCOM.MeadeAutostar497
{
get
{
tl.LogMessage("CanSlewAsync", "Get - " + false.ToString());
return false;
tl.LogMessage("CanSlewAsync", "Get - " + true.ToString());
return true;
}
}
@@ -495,8 +500,8 @@ namespace ASCOM.MeadeAutostar497
{
get
{
tl.LogMessage("CanSync", "Get - " + false.ToString());
return false;
tl.LogMessage("CanSync", "Get - " + true.ToString());
return true;
}
}
@@ -522,7 +527,7 @@ namespace ASCOM.MeadeAutostar497
{
get
{
double declination = 0.0;
double declination = _telescopeController.Declination;
tl.LogMessage("Declination", "Get - " + utilities.DegreesToDMS(declination, ":", ":"));
return declination;
}
@@ -620,34 +625,35 @@ namespace ASCOM.MeadeAutostar497
{
get
{
tl.LogMessage("IsPulseGuiding Get", "Not implemented");
throw new ASCOM.PropertyNotImplementedException("IsPulseGuiding", false);
tl.LogMessage("IsPulseGuiding Get", "pulse guiding is synchronous for this driver");
//throw new ASCOM.PropertyNotImplementedException("IsPulseGuiding", false);
return false;
}
}
public void MoveAxis(TelescopeAxes Axis, double Rate)
{
tl.LogMessage("MoveAxis", "Not implemented");
throw new ASCOM.MethodNotImplementedException("MoveAxis");
tl.LogMessage("MoveAxis", $"Axis={Axis} rate={Rate}");
_telescopeController.MoveAxis(Axis, Rate);
}
public void Park()
{
tl.LogMessage("Park", "Not implemented");
throw new ASCOM.MethodNotImplementedException("Park");
tl.LogMessage("Park", "Parking telescope");
_telescopeController.Park();
}
public void PulseGuide(GuideDirections Direction, int Duration)
{
tl.LogMessage("PulseGuide", "Not implemented");
throw new ASCOM.MethodNotImplementedException("PulseGuide");
tl.LogMessage("PulseGuide", $"pulse guide direction {Direction} duration {Duration}");
_telescopeController.PulseGuide(Direction, Duration);
}
public double RightAscension
{
get
{
double rightAscension = 0.0;
double rightAscension = _telescopeController.RightAscension;
tl.LogMessage("RightAscension", "Get - " + utilities.HoursToHMS(rightAscension));
return rightAscension;
}
@@ -732,13 +738,14 @@ namespace ASCOM.MeadeAutostar497
{
get
{
tl.LogMessage("SiteLatitude Get", "Not implemented");
throw new ASCOM.PropertyNotImplementedException("SiteLatitude", false);
var siteLatitude = _telescopeController.SiteLatitude;
tl.LogMessage("SiteLatitude Get", $"{utilities.DegreesToDMS(siteLatitude)}");
return siteLatitude;
}
set
{
tl.LogMessage("SiteLatitude Set", "Not implemented");
throw new ASCOM.PropertyNotImplementedException("SiteLatitude", true);
tl.LogMessage("SiteLatitude Set", $"{utilities.DegreesToDMS(value)}");
_telescopeController.SiteLatitude = value;
}
}
@@ -746,13 +753,14 @@ namespace ASCOM.MeadeAutostar497
{
get
{
tl.LogMessage("SiteLongitude Get", "Not implemented");
throw new ASCOM.PropertyNotImplementedException("SiteLongitude", false);
var siteLongitude = _telescopeController.SiteLongitude;
tl.LogMessage("SiteLongitude Get", $"{utilities.DegreesToDMS(siteLongitude)}");
return siteLongitude;
}
set
{
tl.LogMessage("SiteLongitude Set", "Not implemented");
throw new ASCOM.PropertyNotImplementedException("SiteLongitude", true);
tl.LogMessage("SiteLongitude Set", $"{utilities.DegreesToDMS(value)}");
_telescopeController.SiteLongitude = value;
}
}
@@ -772,46 +780,48 @@ namespace ASCOM.MeadeAutostar497
public void SlewToAltAz(double Azimuth, double Altitude)
{
tl.LogMessage("SlewToAltAz", "Not implemented");
throw new ASCOM.MethodNotImplementedException("SlewToAltAz");
tl.LogMessage("SlewToAltAz", $"Az=~{Azimuth} Alt={Altitude}");
_telescopeController.SlewToAltAz(Azimuth, Altitude);
}
public void SlewToAltAzAsync(double Azimuth, double Altitude)
{
tl.LogMessage("SlewToAltAzAsync", "Not implemented");
throw new ASCOM.MethodNotImplementedException("SlewToAltAzAsync");
tl.LogMessage("SlewToAltAzAsync", $"Az=~{Azimuth} Alt={Altitude}");
_telescopeController.SlewToAltAzAsync(Azimuth, Altitude);
}
public void SlewToCoordinates(double RightAscension, double Declination)
{
tl.LogMessage("SlewToCoordinates", "Not implemented");
throw new ASCOM.MethodNotImplementedException("SlewToCoordinates");
tl.LogMessage("SlewToCoordinates", $"Ra={RightAscension}, Dec={Declination}");
_telescopeController.SlewToCoordinates(RightAscension, Declination);
}
public void SlewToCoordinatesAsync(double RightAscension, double Declination)
{
tl.LogMessage("SlewToCoordinatesAsync", "Not implemented");
throw new ASCOM.MethodNotImplementedException("SlewToCoordinatesAsync");
tl.LogMessage("SlewToCoordinatesAsync", $"Ra={RightAscension}, Dec={Declination}");
_telescopeController.SlewToCoordinatesAsync(RightAscension, Declination);
}
public void SlewToTarget()
{
tl.LogMessage("SlewToTarget", "Not implemented");
throw new ASCOM.MethodNotImplementedException("SlewToTarget");
tl.LogMessage("SlewToTarget", "Executing");
_telescopeController.SlewToTarget();
}
public void SlewToTargetAsync()
{
tl.LogMessage("SlewToTargetAsync", "Not implemented");
throw new ASCOM.MethodNotImplementedException("SlewToTargetAsync");
tl.LogMessage("SlewToTargetAsync", "Executing");
_telescopeController.SlewToTargetAsync();
}
public bool Slewing
{
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;
}
}
@@ -823,27 +833,31 @@ namespace ASCOM.MeadeAutostar497
public void SyncToCoordinates(double RightAscension, double Declination)
{
tl.LogMessage("SyncToCoordinates", "Not implemented");
throw new ASCOM.MethodNotImplementedException("SyncToCoordinates");
tl.LogMessage("SyncToCoordinates", $"RA={RightAscension} Dec={Declination}");
_telescopeController.TargetRightAscension = RightAscension;
_telescopeController.TargetDeclination = Declination;
SyncToTarget();
}
public void SyncToTarget()
{
tl.LogMessage("SyncToTarget", "Not implemented");
throw new ASCOM.MethodNotImplementedException("SyncToTarget");
tl.LogMessage("SyncToTarget", "Executing");
_telescopeController.SyncToTarget();
}
public double TargetDeclination
{
get
{
tl.LogMessage("TargetDeclination Get", "Not implemented");
throw new ASCOM.PropertyNotImplementedException("TargetDeclination", false);
var targetDec = _telescopeController.TargetDeclination;
tl.LogMessage("TargetDeclination Get", $"{targetDec}");
return targetDec;
}
set
{
tl.LogMessage("TargetDeclination Set", "Not implemented");
throw new ASCOM.PropertyNotImplementedException("TargetDeclination", true);
{
tl.LogMessage("TargetDeclination Set", $"{value}");
_telescopeController.TargetDeclination = value;
}
}
@@ -851,13 +865,14 @@ namespace ASCOM.MeadeAutostar497
{
get
{
tl.LogMessage("TargetRightAscension Get", "Not implemented");
throw new ASCOM.PropertyNotImplementedException("TargetRightAscension", false);
var targetRa = _telescopeController.TargetRightAscension;
tl.LogMessage("TargetRightAscension Get", $"{targetRa}");
return targetRa;
}
set
{
tl.LogMessage("TargetRightAscension Set", "Not implemented");
throw new ASCOM.PropertyNotImplementedException("TargetRightAscension", true);
tl.LogMessage("TargetRightAscension Set", $"{value}");
_telescopeController.TargetRightAscension = value;
}
}
@@ -865,6 +880,7 @@ namespace ASCOM.MeadeAutostar497
{
get
{
//todo implementing this, it exists.
bool tracking = true;
tl.LogMessage("Tracking", "Get - " + tracking.ToString());
return tracking;
@@ -880,8 +896,9 @@ namespace ASCOM.MeadeAutostar497
{
get
{
tl.LogMessage("TrackingRate Get", "Not implemented");
throw new ASCOM.PropertyNotImplementedException("TrackingRate", false);
var tr = _telescopeController.TrackingRate;
tl.LogMessage("TrackingRate Get", $"{tr}");
return tr;
}
set
{
@@ -908,14 +925,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;
}
}
@@ -927,6 +947,124 @@ namespace ASCOM.MeadeAutostar497
#endregion
#region IFocuser Implementation
private int focuserPosition = 0; // Class level variable to hold the current focuser position
private const int focuserSteps = 10000;
public bool Absolute
{
get
{
tl.LogMessage("Absolute Get", true.ToString());
return true; // This is an absolute focuser
}
}
public void Halt()
{
tl.LogMessage("Halt", "Not implemented");
throw new ASCOM.MethodNotImplementedException("Halt");
}
public bool IsMoving
{
get
{
tl.LogMessage("IsMoving Get", false.ToString());
return false; // This focuser always moves instantaneously so no need for IsMoving ever to be True
}
}
public bool Link
{
get
{
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());
this.Connected = value; // Direct function to the connected method, the Link method is just here for backwards compatibility
}
}
public int MaxIncrement
{
get
{
tl.LogMessage("MaxIncrement Get", focuserSteps.ToString());
return focuserSteps; // Maximum change in one move
}
}
public int MaxStep
{
get
{
tl.LogMessage("MaxStep Get", focuserSteps.ToString());
return focuserSteps; // Maximum extent of the focuser, so position range is 0 to 10,000
}
}
public void Move(int Position)
{
tl.LogMessage("Move", Position.ToString());
focuserPosition = Position; // Set the focuser position
}
public int Position
{
get
{
return focuserPosition; // Return the focuser position
}
}
public double StepSize
{
get
{
tl.LogMessage("StepSize Get", "Not implemented");
throw new ASCOM.PropertyNotImplementedException("StepSize", false);
}
}
public bool TempComp
{
get
{
tl.LogMessage("TempComp Get", false.ToString());
return false;
}
set
{
tl.LogMessage("TempComp Set", "Not implemented");
throw new ASCOM.PropertyNotImplementedException("TempComp", false);
}
}
public bool TempCompAvailable
{
get
{
tl.LogMessage("TempCompAvailable Get", false.ToString());
return false; // Temperature compensation is not available in this driver
}
}
public double Temperature
{
get
{
tl.LogMessage("Temperature Get", "Not implemented");
throw new ASCOM.PropertyNotImplementedException("Temperature", false);
}
}
#endregion
#region Private properties and methods
// here are some useful properties and methods that can be used as required
// to help with driver development
@@ -943,16 +1081,29 @@ namespace ASCOM.MeadeAutostar497
/// <param name="bRegister">If <c>true</c>, registers the driver, otherwise unregisters it.</param>
private static void RegUnregASCOM(bool bRegister)
{
using (var P = new ASCOM.Utilities.Profile())
using (var p = new ASCOM.Utilities.Profile())
{
P.DeviceType = "Telescope";
p.DeviceType = "Telescope";
if (bRegister)
{
P.Register(driverID, driverDescription);
p.Register(driverID, driverDescription);
}
else
{
P.Unregister(driverID);
p.Unregister(driverID);
}
}
using (var p = new ASCOM.Utilities.Profile())
{
p.DeviceType = "Focuser";
if (bRegister)
{
p.Register(driverID, driverDescription);
}
else
{
p.Unregister(driverID);
}
}
}
@@ -0,0 +1,28 @@
using System.IO.Ports;
using System.Runtime.InteropServices;
namespace ASCOM.MeadeAutostar497.Controller
{
[ComVisible(false)]
public interface ISerialProcessor
{
bool IsOpen { get; }
bool DtrEnable { get; set; }
bool RtsEnable { get; set; }
int BaudRate { get; set; }
int DataBits { get; set; }
StopBits StopBits { get; set; }
Parity Parity { get; set; }
string PortName { get; set; }
string[] GetPortNames();
void Open();
void Close();
string CommandTerminated(string command, string terminator);
char CommandChar(string command);
string ReadTerminated(string terminator);
void Command(string command);
void Lock();
void Unlock();
}
}
@@ -1,13 +1,36 @@
using ASCOM.Utilities.Interfaces;
using System;
using ASCOM.DeviceInterface;
namespace ASCOM.MeadeAutostar497.Controller
{
public interface ITelescopeController
{
ISerial SerialPort { get; set; }
string Port { get; set; }
bool Connected { get; set; }
string CommandString(string command, bool raw);
bool Slewing { get; }
DateTime utcDate { get; set; }
double SiteLatitude { get; set; }
double SiteLongitude { get; set; }
AlignmentModes AlignmentMode { get; set; }
bool AtPark { get; }
double Altitude { get; }
double Azimuth { get; }
double RightAscension { get; }
double Declination { get; }
double TargetRightAscension { get; set; }
double TargetDeclination { get; set; }
DriveRates TrackingRate { get; }
void AbortSlew();
void PulseGuide(GuideDirections direction, int duration);
void Park();
void SlewToCoordinates(double rightAscension, double declination);
void SlewToCoordinatesAsync(double rightAscension, double declination);
void SlewToAltAz(double azimuth, double altitude);
void SlewToAltAzAsync(double azimuth, double altitude);
void SyncToTarget();
void SlewToTarget();
void SlewToTargetAsync();
void MoveAxis(TelescopeAxes axis, double rate);
}
}
@@ -0,0 +1,142 @@
using System;
using System.IO.Ports;
using System.Runtime.InteropServices;
using System.Threading;
namespace ASCOM.MeadeAutostar497.Controller
{
[ComVisible(false)]
public class SerialProcessor : ISerialProcessor
{
private SerialPort _serialPort = new SerialPort();
private Mutex serialMutex = new Mutex();
public bool IsOpen => _serialPort.IsOpen;
public bool DtrEnable
{
get => _serialPort.DtrEnable;
set => _serialPort.DtrEnable = value;
}
public bool RtsEnable
{
get => _serialPort.RtsEnable;
set => _serialPort.RtsEnable = value;
}
public int BaudRate
{
get => _serialPort.BaudRate;
set => _serialPort.BaudRate = value;
}
public int DataBits
{
get => _serialPort.DataBits;
set => _serialPort.DataBits = value;
}
public StopBits StopBits
{
get => _serialPort.StopBits;
set => _serialPort.StopBits = value;
}
public Parity Parity
{
get => _serialPort.Parity;
set => _serialPort.Parity = value;
}
public string PortName
{
get => _serialPort.PortName;
set => _serialPort.PortName = value;
}
public string[] GetPortNames()
{
return SerialPort.GetPortNames();
}
public void Open()
{
_serialPort.ReadTimeout = 5000;
_serialPort.WriteTimeout = 5000;
_serialPort.Open();
}
public void Close()
{
_serialPort.Close();
}
public string CommandTerminated(string command, string terminator)
{
Lock();
try
{
_serialPort.Write(command);
string result = _serialPort.ReadTo("#");
return result;
}
finally
{
Unlock();
}
}
public char CommandChar(string command)
{
Lock();
try
{
_serialPort.Write(command);
var result = _serialPort.ReadChar();
return Convert.ToChar(result);
}
finally
{
Unlock();
}
}
public string ReadTerminated(string terminator)
{
Lock();
try
{
string result = _serialPort.ReadTo("#");
return result;
}
finally
{
Unlock();
}
}
public void Command(string command)
{
Lock();
try
{
_serialPort.Write(command);
}
finally
{
Unlock();
}
}
public void Lock()
{
serialMutex.WaitOne();
}
public void Unlock()
{
serialMutex.ReleaseMutex();
}
}
}
@@ -1,19 +1,27 @@
using System;
using System.IO.Ports;
using System.Linq;
using System.Threading;
using ASCOM.DeviceInterface;
using ASCOM.Utilities;
using ASCOM.Utilities.Interfaces;
namespace ASCOM.MeadeAutostar497.Controller
{
//todo stop this being a singleton, and instead use a server to make only a single instance.
public sealed class TelescopeController : ITelescopeController
{
private static readonly Lazy<TelescopeController> lazy = new Lazy<TelescopeController>();
private const double INVALID_PARAMETER = -1000;
public static TelescopeController Instance => lazy.Value;
private static readonly Lazy<TelescopeController> Lazy = new Lazy<TelescopeController>();
private ISerial _serialPort;
public ISerial SerialPort
public static TelescopeController Instance => Lazy.Value;
//todo remove this as it can cause problems in production
private ISerialProcessor _serialPort;
public ISerialProcessor SerialPort
{
get => _serialPort ?? (_serialPort = new Serial());
get => _serialPort ?? (_serialPort = new SerialProcessor());
set
{
if (_serialPort == value)
@@ -21,14 +29,27 @@ namespace ASCOM.MeadeAutostar497.Controller
if (_serialPort != null)
{
if (_serialPort.Connected)
throw new InvalidOperationException("Please disconnect before changing the port.");
if (_serialPort.IsOpen)
throw new InvalidOperationException("Please disconnect before changing the serial engine.");
}
_serialPort = value;
}
}
private IUtil _util;
public IUtil Util
{
get => _util ?? (_util = new Util());
set
{
if (Equals(_util, value))
return;
_util = value;
}
}
private string _port = "COM1";
public string Port
{
@@ -40,13 +61,21 @@ 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.GetPortNames().Contains(value);
}
public bool Connected
{
get => SerialPort.Connected;
get => SerialPort.IsOpen;
set
{
if (value == Connected)
@@ -55,32 +84,769 @@ 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
{
AtPark = false;
SerialPort.DtrEnable = false;
SerialPort.RtsEnable = false;
SerialPort.BaudRate = 9600;
SerialPort.DataBits = 8;
SerialPort.StopBits = StopBits.One;
SerialPort.Parity = Parity.None;
SerialPort.PortName = Port;
SerialPort.Open();
//todo perform test to ensure that connection has been made correctly.
TestConnectionActive();
}
catch (Exception)
{
if (SerialPort.IsOpen)
SerialPort.Close();
throw;
}
}
else
{
//Disconnecting
SerialPort.Connected = false;
SerialPort.Close();
AtPark = false;
}
}
}
public string CommandString(string command, bool raw)
private void TestConnectionActive()
{
// 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
throw new ASCOM.MethodNotImplementedException("CommandString");
var firmwareVersionNumber = SerialPort.CommandTerminated(":GVN#", "#");
if (string.IsNullOrEmpty(firmwareVersionNumber))
{
throw new InvalidOperationException("Failed to communicate with telescope.");
}
}
public bool Slewing
{
get
{
if (!Connected) return false;
if (movingAxis())
return true;
var result = SerialPort.CommandTerminated(":D#", "#");
return result != string.Empty;
}
}
public DateTime utcDate
{
get
{
string telescopeDate = SerialPort.CommandTerminated(":GC#", "#");
string telescopeTime = SerialPort.CommandTerminated(":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) //todo fix this hack that will create a Y2K100 bug
{
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 utcCorrection = GetUtcCorrection();
//Todo is this telescope local time, or real utc?
var newDate = new DateTime(year, month, day, hour, minute, second, DateTimeKind.Utc) + utcCorrection;
return newDate;
}
set
{
var utcCorrection = GetUtcCorrection();
var localDateTime = value - utcCorrection;
//Todo is this telescope local time, or real utc?
var timeResult = SerialPort.CommandChar($":SL{localDateTime:HH:mm:ss}#");
if (timeResult != '1')
{
throw new InvalidOperationException("Failed to set local time");
}
SerialPort.Lock();
try
{
var dateResult = SerialPort.CommandChar($":SC{localDateTime:MM/dd/yy}#");
if (dateResult != '1')
{
throw new InvalidOperationException("Failed to set local date");
}
//throwing away these two strings which represent
SerialPort.ReadTerminated("#"); //Updating Planetary Data#
SerialPort.ReadTerminated("#"); // #
}
finally
{
SerialPort.Unlock();
}
}
}
private TimeSpan GetUtcCorrection()
{
string utcOffSet = SerialPort.CommandTerminated(":GG#", "#");
double utcOffsetHours = double.Parse(utcOffSet);
TimeSpan utcCorrection = TimeSpan.FromHours(utcOffsetHours);
return utcCorrection;
}
public double SiteLatitude
{
get
{
var latitude = SerialPort.CommandTerminated( ":Gt#", "#");
return DmsToDouble(latitude);
}
set
{
if (value > 90)
throw new InvalidValueException("Latitude cannot be greater than 90 degrees.");
if (value < -90)
throw new InvalidValueException("Latitude cannot be less than -90 degrees.");
int d = Convert.ToInt32(Math.Floor(value));
int m = Convert.ToInt32(60 * (value - d));
var result = SerialPort.CommandChar($":Sts{d:00}*{m:00}#");
if (result != '1')
throw new InvalidOperationException("Failed to set site latitude.");
}
}
private double DmsToDouble(string dms)
{
if (IsNumeric(dms[0]))
{
double l = int.Parse(dms.Substring(0, 3));
l = l + double.Parse(dms.Substring(4, 2)) / 60;
if (dms.Length == 9)
l = l + double.Parse(dms.Substring(7, 2)) / 60 / 60;
return l;
}
double lat = int.Parse(dms.Substring(1, 2));
lat = lat + double.Parse(dms.Substring(4, 2)) / 60;
if (dms.Length == 9)
lat = lat + double.Parse(dms.Substring(7, 2)) / 60 / 60;
if (dms[0] == '-')
lat = -lat;
return lat;
}
private bool IsNumeric(char c)
{
char[] nums = new[] {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};
return nums.Contains(c);
}
public double SiteLongitude
{
get
{
var longitude = SerialPort.CommandTerminated(":Gg#", "#");
double l = DmsToDouble(longitude);
if (l > 180)
l = l - 360;
return l;
}
set
{
if (value > 180)
throw new InvalidValueException("Longitude cannot be greater than 180 degrees.");
if (value < -180)
throw new InvalidValueException("Longitude cannot be lower than -180 degrees.");
int d = Convert.ToInt32(Math.Floor(value));
int m = Convert.ToInt32(60 * (value - d));
var result = SerialPort.CommandChar($":Sg{d:000}*{m:00}#");
if (result != '1')
throw new InvalidOperationException("Failed to set site longitude.");
}
}
public AlignmentModes AlignmentMode
{
get
{
const char ack = (char)6;
//var alignmentString = SerialPort.CommandTerminated(":GW#", "#");
var alignmentString = SerialPort.CommandChar(ack.ToString());
//:GW# Get Scope Alignment Status
//Returns: <mount><tracking><alignment>#
// where:
//mount: A - AzEl mounted, P - Equatorially mounted, G - german mounted equatorial
//tracking: T - tracking, N - not tracking
//alignment: 0 - needs alignment, 1 - one star aligned, 2 - two star aligned, 3 - three star aligned.
switch (alignmentString)
{
case 'A': return AlignmentModes.algAltAz;
case 'P': return AlignmentModes.algPolar;
case 'G': return AlignmentModes.algGermanPolar;
default:
throw new InvalidValueException($"unknown alignment returned from telescope: {alignmentString}");
}
}
set
{
switch (value)
{
case AlignmentModes.algAltAz:
SerialPort.Command(":AA#");
//:AA# Sets telescope the AltAz alignment mode
//Returns: nothing
break;
case AlignmentModes.algPolar:
case AlignmentModes.algGermanPolar:
SerialPort.Command(":AP#");
//:AP# Sets telescope to Polar alignment mode
//Returns: nothing
break;
default:
throw new ArgumentOutOfRangeException(nameof(value), value, null);
}
//:AL# Sets telescope to Land alignment mode
//Returns: nothing
}
}
public bool AtPark { get; private set; }
public double Azimuth
{
get
{
var result = SerialPort.CommandTerminated(":GZ#", "#");
//:GZ# Get telescope azimuth
//Returns: DDD*MM#T or DDD*MMSS#
//The current telescope Azimuth depending on the selected precision.
double az = DmsToDouble(result);
return az;
}
}
public double RightAscension {
get
{
var result = SerialPort.CommandTerminated(":GR#", "#");
//:GR# Get Telescope RA
//Returns: HH: MM.T# or HH:MM:SS#
//Depending which precision is set for the telescope
double ra = HmsToDouble(result);
return ra;
}
}
private double HmsToDouble(string hms)
{
return Util.HMSToHours(hms);
}
public double Declination
{
get
{
var result = SerialPort.CommandTerminated(":GD#", "#");
//:GD# Get Telescope Declination.
//Returns: sDD* MM# or sDD*MMSS#
//Depending upon the current precision setting for the telescope.
double az = DmsToDouble(result);
return az;
}
}
private double _targetRightAscension = INVALID_PARAMETER;
public double TargetRightAscension {
get
{
if (_targetRightAscension == INVALID_PARAMETER)
throw new ASCOM.InvalidOperationException("Target not set");
//var result = SerialPort.CommandTerminated(":Gr#", "#");
////:Gr# Get current/target object RA
////Returns: HH: MM.T# or HH:MM:SS
////Depending upon which precision is set for the telescope
//double targetRa = HmsToDouble(result);
//return targetRa;
return _targetRightAscension;
}
set
{
if (value < 0)
throw new InvalidValueException("Right ascension value cannot be below 0");
if (value >= 24)
throw new InvalidValueException("Right ascension value cannot be greater than 23:59:59");
//todo implement the low precision version
var hms = Util.HoursToHMS(value, ":", ":", ":", 2);
var response = SerialPort.CommandChar($":Sr{hms}#");
//:SrHH:MM.T#
//:SrHH:MM:SS#
//Set target object RA to HH:MM.T or HH: MM: SS depending on the current precision setting.
// Returns:
//0 Invalid
//1 - Valid
if (response == '0')
throw new InvalidOperationException("Failed to set TargetRightAscension.");
_targetRightAscension = value;
}
}
private double _targetDeclination = INVALID_PARAMETER;
public double TargetDeclination {
get
{
if (_targetDeclination == INVALID_PARAMETER)
throw new ASCOM.InvalidOperationException("Target not set");
//var result = SerialPort.CommandTerminated(":Gd#", "#");
////:Gd# Get Currently Selected Object/Target Declination
////Returns: sDD* MM# or sDD*MMSS#
////Depending upon the current precision setting for the telescope.
//double targetDec = DmsToDouble(result);
//return targetDec;
return _targetDeclination;
}
set
{
//todo implement low precision version of this.
if (value > 90)
throw new ASCOM.InvalidValueException("Declination cannot be greater than 90.");
if (value < -90)
throw new ASCOM.InvalidValueException("Declination cannot be less than -90.");
var dms = Util.DegreesToDMS(value, "*", ":", ":", 2);
var s = value < 0 ? '-' : '+';
var result = SerialPort.CommandChar($":Sd{s}{dms}#");
//:SdsDD*MM#
//Set target object declination to sDD*MM or sDD*MM:SS depending on the current precision setting
//Returns:
//1 - Dec Accepted
//0 Dec invalid
if (result == '0')
{
throw new ASCOM.InvalidOperationException("Target declination invalid");
}
_targetDeclination = value;
}
}
public DriveRates TrackingRate
{
get
{
var result = SerialPort.CommandTerminated(":GT#", "#");
double rate = double.Parse(result);
if (rate == 60.1)
return DriveRates.driveLunar;
else if (rate == 60.1)
return DriveRates.driveSidereal;
return DriveRates.driveKing;
}
set
{
switch (value)
{
case DriveRates.driveSidereal:
SerialPort.Command(":TQ#");
//:TQ# Selects sidereal tracking rate
//Returns: Nothing
break;
case DriveRates.driveLunar:
SerialPort.Command(":TL#");
//:TL# Set Lunar Tracking Rage
//Returns: Nothing
break;
case DriveRates.driveSolar:
SerialPort.Command(":TS#");
//:TS# Select Solar tracking rate. [LS Only]
//Returns: Nothing
break;
case DriveRates.driveKing:
break;
default:
throw new ArgumentOutOfRangeException(nameof(value), value, null);
}
}
}
public double Altitude {
get
{
var result = SerialPort.CommandTerminated(":GA#", "#");
//:GA# Get Telescope Altitude
//Returns: sDD* MM# or sDD*MMSS#
//The current scope altitude. The returned format depending on the current precision setting.
return DmsToDouble(result);
}
}
public void AbortSlew()
{
SerialPort.Command("#:Q#");
}
public void PulseGuide(GuideDirections direction, int duration)
{
string d = string.Empty;
switch (direction)
{
case GuideDirections.guideEast:
d = "e";
break;
case GuideDirections.guideNorth:
d = "n";
break;
case GuideDirections.guideSouth:
d = "s";
break;
case GuideDirections.guideWest:
d = "w";
break;
}
if (UserNewerPulseGuiding)
{
_serialPort.Command($":Mg{d}{duration:0000}#");
Thread.Sleep(duration); //todo figure out if this is really needed
}
else
{
_serialPort.Command(":RG#"); //Make sure we are at guide rate
_serialPort.Command($":M{d}#");
Thread.Sleep(duration);
_serialPort.Command($":Q{d}#");
//classic only !!!, this is needed since once in a while one is not enough
Thread.Sleep(200);
_serialPort.Command($":Q{d}#");
}
}
public void Park()
{
if (AtPark)
return;
AtPark = true;
_serialPort.Command(":hP#");
}
public void SlewToCoordinates(double rightAscension, double declination)
{
SlewToCoordinatesAsync(rightAscension, declination);
while (Slewing) //wait for slew to complete
{
Util.WaitForMilliseconds(200); //be responsive to AbortSlew();
}
}
public void SlewToCoordinatesAsync(double rightAscension, double declination)
{
TargetRightAscension = rightAscension;
TargetDeclination = declination;
DoSlewAsync(true);
}
public void SlewToAltAz(double azimuth, double altitude)
{
SlewToAltAzAsync(azimuth, altitude);
while (Slewing) //wait for slew to complete
{
Util.WaitForMilliseconds(200); //be responsive to AbortSlew();
}
}
private double TargetAltitude
{
set
{
if (value > 90)
throw new ASCOM.InvalidValueException("Altitude cannot be greater than 90.");
if (value < 0)
throw new ASCOM.InvalidValueException("Altitide cannot be less than 0.");
var dms = Util.DegreesToDMS(value, "*", "'", ".", 2);
var s = value < 0 ? '-' : '+';
var result = SerialPort.CommandChar($":Sa{s}{dms}#");
//:SasDD*MM#
//Set target object altitude to sDD*MM# or sDD*MMSS# [LX 16”, Autostar, Autostar II]
//Returns:
//1 Object within slew range
//0 Object out of slew range
if (result == '0')
throw new ASCOM.InvalidOperationException("Target altitude out of slew range");
}
}
private double TargetAzimuth
{
set
{
if (value >= 360)
throw new ASCOM.InvalidValueException("Azimuth cannot be 360 or higher.");
if (value < 0)
throw new ASCOM.InvalidValueException("Azimuth cannot be less than 0.");
var dms = Util.DegreesToDM(value, "*", ":", 2);
var result = SerialPort.CommandChar($":Sd{dms}#");
//:SzDDD*MM#
//Sets the target Object Azimuth[LX 16” and Autostar II only]
//Returns:
//0 Invalid
//1 - Valid
if (result == '0')
throw new ASCOM.InvalidOperationException("Target Azimuth out of slew range");
}
}
public void SlewToAltAzAsync(double azimuth, double altitude)
{
TargetAltitude = altitude;
TargetAzimuth = azimuth;
DoSlewAsync(false);
}
public void SyncToTarget()
{
var result = SerialPort.CommandTerminated(":CM#", "#");
//:CM# Synchronizes the telescope's position with the currently selected database object's coordinates.
//Returns:
//LX200's - a "#" terminated string with the name of the object that was synced.
// Autostars & Autostar II - At static string: " M31 EX GAL MAG 3.5 SZ178.0'#"
if (result == string.Empty)
throw new ASCOM.InvalidOperationException("Unable to perform sync");
}
public void SlewToTarget()
{
SlewToTargetAsync();
while (Slewing)
{
Util.WaitForMilliseconds(200);
}
}
public void SlewToTargetAsync()
{
if (TargetDeclination == INVALID_PARAMETER || TargetRightAscension == INVALID_PARAMETER )
throw new ASCOM.InvalidOperationException("No target selected to slew to.");
DoSlewAsync(true);
}
private bool movingAxis()
{
return _movingPrimary || _movingSecondary;
}
private bool _movingPrimary;
private bool _movingSecondary;
public void MoveAxis(TelescopeAxes axis, double rate)
{
var absrate = Math.Abs(rate);
switch(absrate)
{
case 0:
//do nothing, it's ok this time as we're halting the slew.
break;
case 1:
SerialPort.Command(":RG#");
//:RG# Set Slew rate to Guiding Rate (slowest)
//Returns: Nothing
break;
case 2:
SerialPort.Command(":RC#");
//:RC# Set Slew rate to Centering rate (2nd slowest)
//Returns: Nothing
break;
case 3:
SerialPort.Command(":RM#");
//:RM# Set Slew rate to Find Rate (2nd Fastest)
//Returns: Nothing
break;
case 4:
SerialPort.Command(":RS#");
//:RS# Set Slew rate to max (fastest)
//Returns: Nothing
break;
default:
throw new ASCOM.InvalidValueException($"Rate {rate} not supported");
}
switch (axis)
{
case TelescopeAxes.axisPrimary:
if (rate == 0)
{
_movingPrimary = false;
SerialPort.Command(":Qe#");
//:Qe# Halt eastward Slews
//Returns: Nothing
SerialPort.Command(":Qw#");
//:Qw# Halt westward Slews
//Returns: Nothing
}
else if (rate > 0)
{
SerialPort.Command(":Me#");
//:Me# Move Telescope East at current slew rate
//Returns: Nothing
_movingPrimary = true;
}
else
{
SerialPort.Command(":Mw#");
//:Mw# Move Telescope West at current slew rate
//Returns: Nothing
_movingPrimary = true;
}
break;
case TelescopeAxes.axisSecondary:
if (rate == 0)
{
_movingSecondary = false;
SerialPort.Command(":Qn#");
//:Qn# Halt northward Slews
//Returns: Nothing
SerialPort.Command(":Qs#");
//:Qs# Halt southward Slews
//Returns: Nothing
}
else if (rate > 0)
{
SerialPort.Command(":Mn#");
//:Mn# Move Telescope North at current slew rate
//Returns: Nothing
_movingSecondary = true;
}
else
{
SerialPort.Command(":Ms#");
//:Ms# Move Telescope South at current slew rate
//Returns: Nothing
_movingSecondary = true;
}
break;
default:
throw new ASCOM.MethodNotImplementedException("Can not move this axis.");
}
}
//todo remove the polar parameter and split method into two.
private void DoSlewAsync( bool polar)
{
switch (polar)
{
case true:
var response = SerialPort.CommandChar(":MS#");
//:MS# Slew to Target Object
//Returns:
//0 Slew is Possible
//1<string># Object Below Horizon w/string message
//2<string># Object Below Higher w/string message
switch (response)
{
case '0':
//We're slewing everything should be working just fine.
break;
case '1':
//Below Horizon
string belowHorizonMessage = SerialPort.ReadTerminated("#");
throw new ASCOM.InvalidOperationException(belowHorizonMessage);
case '2':
//Below Horizon
string belowMinimumElevationMessage = SerialPort.ReadTerminated("#");
throw new ASCOM.InvalidOperationException(belowMinimumElevationMessage);
default:
throw new ASCOM.DriverException("This error should not happen");
}
break;
case false:
var maResponse = SerialPort.CommandChar(":MA#");
//:MA# Autostar, LX 16”, Autostar II Slew to target Alt and Az
//Returns:
//0 - No fault
//1 Fault
// LX200 Not supported
if (maResponse == '1')
{
throw new ASCOM.InvalidOperationException("fault");
}
break;
}
}
public bool UserNewerPulseGuiding { get; set; } = true; //todo make this a device setting
}
}
+17 -4
View File
@@ -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>
@@ -45,7 +46,8 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<RegisterForComInterop>true</RegisterForComInterop>
<PlatformTarget>AnyCPU</PlatformTarget>
<PlatformTarget>x64</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,22 @@
</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\ISerialProcessor.cs" />
<Compile Include="Controller\ITelescopeController.cs" />
<Compile Include="Controller\SerialProcessor.cs" />
<Compile Include="Controller\TelescopeController.cs" />
<Compile Include="StringExtensions.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
+5 -5
View File
@@ -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
View File
@@ -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
View File
@@ -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;
}
}
+16
View File
@@ -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);
}
}
}
+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.0,Profile=Client"/></startup></configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2"/></startup></configuration>