From 8b5f2092f9a3193de9f313a0fffb5db0a560253b Mon Sep 17 00:00:00 2001 From: Peter Simpson <38855929+Peter-Simpson@users.noreply.github.com> Date: Wed, 17 May 2023 22:35:17 +0100 Subject: [PATCH] Fic issue where a Connect failure in the Focuser device was not reported. Make all Connected methods confirm that the set value is reflected in Get Connected. --- ConformU/Conform/Devices/CameraTester.cs | 14 +++++++---- .../Conform/Devices/CoverCalibratorTester.cs | 14 +++++++++-- ConformU/Conform/Devices/DomeTester.cs | 13 ++++++++-- ConformU/Conform/Devices/FilerWheelTester.cs | 14 +++++++++-- ConformU/Conform/Devices/FocuserTester.cs | 21 ++++++++-------- .../Devices/ObservingConditionsTester.cs | 14 +++++++++-- ConformU/Conform/Devices/RotatorTester.cs | 18 ++++++++++---- .../Conform/Devices/SafetyMonitorTester.cs | 14 +++++++++-- ConformU/Conform/Devices/SwitchTester.cs | 14 +++++++++-- ConformU/Conform/Devices/TelescopeTester.cs | 20 ++++++++++------ ConformU/Conform/Devices/VideoTester.cs | 14 +++++++++-- WindowsInstaller/ConformU.iss | 24 +++++++++---------- publishWindows.cmd | 6 ++--- 13 files changed, 145 insertions(+), 55 deletions(-) diff --git a/ConformU/Conform/Devices/CameraTester.cs b/ConformU/Conform/Devices/CameraTester.cs index e519733..0300578 100644 --- a/ConformU/Conform/Devices/CameraTester.cs +++ b/ConformU/Conform/Devices/CameraTester.cs @@ -327,20 +327,26 @@ public override bool Connected { get { - if (settings.DisplayMethodCalls) - LogTestAndMessage("ConformanceCheck", "About to get Connected"); + LogCallToDriver("ConformanceCheck", "About to get Connected"); return camera.Connected; } set { - if (settings.DisplayMethodCalls) - LogTestAndMessage("ConformanceCheck", "About to set Connected"); + LogCallToDriver("ConformanceCheck", "About to set Connected"); SetTest("Connected"); SetAction("Waiting for Connected to become 'true'"); camera.Connected = value; ResetTestActionStatus(); + + // Make sure that the value set is reflected in Connected GET + bool connectedState = Connected; + if (connectedState != value) + { + throw new ASCOM.InvalidOperationException($"Connected was set to {value} but Connected Get returned {connectedState}."); + } } } + public override void ReadCanProperties() { // ICameraV1 properties diff --git a/ConformU/Conform/Devices/CoverCalibratorTester.cs b/ConformU/Conform/Devices/CoverCalibratorTester.cs index b8282bd..150a783 100644 --- a/ConformU/Conform/Devices/CoverCalibratorTester.cs +++ b/ConformU/Conform/Devices/CoverCalibratorTester.cs @@ -173,13 +173,23 @@ public override bool Connected { get { - LogCallToDriver("Connected", "About to get Connected property"); + LogCallToDriver("ConformanceCheck", "About to get Connected"); return coverCalibratorDevice.Connected; } set { - LogCallToDriver("Connected", "About to set Connected property"); + LogCallToDriver("ConformanceCheck", "About to set Connected"); + SetTest("Connected"); + SetAction("Waiting for Connected to become 'true'"); coverCalibratorDevice.Connected = value; + ResetTestActionStatus(); + + // Make sure that the value set is reflected in Connected GET + bool connectedState = Connected; + if (connectedState != value) + { + throw new ASCOM.InvalidOperationException($"Connected was set to {value} but Connected Get returned {connectedState}."); + } } } diff --git a/ConformU/Conform/Devices/DomeTester.cs b/ConformU/Conform/Devices/DomeTester.cs index 8778438..0dcb963 100644 --- a/ConformU/Conform/Devices/DomeTester.cs +++ b/ConformU/Conform/Devices/DomeTester.cs @@ -200,14 +200,23 @@ public override bool Connected { get { - LogCallToDriver("Connected", "About to get Connected property"); + LogCallToDriver("ConformanceCheck", "About to get Connected"); return domeDevice.Connected; } set { - LogCallToDriver("Connected", "About to set Connected property"); + LogCallToDriver("ConformanceCheck", "About to set Connected"); + SetTest("Connected"); + SetAction("Waiting for Connected to become 'true'"); domeDevice.Connected = value; + ResetTestActionStatus(); + // Make sure that the value set is reflected in Connected GET + bool connectedState = Connected; + if (connectedState != value) + { + throw new ASCOM.InvalidOperationException($"Connected was set to {value} but Connected Get returned {connectedState}."); + } } } public override void CheckCommonMethods() diff --git a/ConformU/Conform/Devices/FilerWheelTester.cs b/ConformU/Conform/Devices/FilerWheelTester.cs index 48e31cb..c454d93 100644 --- a/ConformU/Conform/Devices/FilerWheelTester.cs +++ b/ConformU/Conform/Devices/FilerWheelTester.cs @@ -151,13 +151,23 @@ public override bool Connected { get { - LogCallToDriver("Connected", "About to get Connected property"); + LogCallToDriver("ConformanceCheck", "About to get Connected"); return filterWheel.Connected; } set { - LogCallToDriver("Connected", "About to set Connected property"); + LogCallToDriver("ConformanceCheck", "About to set Connected"); + SetTest("Connected"); + SetAction("Waiting for Connected to become 'true'"); filterWheel.Connected = value; + ResetTestActionStatus(); + + // Make sure that the value set is reflected in Connected GET + bool connectedState = Connected; + if (connectedState != value) + { + throw new ASCOM.InvalidOperationException($"Connected was set to {value} but Connected Get returned {connectedState}."); + } } } public override void PreRunCheck() diff --git a/ConformU/Conform/Devices/FocuserTester.cs b/ConformU/Conform/Devices/FocuserTester.cs index 424f226..78fd57f 100644 --- a/ConformU/Conform/Devices/FocuserTester.cs +++ b/ConformU/Conform/Devices/FocuserTester.cs @@ -167,21 +167,22 @@ public override bool Connected { get { - LogCallToDriver("Connected", "About to get Connected property"); + LogCallToDriver("ConformanceCheck", "About to get Connected"); return focuser.Connected; } set { - try - { - LogDebug("Connected", "Setting connected state to: " + value.ToString()); - LogCallToDriver("Connected", "About to set Link property"); - focuser.Connected = value; - LogDebug("AccessChecks", "Successfully changed connected state"); - } - catch (Exception ex) + LogCallToDriver("ConformanceCheck", "About to set Connected"); + SetTest("Connected"); + SetAction("Waiting for Connected to become 'true'"); + focuser.Connected = value; + ResetTestActionStatus(); + + // Make sure that the value set is reflected in Connected GET + bool connectedState = Connected; + if (connectedState != value) { - LogIssue("Connected", "Error changing focuser connected state: " + ex.ToString()); + throw new ASCOM.InvalidOperationException($"Connected was set to {value} but Connected Get returned {connectedState}."); } } } diff --git a/ConformU/Conform/Devices/ObservingConditionsTester.cs b/ConformU/Conform/Devices/ObservingConditionsTester.cs index 7a4ede1..334e96f 100644 --- a/ConformU/Conform/Devices/ObservingConditionsTester.cs +++ b/ConformU/Conform/Devices/ObservingConditionsTester.cs @@ -235,13 +235,23 @@ public override bool Connected { get { - LogCallToDriver("Absolute", "About to get Connected property"); + LogCallToDriver("ConformanceCheck", "About to get Connected"); return m_ObservingConditions.Connected; } set { - LogCallToDriver("Absolute", "About to set Connected property"); + LogCallToDriver("ConformanceCheck", "About to set Connected"); + SetTest("Connected"); + SetAction("Waiting for Connected to become 'true'"); m_ObservingConditions.Connected = value; + ResetTestActionStatus(); + + // Make sure that the value set is reflected in Connected GET + bool connectedState = Connected; + if (connectedState != value) + { + throw new ASCOM.InvalidOperationException($"Connected was set to {value} but Connected Get returned {connectedState}."); + } } } diff --git a/ConformU/Conform/Devices/RotatorTester.cs b/ConformU/Conform/Devices/RotatorTester.cs index edf1af4..6339afb 100644 --- a/ConformU/Conform/Devices/RotatorTester.cs +++ b/ConformU/Conform/Devices/RotatorTester.cs @@ -178,15 +178,23 @@ public override bool Connected { get { - LogCallToDriver("Connected", "About to get Connected property"); - bool ConnectedRet = m_Rotator.Connected; - return ConnectedRet; + LogCallToDriver("ConformanceCheck", "About to get Connected"); + return m_Rotator.Connected; } - set { - LogCallToDriver("Connected", "About to set Connected property"); + LogCallToDriver("ConformanceCheck", "About to set Connected"); + SetTest("Connected"); + SetAction("Waiting for Connected to become 'true'"); m_Rotator.Connected = value; + ResetTestActionStatus(); + + // Make sure that the value set is reflected in Connected GET + bool connectedState = Connected; + if (connectedState != value) + { + throw new ASCOM.InvalidOperationException($"Connected was set to {value} but Connected Get returned {connectedState}."); + } } } diff --git a/ConformU/Conform/Devices/SafetyMonitorTester.cs b/ConformU/Conform/Devices/SafetyMonitorTester.cs index b0043ba..fb1f45d 100644 --- a/ConformU/Conform/Devices/SafetyMonitorTester.cs +++ b/ConformU/Conform/Devices/SafetyMonitorTester.cs @@ -179,13 +179,23 @@ public override bool Connected { get { - LogCallToDriver("Connected", "About to get Connected property"); + LogCallToDriver("ConformanceCheck", "About to get Connected"); return m_SafetyMonitor.Connected; } set { - LogCallToDriver("Connected", "About to set Connected property"); + LogCallToDriver("ConformanceCheck", "About to set Connected"); + SetTest("Connected"); + SetAction("Waiting for Connected to become 'true'"); m_SafetyMonitor.Connected = value; + ResetTestActionStatus(); + + // Make sure that the value set is reflected in Connected GET + bool connectedState = Connected; + if (connectedState != value) + { + throw new ASCOM.InvalidOperationException($"Connected was set to {value} but Connected Get returned {connectedState}."); + } } } diff --git a/ConformU/Conform/Devices/SwitchTester.cs b/ConformU/Conform/Devices/SwitchTester.cs index e4a9782..406cb62 100644 --- a/ConformU/Conform/Devices/SwitchTester.cs +++ b/ConformU/Conform/Devices/SwitchTester.cs @@ -184,13 +184,23 @@ public override bool Connected { get { - LogCallToDriver("Connected", "About to get Connected property"); + LogCallToDriver("ConformanceCheck", "About to get Connected"); return m_Switch.Connected; } set { - LogCallToDriver("Connected", "About to get Connected property"); + LogCallToDriver("ConformanceCheck", "About to set Connected"); + SetTest("Connected"); + SetAction("Waiting for Connected to become 'true'"); m_Switch.Connected = value; + ResetTestActionStatus(); + + // Make sure that the value set is reflected in Connected GET + bool connectedState = Connected; + if (connectedState != value) + { + throw new ASCOM.InvalidOperationException($"Connected was set to {value} but Connected Get returned {connectedState}."); + } } } diff --git a/ConformU/Conform/Devices/TelescopeTester.cs b/ConformU/Conform/Devices/TelescopeTester.cs index 83c5c27..06fea63 100644 --- a/ConformU/Conform/Devices/TelescopeTester.cs +++ b/ConformU/Conform/Devices/TelescopeTester.cs @@ -443,17 +443,23 @@ public override bool Connected { get { - if (settings.DisplayMethodCalls) - LogTestAndMessage("ConformanceCheck", "About to get Connected property"); - bool ConnectedRet = telescopeDevice.Connected; - return ConnectedRet; + LogCallToDriver("ConformanceCheck", "About to get Connected"); + return telescopeDevice.Connected; } - set { - if (settings.DisplayMethodCalls) - LogTestAndMessage("ConformanceCheck", "About to set Connected property " + value.ToString()); + LogCallToDriver("ConformanceCheck", "About to set Connected"); + SetTest("Connected"); + SetAction("Waiting for Connected to become 'true'"); telescopeDevice.Connected = value; + ResetTestActionStatus(); + + // Make sure that the value set is reflected in Connected GET + bool connectedState = Connected; + if (connectedState != value) + { + throw new ASCOM.InvalidOperationException($"Connected was set to {value} but Connected Get returned {connectedState}."); + } } } diff --git a/ConformU/Conform/Devices/VideoTester.cs b/ConformU/Conform/Devices/VideoTester.cs index e16d15b..e7f5e44 100644 --- a/ConformU/Conform/Devices/VideoTester.cs +++ b/ConformU/Conform/Devices/VideoTester.cs @@ -223,13 +223,23 @@ public override bool Connected { get { - LogCallToDriver("Connected", "About to get Connected property"); + LogCallToDriver("ConformanceCheck", "About to get Connected"); return videoDevice.Connected; } set { - LogCallToDriver("Connected", "About to set Connected property"); + LogCallToDriver("ConformanceCheck", "About to set Connected"); + SetTest("Connected"); + SetAction("Waiting for Connected to become 'true'"); videoDevice.Connected = value; + ResetTestActionStatus(); + + // Make sure that the value set is reflected in Connected GET + bool connectedState = Connected; + if (connectedState != value) + { + throw new ASCOM.InvalidOperationException($"Connected was set to {value} but Connected Get returned {connectedState}."); + } } } diff --git a/WindowsInstaller/ConformU.iss b/WindowsInstaller/ConformU.iss index 5f68105..f0bab98 100644 --- a/WindowsInstaller/ConformU.iss +++ b/WindowsInstaller/ConformU.iss @@ -81,22 +81,22 @@ Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{ [Files] ; 64bit OS - Install the 64bit app -Source: "J:\ConformU\publish\ConformU64\*.exe"; DestDir: "{app}\64bit"; Flags: ignoreversion signonce; Check: Is64BitInstallMode -Source: "J:\ConformU\publish\ConformU64\*.dll"; DestDir: "{app}\64bit"; Flags: ignoreversion signonce; Check: Is64BitInstallMode -Source: "J:\ConformU\publish\ConformU64\*"; DestDir: "{app}\64bit"; Flags: ignoreversion; Excludes:"*.exe,*.dll"; Check: Is64BitInstallMode -Source: "J:\ConformU\publish\ConformU64\wwwroot\*"; DestDir: "{app}\64bit\wwwroot"; Flags: ignoreversion recursesubdirs createallsubdirs; Check: Is64BitInstallMode +Source: "..\publish\ConformU64\*.exe"; DestDir: "{app}\64bit"; Flags: ignoreversion signonce; Check: Is64BitInstallMode +Source: "..\publish\ConformU64\*.dll"; DestDir: "{app}\64bit"; Flags: ignoreversion signonce; Check: Is64BitInstallMode +Source: "..\publish\ConformU64\*"; DestDir: "{app}\64bit"; Flags: ignoreversion; Excludes:"*.exe,*.dll"; Check: Is64BitInstallMode +Source: "..\publish\ConformU64\wwwroot\*"; DestDir: "{app}\64bit\wwwroot"; Flags: ignoreversion recursesubdirs createallsubdirs; Check: Is64BitInstallMode ; 64bit OS - Install the 32bit app -Source: "J:\ConformU\publish\ConformU86\*.exe"; DestDir: "{app}\32bit"; Flags: ignoreversion signonce; Check: Is64BitInstallMode -Source: "J:\ConformU\publish\ConformU86\*.dll"; DestDir: "{app}\32bit"; Flags: ignoreversion signonce; Check: Is64BitInstallMode -Source: "J:\ConformU\publish\ConformU86\*"; DestDir: "{app}\32bit"; Flags: ignoreversion; Excludes:"*.exe,*.dll"; Check: Is64BitInstallMode -Source: "J:\ConformU\publish\ConformU86\wwwroot\*"; DestDir: "{app}\32bit\wwwroot"; Flags: ignoreversion recursesubdirs createallsubdirs; Check: Is64BitInstallMode +Source: "..\publish\ConformU86\*.exe"; DestDir: "{app}\32bit"; Flags: ignoreversion signonce; Check: Is64BitInstallMode +Source: "..\publish\ConformU86\*.dll"; DestDir: "{app}\32bit"; Flags: ignoreversion signonce; Check: Is64BitInstallMode +Source: "..\publish\ConformU86\*"; DestDir: "{app}\32bit"; Flags: ignoreversion; Excludes:"*.exe,*.dll"; Check: Is64BitInstallMode +Source: "..\publish\ConformU86\wwwroot\*"; DestDir: "{app}\32bit\wwwroot"; Flags: ignoreversion recursesubdirs createallsubdirs; Check: Is64BitInstallMode ; 32bit OS - Install the 32bit app -Source: "J:\ConformU\publish\ConformU86\*.exe"; DestDir: "{app}"; Flags: ignoreversion signonce; Check: not Is64BitInstallMode -Source: "J:\ConformU\publish\ConformU86\*.dll"; DestDir: "{app}"; Flags: ignoreversion signonce; Check: not Is64BitInstallMode -Source: "J:\ConformU\publish\ConformU86\*"; DestDir: "{app}"; Flags: ignoreversion; Excludes:"*.exe,*.dll"; Check: not Is64BitInstallMode -Source: "J:\ConformU\publish\ConformU86\wwwroot\*"; DestDir: "{app}\wwwroot"; Flags: ignoreversion recursesubdirs createallsubdirs; Check: not Is64BitInstallMode +Source: "..\publish\ConformU86\*.exe"; DestDir: "{app}"; Flags: ignoreversion signonce; Check: not Is64BitInstallMode +Source: "..\publish\ConformU86\*.dll"; DestDir: "{app}"; Flags: ignoreversion signonce; Check: not Is64BitInstallMode +Source: "..\publish\ConformU86\*"; DestDir: "{app}"; Flags: ignoreversion; Excludes:"*.exe,*.dll"; Check: not Is64BitInstallMode +Source: "..\publish\ConformU86\wwwroot\*"; DestDir: "{app}\wwwroot"; Flags: ignoreversion recursesubdirs createallsubdirs; Check: not Is64BitInstallMode [Icons] ; 64bit OS diff --git a/publishWindows.cmd b/publishWindows.cmd index c6ae2cb..f22fbdf 100644 --- a/publishWindows.cmd +++ b/publishWindows.cmd @@ -8,9 +8,9 @@ cd cd J:\ConformU echo *** Build application -MSBuild "J:\ConformU\ConformU.sln" /p:Configuration=Debug /p:Platform="Any CPU" /t:Restore +MSBuild "ConformU.sln" /p:Configuration=Debug /p:Platform="Any CPU" /t:Restore cd -MSBuild "J:\ConformU\ConformU.sln" /p:Configuration=Debug /p:Platform="Any CPU" /t:Rebuild +MSBuild "ConformU.sln" /p:Configuration=Debug /p:Platform="Any CPU" /t:Rebuild echo *** Completed Build echo *** Publishing Windows 64bit @@ -26,7 +26,7 @@ echo *** Completed setting large address aware flag on 32bit EXE echo *** Creating Windows installer cd WindowsInstaller -"C:\Program Files (x86)\Inno Script Studio\isstudio.exe" -compile "J:\ConformU\WindowsInstaller\conformu.iss" +"C:\Program Files (x86)\Inno Script Studio\isstudio.exe" -compile "conformu.iss" cd .. echo *** Builds complete