UDS-会话层服务

1.会话层服务

该服务接口定义了一组用于获取会话层功能的服务,如数据的发送、接收、协议参数的设置。

所有会话层服务定义了三组服务原语(service primitives),服务原语定义了服务使用者(如,diagnostic application)与服务提供者(如, session layer)间的相互合作。三组服务原语如下:

-服务请求原语 S_Data.request: 应用层用来向会话层传递控制信息或需要发送的数据。结构如下:(S_Mtype, S_SA, S_TA, S_TAtype, [S_AE],S_Data [Data#1, Data#2,...], S_Length)

-服务指示原语 S_Data.indication: 会话层用来向应用层传递状态信息或接收到的数据。结构如下:(S_Mtype, S_SA, S_TA, S_TAtype, [S_AE], S_Result)

-服务确认原语 S_Data.confirm:应用层用来向会话层传递控制信息。结构如下:

(S_Mtype, S_SA, S_TA, S_TAtype, [S_AE], S_Data [Data#1, Data#2,...], S_Length, S_Result)

注:

S_Mtype: 会话层报文类型,有diagnositics, remote diagnostics两种. 如果为diagnositcs, 地址信息包括S_SA, S_TA, S_TAtype; 如果为remote diagnositcs, 地址信息包括S_SA, S_TA, S_TAtype, S_-AE;

S_SA: 会话层源地址,2 byte的无符号整型,范围0x0000 - 0xFFFF;

S_TA: 会话层目标地址,2 byte的无符号整型,范围0x0000 - 0xFFFF;

S_TAtype: 会话层目标地址类型,有physical(1对1通信),functional(1对多通信)两种;

S_AE: 会话层地址扩展(可选),2 byte的无符号整型,范围0x0000 - 0xFFFF;

S_Length: 4 byte的无符号整型,范围0x0000 0000 - 0xFFFF FFFF;

 

图1 会话层服务原语-单帧
图1 会话层服务原语-单帧

 

图2 会话层服务原语-多帧

 

会话层协议数据单元(S_PDU)与传输/网络层协议数据单元(T_PDU)的对应关系:

图3 S_PDU与T_PDU的对应关系

 

2.时间参数定义

2.1 一般应用程序计时注意事项

服务端(ECU):ECU使用单个应用程序计时器P2Server,该计时器由T_Data服务原语接口(T_Data.ind, T_Data.con, T_Data.req)来触发(开始计时,结束计时)。P2Server加载P2Server_max/P2*Server_max的值。

P2Server: Performance requirement for the server to start with the response message after the receptionof a request message (indicated via T_Data.ind). ECU接收到请求报文到发送响应报文之间的时间;ECU应在该时间内进行响应;推荐50ms。


P4Server: This is the time between the reception of a request (T_Data.indication) and the start of the transmission of the final response (T_Data.request) at the server side. ECU接收到请求后到最终返回正响应或负响应(除0x78)的时间;P4server定义的是从接收到请求(T_Data.indiaction)到final response(T_Data.request)间的时间;final response指的是正响应或负响应(除了0x78);P4server属于一个性能方面的要求。如果P4server与P2server相同,则意味着,该服务或数据不支持负响应码0x78。

客户端(Tester): Tester使用单个应用程序计时器PClient,该计时器由T_Data服务原语接口(T_Data.ind, T_Data.con, T_DataSOM.ind)来触发(开始、重载、停止)。P2Server加载P2Client_max/P2*Client_max的值。(T_DataSOM.ind: The transport/network layer indication for the reception of a StartOfMessage T_PDU. it is only used within the session layer to perform the session layer timing.)

P2Client: Timeout for the client to wait after the successful transmission of a request message (indicatedvia T_Data.con) for the start of incoming response messages (indicated via T_DataSOM.ind of a multi-frame message or T_Data.ind of a SingleFrame message). Client发送请求报文后的等待时间, 若该时间内未收到响应则超时。

P2*ClientEnhanced timeout for the client to wait after the reception of a negative response messagewith negative response code 0x78 (indicated via T_Data.ind) for the start of incomingresponse messages (indicated via T_DataSOM.ind of a multi-frame message or T_Data.indof a SingleFrame message). Client接收到0x78负响应后的等待的时间;若该时间内未收到响应则超时。

图4 Example for each timing parameter

 

2.2 非默认会话模式下的会话层时间参数要求

在非默认诊断会话模式下,还需满足如下会话层时间参数的要求:

S3Client: Time between functionally addressed TesterPresent (0x3E) request messages transmitted by the client to keep a diagnostic session other than the defaultSession active inmultiple servers (functional communication) or maximum time between physically transmitted request messages to a single server (physical communication). The S3Client timeout value includes the travel time of the message on the network (gateway delays,etc.). 为使ECU保持非默认会话不退出,Client应在该时间内发送0x3E服务; 推荐2000ms。

S3Server: Time for the server to keep a diagnostic session other than the defaultSession active while not receiving any diagnostic requestmessage. The tolerance of S3Server is -0 ms, +200 ms. ECU在该时间内,如果没有接受到任何诊断请求报文(包括其不支持的服务),则退出当前非默认会话。

ECU在进入某非默认会话时,其应用层参数P2Server、P2*Server可能会改变。ECU会通过DiagnosticSessionControl 服务返回这些参数给Client端. 此时,Client端需要调整其内部时间参数。

Client应对TesterPresent(0x3E)请求的寻址方式进行区分,Server无需进行区分。此外,一旦接收到诊断请求报文,即使该服务Server不支持,S3Server也重新计时。

                                          图5 Functional communication during non-default session

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值