Elevator/ymodem-master
Huey 5c576d7701 first 2024-07-28 18:23:29 +08:00
..
build first 2024-07-28 18:23:29 +08:00
doc first 2024-07-28 18:23:29 +08:00
.gitignore first 2024-07-28 18:23:29 +08:00
CMakeLists copy.txt first 2024-07-28 18:23:29 +08:00
CMakeLists.txt first 2024-07-28 18:23:29 +08:00
LICENSE first 2024-07-28 18:23:29 +08:00
Makefile first 2024-07-28 18:23:29 +08:00
README.md first 2024-07-28 18:23:29 +08:00
checkversion.cpp first 2024-07-28 18:23:29 +08:00
checkversion.h first 2024-07-28 18:23:29 +08:00
download.cpp first 2024-07-28 18:23:29 +08:00
download.h first 2024-07-28 18:23:29 +08:00
log.cpp first 2024-07-28 18:23:29 +08:00
log.h first 2024-07-28 18:23:29 +08:00
serial_port.c first 2024-07-28 18:23:29 +08:00
serial_port.h first 2024-07-28 18:23:29 +08:00
ymodem.c first 2024-07-28 18:23:29 +08:00
ymodem.h first 2024-07-28 18:23:29 +08:00
ymodem_test.cpp first 2024-07-28 18:23:29 +08:00

README.md

由网上开源Ymodem代码修改而来根据与服务器的通信协议以及传感器的协议做出以下修改 1、定期查询version文件中的版本号version文件由update-engine工程中的updata进程负责下载 2、定期向服务器查询当前传感器的版本号并于version中的版本号做对比 3、版本不一致则进行升级 4、根据与传感器的协议添加了升级失败时的失败代码的处理

以下时原工程的readme内容有些方法可能失效

ymodem

linux c ymodem

在调用receive/send时,需要先设置好struct ymodem的几个回调函数.如ymodem_test中.

help

/userdata/test # ./ymodem -h
Usage : ./ymodem [options]
options:
eg send Ymodem: ./ymodem -d /dev/ttyS0 -s /demo/bin/SE-app2.bin
eg receive Ymodem: ./ymodem -d /dev/ttyUSB0
	 -d <device name>		device path.设置设备名,默认/dev/ttyUSB0.
	 -s <file name>       send Ymodem, receiving mode if not set.发送文件,如果不选,默认为接收文件
	 -t <timeout>         Set getchar timeout,def:10(1s), 1=100ms.设置getchar超时,1为100毫秒,默认10=>1s.
	 --help			display specific types of command line options.

recevice file

/userdata/test # ./ymodem -d /dev/ttyUSB0 
dev path: /dev/ttyUSB0
open dev: /dev/ttyUSB0
Receice Ymodem!
				C
				C
				C
SOH 00 FF Data[128] CRC CRC
				ACK
				C
file name : xymodem.pdf, size : 53245
STX 01 FE Data[1024] CRC CRC
				ACK
STX 02 FD Data[1024] CRC CRC
				ACK
.
.
.
STX 33 CC Data[1024] CRC CRC
				ACK
STX 34 CB Data[1024] CRC CRC
				ACK
EOT 
				NAK
EOT 
				ACK
				C
SOH 00 FF Data[128] CRC CRC
				ACK
Recevice complete!
file: xymodem.pdf, size: 53245
/userdata/test # 

send file

/userdata/test # 
/userdata/test # ./ymodem -d /dev/ttyUSB0  -s xymodem.pdf 
dev path: /dev/ttyUSB0
send file: xymodem.pdf.
open dev: /dev/ttyUSB0
Send Ymodem! file: xymodem.pdf
				CAN
				CAN
				C
file name: xymodem.pdf, size: 53245
SOH 00 FF Data[128] CRC CRC
				ACK
				C
STX 01 FE Data[1024] CRC CRC
				ACK
STX 02 FD Data[1024] CRC CRC
				ACK
.
.
.
STX 33 CC Data[1024] CRC CRC
				ACK
STX 34 CB Data[1024] CRC CRC
				ACK
EOT
				NAK
EOT
				ACK
				C
SOH 00 FF Data[128] CRC CRC
				ACK
Transfer complete!