ASCOMInitiative / Conform

ASCOM Interface Conformance Checker
GNU General Public License v3.0
6 stars 2 forks source link

Issue on IsSafe vs. Connected for SafetyMonitor tests #2

Closed tholo closed 5 years ago

tholo commented 5 years ago

It appears to me that there is something wrong with the SafetyMonitor conformance check.

Conform claims that IsSafe is still returning true after disconnecting. But the trace logs from the SafetyMonitor implementation tells a different story:

15:15:14.872 SafetyMonitor             Starting initialisation
15:15:14.898 SafetyMonitor             Completed initialisation
15:15:14.900 InterfaceVersion Get      1
15:15:14.957 IsSafe Get                False
15:15:15.001 Connected                 Set {0}  (HEX[53][65][74][20][7B][30][7D])
15:15:15.002 Connected Set             Connecting
15:15:15.065 InterfaceVersion Get      1
15:15:15.095 Connected                 Get True
15:15:15.128 Description Get           EOST One Meter Safety Monitor
15:15:15.161 DriverInfo Get            Information about the driver itself. Version: 6.4
15:15:15.197 DriverVersion Get         6.4
15:15:15.232 Name Get                  Short driver name - please customise
15:15:15.312 SupportedActions Get      Returning empty arraylist
15:15:15.441 IsSafe Get                True
15:15:15.566 Connected                 Set {0}
15:15:15.566 Connected Set             Disconnecting

It checks IsSafe just before disconnecting, and never after...

Peter-Simpson commented 5 years ago

Hi Thorston,

Please can you zip up the complete SafetyMonitor and Conform log files and post them here so that I can see the entire interaction sequence.

Also, do you see the same issue with the SafetyMonitor simulator driver?

Thanks, Peter

From: Thorsten Lockert notifications@github.com Reply-To: ASCOMInitiative/Conform reply@reply.github.com Date: Thursday, 18 April 2019 at 22:22 To: ASCOMInitiative/Conform Conform@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Subject: [ASCOMInitiative/Conform] Issue on IsSafe vs. Connected for SafetyMonitor tests (#2)

It appears to me that there is something wrong with the SafetyMonitor conformance check.

Conform claims that IsSafe is still returning true after disconnecting. But the trace logs from the SafetyMonitor implementation tells a different story: 15:15:14.872 SafetyMonitor             Starting initialisation 15:15:14.898 SafetyMonitor             Completed initialisation 15:15:14.900 InterfaceVersion Get      1 15:15:14.957 IsSafe Get                False 15:15:15.001 Connected                 Set {0}  (HEX[53][65][74][20][7B][30][7D]) 15:15:15.002 Connected Set             Connecting 15:15:15.065 InterfaceVersion Get      1 15:15:15.095 Connected                 Get True 15:15:15.128 Description Get           EOST One Meter Safety Monitor 15:15:15.161 DriverInfo Get            Information about the driver itself. Version: 6.4 15:15:15.197 DriverVersion Get         6.4 15:15:15.232 Name Get                  Short driver name - please customise 15:15:15.312 SupportedActions Get      Returning empty arraylist 15:15:15.441 IsSafe Get                True 15:15:15.566 Connected                 Set {0} 15:15:15.566 Connected Set             Disconnecting It checks IsSafe just before disconnecting, and never after...

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

tholo commented 5 years ago

The above was the entire trace log from the SafetyMonitor driver trace for that run. In terms of the simulated one, no, it does not exhibit this -- but I am not at all sure it ever returned "True" for safe, either...

The log from Conform itself, for the same run that was above, is included below:

ConformanceCheck ASCOM Device Conformance Checker Version 6.4.63.0, Build time: 12/18/2018 08:58:34
ConformanceCheck Running on: ASCOM Platform 6.4 SP1 6.4.1.2695

ConformanceCheck Driver ProgID: ASCOM.OneMeter.SafetyMonitor

Error handling 
Error number for "Not Implemented" is: 80040400
Error number for "Invalid Value 1" 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.

15:15:09.525 Driver Access Checks              OK       
15:15:10.413 AccessChecks                      OK       Successfully created driver using late binding
15:15:11.586 AccessChecks                      OK       Successfully connected using late binding
15:15:11.593 AccessChecks                      INFO     The driver is a COM object
15:15:12.462 AccessChecks                      OK       Successfully created driver using early binding to ISafetyMonitor interface
15:15:12.471 AccessChecks                      OK       Successfully connected using early binding to ISafetyMonitor interface
15:15:13.667 AccessChecks                      OK       Successfully created driver using driver access toolkit
15:15:13.676 AccessChecks                      OK       Successfully connected using driver access toolkit

Conform is using ASCOM.DriverAccess.SafetyMonitor to get a SafetyMonitor object
15:15:14.901 ConformanceCheck                  OK       Driver instance created successfully

Pre-connect checks 
15:15:14.957 IsSafe                            OK       Reports false before connection

Connect 
15:15:15.002 ConformanceCheck                  OK       Connected OK

Common Driver Methods 
15:15:15.065 InterfaceVersion                  OK       1
15:15:15.095 Connected                         OK       True
15:15:15.128 Description                       OK       EOST One Meter Safety Monitor
15:15:15.161 DriverInfo                        OK       Information about the driver itself. Version: 6.4
15:15:15.197 DriverVersion                     OK       6.4
15:15:15.232 Name                              OK       Short driver name - please customise
15:15:15.267 CommandString                     INFO     Conform cannot test the CommandString method
15:15:15.279 CommandBlind                      INFO     Conform cannot test the CommandBlind method
15:15:15.287 CommandBool                       INFO     Conform cannot test the CommandBool method
15:15:15.300 Action                            INFO     Conform cannot test the Action method
15:15:15.313 SupportedActions                  OK       Driver returned an empty action list

Properties 
15:15:15.441 IsSafe                            ISSUE    IsSafe is True when not connected, IsSafe should be False

Conformance test complete 

Your driver had 0 errors, 0 warnings and 1 issues 
tholo commented 5 years ago

For what it is worth, the current implementation of the IsSafe property looks like:

       public bool IsSafe {
            get {
                var safe = true;

                if (!IsConnected)
                    safe = false;
                else if (weather == null)
                    safe = false;
                else
                {
                    if (weather.Outdoor.Precipitation)
                        safe = false;
                    if (weather.Wind.Speed > 30)
                        safe = false;
                    if (weather.Wind.Gust > 50)
                        safe = false;
                }
                tl.LogMessage("IsSafe Get", safe.ToString());
                return safe;
            }
        }
Peter-Simpson commented 5 years ago

Hi Thorston,

Thanks, I've found and fixed the issue. Here is a new version, does it now work correctly?

Conform 6.4.63.3

Regards, Peter

tholo commented 5 years ago

Yes, this new version seems to work correctly insofar as what I have implemented in my end of things.

Thank you!

Peter-Simpson commented 5 years ago

Great, thanks for testing the new version Thorston.

Best wishes, Peter