public override int GetHashCode()
        {
            int hash = 1;

            if (typeCase_ == TypeOneofCase.Success)
            {
                hash ^= Success.GetHashCode();
            }
            if (typeCase_ == TypeOneofCase.Error)
            {
                hash ^= Error.GetHashCode();
            }
            if (typeCase_ == TypeOneofCase.ClientSpecification)
            {
                hash ^= ClientSpecification.GetHashCode();
            }
            if (typeCase_ == TypeOneofCase.DeviceSpecification)
            {
                hash ^= DeviceSpecification.GetHashCode();
            }
            hash ^= (int)typeCase_;
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
        public void MergeFrom(ServiceReply other)
        {
            if (other == null)
            {
                return;
            }
            switch (other.TypeCase)
            {
            case TypeOneofCase.Success:
                if (Success == null)
                {
                    Success = new global::Ubii.Service.Reply.Success();
                }
                Success.MergeFrom(other.Success);
                break;

            case TypeOneofCase.Error:
                if (Error == null)
                {
                    Error = new global::Ubii.Service.Reply.Error();
                }
                Error.MergeFrom(other.Error);
                break;

            case TypeOneofCase.ClientSpecification:
                if (ClientSpecification == null)
                {
                    ClientSpecification = new global::Ubii.Service.Reply.ClientSpecification();
                }
                ClientSpecification.MergeFrom(other.ClientSpecification);
                break;

            case TypeOneofCase.DeviceSpecification:
                if (DeviceSpecification == null)
                {
                    DeviceSpecification = new global::Ubii.Service.Reply.DeviceSpecification();
                }
                DeviceSpecification.MergeFrom(other.DeviceSpecification);
                break;
            }

            _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
        }
Exemple #3
0
        private void Start(IDevice device, bool primaryVerification, CancellationToken cancellation)
        {
            try
            {
                Exception = null;
                ReadPsysInfo();
                DeviceSpecification.CheckRangeSupport(device);
                UpdProductInfoEvent?.Invoke(this, new EventArgs());

                Action <CancellationToken> waitContinueAction = null;
                waitContinue = null;

                ITestProcess     testProcess;
                IMeasurmentTools measurmentTools;
                if (!Settings.UsedAutomaticSortingOut)
                {
                    waitContinue = new WaitContinue();
                    waitContinue.ContinueRequest  += ContinueRequest;
                    waitContinue.SelectionRequest += (obj, e) => SelectionRequest(this, e);
                    waitContinueAction             = waitContinue.Wait;
                }
                if (device.OutPort == OutPortEnum.Current)
                {
                    InitAmmetr();
                    ammetr.StartCycleMeasureCurrent();
                    measurmendIndicator = new MeasurmendIndicator(ammetr, psys, device.Range.RangeType == RangeTypeEnum.DA);
                    measurmentTools     = new CurrentMeasurmentTools(psys, GetPsysOutChannel(), ammetr);
                }
                else
                {
                    // Для симуляции преобразователя давления с цифровым портом
                    var digitalDevice = new DigitalPdSimulator(psys, device.Range.Min_Pa, device.Range.Max_Pa, 0.05,
                                                               device.Range.RangeType == RangeTypeEnum.DA);

                    // var digitalDevice = new PD_RS_device("COM5");

                    // Индикатор давления
                    measurmendIndicator = new MeasurmendIndicator(psys, device.Range.RangeType == RangeTypeEnum.DA);
                    measurmentTools     = new DigitalMeasurmentTools(psys, GetPsysOutChannel(), digitalDevice);
                }
                testProcess = new TestProcess(waitContinueAction, measurmentTools, GetTestPoints(device.Range.Max_Pa, device.Range.Min_Pa),
                                              Settings.TestPause100);
                measurmendIndicator.UpdDataEvent += UpdateMeasurmendIndicators;
                measurmendIndicator.Start();
                testProcess.UpdResultsEvent += UpdTestResult_event;
                progress.Report(0);
                double precision = primaryVerification ? device.TargetPrecision : device.Precision;
                var    units     = (PressureSensorTestCore.PressureUnitsEnum)device.Range.PressureUnits;
                testProcess.RunProcess(device.Range.Min_Pa, device.Range.Max_Pa, units, precision, device.Range.RangeType == RangeTypeEnum.DA,
                                       cancellation, progress);
                Product.Error = (TestErrorEnum)TestResults.GetResume();
                waitContinue?.WaitSelection(cancellation);
                Stop();
            }
            catch (OperationCanceledException)
            {
                Product.Error = TestErrorEnum.InDefined;
                Stop();
                if (Exception != null)
                {
                    processErrorHandler.ErrorHanding(Exception, Product);
                }
                else
                {
                    throw;
                }
            }
            catch (Exception ex)
            {
                Product.Error = TestErrorEnum.InDefined;
                Stop();
                Exception = ex;
                processErrorHandler.ErrorHanding(ex, Product);
            }
        }