Example #1
0
        private void teleProcessor_telegramSeriesFinished(object sender, EventArgs e)
        {
            this.sbProgressBar.Reset();
            this.showLocalLog("");
            switch (this._perState)
            {
                case PerTestState.Stopped:
                case PerTestState.Start:
                    break;

                case PerTestState.Wait:
                    this._triggeringFinished = true;
                    return;

                case PerTestState.Read:
                    this._perState = PerTestState.Start;
                    base.BeginInvoke(new EventHandler(this.doPer), new object[2]);
                    break;

                default:
                    return;
            }
        }
Example #2
0
 private void ercPerTest_resetStopRequested(object sender, EventArgs e)
 {
     this.ercPerTest.setStartStopBtnText("Start");
     this._perState = PerTestState.Stopped;
 }
Example #3
0
 private void ercPerTest_startStopRequested(object sender, EventArgs e)
 {
     if (this._perState == PerTestState.Stopped)
     {
         this.ercPerTest.setStartStopBtnText("Stop");
         this._perState = PerTestState.Start;
         this.doPer(null, null);
     }
     else
     {
         this.ercPerTest.setStartStopBtnText("Start");
         this._perState = PerTestState.Stopped;
     }
 }
Example #4
0
        private void doPer(object sender, EventArgs e)
        {
            TelegramContainer tc = new TelegramContainer();
            switch (this._perState)
            {
                case PerTestState.Stopped:
                    break;

                case PerTestState.Start:
                {
                    byte[][] bufferArray2 = new byte[2][];
                    bufferArray2[0] = new byte[] { 0x18, 4, 1 };
                    byte[] buffer = new byte[3];
                    buffer[0] = 0x18;
                    buffer[1] = 4;
                    bufferArray2[1] = buffer;
                    byte[][] teleData = bufferArray2;
                    tc = this.createSeries(Task.PER, 2, new LastReplyPrecondition[] { LastReplyPrecondition.ACK, LastReplyPrecondition.ACK }, teleData, null, new bool[2]);
                    if (this._teleProcessor != null)
                    {
                        if (this._teleProcessor.initSeries(tc))
                        {
                            this._perState = PerTestState.Wait;
                            this.tmrPerTimer.Interval = this.ercPerTest.getTimeout();
                            this.tmrPerTimer.Enabled = true;
                            this._triggeringFinished = false;
                            this._teleProcessor.execTelegramSeries();
                            return;
                        }
                        MessageBox.Show("Device is BUSY!");
                        this._perState = PerTestState.Stopped;
                        this.ercPerTest.setStartStopBtnText("Start");
                        return;
                    }
                    for (int i = 0; i < tc.Count; i++)
                    {
                        tc[i].telegram.UserDataExt.addUserData("SentData", "> " + WDSConverters.ToHexString(tc[i].telegram.data.Buf, tc[i].telegram.data.NumItems));
                    }
                    this._perState = PerTestState.Wait;
                    this._triggeringFinished = false;
                    this.tmrPerTimer.Interval = this.ercPerTest.getTimeout();
                    this.tmrPerTimer.Enabled = true;
                    this.sbProgressBar.Reset();
                    this.sbProgressBar.EndPoint = tc.Count;
                    this.sbDeviceStatePane.Text = this.getStatusString((Task) tc[0].telegram.UserDataExt.StoredUserData["Task"]);
                    if (this._adtRec.isSimuation)
                    {
                        this.logSimulationModeCommandSeries(tc);
                        return;
                    }
                    if (this._ioph.telegramSeriesFromMainWin(tc, SeriesExecutionState.Run, true) != -1)
                    {
                        break;
                    }
                    MessageBox.Show("Device is BUSY!");
                    this._perState = PerTestState.Stopped;
                    this.ercPerTest.setStartStopBtnText("Start");
                    return;
                }
                case PerTestState.Wait:
                {
                    if (!this._triggeringFinished)
                    {
                        _log.Error("Initiating double timeout waiting, due to the slow communication.");
                        return;
                    }
                    this.tmrPerTimer.Enabled = false;
                    byte[][] bufferArray3 = new byte[2][];
                    byte[] buffer2 = new byte[7];
                    buffer2[0] = 0x10;
                    buffer2[3] = 0x20;
                    bufferArray3[0] = buffer2;
                    bufferArray3[1] = new byte[] { 0x10, 0, 0, 0x44, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
                    tc = this.createSeries(Task.ReadInterruptStatus, 2, new LastReplyPrecondition[] { LastReplyPrecondition.Indication, LastReplyPrecondition.Indication }, bufferArray3, new Telegram.Callback(this.processInterruptStatusForPerRepTele), new bool[2]);
                    tc[1].telegram.UserDataExt.addUserData("PerRxPacketInfo", null);
                    if (this._teleProcessor != null)
                    {
                        if (this._teleProcessor.initSeries(tc))
                        {
                            this._teleProcessor.execTelegramSeries();
                            this._perState = PerTestState.Read;
                            return;
                        }
                        MessageBox.Show("Device is BUSY!");
                        this._perState = PerTestState.Stopped;
                        this.ercPerTest.setStartStopBtnText("Start");
                        return;
                    }
                    for (int j = 0; j < tc.Count; j++)
                    {
                        tc[j].telegram.UserDataExt.addUserData("SentData", "> " + WDSConverters.ToHexString(tc[j].telegram.data.Buf, tc[j].telegram.data.NumItems));
                    }
                    this.sbProgressBar.Reset();
                    this.sbProgressBar.EndPoint = tc.Count;
                    this.sbDeviceStatePane.Text = this.getStatusString((Task) tc[0].telegram.UserDataExt.StoredUserData["Task"]);
                    if (this._adtRec.isSimuation)
                    {
                        this.logSimulationModeCommandSeries(tc);
                        return;
                    }
                    if (this._ioph.telegramSeriesFromMainWin(tc, SeriesExecutionState.Run, true) == -1)
                    {
                        MessageBox.Show("Device is BUSY!");
                        this._perState = PerTestState.Stopped;
                        this.ercPerTest.setStartStopBtnText("Start");
                        return;
                    }
                    this._perState = PerTestState.Read;
                    return;
                }
                case PerTestState.Read:
                {
                    if (sender == null)
                    {
                        break;
                    }
                    byte num3 = (byte) sender;
                    if ((num3 & 0x10) != 0x10)
                    {
                        this.ercPerTest.packetReceived(false);
                        break;
                    }
                    this.ercPerTest.packetReceived(true);
                    return;
                }
                default:
                    return;
            }
        }