|
@@ -270,8 +270,6 @@ void CSIACP::LoadCommand()
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- Global::WriteTextLog("Load Comman xml");
|
|
|
}
|
|
|
|
|
|
void CSIACP::SaveCommand(std::vector<_SIACP_> &vtSiacp, std::string path)
|
|
@@ -329,7 +327,7 @@ BOOL CSIACP::OpenComm(LPCTSTR lpszCom, DWORD dwBaudrate)
|
|
|
{
|
|
|
if (lpszCom == NULL || lpszCom[0] == '\0')
|
|
|
{
|
|
|
- LOG4C((LOG_WARN, "(lpszCom) Invalid parameter!"));
|
|
|
+ Global::WriteReportLog(1, "Parameter error", "(lpszCom) Invalid parameter!");
|
|
|
return FALSE;
|
|
|
}
|
|
|
|
|
@@ -341,7 +339,7 @@ BOOL CSIACP::OpenComm(LPCTSTR lpszCom, DWORD dwBaudrate)
|
|
|
m_pSerial = new CSerialPort();
|
|
|
if (m_pSerial == NULL)
|
|
|
{
|
|
|
- LOG4C((LOG_WARN, "(m_pSerial) Fail to create object!"));
|
|
|
+ Global::WriteReportLog(1, "Memory error", "(m_pSerial) Fail to create object!");
|
|
|
return FALSE;
|
|
|
}
|
|
|
|
|
@@ -350,7 +348,7 @@ BOOL CSIACP::OpenComm(LPCTSTR lpszCom, DWORD dwBaudrate)
|
|
|
{
|
|
|
delete m_pSerial;
|
|
|
m_pSerial = NULL;
|
|
|
- LOG4C((LOG_WARN, "Open Serial Port Fail !"));
|
|
|
+ Global::WriteReportLog(1, "Serial port error", "Open Serial Port Fail !");
|
|
|
return FALSE;
|
|
|
}
|
|
|
|
|
@@ -377,7 +375,7 @@ BOOL CSIACP::ExecSerialCommand(const _SIACP_ &siacp, std::string command)
|
|
|
{
|
|
|
if (m_pSerial == NULL || !m_pSerial->IsOpen())
|
|
|
{
|
|
|
- LOG4C((LOG_ERROR, "Serial Port un't Open!"));
|
|
|
+ Global::WriteReportLog(1, "Serial port error", "Serial Port un't Open!");
|
|
|
return FALSE;
|
|
|
}
|
|
|
|
|
@@ -386,7 +384,8 @@ BOOL CSIACP::ExecSerialCommand(const _SIACP_ &siacp, std::string command)
|
|
|
Global::WriteTextLog(_T("COM Write:%s"), Bytes2HexString((const byte *)command.c_str(), command.size(), ' ').c_str());
|
|
|
if (dwWritten != command.size())
|
|
|
{
|
|
|
- Global::WriteTextLog("COM Written Error!");
|
|
|
+ Global::WriteTextLog("COM Written Error");
|
|
|
+ Global::WriteReportLog(1, "Serial Writing Error", "COM Written Error, Buffer=%s", Bytes2HexString((const byte*)command.c_str(), command.size(), ' ').c_str());
|
|
|
return FALSE;
|
|
|
}
|
|
|
|
|
@@ -395,7 +394,8 @@ BOOL CSIACP::ExecSerialCommand(const _SIACP_ &siacp, std::string command)
|
|
|
DWORD dwBytesRead = m_pSerial->Read(szRecive, BUFFER_LEN);
|
|
|
if (dwBytesRead == 0)
|
|
|
{
|
|
|
- Global::WriteTextLog("COM Read Error!");
|
|
|
+ Global::WriteTextLog("COM Read Error");
|
|
|
+ Global::WriteReportLog(1, "Serial Reading Error","COM Read Error(No Data Return), Write=%s!", Bytes2HexString((const byte*)command.c_str(), command.size(), ' ').c_str());
|
|
|
return FALSE;
|
|
|
}
|
|
|
|
|
@@ -411,7 +411,10 @@ BOOL CSIACP::ParserSerialData(std::vector<RTN> &vtdata, const _SIACP_ &siacp, by
|
|
|
{
|
|
|
vtdata.clear();
|
|
|
if (pbuffer == NULL || dwlen < 5)
|
|
|
+ {
|
|
|
+ Global::WriteReportLog(1, "Serial Parsing error", "cmd=%s,Return length less than 5! Buffer = %s", siacp.name.c_str(), Bytes2HexString(pbuffer, dwlen, ' ').c_str());
|
|
|
return FALSE;
|
|
|
+ }
|
|
|
|
|
|
// 返回码;
|
|
|
byte byReturn = TV_Return;
|
|
@@ -433,6 +436,7 @@ BOOL CSIACP::ParserSerialData(std::vector<RTN> &vtdata, const _SIACP_ &siacp, by
|
|
|
else
|
|
|
{
|
|
|
Global::WriteTextLog("COM Read Parser: Invalid return code!");
|
|
|
+ Global::WriteReportLog(1, "Serial Parsing error", "cmd=%s,Invalid return code! Buffer=%s", siacp.name.c_str(), Bytes2HexString(pbuffer, dwlen, ' ').c_str());
|
|
|
return FALSE;
|
|
|
}
|
|
|
|
|
@@ -467,6 +471,7 @@ BOOL CSIACP::ParserSerialData(std::vector<RTN> &vtdata, const _SIACP_ &siacp, by
|
|
|
if (package_len > (dwlen - nTookenLen))
|
|
|
{
|
|
|
Global::WriteTextLog("COM Read Parser: Incorrect length of returned data!");
|
|
|
+ Global::WriteReportLog(1, "Serial Parsing error", "cmd=%s,Incorrect length of returned data! Buffer=%s", siacp.name.c_str(), Bytes2HexString(pbuffer, dwlen, ' ').c_str());
|
|
|
return FALSE;
|
|
|
}
|
|
|
|
|
@@ -477,6 +482,7 @@ BOOL CSIACP::ParserSerialData(std::vector<RTN> &vtdata, const _SIACP_ &siacp, by
|
|
|
if (byte(package[0]) != byReturn)
|
|
|
{
|
|
|
Global::WriteTextLog("COM Read Parser: Data Header Check Error!");
|
|
|
+ Global::WriteReportLog(1, "Serial Parsing error", "cmd=%s,Data Header Check Error! Buffer=%s", siacp.name.c_str(), Bytes2HexString(pbuffer, dwlen, ' ').c_str());
|
|
|
return FALSE;
|
|
|
}
|
|
|
|
|
@@ -485,6 +491,7 @@ BOOL CSIACP::ParserSerialData(std::vector<RTN> &vtdata, const _SIACP_ &siacp, by
|
|
|
if (((usCRCValue >> 8) & 0xFF) != (unsigned char)package[package_len - 2] || (usCRCValue & 0xFF) != (unsigned char)package[package_len - 1])
|
|
|
{
|
|
|
Global::WriteTextLog("COM Read Parser: Data CRC validation failure!");
|
|
|
+ Global::WriteReportLog(1, "Serial Parsing error", "cmd=%s,Data CRC validation failure! Buffer=%s", siacp.name.c_str(), Bytes2HexString(pbuffer, dwlen, ' ').c_str());
|
|
|
return FALSE;
|
|
|
}
|
|
|
|
|
@@ -494,6 +501,7 @@ BOOL CSIACP::ParserSerialData(std::vector<RTN> &vtdata, const _SIACP_ &siacp, by
|
|
|
if (package[2] != RC_OK)
|
|
|
{
|
|
|
Global::WriteTextLog("COM Read Parser: The return code of the response data is invalid!");
|
|
|
+ Global::WriteReportLog(1, "Serial Parsing error", "cmd=%s,The return code of the response data is invalid! Buffer=%s", siacp.name.c_str(), Bytes2HexString(pbuffer, dwlen, ' ').c_str());
|
|
|
return FALSE;
|
|
|
}
|
|
|
}
|
|
@@ -503,6 +511,7 @@ BOOL CSIACP::ParserSerialData(std::vector<RTN> &vtdata, const _SIACP_ &siacp, by
|
|
|
if (byte(package[2 + nABFE] - 1) != byCode)
|
|
|
{
|
|
|
Global::WriteTextLog("COM Read Parser: The command code of response data does not match the command code of sending data!");
|
|
|
+ Global::WriteReportLog(1, "Serial Parsing error", "cmd=%s,The command code of response data does not match the command code of sending data! Buffer=%s", siacp.name.c_str(), Bytes2HexString(pbuffer, dwlen, ' ').c_str());
|
|
|
return FALSE;
|
|
|
}
|
|
|
|
|
@@ -628,14 +637,16 @@ BOOL CSIACP::SendCommand(std::string cmd_name, const byte *pszOthers, DWORD dwOt
|
|
|
const _SIACP_ *pSiacp = GetSiacp(cmd_name);
|
|
|
if (pSiacp == NULL)
|
|
|
{
|
|
|
- LOG4C((LOG_ERROR, "This command is not supported!"));
|
|
|
+ Global::WriteTextLog("This command is not supported!");
|
|
|
+ Global::WriteReportLog(1, "Invalid command", "This command(%s) is not supported!", cmd_name.c_str());
|
|
|
return FALSE;
|
|
|
}
|
|
|
|
|
|
std::string command = GetSiacpCommand(*pSiacp, others, dwOthersLen);
|
|
|
if (command.size() == 0)
|
|
|
{
|
|
|
- LOG4C((LOG_ERROR, "Generation command failed!"));
|
|
|
+ Global::WriteTextLog("Generation command failed!");
|
|
|
+ Global::WriteReportLog(1, "Generation command failed", "command=%s", cmd_name.c_str());
|
|
|
return FALSE;
|
|
|
}
|
|
|
|
|
@@ -648,14 +659,16 @@ BOOL CSIACP::SendCommand2(std::string cmd_name, std::string data /* = "" */, siz
|
|
|
const _SIACP_ *pSiacp = GetSiacp(cmd_name);
|
|
|
if (pSiacp == NULL)
|
|
|
{
|
|
|
- LOG4C((LOG_ERROR, "This command is not supported!"));
|
|
|
+ Global::WriteTextLog("This command is not supported!");
|
|
|
+ Global::WriteReportLog(1, "Invalid command", "This command(%s) is not supported!", cmd_name.c_str());
|
|
|
return FALSE;
|
|
|
}
|
|
|
|
|
|
std::string command = GetSiacpCommand(*pSiacp, data, nlen);
|
|
|
if (command.size() == 0)
|
|
|
{
|
|
|
- LOG4C((LOG_ERROR, "Generation command failed!"));
|
|
|
+ Global::WriteTextLog("Generation command failed!");
|
|
|
+ Global::WriteReportLog(1, "Generation command failed", "command=%s", cmd_name.c_str());
|
|
|
return FALSE;
|
|
|
}
|
|
|
|
|
@@ -671,7 +684,6 @@ BOOL CSIACP::SCBC_WaitTVBoot()
|
|
|
if ( SCBC_EnterFactory() )
|
|
|
{
|
|
|
SCBC_LeaveFactory();
|
|
|
- Global::WriteTextLog("TV Boot OK!");
|
|
|
return TRUE;
|
|
|
}
|
|
|
}
|
|
@@ -683,13 +695,15 @@ BOOL CSIACP::SCBC_MTKInit()
|
|
|
{
|
|
|
if (m_pSerial == NULL)
|
|
|
{
|
|
|
- LOG4C((LOG_ERROR, "CSerialPort对象未初始化"));
|
|
|
+ Global::WriteTextLog("串口对象未初始化");
|
|
|
+ Global::WriteReportLog(1, "MTKInit Error", "Serial port object uninitialized!");
|
|
|
return FALSE;
|
|
|
}
|
|
|
|
|
|
if (!m_pSerial->IsOpen())
|
|
|
{
|
|
|
- LOG4C((LOG_ERROR, "CSerialPort对象未打开串口"));
|
|
|
+ Global::WriteTextLog("未打开串口");
|
|
|
+ Global::WriteReportLog(1, "MTKInit Error", "Unopened Serial Port!");
|
|
|
return FALSE;
|
|
|
}
|
|
|
|
|
@@ -723,7 +737,9 @@ BOOL CSIACP::SCBC_GetProjectId(int &pid)
|
|
|
{
|
|
|
if (m_vtdata.size() == 0)
|
|
|
{
|
|
|
- LOG4C((LOG_WARN, "No data return!"));
|
|
|
+ Global::WriteTextLog("%s:%s", __FUNCTION__, "No data return!");
|
|
|
+ Global::WriteReportLog(1, "Copy Key", "%s:%s", __FUNCTION__, "No data return!");
|
|
|
+
|
|
|
return FALSE;
|
|
|
}
|
|
|
|
|
@@ -749,14 +765,18 @@ BOOL CSIACP::SCBC_GetSoftVersion(std::string &strVer)
|
|
|
{
|
|
|
if (m_vtdata.size() == 0)
|
|
|
{
|
|
|
- LOG4C((LOG_WARN, "No data return!"));
|
|
|
+ Global::WriteTextLog("%s:%s", __FUNCTION__, "No data return!");
|
|
|
+ Global::WriteReportLog(1, "Copy Key", "%s:%s", __FUNCTION__, "No data return!");
|
|
|
+
|
|
|
return FALSE;
|
|
|
}
|
|
|
|
|
|
RTN rtn = m_vtdata.at(0);
|
|
|
if (!IsValidString(rtn.data.c_str()))
|
|
|
{
|
|
|
- LOG4C((LOG_WARN, "tv version string is invalid!"));
|
|
|
+ Global::WriteTextLog("%s:%s%s!", __FUNCTION__, "tv version string is invalid=", rtn.data.c_str());
|
|
|
+ Global::WriteReportLog(1, "Copy Key", "%s:%s%s!", __FUNCTION__, "tv version string is invalid=", rtn.data.c_str());
|
|
|
+
|
|
|
return FALSE;
|
|
|
}
|
|
|
|
|
@@ -773,7 +793,8 @@ BOOL CSIACP::SCBC_GetDeviceId(std::string &strDid)
|
|
|
{
|
|
|
if (m_vtdata.size() == 0)
|
|
|
{
|
|
|
- LOG4C((LOG_WARN, "No data return!"));
|
|
|
+ Global::WriteTextLog("%s:%s", __FUNCTION__, "No data return!");
|
|
|
+ Global::WriteReportLog(1, "Copy Key", "%s:%s", __FUNCTION__, "No data return!");
|
|
|
return FALSE;
|
|
|
}
|
|
|
|
|
@@ -791,14 +812,17 @@ BOOL CSIACP::SCBC_GetClientType(std::string &strClt)
|
|
|
{
|
|
|
if (m_vtdata.size() == 0)
|
|
|
{
|
|
|
- LOG4C((LOG_WARN, "No data return!"));
|
|
|
+ Global::WriteTextLog("%s:%s", __FUNCTION__, "No data return!");
|
|
|
+ Global::WriteReportLog(1, "Copy Key", "%s:%s", __FUNCTION__, "No data return!");
|
|
|
return FALSE;
|
|
|
}
|
|
|
|
|
|
RTN rtn = m_vtdata.at(0);
|
|
|
if (!IsValidString(rtn.data.c_str()))
|
|
|
{
|
|
|
- LOG4C((LOG_WARN, "tv client type string is invalid!"));
|
|
|
+ Global::WriteTextLog("%s:%s%s!", __FUNCTION__, "tv client string is invalid=", rtn.data.c_str());
|
|
|
+ Global::WriteReportLog(1, "Copy Key", "%s:%s%s!", __FUNCTION__, "tv client string is invalid=", rtn.data.c_str());
|
|
|
+
|
|
|
return FALSE;
|
|
|
}
|
|
|
strClt.append(rtn.data.c_str(), rtn.len);
|
|
@@ -814,7 +838,9 @@ BOOL CSIACP::SCBC_GetMAC(std::string &strMac)
|
|
|
{
|
|
|
if (m_vtdata.size() == 0)
|
|
|
{
|
|
|
- LOG4C((LOG_WARN, "No data return!"));
|
|
|
+ Global::WriteTextLog("%s:%s", __FUNCTION__, "No data return!");
|
|
|
+ Global::WriteReportLog(1, "Copy Key", "%s:%s", __FUNCTION__, "No data return!");
|
|
|
+
|
|
|
return FALSE;
|
|
|
}
|
|
|
|
|
@@ -832,7 +858,9 @@ BOOL CSIACP::SCBC_GetHDCPKey(std::string &strHDCP)
|
|
|
{
|
|
|
if (m_vtdata.size() == 0)
|
|
|
{
|
|
|
- LOG4C((LOG_WARN, "No data return!"));
|
|
|
+ Global::WriteTextLog("%s:%s", __FUNCTION__, "No data return!");
|
|
|
+ Global::WriteReportLog(1, "Copy Key", "%s:%s", __FUNCTION__, "No data return!");
|
|
|
+
|
|
|
return FALSE;
|
|
|
}
|
|
|
|
|
@@ -851,7 +879,9 @@ BOOL CSIACP::SCBC_GetHDCPKey22(std::string &strHDCP22)
|
|
|
{
|
|
|
if (m_vtdata.size() == 0)
|
|
|
{
|
|
|
- LOG4C((LOG_WARN, "No data return!"));
|
|
|
+ Global::WriteTextLog("%s:%s", __FUNCTION__, "No data return!");
|
|
|
+ Global::WriteReportLog(1, "Copy Key", "%s:%s", __FUNCTION__, "No data return!");
|
|
|
+
|
|
|
return FALSE;
|
|
|
}
|
|
|
|
|
@@ -870,7 +900,9 @@ BOOL CSIACP::SCBC_GetWidi(std::string &strWidi)
|
|
|
{
|
|
|
if (m_vtdata.size() == 0)
|
|
|
{
|
|
|
- LOG4C((LOG_WARN, "No data return!"));
|
|
|
+ Global::WriteTextLog("%s:%s", __FUNCTION__, "No data return!");
|
|
|
+ Global::WriteReportLog(1, "Copy Key", "%s:%s", __FUNCTION__, "No data return!");
|
|
|
+
|
|
|
return FALSE;
|
|
|
}
|
|
|
|
|
@@ -889,7 +921,9 @@ BOOL CSIACP::SCBC_GetNetflixESN(std::string &strESN)
|
|
|
{
|
|
|
if (m_vtdata.size() == 0)
|
|
|
{
|
|
|
- LOG4C((LOG_WARN, "No data return!"));
|
|
|
+ Global::WriteTextLog("%s:%s", __FUNCTION__, "No data return!");
|
|
|
+ Global::WriteReportLog(1, "Copy Key", "%s:%s", __FUNCTION__, "No data return!");
|
|
|
+
|
|
|
return FALSE;
|
|
|
}
|
|
|
|
|
@@ -908,7 +942,9 @@ BOOL CSIACP::SCBC_GetWidevine(std::string &strWidevine)
|
|
|
{
|
|
|
if (m_vtdata.size() == 0)
|
|
|
{
|
|
|
- LOG4C((LOG_WARN, "No data return!"));
|
|
|
+ Global::WriteTextLog("%s:%s", __FUNCTION__, "No data return!");
|
|
|
+ Global::WriteReportLog(1, "Copy Key", "%s:%s", __FUNCTION__, "No data return!");
|
|
|
+
|
|
|
return FALSE;
|
|
|
}
|
|
|
|
|
@@ -927,7 +963,9 @@ BOOL CSIACP::SCBC_GetCiKey(std::string &strCikey)
|
|
|
{
|
|
|
if (m_vtdata.size() == 0)
|
|
|
{
|
|
|
- LOG4C((LOG_WARN, "No data return!"));
|
|
|
+ Global::WriteTextLog("%s:%s", __FUNCTION__, "No data return!");
|
|
|
+ Global::WriteReportLog(1, "Copy Key", "%s:%s", __FUNCTION__, "No data return!");
|
|
|
+
|
|
|
return FALSE;
|
|
|
}
|
|
|
|
|
@@ -946,7 +984,9 @@ BOOL CSIACP::SCBC_GetOSDLanguage(std::string &strOSDLan)
|
|
|
{
|
|
|
if (m_vtdata.size() == 0)
|
|
|
{
|
|
|
- LOG4C((LOG_WARN, "No data return!"));
|
|
|
+ Global::WriteTextLog("%s:%s", __FUNCTION__, "No data return!");
|
|
|
+ Global::WriteReportLog(1, "Copy Key", "%s:%s", __FUNCTION__, "No data return!");
|
|
|
+
|
|
|
return FALSE;
|
|
|
}
|
|
|
|
|
@@ -965,7 +1005,9 @@ BOOL CSIACP::SCBC_GetShopLanguage(std::string &strShopLan)
|
|
|
{
|
|
|
if (m_vtdata.size() == 0)
|
|
|
{
|
|
|
- LOG4C((LOG_WARN, "No data return!"));
|
|
|
+ Global::WriteTextLog("%s:%s", __FUNCTION__, "No data return!");
|
|
|
+ Global::WriteReportLog(1, "Copy Key", "%s:%s", __FUNCTION__, "No data return!");
|
|
|
+
|
|
|
return FALSE;
|
|
|
}
|
|
|
|
|
@@ -984,7 +1026,9 @@ BOOL CSIACP::SCBC_GetChannel(std::string& channel)
|
|
|
{
|
|
|
if (m_vtdata.size() == 0)
|
|
|
{
|
|
|
- LOG4C((LOG_WARN, "No data return!"));
|
|
|
+ Global::WriteTextLog("%s:%s", __FUNCTION__, "No data return!");
|
|
|
+ Global::WriteReportLog(1, "Copy Key", "%s:%s", __FUNCTION__, "No data return!");
|
|
|
+
|
|
|
return FALSE;
|
|
|
}
|
|
|
|
|
@@ -1187,7 +1231,9 @@ BOOL CSIACP::SCBC_CheckDeviceId()
|
|
|
{
|
|
|
if (m_vtdata.size() == 0)
|
|
|
{
|
|
|
- LOG4C((LOG_WARN, "No data return!"));
|
|
|
+ Global::WriteTextLog("%s:%s", __FUNCTION__, "No data return!");
|
|
|
+ Global::WriteReportLog(1, "Copy Key", "%s:%s", __FUNCTION__, "No data return!");
|
|
|
+
|
|
|
return FALSE;
|
|
|
}
|
|
|
|
|
@@ -1214,7 +1260,9 @@ BOOL CSIACP::SCBC_CheckMAC()
|
|
|
{
|
|
|
if (m_vtdata.size() == 0)
|
|
|
{
|
|
|
- LOG4C((LOG_WARN, "No data return!"));
|
|
|
+ Global::WriteTextLog("%s:%s", __FUNCTION__, "No data return!");
|
|
|
+ Global::WriteReportLog(1, "Copy Key", "%s:%s", __FUNCTION__, "No data return!");
|
|
|
+
|
|
|
return FALSE;
|
|
|
}
|
|
|
|
|
@@ -1241,7 +1289,9 @@ BOOL CSIACP::SCBC_CheckHDCP()
|
|
|
{
|
|
|
if (m_vtdata.size() == 0)
|
|
|
{
|
|
|
- LOG4C((LOG_WARN, "No data return!"));
|
|
|
+ Global::WriteTextLog("%s:%s", __FUNCTION__, "No data return!");
|
|
|
+ Global::WriteReportLog(1, "Copy Key", "%s:%s", __FUNCTION__, "No data return!");
|
|
|
+
|
|
|
return FALSE;
|
|
|
}
|
|
|
|
|
@@ -1268,7 +1318,9 @@ BOOL CSIACP::SCBC_CheckHDCP22()
|
|
|
{
|
|
|
if (m_vtdata.size() == 0)
|
|
|
{
|
|
|
- LOG4C((LOG_WARN, "No data return!"));
|
|
|
+ Global::WriteTextLog("%s:%s", __FUNCTION__, "No data return!");
|
|
|
+ Global::WriteReportLog(1, "Copy Key", "%s:%s", __FUNCTION__, "No data return!");
|
|
|
+
|
|
|
return FALSE;
|
|
|
}
|
|
|
|
|
@@ -1295,7 +1347,9 @@ BOOL CSIACP::SCBC_CheckNetflixESN()
|
|
|
{
|
|
|
if (m_vtdata.size() == 0)
|
|
|
{
|
|
|
- LOG4C((LOG_WARN, "No data return!"));
|
|
|
+ Global::WriteTextLog("%s:%s", __FUNCTION__, "No data return!");
|
|
|
+ Global::WriteReportLog(1, "Copy Key", "%s:%s", __FUNCTION__, "No data return!");
|
|
|
+
|
|
|
return FALSE;
|
|
|
}
|
|
|
|
|
@@ -1322,7 +1376,9 @@ BOOL CSIACP::SCBC_CheckWidi()
|
|
|
{
|
|
|
if (m_vtdata.size() == 0)
|
|
|
{
|
|
|
- LOG4C((LOG_WARN, "No data return!"));
|
|
|
+ Global::WriteTextLog("%s:%s", __FUNCTION__, "No data return!");
|
|
|
+ Global::WriteReportLog(1, "Copy Key", "%s:%s", __FUNCTION__, "No data return!");
|
|
|
+
|
|
|
return FALSE;
|
|
|
}
|
|
|
|
|
@@ -1349,7 +1405,9 @@ BOOL CSIACP::SCBC_CheckWidevine()
|
|
|
{
|
|
|
if (m_vtdata.size() == 0)
|
|
|
{
|
|
|
- LOG4C((LOG_WARN, "No data return!"));
|
|
|
+ Global::WriteTextLog("%s:%s", __FUNCTION__, "No data return!");
|
|
|
+ Global::WriteReportLog(1, "Copy Key", "%s:%s", __FUNCTION__, "No data return!");
|
|
|
+
|
|
|
return FALSE;
|
|
|
}
|
|
|
|
|
@@ -1376,7 +1434,9 @@ BOOL CSIACP::SCBC_CheckCikey()
|
|
|
{
|
|
|
if (m_vtdata.size() == 0)
|
|
|
{
|
|
|
- LOG4C((LOG_WARN, "No data return!"));
|
|
|
+ Global::WriteTextLog("%s:%s", __FUNCTION__, "No data return!");
|
|
|
+ Global::WriteReportLog(1, "Copy Key", "%s:%s", __FUNCTION__, "No data return!");
|
|
|
+
|
|
|
return FALSE;
|
|
|
}
|
|
|
|
|
@@ -1448,7 +1508,13 @@ BOOL COTA::HttpGet(std::string host, std::string context, std::string &result, D
|
|
|
nRecCode = m_curl.Get(host + context, result);
|
|
|
|
|
|
if (CURLE_OK != nRecCode)
|
|
|
+ {
|
|
|
+ TCHAR szMsg[250] = { 0 };
|
|
|
+ _stprintf_s(szMsg, _T("http(get) request failed, curl error code = %d\r"), nRecCode);
|
|
|
+ ShowMessage(szMsg);
|
|
|
LOG4C((LOG_NOTICE, "请求失败:%s, 错误码=%ld", context.c_str(), nRecCode));
|
|
|
+ Global::WriteReportLog(0, __FUNCTION__, "Request(get) Failure, Curl Error Code=%ld: host=%s, content=%s, result=%s", nRecCode, host.c_str(), context.c_str(),result.c_str());
|
|
|
+ }
|
|
|
|
|
|
return CURLE_OK == nRecCode;
|
|
|
}
|
|
@@ -1473,9 +1539,10 @@ BOOL COTA::HttpPost(std::string host, std::string context, std::string &result,
|
|
|
if (CURLE_OK != nRecCode)
|
|
|
{
|
|
|
TCHAR szMsg[250] = {0};
|
|
|
- _stprintf_s(szMsg, _T("http request failed, curl error code = %d\r"), nRecCode);
|
|
|
+ _stprintf_s(szMsg, _T("http(post) request failed, curl error code = %d\r"), nRecCode);
|
|
|
ShowMessage(szMsg);
|
|
|
LOG4C((LOG_NOTICE, "请求失败:%s, 错误码=%ld\n", context.c_str(), nRecCode));
|
|
|
+ Global::WriteReportLog(0, __FUNCTION__, "Request(post) Failure, Curl Error Code=%ld: host=%s, content=%s, result=%s", nRecCode, host.c_str(), context.c_str(), result.c_str());
|
|
|
}
|
|
|
|
|
|
std::string api = host.substr(host.find_last_of('/') + 1);
|
|
@@ -1523,6 +1590,8 @@ BOOL COTA::GetMIDInfo(MIDInfo &mid, std::string bid, std::string strMacs, std::s
|
|
|
{
|
|
|
bRet = FALSE;
|
|
|
LOG4C((LOG_WARN, "JSON parsing failure:post=%s;return=%s\n", context.c_str(), result.c_str()));
|
|
|
+ Global::WriteReportLog(0, __FUNCTION__, "JSON Parsing Error: host=%s, content=%s, result=%s", host.c_str(), context.c_str(), result.c_str());
|
|
|
+
|
|
|
goto end;
|
|
|
}
|
|
|
|
|
@@ -1539,6 +1608,8 @@ BOOL COTA::GetMIDInfo(MIDInfo &mid, std::string bid, std::string strMacs, std::s
|
|
|
{
|
|
|
bRet = FALSE;
|
|
|
LOG4C((LOG_WARN, "JSON parsing failure:post=%s;return=%s\n", context.c_str(), result.c_str()));
|
|
|
+ Global::WriteReportLog(0, __FUNCTION__, "JSON Parsing Error: host=%s, content=%s, result=%s", host.c_str(), context.c_str(), result.c_str());
|
|
|
+
|
|
|
goto end;
|
|
|
}
|
|
|
|
|
@@ -1546,6 +1617,8 @@ BOOL COTA::GetMIDInfo(MIDInfo &mid, std::string bid, std::string strMacs, std::s
|
|
|
{
|
|
|
bRet = FALSE;
|
|
|
LOG4C((LOG_WARN, "return invalid data:post=%s;return=%s\n", context.c_str(), result.c_str()));
|
|
|
+ Global::WriteReportLog(0, __FUNCTION__, "return invalid data: host=%s, content=%s, result=%s", host.c_str(), context.c_str(), result.c_str());
|
|
|
+
|
|
|
goto end;
|
|
|
}
|
|
|
|
|
@@ -1553,6 +1626,8 @@ BOOL COTA::GetMIDInfo(MIDInfo &mid, std::string bid, std::string strMacs, std::s
|
|
|
{
|
|
|
bRet = FALSE;
|
|
|
LOG4C((LOG_WARN, "return invalid data:post=%s;return=%s\n", context.c_str(), result.c_str()));
|
|
|
+ Global::WriteReportLog(0, __FUNCTION__, "return invalid data: host=%s, content=%s, result=%s", host.c_str(), context.c_str(), result.c_str());
|
|
|
+
|
|
|
goto end;
|
|
|
}
|
|
|
|
|
@@ -1662,6 +1737,8 @@ BOOL COTA::GetKeyInfo(std::string host, std::string context, std::string keyname
|
|
|
{
|
|
|
LOG4C((LOG_ERROR, "(http=%s) No data return!", context.c_str()));
|
|
|
ShowMessage(_T("http No data return!\r"));
|
|
|
+ Global::WriteReportLog(0, __FUNCTION__, "http No data return: host=%s, content=%s, result=%s", host.c_str(), context.c_str(), result.c_str());
|
|
|
+
|
|
|
return FALSE;
|
|
|
}
|
|
|
|
|
@@ -1671,6 +1748,8 @@ BOOL COTA::GetKeyInfo(std::string host, std::string context, std::string keyname
|
|
|
{
|
|
|
LOG4C((LOG_ERROR, "(http=%s) this post return xml invalid!", context.c_str()));
|
|
|
ShowMessage(_T("http return invalid xml data!\r"));
|
|
|
+ Global::WriteReportLog(0, __FUNCTION__, "http return invalid xml data: host=%s, content=%s, result=%s", host.c_str(), context.c_str(), result.c_str());
|
|
|
+
|
|
|
return FALSE;
|
|
|
}
|
|
|
|
|
@@ -1704,9 +1783,13 @@ BOOL COTA::GetKeyInfo(std::string host, std::string context, std::string keyname
|
|
|
TCHAR szMsg[250] = { 0 };
|
|
|
_stprintf_s(szMsg, _T("http Code is not equal to 200, desc=%s\r"), desc.c_str());
|
|
|
ShowMessage(szMsg);
|
|
|
+
|
|
|
// 如果是上报接口,500表示成功;
|
|
|
if (host.rfind("/report.do?") != std::string::npos && _tcsicmp(code.c_str(), "500") == 0)
|
|
|
return TRUE;
|
|
|
+
|
|
|
+ Global::WriteReportLog(0, __FUNCTION__, "http Code is not equal to 200: host=%s, content=%s, result=%s", host.c_str(), context.c_str(), result.c_str());
|
|
|
+
|
|
|
return FALSE;
|
|
|
}
|
|
|
|
|
@@ -1742,6 +1825,8 @@ BOOL COTA::GetKeyInfo(std::string host, std::string context, std::string keyname
|
|
|
{
|
|
|
LOG4C((LOG_ERROR, "(http=%s)xml value is empty!", context.c_str()));
|
|
|
ShowMessage(_T("http xml value is empty!\r"));
|
|
|
+ Global::WriteReportLog(0, __FUNCTION__, "http xml value is empty: host=%s, content=%s, result=%s", host.c_str(), context.c_str(), result.c_str());
|
|
|
+
|
|
|
return FALSE;
|
|
|
}
|
|
|
}
|
|
@@ -1786,6 +1871,8 @@ void COTA::UpgradeCheck(std::string factoryNum)
|
|
|
if (strResHttp.size() == 0)
|
|
|
{
|
|
|
LOG4C((LOG_WARN, "返回结果空:post=%s;return=%s", strContext.c_str(), strResHttp.c_str()));
|
|
|
+ Global::WriteReportLog(0, __FUNCTION__, "http No data return: host=%s, content=%s, result=%s", strHttpUrl.c_str(), strContext.c_str(), strResHttp.c_str());
|
|
|
+
|
|
|
ReportUpgrade(FALSE, szVersion, factoryNum);
|
|
|
return;
|
|
|
}
|
|
@@ -1797,6 +1884,8 @@ void COTA::UpgradeCheck(std::string factoryNum)
|
|
|
{
|
|
|
cJSON_Delete(pJson);
|
|
|
LOG4C((LOG_WARN, "cJSON解析时出错:post=%s;return=%s", strContext.c_str(), strResHttp.c_str()));
|
|
|
+ Global::WriteReportLog(0, __FUNCTION__, "JSON Parsing Error: host=%s, content=%s, result=%s", strHttpUrl.c_str(), strContext.c_str(), strResHttp.c_str());
|
|
|
+
|
|
|
ReportUpgrade(FALSE, szVersion, factoryNum);
|
|
|
return;
|
|
|
}
|
|
@@ -1811,6 +1900,8 @@ void COTA::UpgradeCheck(std::string factoryNum)
|
|
|
{
|
|
|
cJSON_Delete(pJson);
|
|
|
LOG4C((LOG_WARN, "升级接口没有升级内容:post=%s;return=%s", strContext.c_str(), strResHttp.c_str()));
|
|
|
+ Global::WriteReportLog(0, __FUNCTION__, "Upgrade interface has no upgrade content: host = %s, content = %s, result = %s", strHttpUrl.c_str(), strContext.c_str(), strResHttp.c_str());
|
|
|
+
|
|
|
//ReportUpdateResult(FALSE, strVer);
|
|
|
return;
|
|
|
}
|
|
@@ -1835,6 +1926,8 @@ void COTA::UpgradeCheck(std::string factoryNum)
|
|
|
if (upresult.status.compare("0000") != 0)
|
|
|
{
|
|
|
LOG4C((LOG_WARN, "升级接口http返回出错:post=%s;return=%s", strContext.c_str(), strResHttp.c_str()));
|
|
|
+ Global::WriteReportLog(0, __FUNCTION__, "Error upgrading interface: host = %s, content = %s, result = %s", strHttpUrl.c_str(), strContext.c_str(), strResHttp.c_str());
|
|
|
+
|
|
|
ReportUpgrade(FALSE, szVersion, factoryNum);
|
|
|
return;
|
|
|
}
|
|
@@ -1845,6 +1938,8 @@ void COTA::UpgradeCheck(std::string factoryNum)
|
|
|
if (_tcsicmp(szVersion , upresult.upcontent.version.c_str()) > 0 )
|
|
|
{
|
|
|
LOG4C((LOG_NOTICE, "当前版本(%s)比服务器版本(%s)新", szVersion, upresult.upcontent.version.c_str()));
|
|
|
+ Global::WriteReportLog(0, __FUNCTION__, "The current version (%s) is newer than the server version (%s).", szVersion, upresult.upcontent.version.c_str());
|
|
|
+
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -1857,6 +1952,8 @@ void COTA::UpgradeCheck(std::string factoryNum)
|
|
|
LOG4C((LOG_NOTICE, "下载升级文件失败"));
|
|
|
MessageBox(NULL, _T("Download failure."), _T("Tips"), MB_OK | MB_TOPMOST | MB_ICONINFORMATION);
|
|
|
ReportUpgrade(FALSE, szVersion, factoryNum);
|
|
|
+ Global::WriteReportLog(0, __FUNCTION__, "Failed to download upgrade file=%s", upresult.upcontent.fileurl.c_str());
|
|
|
+
|
|
|
return;
|
|
|
}
|
|
|
else
|
|
@@ -1886,6 +1983,8 @@ void COTA::UpgradeCheck(std::string factoryNum)
|
|
|
DWORD dwError = GetLastError();
|
|
|
LOG4C((LOG_ERROR, "执行rename程序失败,错误码=%d", dwError));
|
|
|
MessageBox(NULL, _T("Upgrade failure."), _T("Tips"), MB_OK | MB_TOPMOST | MB_ICONINFORMATION);
|
|
|
+ Global::WriteReportLog(0, __FUNCTION__, "Upgrade failed, Error=%d", dwError);
|
|
|
+
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -1893,7 +1992,10 @@ void COTA::UpgradeCheck(std::string factoryNum)
|
|
|
if (hProcess != NULL)
|
|
|
CloseHandle(hProcess);
|
|
|
else
|
|
|
+ {
|
|
|
LOG4C((LOG_WARN, "执行rename程序失败,进程句柄空"));
|
|
|
+ Global::WriteReportLog(0, __FUNCTION__, "Upgrade failed, Process handle empty");
|
|
|
+ }
|
|
|
|
|
|
// 提示升级程序执行;
|
|
|
LOG4C((LOG_NOTICE, "后台升级程序执行成功,程序退出后自动覆盖文件"));
|
|
@@ -1929,6 +2031,8 @@ void COTA::ReportUpgrade(BOOL bUpgrade, std::string ver, std::string num)
|
|
|
if (pJson == NULL)
|
|
|
{
|
|
|
LOG4C((LOG_WARN, "解析JSON失败:post=%s;return=%s", strContext.c_str(), strResHttp.c_str()));
|
|
|
+ Global::WriteReportLog(0, __FUNCTION__, "JSON Parsing Error: host=%s, content=%s, result=%s", strHttpUrl.c_str(), strContext.c_str(), strResHttp.c_str());
|
|
|
+
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -1955,6 +2059,8 @@ BOOL COTA::DownloadFile(std::string url, std::string savePath)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ Global::WriteReportLog(0, __FUNCTION__, "Failed to download file: host = %s", url.c_str());
|
|
|
+
|
|
|
return FALSE;
|
|
|
}
|
|
|
|
|
@@ -1990,6 +2096,8 @@ BOOL COTA::ReportLog(TReportData& repdata)
|
|
|
if (pJson == NULL)
|
|
|
{
|
|
|
LOG4C((LOG_WARN, "解析JSON失败:post=%s;return=%s", strContext.c_str(), strResHttp.c_str()));
|
|
|
+ Global::WriteReportLog(0, __FUNCTION__, "JSON Parsing Error: host=%s, content=%s, result=%s", strHttpUrl.c_str(), strContext.c_str(), strResHttp.c_str());
|
|
|
+
|
|
|
return FALSE;
|
|
|
}
|
|
|
|
|
@@ -2001,6 +2109,8 @@ BOOL COTA::ReportLog(TReportData& repdata)
|
|
|
return TRUE;
|
|
|
}
|
|
|
|
|
|
+ Global::WriteReportLog(0, __FUNCTION__, "http Code is not equal to 200: host=%s, content=%s, result=%s", strHttpUrl.c_str(), strContext.c_str(), strResHttp.c_str());
|
|
|
+
|
|
|
return FALSE;
|
|
|
}
|
|
|
|