Ejemplo n.º 1
0
		/// <summary>
		/// Executes a docking station diagnostic operation.
		/// </summary>
		/// <returns>Docking station event</returns>
		public DockingStationEvent Execute()
		{
            // Initialize resource manager's culture to be same as current configuration culture.
            DiagnosticResources.Culture = Configuration.DockingStation.Language.Culture;
			
            // Make the return event and return diagnostic and wire them together.
            DiagnosticEvent dsEvent = new DiagnosticEvent( this );
            dsEvent.DockingStation = Controller.GetDockingStation(); // Retrieve IDS's complete information.

            // Make the builder for the details.
            DetailsBuilder details = new DetailsBuilder();

            details.AddDockingStation( dsEvent.DockingStation );

            // SGF  23-May-2011  INS-1741
            ReportDiagnosticDate(details);

            GeneralDiagnostic generalDiagnostic = new GeneralDiagnostic( Configuration.DockingStation.SerialNumber, DateTime.UtcNow );

            ExecuteDiagnostics( dsEvent, details );

			// Retrieve the details.
			dsEvent.Details = details.ToString();

			// Write the details to a log file.
            FlashCard.WriteTextFile( LAST_RUN_DETAILS_FILE_NAME, dsEvent.Details );

            dsEvent.Diagnostics.Add( generalDiagnostic );
            generalDiagnostic.Items = _gdpList.ToArray();

            return dsEvent;  // Return the event
		}
Ejemplo n.º 2
0
		/// <summary>
		/// Executes a docking station interactive diagnostic operation.
		/// </summary>
		/// <returns>Docking station event</returns>
		public DockingStationEvent Execute()
		{
            // Initialize resource manager's culture to be same as current configuration culture.
            DiagnosticResources.Culture = Configuration.DockingStation.Language.Culture;

			// Make the return event.
            InteractiveDiagnosticEvent dsEvent = new InteractiveDiagnosticEvent( this );

			// Retrieve the docking station's complete information.
            dsEvent.DockingStation = Master.Instance.ControllerWrapper.GetDockingStation();

            // Print to log the selections made by the user
            Log.Debug( Name + ": DiagnoseKeypad = " + DiagnoseKeypad.ToString() ); // SGF  03-Jun-2011  INS-1730
            Log.Debug( Name + ": DiagnoseLcd = " + DiagnoseLcd.ToString() ); // SGF  03-Jun-2011  INS-1730
            Log.Debug( Name + ": DiagnoseLeds = " + DiagnoseLeds.ToString() );
            Log.Debug( Name + ": DiagnoseBuzzer = " + DiagnoseBuzzer.ToString() );
            Log.Debug( Name + ": DiagnoseLidSwitches = " + DiagnoseLidSwitches.ToString() );
            Log.Debug( Name + ": DiagnoseIGas = " + DiagnoseIGas.ToString() );
            Log.Debug( Name + ": DiagnoseCradleGasFlow = " + DiagnoseCradleGasFlow.ToString() ); // SGF  03-Jun-2011  INS-1730
            Log.Debug( Name + ": DiagnoseFlowRate = " + DiagnoseFlowRate.ToString() ); // SGF  03-Jun-2011  INS-1730
            Log.Debug( Name + ": DiagnoseInstrumentDetection = " + DiagnoseInstrumentDetection.ToString() );
            Log.Debug( Name + ": DiagnoseInstrumentCommunication = " + DiagnoseInstrumentCommunication.ToString() );
            Log.Debug( Name + ": DiagnoseBatteryCharging = " + DiagnoseBatteryCharging.ToString() );

            _details.AddDockingStation( dsEvent.DockingStation );

            // SGF  23-May-2011  INS-1741
            ReportDiagnosticDate();

			Pump.DoCheckFlow = false;

            for ( int valve = 1; valve <= Configuration.DockingStation.NumGasPorts; valve++ )
            {
                Master.Instance.PumpWrapper.OpenValve( valve, false );
                Thread.Sleep( 500 );
                Master.Instance.PumpWrapper.CloseValve( valve, false );
            }
            Master.Instance.PumpWrapper.Stop();
            Master.Instance.ControllerWrapper.TurnLEDsOff();
            Master.Instance.LCDWrapper.Backlight(true);
            Master.Instance.LCDWrapper.Display( "<a>               <a>" );

            if (Master.Instance.ControllerWrapper.IsDocked() )
            {
                Log.Debug( "ERROR: Remove the instrument from the cradle." );
                // Pause for the tech to remove the instrument.
                Thread.Sleep( 5000 );
            }

			Log.Debug( "Beginning interactive diagnostics." );

            // SGF  NEW CODE FOR INTERACTIVE DIAGNOSTIC CONTROL
            bool continueTesting = true;

            // SGF  03-Jun-2011  INS-1730 -- split keypad testing from LCD testing
            // Keypad
            if ( continueTesting && DiagnoseKeypad )
            {
                Log.Debug( "Interactive Diagnostics:  Testing Keypad" );
                continueTesting = TestKeypad();
            }

            // SGF  03-Jun-2011  INS-1730 -- split keypad testing from LCD testing
            // LCD
            if ( continueTesting && DiagnoseLcd )
            {
                Log.Debug( "Interactive Diagnostics:  Testing LCD" );
                continueTesting = TestLCD();
            }

            // LEDs
            if ( continueTesting && DiagnoseLeds )
            {
                Log.Debug( "Interactive Diagnostics:  Testing LEDs" );
                TestLEDs();
            }

            // Buzzer
            if ( continueTesting && DiagnoseBuzzer )
            {
                Log.Debug( "Interactive Diagnostics:  Testing Buzzer" );
                TestBuzzer();
            }

            // Lid Switches
            if ( continueTesting && DiagnoseLidSwitches )
            {
                Log.Debug( "Interactive Diagnostics:  Testing Lid Switches" );
                TestLidSwitches();
            }

            // iGas Connections
            if ( continueTesting && DiagnoseIGas )
            {
                Log.Debug( "Interactive Diagnostics:  Testing iGas Connections" );
                TestiGas();
            }

            // SGF  03-Jun-2011  INS-1730 -- split cradle solenoid testing from flow rate testing
            // Cradle Solenoid
            if ( continueTesting && DiagnoseCradleGasFlow )
            {
                Log.Debug( "Interactive Diagnostics:  Testing Cradle Gas Flow" );
                TestCradleGasFlow();
            }

            // SGF  03-Jun-2011  INS-1730 -- split cradle solenoid testing from flow rate testing
            // Flow Rate
            if ( continueTesting && DiagnoseFlowRate )
            {
                Log.Debug( "Interactive Diagnostics:  Testing Flow Rate" );
                TestFlowRate();
            }

            // Instrument Detection
            if ( continueTesting && DiagnoseInstrumentDetection )
            {
                Log.Debug( "Interactive Diagnostics:  Testing Instrument Detection" );
                TestInstrumentDetect();
            }
        
            // Instrument Communication
            if ( continueTesting && DiagnoseInstrumentCommunication )
            {
                Log.Debug( "Interactive Diagnostics:  Testing Instrument Communication" );
                continueTesting = TestInstrumentCommunication();               
            }

            // Battery Charging.
            if ( continueTesting && DiagnoseBatteryCharging )
            {
                Log.Debug( "Interactive Diagnostics:  Testing Battery Charging" );
                TestBatteryCharging();
            }

            Master.Instance.LCDWrapper.Display( GetMessage( DiagnosticResources.DONE ) );

			Pump.DoCheckFlow = true;
			Master.Instance.PumpWrapper.Stop();
            for ( int valve = 1; valve <= Configuration.DockingStation.NumGasPorts; valve++ )
            {
                Master.Instance.PumpWrapper.OpenValve( valve, false );
                Thread.Sleep( 500 );
                Master.Instance.PumpWrapper.CloseValve( valve, false );
            }
            Log.Debug( "Finished interactive diagnostics." );

			// Retrieve the details.
			dsEvent.Details = _details.ToString();

			// Write the details to a log file.
            FlashCard.WriteTextFile( LAST_RUN_DETAILS_FILE_NAME, dsEvent.Details );

            return dsEvent; // Return the event.
		}