Forráskód Böngészése

1、添加Kayla测试平台配置项。2、完善小米FireTV功能项,只有ETMac、WifiMac、BTMac、DSN 4个key才需要抄写,其他不需要处理。

sat23 3 éve
szülő
commit
77a4757f78

+ 13 - 2
FactoryTool_CShare/Models/StructList.cs

@@ -229,6 +229,10 @@ namespace MOKA_Factory_Tools
         /// </summary>
         /// </summary>
         public bool MITVEnable { get; set; } = false;
         public bool MITVEnable { get; set; } = false;
         #endregion
         #endregion
+
+        #region Kayla测试平台;
+        public bool Kayla { get; set; } = false;
+        #endregion
     }
     }
 
 
     public class KeyInfo
     public class KeyInfo
@@ -548,13 +552,19 @@ namespace MOKA_Factory_Tools
         public string FWVersion_2;
         public string FWVersion_2;
         public string OPName;
         public string OPName;
         public string TVMN;
         public string TVMN;
-        public string EthernetMac;        
-        public string BTMac;
         public string EAN;
         public string EAN;
         public string SKU;
         public string SKU;
         public string DeviceID;
         public string DeviceID;
         public string OPSN;
         public string OPSN;
+        // 实际只抄写以下4项;
+        public string EthernetMac;        
+        public string BTMac;
+        public string WifiMac;
         public string DSN;
         public string DSN;
+        // 内置值;
+        public string _PSN;
+        public int _HDCP14;
+        public int _HDCP22;
     }
     }
 
 
     public class ReportMIKey
     public class ReportMIKey
@@ -566,6 +576,7 @@ namespace MOKA_Factory_Tools
         public string ChipMN { set; get; } = "";
         public string ChipMN { set; get; } = "";
         public string EthernetMAC { set; get; } = "";
         public string EthernetMAC { set; get; } = "";
         public string BTMAC { set; get; } = "";
         public string BTMAC { set; get; } = "";
+        public string WifiMAC { set; get; } = "";
         public string HDCP14 { set; get; } = "";
         public string HDCP14 { set; get; } = "";
         public string HDCP22 { set; get; } = "";
         public string HDCP22 { set; get; } = "";
     }
     }

+ 12 - 0
FactoryTool_CShare/Views/Main.cs

@@ -782,6 +782,18 @@ namespace MOKA_Factory_Tools
                     SaveJsonConfig("MITVEnable", false);
                     SaveJsonConfig("MITVEnable", false);
                 }
                 }
                 #endregion
                 #endregion
+
+                #region G客户Kayla测试平台;
+                if (jObject["Kayla"] != null)
+                {
+                    functionSetting1.MITVEnable = jObject["Kayla"].Value<bool>();
+                }
+                else
+                {
+                    SaveJsonConfig("Kayla", false);
+                }
+                #endregion
+
                 foreach (var ss in jObject["Channel"])  //遍历Channel
                 foreach (var ss in jObject["Channel"])  //遍历Channel
                 {
                 {
                     Dictionary<string, string> ChannelValues = JsonConvert.DeserializeObject<Dictionary<string, string>>(ss.ToString());
                     Dictionary<string, string> ChannelValues = JsonConvert.DeserializeObject<Dictionary<string, string>>(ss.ToString());

+ 173 - 71
FactoryTool_CShare/Views/OperationPanel.cs

@@ -1519,11 +1519,11 @@ namespace MOKA_Factory_Tools
                 if (_MiKey.BTMac != null)
                 if (_MiKey.BTMac != null)
                     SetCheckboxStatus(WriteBTMac, false);
                     SetCheckboxStatus(WriteBTMac, false);
 
 
-                if (_MiKey.DeviceID != null)
-                    SetCheckboxStatus(WriteDID, false);
-
                 if (_MiKey.DSN != null)
                 if (_MiKey.DSN != null)
                     SetCheckboxStatus(WriteDSN, false);
                     SetCheckboxStatus(WriteDSN, false);
+
+                if (_MiKey.WifiMac != null)
+                    SetCheckboxStatus(WriteWifiMac, false);
             }
             }
             #endregion
             #endregion
 
 
@@ -1620,16 +1620,21 @@ namespace MOKA_Factory_Tools
             ReportMIKey reportMIKey = new ReportMIKey();
             ReportMIKey reportMIKey = new ReportMIKey();
             reportMIKey.EthernetMAC = _MiKey.EthernetMac;
             reportMIKey.EthernetMAC = _MiKey.EthernetMac;
             reportMIKey.BTMAC = _MiKey.BTMac;
             reportMIKey.BTMAC = _MiKey.BTMac;
-            reportMIKey.HDCP22 = "";
-            reportMIKey.HDCP14 = "";
-            reportMIKey.ChipMN = "";
-            reportMIKey.ChipSN = "";
-            reportMIKey.DSN = "";
-            reportMIKey.TVMN = "";
-            reportMIKey.TVSN = "";
+            reportMIKey.WifiMAC = _MiKey.WifiMac;
+            // 读取HDCP长度赋值;
+            reportMIKey.HDCP22 = _MiKey._HDCP22.ToString();
+            reportMIKey.HDCP14 = _MiKey._HDCP14.ToString();
+            // 返回的PSN作为ChipMN和ChipSN;
+            reportMIKey.ChipMN = _MiKey._PSN;
+            reportMIKey.ChipSN = _MiKey._PSN;
+            reportMIKey.DSN = _MiKey.DSN;
+            reportMIKey.TVMN = _MiKey.TVMN;
+            reportMIKey.TVSN = SN.Replace("/","");  // 去掉斜杠;
 
 
             if (!CommonMethod.ReportMIKey(reportMIKey, out msg))
             if (!CommonMethod.ReportMIKey(reportMIKey, out msg))
             {
             {
+                msg = string.Format("ReportMIKey error!\r\n{0}", msg);
+                Log.WriteErrorLog(msg);
                 return false;
                 return false;
             }
             }
 
 
@@ -2436,17 +2441,17 @@ namespace MOKA_Factory_Tools
                     keyInfo.BT_MAC = _MiKey.BTMac;
                     keyInfo.BT_MAC = _MiKey.BTMac;
                 }
                 }
 
 
-                if (_MiKey.DeviceID != null)
-                {
-                    SetCheckboxStatus(WriteDID, true);
-                    keyInfo.DID = _MiKey.DeviceID;
-                }
-
                 if (_MiKey.DSN != null)
                 if (_MiKey.DSN != null)
                 {
                 {
                     SetCheckboxStatus(WriteDSN, true);
                     SetCheckboxStatus(WriteDSN, true);
                     keyInfo.DSN = _MiKey.DSN;
                     keyInfo.DSN = _MiKey.DSN;
                 }
                 }
+
+                if (_MiKey.WifiMac != null)
+                {
+                    SetCheckboxStatus(WriteWifiMac, true);
+                    keyInfo.WiFi_MAC = _MiKey.WifiMac;
+                }
             }
             }
             #endregion
             #endregion
 
 
@@ -4560,121 +4565,218 @@ namespace MOKA_Factory_Tools
                 SetcolorStatus(ProductMsg_Text, Color.FromArgb(128, 255, 128));
                 SetcolorStatus(ProductMsg_Text, Color.FromArgb(128, 255, 128));
             }
             }
 
 
-            // DSN抄写:如果是G客户,要在抄写其他key前时行fsn+psn查重处理;
+            // DSN抄写;
             if (WriteDSN.Checked)
             if (WriteDSN.Checked)
             {
             {
-                // 计算函数耗时;
-                Stopwatch watch = new Stopwatch();
-                watch.Start();
-                if (SN == null)
-                {
-                    MessageBox.Show("Please scan to trigger testing");
-                    goto end;
-                }
-                if (SN.Trim().Length == 0)
-                {
-                    MessageBox.Show("Please scan to trigger testing");
-                    goto end;
-                }
-                Log.WriteInfoLog("Read FireTV Device Code...\r\n");
-                if (SerialCMD.GetFireTVDevcieCode(TVPort, out result, out data, out error, SerailDelay))
-                {
-                    string devicecode = Encoding.ASCII.GetString(data);
-                    if (devicecode == "N/A")
+                if (FunctionSettingNow.MITVEnable)
+                {// 小米的DSN抄写不用这么多处理;
+                    if (!CommonMethod.IsNumberAndWord(keyInfo.DSN))
                     {
                     {
-                        ErrMsg = string.Format("Device code format error!\r\n{0}", devicecode);
+                        ErrMsg = string.Format("DSN format error!\r\n{0}", keyInfo.DSN);
                         Log.WriteErrorLog(ErrMsg);
                         Log.WriteErrorLog(ErrMsg);
                         goto end;
                         goto end;
                     }
                     }
-
-                    // 先读取psn的值;
-                    byte[] result_psn;
-                    byte[] data_psn;
-                    string error_psn;
-                    if (SerialCMD.ReadFireTVPSN(TVPort, out result_psn, out data_psn, out error_psn, SerailDelay))
+                    byte[] DSNData = System.Text.Encoding.ASCII.GetBytes(keyInfo.DSN);
+                    Log.WriteInfoLog("Write DSN...");
+                    if (SerialCMD.SetFireTVDSN(TVPort, DSNData, out result, out data, out error, SerailDelay))
                     {
                     {
-                        string psn = Encoding.ASCII.GetString(data_psn);
-                        if (CommonMethod.GetFireTVDsn(midListNow.host, orderNow, Encoding.ASCII.GetString(data), SN, psn, out string dsn, out error_psn, errorDBNow))
+                        SetsuccessStatus(m_writeDSN);
+                        Log.WriteInfoLog("Check DSN...");
+                        if (writeCheckNow.DSNCheckcheck ? SerialCMD.CheckFireTVDSN(TVPort, out result, out data, out error, SerailDelay) : true)
                         {
                         {
-                            keyInfo.DSN = dsn;
-                            if (!CommonMethod.IsNumberAndWord(keyInfo.DSN))
+                            SetsuccessStatus(m_checkDSN);
+                            Log.WriteInfoLog("Read DSN...");
+                            if (readCheckNow.DSNReadcheck ? SerialCMD.GetFireTVDSN(TVPort, out result, out data, out error, SerailDelay) : true)
                             {
                             {
-                                ErrMsg = string.Format("DSN format error!\r\n{0}", keyInfo.DSN);
+                                if (SerialInit.BytesCompare_Base64(data, DSNData))
+                                {
+                                    SetsuccessStatus(m_readDSN);
+                                    //DSN读取别对成功
+                                }
+                                else
+                                {
+                                    SetfailStatus(m_readDSN);
+                                    ErrMsg = string.Format("{0}  contrast DSN fail!", SN);
+                                    Log.WriteErrorLog(ErrMsg);
+                                    goto end;
+                                }
+                            }
+                            else
+                            {
+                                SetfailStatus(m_readDSN);
+                                ErrMsg = string.Format("{0}  read DSN fail!", SN);
                                 Log.WriteErrorLog(ErrMsg);
                                 Log.WriteErrorLog(ErrMsg);
                                 goto end;
                                 goto end;
                             }
                             }
-                            byte[] DSNData = System.Text.Encoding.ASCII.GetBytes(keyInfo.DSN);
-                            Log.WriteInfoLog("Write DSN...");
-                            if (SerialCMD.SetFireTVDSN(TVPort, DSNData, out result, out data, out error, SerailDelay))
+                        }
+                        else
+                        {
+                            SetfailStatus(m_checkDSN);
+                            ErrMsg = string.Format("{0}  check DSN fail!", SN);
+                            Log.WriteErrorLog(ErrMsg);
+                            goto end;
+                        }
+                    }
+                    else
+                    {
+                        SetfailStatus(m_writeDSN);
+                        ErrMsg = string.Format("{0}  Write DSN fail!", SN);
+                        Log.WriteErrorLog(ErrMsg);
+                        goto end;
+                    }
+                }
+                else
+                {// 如果是G客户,要在抄写其他key前时行fsn+psn查重处理;
+                    // 计算函数耗时;
+                    Stopwatch watch = new Stopwatch();
+                    watch.Start();
+                    if (SN == null)
+                    {
+                        MessageBox.Show("Please scan to trigger testing");
+                        goto end;
+                    }
+                    if (SN.Trim().Length == 0)
+                    {
+                        MessageBox.Show("Please scan to trigger testing");
+                        goto end;
+                    }
+                    Log.WriteInfoLog("Read FireTV Device Code...\r\n");
+                    if (SerialCMD.GetFireTVDevcieCode(TVPort, out result, out data, out error, SerailDelay))
+                    {
+                        string devicecode = Encoding.ASCII.GetString(data);
+                        if (devicecode == "N/A")
+                        {
+                            ErrMsg = string.Format("Device code format error!\r\n{0}", devicecode);
+                            Log.WriteErrorLog(ErrMsg);
+                            goto end;
+                        }
+
+                        // 先读取psn的值;
+                        byte[] result_psn;
+                        byte[] data_psn;
+                        string error_psn;
+                        if (SerialCMD.ReadFireTVPSN(TVPort, out result_psn, out data_psn, out error_psn, SerailDelay))
+                        {
+                            string psn = Encoding.ASCII.GetString(data_psn);
+                            if (CommonMethod.GetFireTVDsn(midListNow.host, orderNow, Encoding.ASCII.GetString(data), SN, psn, out string dsn, out error_psn, errorDBNow))
                             {
                             {
-                                SetsuccessStatus(m_writeDSN);
-                                Log.WriteInfoLog("Check DSN...");
-                                if (writeCheckNow.DSNCheckcheck ? SerialCMD.CheckFireTVDSN(TVPort, out result, out data, out error, SerailDelay) : true)
+                                keyInfo.DSN = dsn;
+                                if (!CommonMethod.IsNumberAndWord(keyInfo.DSN))
+                                {
+                                    ErrMsg = string.Format("DSN format error!\r\n{0}", keyInfo.DSN);
+                                    Log.WriteErrorLog(ErrMsg);
+                                    goto end;
+                                }
+                                byte[] DSNData = System.Text.Encoding.ASCII.GetBytes(keyInfo.DSN);
+                                Log.WriteInfoLog("Write DSN...");
+                                if (SerialCMD.SetFireTVDSN(TVPort, DSNData, out result, out data, out error, SerailDelay))
                                 {
                                 {
-                                    SetsuccessStatus(m_checkDSN);
-                                    Log.WriteInfoLog("Read DSN...");
-                                    if (readCheckNow.DSNReadcheck ? SerialCMD.GetFireTVDSN(TVPort, out result, out data, out error, SerailDelay) : true)
+                                    SetsuccessStatus(m_writeDSN);
+                                    Log.WriteInfoLog("Check DSN...");
+                                    if (writeCheckNow.DSNCheckcheck ? SerialCMD.CheckFireTVDSN(TVPort, out result, out data, out error, SerailDelay) : true)
                                     {
                                     {
-                                        if (SerialInit.BytesCompare_Base64(data, DSNData))
+                                        SetsuccessStatus(m_checkDSN);
+                                        Log.WriteInfoLog("Read DSN...");
+                                        if (readCheckNow.DSNReadcheck ? SerialCMD.GetFireTVDSN(TVPort, out result, out data, out error, SerailDelay) : true)
                                         {
                                         {
-                                            SetsuccessStatus(m_readDSN);
-                                            //DSN读取别对成功
+                                            if (SerialInit.BytesCompare_Base64(data, DSNData))
+                                            {
+                                                SetsuccessStatus(m_readDSN);
+                                                //DSN读取别对成功
+                                            }
+                                            else
+                                            {
+                                                SetfailStatus(m_readDSN);
+                                                ErrMsg = string.Format("{0}  contrast DSN fail!", SN);
+                                                Log.WriteErrorLog(ErrMsg);
+                                                goto end;
+                                            }
                                         }
                                         }
                                         else
                                         else
                                         {
                                         {
                                             SetfailStatus(m_readDSN);
                                             SetfailStatus(m_readDSN);
-                                            ErrMsg = string.Format("{0}  contrast DSN fail!", SN);
+                                            ErrMsg = string.Format("{0}  read DSN fail!", SN);
                                             Log.WriteErrorLog(ErrMsg);
                                             Log.WriteErrorLog(ErrMsg);
                                             goto end;
                                             goto end;
                                         }
                                         }
                                     }
                                     }
                                     else
                                     else
                                     {
                                     {
-                                        SetfailStatus(m_readDSN);
-                                        ErrMsg = string.Format("{0}  read DSN fail!", SN);
+                                        SetfailStatus(m_checkDSN);
+                                        ErrMsg = string.Format("{0}  check DSN fail!", SN);
                                         Log.WriteErrorLog(ErrMsg);
                                         Log.WriteErrorLog(ErrMsg);
                                         goto end;
                                         goto end;
                                     }
                                     }
                                 }
                                 }
                                 else
                                 else
                                 {
                                 {
-                                    SetfailStatus(m_checkDSN);
-                                    ErrMsg = string.Format("{0}  check DSN fail!", SN);
+                                    SetfailStatus(m_writeDSN);
+                                    ErrMsg = string.Format("{0}  Write DSN fail!", SN);
                                     Log.WriteErrorLog(ErrMsg);
                                     Log.WriteErrorLog(ErrMsg);
                                     goto end;
                                     goto end;
                                 }
                                 }
                             }
                             }
                             else
                             else
                             {
                             {
-                                SetfailStatus(m_writeDSN);
-                                ErrMsg = string.Format("{0}  Write DSN fail!", SN);
+                                ErrMsg = string.Format("错误的PSN {0}", error_psn);
                                 Log.WriteErrorLog(ErrMsg);
                                 Log.WriteErrorLog(ErrMsg);
                                 goto end;
                                 goto end;
                             }
                             }
                         }
                         }
                         else
                         else
                         {
                         {
-                            ErrMsg = string.Format("错误的PSN {0}", error_psn);
+                            ErrMsg = string.Format("Failed to read PSN when requesting DSN !\r\n{0}", devicecode);
                             Log.WriteErrorLog(ErrMsg);
                             Log.WriteErrorLog(ErrMsg);
                             goto end;
                             goto end;
                         }
                         }
                     }
                     }
                     else
                     else
                     {
                     {
-                        ErrMsg = string.Format("Failed to read PSN when requesting DSN !\r\n{0}", devicecode);
+                        ErrMsg = string.Format("{0}     Get Device Code Error", SN);
                         Log.WriteErrorLog(ErrMsg);
                         Log.WriteErrorLog(ErrMsg);
                         goto end;
                         goto end;
                     }
                     }
+
+                    watch.Stop();
+                    Log.WriteInfoLog(string.Format("Write DSN Elapsed={0}", watch.Elapsed.TotalMilliseconds));
+                }
+            }
+
+            if (FunctionSettingNow.MITVEnable)
+            {
+                // 读取PSN;
+                byte[] result_psn;
+                byte[] data_psn;
+                if (SerialCMD.ReadFireTVPSN(TVPort, out result_psn, out data_psn, out error, SerailDelay))
+                {
+                    _MiKey._PSN = Encoding.ASCII.GetString(data_psn);
                 }
                 }
                 else
                 else
                 {
                 {
-                    ErrMsg = string.Format("{0}     Get Device Code Error", SN);
+                    ErrMsg = string.Format("读取PSN失败 {0}", error);
                     Log.WriteErrorLog(ErrMsg);
                     Log.WriteErrorLog(ErrMsg);
                     goto end;
                     goto end;
                 }
                 }
 
 
-                watch.Stop();
-                Log.WriteInfoLog(string.Format("Write DSN Elapsed={0}", watch.Elapsed.TotalMilliseconds));
+                // 读取HDCP;
+                if (!SerialCMD.GetHDCPKey(TVPort, out result, out data, out error, SerailDelay))
+                {
+                    ErrMsg = string.Format("读取HDCP失败 {0}", error);
+                    Log.WriteErrorLog(ErrMsg);
+                    goto end;
+                }
+
+                _MiKey._HDCP14 = data.Length;
+
+                // 读取HDCP;
+                if (!SerialCMD.GetHDCPKey22(TVPort, out result, out data, out error, SerailDelay))
+                {
+                    ErrMsg = string.Format("读取HDCP22失败 {0}", error);
+                    Log.WriteErrorLog(ErrMsg);
+                    goto end;
+                }
+
+                _MiKey._HDCP22 = data.Length;
             }
             }
 
 
             // 生成IDM报文;
             // 生成IDM报文;