CN111510159B - Intelligent coding method and coder following general information exchange protocol specification - Google Patents

Intelligent coding method and coder following general information exchange protocol specification Download PDF

Info

Publication number
CN111510159B
CN111510159B CN202010403289.7A CN202010403289A CN111510159B CN 111510159 B CN111510159 B CN 111510159B CN 202010403289 A CN202010403289 A CN 202010403289A CN 111510159 B CN111510159 B CN 111510159B
Authority
CN
China
Prior art keywords
information
information exchange
exchange protocol
protocol
coded
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.)
Active
Application number
CN202010403289.7A
Other languages
Chinese (zh)
Other versions
CN111510159A (en
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.)
Institute of Automation of Chinese Academy of Science
Original Assignee
Institute of Automation of Chinese Academy of Science
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 Institute of Automation of Chinese Academy of Science filed Critical Institute of Automation of Chinese Academy of Science
Priority to CN202010403289.7A priority Critical patent/CN111510159B/en
Publication of CN111510159A publication Critical patent/CN111510159A/en
Application granted granted Critical
Publication of CN111510159B publication Critical patent/CN111510159B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H03ELECTRONIC CIRCUITRY
    • H03MCODING; DECODING; CODE CONVERSION IN GENERAL
    • H03M13/00Coding, decoding or code conversion, for error detection or error correction; Coding theory basic assumptions; Coding bounds; Error probability evaluation methods; Channel models; Simulation or testing of codes
    • H03M13/61Aspects and characteristics of methods and arrangements for error correction or error detection, not provided for otherwise
    • H03M13/615Use of computational or mathematical techniques

Landscapes

  • Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Algebra (AREA)
  • Computational Mathematics (AREA)
  • Computing Systems (AREA)
  • General Physics & Mathematics (AREA)
  • Mathematical Analysis (AREA)
  • Mathematical Optimization (AREA)
  • Mathematical Physics (AREA)
  • Pure & Applied Mathematics (AREA)
  • Probability & Statistics with Applications (AREA)
  • Theoretical Computer Science (AREA)
  • Communication Control (AREA)

Abstract

The invention belongs to the field of information transmission and exchange, in particular relates to an intelligent encoder following the specification of a general information exchange protocol, and aims to solve the problem that different information exchange protocols and information encoders need to be constructed for different applications. The invention comprises the following steps: presetting a general information exchange protocol standard; an information exchange protocol is established according to the standard, and error prompt information is sent out to modify the protocol when the protocol does not meet the standard; inputting an information example to be coded which accords with an information exchange protocol, and reporting an error when the example does not meet the protocol; and coding the information example to be coded into a binary information example through an intelligent coding algorithm. The invention codes the information instance into binary system, improves the information transmission efficiency, and the user can compile various information exchange protocols meeting different requirements according to the specification, can intelligently identify different information exchange protocols without redesigning or adjusting the encoder, adopts the same encoder for coding, and saves a large amount of time.

Description

Intelligent coding method and coder following general information exchange protocol specification
Technical Field
The invention belongs to the field of information transmission and exchange, and particularly relates to an intelligent encoding method and an encoder following the general information exchange protocol specification.
Background
In the field of information transmission and exchange, before information exchange, an information exchange protocol needs to be established by two information receiving and transmitting parties (a consumer and a producer), the information is encoded by the information transmitting party (the producer) according to the protocol, then the information is transmitted to the information receiving party (the consumer) through an appointed channel, and the information is decoded according to the protocol after the information is acquired by the receiving party. The two parties of the receiving and the transmitting follow the exchange protocol, and the receiving party can be ensured to correctly analyze the information of the transmitting party.
Because the application range of the information transmission and exchange field is very wide and the information structures of the applications are different, each application needs to establish a specific information exchange protocol, thereby generating a huge number of information exchange protocols with different types. For each information exchange protocol, both the information transceiver and the decoder need to design and implement the encoder separately to encode the information to be exchanged, and also need to design and implement the decoder separately to decode the information to be exchanged, which also results in a huge number of encoders and decoders with different types. On the one hand, there is a lot of repetitive work in the design and implementation of various types of encoders and decoders; on the other hand, designing and implementing different types of encoders and decoders manually is error prone and difficult to debug.
Generally speaking, there is a urgent need in the art for an intelligent encoding method and encoder that comply with the general information exchange protocol specification, and only one encoder is needed to meet the information encoding requirements of various structure types and different information exchange protocols in specific applications, thereby greatly reducing a large amount of repetitive work in the design and implementation of each type of encoder, reducing the debugging difficulty of the encoder, and improving the reliability of the encoder.
Disclosure of Invention
In order to solve the above-mentioned problem in the prior art, that is, the problem that different applications need to construct different information exchange protocols and information encoders, the present invention provides an intelligent encoding method following the specification of a general information exchange protocol, wherein the intelligent encoding method comprises:
step B10, acquiring a preset general information exchange protocol specification, an information exchange protocol established by a user and an information example to be coded;
step B20, based on the general information exchange protocol standard, judging whether the information exchange protocol made by the user accords with the standard, if so, jumping to step B40; otherwise, sending out protocol error prompt information;
step B30, based on the protocol error prompt information, modifying the information exchange protocol made by the user, and jumping to step B20;
step B40, judging whether the information example to be coded accords with the information exchange protocol set by the user, if so, jumping to step B60; otherwise, sending out an instance error prompt message;
step B50, based on the example error prompt information, modifying the information example to be coded, and jumping to step B40;
and step B60, coding the example to be coded by a preset intelligent coding method to obtain a binary information example with successful coding.
In some preferred embodiments, the root element of the preset general information exchange protocol specification includes one or more of a sequence element, a loop element and a condition element.
In some preferred embodiments, the user-defined information exchange protocol is defined based on the preset general information exchange protocol specification.
In some preferred embodiments, the preset intelligent encoding method is as follows:
step S10, acquiring the user-defined information exchange protocol and the information example to be coded which accord with the preset general information exchange protocol standard, and initializing the initial byte and bit position of the byte array binary _ data to be output;
step S20, analyzing the information exchange protocol made by the user and the root element r1 and the root element r2 of the information example to be coded respectively, checking the consistency of r1 and r2, and if the consistency is consistent, jumping to step S30; otherwise, sending out error prompt information;
step S30, for each sub-element e1 in the root element r1, obtaining the sub-element e2 matched in the root element r2, and determining and executing:
if e1 is a sequential element, coding the information instance to be coded by a sequential algorithm based on e1, e2 and binary _ data to obtain a binary information instance which is successfully coded;
if e1 is a cyclic element, coding the information instance to be coded by a cyclic algorithm based on e1, e2 and binary _ data to obtain a binary information instance which is successfully coded;
and if e1 is a condition element, coding the information instance to be coded by a condition algorithm based on e1, e2 and binary _ data to obtain a binary information instance which is successfully coded.
In some preferred embodiments, "the coding of the information instance to be coded is performed by a sequential algorithm based on e1, e2, and binary _ data" by:
step S311, obtaining the bit length to be currently encoded and the data type T from the protocol element e1 of the information exchange protocol formulated by the user, and obtaining an instance element e2 corresponding to e 1;
step S312, if T is int, acquiring an element value from e2, and converting the element value into int type data i; if T is float, acquiring element values from e2, and converting the element values into float type data f; if T is string, acquiring element values from e2, and converting the element values into string type data s;
step 313, according to the bit length to be coded currently, adding the converted i/f/S to the back of the binary _ data in sequence from low to high according to the bit position.
In some preferred embodiments, "the coding of the information instance to be coded is performed by a round-robin algorithm based on e1, e2 and binary _ data" by:
step S321, acquiring a cycle name and a cycle number element name loop _ number _ name from a protocol element e1 of the information exchange protocol formulated by the user, and acquiring a parent element e2 of an instance element corresponding to e 1;
step S322, if the loop _ number _ name is an integer, calculating and acquiring the loop _ number of the cycle times; otherwise, counting the number of elements with element names consistent with the loop names in e2 as loop times loop _ number;
step S323, acquiring a cycle number element e from a protocol element e1, extracting the coded bit length of loop _ number from e, and adding the loop _ number to the back of the binary _ data according to the sequence of the bit positions from low to high;
step S324, for each sub-element pce of e1 except the loop name and the loop number name, acquiring the sub-element xcce of e2 corresponding to the sub-element pce, and if the xcce is a sequential element, encoding the xcce through a sequential algorithm; if the xcce is a cyclic element, coding through a cyclic algorithm; and if the xcce is a condition element, encoding by a condition algorithm.
In some preferred embodiments, "the coding of the information instance to be coded is performed by a conditional algorithm based on e1, e2 and binary _ data" by:
step S331, obtaining a parent element e2 of an instance element corresponding to e1 from attribute values in a protocol element e1 of the information exchange protocol formulated by the user;
step S332, judging whether the information of e2 conforms to the description of the expression, and if not, returning; otherwise, acquiring the name attribute indication element condition _ element of e1 from e 2;
step S333, for each sub-element pce of e1, acquiring an instance element xce indicated by the name attribute of the pce element from the condition _ element;
step S334, if pce is a sequential element, xce encoding is performed through a sequential algorithm; if pce is a loop element, xce encoding is carried out through a loop algorithm; if pce is a condition element, xce encoding is performed by a conditional algorithm.
On the other hand, the invention provides an intelligent encoder following the general information exchange protocol specification, which comprises a protocol specification import module, a user protocol input interface, a protocol check module, a user information instance input interface, an information instance check module and an intelligent encoding module;
the protocol specification importing module is used for importing a preset general information exchange protocol specification;
the user protocol input interface is used for importing an information exchange protocol formulated by a user and modifying the information exchange protocol according to the error prompt information of the protocol checking module;
the protocol checking module judges whether the information exchange protocol/the modified information exchange protocol formulated by the user accords with the standard or not based on the general information exchange protocol standard, and if not, sends error prompt information to the user protocol input interface; otherwise, sending instance acquisition information to the user information instance input interface;
the user information instance input interface is used for importing an information instance to be coded after receiving instance acquisition information;
the information example checking module judges whether the information example to be coded conforms to the protocol or not based on the information exchange protocol established by the user/the modified information exchange protocol, and if not, error reporting information is sent out; otherwise, sending the information example to be coded to the intelligent coding module;
and the intelligent coding module is used for coding the information example to be coded based on a preset intelligent coding method and outputting a binary information example with successful coding.
In a third aspect of the present invention, a storage device is provided, in which a plurality of programs are stored, the programs being adapted to be loaded and executed by a processor to implement the above-mentioned intelligent encoding method complying with the specification of the universal information exchange protocol.
In a fourth aspect of the present invention, a processing apparatus is provided, which includes a processor, a storage device; the processor is suitable for executing various programs; the storage device is suitable for storing a plurality of programs; the program is adapted to be loaded and executed by a processor to implement the intelligent coding method described above in compliance with the general information exchange protocol specification.
The invention has the beneficial effects that:
the invention relates to an intelligent coding method and a coder following the general information exchange protocol specification, which code text-based information examples provided by a user and conforming to the user-defined protocol into binary information examples according to the user-defined protocol under the condition of following the general information exchange protocol specification. Therefore, a user does not need to design, realize and debug own specific encoders aiming at each information exchange protocol, and the development and debugging workload of the user is greatly reduced.
Drawings
Other features, objects and advantages of the present application will become more apparent upon reading of the following detailed description of non-limiting embodiments thereof, made with reference to the accompanying drawings in which:
FIG. 1 is a schematic flow chart of the intelligent encoding method of the present invention following the general information exchange protocol specification.
Detailed Description
The present application will be described in further detail with reference to the following drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the relevant invention and not restrictive of the invention. It should be noted that, for convenience of description, only the portions related to the related invention are shown in the drawings.
It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict. The present application will be described in detail below with reference to the embodiments with reference to the attached drawings.
The invention provides an intelligent coding method following general information exchange protocol specification, firstly, checking the input information exchange protocol made by the user according to the preset general information exchange protocol specification: if the information exchange protocol does not conform to the standard, an error is reported, and a user needs to modify the information exchange protocol to conform to the standard; and if the information exchange protocol conforms to the specification, the user inputs the text-based information example to be coded according to the information exchange protocol. Then, checking whether the information example to be coded conforms to the information exchange protocol: if the protocol is not in accordance with the information exchange protocol, an error is reported; and if the code accords with the protocol, executing coding according to a preset intelligent coding method to obtain a binary information example with successful coding. .
The invention relates to an intelligent coding method following general information exchange protocol specification, which comprises the following steps:
step B10, acquiring a preset general information exchange protocol specification, an information exchange protocol established by a user and an information example to be coded;
step B20, based on the general information exchange protocol standard, judging whether the information exchange protocol made by the user accords with the standard, if so, jumping to step B40; otherwise, sending out protocol error prompt information;
step B30, based on the protocol error prompt information, modifying the information exchange protocol made by the user, and jumping to step B20;
step B40, judging whether the information example to be coded accords with the information exchange protocol set by the user, if so, jumping to step B60; otherwise, sending out an instance error prompt message;
step B50, based on the example error prompt information, modifying the information example to be coded, and jumping to step B40;
and step B60, coding the example to be coded by a preset intelligent coding method to obtain a binary information example with successful coding.
In order to more clearly explain the intelligent encoding method in compliance with the specification of the universal information exchange protocol, the following describes the steps in the embodiment of the present invention in detail with reference to fig. 1.
The intelligent coding method following the general information exchange protocol specification of the embodiment of the invention comprises a step B10-a step B60, and the steps are described in detail as follows:
and step B10, acquiring a preset general information exchange protocol specification, an information exchange protocol established by a user and an information example to be coded.
The root element of the preset general information exchange protocol specification comprises one or more of a sequence element, a cycle element and a condition element.
The root element protocol of the information exchange protocol specification, the root element must contain at least one of a sequence element, a loop element, or a condition element condition, may contain a plurality of elements, and each element may appear in any order a plurality of times.
In an embodiment of the present invention, the preset general information exchange protocol specification is:
Figure BDA0002490310930000081
the information exchange protocol established by the user is approved by both the transmitting and receiving parties, and provides a file for subsequent information exchange. The protocol is a protocol established according to the above general information exchange protocol specification: in order to describe a protocol for sharing target position information, including information such as target name, longitude and latitude, sequence elements and condition elements are also used in the protocol.
In one embodiment of the present invention, the information exchange protocol established by the user is:
Figure BDA0002490310930000091
step B20, based on the general information exchange protocol standard, judging whether the information exchange protocol made by the user accords with the standard, if so, jumping to step B40; otherwise, sending out protocol error prompt information.
And B30, modifying the information exchange protocol established by the user based on the protocol error prompt information, and jumping to the step B20.
If the information exchange protocol established by the user meets the general information exchange protocol specification, the next step is carried out; if not, sending out error prompt information, and the user needs to make corresponding modification to the information exchange protocol.
The system can only do normal encoding work if the information exchange protocol meets this specification.
Step B40, judging whether the information example to be coded accords with the information exchange protocol set by the user, if so, jumping to step B60; otherwise, sending out an example error prompt message.
Step B50, based on the example error prompt information, modifying the information example to be coded, and jumping to step B40.
The example of the information to be coded is the information that the user wants to send, it needs to satisfy the information exchange protocol that both sides of receiving and sending make, in an embodiment of the invention, the example of the information to be coded is:
Figure BDA0002490310930000101
the information example to be coded is an information example for describing a target, the described information comprises the name, longitude and latitude and the like of the target, the information example conforms to the information exchange protocol established in the foregoing, and the readability is high.
And step B60, coding the example to be coded by a preset intelligent coding method to obtain a binary information example with successful coding.
The preset intelligent coding method takes an information exchange protocol which is made by a user and accords with a preset general information exchange protocol specification and an information example instance to be coded which accords with the information exchange protocol which is made by the user as input, takes a binary information example file which is matched with the protocol and the instance and a byte array binary thereof as output, and has the coding process as follows:
step S10, acquiring a user-defined protocol and an instance of information to be encoded, which conform to a preset general information exchange protocol specification, and initializing a start byte and a bit position of a byte array binary _ data to be output.
The protocol and the instance are read in, and the starting byte and the bit position of the binary are initialized.
Step S20, analyzing the information exchange protocol made by the user and the root element r1 and the root element r2 of the information example to be coded respectively, checking the consistency of r1 and r2, and if the consistency is consistent, jumping to step S30; otherwise, sending out error prompt information.
Root element r1 of protocol and root element r2 of instance are analyzed, and consistency of root element r1 and root element r2 is checked.
Step S30, for each sub-element e1 in the root element r1, obtaining the sub-element e2 matched in the root element r2, and determining and executing:
if e1 is a sequential element, encoding the information instance to be encoded by a sequential algorithm SEQUENCE _ Encode (e1, e2, binary) based on e1, e2 and binary _ data, and obtaining a successfully encoded binary information instance.
If e1 is a cyclic element, encoding the information instance to be encoded by a cyclic algorithm LOOP _ Encode (e1, r2, binary) based on e1, e2 and binary _ data, and obtaining a successfully encoded binary information instance.
If e1 is a CONDITION element, encoding the information instance to be encoded by a CONDITION algorithm CONDITION _ Encode (e1, r2, binary) based on e1, e2 and binary _ data, and obtaining a successfully encoded binary information instance.
Agreement with an instance means that the root elements of both have the same name, and in general, the root elements are used to distinguish between different protocols, and the root element of any instance that conforms to a protocol must have the same name as the protocol root element.
In one embodiment of the present invention, when initializing the byte array, it is assumed that the number of encoded bytes does not exceed the maximum value that can be expressed by a 32-bit integer.
The SEQUENCE _ Encode takes a protocol element pe (i.e. e1), an instance element xe (i.e. e2) corresponding to the protocol element pe, and binary data binary _ data to be output as inputs, and takes encoded binary as an output, and the encoding process is as follows:
step S311, obtaining the bit length to be encoded and the data type T from the protocol element pe of the information exchange protocol formulated by the user, and obtaining an instance element xe corresponding to pe.
Step S312, if T is int, acquiring an element value from xe, and converting the element value into int type data i; if T is float, acquiring an element value from xe, and converting the element value into float type data f; if T is string, acquiring element values from xe, and converting the element values into string type data s;
step 313, according to the bit length to be coded currently, adding the converted i/f/S to the back of the binary _ data in sequence from low to high according to the bit position.
In the coding process, if the bit length is a direct quantity, the coding method is obtained; if the bit length is an indirect quantity, it is obtained by calculating the associated element value of the pe element.
The LOOP _ Encode algorithm takes a protocol element pe (i.e. e1), a parent element xe (i.e. e2) of an instance element corresponding to the protocol element pe, and binary data binary _ data to be output as inputs, and takes encoded binary as an output, and the encoding process is as follows:
step S321, acquiring a cycle name and a cycle number element name loop _ number _ name from a protocol element pe of the information exchange protocol formulated by the user, and acquiring a parent element xe of an instance element corresponding to pe;
step S322, if the loop _ number _ name is an integer, calculating and acquiring the loop _ number of the cycle times; otherwise, counting the number of elements with element names consistent with the cycle names in the xe as a cycle number loop _ number;
step S323, acquiring a cycle time element e from a protocol element pe, extracting the length of a coding bit from e, and sequentially adding the loop _ number to the back of the binary _ data according to the bit from low to high;
step S324, for each sub-element pce of pe except the cycle name and the cycle number element name loop _ number _ name, acquiring the sub-element xcce of xe corresponding to pe, and if the xcce is a SEQUENCE element, encoding by a SEQUENCE algorithm SEQUENCE _ Encode (pce, xcce, binary); if xcce is a LOOP element, encoding by LOOP _ Encode (pce, xce, binary); if xcce is a conditional element, it is encoded by a conditional algorithm CONDITION _ Encode (pce, xce, binary).
The conditional algorithm CONDITION _ Encode takes a protocol element pe (i.e., e1), a parent element xe (i.e., e2) of an instance element corresponding to the protocol element pe, and binary data binary _ data to be output as inputs, and takes the encoded binary as an output, and the encoding process is as follows:
step S331, obtaining an attribute value in a protocol element pe of the information exchange protocol formulated by the user, and obtaining a parent element xe of an instance element corresponding to pe;
step S332, calling an algorithm EXPRESSION _ EVal (xe, EXPRESSION) to judge whether the information of e2 conforms to the description of the EXPRESSION, and if not, returning; otherwise, acquiring the name attribute indication element condition _ element of pe from xe;
step S333, for each sub-element pce of pe, obtaining an instance element xce indicated by the name attribute of the pce element from condition _ element;
step S334, if pce is a SEQUENCE element, encoding xce by a SEQUENCE algorithm SEQUENCE _ Encode (pce, xce, binary); if pce is a LOOP element, xce encoding is performed by LOOP _ Encode (pce, xce, binary); if pce is a CONDITION element, xce encoding is performed by a conditional algorithm CONDITION _ Encode (pce, xce, binary).
The intelligent encoder according to the second embodiment of the invention comprises a protocol specification import module, a user protocol input interface, a protocol check module, a user information instance input interface, an information instance check module and an intelligent encoding module;
the protocol specification importing module is used for importing a preset general information exchange protocol specification;
the user protocol input interface is used for importing an information exchange protocol formulated by a user and modifying the information exchange protocol according to the error prompt information of the protocol checking module;
the protocol checking module judges whether the information exchange protocol/the modified information exchange protocol formulated by the user accords with the standard or not based on the general information exchange protocol standard, and if not, sends error prompt information to the user protocol input interface; otherwise, sending instance acquisition information to the user information instance input interface;
the user information instance input interface is used for importing an information instance to be coded after receiving instance acquisition information;
the information example checking module judges whether the information example to be coded conforms to the protocol or not based on the information exchange protocol established by the user/the modified information exchange protocol, and if not, error reporting information is sent out; otherwise, sending the information example to be coded to the intelligent coding module;
and the intelligent coding module is used for coding the information example to be coded based on a preset intelligent coding method and outputting a binary information example with successful coding.
The preset general information exchange protocol specification is imported to assist and restrict a user to establish a corresponding information exchange protocol, and the preset general information exchange protocol specification specifies the organization structure of information in an information instance, the contained elements, limits of some lengths or types of related elements and the like.
The user inputs a protocol for information exchange into the interface, which provides the basis for information example.
The system checks the information exchange protocol formulated by the user according to the imported preset general information exchange protocol specification, namely the system checks whether the information exchange protocol formulated by the user meets a text organization structure defined by the specification and whether sub-elements of the information exchange protocol meet certain limits defined by the specification according to the preset general information exchange protocol specification. If the condition is met, the system can carry out the next work, otherwise, the system can report an error and give error prompt information, a user can modify the information exchange protocol according to the error prompt information, and then the modified information exchange protocol is imported again through the information exchange protocol input interface.
The user inputs the text-based information example, namely the information example to be coded according to the information exchange protocol, which means that the system provides an interface for inputting the information example for the user, and the user inputs the information example which meets the information exchange protocol and needs to be transmitted into the system.
The system checks whether the information example meets the protocol, namely the system checks the information example to be coded input by the user according to the information exchange protocol established by the user and checks whether the information example meets the information exchange protocol. The system can only perform the next encoding operation if the information exchange protocol is satisfied, otherwise the system will report an error.
The system executes coding according to the intelligent coding method, namely when the information exchange protocol meets the protocol specification and the information example meets the information exchange protocol, the system codes the information example to be coded according to the intelligent coding method, codes the information example into a binary form, compresses the data transmission quantity and improves the transmission efficiency.
Aiming at the problems of various encoders and low efficiency in the traditional information transmission and exchange, the invention designs and realizes an intelligent encoder, which comprises a general information exchange protocol specification, according to which a user can compile an information exchange protocol and a text-based information example; the intelligent encoder can then encode the information instance into a binary-based information instance, improving information transmission efficiency. Moreover, a user can compile various information exchange protocols meeting different requirements according to the general information exchange protocol specification provided by the invention, but the intelligent encoder can intelligently identify the different information exchange protocols without redesigning or adjusting the encoder, and the same encoder is adopted for encoding, thereby saving a large amount of encoder development time.
It should be noted that, the intelligent encoder complying with the specification of the general information exchange protocol provided in the foregoing embodiment is only illustrated by the division of the functional modules, and in practical applications, the functions may be allocated to different functional modules according to needs, that is, the modules in the embodiment of the present invention are further decomposed or combined, for example, the modules in the foregoing embodiment may be combined into one module, or may be further split into multiple sub-modules, so as to complete all or part of the functions described above. The names of the modules involved in the embodiments of the present invention are only for distinguishing the modules, and are not to be construed as unduly limiting the present invention.
A storage device according to a third embodiment of the present invention stores a plurality of programs, which are adapted to be loaded and executed by a processor to implement the above-described intelligent encoding method complying with the specification of the universal information exchange protocol.
A processing apparatus according to a fourth embodiment of the present invention includes a processor, a storage device; a processor adapted to execute various programs; a storage device adapted to store a plurality of programs; the program is adapted to be loaded and executed by a processor to implement the intelligent coding method described above in compliance with the general information exchange protocol specification.
It can be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working processes and related descriptions of the storage device and the processing device described above may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
Those of skill in the art would appreciate that the various illustrative modules, method steps, and modules described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that programs corresponding to the software modules, method steps may be located in Random Access Memory (RAM), memory, Read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art. To clearly illustrate this interchangeability of electronic hardware and software, various illustrative components and steps have been described above generally in terms of their functionality. Whether such functionality is implemented as electronic hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
The terms "first," "second," and the like are used for distinguishing between similar elements and not necessarily for describing or implying a particular order or sequence.
The terms "comprises," "comprising," or any other similar term are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus.
So far, the technical solutions of the present invention have been described in connection with the preferred embodiments shown in the drawings, but it is easily understood by those skilled in the art that the scope of the present invention is obviously not limited to these specific embodiments. Equivalent changes or substitutions of related technical features can be made by those skilled in the art without departing from the principle of the invention, and the technical scheme after the changes or substitutions can fall into the protection scope of the invention.

Claims (7)

1. An intelligent encoding method compliant with the specification of a general information exchange protocol, the intelligent encoding method comprising:
step B10, acquiring a preset general information exchange protocol specification, an information exchange protocol established by a user and an information example to be coded; the root element of the preset general information exchange protocol specification comprises one or more of a sequence element, a cycle element and a condition element, and each element can appear at any position once or more times; the information exchange protocol established by the user is established based on the preset general information exchange protocol specification;
step B20, based on the general information exchange protocol standard, judging whether the information exchange protocol made by the user accords with the standard, if so, jumping to step B40; otherwise, sending out protocol error prompt information;
step B30, based on the protocol error prompt information, modifying the information exchange protocol made by the user, and jumping to step B20;
step B40, judging whether the information example to be coded accords with the information exchange protocol set by the user, if so, jumping to step B60; otherwise, sending out an instance error prompt message;
step B50, based on the example error prompt information, modifying the information example to be coded, and jumping to step B40;
step B60, encoding the example to be encoded by a preset intelligent encoding method to obtain a binary information example with successful encoding;
the preset intelligent coding method comprises the following steps:
step S10, acquiring the user-defined information exchange protocol and the information example to be coded which accord with the preset general information exchange protocol standard, and initializing the initial byte and bit position of the byte array binary _ data to be output;
step S20, analyzing the information exchange protocol made by the user and the root element r1 and the root element r2 of the information example to be coded respectively, checking the consistency of r1 and r2, and if the consistency is consistent, jumping to step S30; otherwise, sending out error prompt information;
step S30, for each sub-element e1 in the root element r1, obtaining the sub-element e2 matched in the root element r2, and determining and executing:
if e1 is a sequential element, coding the information instance to be coded by a sequential algorithm based on e1, e2 and binary _ data to obtain a binary information instance which is successfully coded;
if e1 is a cyclic element, coding the information instance to be coded by a cyclic algorithm based on e1, e2 and binary _ data to obtain a binary information instance which is successfully coded;
and if e1 is a condition element, coding the information instance to be coded by a condition algorithm based on e1, e2 and binary _ data to obtain a binary information instance which is successfully coded.
2. The intelligent coding method according to claim 1, wherein the coding of the information instance to be coded is performed by a sequential algorithm based on e1, e2 and binary data, and the method comprises:
step S311, obtaining the bit length to be currently encoded and the data type T from the protocol element e1 of the information exchange protocol formulated by the user, and obtaining an instance element e2 corresponding to e 1;
step S312, if T is int, acquiring an element value from e2, and converting the element value into int type data i; if T is float, acquiring element values from e2, and converting the element values into float type data f; if T is string, acquiring element values from e2, and converting the element values into string type data s;
step 313, according to the bit length to be coded currently, adding the converted i/f/S to the back of the binary _ data in sequence from low to high according to the bit position.
3. The intelligent coding method according to claim 2, wherein the coding of the information instance to be coded is performed by a round-robin algorithm based on e1, e2 and binary data, and the method comprises:
step S321, acquiring a cycle name and a cycle number element name loop _ number _ name from a protocol element e1 of the information exchange protocol formulated by the user, and acquiring a parent element e2 of an instance element corresponding to e 1;
step S322, if the loop _ number _ name is an integer, calculating and acquiring the loop _ number of the cycle times; otherwise, counting the number of elements with element names consistent with the loop names in e2 as loop times loop _ number;
step S323, acquiring a cycle number element e from a protocol element e1, extracting the coded bit length of loop _ number from e, and adding the loop _ number to the back of the binary _ data according to the sequence of the bit positions from low to high;
step S324, for each sub-element pce of e1 except the loop name and the loop number name, acquiring the sub-element xcce of e2 corresponding to the sub-element pce, and if the xcce is a sequential element, encoding the xcce through a sequential algorithm; if the xcce is a cyclic element, coding through a cyclic algorithm; and if the xcce is a condition element, encoding by a condition algorithm.
4. The intelligent coding method according to claim 3, wherein the coding of the information instance to be coded is performed by a conditional algorithm based on e1, e2 and binary data, and the method comprises:
step S331, obtaining a parent element e2 of an instance element corresponding to e1 from attribute values in a protocol element e1 of the information exchange protocol formulated by the user;
step S332, judging whether the information of e2 conforms to the description of the expression, and if not, returning; otherwise, acquiring the name attribute indication element condition _ element of e1 from e 2;
step S333, for each sub-element pce of e1, acquiring an instance element xce indicated by the name attribute of the pce element from the condition _ element;
step 334, if pce is a sequential element, xce encoding is performed through a sequential algorithm; if pce is a loop element, xce encoding is carried out through a loop algorithm; if pce is a condition element, xce encoding is performed by a conditional algorithm.
5. An intelligent encoder following general information exchange protocol specification is characterized by comprising a protocol specification import module, a user protocol input interface, a protocol check module, a user information example input interface, an information example check module and an intelligent encoding module;
the protocol specification importing module is used for importing a preset general information exchange protocol specification; the root element of the preset general information exchange protocol specification comprises one or more of a sequence element, a cycle element and a condition element, and each element can appear at any position once or more times;
the user protocol input interface is used for importing an information exchange protocol formulated by a user and modifying the information exchange protocol according to the error prompt information of the protocol checking module; the information exchange protocol established by the user is established based on the preset general information exchange protocol specification;
the protocol checking module judges whether the information exchange protocol/the modified information exchange protocol formulated by the user accords with the standard or not based on the general information exchange protocol standard, and if not, sends error prompt information to the user protocol input interface; otherwise, sending instance acquisition information to the user information instance input interface;
the user information instance input interface is used for importing an information instance to be coded after receiving instance acquisition information;
the information example checking module judges whether the information example to be coded conforms to the protocol or not based on the information exchange protocol established by the user/the modified information exchange protocol, and if not, error reporting information is sent out; otherwise, sending the information example to be coded to the intelligent coding module;
the intelligent coding module is used for coding the information example to be coded based on a preset intelligent coding method and outputting a binary information example with successful coding;
the preset intelligent coding method comprises the following steps:
step S10, acquiring the user-defined information exchange protocol and the information example to be coded which accord with the preset general information exchange protocol standard, and initializing the initial byte and bit position of the byte array binary _ data to be output;
step S20, analyzing the information exchange protocol made by the user and the root element r1 and the root element r2 of the information example to be coded respectively, checking the consistency of r1 and r2, and if the consistency is consistent, jumping to step S30; otherwise, sending out error prompt information;
step S30, for each sub-element e1 in the root element r1, obtaining the sub-element e2 matched in the root element r2, and determining and executing:
if e1 is a sequential element, coding the information instance to be coded by a sequential algorithm based on e1, e2 and binary _ data to obtain a binary information instance which is successfully coded;
if e1 is a cyclic element, coding the information instance to be coded by a cyclic algorithm based on e1, e2 and binary _ data to obtain a binary information instance which is successfully coded;
and if e1 is a condition element, coding the information instance to be coded by a condition algorithm based on e1, e2 and binary _ data to obtain a binary information instance which is successfully coded.
6. A storage device having stored therein a plurality of programs, characterized in that said programs are adapted to be loaded and executed by a processor to implement the intelligent coding method in accordance with the specification of the general information exchange protocol according to any one of claims 1 to 4.
7. A treatment apparatus comprises
A processor adapted to execute various programs; and
a storage device adapted to store a plurality of programs;
wherein the program is adapted to be loaded and executed by a processor to perform:
an intelligent encoding method according to any one of claims 1 to 4, following the general information exchange protocol specification.
CN202010403289.7A 2020-05-13 2020-05-13 Intelligent coding method and coder following general information exchange protocol specification Active CN111510159B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010403289.7A CN111510159B (en) 2020-05-13 2020-05-13 Intelligent coding method and coder following general information exchange protocol specification

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010403289.7A CN111510159B (en) 2020-05-13 2020-05-13 Intelligent coding method and coder following general information exchange protocol specification

Publications (2)

Publication Number Publication Date
CN111510159A CN111510159A (en) 2020-08-07
CN111510159B true CN111510159B (en) 2022-03-08

Family

ID=71871894

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010403289.7A Active CN111510159B (en) 2020-05-13 2020-05-13 Intelligent coding method and coder following general information exchange protocol specification

Country Status (1)

Country Link
CN (1) CN111510159B (en)

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2003014917A1 (en) * 2001-08-09 2003-02-20 Primelayer Software Inc. A universal driver apparatus and method
CN101820418A (en) * 2010-03-19 2010-09-01 上海博康智能网络科技有限公司 Universal security equipment control method for extensible protocol and system
CN102325129A (en) * 2011-07-14 2012-01-18 广州致远电子有限公司 Self-defined protocol decoding technique for measurement and analysis instrument
CN103001971A (en) * 2012-12-25 2013-03-27 成都科来软件有限公司 Method for analyzing network data package
CN105049256A (en) * 2015-08-10 2015-11-11 北京思特奇信息技术股份有限公司 Method and system for realizing universal custom interface message
CN105812368A (en) * 2016-03-15 2016-07-27 山东超越数控电子有限公司 Universal programming method for multiple communication protocols
CN107547574A (en) * 2017-10-31 2018-01-05 哈尔滨工业大学 A kind of communication system and method based on puppy parc
CN108076017A (en) * 2016-11-16 2018-05-25 腾讯科技(深圳)有限公司 The protocol analysis method and device of a kind of data packet
CN109150676A (en) * 2018-09-14 2019-01-04 杭州若奇技术有限公司 Application coding, coding/decoding method and the device and application system of smart machine
CN110708307A (en) * 2019-09-29 2020-01-17 北京明略软件系统有限公司 Transcoder generation method and apparatus, electronic device, and storage medium

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6996833B1 (en) * 2001-03-27 2006-02-07 Microsoft Corporation Protocol agnostic request response pattern
US9515775B2 (en) * 2012-11-08 2016-12-06 Instart Logic, Inc. Method and apparatus for improving the performance of TCP and other network protocols in a communication network

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2003014917A1 (en) * 2001-08-09 2003-02-20 Primelayer Software Inc. A universal driver apparatus and method
CN101820418A (en) * 2010-03-19 2010-09-01 上海博康智能网络科技有限公司 Universal security equipment control method for extensible protocol and system
CN102325129A (en) * 2011-07-14 2012-01-18 广州致远电子有限公司 Self-defined protocol decoding technique for measurement and analysis instrument
CN103001971A (en) * 2012-12-25 2013-03-27 成都科来软件有限公司 Method for analyzing network data package
CN105049256A (en) * 2015-08-10 2015-11-11 北京思特奇信息技术股份有限公司 Method and system for realizing universal custom interface message
CN105812368A (en) * 2016-03-15 2016-07-27 山东超越数控电子有限公司 Universal programming method for multiple communication protocols
CN108076017A (en) * 2016-11-16 2018-05-25 腾讯科技(深圳)有限公司 The protocol analysis method and device of a kind of data packet
CN107547574A (en) * 2017-10-31 2018-01-05 哈尔滨工业大学 A kind of communication system and method based on puppy parc
CN109150676A (en) * 2018-09-14 2019-01-04 杭州若奇技术有限公司 Application coding, coding/decoding method and the device and application system of smart machine
CN110708307A (en) * 2019-09-29 2020-01-17 北京明略软件系统有限公司 Transcoder generation method and apparatus, electronic device, and storage medium

Also Published As

Publication number Publication date
CN111510159A (en) 2020-08-07

Similar Documents

Publication Publication Date Title
KR100614677B1 (en) Method for compressing/decompressing a structured document
CN101841515B (en) Target variable protocol data unit codec code automatic generation implementation method
CN110445860B (en) Message sending method, device, terminal equipment and storage medium
CN111131403A (en) Message coding and decoding method and device for Internet of things equipment
CN101807205B (en) Processing module, device, and method for processing of xml data
CN111147462A (en) FPGA-based step protocol analysis method, system, terminal and storage medium
CN110060158B (en) Variable length coding-based intelligent contract execution method and device
CN110769002A (en) LabVIEW-based message analysis method, system, electronic device and medium
CN113778449A (en) Avionics interface data adaptation conversion system
CN101202736B (en) Method for realizing encoding-decoding in communication network
CN114327477A (en) Intelligent contract execution method and device, electronic device and storage medium
CN114331416A (en) Data processing method and device, electronic equipment and storage medium
CN112188211A (en) Transcoding implementation method and device
US10282400B2 (en) Grammar generation for simple datatypes
CN112911024B (en) Method and system for collecting data of Internet of things, electronic device and storage medium
CN115830723A (en) Correlation method and correlation device for training set images
CN111510159B (en) Intelligent coding method and coder following general information exchange protocol specification
CN115495082B (en) TLV format data automatic conversion method and related equipment
CN116775599A (en) Data migration method, device, electronic equipment and storage medium
CN111464565B (en) Intelligent decoding method and decoder following general information exchange protocol specification
CN101101606A (en) Web page coding language automatic identification method and device for embedded type browser
CN109885549A (en) A kind of log collecting method, device, system and computer storage medium
CN112698825B (en) Programming building block conversion method, device, processing equipment and storage medium
CN110942127B (en) Method, system and storage medium for encrypting reagent two-dimensional code information of medical instrument
CN114169292A (en) Byte stream data conversion method, device, equipment and storage medium

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
GR01 Patent grant
GR01 Patent grant