Skip to content

Commit

Permalink
Fix Dome Driver to correctly report exception when invalid shutter va…
Browse files Browse the repository at this point in the history
…lue is specified.

Changed Dome Driver Conformance Test to report unexpected exceptions
Bumped version to 6.4.1.9
  • Loading branch information
astroman133 committed Jun 8, 2020
1 parent 24a3b45 commit 9238326
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 18 deletions.
42 changes: 28 additions & 14 deletions ConformanceTests/DomeDriverConformance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -751,18 +751,18 @@ private void TestSlewToAzimuth()
TestSlewToAzimuth( 225 );
TestSlewToAzimuth( 270 );
TestSlewToAzimuth( 315 );
TestSlewToAzimuth( -10 );
TestSlewToAzimuth( 370 );
TestSlewToAzimuth( -10, true );
TestSlewToAzimuth( 370, true );
}

private void TestSlewToAzimuth( int target )
private void TestSlewToAzimuth( int target, bool expectException = false )
{
string msg = "";
string status = _error;
bool timedOut = false;
int minValid = 0;
int maxValid = 359;
Exception except;
Exception except = null;

try
{
Expand Down Expand Up @@ -796,11 +796,19 @@ private void TestSlewToAzimuth( int target )

if ( msg.Contains( "invalid value" ) && ( target < minValid || target > maxValid ) )
{
status = _ok;
msg = String.Format( "COM invalid value exception correctly raised for slew to {0} degrees", target );
status = (expectException) ? _ok : _error;
msg = String.Format( "COM invalid value exception {0} raised for slew to {1} degrees"
, (expectException) ? "correctly" : "unexpectedly", target );
}
}

if ( expectException && except == null )
{
status = _error;
msg = String.Format( "No invalid value exception was raised for a slew to {0} degrees", target );
}


string suffix = ( target >= minValid && target <= maxValid ) ? target.ToString() : "";
TestContext.WriteLine( _fmt, NowTime(), "SlewToAzimuth " + suffix, status, msg );

Expand All @@ -821,18 +829,18 @@ private void TestSlewToAltitude()
TestSlewToAltitude( 60 );
TestSlewToAltitude( 75 );
TestSlewToAltitude( 90 );
TestSlewToAltitude( -10 );
TestSlewToAltitude( 100 );
TestSlewToAltitude( -10, true );
TestSlewToAltitude( 100, true );
}

private void TestSlewToAltitude( int target )
private void TestSlewToAltitude( int target, bool expectException = false )
{
string msg = "";
string status = _error;
bool timedOut = false;
int minValid = 0;
int maxValid = 90;
Exception except;
Exception except = null;

try
{
Expand Down Expand Up @@ -866,13 +874,19 @@ private void TestSlewToAltitude( int target )

if ( msg.Contains( "invalid value") && ( target < minValid || target > maxValid ) )
{
status = _ok;
msg = String.Format( "COM invalid value exception correctly raised for slew to {0} degrees", target );
status = ( expectException ) ? _ok : _error;
msg = String.Format( "COM invalid value exception {0} raised for slew to {1} degrees"
, ( expectException ) ? "correctly" : "unexpectedly", target );
}
}

string suffix = ( target >= minValid && target <= maxValid ) ? target.ToString() : "";
TestContext.WriteLine( _fmt, NowTime(), "SlewToAltitude "+ suffix, status, msg );
if ( expectException && except == null )
{
status = _error;
msg = String.Format( "No invalid value exception was raised for a slew to {0} degrees", target );
}

TestContext.WriteLine( _fmt, NowTime(), "SlewToAltitude "+ target.ToString(), status, msg );

if ( status == _error )
{
Expand Down
4 changes: 3 additions & 1 deletion DomeDriver/DomeDriver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1111,7 +1111,9 @@ public void SlewToAltitude( double altitude )

try
{
DomeManager.SlewDomeShutter( altitude );
//DomeManager.SlewDomeShutter( altitude );

DomeManager.SlewToAltitude( altitude );
msg += _done;
}
catch ( Exception )
Expand Down
2 changes: 1 addition & 1 deletion Inno Setup/ASCOM Device Hub Setup.iss
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
;

#define MyAppName "ASCOM.DeviceHub"
#define MyAppVersion "6.4.1.8"
#define MyAppVersion "6.4.1.9"
#define MyDestSubdirName "ASCOM.DeviceHub"

[Setup]
Expand Down
4 changes: 2 additions & 2 deletions ProductAssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion( "6.4.1.8" )]
[assembly: AssemblyFileVersion( "6.4.1.8" )]
[assembly: AssemblyVersion( "6.4.1.9" )]
[assembly: AssemblyFileVersion( "6.4.1.9" )]

0 comments on commit 9238326

Please sign in to comment.