/// <summary> /// Implementation of ICloneable::Clone - Creates a duplicate of an InstalledComponent object. /// </summary> /// <returns>InstalledComponent object</returns> public virtual object Clone() { InstalledComponent installedComponent = (InstalledComponent)this.MemberwiseClone(); installedComponent.Component = (Component)Component.Clone(); return(installedComponent); }
/// <summary> /// Returns a cal passed DualSense InstalledComponent sibling of the provided InstalledComponent if Single-Sensor mode is enabled /// and one exists. Otherwise, null is returned. GetDualSenseSibling is a helper method to be used in possible redundant /// bump passed scenarios. The calling method should determine if the sibling has a passed bump status. This method should only /// be called after determining that the instrument is NOT in cal failed state. /// </summary> public InstalledComponent GetDualSenseSibling(bool singleSensorMode, InstalledComponent bumpFailedComponent) { if (!singleSensorMode) { Log.Debug("Single-Sensor mode is currently disabled. A DualSense sibling will NOT be returned."); return(null); } // validate input parameter, only sensors are expected if (!(bumpFailedComponent.Component is Sensor)) { return(null); } Sensor bumpFailedSensor = (Sensor)bumpFailedComponent.Component; // an instrument must be docked and discovered if (this.Type == DeviceType.Unknown || this.SerialNumber.Length <= 0) { return(null); } if (this.Type == DeviceType.TX1) { // for TX1, a sensor that has a different S/N would be a DualSense sibling foreach (InstalledComponent ic in this.InstalledComponents) { if (!(ic.Component is Sensor)) { continue; } // We do not need to check if the sensor is enabled, because TX1 sensors cannot be disabled. Sensor sensor = (Sensor)ic.Component; if (sensor.Uid == bumpFailedSensor.Uid) { continue; } if (sensor.Type.Code == bumpFailedSensor.Type.Code && !SensorGasResponse.IsFailedCalibrationStatus(sensor.CalibrationStatus)) { return(ic); } } } else if (this.Type == DeviceType.VPRO || this.Type == DeviceType.SC) { // if the failed sensor is not capable of DualSense, then don't search for a sibling; // we check the flag here because TX1 does not use it if (!bumpFailedSensor.IsDualSenseCapable) { return(null); } // For Ventis Pro Series and SafeCore, a sibling will have a different S/N, but be DualSense capable, and have // the same sensor part number and sensor code. For SafeCore, we do not worry about sensor position because // if it were an issue the DS would go into the Sensor Error state. foreach (InstalledComponent ic in this.InstalledComponents) { if (!(ic.Component is Sensor)) { continue; } // Ventis Pro sensors cannot be disabled, but we check because SafeCore sensors can. if (!ic.Component.Enabled) { continue; } Sensor sensor = (Sensor)ic.Component; if (sensor.Uid == bumpFailedSensor.Uid) { continue; } if (sensor.IsDualSenseCapable && sensor.PartNumber == bumpFailedSensor.PartNumber && sensor.Type.Code == bumpFailedSensor.Type.Code && !SensorGasResponse.IsFailedCalibrationStatus(sensor.CalibrationStatus)) { return(ic); } } } // instrument does not support DualSense or no DualSense sibling found return(null); }