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


C# NewWDS.Telegram类代码示例

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


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

示例1: IOPH_DATA

 public IOPH_DATA(ADTRecord adtRec, IAppMainWindow mainWin)
 {
     _adtRec = adtRec;
     _mainWin = mainWin;
     _teleToWin = new Telegram(GlobalServices.maxReplyDataLen);
     _teleFromWin = new Telegram(GlobalServices.maxReplyDataLen);
 }
开发者ID:x893,项目名称:WDS,代码行数:7,代码来源:IOPH_DATA.cs

示例2: IOPH_EZLinkDongle

 public IOPH_EZLinkDongle(ADTRecord adtRec, IAppMainWindow mainWin)
 {
     this._adtRec = adtRec;
     this._mainWin = mainWin;
     this._teleFromWin = new Telegram(0x3e8);
     this._teleToWin = new Telegram(0x3e8);
     this._replyData = new DataBuffer(0x3e8);
     this._isSeries = false;
     this._seriesExecStat = SeriesExecutionState.Stop;
     this._taskEvent = new AutoResetEvent(false);
     this._taskState = TaskState.TaskReady_OK;
     if (adtRec.isUsbEZLinkDevice())
     {
         this._ddi = DDI_EZLinkDongle.instance();
     }
     else if (adtRec.isTESTDevice())
     {
         this._ddi = DDI_TEST.instance();
     }
     else
     {
         GlobalServices.ErrMsg("FATAL ERROR: IOPH_EZLinkDongle", "I/O port type not supported, exit WDS!");
         Application.Exit();
     }
     this._iot = new Thread(new ThreadStart(this.doDeviceIO));
     this._iot.IsBackground = true;
     this._iot.Name = "IOPH_EZLink thread";
     this._isTelegramRequest = false;
     this._isRxTimerRequest = false;
     this._isReadRxPacketEnabled = false;
     this._iot.Start();
 }
开发者ID:x893,项目名称:WDS,代码行数:32,代码来源:IOPH_EZLinkDongle.cs

示例3: telegramFromPortHandler

 public int telegramFromPortHandler(Telegram recTelegram)
 {
     TelegramTools.copyTelegram(recTelegram, ref this._savedTelegram);
     this._isDeviceBusy = false;
     if ((this._savedTelegram.type != TelegramType.PortHandlerTerminated) &&
         this._savedTelegram.FireCallback())
     {
         return 0;
     }
     return this.DefaultTelegramFromPortHandler(this._savedTelegram);
 }
开发者ID:x893,项目名称:WDS,代码行数:11,代码来源:TelegramDispatcher.cs

示例4: IOPH_DCP

 public IOPH_DCP(ADTRecord adtRec, IAppMainWindow mainWin)
 {
     _adtRec = adtRec;
     _mainWin = mainWin;
     _teleFromWin = new Telegram(GlobalServices.maxCommandDataLen);
     _teleToWin = new Telegram(GlobalServices.maxReplyDataLen);
     _replyData = new DataBuffer(GlobalServices.maxReplyDataLen);
     _isSeries = false;
     _seriesExecStat = SeriesExecutionState.Stop;
     _taskState = TaskState.TaskReady_OK;
     int num = int.Parse(ConfigurationManager.AppSettings["DCPMaxDataLen"]);
     int num2 = int.Parse(ConfigurationManager.AppSettings["DCPMsgRepeatNr"]);
     int num3 = int.Parse(ConfigurationManager.AppSettings["DCPRecTimeout"]);
     byte num4 = byte.Parse(ConfigurationManager.AppSettings["DCPSOFByte"]);
     _dcpProtocolEngine = new DCPProtocol(this, num, num2, num3, 10, num4);
     _DCPRXMsg = new DCPFrame(num, num4);
     _DCPAnswerMsg = new DCPFrame(num, num4);
     _DCPTXMsg = new DCPFrame(num, num4);
     _DCPTXBuf = new DCPFrame(num, num4);
     if (adtRec.isUsbFtdiDevice())
     {
         _ddi = DDI_USB.instance();
     }
     else if (adtRec.isRS232Device())
     {
         _ddi = DDI_RS232.instance();
     }
     else if (adtRec.isTESTDevice())
     {
         _ddi = DDI_TEST.instance();
     }
     else if (adtRec.isHIDDevice())
     {
         _ddi = DDI_HID.instance();
     }
     else
     {
         GlobalServices.ErrMsg("IOPH_DCP.IOPH_DCP()", "FATAL ERROR: Unknown I/O port type, exit WDS!");
         Application.Exit();
     }
     _iot = new Thread(new ThreadStart(doDeviceIO));
     _iot.IsBackground = true;
     _iot.Name = "IOPH_DCP thread";
     _isTelegramRequest = false;
     _iot.Start();
 }
开发者ID:x893,项目名称:WDS,代码行数:46,代码来源:IOPH_DCP.cs

示例5: copyTelegram

 public static void copyTelegram(Telegram srcTele, ref Telegram dstTele)
 {
     if (srcTele != null)
     {
         dstTele = new Telegram(100);
         if (dstTele.copy(srcTele) == -1)
         {
             int numItems = srcTele.data.NumItems;
             dstTele = new Telegram((numItems < 0x3e8) ? (numItems * 5) : (numItems * 2));
             if (dstTele.copy(srcTele) == -1)
             {
                 GlobalServices.ErrMsg("TelegramTools.copyTelegram()", "FATAL ERROR: erroneous telegram copy implementation, exit WDS!");
                 Application.Exit();
             }
         }
     }
 }
开发者ID:x893,项目名称:WDS,代码行数:17,代码来源:TelegramTools.cs

示例6: IOPH_LoadBoard

 public IOPH_LoadBoard(ADTRecord adtRec, IAppMainWindow mainWin)
 {
     this._adtRec = adtRec;
     this._mainWin = mainWin;
     this._teleFromWin = new Telegram(GlobalServices.maxCommandDataLen);
     this._teleToWin = new Telegram(GlobalServices.maxReplyDataLen);
     this._replyData = new DataBuffer(GlobalServices.maxReplyDataLen, Data_Type.ASCII);
     this._isSeries = false;
     this._seriesExecStat = SeriesExecutionState.Stop;
     this._taskEvent = new AutoResetEvent(false);
     this._taskState = TaskState.TaskReady_OK;
     if (adtRec.isUsbFtdiDevice())
     {
         this._ddi = DDI_USB.instance();
         this._isTestDevice = false;
     }
     else if (adtRec.isRS232Device())
     {
         this._ddi = DDI_RS232.instance();
         this._isTestDevice = false;
     }
     else if (adtRec.isTESTDevice())
     {
         this._ddi = DDI_TEST.instance();
         this._isTestDevice = true;
     }
     else if (adtRec.isHIDDevice())
     {
         this._ddi = DDI_HID.instance();
         this._isTestDevice = false;
     }
     else
     {
         GlobalServices.ErrMsg("IOPH_LoadBoard.IOPH_LoadBoard()", "FATAL ERROR: Unknown I/O port type, exit WDS!");
         GlobalServices.msgBox("FATAL ERROR: Unknown I/O port type, exit WDS!", "IOPH_LoadBoard.IOPH_LoadBoard()");
         Application.Exit();
     }
     this.ReadReplytimerDelegate = new TimerCallback(this.rxReadReplyTimerTickHandler);
     this._iot = new Thread(new ThreadStart(this.doDeviceIO));
     this._iot.IsBackground = true;
     this._iot.Name = "IOPH_LoadBoard thread";
     this._iot.Start();
 }
开发者ID:x893,项目名称:WDS,代码行数:43,代码来源:IOPH_LoadBoard.cs

示例7: processRegisterIO

 private void processRegisterIO(Telegram replyTele)
 {
     try
     {
         bool flag = false;
         if (replyTele.type == TelegramType.SeriesEndOK)
         {
             statusBarPanel4.Reset();
             showLocalLog("\n");
             if (tsrMainToolStrip.IsContCurrentReadOn)
             {
                 base.BeginInvoke(new EventHandler(tsrMainToolStrip_AmmeteringRequested), new object[2]);
             }
         }
         else
         {
             if ((((replyTele.type == TelegramType.PacketRecOK) && (replyTele.data.NumItems > 0)) && ((replyTele.data.Buf[0] == 0x11) && replyTele.UserDataExt.hasStoredValue("RegId"))) && (replyTele.data.NumItems >= 4))
             {
                 if (replyTele.data.Buf[1] != 0)
                 {
                     showLocalLog("< Reading returned with error code: " + replyTele.data.Buf[1].ToString());
                     return;
                 }
                 int registerIdx = (int) replyTele.UserDataExt["RegId"];
                 if (replyTele.UserDataExt.hasStoredValue("IsRead") && ((bool) replyTele.UserDataExt["IsRead"]))
                 {
                     _myDev.Registers[registerIdx].DeviceValue = _myDev.Registers[registerIdx].CurrentValue = replyTele.data.Buf[3];
                     repaintRegisterRowColors(registerIdx);
                     flag = true;
                 }
                 else
                 {
                     _myDev.Registers[registerIdx].DeviceValue = _myDev.Registers[registerIdx].CurrentValue;
                     repaintRegisterRowColors(registerIdx);
                     flag = true;
                 }
                 if (replyTele.UserDataExt.hasStoredValue("SentData"))
                 {
                     showLocalLog(((string) replyTele.UserDataExt["SentData"]) + "\n");
                     showLocalLog("< " + WDSConverters.ToHexString(replyTele.data.Buf, replyTele.data.NumItems) + "\n");
                     statusBarPanel4.Step();
                 }
             }
             if (!flag)
             {
                 showLocalLog("Unexpected packet received! The packet could not be procesed! " + replyTele.UserDataExt["RegId"].ToString());
                 _log.Error("Unexpected packet received! The packet could not be procesed!");
             }
         }
     }
     catch (Exception exception)
     {
         _log.Error("Register IO processing problem! " + exception.Message);
     }
 }
开发者ID:x893,项目名称:WDS,代码行数:55,代码来源:AppWin_SPITool_PRO.cs

示例8: processReadCurrentReplyTelegram

 private void processReadCurrentReplyTelegram(Telegram replyTele)
 {
     if ((replyTele.type == TelegramType.DeviceFailure) && replyTele.UserDataExt.hasStoredValue("SentData"))
     {
         showLocalLog(((string) replyTele.UserDataExt["SentData"]) + "\n");
         showLocalLog("< " + ((TelegramType) replyTele.type).ToString() + "\n");
         statusBarPanel4.Step();
     }
     else if (replyTele.type == TelegramType.SeriesEndOK)
     {
         statusBarPanel4.Reset();
         showLocalLog("\n");
     }
     else
     {
         double num;
         byte[] buffer;
         if ((replyTele.data.NumItems > 0) && (replyTele.data[0] == 0x20))
         {
             if (replyTele.UserDataExt.hasStoredValue("SentData"))
             {
                 showLocalLog(((string) replyTele.UserDataExt["SentData"]) + "\n");
                 showLocalLog("< " + WDSConverters.ToHexString(replyTele.data.Buf, replyTele.data.NumItems) + "\n");
                 statusBarPanel4.Step();
             }
             buffer = new byte[4];
             Array.ConstrainedCopy(replyTele.data.Buf, 3, buffer, 0, 4);
             Array.Reverse(buffer, 0, 4);
             num = BitConverter.ToUInt32(buffer, 0);
             num /= 1000000.0;
         }
         else
         {
             buffer = new byte[replyTele.data.Capacity];
             replyTele.data.Buf.CopyTo(buffer, 0);
             Array.Reverse(buffer, 1, 2);
             num = BitConverter.ToUInt16(buffer, 1);
             num = (num * 31.25) / 20000000.0;
         }
         if (num >= 0.001)
         {
             num *= 1000.0;
             tsrMainToolStrip.setCurrentText(num.ToString("###.###") + " mA");
         }
         else
         {
             tsrMainToolStrip.setCurrentText(((num * 1000000.0)).ToString("###.###") + " \x00b5A");
         }
     }
 }
开发者ID:x893,项目名称:WDS,代码行数:50,代码来源:AppWin_SPITool_PRO.cs

示例9: ProcessReceivedTelegram

        private void ProcessReceivedTelegram(Telegram command, Telegram reply)
        {
            try
            {
                switch (_task_id)
                {
                    case Task.None:
                    case Task.ACK:
                    case Task.NACK:
                    case Task.SetVoltage:
                    case Task.ReadCurrent:
                    case Task.Reset:
                    case Task.IdentifyStart:
                    case Task.IdentifyStop:
                    case Task.SingleRegisterIO:
                        return;

                    case Task.MultipleRegisterIO:
                        if (reply.type == TelegramType.DataAcknowledgeOK)
                        {
                            if (isWriteCommand(command))
                            {
                                break;
                            }
                            _myDev.Registers[reply.userData].CurrentValue = getDeviceData(command, reply);
                            _myDev.Registers[reply.userData].DeviceValue = getDeviceData(command, reply);
                            if (!_isSeries)
                            {
                                repaintRegisterRowColors(reply.userData);
                            }
                        }
                        goto Label_014F;

                    case Task.Batch1:
                        statusBarPanel4.Step();
                        if (chbLoopB1.Checked)
                        {
                            _telegramSeriesReplyConuter++;
                            if (_series.ItemNum <= _telegramSeriesReplyConuter)
                            {
                                _telegramSeriesReplyConuter = 0;
                                int num = Convert.ToInt32(txbLoopCount.Text) + 1;
                                txbLoopCount.Text = num.ToString();
                                myFormStatus.LoopNum = num.ToString();
                            }
                        }
                        return;

                    case Task.Batch2:
                        statusBarPanel4.Step();
                        if (chbLoopB2.Checked)
                        {
                            _telegramSeriesReplyConuter++;
                            if (_series.ItemNum <= _telegramSeriesReplyConuter)
                            {
                                _telegramSeriesReplyConuter = 0;
                                int num2 = Convert.ToInt32(txbLoopCount.Text) + 1;
                                txbLoopCount.Text = num2.ToString();
                                myFormStatus.LoopNum = num2.ToString();
                            }
                        }
                        return;

                    case Task.Batch3:
                        statusBarPanel4.Step();
                        if (chbLoopB3.Checked)
                        {
                            _telegramSeriesReplyConuter++;
                            if (_series.ItemNum <= _telegramSeriesReplyConuter)
                            {
                                _telegramSeriesReplyConuter = 0;
                                int num3 = Convert.ToInt32(txbLoopCount.Text) + 1;
                                txbLoopCount.Text = num3.ToString();
                                myFormStatus.LoopNum = num3.ToString();
                            }
                        }
                        return;

                    case Task.Batch4:
                        statusBarPanel4.Step();
                        if (chbLoopB4.Checked)
                        {
                            _telegramSeriesReplyConuter++;
                            if (_series.ItemNum <= _telegramSeriesReplyConuter)
                            {
                                _telegramSeriesReplyConuter = 0;
                                int num4 = Convert.ToInt32(txbLoopCount.Text) + 1;
                                txbLoopCount.Text = num4.ToString();
                                myFormStatus.LoopNum = num4.ToString();
                            }
                        }
                        return;

                    case Task.FIFOWrite:
                        statusBarPanel4.Step();
                        return;

                    case Task.FIFORead:
                    {
                        if (reply.userData == -1)
//.........这里部分代码省略.........
开发者ID:x893,项目名称:WDS,代码行数:101,代码来源:AppWin_SPITool_PRO.cs

示例10: send_Script

 private int send_Script(List<string> commandSet, int delay, string commandName)
 {
     try
     {
         this._series.clear();
         for (int i = 0; i < commandSet.Count; i++)
         {
             this._tele = new Telegram(commandSet[i].Length);
             this._tele.uniqId = GlobalServices.uniqTelegramId();
             this._tele.parentUniqId = -1;
             this._tele.type = TelegramType.Command;
             this._tele.protocol = Protocol.WriteRead;
             string reply = null;
             this._tele.replySize = GlobalServices.calculateExpextedReplyLen(commandSet[i], ref reply);
             if (this._tele.replySize == -1)
             {
                 throw new Exception("Not supported command.");
             }
             this._tele.data.copy(commandSet[i]);
             this._tele.userData = -1;
             this._tele.portHandler = this._ioph;
             this._tele.mainWin = this;
             this._series.addTelegram(this._tele);
         }
         if (delay > 0)
         {
             this._series.addDelay(delay);
         }
         if (this._series.ItemNum == 0)
         {
             return 0;
         }
         if (this._ioph.telegramSeriesFromMainWin(this._series, SeriesExecutionState.Run, true) == 0)
         {
             this._isDeviceBusy = true;
             this.lockDeviceButtons(ExceptedBtn.None);
             GlobalServices.LogMsg(this._appId, commandName + " Series started");
             return 0;
         }
         GlobalServices.ErrMsg(this._appId, commandName + "error at sending user scripts to the Device!");
         return -1;
     }
     catch (Exception exception)
     {
         GlobalServices.ErrMsg(this._appId, "Error at sending " + commandName + " Commands!\n" + exception.Message);
         GlobalServices.msgBox("Error at sending " + commandName + " Commands!\n" + exception.Message, "Error!");
         return -1;
     }
 }
开发者ID:x893,项目名称:WDS,代码行数:49,代码来源:AppWin_Si4420_CP.cs

示例11: processFIFOReadIO

 private void processFIFOReadIO(Telegram replyTele)
 {
     try
     {
         if ((replyTele.type == TelegramType.DeviceFailure) && replyTele.UserDataExt.hasStoredValue("SentData"))
         {
             showLocalLog(((string) replyTele.UserDataExt["SentData"]) + "\n");
             showLocalLog("< " + ((TelegramType) replyTele.type).ToString() + "\n");
             statusBarPanel4.Step();
         }
         else if (replyTele.type == TelegramType.SeriesEndOK)
         {
             statusBarPanel4.Reset();
             showLocalLog("\n");
             if (tsrMainToolStrip.IsContCurrentReadOn)
             {
                 base.BeginInvoke(new EventHandler(tsrMainToolStrip_AmmeteringRequested), new object[2]);
             }
         }
         else
         {
             int num = 0;
             int num2 = 0;
             int num3 = 0;
             for (int i = 0; i < _myDev.RxPufferSize; i++)
             {
                 byte num5;
                 if ((i + 2) < replyTele.data.NumItems)
                 {
                     byte num4 = replyTele.data[i + 2];
                     num++;
                     dgvRX.Rows[i].Cells[1].Value = num4.ToString("X2");
                     if (byte.TryParse(dgvRX.Rows[i].Cells[2].Value.ToString(), NumberStyles.HexNumber, (IFormatProvider) null, out num5) && (num4 != num5))
                     {
                         num2++;
                         byte num7 = 0x80;
                         int num8 = 0;
                         while (num8 < 8)
                         {
                             if (((num4 ^ num5) & num7) != 0)
                             {
                                 num3++;
                             }
                             num8++;
                             num7 = (byte) (num7 >> 1);
                         }
                     }
                 }
                 else
                 {
                     dgvRX.Rows[i].Cells[1].Value = string.Empty;
                     if (byte.TryParse(dgvRX.Rows[i].Cells[2].Value.ToString(), NumberStyles.HexNumber, (IFormatProvider) null, out num5))
                     {
                         num2++;
                         num3 += 8;
                     }
                 }
             }
             txbPackets.Text = num.ToString();
             txbLost.Text = num2.ToString();
             txbPER.Text = Math.Round((double) (((double) num2) / ((double) num)), 4).ToString();
             txbDatabits.Text = (num * 8).ToString();
             txbBitErrors.Text = num3.ToString();
             txbBER.Text = Math.Round((double) (((double) num3) / ((double) (num * 8))), 4).ToString();
             if (replyTele.UserDataExt.hasStoredValue("SentData"))
             {
                 showLocalLog(((string) replyTele.UserDataExt["SentData"]) + "\n");
                 showLocalLog("< " + WDSConverters.ToHexString(replyTele.data.Buf, replyTele.data.NumItems) + "\n");
                 statusBarPanel4.Step();
             }
         }
     }
     catch (Exception exception)
     {
         _log.Error("FIFO read IO processing problem! " + exception.Message);
     }
 }
开发者ID:x893,项目名称:WDS,代码行数:77,代码来源:AppWin_SPITool_PRO.cs

示例12: send_Nack

 private int send_Nack()
 {
     try
     {
         Telegram telegram = new Telegram(0) {
             uniqId = GlobalServices.uniqTelegramId(),
             parentUniqId = -1,
             type = TelegramType.Command,
             lastReplyPrecondition = _lastReplyPec,
             protocol = Protocol.DCP,
             DCPCmdSet = 0,
             DCPMsgType = 0x80,
             replySize = 0x19
         };
         if (telegram.replySize == -1)
         {
             throw new Exception("Not supported command.");
         }
         telegram.userData = 2;
         telegram.portHandler = _mainWin._ioph;
         telegram.mainWin = _mainWin;
         _mainWin.showLocalLog("> NACK\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,代码行数:34,代码来源:AppWin_SPITool_PRO.cs

示例13: oldTelegramFromPortHandler

        public int oldTelegramFromPortHandler(Telegram telegram)
        {
            if (telegram.type == TelegramType.Command)
            {
                _closeCtrl.portHandlerClosed(telegram.portHandler);
                return 0;
            }
            if (telegram.type == TelegramType.DeviceFailure)
            {
                GlobalServices.ErrMsg(_appId, "telegramFromPortHandler(): DeviceFailure received");
                _ioph.controlSeriesExecution(SeriesExecutionState.Stop);
                statusBarPanel4.Reset();
                sbDeviceStatePane.Text = "Status: DeviceFailure";
                return -1;
            }
            if (_isSeries)
            {
                string str = "";
                if (_series.findTelegram(telegram.parentUniqId) != null)
                {
                    str = _series.findTelegram(telegram.parentUniqId).data.objectInfo(false);
                }
                GlobalServices.LogMsg(_appId, str + telegram.data.objectInfo(false));
            }
            else
            {
                GlobalServices.LogMsg(_appId, "|--->\n\tWindow->Device:   " + _tele.data.objectInfo(false) + "\n\tWindow<-Device:   " + telegram.data.objectInfo(false));
            }
            switch (telegram.type)
            {
                case TelegramType.AcknowledgeOK:
                    showLocalLog(telegram.data.objectInfo(false) + "\n");
                    break;

                case TelegramType.AcknowledgeERROR:
                    showLocalLog(telegram.data.objectInfo(false) + "\n");
                    break;

                case TelegramType.DataAcknowledgeOK:
                    showLocalLog(telegram.data.objectInfo(false) + "\n");
                    break;

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

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

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

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

                default:
                    showLocalLog("Unexpected telegram type received: " + ((TelegramType) telegram.type).ToString());
                    break;
            }
            if ((telegram.type != TelegramType.SeriesEndOK) && (telegram.type != TelegramType.SeriesEndERROR))
            {
                ProcessReceivedTelegram(_tele, telegram);
            }
            else
            {
                base._isDeviceBusy = false;
                statusBarPanel4.Reset();
                if (telegram.type != TelegramType.SeriesEndOK)
                {
                    statusBarPanel4.Reset();
                    ButtonLock(false);
                    sbDeviceStatePane.Text = "Status: SeriesEnd Error";
                }
                else
                {
                    ButtonLock(false);
                    switch (_task_id)
                    {
                        case Task.SetVoltage:
                            _task_id = Task.None;
                            if (!_isReadCurrentOnChange)
                            {
                                tsrMainToolStrip.setCurrentText("? \x00b5A");
                            }
                            break;

                        case Task.Reset:
                            if (!_isReadCurrentOnChange)
                            {
                                tsrMainToolStrip.setCurrentText("? \x00b5A");
                            }
                            break;

                        case Task.SingleRegisterIO:
                            if (!_isReadCurrentOnChange)
                            {
                                tsrMainToolStrip.setCurrentText("? \x00b5A");
//.........这里部分代码省略.........
开发者ID:x893,项目名称:WDS,代码行数:101,代码来源:AppWin_SPITool_PRO.cs

示例14: tsrMainToolStrip_ResetRequested

 private void tsrMainToolStrip_ResetRequested(object sender, EventArgs e)
 {
     if ((DialogResult.Yes == MessageBox.Show("Chip configuration will be changed to the POR values!\nDo you want to proceed?", "Warning!", MessageBoxButtons.YesNo)) && !this._isDeviceBusy)
     {
         string command = "S2";
         command = (command + "FE") + "00" + "\r";
         this._task_id = Task.SWReset;
         try
         {
             this._series.clear();
             string reply = null;
             this._tele = new Telegram(command.Length);
             this._tele.uniqId = GlobalServices.uniqTelegramId();
             this._tele.parentUniqId = -1;
             this._tele.type = TelegramType.Command;
             this._tele.protocol = Protocol.WriteRead;
             this._tele.replySize = GlobalServices.calculateExpextedReplyLen(command, ref reply);
             if (this._tele.replySize == -1)
             {
                 throw new Exception("Not supported command.");
             }
             this._tele.data.copy(command);
             this._tele.userData = 2;
             this._tele.portHandler = this._ioph;
             this._tele.mainWin = this;
             this._series.addTelegram(this._tele);
             if (this._ioph.telegramSeriesFromMainWin(this._series, SeriesExecutionState.Run, true) == 0)
             {
                 this._isDeviceBusy = true;
                 this.lockDeviceButtons(ExceptedBtn.None);
                 GlobalServices.LogMsg(this._appId, "SWReset Series started");
             }
             else
             {
                 GlobalServices.ErrMsg("IO operation failed", "SW Reset");
             }
         }
         catch (Exception exception)
         {
             GlobalServices.ErrMsg(this._appId, "Error at sending Set Voltage Command!\n" + exception.Message);
             GlobalServices.msgBox("Error at sending Set Voltage Command!\n" + exception.Message, "Error!");
         }
     }
 }
开发者ID:x893,项目名称:WDS,代码行数:44,代码来源:AppWin_Si4420_CP.cs

示例15: telegramFromPortHandler

        public int telegramFromPortHandler(Telegram telegram)
        {
            switch (telegram.type)
            {
                case TelegramType.AcknowledgeOK:
                    switch (telegram.protocol)
                    {
                        case Protocol.Write:
                            this.lsbRegisterLog.Items.Insert(0, "Transmit OK");
                            goto Label_02C4;

                        case Protocol.WriteRegister:
                            this.lsbRegisterLog.Items.Insert(0, "Write Register OK: address=" + this._regAddr.ToString("X") + " value=" + this._regVal.ToString("X"));
                            goto Label_02C4;
                    }
                    GlobalServices.ErrMsg("AppWin_EZLinkTest.telegramFromPortHandler", "Unexpected protocol in handling AcknowledgeOK");
                    return -1;

                case TelegramType.AcknowledgeERROR:
                case TelegramType.DataAcknowledgeERROR:
                case TelegramType.DeviceFailure:
                    GlobalServices.ErrMsg("AppWin_EZLinkTest.telegramFromPortHandler", "ERROR status received:  type: " + ((TelegramType) telegram.type).ToString() + "   protocol: " + telegram.protocol.ToString() + "   error code: " + ((int) telegram.userData).ToString("X"));
                    this.chbAutoTxmt.Checked = false;
                    this.chbRxOnIdle.Checked = false;
                    return -1;

                case TelegramType.DataAcknowledgeOK:
                    string str;
                    switch (telegram.protocol)
                    {
                        case Protocol.ReadRegister:
                            uint num;
                            uint num2;
                            telegram.data.appWin_getReply_ReadRegister(out num, out num2);
                            this.lsbRegisterLog.Items.Insert(0, "Read Register OK: Address=" + num.ToString("X") + "   data=" + num2.ToString("X"));
                            goto Label_02C4;

                        case Protocol.ReadStatus:
                            telegram.data.appWin_getReply_ReadStatus(out str);
                            this.lsbRegisterLog.Items.Insert(0, "Read Status OK: " + str);
                            goto Label_02C4;

                        case Protocol.Read:
                            telegram.data.appWin_getReply_Receive(out str);
                            this.lsbMessageLog.Items.Insert(0, "Receive OK: " + str);
                            goto Label_02C4;
                    }
                    GlobalServices.ErrMsg("AppWin_EZLinkTest.telegramFromPortHandler", "Unexpected protocol in handling DataAcknowledgeOK");
                    return -1;

                case TelegramType.SeriesEndOK:
                    this.lsbRegisterLog.Items.Insert(0, "Series terminated with OK");
                    break;

                case TelegramType.SeriesEndERROR:
                    this.lsbRegisterLog.Items.Insert(0, "Series terminated with ERROR");
                    break;

                case TelegramType.PortHandlerTerminated:
                    this._closeCtrl.portHandlerClosed(telegram.portHandler);
                    return 0;

                default:
                    GlobalServices.ErrMsg("AppWin_EZLinkTest.telegramFromPortHandler", "Unexpected telegram type received:  type: " + ((TelegramType) telegram.type).ToString() + "   protocol: " + telegram.protocol.ToString());
                    return -1;
            }
            Label_02C4:
            return 0;
        }
开发者ID:x893,项目名称:WDS,代码行数:69,代码来源:AppWin_EZLinkTest.cs


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