@@ -917,6 +917,7 @@ namespace Meade.net.Telescope.UnitTests
|
||||
|
||||
[TestCase("Autostar", "43Eg", true)]
|
||||
[TestCase("LX200 Classic", "", false)]
|
||||
[TestCase("LXD600", TelescopeList.LXD600_6_12S, false)]
|
||||
public void CanPark_Get_ReturnsTrue(string productName, string firmware, bool canPark)
|
||||
{
|
||||
ConnectTelescope(productName, firmware, $"{_testProperties.AlignmentMode}N0");
|
||||
|
||||
@@ -632,6 +632,9 @@ namespace ASCOM.Meade.net
|
||||
{
|
||||
var isStarPatch = false;
|
||||
|
||||
//LXD600 is based on LX-200 classic Meade and does not support StarPatch
|
||||
if (SharedResourcesWrapper.ProductName != TelescopeList.LXD600)
|
||||
{
|
||||
var firmwareVersionArray = SharedResourcesWrapper.FirmwareVersion.ToCharArray();
|
||||
if (firmwareVersionArray.Length > 1)
|
||||
{
|
||||
@@ -650,6 +653,7 @@ namespace ASCOM.Meade.net
|
||||
isStarPatch = char.IsUpper(lastChr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LogMessage("Is StarPatch Firmware", $": {isStarPatch}");
|
||||
return isStarPatch;
|
||||
@@ -703,7 +707,7 @@ namespace ASCOM.Meade.net
|
||||
i--;
|
||||
}
|
||||
}
|
||||
catch (TimeoutException e)
|
||||
catch (TimeoutException)
|
||||
{
|
||||
LogMessage("ApplySkipAutoStarPrompts","Timed out bypassing the date time prompts. Skipping.");
|
||||
}
|
||||
@@ -765,7 +769,8 @@ namespace ASCOM.Meade.net
|
||||
|
||||
private bool IsLongFormatSupported()
|
||||
{
|
||||
if (SharedResourcesWrapper.ProductName == TelescopeList.LX200CLASSIC)
|
||||
if ((SharedResourcesWrapper.ProductName == TelescopeList.LX200CLASSIC) ||
|
||||
(SharedResourcesWrapper.ProductName == TelescopeList.LXD600))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -1532,7 +1537,8 @@ namespace ASCOM.Meade.net
|
||||
{
|
||||
try
|
||||
{
|
||||
var canPark = SharedResourcesWrapper.ProductName != TelescopeList.LX200CLASSIC;
|
||||
var canPark = ((SharedResourcesWrapper.ProductName != TelescopeList.LX200CLASSIC) &&
|
||||
(SharedResourcesWrapper.ProductName != TelescopeList.LXD600));
|
||||
LogMessage("CanPark", "Get - " + canPark);
|
||||
return canPark;
|
||||
}
|
||||
@@ -1810,7 +1816,8 @@ namespace ASCOM.Meade.net
|
||||
TelescopeList.LX200GPS,
|
||||
TelescopeList.RCX400,
|
||||
TelescopeList.LX200CLASSIC,
|
||||
TelescopeList.LX800
|
||||
TelescopeList.LX800,
|
||||
TelescopeList.LXD600
|
||||
};
|
||||
|
||||
return unParkableScopes.Contains(SharedResourcesWrapper.ProductName);
|
||||
@@ -2294,7 +2301,8 @@ namespace ASCOM.Meade.net
|
||||
|
||||
var isTracking = Tracking;
|
||||
|
||||
if (SharedResourcesWrapper.ProductName != TelescopeList.LX200CLASSIC)
|
||||
if ((SharedResourcesWrapper.ProductName != TelescopeList.LX200CLASSIC) &&
|
||||
(SharedResourcesWrapper.ProductName != TelescopeList.LXD600))
|
||||
{
|
||||
SharedResourcesWrapper.SendBlind(Tl, "hP");
|
||||
//:hP# Autostar, Autostar II and LX 16" Slew to Park Position
|
||||
@@ -2302,7 +2310,7 @@ namespace ASCOM.Meade.net
|
||||
}
|
||||
else
|
||||
{
|
||||
LogMessage("Park", $"LX200 Classic does not support parking");
|
||||
LogMessage("Park", $"LX200 Classic or LXD600 do not support parking");
|
||||
throw new NotImplementedException("Park");
|
||||
}
|
||||
|
||||
@@ -2953,7 +2961,7 @@ namespace ASCOM.Meade.net
|
||||
LogMessage("TargetAltitude Set", $"{command}");
|
||||
var response = SharedResourcesWrapper.SendBool(Tl, command);
|
||||
//:SasDD*MM#
|
||||
// Set target object altitude to sDD*MM# or sDD*MM’SS# [LX 16”, Autostar, Autostar II]
|
||||
// Set target object altitude to sDD*MM# or sDD*MM�SS# [LX 16�, Autostar, Autostar II]
|
||||
// Returns:
|
||||
// 1 Object within slew range
|
||||
// 0 Object out of slew range
|
||||
@@ -2990,9 +2998,9 @@ namespace ASCOM.Meade.net
|
||||
LogMessage("TargetAzimuth Set", $"{command}");
|
||||
var response = SharedResourcesWrapper.SendBool(Tl, command);
|
||||
//:SzDDD*MM#
|
||||
// Sets the target Object Azimuth[LX 16” and Autostar II only]
|
||||
// Sets the target Object Azimuth[LX 16� and Autostar II only]
|
||||
// Returns:
|
||||
// 0 – Invalid
|
||||
// 0 � Invalid
|
||||
// 1 - Valid
|
||||
if (!response)
|
||||
throw new InvalidOperationException("Target Azimuth out of slew range.");
|
||||
|
||||
@@ -151,21 +151,21 @@ namespace Meade.net.UnitTests
|
||||
string TraceStateDefault = "false";
|
||||
|
||||
string ComPortDefault = "COM1";
|
||||
string SpeedDefault = "9600";
|
||||
string DataBitsDefault = "8";
|
||||
int SpeedDefault = 9600;
|
||||
int DataBitsDefault = 8;
|
||||
string StopBitsDefault = "One";
|
||||
string HandshakeDefault = "None";
|
||||
string ParityDefault = "None";
|
||||
string RtsDtrEnabledDefault = "true";
|
||||
bool RtsDtrEnabledDefault = true;
|
||||
|
||||
string GuideRateProfileNameDefault = "10.077939"; //67% of sidereal rate
|
||||
double GuideRateProfileNameDefault = 10.077939; //67% of sidereal rate
|
||||
string PrecisionDefault = "Unchanged";
|
||||
string GuidingStyleDefault = "Auto";
|
||||
|
||||
string BacklashCompensationDefault = "3000";
|
||||
string ReverseFocuserDiectionDefault = "true";
|
||||
int BacklashCompensationDefault = 3000;
|
||||
bool ReverseFocuserDiectionDefault = true;
|
||||
|
||||
string SendDateTimeDefault = "true";
|
||||
bool SendDateTimeDefault = true;
|
||||
string SkipPromptsDefault = "true";
|
||||
|
||||
string ParkedBehaviourDefault = "No Coordinates";
|
||||
@@ -184,23 +184,23 @@ namespace Meade.net.UnitTests
|
||||
profileWrapperMock.Setup(x => x.GetValue(DriverId, "COM Port", string.Empty, ComPortDefault))
|
||||
.Returns(ComPortDefault);
|
||||
profileWrapperMock
|
||||
.Setup(x => x.GetValue(DriverId, "Guide Rate Arc Seconds Per Second", string.Empty,
|
||||
GuideRateProfileNameDefault)).Returns(GuideRateProfileNameDefault);
|
||||
.Setup(x => x.GetValueDouble(DriverId, "Guide Rate Arc Seconds Per Second", string.Empty,
|
||||
GuideRateProfileNameDefault.ToString())).Returns(GuideRateProfileNameDefault);
|
||||
profileWrapperMock.Setup(x => x.GetValue(DriverId, "Precision", string.Empty, PrecisionDefault))
|
||||
.Returns(PrecisionDefault);
|
||||
profileWrapperMock.Setup(x => x.GetValue(DriverId, "Guiding Style", string.Empty, GuidingStyleDefault))
|
||||
.Returns(GuidingStyleDefault);
|
||||
profileWrapperMock.Setup(x =>
|
||||
x.GetValue(DriverId, "Backlash Compensation", string.Empty, BacklashCompensationDefault))
|
||||
x.GetValueInt(DriverId, "Backlash Compensation", string.Empty, BacklashCompensationDefault.ToString()))
|
||||
.Returns(BacklashCompensationDefault);
|
||||
profileWrapperMock.Setup(x =>
|
||||
x.GetValue(DriverId, "Reverse Focuser Direction", string.Empty, "true"))
|
||||
x.GetValueBool(DriverId, "Reverse Focuser Direction", string.Empty, "true"))
|
||||
.Returns(() => ReverseFocuserDiectionDefault);
|
||||
profileWrapperMock.Setup(x =>
|
||||
x.GetValue(DriverId, "Speed", string.Empty, SpeedDefault))
|
||||
x.GetValueInt(DriverId, "Speed", string.Empty, SpeedDefault.ToString()))
|
||||
.Returns(() => SpeedDefault);
|
||||
profileWrapperMock.Setup(x =>
|
||||
x.GetValue(DriverId, "Data Bits", string.Empty, DataBitsDefault))
|
||||
x.GetValueInt(DriverId, "Data Bits", string.Empty, DataBitsDefault.ToString()))
|
||||
.Returns(() => DataBitsDefault);
|
||||
profileWrapperMock.Setup(x =>
|
||||
x.GetValue(DriverId, "Stop Bits", string.Empty, StopBitsDefault))
|
||||
@@ -212,7 +212,7 @@ namespace Meade.net.UnitTests
|
||||
x.GetValue(DriverId, "Parity", string.Empty, ParityDefault))
|
||||
.Returns(() => ParityDefault);
|
||||
profileWrapperMock.Setup(x =>
|
||||
x.GetValue(DriverId, "Rts / Dtr", string.Empty, "false"))
|
||||
x.GetValueBool(DriverId, "Rts / Dtr", string.Empty, "false"))
|
||||
.Returns(() => RtsDtrEnabledDefault);
|
||||
|
||||
profileWrapperMock.Setup(x =>
|
||||
@@ -239,7 +239,7 @@ namespace Meade.net.UnitTests
|
||||
|
||||
|
||||
profileWrapperMock.Setup(x =>
|
||||
x.GetValue(DriverId, "Send Date and time on connect", string.Empty, "false"))
|
||||
x.GetValueBool(DriverId, "Send Date and time on connect", string.Empty, "false"))
|
||||
.Returns(() => SendDateTimeDefault);
|
||||
|
||||
profileWrapperMock.Setup(x =>
|
||||
@@ -264,21 +264,21 @@ namespace Meade.net.UnitTests
|
||||
Assert.That(profileProperties.ComPort, Is.EqualTo(ComPortDefault));
|
||||
|
||||
Assert.That(profileProperties.GuideRateArcSecondsPerSecond,
|
||||
Is.EqualTo(double.Parse(GuideRateProfileNameDefault)));
|
||||
Is.EqualTo(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.BacklashCompensation, Is.EqualTo(BacklashCompensationDefault));
|
||||
Assert.That(profileProperties.ReverseFocusDirection, Is.EqualTo(ReverseFocuserDiectionDefault));
|
||||
|
||||
Assert.That(profileProperties.Speed, Is.EqualTo(int.Parse(SpeedDefault)));
|
||||
Assert.That(profileProperties.DataBits, Is.EqualTo(int.Parse(DataBitsDefault)));
|
||||
Assert.That(profileProperties.Speed, Is.EqualTo(SpeedDefault));
|
||||
Assert.That(profileProperties.DataBits, Is.EqualTo(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.RtsDtrEnabled, Is.EqualTo(RtsDtrEnabledDefault));
|
||||
|
||||
Assert.That(profileProperties.SendDateTime, Is.EqualTo(bool.Parse(SendDateTimeDefault)));
|
||||
Assert.That(profileProperties.SendDateTime, Is.EqualTo(SendDateTimeDefault));
|
||||
}
|
||||
|
||||
[TestCase("TCP")]
|
||||
@@ -488,6 +488,109 @@ namespace Meade.net.UnitTests
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Connect_WhenDeviceIdIsSerialGVPGVTPartiallySupported_ThenConnectsAndSetsProductToLXD600()
|
||||
{
|
||||
string deviceId = "Serial";
|
||||
string DriverId = "ASCOM.MeadeGeneric.Telescope";
|
||||
|
||||
string TraceStateDefault = "false";
|
||||
|
||||
string ComPortDefault = "COM1";
|
||||
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";
|
||||
string FocalLengthDefault = "2000";
|
||||
string ApertureAreaDefault = "32685";
|
||||
string ApertureDiameterDefault = "203";
|
||||
|
||||
Mock<IProfileWrapper> profileWrapperMock = new Mock<IProfileWrapper>();
|
||||
profileWrapperMock.SetupAllProperties();
|
||||
|
||||
profileWrapperMock.Setup(x => x.GetValue(DriverId, "Trace Level", string.Empty, TraceStateDefault))
|
||||
.Returns(TraceStateDefault);
|
||||
profileWrapperMock.Setup(x => x.GetValue(DriverId, "COM Port", string.Empty, ComPortDefault))
|
||||
.Returns(ComPortDefault);
|
||||
profileWrapperMock
|
||||
.Setup(x => x.GetValue(DriverId, "Guide Rate Arc Seconds Per Second", string.Empty,
|
||||
GuideRateProfileNameDefault)).Returns(GuideRateProfileNameDefault);
|
||||
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);
|
||||
profileWrapperMock.Setup(x =>
|
||||
x.GetValue(DriverId, "Focal Length (mm)", string.Empty, FocalLengthDefault))
|
||||
.Returns(() => FocalLengthDefault);
|
||||
profileWrapperMock.Setup(x =>
|
||||
x.GetValue(DriverId, "Aperture Area (mm²)", string.Empty, ApertureAreaDefault))
|
||||
.Returns(() => ApertureAreaDefault);
|
||||
profileWrapperMock.Setup(x =>
|
||||
x.GetValue(DriverId, "Aperture Diameter (mm)", string.Empty, ApertureDiameterDefault))
|
||||
.Returns(() => ApertureDiameterDefault);
|
||||
|
||||
Mock<IProfileFactory> profileFactoryMock = new Mock<IProfileFactory>();
|
||||
profileFactoryMock.Setup(x => x.Create()).Returns(profileWrapperMock.Object);
|
||||
|
||||
SharedResources.ProfileFactory = profileFactoryMock.Object;
|
||||
|
||||
string serialPortReturn = string.Empty;
|
||||
string productNameAndFirmwareVersion = TelescopeList.LXD600_6_12S;
|
||||
|
||||
_serialMock.Setup(x => x.Transmit("#:GVP#")).Callback(() => { serialPortReturn = productNameAndFirmwareVersion; });
|
||||
_serialMock.Setup(x => x.Transmit("#:GVN#")).Callback(() => { serialPortReturn = productNameAndFirmwareVersion; });
|
||||
|
||||
_serialMock.Setup(x => x.Transmit("#:GG#")).Callback(() => { serialPortReturn = "0"; });
|
||||
_serialMock.Setup(x => x.ReceiveTerminated("#")).Returns(() => serialPortReturn);
|
||||
|
||||
var connectionResult = SharedResources.Connect(deviceId, string.Empty, _traceLoggerMock.Object);
|
||||
try
|
||||
{
|
||||
Assert.That(connectionResult.SameDevice, Is.EqualTo(1));
|
||||
Assert.That(SharedResources.ProductName, Is.EqualTo(TelescopeList.LXD600));
|
||||
Assert.That(SharedResources.FirmwareVersion, Is.EqualTo(productNameAndFirmwareVersion));
|
||||
}
|
||||
finally
|
||||
{
|
||||
SharedResources.Disconnect(deviceId, String.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Connect_WhenDeviceIdIsSerialButGVPIsAutostar_ThenConnectsAndSetsProductToAutostarAndFirmware()
|
||||
{
|
||||
@@ -692,15 +795,15 @@ namespace Meade.net.UnitTests
|
||||
}
|
||||
}
|
||||
|
||||
[TestCase("57600")]
|
||||
[TestCase("38400")]
|
||||
[TestCase("28800")]
|
||||
[TestCase("19200")]
|
||||
[TestCase("14400")]
|
||||
[TestCase("4800")]
|
||||
[TestCase("2400")]
|
||||
[TestCase("1200")]
|
||||
public void Connect_WhenSpeedIsFastAndAutostarAtDefault_ThenConnectsAutoStarSpeedChanged(string WantedSpeed)
|
||||
[TestCase(57600)]
|
||||
[TestCase(38400)]
|
||||
[TestCase(28800)]
|
||||
[TestCase(19200)]
|
||||
[TestCase(14400)]
|
||||
[TestCase(4800)]
|
||||
[TestCase(2400)]
|
||||
[TestCase(1200)]
|
||||
public void Connect_WhenSpeedIsFastAndAutostarAtDefault_ThenConnectsAutoStarSpeedChanged(int WantedSpeed)
|
||||
{
|
||||
string deviceId = "Serial";
|
||||
|
||||
@@ -739,7 +842,7 @@ namespace Meade.net.UnitTests
|
||||
profileWrapperMock.Setup(x => x.GetValue(DriverId, "Precision", string.Empty, PrecisionDefault))
|
||||
.Returns(PrecisionDefault);
|
||||
profileWrapperMock.Setup(x =>
|
||||
x.GetValue(DriverId, "Speed", string.Empty, SpeedDefault))
|
||||
x.GetValueInt(DriverId, "Speed", string.Empty, SpeedDefault))
|
||||
.Returns(() => WantedSpeed);
|
||||
profileWrapperMock.Setup(x =>
|
||||
x.GetValue(DriverId, "Data Bits", string.Empty, DataBitsDefault))
|
||||
@@ -812,15 +915,15 @@ namespace Meade.net.UnitTests
|
||||
}
|
||||
}
|
||||
|
||||
[TestCase("57600")]
|
||||
[TestCase("38400")]
|
||||
[TestCase("28800")]
|
||||
[TestCase("19200")]
|
||||
[TestCase("14400")]
|
||||
[TestCase("4800")]
|
||||
[TestCase("2400")]
|
||||
[TestCase("1200")]
|
||||
public void Connect_WhenAutostarReportsFailedToChangeSpeec_ThenConnectsAutoStarAtDefaultSpeed(string WantedSpeed)
|
||||
[TestCase(57600)]
|
||||
[TestCase(38400)]
|
||||
[TestCase(28800)]
|
||||
[TestCase(19200)]
|
||||
[TestCase(14400)]
|
||||
[TestCase(4800)]
|
||||
[TestCase(2400)]
|
||||
[TestCase(1200)]
|
||||
public void Connect_WhenAutostarReportsFailedToChangeSpeec_ThenConnectsAutoStarAtDefaultSpeed(int WantedSpeed)
|
||||
{
|
||||
string deviceId = "Serial";
|
||||
|
||||
@@ -859,7 +962,7 @@ namespace Meade.net.UnitTests
|
||||
profileWrapperMock.Setup(x => x.GetValue(DriverId, "Precision", string.Empty, PrecisionDefault))
|
||||
.Returns(PrecisionDefault);
|
||||
profileWrapperMock.Setup(x =>
|
||||
x.GetValue(DriverId, "Speed", string.Empty, SpeedDefault))
|
||||
x.GetValueInt(DriverId, "Speed", string.Empty, SpeedDefault))
|
||||
.Returns(() => WantedSpeed);
|
||||
profileWrapperMock.Setup(x =>
|
||||
x.GetValue(DriverId, "Data Bits", string.Empty, DataBitsDefault))
|
||||
|
||||
@@ -148,6 +148,7 @@
|
||||
<Compile Include="TelescopeList.cs" />
|
||||
<Compile Include="ThreadSafeValue.cs" />
|
||||
<Compile Include="Win32Utilities.cs" />
|
||||
<Compile Include="Wrapper\GetValueException.cs" />
|
||||
<Compile Include="Wrapper\IProfileWrapper.cs" />
|
||||
<Compile Include="Wrapper\SharedResourcesWrapper.cs" />
|
||||
<EmbeddedResource Include="frmMain.resx">
|
||||
|
||||
@@ -211,7 +211,7 @@ namespace ASCOM.Meade.net
|
||||
private const string ParkedAltName = "Parked Altitude";
|
||||
private const string ParkedAzimuthName = "Parked Azimuth";
|
||||
private const string FocalLengthName = "Focal Length (mm)";
|
||||
private const string ApertureAreaName = "Aperture Area (mm²)";
|
||||
private const string ApertureAreaName = "Aperture Area (mm�)";
|
||||
private const string ApertureDiameterName = "Aperture Diameter (mm)";
|
||||
|
||||
public static void WriteProfile(ProfileProperties profileProperties)
|
||||
@@ -283,30 +283,30 @@ namespace ASCOM.Meade.net
|
||||
{
|
||||
driverProfile.DeviceType = "Telescope";
|
||||
profileProperties.ComPort = driverProfile.GetValue(DriverId, ComPortProfileName, string.Empty, ComPortDefault);
|
||||
profileProperties.TimeoutMs = Convert.ToInt32(driverProfile.GetValue(DriverId, TimeoutMsName, string.Empty, TimeoutMsDefault));
|
||||
profileProperties.RtsDtrEnabled = Convert.ToBoolean(driverProfile.GetValue(DriverId, RtsDtrProfileName, string.Empty, RtsDtrDefault));
|
||||
profileProperties.TraceLogger = Convert.ToBoolean(driverProfile.GetValue(DriverId, TraceStateProfileName, string.Empty, TraceStateDefault));
|
||||
profileProperties.GuideRateArcSecondsPerSecond = double.Parse(driverProfile.GetValue(DriverId, GuideRateProfileName, string.Empty, GuideRateProfileNameDefault), NumberFormatInfo.InvariantInfo);
|
||||
profileProperties.TimeoutMs = driverProfile.GetValueInt(DriverId, TimeoutMsName, string.Empty, TimeoutMsDefault);
|
||||
profileProperties.RtsDtrEnabled = driverProfile.GetValueBool(DriverId, RtsDtrProfileName, string.Empty, RtsDtrDefault);
|
||||
profileProperties.TraceLogger = driverProfile.GetValueBool(DriverId, TraceStateProfileName, string.Empty, TraceStateDefault);
|
||||
profileProperties.GuideRateArcSecondsPerSecond = driverProfile.GetValueDouble(DriverId, GuideRateProfileName, string.Empty, GuideRateProfileNameDefault);
|
||||
profileProperties.Precision = driverProfile.GetValue(DriverId, PrecisionProfileName, string.Empty, PrecisionDefault);
|
||||
profileProperties.GuidingStyle = driverProfile.GetValue(DriverId, GuidingStyleProfileName, string.Empty, GuidingStyleDefault);
|
||||
profileProperties.BacklashCompensation = Convert.ToInt32(driverProfile.GetValue(DriverId, BacklashCompensationName, string.Empty, BacklashCompensationDefault));
|
||||
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.BacklashCompensation = driverProfile.GetValueInt(DriverId, BacklashCompensationName, string.Empty, BacklashCompensationDefault);
|
||||
profileProperties.ReverseFocusDirection = driverProfile.GetValueBool(DriverId, ReverseFocusDirectionName, string.Empty, ReverseFocuserDiectionDefault);
|
||||
profileProperties.DynamicBreaking = driverProfile.GetValueBool(DriverId, DynamicBreakingName, string.Empty, DynamicBreakingDefault);
|
||||
profileProperties.SiteElevation = driverProfile.GetValueInt(DriverId, SiteElevationName, string.Empty, SiteElevationDefault);
|
||||
profileProperties.SettleTime = driverProfile.GetValueShort(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.DataBits = driverProfile.GetValueInt(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.Speed = driverProfile.GetValueInt(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.SendDateTime = driverProfile.GetValueBool(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);
|
||||
profileProperties.FocalLength = double.Parse(driverProfile.GetValue(DriverId, FocalLengthName, string.Empty, FocalLengthDefault), NumberFormatInfo.InvariantInfo);
|
||||
profileProperties.ApertureArea = double.Parse(driverProfile.GetValue(DriverId, ApertureAreaName, string.Empty, ApertureAreaDefault), NumberFormatInfo.InvariantInfo);
|
||||
profileProperties.ApertureDiameter = double.Parse(driverProfile.GetValue(DriverId, ApertureDiameterName, string.Empty, ApertureDiameterDefault), NumberFormatInfo.InvariantInfo);
|
||||
profileProperties.ParkedAlt = driverProfile.GetValueDouble(DriverId, ParkedAltName, string.Empty, ParkedAltDefault);
|
||||
profileProperties.ParkedAz = driverProfile.GetValueDouble(DriverId, ParkedAzimuthName, string.Empty, ParkedAzimuthDefault);
|
||||
profileProperties.FocalLength = driverProfile.GetValueDouble(DriverId, FocalLengthName, string.Empty, FocalLengthDefault);
|
||||
profileProperties.ApertureArea = driverProfile.GetValueDouble(DriverId, ApertureAreaName, string.Empty, ApertureAreaDefault);
|
||||
profileProperties.ApertureDiameter = driverProfile.GetValueDouble(DriverId, ApertureDiameterName, string.Empty, ApertureDiameterDefault);
|
||||
}
|
||||
|
||||
return profileProperties;
|
||||
@@ -475,6 +475,15 @@ namespace ASCOM.Meade.net
|
||||
{
|
||||
ProductName = SendString(traceLogger, "GVP");
|
||||
FirmwareVersion = SendString(traceLogger, "GVN");
|
||||
|
||||
//LXD600 mount uses LX-200 based firmware. When both above commands are sent to the scope,
|
||||
//they both return the "6.12S" string.
|
||||
//There may be other values of the string applicable to LXD600 mount or other values of the string
|
||||
//may allow identify LXD650/LXD700 or other scopes. May require further adjustments.
|
||||
if (String.Equals(ProductName, FirmwareVersion) && String.Equals(ProductName, TelescopeList.LXD600_6_12S))
|
||||
{
|
||||
ProductName = TelescopeList.LXD600;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
@@ -45,6 +45,13 @@
|
||||
public const string LX200CLASSIC = "LX200 Classic"; //GVP command is not supported!
|
||||
#endregion
|
||||
|
||||
#region LXD600
|
||||
public const string LXD600 = "LXD600";
|
||||
|
||||
public const string LXD600_6_12S = "6.12S";
|
||||
|
||||
#endregion
|
||||
|
||||
#region RCX400
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public const string RCX400 = "RCX400";
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
|
||||
namespace ASCOM.Meade.net.Wrapper
|
||||
{
|
||||
public class GetValueException : Exception
|
||||
{
|
||||
public GetValueException(
|
||||
string driverId,
|
||||
string name,
|
||||
string subKey,
|
||||
string defaultValue,
|
||||
Exception innerException
|
||||
) : base ( $"Error getting value {name} from driver {driverId} in {subKey} and default value {defaultValue} cannot be used.", innerException)
|
||||
{
|
||||
}
|
||||
|
||||
public GetValueException(
|
||||
string driverId,
|
||||
string name,
|
||||
string subKey,
|
||||
string defaultValue,
|
||||
string value,
|
||||
Exception innerException):
|
||||
base($"Error converting value {name} from {value}", innerException)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Globalization;
|
||||
using ASCOM.Utilities;
|
||||
using ASCOM.Utilities.Interfaces;
|
||||
|
||||
@@ -7,7 +8,11 @@ namespace ASCOM.Meade.net.Wrapper
|
||||
{
|
||||
public interface IProfileWrapper : IProfile, IProfileExtra, IDisposable
|
||||
{
|
||||
int GetValueInt(string driverId, string name, string subKey, string defaultValue);
|
||||
short GetValueShort(string driverId, string name, string subKey, string defaultValue);
|
||||
|
||||
bool GetValueBool(string driverId, string name, string subKey, string defaultValue);
|
||||
double GetValueDouble(string driverId, string name, string subKey, string defaultValue);
|
||||
}
|
||||
|
||||
public class ProfileWrapper : IProfileWrapper
|
||||
@@ -35,9 +40,70 @@ namespace ASCOM.Meade.net.Wrapper
|
||||
}
|
||||
|
||||
public string GetValue(string driverId, string name, string subKey, string defaultValue)
|
||||
{
|
||||
try
|
||||
{
|
||||
return _profile.GetValue(driverId, name, subKey, defaultValue);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new GetValueException(driverId, name, subKey, defaultValue, e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public int GetValueInt(string driverId, string name, string subKey, string defaultValue)
|
||||
{
|
||||
var value = GetValue(driverId, name, subKey, defaultValue);
|
||||
try
|
||||
{
|
||||
return int.Parse(value, CultureInfo.InvariantCulture);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new GetValueException(driverId, name, subKey, defaultValue, value, e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public short GetValueShort(string driverId, string name, string subKey, string defaultValue)
|
||||
{
|
||||
var value = GetValue(driverId, name, subKey, defaultValue);
|
||||
try
|
||||
{
|
||||
return short.Parse(value, CultureInfo.InvariantCulture);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new GetValueException(driverId, name, subKey, defaultValue, value, e);
|
||||
}
|
||||
}
|
||||
|
||||
public bool GetValueBool(string driverId, string name, string subKey, string defaultValue)
|
||||
{
|
||||
var value = GetValue(driverId, name, subKey, defaultValue);
|
||||
try
|
||||
{
|
||||
return bool.Parse(value);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new GetValueException(driverId, name, subKey, defaultValue, value, e);
|
||||
}
|
||||
}
|
||||
|
||||
public double GetValueDouble(string driverId, string name, string subKey, string defaultValue)
|
||||
{
|
||||
var value = GetValue(driverId, name, subKey, defaultValue);
|
||||
try
|
||||
{
|
||||
return double.Parse(value, CultureInfo.InvariantCulture);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new GetValueException(driverId, name, subKey, defaultValue, value, e);
|
||||
}
|
||||
}
|
||||
|
||||
public void WriteValue(string driverId, string name, string value, string subKey)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user