经常需要调试Cyphal协议,yakut的安装比较麻烦,所以就用candump和gawk实现了一个协议解析工具。
这个candump导出的数据,很明显这是一条心跳广播,7D55是心跳广播的id,而且还是条单帧消息。
can1 107D552A [8] 00 00 00 00 00 01 A1 E0 can1 107D552A [8] 01 00 00 00 00 01 A1 E1 can1 107D552A [8] 02 00 00 00 00 01 A1 E2 can1 107D552A [8] 03 00 00 00 00 01 A1 E3
解析的依据参考这个图片:
贴上我们的awk脚本:
usage_and_exit () { echo -e "e[32m$0e[0m support option is : e[32m-v|--versione[0m show the program version e[32m-d|--debuge[0m open debug mode e[32m-m|--monitore[0m print online node and do message statistic e[32m-i|--interfacee[0m specify the can interface to listen e[32m-c|--cyclee[0m set frequency calculate cycle, uint is second. e[32m-e|--print_errore[0m print toggle error and transfer id not continue error. e[32m-h|--helpe[0m show this