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


C# Telegram.getHeaderMagic方法代码示例

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


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

示例1: telegramFromPortHandler

        public int telegramFromPortHandler(Telegram telegram)
        {
            if (telegram.type == TelegramType.Command)
            {
                this._portHandlerTerminated = true;
                this._closeCtrl.portHandlerClosed(telegram.portHandler);
                return 0;
            }
            if (telegram.type == TelegramType.DeviceFailure)
            {
                GlobalServices.ErrMsg(this._appId, "telegramFromPortHandler(): DeviceFailure received");
                this._ioph.controlSeriesExecution(SeriesExecutionState.Stop);
                return -1;
            }
            switch (telegram.type)
            {
                case TelegramType.AcknowledgeOK:
                    this.addToLogWindow(telegram.data.objectInfo(false));
                    break;

                case TelegramType.AcknowledgeERROR:
                    this.addToLogWindow(telegram.data.objectInfo(false));
                    break;

                case TelegramType.DataAcknowledgeOK:
                    if ((telegram.protocol == Protocol.ReadRxPacket) && ((this._task_id == Task.Receive) || (this._task_id == Task.ContReceive)))
                    {
                        this.addToLogWindow("Received packet: ");
                    }
                    this.addToLogWindow(telegram.data.objectInfo(false));
                    break;

                case TelegramType.DataAcknowledgeERROR:
                    this.addToLogWindow(telegram.data.objectInfo(false));
                    break;

                case TelegramType.SeriesEndOK:
                    GlobalServices.LogMsg(this._appId, "<--- Series finished");
                    break;

                case TelegramType.SeriesEndERROR:
                    GlobalServices.LogMsg(this._appId, "<--- Series finished with SeriesEndERROR");
                    break;

                case TelegramType.DeviceFailure:
                    this.addToLogWindow("DeviceFailure telegram type received: " + ((TelegramType) telegram.type).ToString());
                    break;

                default:
                    this.addToLogWindow("Unexpected telegram type received: " + ((TelegramType) telegram.type).ToString());
                    break;
            }
            if ((telegram.type != TelegramType.SeriesEndOK) && (telegram.type != TelegramType.SeriesEndERROR))
            {
                if (telegram.userData == 5)
                {
                    this._currentVoltage = this._sentVoltage;
                }
                if (telegram.userData == 3)
                {
                    if (this.chbTransPackErrRateTestEnab.Checked)
                    {
                        int num;
                        if (telegram.getHeaderMagic(true, out num))
                        {
                            this.txbTransTeleHdr.Text = num.ToString();
                        }
                        else
                        {
                            GlobalServices.ErrMsg(this._appId, "No header found in transmitted data telegram of an RF link test!");
                        }
                    }
                    this.received_TransmitAcknowledge();
                }
                if (telegram.type == TelegramType.DataAcknowledgeOK)
                {
                    if ((telegram.protocol == Protocol.ReadRxPacket) && ((this._task_id == Task.Receive) || (this._task_id == Task.ContReceive)))
                    {
                        if (this.chbRecvPackErrRateTestEnab.Checked)
                        {
                            int num2;
                            if (telegram.getHeaderMagic(false, out num2))
                            {
                                int num3;
                                if ((this._firstRecvHdrVal == -1) || (num2 <= this._firstRecvHdrVal))
                                {
                                    this._firstRecvHdrVal = num2;
                                    num3 = 1;
                                    this._receivedPackets = 1;
                                }
                                else
                                {
                                    num3 = (num2 - this._firstRecvHdrVal) + 1;
                                    this._receivedPackets++;
                                }
                                this.txbRecvTeleHdr.Text = num2.ToString();
                                this.txbSuccRecvPackets.Text = this._receivedPackets.ToString();
                                this.txbAllPackets.Text = num3.ToString();
                                this.lblRecvStatistic.Text = "(" + (((((double) this._receivedPackets) / ((double) num3)) * 100.0)).ToString("0.#") + " %)";
                                byte num4 = telegram.data[telegram.data.NumItems - 1];
//.........这里部分代码省略.........
开发者ID:x893,项目名称:WDS,代码行数:101,代码来源:AppWin_Si4420_CP.cs


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