一、周期调用的函数:Dlt_TxFunction

根据参数DltGeneralTrafficShapingSupport,决定如何去发送DLT消息。如果为TRUE,那需要参考参数DltLogChannelTrafficShapingBandwidth为每个Log通道设置发送带宽;如果为FALSE,那么所有缓存的DLT消息会立即发送。

    /* traffic shaping */
#if (DLT_ENABLE_TRAFFIC_SHAPING == STD_ON)
    txChannel->trafficShapingTimer += txChannel->transmitCycleTime;
    if (txChannel->trafficShapingTimer >= DLT_TIME_1S) {
        txChannel->trafficShapingTimer = 0u;
        txChannel->trafficShapingCount = 0u;
    }

    if (txChannel->trafficShapingCount >= txChannel->trafficShapingBandwidth) {
        Dlt_OverflowHandle(txChannel); /* avoid overflowTimer stop updating */
        return;
    }
#endif

Dlt_TxFunction函数会检查“缓冲溢出”标识。如果发生溢出,那么DLT命令“BufferOverflowNotification”会立即发出,直到“溢出”标识被清掉(经过DltLogChannelBufferOverflowTimer参数配置的时间,此标识自动被清掉)

如果一个DLT消息无法被发送,那么每次调用Dlt_TxFunction都会尝试发送一次该消息,直到尝试了DltLogChannelMaxNumOfRetries参数所配置的次数。

二、上层调用函数

2.1. Dlt_Init

读懂AUTOSAR :DiagnosticLogAndTrace DLT(四)-- API解析-LMLPHP

2.2.  Dlt_RegisterContext

读懂AUTOSAR :DiagnosticLogAndTrace DLT(四)-- API解析-LMLPHP

 入参:

1.  sessionId -- 对于BSW而言,应传入模块ID; 对于SWC而言,应传入端口定义参数值(port defined argument value)

2. appId -- 要注册的Application ID

3. contextId -- 要注册的Context ID

4. appDescription -- app 描述,最长255个字符 (这里所说的描述到底是什么?

5.  lenAppDescription -- app描述的字符长度

6. contextDescription -- context描述,最长255个字符

7. lenContextDescription -- context描述的字符长度

2.3. Dlt_SendLogMessage

这是BSW模块或SWC模块所使用的发送LOG报文的接口

读懂AUTOSAR :DiagnosticLogAndTrace DLT(四)-- API解析-LMLPHP读懂AUTOSAR :DiagnosticLogAndTrace DLT(四)-- API解析-LMLPHP

 有如下入参。

sessionId--仅仅对BSW来讲,这实际上是模块号。例如Det模块号15.

logInfo--对报文进行滤波的相关信息的结构体。

logData--被记录的参数的buffer,这个指针表示Log报文的payload。

logDataLength--数据buffer的长度

04-13 03:52