基于事件驅(qū)動(dòng)的串口通訊控件
消息幀數(shù)據(jù)格式:
1 0 A B X X
其中 10 為消息標(biāo)識(shí),
AB表示文本長(zhǎng)度,L=A*100+B
XX為配位字符,任意
控制幀數(shù)據(jù)格式
0 1 A B M N
其中 01為控制標(biāo)識(shí),
AB為請(qǐng)求標(biāo)識(shí)
MN為附加標(biāo)識(shí)
11表示請(qǐng)求對(duì)方接收文件,M表示描述字串中文件名子串的長(zhǎng)度
N表示描述字串中文件大小子串的長(zhǎng)度
10通知對(duì)方放棄傳輸
00通知文件傳輸完畢
01請(qǐng)求對(duì)方發(fā)送數(shù)據(jù), MN為10請(qǐng)求發(fā)送下一個(gè)
MN為00請(qǐng)求重發(fā)
數(shù)據(jù)幀數(shù)據(jù)格式
0 0 A B M N
其中 00 為數(shù)據(jù)標(biāo)識(shí),
AB表示數(shù)據(jù)長(zhǎng)度,L=A*100+B
MN為校驗(yàn),M*100+N=A+B
Data Structures and Algorithms
with Object-Oriented Design Patterns in Java
Bruno R. Preiss
B.A.Sc., M.A.Sc., Ph.D., P.Eng.
Associate Professor
Department of Electrical and Computer Engineering
University of Waterloo, Waterloo, Canada