示例#1
0
        private void tsrMainToolStrip_IdentifyRequested(object sender, EventArgs e)
        {
            TelegramContainer container = new TelegramContainer();
            if (_ioph is IOPH_DATA)
            {
                container = createSeries(Task.IdentifyStop, 1, new LastReplyPrecondition[] { LastReplyPrecondition.Indication }, new byte[][] { new byte[] { 0x17, 1 } }, new Telegram.Callback(processSimpleCommunicationReplyTelegram), true);
                _commonTimerRole = TmrRole.None;
                container[0].telegram.UserDataExt.addUserData("SentData", "> " + WDSConverters.ToHexString(container[0].telegram.data.Buf, container[0].telegram.data.NumItems));
                tmrCommon.Enabled = false;
            }
            else
            {
                switch (_commonTimerRole)
                {
                    case TmrRole.None:
                        container = createSeries(Task.IdentifyStart, 1, new LastReplyPrecondition[] { LastReplyPrecondition.ACK }, new byte[][] { new byte[] { 0x17, 3 } }, null, true);
                        _commonTimerRole = TmrRole.LBIdentification;
                        tmrCommon.Enabled = true;
                        goto Label_0195;

                    case TmrRole.LBIdentification:
                    {
                        byte[][] teleData = new byte[1][];
                        byte[] buffer3 = new byte[2];
                        buffer3[0] = 0x17;
                        teleData[0] = buffer3;
                        container = createSeries(Task.IdentifyStop, 1, new LastReplyPrecondition[] { LastReplyPrecondition.ACK }, teleData, null, true);
                        _commonTimerRole = TmrRole.None;
                        tmrCommon.Enabled = false;
                        goto Label_0195;
                    }
                }
                _commonTimerRole = TmrRole.None;
                tmrCommon.Enabled = false;
                return;
            }
            Label_0195:
            if (_teleProcessor == null)
            {
                if (_ioph.telegramSeriesFromMainWin(container, SeriesExecutionState.Run, true) == -1)
                {
                    MessageBox.Show("Device is BUSY!");
                    return;
                }
            }
            else
            {
                if (_teleProcessor.initSeries(container))
                {
                    _teleProcessor.execTelegramSeries();
                    return;
                }
                MessageBox.Show("Device is BUSY!");
            }
        }
示例#2
0
 private void tsrMainToolStrip_IdentifyRequested(object sender, EventArgs e)
 {
     this.send_SetLoadboardLed(LBLEDMode.Mode3);
     this._commonTimerRole = TmrRole.LBIdentification;
     this.tmrCommon.Interval = 500;
     this.tmrCommon.Enabled = true;
 }
示例#3
0
 public void received_TransmitAcknowledge()
 {
     this.lblPacketSent.Visible = true;
     this._commonTimerRole = TmrRole.TransmitLabelBlink;
     this.tmrCommon.Interval = 250;
     this.tmrCommon.Enabled = true;
     if (this._task_id != Task.ContTransmit)
     {
         this._task_id = Task.None;
         this.unLockDeviceButtons();
     }
 }
示例#4
0
 private void tmrCommon_Tick(object sender, EventArgs e)
 {
     if (this._commonTimerRole == TmrRole.LBIdentification)
     {
         this.tmrCommon.Enabled = false;
         this.send_SetLoadboardLed(LBLEDMode.Mode0);
         this._commonTimerRole = TmrRole.None;
     }
     else
     {
         this.tmrCommon.Enabled = false;
     }
 }
示例#5
0
        private void tmrCommon_Tick(object sender, EventArgs e)
        {
            switch (this._commonTimerRole)
            {
                case TmrRole.TransmitLabelBlink:
                    this.tmrCommon.Enabled = false;
                    this.lblPacketSent.Visible = false;
                    this._commonTimerRole = TmrRole.None;
                    return;

                case TmrRole.LBIdentification:
                    this.tmrCommon.Enabled = false;
                    this.send_SetLoadboardLed(LBLEDMode.Mode0);
                    this._commonTimerRole = TmrRole.None;
                    return;
            }
            this.tmrCommon.Enabled = false;
        }
示例#6
0
 private void tsrMainToolStrip_IdentifyRequested(object sender, EventArgs e)
 {
     if (this._teleProcessor.initSeries(this.createSeries(Task.DeviceIdentificationStart, 1, new LastReplyPrecondition[] { LastReplyPrecondition.ACK }, new byte[][] { new byte[] { 0x17, 3 } }, null)))
     {
         this._teleProcessor.execTelegramSeries();
         this._commonTimerRole = TmrRole.LBIdentification;
         this.tmrCommon.Interval = 0x3e8;
         this.tmrCommon.Enabled = true;
     }
     else
     {
         MessageBox.Show("Device is BUSY!");
     }
 }
示例#7
0
 private void tslblNickname_Click(object sender, EventArgs e)
 {
     this.send_SetLoadboardLed(LBLEDMode.Mode3);
     this._commonTimerRole = TmrRole.LBIdentification;
     this.tmrCommon.Interval = 500;
     this.tmrCommon.Enabled = true;
 }
示例#8
0
 private void Basic_Network_Demo_CP_Load(object sender, EventArgs e)
 {
     this.powerSupply_Initialize(2.2, 3.8, this._currentVoltage);
     base.Location = WDS_MainProg.frameWin().getNextChildPosition();
     this.resetAppDataChanged();
     this._NodeAddr[0] = 1;
     this._NodeAddr[1] = 2;
     this._NodeAddr[2] = 3;
     this._NodeAddr[3] = 4;
     this._commonTimerRole = TmrRole.GetInitialInfo1;
     this.tmrCommon.Enabled = true;
     this.pnlNode1.Visible = false;
     this.pnlNode2.Visible = false;
     this.pnlNode3.Visible = false;
     this.pnlNode4.Visible = false;
     this.pnlN1TempBar.Height = 0;
     this.pnlN2TempBar.Height = 0;
     this.pnlN3TempBar.Height = 0;
     this.pnlN4TempBar.Height = 0;
 }
示例#9
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (!this._isDeviceBusy)
     {
         if (this.button1.Text == "Stop polling")
         {
             if (this.send_EnDis(1) == 0)
             {
                 this._task_id = Task.EnDis;
                 this.button1.Text = "Start polling";
                 this.tmrCommon.Enabled = false;
             }
         }
         else if (this.send_EnDis(1) == 0)
         {
             this._task_id = Task.EnDis;
             this.button1.Text = "Stop polling";
             this._commonTimerRole = TmrRole.GetSlaveInfo;
             this.tmrCommon.Enabled = true;
         }
     }
 }
示例#10
0
        private void tmrCommon_Tick(object sender, EventArgs e)
        {
            switch (this._commonTimerRole)
            {
                case TmrRole.GetSlaveInfo:
                    if (this._isDeviceBusy || (this.send_GetInfo() != 0))
                    {
                        break;
                    }
                    this._task_id = Task.GetInfo;
                    return;

                case TmrRole.GetInitialInfo1:
                    if (this.send_GetInfo() == 0)
                    {
                        this._task_id = Task.GetInfo;
                    }
                    this._commonTimerRole = TmrRole.GetInitialInfo2;
                    return;

                case TmrRole.GetInitialInfo2:
                    this.tmrCommon.Enabled = false;
                    this._commonTimerRole = TmrRole.None;
                    if (this.send_EnDis(1) != 0)
                    {
                        break;
                    }
                    this._task_id = Task.EnDis;
                    return;

                case TmrRole.LBIdentification:
                    this.tmrCommon.Enabled = false;
                    this.send_SetLoadboardLed(LBLEDMode.Mode0);
                    this._commonTimerRole = TmrRole.None;
                    return;

                default:
                    this.tmrCommon.Enabled = false;
                    break;
            }
        }
示例#11
0
        private void tsrMainToolStrip_IdentifyRequested(object sender, EventArgs e)
        {
            TelegramContainer telegramSeries = new TelegramContainer();
            if (this._teleProcessor == null)
            {
                telegramSeries = this.createSeries(Task.IdentifyStart, 1, new LastReplyPrecondition[] { LastReplyPrecondition.ACK }, new byte[][] { new byte[] { 0x17, 1 } }, null, new bool[] { true });
                this._commonTimerRole = TmrRole.LBIdentification;
                telegramSeries[0].telegram.UserDataExt.addUserData("SentData", "> " + WDSConverters.ToHexString(telegramSeries[0].telegram.data.Buf, telegramSeries[0].telegram.data.NumItems));
                this.sbProgressBar.Reset();
                this.sbProgressBar.EndPoint = telegramSeries.Count;
                this.sbDeviceStatePane.Text = this.getStatusString((Task) telegramSeries[0].telegram.UserDataExt.StoredUserData["Task"]);
                if (this._adtRec.isSimuation)
                {
                    this.logSimulationModeCommandSeries(telegramSeries);
                }
                else if (this._ioph.telegramSeriesFromMainWin(telegramSeries, SeriesExecutionState.Run, true) == -1)
                {
                    MessageBox.Show("Device is BUSY!");
                }
            }
            else
            {
                switch (this._commonTimerRole)
                {
                    case TmrRole.None:
                        telegramSeries = this.createSeries(Task.IdentifyStart, 1, new LastReplyPrecondition[] { LastReplyPrecondition.ACK }, new byte[][] { new byte[] { 0x17, 3 } }, null, new bool[] { true });
                        this._commonTimerRole = TmrRole.LBIdentification;
                        this.tmrCommon.Enabled = true;
                        break;

                    case TmrRole.LBIdentification:
                    {
                        byte[][] teleData = new byte[1][];
                        byte[] buffer3 = new byte[2];
                        buffer3[0] = 0x17;
                        teleData[0] = buffer3;
                        telegramSeries = this.createSeries(Task.IdentifyStop, 1, new LastReplyPrecondition[] { LastReplyPrecondition.ACK }, teleData, null, new bool[] { true });
                        this._commonTimerRole = TmrRole.None;
                        this.tmrCommon.Enabled = false;
                        break;
                    }
                    default:
                        this._commonTimerRole = TmrRole.None;
                        this.tmrCommon.Enabled = false;
                        return;
                }
                if (this._teleProcessor.initSeries(telegramSeries))
                {
                    this._teleProcessor.execTelegramSeries();
                }
                else
                {
                    MessageBox.Show("Device is BUSY!");
                }
            }
        }
示例#12
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            switch (this._commonTimerRole)
            {
                case TmrRole.LBIdentification:
                    this.tmrCommon.Enabled = false;
                    this.send_SetLoadboardLed(LBLEDMode.Mode0);
                    this._commonTimerRole = TmrRole.None;
                    return;

                case TmrRole.FindOutAppsNum:
                    this.tmrCommon.Enabled = false;
                    this.SetSwitchApplicationBtnToolTip();
                    this._commonTimerRole = TmrRole.None;
                    return;
            }
            this.tmrCommon.Enabled = false;
        }
示例#13
0
        private void SPI_Form_Load(object sender, EventArgs e)
        {
            this.tsrMainToolStrip.initVoltageRange(2.2, 3.6, this._currentVoltage);
            this.tsrMainToolStrip_SetVoltageRequested(null, new VoltageEventArgs(this._currentVoltage));
            this._baseChipType = this._chipType = this._adtRec.DeviceInfo.EBID.ChipType;
            this._chipRev = this._adtRec.DeviceInfo.EBID.ChipRevision;
            try
            {
                this.determinateBaseChipType();
                if ((this._myDev != null) && (this._myDev.Type == null))
                {
                    MessageBox.Show("The " + this._adtRec.DeviceInfo.ShowChipName + " Rev.:" + this._adtRec.DeviceInfo.ShowChipRevision + " is not supported in this application!\n", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
                this.sbChipRevPane.Text = "Chip Revision: " + this._myDev.Revision;
                this.SetControlsBasedOnFWType();
                this.ButtonLock(true);
                this.cbbMasterDB_SelectedIndexChanged(this, null);
                this.statusBarPanel1.Text = " Device: " + this._adtRec.DeviceInfo.ShowChipName + this._adtRec.PortAddress.objectInfo();
                this.Text = this._adtRec.DeviceInfo.ShowChipName + " Register Setting Panel";
                this._appId.Substring(this._appId.Length - 3);
                if (this._adtRec.PortAddress.Nickname != null)
                {
                    this.tsrMainToolStrip.Nickname = this._adtRec.PortAddress.Nickname;
                }
                else
                {
                    this.tsrMainToolStrip.Nickname = "Device [" + this._adtRec.UniqId + "]";
                }
                switch (this._chipType)
                {
                    case "Si4030":
                    case "Si4031":
                    case "Si4032":
                    case "Si4033":
                        this.pnlRXFIFO.Visible = false;
                        this.pnlBerPer.Visible = false;
                        goto Label_02FB;

                    case "Si4313":
                    case "Si4330":
                    {
                        this.pnlTXFIFO.Visible = false;
                        Point location = this.pnlTXFIFO.Location;
                        this.pnlRXFIFO.Location = location;
                        location.X += 220;
                        this.pnlBerPer.Location = location;
                        goto Label_02FB;
                    }
                }
            }
            catch (Exception exception)
            {
                MessageBox.Show("Error at Form Load!\n" + exception.Message);
            }
            Label_02FB:
            this._frameWin = WDS_MainProg.frameWin();
            base.Location = WDS_MainProg.frameWin().getNextChildPosition();
            this.send_SetLoadboardLed(LBLEDMode.Mode0);
            this._commonTimerRole = TmrRole.FindOutAppsNum;
            this.tmrCommon.Interval = 100;
            this.tmrCommon.Enabled = true;
            this.resetAppDataChanged();
        }
示例#14
0
        private void tsrMainToolStrip_IdentifyRequested(object sender, EventArgs e)
        {
            Telegram telegram = new Telegram(1) {
                uniqId = GlobalServices.uniqTelegramId(),
                parentUniqId = -1,
                type = TelegramType.Command
            };
            if (this._ioph is IOPH_DCP)
            {
                telegram.protocol = Protocol.DCP;
                telegram.DCPCmdSet = 4;
            }
            else
            {
                telegram.protocol = Protocol.DCP2;
                telegram.DCPCmdSet = 0x18;
            }
            telegram.portHandler = this._ioph;
            telegram.mainWin = this;
            telegram.clearEventHandler();
            telegram.CallbackEvent += new Telegram.Callback(this.identifyEventHandler);
            telegram.lastReplyPrecondition = LastReplyPrecondition.ACK;
            this._series.clear();
            if (this._teleProcessor == null)
            {
                this._series.addTelegram(telegram);
                this._series[0].telegram.data.copy(new byte[] { 0x17, 1 });
                this._series[0].telegram.UserDataExt.addUserData("CmdName", "IdentifyDevice");
                this._series[0].telegram.UserDataExt.addUserData("Task", Task.DeviceIdentificationStart);
                this._series[0].telegram.UserDataExt.addUserData("SentData", "> " + WDSConverters.ToHexString(this._series[0].telegram.data.Buf, this._series[0].telegram.data.NumItems));
                this.statusBarPanel4.Reset();
                this.statusBarPanel4.EndPoint = this._series.Count;
                this.sbDeviceStatePane.Text = this.getStatusString((Task) this._series[0].telegram.UserDataExt.StoredUserData["Task"]);
                if (this._adtRec.isSimuation)
                {
                    this.logSimulationModeCommandSeries(this._series);
                }
                else if (this._ioph.telegramSeriesFromMainWin(this._series, SeriesExecutionState.Run, true) == -1)
                {
                    MessageBox.Show("Device is BUSY!");
                }
            }
            else
            {
                switch (this._commonTimerRole)
                {
                    case TmrRole.None:
                        telegram.data.copy(new byte[] { 0x17, 3 });
                        telegram.SenderInfo = new object[] { "IdentifyDevice" };
                        this._series.addTelegram(telegram);
                        if (!this._teleProcessor.initSeries(this._series))
                        {
                            MessageBox.Show("Device is BUSY!");
                        }
                        else
                        {
                            this._teleProcessor.execTelegramSeries();
                        }
                        this.tmrCommon.Interval = 0x3e8;
                        this.tmrCommon.Enabled = true;
                        this._commonTimerRole = TmrRole.LBIdentification;
                        return;

                    case TmrRole.LBIdentification:
                    {
                        byte[] buf = new byte[2];
                        buf[0] = 0x17;
                        telegram.data.copy(buf);
                        this.tmrCommon.Enabled = false;
                        this._series.addTelegram(telegram);
                        if (!this._teleProcessor.initSeries(this._series))
                        {
                            MessageBox.Show("Device is BUSY!");
                            break;
                        }
                        this._teleProcessor.execTelegramSeries();
                        break;
                    }
                    default:
                        this._commonTimerRole = TmrRole.None;
                        return;
                }
                this._commonTimerRole = TmrRole.None;
            }
        }