Kaynağa Gözat

增加RMCA指令(只是指令,还未调用)

:q
chenjiangqun 2 yıl önce
ebeveyn
işleme
392b27ba19
1 değiştirilmiş dosya ile 43 ekleme ve 0 silme
  1. 43 0
      FactoryTool_CShare/IO/SerialCMD.cs

+ 43 - 0
FactoryTool_CShare/IO/SerialCMD.cs

@@ -3201,5 +3201,48 @@ namespace MOKA_Factory_Tools
                 l++;
             }
         }
+
+        public static bool SetRMCA(SerialPort Comport, byte[] param, out byte[] result, out byte[] data, out string error, int waitTime)
+        {
+            return SendcmdEx(Comport, new byte[] { 0xAA, 0xFE }, new byte[] { 0xFC, 0x00, 0x18 }, param, false, false, out result, out data, out error, waitTime);
+        }
+
+        public static bool CheckRMCA(SerialPort Comport, out byte[] result, out byte[] data, out string error, int waitTime)
+        {
+            if (SendcmdEx(Comport, new byte[] { 0xAA }, new byte[] { 0xFC, 0x01, 0x18 }, new byte[] { }, true, false, out result, out data, out error, waitTime))
+            {
+                if (data.Length == 3 && data[0] == 0x02 && data[1] == 0x18 && data[2] == 0x01)
+                    return true;
+                else
+                {
+                    error = "Playready return status fail,should be 0x02,0x18,0x01";
+                    return false;
+                }
+
+            }
+            else
+                return false;
+        }
+
+        public static bool ReadRMCA(SerialPort Comport, out byte[] result, out byte[] data, out string error, int waitTime)
+        {
+            if (SendcmdEx(Comport, new byte[] { 0xAA }, new byte[] { 0xFC, 0x03, 0x18 }, new byte[] { }, true, true, out result, out data, out error, waitTime))
+            {
+                if (data[0] == 0x04 && data[1] == 0x18)
+                {
+                    data = data.Skip(2).Take(data.Length - 2).ToArray();
+                    return true;
+                }
+                else
+                {
+                    error = "返回Playready类型错误,应为0x04, 0x18";
+                    return false;
+                }
+
+            }
+            else
+                return false;
+
+        }
     }
 }