示例#1
0
 public void DecodeInternal()
 {
     while (RunDecodeThread)
     {
         if (Decode)
         {
             List <Original> list = RxQueue.PopAll();
             {
                 if (list != null && list.Count > 0)
                 {
                     foreach (var o in list)
                     {
                         OriginalBytes obytes = o as OriginalBytes;
                         if (o != null)
                         {
                             MotorProtocol     mp           = motorProtocol.DePackage(obytes.Data);
                             byte[]            data         = mp.CodeRegion;
                             byte              commandCode  = data[0];
                             byte              additionCode = data[1];
                             MotorBaseResponse mr           = Decoders[commandCode].Decode(obytes);
                             if (mr != null)
                             {
                                 RxMsgQueue.Push(mr);
                                 LogHelper.GetLogger <LaserProtocolFactory>().Error(string.Format("接受到的原始数据为: {0}",
                                                                                                  ByteHelper.Byte2ReadalbeXstring(obytes.Data)));
                             }
                         }
                     }
                 }
             }
         }
         Thread.Sleep(10);
     }
 }
示例#2
0
 public void DecodeInternal()
 {
     while (RunDecodeThread)
     {
         if (Decode)
         {
             List <Original> list = RxQueue.PopAll();
             if (list != null && list.Count > 0)
             {
                 foreach (var o in list)
                 {
                     OriginalBytes obytes = o as OriginalBytes;
                     if (o != null)
                     {
                         LaserProtocol lp       = laserProtocol.DePackage(obytes.Data);
                         byte[]        data     = lp.Body;
                         byte          markHead = data[0];
                         byte          type     = GetMsgType();
                         byte[]        appData  = new byte[data.Length - 2];
                         Array.Copy(data, 1, appData, 0, data.Length - 2);
                         LaserBasePackage         bp           = new LaserBasePackage(markHead, type, appData);
                         List <LaserBaseResponse> responseList = Decoder.Decode(bp, obytes);
                         if (responseList != null && responseList.Count > 0)
                         {
                             RxMsgQueue.Push(responseList);
                         }
                         LogHelper.GetLogger <LaserProtocolFactory>().Error(string.Format("接受到的原始数据为: {0}",
                                                                                          ByteHelper.Byte2ReadalbeXstring(obytes.Data)));
                     }
                 }
             }
         }
         Thread.Sleep(10);
     }
 }
示例#3
0
 public void DecodeInternal()
 {
     while (RunDecodeThread)
     {
         if (Decode)
         {
             List <Original> list = RxQueue.PopAll();
             if (list != null && list.Count > 0)
             {
                 foreach (var o in list)
                 {
                     OriginalBytes obytes = o as OriginalBytes;
                     if (o != null && obytes.Data.Count() == 6)
                     {
                         LaserBaseResponse responseList = Decoder.Decode(obytes);
                         if (responseList != null)
                         {
                             RxMsgQueue.Push(responseList);
                         }
                         //LogHelper.GetLogger<LaserProtocolFactory>().Error(string.Format("接受到的原始数据为: {0}",
                         //        ByteHelper.Byte2ReadalbeXstring(obytes.Data)));
                     }
                 }
             }
         }
         Thread.Sleep(10);
     }
 }
示例#4
0
文件: FctRule.cs 项目: marlonnn/VPI
        public FctRule(Cabinet cabinet, RxMsgQueue rxMsgQueue)
        {
            this.cabinet = cabinet;
            this.rxMsgQueue = rxMsgQueue;

            //错误计数全部置零
            foreach (var r in cabinet.Racks)
            {
                foreach (var b in r.Boards)
                {
                    foreach (var ct in b.ComponentTypes)
                    {
                        foreach (var c in ct.Components)
                        {
                            componentErrorPackageTimes.Add(c, 0);
                            componentLostPackageTimes.Add(c, 0);
                            componentInterruptTimes.Add(c, 0);
                            c.AllTestTimes = 0;
                            c.ErrorPackageTimes = 0;
                            c.LostPackageTimes = 0;
                            c.InterruptTimes = 0;
                        }
                    }
                }
            }
        }
示例#5
0
 public GeneralRule(Cabinet cabinet, RxMsgQueue rxMsgQueue, Dictionary<Board, Board[]> matrix)
     : base(cabinet, rxMsgQueue)
 {
     this.matrix = matrix;
 }