Skip to content

Commit

Permalink
* MDF [zh_CN] Add some/ip sub event test in docs
Browse files Browse the repository at this point in the history
Signed-off-by: Moi Ran <maoyi.ran@emqx.io>
  • Loading branch information
RanMaoyi authored and JaylinYu committed Oct 11, 2023
1 parent aeefce2 commit 6735d5e
Showing 1 changed file with 119 additions and 2 deletions.
121 changes: 119 additions & 2 deletions docs/zh_CN/gateway/someip-gateway.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ make install

### 编译例程服务

编译 vSOMEIP 中的 `hello_world_service` 例程服务,稍后我们将通过该例程测试 NanoMQ 的 SOME/IP 网关。
1. 编译 vSOMEIP 中的 `hello_world_service` 例程服务,稍后我们将通过该例程测试 NanoMQ 的 SOME/IP 网关。

```shell
cd vsomeip/examples/hello_world
Expand All @@ -35,6 +35,35 @@ cd build
cmake ..
make -j8
```
2. 准备notify-sample例程,为SOME/IP sub event的测试做准备

- 修改vsomeip notify-sample的service-id等信息

```shell
diff --git a/examples/sample-ids.hpp b/examples/sample-ids.hpp
index 6d31131..078df71 100644
--- a/examples/sample-ids.hpp
+++ b/examples/sample-ids.hpp
@@ -6,9 +6,9 @@
#ifndef VSOMEIP_EXAMPLES_SAMPLE_IDS_HPP
#define VSOMEIP_EXAMPLES_SAMPLE_IDS_HPP

-#define SAMPLE_SERVICE_ID 0x1234
-#define SAMPLE_INSTANCE_ID 0x5678
-#define SAMPLE_METHOD_ID 0x0421
+#define SAMPLE_SERVICE_ID 0x1111
+#define SAMPLE_INSTANCE_ID 0x2222
+#define SAMPLE_METHOD_ID 0x3333

#define SAMPLE_EVENT_ID 0x8778
#define SAMPLE_GET_METHOD_ID 0x0001
```

- 编译vsomeip 中的 notify-sample
```
$ cd vsomeip/build/examples
$ make -j8
```

## 启用 SOME/IP 协议转换功能

Expand Down Expand Up @@ -97,6 +126,8 @@ gateway.vsomeip {
service_id = "0x1111"
service_instance_id = "0x2222"
service_method_id = "0x3333"
service_event_id = "0x8778"
service_eventgroup_id = "0x4465"
# conf_path = "/etc/vsomeip.json"
}

Expand Down Expand Up @@ -167,7 +198,7 @@ $ curl --basic -u admin:public 'http://127.0.0.1:8082/api/v4/proxy/ctrl/restart'
## 测试 SOME/IP 网关
本节将使用上面编译好的 `hello_world_service` 作为 SOME/IP 的服务端,并通过
1. 使用上面编译好的 `hello_world_service` 作为 SOME/IP 的服务端,并通过
SOME/IP gateway 与 NanoMQ 对接。
::: tip
Expand All @@ -192,5 +223,91 @@ $ ./nanomq_cli vsomeip_gateway --conf path/to/nanomq_vsomeip_gateway.conf // 启
![img](./assets/someip_gateway.png)
![img](./assets/pub_sub.png)
2. 测试SOME/IP sub event功能
- 运行nanomq SOME/IP 网关
```shell
$ ./nanomq_cli vsomeip_gateway --conf=../etc/nanomq_vsomeip_gateway.conf
Start http server listener: http://0.0.0.0:8082/api/v4/proxy [3/3039]
2023-10-11 11:33:27.331499 [info] Parsed vsomeip configuration in 0ms
2023-10-11 11 :33:27.331709 [info] Configuration module loaded.
2023-10-11 11:33:27.331741 [info] Initializing vsomeip (3.3.8) application "".
2023-10-11 11:33:27.332751 [info] Instantiating routing manager [Host].
2023-10-11 11:33:27.333824 [info] create_routing_root: Routing root @ /tmp/vsomeip-0
2023-10-11 11:33:27.334535 [info] Service Discovery enabled. Trying to load module.
2023-10-11 11:33:27.337933 [info] Service Discovery module loaded.
2023-10-11 11:33:27.338445 [info] Application(unnamed, 0100) is initialized (11, 100).
2023-10-11 11:33:27.338846 [info] REGISTER EVENT(0100): [1111.2222.8778:is_provider=false]
2023-10-11 11:33:27.338991 [info] SUBSCRIBE(0100): [1111.2222.4465:ffff:0]
2023-10-11 11:33:27.339122 [info] notify_one_unlocked: Notifying 1111.2222.8778 to client 100 failed. Event payload not set!
2023-10-11 11:33:27.339296 [info] Starting vsomeip application "" (0100) using 2 threads I/O nice 255
2023-10-11 11:33:27.340355 [info] Client [0100] routes unicast:127.0.0.1, netmask:255.255.255.0
2023-10-11 11:33:27.340443 [info] shutdown thread id from application: 0100 () is: 7fd859fdd640 TID: 313601
2023-10-11 11:33:27.340371 [info] main dispatch thread id from application: 0100 () is: 7fd85a7de640 TID: 313600
2023-10-11 11:33:27.342756 [info] Watchdog is disabled!
2023-10-11 11:33:27.344507 [info] connect_cb: connected!
2023-10-11 11:33:27.344764 [info] io thread id from application: 0100 () is: 7fd86bad0b80 TID: 313566
2023-10-11 11:33:27.344807 [info] topic: topic/sub
2023-10-11 11:33:27.344528 [info] REQUEST(0100): [1111.2222:255.4294967295]
2023-10-11 11:33:27.346067 [info] Recv message: '' from ''
2023-10-11 11:33:27.344800 [info] io thread id from application: 0100 () is: 7fd858fdb640 TID: 313603
2023-10-11 11:33:27.347251 [info] vSomeIP 3.3.8 | (default)
2023-10-11 11:33:27.347239 [info] create_local_server: Listening @ /tmp/vsomeip-100
2023-10-11 11:33:27.347933 [info] Network interface "lo" state changed: up
2023-10-11 11:33:29.981305 [info] Application/Client 0101 is registering.
2023-10-11 11:33:29.981761 [info] Client [100] is connecting to [101] at /tmp/vsomeip-101
2023-10-11 11:33:29.982757 [info] REGISTERED_ACK(0101)
2023-10-11 11:33:29.982877 [info] OFFER(0101): [1111.2222:0.0] (true)
2023-10-11 11:33:29.982948 [info] Port configuration missing for [1111.2222]. Service is internal.
2023-10-11 11:33:29.983767 [info] SUBSCRIBE ACK(0101): [1111.2222.4465.ffff]
2023-10-11 11:33:29.985027 [info] Send publish: '' to 'topic/pub'
2023-10-11 11:33:30.991436 [info] Send publish: '' to 'topic/pub'
2023-10-11 11:33:31.996741 [info] Send publish: '' to 'topic/pub'
2023-10-11 11:33:32.000175 [info] Send publish: '' to 'topic/pub'
2023-10-11 11:33:33.006548 [info] Send publish: '' to 'topic/pub'
2023-10-11 11:33:34.009595 [info] Send publish: '' to 'topic/pub'
2023-10-11 11:33:35.014565 [info] Send publish: '' to 'topic/pub'
2023-10-11 11:33:36.019592 [info] Send publish: '' to 'topic/pub'
2023-10-11 11:33:37.350110 [info] vSomeIP 3.3.8 | (default)
2023-10-11 11:33:37.025566 [info] Send publish: '' to 'topic/pub'
2023-10-11 11:33:38.020287 [info] Send publish: '' to 'topic/pub'
2023-10-11 11:33:39.007535 [info] STOP OFFER(0101): [1111.2222:0.0] (true)
^C2023-10-11 11:33:44.494770 [info] RELEASE(0100): [1111.2222]
```
- 运行notify-sample
```shell
$ ./notify-sample
2023-10-11 11:11:30.705967 [info] Parsed vsomeip configuration in 0ms
2023-10-11 11:11:30.706632 [info] Configuration module loaded.
2023-10-11 11:11:30.706724 [info] Initializing vsomeip (3.3.8) application "".
2023-10-11 11:11:30.706990 [info] Instantiating routing manager [Proxy].
2023-10-11 11:11:30.707191 [info] Client [ffff] is connecting to [0] at /tmp/vsomeip-0
2023-10-11 11:11:30.707414 [info] Application(unnamed, ffff) is initialized (11, 100).
2023-10-11 11:11:30.707528 [info] offer_event: Event [1111.2222.8778] uses configured cycle time 0ms
2023-10-11 11:11:30.707828 [info] Starting vsomeip application "" (ffff) using 2 threads I/O nice 255
2023-10-11 11:11:30.709944 [info] io thread id from application: ffff () is: 7f7918b08b80 TID: 312699
Setting event (Length=1).
2023-10-11 11:11:30.710052 [info] main dispatch thread id from application: ffff () is: 7f7916ffd640 TID: 312702
2023-10-11 11:11:30.710180 [info] shutdown thread id from application: ffff () is: 7f79167fc640 TID: 312703
2023-10-11 11:11:30.710269 [info] io thread id from application: ffff () is: 7f7915ffb640 TID: 312704
2023-10-11 11:11:30.713151 [info] create_local_server: Listening @ /tmp/vsomeip-101
2023-10-11 11:11:30.713436 [info] Client 101 () successfully connected to routing ~> registering..
2023-10-11 11:11:30.713521 [info] Registering to routing manager @ vsomeip-0
2023-10-11 11:11:30.716261 [info] Application/Client 101 () is registered.
Application is registered.
2023-10-11 11:11:30.720445 [info] Client [101] is connecting to [100] at /tmp/vsomeip-100
2023-10-11 11:11:30.721525 [info] SUBSCRIBE(0100): [1111.2222.4465:ffff:0]
Setting event (Length=2).
Setting event (Length=3).
Setting event (Length=4).
Setting event (Length=5).
Setting event (Length=6).
Setting event (Length=7).
Setting event (Length=8).
Setting event (Length=9).
Setting event (Length=1).
...
```
目前,NanoMQ 的 SOME/IP 网关仅支持透明传输(透传)服务,即原始数据经过 SOME/IP 网关后不会有任何的改变或处理,我们后续计划根据用户所使用的数据序列化和反序列化格式工具,比如 IDL 或 FIDL,提供更多高级功能,比如自动代码生成和数据序列化,敬请期待。

0 comments on commit 6735d5e

Please sign in to comment.