天天看點

capl儲存trace_用于診斷服務的CAPL腳本

我正在編寫CAPL腳本以自動化診斷服務 . 我已經閱讀了一些大于8位元組的DID . 直到8個位元組,我可以正确捕獲我的CAPL腳本中的資料,但是當資料大小超過8個位元組時,我得到剩餘位元組的一些垃圾值00 .

我可以在CANoe Trace中看到完整的讀取資料,但我無法在CAPL腳本中捕獲它 . 如果有人有任何想法或解決方案,請與我分享 .

在Belo腳本中,問題是我可以正确地捕獲值直到this.byte(7) . 但是對于this.byte(8)和this.byte(9)我讀了00,盡管CANoe Trace中的實際值是0x54和0x66 . 是以這意味着我無法從CAN中讀取CAPL中超過8個位元組 .

我的腳本看起來像:

variables

{

//Please insert your code below this comment

byte test_num;

message DTOOL_to_UPA msg_tester;

mstimer readTimerDID_2001;

mstimer defaultSession;

byte readBuf2001[8];

}

// read request

on key 'd'

{

test_num = 0;

msg_tester.dlc = 8;

msg_tester.dir = tx;

msg_tester.can = 1;

settimer(defaultSession, 2000);

}

on timer defaultSession // Request DID: 10 01

{

msg_tester.byte(0) = 0x02;

msg_tester.byte(1) = 0x10;

msg_tester.byte(2) = 0x01;

output(msg_tester);

settimer(readTimerDID_2001, 100);

canceltimer(defaultSession);

}

on timer readTimerDID_2001 // Read Request DID: 22 20 01

{

msg_tester.byte(0) = 0x03;

msg_tester.byte(1) = 0x22;

msg_tester.byte(2) = 0x20;

msg_tester.byte(3) = 0x01;

output(msg_tester);

canceltimer(readTimerDID_2001);

}

on message UPA_to_DTOOL

{

if (this.DIR == RX)

{

// Response Data for DID 2001

if ((this.byte(0)== 0x04)&&(this.byte(1)== 0x62)&&(this.byte(2)==0x20)&&

(this.byte(3)== 0x01)&&(this.byte(4)== 0x23) &&(this.byte(5)== 0x00)

&&(this.byte(6)== 0x44)&&(this.byte(7)== 0x22) &&(this.byte(8)==0x54)&&

(this.byte(9)== 0x66))

{

readDID2001();

}

}

}