/// <summary> /// Process the incoming data. This will screen and average the data. /// </summary> /// <param name="data">Data to display.</param> /// <param name="origDataFormat">Originial Format of the data.</param> private void ProcessEnsemble(DataSet.Ensemble data, AdcpCodec.CodecEnum origDataFormat) { // Distribute the dataset to all subscribers if (data != null) { // Publish the ensemble before it is screened and averaged _events.PublishOnBackgroundThread(new EnsembleRawEvent(data.Clone(), EnsembleSource.Playback, EnsembleType.Single, origDataFormat)); // Make a copy of the ensemble to pass to all the views DataSet.Ensemble newEnsemble = data.Clone(); // Lock the ensemble lock (newEnsemble.SyncRoot) { // Vessel Mount Options VesselMountScreen(ref newEnsemble); // Screen the data _screenDataVM.ScreenData(ref newEnsemble, origDataFormat); // Average the data _averagingVM.AverageEnsemble(newEnsemble); // Create and Ensembl event EnsembleEvent ensEvent = new EnsembleEvent(newEnsemble, EnsembleSource.Playback); // Publish the ensemble after screening and averging the data _events.PublishOnBackgroundThread(ensEvent); // Display the ensemble _pm.DisplayEnsemble(ensEvent); } } }
/// <summary> /// Handle event when EnsembleEvent is received. /// This will create the displays for each config /// if it has not been created already. It will also /// display the latest ensemble. /// </summary> /// <param name="ensEvent">Ensemble event.</param> public override void Handle(EnsembleEvent ensEvent) { if (ensEvent.Ensemble != null && ensEvent.Ensemble.IsEnsembleAvail) { // Create the config var ssDataConfig = new SubsystemDataConfig(ensEvent.Ensemble.EnsembleData.SubsystemConfig, ensEvent.Source); if (!_validationTestVMDict.ContainsKey(ssDataConfig)) { Application.Current.Dispatcher.BeginInvoke(new System.Action(() => AddConfig(ssDataConfig))); } } // Check if record button was already pressed if (IsTesting != _adcpConn.IsValidationTestRecording) { IsTesting = _adcpConn.IsValidationTestRecording; } // Update timer if (!_adcpConn.IsRecording && // Not recording !_adcpConn.IsValidationTestRecording && // Not Validation test recording ensEvent.Source != EnsembleSource.Playback) // Not playing back data { _warningRecordTimer.Enabled = true; } else { _warningRecordTimer.Enabled = false; } }
/// <summary> /// Eventhandler for the latest ensemble data. /// This will filter the ensembles based off the subsystem type. /// It will set the max ensemble and then check the data and display the data. /// </summary> /// <param name="ensEvent">Ensemble event.</param> public override void Handle(EnsembleEvent ensEvent) { // Check if source matches this display if (_Config.Source != ensEvent.Source || ensEvent.Ensemble == null) { return; } // Display the data Task.Run(() => DisplayData(ensEvent.Ensemble)); }
/// <summary> /// Handle event when EnsembleEvent is received. /// This will create the displays for each config /// if it has not been created already. It will also /// display the latest ensemble. /// </summary> /// <param name="ensEvent">Ensemble event.</param> public override void Handle(EnsembleEvent ensEvent) { if (ensEvent.Ensemble != null && ensEvent.Ensemble.IsEnsembleAvail) { // Create the config var ssDataConfig = new SubsystemDataConfig(ensEvent.Ensemble.EnsembleData.SubsystemConfig, ensEvent.Source); if (!_textVMDict.ContainsKey(ssDataConfig)) { Application.Current.Dispatcher.BeginInvoke(new System.Action(() => AddConfig(ssDataConfig))); } } }
/// <summary> /// Handle event when EnsembleEvent is received. /// This will create the displays for each config /// if it has not been created already. It will also /// display the latest ensemble. /// </summary> /// <param name="ensEvent">Ensemble event.</param> public void Handle(EnsembleEvent ensEvent) { if (ensEvent.Ensemble != null) { // Update timer if (!_adcpConn.IsRecording && // Not recording !_adcpConn.IsValidationTestRecording && // Not Validation test recording ensEvent.Source != EnsembleSource.Playback) // Not playing back data { _warningRecordTimer.Enabled = true; } else { _warningRecordTimer.Enabled = false; } } }
/// <summary> /// Handle event when EnsembleEvent is received. /// This will create the displays for each config /// if it has not been created already. It will also /// display the latest ensemble. /// </summary> /// <param name="ensEvent">Ensemble event.</param> public override void Handle(EnsembleEvent ensEvent) { if (ensEvent.Ensemble != null && ensEvent.Ensemble.IsEnsembleAvail) { // Create the config var ssDataConfig = new SubsystemDataConfig(ensEvent.Ensemble.EnsembleData.SubsystemConfig, ensEvent.Source); // Don't add a STA or LTA config to average averaged data if (ensEvent.Source != EnsembleSource.STA && ensEvent.Source != EnsembleSource.LTA) { // Check if the config exist in the table if (!_averagingVMDict.ContainsKey(ssDataConfig)) { Application.Current.Dispatcher.BeginInvoke(new System.Action(() => AddConfig(ssDataConfig))); } } } }
/// <summary> /// Handle event when EnsembleEvent is received. /// This will create the displays for each config /// if it has not been created already. It will also /// display the latest ensemble. /// </summary> /// <param name="ensEvent">Ensemble event.</param> public override void Handle(EnsembleEvent ensEvent) { // Check if source matches this display if (_Config.Source != ensEvent.Source || ensEvent.Ensemble == null) { return; } // If no subsystem is given, then a project is not selected // So receive all data and display // If the serial number is not set, this may be an old ensemble // Try to display it anyway if (!_Config.SubSystem.IsEmpty() && !ensEvent.Ensemble.EnsembleData.SysSerialNumber.IsEmpty()) { // Verify the subsystem matches this viewmodel's subystem. if ((_Config.SubSystem == ensEvent.Ensemble.EnsembleData.GetSubSystem()) && // Check if Subsystem matches (_Config == ensEvent.Ensemble.EnsembleData.SubsystemConfig)) // Check if Subsystem Config matches { // Receive the ensemble ReceiveEnsemble(ensEvent.Ensemble); } } }
/// <summary> /// Handle a Ensemble Event. /// </summary> /// <param name="ensEvent">Event containing the ensemble.</param> public abstract void Handle(EnsembleEvent ensEvent);