Refactor all LogMessage commands via LogMessage Method instead of directory to dependent class

This commit is contained in:
2019-07-13 16:15:58 +01:00
parent 8089e8d536
commit bd49a86866
+104 -107
View File
@@ -101,13 +101,13 @@ namespace ASCOM.Meade.net
{ {
//todo move the TraceLogger out to a factory class. //todo move the TraceLogger out to a factory class.
tl = new TraceLogger("", "Meade.net.Telescope"); tl = new TraceLogger("", "Meade.net.Telescope");
tl.LogMessage("Telescope", "Starting initialisation"); LogMessage("Telescope", "Starting initialisation");
ReadProfile(); // Read device configuration from the ASCOM Profile store ReadProfile(); // Read device configuration from the ASCOM Profile store
IsConnected = false; // Initialise connected to false IsConnected = false; // Initialise connected to false
tl.LogMessage("Telescope", "Completed initialisation"); LogMessage("Telescope", "Completed initialisation");
} }
@@ -125,10 +125,10 @@ namespace ASCOM.Meade.net
/// </summary> /// </summary>
public void SetupDialog() public void SetupDialog()
{ {
tl.LogMessage("SetupDialog", "Opening setup dialog"); LogMessage("SetupDialog", "Opening setup dialog");
_sharedResourcesWrapper.SetupDialog(); _sharedResourcesWrapper.SetupDialog();
ReadProfile(); ReadProfile();
tl.LogMessage("SetupDialog", "complete"); LogMessage("SetupDialog", "complete");
//// consider only showing the setup dialog if not connected //// consider only showing the setup dialog if not connected
//// or call a different dialog if connected //// or call a different dialog if connected
//if (IsConnected) //if (IsConnected)
@@ -148,7 +148,7 @@ namespace ASCOM.Meade.net
{ {
get get
{ {
tl.LogMessage("SupportedActions Get", "Returning empty arraylist"); LogMessage("SupportedActions Get", "Returning empty arraylist");
var supportedActions = new ArrayList(); var supportedActions = new ArrayList();
supportedActions.Add("handbox"); supportedActions.Add("handbox");
return supportedActions; return supportedActions;
@@ -293,7 +293,7 @@ namespace ASCOM.Meade.net
} }
set set
{ {
tl.LogMessage("Connected", "Set {0}", value); LogMessage("Connected", "Set {0}", value);
if (value == IsConnected) if (value == IsConnected)
return; return;
@@ -305,14 +305,11 @@ namespace ASCOM.Meade.net
_sharedResourcesWrapper.Connect("Serial"); _sharedResourcesWrapper.Connect("Serial");
try try
{ {
LogMessage("Connected Set", $"Commented to port {comPort}. Product: {_sharedResourcesWrapper.ProductName} Version:{_sharedResourcesWrapper.FirmwareVersion}"); LogMessage("Connected Set", $"Connected to port {comPort}. Product: {_sharedResourcesWrapper.ProductName} Version:{_sharedResourcesWrapper.FirmwareVersion}");
//SelectSite(1);
SetLongFormat(true); SetLongFormat(true);
_userNewerPulseGuiding = IsNewPulseGuidingSupported(); _userNewerPulseGuiding = IsNewPulseGuidingSupported();
LogMessage("Connected Set", $"New Pulse Guiding Supported: {_userNewerPulseGuiding}");
IsConnected = true; IsConnected = true;
} }
@@ -336,7 +333,7 @@ namespace ASCOM.Meade.net
} }
} }
private bool IsNewPulseGuidingSupported() public bool IsNewPulseGuidingSupported()
{ {
if (_sharedResourcesWrapper.ProductName == _sharedResourcesWrapper.AUTOSTAR497) if (_sharedResourcesWrapper.ProductName == _sharedResourcesWrapper.AUTOSTAR497)
{ {
@@ -394,7 +391,7 @@ namespace ASCOM.Meade.net
// TODO customise this device description // TODO customise this device description
get get
{ {
tl.LogMessage("Description Get", driverDescription); LogMessage("Description Get", driverDescription);
return driverDescription; return driverDescription;
} }
} }
@@ -407,7 +404,7 @@ namespace ASCOM.Meade.net
// TODO customise this driver description // TODO customise this driver description
string driverInfo = "Meade Generic .net driver. Version: " + String.Format(CultureInfo.InvariantCulture, "{0}.{1}", version.Major, string driverInfo = "Meade Generic .net driver. Version: " + String.Format(CultureInfo.InvariantCulture, "{0}.{1}", version.Major,
version.Minor); version.Minor);
tl.LogMessage("DriverInfo Get", driverInfo); LogMessage("DriverInfo Get", driverInfo);
return driverInfo; return driverInfo;
} }
} }
@@ -419,7 +416,7 @@ namespace ASCOM.Meade.net
Version version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version; Version version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
string driverVersion = string driverVersion =
String.Format(CultureInfo.InvariantCulture, "{0}.{1}", version.Major, version.Minor); String.Format(CultureInfo.InvariantCulture, "{0}.{1}", version.Major, version.Minor);
tl.LogMessage("DriverVersion Get", driverVersion); LogMessage("DriverVersion Get", driverVersion);
return driverVersion; return driverVersion;
} }
} }
@@ -450,7 +447,7 @@ namespace ASCOM.Meade.net
//string name = $"{telescopeProduceName} - {firmwareVersion}"; //string name = $"{telescopeProduceName} - {firmwareVersion}";
string name = driverDescription; string name = driverDescription;
tl.LogMessage("Name Get", name); LogMessage("Name Get", name);
return name; return name;
} }
} }
@@ -463,7 +460,7 @@ namespace ASCOM.Meade.net
{ {
CheckConnected("AbortSlew"); CheckConnected("AbortSlew");
tl.LogMessage("AbortSlew", "Aborting slew"); LogMessage("AbortSlew", "Aborting slew");
_sharedResourcesWrapper.SendBlind(":Q#"); _sharedResourcesWrapper.SendBlind(":Q#");
//:Q# Halt all current slewing //:Q# Halt all current slewing
//Returns:Nothing //Returns:Nothing
@@ -473,7 +470,7 @@ namespace ASCOM.Meade.net
{ {
get get
{ {
tl.LogMessage("AlignmentMode Get", "Getting alignmode"); LogMessage("AlignmentMode Get", "Getting alignmode");
CheckConnected("AlignmentMode Get"); CheckConnected("AlignmentMode Get");
@@ -513,7 +510,7 @@ namespace ASCOM.Meade.net
$"unknown alignment returned from telescope: {alignmentString}"); $"unknown alignment returned from telescope: {alignmentString}");
} }
tl.LogMessage("AlignmentMode Get", $"alignmode = {alignmentMode}"); LogMessage("AlignmentMode Get", $"alignmode = {alignmentMode}");
return alignmentMode; return alignmentMode;
} }
set set
@@ -549,7 +546,7 @@ namespace ASCOM.Meade.net
CheckConnected("Altitude get"); CheckConnected("Altitude get");
var altAz = CalcAltAzFromTelescopeEqData(); var altAz = CalcAltAzFromTelescopeEqData();
tl.LogMessage("Altitude", $"{altAz.Altitude}"); LogMessage("Altitude", $"{altAz.Altitude}");
return altAz.Altitude; return altAz.Altitude;
////todo firmware bug in 44Eg, :GA# is returning the dec, not the altitude! ////todo firmware bug in 44Eg, :GA# is returning the dec, not the altitude!
@@ -559,10 +556,10 @@ namespace ASCOM.Meade.net
////The current scope altitude. The returned format depending on the current precision setting. ////The current scope altitude. The returned format depending on the current precision setting.
//var alt = utilities.DMSToDegrees(result); //var alt = utilities.DMSToDegrees(result);
//tl.LogMessage("Altitude", $"{alt}"); //LogMessage("Altitude", $"{alt}");
//return alt; //return alt;
//tl.LogMessage("Altitude Get", "Not implemented"); //LogMessage("Altitude Get", "Not implemented");
//throw new ASCOM.PropertyNotImplementedException("Altitude", false); //throw new ASCOM.PropertyNotImplementedException("Altitude", false);
} }
} }
@@ -591,7 +588,7 @@ namespace ASCOM.Meade.net
{ {
get get
{ {
tl.LogMessage("ApertureArea Get", "Not implemented"); LogMessage("ApertureArea Get", "Not implemented");
throw new ASCOM.PropertyNotImplementedException("ApertureArea", false); throw new ASCOM.PropertyNotImplementedException("ApertureArea", false);
} }
} }
@@ -600,7 +597,7 @@ namespace ASCOM.Meade.net
{ {
get get
{ {
tl.LogMessage("ApertureDiameter Get", "Not implemented"); LogMessage("ApertureDiameter Get", "Not implemented");
throw new ASCOM.PropertyNotImplementedException("ApertureDiameter", false); throw new ASCOM.PropertyNotImplementedException("ApertureDiameter", false);
} }
} }
@@ -609,7 +606,7 @@ namespace ASCOM.Meade.net
{ {
get get
{ {
tl.LogMessage("AtHome", "Get - " + false.ToString()); LogMessage("AtHome", "Get - " + false.ToString());
return false; return false;
} }
} }
@@ -620,7 +617,7 @@ namespace ASCOM.Meade.net
{ {
get get
{ {
tl.LogMessage("AtPark", "Get - " + _atPark); LogMessage("AtPark", "Get - " + _atPark);
return _atPark; return _atPark;
} }
private set { _atPark = value; } private set { _atPark = value; }
@@ -628,7 +625,7 @@ namespace ASCOM.Meade.net
public IAxisRates AxisRates(TelescopeAxes Axis) public IAxisRates AxisRates(TelescopeAxes Axis)
{ {
tl.LogMessage("AxisRates", "Get - " + Axis.ToString()); LogMessage("AxisRates", "Get - " + Axis.ToString());
return new AxisRates(Axis); return new AxisRates(Axis);
} }
@@ -645,11 +642,11 @@ namespace ASCOM.Meade.net
//double az = utilities.DMSToDegrees(result); //double az = utilities.DMSToDegrees(result);
//tl.LogMessage("Azimuth Get", $"{az}"); //LogMessage("Azimuth Get", $"{az}");
//return az; //return az;
var altAz = CalcAltAzFromTelescopeEqData(); var altAz = CalcAltAzFromTelescopeEqData();
tl.LogMessage("Azimuth Get", $"{altAz.Azimuth}"); LogMessage("Azimuth Get", $"{altAz.Azimuth}");
return altAz.Azimuth; return altAz.Azimuth;
} }
} }
@@ -658,14 +655,14 @@ namespace ASCOM.Meade.net
{ {
get get
{ {
tl.LogMessage("CanFindHome", "Get - " + false.ToString()); LogMessage("CanFindHome", "Get - " + false.ToString());
return false; return false;
} }
} }
public bool CanMoveAxis(TelescopeAxes Axis) public bool CanMoveAxis(TelescopeAxes Axis)
{ {
tl.LogMessage("CanMoveAxis", "Get - " + Axis.ToString()); LogMessage("CanMoveAxis", "Get - " + Axis.ToString());
switch (Axis) switch (Axis)
{ {
case TelescopeAxes.axisPrimary: return true; //RA or AZ case TelescopeAxes.axisPrimary: return true; //RA or AZ
@@ -679,7 +676,7 @@ namespace ASCOM.Meade.net
{ {
get get
{ {
tl.LogMessage("CanPark", "Get - " + true.ToString()); LogMessage("CanPark", "Get - " + true.ToString());
return true; return true;
} }
} }
@@ -688,7 +685,7 @@ namespace ASCOM.Meade.net
{ {
get get
{ {
tl.LogMessage("CanPulseGuide", "Get - " + true.ToString()); LogMessage("CanPulseGuide", "Get - " + true.ToString());
return true; return true;
} }
} }
@@ -697,7 +694,7 @@ namespace ASCOM.Meade.net
{ {
get get
{ {
tl.LogMessage("CanSetDeclinationRate", "Get - " + false.ToString()); LogMessage("CanSetDeclinationRate", "Get - " + false.ToString());
return false; return false;
} }
} }
@@ -706,7 +703,7 @@ namespace ASCOM.Meade.net
{ {
get get
{ {
tl.LogMessage("CanSetGuideRates", "Get - " + false.ToString()); LogMessage("CanSetGuideRates", "Get - " + false.ToString());
return false; return false;
} }
} }
@@ -715,7 +712,7 @@ namespace ASCOM.Meade.net
{ {
get get
{ {
tl.LogMessage("CanSetPark", "Get - " + false.ToString()); LogMessage("CanSetPark", "Get - " + false.ToString());
return false; return false;
} }
} }
@@ -724,7 +721,7 @@ namespace ASCOM.Meade.net
{ {
get get
{ {
tl.LogMessage("CanSetPierSide", "Get - " + false.ToString()); LogMessage("CanSetPierSide", "Get - " + false.ToString());
return false; return false;
} }
} }
@@ -733,7 +730,7 @@ namespace ASCOM.Meade.net
{ {
get get
{ {
tl.LogMessage("CanSetRightAscensionRate", "Get - " + false.ToString()); LogMessage("CanSetRightAscensionRate", "Get - " + false.ToString());
return false; return false;
} }
} }
@@ -742,7 +739,7 @@ namespace ASCOM.Meade.net
{ {
get get
{ {
tl.LogMessage("CanSetTracking", "Get - " + true.ToString()); LogMessage("CanSetTracking", "Get - " + true.ToString());
return true; return true;
} }
} }
@@ -751,7 +748,7 @@ namespace ASCOM.Meade.net
{ {
get get
{ {
tl.LogMessage("CanSlew", "Get - " + true.ToString()); LogMessage("CanSlew", "Get - " + true.ToString());
return true; return true;
} }
} }
@@ -760,7 +757,7 @@ namespace ASCOM.Meade.net
{ {
get get
{ {
tl.LogMessage("CanSlewAltAz", "Get - " + true.ToString()); LogMessage("CanSlewAltAz", "Get - " + true.ToString());
return true; return true;
} }
} }
@@ -769,7 +766,7 @@ namespace ASCOM.Meade.net
{ {
get get
{ {
tl.LogMessage("CanSlewAltAzAsync", "Get - " + true.ToString()); LogMessage("CanSlewAltAzAsync", "Get - " + true.ToString());
return true; return true;
} }
} }
@@ -778,7 +775,7 @@ namespace ASCOM.Meade.net
{ {
get get
{ {
tl.LogMessage("CanSlewAsync", "Get - " + true.ToString()); LogMessage("CanSlewAsync", "Get - " + true.ToString());
return true; return true;
} }
} }
@@ -787,7 +784,7 @@ namespace ASCOM.Meade.net
{ {
get get
{ {
tl.LogMessage("CanSync", "Get - " + true.ToString()); LogMessage("CanSync", "Get - " + true.ToString());
return true; return true;
} }
} }
@@ -796,7 +793,7 @@ namespace ASCOM.Meade.net
{ {
get get
{ {
tl.LogMessage("CanSyncAltAz", "Get - " + false.ToString()); LogMessage("CanSyncAltAz", "Get - " + false.ToString());
return false; return false;
} }
} }
@@ -805,7 +802,7 @@ namespace ASCOM.Meade.net
{ {
get get
{ {
tl.LogMessage("CanUnpark", "Get - " + false.ToString()); LogMessage("CanUnpark", "Get - " + false.ToString());
return false; return false;
} }
} }
@@ -823,7 +820,7 @@ namespace ASCOM.Meade.net
double declination = _utilities.DMSToDegrees(result); double declination = _utilities.DMSToDegrees(result);
tl.LogMessage("Declination", "Get - " + _utilitiesExtra.DegreesToDMS(declination, ":", ":")); LogMessage("Declination", "Get - " + _utilitiesExtra.DegreesToDMS(declination, ":", ":"));
return declination; return declination;
} }
} }
@@ -833,19 +830,19 @@ namespace ASCOM.Meade.net
get get
{ {
double declination = 0.0; double declination = 0.0;
tl.LogMessage("DeclinationRate", "Get - " + declination.ToString()); LogMessage("DeclinationRate", "Get - " + declination.ToString());
return declination; return declination;
} }
set set
{ {
tl.LogMessage("DeclinationRate Set", "Not implemented"); LogMessage("DeclinationRate Set", "Not implemented");
throw new ASCOM.PropertyNotImplementedException("DeclinationRate", true); throw new ASCOM.PropertyNotImplementedException("DeclinationRate", true);
} }
} }
public PierSide DestinationSideOfPier(double rightAscension, double declination) public PierSide DestinationSideOfPier(double rightAscension, double declination)
{ {
tl.LogMessage("DestinationSideOfPier Get", "Not implemented"); LogMessage("DestinationSideOfPier Get", "Not implemented");
throw new ASCOM.PropertyNotImplementedException("DestinationSideOfPier", false); throw new ASCOM.PropertyNotImplementedException("DestinationSideOfPier", false);
} }
@@ -853,12 +850,12 @@ namespace ASCOM.Meade.net
{ {
get get
{ {
tl.LogMessage("DoesRefraction Get", "Not implemented"); LogMessage("DoesRefraction Get", "Not implemented");
throw new ASCOM.PropertyNotImplementedException("DoesRefraction", false); throw new ASCOM.PropertyNotImplementedException("DoesRefraction", false);
} }
set set
{ {
tl.LogMessage("DoesRefraction Set", "Not implemented"); LogMessage("DoesRefraction Set", "Not implemented");
throw new ASCOM.PropertyNotImplementedException("DoesRefraction", true); throw new ASCOM.PropertyNotImplementedException("DoesRefraction", true);
} }
} }
@@ -868,14 +865,14 @@ namespace ASCOM.Meade.net
get get
{ {
EquatorialCoordinateType equatorialSystem = EquatorialCoordinateType.equTopocentric; EquatorialCoordinateType equatorialSystem = EquatorialCoordinateType.equTopocentric;
tl.LogMessage("DeclinationRate", "Get - " + equatorialSystem.ToString()); LogMessage("DeclinationRate", "Get - " + equatorialSystem.ToString());
return equatorialSystem; return equatorialSystem;
} }
} }
public void FindHome() public void FindHome()
{ {
tl.LogMessage("FindHome", "Not implemented"); LogMessage("FindHome", "Not implemented");
throw new ASCOM.MethodNotImplementedException("FindHome"); throw new ASCOM.MethodNotImplementedException("FindHome");
} }
@@ -883,7 +880,7 @@ namespace ASCOM.Meade.net
{ {
get get
{ {
tl.LogMessage("FocalLength Get", "Not implemented"); LogMessage("FocalLength Get", "Not implemented");
throw new ASCOM.PropertyNotImplementedException("FocalLength", false); throw new ASCOM.PropertyNotImplementedException("FocalLength", false);
} }
} }
@@ -892,12 +889,12 @@ namespace ASCOM.Meade.net
{ {
get get
{ {
tl.LogMessage("GuideRateDeclination Get", "Not implemented"); LogMessage("GuideRateDeclination Get", "Not implemented");
throw new ASCOM.PropertyNotImplementedException("GuideRateDeclination", false); throw new ASCOM.PropertyNotImplementedException("GuideRateDeclination", false);
} }
set set
{ {
tl.LogMessage("GuideRateDeclination Set", "Not implemented"); LogMessage("GuideRateDeclination Set", "Not implemented");
throw new ASCOM.PropertyNotImplementedException("GuideRateDeclination", true); throw new ASCOM.PropertyNotImplementedException("GuideRateDeclination", true);
} }
} }
@@ -906,12 +903,12 @@ namespace ASCOM.Meade.net
{ {
get get
{ {
tl.LogMessage("GuideRateRightAscension Get", "Not implemented"); LogMessage("GuideRateRightAscension Get", "Not implemented");
throw new ASCOM.PropertyNotImplementedException("GuideRateRightAscension", false); throw new ASCOM.PropertyNotImplementedException("GuideRateRightAscension", false);
} }
set set
{ {
tl.LogMessage("GuideRateRightAscension Set", "Not implemented"); LogMessage("GuideRateRightAscension Set", "Not implemented");
throw new ASCOM.PropertyNotImplementedException("GuideRateRightAscension", true); throw new ASCOM.PropertyNotImplementedException("GuideRateRightAscension", true);
} }
} }
@@ -920,7 +917,7 @@ namespace ASCOM.Meade.net
{ {
get get
{ {
tl.LogMessage("IsPulseGuiding Get", "pulse guiding is synchronous for this driver"); LogMessage("IsPulseGuiding Get", "pulse guiding is synchronous for this driver");
//throw new ASCOM.PropertyNotImplementedException("IsPulseGuiding", false); //throw new ASCOM.PropertyNotImplementedException("IsPulseGuiding", false);
return false; return false;
} }
@@ -931,7 +928,7 @@ namespace ASCOM.Meade.net
public void MoveAxis(TelescopeAxes axis, double rate) public void MoveAxis(TelescopeAxes axis, double rate)
{ {
tl.LogMessage("MoveAxis", $"Axis={axis} rate={rate}"); LogMessage("MoveAxis", $"Axis={axis} rate={rate}");
CheckConnected("MoveAxis"); CheckConnected("MoveAxis");
var absRate = Math.Abs(rate); var absRate = Math.Abs(rate);
@@ -1028,7 +1025,7 @@ namespace ASCOM.Meade.net
public void Park() public void Park()
{ {
tl.LogMessage("Park", "Parking telescope"); LogMessage("Park", "Parking telescope");
CheckConnected("Park"); CheckConnected("Park");
if (AtPark) if (AtPark)
@@ -1044,7 +1041,7 @@ namespace ASCOM.Meade.net
public void PulseGuide(GuideDirections direction, int duration) public void PulseGuide(GuideDirections direction, int duration)
{ {
tl.LogMessage("PulseGuide", $"pulse guide direction {direction} duration {duration}"); LogMessage("PulseGuide", $"pulse guide direction {direction} duration {duration}");
CheckConnected("PulseGuide"); CheckConnected("PulseGuide");
string d = string.Empty; string d = string.Empty;
@@ -1120,7 +1117,7 @@ namespace ASCOM.Meade.net
double rightAscension = _utilities.HMSToHours(result); double rightAscension = _utilities.HMSToHours(result);
tl.LogMessage("RightAscension", "Get - " + _utilitiesExtra.HoursToHMS(rightAscension)); LogMessage("RightAscension", "Get - " + _utilitiesExtra.HoursToHMS(rightAscension));
return rightAscension; return rightAscension;
} }
} }
@@ -1130,19 +1127,19 @@ namespace ASCOM.Meade.net
get get
{ {
double rightAscensionRate = 0.0; double rightAscensionRate = 0.0;
tl.LogMessage("RightAscensionRate", "Get - " + rightAscensionRate.ToString()); LogMessage("RightAscensionRate", "Get - " + rightAscensionRate.ToString());
return rightAscensionRate; return rightAscensionRate;
} }
set set
{ {
tl.LogMessage("RightAscensionRate Set", "Not implemented"); LogMessage("RightAscensionRate Set", "Not implemented");
throw new ASCOM.PropertyNotImplementedException("RightAscensionRate", true); throw new ASCOM.PropertyNotImplementedException("RightAscensionRate", true);
} }
} }
public void SetPark() public void SetPark()
{ {
tl.LogMessage("SetPark", "Not implemented"); LogMessage("SetPark", "Not implemented");
throw new ASCOM.MethodNotImplementedException("SetPark"); throw new ASCOM.MethodNotImplementedException("SetPark");
} }
@@ -1150,12 +1147,12 @@ namespace ASCOM.Meade.net
{ {
get get
{ {
tl.LogMessage("SideOfPier Get", "Not implemented"); LogMessage("SideOfPier Get", "Not implemented");
throw new ASCOM.PropertyNotImplementedException("SideOfPier", false); throw new ASCOM.PropertyNotImplementedException("SideOfPier", false);
} }
set set
{ {
tl.LogMessage("SideOfPier Set", "Not implemented"); LogMessage("SideOfPier Set", "Not implemented");
throw new ASCOM.PropertyNotImplementedException("SideOfPier", true); throw new ASCOM.PropertyNotImplementedException("SideOfPier", true);
} }
} }
@@ -1181,7 +1178,7 @@ namespace ASCOM.Meade.net
// Reduce to the range 0 to 24 hours // Reduce to the range 0 to 24 hours
siderealTime = _astroUtilities.ConditionRA(siderealTime); siderealTime = _astroUtilities.ConditionRA(siderealTime);
tl.LogMessage("SiderealTime", "Get - " + siderealTime.ToString()); LogMessage("SiderealTime", "Get - " + siderealTime.ToString());
return siderealTime; return siderealTime;
} }
} }
@@ -1190,12 +1187,12 @@ namespace ASCOM.Meade.net
{ {
get get
{ {
tl.LogMessage("SiteElevation Get", "Not implemented"); LogMessage("SiteElevation Get", "Not implemented");
throw new ASCOM.PropertyNotImplementedException("SiteElevation", false); throw new ASCOM.PropertyNotImplementedException("SiteElevation", false);
} }
set set
{ {
tl.LogMessage("SiteElevation Set", "Not implemented"); LogMessage("SiteElevation Set", "Not implemented");
throw new ASCOM.PropertyNotImplementedException("SiteElevation", true); throw new ASCOM.PropertyNotImplementedException("SiteElevation", true);
} }
} }
@@ -1212,12 +1209,12 @@ namespace ASCOM.Meade.net
//The latitude of the current site. Positive inplies North latitude. //The latitude of the current site. Positive inplies North latitude.
var siteLatitude = _utilities.DMSToDegrees(latitude); var siteLatitude = _utilities.DMSToDegrees(latitude);
tl.LogMessage("SiteLatitude Get", $"{_utilitiesExtra.DegreesToDMS(siteLatitude)}"); LogMessage("SiteLatitude Get", $"{_utilitiesExtra.DegreesToDMS(siteLatitude)}");
return siteLatitude; return siteLatitude;
} }
set set
{ {
tl.LogMessage("SiteLatitude Set", $"{_utilitiesExtra.DegreesToDMS(value)}"); LogMessage("SiteLatitude Set", $"{_utilitiesExtra.DegreesToDMS(value)}");
CheckConnected("SiteLatitude Set"); CheckConnected("SiteLatitude Set");
@@ -1259,14 +1256,14 @@ namespace ASCOM.Meade.net
siteLongitude = -siteLongitude; siteLongitude = -siteLongitude;
tl.LogMessage("SiteLongitude Get", $"{_utilitiesExtra.DegreesToDMS(siteLongitude)}"); LogMessage("SiteLongitude Get", $"{_utilitiesExtra.DegreesToDMS(siteLongitude)}");
return siteLongitude; return siteLongitude;
} }
set set
{ {
var newLongitude = value; var newLongitude = value;
tl.LogMessage("SiteLongitude Set", $"{_utilitiesExtra.DegreesToDMS(newLongitude)}"); LogMessage("SiteLongitude Set", $"{_utilitiesExtra.DegreesToDMS(newLongitude)}");
CheckConnected("SiteLongitude Set"); CheckConnected("SiteLongitude Set");
@@ -1299,19 +1296,19 @@ namespace ASCOM.Meade.net
{ {
get get
{ {
tl.LogMessage("SlewSettleTime Get", "Not implemented"); LogMessage("SlewSettleTime Get", "Not implemented");
throw new ASCOM.PropertyNotImplementedException("SlewSettleTime", false); throw new ASCOM.PropertyNotImplementedException("SlewSettleTime", false);
} }
set set
{ {
tl.LogMessage("SlewSettleTime Set", "Not implemented"); LogMessage("SlewSettleTime Set", "Not implemented");
throw new ASCOM.PropertyNotImplementedException("SlewSettleTime", true); throw new ASCOM.PropertyNotImplementedException("SlewSettleTime", true);
} }
} }
public void SlewToAltAz(double azimuth, double altitude) public void SlewToAltAz(double azimuth, double altitude)
{ {
tl.LogMessage("SlewToAltAz", $"Az=~{azimuth} Alt={altitude}"); LogMessage("SlewToAltAz", $"Az=~{azimuth} Alt={altitude}");
CheckConnected("SlewToAltAz"); CheckConnected("SlewToAltAz");
SlewToAltAzAsync(azimuth, altitude); SlewToAltAzAsync(azimuth, altitude);
@@ -1394,7 +1391,7 @@ namespace ASCOM.Meade.net
if (azimuth < 0) if (azimuth < 0)
throw new ASCOM.InvalidValueException("Azimuth cannot be less than 0."); throw new ASCOM.InvalidValueException("Azimuth cannot be less than 0.");
tl.LogMessage("SlewToAltAzAsync", $"Az={azimuth} Alt={altitude}"); LogMessage("SlewToAltAzAsync", $"Az={azimuth} Alt={altitude}");
CheckConnected("SlewToAltAzAsync"); CheckConnected("SlewToAltAzAsync");
HorizonCoordinates altAz = new HorizonCoordinates(); HorizonCoordinates altAz = new HorizonCoordinates();
@@ -1441,20 +1438,20 @@ namespace ASCOM.Meade.net
{ {
case "0": case "0":
//We're slewing everything should be working just fine. //We're slewing everything should be working just fine.
tl.LogMessage("DoSlewAsync", "Slewing to target"); LogMessage("DoSlewAsync", "Slewing to target");
break; break;
case "1": case "1":
//Below Horizon //Below Horizon
string belowHorizonMessage = _sharedResourcesWrapper.ReadTerminated(); string belowHorizonMessage = _sharedResourcesWrapper.ReadTerminated();
tl.LogMessage("DoSlewAsync", $"Slew failed \"{belowHorizonMessage}\""); LogMessage("DoSlewAsync", $"Slew failed \"{belowHorizonMessage}\"");
throw new ASCOM.InvalidOperationException(belowHorizonMessage); throw new ASCOM.InvalidOperationException(belowHorizonMessage);
case "2": case "2":
//Below Horizon //Below Horizon
string belowMinimumElevationMessage = _sharedResourcesWrapper.ReadTerminated(); string belowMinimumElevationMessage = _sharedResourcesWrapper.ReadTerminated();
tl.LogMessage("DoSlewAsync", $"Slew failed \"{belowMinimumElevationMessage}\""); LogMessage("DoSlewAsync", $"Slew failed \"{belowMinimumElevationMessage}\"");
throw new ASCOM.InvalidOperationException(belowMinimumElevationMessage); throw new ASCOM.InvalidOperationException(belowMinimumElevationMessage);
default: default:
tl.LogMessage("DoSlewAsync", $"Slew failed - unknown response \"{response}\""); LogMessage("DoSlewAsync", $"Slew failed - unknown response \"{response}\"");
throw new ASCOM.DriverException("This error should not happen"); throw new ASCOM.DriverException("This error should not happen");
} }
@@ -1480,7 +1477,7 @@ namespace ASCOM.Meade.net
public void SlewToCoordinates(double rightAscension, double declination) public void SlewToCoordinates(double rightAscension, double declination)
{ {
tl.LogMessage("SlewToCoordinates", $"Ra={rightAscension}, Dec={declination}"); LogMessage("SlewToCoordinates", $"Ra={rightAscension}, Dec={declination}");
CheckConnected("SlewToCoordinates"); CheckConnected("SlewToCoordinates");
SlewToCoordinatesAsync(rightAscension, declination); SlewToCoordinatesAsync(rightAscension, declination);
@@ -1490,12 +1487,12 @@ namespace ASCOM.Meade.net
_utilities.WaitForMilliseconds(200); //be responsive to AbortSlew(); _utilities.WaitForMilliseconds(200); //be responsive to AbortSlew();
} }
tl.LogMessage("SlewToCoordinates", $"Slewing completed new coordinates Ra={RightAscension}, Dec={Declination}"); LogMessage("SlewToCoordinates", $"Slewing completed new coordinates Ra={RightAscension}, Dec={Declination}");
} }
public void SlewToCoordinatesAsync(double rightAscension, double declination) public void SlewToCoordinatesAsync(double rightAscension, double declination)
{ {
tl.LogMessage("SlewToCoordinatesAsync", $"Ra={rightAscension}, Dec={declination}"); LogMessage("SlewToCoordinatesAsync", $"Ra={rightAscension}, Dec={declination}");
CheckConnected("SlewToCoordinatesAsync"); CheckConnected("SlewToCoordinatesAsync");
_sharedResourcesWrapper.Lock(() => _sharedResourcesWrapper.Lock(() =>
@@ -1510,7 +1507,7 @@ namespace ASCOM.Meade.net
public void SlewToTarget() public void SlewToTarget()
{ {
tl.LogMessage("SlewToTarget", "Executing"); LogMessage("SlewToTarget", "Executing");
CheckConnected("SlewToTarget"); CheckConnected("SlewToTarget");
SlewToTargetAsync(); SlewToTargetAsync();
@@ -1556,20 +1553,20 @@ namespace ASCOM.Meade.net
//Autostars and Autostar II a string containing one bar until a slew is complete, then a null string is returned. //Autostars and Autostar II a string containing one bar until a slew is complete, then a null string is returned.
bool isSlewing = result != string.Empty; bool isSlewing = result != string.Empty;
tl.LogMessage("Slewing Get", $"Result = {isSlewing}"); LogMessage("Slewing Get", $"Result = {isSlewing}");
return isSlewing; return isSlewing;
} }
} }
public void SyncToAltAz(double azimuth, double altitude) public void SyncToAltAz(double azimuth, double altitude)
{ {
tl.LogMessage("SyncToAltAz", "Not implemented"); LogMessage("SyncToAltAz", "Not implemented");
throw new ASCOM.MethodNotImplementedException("SyncToAltAz"); throw new ASCOM.MethodNotImplementedException("SyncToAltAz");
} }
public void SyncToCoordinates(double rightAscension, double declination) public void SyncToCoordinates(double rightAscension, double declination)
{ {
tl.LogMessage("SyncToCoordinates", $"RA={rightAscension} Dec={declination}"); LogMessage("SyncToCoordinates", $"RA={rightAscension} Dec={declination}");
CheckConnected("SyncToCoordinates"); CheckConnected("SyncToCoordinates");
_sharedResourcesWrapper.Lock(() => _sharedResourcesWrapper.Lock(() =>
@@ -1583,7 +1580,7 @@ namespace ASCOM.Meade.net
public void SyncToTarget() public void SyncToTarget()
{ {
tl.LogMessage("SyncToTarget", "Executing"); LogMessage("SyncToTarget", "Executing");
CheckConnected("SyncToTarget"); CheckConnected("SyncToTarget");
var result = _sharedResourcesWrapper.SendString(":CM#"); var result = _sharedResourcesWrapper.SendString(":CM#");
@@ -1613,12 +1610,12 @@ namespace ASCOM.Meade.net
//return targetDec; //return targetDec;
tl.LogMessage("TargetDeclination Get", $"{_targetDeclination}"); LogMessage("TargetDeclination Get", $"{_targetDeclination}");
return _targetDeclination; return _targetDeclination;
} }
set set
{ {
tl.LogMessage("TargetDeclination Set", $"{value}"); LogMessage("TargetDeclination Set", $"{value}");
//todo implement low precision version of this. //todo implement low precision version of this.
if (value > 90) if (value > 90)
@@ -1634,7 +1631,7 @@ namespace ASCOM.Meade.net
var command = $":Sd{s}{dms}#"; var command = $":Sd{s}{dms}#";
tl.LogMessage("TargetDeclination Set", $"{command}"); LogMessage("TargetDeclination Set", $"{command}");
var result = _sharedResourcesWrapper.SendChar(command); var result = _sharedResourcesWrapper.SendChar(command);
//:SdsDD*MM# //:SdsDD*MM#
//Set target object declination to sDD*MM or sDD*MM:SS depending on the current precision setting //Set target object declination to sDD*MM or sDD*MM:SS depending on the current precision setting
@@ -1667,12 +1664,12 @@ namespace ASCOM.Meade.net
//double targetRa = HmsToDouble(result); //double targetRa = HmsToDouble(result);
//return targetRa; //return targetRa;
tl.LogMessage("TargetRightAscension Get", $"{_targetRightAscension}"); LogMessage("TargetRightAscension Get", $"{_targetRightAscension}");
return _targetRightAscension; return _targetRightAscension;
} }
set set
{ {
tl.LogMessage("TargetRightAscension Set", $"{value}"); LogMessage("TargetRightAscension Set", $"{value}");
if (value < 0) if (value < 0)
throw new InvalidValueException("Right ascension value cannot be below 0"); throw new InvalidValueException("Right ascension value cannot be below 0");
@@ -1704,12 +1701,12 @@ namespace ASCOM.Meade.net
{ {
get get
{ {
tl.LogMessage("Tracking", $"Get - {_tracking}"); LogMessage("Tracking", $"Get - {_tracking}");
return _tracking; return _tracking;
} }
set set
{ {
tl.LogMessage($"Tracking Set", $"{value}"); LogMessage($"Tracking Set", $"{value}");
_tracking = value; _tracking = value;
} }
} }
@@ -1732,12 +1729,12 @@ namespace ASCOM.Meade.net
// return DriveRates.driveSidereal; // return DriveRates.driveSidereal;
//return DriveRates.driveKing; //return DriveRates.driveKing;
tl.LogMessage("TrackingRate Get", $"{_trackingRate}"); LogMessage("TrackingRate Get", $"{_trackingRate}");
return _trackingRate; return _trackingRate;
} }
set set
{ {
tl.LogMessage("TrackingRate Set", $"{value}"); LogMessage("TrackingRate Set", $"{value}");
CheckConnected("TrackingRate Set"); CheckConnected("TrackingRate Set");
switch (value) switch (value)
@@ -1774,10 +1771,10 @@ namespace ASCOM.Meade.net
get get
{ {
ITrackingRates trackingRates = new TrackingRates(); ITrackingRates trackingRates = new TrackingRates();
tl.LogMessage("TrackingRates", "Get - "); LogMessage("TrackingRates", "Get - ");
foreach (DriveRates driveRate in trackingRates) foreach (DriveRates driveRate in trackingRates)
{ {
tl.LogMessage("TrackingRates", "Get - " + driveRate.ToString()); LogMessage("TrackingRates", "Get - " + driveRate.ToString());
} }
return trackingRates; return trackingRates;
} }
@@ -1810,7 +1807,7 @@ namespace ASCOM.Meade.net
{ {
CheckConnected("UTCDate Get"); CheckConnected("UTCDate Get");
tl.LogMessage("UTCDate", "Get started"); LogMessage("UTCDate", "Get started");
TelescopeDateDetails telescopeDateDetails = _sharedResourcesWrapper.Lock(() => TelescopeDateDetails telescopeDateDetails = _sharedResourcesWrapper.Lock(() =>
{ {
@@ -1844,13 +1841,13 @@ namespace ASCOM.Meade.net
var utcDate = new DateTime(year, month, day, hour, minute, second, DateTimeKind.Utc) + var utcDate = new DateTime(year, month, day, hour, minute, second, DateTimeKind.Utc) +
telescopeDateDetails.utcCorrection; telescopeDateDetails.utcCorrection;
tl.LogMessage("UTCDate", "Get - " + utcDate.ToString("MM/dd/yy HH:mm:ss")); LogMessage("UTCDate", "Get - " + utcDate.ToString("MM/dd/yy HH:mm:ss"));
return utcDate; return utcDate;
} }
set set
{ {
tl.LogMessage("UTCDate", "Set - " + value.ToString("MM/dd/yy HH:mm:ss")); LogMessage("UTCDate", "Set - " + value.ToString("MM/dd/yy HH:mm:ss"));
CheckConnected("UTCDate Set"); CheckConnected("UTCDate Set");
@@ -1891,7 +1888,7 @@ namespace ASCOM.Meade.net
public void Unpark() public void Unpark()
{ {
tl.LogMessage("Unpark", "Not implemented"); LogMessage("Unpark", "Not implemented");
throw new ASCOM.MethodNotImplementedException("Unpark"); throw new ASCOM.MethodNotImplementedException("Unpark");
} }