CN109739747A - A General Analysis Method of Serial Communication Information Protocol - Google Patents

A General Analysis Method of Serial Communication Information Protocol Download PDF

Info

Publication number
CN109739747A
CN109739747A CN201811525431.4A CN201811525431A CN109739747A CN 109739747 A CN109739747 A CN 109739747A CN 201811525431 A CN201811525431 A CN 201811525431A CN 109739747 A CN109739747 A CN 109739747A
Authority
CN
China
Prior art keywords
variable
protocol
frame header
communication information
byte
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201811525431.4A
Other languages
Chinese (zh)
Inventor
杨朝明
朱启举
杨鹏翔
阮娟
李应举
罗晓武
陈沣
刘琴
罗苏慧
余晓伟
高宗耀
白亮
谭鹏立
卢宝峰
李小博
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Xian Institute of Modern Control Technology
Original Assignee
Xian Institute of Modern Control Technology
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Xian Institute of Modern Control Technology filed Critical Xian Institute of Modern Control Technology
Priority to CN201811525431.4A priority Critical patent/CN109739747A/en
Publication of CN109739747A publication Critical patent/CN109739747A/en
Pending legal-status Critical Current

Links

Landscapes

  • Communication Control (AREA)
  • Computer And Data Communications (AREA)

Abstract

本发明属于产品测试、分析及评估软件领域,公开了一种串行通信信息协议通用解析方法,包括:一、根据通信信息协议填写配置参数文件;二、查找帧头标识;三、判断是否找到帧头标识;四、从帧头标识开始截取通信信息的协议字节长度,判定帧头标识到待解析数据结尾的字节个数是否小于协议字节长度;五、对通信信息协议进行校验判断;六、读取第i个变量,顺序解析第i个变量的特征参数;七、判断第i个变量是否为最后一个变量信息。本发明大大简化了串口通信信息协议的解析过程,取消了不同通信协议解析软件的编写过程,提高了通信协议的可读性,有效降低了解析过程的错误率,并显著提高了调试工作过程中的效率。

The invention belongs to the field of product testing, analysis and evaluation software, and discloses a general analysis method for serial communication information protocol, comprising: 1. filling in a configuration parameter file according to the communication information protocol; 2. searching for frame header identification; 3. judging whether to find the Frame header identification; 4. Intercept the protocol byte length of the communication information from the frame header identification, and determine whether the number of bytes from the frame header identification to the end of the data to be parsed is less than the protocol byte length; 5. Verify the communication information protocol Judgment; 6. Read the ith variable, and analyze the characteristic parameters of the ith variable in sequence; 7. Determine whether the ith variable is the last variable information. The invention greatly simplifies the analysis process of the serial communication information protocol, cancels the writing process of different communication protocol analysis software, improves the readability of the communication protocol, effectively reduces the error rate of the analysis process, and significantly improves the debugging process. s efficiency.

Description

A kind of general analytic method of serial communication information protocol
Technical field
The present invention relates to product test, analysis and assessment software field more particularly to a kind of serial communication information protocol solutions Analysis method.
Background technique
During product test, since the communication protocol of different product is not often identical, it is therefore desirable to for difference The corresponding analysis software of product edition, and the protocol contents of conventional protocol analysis software are readable poor, are not easy to modify, greatly The working efficiency of test assignment when reducing product development greatly.
Summary of the invention
In order to solve product communication protocol disunity existing in the prior art, need constantly to modify test software, software It is readable to protocol contents poor, it is not easy to modify, the problems such as test job inefficiency, the invention proposes a kind of serial communication letters Cease the general analytic method of agreement.
In order to solve the above-mentioned technical problem, technical scheme is as follows:
A kind of general analytic method of serial communication information protocol, includes the following steps:
Step 1: filling in configuration parameter file according to communication message protocol;The configuration parameter include protocol byte length, Frame head mark, verification mode, variable characteristic parameter, the characteristic parameter of variable includes variable declaration, varying byte length, variable Zoom factor, types of variables, multibyte variable transmitting-receiving sequence;
Step 2: searching frame head mark;
Step 3: judging whether to find frame head mark;
When finding frame head mark, step 4 is skipped to, otherwise judges whether it is communications information data ending, if being judged as YES, Parsing terminates, otherwise return step two;
Step 4: since frame head identify start intercept communication information protocol byte length, judgement frame head be identified to it is to be resolved Whether the byte number of the end of data is less than protocol byte length;
If the byte number that frame head is identified to the end of data to be resolved is less than protocol byte length, parsing terminates, otherwise, It skips to step 5;
Step 5: carrying out verification judgement to communication message protocol;
If check results are incorrect, the byte and return step two for abandoning frame head identification length in step 2 is held again Row;Otherwise step 6 is skipped to;
Step 6: reading i-th of variable, sequence parses the characteristic parameter of i-th of variable, and i=1 ... n, n are variable number;
Step 7: judging whether i-th of variable is the last one variable information;
If so, return step two begins looking for frame head mark again, otherwise, return step six reads next variable.
Further, in the step 6, the characteristic parameter that sequence parses i-th of variable further comprises:
1. reading variable declaration;
2. reading varying byte length;
3. rearranging varying byte data sequence according to multibyte variable transmitting-receiving sequence;
4. varying byte data conversion is switched to decimal number according to types of variables;
5. restoring actual physical information divided by variable zoom coefficient.
Advantageous effects of the invention:
In the present invention, by using the general analytic method of serial communication information protocol, according to the byte length of information protocol, The characteristic parameter of frame head mark, verification mode and variable fills in the information protocol configuration parameter file of different product, opens in product Begin first to load the configuration parameter file of the product before test, can be realized real time parsing is carried out to output of products information, it can be achieved that The online data of product shows, analyzes and assesses;In addition, product information agreement can be read and be modified by configuration file, increase The readability and alterability of agreement, therefore different information protocols can be adapted to by modification configuration file;For those For client development provide test, assess software enterprise propose a kind of solution of general parsing of information protocol, no longer need to For the different software communication interfaces of every kind of product customization, the versatility of test software is significantly improved.
Detailed description of the invention
Fig. 1 is a kind of configuration parameter file template of serial communication information protocol proposed by the present invention;
Fig. 2 is a kind of flow chart of the general parsing of serial communication information protocol proposed by the present invention.
Specific embodiment
The present invention is described in further detail below in conjunction with the accompanying drawings.
Compared with conventional analytic method, a kind of general analytic method of serial communication information protocol mainly believes serial communication Breath agreement is refined and uniformly, and is opened in the form of configuration file to parsing person, so that analytic method of the invention can be with Protocol analysis suitable for nearly all serial communication information.In order to reach the general purpose of protocol analysis, need to solve a variety of Serial communication messaging protocol format is unified or general problem is arranged.
The present invention is realized for serial communication information protocol to be unified for and be expressed by configuration parameter.Referring to Fig.1, serial In the profile template of communication message protocol, the configuration parameter of communication protocol first include protocol byte length, frame head mark, The characteristic parameter of verification mode, variable;Protocol byte length is the length of a cycle transmission in communication, and unit is byte Number;The frame head of agreement identifies, with hexadecimal mark, using space as blank character between multiple bytes;The verification of protocol information Mode, the method for calibration in characterization information transmission process.
Secondly the characteristic parameter description of the variable of communication protocol includes variable declaration, varying byte length, types of variables, change Measure zoom factor, multibyte variable transmitting-receiving sequence;Variable declaration, that is, variable name is for showing;Varying byte length is divided into 1~8 Eight kinds of byte;Types of variables is divided into unsigned int (U), has symbol integer (I), single-precision floating point (F) and double-precision floating point (D) Four kinds;Variable zoom coefficient is used to describe the multiple restored when amplification or variable receive when variable is sent, and variable zoom coefficient is Can mixed decimal decimal number;Multibyte variable transmitting-receiving sequence is divided into first low rear high (LH) and two kinds of from low to high (HL).
Referring to Fig. 2, a kind of general analytic method of serial communication information protocol provided by the invention includes the following steps:
Step 1: filling in configuration parameter file according to communication message protocol;The configuration parameter include protocol byte length, Frame head mark, transmission cycle, verification mode, variable characteristic parameter, the characteristic parameter of variable includes variable declaration, varying byte Length, variable zoom coefficient, types of variables, multibyte variable transmitting-receiving sequence.
Step 2: searching frame head mark;
Step 3: judging whether to find frame head mark;
When finding frame head mark, step 4 is skipped to, otherwise judges whether it is communications information data ending, if being judged as YES, Parsing terminates, otherwise return step two;
Step 4: since frame head identify start intercept communication information protocol byte length, judgement frame head be identified to it is to be resolved Whether the byte number of the end of data is less than protocol byte length;
If the byte number that frame head is identified to the end of data to be resolved is less than protocol byte length, parsing terminates, otherwise, It skips to step 5;
Step 5: carrying out verification judgement to communication message protocol;
If check results are incorrect, the byte and return step two for abandoning frame head identification length in step 2 is held again Row;Otherwise step 6 is skipped to;
Step 6: reading i-th of variable, sequence parses the characteristic parameter of i-th of variable, and i=1 ... n, n are variable number;
It is specific as follows:
6.1 read variable declaration;
6.2 read varying byte length;
6.3 rearrange varying byte data sequence according to variable transmitting-receiving sequence;
Varying byte data conversion is switched to decimal number according to types of variables by 6.4;
6.5 restore actual physical information divided by variable zoom coefficient;
Step 7: judging whether i-th of variable is the last one variable information;
If so, return step two begins looking for frame head mark again, otherwise, return step six reads next variable.
The foregoing is only a preferred embodiment of the present invention, but scope of protection of the present invention is not limited thereto, Anyone skilled in the art in the technical scope disclosed by the present invention, according to the technique and scheme of the present invention and its Inventive concept is subject to equivalent substitution or change, should be covered by the protection scope of the present invention.

Claims (2)

1.一种串行通信信息协议通用解析方法,其特征在于,包括如下步骤:1. a general analysis method of serial communication information protocol, is characterized in that, comprises the steps: 步骤一、根据通信信息协议填写配置参数文件;所述配置参数包括协议字节长度、帧头标识、校验方式、变量的特征参数,变量的特征参数包括变量说明、变量字节长度、变量缩放系数、变量类型、多字节变量收发顺序;Step 1. Fill in the configuration parameter file according to the communication information protocol; the configuration parameters include protocol byte length, frame header identification, verification method, and variable characteristic parameters, and variable characteristic parameters include variable description, variable byte length, and variable scaling. Coefficient, variable type, multi-byte variable sending and receiving order; 步骤二、查找帧头标识;Step 2: Find the frame header identifier; 步骤三、判断是否找到帧头标识;Step 3: Determine whether the frame header identifier is found; 当找到帧头标识,跳至步骤四,否则判断是否是通信信息数据结尾,若判断为是,解析结束,否则返回步骤二;When the frame header identifier is found, skip to step 4, otherwise judge whether it is the end of the communication information data, if it is judged to be yes, the parsing ends, otherwise return to step 2; 步骤四、从帧头标识开始截取通信信息的协议字节长度,判定帧头标识到待解析数据结尾的字节个数是否小于协议字节长度;Step 4: Intercept the protocol byte length of the communication information from the frame header identification, and determine whether the number of bytes from the frame header identification to the end of the data to be parsed is less than the protocol byte length; 若帧头标识到待解析数据结尾的字节个数小于协议字节长度,则解析结束,否则,跳至至步骤五;If the number of bytes from the frame header to the end of the data to be parsed is less than the length of the protocol bytes, the parsing ends; otherwise, skip to step 5; 步骤五、对通信信息协议进行校验判断;Step 5, verifying and judging the communication information protocol; 若校验结果不正确,则丢弃步骤二中帧头标识长度的字节并返回步骤二重新执行;否则跳至步骤六;If the verification result is incorrect, discard the bytes of the frame header identification length in step 2 and return to step 2 to execute again; otherwise, skip to step 6; 步骤六、读取第i个变量,顺序解析第i个变量的特征参数,i=1…n,n为变量个数;Step 6: Read the ith variable, analyze the characteristic parameters of the ith variable sequentially, i=1...n, n is the number of variables; 步骤七、判断第i个变量是否为最后一个变量信息;Step 7. Determine whether the i-th variable is the last variable information; 若是,则返回步骤二重新开始查找帧头标识,否则,返回步骤六读取下一个变量。If so, go back to step 2 to start searching for the frame header identifier again, otherwise, go back to step 6 to read the next variable. 2.如权利要求1所述的一种串行通信信息协议通用解析方法,其特征在于,所述步骤六中,顺序解析第i个变量的特征参数进一步包括:2. a kind of general analysis method of serial communication information protocol as claimed in claim 1, is characterized in that, in described step 6, the characteristic parameter of sequence analysis i-th variable further comprises: 1.读取变量说明;1. Read the variable description; 2.读取变量字节长度;2. Read the variable byte length; 3.根据多字节变量收发顺序重新排列变量字节数据顺序;3. Rearrange the variable byte data sequence according to the multi-byte variable sending and receiving sequence; 4.根据变量类型将变量字节数据转换转为十进制数;4. Convert the variable byte data to decimal numbers according to the variable type; 5.除以变量缩放系数还原真实物理信息。5. Divide by the variable scaling factor to restore the real physical information.
CN201811525431.4A 2018-12-13 2018-12-13 A General Analysis Method of Serial Communication Information Protocol Pending CN109739747A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811525431.4A CN109739747A (en) 2018-12-13 2018-12-13 A General Analysis Method of Serial Communication Information Protocol

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811525431.4A CN109739747A (en) 2018-12-13 2018-12-13 A General Analysis Method of Serial Communication Information Protocol

Publications (1)

Publication Number Publication Date
CN109739747A true CN109739747A (en) 2019-05-10

Family

ID=66359023

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811525431.4A Pending CN109739747A (en) 2018-12-13 2018-12-13 A General Analysis Method of Serial Communication Information Protocol

Country Status (1)

Country Link
CN (1) CN109739747A (en)

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110213297A (en) * 2019-06-27 2019-09-06 北京史河科技有限公司 A kind of data analysis method, device and computer readable storage medium
CN110545283A (en) * 2019-09-12 2019-12-06 潍柴动力股份有限公司 Bit-based J1939 variable data acquisition method
CN111091697A (en) * 2019-11-29 2020-05-01 湖北航天飞行器研究所 Telemetry data processing system
CN111107059A (en) * 2019-11-29 2020-05-05 彩虹无人机科技有限公司 Unmanned aerial vehicle multi-protocol transmission data analysis method
CN111314304A (en) * 2020-01-17 2020-06-19 西安微电子技术研究所 Multi-type data stream oriented frame identification method, device and readable storage medium
CN111339020A (en) * 2020-02-25 2020-06-26 东莞市峰谷科技有限公司 Serial port data receiving and transmitting method
CN112235302A (en) * 2020-10-15 2021-01-15 天津津航计算技术研究所 Protocol analysis method suitable for multiple buses
CN112486910A (en) * 2020-11-23 2021-03-12 天津津航计算技术研究所 Method for rapidly analyzing mass data files
CN112491645A (en) * 2020-11-11 2021-03-12 深圳数联天下智能科技有限公司 Automatic test method and automatic test equipment
CN114168517A (en) * 2020-09-11 2022-03-11 北京机械设备研究所 Universal asynchronous serial data analysis method and device
CN114979307A (en) * 2022-04-19 2022-08-30 杭州涂鸦信息技术有限公司 Communication protocol analysis method, intelligent terminal and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070168590A1 (en) * 2005-12-21 2007-07-19 Crain Ii Charles E Serial Port that Supports Multiple Protocols
CN102098131A (en) * 2009-12-15 2011-06-15 航天科工惯性技术有限公司 Dynamic parameter configuration-based general framing and de-framing method for serial port data frames
CN104780140A (en) * 2014-01-12 2015-07-15 盛吉高科(北京)科技有限公司 Configurable communication protocol identifying and parsing system
CN105681134A (en) * 2016-03-04 2016-06-15 西安航天动力技术研究所 General multiple serial port communication protocol detection and identification method
CN108415857A (en) * 2018-03-01 2018-08-17 合肥威艾尔智能技术有限公司 A kind of universal process method of serial data

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070168590A1 (en) * 2005-12-21 2007-07-19 Crain Ii Charles E Serial Port that Supports Multiple Protocols
CN102098131A (en) * 2009-12-15 2011-06-15 航天科工惯性技术有限公司 Dynamic parameter configuration-based general framing and de-framing method for serial port data frames
CN104780140A (en) * 2014-01-12 2015-07-15 盛吉高科(北京)科技有限公司 Configurable communication protocol identifying and parsing system
CN105681134A (en) * 2016-03-04 2016-06-15 西安航天动力技术研究所 General multiple serial port communication protocol detection and identification method
CN108415857A (en) * 2018-03-01 2018-08-17 合肥威艾尔智能技术有限公司 A kind of universal process method of serial data

Cited By (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110213297A (en) * 2019-06-27 2019-09-06 北京史河科技有限公司 A kind of data analysis method, device and computer readable storage medium
CN110545283A (en) * 2019-09-12 2019-12-06 潍柴动力股份有限公司 Bit-based J1939 variable data acquisition method
CN110545283B (en) * 2019-09-12 2022-08-23 潍柴动力股份有限公司 Bit-based J1939 variable data acquisition method
CN111091697A (en) * 2019-11-29 2020-05-01 湖北航天飞行器研究所 Telemetry data processing system
CN111107059A (en) * 2019-11-29 2020-05-05 彩虹无人机科技有限公司 Unmanned aerial vehicle multi-protocol transmission data analysis method
CN111314304A (en) * 2020-01-17 2020-06-19 西安微电子技术研究所 Multi-type data stream oriented frame identification method, device and readable storage medium
CN111314304B (en) * 2020-01-17 2022-07-19 西安微电子技术研究所 Multi-type data stream oriented frame identification method, device and readable storage medium
CN111339020A (en) * 2020-02-25 2020-06-26 东莞市峰谷科技有限公司 Serial port data receiving and transmitting method
CN114168517A (en) * 2020-09-11 2022-03-11 北京机械设备研究所 Universal asynchronous serial data analysis method and device
CN114168517B (en) * 2020-09-11 2024-01-16 北京机械设备研究所 Universal asynchronous serial data analysis method and device
CN112235302A (en) * 2020-10-15 2021-01-15 天津津航计算技术研究所 Protocol analysis method suitable for multiple buses
CN112235302B (en) * 2020-10-15 2023-03-24 天津津航计算技术研究所 Protocol analysis method suitable for multiple buses
CN112491645A (en) * 2020-11-11 2021-03-12 深圳数联天下智能科技有限公司 Automatic test method and automatic test equipment
CN112486910A (en) * 2020-11-23 2021-03-12 天津津航计算技术研究所 Method for rapidly analyzing mass data files
CN114979307A (en) * 2022-04-19 2022-08-30 杭州涂鸦信息技术有限公司 Communication protocol analysis method, intelligent terminal and storage medium

Similar Documents

Publication Publication Date Title
CN109739747A (en) A General Analysis Method of Serial Communication Information Protocol
CN102118230B (en) Tree and tabular combined notation (TTCN)-based network protocol performance testing method
CN101651683B (en) Method for generating analysis source code of signaling message
CN110719296A (en) A method for automatic analysis of message data in terminal communication protocol
CN101262304A (en) A data flow analysis method based on general communication data format
CN107544765A (en) A kind of order print system and method
CN115242896B (en) Dynamic message parsing method and device, electronic equipment and computer readable storage medium
CN102752216B (en) A method for identifying application traffic with dynamic characteristics
CN113422718A (en) Configuration protocol-based internet of things gateway and method for docking equipment
CN107291675A (en) A kind of trade information sorting code number management system and method
CN105978886A (en) Parameter dynamic parsing method suitable for various metering instrument communication
CN110830466A (en) A method and device for framing DL/T645 protocol message based on XML
CN110191447A (en) The filter method and relevant apparatus of Bluetooth broadcast packet in a kind of ESL
CN117714564B (en) Universal DLT645 protocol analysis method and device based on java language
CN108064037B (en) A method and device for command parsing based on near field communication
CN113438226B (en) Message generating and analyzing method, device and system based on hybrid transmission protocol
CN102722592B (en) Universal digital information recording device and method
CN100357952C (en) Binary data access method
CN107943761A (en) A kind of method of calibration and system of TXT document codings character set
CN104536922B (en) Sensor data reading, converting and storing system in intelligent granary
CN115097808A (en) Vehicle fault code simulation test method, system, electronic equipment and storage
CN110222279A (en) Electronic description acquisition methods based on nameplate
CN116094778B (en) Real-time monitoring system based on Internet
CN114648786B (en) Finger vein data transmission method, device, equipment and storage medium
CN110769049A (en) A power distribution terminal and its SOE data uploading method

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20190510

RJ01 Rejection of invention patent application after publication