使用dlt的gateway功能,要先明确两个概念:gateway端和passive端。
简而言之,gateway端就是开启gateway功能,能够把passive端的log传输给dlt-viewer的dlt-daemon。
而passive端则是产生dlt log,并不直接与某个dlt-viewer相连的dlt-daemon。
为了调查dlt的gateway功能,我建立了两个虚拟机,一个作为passive端,一个作为gateway端。再用pc作为dlt-viewer端来接收passive端的log。
1、passive端
passive端不可以开启Gateway功能(即不能在dlt.conf中配置GatewayMode=1),其他的配置与一般的dlt配置没有不同,对于gateway功能来说,passive端是透明的。
只需要明确它的ECUID即可,不能与局域网中的其他dlt-daemon的ECUID相同。
2、gateway端
gateway端需要开启gateway功能,在dlt.conf(dlt-daemon在启动时指定的配置文件)中的配置如下:
在该配置中指定了gateway功能的具体配置文件,在我的调查中,该配置文件的内容如下:
其中,
中括号中的内容是段落名称,段落名称的格式如下:[PassiveNode{1,2, …N}],每一个段落描述一个passive端。
IPaddress指该段落所描述的passive端的ip地址;Port为其端口号,默认端口号是3490。
EcuID是该passive端的ECUID。
connect表示gateway端连接passive端的方式,取值有二:
- OnStartup - The Gateway DLT Daemon tries to connect to the Passive DLT Daemon immediately after the Gateway DLT Daemon is started.- OnDemand - The Gateway DLT Daemon tries to connect to the Passive DLT Daemon when it receives a connection request.
Timeout表示gateway端与passive端建立连接的超时时间。
SendControl表示在连接建立完毕后要发送给passive端的命令:
- 0x03: Get Log Info- 0x13: Get Software Version
1.启动passive端的dlt-daemon:
dlt-daemon -c /etc/dlt.conf -d
2.启动gateway端的dlt-daemon:
dlt-daemon -c /etc/dlt.conf -d
3.启动pc宿主机上的dlt-viewer连接gateway端,我用的是windows版的。
passive端的ECUID是1,gateway端的ECUID是8。
4.在passive端启动测试程序,然后查看dlt-viewer上的打印输出
dlt-example-user hello
测试程序连续发送了9个hello作为log给dlt-daemon。
在dlt-viewer上可以看到这9个hello,并且ECUID是1:
当前dlt-viewer连接的是ECU8:
证明实验已经成功,在ECU1上的“hello”log,已经通过ECU8这个gatway端发送到了dlt-viewer上。
版权声明:本站所有资料均为网友推荐收集整理而来,仅供学习和研究交流使用。
工作时间:8:00-18:00
客服电话
电子邮件
admin@qq.com
扫码二维码
获取最新动态