当前位置: 首页>>代码示例>>C#>>正文


C# Telegram.clearEventHandler方法代码示例

本文整理汇总了C#中NewWDS.Telegram.clearEventHandler方法的典型用法代码示例。如果您正苦于以下问题:C# Telegram.clearEventHandler方法的具体用法?C# Telegram.clearEventHandler怎么用?C# Telegram.clearEventHandler使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在NewWDS.Telegram的用法示例。


在下文中一共展示了Telegram.clearEventHandler方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: send_Ack

 private int send_Ack(Telegram.Callback callback)
 {
     try
     {
         Telegram telegram = new Telegram(0) {
             uniqId = GlobalServices.uniqTelegramId(),
             parentUniqId = -1,
             type = TelegramType.Command,
             lastReplyPrecondition = _lastReplyPec,
             protocol = Protocol.DCP,
             DCPCmdSet = 0,
             DCPMsgType = 0x40,
             replySize = 0x19
         };
         telegram.clearEventHandler();
         telegram.CallbackEvent += callback;
         if (telegram.replySize == -1)
         {
             throw new Exception("Not supported command.");
         }
         telegram.userData = 1;
         telegram.portHandler = _mainWin._ioph;
         telegram.mainWin = _mainWin;
         _mainWin.showLocalLog("> ACK\n");
         if (_mainWin._ioph.telegramFromMainWin(telegram) == 0)
         {
             return 0;
         }
         return -1;
     }
     catch (Exception exception)
     {
         AppWin_SPITool_PRO._log.Error(exception.Message);
         return -1;
     }
 }
开发者ID:x893,项目名称:WDS,代码行数:36,代码来源:AppWin_SPITool_PRO.cs

示例2: createSeries

 private TelegramContainer createSeries(Task task, int numOfCommands, LastReplyPrecondition[] teleStopPrec, byte[][] teleData, Telegram.Callback callback)
 {
     TelegramContainer container = new TelegramContainer();
     container.clear();
     for (int i = 0; i < numOfCommands; i++)
     {
         Telegram tele = new Telegram(5) {
             uniqId = GlobalServices.uniqTelegramId(),
             parentUniqId = -1,
             type = TelegramType.Command,
             protocol = Protocol.DCP,
             DCPCmdSet = 4,
             lastReplyPrecondition = teleStopPrec[i],
             userData = (int) task,
             portHandler = this._ioph,
             mainWin = this
         };
         tele.clearEventHandler();
         tele.CallbackEvent += callback;
         tele.data.copy(teleData[i]);
         if (i == (numOfCommands - 1))
         {
             tele.UserDataExt.addUserData("RetVal", 0);
         }
         container.addTelegramContainerItem(new TelegramContainerItem(tele));
     }
     return container;
 }
开发者ID:x893,项目名称:WDS,代码行数:28,代码来源:AppWin_Si4012_CP.cs

示例3: createSeries

 private TelegramContainer createSeries(Task task, int numOfCommands, LastReplyPrecondition[] teleStopPrec, byte[][] teleData, Telegram.Callback callback, bool isGeneralCmd)
 {
     TelegramContainer container = new TelegramContainer();
     container.clear();
     for (int i = 0; i < numOfCommands; i++)
     {
         Telegram tele = new Telegram(5) {
             uniqId = GlobalServices.uniqTelegramId(),
             parentUniqId = -1,
             type = TelegramType.Command
         };
         if (_ioph is IOPH_DATA)
         {
             tele.protocol = Protocol.DCP2;
             if (isGeneralCmd)
             {
                 tele.DCPCmdSet = 0x18;
             }
             else
             {
                 tele.DCPCmdSet = 0x1c;
             }
         }
         else
         {
             tele.protocol = Protocol.DCP;
             tele.DCPCmdSet = 4;
         }
         tele.lastReplyPrecondition = teleStopPrec[i];
         tele.UserDataExt.addUserData("Task", task);
         tele.portHandler = _ioph;
         tele.mainWin = this;
         tele.clearEventHandler();
         tele.CallbackEvent += callback;
         tele.data.copy(teleData[i]);
         container.addTelegramContainerItem(new TelegramContainerItem(tele));
     }
     return container;
 }
开发者ID:x893,项目名称:WDS,代码行数:39,代码来源:AppWin_SPITool_PRO.cs

示例4: sendLabelDataChanges

 private void sendLabelDataChanges(int nodeNumber)
 {
     Telegram telegram = new Telegram(5);
     TelegramContainer container = new TelegramContainer();
     telegram.uniqId = GlobalServices.uniqTelegramId();
     telegram.parentUniqId = -1;
     telegram.type = TelegramType.Command;
     telegram.protocol = Protocol.DCP2;
     telegram.DCPCmdSet = 0x24;
     telegram.lastReplyPrecondition = LastReplyPrecondition.Indication;
     telegram.portHandler = this._ioph;
     telegram.mainWin = this;
     telegram.clearEventHandler();
     telegram.CallbackEvent += new Telegram.Callback(this.processReplyData);
     telegram.data.copy(new byte[1]);
     byte[] buf = this._shelfLabelDescriptorSet[nodeNumber].getUpdatePayload();
     telegram.data.append(buf, buf.Length);
     telegram.UserDataExt.addUserData("NodeNumber", nodeNumber);
     container.addTelegram(telegram);
     if (!this._adtRec.isSimuation && (this._ioph.telegramSeriesFromMainWin(container, SeriesExecutionState.Run, true) == -1))
     {
         MessageBox.Show("Device is BUSY!");
     }
 }
开发者ID:x893,项目名称:WDS,代码行数:24,代码来源:ShelfLabelDemo_CP.cs

示例5: btnChipStateReadInfo_Click

 private void btnChipStateReadInfo_Click(object sender, EventArgs e)
 {
     this._series.clear();
     Telegram tele = new Telegram(5) {
         uniqId = GlobalServices.uniqTelegramId(),
         parentUniqId = -1,
         type = TelegramType.Command,
         protocol = Protocol.DCP,
         DCPCmdSet = 4,
         lastReplyPrecondition = LastReplyPrecondition.Indication,
         userData = 12,
         portHandler = this._ioph,
         mainWin = this
     };
     tele.clearEventHandler();
     tele.CallbackEvent += new Telegram.Callback(this.processReadChipStatusReplyTelegram);
     byte[] buf = new byte[] { 0x27, 0, 1, 0x61 };
     buf[1] = this._Si4012I2CBusAddress;
     tele.data.copy(buf);
     this._series.addTelegramContainerItem(new TelegramContainerItem(tele));
     tele = new Telegram(5) {
         uniqId = GlobalServices.uniqTelegramId(),
         parentUniqId = -1,
         type = TelegramType.Command,
         protocol = Protocol.DCP,
         DCPCmdSet = 4,
         lastReplyPrecondition = LastReplyPrecondition.Indication,
         userData = 11,
         portHandler = this._ioph,
         mainWin = this
     };
     tele.clearEventHandler();
     tele.CallbackEvent += new Telegram.Callback(this.processReadChipStatusReplyTelegram);
     tele.UserDataExt.addUserData("RetVal", 0);
     tele.data.copy(new byte[] { 40, this._Si4012I2CBusAddress, 6 });
     this._series.addTelegramContainerItem(new TelegramContainerItem(tele));
     if (this._teleProcessor.initSeries(this._series))
     {
         this._teleProcessor.execTelegramSeries();
     }
     else
     {
         MessageBox.Show("Device is BUSY!");
     }
 }
开发者ID:x893,项目名称:WDS,代码行数:45,代码来源:AppWin_Si4012_CP.cs

示例6: createSeries

 private TelegramContainer createSeries(Task task, int numOfCommands, byte[][] dcpPrefixCommandSet, byte[][] rfCommandSet, Telegram.Callback callback, bool[] isGeneralCmdIndicatorSet)
 {
     try
     {
         TelegramContainer container = new TelegramContainer();
         container.clear();
         for (int i = 0; i < numOfCommands; i++)
         {
             Telegram tele = new Telegram(5) {
                 uniqId = GlobalServices.uniqTelegramId(),
                 parentUniqId = -1,
                 type = TelegramType.Command,
                 protocol = Protocol.DCP2
             };
             if (isGeneralCmdIndicatorSet[i])
             {
                 tele.DCPCmdSet = 0x18;
             }
             else
             {
                 tele.DCPCmdSet = 0x1c;
             }
             tele.lastReplyPrecondition = LastReplyPrecondition.Indication;
             tele.UserDataExt.addUserData("Task", task);
             tele.portHandler = this._ioph;
             tele.mainWin = this;
             tele.clearEventHandler();
             tele.CallbackEvent += callback;
             if ((dcpPrefixCommandSet != null) && (dcpPrefixCommandSet.Length >= i))
             {
                 tele.data.copy(dcpPrefixCommandSet[i]);
             }
             if ((rfCommandSet != null) && (rfCommandSet.Length >= i))
             {
                 tele.data.append(rfCommandSet[i], rfCommandSet[i].Length);
             }
             container.addTelegramContainerItem(new TelegramContainerItem(tele));
         }
         return container;
     }
     catch (Exception exception)
     {
         _log.Error("Could not create command series! " + exception.Message);
         return null;
     }
 }
开发者ID:x893,项目名称:WDS,代码行数:46,代码来源:AppWin_Si4012_RC.cs

示例7: tsrMainToolStrip_IdentifyRequested

        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;
            }
        }
开发者ID:x893,项目名称:WDS,代码行数:85,代码来源:AppWin_SPITool_PRO2.cs

示例8: createSpiCommanSeries

 private TelegramContainer createSpiCommanSeries(int numOfCommands, byte[][] teleData, Telegram.Callback callback, bool resetChip, bool shutdownChip)
 {
     TelegramContainer container = new TelegramContainer();
     container.clear();
     if (shutdownChip)
     {
         foreach (TelegramContainerItem item in createShutdownCommandSeries())
         {
             container.addTelegramContainerItem(item);
         }
         return container;
     }
     if (resetChip)
     {
         foreach (TelegramContainerItem item2 in createResetCommandSeries())
         {
             container.addTelegramContainerItem(item2);
         }
     }
     for (int i = 0; i < numOfCommands; i++)
     {
         Telegram tele = new Telegram(5) {
             uniqId = GlobalServices.uniqTelegramId(),
             parentUniqId = -1,
             type = TelegramType.Command,
             protocol = Protocol.DCP2,
             DCPCmdSet = 0x1c,
             portHandler = _ioph,
             mainWin = this
         };
         tele.clearEventHandler();
         tele.CallbackEvent += callback;
         byte[] buf = new byte[3];
         buf[0] = 0x10;
         tele.data.copy(buf);
         tele.data.append(teleData[i], teleData[i].Length);
         tele.UserDataExt.addUserData("SentData", "> " + WDSConverters.ToHexString(teleData[i], teleData[i].Length));
         container.addTelegramContainerItem(new TelegramContainerItem(tele));
     }
     return container;
 }
开发者ID:x893,项目名称:WDS,代码行数:41,代码来源:AppWin_Si4460_RC.cs

示例9: createShutdownCommandSeries

 private TelegramContainer createShutdownCommandSeries()
 {
     TelegramContainer container = new TelegramContainer();
     container.clear();
     for (int i = 0; (i < RESET_COMMAND_SET.Length) || (i < 2); i++)
     {
         Telegram tele = new Telegram(5) {
             uniqId = GlobalServices.uniqTelegramId(),
             parentUniqId = -1,
             type = TelegramType.Command,
             protocol = Protocol.DCP2,
             DCPCmdSet = 0x1c,
             portHandler = _ioph,
             mainWin = this
         };
         tele.clearEventHandler();
         tele.data.copy(RESET_COMMAND_SET[i]);
         container.addTelegramContainerItem(new TelegramContainerItem(tele));
     }
     return container;
 }
开发者ID:x893,项目名称:WDS,代码行数:21,代码来源:AppWin_Si4460_RC.cs

示例10: send_Ack

 private int send_Ack(Telegram.Callback callback)
 {
     try
     {
         Telegram telegram = new Telegram(0) {
             uniqId = GlobalServices.uniqTelegramId(),
             parentUniqId = -1,
             type = TelegramType.Command,
             lastReplyPrecondition = this._lastReplyPec,
             protocol = Protocol.DCP,
             DCPCmdSet = 0,
             DCPMsgType = 0x40,
             replySize = 0x19
         };
         telegram.clearEventHandler();
         telegram.CallbackEvent += callback;
         if (telegram.replySize == -1)
         {
             throw new Exception("Error sending ACK message");
         }
         telegram.portHandler = this._ioph;
         telegram.mainWin = this._mainWin;
         this.communicationLog("> ACK");
         if (this._ioph.telegramFromMainWin(telegram) == 0)
         {
             return 0;
         }
         return -1;
     }
     catch (Exception exception)
     {
         _log.Error(exception.Message);
         return -1;
     }
 }
开发者ID:x893,项目名称:WDS,代码行数:35,代码来源:TelegramSeriesLocalProcessor.cs


注:本文中的NewWDS.Telegram.clearEventHandler方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。