|
@@ -1519,11 +1519,11 @@ namespace MOKA_Factory_Tools
|
|
|
if (_MiKey.BTMac != null)
|
|
|
SetCheckboxStatus(WriteBTMac, false);
|
|
|
|
|
|
- if (_MiKey.DeviceID != null)
|
|
|
- SetCheckboxStatus(WriteDID, false);
|
|
|
-
|
|
|
if (_MiKey.DSN != null)
|
|
|
SetCheckboxStatus(WriteDSN, false);
|
|
|
+
|
|
|
+ if (_MiKey.WifiMac != null)
|
|
|
+ SetCheckboxStatus(WriteWifiMac, false);
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
@@ -1620,16 +1620,21 @@ namespace MOKA_Factory_Tools
|
|
|
ReportMIKey reportMIKey = new ReportMIKey();
|
|
|
reportMIKey.EthernetMAC = _MiKey.EthernetMac;
|
|
|
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))
|
|
|
{
|
|
|
+ msg = string.Format("ReportMIKey error!\r\n{0}", msg);
|
|
|
+ Log.WriteErrorLog(msg);
|
|
|
return false;
|
|
|
}
|
|
|
|
|
@@ -2436,17 +2441,17 @@ namespace MOKA_Factory_Tools
|
|
|
keyInfo.BT_MAC = _MiKey.BTMac;
|
|
|
}
|
|
|
|
|
|
- if (_MiKey.DeviceID != null)
|
|
|
- {
|
|
|
- SetCheckboxStatus(WriteDID, true);
|
|
|
- keyInfo.DID = _MiKey.DeviceID;
|
|
|
- }
|
|
|
-
|
|
|
if (_MiKey.DSN != null)
|
|
|
{
|
|
|
SetCheckboxStatus(WriteDSN, true);
|
|
|
keyInfo.DSN = _MiKey.DSN;
|
|
|
}
|
|
|
+
|
|
|
+ if (_MiKey.WifiMac != null)
|
|
|
+ {
|
|
|
+ SetCheckboxStatus(WriteWifiMac, true);
|
|
|
+ keyInfo.WiFi_MAC = _MiKey.WifiMac;
|
|
|
+ }
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
@@ -4560,121 +4565,218 @@ namespace MOKA_Factory_Tools
|
|
|
SetcolorStatus(ProductMsg_Text, Color.FromArgb(128, 255, 128));
|
|
|
}
|
|
|
|
|
|
- // DSN抄写:如果是G客户,要在抄写其他key前时行fsn+psn查重处理;
|
|
|
+ // DSN抄写;
|
|
|
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);
|
|
|
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);
|
|
|
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
|
|
|
{
|
|
|
SetfailStatus(m_readDSN);
|
|
|
- ErrMsg = string.Format("{0} contrast DSN fail!", SN);
|
|
|
+ ErrMsg = string.Format("{0} read DSN fail!", SN);
|
|
|
Log.WriteErrorLog(ErrMsg);
|
|
|
goto end;
|
|
|
}
|
|
|
}
|
|
|
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);
|
|
|
goto end;
|
|
|
}
|
|
|
}
|
|
|
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);
|
|
|
goto end;
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- SetfailStatus(m_writeDSN);
|
|
|
- ErrMsg = string.Format("{0} Write DSN fail!", SN);
|
|
|
+ ErrMsg = string.Format("错误的PSN {0}", error_psn);
|
|
|
Log.WriteErrorLog(ErrMsg);
|
|
|
goto end;
|
|
|
}
|
|
|
}
|
|
|
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);
|
|
|
goto end;
|
|
|
}
|
|
|
}
|
|
|
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);
|
|
|
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
|
|
|
{
|
|
|
- ErrMsg = string.Format("{0} Get Device Code Error", SN);
|
|
|
+ ErrMsg = string.Format("读取PSN失败 {0}", error);
|
|
|
Log.WriteErrorLog(ErrMsg);
|
|
|
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报文;
|