Compare commits

..

46 Commits

Author SHA1 Message Date
ColinD 43ec63b0f5 Merged in develop (pull request #29)
Develop
2021-04-25 19:54:35 +00:00
ColinD f354bcdee1 Merged in feature/AddDateTimeByPass (pull request #28)
Feature/AddDateTimeByPass
2021-04-25 19:27:23 +00:00
ColinD e32c2aa50a Sorted out some code inspection issues 2021-04-25 20:16:07 +01:00
ColinD 795dc0c741 Added parked behaviour modes to the unit testing. 2021-04-25 19:58:09 +01:00
ColinD 22a8a794ba Added unit tests for check Parked, when parked mode is set to no coordinates 2021-04-25 19:17:56 +01:00
ColinD c6b54e273d Added unit testing for bypass feature, and setting the date on first connection 2021-04-25 18:27:44 +01:00
ColinD 7eec6c0008 Fixed some issued with the telescope parking and unparking. Now reports reported correctly for the LX200GPS, and Autostars 2021-04-24 22:29:11 +01:00
ColinD f9bb2aa879 Fixed the date format for the bypass date time setting for the LX-200GPS 2021-04-24 21:23:12 +01:00
ColinD 18ea52c972 Impemented the code changes to return co-ordinated when the telescope is parked.
Also added loads of checks for if the telescope is parked.
2021-04-24 20:52:21 +01:00
ColinD f4eafa668d Added a log for the display output 2021-04-24 19:30:46 +01:00
ColinD 53abdba374 Added extra logging. 2021-04-24 19:20:05 +01:00
ColinD fdd008fcfb Adding support for sending co-ordinates when scope is parked. 2021-04-24 19:16:36 +01:00
ColinD eaeae4d66b Combined the skip prompts and set date time code, to just one check box. 2021-04-24 13:16:08 +01:00
ColinD 6ac80c408c Fixed problem with changing the modifying the profile on the fly! 2021-04-24 13:07:42 +01:00
ColinD 9c5620edee Going to try the proper command for bypassing the date entry for AutostarII 2021-04-23 21:13:46 +01:00
ColinD ad40eb8b9a Fixed problem with Autostar not returning the correct value for IsSlewing 2021-04-23 20:45:48 +01:00
ColinD aca01de4ee Added a # prefix before the commands. 2021-04-23 19:45:10 +01:00
ColinD 384deecc3f More attempts to detect the slewing character 2021-04-23 19:11:45 +01:00
ColinD b27adf2649 Added check that returns [7F] when slewing 2021-04-23 18:58:14 +01:00
ColinD 2776b469c8 Fixed broken logic, and fixed broken unit tests. 2021-04-23 18:26:49 +01:00
ColinD fc3c91b975 Added extra logging to get slewing 2021-04-23 17:14:33 +01:00
ColinD e7c81aba24 Added code to force the date time to happen after the display bypass for autostar 497's 2021-04-23 16:51:05 +01:00
ColinD a15bf22785 Switched the order of the setting of the date and time, then skipping the prompts. 2021-04-23 15:00:03 +01:00
ColinD ed84313c2e Added initial display values bypass for the Autostar 497 2021-04-22 21:40:07 +01:00
ColinD e4af93dd07 Added ability to skip the prompts initial connect, and added ability to send the date and time on initial connect 2021-04-21 20:17:00 +01:00
ColinD 5538f51cf0 Merged in feature/SerialPort (pull request #27)
Feature/SerialPort
2021-04-21 16:35:02 +00:00
ColinD d0f12a604a Made the new serial options dropdownLists to help avoid ID10T errors. 2021-04-09 21:35:19 +01:00
ColinD 178ef8b11d Fixed the dataBits profile name, and upgraded the sharedresources unit tests for the new comport settings. 2021-04-09 20:43:12 +01:00
ColinD 0835431e76 Added new profile settings to the unit tests 2021-04-09 20:07:52 +01:00
ColinD bf6203d901 Added support for setting all serial properties. 2021-04-09 19:57:43 +01:00
ColinD 51bf99cb8c Started adding full serial port settings, so that people can do crazy things at their own risk. 2021-04-09 12:54:25 +01:00
ColinD 8713154e84 Merged in develop (pull request #26)
Version 1.0.0
2021-03-02 20:31:32 +00:00
ColinD 75b6f0b4b4 Added unit testing for the settle time delay on MoveAxis. 2021-03-02 20:24:43 +00:00
ColinD 032fb2e8a8 Code inspection 2021-03-02 20:24:13 +00:00
ColinD a5773aaaa9 Trying to change the inspections again 2021-03-02 14:23:42 +00:00
ColinD f88ad13f0d Testing to ignore unit tests from code inspections. 2021-03-02 14:02:12 +00:00
ColinD 9dde0d9e81 Another code inspection. 2021-03-02 13:49:02 +00:00
ColinD acc935248b Couple more code inspections, and changes the MoveAxis so that it will apply the settle time delay when not guiding. 2021-03-02 13:07:21 +00:00
ColinD cdf1066e4e Fixed a few more code inspections 2021-03-02 12:54:47 +00:00
ColinD f57a73843a Fixed a few code inspections 2021-03-01 11:19:27 +00:00
ColinD b0ef75ae66 Added code to include the settle time in the Moving Axis commands (except when moving at Guide Rate) 2021-03-01 09:55:07 +00:00
ColinD 136ccc8fa9 Added more places to initialise the slewing settle delay 2021-02-28 20:03:19 +00:00
ColinD e9491da707 Seperated the SlewSettleTime property from the ProfileSettle time, and implemented a delay on IsSlewing to use the combined SettleTimes 2021-02-27 21:20:06 +00:00
ColinD db06002ebf Added support for SlewSettleTime 2021-02-26 00:11:44 +00:00
ColinD ca1b7f8883 Merged in develop (pull request #24)
Made alteration to IsSlewing response when the LX200 returns a buffer of rubbish.
2021-02-10 10:24:54 +00:00
ColinD 14b5651795 Made alteration to IsSlewing response when the LX200 returns a buffer of rubbish. 2021-02-09 21:57:42 +00:00
26 changed files with 2561 additions and 488 deletions
-1
View File
@@ -218,5 +218,4 @@ _Pvt_Extensions
# nCrunch items
*.ncrunchsolution
*.DotSettings
*.ncrunchproject
@@ -90,6 +90,10 @@
<Project>{64308775-bd4a-469c-bcab-3ed830b811af}</Project>
<Name>Meade.net.Telescope</Name>
</ProjectReference>
<ProjectReference Include="..\Meade.net\Meade.net.csproj">
<Project>{3689a2cb-94c5-4012-a5cf-7e7d1dd27143}</Project>
<Name>Meade.net</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
@@ -27,6 +27,12 @@ namespace Meade.net.Focuser.UnitTests
{
TraceLogger = false,
ComPort = "TestCom1",
Speed = 9600,
Parity = "None",
Handshake = "None",
StopBits = "One",
DataBits = 8,
GuideRateArcSecondsPerSecond = 1.23,
Precision = "Unchanged",
GuidingStyle = "Auto"
@@ -153,11 +159,11 @@ namespace Meade.net.Focuser.UnitTests
ConnectFocuser();
_sharedResourcesWrapperMock.Setup(x => x.SendString(sendMessage)).Returns(() => expectedMessage);
_sharedResourcesWrapperMock.Setup(x => x.SendString(sendMessage, true)).Returns(() => expectedMessage);
var actualMessage = _focuser.CommandString(sendMessage, true);
_sharedResourcesWrapperMock.Verify(x => x.SendString(sendMessage), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.SendString(sendMessage, true), Times.Once);
Assert.That(actualMessage, Is.EqualTo(expectedMessage));
}
File diff suppressed because it is too large Load Diff
@@ -58,7 +58,7 @@ namespace ASCOM.Meade.net.AstroMaths
t0 -= 24;
}
var ut = DateTimeToDecimalHours(utcDateTime);
var ut = utcDateTime.DateTimeToDecimalHours();
var a = ut * 1.002737909;
var t1 = t0 + a;
+9
View File
@@ -0,0 +1,9 @@
using System;
namespace ASCOM.Meade.net
{
public class Clock : IClock
{
public DateTime UtcNow => DateTime.UtcNow;
}
}
+9
View File
@@ -0,0 +1,9 @@
using System;
namespace ASCOM.Meade.net
{
public interface IClock
{
DateTime UtcNow { get; }
}
}
@@ -122,10 +122,11 @@
<Compile Include="AstroMaths\AstroMathExtensions.cs" />
<Compile Include="AstroMaths\AstroMaths.cs" />
<Compile Include="AstroMaths\EquatorialCoordinates.cs" />
<Compile Include="AstroMaths\HorizonCoordinates.cs" />
<Compile Include="AstroMaths\IAstroMaths.cs" />
<Compile Include="Clock.cs" />
<Compile Include="ComparisonResult.cs" />
<Compile Include="DoubleExtensions.cs" />
<Compile Include="IClock.cs" />
<Compile Include="StringExtensions.cs" />
<Compile Include="Telescope.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
+383 -137
View File
@@ -60,16 +60,20 @@ namespace ASCOM.Meade.net
private readonly IAstroMaths _astroMaths;
private readonly IClock _clock;
/// <summary>
/// Private variable to hold number of decimals for RA
/// </summary>
private int _digitsRa = 2;
/// <summary>
/// Private variable to hold number of decimals for DE
/// Private variable to hold number of decimals for Dec
/// </summary>
private int _digitsDe = 2;
private short _settleTime;
/// <summary>
/// Initializes a new instance of the <see cref="Meade.net"/> class.
/// Must be public for COM registration.
@@ -84,6 +88,7 @@ namespace ASCOM.Meade.net
_utilitiesExtra = util; //Initialise util object
_astroUtilities = new AstroUtils(); // Initialise astro utilities object
_astroMaths = new AstroMaths.AstroMaths();
_clock = new Clock();
Initialise(nameof(Telescope));
}
@@ -116,8 +121,9 @@ namespace ASCOM.Meade.net
sb.AppendLine();
}
public Telescope( IUtil util, IUtilExtra utilExtra, IAstroUtils astroUtilities, ISharedResourcesWrapper sharedResourcesWrapper, IAstroMaths astroMaths) : base(sharedResourcesWrapper)
public Telescope( IUtil util, IUtilExtra utilExtra, IAstroUtils astroUtilities, ISharedResourcesWrapper sharedResourcesWrapper, IAstroMaths astroMaths, IClock clock) : base(sharedResourcesWrapper)
{
_clock = clock;
_utilities = util; //Initialise util object
_utilitiesExtra = utilExtra; //Initialise util object
_astroUtilities = astroUtilities; // Initialise astro utilities object
@@ -351,7 +357,7 @@ namespace ASCOM.Meade.net
// it's a good idea to put all the low level communication with the device here,
// then all communication calls this function
// you need something to ensure that only one command is in progress at a time
return SharedResourcesWrapper.SendString(command);
return SharedResourcesWrapper.SendString(command, raw);
//throw new ASCOM.MethodNotImplementedException("CommandString");
}
@@ -403,6 +409,9 @@ namespace ASCOM.Meade.net
{
LogMessage("Connected Set", "Making first connection telescope adjustments");
LogMessage("Connected Set", $"Site Longitude: {SiteLongitude}");
LogMessage("Connected Set", $"Site Latitude: {SiteLatitude}");
//These settings are applied only when the first device connects to the telescope.
SetLongFormat(true);
@@ -412,6 +421,36 @@ namespace ASCOM.Meade.net
}
SetTelescopePrecision("Connect");
LogMessage("Connected Set", $"SendDateTime: {SendDateTime}");
if (SendDateTime)
{
if (SharedResourcesWrapper.ProductName == TelescopeList.LX200GPS)
{
LogMessage("Connected Set", $"LX200GPS Detecting if daylight savings message on screen: {SendDateTime}");
var displayText = Action("Handbox", "readdisplay");
LogMessage("Connected Set", $"Current Handset display: {displayText}");
if (displayText.Contains("Daylight"))
{
LogMessage("Connected Set", $"LX200GPS Setting Date time and bypassing settings screens: {SendDateTime}");
BypassHandboxEntryForAutostarII();
}
else
{
LogMessage("Connected Set", $"LX200GPS Sending current date and time: {SendDateTime}");
SendCurrentDateTime("Connect");
LogMessage("Connected Set", $"LX200GPS Attempting manual bypass of prompts: {SendDateTime}");
ApplySkipAutoStarPrompts("Connect");
}
}
else
{
LogMessage("Connected Set", "Autostar Attempting manual bypass of prompts");
ApplySkipAutoStarPrompts("Connect");
SendCurrentDateTime("Connect");
}
}
}
else
{
@@ -441,6 +480,48 @@ namespace ASCOM.Meade.net
}
}
private void SendCurrentDateTime(string connect)
{
if (SendDateTime)
{
UTCDate = _clock.UtcNow;
}
}
private void ApplySkipAutoStarPrompts(string connect)
{
if (SharedResourcesWrapper.ProductName == TelescopeList.LX200GPS)
{
var displayText = Action("Handbox", "readdisplay");
if (displayText.Contains("Daylight"))
{
for (var i = 0; i < 3; i++)
{
Action("Handbox", "enter");
_utilities.WaitForMilliseconds(2000);
}
}
}
else if (SharedResourcesWrapper.ProductName == TelescopeList.Autostar497)
{
var i = 10;
while (i > 0)
{
var displayText = Action("Handbox", "readdisplay");
if (displayText.Contains("Align:"))
{
i = 0;
continue;
}
Action("Handbox", "mode");
_utilities.WaitForMilliseconds(500);
i--;
}
}
}
private void SetTelescopePrecision(string propertyName)
{
switch (Precision.ToLower())
@@ -552,7 +633,7 @@ namespace ASCOM.Meade.net
if((Math.Abs(RightAscension - rightTargetAscension ) <= eps) &&
(Math.Abs(Declination - targetDeclination) <= eps))
{
LogMessage("IsTargetCoordinateInitRequired", $"0 diff -> false");
LogMessage("IsTargetCoordinateInitRequired", "0 diff -> false");
_isTargetCoordinateInitRequired = false;
return _isTargetCoordinateInitRequired;
}
@@ -576,7 +657,7 @@ namespace ASCOM.Meade.net
}
catch (Exception ex)
{
LogMessage("InitTargetCoordinates", $"Error sync telescope position", ex.Message);
LogMessage("InitTargetCoordinates", "Error sync telescope position", ex.Message);
}
}
@@ -805,6 +886,7 @@ namespace ASCOM.Meade.net
public void AbortSlew()
{
CheckConnected("AbortSlew");
CheckParked();
LogMessage("AbortSlew", "Aborting slew");
SharedResourcesWrapper.SendBlind(":Q#");
@@ -813,6 +895,13 @@ namespace ASCOM.Meade.net
_movingPrimary = false;
_movingSecondary = false;
SetSlewingMinEndTime();
}
private void CheckParked()
{
if (AtPark)
throw new ParkedException("Telescope is parked");
}
public AlignmentModes AlignmentMode
@@ -900,7 +989,7 @@ namespace ASCOM.Meade.net
get
{
CheckConnected("Altitude Get");
var altAz = CalcAltAzFromTelescopeEqData();
LogMessage("Altitude", $"{altAz.Altitude}");
return altAz.Altitude;
@@ -1167,26 +1256,49 @@ namespace ASCOM.Meade.net
{
get
{
CheckConnected("CanUnpark");
//todo make this return false for non LX-200 GPS telescopes
LogMessage("CanUnpark", "Get - " + true);
return true;
return SharedResourcesWrapper.ProductName == TelescopeList.LX200GPS;
}
}
private double _lastGoodDeclination;
public double Declination
{
get
{
CheckConnected("Declination Get");
try
{
CheckParked();
var result = SharedResourcesWrapper.SendString(":GD#");
//:GD# Get Telescope Declination.
//Returns: sDD*MM# or sDD*MMSS#
//Depending upon the current precision setting for the telescope.
var result = SharedResourcesWrapper.SendString(":GD#");
//:GD# Get Telescope Declination.
//Returns: sDD*MM# or sDD*MMSS#
//Depending upon the current precision setting for the telescope.
double declination = _utilities.DMSToDegrees(result);
double declination = _utilities.DMSToDegrees(result);
LogMessage("Declination", $"Get - {result} convert to {declination} {_utilitiesExtra.DegreesToDMS(declination, ":", ":")}");
return declination;
LogMessage("Declination", $"Get - {result} convert to {declination} {_utilitiesExtra.DegreesToDMS(declination, ":", ":")}");
_lastGoodDeclination = declination;
return declination;
}
catch (ParkedException)
{
switch (ParkedBehaviour)
{
case ParkedBehaviour.LastGoodPosition:
return _lastGoodDeclination;
case ParkedBehaviour.ReportCoordinates:
var raDec = _astroMaths.ConvertHozToEq(UTCDate, SiteLatitude, SiteLongitude, ParkedAltAz);
return raDec.Declination;
default:
throw;
}
}
}
}
@@ -1333,11 +1445,12 @@ namespace ASCOM.Meade.net
private bool _movingPrimary;
private bool _movingSecondary;
public void MoveAxis(TelescopeAxes axis, double rate)
{
LogMessage("MoveAxis", $"Axis={axis} rate={rate}");
CheckConnected("MoveAxis");
CheckParked();
var absRate = Math.Abs(rate);
@@ -1376,6 +1489,11 @@ namespace ASCOM.Meade.net
switch (rate.Compare(0))
{
case ComparisonResult.Equals:
if (!_isGuiding)
{
SetSlewingMinEndTime();
}
_movingPrimary = false;
SharedResourcesWrapper.SendBlind(":Qe#");
//:Qe# Halt eastward Slews
@@ -1385,7 +1503,6 @@ namespace ASCOM.Meade.net
//Returns: Nothing
break;
case ComparisonResult.Greater:
SharedResourcesWrapper.SendBlind(":Me#");
//:Me# Move Telescope East at current slew rate
//Returns: Nothing
@@ -1403,6 +1520,10 @@ namespace ASCOM.Meade.net
switch (rate.Compare(0))
{
case ComparisonResult.Equals:
if (!_isGuiding)
{
SetSlewingMinEndTime();
}
_movingSecondary = false;
SharedResourcesWrapper.SendBlind(":Qn#");
//:Qn# Halt northward Slews
@@ -1423,9 +1544,7 @@ namespace ASCOM.Meade.net
//Returns: Nothing
_movingSecondary = true;
break;
}
break;
default:
throw new InvalidValueException("Can not move this axis.");
@@ -1440,10 +1559,11 @@ namespace ASCOM.Meade.net
if (AtPark)
return;
//Setting park to true before sending the park command as the Autostar and Audiostar stop serial communications once the park command has been issued.
AtPark = true;
SharedResourcesWrapper.SendBlind(":hP#");
//:hP# Autostar, Autostar II and LX 16”Slew to Park Position
//Returns: Nothing
AtPark = true;
}
private bool _userNewerPulseGuiding = true;
@@ -1454,6 +1574,7 @@ namespace ASCOM.Meade.net
try
{
CheckConnected("PulseGuide");
CheckParked();
if (IsSlewingToTarget())
throw new InvalidOperationException("Unable to PulseGuide whilst slewing to target.");
@@ -1553,7 +1674,7 @@ namespace ASCOM.Meade.net
/// <summary>
/// convert a HH:MM.T (classic LX200 RA Notation) string to a double hours. T is the decimal part of minutes which is converted into seconds
/// </summary>
public double HMToHours(string hm)
public double HmToHours(string hm)
{
var token = hm.Split('.');
if (token.Length != 2)
@@ -1563,21 +1684,43 @@ namespace ASCOM.Meade.net
var hms = $"{token[0]}:{seconds}";
return _utilities.HMSToHours(hms);
}
double _lastGoodRightAsension;
public double RightAscension
{
get
{
CheckConnected("RightAscension Get");
var result = SharedResourcesWrapper.SendString(":GR#");
//:GR# Get Telescope RA
//Returns: HH:MM.T# or HH:MM:SS#
//Depending which precision is set for the telescope
try
{
CheckParked();
double rightAscension = HMToHours(result);
var result = SharedResourcesWrapper.SendString(":GR#");
//:GR# Get Telescope RA
//Returns: HH:MM.T# or HH:MM:SS#
//Depending which precision is set for the telescope
LogMessage("RightAscension", $"Get - {result} convert to {rightAscension} {_utilitiesExtra.HoursToHMS(rightAscension)}");
return rightAscension;
double rightAscension = HmToHours(result);
LogMessage("RightAscension", $"Get - {result} convert to {rightAscension} {_utilitiesExtra.HoursToHMS(rightAscension)}");
_lastGoodRightAsension = rightAscension;
return rightAscension;
}
catch (ParkedException)
{
switch (ParkedBehaviour)
{
case ParkedBehaviour.LastGoodPosition:
return _lastGoodRightAsension;
case ParkedBehaviour.ReportCoordinates:
var raDec = _astroMaths.ConvertHozToEq(UTCDate, SiteLatitude, SiteLongitude, ParkedAltAz);
return raDec.RightAscension;
default:
throw;
}
}
}
}
@@ -1626,7 +1769,7 @@ namespace ASCOM.Meade.net
double siderealTime = 0.0;
using (var novas = new NOVAS31())
{
var jd = _utilities.DateUTCToJulian(DateTime.UtcNow);
var jd = _utilities.DateUTCToJulian(_clock.UtcNow);
novas.SiderealTime(jd, 0, novas.DeltaT(jd),
GstType.GreenwichApparentSiderealTime,
Method.EquinoxBased,
@@ -1659,32 +1802,51 @@ namespace ASCOM.Meade.net
CheckConnected("SiteElevation Set");
LogMessage("SiteElevation", $"Set: {value}");
if (value == base.SiteElevation)
if (Math.Abs(value - base.SiteElevation) < 0.1)
{
LogMessage("SiteElevation", $"Set: no change detected");
LogMessage("SiteElevation", "Set: no change detected");
return;
}
LogMessage("SiteElevation", $"Set: {value} was {base.SiteElevation}");
base.SiteElevation = value;
base.UpdateSiteElevation();
UpdateSiteElevation();
}
}
private double? _lastGoodSiteLatitude;
public double SiteLatitude
{
get
{
CheckConnected("SiteLatitude Get");
try
{
CheckParked();
var latitude = SharedResourcesWrapper.SendString(":Gt#");
//:Gt# Get Current Site Latitude
//Returns: sDD* MM#
//The latitude of the current site. Positive inplies North latitude.
var latitude = SharedResourcesWrapper.SendString(":Gt#");
//:Gt# Get Current Site Latitude
//Returns: sDD* MM#
//The latitude of the current site. Positive inplies North latitude.
var siteLatitude = _utilities.DMSToDegrees(latitude);
LogMessage("SiteLatitude Get", $"{_utilitiesExtra.DegreesToDMS(siteLatitude)}");
return siteLatitude;
if (latitude != null)
{
var siteLatitude = _utilities.DMSToDegrees(latitude);
LogMessage("SiteLatitude Get", $"{_utilitiesExtra.DegreesToDMS(siteLatitude)}");
_lastGoodSiteLatitude = siteLatitude;
return siteLatitude;
}
throw new InvalidOperationException("unable to get site latitude from telescope.");
}
catch (ParkedException)
{
if (ParkedBehaviour == ParkedBehaviour.NoCoordinates)
throw;
return _lastGoodSiteLatitude.Value;
}
}
set
{
@@ -1713,26 +1875,42 @@ namespace ASCOM.Meade.net
//1 - Valid
if (result != "1")
throw new InvalidOperationException("Failed to set site latitude.");
_lastGoodSiteLatitude = value;
}
}
private double _lastGoodSiteLongitude;
public double SiteLongitude
{
get
{
CheckConnected("SiteLongitude Get");
try
{
CheckParked();
var longitude = SharedResourcesWrapper.SendString(":Gg#");
//:Gg# Get Current Site Longitude
//Returns: sDDD*MM#
//The current site Longitude. East Longitudes are expressed as negative
double siteLongitude = -_utilities.DMSToDegrees(longitude);
var longitude = SharedResourcesWrapper.SendString(":Gg#");
//:Gg# Get Current Site Longitude
//Returns: sDDD*MM#
//The current site Longitude. East Longitudes are expressed as negative
double siteLongitude = -_utilities.DMSToDegrees(longitude);
if (siteLongitude < -180)
siteLongitude = siteLongitude + 360;
LogMessage("SiteLongitude Get", $"{_utilitiesExtra.DegreesToDMS(siteLongitude)}");
return siteLongitude;
if (siteLongitude < -180)
siteLongitude = siteLongitude + 360;
LogMessage("SiteLongitude Get", $"{_utilitiesExtra.DegreesToDMS(siteLongitude)}");
_lastGoodSiteLongitude = siteLongitude;
return siteLongitude;
}
catch (ParkedException)
{
if (ParkedBehaviour == ParkedBehaviour.NoCoordinates)
throw;
return _lastGoodSiteLongitude;
}
}
set
{
@@ -1766,6 +1944,8 @@ namespace ASCOM.Meade.net
//1 - Valid
if (result != "1")
throw new InvalidOperationException("Failed to set site longitude.");
_lastGoodSiteLongitude = value;
}
}
@@ -1773,14 +1953,15 @@ namespace ASCOM.Meade.net
{
get
{
LogMessage("SlewSettleTime Get", "Not implemented");
throw new PropertyNotImplementedException("SlewSettleTime", false);
CheckConnected("SlewSettleTime Get");
LogMessage("SlewSettleTime Get", $"{_settleTime} Seconds");
return _settleTime;
}
// ReSharper disable once ValueParameterNotUsed
set
{
LogMessage("SlewSettleTime Set", "Not implemented");
throw new PropertyNotImplementedException("SlewSettleTime", true);
CheckConnected("SlewSettleTime Set");
LogMessage("SlewSettleTime Set", $"Setting from {_settleTime} to {value}");
_settleTime = value;
}
}
@@ -1788,6 +1969,7 @@ namespace ASCOM.Meade.net
{
LogMessage("SlewToAltAz", $"Az=~{azimuth} Alt={altitude}");
CheckConnected("SlewToAltAz");
CheckParked();
SlewToAltAzAsync(azimuth, altitude);
@@ -1800,6 +1982,7 @@ namespace ASCOM.Meade.net
public void SlewToAltAzAsync(double azimuth, double altitude)
{
CheckConnected("SlewToAltAzAsync");
CheckParked();
if (altitude > 90)
throw new InvalidValueException("Altitude cannot be greater than 90.");
@@ -1840,6 +2023,7 @@ namespace ASCOM.Meade.net
private void DoSlewAsync(bool polar)
{
CheckConnected("DoSlewAsync");
CheckParked();
SharedResourcesWrapper.Lock(() =>
{
@@ -1858,6 +2042,7 @@ namespace ASCOM.Meade.net
case "0":
//We're slewing everything should be working just fine.
LogMessage("DoSlewAsync", "Slewing to target");
SetSlewingMinEndTime();
break;
case "1":
//Below Horizon
@@ -1893,7 +2078,7 @@ namespace ASCOM.Meade.net
{
throw new InvalidOperationException("fault");
}
SetSlewingMinEndTime();
break;
}
});
@@ -1903,6 +2088,7 @@ namespace ASCOM.Meade.net
{
LogMessage("SlewToCoordinates", $"Ra={rightAscension}, Dec={declination}");
CheckConnected("SlewToCoordinates");
CheckParked();
SlewToCoordinatesAsync(rightAscension, declination);
@@ -1918,6 +2104,7 @@ namespace ASCOM.Meade.net
{
LogMessage("SlewToCoordinatesAsync", $"Ra={rightAscension}, Dec={declination}");
CheckConnected("SlewToCoordinatesAsync");
CheckParked();
SharedResourcesWrapper.Lock(() =>
{
@@ -1933,6 +2120,7 @@ namespace ASCOM.Meade.net
{
LogMessage("SlewToTarget", "Executing");
CheckConnected("SlewToTarget");
CheckParked();
SlewToTargetAsync();
while (Slewing)
@@ -1946,6 +2134,7 @@ namespace ASCOM.Meade.net
public void SlewToTargetAsync()
{
CheckConnected("SlewToTargetAsync");
CheckParked();
if (TargetDeclination.Equals(InvalidParameter) || TargetRightAscension.Equals(InvalidParameter))
throw new InvalidOperationException("No target selected to slew to.");
@@ -1961,25 +2150,48 @@ namespace ASCOM.Meade.net
return _movingPrimary || _movingSecondary;
}
private DateTime _earliestNonSlewingTime = DateTime.MinValue;
public bool Slewing
{
get
{
var isSlewing = GetSlewing();
if (isSlewing)
SetSlewingMinEndTime();
else if (_clock.UtcNow < _earliestNonSlewingTime)
isSlewing = true;
LogMessage("Slewing", $"Result = {isSlewing}");
return isSlewing;
}
}
private void SetSlewingMinEndTime()
{
_earliestNonSlewingTime = _clock.UtcNow + GetTotalSlewingSettleTime();
}
private TimeSpan GetTotalSlewingSettleTime()
{
return TimeSpan.FromSeconds( SlewSettleTime + ProfileSettleTime );
}
private bool GetSlewing()
{
if (!Connected) return false;
var result = false;
try
{
if (Connected)
result = MovingAxis() || IsSlewingToTarget();
}
finally
{
LogMessage("GetSlewing", $"Result = {result}");
}
if (MovingAxis())
return true;
return IsSlewingToTarget();
return result;
}
private bool IsSlewingToTarget()
@@ -1989,26 +2201,41 @@ namespace ASCOM.Meade.net
if (_isGuiding)
return false;
var result = SharedResourcesWrapper.SendString(":D#");
string result;
try
{
result = SharedResourcesWrapper.SendString(":D#");
}
catch (TimeoutException)
{
result = string.Empty;
}
//:D# Requests a string of bars indicating the distance to the current target location.
//Returns:
//LX200's a string of bar characters indicating the distance.
//Autostars and Autostar II a string containing one bar until a slew is complete, then a null string is returned.
bool isSlewing = !string.IsNullOrEmpty(result);
bool isSlewing = false;
try
{
//if (string.IsNullOrEmpty(result))
//{
// isSlewing = false;
// return isSlewing;
//}
if (string.IsNullOrEmpty(result))
{
// ReSharper disable once RedundantAssignment
isSlewing = false;
return isSlewing;
}
//if (result.Contains("|"))
//{
// isSlewing = true;
// return isSlewing;
//}
if (result.Contains("|"))
{
isSlewing = true;
return isSlewing;
}
if (result.Contains("\u007f"))
{
isSlewing = true;
return isSlewing;
}
////classic LX200 return bar with 32 chars. FF is contained from left to right when slewing
//byte[] ba = Encoding.Default.GetBytes(result);
@@ -2025,13 +2252,13 @@ namespace ASCOM.Meade.net
////a 0 movement will solved that lock if the target coordinates are set to the current coordinates.
//if (IsTargetCoordinateInitRequired())
// InitTargetCoordinates();
return isSlewing;
}
finally
{
LogMessage("IsSlewingToTarget", $"Result = {isSlewing}");
LogMessage("IsSlewingToTarget", $"IsSlewing = {isSlewing} : result = {result ?? "<null>"}");
}
return isSlewing;
}
public void SyncToAltAz(double azimuth, double altitude)
@@ -2045,6 +2272,7 @@ namespace ASCOM.Meade.net
LogMessage("SyncToCoordinates", $"RA={rightAscension} Dec={declination}");
LogMessage("SyncToCoordinates", $"RA={_utilitiesExtra.HoursToHMS(rightAscension)} Dec={_utilitiesExtra.HoursToHMS(declination)}");
CheckConnected("SyncToCoordinates");
CheckParked();
SharedResourcesWrapper.Lock(() =>
{
@@ -2059,7 +2287,8 @@ namespace ASCOM.Meade.net
{
LogMessage("SyncToTarget", "Executing");
CheckConnected("SyncToTarget");
CheckParked();
var result = SharedResourcesWrapper.SendString(":CM#");
//:CM# Synchronizes the telescope's position with the currently selected database object's coordinates.
//Returns:
@@ -2072,14 +2301,14 @@ namespace ASCOM.Meade.net
// At least the classic LX200 low precision might not slew to the exact target position
// This Requires to retrieve the aimed target ra de from the telescope
double ra = RightAscension;
if (_targetRightAscension != InvalidParameter &&
if (Math.Abs(_targetRightAscension - InvalidParameter) > 0.1 &&
_utilities.HoursToHMS(ra, ":", ":", ":", _digitsRa) != _utilities.HoursToHMS(_targetRightAscension, ":", ":", ":", _digitsRa))
{
LogMessage("SyncToTarget", $"differ RA real {ra} targeted {_targetRightAscension}");
_targetRightAscension = ra;
}
double de = Declination;
if (_targetDeclination != InvalidParameter &&
if (Math.Abs(_targetDeclination - InvalidParameter) > 0.1 &&
_utilities.DegreesToDMS(de, "*", ":", ":", _digitsDe) != _utilities.DegreesToDMS(_targetDeclination, "*", ":", ":", _digitsDe))
{
LogMessage("SyncToTarget", $"differ DE real {de} targeted {_targetDeclination}");
@@ -2112,6 +2341,7 @@ namespace ASCOM.Meade.net
LogMessage("TargetDeclination Set", $"{value}");
CheckConnected("TargetDeclination Set");
CheckParked();
if (value > 90)
throw new InvalidValueException("Declination cannot be greater than 90.");
@@ -2119,11 +2349,9 @@ namespace ASCOM.Meade.net
if (value < -90)
throw new InvalidValueException("Declination cannot be less than -90.");
var dms = "";
if (IsLongFormat)
dms = _utilities.DegreesToDMS(value, "*", ":", ":", _digitsDe);
else
dms = _utilities.DegreesToDM(value, "*", "", _digitsDe);
var dms = IsLongFormat ?
_utilities.DegreesToDMS(value, "*", ":", ":", _digitsDe) :
_utilities.DegreesToDM(value, "*", "", _digitsDe);
var s = value < 0 ? string.Empty : "+";
@@ -2169,6 +2397,7 @@ namespace ASCOM.Meade.net
{
LogMessage("TargetRightAscension Set", $"{value}");
CheckConnected("TargetRightAscension Set");
CheckParked();
if (value < 0)
throw new InvalidValueException("Right ascension value cannot be below 0");
@@ -2176,12 +2405,9 @@ namespace ASCOM.Meade.net
if (value >= 24)
throw new InvalidValueException("Right ascension value cannot be greater than 23:59:59");
var hms = "";
if(IsLongFormat)
hms = _utilities.HoursToHMS(value, ":", ":", ":", _digitsRa);
else
//meade protocol defines H:MM.T format
hms = _utilities.HoursToHM(value, ":", "", _digitsRa).Replace(',','.');
var hms = IsLongFormat ?
_utilities.HoursToHMS(value, ":", ":", ":", _digitsRa) :
_utilities.HoursToHM(value, ":", "", _digitsRa).Replace(',','.');
var command = $":Sr{hms}#";
LogMessage("TargetRightAscension Set", $"{command}");
@@ -2240,6 +2466,7 @@ namespace ASCOM.Meade.net
{
LogMessage("TrackingRate Set", $"{value}");
CheckConnected("TrackingRate Set");
CheckParked();
switch (value)
{
@@ -2308,46 +2535,56 @@ namespace ASCOM.Meade.net
get
{
CheckConnected("UTCDate Get");
LogMessage("UTCDate", "Get started");
var telescopeDateDetails = SharedResourcesWrapper.Lock(() =>
try
{
var tdd = new TelescopeDateDetails
CheckParked();
var telescopeDateDetails = SharedResourcesWrapper.Lock(() =>
{
TelescopeDate = SharedResourcesWrapper.SendString(":GC#"),
//:GC# Get current date.
//Returns: MM/DD/YY#
//The current local calendar date for the telescope.
TelescopeTime = SharedResourcesWrapper.SendString(":GL#"),
//:GL# Get Local Time in 24 hour format
//Returns: HH:MM:SS#
//The Local Time in 24 - hour Format
UtcCorrection = GetUtcCorrection()
};
var tdd = new TelescopeDateDetails
{
TelescopeDate = SharedResourcesWrapper.SendString(":GC#"),
//:GC# Get current date.
//Returns: MM/DD/YY#
//The current local calendar date for the telescope.
TelescopeTime = SharedResourcesWrapper.SendString(":GL#"),
//:GL# Get Local Time in 24 hour format
//Returns: HH:MM:SS#
//The Local Time in 24 - hour Format
UtcCorrection = GetUtcCorrection()
};
return tdd;
});
return tdd;
});
int month = telescopeDateDetails.TelescopeDate.Substring(0, 2).ToInteger();
int day = telescopeDateDetails.TelescopeDate.Substring(3, 2).ToInteger();
int year = telescopeDateDetails.TelescopeDate.Substring(6, 2).ToInteger();
int month = telescopeDateDetails.TelescopeDate.Substring(0, 2).ToInteger();
int day = telescopeDateDetails.TelescopeDate.Substring(3, 2).ToInteger();
int year = telescopeDateDetails.TelescopeDate.Substring(6, 2).ToInteger();
if (year < 2000) //todo fix this hack that will create a Y2K100 bug
{
year = year + 2000;
if (year < 2000) //todo fix this hack that will create a Y2K100 bug
{
year = year + 2000;
}
int hour = telescopeDateDetails.TelescopeTime.Substring(0, 2).ToInteger();
int minute = telescopeDateDetails.TelescopeTime.Substring(3, 2).ToInteger();
int second = telescopeDateDetails.TelescopeTime.Substring(6, 2).ToInteger();
var utcDate = new DateTime(year, month, day, hour, minute, second, DateTimeKind.Utc) +
telescopeDateDetails.UtcCorrection;
LogMessage("UTCDate", "Get - " + utcDate.ToString("MM/dd/yy HH:mm:ss"));
return utcDate;
}
catch (ParkedException e)
{
if (ParkedBehaviour == ParkedBehaviour.NoCoordinates)
throw;
int hour = telescopeDateDetails.TelescopeTime.Substring(0, 2).ToInteger();
int minute = telescopeDateDetails.TelescopeTime.Substring(3, 2).ToInteger();
int second = telescopeDateDetails.TelescopeTime.Substring(6, 2).ToInteger();
var utcDate = new DateTime(year, month, day, hour, minute, second, DateTimeKind.Utc) +
telescopeDateDetails.UtcCorrection;
LogMessage("UTCDate", "Get - " + utcDate.ToString("MM/dd/yy HH:mm:ss"));
return utcDate;
return _clock.UtcNow;
}
}
set
{
@@ -2394,7 +2631,11 @@ namespace ASCOM.Meade.net
public void Unpark()
{
LogMessage("Unpark", "Parking telescope");
LogMessage("Unpark", "Unparking telescope");
CheckConnected("Unpark");
if (SharedResourcesWrapper.ProductName != TelescopeList.LX200GPS)
throw new InvalidOperationException("Unable to unpark this telescope type");
if (!AtPark)
return;
@@ -2403,24 +2644,24 @@ namespace ASCOM.Meade.net
//:I# LX200 GPS Only - Causes the telescope to cease current operations and restart at its power on initialization.
//Returns: X once the handset restart has completed
//todo implement the
//todo make sure that the telescope has the correct date and time.
//UTCDate = DateTime.UtcNow;
BypassHandboxEntryForAutostarII();
AtPark = false;
}
private bool BypassHandboxEntryForAutostarII()
{
var utcCorrection = GetUtcCorrection();
var localDateTime = DateTime.UtcNow - utcCorrection;
var localDateTime = _clock.UtcNow - utcCorrection;
//localDateTime: HH: mm: ss
SharedResourcesWrapper.SendBlind($":hI{localDateTime:yyMMddhhmmss}#");
var result = SharedResourcesWrapper.SendChar($":hI{localDateTime:yyMMddHHmmss}#");
//:hIYYMMDDHHMMSS#
//Bypass handbox entry of daylight savings, date and time.Use the values supplied in this command.This feature is
//intended to allow use of the Autostar II from permanent installations where GPS reception is not possible, such as within
//metal domes. This command must be issued while the telescope is waiting at the initial daylight savings prompt.
//Returns: 1 if command was accepted.
AtPark = false;
return result == "1";
}
#endregion
@@ -2517,14 +2758,19 @@ namespace ASCOM.Meade.net
private void WriteProfile()
{
var profileProperties = new ProfileProperties
{
TraceLogger = Tl.Enabled,
ComPort = ComPort,
GuideRateArcSecondsPerSecond = GuideRate
};
var changed = false;
SharedResourcesWrapper.WriteProfile(profileProperties);
var profileProperties = SharedResourcesWrapper.ReadProfile();
if (Math.Abs(profileProperties.GuideRateArcSecondsPerSecond - GuideRate) > 0.0000001)
{
changed = true;
profileProperties.GuideRateArcSecondsPerSecond = GuideRate;
}
if (changed)
SharedResourcesWrapper.WriteProfile(profileProperties);
}
#endregion
}
+268 -34
View File
@@ -59,15 +59,16 @@ namespace Meade.net.UnitTests
Assert.That(result, Is.EqualTo(expectedResult));
}
[Test]
public void SendString_WhenCalled_ThenSendsMessageAndReadsResultUntilTerminatorFound()
[TestCase(false, "Test")]
[TestCase(true, "#Test")]
public void SendString_WhenCalled_ThenSendsMessageAndReadsResultUntilTerminatorFound(bool includePrefix, string expectedMessage)
{
var expectedMessage = "Test";
var transmitMessage = "Test";
var expectedResult = "TestMessage#";
_serialMock.Setup(x => x.ReceiveTerminated("#")).Returns(expectedResult);
var result = SharedResources.SendString(expectedMessage);
var result = SharedResources.SendString(transmitMessage, includePrefix);
_serialMock.Verify(x => x.ClearBuffers(), Times.Once);
_serialMock.Verify(x => x.Transmit(expectedMessage), Times.Once);
@@ -123,10 +124,19 @@ namespace Meade.net.UnitTests
Assert.That(profeWrapper.DeviceType, Is.EqualTo("Telescope"));
profileWrapperMock.Verify( x => x.WriteValue(DriverId, "Trace Level", profileProperties.TraceLogger.ToString()), Times.Once);
profileWrapperMock.Verify(x => x.WriteValue(DriverId, "COM Port", profileProperties.ComPort), Times.Once);
profileWrapperMock.Verify(x => x.WriteValue(DriverId, "Speed", profileProperties.Speed.ToString()), Times.Once);
profileWrapperMock.Verify(x => x.WriteValue(DriverId, "Data Bits", profileProperties.DataBits.ToString()), Times.Once);
profileWrapperMock.Verify(x => x.WriteValue(DriverId, "Stop Bits", profileProperties.StopBits), Times.Once);
profileWrapperMock.Verify(x => x.WriteValue(DriverId, "Hand Shake", profileProperties.Handshake), Times.Once);
profileWrapperMock.Verify(x => x.WriteValue(DriverId, "Parity", profileProperties.Parity), Times.Once);
profileWrapperMock.Verify(x => x.WriteValue(DriverId, "Rts / Dtr", profileProperties.RtsDtrEnabled.ToString()), Times.Once);
profileWrapperMock.Verify(x => x.WriteValue(DriverId, "Guide Rate Arc Seconds Per Second", profileProperties.GuideRateArcSecondsPerSecond.ToString(CultureInfo.CurrentCulture)), Times.Once);
profileWrapperMock.Verify(x => x.WriteValue(DriverId, "Precision", profileProperties.Precision), Times.Once);
profileWrapperMock.Verify(x => x.WriteValue(DriverId, "Guiding Style", profileProperties.GuidingStyle), Times.Once);
profileWrapperMock.Verify(x => x.WriteValue(DriverId, "Backlash Compensation", profileProperties.BacklashCompensation.ToString(CultureInfo.CurrentCulture)), Times.Once);
profileWrapperMock.Verify(x => x.WriteValue(DriverId, "Reverse Focuser Direction", profileProperties.ReverseFocusDirection.ToString()), Times.Once);
}
@@ -136,14 +146,30 @@ namespace Meade.net.UnitTests
{
string DriverId = "ASCOM.MeadeGeneric.Telescope";
string ComPortDefault = "COM1";
string TraceStateDefault = "false";
string ComPortDefault = "COM1";
string SpeedDefault = "9600";
string DataBitsDefault = "8";
string StopBitsDefault = "One";
string HandshakeDefault = "None";
string ParityDefault = "None";
string RtsDtrEnabledDefault = "true";
string GuideRateProfileNameDefault = "10.077939"; //67% of sidereal rate
string PrecisionDefault = "Unchanged";
string GuidingStyleDefault = "Auto";
string BacklashCompensationDefault = "3000";
string ReverseFocuserDiectionDefault = "true";
string SendDateTimeDefault = "true";
string SkipPromptsDefault = "true";
string ParkedBehaviourDefault = "No Coordinates";
string ParkedAltDefault = "0";
string ParkedAzimuthDefault = "180";
Mock<IProfileWrapper> profileWrapperMock = new Mock<IProfileWrapper>();
profileWrapperMock.SetupAllProperties();
@@ -163,8 +189,46 @@ namespace Meade.net.UnitTests
x.GetValue(DriverId, "Backlash Compensation", string.Empty, BacklashCompensationDefault))
.Returns(BacklashCompensationDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Reverse Focuser Direction", string.Empty, ReverseFocuserDiectionDefault))
x.GetValue(DriverId, "Reverse Focuser Direction", string.Empty, "true"))
.Returns(() => ReverseFocuserDiectionDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Speed", string.Empty, SpeedDefault))
.Returns(() => SpeedDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Data Bits", string.Empty, DataBitsDefault))
.Returns(() => DataBitsDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Stop Bits", string.Empty, StopBitsDefault))
.Returns(() => StopBitsDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Hand Shake", string.Empty, HandshakeDefault))
.Returns(() => HandshakeDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Parity", string.Empty, ParityDefault))
.Returns(() => ParityDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Rts / Dtr", string.Empty, "false"))
.Returns(() => RtsDtrEnabledDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Parked Behaviour", string.Empty, ParkedBehaviourDefault))
.Returns(() => ParityDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Parked Altitude", string.Empty, ParkedAltDefault))
.Returns(() => ParkedAltDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Parked Azimuth", string.Empty, ParkedAzimuthDefault))
.Returns(() => ParkedAzimuthDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Send Date and time on connect", string.Empty, "false"))
.Returns(() => SendDateTimeDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Skip date prompts on connect", string.Empty, "false"))
.Returns(() => SkipPromptsDefault);
IProfileWrapper profeWrapper = profileWrapperMock.Object;
@@ -174,16 +238,29 @@ namespace Meade.net.UnitTests
SharedResources.ProfileFactory = profileFactoryMock.Object;
var profileProperties = SharedResources.ReadProfile();
Assert.That(profeWrapper.DeviceType, Is.EqualTo("Telescope"));
Assert.That(profileProperties.ComPort, Is.EqualTo(ComPortDefault));
Assert.That(profileProperties.GuideRateArcSecondsPerSecond,
Is.EqualTo(double.Parse(GuideRateProfileNameDefault)));
Assert.That(profileProperties.TraceLogger, Is.EqualTo(bool.Parse(TraceStateDefault)));
Assert.That(profileProperties.ComPort, Is.EqualTo(ComPortDefault));
Assert.That(profileProperties.GuideRateArcSecondsPerSecond,
Is.EqualTo(double.Parse(GuideRateProfileNameDefault)));
Assert.That(profileProperties.Precision, Is.EqualTo(PrecisionDefault));
Assert.That(profileProperties.GuidingStyle, Is.EqualTo(GuidingStyleDefault));
Assert.That(profileProperties.BacklashCompensation, Is.EqualTo(int.Parse(BacklashCompensationDefault)));
Assert.That(profileProperties.ReverseFocusDirection, Is.EqualTo(bool.Parse(ReverseFocuserDiectionDefault)));
Assert.That(profileProperties.Speed, Is.EqualTo(int.Parse(SpeedDefault)));
Assert.That(profileProperties.DataBits, Is.EqualTo(int.Parse(DataBitsDefault)));
Assert.That(profileProperties.StopBits, Is.EqualTo(StopBitsDefault));
Assert.That(profileProperties.Handshake, Is.EqualTo(HandshakeDefault));
Assert.That(profileProperties.Parity, Is.EqualTo(ParityDefault));
Assert.That(profileProperties.RtsDtrEnabled, Is.EqualTo(bool.Parse(RtsDtrEnabledDefault)));
Assert.That(profileProperties.SendDateTime, Is.EqualTo(bool.Parse(SendDateTimeDefault)));
}
[TestCase("TCP")]
@@ -199,27 +276,66 @@ namespace Meade.net.UnitTests
public void Connect_WhenDeviceIdIsSerialButGVPEchos_ThenThrowsException()
{
string deviceId = "Serial";
string driverDriverId = "ASCOM.MeadeGeneric.Telescope";
string DriverId = "ASCOM.MeadeGeneric.Telescope";
string ComPortDefault = "COM1";
string SpeedDefault = "9600";
string DataBitsDefault = "8";
string StopBitsDefault = "One";
string HandshakeDefault = "None";
string ParityDefault = "None";
string RtsDtrEnabledDefault = "false";
string TraceStateDefault = "false";
string GuideRateProfileNameDefault = "10.077939"; //67% of sidereal rate
string PrecisionDefault = "Unchanged";
string ParkedBehaviourDefault = "No Coordinates";
string ParkedAltDefault = "0";
string ParkedAzimuthDefault = "180";
Mock<IProfileWrapper> profileWrapperMock = new Mock<IProfileWrapper>();
profileWrapperMock.SetupAllProperties();
profileWrapperMock.Setup(x => x.GetValue(driverDriverId, "Trace Level", string.Empty, TraceStateDefault))
profileWrapperMock.Setup(x => x.GetValue(DriverId, "Trace Level", string.Empty, TraceStateDefault))
.Returns(TraceStateDefault);
profileWrapperMock.Setup(x => x.GetValue(driverDriverId, "COM Port", string.Empty, ComPortDefault))
profileWrapperMock.Setup(x => x.GetValue(DriverId, "COM Port", string.Empty, ComPortDefault))
.Returns(ComPortDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Speed", string.Empty, SpeedDefault))
.Returns(() => SpeedDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Data Bits", string.Empty, DataBitsDefault))
.Returns(() => DataBitsDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Stop Bits", string.Empty, StopBitsDefault))
.Returns(() => StopBitsDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Hand Shake", string.Empty, HandshakeDefault))
.Returns(() => HandshakeDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Parity", string.Empty, ParityDefault))
.Returns(() => ParityDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Rts / Dtr", string.Empty, RtsDtrEnabledDefault))
.Returns(() => RtsDtrEnabledDefault);
profileWrapperMock
.Setup(x => x.GetValue(driverDriverId, "Guide Rate Arc Seconds Per Second", string.Empty,
.Setup(x => x.GetValue(DriverId, "Guide Rate Arc Seconds Per Second", string.Empty,
GuideRateProfileNameDefault)).Returns(GuideRateProfileNameDefault);
profileWrapperMock.Setup(x => x.GetValue(driverDriverId, "Precision", string.Empty, PrecisionDefault))
profileWrapperMock.Setup(x => x.GetValue(DriverId, "Precision", string.Empty, PrecisionDefault))
.Returns(PrecisionDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Parked Behaviour", string.Empty, ParkedBehaviourDefault))
.Returns(() => ParityDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Parked Altitude", string.Empty, ParkedAltDefault))
.Returns(() => ParkedAltDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Parked Azimuth", string.Empty, ParkedAzimuthDefault))
.Returns(() => ParkedAzimuthDefault);
Mock<IProfileFactory> profileFactoryMock = new Mock<IProfileFactory>();
profileFactoryMock.Setup(x => x.Create()).Returns(profileWrapperMock.Object);
@@ -239,26 +355,65 @@ namespace Meade.net.UnitTests
public void Connect_WhenDeviceIdIsSerialButGVPNotSupported_ThenConnectsAndSetsProductToLX200Classic()
{
string deviceId = "Serial";
string DriverId = "ASCOM.MeadeGeneric.Telescope";
string driverDriverId = "ASCOM.MeadeGeneric.Telescope";
string TraceStateDefault = "false";
string ComPortDefault = "COM1";
string TraceStateDefault = "false";
string SpeedDefault = "9600";
string DataBitsDefault = "8";
string StopBitsDefault = "One";
string HandshakeDefault = "None";
string ParityDefault = "None";
string RtsDtrEnabledDefault = "false";
string GuideRateProfileNameDefault = "10.077939"; //67% of sidereal rate
string PrecisionDefault = "Unchanged";
string ParkedBehaviourDefault = "No Coordinates";
string ParkedAltDefault = "0";
string ParkedAzimuthDefault = "180";
Mock<IProfileWrapper> profileWrapperMock = new Mock<IProfileWrapper>();
profileWrapperMock.SetupAllProperties();
profileWrapperMock.Setup(x => x.GetValue(driverDriverId, "Trace Level", string.Empty, TraceStateDefault))
profileWrapperMock.Setup(x => x.GetValue(DriverId, "Trace Level", string.Empty, TraceStateDefault))
.Returns(TraceStateDefault);
profileWrapperMock.Setup(x => x.GetValue(driverDriverId, "COM Port", string.Empty, ComPortDefault))
profileWrapperMock.Setup(x => x.GetValue(DriverId, "COM Port", string.Empty, ComPortDefault))
.Returns(ComPortDefault);
profileWrapperMock
.Setup(x => x.GetValue(driverDriverId, "Guide Rate Arc Seconds Per Second", string.Empty,
.Setup(x => x.GetValue(DriverId, "Guide Rate Arc Seconds Per Second", string.Empty,
GuideRateProfileNameDefault)).Returns(GuideRateProfileNameDefault);
profileWrapperMock.Setup(x => x.GetValue(driverDriverId, "Precision", string.Empty, PrecisionDefault))
profileWrapperMock.Setup(x => x.GetValue(DriverId, "Precision", string.Empty, PrecisionDefault))
.Returns(PrecisionDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Speed", string.Empty, SpeedDefault))
.Returns(() => SpeedDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Data Bits", string.Empty, DataBitsDefault))
.Returns(() => DataBitsDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Stop Bits", string.Empty, StopBitsDefault))
.Returns(() => StopBitsDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Hand Shake", string.Empty, HandshakeDefault))
.Returns(() => HandshakeDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Parity", string.Empty, ParityDefault))
.Returns(() => ParityDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Rts / Dtr", string.Empty, RtsDtrEnabledDefault))
.Returns(() => RtsDtrEnabledDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Parked Behaviour", string.Empty, ParkedBehaviourDefault))
.Returns(() => ParityDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Parked Altitude", string.Empty, ParkedAltDefault))
.Returns(() => ParkedAltDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Parked Azimuth", string.Empty, ParkedAzimuthDefault))
.Returns(() => ParkedAzimuthDefault);
Mock<IProfileFactory> profileFactoryMock = new Mock<IProfileFactory>();
profileFactoryMock.Setup(x => x.Create()).Returns(profileWrapperMock.Object);
@@ -293,25 +448,65 @@ namespace Meade.net.UnitTests
{
string deviceId = "Serial";
string driverDriverId = "ASCOM.MeadeGeneric.Telescope";
string DriverId = "ASCOM.MeadeGeneric.Telescope";
string TraceStateDefault = "false";
string ComPortDefault = "COM1";
string TraceStateDefault = "false";
string SpeedDefault = "9600";
string DataBitsDefault = "8";
string StopBitsDefault = "One";
string HandshakeDefault = "None";
string ParityDefault = "None";
string RtsDtrEnabledDefault = "false";
string GuideRateProfileNameDefault = "10.077939"; //67% of sidereal rate
string PrecisionDefault = "Unchanged";
string ParkedBehaviourDefault = "No Coordinates";
string ParkedAltDefault = "0";
string ParkedAzimuthDefault = "180";
Mock<IProfileWrapper> profileWrapperMock = new Mock<IProfileWrapper>();
profileWrapperMock.SetupAllProperties();
profileWrapperMock.Setup(x => x.GetValue(driverDriverId, "Trace Level", string.Empty, TraceStateDefault))
profileWrapperMock.Setup(x => x.GetValue(DriverId, "Trace Level", string.Empty, TraceStateDefault))
.Returns(TraceStateDefault);
profileWrapperMock.Setup(x => x.GetValue(driverDriverId, "COM Port", string.Empty, ComPortDefault))
profileWrapperMock.Setup(x => x.GetValue(DriverId, "COM Port", string.Empty, ComPortDefault))
.Returns(ComPortDefault);
profileWrapperMock
.Setup(x => x.GetValue(driverDriverId, "Guide Rate Arc Seconds Per Second", string.Empty,
.Setup(x => x.GetValue(DriverId, "Guide Rate Arc Seconds Per Second", string.Empty,
GuideRateProfileNameDefault)).Returns(GuideRateProfileNameDefault);
profileWrapperMock.Setup(x => x.GetValue(driverDriverId, "Precision", string.Empty, PrecisionDefault))
profileWrapperMock.Setup(x => x.GetValue(DriverId, "Precision", string.Empty, PrecisionDefault))
.Returns(PrecisionDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Speed", string.Empty, SpeedDefault))
.Returns(() => SpeedDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Data Bits", string.Empty, DataBitsDefault))
.Returns(() => DataBitsDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Stop Bits", string.Empty, StopBitsDefault))
.Returns(() => StopBitsDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Hand Shake", string.Empty, HandshakeDefault))
.Returns(() => HandshakeDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Parity", string.Empty, ParityDefault))
.Returns(() => ParityDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Rts / Dtr", string.Empty, RtsDtrEnabledDefault))
.Returns(() => RtsDtrEnabledDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Parked Behaviour", string.Empty, ParkedBehaviourDefault))
.Returns(() => ParityDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Parked Altitude", string.Empty, ParkedAltDefault))
.Returns(() => ParkedAltDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Parked Azimuth", string.Empty, ParkedAzimuthDefault))
.Returns(() => ParkedAzimuthDefault);
Mock<IProfileFactory> profileFactoryMock = new Mock<IProfileFactory>();
profileFactoryMock.Setup(x => x.Create()).Returns(profileWrapperMock.Object);
@@ -343,25 +538,64 @@ namespace Meade.net.UnitTests
{
string deviceId = "Serial";
string driverDriverId = "ASCOM.MeadeGeneric.Telescope";
string DriverId = "ASCOM.MeadeGeneric.Telescope";
string TraceStateDefault = "false";
string ComPortDefault = "COM1";
string TraceStateDefault = "false";
string SpeedDefault = "9600";
string DataBitsDefault = "8";
string StopBitsDefault = "One";
string HandshakeDefault = "None";
string ParityDefault = "None";
string RtsDtrEnabledDefault = "false";
string GuideRateProfileNameDefault = "10.077939"; //67% of sidereal rate
string PrecisionDefault = "Unchanged";
string ParkedBehaviourDefault = "No Coordinates";
string ParkedAltDefault = "0";
string ParkedAzimuthDefault = "180";
Mock<IProfileWrapper> profileWrapperMock = new Mock<IProfileWrapper>();
profileWrapperMock.SetupAllProperties();
profileWrapperMock.Setup(x => x.GetValue(driverDriverId, "Trace Level", string.Empty, TraceStateDefault))
profileWrapperMock.Setup(x => x.GetValue(DriverId, "Trace Level", string.Empty, TraceStateDefault))
.Returns(TraceStateDefault);
profileWrapperMock.Setup(x => x.GetValue(driverDriverId, "COM Port", string.Empty, ComPortDefault))
profileWrapperMock.Setup(x => x.GetValue(DriverId, "COM Port", string.Empty, ComPortDefault))
.Returns(ComPortDefault);
profileWrapperMock
.Setup(x => x.GetValue(driverDriverId, "Guide Rate Arc Seconds Per Second", string.Empty,
.Setup(x => x.GetValue(DriverId, "Guide Rate Arc Seconds Per Second", string.Empty,
GuideRateProfileNameDefault)).Returns(GuideRateProfileNameDefault);
profileWrapperMock.Setup(x => x.GetValue(driverDriverId, "Precision", string.Empty, PrecisionDefault))
profileWrapperMock.Setup(x => x.GetValue(DriverId, "Precision", string.Empty, PrecisionDefault))
.Returns(PrecisionDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Speed", string.Empty, SpeedDefault))
.Returns(() => SpeedDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Data Bits", string.Empty, DataBitsDefault))
.Returns(() => DataBitsDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Stop Bits", string.Empty, StopBitsDefault))
.Returns(() => StopBitsDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Hand Shake", string.Empty, HandshakeDefault))
.Returns(() => HandshakeDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Parity", string.Empty, ParityDefault))
.Returns(() => ParityDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Rts / Dtr", string.Empty, RtsDtrEnabledDefault))
.Returns(() => RtsDtrEnabledDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Parked Behaviour", string.Empty, ParkedBehaviourDefault))
.Returns(() => ParityDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Parked Altitude", string.Empty, ParkedAltDefault))
.Returns(() => ParkedAltDefault);
profileWrapperMock.Setup(x =>
x.GetValue(DriverId, "Parked Azimuth", string.Empty, ParkedAzimuthDefault))
.Returns(() => ParkedAzimuthDefault);
Mock<IProfileFactory> profileFactoryMock = new Mock<IProfileFactory>();
profileFactoryMock.Setup(x => x.Create()).Returns(profileWrapperMock.Object);
+6
View File
@@ -0,0 +1,6 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/Housekeeping/ExcludedProjects/ProjectMasksToIgnore/=_002A_002A_005C_002A_002EUnitTests/@EntryIndexedValue">False</s:Boolean>
<s:Boolean x:Key="/Default/Housekeeping/ExcludedProjects/ProjectMasksToIgnore/=_002A_002A_005C_002A_002EUnitTests/@EntryIndexRemoved">True</s:Boolean>
<s:Boolean x:Key="/Default/Housekeeping/ExcludedProjects/ProjectMasksToIgnore/=_002A_002EUnitTests_002E_002A/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=ASCOM/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Autostar/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
+39
View File
@@ -0,0 +1,39 @@
using System;
using System.Linq;
using System.Reflection;
namespace ASCOM.Meade.net
{
public static class EnumExtensionMethods
{
public static string GetDescription(this Enum GenericEnum)
{
var genericEnumType = GenericEnum.GetType();
var memberInfo = genericEnumType.GetMember(GenericEnum.ToString());
if (memberInfo.Length > 0)
{
var _Attribs = memberInfo[0]
.GetCustomAttributes(typeof(System.ComponentModel.DescriptionAttribute), false);
if (_Attribs.Any())
{
return ((System.ComponentModel.DescriptionAttribute) _Attribs.ElementAt(0)).Description;
}
}
return GenericEnum.ToString();
}
public static T GetValueFromDescription<T>( string description) where T : Enum
{
foreach (T value in Enum.GetValues(typeof(T)))
{
if (value.GetDescription() == description)
{
return value;
}
}
return default;
}
}
}
+16 -11
View File
@@ -337,18 +337,23 @@ namespace ASCOM.Meade.net
{
key?.SetValue(null, progid); // Could be assyTitle/Desc??, but .NET components show ProgId here
key?.SetValue("AppId", _sAppId);
using (RegistryKey key2 = key.CreateSubKey("Implemented Categories"))
if (key != null)
{
key2?.CreateSubKey("{62C8FE65-4EBB-45e7-B440-6E39B2CDBF29}");
}
using (RegistryKey key2 = key.CreateSubKey("ProgId"))
{
key2?.SetValue(null, progid);
}
key.CreateSubKey("Programmable");
using (RegistryKey key2 = key.CreateSubKey("LocalServer32"))
{
key2?.SetValue(null, Application.ExecutablePath);
using (RegistryKey key2 = key.CreateSubKey("Implemented Categories"))
{
key2?.CreateSubKey("{62C8FE65-4EBB-45e7-B440-6E39B2CDBF29}");
}
using (RegistryKey key2 = key.CreateSubKey("ProgId"))
{
key2?.SetValue(null, progid);
}
key.CreateSubKey("Programmable");
using (RegistryKey key2 = key.CreateSubKey("LocalServer32"))
{
key2?.SetValue(null, Application.ExecutablePath);
}
}
}
//
+4
View File
@@ -129,6 +129,7 @@
<Compile Include="AssemblyInfo.cs" />
<Compile Include="ClassFactory.cs" />
<Compile Include="ConnectionInfo.cs" />
<Compile Include="EnumExtensionMethods.cs" />
<Compile Include="frmMain.cs">
<SubType>Form</SubType>
</Compile>
@@ -136,8 +137,10 @@
<DependentUpon>frmMain.cs</DependentUpon>
</Compile>
<Compile Include="GarbageCollection.cs" />
<Compile Include="AstroMaths\HorizonCoordinates.cs" />
<Compile Include="LocalServer.cs" />
<Compile Include="MeadeTelescopeBase.cs" />
<Compile Include="ParkedBehaviour.cs" />
<Compile Include="ProfileFactory.cs" />
<Compile Include="ProfileProperties.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
@@ -199,6 +202,7 @@
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
+20 -1
View File
@@ -1,6 +1,7 @@
using System;
using System.Reflection;
using System.Runtime.InteropServices;
using ASCOM.Meade.net.AstroMaths;
using ASCOM.Meade.net.Wrapper;
using ASCOM.Utilities;
@@ -27,8 +28,12 @@ namespace ASCOM.Meade.net
protected string Precision;
protected string GuidingStyle;
protected double SiteElevation;
protected short ProfileSettleTime;
protected bool SendDateTime;
protected ParkedBehaviour ParkedBehaviour;
protected HorizonCoordinates ParkedAltAz;
protected readonly ISharedResourcesWrapper SharedResourcesWrapper;
protected readonly ISharedResourcesWrapper SharedResourcesWrapper;
public MeadeTelescopeBase()
{
@@ -67,7 +72,16 @@ namespace ASCOM.Meade.net
Precision = profileProperties.Precision;
GuidingStyle = profileProperties.GuidingStyle.ToLower();
SiteElevation = profileProperties.SiteElevation;
ProfileSettleTime = profileProperties.SettleTime;
SendDateTime = profileProperties.SendDateTime;
ParkedBehaviour = profileProperties.ParkedBehaviour;
ParkedAltAz = new HorizonCoordinates
{
Altitude = profileProperties.ParkedAlt,
Azimuth = profileProperties.ParkedAz
};
LogMessage("ReadProfile", $"Trace logger enabled: {Tl.Enabled}");
LogMessage("ReadProfile", $"Com Port: {ComPort}");
LogMessage("ReadProfile", $"Backlash Steps: {BacklashCompensation}");
@@ -76,6 +90,11 @@ namespace ASCOM.Meade.net
LogMessage("ReadProfile", $"Precision: {Precision}");
LogMessage("ReadProfile", $"Guiding Style: {GuidingStyle}");
LogMessage("ReadProfile", $"Site Elevation: {SiteElevation}");
LogMessage("ReadProfile", $"Settle Time after slew: {ProfileSettleTime}");
LogMessage("ReadProfile", $"Send date and time on connect: {SendDateTime}");
LogMessage("ReadProfile", $"Parked Behaviour: {ParkedBehaviour}");
LogMessage("ReadProfile", $"Parked Alt: {ParkedAltAz.Altitude}");
LogMessage("ReadProfile", $"Parked Az: {ParkedAltAz.Azimuth}");
}
/// <summary>
+14
View File
@@ -0,0 +1,14 @@
using System.ComponentModel;
namespace ASCOM.Meade.net
{
public enum ParkedBehaviour
{
[Description("No Coordinates")]
NoCoordinates,
[Description("Last Good Position")]
LastGoodPosition,
[Description("Report coordinates as")]
ReportCoordinates
}
}
+10
View File
@@ -13,5 +13,15 @@ namespace ASCOM.Meade.net
public bool DynamicBreaking { get; set; }
public bool RtsDtrEnabled { get; set; }
public double SiteElevation { get; set; }
public short SettleTime { get; set; }
public int DataBits { get; set; }
public string StopBits { get; set; }
public string Parity { get; set; }
public int Speed { get; set; }
public string Handshake { get; set; }
public bool SendDateTime { get; set; }
public ParkedBehaviour ParkedBehaviour { get; set; }
public double ParkedAlt { get; set; }
public double ParkedAz { get; set; }
}
}
+9
View File
@@ -135,5 +135,14 @@ namespace ASCOM.Meade.net.Properties {
return ResourceManager.GetString("SetupDialogForm_TextBox1_TextChanged___0_00_0___of_sidereal_rate_", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Please enter only numbers..
/// </summary>
internal static string SetupDialogForm_txtElevation_TextChanged_1_Please_enter_only_numbers_ {
get {
return ResourceManager.GetString("SetupDialogForm_txtElevation_TextChanged_1_Please_enter_only_numbers_", resourceCulture);
}
}
}
}
+3
View File
@@ -144,4 +144,7 @@ Valid are : -register, -unregister and -embedding</value>
<data name="SetupDialogForm_SetupDialogForm__0__Settings___1__" xml:space="preserve">
<value>{0} Settings ({1})</value>
</data>
<data name="SetupDialogForm_txtElevation_TextChanged_1_Please_enter_only_numbers_" xml:space="preserve">
<value>Please enter only numbers.</value>
</data>
</root>
+146 -4
View File
@@ -1,4 +1,5 @@
using System;
using System.Collections;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
@@ -7,6 +8,7 @@ using System.Linq;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using ASCOM.Meade.net.Properties;
using ASCOM.Utilities;
namespace ASCOM.Meade.net
{
@@ -20,6 +22,33 @@ namespace ASCOM.Meade.net
var assemblyInfo = new AssemblyInfo();
Text = string.Format(Resources.SetupDialogForm_SetupDialogForm__0__Settings___1__, assemblyInfo.Product, assemblyInfo.AssemblyVersion);
SetItemsFromEnum(cboStopBits.Items, typeof(SerialStopBits));
SetItemsFromEnum(cboParity.Items, typeof(SerialParity));
SetItemsFromEnumValues(cboSpeed.Items, typeof(SerialSpeed));
SetItemsFromEnum(cboHandShake.Items, typeof(SerialHandshake));
SetItemsFromEnum(cboParkedBehaviour.Items, typeof(ParkedBehaviour));
}
private void SetItemsFromEnum(IList items, Type enumItems)
{
items.Clear();
foreach (var value in Enum.GetValues(enumItems) )
{
var val = value as Enum;
items.Add(val.GetDescription());
}
}
private void SetItemsFromEnumValues(IList items, Type enumItems)
{
items.Clear();
foreach (int item in Enum.GetValues(enumItems))
{
items.Add(item);
}
}
public sealed override string Text
@@ -83,11 +112,83 @@ namespace ASCOM.Meade.net
cboGuidingStyle.SelectedItem = "Auto";
}
numDatabits.Value = profileProperties.DataBits;
try
{
cboStopBits.SelectedItem = profileProperties.StopBits;
}
catch (Exception)
{
cboStopBits.SelectedItem = "One";
}
try
{
cboParity.SelectedItem = profileProperties.Parity;
}
catch (Exception)
{
cboParity.SelectedItem = "None";
}
try
{
cboSpeed.SelectedItem = profileProperties.Speed;
}
catch (Exception)
{
cboParity.SelectedItem = "9600";
}
try
{
cboHandShake.SelectedItem = profileProperties.Handshake;
}
catch (Exception)
{
cboHandShake.SelectedItem = "None";
}
txtBacklashSteps.Text = profileProperties.BacklashCompensation.ToString(CultureInfo.CurrentCulture);
txtElevation.Text = profileProperties.SiteElevation.ToString(CultureInfo.CurrentCulture);
cbxReverseDirection.Checked = profileProperties.ReverseFocusDirection;
cbxDynamicBreaking.Checked = profileProperties.DynamicBreaking;
nudSettleTime.Value = profileProperties.SettleTime;
cbxSendDateTime.Checked = profileProperties.SendDateTime;
try
{
cboParkedBehaviour.SelectedItem = profileProperties.ParkedBehaviour.GetDescription();
}
catch (Exception)
{
cboParkedBehaviour.SelectedItem = ParkedBehaviour.NoCoordinates.GetDescription();
}
try
{
txtParkedAlt.Text = profileProperties.ParkedAlt.ToString(CultureInfo.CurrentCulture);
}
catch (Exception)
{
txtParkedAlt.Text = "0";
}
try
{
txtParkedAz.Text = profileProperties.ParkedAz.ToString(CultureInfo.CurrentCulture);
}
catch (Exception)
{
txtParkedAz.Text = "180";
}
UpdateParkedItemsEnabled();
}
public ProfileProperties GetProfile()
@@ -97,13 +198,23 @@ namespace ASCOM.Meade.net
TraceLogger = chkTrace.Checked,
ComPort = comboBoxComPort.SelectedItem.ToString(),
RtsDtrEnabled = cbxRtsDtr.Checked,
DataBits = Convert.ToInt32(numDatabits.Value),
StopBits = cboStopBits.SelectedItem.ToString(),
Parity = cboParity.SelectedItem.ToString(),
Speed = Convert.ToInt32(cboSpeed.SelectedItem),
Handshake = cboHandShake.SelectedItem.ToString(),
GuideRateArcSecondsPerSecond = double.Parse(txtGuideRate.Text.Trim()),
Precision = cboPrecision.SelectedItem.ToString(),
GuidingStyle = cboGuidingStyle.SelectedItem.ToString(),
BacklashCompensation = int.Parse(txtBacklashSteps.Text),
ReverseFocusDirection = cbxReverseDirection.Checked,
DynamicBreaking = cbxDynamicBreaking.Checked,
SiteElevation = double.Parse(txtElevation.Text)
SiteElevation = double.Parse(txtElevation.Text),
SettleTime = Convert.ToInt16(nudSettleTime.Value),
SendDateTime = cbxSendDateTime.Checked,
ParkedBehaviour = EnumExtensionMethods.GetValueFromDescription<ParkedBehaviour>(cboParkedBehaviour.SelectedItem.ToString()),
ParkedAlt = double.Parse(txtParkedAlt.Text),
ParkedAz = double.Parse(txtParkedAz.Text)
};
return profileProperties;
@@ -167,7 +278,7 @@ namespace ASCOM.Meade.net
{
if (System.Text.RegularExpressions.Regex.IsMatch(txtElevation.Text, "[^0-9]"))
{
MessageBox.Show("Please enter only numbers.");
MessageBox.Show(Resources.SetupDialogForm_txtElevation_TextChanged_1_Please_enter_only_numbers_);
txtElevation.Text = txtElevation.Text.Remove(txtElevation.Text.Length - 1);
}
}
@@ -176,9 +287,40 @@ namespace ASCOM.Meade.net
{
if (System.Text.RegularExpressions.Regex.IsMatch(txtBacklashSteps.Text, "[^0-9]"))
{
MessageBox.Show("Please enter only numbers.");
MessageBox.Show(Resources.SetupDialogForm_txtElevation_TextChanged_1_Please_enter_only_numbers_);
txtBacklashSteps.Text = txtElevation.Text.Remove(txtBacklashSteps.Text.Length - 1);
}
}
private void cboParkedBehaviour_SelectionChangeCommitted(object sender, EventArgs e)
{
UpdateParkedItemsEnabled();
}
private void UpdateParkedItemsEnabled()
{
txtParkedAlt.Enabled = cboParkedBehaviour.SelectedItem?.ToString() == "Report coordinates as";
txtParkedAz.Enabled = txtParkedAlt.Enabled;
}
private void txtParkedAlt_TextChanged(object sender, EventArgs e)
{
if (System.Text.RegularExpressions.Regex.IsMatch(txtParkedAlt.Text, "[^0-9]"))
{
MessageBox.Show(Resources.SetupDialogForm_txtElevation_TextChanged_1_Please_enter_only_numbers_);
txtParkedAlt.Text = txtParkedAlt.Text.Remove(txtParkedAlt.Text.Length - 1);
}
}
private void txtParkedAz_TextChanged(object sender, EventArgs e)
{
if (System.Text.RegularExpressions.Regex.IsMatch(txtParkedAz.Text, "[^0-9]"))
{
MessageBox.Show(Resources.SetupDialogForm_txtElevation_TextChanged_1_Please_enter_only_numbers_);
txtParkedAz.Text = txtParkedAz.Text.Remove(txtParkedAz.Text.Length - 1);
}
}
}
}
}
+202
View File
@@ -58,10 +58,33 @@ namespace ASCOM.Meade.net
this.cbxDynamicBreaking = new System.Windows.Forms.CheckBox();
this.cbxRtsDtr = new System.Windows.Forms.CheckBox();
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
this.cbxSendDateTime = new System.Windows.Forms.CheckBox();
this.label12 = new System.Windows.Forms.Label();
this.txtElevation = new System.Windows.Forms.TextBox();
this.label13 = new System.Windows.Forms.Label();
this.label14 = new System.Windows.Forms.Label();
this.nudSettleTime = new System.Windows.Forms.NumericUpDown();
this.label15 = new System.Windows.Forms.Label();
this.label16 = new System.Windows.Forms.Label();
this.cboStopBits = new System.Windows.Forms.ComboBox();
this.numDatabits = new System.Windows.Forms.NumericUpDown();
this.cboParity = new System.Windows.Forms.ComboBox();
this.cboSpeed = new System.Windows.Forms.ComboBox();
this.cboHandShake = new System.Windows.Forms.ComboBox();
this.label17 = new System.Windows.Forms.Label();
this.label18 = new System.Windows.Forms.Label();
this.label19 = new System.Windows.Forms.Label();
this.label20 = new System.Windows.Forms.Label();
this.label21 = new System.Windows.Forms.Label();
this.cboParkedBehaviour = new System.Windows.Forms.ComboBox();
this.label22 = new System.Windows.Forms.Label();
this.label23 = new System.Windows.Forms.Label();
this.label24 = new System.Windows.Forms.Label();
this.txtParkedAlt = new System.Windows.Forms.TextBox();
this.txtParkedAz = new System.Windows.Forms.TextBox();
((System.ComponentModel.ISupportInitialize)(this.picASCOM)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nudSettleTime)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numDatabits)).BeginInit();
this.SuspendLayout();
//
// cmdOK
@@ -121,6 +144,7 @@ namespace ASCOM.Meade.net
//
resources.ApplyResources(this.txtGuideRate, "txtGuideRate");
this.txtGuideRate.Name = "txtGuideRate";
this.toolTip1.SetToolTip(this.txtGuideRate, resources.GetString("txtGuideRate.ToolTip"));
this.txtGuideRate.TextChanged += new System.EventHandler(this.TextBox1_TextChanged);
//
// label4
@@ -215,6 +239,13 @@ namespace ASCOM.Meade.net
this.toolTip1.SetToolTip(this.cbxRtsDtr, resources.GetString("cbxRtsDtr.ToolTip"));
this.cbxRtsDtr.UseVisualStyleBackColor = true;
//
// cbxSendDateTime
//
resources.ApplyResources(this.cbxSendDateTime, "cbxSendDateTime");
this.cbxSendDateTime.Name = "cbxSendDateTime";
this.toolTip1.SetToolTip(this.cbxSendDateTime, resources.GetString("cbxSendDateTime.ToolTip"));
this.cbxSendDateTime.UseVisualStyleBackColor = true;
//
// label12
//
resources.ApplyResources(this.label12, "label12");
@@ -231,10 +262,158 @@ namespace ASCOM.Meade.net
resources.ApplyResources(this.label13, "label13");
this.label13.Name = "label13";
//
// label14
//
resources.ApplyResources(this.label14, "label14");
this.label14.Name = "label14";
//
// nudSettleTime
//
resources.ApplyResources(this.nudSettleTime, "nudSettleTime");
this.nudSettleTime.Maximum = new decimal(new int[] {
32767,
0,
0,
0});
this.nudSettleTime.Name = "nudSettleTime";
//
// label15
//
resources.ApplyResources(this.label15, "label15");
this.label15.Name = "label15";
//
// label16
//
resources.ApplyResources(this.label16, "label16");
this.label16.Name = "label16";
//
// cboStopBits
//
this.cboStopBits.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cboStopBits.FormattingEnabled = true;
resources.ApplyResources(this.cboStopBits, "cboStopBits");
this.cboStopBits.Name = "cboStopBits";
//
// numDatabits
//
resources.ApplyResources(this.numDatabits, "numDatabits");
this.numDatabits.Maximum = new decimal(new int[] {
32767,
0,
0,
0});
this.numDatabits.Name = "numDatabits";
//
// cboParity
//
this.cboParity.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cboParity.FormattingEnabled = true;
resources.ApplyResources(this.cboParity, "cboParity");
this.cboParity.Name = "cboParity";
//
// cboSpeed
//
this.cboSpeed.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cboSpeed.FormattingEnabled = true;
resources.ApplyResources(this.cboSpeed, "cboSpeed");
this.cboSpeed.Name = "cboSpeed";
//
// cboHandShake
//
this.cboHandShake.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cboHandShake.FormattingEnabled = true;
resources.ApplyResources(this.cboHandShake, "cboHandShake");
this.cboHandShake.Name = "cboHandShake";
//
// label17
//
resources.ApplyResources(this.label17, "label17");
this.label17.Name = "label17";
//
// label18
//
resources.ApplyResources(this.label18, "label18");
this.label18.Name = "label18";
//
// label19
//
resources.ApplyResources(this.label19, "label19");
this.label19.Name = "label19";
//
// label20
//
resources.ApplyResources(this.label20, "label20");
this.label20.Name = "label20";
//
// label21
//
resources.ApplyResources(this.label21, "label21");
this.label21.Name = "label21";
//
// cboParkedBehaviour
//
this.cboParkedBehaviour.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cboParkedBehaviour.FormattingEnabled = true;
this.cboParkedBehaviour.Items.AddRange(new object[] {
resources.GetString("cboParkedBehaviour.Items"),
resources.GetString("cboParkedBehaviour.Items1"),
resources.GetString("cboParkedBehaviour.Items2")});
resources.ApplyResources(this.cboParkedBehaviour, "cboParkedBehaviour");
this.cboParkedBehaviour.Name = "cboParkedBehaviour";
this.cboParkedBehaviour.SelectionChangeCommitted += new System.EventHandler(this.cboParkedBehaviour_SelectionChangeCommitted);
//
// label22
//
resources.ApplyResources(this.label22, "label22");
this.label22.Name = "label22";
//
// label23
//
resources.ApplyResources(this.label23, "label23");
this.label23.Name = "label23";
//
// label24
//
resources.ApplyResources(this.label24, "label24");
this.label24.Name = "label24";
//
// txtParkedAlt
//
resources.ApplyResources(this.txtParkedAlt, "txtParkedAlt");
this.txtParkedAlt.Name = "txtParkedAlt";
this.txtParkedAlt.TextChanged += new System.EventHandler(this.txtParkedAlt_TextChanged);
//
// txtParkedAz
//
resources.ApplyResources(this.txtParkedAz, "txtParkedAz");
this.txtParkedAz.Name = "txtParkedAz";
this.txtParkedAz.TextChanged += new System.EventHandler(this.txtParkedAz_TextChanged);
//
// SetupDialogForm
//
resources.ApplyResources(this, "$this");
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.txtParkedAz);
this.Controls.Add(this.txtParkedAlt);
this.Controls.Add(this.label24);
this.Controls.Add(this.label23);
this.Controls.Add(this.label22);
this.Controls.Add(this.cboParkedBehaviour);
this.Controls.Add(this.cbxSendDateTime);
this.Controls.Add(this.label21);
this.Controls.Add(this.label20);
this.Controls.Add(this.label19);
this.Controls.Add(this.label18);
this.Controls.Add(this.label17);
this.Controls.Add(this.cboHandShake);
this.Controls.Add(this.cboSpeed);
this.Controls.Add(this.cboParity);
this.Controls.Add(this.numDatabits);
this.Controls.Add(this.cboStopBits);
this.Controls.Add(this.label16);
this.Controls.Add(this.label15);
this.Controls.Add(this.nudSettleTime);
this.Controls.Add(this.label14);
this.Controls.Add(this.label13);
this.Controls.Add(this.txtElevation);
this.Controls.Add(this.label12);
@@ -270,6 +449,8 @@ namespace ASCOM.Meade.net
this.TopMost = true;
this.Shown += new System.EventHandler(this.SetupDialogForm_Shown);
((System.ComponentModel.ISupportInitialize)(this.picASCOM)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.nudSettleTime)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numDatabits)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@@ -305,5 +486,26 @@ namespace ASCOM.Meade.net
private Label label12;
private TextBox txtElevation;
private Label label13;
private Label label14;
private NumericUpDown nudSettleTime;
private Label label15;
private Label label16;
private ComboBox cboStopBits;
private NumericUpDown numDatabits;
private ComboBox cboParity;
private ComboBox cboSpeed;
private ComboBox cboHandShake;
private Label label17;
private Label label18;
private Label label19;
private Label label20;
private Label label21;
private CheckBox cbxSendDateTime;
private ComboBox cboParkedBehaviour;
private Label label22;
private Label label23;
private Label label24;
private TextBox txtParkedAlt;
private TextBox txtParkedAz;
}
}
+594 -54
View File
@@ -123,7 +123,7 @@
</data>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="cmdOK.Location" type="System.Drawing.Point, System.Drawing">
<value>281, 457</value>
<value>765, 391</value>
</data>
<data name="cmdOK.Size" type="System.Drawing.Size, System.Drawing">
<value>59, 24</value>
@@ -145,13 +145,13 @@
<value>$this</value>
</data>
<data name="&gt;&gt;cmdOK.ZOrder" xml:space="preserve">
<value>26</value>
<value>47</value>
</data>
<data name="cmdCancel.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Bottom, Right</value>
</data>
<data name="cmdCancel.Location" type="System.Drawing.Point, System.Drawing">
<value>281, 487</value>
<value>765, 421</value>
</data>
<data name="cmdCancel.Size" type="System.Drawing.Size, System.Drawing">
<value>59, 25</value>
@@ -172,7 +172,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;cmdCancel.ZOrder" xml:space="preserve">
<value>25</value>
<value>46</value>
</data>
<data name="label1.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 9</value>
@@ -196,13 +196,13 @@
<value>$this</value>
</data>
<data name="&gt;&gt;label1.ZOrder" xml:space="preserve">
<value>24</value>
<value>45</value>
</data>
<data name="picASCOM.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Top, Right</value>
</data>
<data name="picASCOM.Location" type="System.Drawing.Point, System.Drawing">
<value>292, 9</value>
<value>776, 9</value>
</data>
<data name="picASCOM.Size" type="System.Drawing.Size, System.Drawing">
<value>48, 56</value>
@@ -223,7 +223,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;picASCOM.ZOrder" xml:space="preserve">
<value>23</value>
<value>44</value>
</data>
<data name="label2.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@@ -250,22 +250,22 @@
<value>$this</value>
</data>
<data name="&gt;&gt;label2.ZOrder" xml:space="preserve">
<value>22</value>
<value>43</value>
</data>
<data name="chkTrace.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="chkTrace.Location" type="System.Drawing.Point, System.Drawing">
<value>97, 137</value>
<value>97, 305</value>
</data>
<data name="chkTrace.Size" type="System.Drawing.Size, System.Drawing">
<value>69, 17</value>
<value>90, 17</value>
</data>
<data name="chkTrace.TabIndex" type="System.Int32, mscorlib">
<value>2</value>
</data>
<data name="chkTrace.Text" xml:space="preserve">
<value>Trace on</value>
<value>Trace Log on</value>
</data>
<data name="&gt;&gt;chkTrace.Name" xml:space="preserve">
<value>chkTrace</value>
@@ -277,7 +277,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;chkTrace.ZOrder" xml:space="preserve">
<value>21</value>
<value>42</value>
</data>
<data name="comboBoxComPort.Location" type="System.Drawing.Point, System.Drawing">
<value>97, 87</value>
@@ -298,13 +298,13 @@
<value>$this</value>
</data>
<data name="&gt;&gt;comboBoxComPort.ZOrder" xml:space="preserve">
<value>20</value>
<value>41</value>
</data>
<data name="label3.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="label3.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 278</value>
<value>290, 169</value>
</data>
<data name="label3.Size" type="System.Drawing.Size, System.Drawing">
<value>61, 13</value>
@@ -325,10 +325,13 @@
<value>$this</value>
</data>
<data name="&gt;&gt;label3.ZOrder" xml:space="preserve">
<value>19</value>
<value>40</value>
</data>
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<data name="txtGuideRate.Location" type="System.Drawing.Point, System.Drawing">
<value>97, 275</value>
<value>375, 166</value>
</data>
<data name="txtGuideRate.Size" type="System.Drawing.Size, System.Drawing">
<value>46, 20</value>
@@ -339,6 +342,9 @@
<data name="txtGuideRate.Text" xml:space="preserve">
<value>10.0</value>
</data>
<data name="txtGuideRate.ToolTip" xml:space="preserve">
<value>LX-200GPS only</value>
</data>
<data name="&gt;&gt;txtGuideRate.Name" xml:space="preserve">
<value>txtGuideRate</value>
</data>
@@ -349,13 +355,13 @@
<value>$this</value>
</data>
<data name="&gt;&gt;txtGuideRate.ZOrder" xml:space="preserve">
<value>18</value>
<value>39</value>
</data>
<data name="label4.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="label4.Location" type="System.Drawing.Point, System.Drawing">
<value>149, 278</value>
<value>427, 169</value>
</data>
<data name="label4.Size" type="System.Drawing.Size, System.Drawing">
<value>122, 13</value>
@@ -376,13 +382,13 @@
<value>$this</value>
</data>
<data name="&gt;&gt;label4.ZOrder" xml:space="preserve">
<value>17</value>
<value>38</value>
</data>
<data name="lblPercentOfSiderealRate.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="lblPercentOfSiderealRate.Location" type="System.Drawing.Point, System.Drawing">
<value>149, 291</value>
<value>427, 182</value>
</data>
<data name="lblPercentOfSiderealRate.Size" type="System.Drawing.Size, System.Drawing">
<value>105, 13</value>
@@ -403,13 +409,13 @@
<value>$this</value>
</data>
<data name="&gt;&gt;lblPercentOfSiderealRate.ZOrder" xml:space="preserve">
<value>16</value>
<value>37</value>
</data>
<data name="label5.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="label5.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 310</value>
<value>290, 201</value>
</data>
<data name="label5.Size" type="System.Drawing.Size, System.Drawing">
<value>50, 13</value>
@@ -430,7 +436,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;label5.ZOrder" xml:space="preserve">
<value>15</value>
<value>36</value>
</data>
<data name="cboPrecision.Items" xml:space="preserve">
<value>Unchanged</value>
@@ -442,7 +448,7 @@
<value>High</value>
</data>
<data name="cboPrecision.Location" type="System.Drawing.Point, System.Drawing">
<value>97, 307</value>
<value>375, 198</value>
</data>
<data name="cboPrecision.Size" type="System.Drawing.Size, System.Drawing">
<value>90, 21</value>
@@ -460,7 +466,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;cboPrecision.ZOrder" xml:space="preserve">
<value>14</value>
<value>35</value>
</data>
<data name="label6.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@@ -469,7 +475,7 @@
<value>NoControl</value>
</data>
<data name="label6.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 337</value>
<value>290, 228</value>
</data>
<data name="label6.Size" type="System.Drawing.Size, System.Drawing">
<value>67, 13</value>
@@ -490,7 +496,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;label6.ZOrder" xml:space="preserve">
<value>13</value>
<value>34</value>
</data>
<data name="cboGuidingStyle.Items" xml:space="preserve">
<value>Auto</value>
@@ -502,7 +508,7 @@
<value>Pulse guiding</value>
</data>
<data name="cboGuidingStyle.Location" type="System.Drawing.Point, System.Drawing">
<value>97, 334</value>
<value>375, 225</value>
</data>
<data name="cboGuidingStyle.Size" type="System.Drawing.Size, System.Drawing">
<value>90, 21</value>
@@ -520,7 +526,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;cboGuidingStyle.ZOrder" xml:space="preserve">
<value>12</value>
<value>33</value>
</data>
<data name="label7.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@@ -529,7 +535,7 @@
<value>Microsoft Sans Serif, 8.25pt, style=Bold</value>
</data>
<data name="label7.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 176</value>
<value>290, 67</value>
</data>
<data name="label7.Size" type="System.Drawing.Size, System.Drawing">
<value>66, 13</value>
@@ -550,7 +556,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;label7.ZOrder" xml:space="preserve">
<value>11</value>
<value>32</value>
</data>
<data name="label8.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@@ -562,7 +568,7 @@
<value>NoControl</value>
</data>
<data name="label8.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 393</value>
<value>290, 284</value>
</data>
<data name="label8.Size" type="System.Drawing.Size, System.Drawing">
<value>52, 13</value>
@@ -583,10 +589,10 @@
<value>$this</value>
</data>
<data name="&gt;&gt;label8.ZOrder" xml:space="preserve">
<value>10</value>
<value>31</value>
</data>
<data name="txtBacklashSteps.Location" type="System.Drawing.Point, System.Drawing">
<value>97, 411</value>
<value>375, 302</value>
</data>
<data name="txtBacklashSteps.Size" type="System.Drawing.Size, System.Drawing">
<value>46, 20</value>
@@ -607,7 +613,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;txtBacklashSteps.ZOrder" xml:space="preserve">
<value>8</value>
<value>29</value>
</data>
<data name="label9.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@@ -616,7 +622,7 @@
<value>NoControl</value>
</data>
<data name="label9.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 414</value>
<value>290, 305</value>
</data>
<data name="label9.Size" type="System.Drawing.Size, System.Drawing">
<value>79, 13</value>
@@ -637,7 +643,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;label9.ZOrder" xml:space="preserve">
<value>9</value>
<value>30</value>
</data>
<data name="label10.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@@ -646,7 +652,7 @@
<value>NoControl</value>
</data>
<data name="label10.Location" type="System.Drawing.Point, System.Drawing">
<value>149, 414</value>
<value>427, 305</value>
</data>
<data name="label10.Size" type="System.Drawing.Size, System.Drawing">
<value>20, 13</value>
@@ -667,7 +673,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;label10.ZOrder" xml:space="preserve">
<value>7</value>
<value>28</value>
</data>
<data name="label11.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@@ -700,13 +706,13 @@
<value>$this</value>
</data>
<data name="&gt;&gt;label11.ZOrder" xml:space="preserve">
<value>6</value>
<value>27</value>
</data>
<data name="cbxReverseDirection.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="cbxReverseDirection.Location" type="System.Drawing.Point, System.Drawing">
<value>97, 437</value>
<value>375, 328</value>
</data>
<data name="cbxReverseDirection.Size" type="System.Drawing.Size, System.Drawing">
<value>109, 17</value>
@@ -727,13 +733,13 @@
<value>$this</value>
</data>
<data name="&gt;&gt;cbxReverseDirection.ZOrder" xml:space="preserve">
<value>5</value>
<value>26</value>
</data>
<data name="cbxDynamicBreaking.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="cbxDynamicBreaking.Location" type="System.Drawing.Point, System.Drawing">
<value>97, 460</value>
<value>375, 351</value>
</data>
<data name="cbxDynamicBreaking.Size" type="System.Drawing.Size, System.Drawing">
<value>112, 17</value>
@@ -754,11 +760,8 @@
<value>$this</value>
</data>
<data name="&gt;&gt;cbxDynamicBreaking.ZOrder" xml:space="preserve">
<value>4</value>
<value>25</value>
</data>
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<data name="cbxRtsDtr.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
@@ -790,16 +793,49 @@
<value>$this</value>
</data>
<data name="&gt;&gt;cbxRtsDtr.ZOrder" xml:space="preserve">
<value>3</value>
<value>24</value>
</data>
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<data name="cbxSendDateTime.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="cbxSendDateTime.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="cbxSendDateTime.Location" type="System.Drawing.Point, System.Drawing">
<value>671, 96</value>
</data>
<data name="cbxSendDateTime.Size" type="System.Drawing.Size, System.Drawing">
<value>145, 17</value>
</data>
<data name="cbxSendDateTime.TabIndex" type="System.Int32, mscorlib">
<value>41</value>
</data>
<data name="cbxSendDateTime.Text" xml:space="preserve">
<value>Set current date and time</value>
</data>
<data name="cbxSendDateTime.ToolTip" xml:space="preserve">
<value>Send Current Date and Time (will also skip the opening dialogs on the LX200GPS)</value>
</data>
<data name="&gt;&gt;cbxSendDateTime.Name" xml:space="preserve">
<value>cbxSendDateTime</value>
</data>
<data name="&gt;&gt;cbxSendDateTime.Type" xml:space="preserve">
<value>System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;cbxSendDateTime.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;cbxSendDateTime.ZOrder" xml:space="preserve">
<value>6</value>
</data>
<data name="label12.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="label12.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 205</value>
<value>290, 96</value>
</data>
<data name="label12.Size" type="System.Drawing.Size, System.Drawing">
<value>72, 13</value>
@@ -820,10 +856,10 @@
<value>$this</value>
</data>
<data name="&gt;&gt;label12.ZOrder" xml:space="preserve">
<value>2</value>
<value>23</value>
</data>
<data name="txtElevation.Location" type="System.Drawing.Point, System.Drawing">
<value>97, 202</value>
<value>375, 93</value>
</data>
<data name="txtElevation.Size" type="System.Drawing.Size, System.Drawing">
<value>100, 20</value>
@@ -841,13 +877,13 @@
<value>$this</value>
</data>
<data name="&gt;&gt;txtElevation.ZOrder" xml:space="preserve">
<value>1</value>
<value>22</value>
</data>
<data name="label13.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="label13.Location" type="System.Drawing.Point, System.Drawing">
<value>203, 205</value>
<value>481, 96</value>
</data>
<data name="label13.Size" type="System.Drawing.Size, System.Drawing">
<value>38, 13</value>
@@ -868,16 +904,520 @@
<value>$this</value>
</data>
<data name="&gt;&gt;label13.ZOrder" xml:space="preserve">
<value>21</value>
</data>
<data name="label14.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="label14.Location" type="System.Drawing.Point, System.Drawing">
<value>290, 127</value>
</data>
<data name="label14.Size" type="System.Drawing.Size, System.Drawing">
<value>56, 13</value>
</data>
<data name="label14.TabIndex" type="System.Int32, mscorlib">
<value>25</value>
</data>
<data name="label14.Text" xml:space="preserve">
<value>Settle time</value>
</data>
<data name="&gt;&gt;label14.Name" xml:space="preserve">
<value>label14</value>
</data>
<data name="&gt;&gt;label14.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;label14.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;label14.ZOrder" xml:space="preserve">
<value>20</value>
</data>
<data name="nudSettleTime.Location" type="System.Drawing.Point, System.Drawing">
<value>375, 125</value>
</data>
<data name="nudSettleTime.Size" type="System.Drawing.Size, System.Drawing">
<value>120, 20</value>
</data>
<data name="nudSettleTime.TabIndex" type="System.Int32, mscorlib">
<value>26</value>
</data>
<data name="&gt;&gt;nudSettleTime.Name" xml:space="preserve">
<value>nudSettleTime</value>
</data>
<data name="&gt;&gt;nudSettleTime.Type" xml:space="preserve">
<value>System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;nudSettleTime.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;nudSettleTime.ZOrder" xml:space="preserve">
<value>19</value>
</data>
<data name="label15.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="label15.Location" type="System.Drawing.Point, System.Drawing">
<value>501, 127</value>
</data>
<data name="label15.Size" type="System.Drawing.Size, System.Drawing">
<value>47, 13</value>
</data>
<data name="label15.TabIndex" type="System.Int32, mscorlib">
<value>27</value>
</data>
<data name="label15.Text" xml:space="preserve">
<value>seconds</value>
</data>
<data name="&gt;&gt;label15.Name" xml:space="preserve">
<value>label15</value>
</data>
<data name="&gt;&gt;label15.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;label15.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;label15.ZOrder" xml:space="preserve">
<value>18</value>
</data>
<data name="label16.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="label16.Location" type="System.Drawing.Point, System.Drawing">
<value>15, 139</value>
</data>
<data name="label16.Size" type="System.Drawing.Size, System.Drawing">
<value>49, 13</value>
</data>
<data name="label16.TabIndex" type="System.Int32, mscorlib">
<value>29</value>
</data>
<data name="label16.Text" xml:space="preserve">
<value>Data bits</value>
</data>
<data name="&gt;&gt;label16.Name" xml:space="preserve">
<value>label16</value>
</data>
<data name="&gt;&gt;label16.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;label16.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;label16.ZOrder" xml:space="preserve">
<value>17</value>
</data>
<data name="cboStopBits.Location" type="System.Drawing.Point, System.Drawing">
<value>97, 163</value>
</data>
<data name="cboStopBits.Size" type="System.Drawing.Size, System.Drawing">
<value>119, 21</value>
</data>
<data name="cboStopBits.TabIndex" type="System.Int32, mscorlib">
<value>30</value>
</data>
<data name="&gt;&gt;cboStopBits.Name" xml:space="preserve">
<value>cboStopBits</value>
</data>
<data name="&gt;&gt;cboStopBits.Type" xml:space="preserve">
<value>System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;cboStopBits.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;cboStopBits.ZOrder" xml:space="preserve">
<value>16</value>
</data>
<data name="numDatabits.Location" type="System.Drawing.Point, System.Drawing">
<value>97, 137</value>
</data>
<data name="numDatabits.Size" type="System.Drawing.Size, System.Drawing">
<value>120, 20</value>
</data>
<data name="numDatabits.TabIndex" type="System.Int32, mscorlib">
<value>31</value>
</data>
<data name="&gt;&gt;numDatabits.Name" xml:space="preserve">
<value>numDatabits</value>
</data>
<data name="&gt;&gt;numDatabits.Type" xml:space="preserve">
<value>System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;numDatabits.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;numDatabits.ZOrder" xml:space="preserve">
<value>15</value>
</data>
<data name="cboParity.Location" type="System.Drawing.Point, System.Drawing">
<value>97, 190</value>
</data>
<data name="cboParity.Size" type="System.Drawing.Size, System.Drawing">
<value>119, 21</value>
</data>
<data name="cboParity.TabIndex" type="System.Int32, mscorlib">
<value>32</value>
</data>
<data name="&gt;&gt;cboParity.Name" xml:space="preserve">
<value>cboParity</value>
</data>
<data name="&gt;&gt;cboParity.Type" xml:space="preserve">
<value>System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;cboParity.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;cboParity.ZOrder" xml:space="preserve">
<value>14</value>
</data>
<data name="cboSpeed.Location" type="System.Drawing.Point, System.Drawing">
<value>97, 217</value>
</data>
<data name="cboSpeed.Size" type="System.Drawing.Size, System.Drawing">
<value>119, 21</value>
</data>
<data name="cboSpeed.TabIndex" type="System.Int32, mscorlib">
<value>33</value>
</data>
<data name="&gt;&gt;cboSpeed.Name" xml:space="preserve">
<value>cboSpeed</value>
</data>
<data name="&gt;&gt;cboSpeed.Type" xml:space="preserve">
<value>System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;cboSpeed.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;cboSpeed.ZOrder" xml:space="preserve">
<value>13</value>
</data>
<data name="cboHandShake.Location" type="System.Drawing.Point, System.Drawing">
<value>97, 244</value>
</data>
<data name="cboHandShake.Size" type="System.Drawing.Size, System.Drawing">
<value>121, 21</value>
</data>
<data name="cboHandShake.TabIndex" type="System.Int32, mscorlib">
<value>34</value>
</data>
<data name="&gt;&gt;cboHandShake.Name" xml:space="preserve">
<value>cboHandShake</value>
</data>
<data name="&gt;&gt;cboHandShake.Type" xml:space="preserve">
<value>System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;cboHandShake.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;cboHandShake.ZOrder" xml:space="preserve">
<value>12</value>
</data>
<data name="label17.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="label17.Location" type="System.Drawing.Point, System.Drawing">
<value>15, 166</value>
</data>
<data name="label17.Size" type="System.Drawing.Size, System.Drawing">
<value>49, 13</value>
</data>
<data name="label17.TabIndex" type="System.Int32, mscorlib">
<value>35</value>
</data>
<data name="label17.Text" xml:space="preserve">
<value>Stop Bits</value>
</data>
<data name="&gt;&gt;label17.Name" xml:space="preserve">
<value>label17</value>
</data>
<data name="&gt;&gt;label17.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;label17.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;label17.ZOrder" xml:space="preserve">
<value>11</value>
</data>
<data name="label18.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="label18.Location" type="System.Drawing.Point, System.Drawing">
<value>15, 193</value>
</data>
<data name="label18.Size" type="System.Drawing.Size, System.Drawing">
<value>33, 13</value>
</data>
<data name="label18.TabIndex" type="System.Int32, mscorlib">
<value>36</value>
</data>
<data name="label18.Text" xml:space="preserve">
<value>Parity</value>
</data>
<data name="&gt;&gt;label18.Name" xml:space="preserve">
<value>label18</value>
</data>
<data name="&gt;&gt;label18.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;label18.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;label18.ZOrder" xml:space="preserve">
<value>10</value>
</data>
<data name="label19.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="label19.Location" type="System.Drawing.Point, System.Drawing">
<value>15, 220</value>
</data>
<data name="label19.Size" type="System.Drawing.Size, System.Drawing">
<value>38, 13</value>
</data>
<data name="label19.TabIndex" type="System.Int32, mscorlib">
<value>37</value>
</data>
<data name="label19.Text" xml:space="preserve">
<value>Speed</value>
</data>
<data name="&gt;&gt;label19.Name" xml:space="preserve">
<value>label19</value>
</data>
<data name="&gt;&gt;label19.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;label19.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;label19.ZOrder" xml:space="preserve">
<value>9</value>
</data>
<data name="label20.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="label20.Location" type="System.Drawing.Point, System.Drawing">
<value>15, 247</value>
</data>
<data name="label20.Size" type="System.Drawing.Size, System.Drawing">
<value>62, 13</value>
</data>
<data name="label20.TabIndex" type="System.Int32, mscorlib">
<value>38</value>
</data>
<data name="label20.Text" xml:space="preserve">
<value>Handshake</value>
</data>
<data name="&gt;&gt;label20.Name" xml:space="preserve">
<value>label20</value>
</data>
<data name="&gt;&gt;label20.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;label20.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;label20.ZOrder" xml:space="preserve">
<value>8</value>
</data>
<data name="label21.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="label21.Font" type="System.Drawing.Font, System.Drawing">
<value>Microsoft Sans Serif, 8.25pt, style=Bold</value>
</data>
<data name="label21.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="label21.Location" type="System.Drawing.Point, System.Drawing">
<value>15, 284</value>
</data>
<data name="label21.Size" type="System.Drawing.Size, System.Drawing">
<value>73, 13</value>
</data>
<data name="label21.TabIndex" type="System.Int32, mscorlib">
<value>39</value>
</data>
<data name="label21.Text" xml:space="preserve">
<value>Diagnostics</value>
</data>
<data name="&gt;&gt;label21.Name" xml:space="preserve">
<value>label21</value>
</data>
<data name="&gt;&gt;label21.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;label21.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;label21.ZOrder" xml:space="preserve">
<value>7</value>
</data>
<data name="cboParkedBehaviour.Items" xml:space="preserve">
<value>No Coordinates</value>
</data>
<data name="cboParkedBehaviour.Items1" xml:space="preserve">
<value>Last Good Position</value>
</data>
<data name="cboParkedBehaviour.Items2" xml:space="preserve">
<value>Report coordinates as</value>
</data>
<data name="cboParkedBehaviour.Location" type="System.Drawing.Point, System.Drawing">
<value>671, 124</value>
</data>
<data name="cboParkedBehaviour.Size" type="System.Drawing.Size, System.Drawing">
<value>126, 21</value>
</data>
<data name="cboParkedBehaviour.TabIndex" type="System.Int32, mscorlib">
<value>42</value>
</data>
<data name="&gt;&gt;cboParkedBehaviour.Name" xml:space="preserve">
<value>cboParkedBehaviour</value>
</data>
<data name="&gt;&gt;cboParkedBehaviour.Type" xml:space="preserve">
<value>System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;cboParkedBehaviour.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;cboParkedBehaviour.ZOrder" xml:space="preserve">
<value>5</value>
</data>
<data name="label22.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="label22.Location" type="System.Drawing.Point, System.Drawing">
<value>574, 127</value>
</data>
<data name="label22.Size" type="System.Drawing.Size, System.Drawing">
<value>91, 13</value>
</data>
<data name="label22.TabIndex" type="System.Int32, mscorlib">
<value>43</value>
</data>
<data name="label22.Text" xml:space="preserve">
<value>Parked behaviour</value>
</data>
<data name="&gt;&gt;label22.Name" xml:space="preserve">
<value>label22</value>
</data>
<data name="&gt;&gt;label22.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;label22.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;label22.ZOrder" xml:space="preserve">
<value>4</value>
</data>
<data name="label23.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="label23.Location" type="System.Drawing.Point, System.Drawing">
<value>668, 154</value>
</data>
<data name="label23.Size" type="System.Drawing.Size, System.Drawing">
<value>19, 13</value>
</data>
<data name="label23.TabIndex" type="System.Int32, mscorlib">
<value>44</value>
</data>
<data name="label23.Text" xml:space="preserve">
<value>Alt</value>
</data>
<data name="&gt;&gt;label23.Name" xml:space="preserve">
<value>label23</value>
</data>
<data name="&gt;&gt;label23.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;label23.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;label23.ZOrder" xml:space="preserve">
<value>3</value>
</data>
<data name="label24.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="label24.Location" type="System.Drawing.Point, System.Drawing">
<value>668, 180</value>
</data>
<data name="label24.Size" type="System.Drawing.Size, System.Drawing">
<value>19, 13</value>
</data>
<data name="label24.TabIndex" type="System.Int32, mscorlib">
<value>45</value>
</data>
<data name="label24.Text" xml:space="preserve">
<value>Az</value>
</data>
<data name="&gt;&gt;label24.Name" xml:space="preserve">
<value>label24</value>
</data>
<data name="&gt;&gt;label24.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;label24.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;label24.ZOrder" xml:space="preserve">
<value>2</value>
</data>
<data name="txtParkedAlt.Location" type="System.Drawing.Point, System.Drawing">
<value>697, 151</value>
</data>
<data name="txtParkedAlt.Size" type="System.Drawing.Size, System.Drawing">
<value>100, 20</value>
</data>
<data name="txtParkedAlt.TabIndex" type="System.Int32, mscorlib">
<value>46</value>
</data>
<data name="&gt;&gt;txtParkedAlt.Name" xml:space="preserve">
<value>txtParkedAlt</value>
</data>
<data name="&gt;&gt;txtParkedAlt.Type" xml:space="preserve">
<value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;txtParkedAlt.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;txtParkedAlt.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<data name="txtParkedAz.Location" type="System.Drawing.Point, System.Drawing">
<value>697, 177</value>
</data>
<data name="txtParkedAz.Size" type="System.Drawing.Size, System.Drawing">
<value>100, 20</value>
</data>
<data name="txtParkedAz.TabIndex" type="System.Int32, mscorlib">
<value>47</value>
</data>
<data name="&gt;&gt;txtParkedAz.Name" xml:space="preserve">
<value>txtParkedAz</value>
</data>
<data name="&gt;&gt;txtParkedAz.Type" xml:space="preserve">
<value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;txtParkedAz.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;txtParkedAz.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>25</value>
</metadata>
<data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
<value>6, 13</value>
</data>
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
<value>350, 520</value>
<value>834, 454</value>
</data>
<data name="$this.StartPosition" type="System.Windows.Forms.FormStartPosition, System.Windows.Forms">
<value>CenterScreen</value>
+79 -13
View File
@@ -17,6 +17,7 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using ASCOM.Meade.net.Wrapper;
using ASCOM.Utilities;
@@ -93,13 +94,25 @@ namespace ASCOM.Meade.net
/// </summary>
/// <param name="message"></param>
/// <returns></returns>
public static string SendString(string message)
public static string SendString(string message, bool includePrefix = true)
{
lock (LockObject)
{
SharedSerial.ClearBuffers();
SharedSerial.Transmit(message);
return SharedSerial.ReceiveTerminated("#").TrimEnd('#');
SharedSerial.Transmit(includePrefix ? $"#{message}" : message);
try
{
return SharedSerial.ReceiveTerminated("#").TrimEnd('#');
}
catch (COMException ex)
{
if (ex.Message.Contains("Timed out waiting for received data"))
throw new TimeoutException(ex.Message, ex);
throw;
}
}
}
@@ -109,7 +122,18 @@ namespace ASCOM.Meade.net
{
SharedSerial.ClearBuffers();
SharedSerial.Transmit(message);
return SharedSerial.ReceiveCounted(1);
try
{
return SharedSerial.ReceiveCounted(1);
}
catch (COMException ex)
{
if (ex.Message.Contains("Timed out waiting for received data"))
throw new TimeoutException(ex.Message, ex);
throw;
}
}
}
@@ -146,6 +170,17 @@ namespace ASCOM.Meade.net
private const string ReverseFocusDirectionName = "Reverse Focuser Direction";
private const string DynamicBreakingName = "Dynamic Breaking";
private const string SiteElevationName = "Site Elevation";
private const string SettleTimeName = "Settle Time";
private const string SpeedName = "Speed";
private const string DataBitsName = "Data Bits";
private const string StopBitsName = "Stop Bits";
private const string HandShakeName = "Hand Shake";
private const string ParityName = "Parity";
private const string SendDateTimeName = "Send Date and time on connect";
private const string ParkedBehaviourName = "Parked Behaviour";
private const string ParkedAltName = "Parked Altitude";
private const string ParkedAzimuthName = "Parked Azimuth";
public static void WriteProfile(ProfileProperties profileProperties)
{
@@ -157,13 +192,23 @@ namespace ASCOM.Meade.net
driverProfile.WriteValue(DriverId, TraceStateProfileName, profileProperties.TraceLogger.ToString());
driverProfile.WriteValue(DriverId, ComPortProfileName, profileProperties.ComPort);
driverProfile.WriteValue(DriverId, RtsDtrProfileName, profileProperties.RtsDtrEnabled.ToString());
driverProfile.WriteValue(DriverId, SpeedName, profileProperties.Speed.ToString(CultureInfo.InvariantCulture));
driverProfile.WriteValue(DriverId, DataBitsName, profileProperties.DataBits.ToString(CultureInfo.InvariantCulture));
driverProfile.WriteValue(DriverId, StopBitsName, profileProperties.StopBits);
driverProfile.WriteValue(DriverId, HandShakeName, profileProperties.Handshake);
driverProfile.WriteValue(DriverId, ParityName, profileProperties.Parity);
driverProfile.WriteValue(DriverId, GuideRateProfileName, profileProperties.GuideRateArcSecondsPerSecond.ToString(CultureInfo.InvariantCulture));
driverProfile.WriteValue(DriverId, PrecisionProfileName, profileProperties.Precision);
driverProfile.WriteValue(DriverId, GuidingStyleProfileName, profileProperties.GuidingStyle);
driverProfile.WriteValue(DriverId, BacklashCompensationName, profileProperties.BacklashCompensation.ToString());
driverProfile.WriteValue(DriverId, ReverseFocusDirectionName, profileProperties.ReverseFocusDirection.ToString());
driverProfile.WriteValue(DriverId, DynamicBreakingName, profileProperties.DynamicBreaking.ToString());
driverProfile.WriteValue(DriverId, SiteElevationName, profileProperties.SiteElevation.ToString());
driverProfile.WriteValue(DriverId, SiteElevationName, profileProperties.SiteElevation.ToString(CultureInfo.InvariantCulture));
driverProfile.WriteValue(DriverId, SettleTimeName, profileProperties.SettleTime.ToString());
driverProfile.WriteValue(DriverId, SendDateTimeName, profileProperties.SendDateTime.ToString());
driverProfile.WriteValue(DriverId, ParkedBehaviourName, profileProperties.ParkedBehaviour.GetDescription());
driverProfile.WriteValue(DriverId, ParkedAltName, profileProperties.ParkedAlt.ToString(CultureInfo.InvariantCulture));
driverProfile.WriteValue(DriverId, ParkedAzimuthName, profileProperties.ParkedAz.ToString(CultureInfo.InvariantCulture));
}
}
}
@@ -178,6 +223,16 @@ namespace ASCOM.Meade.net
private const string ReverseFocuserDiectionDefault = "true";
private const string DynamicBreakingDefault = "true";
private const string SiteElevationDefault = "0";
private const string SettleTimeDefault = "2";
private const string SpeedDefault = "9600";
private const string DataBitsDefault = "8";
private const string StopBitsDefault = "One";
private const string HandShakeDefault = "None";
private const string ParityDefault = "None";
private const string SendDateTimeDefault = "false";
private static string ParkedBehaviourDefault = "No Coordinates";
private const string ParkedAltDefault = "0";
private const string ParkedAzimuthDefault = "180";
public static ProfileProperties ReadProfile()
{
@@ -197,6 +252,17 @@ namespace ASCOM.Meade.net
profileProperties.ReverseFocusDirection = Convert.ToBoolean(driverProfile.GetValue(DriverId, ReverseFocusDirectionName, string.Empty, ReverseFocuserDiectionDefault));
profileProperties.DynamicBreaking = Convert.ToBoolean(driverProfile.GetValue(DriverId, DynamicBreakingName, string.Empty, DynamicBreakingDefault));
profileProperties.SiteElevation = Convert.ToInt32(driverProfile.GetValue(DriverId, SiteElevationName, string.Empty, SiteElevationDefault));
profileProperties.SettleTime = Convert.ToInt16(driverProfile.GetValue(DriverId, SettleTimeName, string.Empty, SettleTimeDefault));
profileProperties.StopBits = driverProfile.GetValue(DriverId, StopBitsName, string.Empty, StopBitsDefault);
profileProperties.DataBits = Convert.ToInt32(driverProfile.GetValue(DriverId, DataBitsName, string.Empty, DataBitsDefault));
profileProperties.Handshake = driverProfile.GetValue(DriverId, HandShakeName, string.Empty, HandShakeDefault);
profileProperties.Speed = Convert.ToInt32(driverProfile.GetValue(DriverId, SpeedName, string.Empty, SpeedDefault));
profileProperties.Parity = driverProfile.GetValue(DriverId, ParityName, string.Empty, ParityDefault);
profileProperties.SendDateTime = Convert.ToBoolean(driverProfile.GetValue(DriverId, SendDateTimeName, string.Empty, SendDateTimeDefault));
profileProperties.ParkedBehaviour = EnumExtensionMethods.GetValueFromDescription<ParkedBehaviour>(driverProfile.GetValue(DriverId, ParkedBehaviourName, string.Empty, ParkedBehaviourDefault));
profileProperties.ParkedAlt = double.Parse(driverProfile.GetValue(DriverId, ParkedAltName, string.Empty, ParkedAltDefault), NumberFormatInfo.InvariantInfo);
profileProperties.ParkedAz = double.Parse(driverProfile.GetValue(DriverId, ParkedAzimuthName, string.Empty, ParkedAzimuthDefault), NumberFormatInfo.InvariantInfo);
}
return profileProperties;
@@ -282,17 +348,17 @@ namespace ASCOM.Meade.net
SharedSerial.PortName = profileProperties.ComPort;
SharedSerial.DTREnable = profileProperties.RtsDtrEnabled;
SharedSerial.RTSEnable = profileProperties.RtsDtrEnabled;
SharedSerial.DataBits = 8;
SharedSerial.StopBits = SerialStopBits.One;
SharedSerial.Parity = SerialParity.None;
SharedSerial.Speed = SerialSpeed.ps9600;
SharedSerial.Handshake = SerialHandshake.None;
SharedSerial.DataBits = profileProperties.DataBits;
SharedSerial.StopBits = (SerialStopBits)Enum.Parse(typeof(SerialStopBits), profileProperties.StopBits );
SharedSerial.Parity = (SerialParity)Enum.Parse(typeof(SerialParity), profileProperties.Parity);
SharedSerial.Speed = (SerialSpeed)profileProperties.Speed;
SharedSerial.Handshake = (SerialHandshake)Enum.Parse(typeof(SerialHandshake), profileProperties.Handshake);
SharedSerial.Connected = true;
try
{
ProductName = SendString("#:GVP#");
FirmwareVersion = SendString("#:GVN#");
ProductName = SendString(":GVP#");
FirmwareVersion = SendString(":GVN#");
}
catch (Exception ex)
{
@@ -312,7 +378,7 @@ namespace ASCOM.Meade.net
try
{
string utcOffSet = SendString("#:GG#");
string utcOffSet = SendString(":GG#");
//:GG# Get UTC offset time
//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
+2
View File
@@ -14,6 +14,8 @@
// ReSharper disable once InconsistentNaming
public const string Autostar497_43Eg = "43Eg";
// ReSharper disable once InconsistentNaming
public const string AudioStar_A4S4 = "A4S4";
#endregion
#region LX200GPS
+3 -3
View File
@@ -15,7 +15,7 @@ namespace ASCOM.Meade.net.Wrapper
void Lock(Action action);
T Lock<T>(Func<T> func);
string SendString(string message);
string SendString(string message, bool includePrefix = true);
void SendBlind(string message);
string SendChar(string message);
@@ -54,9 +54,9 @@ namespace ASCOM.Meade.net.Wrapper
return SharedResources.Lock(func);
}
public string SendString(string message)
public string SendString(string message, bool includePrefix = true)
{
return SharedResources.SendString(message);
return SharedResources.SendString(message, includePrefix);
}
public void SendBlind(string message)