当前位置: 首页 > news >正文

SOME/IP--协议英文原文讲解10

前言
SOME/IP协议越来越多的用于汽车电子行业中,关于协议详细完全的中文资料却没有,所以我将结合工作经验并对照英文原版协议做一系列的文章。基本分三大块:

1. SOME/IP协议讲解

2. SOME/IP-SD协议讲解

3. python/C++举例调试讲解


4.2.2 Request/Response Communication

One of the most common communication patterns is the request/response pattern.
One communication partner (Client) sends a request message, which is answered by
another communication partner (Server).
最常用的通信模型 就是 请求/响应模型,client请求 server回复响应.

[PRS_SOMEIP_00920]发送请求包 按照下面的步骤 就没错
Upstream requirements: RS_SOMEIP_00007
For the SOME/IP request message the client has to do the following for payload and
header:
• Construct the payload
• Set the Message ID based on the method the client wants to call
• Set the Length field to 8 bytes (for the part of the SOME/IP header after the length
field) + length of the serialized payload
8个字节是header length字段 后面的长度 
  +
payload的长度
• Optionally set the Request ID to a unique number (shall be unique for client only)
• Set the Protocol Version according [PRS_SOMEIP_00052]
• Set the Interface Version according to the interface definition
• Set the Message Type to REQUEST (i.e. 0x00)
• Set the Return Code to 0x00

[PRS_SOMEIP_00921]
Upstream requirements: RS_SOMEIP_00028, RS_SOMEIP_00007
To construct the payload of a request message, all input or inout arguments of the
method shall be serialized according to the order of the arguments within the signature
of the method.
不管是请求还是响应的参数列表 ,在序列化payload的时必须要按照规范的参数顺序进行序列化。

[PRS_SOMEIP_00922]
Upstream requirements: RS_SOMEIP_00007
The server builds the header of the response based on the header of the client’s
request and does in addition:
• Construct the payload
• take over the Message ID from the corresponding request
• Set the length to the 8 Bytes + new payload size
8个字节是header length字段 后面的长度 
  +
payload的长度
• take over the Request ID from the corresponding request
• Set the Message Type to RESPONSE (i.e. 0x80) or ERROR (i.e. 0x81)
• set Return Code to a return code according to [PRS_SOMEIP_00191].

[PRS_SOMEIP_00923]
Upstream requirements: RS_SOMEIP_00028, RS_SOMEIP_00007
To construct the payload of a response message, all output or inout arguments of the
method shall be serialized according to the order of the arguments within the signature
of the method.

[PRS_SOMEIP_00927]
Upstream requirements: RS_SOMEIP_00007
A server shall not sent a response message for a request with a specific Request ID
until the corresponding request message has been received.
如果client请求的 requestID 与pending的回复中的requestID 重复,则忽略这个消息 不做回复。

[PRS_SOMEIP_00928]
Upstream requirements: RS_SOMEIP_00007
A client shall ignore the reception of a response message with a specific Request ID,
when the corresponding request message has not yet been sent completely.
client收到重复的 requestID 的回复不做处理

4.2.3 Fire&Forget Communication

Requests without response message are called fire&forget.
不需要响应的请求 称为 fire&forget 很多需求规范也可以简写为F&F

[PRS_SOMEIP_00924] 组装格式如下
Upstream requirements: RS_SOMEIP_00006
For the SOME/IP request-no-return message the client has to do the following for
payload and header:
• Construct the payload
• Set the Message ID based on the method the client wants to call
• Set the Length field to 8 bytes (for the part of the SOME/IP header after the length
field) + length of the serialized payload
8个字节是header length字段 后面的长度 
  +
payload的长度
• Optionally set the Request ID to a unique number (shall be unique for client only)
• Set the Protocol Version according [PRS_SOMEIP_00052]
• Set the Interface Version according to the interface definition
• Set the Message Type to REQUEST_NO_RETURN (i.e. 0x01)
• Set the Return Code to 0x00

[PRS_SOMEIP_00171]
Upstream requirements: RS_SOMEIP_00006
Fire & Forget messages shall not return an error. Error handling and return codes
shall be implemented by the application when needed.
没有错误返回 上层应用自己记录处理

4.2.4 Notification Events

Notifications describe a general Publish/Subscribe-Concept. Usually the server publishes a service to which a client subscribes. On certain cases the server will send the
client an event, which could be for example an updated value or an event that occurred.
SOME/IP is used only for transporting the updated value and not for the publishing and
subscription mechanisms. These mechanisms are implemented by SOME/IP-SD.
服务端给向自己订阅的client端 发布 事件, 这些事件可能是周期 或者变化事件。
订阅的逻辑是在SOME/IP-SD协议中实现

[PRS_SOMEIP_00925]
Upstream requirements: RS_SOMEIP_00004
For the SOME/IP notification message the server has to do the following for payload
and header:
• Construct the payload
• Set the Message ID based on the event the server wants to send
• Set the Length field to 8 bytes (for the part of the SOME/IP header after the length
field) + length of the serialized payload
• Set the Client ID to 0x00. Set the Session ID according to
[PRS_SOMEIP_00932], [PRS_SOMEIP_00933], and [PRS_SOMEIP_00521].
In case of active Session Handling the Session ID shall be incremented upon
each transmission.
clientID  --- 设置为0
SessionID -- 按照之前的规范 要递增

• Set the Protocol Version according [PRS_SOMEIP_00052]
• Set the Interface Version according to the interface definition
• Set the Message Type to NOTIFICATION (i.e. 0x02)
• Set the Return Code to 0x00

[PRS_SOMEIP_00926]
Upstream requirements: RS_SOMEIP_00004
The payload of the notification message shall consist of the serialized data of the
event.
payload 要按照要求 序列化数据

[PRS_SOMEIP_00930]
Upstream requirements: RS_SOMEIP_00042
When more than one subscribed client on the same ECU exists, the system shall handle the replication of notifications in order to save transmissions on the communication
medium.

This is especially important, when notifications are transported using multicast messages

这段内容([PRS_SOMEIP_00930])描述了在 **SOME/IP** 中,当同一 ECU(电子控制单元)上有多个订阅客户端时,系统应如何处理通知消息的复制,以减少通信介质上的传输负载。以下是详细解释:

---

### 核心要求
1. **多客户端订阅**:
   - 当同一 ECU 上有多个客户端订阅了相同的服务或事件时,系统需要高效地处理通知消息的复制和分发。

2. **减少传输负载**:
   - 系统应优化通知消息的传输,避免在通信介质上重复发送相同的通知消息。
   - 特别是在使用 **组播(multicast)** 传输通知消息时,这种优化尤为重要。

---

### 关键点
1. **通知消息的复制**:
   - 当多个客户端订阅了相同的服务或事件时,服务端可能会生成相同的通知消息。
   - 系统需要在 ECU 内部复制这些通知消息,而不是通过通信介质多次发送。

2. **组播传输的优化**:
   - 组播是一种高效的通信方式,允许将单个消息发送给多个接收方。
   - 如果通知消息通过组播传输,系统应确保同一 ECU 上的多个客户端共享同一组播消息,而不是为每个客户端单独发送。

3. **通信介质的负载**:
   - 减少重复传输可以显著降低通信介质的负载,提高网络效率。
   - 这对于资源受限的嵌入式系统(如汽车电子系统)尤为重要。

---

### 实现建议
1. **ECU 内部消息复制**:
   - 在 ECU 内部实现消息复制机制,确保多个客户端可以共享同一通知消息。
   - 例如,使用共享内存或消息队列来分发通知消息。

2. **组播消息的共享**:
   - 如果通知消息通过组播传输,ECU 应确保所有订阅客户端都能接收到同一组播消息。
   - 避免为每个客户端单独发送组播消息。

3. **订阅管理**:
   - 实现高效的订阅管理机制,跟踪哪些客户端订阅了哪些服务或事件。
   - 在通知消息生成时,根据订阅列表进行消息分发。

4. **性能优化**:
   - 在 ECU 内部优化消息复制和分发的性能,确保实时性和低延迟。
   - 避免因消息复制导致的性能瓶颈。

---

### 示例场景
假设一个 ECU 上有三个客户端(Client A、Client B 和 Client C)订阅了同一个服务的事件通知。

#### 传统方式(未优化):
- 服务端为每个客户端单独发送通知消息,导致通信介质上传输三次相同的消息。

#### 优化方式:
1. 服务端通过组播发送一次通知消息。
2. ECU 接收到组播消息后,在内部复制并分发给 Client A、Client B 和 Client C。
3. 通信介质上只传输一次通知消息,减少了传输负载。

---

### 总结
[PRS_SOMEIP_00930] 强调了在 SOME/IP 中,当同一 ECU 上有多个订阅客户端时,系统应优化通知消息的复制和分发,以减少通信介质上的传输负载。特别是在使用组播传输通知消息时,这种优化可以显著提高网络效率和系统性能。实现时需要注意 ECU 内部的消息复制机制、组播消息的共享以及订阅管理的高效性。

4.2.4.1 Strategy for sending notifications

For different use cases different strategies for sending notifications are possible. The
following examples are common:
• Cyclic update — send an updated value in a fixed interval (e.g. every 100 ms for
safety relevant messages with Alive)
• Update on change — send an update as soon as a "value" changes (e.g. door
open)
• Epsilon change — only send an update when the difference to the last value is
greater than a certain epsilon. This concept may be adaptive, i.e. the prediction is
based on a history; thus, only when the difference between prediction and current
value is greater than epsilon an update is transmitted.
notifications 通知的 三种发送策略
1. 周期
2. 变化
3. 门限 -- 接触几家车企的规范 没看到使用这个

4.2.5 Fields

A field represents a status and has a valid value. The consumers subscribing for the
field instantly after subscription get the field value as an initial event.
一个Field 代表一种状态 并带有个有效值
client第一次订阅后 能立刻收到event的值

[PRS_SOMEIP_00179]
Upstream requirements: RS_SOMEIP_00009
A field shall be a combination of getter, setter and notification event.
Field是 getter / setter / notify的集合体

[PRS_SOMEIP_00180]
Upstream requirements: RS_SOMEIP_00009
A field without a setter and without a getter and without a notifier shall not exist. The
field shall contain at least a getter, a setter, or a notifier.
field 至少含有 getter/ setter/ notify 一种

[PRS_SOMEIP_00181]
Upstream requirements: RS_SOMEIP_00009
The getter of a field shall be a request/response call that has an empty payload in the
request message and the value of the field in the payload of the response message.
getter的 请求报文 不能带参数 ,只能响应包中携带返回值

[PRS_SOMEIP_00182]
Upstream requirements: RS_SOMEIP_00009
The setter of a field shall be a request/response call that has the desired value of the
field in the payload of the request message and the value that was set to the field in
the payload of the response message.
Note:
If the value of the request payload was adapted (e.g. because it was out of limits) the
adapted value will be transported in the response payload.
setter有请求 有响应。
请求 是想要设置的值。
返回 是设置后的实际值(如果请求的值超范围 server端会把调整后的值返回回去)

[PRS_SOMEIP_00909]
Upstream requirements: RS_SOMEIP_00002, RS_SOMEIP_00009
The notifier shall send an event message that transports the value of the field to the
client when the client subscribes to the field.
谁订阅field给谁发送 事件

[PRS_SOMEIP_00183]
Upstream requirements: RS_SOMEIP_00005, RS_SOMEIP_00009
The notifier shall send an event message that transports the value of a field and shall
follow the rules for events. Sending strategies include on change, on epsilon change,
and cyclic sending.
field的notify 发送事件 也是支持这三种模式:
周期 、变化、门限

相关文章:

SOME/IP--协议英文原文讲解10

前言 SOME/IP协议越来越多的用于汽车电子行业中,关于协议详细完全的中文资料却没有,所以我将结合工作经验并对照英文原版协议做一系列的文章。基本分三大块: 1. SOME/IP协议讲解 2. SOME/IP-SD协议讲解 3. python/C举例调试讲解 4.2.2 Req…...

欢乐力扣:赎金信

文章目录 1、题目描述2、 代码 1、题目描述 赎金信,给你两个字符串:ransomNote 和 magazine ,判断 ransomNote 能不能由 magazine 里面的字符构成。如果可以,返回 true ;否则返回 false 。magazine 中的每个字符只能在…...

【量化科普】Standard Deviation,标准差

【量化科普】Standard Deviation,标准差 🚀🚀🚀量化软件开通🚀🚀🚀 🚀🚀🚀量化实战教程🚀🚀🚀 在量化投资领域&#xf…...

stm32单片机个人学习笔记15(I2C通信协议)

前言 本篇文章属于stm32单片机(以下简称单片机)的学习笔记,来源于B站教学视频。下面是这位up主的视频链接。本文为个人学习笔记,只能做参考,细节方面建议观看视频,肯定受益匪浅。 STM32入门教程-2023版 细…...

网络安全防护

一:物理安全防护 直接的物理破坏所造成的损失远大于通过网络远程攻击 提高物理安全需关注的问题: 1: 服务器和安全设备是否放置在上锁的机房内? 2: 网络设备是否被保护和监控? 3: 是否有无关人员单独在敏感区域工作&…...

YOLOV7的复现过程

复现 YOLOv7 代码的步骤相对清晰,主要分为以下几个部分: 环境准备克隆 YOLOv7 仓库准备数据集训练模型验证和测试推理(Inference) 下面是一个简化的流程来帮助你复现 YOLOv7 代码: 1. 环境准备 首先,你…...

uniapp实现app的pdf预览

实现效果 文件准备 static下添加该pdf文件&#xff08;下载地址&#xff1a;https://gitee.com/shallow-winds/resource_package/tree/master/%E6%96%B9%E6%B3%95%E4%B8%80/html&#xff09; 使用web-view进行展示&#xff1a; 在这里插入代码片 <web-view :src"u…...

用Java创建一个验证码的工具类

在Java中创建一个验证码工具类&#xff0c;可以通过以下代码实现。该工具类支持生成包含字母和数字的随机验证码图片&#xff0c;并添加干扰线和噪点以提高安全性。以下是详细实现&#xff1a; 完整代码实现 import javax.imageio.ImageIO; import java.awt.*; import java.aw…...

uvm中的激励是如何发送出去的

在UVM中&#xff0c;Sequence生成的激励&#xff08;Transaction&#xff09;通过以下协作流程发送到Driver并最终驱动到DUT&#xff0c;其核心机制如下&#xff1a; --------------- --------------- ------------ ----- | Sequence | → | Seque…...

一只企鹅如何改变世界

一、历史的转折点:一只企鹅如何改变世界 1991年,芬兰大学生Linus Torvalds在邮件列表中写道:“我正在做一个自由的操作系统(只是爱好,不会像GNU那样庞大专业)”。这个后来被称为Linux内核的项目,与GNU项目的结合,点燃了开源运动的燎原之火。 关键演化: 1996年:Tux企…...

拦截器VS过滤器:Spring Boot中请求处理的艺术!

目录 一、拦截器&#xff08;Interceptor&#xff09;和过滤器&#xff08;Filter&#xff09;&#xff1a;都是“守门员”&#xff01;二、如何实现拦截器和过滤器&#xff1f;三、拦截器和过滤器的区别四、执行顺序五、真实的应用场景六、总结 &#x1f31f;如果喜欢作者的讲…...

C语言预处理学习笔记

1. 预处理器的功能 预处理器&#xff08;Preprocessor&#xff09;在编译C语言程序之前对源代码进行预处理。预处理指令以#号开头&#xff0c;主要包括文件包含、宏定义、条件编译等功能。 2. 文件包含 文件包含功能用于在一个文件中包含另一个文件的内容&#xff0c;通常用…...

LLM基础环境准备-云服务器

软件环境 腾讯云 操作系统&#xff1a; TencentOS Server 3.1 (TK4) Python: 3.9.0(使用 conda的虚拟python环境&#xff0c;可根据实际需要更换版本&#xff0c;当前使用的是3.9.0的版本) CUDA Version: 12.2&#xff08;腾讯云会自动安装&#xff09; Driver Version: 5…...

网络协议相关知识有哪些?

前言 网络协议的基础是OSI和TCP/IP模型,这两个模型是理解协议分层的关键。 正文(仅是个人理解,如有遗漏望海涵) 网络协议是网络中设备间通信的规则和标准,涉及数据传输、路由、错误控制等多个方面。以下是网络协议相关知识的系统梳理: 一、网络协议分层模型 1、OSI七…...

基于Llama 3.2-Vision的医学报告生成

记录运用大模型解决医学报告实例&#xff0c;仅介绍本地调用的情况。 前情提要 已安装 Python 显存不少于8G&#xff08;8G设备上测试成功&#xff0c;其他环境可以自行测试&#xff09;。 需要安装Ollama (Ollama 是一个允许在本地运行多模态模型的平台)。 方式1&#xff1…...

离线部署大模型:ollama+deepseek+open-webui

ollama 是一个开源的本地大语言模型运行框架&#xff0c;它提供了非常简单便捷的使用形式&#xff0c;让用户可以十分方便的在本地机器上部署和运行大型语言模型&#xff0c;从而实现免费离线的方式使用 LLM 能力&#xff0c;并确保私有数据的隐私和安全性。 1 ollama 安装 o…...

如何看nginx.conf文件?

是的&#xff0c;你的理解是对的&#xff01;在 Nginx 配置中&#xff0c;最内层的 location 确实是决定请求最终处理的“入口”。当请求进入 Nginx 时&#xff0c;Nginx 会根据请求的路径&#xff08;即 URL&#xff09;匹配 location 块&#xff0c;然后按照匹配的顺序逐层向…...

3月营销日历:开启春日盛宴,绽放生活魅力

关键营销节点∶惊蛰、女生节、妇女节、 植树节、315消费者权益日、春分 营销关键词 养生、女生魅力、感恩女性、环保、品质 01.重点关注品类 春季服饰&#xff1a;如轻薄外套、春装等&#xff0c;适合惊蛰后的市场需求&#xff1b; 美妆护肤&#xff1a;妇女节期间&#xf…...

pdf预览在vue项目中的使用兼容ie浏览器

一、下载pdf预览插件 链接: https://pan.baidu.com/s/1wuzay-saAfiqtS-efd-cvw?pwd6m78 提取码: 6m78 二、创建一个pdf文件夹&#xff0c;将下载下来的文件build和web文件夹复制到pdf文件夹下 三、项目中使用 (路径由两部分组成&#xff0c;第一部分是项目存放pdf插件的路径…...

Unity面板介绍_Project工程面板(23.1.1)

一、project(工程界面) 显示当前工程所有资源文件&#xff08;场景、脚本、音频、图片。。&#xff09; Assets资源文件、Library库文件、Project setting项目设置、Temp临时文件 二、面板大致...

别再只盯着Network面板了!用Python 3分钟自动解析Chrome导出的.har文件,提取关键请求数据

3分钟用Python自动化解析.har文件&#xff1a;告别低效手动分析 每次面对几十个.har文件时&#xff0c;你是否还在逐个点击Network面板查看请求&#xff1f;作为开发者&#xff0c;我们经常需要分析接口性能、监控错误请求或统计API调用情况。手动处理这些数据不仅耗时&#xf…...

别再硬编码了!用C# NXOpen的SelectObject方法,5分钟搞定UG/NX智能选择对话框

从硬编码到智能工厂&#xff1a;NXOpen选择对话框的工程化重构 在UG/NX二次开发领域&#xff0c;SelectObject方法就像是一把瑞士军刀——几乎所有交互功能都离不开它&#xff0c;但大多数开发者只停留在"能用"层面。想象一下这样的场景&#xff1a;你的代码库里有20…...

PHP进程管理利器:轻量级工具pao的原理、配置与实战

1. 项目概述&#xff1a;一个轻量级的PHP进程管理器如果你在PHP开发中&#xff0c;特别是处理后台任务、队列消费或者需要管理长时间运行的脚本时&#xff0c;还在为进程的启动、停止、重启和监控而头疼&#xff0c;那么nunomaduro/pao这个项目绝对值得你花时间了解一下。它不是…...

real-anime-z惊艳效果展示:8K细节、光影质感与角色神态真实呈现

real-anime-z惊艳效果展示&#xff1a;8K细节、光影质感与角色神态真实呈现 1. 模型简介 real-anime-z是基于Z-Image的LoRA版本开发的文生图模型&#xff0c;专注于生成具有真实感的动画风格图片。这个模型通过Xinference部署&#xff0c;并提供了Gradio交互界面&#xff0c;…...

LangChain.js构建MCP智能体:快速接入微软Copilot平台实战指南

1. 项目概述&#xff1a;当LangChain.js遇见微软Copilot平台 如果你最近在捣鼓AI应用开发&#xff0c;特别是想把自己的工具或数据接入到像Microsoft 365 Copilot这样的企业级AI助手里去&#xff0c;那你很可能已经听说过“MCP”&#xff08;Microsoft Copilot Platform&#x…...

保姆级教程:在Vue3+TS+Vite项目中,用webrtc-streamer搞定RTSP监控视频实时播放

Vue3TSVite全栈实战&#xff1a;WebRTC-streamer实现RTSP监控流低延迟播放方案 监控视频的实时播放一直是Web开发中的难点&#xff0c;尤其是对接传统RTSP协议摄像头时。本文将带你从零构建一个基于Vue3、TypeScript和Vite的技术方案&#xff0c;通过WebRTC-streamer实现浏览器…...

基于LangGraph与LLM的智能数据分析平台OpenChatBI实战指南

1. 项目概述&#xff1a;当自然语言遇上数据分析作为一名在数据分析和BI工具领域摸爬滚打了十多年的老兵&#xff0c;我见过太多团队在数据民主化道路上的挣扎。业务同学想自己看个数据&#xff0c;得先学SQL语法、搞懂表结构、再琢磨怎么关联&#xff0c;一套流程下来&#xf…...

Qwen3-4B-Thinking镜像免配置价值:规避HuggingFace token认证与网络超时问题

Qwen3-4B-Thinking镜像免配置价值&#xff1a;规避HuggingFace token认证与网络超时问题 1. 模型概述与核心优势 1.1 模型背景与技术特点 Qwen3-4B-Thinking-2507-Gemini-2.5-Flash-Distill是基于通义千问Qwen3-4B官方模型开发的高效推理版本。这个镜像通过精心设计的蒸馏技…...

小红书专业号主体变更流程

小红书专业号主体变更&#xff0c;核心就是把你当前专业号绑定的认证主体、经营主体或者账号归属关系&#xff0c;按照平台规则调整到新主体名下&#xff0c;整个流程资料齐全的话最快2到3个工作日就能完成&#xff0c;不用特意停更或者担心现有粉丝、历史内容受影响。小红书专…...

机器学习概率校准:原理与实践指南

1. 校准分类模型的核心价值 在机器学习分类任务中&#xff0c;我们常常遇到一个关键问题&#xff1a;模型输出的概率是否真实反映了样本属于某类的实际可能性&#xff1f;比如一个二分类模型预测某样本属于正类的概率为0.7&#xff0c;这个数值是否意味着该样本有70%的可能性确…...