CN116016692A - Protocol description text construction method, device, equipment and storage medium - Google Patents

Protocol description text construction method, device, equipment and storage medium Download PDF

Info

Publication number
CN116016692A
CN116016692A CN202211686127.4A CN202211686127A CN116016692A CN 116016692 A CN116016692 A CN 116016692A CN 202211686127 A CN202211686127 A CN 202211686127A CN 116016692 A CN116016692 A CN 116016692A
Authority
CN
China
Prior art keywords
description text
protocol description
protocol
transmission frame
determining
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
CN202211686127.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.)
Hangzhou Kongtrolink Information Technology Co ltd
Original Assignee
Hangzhou Kongtrolink Information Technology Co ltd
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 Hangzhou Kongtrolink Information Technology Co ltd filed Critical Hangzhou Kongtrolink Information Technology Co ltd
Priority to CN202211686127.4A priority Critical patent/CN116016692A/en
Publication of CN116016692A publication Critical patent/CN116016692A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Communication Control (AREA)

Abstract

The application provides a protocol description text construction method, device, equipment and storage medium, and relates to the technical field of data processing. The method comprises the following steps: determining at least one transmission frame in a first protocol description text, wherein the first protocol description text is the protocol description text in construction of the first device; determining a reference protocol description text of the first protocol description text in a second protocol description text by taking at least one transmission frame as the text characteristic of the first protocol description text, wherein the second protocol description text is the constructed protocol description text of the second device; and determining the rest content except at least one transmission frame in the first protocol description text according to the reference protocol description text. Therefore, the transmission frames in the protocol description text in construction are utilized, the protocol description text suitable for reference is determined in the protocol description text in construction, and the protocol description text in construction is perfected by referring to the protocol description text, so that the construction efficiency of the protocol description text is improved.

Description

Protocol description text construction method, device, equipment and storage medium
Technical Field
The present disclosure relates to the field of data processing technologies, and in particular, to a method, an apparatus, a device, and a storage medium for constructing a protocol description text.
Background
In the field of industrial internet of things, the number and variety of terminal devices are very large, and corresponding device communication protocols need to be developed for the terminal devices in a targeted manner.
In the related art, engineers write and develop corresponding protocol description text for terminal equipment based on a communication protocol provided by equipment manufacturers of the terminal equipment.
However, the protocol description text construction efficiency of the device in the above manner is low.
Disclosure of Invention
The application provides a method, a device, equipment and a storage medium for constructing a protocol description text, which are used for solving the problem of low efficiency of constructing the protocol description text.
In a first aspect, the present application provides a method for constructing a protocol description text, including: determining at least one transmission frame in a first protocol description text, wherein the first protocol description text is the protocol description text of the first equipment in the construction process; determining a reference protocol description text of the first protocol description text in a second protocol description text by taking the at least one transmission frame as the text characteristic of the first protocol description text, wherein the second protocol description text is constructed and completed protocol description text of a second device, and the second device and the first device are different devices; and determining the rest content except the at least one transmission frame in the first protocol description text according to the reference protocol description text.
In one possible implementation manner, the determining at least one transmission frame in the first protocol description text includes: and determining an nth transmission frame in the first protocol description text, wherein n is greater than or equal to 1.
In one possible implementation manner, the determining, in the second protocol description text, the reference protocol description text of the first protocol description text with the text feature of the first protocol description text that is the at least one transmission frame includes: determining an nth transmission frame in the second protocol description text; and determining the reference protocol description text in the second protocol description text according to the nth transmission frame in the first protocol description text and the nth transmission frame in the second protocol description text.
In one possible implementation manner, the determining the reference protocol description text according to the nth transmission frame in the first protocol description text and the nth transmission frame in the second protocol description text includes: performing text matching on an nth transmission frame in the first protocol description text and an nth transmission frame in the second protocol description text, and determining similar transmission frames of the nth transmission frame in the first protocol description text; and determining the reference protocol description text as the protocol description text to which the similar transmission frame belongs.
In one possible implementation manner, the determining, according to the reference protocol description text, the remaining content in the first protocol description text except for the at least one transmission frame includes: extracting protocol elements from the reference protocol description text; and according to the protocol elements, complementing blank elements to be configured in the residual content.
In one possible implementation manner, the at least one transmission frame is an nth transmission frame in the first protocol description text, and the extracting a protocol element from the reference protocol description text includes: extracting an allowed configuration field of an mth transmission frame in the reference protocol description text, wherein m is not equal to n; the blank element includes a blank field, and the complementing the blank element to be configured in the remaining content according to the protocol element includes: and determining a blank field of an mth transmission frame in the first protocol description text as an allowable configuration field of the mth transmission frame in the reference protocol description text.
In one possible implementation manner, extracting a protocol element from the reference protocol description text includes: extracting protocol elements related to response frame analysis from the reference protocol description file; the complementing the blank element to be configured in the rest content according to the protocol element comprises: and adding the protocol element related to response frame analysis to the first protocol description text.
In a second aspect, the present application provides a protocol description text construction apparatus, including:
a transmission frame determining unit, configured to determine at least one transmission frame in a first protocol description text, where the first protocol description text is a protocol description text in a building process of a first device;
a reference text determining unit, configured to determine, in a second protocol description text, a reference protocol description text of the first protocol description text by using the at least one transmission frame as a text feature of the first protocol description text, where the second protocol description text is a constructed protocol description text of a second device, and the second device and the first device are different devices;
and the residual content determining unit is used for determining residual contents except the at least one transmission frame in the first protocol description text according to the reference protocol description text.
In a third aspect, the present application provides an electronic device, comprising: at least one processor and memory;
the memory stores computer-executable instructions;
at least one processor executes computer-executable instructions stored in a memory, causing the at least one processor to perform the protocol description text construction method as provided in the first aspect above.
In a fourth aspect, the present application provides a computer-readable storage medium having stored therein computer-executable instructions which, when executed by a processor, are configured to implement the protocol description text construction method as provided in the first aspect above.
In a fifth aspect, the present application provides a computer program product comprising a computer program which, when executed by a processor, implements a protocol description text construction method as provided in the first aspect above.
The method, the device, the equipment and the storage medium for constructing the protocol description text determine at least one transmission frame in a first protocol description text, wherein the first protocol description text is the protocol description text of the first equipment in the construction process, and the rest of contents except the at least one transmission frame in the first protocol description text are to be constructed; determining a reference protocol description text of the first protocol description text in a second protocol description text by taking the at least one transmission frame as the text characteristic of the first protocol description text, wherein the second protocol description text is the constructed protocol description text of the second device, and the second device and the first device are different devices; and determining the rest content except at least one occurrence frame in the first protocol description text according to the reference protocol text, namely constructing the rest content in the first protocol description text by taking the reference protocol text as a reference object to obtain a complete first protocol description text, and completing the construction of the first protocol description text. Therefore, based on at least one transmission frame in the protocol description text in the construction process and the constructed protocol description text, the automatic construction of the protocol description text in the construction process is realized, without the need of a developer to construct all contents in the protocol description text one by one, and the construction efficiency of the protocol description text is effectively improved.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the application and together with the description, serve to explain the principles of the application.
Fig. 1 is a schematic diagram of an application scenario suitable for the embodiment of the present application;
fig. 2 is a second application scenario schematic diagram applicable to the embodiment of the present application;
fig. 3 is a schematic structural diagram of a protocol description file provided in an embodiment of the present application;
fig. 4 is a schematic flow chart of a method for constructing a protocol description text according to an embodiment of the present application;
fig. 5 is a second flow chart of a method for constructing a protocol description text according to an embodiment of the present application;
FIG. 6 is a diagram of an example of the construction of a protocol description text provided in an embodiment of the present application;
fig. 7 is a flowchart illustrating a method for constructing a protocol description text according to an embodiment of the present application;
fig. 8 is a schematic structural diagram of a protocol description text construction device according to an embodiment of the present application;
fig. 9 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Specific embodiments thereof have been shown by way of example in the drawings and will herein be described in more detail. These drawings and the written description are not intended to limit the scope of the inventive concepts in any way, but to illustrate the concepts of the present application to those skilled in the art by reference to specific embodiments.
Detailed Description
Reference will now be made in detail to exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, the same numbers in different drawings refer to the same or similar elements, unless otherwise indicated. The implementations described in the following exemplary examples are not representative of all implementations consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with some aspects of the present application as detailed in the accompanying claims.
In the related art, a development engineer develops a corresponding protocol description text for a terminal device according to a communication protocol provided by a device manufacturer of the terminal device. Development engineers need to rely on expertise in communication protocols to find protocol elements that can be used to construct protocol description text one by one, which is inefficient.
In order to improve the construction efficiency of the protocol description text, the protocol description text of other terminal equipment similar to the equipment model of the current terminal equipment can be searched, and the protocol description text of the other terminal equipment is modified on the basis of the protocol description text of the other terminal equipment. However, when the number of protocol description texts is large, the number of similar device models is also large, other terminal devices corresponding to the similar device models are also large, and the similarity of the device models and the similarity of the communication protocols have a certain relationship but not a certain relationship, so that a less suitable protocol description text is possibly selected as a basis for protocol modification, and the efficiency improvement effect is limited.
Therefore, how to quickly and accurately select similar protocol description texts from a large number of protocol description texts is a key breakthrough point for shortening the construction period of the protocol description texts.
In order to solve the above problems, the present application provides a method, an apparatus, a device, and a storage medium for constructing a protocol description text. In the application, considering that the communication protocol of the terminal equipment mainly consists of a transmission frame and a data response frame and the communication protocol has certain integrity, if the transmission frame similarity of the two equipment is higher, the data response frame similarity is higher, the analysis rule similarity of the data response frame is higher, at least one transmission frame in the first protocol description text is taken as a text feature, and the reference protocol description text of the first protocol description text is determined in the second protocol description text, which is equivalent to the protocol description text similar to the first protocol description text; based on the reference protocol description text, the remaining content in the first protocol description text excluding the at least one transmission frame is determined. Therefore, the efficiency and the accuracy of searching similar protocol description texts in a large number of protocol description texts are improved, and the construction efficiency of the protocol description texts is further improved.
Fig. 1 is a schematic diagram of an application scenario suitable for the embodiment of the present application. As shown in fig. 1, the devices involved in the application scenario include a protocol description text construction device 110 and a database 120 in which a plurality of constructed protocol description texts can be stored. The protocol description text constructing means 110 may acquire a plurality of protocol description texts from the database 120 when constructing the protocol description texts, determine a similar protocol description text among the plurality of protocol description texts based on at least one transmission frame of the protocol description texts under construction, and perfect the protocol description text under construction with reference to the similar protocol description text. The protocol description text construction device 110 may be a server or a terminal, and fig. 1 illustrates the server as an example.
The terminal may be a personal digital processing (personal digital assistant, PDA for short), a handheld device (e.g., a smart phone, a tablet computer), a computing device (e.g., a personal computer (personal computer, PC for short)), a vehicle-mounted device, a wearable device (e.g., a smart watch, a smart bracelet), a smart home device (e.g., a smart display device), etc. The servers may be distributed servers, centralized servers, cloud servers, and the like.
Fig. 2 is a second schematic application scenario applicable to the embodiment of the present application. As shown in fig. 2, the apparatus related to the application scenario includes an edge computing host or a programmable logic controller (Programmable Logic Controller, abbreviated as PLC), and further includes a terminal device. In the communication protocol, a transmission frame (which may also be referred to as a data transmission frame, a data query frame) and a data response frame may be included, wherein the transmission frame is transmitted to the terminal device by the edge computing host or the PLC, and the data response frame is transmitted to the edge computing host or the PLC by the terminal device. The protocol description text mainly describes the transmission frame and the information related to the analysis of the data response frame, so that the edge computing host or the PLC can transmit the transmission frame which can be analyzed by the terminal equipment to the terminal equipment based on the protocol description text, and analyze the data response frame returned by the terminal equipment.
Fig. 3 is a schematic structural diagram of a protocol description file provided in an embodiment of the present application. As shown in fig. 3, in the protocol description text of the terminal device, contents such as a protocol type, a device model number, a device vendor, a software version number, a number of data frames, a transmission frame vector, a data parsing rule (i.e., a signal point parsing rule) and the like may be described. The transmission frame vector, i.e., the transmission frame (i.e., the query frame), can be expressed as: transmitting frame 1: XXX (frame structure of transmission frame 1); transmitting frame 2: XXX (frame structure of transmission frame 2); … …; transmitting frame k: XXX (frame structure of transmission frame k). The data parsing rule is a parsing rule of a response frame corresponding to the transmission frame, and may specifically include parsing rules of a plurality of signal points in the response frame, for example: signal point 1: analyzing rules; signal point 2: analyzing rules; … …; signal point m: and analyzing the rule.
The following describes the technical solution of the present application and how the technical solution of the present application solves the above technical problems in detail with specific embodiments. The following embodiments may be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments. Embodiments of the present application will be described below with reference to the accompanying drawings.
Referring to fig. 4, fig. 4 is a schematic flow diagram of a method for constructing a protocol description text according to an embodiment of the present application. As shown in fig. 4, the protocol description text construction method provided in this embodiment includes:
s401, determining at least one transmission frame in a first protocol description text, wherein the first protocol description text is the protocol description text of the first device in the construction process.
The first device is a terminal device. For convenience of distinction, the protocol description text of the first device in the building process is referred to as a first protocol description text.
In this embodiment, at least one transmission frame in the first protocol description text may be pre-constructed by a professional based on a communication protocol provided by a device manufacturer of the first device, for example, 10 transmission frames need to be constructed in total in the first protocol description text, and 1 transmission frame is pre-constructed by the professional. Compared with the construction of the whole first protocol description text, the construction of one or a plurality of transmission frames in the first protocol description text greatly reduces the time consumption of professionals. After the professional constructs at least one transmission frame in the first protocol description text, the transmission frame may be stored in a database, and the transmission frame may be input into the protocol description text constructing apparatus, so in this embodiment, the at least one transmission frame in the first protocol description text may be acquired from the database or the at least one transmission frame input by the user may be received.
S402, taking at least one transmission frame as a text characteristic of a first protocol description text, determining a reference protocol description text of the first protocol description text in a second protocol description text, wherein the second protocol description text is a constructed protocol description text of a second device, and the second device and the first device are different devices.
Wherein the second device may be one or more terminal devices. For convenience of the area, the protocol description text of the second device is referred to as a second protocol description text.
In this embodiment, the second protocol description text may be obtained from the protocol database. And taking at least one transmission frame in the first protocol description text as the text characteristic of the first protocol description text, and matching the at least one transmission frame with the transmission frame in the second protocol description text. Considering that the communication protocol of the terminal equipment mainly consists of a transmission frame and a data response frame, and the communication protocol has certain integrity, if the transmission frame similarity of the two equipment is higher, the data response frame similarity is also higher, and the analysis rule similarity of the data response frame is also higher, so that a protocol description text similar to the first protocol description text can be selected from the second protocol description text based on the matching result of the transmission frame in the first protocol description text and the transmission frame in the second protocol description text. Considering that this protocol description text is used as a reference object for constructing the first protocol description text, the protocol description text is referred to as a reference protocol description text for convenience of distinction.
As an example, the first device is a device a, the second device includes a device B, a device D, and a device C, the protocol description text of the device B, the protocol description text of the device D, and the protocol description text of the device C are already constructed, the protocol description text of the device a needs to be constructed, at least one transmission frame in the protocol description text of the device a may be constructed by a professional, and then the at least one transmission frame is used as a text feature, and a reference protocol description text similar to the protocol description text of the device a is searched in the protocol description text of the device B, the protocol description text of the device D, and the protocol description text of the device C, so as to further construct and complete the protocol description text of the device a based on the reference protocol description text.
S403, determining the rest content except at least one transmission frame in the first protocol description text according to the reference protocol description text.
In the present embodiment, in determining the reference protocol description text, the protocol content may be extracted in the reference protocol description text. Such as extracting the transmitted frames, data parsing rules, software versions, etc. The remaining content in the first protocol description text may be generated based on the extracted protocol content.
According to the method and the device for searching the reference protocol description text, based on at least one transmission frame in the first protocol description text, the reference protocol description text similar to the first protocol description text is searched in the constructed second protocol description text, and therefore the searching efficiency and accuracy of the similar protocol description text are improved. The remaining content of the first protocol description text is determined based on the reference protocol description text, a complete first protocol description text is obtained, and then the first protocol description text can be modified and corrected by a professional. Because the reference protocol description text is higher in similarity with the first protocol description text, the accuracy of generating the first protocol description text based on the reference protocol description text is higher, and the workload of modifying and correcting the first protocol description text by professionals after the first protocol description text is generated is greatly reduced, so that the construction efficiency of the protocol description text is effectively improved.
In some embodiments, at least one transmission frame in the first protocol description text may be an nth transmission frame in the first protocol description text, n being greater than or equal to 1. Therefore, a professional only needs to develop the nth transmission frame in the first protocol description text, and can determine the rest content in the first protocol description text based on the nth transmission frame and the second protocol description text, so that the construction efficiency of the protocol description text is improved.
Referring to fig. 5, fig. 5 is a second flowchart of a method for constructing a protocol description text according to an embodiment of the present application. As shown in fig. 5, the protocol description text construction method includes:
s501, determining an nth transmission frame in the first protocol description text, wherein n is greater than or equal to 1.
The first protocol description text may refer to the foregoing embodiments, and will not be described in detail.
In this embodiment, the nth transmission frame in the first protocol description text may be pre-constructed by a professional based on a communication protocol provided by a device manufacturer of the first device. Compared with the construction of the whole first protocol description text, the construction of the nth transmission frame in the first protocol description text consumes less time and does not reduce the construction efficiency of the whole first protocol description text. The nth transmission frame in the first protocol description text may be obtained from the database or may be received as input by the user.
Further, n is 1, and S501 may include: and determining the 1 st transmission frame in the first protocol description text. The practitioner may construct a 1 st transmission frame in the first protocol description text based on the communication protocol provided by the device vendor of the first device, and other transmission frames may need to be determined based on the reference protocol description text.
S502, determining an nth transmission frame in the second protocol description text.
The second protocol description text may refer to the foregoing embodiments, and will not be described in detail.
In this embodiment, the second protocol description text may be obtained from the protocol database. For each second protocol description text, the nth transmission frame in the second protocol description text can be identified according to the arrangement sequence of the transmission frames in the second protocol description text.
S503, determining a reference protocol description text in the second protocol description text according to the nth transmission frame in the first protocol description text and the nth transmission frame in the second protocol description text.
In this embodiment, for similar protocol description texts, the nth transmission frame is similar, so the nth transmission frame in the first protocol description text and the nth transmission frame in the second protocol description text may be compared, and the similarity between the nth transmission frame in the first protocol description text and the nth transmission frame in the second protocol description text may be determined; determining a transmission frame with highest similarity with the nth transmission frame in the first protocol description text in the nth transmission frame in the second protocol description text; and determining the reference protocol description text as the protocol description text to which the transmission frame with the highest similarity belongs. Therefore, based on the similarity between the nth transmission frame in the first protocol description text and the nth transmission frame in the second protocol description text, the accuracy and the searching efficiency of the reference protocol description text are improved.
In one possible implementation, S303 includes: performing text matching on an nth transmission frame in the first protocol description text and an nth transmission frame in the second protocol description text, and determining similar transmission frames of the nth transmission frame in the first protocol description text; and determining the reference protocol description text as the protocol description text to which the similar transmission frame belongs.
In the implementation manner, text matching can be performed on an nth transmission frame in the first protocol description text and an nth transmission frame in the second protocol description text to obtain similarity between the nth transmission frame in the first protocol description text and the nth transmission frame in the second protocol description text; determining the similar transmission frames as the transmission frames with the highest similarity with the nth transmission frame in the first protocol description text in the nth transmission frame in the second protocol description text; and determining the reference protocol description text as the protocol description text to which the similarity transmission frame belongs. Therefore, the accuracy of the similarity between the nth transmission frame in the first protocol description text and the nth transmission frame in the second protocol description text is improved in a text matching mode, and the accuracy of the reference protocol description text is further improved.
S504, determining the rest content except at least one transmission frame in the first protocol description text according to the reference protocol description text.
The implementation principle and technical effect of S504 may refer to the foregoing embodiments, and are not described herein.
According to the method and the device for searching the reference protocol description text in the second protocol description text, the reference protocol description text similar to the first protocol description text is searched in the second protocol description text based on the similarity between the nth transmission frame in the first protocol description text and the nth transmission frame in the second protocol description text, and therefore the searching efficiency and the searching accuracy of the similar protocol description text are improved. And determining the rest content of the first protocol description text based on the reference protocol description text to obtain the complete first protocol description text. Because the reference protocol description text is higher in similarity with the first protocol description text, the accuracy of generating the first protocol description text based on the reference protocol description text is higher, and the workload of modifying and correcting the first protocol description text by professionals after the first protocol description text is generated is greatly reduced, so that the construction efficiency of the protocol description text is effectively improved.
By way of example, fig. 6 is a diagram illustrating the construction of protocol description text provided in an embodiment of the present application. As shown in fig. 6, first, a first transmission frame may be developed by a developer based on a protocol text T provided by a device manufacturer of the device D, and input to a protocol matcher; next, all protocol description files (corresponding to the second protocol description file) s= [ S1, S2, … …, sn ] in the protocol library can be loaded through the protocol matcher, wherein S1, S2, … …, sn represent the 1 st, 2 nd, … … th and n th protocol description files respectively, the first transmission frame in the loaded all protocol description files is identified, and a matching data set M (M1, M2, …, mn) is formed by the first transmission frame in the all protocol description files; then, searching a transmission frame most similar to the input first transmission frame in the matched data set M by using a text matching algorithm, and determining a protocol description file where the most similar transmission frame is located; finally, creating the protocol description text of the device D according to the protocol description file of the most similar transmission frame.
Referring to fig. 7, fig. 7 is a flowchart illustrating a method for constructing a protocol description text according to an embodiment of the present application. As shown in fig. 7, the protocol description text construction method provided in this embodiment includes:
s701, determining at least one transmission frame in a first protocol description text, wherein the first protocol description text is the protocol description text of the first device in the construction process.
S702, taking at least one transmission frame as a text characteristic of a first protocol description text, determining a reference protocol description text of the first protocol description text in a second protocol description text, wherein the second protocol description text is a constructed protocol description text of a second device, and the second device and the first device are different devices.
The implementation principles and technical effects of S701 to S702 may refer to the foregoing embodiments, and are not repeated.
S703, extracting protocol elements from the reference protocol description text.
In this embodiment, the protocol element is an element related to a communication protocol and supporting flexible configuration. In the protocol description text, protocol elements related to transmitting frames and/or protocol elements related to signal parsing may be included. Thus, protocol elements related to the transmitted frame and/or protocol elements related to signal parsing may be extracted from the reference protocol description text.
S704, complementing blank elements to be configured in the rest content according to the protocol elements.
In this embodiment, after extracting the protocol element from the reference protocol description text, the protocol element may be added to the blank element to be configured in the remaining content of the first protocol description text, so as to complement the blank element to be configured in the remaining content.
In one possible implementation, at least one transmission frame in the first protocol description text is an nth transmission frame in the first protocol description text, and the blank element includes a blank field. At this time, S703 may include: extracting an allowed configuration field of an mth transmission frame in a reference protocol description text, wherein m is not equal to n; s704 may include: and determining a blank field of an mth transmission frame in the first protocol description text as an allowed configuration field of the mth transmission frame in the reference protocol description text.
In this implementation manner, in the case that at least one transmission frame in the first protocol description text is the nth transmission frame in the first protocol description text, the remaining content in the first protocol description text includes the mth transmission frame, and since the first protocol description text is similar to the reference protocol description text, the mth transmission frame in the first protocol description text is similar to the mth transmission frame in the reference protocol description text, the mth transmission frame in the first protocol description text can be determined with reference to the mth transmission frame in the reference protocol description text. For the construction of the transmission frames, what is configured by the allowed configuration field in the frame structure of the transmission frames is mainly determined, so that the allowed configuration field of the mth transmission frame can be extracted from the reference protocol description text, that is, the protocol element extracted from the reference protocol description text includes the allowed configuration field of the mth transmission frame in the reference protocol description text, and the blank field for determining the mth transmission frame in the first protocol description text is determined as the allowed configuration field of the mth transmission frame in the reference protocol description text.
For example, with reference to the allowed configuration field of the mth transmission frame in the protocol description text having a protocol type field and a protocol address field, the blank field of the mth transmission frame in the first protocol description text may be determined as the protocol type field and the protocol address field, so that the allowed configuration field in the frame structure of the mth transmission frame in the first protocol description text also includes the protocol type field and the protocol address field.
In the case where n is equal to 1, if m is equal to 2, the 2 nd transmission frame in the first protocol description text may be constructed, and if m is equal to 3, the 3 rd transmission frame in the first protocol description text may be constructed, and thus, a plurality of transmission frames in the first protocol description text may be constructed.
In one possible implementation, the protocol elements related to signal parsing include protocol elements related to response frame parsing, S703 may include: extracting protocol elements related to response frame analysis from the reference protocol description file; s704 may include: a protocol element associated with the response frame parsing is added to the first protocol description text. Therefore, the construction of the protocol elements related to the response frame analysis in the first protocol description text is realized, and the construction efficiency of the first protocol description text is improved.
Wherein the protocol element associated with the resolution of the response frame may include a signal point resolution rule of the response frame.
As an example, all the transmission frames extracted from the reference protocol description text can be expressed as:
transmission frame 1:
0x7E,0x32,0x31,0x31,0x34,0x30,0x34,0x31,0x43,0x45,0x30,0x30,0x32,0x46,0x44,0x46,0x43,0x46,0x46,0x0D
transmission frame 2:
0x7E,0x32,0x31,0x31,0x34,0x30,0x34,0x34,0x43,0x45,0x30,0x30,0x32,0x46,0x44,0x46,0x43,0x46,0x43,0x0D
3 rd transmission frame:
0x7E,0x32,0x31,0x31,0x34,0x31,0x34,0x30,0x46,0x45,0x30,0x30,0x32,0x45,0x46,0x46,0x43,0x46,0x42,0x0D
transmission frame 4:
0x7E,0x32,0x31,0x31,0x34,0x31,0x34,0x32,0x46,0x45,0x30,0x30,0x32,0x45,0x46,0x46,0x43,0x46,0x39,0x0D
the 5 th transmission frame:
0x7E,0x32,0x31,0x31,0x34,0x31,0x34,0x33,0x46,0x45,0x30,0x30,0x32,0x45,0x46,0x46,0x43,0x46,0x38,0x0D
transmission frame 6:
0x7E,0x32,0x31,0x31,0x34,0x32,0x34,0x30,0x46,0x45,0x30,0x30,0x32,0x45,0x46,0x46,0x43,0x46,0x41,0x0D
the 7 th transmission frame:
0x7E,0x32,0x31,0x31,0x34,0x32,0x34,0x33,0x46,0x45,0x30,0x30,0x32,0x45,0x46,0x46,0x43,0x46,0x37,0x0D
transmission frame 8:
0x7E,0x32,0x31,0x31,0x34,0x32,0x34,0x35,0x46,0x45,0x30,0x30,0x32,0x45,0x46,0x46,0x43,0x46,0x35,0x0D
the numbers 0x7E, 0x32, etc. indicate protocol elements in the transmission frame, that is, indicate allowed configuration fields.
The signal point analysis rule may be represented as a signal point analysis matrix, where the signal point analysis matrix may include a frame index corresponding to a signal point, a name of the signal point, a data type of the signal point, a number of bytes occupied by the signal point data, a start bit of the signal point data, a number of bits occupied by the signal point data, a calculated value of the signal point data, a unit of the signal point data, and the like.
By way of example, the signal point parsing rules may be as shown in the following table:
Figure BDA0004021268210000121
Figure BDA0004021268210000131
in the above table, the signal point with the frame index of 1 is the signal point in the data response frame corresponding to the 1 st transmission frame, and the signal point with the frame index of 3 is the signal point in the data response frame corresponding to the 3 rd transmission frame.
In the embodiment of the application, at least one transmission frame in the first protocol description text is taken as a text feature, and the reference protocol description text is searched in the second protocol description text, so that the searching efficiency and accuracy of the reference protocol description text are improved; and based on the reference protocol description text, complementing blank elements in the first protocol description text, and especially complementing the rest transmission frames and/or signal analysis rules in the first protocol description text, and constructing to obtain the complete first protocol description text. Therefore, the construction efficiency of the first protocol description text is improved.
The following are embodiments of the apparatus of the present application, which may be used to execute the corresponding method embodiments of the present application. For details not disclosed in the device embodiments of the present application, please refer to the corresponding method embodiments of the present application.
Fig. 8 is a schematic structural diagram of a protocol description text construction device according to an embodiment of the present application. As shown in fig. 8, the protocol description text construction apparatus 800 provided in this embodiment includes:
a transmission frame determining unit 801, configured to determine at least one transmission frame in a first protocol description text, where the first protocol description text is a protocol description text in a building process of the first device;
a reference text determining unit 802, configured to determine, in a second protocol description text, a reference protocol description text of the first protocol description text by using at least one transmission frame as a text feature of the first protocol description text, where the second protocol description text is a constructed protocol description text of a second device, and the second device is a different device from the first device;
a remaining content determining unit 803 for determining, according to the reference protocol description text, remaining content excluding at least one transmission frame in the first protocol description text.
In one possible implementation, the transmission frame determining unit 801 is specifically configured to: and determining an nth transmission frame in the first protocol description text, wherein n is greater than or equal to 1.
In one possible implementation, the reference text determining unit 802 is specifically configured to: determining an nth transmission frame in the second protocol description text; and determining the reference protocol description text in the second protocol description text according to the nth transmission frame in the first protocol description text and the nth transmission frame in the second protocol description text.
In one possible implementation manner, in determining the reference protocol description text according to the nth transmission frame in the first protocol description text and the nth transmission frame in the second protocol description text, the reference text determining unit 802 is specifically configured to: performing text matching on an nth transmission frame in the first protocol description text and an nth transmission frame in the second protocol description text, and determining similar transmission frames of the nth transmission frame in the first protocol description text; and determining the reference protocol description text as the protocol description text to which the similar transmission frame belongs.
In one possible implementation, the remaining content determining unit 803 is specifically configured to: extracting protocol elements from the reference protocol description text; and according to the protocol elements, complementing blank elements to be configured in the rest content.
In a possible implementation manner, at least one transmission frame is an nth transmission frame in the first protocol description text, and in the process of extracting a protocol element from the reference protocol description text, the remaining content determining unit 803 is specifically configured to: extracting an allowed configuration field of an mth transmission frame in the reference protocol description text, wherein m is not equal to n. The blank element includes a blank field, and in the process of complementing the blank element to be configured in the remaining content according to the protocol element, the remaining content determining unit 803 is specifically configured to: and determining a blank field of an mth transmission frame in the first protocol description text as an allowed configuration field of the mth transmission frame in the reference protocol description text.
In one possible implementation, in extracting protocol elements from the reference protocol description text, the remaining content determining unit 803 is specifically configured to: from the reference protocol description file, protocol elements associated with the response frame parsing are extracted. In the process of complementing the blank element to be configured in the remaining content according to the protocol element, the remaining content determining unit 803 specifically is configured to: a protocol element associated with the response frame parsing is added to the first protocol description text.
It should be noted that, the protocol description text construction device provided in the foregoing embodiments may be used to execute each step in the protocol description text construction method provided in any one of the foregoing embodiments, and the specific implementation manner and technical effect are similar, and are not repeated here.
The above embodiments of the apparatus provided in the present application are merely illustrative, where the module division is merely a logic function division, and other division manners may be implemented in practice. For example, multiple modules may be combined or may be integrated into another system. The coupling of the modules to each other may be through interfaces that are typically electrical communication interfaces, but are not exclusive of being mechanical or other forms of interfaces. Thus, the modules illustrated as separate components may or may not be physically separate, may be located in one place, or may be distributed in different locations on the same or different devices.
Fig. 9 is a schematic structural diagram of an electronic device according to an embodiment of the present application. As shown in fig. 9, the electronic device 900 may include: at least one processor 901 and a memory 902. Fig. 9 shows an electronic device using one processor as an example.
A memory 902 for storing programs of the processor 901. In particular, the program may include program code including computer-operating instructions.
The memory 902 may include high-speed RAM memory or may further include non-volatile memory (non-volatile memory), such as at least one disk memory.
The processor 901 is configured to execute a computer program stored in the memory 902 to implement the steps in the protocol description text construction method in the above method embodiments.
The processor 901 may be a central processing unit (central processing unit, abbreviated as CPU), or an application specific integrated circuit (application specific integrated circuit, abbreviated as ASIC), or one or more integrated circuits configured to implement embodiments of the present application.
Alternatively, the memory 902 may be separate or integrated with the processor 901. When the memory 902 is a device separate from the processor 901, the electronic device 900 may further include: bus 903 for connecting processor 901 and memory 902. The bus may be an industry standard architecture (industry standard architecture, abbreviated ISA) bus, an external device interconnect (peripheral component, PCI) bus, or an extended industry standard architecture (extended industry standard architecture, EISA) bus, among others. Buses may be divided into address buses, data buses, control buses, etc., but do not represent only one bus or one type of bus.
Alternatively, in a specific implementation, if the memory 902 and the processor 901 are integrated on a chip, the memory 902 and the processor 901 may complete communication through an internal interface.
The present application also provides a computer-readable storage medium, which may include: various media capable of storing program codes, such as a usb disk, a removable hard disk, a read-only memory (ROM), a random access memory (random access memory, RAM), a magnetic disk, or an optical disk, and in particular, the computer-readable storage medium stores computer-executable instructions, which when executed by at least one processor of an electronic device, the electronic device performs the steps of the protocol description text construction method provided in the various embodiments described above.
Embodiments of the present application also provide a computer program product comprising a computer program stored in a readable storage medium. The computer program may be read from a readable storage medium by at least one processor of an electronic device, and executed by the at least one processor, causes the electronic device to implement the steps of the protocol description text construction method provided by the various embodiments described above.
Other embodiments of the present application will be apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the application following, in general, the principles of the application and including such departures from the present disclosure as come within known or customary practice within the art to which the application pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the application being indicated by the following claims.
It is to be understood that the present application is not limited to the precise arrangements and instrumentalities shown in the drawings, which have been described above, and that various modifications and changes may be effected without departing from the scope thereof. The scope of the application is limited only by the appended claims.

Claims (10)

1. A method for constructing a protocol description text, comprising:
determining at least one transmission frame in a first protocol description text, wherein the first protocol description text is the protocol description text of the first equipment in the construction process;
determining a reference protocol description text of the first protocol description text in a second protocol description text by taking the at least one transmission frame as the text characteristic of the first protocol description text, wherein the second protocol description text is constructed and completed protocol description text of a second device, and the second device and the first device are different devices;
And determining the rest content except the at least one transmission frame in the first protocol description text according to the reference protocol description text.
2. The method for constructing a protocol description text according to claim 1, wherein determining at least one transmission frame in the first protocol description text comprises:
and determining an nth transmission frame in the first protocol description text, wherein n is greater than or equal to 1.
3. The method for constructing a protocol description text according to claim 2, wherein the determining, in a second protocol description text, a reference protocol description text of the first protocol description text using the at least one transmission frame as a text feature of the first protocol description text includes:
determining an nth transmission frame in the second protocol description text;
and determining the reference protocol description text in the second protocol description text according to the nth transmission frame in the first protocol description text and the nth transmission frame in the second protocol description text.
4. A protocol description text constructing method according to claim 3, wherein the determining the reference protocol description text in the second protocol description text according to the nth transmission frame in the first protocol description text and the nth transmission frame in the second protocol description text includes:
Performing text matching on an nth transmission frame in the first protocol description text and an nth transmission frame in the second protocol description text, and determining similar transmission frames of the nth transmission frame in the first protocol description text;
and determining the reference protocol description text as the protocol description text to which the similar transmission frame belongs.
5. The protocol description text construction method according to any one of claims 1 to 4, wherein the determining remaining content in the first protocol description text excluding the at least one transmission frame from the reference protocol description text includes:
extracting protocol elements from the reference protocol description text;
and according to the protocol elements, complementing blank elements to be configured in the residual content.
6. The method according to claim 5, wherein the at least one transmission frame is an nth transmission frame in the first protocol description text, and the extracting a protocol element from the reference protocol description text includes:
extracting an allowed configuration field of an mth transmission frame in the reference protocol description text, wherein m is not equal to n;
The blank element includes a blank field, and the complementing the blank element to be configured in the remaining content according to the protocol element includes:
and determining a blank field of an mth transmission frame in the first protocol description text as an allowable configuration field of the mth transmission frame in the reference protocol description text.
7. The method for constructing a protocol description text according to claim 5, wherein extracting a protocol element from the reference protocol description text comprises:
extracting protocol elements related to response frame analysis from the reference protocol description file;
the complementing the blank element to be configured in the rest content according to the protocol element comprises:
and adding the protocol element related to response frame analysis to the first protocol description text.
8. A protocol description text construction apparatus, comprising:
a transmission frame determining unit, configured to determine at least one transmission frame in a first protocol description text, where the first protocol description text is a protocol description text in a building process of a first device;
a reference text determining unit, configured to determine, in a second protocol description text, a reference protocol description text of the first protocol description text by using the at least one transmission frame as a text feature of the first protocol description text, where the second protocol description text is a constructed protocol description text of a second device, and the second device and the first device are different devices;
And the residual content determining unit is used for determining residual contents except the at least one transmission frame in the first protocol description text according to the reference protocol description text.
9. An electronic device, comprising: at least one processor and memory;
the memory stores computer-executable instructions;
the at least one processor executing computer-executable instructions stored in the memory causes the at least one processor to perform the protocol description text construction method of any one of claims 1 to 7.
10. A computer readable storage medium having stored therein computer executable instructions which, when executed by a processor, implement the protocol description text construction method of any of claims 1 to 7.
CN202211686127.4A 2022-12-27 2022-12-27 Protocol description text construction method, device, equipment and storage medium Pending CN116016692A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211686127.4A CN116016692A (en) 2022-12-27 2022-12-27 Protocol description text construction method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211686127.4A CN116016692A (en) 2022-12-27 2022-12-27 Protocol description text construction method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116016692A true CN116016692A (en) 2023-04-25

Family

ID=86026102

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211686127.4A Pending CN116016692A (en) 2022-12-27 2022-12-27 Protocol description text construction method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116016692A (en)

Similar Documents

Publication Publication Date Title
CN110515951B (en) BOM standardization method and system, electronic device and storage medium
CN111428462A (en) Communication protocol template construction method and terminal equipment
CN109783346B (en) Keyword-driven automatic testing method and device and terminal equipment
CN111064716B (en) Message conversion method, device, storage medium and server
CN113032580B (en) Associated file recommendation method and system and electronic equipment
CN111159329A (en) Sensitive word detection method and device, terminal equipment and computer-readable storage medium
CN116303459A (en) Method and system for processing data table
CN114090671A (en) Data import method and device, electronic equipment and storage medium
CN110688111A (en) Configuration method, device, server and storage medium of business process
CN110795464B (en) Method, device, terminal and storage medium for checking field of object marker data
CN111625567A (en) Data model matching method, device, computer system and readable storage medium
CN106649210A (en) Data conversion method and device
CN113434542B (en) Data relationship identification method and device, electronic equipment and storage medium
CN109324838B (en) Execution method and execution device of single chip microcomputer program and terminal
CN114745452B (en) Equipment management method and device and electronic equipment
CN116016692A (en) Protocol description text construction method, device, equipment and storage medium
CN113703753B (en) Method and device for product development and product development system
CN116168403A (en) Medical data classification model training method, classification method, device and related medium
CN112541357B (en) Entity identification method and device and intelligent equipment
CN114462381A (en) Data processing method, device, equipment and storage medium
CN113590581A (en) Data transmission method, device, equipment and storage medium
CN114840743B (en) Model recommendation method and device, electronic equipment and readable storage medium
CN117473941B (en) Drawing processing method and device, electronic equipment and storage medium
CN117435638A (en) Batch number generation method, system, equipment and medium of multi-service system
CN115390814A (en) Management method, system, device and storage medium for JavaBean check class

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