Removed redundant qualifiers

This commit is contained in:
2019-07-19 13:12:22 +01:00
parent dfef48ff0c
commit 2ce8c4e123
9 changed files with 109 additions and 109 deletions
+2 -2
View File
@@ -24,11 +24,11 @@ namespace ASCOM
// Uncomment the code that's required // Uncomment the code that's required
#if UseChooser #if UseChooser
// choose the device // choose the device
string id = ASCOM.DriverAccess.Focuser.Choose("ASCOM.MeadeGeneric.Focuser"); string id = Focuser.Choose("ASCOM.MeadeGeneric.Focuser");
if (string.IsNullOrEmpty(id)) if (string.IsNullOrEmpty(id))
return; return;
// create this device // create this device
ASCOM.DriverAccess.Focuser device = new ASCOM.DriverAccess.Focuser(id); Focuser device = new Focuser(id);
#else #else
// this can be replaced by this code, it avoids the chooser and creates the driver class directly. // 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"); ASCOM.DriverAccess.Telescope device = new ASCOM.DriverAccess.Telescope("ASCOM.MeadeGeneric.Telescope");
@@ -1200,7 +1200,7 @@ namespace Meade.net.Telescope.UnitTests
_sharedResourcesWrapperMock.Setup(x => x.SendChar(It.IsAny<string>())).Returns("0"); _sharedResourcesWrapperMock.Setup(x => x.SendChar(It.IsAny<string>())).Returns("0");
var exception = Assert.Throws<ASCOM.InvalidOperationException>(() => { _telescope.SiteLatitude = siteLatitude; }); var exception = Assert.Throws<InvalidOperationException>(() => { _telescope.SiteLatitude = siteLatitude; });
Assert.That(exception.Message, Is.EqualTo("Failed to set site latitude.")); Assert.That(exception.Message, Is.EqualTo("Failed to set site latitude."));
} }
+13 -13
View File
@@ -21,7 +21,7 @@ namespace ASCOM.Meade.net
[Guid("288838d1-bbf9-4ce0-9ee1-86ecf38b45c9")] [Guid("288838d1-bbf9-4ce0-9ee1-86ecf38b45c9")]
[ClassInterface(ClassInterfaceType.None)] [ClassInterface(ClassInterfaceType.None)]
[ComVisible(true)] [ComVisible(true)]
public class Rate : ASCOM.DeviceInterface.IRate public class Rate : IRate
{ {
private double maximum = 0; private double maximum = 0;
private double minimum = 0; private double minimum = 0;
@@ -45,14 +45,14 @@ namespace ASCOM.Meade.net
public double Maximum public double Maximum
{ {
get { return this.maximum; } get { return maximum; }
set { this.maximum = value; } set { maximum = value; }
} }
public double Minimum public double Minimum
{ {
get { return this.minimum; } get { return minimum; }
set { this.minimum = value; } set { minimum = value; }
} }
#endregion #endregion
@@ -100,16 +100,16 @@ namespace ASCOM.Meade.net
// TODO Initialize this array with any Primary axis rates that your driver may provide // 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) } // 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) }; rates = new Rate[] { new Rate(1, 1), new Rate(2, 2), new Rate(3, 3), new Rate(4, 4) };
break; break;
case TelescopeAxes.axisSecondary: case TelescopeAxes.axisSecondary:
// TODO Initialize this array with any Secondary axis rates that your driver may provide // 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) }; rates = new Rate[] { new Rate(1, 1), new Rate(2, 2), new Rate(3, 3), new Rate(4, 4) };
break; break;
case TelescopeAxes.axisTertiary: case TelescopeAxes.axisTertiary:
// TODO Initialize this array with any Tertiary axis rates that your driver may provide // TODO Initialize this array with any Tertiary axis rates that your driver may provide
this.rates = new Rate[0]; rates = new Rate[0];
break; break;
} }
} }
@@ -118,7 +118,7 @@ namespace ASCOM.Meade.net
public int Count public int Count
{ {
get { return this.rates.Length; } get { return rates.Length; }
} }
public void Dispose() public void Dispose()
@@ -133,7 +133,7 @@ namespace ASCOM.Meade.net
public IRate this[int index] public IRate this[int index]
{ {
get { return this.rates[index - 1]; } // 1-based get { return rates[index - 1]; } // 1-based
} }
#endregion #endregion
@@ -176,7 +176,7 @@ namespace ASCOM.Meade.net
// the tracking rates supported by your telescope. The one value // the tracking rates supported by your telescope. The one value
// (tracking rate) that MUST be supported is driveSidereal! // (tracking rate) that MUST be supported is driveSidereal!
// //
this.trackingRates = new[] { DriveRates.driveSidereal, DriveRates.driveLunar }; trackingRates = new[] { DriveRates.driveSidereal, DriveRates.driveLunar };
// TODO Initialize this array with any additional tracking rates that your driver may provide // TODO Initialize this array with any additional tracking rates that your driver may provide
} }
@@ -184,7 +184,7 @@ namespace ASCOM.Meade.net
public int Count public int Count
{ {
get { return this.trackingRates.Length; } get { return trackingRates.Length; }
} }
public IEnumerator GetEnumerator() public IEnumerator GetEnumerator()
@@ -200,7 +200,7 @@ namespace ASCOM.Meade.net
public DriveRates this[int index] public DriveRates this[int index]
{ {
get { return this.trackingRates[index - 1]; } // 1-based get { return trackingRates[index - 1]; } // 1-based
} }
#endregion #endregion
+60 -60
View File
@@ -230,12 +230,12 @@ namespace ASCOM.Meade.net
break; break;
default: default:
LogMessage("", "Action {0}, parameters {1} not implemented", actionName, actionParameters); LogMessage("", "Action {0}, parameters {1} not implemented", actionName, actionParameters);
throw new ASCOM.ActionNotImplementedException($"{actionName}({actionParameters})"); throw new ActionNotImplementedException($"{actionName}({actionParameters})");
} }
break; break;
default: default:
LogMessage("", "Action {0}, parameters {1} not implemented", actionName, actionParameters); LogMessage("", "Action {0}, parameters {1} not implemented", actionName, actionParameters);
throw new ASCOM.ActionNotImplementedException($"{actionName}"); throw new ActionNotImplementedException($"{actionName}");
} }
return string.Empty; return string.Empty;
@@ -258,7 +258,7 @@ namespace ASCOM.Meade.net
//string ret = CommandString(command, raw); //string ret = CommandString(command, raw);
// TODO decode the return string and return true or false // TODO decode the return string and return true or false
// or // or
throw new ASCOM.MethodNotImplementedException("CommandBool"); throw new MethodNotImplementedException("CommandBool");
// DO NOT have both these sections! One or the other // DO NOT have both these sections! One or the other
} }
@@ -414,7 +414,7 @@ namespace ASCOM.Meade.net
{ {
get get
{ {
Version version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version; Version version = Assembly.GetExecutingAssembly().GetName().Version;
string driverVersion = $"{version.Major}.{version.Minor}.{version.Revision}.{version.Build}"; string driverVersion = $"{version.Major}.{version.Minor}.{version.Revision}.{version.Build}";
LogMessage("DriverVersion Get", driverVersion); LogMessage("DriverVersion Get", driverVersion);
return driverVersion; return driverVersion;
@@ -580,13 +580,13 @@ namespace ASCOM.Meade.net
{ {
var altitudeData = _sharedResourcesWrapper.Lock(() => new AltitudeData var altitudeData = _sharedResourcesWrapper.Lock(() => new AltitudeData
{ {
UtcDateTime = this.UTCDate, UtcDateTime = UTCDate,
SiteLongitude = this.SiteLongitude, SiteLongitude = SiteLongitude,
SiteLatitude = this.SiteLatitude, SiteLatitude = SiteLatitude,
equatorialCoordinates = new EquatorialCoordinates() equatorialCoordinates = new EquatorialCoordinates()
{ {
RightAscension = this.RightAscension, RightAscension = RightAscension,
Declination = this.Declination Declination = Declination
} }
}); });
@@ -601,7 +601,7 @@ namespace ASCOM.Meade.net
get get
{ {
LogMessage("ApertureArea Get", "Not implemented"); LogMessage("ApertureArea Get", "Not implemented");
throw new ASCOM.PropertyNotImplementedException("ApertureArea", false); throw new PropertyNotImplementedException("ApertureArea", false);
} }
} }
@@ -610,7 +610,7 @@ namespace ASCOM.Meade.net
get get
{ {
LogMessage("ApertureDiameter Get", "Not implemented"); LogMessage("ApertureDiameter Get", "Not implemented");
throw new ASCOM.PropertyNotImplementedException("ApertureDiameter", false); throw new PropertyNotImplementedException("ApertureDiameter", false);
} }
} }
@@ -848,14 +848,14 @@ namespace ASCOM.Meade.net
set set
{ {
LogMessage("DeclinationRate Set", "Not implemented"); LogMessage("DeclinationRate Set", "Not implemented");
throw new ASCOM.PropertyNotImplementedException("DeclinationRate", true); throw new PropertyNotImplementedException("DeclinationRate", true);
} }
} }
public PierSide DestinationSideOfPier(double rightAscension, double declination) public PierSide DestinationSideOfPier(double rightAscension, double declination)
{ {
LogMessage("DestinationSideOfPier Get", "Not implemented"); LogMessage("DestinationSideOfPier Get", "Not implemented");
throw new ASCOM.MethodNotImplementedException("DestinationSideOfPier"); throw new MethodNotImplementedException("DestinationSideOfPier");
} }
public bool DoesRefraction public bool DoesRefraction
@@ -863,12 +863,12 @@ namespace ASCOM.Meade.net
get get
{ {
LogMessage("DoesRefraction Get", "Not implemented"); LogMessage("DoesRefraction Get", "Not implemented");
throw new ASCOM.PropertyNotImplementedException("DoesRefraction", false); throw new PropertyNotImplementedException("DoesRefraction", false);
} }
set set
{ {
LogMessage("DoesRefraction Set", "Not implemented"); LogMessage("DoesRefraction Set", "Not implemented");
throw new ASCOM.PropertyNotImplementedException("DoesRefraction", true); throw new PropertyNotImplementedException("DoesRefraction", true);
} }
} }
@@ -885,7 +885,7 @@ namespace ASCOM.Meade.net
public void FindHome() public void FindHome()
{ {
LogMessage("FindHome", "Not implemented"); LogMessage("FindHome", "Not implemented");
throw new ASCOM.MethodNotImplementedException("FindHome"); throw new MethodNotImplementedException("FindHome");
} }
public double FocalLength public double FocalLength
@@ -893,7 +893,7 @@ namespace ASCOM.Meade.net
get get
{ {
LogMessage("FocalLength Get", "Not implemented"); LogMessage("FocalLength Get", "Not implemented");
throw new ASCOM.PropertyNotImplementedException("FocalLength", false); throw new PropertyNotImplementedException("FocalLength", false);
} }
} }
@@ -902,12 +902,12 @@ namespace ASCOM.Meade.net
get get
{ {
LogMessage("GuideRateDeclination Get", "Not implemented"); LogMessage("GuideRateDeclination Get", "Not implemented");
throw new ASCOM.PropertyNotImplementedException("GuideRateDeclination", false); throw new PropertyNotImplementedException("GuideRateDeclination", false);
} }
set set
{ {
LogMessage("GuideRateDeclination Set", "Not implemented"); LogMessage("GuideRateDeclination Set", "Not implemented");
throw new ASCOM.PropertyNotImplementedException("GuideRateDeclination", true); throw new PropertyNotImplementedException("GuideRateDeclination", true);
} }
} }
@@ -916,12 +916,12 @@ namespace ASCOM.Meade.net
get get
{ {
LogMessage("GuideRateRightAscension Get", "Not implemented"); LogMessage("GuideRateRightAscension Get", "Not implemented");
throw new ASCOM.PropertyNotImplementedException("GuideRateRightAscension", false); throw new PropertyNotImplementedException("GuideRateRightAscension", false);
} }
set set
{ {
LogMessage("GuideRateRightAscension Set", "Not implemented"); LogMessage("GuideRateRightAscension Set", "Not implemented");
throw new ASCOM.PropertyNotImplementedException("GuideRateRightAscension", true); throw new PropertyNotImplementedException("GuideRateRightAscension", true);
} }
} }
@@ -972,7 +972,7 @@ namespace ASCOM.Meade.net
//Returns: Nothing //Returns: Nothing
break; break;
default: default:
throw new ASCOM.InvalidValueException($"Rate {rate} not supported"); throw new InvalidValueException($"Rate {rate} not supported");
} }
switch (axis) switch (axis)
@@ -1032,7 +1032,7 @@ namespace ASCOM.Meade.net
break; break;
default: default:
throw new ASCOM.InvalidValueException("Can not move this axis."); throw new InvalidValueException("Can not move this axis.");
} }
} }
@@ -1147,14 +1147,14 @@ namespace ASCOM.Meade.net
set set
{ {
LogMessage("RightAscensionRate Set", "Not implemented"); LogMessage("RightAscensionRate Set", "Not implemented");
throw new ASCOM.PropertyNotImplementedException("RightAscensionRate", true); throw new PropertyNotImplementedException("RightAscensionRate", true);
} }
} }
public void SetPark() public void SetPark()
{ {
LogMessage("SetPark", "Not implemented"); LogMessage("SetPark", "Not implemented");
throw new ASCOM.MethodNotImplementedException("SetPark"); throw new MethodNotImplementedException("SetPark");
} }
public PierSide SideOfPier public PierSide SideOfPier
@@ -1162,12 +1162,12 @@ namespace ASCOM.Meade.net
get get
{ {
LogMessage("SideOfPier Get", "Not implemented"); LogMessage("SideOfPier Get", "Not implemented");
throw new ASCOM.PropertyNotImplementedException("SideOfPier", false); throw new PropertyNotImplementedException("SideOfPier", false);
} }
set set
{ {
LogMessage("SideOfPier Set", "Not implemented"); LogMessage("SideOfPier Set", "Not implemented");
throw new ASCOM.PropertyNotImplementedException("SideOfPier", true); throw new PropertyNotImplementedException("SideOfPier", true);
} }
} }
@@ -1177,13 +1177,13 @@ namespace ASCOM.Meade.net
{ {
// Now using NOVAS 3.1 // Now using NOVAS 3.1
double siderealTime = 0.0; double siderealTime = 0.0;
using (var novas = new ASCOM.Astrometry.NOVAS.NOVAS31()) using (var novas = new Astrometry.NOVAS.NOVAS31())
{ {
var jd = _utilities.DateUTCToJulian(DateTime.UtcNow); var jd = _utilities.DateUTCToJulian(DateTime.UtcNow);
novas.SiderealTime(jd, 0, novas.DeltaT(jd), novas.SiderealTime(jd, 0, novas.DeltaT(jd),
ASCOM.Astrometry.GstType.GreenwichApparentSiderealTime, Astrometry.GstType.GreenwichApparentSiderealTime,
ASCOM.Astrometry.Method.EquinoxBased, Astrometry.Method.EquinoxBased,
ASCOM.Astrometry.Accuracy.Reduced, ref siderealTime); Astrometry.Accuracy.Reduced, ref siderealTime);
} }
// Allow for the longitude // Allow for the longitude
@@ -1202,12 +1202,12 @@ namespace ASCOM.Meade.net
get get
{ {
LogMessage("SiteElevation Get", "Not implemented"); LogMessage("SiteElevation Get", "Not implemented");
throw new ASCOM.PropertyNotImplementedException("SiteElevation", false); throw new PropertyNotImplementedException("SiteElevation", false);
} }
set set
{ {
LogMessage("SiteElevation Set", "Not implemented"); LogMessage("SiteElevation Set", "Not implemented");
throw new ASCOM.PropertyNotImplementedException("SiteElevation", true); throw new PropertyNotImplementedException("SiteElevation", true);
} }
} }
@@ -1316,12 +1316,12 @@ namespace ASCOM.Meade.net
get get
{ {
LogMessage("SlewSettleTime Get", "Not implemented"); LogMessage("SlewSettleTime Get", "Not implemented");
throw new ASCOM.PropertyNotImplementedException("SlewSettleTime", false); throw new PropertyNotImplementedException("SlewSettleTime", false);
} }
set set
{ {
LogMessage("SlewSettleTime Set", "Not implemented"); LogMessage("SlewSettleTime Set", "Not implemented");
throw new ASCOM.PropertyNotImplementedException("SlewSettleTime", true); throw new PropertyNotImplementedException("SlewSettleTime", true);
} }
} }
@@ -1343,10 +1343,10 @@ namespace ASCOM.Meade.net
set set
{ {
if (value > 90) if (value > 90)
throw new ASCOM.InvalidValueException("Altitude cannot be greater than 90."); throw new InvalidValueException("Altitude cannot be greater than 90.");
if (value < 0) if (value < 0)
throw new ASCOM.InvalidValueException("Altitide cannot be less than 0."); throw new InvalidValueException("Altitide cannot be less than 0.");
CheckConnected("TargetAltitude Set"); CheckConnected("TargetAltitude Set");
@@ -1363,7 +1363,7 @@ namespace ASCOM.Meade.net
//0 Object out of slew range //0 Object out of slew range
if (result == "0") if (result == "0")
throw new ASCOM.InvalidOperationException("Target altitude out of slew range"); throw new InvalidOperationException("Target altitude out of slew range");
} }
} }
@@ -1372,10 +1372,10 @@ namespace ASCOM.Meade.net
set set
{ {
if (value >= 360) if (value >= 360)
throw new ASCOM.InvalidValueException("Azimuth cannot be 360 or higher."); throw new InvalidValueException("Azimuth cannot be 360 or higher.");
if (value < 0) if (value < 0)
throw new ASCOM.InvalidValueException("Azimuth cannot be less than 0."); throw new InvalidValueException("Azimuth cannot be less than 0.");
CheckConnected("TargetAzimuth Set"); CheckConnected("TargetAzimuth Set");
@@ -1391,7 +1391,7 @@ namespace ASCOM.Meade.net
//1 - Valid //1 - Valid
if (result == "0") if (result == "0")
throw new ASCOM.InvalidOperationException("Target Azimuth out of slew range"); throw new InvalidOperationException("Target Azimuth out of slew range");
} }
} }
@@ -1401,16 +1401,16 @@ namespace ASCOM.Meade.net
CheckConnected("SlewToAltAzAsync"); CheckConnected("SlewToAltAzAsync");
if (altitude > 90) if (altitude > 90)
throw new ASCOM.InvalidValueException("Altitude cannot be greater than 90."); throw new InvalidValueException("Altitude cannot be greater than 90.");
if (altitude < 0) if (altitude < 0)
throw new ASCOM.InvalidValueException("Altitide cannot be less than 0."); throw new InvalidValueException("Altitide cannot be less than 0.");
if (azimuth >= 360) if (azimuth >= 360)
throw new ASCOM.InvalidValueException("Azimuth cannot be 360 or higher."); throw new InvalidValueException("Azimuth cannot be 360 or higher.");
if (azimuth < 0) if (azimuth < 0)
throw new ASCOM.InvalidValueException("Azimuth cannot be less than 0."); throw new InvalidValueException("Azimuth cannot be less than 0.");
LogMessage("SlewToAltAzAsync", $"Az={azimuth} Alt={altitude}"); LogMessage("SlewToAltAzAsync", $"Az={azimuth} Alt={altitude}");
@@ -1464,15 +1464,15 @@ namespace ASCOM.Meade.net
//Below Horizon //Below Horizon
string belowHorizonMessage = _sharedResourcesWrapper.ReadTerminated(); string belowHorizonMessage = _sharedResourcesWrapper.ReadTerminated();
LogMessage("DoSlewAsync", $"Slew failed \"{belowHorizonMessage}\""); LogMessage("DoSlewAsync", $"Slew failed \"{belowHorizonMessage}\"");
throw new ASCOM.InvalidOperationException(belowHorizonMessage); throw new InvalidOperationException(belowHorizonMessage);
case "2": case "2":
//Below Horizon //Below Horizon
string belowMinimumElevationMessage = _sharedResourcesWrapper.ReadTerminated(); string belowMinimumElevationMessage = _sharedResourcesWrapper.ReadTerminated();
LogMessage("DoSlewAsync", $"Slew failed \"{belowMinimumElevationMessage}\""); LogMessage("DoSlewAsync", $"Slew failed \"{belowMinimumElevationMessage}\"");
throw new ASCOM.InvalidOperationException(belowMinimumElevationMessage); throw new InvalidOperationException(belowMinimumElevationMessage);
default: default:
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 DriverException("This error should not happen");
} }
@@ -1487,7 +1487,7 @@ namespace ASCOM.Meade.net
if (maResponse == "1") if (maResponse == "1")
{ {
throw new ASCOM.InvalidOperationException("fault"); throw new InvalidOperationException("fault");
} }
break; break;
@@ -1544,7 +1544,7 @@ namespace ASCOM.Meade.net
CheckConnected("SlewToTargetAsync"); CheckConnected("SlewToTargetAsync");
if (TargetDeclination == INVALID_PARAMETER || TargetRightAscension == INVALID_PARAMETER) if (TargetDeclination == INVALID_PARAMETER || TargetRightAscension == INVALID_PARAMETER)
throw new ASCOM.InvalidOperationException("No target selected to slew to."); throw new InvalidOperationException("No target selected to slew to.");
DoSlewAsync(true); DoSlewAsync(true);
} }
@@ -1587,7 +1587,7 @@ namespace ASCOM.Meade.net
public void SyncToAltAz(double azimuth, double altitude) public void SyncToAltAz(double azimuth, double altitude)
{ {
LogMessage("SyncToAltAz", "Not implemented"); LogMessage("SyncToAltAz", "Not implemented");
throw new ASCOM.MethodNotImplementedException("SyncToAltAz"); throw new MethodNotImplementedException("SyncToAltAz");
} }
public void SyncToCoordinates(double rightAscension, double declination) public void SyncToCoordinates(double rightAscension, double declination)
@@ -1616,7 +1616,7 @@ namespace ASCOM.Meade.net
// Autostars & Autostar II - A static string: " M31 EX GAL MAG 3.5 SZ178.0'#" // Autostars & Autostar II - A static string: " M31 EX GAL MAG 3.5 SZ178.0'#"
if (result == string.Empty) if (result == string.Empty)
throw new ASCOM.InvalidOperationException("Unable to perform sync"); throw new InvalidOperationException("Unable to perform sync");
} }
private double _targetDeclination = INVALID_PARAMETER; private double _targetDeclination = INVALID_PARAMETER;
@@ -1625,7 +1625,7 @@ namespace ASCOM.Meade.net
get get
{ {
if (_targetDeclination == INVALID_PARAMETER) if (_targetDeclination == INVALID_PARAMETER)
throw new ASCOM.InvalidOperationException("Target not set"); throw new InvalidOperationException("Target not set");
//var result = SerialPort.CommandTerminated(":Gd#", "#"); //var result = SerialPort.CommandTerminated(":Gd#", "#");
////:Gd# Get Currently Selected Object/Target Declination ////:Gd# Get Currently Selected Object/Target Declination
@@ -1647,10 +1647,10 @@ namespace ASCOM.Meade.net
//todo implement low precision version of this. //todo implement low precision version of this.
if (value > 90) if (value > 90)
throw new ASCOM.InvalidValueException("Declination cannot be greater than 90."); throw new InvalidValueException("Declination cannot be greater than 90.");
if (value < -90) if (value < -90)
throw new ASCOM.InvalidValueException("Declination cannot be less than -90."); throw new InvalidValueException("Declination cannot be less than -90.");
var dms = _utilities.DegreesToDMS(value, "*", ":", ":", 2); var dms = _utilities.DegreesToDMS(value, "*", ":", ":", 2);
var s = value < 0 ? string.Empty : "+"; var s = value < 0 ? string.Empty : "+";
@@ -1667,7 +1667,7 @@ namespace ASCOM.Meade.net
if (result == "0") if (result == "0")
{ {
throw new ASCOM.InvalidOperationException("Target declination invalid"); throw new InvalidOperationException("Target declination invalid");
} }
_targetDeclination = value; _targetDeclination = value;
@@ -1680,7 +1680,7 @@ namespace ASCOM.Meade.net
get get
{ {
if (_targetRightAscension == INVALID_PARAMETER) if (_targetRightAscension == INVALID_PARAMETER)
throw new ASCOM.InvalidOperationException("Target not set"); throw new InvalidOperationException("Target not set");
//var result = SerialPort.CommandTerminated(":Gr#", "#"); //var result = SerialPort.CommandTerminated(":Gr#", "#");
////:Gr# Get current/target object RA ////:Gr# Get current/target object RA
@@ -1914,7 +1914,7 @@ namespace ASCOM.Meade.net
public void Unpark() public void Unpark()
{ {
LogMessage("Unpark", "Not implemented"); LogMessage("Unpark", "Not implemented");
throw new ASCOM.MethodNotImplementedException("Unpark"); throw new MethodNotImplementedException("Unpark");
} }
#endregion #endregion
@@ -1935,7 +1935,7 @@ namespace ASCOM.Meade.net
/// <param name="bRegister">If <c>true</c>, registers the driver, otherwise unregisters it.</param> /// <param name="bRegister">If <c>true</c>, registers the driver, otherwise unregisters it.</param>
private static void RegUnregASCOM(bool bRegister) private static void RegUnregASCOM(bool bRegister)
{ {
using (var P = new ASCOM.Utilities.Profile()) using (var P = new Profile())
{ {
P.DeviceType = "Telescope"; P.DeviceType = "Telescope";
if (bRegister) if (bRegister)
@@ -2010,7 +2010,7 @@ namespace ASCOM.Meade.net
{ {
if (!IsConnected) if (!IsConnected)
{ {
throw new ASCOM.NotConnectedException($"Not connected to telescope when trying to execute: {message}"); throw new NotConnectedException($"Not connected to telescope when trying to execute: {message}");
} }
} }
+15 -15
View File
@@ -117,7 +117,7 @@ namespace ASCOM.Meade.net
public string Action(string actionName, string actionParameters) public string Action(string actionName, string actionParameters)
{ {
LogMessage("", "Action {0}, parameters {1} not implemented", actionName, actionParameters); LogMessage("", "Action {0}, parameters {1} not implemented", actionName, actionParameters);
throw new ASCOM.ActionNotImplementedException("Action " + actionName + " is not implemented by this driver"); throw new ActionNotImplementedException("Action " + actionName + " is not implemented by this driver");
} }
public void CommandBlind(string command, bool raw) public void CommandBlind(string command, bool raw)
@@ -137,7 +137,7 @@ namespace ASCOM.Meade.net
//string ret = CommandString(command, raw); //string ret = CommandString(command, raw);
// TODO decode the return string and return true or false // TODO decode the return string and return true or false
// or // or
throw new ASCOM.MethodNotImplementedException("CommandBool"); throw new MethodNotImplementedException("CommandBool");
// DO NOT have both these sections! One or the other // DO NOT have both these sections! One or the other
} }
@@ -149,7 +149,7 @@ namespace ASCOM.Meade.net
// you need something to ensure that only one command is in progress at a time // you need something to ensure that only one command is in progress at a time
return _sharedResourcesWrapper.SendString(command); return _sharedResourcesWrapper.SendString(command);
throw new ASCOM.MethodNotImplementedException("CommandString"); throw new MethodNotImplementedException("CommandString");
} }
public void Dispose() public void Dispose()
@@ -250,7 +250,7 @@ namespace ASCOM.Meade.net
{ {
get get
{ {
Version version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version; Version version = Assembly.GetExecutingAssembly().GetName().Version;
// TODO customise this driver description // TODO customise this driver description
string driverInfo = "Information about the driver itself. Version: " + String.Format(CultureInfo.InvariantCulture, "{0}.{1}", version.Major, version.Minor); string driverInfo = "Information about the driver itself. Version: " + String.Format(CultureInfo.InvariantCulture, "{0}.{1}", version.Major, version.Minor);
tl.LogMessage("DriverInfo Get", driverInfo); tl.LogMessage("DriverInfo Get", driverInfo);
@@ -262,7 +262,7 @@ namespace ASCOM.Meade.net
{ {
get get
{ {
Version version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version; Version version = Assembly.GetExecutingAssembly().GetName().Version;
string driverVersion = String.Format(CultureInfo.InvariantCulture, "{0}.{1}", version.Major, version.Minor); string driverVersion = String.Format(CultureInfo.InvariantCulture, "{0}.{1}", version.Major, version.Minor);
tl.LogMessage("DriverVersion Get", driverVersion); tl.LogMessage("DriverVersion Get", driverVersion);
return driverVersion; return driverVersion;
@@ -334,13 +334,13 @@ namespace ASCOM.Meade.net
{ {
get get
{ {
tl.LogMessage("Link Get", this.Connected.ToString()); tl.LogMessage("Link Get", Connected.ToString());
return this.Connected; // Direct function to the connected method, the Link method is just here for backwards compatibility return Connected; // Direct function to the connected method, the Link method is just here for backwards compatibility
} }
set set
{ {
tl.LogMessage("Link Set", value.ToString()); tl.LogMessage("Link Set", value.ToString());
this.Connected = value; // Direct function to the connected method, the Link method is just here for backwards compatibility Connected = value; // Direct function to the connected method, the Link method is just here for backwards compatibility
} }
} }
@@ -375,7 +375,7 @@ namespace ASCOM.Meade.net
if (Position < -MaxIncrement || Position > MaxIncrement) if (Position < -MaxIncrement || Position > MaxIncrement)
{ {
throw new ASCOM.InvalidValueException($"position out of range {-MaxIncrement} < {Position} < {MaxIncrement}"); throw new InvalidValueException($"position out of range {-MaxIncrement} < {Position} < {MaxIncrement}");
} }
if (Position == 0) if (Position == 0)
@@ -434,7 +434,7 @@ namespace ASCOM.Meade.net
{ {
get get
{ {
throw new ASCOM.PropertyNotImplementedException("Position", false); throw new PropertyNotImplementedException("Position", false);
//return focuserPosition; // Return the focuser position //return focuserPosition; // Return the focuser position
} }
} }
@@ -444,7 +444,7 @@ namespace ASCOM.Meade.net
get get
{ {
tl.LogMessage("StepSize Get", "Not implemented"); tl.LogMessage("StepSize Get", "Not implemented");
throw new ASCOM.PropertyNotImplementedException("StepSize", false); throw new PropertyNotImplementedException("StepSize", false);
} }
} }
@@ -458,7 +458,7 @@ namespace ASCOM.Meade.net
set set
{ {
tl.LogMessage("TempComp Set", "Not implemented"); tl.LogMessage("TempComp Set", "Not implemented");
throw new ASCOM.PropertyNotImplementedException("TempComp", false); throw new PropertyNotImplementedException("TempComp", false);
} }
} }
@@ -476,7 +476,7 @@ namespace ASCOM.Meade.net
get get
{ {
tl.LogMessage("Temperature Get", "Not implemented"); tl.LogMessage("Temperature Get", "Not implemented");
throw new ASCOM.PropertyNotImplementedException("Temperature", false); throw new PropertyNotImplementedException("Temperature", false);
} }
} }
@@ -498,7 +498,7 @@ namespace ASCOM.Meade.net
/// <param name="bRegister">If <c>true</c>, registers the driver, otherwise unregisters it.</param> /// <param name="bRegister">If <c>true</c>, registers the driver, otherwise unregisters it.</param>
private static void RegUnregASCOM(bool bRegister) private static void RegUnregASCOM(bool bRegister)
{ {
using (var P = new ASCOM.Utilities.Profile()) using (var P = new Profile())
{ {
P.DeviceType = "Focuser"; P.DeviceType = "Focuser";
if (bRegister) if (bRegister)
@@ -573,7 +573,7 @@ namespace ASCOM.Meade.net
{ {
if (!IsConnected) if (!IsConnected)
{ {
throw new ASCOM.NotConnectedException(message); throw new NotConnectedException(message);
} }
} }
+2 -2
View File
@@ -420,7 +420,7 @@ namespace ASCOM.Meade.net
// Pull the display name from the ServedClassName attribute. // Pull the display name from the ServedClassName attribute.
attr = Attribute.GetCustomAttribute(type, typeof(ServedClassNameAttribute)); //PWGS Changed to search type for attribute rather than assembly attr = Attribute.GetCustomAttribute(type, typeof(ServedClassNameAttribute)); //PWGS Changed to search type for attribute rather than assembly
string chooserName = ((ServedClassNameAttribute)attr).DisplayName ?? "MultiServer"; string chooserName = ((ServedClassNameAttribute)attr).DisplayName ?? "MultiServer";
using (var P = new ASCOM.Utilities.Profile()) using (var P = new Profile())
{ {
P.DeviceType = deviceType; P.DeviceType = deviceType;
P.Register(progid, chooserName); P.Register(progid, chooserName);
@@ -490,7 +490,7 @@ namespace ASCOM.Meade.net
// //
// ASCOM // ASCOM
// //
using (var P = new ASCOM.Utilities.Profile()) using (var P = new Profile())
{ {
P.DeviceType = deviceType; P.DeviceType = deviceType;
P.Unregister(progid); P.Unregister(progid);
+2 -2
View File
@@ -29,12 +29,12 @@ namespace ASCOM.Meade.net
{ {
System.Diagnostics.Process.Start("http://ascom-standards.org/"); System.Diagnostics.Process.Start("http://ascom-standards.org/");
} }
catch (System.ComponentModel.Win32Exception noBrowser) catch (Win32Exception noBrowser)
{ {
if (noBrowser.ErrorCode == -2147467259) if (noBrowser.ErrorCode == -2147467259)
MessageBox.Show(noBrowser.Message); MessageBox.Show(noBrowser.Message);
} }
catch (System.Exception other) catch (Exception other)
{ {
MessageBox.Show(other.Message); MessageBox.Show(other.Message);
} }
+12 -12
View File
@@ -35,7 +35,7 @@ namespace ASCOM.Meade.net
private static readonly object lockObject = new object(); private static readonly object lockObject = new object();
// Shared serial port. This will allow multiple drivers to use one single serial port. // Shared serial port. This will allow multiple drivers to use one single serial port.
private static ASCOM.Utilities.Serial s_sharedSerial; // Shared serial port private static Serial s_sharedSerial; // Shared serial port
// //
// Public access to shared resources // Public access to shared resources
@@ -60,7 +60,7 @@ namespace ASCOM.Meade.net
/// <summary> /// <summary>
/// Shared serial port /// Shared serial port
/// </summary> /// </summary>
public static ASCOM.Utilities.Serial SharedSerial => s_sharedSerial ?? (s_sharedSerial = new ASCOM.Utilities.Serial()); public static Serial SharedSerial => s_sharedSerial ?? (s_sharedSerial = new Serial());
/// <summary> /// <summary>
/// number of connections to the shared serial port /// number of connections to the shared serial port
@@ -266,15 +266,15 @@ namespace ASCOM.Meade.net
if (connectedDevices[deviceId].count == 1) if (connectedDevices[deviceId].count == 1)
{ {
var profileProperties = ReadProfile(); var profileProperties = ReadProfile();
SharedResources.SharedSerial.PortName = profileProperties.ComPort; SharedSerial.PortName = profileProperties.ComPort;
SharedResources.SharedSerial.DTREnable = false; SharedSerial.DTREnable = false;
SharedResources.SharedSerial.RTSEnable = false; SharedSerial.RTSEnable = false;
SharedResources.SharedSerial.DataBits = 8; SharedSerial.DataBits = 8;
SharedResources.SharedSerial.StopBits = SerialStopBits.One; SharedSerial.StopBits = SerialStopBits.One;
SharedResources.SharedSerial.Parity = SerialParity.None; SharedSerial.Parity = SerialParity.None;
SharedResources.SharedSerial.Speed = SerialSpeed.ps9600; SharedSerial.Speed = SerialSpeed.ps9600;
SharedResources.SharedSerial.Handshake = SerialHandshake.None; SharedSerial.Handshake = SerialHandshake.None;
SharedResources.SharedSerial.Connected = true; SharedSerial.Connected = true;
ProductName = SendString(":GVP#"); ProductName = SendString(":GVP#");
FirmwareVersion = SendString(":GVN#"); FirmwareVersion = SendString(":GVN#");
@@ -295,7 +295,7 @@ namespace ASCOM.Meade.net
connectedDevices.Remove(deviceId); connectedDevices.Remove(deviceId);
if (deviceId == "Serial") if (deviceId == "Serial")
{ {
SharedResources.SharedSerial.Connected = false; SharedSerial.Connected = false;
} }
} }
} }
+2 -2
View File
@@ -22,11 +22,11 @@ namespace ASCOM
// Uncomment the code that's required // Uncomment the code that's required
#if UseChooser #if UseChooser
// choose the device // choose the device
string id = ASCOM.DriverAccess.Telescope.Choose("ASCOM.MeadeGeneric.Telescope"); string id = DriverAccess.Telescope.Choose("ASCOM.MeadeGeneric.Telescope");
if (string.IsNullOrEmpty(id)) if (string.IsNullOrEmpty(id))
return; return;
// create this device // create this device
ASCOM.DriverAccess.Telescope device = new ASCOM.DriverAccess.Telescope(id); DriverAccess.Telescope device = new DriverAccess.Telescope(id);
#else #else
// this can be replaced by this code, it avoids the chooser and creates the driver class directly. // 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.Meade.net.Telescope"); ASCOM.DriverAccess.Telescope device = new ASCOM.DriverAccess.Telescope("ASCOM.Meade.net.Telescope");