Java代码
void CClearDtc::ClearCode(const CString &strEcu)
{
adsMessageBox(STD_TEXT_INFORMATION, STD_TEXT_COMMING, DF_MB_NOBUTTON);
CBinary binEcu = SetBinary(CB_ReadDtc, HexStrToBinary(strEcu), 4);
CString strFilePath;
strFilePath = "\\EcuFiles\\" + strEcu + ".ods";
CDataSheet openFile;
openFile.Open(strFilePath);
openFile.SetKey(binEcu);
CString strEraserCmd = openFile.GetValue(STR_Menu, STR_EraserCmd);
if (strEraserCmd.IsEmpty())
{
adsMessageBox(STD_TEXT_INFORMATION, STD_TEXT_FUNC_NOT_SUPPORT, DF_MB_OK);
return;
}
D_I32 iRet = adsMessageBox(STD_MENU_CLEAR_DTC, STD_TEXT_CONFIRMING, DF_MB_YESNO);
if (DF_IDNO == iRet)
{
return;
}
iRet = adsMessageBox(STD_MENU_CLEAR_DTC, STD_TEXT_CLEAR_DTC, DF_MB_YESNO);
if (DF_IDNO == iRet)
{
return;
}
CBinary binEraserCmd, binRequest, binResponse, binRecv;
CString strRequest, strReqDelay, strResponse;
//清码命令可能有多条
CGroup<CString>vctEraserCmd;
Split(vctEraserCmd, strEraserCmd, "#");
for (D_I16 iCmd = 0; iCmd < vctEraserCmd.GetSize(); iCmd++)
{
binEraserCmd = SetBinary(binEcu, StrHextoBinary(vctEraserCmd[iCmd]), 1);
openFile.SetKey(binEraserCmd);
strRequest = openFile.GetValue(STR_Req, STR_Request);
binRequest = HexStrToBinary(strRequest);
strReqDelay = openFile.GetValue(STR_Req, STR_ReqDelay);
strResponse = openFile.GetValue(STR_Rsp, STR_Response);
binResponse = HexStrToBinary(strResponse);
binRecv = SendCmd(binRequest);
if (!strReqDelay.IsEmpty())
{
Delay(StrToInt(strReqDelay));
}
}
adsMessageBox(STD_MENU_CLEAR_DTC, STD_TEXT_CLEARING_DTC, DF_MB_NOBUTTON);
if (binRecv.IsEmpty())//只要有收到命令即可清码,不需要SID位+0x40
{
adsMessageBox(STD_MENU_CLEAR_DTC, STD_TEXT_COMM_FAIL, DF_MB_OK);
}
else
{
adsMessageBox(STD_MENU_CLEAR_DTC, STD_TEXT_SUCCESS, DF_MB_OK);
}
}
下面是js代码
function TZ() {
var Text = document.getElementById("Times"); //获取Timer值
var TIME = Text.innerHTML - 1; //减去1
if (TIME == 0) { //如果已经减到了0,就开始操作
javascript: location.href = 'Loging.aspx?TZ_BYKJ=10086&ID=011011000110&BuyTime=201408060953&WEBID=1&Buyuser=urltitle';
} else {
Text.innerHTML = TIME; //没有好?把减去的值赋给Timers
}
setTimeout("TZ()", 1000);
}
TZ();