From 90eb1c604b7d1a309535033560a34842d33dfcdd Mon Sep 17 00:00:00 2001 From: Colin Date: Tue, 30 Apr 2019 18:52:32 +0100 Subject: [PATCH] Forced all code to 64-bit only, will make this 32/64 bit before release. Fixed issue in the SerialProcessor when setting the time, makes sure that there's no chance of thread stealing when pulling out the junk messages Added ConformanceResult.txt to show the progress of the driver development --- ConformanceResult.txt | 166 ++++++++++++++++++ .../MeadeAutostar497.UnitTests.csproj | 1 + .../Controller/ISerialProcessor.cs | 2 + .../Controller/SerialProcessor.cs | 26 ++- .../Controller/TelescopeController.cs | 32 ++-- MeadeAutostar497/MeadeAutostar497.csproj | 2 +- TestConsole/TestConsole.csproj | 2 +- 7 files changed, 209 insertions(+), 22 deletions(-) create mode 100644 ConformanceResult.txt diff --git a/ConformanceResult.txt b/ConformanceResult.txt new file mode 100644 index 0000000..aaab4ff --- /dev/null +++ b/ConformanceResult.txt @@ -0,0 +1,166 @@ +ConformanceCheck ASCOM Device Conformance Checker Version 6.4.63.0, Build time: 18/12/2018 08:58:34 +ConformanceCheck Running on: ASCOM Platform 6.4 SP1 6.4.1.2695 + +ConformanceCheck Driver ProgID: ASCOM.MeadeAutostar497.Telescope + +Error handling +Error number for "Not Implemented" is: 80040400 +Error number for "Invalid Value 1" is: 80040401 +Error number for "Invalid Value 2" is: 80040405 +Error number for "Value Not Set 1" is: 80040402 +Error number for "Value Not Set 2" is: 80040403 +Error messages will not be interpreted to infer state. + +18:44:58.528 Driver Access Checks OK +18:44:59.174 AccessChecks OK Successfully created driver using late binding +18:44:59.400 AccessChecks OK Successfully connected using late binding +18:44:59.405 AccessChecks INFO The driver is a .NET object +18:44:59.409 AccessChecks INFO The AssemblyQualifiedName is: ASCOM.MeadeAutostar497.Telescope, ASCOM.MeadeAutostar497.Telescope, Version= +18:44:59.413 AccessChecks INFO The driver implements interface: ASCOM.DeviceInterface.ITelescopeV3 +18:45:00.117 AccessChecks INFO Device does not expose interface ITelescopeV2 +18:45:00.926 AccessChecks INFO Device exposes interface ITelescopeV3 +18:45:02.245 AccessChecks OK Successfully created driver using driver access toolkit +18:45:02.415 AccessChecks OK Successfully connected using driver access toolkit + +Conform is using ASCOM.DriverAccess.Telescope to get a Telescope object +18:45:03.742 ConformanceCheck OK Driver instance created successfully +18:45:03.954 ConformanceCheck OK Connected OK + +Common Driver Methods +18:45:03.995 InterfaceVersion OK 3 +18:45:04.023 Connected OK True +18:45:04.052 Description OK Meade Autostar 497 .net +18:45:04.081 DriverInfo OK Information about the driver itself. Version: 0.0 +18:45:04.110 DriverVersion OK 0.0 +18:45:04.139 Name OK Meade Autostar 497 .net +18:45:04.168 CommandString INFO Conform cannot test the CommandString method +18:45:04.174 CommandBlind INFO Conform cannot test the CommandBlind method +18:45:04.180 CommandBool INFO Conform cannot test the CommandBool method +18:45:04.185 Action INFO Conform cannot test the Action method +18:45:04.192 SupportedActions OK Driver returned an empty action list + +Can Properties +18:45:04.260 CanFindHome OK False +18:45:04.266 CanPark OK False +18:45:04.273 CanPulseGuide OK False +18:45:04.280 CanSetDeclinationRate OK False +18:45:04.287 CanSetGuideRates OK False +18:45:04.294 CanSetPark OK False +18:45:04.301 CanSetPierSide OK False +18:45:04.315 CanSetRightAscensionRate OK False +18:45:04.322 CanSetTracking OK False +18:45:04.330 CanSlew OK False +18:45:04.337 CanSlewltAz OK False +18:45:04.344 CanSlewAltAzAsync OK False +18:45:04.352 CanSlewAsync OK False +18:45:04.359 CanSync OK False +18:45:04.367 CanSyncAltAz OK False +18:45:04.375 CanUnPark OK False + +Pre-run Checks +18:45:04.421 Mount Safety INFO Scope is not parked, continuing testing +18:45:04.474 TimeCheck INFO PC Time Zone: GMT Summer Time, offset -1 hours. +18:45:04.482 TimeCheck INFO PC UTCDate: 30-Apr-2019 17:45:04.482 +18:45:04.574 TimeCheck INFO Mount UTCDate: 30-Apr-2019 05:45:04.000 + +Properties +18:45:04.646 AlignmentMode OK Optional member threw a PropertyNotImplementedException exception. +18:45:04.683 Altitude OK Optional member threw a PropertyNotImplementedException exception. +18:45:04.715 ApertureArea OK Optional member threw a PropertyNotImplementedException exception. +18:45:04.747 ApertureDiameter OK Optional member threw a PropertyNotImplementedException exception. +18:45:04.779 AtHome OK False +18:45:04.813 AtPark OK False +18:45:04.845 Azimuth OK Optional member threw a PropertyNotImplementedException exception. +18:45:04.877 Declination OK 00:00:00.00 +18:45:04.909 DeclinationRate Read OK 0.00 +18:45:04.943 DeclinationRate Write OK CanSetDeclinationRate is False and a PropertyNotImplementedException exception was generated as expected +18:45:04.982 DoesRefraction Read OK Optional member threw a PropertyNotImplementedException exception. +18:45:05.015 DoesRefraction Write OK Optional member threw a PropertyNotImplementedException exception. +18:45:05.047 EquatorialSystem OK equLocalTopocentric +18:45:05.080 FocalLength OK Optional member threw a PropertyNotImplementedException exception. +18:45:05.116 GuideRateDeclination Read OK Optional member threw a PropertyNotImplementedException exception. +18:45:05.127 GuideRateDeclination Write OK CanSetGuideRates is False and a PropertyNotImplementedException exception was generated as expected +18:45:05.159 GuideRateRightAscension Read OK Optional member threw a PropertyNotImplementedException exception. +18:45:05.171 GuideRateRightAscension Write OK CanSetGuideRates is False and a PropertyNotImplementedException exception was generated as expected +18:45:05.205 IsPulseGuiding OK CanPulseGuide is False and a PropertyNotImplementedException exception was generated as expected +18:45:05.237 RightAscension OK 00:00:00.00 +18:45:05.270 RightAscensionRate Read OK 0.00 +18:45:05.305 RightAscensionRate Write OK CanSetRightAscensionRate is False and a PropertyNotImplementedException exception was generated as expected +18:45:05.339 SiteElevation Read OK Optional member threw a PropertyNotImplementedException exception. +18:45:05.374 SiteElevation Write OK Optional member threw a PropertyNotImplementedException exception. +18:45:05.386 SiteElevation Write OK Optional member threw a PropertyNotImplementedException exception. +18:45:05.398 SiteElevation Write OK Optional member threw a PropertyNotImplementedException exception. +18:45:05.432 SiteLatitude Read OK Optional member threw a PropertyNotImplementedException exception. +18:45:05.467 SiteLatitude Write OK Optional member threw a PropertyNotImplementedException exception. +18:45:05.480 SiteLatitude Write OK Optional member threw a PropertyNotImplementedException exception. +18:45:05.493 SiteLatitude Write OK Optional member threw a PropertyNotImplementedException exception. +18:45:05.529 SiteLongitude Read OK Optional member threw a PropertyNotImplementedException exception. +18:45:05.564 SiteLongitude Write OK Optional member threw a PropertyNotImplementedException exception. +18:45:05.577 SiteLongitude Write OK Optional member threw a PropertyNotImplementedException exception. +18:45:05.589 SiteLongitude Write OK Optional member threw a PropertyNotImplementedException exception. +18:45:05.635 Slewing OK False +18:45:05.669 SlewSettleTime Read OK Optional member threw a PropertyNotImplementedException exception. +18:45:05.706 SlewSettleTime Write OK Optional member threw a PropertyNotImplementedException exception. +18:45:05.719 SlewSettleTime Write OK Optional member threw a PropertyNotImplementedException exception. +18:45:05.754 SideOfPier Read OK Optional member threw a PropertyNotImplementedException exception. +18:45:05.787 SiderealTime ISSUE This member is mandatory but threw a PropertyNotImplementedException exception, it must function per the ASCOM specification. +18:45:05.827 TargetDeclination Read OK Optional member threw a PropertyNotImplementedException exception. +18:45:05.862 TargetDeclination Write INFO Tests moved after the SlewToCoordinates tests so that Conform can check they properly set target coordinates. +18:45:05.877 TargetRightAscension Read OK Optional member threw a PropertyNotImplementedException exception. +18:45:05.915 TargetRightAscension Write INFO Tests moved after the SlewToCoordinates tests so that Conform can check they properly set target coordinates. +18:45:05.928 Tracking Read OK True +18:45:05.963 Tracking Write OK CanSetTracking is False and a PropertyNotImplementedException exception was generated as expected +18:45:06.005 TrackingRates Found drive rate: driveSidereal +18:45:06.017 TrackingRates OK Drive rates read OK +18:45:06.031 TrackingRates OK Disposed tracking rates OK +18:45:06.066 TrackingRates OK Successfully obtained a TrackingRates object after the previous TrackingRates object was disposed +18:45:06.079 TrackingRate Read ISSUE This member is mandatory but threw a PropertyNotImplementedException exception, it must function per the ASCOM specification. +18:45:06.157 UTCDate Read OK 30-Apr-2019 05:45:05.000 +18:45:06.305 UTCDate Write OK New UTCDate written successfully: 30/04/2019 06:45:05 + +Methods +18:45:06.538 CanMoveAxis:Primary OK CanMoveAxis:Primary True +18:45:06.574 CanMoveAxis:Secondary OK CanMoveAxis:Secondary True +18:45:06.611 CanMoveAxis:Tertiary OK CanMoveAxis:Tertiary False +18:45:06.647 Park OK CanPark is False and a MethodNotImplementedException exception was generated as expected +18:45:06.662 UnPark OK CanUnPark is False and a MethodNotImplementedException exception was generated as expected +18:45:06.706 AbortSlew OK AbortSlew OK when not slewing +18:45:06.775 AxisRate:Primary OK Empty axis rate returned +18:45:06.788 AxisRate:Primary OK Disposed axis rates OK +18:45:06.801 AxisRate:Secondary OK Empty axis rate returned +18:45:06.814 AxisRate:Secondary OK Disposed axis rates OK +18:45:06.828 AxisRate:Tertiary OK Empty axis rate returned +18:45:06.840 AxisRate:Tertiary OK Disposed axis rates OK +18:45:06.855 FindHome OK CanFindHome is False and a MethodNotImplementedException exception was generated as expected +18:45:06.905 MoveAxis Primary WARNING MoveAxis tests skipped because there are no AxisRate values +18:45:06.919 MoveAxis Primary OK AxisRates object successfully disposed +18:45:06.978 MoveAxis Secondary WARNING MoveAxis tests skipped because there are no AxisRate values +18:45:06.991 MoveAxis Secondary OK AxisRates object successfully disposed +18:45:07.050 MoveAxis Tertiary OK CanMoveAxis Tertiary is False and a MethodNotImplementedException exception was generated as expected +18:45:07.091 PulseGuide OK CanPulseGuide is False and a MethodNotImplementedException exception was generated as expected +18:45:07.146 SlewToCoordinates ISSUE Received a PropertyNotImplementedException instead of a MethodNotImplementedException +18:45:07.191 SlewToCoordinatesAsync ISSUE Received a PropertyNotImplementedException instead of a MethodNotImplementedException +18:45:07.235 SyncToCoordinates OK CanSync is False and a MethodNotImplementedException exception was generated as expected +18:45:07.272 TargetRightAscension Write OK Optional member threw a PropertyNotImplementedException exception. +18:45:07.287 TargetRightAscension Write OK Optional member threw a PropertyNotImplementedException exception. +18:45:07.309 TargetRightAscension Write OK Optional member threw a PropertyNotImplementedException exception. +18:45:07.348 TargetDeclination Write OK Optional member threw a PropertyNotImplementedException exception. +18:45:07.362 TargetDeclination Write OK Optional member threw a PropertyNotImplementedException exception. +18:45:07.376 TargetDeclination Write OK Optional member threw a PropertyNotImplementedException exception. +18:45:07.421 SlewToTarget ISSUE Received a PropertyNotImplementedException instead of a MethodNotImplementedException +18:45:07.466 SlewToTargetAsync ISSUE Received a PropertyNotImplementedException instead of a MethodNotImplementedException +18:45:07.503 DestinationSideOfPier Test skipped as AligmentMode is not German Polar +18:45:07.520 SlewToAltAz OK CanSlewAltAz is False and a MethodNotImplementedException exception was generated as expected +18:45:07.564 SlewToAltAzAsync OK CanSlewAltAzAsync is False and a MethodNotImplementedException exception was generated as expected +18:45:07.603 SyncToTarget OK CanSync is False and a MethodNotImplementedException exception was generated as expected +18:45:07.641 SyncToAltAz OK CanSyncAltAz is False and a MethodNotImplementedException exception was generated as expected + +SideOfPier Model Tests +18:45:07.711 SideOfPier Model Tests INFO Tests skipped because this driver does Not support SideOfPier Read + +Post-run Checks +18:45:07.800 Mount Safety INFO Tracking can't be turned off for this mount, please switch off manually. + +Conformance test complete + +Your driver had 0 errors, 2 warnings and 6 issues \ No newline at end of file diff --git a/MeadeAutostar497.UnitTests/MeadeAutostar497.UnitTests.csproj b/MeadeAutostar497.UnitTests/MeadeAutostar497.UnitTests.csproj index e49ccdc..a7a4fae 100644 --- a/MeadeAutostar497.UnitTests/MeadeAutostar497.UnitTests.csproj +++ b/MeadeAutostar497.UnitTests/MeadeAutostar497.UnitTests.csproj @@ -26,6 +26,7 @@ prompt 4 false + x64 pdbonly diff --git a/MeadeAutostar497/Controller/ISerialProcessor.cs b/MeadeAutostar497/Controller/ISerialProcessor.cs index 5f2e2c0..5578bf3 100644 --- a/MeadeAutostar497/Controller/ISerialProcessor.cs +++ b/MeadeAutostar497/Controller/ISerialProcessor.cs @@ -22,5 +22,7 @@ namespace ASCOM.MeadeAutostar497.Controller char CommandChar(string command); string ReadTerminated(string terminator); void Command(string command); + void Lock(); + void Unlock(); } } \ No newline at end of file diff --git a/MeadeAutostar497/Controller/SerialProcessor.cs b/MeadeAutostar497/Controller/SerialProcessor.cs index b9fe333..2e14264 100644 --- a/MeadeAutostar497/Controller/SerialProcessor.cs +++ b/MeadeAutostar497/Controller/SerialProcessor.cs @@ -72,7 +72,7 @@ namespace ASCOM.MeadeAutostar497.Controller public string CommandTerminated(string command, string terminator) { - serialMutex.WaitOne(); + Lock(); try { _serialPort.Write(command); @@ -81,13 +81,13 @@ namespace ASCOM.MeadeAutostar497.Controller } finally { - serialMutex.ReleaseMutex(); + Unlock(); } } public char CommandChar(string command) { - serialMutex.WaitOne(); + Lock(); try { _serialPort.Write(command); @@ -96,13 +96,13 @@ namespace ASCOM.MeadeAutostar497.Controller } finally { - serialMutex.ReleaseMutex(); + Unlock(); } } public string ReadTerminated(string terminator) { - serialMutex.WaitOne(); + Lock(); try { string result = _serialPort.ReadTo("#"); @@ -110,21 +110,31 @@ namespace ASCOM.MeadeAutostar497.Controller } finally { - serialMutex.ReleaseMutex(); + Unlock(); } } public void Command(string command) { - serialMutex.WaitOne(); + Lock(); try { _serialPort.Write(command); } finally { - serialMutex.ReleaseMutex(); + Unlock(); } } + + public void Lock() + { + serialMutex.WaitOne(); + } + + public void Unlock() + { + serialMutex.ReleaseMutex(); + } } } diff --git a/MeadeAutostar497/Controller/TelescopeController.cs b/MeadeAutostar497/Controller/TelescopeController.cs index a2a3f64..4979d07 100644 --- a/MeadeAutostar497/Controller/TelescopeController.cs +++ b/MeadeAutostar497/Controller/TelescopeController.cs @@ -93,7 +93,7 @@ namespace ASCOM.MeadeAutostar497.Controller private void TestConnectionActive() { - var firmwareVersionNumber = SerialPort.CommandTerminated("#:GVN#", "#"); + var firmwareVersionNumber = SerialPort.CommandTerminated(":GVN#", "#"); if (string.IsNullOrEmpty(firmwareVersionNumber)) { throw new InvalidOperationException("Failed to communicate with telescope."); @@ -106,7 +106,7 @@ namespace ASCOM.MeadeAutostar497.Controller { if (!Connected) return false; - var result = SerialPort.CommandTerminated("#:D#", "#"); + var result = SerialPort.CommandTerminated(":D#", "#"); return result != string.Empty; } } @@ -115,8 +115,8 @@ namespace ASCOM.MeadeAutostar497.Controller { get { - string telescopeDate = SerialPort.CommandTerminated("#:GC#", "#"); - string telescopeTime = SerialPort.CommandTerminated("#:GL#", "#"); + string telescopeDate = SerialPort.CommandTerminated(":GC#", "#"); + string telescopeTime = SerialPort.CommandTerminated(":GL#", "#"); int month = telescopeDate.Substring(0, 2).ToInteger(); int day = telescopeDate.Substring(3, 2).ToInteger(); @@ -138,21 +138,29 @@ namespace ASCOM.MeadeAutostar497.Controller set { //var result = SerialCommand(":SLHH:MM:SS#", true); - var timeResult = SerialPort.CommandChar($"#:SL{value:hh:mm:ss}#"); + var timeResult = SerialPort.CommandChar($":SL{value:hh:mm:ss}#"); if (timeResult != '1') { throw new InvalidOperationException("Failed to set local time"); } - var dateResult = SerialPort.CommandChar($"#:SC{value:MM/dd/yy}#"); - if (dateResult != '1') + SerialPort.Lock(); + try { - throw new InvalidOperationException("Failed to set local time"); - } + var dateResult = SerialPort.CommandChar($":SC{value:MM/dd/yy}#"); + if (dateResult != '1') + { + throw new InvalidOperationException("Failed to set local time"); + } - //throwing away these two strings which represent - SerialPort.ReadTerminated("#"); //Updating Planetary Data# - SerialPort.ReadTerminated("#"); // # + //throwing away these two strings which represent + SerialPort.ReadTerminated("#"); //Updating Planetary Data# + SerialPort.ReadTerminated("#"); // # + } + finally + { + SerialPort.Unlock(); + } } } diff --git a/MeadeAutostar497/MeadeAutostar497.csproj b/MeadeAutostar497/MeadeAutostar497.csproj index 1fa4160..6de6351 100644 --- a/MeadeAutostar497/MeadeAutostar497.csproj +++ b/MeadeAutostar497/MeadeAutostar497.csproj @@ -46,7 +46,7 @@ prompt 4 true - AnyCPU + x64 false diff --git a/TestConsole/TestConsole.csproj b/TestConsole/TestConsole.csproj index 9631e67..4392996 100644 --- a/TestConsole/TestConsole.csproj +++ b/TestConsole/TestConsole.csproj @@ -16,7 +16,7 @@ 512 - x86 + x64 true full false