Exemple #1
0
 public void ProcessBroadCastingInfo(CommObj commObj)
 {
     // 视觉端发送,PLC端接收
     if (commObj.SrcId == 0x10 && commObj.DestId == 0x30)
     {
         if (commObj.DataType.Equals("PLCControlObj"))
         {
             PLCControlObj plcControlObj = PLCControlObj.FromByteJson(commObj.DataBody);
             SendToPLC(PLCControlObj.ToBytes(plcControlObj));
             allSendCount++;
         }
     }
 }
        public void FromByteJsonTest()
        {
            string        json1 = "\"AAAD6AABAMgAAAEsAAAD6A==\"";
            PLCControlObj obj   = PLCControlObj.FromByteJson(json1);

            Assert.AreEqual(obj.XDir, 0);
            Assert.AreEqual(obj.XVal, 1000);
            Assert.AreEqual(obj.YDir, 1);
            Assert.AreEqual(obj.YVal, 200);
            Assert.AreEqual(obj.ZDir, 0);
            Assert.AreEqual(obj.ZVal, 300);
            Assert.AreEqual(obj.RDir, 0);
            Assert.AreEqual(obj.RVal, 1000);
        }