diff --git a/CAN_Bootloader/dlg/诊断子窗口.aardio b/CAN_Bootloader/dlg/诊断子窗口.aardio index 54a0352..4858b01 100644 --- a/CAN_Bootloader/dlg/诊断子窗口.aardio +++ b/CAN_Bootloader/dlg/诊断子窗口.aardio @@ -1,24 +1,28 @@ import win.ui; /*DSG{{*/ -var winform = win.form(text="诊断读取";right=679;bottom=319;border="thin";max=false;mode="popup") +var winform = win.form(text="诊断读取";right=679;bottom=499;border="thin";max=false;mode="popup") winform.add( -btnDID_1701={cls="button";text="电机当前位置霍尔数";left=36;top=162;right=163;bottom=193;z=5}; -btnDID_1702={cls="button";text="软止点位置霍尔数";left=36;top=203;right=163;bottom=234;z=6}; -btnDID_1706={cls="button";text="软止点学习状态";left=178;top=40;right=305;bottom=71;z=7}; -btnDID_1707={cls="button";text="座椅电机电流";left=178;top=80;right=305;bottom=111;z=8}; -btnDID_1708={cls="button";text="模块输入信号状态";left=178;top=121;right=305;bottom=152;z=9}; -btnDID_1709={cls="button";text="模块输出信号状态";left=178;top=162;right=305;bottom=193;z=11}; -btnDID_170B={cls="button";text="系统供电电压";left=178;top=203;right=305;bottom=234;z=10}; -btnDID_F187={cls="button";text="车辆备用零部件编号";left=36;top=40;right=163;bottom=71;z=2}; -btnDID_F18A={cls="button";text="供应商公司名称代码";left=36;top=80;right=163;bottom=111;z=3}; +btnDID_F010={cls="button";text="F010";left=178;top=162;right=305;bottom=193;z=11}; +btnDID_F010w={cls="button";text="写F010";left=336;top=296;right=463;bottom=327;z=16}; +btnDID_F101={cls="button";text="F101";left=178;top=203;right=305;bottom=234;z=10}; +btnDID_F101w={cls="button";text="写F101";left=338;top=335;right=458;bottom=366;z=15}; +btnDID_F159={cls="button";text="F159";left=36;top=162;right=163;bottom=193;z=5}; +btnDID_F15A={cls="button";text="F15A";left=36;top=203;right=163;bottom=234;z=6}; +btnDID_F180={cls="button";text="F180";left=178;top=40;right=305;bottom=71;z=7}; +btnDID_F187={cls="button";text="零部件编号";left=36;top=40;right=163;bottom=71;z=2}; +btnDID_F18A={cls="button";text="供应商名称";left=36;top=80;right=163;bottom=111;z=3}; +btnDID_F18C={cls="button";text="F18C";left=178;top=80;right=305;bottom=111;z=8}; +btnDID_F190={cls="button";text="F190 VIN";left=178;top=121;right=305;bottom=152;z=9}; btnDID_F197={cls="button";text="ECU 系统名称";left=36;top=121;right=163;bottom=152;z=4}; +btn_1003={cls="button";text="扩展会话";left=22;top=296;right=126;bottom=323;z=14}; +btn_2701={cls="button";text="解锁";left=158;top=296;right=262;bottom=323;z=13}; groupbox={cls="groupbox";text="DID";left=16;top=12;right=328;bottom=260;edge=1;z=1}; groupbox2={cls="groupbox";text="DTC";left=343;top=12;right=655;bottom=260;edge=1;z=12} ) /*}}*/ -winform.btnDID_F187.oncommand = function(id,event){ - DiagReadDID(0xF187); +winform.btnDID_F180.oncommand = function(id,event){ + DiagReadDID(0xF180); } winform.btnDID_F18A.oncommand = function(id,event){ @@ -29,32 +33,28 @@ winform.btnDID_F197.oncommand = function(id,event){ DiagReadDID(0xF197); } -winform.btnDID_1701.oncommand = function(id,event){ - DiagReadDID(0x1701); +winform.btnDID_F159.oncommand = function(id,event){ + DiagReadDID(0xF159); } -winform.btnDID_1702.oncommand = function(id,event){ - DiagReadDID(0x1702); +winform.btnDID_F15A.oncommand = function(id,event){ + DiagReadDID(0xF15A); } -winform.btnDID_1706.oncommand = function(id,event){ - DiagReadDID(0x1706); +winform.btnDID_F18C.oncommand = function(id,event){ + DiagReadDID(0xF18C); } -winform.btnDID_1707.oncommand = function(id,event){ - DiagReadDID(0x1707); +winform.btnDID_F190.oncommand = function(id,event){ + DiagReadDID(0xF190); } -winform.btnDID_1708.oncommand = function(id,event){ - DiagReadDID(0x1708); +winform.btnDID_F010.oncommand = function(id,event){ + DiagReadDID(0xF010); } -winform.btnDID_1709.oncommand = function(id,event){ - DiagReadDID(0x1709); -} - -winform.btnDID_170B.oncommand = function(id,event){ - DiagReadDID(0x170B); +winform.btnDID_F101.oncommand = function(id,event){ + DiagReadDID(0xF101); } winform.onClose = function(hwnd,message,wParam,lParam){ @@ -62,6 +62,26 @@ winform.onClose = function(hwnd,message,wParam,lParam){ return 0; } +winform.btn_2701.oncommand = function(id,event){ + ::PostThreadMessage(thrdId,114,0x01,0)//自定义消息 +} + +winform.btn_1003.oncommand = function(id,event){ + ::PostThreadMessage(thrdId,111,0x00,0x03)//自定义消息 +} + +winform.btnDID_F187.oncommand = function(id,event){ + DiagReadDID(0xF187); +} + +winform.btnDID_F010w.oncommand = function(id,event){ + ::PostThreadMessage(thrdId,115,0xF010,0x00)//自定义消息 +} + +winform.btnDID_F101w.oncommand = function(id,event){ + ::PostThreadMessage(thrdId,115,0xF101,0x00)//自定义消息 +} + winform.show(); win.loopMessage(); return winform; \ No newline at end of file diff --git a/CAN_Bootloader/user/CanThread.aardio b/CAN_Bootloader/user/CanThread.aardio index 79156db..37d2951 100644 --- a/CAN_Bootloader/user/CanThread.aardio +++ b/CAN_Bootloader/user/CanThread.aardio @@ -9,6 +9,20 @@ DiagReqID = 0x748;//0x18dadff1; DiagRespID = 0x7C8;//0x18daf1df; DiagGloableID = 0x7DF;//0x18DB33F1; stopflag = 0; + +write2Etest = function(did){ + select(did) { + case 0xF010 { + var data = {1,2,3,4, 0,0,0,0, 0,0,0,0, 0,0,0,0,}; + FuncReq2E(did,data); + } + case 0xF101 { + var data = {1,2,3,4, 0,0,0,0, }; + FuncReq2E(did,data); + } + } +} + //注册一个消息钩子函数 FuncLoopMsg = function(msg){ select(msg.message) { @@ -51,7 +65,7 @@ FuncLoopMsg = function(msg){ FuncReadDID(msg.wParam); } case 111 { - FuncReq10(msg.wParam); + FuncReq10(msg.wParam,msg.lParam); } case 112 { FuncReq28(msg.wParam); @@ -62,8 +76,11 @@ FuncLoopMsg = function(msg){ case 114 { FuncReq27(msg.wParam); } + case 115 { + write2Etest(msg.wParam) + } else { - + } } } diff --git a/CAN_Bootloader/user/GeelySecurety.aardio b/CAN_Bootloader/user/GeelySecurety.aardio index ec45635..bbfc84d 100644 --- a/CAN_Bootloader/user/GeelySecurety.aardio +++ b/CAN_Bootloader/user/GeelySecurety.aardio @@ -11,20 +11,43 @@ securetyKeyCalc = function(pucSeed,ucSecurityLevel){ seed[4]=pucSeed[1]; select(ucSecurityLevel) { case 0x01 { + /* cal[1] = seed[1]^xorArray[1]; cal[2] = seed[2]^xorArray[2]; cal[3] = seed[3]^xorArray[3]; cal[4] = seed[4]^xorArray[4]; - /* - key[3] = ((cal[0]&0x0F)<<4)|( cal[0]&0xF0); - key[2] = ((cal[2]&0x0F)<<4)|((cal[3]&0xF0)>>4); - key[1] = (cal[2]&0xF0)|((cal[1]&0xF0)>>4); - key[0] = ((cal[3]&0x0F)<<4)|( cal[1]&0x0F); - */ key[4] = ((cal[1]&0x0F)<<4)|( cal[1]&0xF0); key[3] = ((cal[3]&0x0F)<<4)|((cal[4]&0xF0)>>4); key[2] = (cal[3]&0xF0)|((cal[2]&0xF0)>>4); key[1] = ((cal[4]&0x0F)<<4)|( cal[2]&0x0F); + */ + var dll = raw.loadDll("/MSW.dll",,"cdecl" ); + // + if(dll != null){ + FuncDisplay("加载密钥dll成功"); + var retlen = raw.buffer(4,0); + var seedraw = raw.buffer(4,0); + var iVariant = raw.buffer(20,0); + var keyraw = raw.buffer(4,0); + seedraw[1] = pucSeed[1]; + seedraw[2] = pucSeed[2]; + seedraw[3] = pucSeed[3]; + seedraw[4] = pucSeed[4]; + var ret = 0; + ret = dll.GenerateKeyEx(seedraw,4,0x01,iVariant,keyraw,4,retlen); + FuncDisplay("ret = " ++ ret ); + + key[1] = keyraw[1]; + key[2] = keyraw[2]; + key[3] = keyraw[3]; + key[4] = keyraw[4]; + return key; + } + else { + FuncDisplay("加载密钥dll失败"); + } + + } case 0x03 { /*