|
@@ -1735,7 +1735,10 @@ namespace MOKA_Factory_Tools
|
|
|
Log.WriteErrorLog(ErrMsg);
|
|
|
goto end;
|
|
|
}
|
|
|
+
|
|
|
SetsuccessStatus(m_readPSN);
|
|
|
+ SetsuccessStatus(ResultStatus);
|
|
|
+ goto stop;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -2274,7 +2277,7 @@ namespace MOKA_Factory_Tools
|
|
|
}
|
|
|
if (WriteFairplay.Checked && midListNow.keytype.ContainsKey("Fairplay_KEY"))
|
|
|
{
|
|
|
- if (CommonMethod.GetKeys(midListNow.host, "Fairplay_KEY", SN, midListNow.keytype["Fairplay_KEY"], errorDBNow, out string fairplay, out error, orderNow, out string md5))
|
|
|
+ if (!CommonMethod.GetIDMKeys(midListNow.host, SN, orderNow, psn, devicecode, key2Write, errorDBNow, ref keyInfo, out error))
|
|
|
{
|
|
|
keyInfo.Fairplay.data = fairplay;
|
|
|
Log.WriteGetKeyLog("\r\nFairplay=" + keyInfo.Fairplay);
|
|
@@ -4703,106 +4706,48 @@ namespace MOKA_Factory_Tools
|
|
|
}
|
|
|
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))
|
|
|
+ SetsuccessStatus(m_writeDSN);
|
|
|
+ Log.WriteInfoLog("Check DSN...");
|
|
|
+ if (cfg_writecheck.DSNCheckcheck)
|
|
|
{
|
|
|
- string psn = keyInfo._PSN.data = Encoding.ASCII.GetString(data_psn);
|
|
|
- if (CommonMethod.GetFireTVDsn(midListNow.host, orderNow, Encoding.ASCII.GetString(data), SN, psn, out string dsn, out error_psn, errorDBNow))
|
|
|
+ if (SerialCMD.CheckFireTVDSN(TVPort, out result, out data, out error, SerailDelay))
|
|
|
{
|
|
|
- // 预防切了pid后,deviceCode变化了;
|
|
|
- if ( dsn.IndexOf(devicecode) == -1 )
|
|
|
- {
|
|
|
- ErrMsg = string.Format("The device code [{0}] is not included in the DSN [{1}]!\r\n", devicecode, dsn);
|
|
|
- Log.WriteErrorLog(ErrMsg);
|
|
|
- goto end;
|
|
|
- }
|
|
|
-
|
|
|
- keyInfo.DSN.data = dsn;
|
|
|
- if (!CommonMethod.IsNumberAndWord(keyInfo.DSN.data))
|
|
|
- {
|
|
|
- ErrMsg = string.Format("DSN format error!\r\n{0}", keyInfo.DSN.data);
|
|
|
- Log.WriteErrorLog(ErrMsg);
|
|
|
- goto end;
|
|
|
- }
|
|
|
- byte[] DSNData = System.Text.Encoding.ASCII.GetBytes(keyInfo.DSN.data);
|
|
|
- Log.WriteInfoLog("Write DSN...");
|
|
|
- if (SerialCMD.SetFireTVDSN(TVPort, DSNData, out result, out data, out error, SerailDelay))
|
|
|
+ SetsuccessStatus(m_checkDSN);
|
|
|
+ Log.WriteInfoLog("Read DSN...");
|
|
|
+ if (cfg_readcheck.DSNReadcheck)
|
|
|
{
|
|
|
- SetsuccessStatus(m_writeDSN);
|
|
|
- Log.WriteInfoLog("Check DSN...");
|
|
|
- if (cfg_writecheck.DSNCheckcheck ? SerialCMD.CheckFireTVDSN(TVPort, out result, out data, out error, SerailDelay) : true)
|
|
|
+ if (SerialCMD.GetFireTVDSN(TVPort, out result, out data, out error, SerailDelay))
|
|
|
{
|
|
|
- SetsuccessStatus(m_checkDSN);
|
|
|
- Log.WriteInfoLog("Read DSN...");
|
|
|
- if (cfg_readcheck.DSNReadcheck ? SerialCMD.GetFireTVDSN(TVPort, out result, out data, out error, SerailDelay) : true)
|
|
|
+ if (SerialInit.BytesCompare_Base64(data, DSNData))
|
|
|
{
|
|
|
- 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;
|
|
|
- }
|
|
|
+ SetsuccessStatus(m_readDSN);
|
|
|
+ //DSN读取别对成功
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
SetfailStatus(m_readDSN);
|
|
|
- ErrMsg = string.Format("{0} read DSN fail!", SN);
|
|
|
+ ErrMsg = string.Format("{0} contrast DSN fail!", SN);
|
|
|
Log.WriteErrorLog(ErrMsg);
|
|
|
goto end;
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- SetfailStatus(m_checkDSN);
|
|
|
- ErrMsg = string.Format("{0} check DSN fail!", SN);
|
|
|
+ SetfailStatus(m_readDSN);
|
|
|
+ ErrMsg = string.Format("{0} read 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
|
|
|
{
|
|
|
- ErrMsg = string.Format("错误的PSN {0}", error_psn);
|
|
|
+ SetfailStatus(m_checkDSN);
|
|
|
+ ErrMsg = string.Format("{0} check DSN fail!", SN);
|
|
|
Log.WriteErrorLog(ErrMsg);
|
|
|
goto end;
|
|
|
}
|
|
|
}
|
|
|
- else
|
|
|
- {
|
|
|
- ErrMsg = string.Format("Failed to read PSN when requesting DSN !\r\n{0}", devicecode);
|
|
|
- Log.WriteErrorLog(ErrMsg);
|
|
|
- goto end;
|
|
|
- }
|
|
|
}
|
|
|
else
|
|
|
{
|