Code inspections

This commit is contained in:
2020-09-03 20:35:37 +01:00
parent a2fcaac2a9
commit 92ab807eae
4 changed files with 145 additions and 142 deletions
+99 -99
View File
@@ -132,7 +132,7 @@ namespace ASCOM.Meade.net
public void SetupDialog() public void SetupDialog()
{ {
LogMessage("SetupDialog", "Opening setup dialog"); LogMessage("SetupDialog", "Opening setup dialog");
_sharedResourcesWrapper.SetupDialog(); SharedResourcesWrapper.SetupDialog();
ReadProfile(); ReadProfile();
LogMessage("SetupDialog", "complete"); LogMessage("SetupDialog", "complete");
//// consider only showing the setup dialog if not connected //// consider only showing the setup dialog if not connected
@@ -171,68 +171,68 @@ namespace ASCOM.Meade.net
{ {
//Read the screen //Read the screen
case "readdisplay": case "readdisplay":
var output = _sharedResourcesWrapper.SendString(":ED#"); var output = SharedResourcesWrapper.SendString(":ED#");
return output; return output;
//top row of buttons //top row of buttons
case "enter": case "enter":
_sharedResourcesWrapper.SendBlind(":EK13#"); SharedResourcesWrapper.SendBlind(":EK13#");
break; break;
case "mode": case "mode":
_sharedResourcesWrapper.SendBlind(":EK9#"); SharedResourcesWrapper.SendBlind(":EK9#");
break; break;
case "longmode": case "longmode":
_sharedResourcesWrapper.SendBlind(":EK11#"); SharedResourcesWrapper.SendBlind(":EK11#");
break; break;
case "goto": case "goto":
_sharedResourcesWrapper.SendBlind(":EK24#"); SharedResourcesWrapper.SendBlind(":EK24#");
break; break;
case "0": //light and 0 case "0": //light and 0
_sharedResourcesWrapper.SendBlind(":EK48#"); SharedResourcesWrapper.SendBlind(":EK48#");
break; break;
case "1": case "1":
_sharedResourcesWrapper.SendBlind(":EK49#"); SharedResourcesWrapper.SendBlind(":EK49#");
break; break;
case "2": case "2":
_sharedResourcesWrapper.SendBlind(":EK50#"); SharedResourcesWrapper.SendBlind(":EK50#");
break; break;
case "3": case "3":
_sharedResourcesWrapper.SendBlind(":EK51#"); SharedResourcesWrapper.SendBlind(":EK51#");
break; break;
case "4": case "4":
_sharedResourcesWrapper.SendBlind(":EK52#"); SharedResourcesWrapper.SendBlind(":EK52#");
break; break;
case "5": case "5":
_sharedResourcesWrapper.SendBlind(":EK53#"); SharedResourcesWrapper.SendBlind(":EK53#");
break; break;
case "6": case "6":
_sharedResourcesWrapper.SendBlind(":EK54#"); SharedResourcesWrapper.SendBlind(":EK54#");
break; break;
case "7": case "7":
_sharedResourcesWrapper.SendBlind(":EK55#"); SharedResourcesWrapper.SendBlind(":EK55#");
break; break;
case "8": case "8":
_sharedResourcesWrapper.SendBlind(":EK56#"); SharedResourcesWrapper.SendBlind(":EK56#");
break; break;
case "9": case "9":
_sharedResourcesWrapper.SendBlind(":EK57#"); SharedResourcesWrapper.SendBlind(":EK57#");
break; break;
case "up": case "up":
_sharedResourcesWrapper.SendBlind(":EK94#"); SharedResourcesWrapper.SendBlind(":EK94#");
break; break;
case "down": case "down":
_sharedResourcesWrapper.SendBlind(":EK118#"); SharedResourcesWrapper.SendBlind(":EK118#");
break; break;
case "back": case "back":
_sharedResourcesWrapper.SendBlind(":EK87#"); SharedResourcesWrapper.SendBlind(":EK87#");
break; break;
case "forward": case "forward":
_sharedResourcesWrapper.SendBlind(":EK69#"); SharedResourcesWrapper.SendBlind(":EK69#");
break; break;
case "?": case "?":
_sharedResourcesWrapper.SendBlind(":EK63#"); SharedResourcesWrapper.SendBlind(":EK63#");
break; break;
default: default:
LogMessage("", "Action {0}, parameters {1} not implemented", actionName, actionParameters); LogMessage("", "Action {0}, parameters {1} not implemented", actionName, actionParameters);
@@ -317,7 +317,7 @@ namespace ASCOM.Meade.net
CheckConnected("CommandBlind"); CheckConnected("CommandBlind");
// Call CommandString and return as soon as it finishes // Call CommandString and return as soon as it finishes
//this.CommandString(command, raw); //this.CommandString(command, raw);
_sharedResourcesWrapper.SendBlind(command); SharedResourcesWrapper.SendBlind(command);
// or // or
//throw new ASCOM.MethodNotImplementedException("CommandBlind"); //throw new ASCOM.MethodNotImplementedException("CommandBlind");
// DO NOT have both these sections! One or the other // DO NOT have both these sections! One or the other
@@ -339,7 +339,7 @@ namespace ASCOM.Meade.net
// it's a good idea to put all the low level communication with the device here, // it's a good idea to put all the low level communication with the device here,
// then all communication calls this function // then all communication calls this function
// 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 ASCOM.MethodNotImplementedException("CommandString");
} }
@@ -349,9 +349,9 @@ namespace ASCOM.Meade.net
Connected = false; Connected = false;
// Clean up the tracelogger and util objects // Clean up the tracelogger and util objects
_tl.Enabled = false; Tl.Enabled = false;
_tl.Dispose(); Tl.Dispose();
_tl = null; Tl = null;
} }
public bool Connected public bool Connected
@@ -374,10 +374,10 @@ namespace ASCOM.Meade.net
ReadProfile(); ReadProfile();
LogMessage("Connected Set", "Connecting to port {0}", ComPort); LogMessage("Connected Set", "Connecting to port {0}", ComPort);
var connectionInfo = _sharedResourcesWrapper.Connect("Serial", DriverId, _tl); var connectionInfo = SharedResourcesWrapper.Connect("Serial", DriverId, Tl);
try try
{ {
LogMessage("Connected Set", $"Connected to port {ComPort}. Product: {_sharedResourcesWrapper.ProductName} Version:{_sharedResourcesWrapper.FirmwareVersion}"); LogMessage("Connected Set", $"Connected to port {ComPort}. Product: {SharedResourcesWrapper.ProductName} Version:{SharedResourcesWrapper.FirmwareVersion}");
_userNewerPulseGuiding = IsNewPulseGuidingSupported(); _userNewerPulseGuiding = IsNewPulseGuidingSupported();
_targetDeclination = InvalidParameter; _targetDeclination = InvalidParameter;
@@ -411,7 +411,7 @@ namespace ASCOM.Meade.net
} }
catch (Exception) catch (Exception)
{ {
_sharedResourcesWrapper.Disconnect("Serial", DriverId); SharedResourcesWrapper.Disconnect("Serial", DriverId);
throw; throw;
} }
} }
@@ -423,7 +423,7 @@ namespace ASCOM.Meade.net
else else
{ {
LogMessage("Connected Set", "Disconnecting from port {0}", ComPort); LogMessage("Connected Set", "Disconnecting from port {0}", ComPort);
_sharedResourcesWrapper.Disconnect("Serial", DriverId); SharedResourcesWrapper.Disconnect("Serial", DriverId);
IsConnected = false; IsConnected = false;
} }
} }
@@ -457,12 +457,12 @@ namespace ASCOM.Meade.net
return true; return true;
default: default:
if (_sharedResourcesWrapper.ProductName == TelescopeList.Autostar497) if (SharedResourcesWrapper.ProductName == TelescopeList.Autostar497)
{ {
return FirmwareIsGreaterThan(TelescopeList.Autostar497_31Ee); return FirmwareIsGreaterThan(TelescopeList.Autostar497_31Ee);
} }
if (_sharedResourcesWrapper.ProductName == TelescopeList.LX200GPS) if (SharedResourcesWrapper.ProductName == TelescopeList.LX200GPS)
{ {
return true; return true;
} }
@@ -473,7 +473,7 @@ namespace ASCOM.Meade.net
private bool IsLongFormatSupported() private bool IsLongFormatSupported()
{ {
if (_sharedResourcesWrapper.ProductName == TelescopeList.LX200CLASSIC) if (SharedResourcesWrapper.ProductName == TelescopeList.LX200CLASSIC)
{ {
return false; return false;
} }
@@ -482,7 +482,7 @@ namespace ASCOM.Meade.net
private bool IsGuideRateSettingSupported() private bool IsGuideRateSettingSupported()
{ {
if (_sharedResourcesWrapper.ProductName == TelescopeList.LX200GPS) if (SharedResourcesWrapper.ProductName == TelescopeList.LX200GPS)
{ {
return true; return true;
} }
@@ -491,7 +491,7 @@ namespace ASCOM.Meade.net
private bool FirmwareIsGreaterThan(string minVersion) private bool FirmwareIsGreaterThan(string minVersion)
{ {
var currentVersion = _sharedResourcesWrapper.FirmwareVersion; var currentVersion = SharedResourcesWrapper.FirmwareVersion;
var comparison = String.Compare(currentVersion, minVersion, StringComparison.Ordinal); var comparison = String.Compare(currentVersion, minVersion, StringComparison.Ordinal);
return comparison >= 0; return comparison >= 0;
} }
@@ -508,9 +508,9 @@ namespace ASCOM.Meade.net
return; return;
} }
_sharedResourcesWrapper.Lock(() => SharedResourcesWrapper.Lock(() =>
{ {
var result = _sharedResourcesWrapper.SendString(":GZ#"); var result = SharedResourcesWrapper.SendString(":GZ#");
//:GZ# Get telescope azimuth //:GZ# Get telescope azimuth
//Returns: DDD*MM# or DDD*MMSS# //Returns: DDD*MM# or DDD*MMSS#
//The current telescope Azimuth depending on the selected precision. //The current telescope Azimuth depending on the selected precision.
@@ -520,7 +520,7 @@ namespace ASCOM.Meade.net
if (IsLongFormat != setLongFormat) if (IsLongFormat != setLongFormat)
{ {
_utilities.WaitForMilliseconds(500); _utilities.WaitForMilliseconds(500);
_sharedResourcesWrapper.SendBlind(":U#"); SharedResourcesWrapper.SendBlind(":U#");
//:U# Toggle between low/hi precision positions //:U# Toggle between low/hi precision positions
//Low - RA displays and messages HH:MM.T sDD*MM //Low - RA displays and messages HH:MM.T sDD*MM
//High - Dec / Az / El displays and messages HH:MM: SS sDD*MM:SS //High - Dec / Az / El displays and messages HH:MM: SS sDD*MM:SS
@@ -534,7 +534,7 @@ namespace ASCOM.Meade.net
private bool TogglePrecision() private bool TogglePrecision()
{ {
LogMessage("TogglePrecision", "Toggling slewing precision"); LogMessage("TogglePrecision", "Toggling slewing precision");
var result = _sharedResourcesWrapper.SendChar(":P#"); var result = SharedResourcesWrapper.SendChar(":P#");
//:P# Toggles High Precsion Pointing. When High precision pointing is enabled scope will first allow the operator to center a nearby bright star before moving to the actual target. //:P# Toggles High Precsion Pointing. When High precision pointing is enabled scope will first allow the operator to center a nearby bright star before moving to the actual target.
//Returns: <string> //Returns: <string>
//“HIGH PRECISION” Current setting after this command. //“HIGH PRECISION” Current setting after this command.
@@ -552,10 +552,10 @@ namespace ASCOM.Meade.net
break; break;
} }
_sharedResourcesWrapper.ReadCharacters(throwAwayCharacters); SharedResourcesWrapper.ReadCharacters(throwAwayCharacters);
//Make sure that the buffers are cleared out. //Make sure that the buffers are cleared out.
_sharedResourcesWrapper.SendBlind("#"); SharedResourcesWrapper.SendBlind("#");
return highPrecision; return highPrecision;
} }
@@ -574,7 +574,7 @@ namespace ASCOM.Meade.net
{ {
CheckConnectedAndValidateSite(site, "SelectSite"); CheckConnectedAndValidateSite(site, "SelectSite");
_sharedResourcesWrapper.SendBlind($":W{site}#"); SharedResourcesWrapper.SendBlind($":W{site}#");
//:W<n># //:W<n>#
//Set current site to<n>, an ASCII digit in the range 1..4 //Set current site to<n>, an ASCII digit in the range 1..4
//Returns: Nothing //Returns: Nothing
@@ -635,7 +635,7 @@ namespace ASCOM.Meade.net
throw new ArgumentOutOfRangeException(nameof(site), site, Resources.Telescope_GetSiteName_Site_out_of_range); throw new ArgumentOutOfRangeException(nameof(site), site, Resources.Telescope_GetSiteName_Site_out_of_range);
} }
var result = _sharedResourcesWrapper.SendChar(command); var result = SharedResourcesWrapper.SendChar(command);
if (result != "1") if (result != "1")
{ {
throw new InvalidOperationException("Failed to set site name."); throw new InvalidOperationException("Failed to set site name.");
@@ -649,22 +649,22 @@ namespace ASCOM.Meade.net
switch (site) switch (site)
{ {
case 1: case 1:
return _sharedResourcesWrapper.SendString(":GM#"); return SharedResourcesWrapper.SendString(":GM#");
//:GM# Get Site 1 Name //:GM# Get Site 1 Name
//Returns: <string># //Returns: <string>#
//A # terminated string with the name of the requested site. //A # terminated string with the name of the requested site.
case 2: case 2:
return _sharedResourcesWrapper.SendString(":GN#"); return SharedResourcesWrapper.SendString(":GN#");
//:GN# Get Site 2 Name //:GN# Get Site 2 Name
//Returns: <string># //Returns: <string>#
//A # terminated string with the name of the requested site. //A # terminated string with the name of the requested site.
case 3: case 3:
return _sharedResourcesWrapper.SendString(":GO#"); return SharedResourcesWrapper.SendString(":GO#");
//:GO# Get Site 3 Name //:GO# Get Site 3 Name
//Returns: <string># //Returns: <string>#
//A # terminated string with the name of the requested site. //A # terminated string with the name of the requested site.
case 4: case 4:
return _sharedResourcesWrapper.SendString(":GP#"); return SharedResourcesWrapper.SendString(":GP#");
//:GP# Get Site 4 Name //:GP# Get Site 4 Name
//Returns: <string># //Returns: <string>#
//A # terminated string with the name of the requested site. //A # terminated string with the name of the requested site.
@@ -713,7 +713,7 @@ namespace ASCOM.Meade.net
CheckConnected("AbortSlew"); CheckConnected("AbortSlew");
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
@@ -731,7 +731,7 @@ namespace ASCOM.Meade.net
const char ack = (char) 6; const char ack = (char) 6;
var alignmentString = _sharedResourcesWrapper.SendChar(ack.ToString()); var alignmentString = SharedResourcesWrapper.SendChar(ack.ToString());
//ACK <0x06> Query of alignment mounting mode. //ACK <0x06> Query of alignment mounting mode.
//Returns: //Returns:
//A If scope in AltAz Mode //A If scope in AltAz Mode
@@ -782,13 +782,13 @@ namespace ASCOM.Meade.net
switch (value) switch (value)
{ {
case AlignmentModes.algAltAz: case AlignmentModes.algAltAz:
_sharedResourcesWrapper.SendBlind(":AA#"); SharedResourcesWrapper.SendBlind(":AA#");
//:AA# Sets telescope the AltAz alignment mode //:AA# Sets telescope the AltAz alignment mode
//Returns: nothing //Returns: nothing
break; break;
case AlignmentModes.algPolar: case AlignmentModes.algPolar:
case AlignmentModes.algGermanPolar: case AlignmentModes.algGermanPolar:
_sharedResourcesWrapper.SendBlind(":AP#"); SharedResourcesWrapper.SendBlind(":AP#");
//:AP# Sets telescope to Polar alignment mode //:AP# Sets telescope to Polar alignment mode
//Returns: nothing //Returns: nothing
break; break;
@@ -828,7 +828,7 @@ namespace ASCOM.Meade.net
private HorizonCoordinates CalcAltAzFromTelescopeEqData() private HorizonCoordinates CalcAltAzFromTelescopeEqData()
{ {
var altitudeData = _sharedResourcesWrapper.Lock(() => new AltitudeData var altitudeData = SharedResourcesWrapper.Lock(() => new AltitudeData
{ {
UtcDateTime = UTCDate, UtcDateTime = UTCDate,
SiteLongitude = SiteLongitude, SiteLongitude = SiteLongitude,
@@ -1084,7 +1084,7 @@ namespace ASCOM.Meade.net
{ {
CheckConnected("Declination Get"); CheckConnected("Declination Get");
var result = _sharedResourcesWrapper.SendString(":GD#"); var result = SharedResourcesWrapper.SendString(":GD#");
//:GD# Get Telescope Declination. //:GD# Get Telescope Declination.
//Returns: sDD*MM# or sDD*MMSS# //Returns: sDD*MM# or sDD*MMSS#
//Depending upon the current precision setting for the telescope. //Depending upon the current precision setting for the telescope.
@@ -1172,7 +1172,7 @@ namespace ASCOM.Meade.net
} }
LogMessage($"{propertyName} Set", $"Setting new guiderate {value.ToString(CultureInfo.CurrentCulture)} arc seconds/second ({value.ToString(CultureInfo.CurrentCulture)} degrees/second)"); LogMessage($"{propertyName} Set", $"Setting new guiderate {value.ToString(CultureInfo.CurrentCulture)} arc seconds/second ({value.ToString(CultureInfo.CurrentCulture)} degrees/second)");
_sharedResourcesWrapper.SendBlind($":Rg{value:00.0}#"); SharedResourcesWrapper.SendBlind($":Rg{value:00.0}#");
//:RgSS.S# //:RgSS.S#
//Set guide rate to +/ -SS.S to arc seconds per second.This rate is added to or subtracted from the current tracking //Set guide rate to +/ -SS.S to arc seconds per second.This rate is added to or subtracted from the current tracking
//Rates when the CCD guider or handbox guider buttons are pressed when the guide rate is selected.Rate shall not exceed //Rates when the CCD guider or handbox guider buttons are pressed when the guide rate is selected.Rate shall not exceed
@@ -1253,22 +1253,22 @@ namespace ASCOM.Meade.net
//do nothing, it's ok this time as we're halting the slew. //do nothing, it's ok this time as we're halting the slew.
break; break;
case 1: case 1:
_sharedResourcesWrapper.SendBlind(":RG#"); SharedResourcesWrapper.SendBlind(":RG#");
//:RG# Set Slew rate to Guiding Rate (slowest) //:RG# Set Slew rate to Guiding Rate (slowest)
//Returns: Nothing //Returns: Nothing
break; break;
case 2: case 2:
_sharedResourcesWrapper.SendBlind(":RC#"); SharedResourcesWrapper.SendBlind(":RC#");
//:RC# Set Slew rate to Centering rate (2nd slowest) //:RC# Set Slew rate to Centering rate (2nd slowest)
//Returns: Nothing //Returns: Nothing
break; break;
case 3: case 3:
_sharedResourcesWrapper.SendBlind(":RM#"); SharedResourcesWrapper.SendBlind(":RM#");
//:RM# Set Slew rate to Find Rate (2nd Fastest) //:RM# Set Slew rate to Find Rate (2nd Fastest)
//Returns: Nothing //Returns: Nothing
break; break;
case 4: case 4:
_sharedResourcesWrapper.SendBlind(":RS#"); SharedResourcesWrapper.SendBlind(":RS#");
//:RS# Set Slew rate to max (fastest) //:RS# Set Slew rate to max (fastest)
//Returns: Nothing //Returns: Nothing
break; break;
@@ -1283,22 +1283,22 @@ namespace ASCOM.Meade.net
{ {
case ComparisonResult.Equals: case ComparisonResult.Equals:
_movingPrimary = false; _movingPrimary = false;
_sharedResourcesWrapper.SendBlind(":Qe#"); SharedResourcesWrapper.SendBlind(":Qe#");
//:Qe# Halt eastward Slews //:Qe# Halt eastward Slews
//Returns: Nothing //Returns: Nothing
_sharedResourcesWrapper.SendBlind(":Qw#"); SharedResourcesWrapper.SendBlind(":Qw#");
//:Qw# Halt westward Slews //:Qw# Halt westward Slews
//Returns: Nothing //Returns: Nothing
break; break;
case ComparisonResult.Greater: case ComparisonResult.Greater:
_sharedResourcesWrapper.SendBlind(":Me#"); SharedResourcesWrapper.SendBlind(":Me#");
//:Me# Move Telescope East at current slew rate //:Me# Move Telescope East at current slew rate
//Returns: Nothing //Returns: Nothing
_movingPrimary = true; _movingPrimary = true;
break; break;
case ComparisonResult.Lower: case ComparisonResult.Lower:
_sharedResourcesWrapper.SendBlind(":Mw#"); SharedResourcesWrapper.SendBlind(":Mw#");
//:Mw# Move Telescope West at current slew rate //:Mw# Move Telescope West at current slew rate
//Returns: Nothing //Returns: Nothing
_movingPrimary = true; _movingPrimary = true;
@@ -1310,21 +1310,21 @@ namespace ASCOM.Meade.net
{ {
case ComparisonResult.Equals: case ComparisonResult.Equals:
_movingSecondary = false; _movingSecondary = false;
_sharedResourcesWrapper.SendBlind(":Qn#"); SharedResourcesWrapper.SendBlind(":Qn#");
//:Qn# Halt northward Slews //:Qn# Halt northward Slews
//Returns: Nothing //Returns: Nothing
_sharedResourcesWrapper.SendBlind(":Qs#"); SharedResourcesWrapper.SendBlind(":Qs#");
//:Qs# Halt southward Slews //:Qs# Halt southward Slews
//Returns: Nothing //Returns: Nothing
break; break;
case ComparisonResult.Greater: case ComparisonResult.Greater:
_sharedResourcesWrapper.SendBlind(":Mn#"); SharedResourcesWrapper.SendBlind(":Mn#");
//:Mn# Move Telescope North at current slew rate //:Mn# Move Telescope North at current slew rate
//Returns: Nothing //Returns: Nothing
_movingSecondary = true; _movingSecondary = true;
break; break;
case ComparisonResult.Lower: case ComparisonResult.Lower:
_sharedResourcesWrapper.SendBlind(":Ms#"); SharedResourcesWrapper.SendBlind(":Ms#");
//:Ms# Move Telescope South at current slew rate //:Ms# Move Telescope South at current slew rate
//Returns: Nothing //Returns: Nothing
_movingSecondary = true; _movingSecondary = true;
@@ -1346,7 +1346,7 @@ namespace ASCOM.Meade.net
if (AtPark) if (AtPark)
return; return;
_sharedResourcesWrapper.SendBlind(":hP#"); SharedResourcesWrapper.SendBlind(":hP#");
//:hP# Autostar, Autostar II and LX 16”Slew to Park Position //:hP# Autostar, Autostar II and LX 16”Slew to Park Position
//Returns: Nothing //Returns: Nothing
AtPark = true; AtPark = true;
@@ -1396,7 +1396,7 @@ namespace ASCOM.Meade.net
} }
LogMessage("PulseGuide", "Using new pulse guiding technique"); LogMessage("PulseGuide", "Using new pulse guiding technique");
_sharedResourcesWrapper.SendBlind($":Mg{d}{duration:0000}#"); SharedResourcesWrapper.SendBlind($":Mg{d}{duration:0000}#");
//:MgnDDDD# //:MgnDDDD#
//:MgsDDDD# //:MgsDDDD#
//:MgeDDDD# //:MgeDDDD#
@@ -1461,7 +1461,7 @@ namespace ASCOM.Meade.net
get get
{ {
CheckConnected("RightAscension Get"); CheckConnected("RightAscension Get");
var result = _sharedResourcesWrapper.SendString(":GR#"); var result = SharedResourcesWrapper.SendString(":GR#");
//:GR# Get Telescope RA //:GR# Get Telescope RA
//Returns: HH:MM.T# or HH:MM:SS# //Returns: HH:MM.T# or HH:MM:SS#
//Depending which precision is set for the telescope //Depending which precision is set for the telescope
@@ -1557,7 +1557,7 @@ namespace ASCOM.Meade.net
{ {
CheckConnected("SiteLatitude Get"); CheckConnected("SiteLatitude Get");
var latitude = _sharedResourcesWrapper.SendString(":Gt#"); var latitude = SharedResourcesWrapper.SendString(":Gt#");
//:Gt# Get Current Site Latitude //:Gt# Get Current Site Latitude
//Returns: sDD* MM# //Returns: sDD* MM#
//The latitude of the current site. Positive inplies North latitude. //The latitude of the current site. Positive inplies North latitude.
@@ -1585,7 +1585,7 @@ namespace ASCOM.Meade.net
int m = Convert.ToInt32(60 * (absValue - d)); int m = Convert.ToInt32(60 * (absValue - d));
var commandString = $":St{sign}{d:00}*{m:00}#"; var commandString = $":St{sign}{d:00}*{m:00}#";
var result = _sharedResourcesWrapper.SendChar(commandString); var result = SharedResourcesWrapper.SendChar(commandString);
//:StsDD*MM# //:StsDD*MM#
//Sets the current site latitude to sDD* MM# //Sets the current site latitude to sDD* MM#
//Returns: //Returns:
@@ -1602,7 +1602,7 @@ namespace ASCOM.Meade.net
{ {
CheckConnected("SiteLongitude Get"); CheckConnected("SiteLongitude Get");
var longitude = _sharedResourcesWrapper.SendString(":Gg#"); var longitude = SharedResourcesWrapper.SendString(":Gg#");
//:Gg# Get Current Site Longitude //:Gg# Get Current Site Longitude
//Returns: sDDD*MM# //Returns: sDDD*MM#
//The current site Longitude. East Longitudes are expressed as negative //The current site Longitude. East Longitudes are expressed as negative
@@ -1640,7 +1640,7 @@ namespace ASCOM.Meade.net
var commandstring = $":Sg{d:000}*{m:00}#"; var commandstring = $":Sg{d:000}*{m:00}#";
var result = _sharedResourcesWrapper.SendChar(commandstring); var result = SharedResourcesWrapper.SendChar(commandstring);
//:SgDDD*MM# //:SgDDD*MM#
//Set current sites longitude to DDD*MM an ASCII position string //Set current sites longitude to DDD*MM an ASCII position string
//Returns: //Returns:
@@ -1703,7 +1703,7 @@ namespace ASCOM.Meade.net
var latitude = SiteLatitude; var latitude = SiteLatitude;
var longitude = SiteLongitude; var longitude = SiteLongitude;
_sharedResourcesWrapper.Lock(() => SharedResourcesWrapper.Lock(() =>
{ {
var raDec = _astroMaths.ConvertHozToEq(utcDateTime, latitude, longitude, altAz); var raDec = _astroMaths.ConvertHozToEq(utcDateTime, latitude, longitude, altAz);
@@ -1723,12 +1723,12 @@ namespace ASCOM.Meade.net
{ {
CheckConnected("DoSlewAsync"); CheckConnected("DoSlewAsync");
_sharedResourcesWrapper.Lock(() => SharedResourcesWrapper.Lock(() =>
{ {
switch (polar) switch (polar)
{ {
case true: case true:
var response = _sharedResourcesWrapper.SendChar(":MS#"); var response = SharedResourcesWrapper.SendChar(":MS#");
//:MS# Slew to Target Object //:MS# Slew to Target Object
//Returns: //Returns:
//0 Slew is Possible //0 Slew is Possible
@@ -1743,17 +1743,17 @@ namespace ASCOM.Meade.net
break; break;
case "1": case "1":
//Below Horizon //Below Horizon
string belowHorizonMessage = _sharedResourcesWrapper.ReadTerminated(); string belowHorizonMessage = SharedResourcesWrapper.ReadTerminated();
LogMessage("DoSlewAsync", $"Slew failed \"{belowHorizonMessage}\""); LogMessage("DoSlewAsync", $"Slew failed \"{belowHorizonMessage}\"");
throw new InvalidOperationException(belowHorizonMessage); throw new InvalidOperationException(belowHorizonMessage);
case "2": case "2":
//Below minimum elevation //Below minimum elevation
string belowMinimumElevationMessage = _sharedResourcesWrapper.ReadTerminated(); string belowMinimumElevationMessage = SharedResourcesWrapper.ReadTerminated();
LogMessage("DoSlewAsync", $"Slew failed \"{belowMinimumElevationMessage}\""); LogMessage("DoSlewAsync", $"Slew failed \"{belowMinimumElevationMessage}\"");
throw new InvalidOperationException(belowMinimumElevationMessage); throw new InvalidOperationException(belowMinimumElevationMessage);
case "3": case "3":
//Telescope can hit the mount //Telescope can hit the mount
string canHitMountMessage = _sharedResourcesWrapper.ReadTerminated(); string canHitMountMessage = SharedResourcesWrapper.ReadTerminated();
LogMessage("DoSlewAsync", $"Slew failed \"{canHitMountMessage}\""); LogMessage("DoSlewAsync", $"Slew failed \"{canHitMountMessage}\"");
throw new InvalidOperationException(canHitMountMessage); throw new InvalidOperationException(canHitMountMessage);
default: default:
@@ -1764,7 +1764,7 @@ namespace ASCOM.Meade.net
break; break;
case false: case false:
var maResponse = _sharedResourcesWrapper.SendChar(":MA#"); var maResponse = SharedResourcesWrapper.SendChar(":MA#");
//:MA# Autostar, LX 16”, Autostar II Slew to target Alt and Az //:MA# Autostar, LX 16”, Autostar II Slew to target Alt and Az
//Returns: //Returns:
//0 - No fault //0 - No fault
@@ -1801,7 +1801,7 @@ namespace ASCOM.Meade.net
LogMessage("SlewToCoordinatesAsync", $"Ra={rightAscension}, Dec={declination}"); LogMessage("SlewToCoordinatesAsync", $"Ra={rightAscension}, Dec={declination}");
CheckConnected("SlewToCoordinatesAsync"); CheckConnected("SlewToCoordinatesAsync");
_sharedResourcesWrapper.Lock(() => SharedResourcesWrapper.Lock(() =>
{ {
TargetRightAscension = rightAscension; TargetRightAscension = rightAscension;
TargetDeclination = declination; TargetDeclination = declination;
@@ -1864,7 +1864,7 @@ namespace ASCOM.Meade.net
if (_isGuiding) if (_isGuiding)
return false; return false;
var result = _sharedResourcesWrapper.SendString(":D#"); var result = SharedResourcesWrapper.SendString(":D#");
//:D# Requests a string of bars indicating the distance to the current target location. //:D# Requests a string of bars indicating the distance to the current target location.
//Returns: //Returns:
//LX200's a string of bar characters indicating the distance. //LX200's a string of bar characters indicating the distance.
@@ -1892,7 +1892,7 @@ namespace ASCOM.Meade.net
LogMessage("SyncToCoordinates", $"RA={rightAscension} Dec={declination}"); LogMessage("SyncToCoordinates", $"RA={rightAscension} Dec={declination}");
CheckConnected("SyncToCoordinates"); CheckConnected("SyncToCoordinates");
_sharedResourcesWrapper.Lock(() => SharedResourcesWrapper.Lock(() =>
{ {
TargetRightAscension = rightAscension; TargetRightAscension = rightAscension;
TargetDeclination = declination; TargetDeclination = declination;
@@ -1906,7 +1906,7 @@ namespace ASCOM.Meade.net
LogMessage("SyncToTarget", "Executing"); LogMessage("SyncToTarget", "Executing");
CheckConnected("SyncToTarget"); CheckConnected("SyncToTarget");
var result = _sharedResourcesWrapper.SendString(":CM#"); var result = SharedResourcesWrapper.SendString(":CM#");
//:CM# Synchronizes the telescope's position with the currently selected database object's coordinates. //:CM# Synchronizes the telescope's position with the currently selected database object's coordinates.
//Returns: //Returns:
//LX200's - a "#" terminated string with the name of the object that was synced. //LX200's - a "#" terminated string with the name of the object that was synced.
@@ -1955,7 +1955,7 @@ namespace ASCOM.Meade.net
var command = $":Sd{s}{dms}#"; var command = $":Sd{s}{dms}#";
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
//Returns: //Returns:
@@ -2003,7 +2003,7 @@ namespace ASCOM.Meade.net
//todo implement the low precision version //todo implement the low precision version
var hms = _utilities.HoursToHMS(value, ":", ":", ":", 2); var hms = _utilities.HoursToHMS(value, ":", ":", ":", 2);
var response = _sharedResourcesWrapper.SendChar($":Sr{hms}#"); var response = SharedResourcesWrapper.SendChar($":Sr{hms}#");
//:SrHH:MM.T# //:SrHH:MM.T#
//:SrHH:MM:SS# //:SrHH:MM:SS#
//Set target object RA to HH:MM.T or HH: MM: SS depending on the current precision setting. //Set target object RA to HH:MM.T or HH: MM: SS depending on the current precision setting.
@@ -2062,12 +2062,12 @@ namespace ASCOM.Meade.net
switch (value) switch (value)
{ {
case DriveRates.driveSidereal: case DriveRates.driveSidereal:
_sharedResourcesWrapper.SendBlind(":TQ#"); SharedResourcesWrapper.SendBlind(":TQ#");
//:TQ# Selects sidereal tracking rate //:TQ# Selects sidereal tracking rate
//Returns: Nothing //Returns: Nothing
break; break;
case DriveRates.driveLunar: case DriveRates.driveLunar:
_sharedResourcesWrapper.SendBlind(":TL#"); SharedResourcesWrapper.SendBlind(":TL#");
//:TL# Set Lunar Tracking Rage //:TL# Set Lunar Tracking Rage
//Returns: Nothing //Returns: Nothing
break; break;
@@ -2104,7 +2104,7 @@ namespace ASCOM.Meade.net
private TimeSpan GetUtcCorrection() private TimeSpan GetUtcCorrection()
{ {
string utcOffSet = _sharedResourcesWrapper.SendString(":GG#"); string utcOffSet = SharedResourcesWrapper.SendString(":GG#");
//:GG# Get UTC offset time //:GG# Get UTC offset time
//Returns: sHH# or sHH.H# //Returns: sHH# or sHH.H#
//The number of decimal hours to add to local time to convert it to UTC. If the number is a whole number the //The number of decimal hours to add to local time to convert it to UTC. If the number is a whole number the
@@ -2129,15 +2129,15 @@ namespace ASCOM.Meade.net
LogMessage("UTCDate", "Get started"); LogMessage("UTCDate", "Get started");
var telescopeDateDetails = _sharedResourcesWrapper.Lock(() => var telescopeDateDetails = SharedResourcesWrapper.Lock(() =>
{ {
var tdd = new TelescopeDateDetails var tdd = new TelescopeDateDetails
{ {
TelescopeDate = _sharedResourcesWrapper.SendString(":GC#"), TelescopeDate = SharedResourcesWrapper.SendString(":GC#"),
//:GC# Get current date. //:GC# Get current date.
//Returns: MM/DD/YY# //Returns: MM/DD/YY#
//The current local calendar date for the telescope. //The current local calendar date for the telescope.
TelescopeTime = _sharedResourcesWrapper.SendString(":GL#"), TelescopeTime = SharedResourcesWrapper.SendString(":GL#"),
//:GL# Get Local Time in 24 hour format //:GL# Get Local Time in 24 hour format
//Returns: HH:MM:SS# //Returns: HH:MM:SS#
//The Local Time in 24 - hour Format //The Local Time in 24 - hour Format
@@ -2173,13 +2173,13 @@ namespace ASCOM.Meade.net
CheckConnected("UTCDate Set"); CheckConnected("UTCDate Set");
_sharedResourcesWrapper.Lock(() => SharedResourcesWrapper.Lock(() =>
{ {
var utcCorrection = GetUtcCorrection(); var utcCorrection = GetUtcCorrection();
var localDateTime = value - utcCorrection; var localDateTime = value - utcCorrection;
string localStingCommand = $":SL{localDateTime:HH:mm:ss}#"; string localStingCommand = $":SL{localDateTime:HH:mm:ss}#";
var timeResult = _sharedResourcesWrapper.SendChar(localStingCommand); var timeResult = SharedResourcesWrapper.SendChar(localStingCommand);
//:SLHH:MM:SS# //:SLHH:MM:SS#
//Set the local Time //Set the local Time
//Returns: //Returns:
@@ -2191,7 +2191,7 @@ namespace ASCOM.Meade.net
} }
string localDateCommand = $":SC{localDateTime:MM/dd/yy}#"; string localDateCommand = $":SC{localDateTime:MM/dd/yy}#";
var dateResult = _sharedResourcesWrapper.SendChar(localDateCommand); var dateResult = SharedResourcesWrapper.SendChar(localDateCommand);
//:SCMM/DD/YY# //:SCMM/DD/YY#
//Change Handbox Date to MM/DD/YY //Change Handbox Date to MM/DD/YY
//Returns: <D><string> //Returns: <D><string>
@@ -2204,8 +2204,8 @@ namespace ASCOM.Meade.net
} }
//throwing away these two strings which represent //throwing away these two strings which represent
_sharedResourcesWrapper.ReadTerminated(); //Updating Planetary Data# SharedResourcesWrapper.ReadTerminated(); //Updating Planetary Data#
_sharedResourcesWrapper.ReadTerminated(); // # SharedResourcesWrapper.ReadTerminated(); // #
}); });
} }
} }
@@ -2320,12 +2320,12 @@ namespace ASCOM.Meade.net
{ {
var profileProperties = new ProfileProperties var profileProperties = new ProfileProperties
{ {
TraceLogger = _tl.Enabled, TraceLogger = Tl.Enabled,
ComPort = ComPort, ComPort = ComPort,
GuideRateArcSecondsPerSecond = GuideRate GuideRateArcSecondsPerSecond = GuideRate
}; };
_sharedResourcesWrapper.WriteProfile(profileProperties); SharedResourcesWrapper.WriteProfile(profileProperties);
} }
#endregion #endregion
} }
@@ -375,7 +375,10 @@ namespace Meade.net.UnitTests
_serialMock.Setup(x => x.Transmit("#:GG#")).Callback(() => { serialPortReturn = ""; }); _serialMock.Setup(x => x.Transmit("#:GG#")).Callback(() => { serialPortReturn = ""; });
_serialMock.Setup(x => x.ReceiveTerminated("#")).Returns(() => serialPortReturn); _serialMock.Setup(x => x.ReceiveTerminated("#")).Returns(() => serialPortReturn);
var result = Assert.Throws<FormatException>(() => { var connectionResult = SharedResources.Connect(deviceId, string.Empty, _traceLoggerMock.Object); }); var result = Assert.Throws<FormatException>(() =>
{
SharedResources.Connect(deviceId, string.Empty, _traceLoggerMock.Object);
});
Assert.That(result.Message, Is.EqualTo("Input string was not in a correct format.")); Assert.That(result.Message, Is.EqualTo("Input string was not in a correct format."));
_traceLoggerMock.Verify( x => x.LogIssue("Connect", "Unable to decode response from the telescope, This is likely a hardware serial communications error."), Times.Once); _traceLoggerMock.Verify( x => x.LogIssue("Connect", "Unable to decode response from the telescope, This is likely a hardware serial communications error."), Times.Once);
+32 -32
View File
@@ -78,17 +78,17 @@ namespace ASCOM.Meade.net
/// </summary> /// </summary>
public void SetupDialog() public void SetupDialog()
{ {
_tl.LogMessage("SetupDialog", "Opening setup dialog"); Tl.LogMessage("SetupDialog", "Opening setup dialog");
_sharedResourcesWrapper.SetupDialog(); SharedResourcesWrapper.SetupDialog();
ReadProfile(); ReadProfile();
_tl.LogMessage("SetupDialog", "complete"); Tl.LogMessage("SetupDialog", "complete");
} }
public ArrayList SupportedActions public ArrayList SupportedActions
{ {
get get
{ {
_tl.LogMessage("SupportedActions Get", "Returning empty arraylist"); Tl.LogMessage("SupportedActions Get", "Returning empty arraylist");
return new ArrayList(); return new ArrayList();
} }
} }
@@ -104,7 +104,7 @@ namespace ASCOM.Meade.net
CheckConnected("CommandBlind"); CheckConnected("CommandBlind");
// Call CommandString and return as soon as it finishes // Call CommandString and return as soon as it finishes
//this.CommandString(command, raw); //this.CommandString(command, raw);
_sharedResourcesWrapper.SendBlind(command); SharedResourcesWrapper.SendBlind(command);
// or // or
//throw new ASCOM.MethodNotImplementedException("CommandBlind"); //throw new ASCOM.MethodNotImplementedException("CommandBlind");
// DO NOT have both these sections! One or the other // DO NOT have both these sections! One or the other
@@ -126,16 +126,16 @@ namespace ASCOM.Meade.net
// it's a good idea to put all the low level communication with the device here, // it's a good idea to put all the low level communication with the device here,
// then all communication calls this function // then all communication calls this function
// 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 ASCOM.MethodNotImplementedException("CommandString");
} }
public void Dispose() public void Dispose()
{ {
// Clean up the tracelogger and util objects // Clean up the tracelogger and util objects
_tl.Enabled = false; Tl.Enabled = false;
_tl.Dispose(); Tl.Dispose();
_tl = null; Tl = null;
} }
public bool Connected public bool Connected
@@ -147,7 +147,7 @@ namespace ASCOM.Meade.net
} }
set set
{ {
_tl.LogMessage("Connected", "Set {0}", value); Tl.LogMessage("Connected", "Set {0}", value);
if (value == IsConnected) if (value == IsConnected)
return; return;
@@ -156,14 +156,14 @@ namespace ASCOM.Meade.net
try try
{ {
ReadProfile(); ReadProfile();
_sharedResourcesWrapper.Connect("Serial", DriverId, _tl); SharedResourcesWrapper.Connect("Serial", DriverId, Tl);
try try
{ {
IsConnected = true; IsConnected = true;
} }
catch (Exception) catch (Exception)
{ {
_sharedResourcesWrapper.Disconnect("Serial", DriverId); SharedResourcesWrapper.Disconnect("Serial", DriverId);
throw; throw;
} }
} }
@@ -175,7 +175,7 @@ namespace ASCOM.Meade.net
else else
{ {
LogMessage("Connected Set", "Disconnecting from port {0}", ComPort); LogMessage("Connected Set", "Disconnecting from port {0}", ComPort);
_sharedResourcesWrapper.Disconnect("Serial", DriverId); SharedResourcesWrapper.Disconnect("Serial", DriverId);
IsConnected = false; IsConnected = false;
} }
} }
@@ -197,7 +197,7 @@ namespace ASCOM.Meade.net
{ {
//string name = "Short driver name - please customise"; //string name = "Short driver name - please customise";
string name = DriverDescription; string name = DriverDescription;
_tl.LogMessage("Name Get", name); Tl.LogMessage("Name Get", name);
return name; return name;
} }
} }
@@ -212,20 +212,20 @@ namespace ASCOM.Meade.net
{ {
CheckConnected("Absolute Get"); CheckConnected("Absolute Get");
_tl.LogMessage("Absolute Get", false.ToString()); Tl.LogMessage("Absolute Get", false.ToString());
return false; // This is a relative focuser return false; // This is a relative focuser
} }
} }
public void Halt() public void Halt()
{ {
_tl.LogMessage("Halt", "Halting"); Tl.LogMessage("Halt", "Halting");
CheckConnected("Halt"); CheckConnected("Halt");
//todo fix this issue: A single halt command is sometimes missed by the #909 apm, so let's do it a few times to be safe. //todo fix this issue: A single halt command is sometimes missed by the #909 apm, so let's do it a few times to be safe.
_sharedResourcesWrapper.SendBlind(":FQ#"); SharedResourcesWrapper.SendBlind(":FQ#");
//:FQ# Halt Focuser Motion //:FQ# Halt Focuser Motion
//Returns: Nothing //Returns: Nothing
} }
@@ -234,7 +234,7 @@ namespace ASCOM.Meade.net
{ {
get get
{ {
_tl.LogMessage("IsMoving Get", false.ToString()); Tl.LogMessage("IsMoving Get", false.ToString());
return false; // This focuser always moves instantaneously so no need for IsMoving ever to be True return false; // This focuser always moves instantaneously so no need for IsMoving ever to be True
} }
} }
@@ -243,12 +243,12 @@ namespace ASCOM.Meade.net
{ {
get get
{ {
_tl.LogMessage("Link Get", Connected.ToString()); Tl.LogMessage("Link Get", Connected.ToString());
return 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());
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
} }
} }
@@ -258,7 +258,7 @@ namespace ASCOM.Meade.net
{ {
get get
{ {
_tl.LogMessage("MaxIncrement Get", _maxIncrement.ToString()); Tl.LogMessage("MaxIncrement Get", _maxIncrement.ToString());
return _maxIncrement; // Maximum change in one move return _maxIncrement; // Maximum change in one move
} }
} }
@@ -268,14 +268,14 @@ namespace ASCOM.Meade.net
{ {
get get
{ {
_tl.LogMessage("MaxStep Get", _maxStep.ToString()); Tl.LogMessage("MaxStep Get", _maxStep.ToString());
return _maxStep; return _maxStep;
} }
} }
public void Move(int position) public void Move(int position)
{ {
_tl.LogMessage("Move", position.ToString()); Tl.LogMessage("Move", position.ToString());
CheckConnected("Move"); CheckConnected("Move");
if (position < -MaxIncrement || position > MaxIncrement) if (position < -MaxIncrement || position > MaxIncrement)
@@ -290,7 +290,7 @@ namespace ASCOM.Meade.net
if (ReverseFocusDirection) if (ReverseFocusDirection)
direction = !direction; direction = !direction;
_sharedResourcesWrapper.Lock(() => SharedResourcesWrapper.Lock(() =>
{ {
//backlash compensation. //backlash compensation.
var backlashCompensationSteps = direction ? Math.Abs(BacklashCompensation) : 0; var backlashCompensationSteps = direction ? Math.Abs(BacklashCompensation) : 0;
@@ -305,7 +305,7 @@ namespace ASCOM.Meade.net
//ApplyBacklashCompensation(direction); //ApplyBacklashCompensation(direction);
if (direction & backlashCompensationSteps != 0) if (direction & backlashCompensationSteps != 0)
{ {
_tl.LogMessage("Move", "Applying backlash compensation"); Tl.LogMessage("Move", "Applying backlash compensation");
MoveFocuser(!direction, backlashCompensationSteps); MoveFocuser(!direction, backlashCompensationSteps);
} }
@@ -320,7 +320,7 @@ namespace ASCOM.Meade.net
if (!UseDynamicBreaking) if (!UseDynamicBreaking)
return; return;
_tl.LogMessage("Move", "Applying dynamic breaking"); Tl.LogMessage("Move", "Applying dynamic breaking");
PerformFocuserMove(directionOut); PerformFocuserMove(directionOut);
Halt(); Halt();
@@ -349,7 +349,7 @@ namespace ASCOM.Meade.net
private void PerformFocuserMove(bool directionOut) private void PerformFocuserMove(bool directionOut)
{ {
_sharedResourcesWrapper.SendBlind(directionOut ? ":F+#" : ":F-#"); SharedResourcesWrapper.SendBlind(directionOut ? ":F+#" : ":F-#");
//:F+# Start Focuser moving inward (toward objective) //:F+# Start Focuser moving inward (toward objective)
//Returns: None //Returns: None
@@ -363,7 +363,7 @@ namespace ASCOM.Meade.net
{ {
get get
{ {
_tl.LogMessage("StepSize Get", "Not implemented"); Tl.LogMessage("StepSize Get", "Not implemented");
throw new PropertyNotImplementedException("StepSize", false); throw new PropertyNotImplementedException("StepSize", false);
} }
} }
@@ -372,13 +372,13 @@ namespace ASCOM.Meade.net
{ {
get get
{ {
_tl.LogMessage("TempComp Get", false.ToString()); Tl.LogMessage("TempComp Get", false.ToString());
return false; return false;
} }
// ReSharper disable once ValueParameterNotUsed // ReSharper disable once ValueParameterNotUsed
set set
{ {
_tl.LogMessage("TempComp Set", "Not implemented"); Tl.LogMessage("TempComp Set", "Not implemented");
throw new PropertyNotImplementedException("TempComp", false); throw new PropertyNotImplementedException("TempComp", false);
} }
} }
@@ -387,7 +387,7 @@ namespace ASCOM.Meade.net
{ {
get get
{ {
_tl.LogMessage("TempCompAvailable Get", false.ToString()); Tl.LogMessage("TempCompAvailable Get", false.ToString());
return false; // Temperature compensation is not available in this driver return false; // Temperature compensation is not available in this driver
} }
} }
@@ -396,7 +396,7 @@ namespace ASCOM.Meade.net
{ {
get get
{ {
_tl.LogMessage("Temperature Get", "Not implemented"); Tl.LogMessage("Temperature Get", "Not implemented");
throw new PropertyNotImplementedException("Temperature", false); throw new PropertyNotImplementedException("Temperature", false);
} }
} }
+10 -10
View File
@@ -12,7 +12,7 @@ namespace ASCOM.Meade.net
/// <summary> /// <summary>
/// Variable to hold the trace logger object (creates a diagnostic log file with information that you specify) /// Variable to hold the trace logger object (creates a diagnostic log file with information that you specify)
/// </summary> /// </summary>
protected static TraceLogger _tl; protected static TraceLogger Tl;
/// <summary> /// <summary>
/// Driver description that displays in the ASCOM Chooser. /// Driver description that displays in the ASCOM Chooser.
@@ -27,23 +27,23 @@ namespace ASCOM.Meade.net
protected string Precision; protected string Precision;
protected string GuidingStyle; protected string GuidingStyle;
protected readonly ISharedResourcesWrapper _sharedResourcesWrapper; protected readonly ISharedResourcesWrapper SharedResourcesWrapper;
public MeadeTelescopeBase() public MeadeTelescopeBase()
{ {
_sharedResourcesWrapper = new SharedResourcesWrapper(); SharedResourcesWrapper = new SharedResourcesWrapper();
} }
public MeadeTelescopeBase(ISharedResourcesWrapper sharedResourcesWrapper) public MeadeTelescopeBase(ISharedResourcesWrapper sharedResourcesWrapper)
{ {
_sharedResourcesWrapper = sharedResourcesWrapper; SharedResourcesWrapper = sharedResourcesWrapper;
} }
protected void Initialise() protected void Initialise()
{ {
var typeName = GetType().Name; var typeName = GetType().Name;
_tl = new TraceLogger("", $"Meade.Generic.{typeName}"); Tl = new TraceLogger("", $"Meade.Generic.{typeName}");
ReadProfile(); // Read device configuration from the ASCOM Profile store ReadProfile(); // Read device configuration from the ASCOM Profile store
@@ -58,8 +58,8 @@ namespace ASCOM.Meade.net
/// </summary> /// </summary>
protected void ReadProfile() protected void ReadProfile()
{ {
var profileProperties = _sharedResourcesWrapper.ReadProfile(); var profileProperties = SharedResourcesWrapper.ReadProfile();
_tl.Enabled = profileProperties.TraceLogger; Tl.Enabled = profileProperties.TraceLogger;
ComPort = profileProperties.ComPort; ComPort = profileProperties.ComPort;
BacklashCompensation = profileProperties.BacklashCompensation; BacklashCompensation = profileProperties.BacklashCompensation;
ReverseFocusDirection = profileProperties.ReverseFocusDirection; ReverseFocusDirection = profileProperties.ReverseFocusDirection;
@@ -68,7 +68,7 @@ namespace ASCOM.Meade.net
Precision = profileProperties.Precision; Precision = profileProperties.Precision;
GuidingStyle = profileProperties.GuidingStyle.ToLower(); GuidingStyle = profileProperties.GuidingStyle.ToLower();
LogMessage("ReadProfile", $"Trace logger enabled: {_tl.Enabled}"); LogMessage("ReadProfile", $"Trace logger enabled: {Tl.Enabled}");
LogMessage("ReadProfile", $"Com Port: {ComPort}"); LogMessage("ReadProfile", $"Com Port: {ComPort}");
LogMessage("ReadProfile", $"Backlash Steps: {BacklashCompensation}"); LogMessage("ReadProfile", $"Backlash Steps: {BacklashCompensation}");
LogMessage("ReadProfile", $"Dynamic breaking: {UseDynamicBreaking}"); LogMessage("ReadProfile", $"Dynamic breaking: {UseDynamicBreaking}");
@@ -86,7 +86,7 @@ namespace ASCOM.Meade.net
public static void LogMessage(string identifier, string message, params object[] args) public static void LogMessage(string identifier, string message, params object[] args)
{ {
var msg = String.Format(message, args); var msg = String.Format(message, args);
_tl.LogMessage(identifier, msg); Tl.LogMessage(identifier, msg);
} }
/// <summary> /// <summary>
@@ -98,7 +98,7 @@ namespace ASCOM.Meade.net
{ {
get get
{ {
_tl.LogMessage("Description Get", DriverDescription); Tl.LogMessage("Description Get", DriverDescription);
return DriverDescription; return DriverDescription;
} }
} }