马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
媒介
SOME/IP协议越来越多的用于汽车电子行业中,关于协议详细完全的中文资料却没有,以是我将联合工作履历并对照英文原版协议做一系列的文章。基天职三大块:
1. SOME/IP协议讲授
2. SOME/IP-SD协议讲授
3. python/C++举例调试讲授
<hr> 4.2.6 Error Handling
Error handling can be done in the application or the communication layer below. Therefore SOME/IP supports two different mechanisms:
• Return Codes in the Response Messages of methods
• Explicit Error Messages
SOME/IP 在两种情况发送 错误消息
1. method 的 相应消息
消息范例是0x80 , ReturnCode 设置错误码
2. 显式的直接发送 错误码
消息范例是0x81, ReturnCode 设置错误码 payload中携带更多的错误信息
可以任选其一
大概 两种都用
Which one of both is used, depends on the configuration.
[PRS_SOMEIP_00901]
Upstream requirements: RS_SOMEIP_00008
Return Codes in the RESPONSE Messages (Message Type 0x80) of methods shall
be used to transport application errors and the response data of a method from the
provider to the caller of a method. Message Type RESPONSE 0x80 shall be used
in cases where no additional/extended error information (apart from the error code
encoded in the Return Code field) needs to be propagated to the caller.
Note:
Please be aware that return codes of the Request and Response methods are not
treated as errors from the point of view of SOME/IP. This means that the message type
is still 0x80 if a request/response method exits with a return code not equal to 0x00
(message type is still 0x80 if ApplicationError of AUTOSAR ClientServerOperation is
different from E_OK).
method response的消息范例是0x80(非错误消息)
站在SOMEIP的角度 returnCode 中的错误码 不是真正的错误消息 ,只是应用步伐处置惩罚的非OK的结果。
[PRS_SOMEIP_00902]
Upstream requirements: RS_SOMEIP_00008
Explicit Error Messages shall be used to transport application errors and the response
data or generic SOME/IP errors from the provider to the caller of a method.
[PRS_SOMEIP_00903] 0x81消息范例的利用作用
Upstream requirements: RS_SOMEIP_00008
If more detailed error information (apart from an error code encoded in the Return
Code field) needs to be propagated to the caller, an ERROR message (Message type
0x81) shall be used. The payload of the Error Message shall be filled with serialized
error specific data, e.g. an exception string, or other error information. This additional
error information shall be modeled in the interface description, or defined by the standard.
This can be used to handle all different application errors that might occur in the server.
In addition, problems with the communication medium or intermediate components
(e.g. switches) may occur, which have to be handled e.g. by means of reliable transport.
All messages have a return code field in their header. (See chapter 4.1.2)
这段内容([PRS_SOMEIP_00903])形貌了 **SOME/IP 协议** 中 **0x81 消息范例(ERROR 消息)** 的利用场景和作用。以下是详细表明:
---
### 焦点作用
1. **流传详细的错误信息**:
- 当必要向调用方通报比 **Return Code** 字段更详细的错误信息时,应利用 **ERROR 消息(消息范例 0x81)**。
- ERROR 消息的有效载荷(payload)可以包罗序列化的错误特定命据,比方非常字符串或其他错误信息。
2. **错误信息的标准化**:
- 额外的错误信息应在接口形貌中建模,或由标准界说。
- 这确保了错误信息的格式和内容在差别实现之间保持同等。
3. **应用错误的处置惩罚**:
- ERROR 消息可用于处置惩罚服务器中大概发生的全部差别范例的应用错误。
4. **通讯标题的处置惩罚**:
- 除了应用错误外,通讯介质或中央组件(如互换机)的标题也大概发生。
- 这些标题可以通过可靠的传输机制(如 TCP)来处置惩罚。
---
### 关键点
1. **ERROR 消息的结构**:
- ERROR 消息的消息范例为 **0x81**。
- 消息头中包罗 **Return Code** 字段,用于指示错误的根本范例。
- 消息的有效载荷可以包罗详细的错误信息,比方非常字符串或其他数据。
2. **Return Code 字段**:
- 全部 SOME/IP 消息的头部都包罗一个 Return
|