Compare commits

...

69 Commits

Author SHA1 Message Date
ColinD 8d8b50957c Merged in develop (pull request #36)
Develop
2021-07-03 12:35:42 +00:00
Sebastian Godelet faa6ad757e Merged in feature/GWSupport-update (pull request #35)
Feature/GWSupport update
2021-07-03 11:23:32 +00:00
Sebastian Godelet 64df8282a0 Support Set Tracking when GW is supported 2021-06-29 15:31:57 +10:00
Sebastian Godelet 8478af26bf Implemented TrackingRate via GT 2021-06-28 16:06:15 +10:00
Sebastian Godelet 77c87a51fa Moved IsGuiding to SharedResourcesWrapper 2021-06-28 13:03:07 +10:00
Sebastian Godelet 631aa91d94 Moved IsTargetCoordinateInitRequired to SharedResourcesWrapper 2021-06-28 12:53:05 +10:00
Sebastian Godelet 90713de34b Moved parked SiteLat/Long to ParkedPosition data 2021-06-28 12:45:26 +10:00
Sebastian Godelet a3408a86c3 Update unit tests to support GW command
SideOfPier also supports German EQ
2021-06-27 19:16:39 +10:00
Sebastian Godelet 74440b6b3b Merge branch 'develop' into feature/GWSupport 2021-06-25 15:34:58 +10:00
ColinD f1d100892b Removed nunit3 Test adapter 2021-06-23 13:18:30 +01:00
ColinD c6baab2b12 Added tolerance in unit test to allow for rounding error. 2021-06-23 13:11:33 +01:00
Sebastian Godelet f47b205025 Merged in feature/preserve-sop-target-radec-across-connections (pull request #34)
Preserve SideOfPier, Target{RA,DEC}, SlewSettleTime, Move axis across connections

Approved-by: Colin Dawson
2021-06-23 08:53:31 +00:00
Sebastian Godelet 6c27499769 Create generic ThreadSafeValue 2021-06-23 16:21:08 +10:00
Sebastian Godelet 6dff32505e Clarify thread-safe value test intention 2021-06-23 11:09:22 +10:00
Sebastian Godelet 7afd364efa Add tests for SharedResources properties
Ensure that default values are correct and no error appears
2021-06-22 17:43:25 +10:00
Sebastian Godelet 6fc476b031 Make further properties multi-client and thread-safe
Move MovingPrimary, MovingSecondary, EarliestNonSlewingTime to
SharedResources, make all new properties thread-safe (atomic)
operations.
2021-06-22 17:21:21 +10:00
Sebastian Godelet af750549fe Test that low-precision digit values are preserved across connections 2021-06-13 17:36:42 +10:00
Sebastian Godelet 2e3572375f Test that SideralTime is preserved across connections 2021-06-13 17:24:09 +10:00
Sebastian Godelet b23da15022 Make Focuser.cs ASCII compatible 2021-06-13 16:30:55 +10:00
Sebastian Godelet 0b75b8d2cd Remove now unneeded Setup for DestinationSideOfPier
DestinationSideOfPier will not call Slewing anymore,
since it reads the property from SharedResourcesWrapper directly.
2021-06-13 09:59:17 +10:00
Sebastian Godelet 036a9d7116 Add multi-connection test for TargetRightAscension 2021-06-13 09:45:07 +10:00
Sebastian Godelet 6c769f3649 Add SlewSettleTime and IsLongFormat to SharedResources interface
Also ensure that digit precision is set during initialisation
2021-06-12 20:09:51 +10:00
Sebastian Godelet bdbd206a54 Avoid possible data race condition when calculating DSOP 2021-06-12 16:22:38 +10:00
Sebastian Godelet 1684bd60bd Move SideOfPier, TargetRA/DEC properties to SharedResourcesWrapper
This change allows several instances of the driver to be in sync
w.r.t. TargetRightAscension, TargetDeclination and SideOfPier
2021-06-12 15:47:34 +10:00
Sebastian Godelet 8c4b08d0c6 Merged in feature/side-of-pier-unit-tests (pull request #33)
Add unit test around meridian flip detection

Approved-by: Colin Dawson
2021-06-07 10:30:52 +00:00
Sebastian Godelet fe3c106954 Add unit test around meridian flip detection 2021-06-07 17:58:20 +10:00
ColinD 3d0464f379 Merged in develop (pull request #32)
Develop
2021-06-06 13:44:33 +00:00
Sebastian Godelet d1b5652228 Merged in feature/add-side-of-pier (pull request #31)
Implemented SideOfPier and DestinationSideOfPier

Approved-by: Colin Dawson
2021-06-06 13:23:49 +00:00
Sebastian Godelet 65e06f2d6c Implemented SideOfPier and DestinationSideOfPier
For telescopes that automatically perform a meridian flip we can
implement the SideOfPier property by updating the current side of pier
after a telescope slew (via DestinationSideOfPier)
2021-06-06 19:44:40 +10:00
ColinD b27e50275d Added extra logging for CommandBlind, CommandBool, and CommandString. 2021-05-09 15:20:45 +01:00
ColinD a101d3a2d7 Merged in develop (pull request #30)
Develop
2021-04-29 15:18:42 +00:00
ColinD d7637928b7 Made sure that the telescope doesn't think it's parked for the first Telescope to connect. 2021-04-27 22:14:22 +01:00
ColinD 486a9205ee Fixed the defect when one instance of the driver gets parked, the info is shared to the other instances. 2021-04-27 22:08:25 +01:00
ColinD 2c2c59290e Reinstated the Real Alt Az methods for the LX200GPS. Changes how the parked behaviour is implemented, so that it doesn't need to make as many calls. 2021-04-27 20:14:57 +01:00
ColinD 70e615bb4e Made sure that CommandString, CommandBool and CommandBlind work as expected, complete with Raw and non raw support. (Implementation is the same as one of the LX200 drivers.) 2021-04-26 20:51:41 +01:00
ColinD 43ec63b0f5 Merged in develop (pull request #29)
Develop
2021-04-25 19:54:35 +00:00
ColinD 8c94fd6b71 Merge branch 'develop' into feature/GWSupport 2021-04-25 20:28:48 +01: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 a2abbbb3d0 Working on a possible side of pier implementation 2021-04-21 17:24:40 +01: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 21e7bcd530 Added support for the GW Command.
Removed the implementation of Tracking Set as this does not do anything in the code.
Set Can Set Tracking to false.
Get tracking always returns true is the GW command is not supported.
2021-03-10 19:25:27 +00:00
30 changed files with 3995 additions and 1145 deletions
@@ -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" />
+2 -1
View File
@@ -123,7 +123,8 @@ namespace AstroMath.UnitTests
var altAz = _astroMath.ConvertEqToHoz(hourAngle, latitude, equatorialCoordinates);
Assert.That(altAz.Altitude, Is.EqualTo(20.958562421092779));
Assert.That(altAz.Altitude, Is.GreaterThan(20.958562421092770));
Assert.That(altAz.Altitude, Is.LessThanOrEqualTo(20.958562421092779));
Assert.That(altAz.Azimuth, Is.EqualTo(281.2728706962269));
}
+35 -25
View File
@@ -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"
@@ -103,16 +109,17 @@ namespace Meade.net.Focuser.UnitTests
Assert.That(exception.Message, Is.EqualTo("Not connected to focuser when trying to execute: CommandBlind"));
}
[Test]
public void CommandBlind_WhenConnected_ThenSendsExpectedMessage()
[TestCase(false)]
[TestCase(true)]
public void CommandBlind_WhenConnected_ThenSendsExpectedMessage(bool raw)
{
string expectedMessage = "test blind Message";
ConnectFocuser();
_focuser.CommandBlind(expectedMessage, true);
_focuser.CommandBlind(expectedMessage, raw);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(expectedMessage), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(expectedMessage, raw), Times.Once);
}
[Test]
@@ -124,16 +131,19 @@ namespace Meade.net.Focuser.UnitTests
Assert.That(exception.Message, Is.EqualTo("Not connected to focuser when trying to execute: CommandBool"));
}
[Test]
public void CommandBool_WhenConnected_ThenSendsExpectedMessage()
[TestCase(false)]
[TestCase(true)]
public void CommandBool_WhenConnected_ThenSendsExpectedMessage(bool raw)
{
string expectedMessage = "test blind Message";
_sharedResourcesWrapperMock.Setup(x => x.SendBool(expectedMessage, raw)).Returns(true);
ConnectFocuser();
var exception = Assert.Throws<MethodNotImplementedException>(() => { _focuser.CommandBool(expectedMessage, true); });
var result = _focuser.CommandBool(expectedMessage, raw);
Assert.That(exception.Message, Is.EqualTo("Method CommandBool is not implemented in this driver."));
_sharedResourcesWrapperMock.Verify(x => x.SendBool(expectedMessage, raw), Times.Once);
Assert.That(result, Is.True);
}
[Test]
@@ -153,11 +163,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));
}
@@ -313,7 +323,7 @@ namespace Meade.net.Focuser.UnitTests
_focuser.Halt();
_sharedResourcesWrapperMock.Verify( x => x.SendBlind(":FQ#"), Times.AtLeastOnce);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("FQ", false), Times.AtLeastOnce);
}
[Test]
@@ -328,13 +338,13 @@ namespace Meade.net.Focuser.UnitTests
[TestCase(false)]
[TestCase(true)]
public void Link_Get_ReturnsSameValueAsConnected( bool connected)
public void Link_Get_ReturnsSameValueAsConnected(bool connected)
{
_sharedResourcesWrapperMock.Setup(x => x.ProductName).Returns(() => TelescopeList.Autostar497);
_sharedResourcesWrapperMock.Setup(x => x.FirmwareVersion).Returns(() => TelescopeList.Autostar497_31Ee);
_focuser.Connected = connected;
Assert.That( _focuser.Link, Is.EqualTo(connected));
Assert.That(_focuser.Link, Is.EqualTo(connected));
}
[TestCase(false)]
@@ -388,12 +398,12 @@ namespace Meade.net.Focuser.UnitTests
_focuser.Move(0);
_utilMock.Verify( x => x.WaitForMilliseconds(It.IsAny<int>()), Times.Never);
_utilMock.Verify(x => x.WaitForMilliseconds(It.IsAny<int>()), Times.Never);
}
[TestCase(200)]
[TestCase(-200)]
public void Move_WhenIncrementIsNot0_ThenMovesFocuserAndStopsFocuser( int position)
public void Move_WhenIncrementIsNot0_ThenMovesFocuserAndStopsFocuser(int position)
{
_profileProperties.BacklashCompensation = 0;
@@ -403,16 +413,16 @@ namespace Meade.net.Focuser.UnitTests
if (position < 0)
{
_sharedResourcesWrapperMock.Verify( x => x.SendBlind(":F-#"), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":F+#"), Times.Never);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("F-", false), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("F+", false), Times.Never);
}
else
{
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":F-#"), Times.Never);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":F+#"), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("F-", false), Times.Never);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("F+", false), Times.Once);
}
_sharedResourcesWrapperMock.Verify( x => x.Lock(It.IsAny<Action>()), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.Lock(It.IsAny<Action>()), Times.Once);
_utilMock.Verify(x => x.WaitForMilliseconds(Math.Abs(position)), Times.Once);
_utilMock.Verify(x => x.WaitForMilliseconds(Math.Abs(_profileProperties.BacklashCompensation)), Times.Never);
@@ -431,16 +441,16 @@ namespace Meade.net.Focuser.UnitTests
if (position < 0)
{
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":F-#"), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":F+#"), Times.Never);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("F-", false), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("F+", false), Times.Never);
_utilMock.Verify(x => x.WaitForMilliseconds(Math.Abs(position)), Times.Once);
_utilMock.Verify(x => x.WaitForMilliseconds(Math.Abs(_profileProperties.BacklashCompensation)), Times.Never);
_utilMock.Verify(x => x.WaitForMilliseconds(100), Times.Exactly(1));
}
else
{
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":F-#"), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":F+#"), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("F-", false), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind("F+", false), Times.Once);
_utilMock.Verify(x => x.WaitForMilliseconds(Math.Abs(position) + _profileProperties.BacklashCompensation), Times.Once);
_utilMock.Verify(x => x.WaitForMilliseconds(_profileProperties.BacklashCompensation), Times.Once);
_utilMock.Verify(x => x.WaitForMilliseconds(100), Times.Exactly(2));
@@ -497,7 +507,7 @@ namespace Meade.net.Focuser.UnitTests
{
var exception = Assert.Throws<PropertyNotImplementedException>(() =>
{
var result = _focuser.Temperature;
var result = _focuser.Temperature;
Assert.Fail($"{result} should not have a value");
});
Assert.That(exception.Message, Is.EqualTo("Property read Temperature is not implemented in this driver."));
File diff suppressed because it is too large Load Diff
+12
View File
@@ -0,0 +1,12 @@
namespace ASCOM.Meade.net
{
public enum Alignment
{
NeedsAlignment,
OneStarAligned,
TwoStarAligned,
ThreeStarAligned,
AlignedOnHome,
ScopeWasParked,
}
}
+11
View File
@@ -0,0 +1,11 @@
using ASCOM.DeviceInterface;
namespace ASCOM.Meade.net
{
public class AlignmentStatus
{
public AlignmentModes AlignmentMode { get; set; }
public bool Tracking { get; set; }
public Alignment Status { get; set; }
}
}
@@ -62,7 +62,7 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>..\bin\Release\</OutputPath>
<Prefer32Bit>false</Prefer32Bit>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<OutputPath>..\bin\Debug\</OutputPath>
@@ -118,11 +118,12 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Alignment.cs" />
<Compile Include="AlignmentStatus.cs" />
<Compile Include="AstroMaths\AltitudeData.cs" />
<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" />
@@ -191,7 +192,7 @@
<PreBuildEvent>
</PreBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
<!-- 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.
<Target Name="BeforeBuild">
</Target>
File diff suppressed because it is too large Load Diff
@@ -98,6 +98,10 @@
<ItemGroup>
<Compile Include="SharedResourcesUnitTests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ThreadSafeBoolTests.cs" />
<Compile Include="ThreadSafeDateTimeTests.cs" />
<Compile Include="ThreadSafeEnumTests.cs" />
<Compile Include="ThreadSafeNullableDoubleTests.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Meade.net\Meade.net.csproj">
+315 -43
View File
@@ -1,6 +1,7 @@
using System;
using System.Globalization;
using ASCOM.DeviceInterface;
using ASCOM.Meade.net;
using ASCOM.Meade.net.Wrapper;
using ASCOM.Utilities.Interfaces;
@@ -29,45 +30,47 @@ namespace Meade.net.UnitTests
[Test]
public void CheckThatSerialPortIsSetToUseMock()
{
Assert.That(SharedResources.SharedSerial,Is.EqualTo(_serialMock.Object));
Assert.That(SharedResources.SharedSerial, Is.EqualTo(_serialMock.Object));
}
[Test]
public void SendBlind_WhenCalled_Then_ClearsBuffersAndSendsMessage()
[TestCase(true, "Test")]
[TestCase(false, "#:Test#")]
public void SendBlind_WhenCalled_Then_ClearsBuffersAndSendsMessage(bool raw, string expectedMessage)
{
var expectedMessage = "Test";
SharedResources.SendBlind(expectedMessage);
var sendMessage = "Test";
SharedResources.SendBlind(sendMessage, raw);
_serialMock.Verify(x=> x.ClearBuffers(), Times.Once);
_serialMock.Verify(x=>x.Transmit(expectedMessage), Times.Once);
}
[Test]
public void SendChar_WhenCalled_ThenSendsMessageAndReadsExpectedNumberOfCharacters()
[TestCase(false, "#:Test#")]
[TestCase(true, "Test")]
public void SendChar_WhenCalled_ThenSendsMessageAndReadsExpectedNumberOfCharacters(bool raw, string expectedCommand)
{
var expectedMessage = "Test";
var command = "Test";
var expectedResult = "A";
_serialMock.Setup(x => x.ReceiveCounted(1)).Returns(expectedResult);
var result = SharedResources.SendChar(expectedMessage);
var result = SharedResources.SendChar(command, raw);
_serialMock.Verify(x => x.ClearBuffers(), Times.Once);
_serialMock.Verify(x => x.Transmit(expectedMessage), Times.Once);
_serialMock.Verify(x => x.Transmit(expectedCommand), Times.Once);
_serialMock.Verify(x => x.ReceiveCounted(1), Times.Once);
Assert.That(result, Is.EqualTo(expectedResult));
}
[Test]
public void SendString_WhenCalled_ThenSendsMessageAndReadsResultUntilTerminatorFound()
[TestCase(true, "Test")]
[TestCase(false, "#: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 +126,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 +148,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 +191,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;
@@ -176,14 +242,27 @@ namespace Meade.net.UnitTests
var profileProperties = SharedResources.ReadProfile();
Assert.That(profeWrapper.DeviceType, Is.EqualTo("Telescope"));
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.TraceLogger, Is.EqualTo(bool.Parse(TraceStateDefault)));
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 +278,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 +357,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);
@@ -267,7 +424,7 @@ namespace Meade.net.UnitTests
string serialPortReturn = string.Empty;
_serialMock.Setup(x => x.Transmit("#:GVP#")).Callback(() => {
_serialMock.Setup(x => x.Transmit("#:GVP#")).Callback(() => {
serialPortReturn = string.Empty;
throw new Exception("Testerror");
});
@@ -293,25 +450,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 +540,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);
@@ -383,5 +619,41 @@ namespace Meade.net.UnitTests
_traceLoggerMock.Verify( x => x.LogIssue("Connect", "Unable to decode response from the telescope, This is likely a hardware serial communications error."), Times.Once);
}
[Test]
public void CheckIsParkedIsFalseByDefault() => Assert.That(SharedResources.IsParked, Is.False);
[Test]
public void CheckParkedPositionIsNullByDefault() => Assert.That(SharedResources.ParkedPosition, Is.Null);
[Test]
public void CheckIsLongFormatIsFalseByDefault() => Assert.That(SharedResources.IsLongFormat, Is.False);
[Test]
public void CheckMovingPrimaryIsFalseBydefault() => Assert.That(SharedResources.MovingPrimary, Is.False);
[Test]
public void CheckMovingSecondaryIsFalseBydefault() => Assert.That(SharedResources.MovingSecondary, Is.False);
[Test]
public void CheckSideOfPierIsUnknownByDefault() => Assert.That(SharedResources.SideOfPier, Is.EqualTo(PierSide.pierUnknown));
[Test]
public void CheckSlewSettleTimeIsZeroByDefault() => Assert.That(SharedResources.SlewSettleTime, Is.EqualTo((short)0));
[Test]
public void CheckEarliestNonNonSlewingTimeIsMinValueByDefault() => Assert.That(SharedResources.EarliestNonSlewingTime, Is.EqualTo(DateTime.MinValue));
[Test]
public void CheckTargetDeclinationIsNullByDefault() => Assert.That(SharedResources.TargetDeclination.HasValue, Is.False);
[Test]
public void CheckTargetRightAscensionIsNullByDefault() => Assert.That(SharedResources.TargetRightAscension.HasValue, Is.False);
[Test]
public void CheckIsTargetCoordinateInitRequired() => Assert.That(SharedResources.IsTargetCoordinateInitRequired, Is.True);
[Test]
public void CheckIsGuiding() => Assert.That(SharedResources.IsGuiding, Is.False);
}
}
@@ -0,0 +1,39 @@
using ASCOM.Meade.net;
using NUnit.Framework;
namespace Meade.net.UnitTests
{
public class ThreadSafeBoolTests
{
[TestCase(false)]
[TestCase(true)]
public void When_Assigned_ThenValueIsSame(bool value)
{
// given
ThreadSafeValue<bool> sut = value;
// when
bool actual = sut;
// then
Assert.That(actual, Is.EqualTo(value));
}
[TestCase(false, false)]
[TestCase(false, true)]
[TestCase(true, false)]
[TestCase(true, true)]
public void When_SetValue_ThenValueIsUpdated(bool initialValue, bool setValue)
{
// given
ThreadSafeValue<bool> sut = initialValue;
// when
sut.Set(setValue);
bool afterset = sut;
// then
Assert.That(afterset, Is.EqualTo(setValue));
}
}
}
@@ -0,0 +1,61 @@
using ASCOM.Meade.net;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Globalization;
namespace Meade.net.UnitTests
{
public class ThreadSafeDateTimeTests
{
[TestCaseSource(nameof(DateTimeSource))]
public void When_Assigned_ThenValueIsSame(DateTime value)
{
// given
ThreadSafeValue<DateTime> sut = value;
// when
DateTime actual = sut;
// then
Assert.That(actual, Is.EqualTo(value));
}
[TestCaseSource(nameof(DateTimeSetSource))]
public void When_SetValue_ThenValueIsUpdated(DateTime initialValue, DateTime setValue)
{
// given
ThreadSafeValue<DateTime> sut = initialValue;
// when
sut.Set(setValue);
DateTime afterset = sut;
// then
Assert.That(afterset, Is.EqualTo(setValue));
}
static readonly DateTime Example1 = DateTimeOffset.Parse("2012-05-09T02:10:31.296761Z", CultureInfo.InvariantCulture).UtcDateTime;
static readonly DateTime Example2 = DateTimeOffset.Parse("2051-03-09T23:15:11.556081Z", CultureInfo.InvariantCulture).UtcDateTime;
static IEnumerable<DateTime> DateTimeSource => new[]
{
DateTime.MinValue,
Example1,
Example2
};
static IEnumerable<TestCaseData> DateTimeSetSource => new[]
{
new TestCaseData(DateTime.MinValue, Example1),
new TestCaseData(DateTime.MinValue, Example2),
new TestCaseData(DateTime.MinValue, DateTime.MinValue),
new TestCaseData(Example1, Example1),
new TestCaseData(Example1, Example2),
new TestCaseData(Example1, DateTime.MinValue),
new TestCaseData(Example2, Example1),
new TestCaseData(Example2, Example2),
new TestCaseData(Example2, DateTime.MinValue)
};
}
}
@@ -0,0 +1,46 @@
using ASCOM.DeviceInterface;
using ASCOM.Meade.net;
using NUnit.Framework;
namespace Meade.net.UnitTests
{
public class ThreadSafeEnumTests
{
[TestCase(PierSide.pierUnknown)]
[TestCase(PierSide.pierEast)]
[TestCase(PierSide.pierWest)]
public void When_Assigned_ThenValueIsSame(PierSide value)
{
// given
ThreadSafeValue<PierSide> sut = value;
// when
PierSide actual = sut;
// then
Assert.That(actual, Is.EqualTo(value));
}
[TestCase(PierSide.pierUnknown, PierSide.pierUnknown)]
[TestCase(PierSide.pierUnknown, PierSide.pierEast)]
[TestCase(PierSide.pierUnknown, PierSide.pierWest)]
[TestCase(PierSide.pierEast, PierSide.pierUnknown)]
[TestCase(PierSide.pierEast, PierSide.pierEast)]
[TestCase(PierSide.pierEast, PierSide.pierWest)]
[TestCase(PierSide.pierWest, PierSide.pierUnknown)]
[TestCase(PierSide.pierWest, PierSide.pierEast)]
[TestCase(PierSide.pierWest, PierSide.pierWest)]
public void When_SetValue_ThenValueIsUpdated(PierSide initialValue, PierSide setValue)
{
// given
ThreadSafeValue<PierSide> sut = initialValue;
// when
sut.Set(setValue);
PierSide afterset = sut;
// then
Assert.That(afterset, Is.EqualTo(setValue));
}
}
}
@@ -0,0 +1,45 @@
using ASCOM.Meade.net;
using NUnit.Framework;
namespace Meade.net.UnitTests
{
public class ThreadSafeNullableDoubleTests
{
[TestCase(0.1d)]
[TestCase(-12.34d)]
[TestCase(0d)]
[TestCase(null)]
public void When_Assigned_ThenValueIsSame(double? value)
{
// given
ThreadSafeValue<double?> sut = value;
// when
double? actual = sut;
// then
Assert.That(actual, Is.EqualTo(value));
}
[TestCase(0.1d, 0.2d)]
[TestCase(-12.34d, 5d)]
[TestCase(0d, 1d)]
[TestCase(null, 2d)]
[TestCase(0.1d, null)]
[TestCase(-12.34d, null)]
[TestCase(0d, null)]
[TestCase(null, null)]
public void When_SetValue_ThenValueIsUpdated(double? initialValue, double? setValue)
{
// given
ThreadSafeValue<double?> sut = initialValue;
// when
sut.Set(setValue);
double? afterset = sut;
// then
Assert.That(afterset, Is.EqualTo(setValue));
}
}
}
+1
View File
@@ -5,6 +5,7 @@
<package id="JetBrains.Annotations" version="2020.3.0" targetFramework="net472" />
<package id="Moq" version="4.15.2" targetFramework="net472" />
<package id="NUnit" version="3.13.0" targetFramework="net472" />
<package id="NUnit.ConsoleRunner" version="3.12.0" targetFramework="net472" />
<package id="System.Runtime.CompilerServices.Unsafe" version="5.0.0" targetFramework="net472" />
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net472" />
</packages>
+22 -15
View File
@@ -43,7 +43,7 @@ namespace ASCOM.Meade.net
/// Private variable to hold an ASCOM Utilities object
/// </summary>
private readonly IUtil _utilities;
/// <summary>
/// Initializes a new instance of the <see cref="Meade.net"/> class.
/// Must be public for COM registration.
@@ -101,32 +101,39 @@ namespace ASCOM.Meade.net
public void CommandBlind(string command, bool raw)
{
LogMessage("CommandBlind", "raw: {0} command {0}", raw, command);
CheckConnected("CommandBlind");
// Call CommandString and return as soon as it finishes
//this.CommandString(command, raw);
SharedResourcesWrapper.SendBlind(command);
SharedResourcesWrapper.SendBlind(command, raw);
// or
//throw new ASCOM.MethodNotImplementedException("CommandBlind");
// DO NOT have both these sections! One or the other
LogMessage("CommandBlind", "Completed");
}
public bool CommandBool(string command, bool raw)
{
LogMessage("CommandBool", "raw: {0} command {0}", raw, command);
CheckConnected("CommandBool");
//string ret = CommandString(command, raw);
// decode the return string and return true or false
var result = SharedResourcesWrapper.SendBool(command, raw);
LogMessage("CommandBool", "Completed: {0}", result);
return result;
// or
throw new MethodNotImplementedException("CommandBool");
//throw new MethodNotImplementedException("CommandBool");
// DO NOT have both these sections! One or the other
}
public string CommandString(string command, bool raw)
{
LogMessage("CommandString", "raw: {0} command {0}", raw, command);
CheckConnected("CommandString");
// 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);
var result = SharedResourcesWrapper.SendString(command, raw);
LogMessage("CommandBool", "Completed: {0}", result);
return result;
//throw new ASCOM.MethodNotImplementedException("CommandString");
}
@@ -225,7 +232,7 @@ namespace ASCOM.Meade.net
//todo fix this issue: A single halt command is sometimes missed by the #909 apm, so let's do it a few times to be safe.
SharedResourcesWrapper.SendBlind(":FQ#");
SharedResourcesWrapper.SendBlind("FQ");
//:FQ# Halt Focuser Motion
//Returns: Nothing
}
@@ -297,7 +304,7 @@ namespace ASCOM.Meade.net
var backlashCompensationSteps = direction ? Math.Abs(BacklashCompensation) : 0;
var steps = Math.Abs(position) + backlashCompensationSteps;
MoveFocuser(direction, steps);
@@ -329,18 +336,18 @@ namespace ASCOM.Meade.net
private void MoveFocuser(bool directionOut, int steps)
{
//_sharedResourcesWrapper.SendBlind(":FF#");
//_sharedResourcesWrapper.SendBlind("FF");
//:FF# Set Focus speed to fastest setting
//Returns: Nothing
//:FS# Set Focus speed to slowest setting
//Returns: Nothing
//:F<n># Autostar, Autostar II set focuser speed to <n> where <n> is an ASCII digit 1..4
//:F<n># Autostar, Autostar II - set focuser speed to <n> where <n> is an ASCII digit 1..4
//Returns: Nothing
//All others Not Supported
//All others - Not Supported
_utilities.WaitForMilliseconds(100);
PerformFocuserMove(directionOut);
_utilities.WaitForMilliseconds(steps);
@@ -350,7 +357,7 @@ namespace ASCOM.Meade.net
private void PerformFocuserMove(bool directionOut)
{
SharedResourcesWrapper.SendBlind(directionOut ? ":F+#" : ":F-#");
SharedResourcesWrapper.SendBlind(directionOut ? "F+" : "F-");
//:F+# Start Focuser moving inward (toward objective)
//Returns: None
@@ -411,7 +418,7 @@ namespace ASCOM.Meade.net
#region ASCOM Registration
// Register or unregister driver for ASCOM. This is harmless if already
// registered or unregistered.
// registered or unregistered.
//
/// <summary>
/// Register or unregister the driver with the ASCOM Platform.
@@ -481,7 +488,7 @@ namespace ASCOM.Meade.net
}
#endregion
/// <summary>
/// Use this function to throw an exception if we aren't connected to the hardware
/// </summary>
+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;
}
}
}
+6
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,12 +137,16 @@
<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="ParkedPosition.cs" />
<Compile Include="ProfileFactory.cs" />
<Compile Include="ProfileProperties.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="TelescopeList.cs" />
<Compile Include="ThreadSafeValue.cs" />
<Compile Include="Win32Utilities.cs" />
<Compile Include="Wrapper\IProfileWrapper.cs" />
<Compile Include="Wrapper\SharedResourcesWrapper.cs" />
@@ -199,6 +204,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.
+16
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;
@@ -28,6 +29,9 @@ namespace ASCOM.Meade.net
protected string GuidingStyle;
protected double SiteElevation;
protected short ProfileSettleTime;
protected bool SendDateTime;
protected ParkedBehaviour ParkedBehaviour;
protected HorizonCoordinates ParkedAltAz;
protected readonly ISharedResourcesWrapper SharedResourcesWrapper;
@@ -69,6 +73,14 @@ namespace ASCOM.Meade.net
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}");
@@ -79,6 +91,10 @@ namespace ASCOM.Meade.net
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
}
}
+12
View File
@@ -0,0 +1,12 @@
namespace ASCOM.Meade.net
{
public class ParkedPosition
{
public double Altitude { get; set; }
public double Azimuth { get; set; }
public double RightAscension { get; set; }
public double Declination { get; set; }
public double SiteLongitude { get; set; }
public double SiteLatitude { get; set; }
}
}
+9
View File
@@ -14,5 +14,14 @@ namespace ASCOM.Meade.net
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; }
}
}
+143 -3
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,12 +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()
@@ -98,6 +198,11 @@ 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(),
@@ -105,8 +210,12 @@ namespace ASCOM.Meade.net
ReverseFocusDirection = cbxReverseDirection.Checked,
DynamicBreaking = cbxDynamicBreaking.Checked,
SiteElevation = double.Parse(txtElevation.Text),
SettleTime = Convert.ToInt16(nudSettleTime.Value)
};
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;
}
@@ -182,5 +291,36 @@ namespace ASCOM.Meade.net
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);
}
}
}
}
}
+171
View File
@@ -58,14 +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
@@ -125,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
@@ -219,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");
@@ -255,10 +282,135 @@ namespace ASCOM.Meade.net
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);
@@ -298,6 +450,7 @@ namespace ASCOM.Meade.net
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();
@@ -336,5 +489,23 @@ namespace ASCOM.Meade.net
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;
}
}
+525 -60
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>29</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>28</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>27</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>26</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>25</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>24</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>23</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>22</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>21</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>20</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>19</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>18</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>17</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>16</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>15</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>14</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>13</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>11</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>12</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>10</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>9</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>8</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>7</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>6</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>5</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>4</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,13 +904,13 @@
<value>$this</value>
</data>
<data name="&gt;&gt;label13.ZOrder" xml:space="preserve">
<value>3</value>
<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>12, 236</value>
<value>290, 127</value>
</data>
<data name="label14.Size" type="System.Drawing.Size, System.Drawing">
<value>56, 13</value>
@@ -895,10 +931,10 @@
<value>$this</value>
</data>
<data name="&gt;&gt;label14.ZOrder" xml:space="preserve">
<value>2</value>
<value>20</value>
</data>
<data name="nudSettleTime.Location" type="System.Drawing.Point, System.Drawing">
<value>97, 234</value>
<value>375, 125</value>
</data>
<data name="nudSettleTime.Size" type="System.Drawing.Size, System.Drawing">
<value>120, 20</value>
@@ -916,13 +952,13 @@
<value>$this</value>
</data>
<data name="&gt;&gt;nudSettleTime.ZOrder" xml:space="preserve">
<value>1</value>
<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>223, 236</value>
<value>501, 127</value>
</data>
<data name="label15.Size" type="System.Drawing.Size, System.Drawing">
<value>47, 13</value>
@@ -943,16 +979,445 @@
<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>
+195 -22
View File
@@ -4,7 +4,7 @@
// ================
//
// This class is a container for all shared resources that may be needed
// by the drivers served by the Local Server.
// by the drivers served by the Local Server.
//
// NOTES:
//
@@ -17,7 +17,11 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Runtime.InteropServices;
using System.Security.AccessControl;
using System.Threading;
using System.Windows.Forms;
using ASCOM.DeviceInterface;
using ASCOM.Meade.net.Wrapper;
using ASCOM.Utilities;
using ASCOM.Utilities.Interfaces;
@@ -47,7 +51,7 @@ namespace ASCOM.Meade.net
#region single serial port connector
//
// this region shows a way that a single serial port could be connected to by multiple
// this region shows a way that a single serial port could be connected to by multiple
// drivers.
//
// Connected is used to handle the connections to the port.
@@ -71,17 +75,18 @@ namespace ASCOM.Meade.net
public static IProfileFactory ProfileFactory
{
get => _profileFactory ?? ( _profileFactory = new ProfileFactory());
get => _profileFactory ?? (_profileFactory = new ProfileFactory());
set => _profileFactory = value;
}
//todo add code to ensure that there is a minimum gap between commands. 5ms as default.
public static void SendBlind(string message)
public static void SendBlind(string message, bool raw = false)
{
lock (LockObject)
{
SharedSerial.ClearBuffers();
SharedSerial.Transmit(message);
var encodedMessage = raw ? message : $"#:{message}#";
SharedSerial.Transmit(encodedMessage);
}
}
@@ -92,24 +97,60 @@ namespace ASCOM.Meade.net
/// and that the reply will always be terminated by a "#" character.
/// </summary>
/// <param name="message"></param>
/// <param name="raw"></param>
/// <returns></returns>
public static string SendString(string message)
public static string SendString(string message, bool raw = false)
{
lock (LockObject)
{
SharedSerial.ClearBuffers();
SharedSerial.Transmit(message);
return SharedSerial.ReceiveTerminated("#").TrimEnd('#');
var encodedMessage = raw ? message : $"#:{message}#";
SharedSerial.Transmit(encodedMessage);
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;
}
}
}
public static string SendChar(string message)
public static bool SendBool(string command, bool raw = false)
{
var result = SendChar(command, raw);
return result == "1";
}
public static string SendChar(string command, bool raw = false)
{
return SendChars(command, raw, count: 1);
}
public static string SendChars(string command, bool raw = false, int count = 1)
{
lock (LockObject)
{
SharedSerial.ClearBuffers();
SharedSerial.Transmit(message);
return SharedSerial.ReceiveCounted(1);
var encodedMessage = raw ? command : $"#:{command}#";
SharedSerial.Transmit(encodedMessage);
try
{
return SharedSerial.ReceiveCounted(count);
}
catch (COMException ex) when (ex.Message.Contains("Timed out waiting for received data"))
{
throw new TimeoutException(ex.Message, ex);
}
}
}
@@ -148,6 +189,16 @@ namespace ASCOM.Meade.net
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)
{
lock (LockObject)
@@ -158,6 +209,11 @@ 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);
@@ -166,6 +222,10 @@ namespace ASCOM.Meade.net
driverProfile.WriteValue(DriverId, DynamicBreakingName, profileProperties.DynamicBreaking.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));
}
}
}
@@ -181,6 +241,15 @@ namespace ASCOM.Meade.net
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 const string ParkedBehaviourDefault = "No Coordinates";
private const string ParkedAltDefault = "0";
private const string ParkedAzimuthDefault = "180";
public static ProfileProperties ReadProfile()
{
@@ -201,6 +270,16 @@ namespace ASCOM.Meade.net
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;
@@ -235,7 +314,7 @@ namespace ASCOM.Meade.net
}
#endregion
#region Multi Driver handling
public static string ProductName { get; private set; } = string.Empty;
@@ -258,7 +337,7 @@ namespace ASCOM.Meade.net
private static readonly Dictionary<string, DeviceHardware> ConnectedDevices = new Dictionary<string, DeviceHardware>();
private static readonly Dictionary<string, DeviceHardware> ConnectedDeviceIds = new Dictionary<string, DeviceHardware>();
private static IProfileFactory _profileFactory ;
private static IProfileFactory _profileFactory;
/// <summary>
@@ -274,7 +353,7 @@ namespace ASCOM.Meade.net
{
if (!ConnectedDevices.ContainsKey(deviceId))
ConnectedDevices.Add(deviceId, new DeviceHardware());
if (!ConnectedDeviceIds.ContainsKey(driverId))
ConnectedDeviceIds.Add(driverId, new DeviceHardware());
@@ -286,17 +365,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)
{
@@ -316,7 +395,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
@@ -417,5 +496,99 @@ namespace ASCOM.Meade.net
Count = 0;
}
}
public static void SetParked(bool atPark, ParkedPosition parkedPosition)
{
IsParked = atPark;
ParkedPosition = parkedPosition;
}
private static readonly ThreadSafeValue<bool> _isParked = false;
public static bool IsParked
{
get => _isParked;
private set => _isParked.Set(value);
}
private static ParkedPosition _parkedPosition;
public static ParkedPosition ParkedPosition
{
get => _parkedPosition;
private set => Interlocked.Exchange(ref _parkedPosition, value);
}
private static readonly ThreadSafeValue<PierSide> _sideOfPier = PierSide.pierUnknown;
/// <summary>
/// Start with <see cref="PierSide.pierUnknown"/>.
/// As we do not know the physical declination axis position, we have to keep track manually.
/// </summary>
public static PierSide SideOfPier
{
get => _sideOfPier;
internal set => _sideOfPier.Set(value);
}
private static readonly ThreadSafeValue<double?> _targetRightAscension = null as double?;
public static double? TargetRightAscension
{
get => _targetRightAscension;
internal set => _targetRightAscension.Set(value);
}
private static readonly ThreadSafeValue<double?> _targetDeclination = null as double?;
public static double? TargetDeclination
{
get => _targetDeclination;
internal set => _targetDeclination.Set(value);
}
private static int _slewSettleTime;
public static short SlewSettleTime
{
get => Convert.ToInt16(_slewSettleTime);
internal set => Interlocked.Exchange(ref _slewSettleTime, value);
}
private static readonly ThreadSafeValue<bool> _isLongFormat = false;
public static bool IsLongFormat
{
get => _isLongFormat;
internal set => _isLongFormat.Set(value);
}
private static readonly ThreadSafeValue<bool> _movingPrimary = false;
public static bool MovingPrimary
{
get => _movingPrimary;
internal set => _movingPrimary.Set(value);
}
private static readonly ThreadSafeValue<bool> _movingSecondary = false;
public static bool MovingSecondary
{
get => _movingSecondary;
internal set => _movingSecondary.Set(value);
}
private static readonly ThreadSafeValue<DateTime> _earliestNonSlewingTime = DateTime.MinValue;
public static DateTime EarliestNonSlewingTime
{
get => _earliestNonSlewingTime;
internal set => _earliestNonSlewingTime.Set(value);
}
private static readonly ThreadSafeValue<bool> _isTargetCoordinateInitRequired = true;
public static bool IsTargetCoordinateInitRequired
{
get => _isTargetCoordinateInitRequired;
internal set => _isTargetCoordinateInitRequired.Set(value);
}
private static readonly ThreadSafeValue<bool> _isGuiding = false;
public static bool IsGuiding
{
get => _isGuiding;
internal set => _isGuiding.Set(value);
}
}
}
+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
+18
View File
@@ -0,0 +1,18 @@
using JetBrains.Annotations;
using System.Threading;
namespace ASCOM.Meade.net
{
public class ThreadSafeValue<T>
{
private object _value;
public ThreadSafeValue(in T value) => _value = value;
public void Set(in T value) => Interlocked.Exchange(ref _value, value);
public static implicit operator ThreadSafeValue<T>(in T value) => new ThreadSafeValue<T>(value);
public static implicit operator T([NotNull] ThreadSafeValue<T> @this) => (T)(@this?._value ?? default);
}
}
+113 -9
View File
@@ -1,4 +1,5 @@
using System;
using ASCOM.DeviceInterface;
using ASCOM.Utilities.Interfaces;
namespace ASCOM.Meade.net.Wrapper
@@ -15,9 +16,11 @@ namespace ASCOM.Meade.net.Wrapper
void Lock(Action action);
T Lock<T>(Func<T> func);
string SendString(string message);
void SendBlind(string message);
string SendChar(string message);
string SendString(string message, bool raw = false);
void SendBlind(string message, bool raw = false);
bool SendBool(string command, bool raw = false);
string SendChar(string message, bool raw = false);
string SendChars(string message, bool raw = false, int count = 1);
string ReadTerminated();
@@ -26,6 +29,28 @@ namespace ASCOM.Meade.net.Wrapper
void SetupDialog();
void WriteProfile(ProfileProperties profileProperties);
void ReadCharacters(int throwAwayCharacters);
void SetParked(bool atPark, ParkedPosition parkedPosition);
bool IsParked { get; }
ParkedPosition ParkedPosition { get; }
PierSide SideOfPier { get; set; }
double? TargetRightAscension { get; set; }
double? TargetDeclination { get; set; }
short SlewSettleTime { get; set; }
bool IsLongFormat { get; set; }
bool MovingPrimary { get; set; }
bool MovingSecondary { get; set; }
DateTime EarliestNonSlewingTime { get; set; }
bool IsTargetCoordinateInitRequired { get; set; }
bool IsGuiding { get; set; }
}
public class SharedResourcesWrapper : ISharedResourcesWrapper
@@ -54,19 +79,29 @@ namespace ASCOM.Meade.net.Wrapper
return SharedResources.Lock(func);
}
public string SendString(string message)
public string SendString(string message, bool raw = false)
{
return SharedResources.SendString(message);
return SharedResources.SendString(message, raw);
}
public void SendBlind(string message)
public void SendBlind(string message, bool raw = false)
{
SharedResources.SendBlind(message);
SharedResources.SendBlind(message, raw);
}
public string SendChar(string message)
public bool SendBool(string command, bool raw = false)
{
return SharedResources.SendChar(message);
return SharedResources.SendBool(command, raw);
}
public string SendChar(string message, bool raw = false)
{
return SharedResources.SendChar(message, raw);
}
public string SendChars(string message, bool raw = false, int count = 1)
{
return SharedResources.SendChars(message, raw, count);
}
public string ReadTerminated()
@@ -93,5 +128,74 @@ namespace ASCOM.Meade.net.Wrapper
{
SharedResources.WriteProfile(profileProperties);
}
public void SetParked(bool atPark, ParkedPosition parkedPosition)
{
SharedResources.SetParked(atPark, parkedPosition);
}
public bool IsParked => SharedResources.IsParked;
public ParkedPosition ParkedPosition => SharedResources.ParkedPosition;
public PierSide SideOfPier
{
get => SharedResources.SideOfPier;
set => SharedResources.SideOfPier = value;
}
public double? TargetRightAscension
{
get => SharedResources.TargetRightAscension;
set => SharedResources.TargetRightAscension = value;
}
public double? TargetDeclination
{
get => SharedResources.TargetDeclination;
set => SharedResources.TargetDeclination = value;
}
public short SlewSettleTime
{
get => SharedResources.SlewSettleTime;
set => SharedResources.SlewSettleTime = value;
}
public bool IsLongFormat
{
get => SharedResources.IsLongFormat;
set => SharedResources.IsLongFormat = value;
}
public bool MovingPrimary
{
get => SharedResources.MovingPrimary;
set => SharedResources.MovingPrimary = value;
}
public bool MovingSecondary
{
get => SharedResources.MovingSecondary;
set => SharedResources.MovingSecondary = value;
}
public DateTime EarliestNonSlewingTime
{
get => SharedResources.EarliestNonSlewingTime;
set => SharedResources.EarliestNonSlewingTime = value;
}
public bool IsTargetCoordinateInitRequired
{
get => SharedResources.IsTargetCoordinateInitRequired;
set => SharedResources.IsTargetCoordinateInitRequired = value;
}
public bool IsGuiding
{
get => SharedResources.IsGuiding;
set => SharedResources.IsGuiding = value;
}
}
}