SOME/IP-SD -- 協議英文原文講解10

前言
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.pswp.cn/web/74125.shtml
繁體地址,請注明出處:http://hk.pswp.cn/web/74125.shtml
英文地址,請注明出處:http://en.pswp.cn/web/74125.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

STM32 ADC轉換完成回調函數詳解 HAL_ADC_ConvCpltCallback與HAL_ADC_ConvHalfCpltCallback

HAL_ADC_ConvCpltCallback 和 HAL_ADC_ConvHalfCpltCallback 是 STM32 HAL 庫中用于處理 ADC&#xff08;模數轉換器&#xff09;轉換完成事件的回調函數。它們分別在 ADC 轉換完成和轉換完成一半時被調用。以下是它們的詳細說明&#xff1a; 1. HAL_ADC_ConvCpltCallback 功能…

Android OpenGLES 360全景圖片渲染(球體內部)

概述 360度全景圖是一種虛擬現實技術&#xff0c;它通過對現實場景進行多角度拍攝后&#xff0c;利用計算機軟件將這些照片拼接成一個完整的全景圖像。這種技術能夠讓觀看者在虛擬環境中以交互的方式查看整個周圍環境&#xff0c;就好像他們真的站在那個位置一樣。在Android設備…

代碼隨想錄算法訓練營第三十二天 | 509.斐波那契數 70.爬樓梯 746.使用最小花費爬樓梯

509. 斐波那契數 題目鏈接&#xff1a;509. 斐波那契數 - 力扣&#xff08;LeetCode&#xff09; 文章講解&#xff1a;代碼隨想錄 視頻講解&#xff1a;手把手帶你入門動態規劃 | LeetCode&#xff1a;509.斐波那契數_嗶哩嗶哩_bilibili 思路&#xff1a;輸入&#xff1a;…

拼多多 anti-token unidbg 分析

聲明: 本文章中所有內容僅供學習交流使用&#xff0c;不用于其他任何目的&#xff0c;抓包內容、敏感網址、數據接口等均已做脫敏處理&#xff0c;嚴禁用于商業用途和非法用途&#xff0c;否則由此產生的一切后果均與作者無關&#xff01; 逆向分析 版本7.3-7.4 都試過加密沒什…

【工具】BioPred一個用于精準醫療中生物標志物分析的 R 軟件包

介紹 R 語言包 BioPred 提供了一系列用于精準醫療中的亞組分析和生物標志物分析的工具。它借助極端梯度提升&#xff08;XGBoost&#xff09;算法&#xff0c;并結合傾向得分加權和 A 學習方法&#xff0c;幫助優化個體化治療規則&#xff0c;從而簡化亞組識別過程。BioPred 還…

橫掃SQL面試——時間序列分組與合并(會話劃分)問題

橫掃SQL面試題 &#x1f4cc; 時間序列分組與合并問題 &#x1f4da; 橫掃SQL面試——時間序列分組與合并解析 &#x1f31f; 核心問題類型 時間序列分組&#xff08;Sessionization&#xff09; 處理具有時間維度的連續數據流&#xff0c;根據特定規則&#xff08;如時間間隔…

PCB鉆孔之多邊形孔分析

問題分析 在鉆孔過程中&#xff0c;鉆頭的運動可以分為兩部分&#xff1a; 公轉&#xff1a;鉆頭的軸線繞理想軸線&#xff08;鉆孔中心線&#xff09;做圓周運動。自轉&#xff1a;鉆頭繞自身軸線做旋轉運動。 由于公轉和自轉的疊加&#xff0c;鉆尖的運動軌跡會形成復雜的…

Android源碼之App啟動

目錄 App啟動概述 App啟動過程 App啟動過程圖 源碼概述 跨進程啟動 進程內啟動 下面以應用桌面Launcher啟動App的MainActivity來舉例&#xff1a; App啟動概述 首先&#xff0c;MainActivity是由Launcher組件來啟動的&#xff0c;而Launcher又是通過Activity管理服務Act…

指紋瀏覽器技術解析:如何實現多賬號安全運營與隱私保護

瀏覽器指紋的挑戰與需求 在數字化運營場景中&#xff0c;瀏覽器指紋技術被廣泛用于追蹤用戶行為。通過采集設備硬件參數&#xff08;如屏幕分辨率、操作系統&#xff09;、軟件配置&#xff08;如字體、插件&#xff09;及網絡特征&#xff08;如IP地址、時區&#xff09;&…

生活電子常識——cmd不能使用anaconda的python環境,導致輸入python打開應用商店

前言 電腦已經安裝了anaconda,從自帶的Anaconda Prompt (Anaconda3)中是可以識別python環境的&#xff0c;然而切換到cmd時&#xff0c;突然發現cmd中無法識別anaconda的python環境&#xff0c;竟然打開了應用商店讓我安裝Python&#xff0c;這當然是不對的。 解決 這是因為…

搭建前端環境和后端環境

搭建前端環境 ①、安裝vscode&#xff0c;并安裝相應的插件工具 ②、安裝node.js&#xff0c;可以選擇當前版本&#xff0c;或者其他版本 ③、創建工作區 創建一個空文件夾&#xff0c;然后通過vscode工具打開&#xff0c;保存為后綴名為.code-workspace ④、從gitee…

Java基礎知識總結(1.8)——Java 注解(持續更新)

更新時間&#xff1a;2025-03-31 Web后端專欄&#xff1a;CSDN專欄——理論-Web后端技術博客總目錄&#xff1a;計算機技術系列博客——目錄頁 8.1 注解的概念 8.1.1 定義與作用 Java注解&#xff08;Annotation&#xff09;是Java語言自JDK1.5版本引入的核心特性&#xff0…

線程概念與控制(下)

線程概念與控制&#xff08;中&#xff09;https://blog.csdn.net/Small_entreprene/article/details/146539064?sharetypeblogdetail&sharerId146539064&sharereferPC&sharesourceSmall_entreprene&sharefrommp_from_link對于之前學習的內容&#xff0c;我們…

SQL注入之盲注技術詳解

SQL注入之盲注技術詳解 一、盲注基本概念盲注特點&#xff1a; 二、盲注主要類型1. 布爾盲注判斷依據&#xff1a; 2. 時間盲注判斷依據&#xff1a; 三、布爾盲注詳細技術1. 識別布爾盲注2. 數據提取技術(1) 判斷數據庫類型(2) 獲取數據庫名長度(3) 逐字符獲取數據庫名(4) 獲取…

OpenCV 圖形API(3)高層次設計概覽

操作系統&#xff1a;ubuntu22.04 OpenCV版本&#xff1a;OpenCV4.9 IDE:Visual Studio Code 編程語言&#xff1a;C11 描述 G-API 是一個異構框架&#xff0c;提供了統一的 API 來使用多個支持的后端編程圖像處理流水線。 關鍵的設計理念是在指定使用哪些內核和設備時保持流…

阿里云Tair KVCache:打造以緩存為中心的大模型Token超級工廠

一、Tair KVCache 簡介 Tair KVCache 是阿里云瑤池旗下云數據庫 Tair 面向大語言模型推理場景推出的 KVCache 緩存加速服務。 隨著互聯網技術的演進與流量規模的激增&#xff0c;緩存技術逐漸成為系統架構的核心組件。該階段催生了 Redis 等開源緩存數據庫&#xff0c;阿里巴巴…

Open GL ES ->GLSurfaceView正交投影與透視投影方法中近遠平面取值參考

坐標系 OpenGL ES使用右手坐標系&#xff0c;相機默認朝向負z方向 相機位置|vz軸<----- 0 -----> -near -----> -far -----不可見 可見區域 不可見裁剪規則 只有z值在[-near, -far]范圍內的物體可見&#xff0c; 當z > -near&#xff08;在近平面前&#…

iOS自定義collection view的page size(width/height)分頁效果

前言 想必大家工作中或多或少會遇到下圖樣式的UI需求吧 像這種cell長度不固定&#xff0c;并且還能實現的分頁效果UI還是很常見的 實現 我們這里實現主要采用collection view&#xff0c;實現的方式是自定義一個UICollectionViewFlowLayout的子類&#xff0c;在這個類里對…

Java高頻面試之并發編程-01

hello啊&#xff0c;各位觀眾姥爺們&#xff01;&#xff01;&#xff01;本baby今天來報道了&#xff01;哈哈哈哈哈嗝&#x1f436; 面試官&#xff1a;并行跟并發有什么區別&#xff1f; 并發 vs 并行&#xff1a;核心區別與場景 1. 定義對比 維度并發&#xff08;Concu…

從零開始學Rust:所有權(Ownership)機制精要

文章目錄 第四章&#xff1a;Ownership 所有權核心概念關鍵機制引用與借用&#xff08;Reference & Borrowing&#xff09;懸垂引用問題錯誤示例分析解決方案引用安全規則 切片&#xff08;Slice&#xff09;內存安全保證 第四章&#xff1a;Ownership 所有權 Ownership i…