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

news2025/4/3 2:54:54

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

1. SOME/IP协议讲解

2. SOME/IP-SD协议讲解

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


5.1.5 Non-SOME/IP protocols with SOME/IP-SD

用SOME/IP协议 实现非SOME/IP的服务。(实际基本未见使用)
Besides SOME/IP other communication protocols are used within the vehicle; e.g., for
Network Management, Diagnostics, or Flash Updates. Such communication protocols
might need to communicate a service instance or have eventgroups as well.
[PRS_SOMEIPSD_00437]
Upstream requirements: RS_SOMEIPSD_00004
For Non-SOME/IP protocols (the application protocol itself doesn’t use SOME/IP but
it is published over SOME/IP SD) a special Service-ID shall be used and further information shall be added using the configuration option:
• Service-ID shall be set to 0xFFFE (reserved)
• Instance-ID shall be used as described for SOME/IP services and eventgroups.
• The Configuration Option shall be added and shall contain exactly one entry with
key "otherserv" and a configurable non-empty value that is determined by the
system department.

[PRS_SOMEIPSD_00438]
Upstream requirements: RS_SOMEIPSD_00004
SOME/IP services shall not use the otherserv-string in the Configuration Option.
[PRS_SOMEIPSD_00439]
Upstream requirements: RS_SOMEIPSD_00004
For Find Service/Offer Service/Request Service entries the otherserv-String shall be
used when announcing non-SOME/IP service instances.
[PRS_SOMEIPSD_00440]
Upstream requirements: RS_SOMEIPSD_00004

Example for valid otherserv-string: "otherserv=internaldiag".
Example for an invalid otherserv-string: "otherserv".
Example for an invalid otherserv-string: "otherserv=".

### **非SOME/IP协议与SOME/IP-SD的集成规范解析**

针对车载网络中非SOME/IP协议(如诊断、网络管理、刷写)通过SOME/IP-SD发布的规则,以下是技术要点与实现指南:

---

#### **1. 非SOME/IP服务的标识规则 ([PRS_SOMEIPSD_00437])**
| **字段**         | **取值要求**                                                                 |
|------------------|-----------------------------------------------------------------------------|
| **Service-ID**   | 固定 `0xFFFE`(保留值,专用于非SOME/IP协议)                                |
| **Instance-ID**  | 按SOME/IP标准规则分配(与服务实例一一对应)                                  |
| **配置选项**     | 必须包含一个键为 `"otherserv"` 的条目,值为非空字符串(由系统部门定义)      |

**示例配置选项**:  
```xml
<ConfigurationOption>
    <Item key="otherserv" value="internaldiag"/>  <!-- 合法 -->
</ConfigurationOption>
```

**非法示例**:  
- `"otherserv"`(缺少值)  
- `"otherserv="`(值为空)  

---

#### **2. 协议隔离性要求 ([PRS_SOMEIPSD_00438])**  
- **禁止混用**:标准SOME/IP服务**不得**使用 `otherserv` 配置选项,避免与非SOME/IP服务混淆。  
- **设计意图**:明确区分SOME/IP原生服务与代理发布的非SOME/IP服务。

---

#### **3. 服务发现条目中的使用 ([PRS_SOMEIPSD_00439])**  
- **适用场景**:  
  - `Find Service` / `Offer Service` / `Request Service` 条目中必须携带 `otherserv` 字符串。  
- **作用**:  
  - 允许客户端识别非SOME/IP服务类型(如诊断服务 `"internaldiag"`)。  

**报文示例**:  
```cpp
// Offer Service条目结构示例
OfferServiceEntry {
    Service-ID: 0xFFFE,
    Instance-ID: 0x0001,
    Options: [
        ConfigurationOption {
            Items: ["otherserv=flashupdate"]  // 标识为刷写服务
        }
    ]
}
```

---

#### **4. 实现逻辑与校验**  
##### **4.1 服务发布方(Server)**  
```python
def publish_non_someip_service(service_type, instance_id):
    entry = OfferServiceEntry(
        service_id=0xFFFE,
        instance_id=instance_id,
        options=[
            ConfigurationOption(items={"otherserv": service_type})  # 必须非空
        ]
    )
    if not validate_otherserv_string(service_type):
        raise InvalidConfigError("otherserv格式错误")
    send_sd_message(entry)
```

##### **4.2 服务发现方(Client)**  
```python
def handle_offer_entry(entry):
    if entry.service_id == 0xFFFE:  # 非SOME/IP服务
        otherserv = entry.options.get("otherserv")
        if not otherserv:
            log_error("缺失otherserv配置选项")
            return
        route_to_protocol_handler(otherserv)  # 根据类型路由到诊断/刷写等模块
```

---

#### **5. 典型应用场景**  
| **服务类型**       | **otherserv值示例**    | **用途**                     |
|--------------------|-----------------------|-----------------------------|
| 车载诊断           | `"internaldiag"`      | UDS/OBD诊断服务代理          |
| 网络管理           | `"nmalive"`           | AUTOSAR NM报文发布           |
| ECU刷写            | `"flashupdate"`       | 通过DoIP或XCP协议更新固件    |
| 传感器原始数据      | `"rawsensordata"`     | 非SOME/IP格式的传感器流      |

---

#### **6. 错误处理与边界条件**  
- **无效Service-ID**:若非SOME/IP服务未使用 `0xFFFE`,接收方应忽略该条目。  
- **缺失otherserv**:丢弃条目并记录错误日志(违反[PRS_SOMEIPSD_00437])。  
- **值冲突**:同一Instance-ID对应多个 `otherserv` 值时,以最新接收的为准。  

---

### **设计验证要点**  
1. **静态检查**:  
   - 代码审查确保 `0xFFFE` 仅用于非SOME/IP服务。  
2. **动态测试**:  
   - 注入非法 `otherserv` 字符串(如空值),验证系统是否拒绝处理。  
3. **交互测试**:  
   - 混合SOME/IP与非SOME/IP服务,确认客户端能正确路由。  

此规范通过标准化标识和配置选项,实现了SOME/IP-SD对异构协议的统一管理,扩展了车载网络的兼容性。


5.1.6 Publish/Subscribe with SOME/IP and SOME/IP-SD
Note: In contrast to the SOME/IP request/response mechanism there may be cases in
which a client requires a set of parameters from a server, but does not want to request
that information each time it is required. These are called notifications and concern
events and fields.
[PRS_SOMEIPSD_00443]
Upstream requirements: RS_SOMEIPSD_00013, RS_SOMEIPSD_00014, RS_SOMEIPSD_-
00015, RS_SOMEIPSD_00016
All clients needing events and/or notification events shall register using the SOME/IPSD at run-time with a server.

客户端需要 服务端的信息 不是每次需要时请求,要先订阅

 MOST(Media Oriented Systems Transport) 是一种专为汽车多媒体和娱乐系统设计的高速多媒体网络通信协议,主要用于传输音频、视频、语音和数据等实时媒体流。

[PRS_SOMEIPSD_00446]
Upstream requirements: RS_SOMEIPSD_00013, RS_SOMEIPSD_00014, RS_SOMEIPSD_-
00015, RS_SOMEIPSD_00016
With the SOME/IP-SD entry Offer Service the server offers to push notifications to
clients; thus, it shall be used as trigger for Subscriptions.
[PRS_SOMEIPSD_00449]
Upstream requirements: RS_SOMEIPSD_00015
Each client shall respond to a SOME/IP-SD Offer Service entry from the server with
a SOME/IP-SD Subscribe Eventgroup entry as long as the client is still interested in
receiving the notifications/events of this eventgroup. If the client is able to reliably detect
the reboot of the server using the SOME/IP-SD messages reboot flag, the client shall
handle the reboot as if a StopOffer entry was received and proceed with the received
entries after all actions upon a StopOffer have been finalized.
[PRS_SOMEIPSD_00862] Client based distinction between field notifiers and
pure events
Upstream requirements: RS_SOMEIPSD_00015
The distinction between field notifiers and pure events shall be taken based on the
configuration of the client.
Reasons for the client to explicitly request initial values for field notifiers (see
[PRS_SOMEIPSD_00463]) include but are not limited to:
• The client is currently not subscribed to the Eventgroup.
• The client has seen a link-down/link-up after the last Subscribe Eventgroup entry.
• The client has not received a Subscribe Eventgroup Ack after the last regular
Subscribe Eventgroup
• The client has detected a Reboot of the Server of this Services
[PRS_SOMEIPSD_00570]
Upstream requirements: RS_SOMEIPSD_00015
If the client subscribes to two or more eventgroups including one or more identical
events or field notifiers, the server shall not send duplicated events or field notifiers.
This applies to the sending of regular events and regular field notifiers. This does not
apply to the sending of initial values for field notifiers (see [PRS_SOMEIPSD_00571]).
[PRS_SOMEIPSD_00450]
Upstream requirements: RS_SOMEIPSD_00015
Publish/Subscribe with link loss at client side is described as follows:
1. No prior registrations + Client subscribes
(a) Server: OfferService()
(b) Client: SubscribeEventgroup[Session ID=x, Reboot=0]
(c) Server: updateRegistration()
(d) Server: SubscribeEventgroupAck + Events()
2. Link loss at client side
(a) Client: linkDown()
(b) Client: deleteEntries()
(c) Client: linkUp()
3. Client subscribes again, Client Reboot detected
(a) Server: OfferService()
(b) Client: SubscribeEventgroup[Session ID=1, Reboot=1]
(c) Server: updateRegistration()
(d) Server SubscribeEventgroupAck + Events()

client 收到 server的offer 如果里面的entries有自己需要 那就必须发送订阅包。
server 周期发布offer是为了看自己需不需要发送 事件包(如果没人订阅 就不需要发送了)

client 离线后重新上线,Reboot标志要设置为1
server收到client reboot标志后 需要更新自己的订阅列表

 

[PRS_SOMEIPSD_00452]
Upstream requirements: RS_SOMEIPSD_00017, RS_SOMEIPSD_00020
A client shall deregister from a server by sending a SOME/IP-SD Subscribe Eventgroup message with TTL=0 (Stop Subscribe Eventgroup see
[PRS_SOMEIPSD_00389]).
[PRS_SOMEIPSD_00453]
Upstream requirements: RS_SOMEIPSD_00015, RS_SOMEIPSD_00017

Publish/Subscribe Registration/Deregistration behavior is described as follows:
1. Client 1 subscribes
(a) Server: OfferService() to Client 1 and Client 2
(b) Client 1: SubscribeEventgroup()
(c) Server: updateRegistration()
(d) Server: SubscribeEventgroupAck + Events() to Client 1
2. Client 2 subscribes
(a) Client 2: SubscribeEventgroup()
(b) Server: updateRegistration()
(c) Server: SubscribeEventgroupAck + Events() to Client 2
3. Client 2 stops subscription
(a) Client 2: StopSubscribeEventgroup()
(b) Server: updateRegistration()
4. Client 1 remains registered

Note: Description is also shown in Figure 5.22.

client 发送停止订阅(TTL=0)就可以让server去订阅,server要从自己的订阅列表中删除此client,此后的event不能再发送给client

多个client之间的订阅是独立的

[PRS_SOMEIPSD_00457]
Upstream requirements: RS_SOMEIPSD_00013, RS_SOMEIPSD_00015

Publish/Subscribe with link loss at server is described as follows:
1. No prior registrations + Client subscribes
(a) Server: OfferService()
(b) Client: SubscribeEventgroup()
(c) Server: updateRegistration()
(d) Server: SubscribeEventgroupAck + Events()
2. Link loss at server side
(a) Server: linkDown()
(b) Server: deleteRegistrations()
(c) Server: linkUp()
3. Server offers again, Server Reboot detected by client
(a) Server: OfferService()[Session ID=1, Reboot=1]
(b) Client: SubscribeEventgroup()
(c) Server: updateRegistration()
(d) Server SubscribeEventgroupAck + Events()

如果 server 下线后重新上线,要发送reboot 标志位为1 ,让client知道


 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2326206.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

Ubuntu上给AndroidStudio创建桌面图标

最近使用了Ubuntu开发了&#xff0c;默认的android studio没有桌面图标&#xff0c;还是很不方便&#xff0c;每次都要cd到bin目录启动studio.sh。 步骤1&#xff1a;cd /usr/share/applications linux系统里面&#xff0c;所有的应用启动入口都在 /usr/share/applications …

简单视图函数

视图函数 文章目录 视图函数[toc]一、什么是视图函数二、简单视图函数三、返回错误视图 一、什么是视图函数 所谓视图函数&#xff08;简称视图&#xff09;&#xff0c;本质上就是一个Python函数&#xff0c;用于接收Web请求并且返回Web响应。Web响应可以包含很多类型&#x…

蓝桥杯备考----》完全背包模板

其实这个完全背包的步骤和01背包也是差不多滴&#xff0c;不过他有一些优化是我们必须要说一说的 老样子&#xff0c;我们先定义一下状态表示 step1: f[i][j]表示从1到i个物品里选出体积不超过j的最大价值 step2:状态转移方程 写成一行就是 我们再写一下f[i][j-v[i]]的表达…

小白入门机器学习概述

文章目录 一、引言二、机器学习的基础概念1. 机器学习的定义2. 机器学习的类型&#xff08;1&#xff09;监督学习&#xff08;Supervised Learning&#xff09;&#xff08;2&#xff09;无监督学习&#xff08;Unsupervised Learning&#xff09;&#xff08;3&#xff09;半…

微软 GraphRAG 项目学习总结

微软2024年4月份发布了一篇《From Local to Global: A GraphRAG Approach to Query-Focused Summarization》&#xff08;GraphRAG&#xff1a;从局部到全局的查询式摘要方法&#xff09;论文&#xff0c;提出了一种名为GraphRAG的检索增强生成&#xff08;RAG&#xff09;方法…

C# dataGridView 自动生成几行几列及手动输入整型字符

C# dataGridView生成12号4列的表格 private void Form1_Load(object sender, EventArgs e) {// 清除默认列dataGridView1.Columns.Clear();// 添加4列&#xff08;首列为序号列&#xff09;dataGridView1.Columns.Add("ColIndex", "序号");dataGridView1.…

Day17 -实例:利用不同语言不同框架的特征 进行识别

前置&#xff1a;我们所需的web站点&#xff0c;都可以利用fofa去搜索&#xff0c;例如&#xff1a;app"flask"这样的语句去找对应的站点&#xff0c;找到后&#xff0c;我们模拟不知道是什么框架&#xff0c;再根据特征去判断它的框架。 ***利用工具可以再去结合大…

Pycharm(八):字符串切片

一、字符串分片介绍 对操作的对象截取其中一部分的操作&#xff0c;比如想要获取字符串“888666qq.com前面的qq号的时候就可以用切片。 字符串、列表、元组都支持切片操作。 语法&#xff1a;字符串变量名 [起始:结束:步长] 口诀&#xff1a;切片其实很简单&#xff0c;只顾头来…

Mysql从入门到精通day5————子查询精讲

本文主要讲述子查询的几种方法&#xff0c;读者注意体会它们的不同场合的适用情况及功能&#xff0c;本篇文章也融入了小编实践过程遇到的坑&#xff0c;希望读者不要再踩坑 一.带IN关键字的子查询 in关键字可以检测结果集中是否存在某个特定的值&#xff0c;检测成功则执行外…

虫洞数观系列二 | Python+MySQL高效封装:为pandas数据分析铺路

目录 系列文章 1. 引言 2. 常规写法mysql 3. 封装设计接口mysql 3.1dbname.py文件 3.1.1. 导入和基类定义 3.1.2. 具体表定义类 3.1.3. 表定义整合函数 3.1.4. 全局字典和测试代码 3.2mysql_dao文件 3.2.1. 模块导入与配置 3.2.2. 数据库连接池初始化 3.2.3. Comm…

MySQl之Binlog

前言 Binlog&#xff08;Binary Log&#xff09;是MySQL中至关重要的日志模块&#xff0c;它直接关系到数据恢复、主从复制等高阶架构设计。无论你是刚入门的新手还是有一定经验的开发者&#xff0c;掌握Binlog的原理和应用都是进阶的必经之路。 BinLog是什么&#xff1f; Bin…

开源项目解读(https://github.com/zjunlp/DeepKE)

1.DeepKE 是一个开源的知识图谱抽取与构建工具&#xff0c;支持cnSchema、低资源、长篇章、多模态的知识抽取工具&#xff0c;可以基于PyTorch实现命名实体识别、关系抽取和属性抽取功能。同时为初学者提供了文档&#xff0c;在线演示, 论文, 演示文稿和海报。 2.下载对应的de…

「MethodArgumentTypeMismatchException:前端传递 ‘undefined‘ 导致 Integer 类型转换失败」

遇到的问题&#xff1a; Failed to convert value of type java.lang.String to required type java.lang.Integer; nested exception is java.lang.NumberFormatException: For input string: "undefined" 原因分析&#xff1a; 大致意思就是我传递的参数到后端没…

LabVIEW故障诊断数据处理方法

在LabVIEW故障诊断系统中&#xff0c;数据处理直接决定诊断的准确性和效率。工业现场常面临噪声干扰、数据量大、实时性要求高等挑战&#xff0c;需针对性地选择处理方法。本文结合电机故障诊断、轴承损伤检测等典型案例&#xff0c;详解数据预处理、特征提取、模式识别三大核心…

基于 SpringBoot 的火车订票管理系统

收藏关注不迷路&#xff01;&#xff01; &#x1f31f;文末获取源码数据库&#x1f31f; 感兴趣的可以先收藏起来&#xff0c;还有大家在毕设选题&#xff08;免费咨询指导选题&#xff09;&#xff0c;项目以及论文编写等相关问题都可以给我留言咨询&#xff0c;希望帮助更多…

Python的概论

免责声明 如有异议请在评论区友好交流&#xff0c;或者私信 内容纯属个人见解&#xff0c;仅供学习参考 如若从事非法行业请勿食用 如有雷同纯属巧合 版权问题请直接联系本人进行删改 前言 提示&#xff1a;&#xff1a; 提示&#xff1a;以下是本篇文章正文内容&#xff0c…

构建大语言模型应用:句子转换器(Sentence Transformers)(第三部分)

本系列文章目录 简介数据准备句子转换器&#xff08;本文&#xff09;向量数据库搜索与检索大语言模型开源检索增强生成评估大语言模型服务高级检索增强生成 RAG 在之前的博客中&#xff0c;我们学习了为RAG&#xff08;检索增强生成&#xff0c;Retrieval Augmented Generati…

怎样提升大语言模型(LLM)回答准确率

怎样提升大语言模型(LLM)回答准确率 目录 怎样提升大语言模型(LLM)回答准确率激励与规范类知识关联类情感与语境类逆向思维类:为什么不,反面案例群体智慧类明确指令类示例引导类思维引导类约束限制类反馈交互类:对话激励与规范类 给予奖励暗示:在提示词中暗示模型如果回…

【进阶】vscode 中使用 cmake 编译调试 C++ 工程

基于 MSYS2 的 MinGW-w64 GCC 工具链与 CMake 构建系统&#xff0c;结合VSCode及其扩展插件&#xff08; ms-vscode.cmake-tools&#xff09;&#xff0c;可实现高效的全流程C开发调试。既可通过 VSCode 可视化界面&#xff08;命令面板、状态栏按钮&#xff09;便捷完成配置、…

流影---开源网络流量分析平台(三)(管理引擎部署)

目录 前沿 功能介绍 部署过程 前沿 在上一篇文章中&#xff0c;最后因为虚拟机的资源而没看到最后的效果&#xff0c;而是查看了日志&#xff0c;虽然效果是有了&#xff0c;但后来我等了很久&#xff0c;还是那个转圈的画面&#xff0c;所以我猜测可能是少了什么东西&#…