读完DLT Log后,我想解析它并将其存储在我想要的字段中。 它从来都不是 DLT VIEWER 实现。我只想读取日志,然后将日志保存在我的结构中。
已经实现输出到DLT LOG。
目前我已经实现了以下代码来读取DLT日志。
FILE *pLogFile = NULL;
pLogFile = fopen(DLTfilename, "rb") ;
if ( pLogFile )
{
while ( fgets( buff, gBuffSize, pLogFile ) )
{
for ( int i=0; i < gBuffSize - 13 ; ++i )
{
// LF
if ( buff[i] == 0x0A )
{
break ;
}
//...............
//read and save
//...............
}
}
}
上面的代码扫描每个字节,直到找到想要的字符串,但是太慢了!我正在寻找一种优化它的方法。
我尝试了几种方法来读取每一行,但我无法将其作为“
\n
”这样的分隔符来读取,当我用记事本之类的程序读取它时,我注意到字符是混合的。
我有两个问题。
我在互联网上搜索,但我无法得到任何关于其结构的线索。
让我知道我可以参考哪些网站就足够了。
DLT日志格式的基本结构:标头+负载
Autosar std 20-11 术语:
Log and trace message:
A log and trace message contains all data and options to describe a log
and trace event in a software. A log and trace message consists of a
header and payload.
标题:
+Pattern: DLT0x01
+Broken time (ISO C)
+Microsecond of broken time
+Epoch of system/Timestamp
+Msg counter
+ECU ID
+APP ID
+Info of msg type and length
+Verbose status
+Number of arguments
标头内:标准标头+扩展标头
欲了解更多信息: