CN115348320B - Communication data conversion method and device and electronic equipment - Google Patents
Communication data conversion method and device and electronic equipment Download PDFInfo
- Publication number
- CN115348320B CN115348320B CN202210944620.5A CN202210944620A CN115348320B CN 115348320 B CN115348320 B CN 115348320B CN 202210944620 A CN202210944620 A CN 202210944620A CN 115348320 B CN115348320 B CN 115348320B
- Authority
- CN
- China
- Prior art keywords
- conversion
- configuration
- communication data
- frame
- processing
- 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
Links
- 238000006243 chemical reaction Methods 0.000 title claims abstract description 185
- 238000004891 communication Methods 0.000 title claims abstract description 144
- 238000000034 method Methods 0.000 title claims abstract description 61
- 238000012545 processing Methods 0.000 claims abstract description 141
- 230000005540 biological transmission Effects 0.000 claims abstract description 90
- 238000007781 pre-processing Methods 0.000 claims description 36
- 238000012805 post-processing Methods 0.000 claims description 19
- 238000009432 framing Methods 0.000 claims description 11
- 230000006870 function Effects 0.000 description 19
- 238000010586 diagram Methods 0.000 description 15
- 238000005259 measurement Methods 0.000 description 12
- 230000008569 process Effects 0.000 description 9
- 238000004590 computer program Methods 0.000 description 8
- 238000013506 data mapping Methods 0.000 description 4
- 230000003287 optical effect Effects 0.000 description 4
- 230000008859 change Effects 0.000 description 3
- 238000013507 mapping Methods 0.000 description 3
- 230000001105 regulatory effect Effects 0.000 description 3
- 238000012360 testing method Methods 0.000 description 3
- 101150008604 CAN1 gene Proteins 0.000 description 2
- 101150063504 CAN2 gene Proteins 0.000 description 2
- 230000009471 action Effects 0.000 description 2
- 238000004458 analytical method Methods 0.000 description 2
- 230000001419 dependent effect Effects 0.000 description 2
- 239000004973 liquid crystal related substance Substances 0.000 description 2
- 230000000644 propagated effect Effects 0.000 description 2
- 239000004065 semiconductor Substances 0.000 description 2
- 230000006978 adaptation Effects 0.000 description 1
- 230000001174 ascending effect Effects 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000007429 general method Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 239000013307 optical fiber Substances 0.000 description 1
- 230000000737 periodic effect Effects 0.000 description 1
- 238000003672 processing method Methods 0.000 description 1
- 238000012163 sequencing technique Methods 0.000 description 1
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L69/00—Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
- H04L69/08—Protocols for interworking; Protocol conversion
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L69/00—Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
- H04L69/22—Parsing or analysis of headers
Landscapes
- Engineering & Computer Science (AREA)
- Computer Security & Cryptography (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Communication Control (AREA)
Abstract
The application provides a method for converting communication data, which comprises the following steps: when a conversion sending request for communication data is received, determining conversion sending configuration of the communication data from a configuration library according to the conversion request, wherein the conversion sending configuration comprises configuration parameters for completing conversion dependence of the communication data; analyzing the communication data list and the processing mark of the communication data in the conversion and transmission configuration, converting the communication data according to the processing mark, and generating a transmission frame to finish the conversion of the communication data; when a conversion receiving request for a received frame is received, determining a conversion receiving configuration of the received frame from a configuration library according to the connection of the received frame, wherein the conversion receiving configuration comprises configuration parameters for completing communication data conversion dependence; and analyzing the processing mark of the received frame in the conversion receiving configuration, converting the received frame into unit data according to the processing mark, and finishing the conversion of the received frame. The technical scheme of the application can adapt to dynamic network connection protocol changes.
Description
Technical Field
The present application relates to the field of network communications technologies, and in particular, to a method and an apparatus for converting communication data, and an electronic device.
Background
The ground test control system of the carrier rocket generally consists of a plurality of terminal computers, and test control software running on each terminal computer has functions of conversion, transmission and synchronization of various analog quantity and state quantity, relates to the condition of transmitting data by a network communication protocol, and each software designs a self-defined application layer communication protocol according to service functions thereof, wherein the design of the protocols serves specific service functions and meets the transmission requirements of a TCP/IP (transmission control protocol/Internet protocol) protocol, but the conversion work of communication data and service data is specific and service-related, can not adapt to dynamic protocol change, and can not expand the conversion function for changing, adding or deleting the conversion requirements of the communication data and the service data.
Disclosure of Invention
The embodiment of the application provides a communication data conversion method, a communication data conversion device and electronic equipment, and further can adapt to dynamic protocol changes at least to a certain extent.
Other features and advantages of the application will be apparent from the following detailed description, or may be learned by the practice of the application.
According to an aspect of an embodiment of the present application, there is provided a method of converting communication data, the method including: when a conversion sending request for the communication data is received, determining a conversion sending configuration of the communication data from a configuration library according to the conversion request, wherein the conversion sending configuration comprises configuration parameters for completing conversion dependence of the communication data; analyzing a communication data list and a processing mark of the communication data in the conversion and transmission configuration, converting the communication data according to the processing mark, and generating a transmission frame to finish conversion of the communication data; when a conversion receiving request for a received frame is received, determining a conversion receiving configuration of the received frame from the configuration library according to the connection of the received frame, wherein the conversion receiving configuration comprises configuration parameters for completing communication data conversion dependence; and analyzing a processing mark of the received frame in the conversion receiving configuration, converting the received frame into unit data according to the processing mark, and finishing the conversion of the received frame.
In some embodiments of the present application, the determining a conversion transmission configuration of the communication data from a configuration library according to the conversion request includes: determining a target transmission connection of the communication data according to the conversion request, wherein the target transmission connection is a transmission connection aimed by the conversion request; and accessing a configuration library, and determining the conversion sending configuration corresponding to the target transmission connection as the conversion sending configuration of the communication data.
In some embodiments of the present application, based on the foregoing, the converting the communication data according to the processing flag, generating a transmission frame includes: converting the communication data according to the processing mark, and converting each unit data of the communication data according to a priority, wherein the priority is represented by the processing mark; and carrying out post-processing on each unit of data to generate a transmission frame.
In some embodiments of the present application, the post-processing each unit data to generate a transmission frame includes: and framing the unit data, and performing post-processing on the communication data after framing to generate a transmission frame.
In some embodiments of the application, after generating the transmission frame, the method further comprises: the communication transmits the transmission frame or virtually outputs the transmission frame.
In some embodiments of the present application, the determining, from the configuration library, a converted reception configuration of the received frame according to a connection in which the received frame is located includes: determining a preprocessing mode for the received frame from the configuration library according to the connection of the received frame; preprocessing the received frame according to the preprocessing mode to generate a complete received frame; and accessing the configuration library, and determining the conversion receiving configuration corresponding to the complete receiving frame as the conversion receiving configuration of the receiving frame.
In some embodiments of the present application, the parsing the processing flag of the received frame in the conversion receiving configuration, converting the received frame into unit data according to the processing flag includes: analyzing the processing mark of the received frame in the conversion receiving configuration, and determining a receiving unit data list and processing marks corresponding to the unit data; and converting the received frame into the unit data according to the processing mark corresponding to each unit data.
In some embodiments of the application, after converting the received frame into unit data according to the processing flag, the method further comprises: and outputting the unit data to a service end.
According to an aspect of an embodiment of the present application, there is provided a communication data conversion apparatus including: a first receiving unit configured to determine, when a conversion transmission request for the communication data is received, a conversion transmission configuration of the communication data from a configuration library according to the conversion request, the conversion transmission configuration including configuration parameters on which conversion of the communication data is completed; a first parsing unit, configured to parse a communication data list and a processing flag of the communication data in the conversion and transmission configuration, convert the communication data according to the processing flag, and generate a transmission frame to complete conversion of the communication data; the second receiving unit is used for determining conversion receiving configuration of the received frame from the configuration library according to the connection where the received frame is located when receiving a conversion receiving request for the received frame, wherein the conversion receiving configuration comprises configuration parameters for completing communication data conversion dependence; and the second analyzing unit is used for analyzing the processing mark of the received frame in the conversion receiving configuration, converting the received frame into unit data according to the processing mark and finishing the conversion of the received frame.
According to an aspect of an embodiment of the present application, there is provided an electronic device including a memory, and one or more programs, wherein one or more programs are stored in the memory and configured to be executed by one or more processors, the one or more programs including instructions for performing a method of converting communication data as described.
In the technical scheme provided by some embodiments of the application, the method can be arranged in a configuration library according to preloaded multiple conversion configurations, and can quickly select proper conversion configurations according to requirements in the actual use process, so that the conversion of communication data is efficiently and quickly completed, the frame assembly and the analysis process of the communication data are decoupled from the measurement and control business process, and the method has a configurable function for the change of a communication protocol; aiming at the protocol conversion requirement which is not realized yet, the system has the extensible function.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the application as claimed.
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. It is evident that the drawings in the following description are only some embodiments of the present application and that other drawings may be obtained from these drawings without inventive effort for a person of ordinary skill in the art. In the drawings:
fig. 1 shows a schematic view of a scenario of a method of converting communication data according to an embodiment of the present application;
FIG. 2 shows a flow diagram of a method of converting communication data according to one embodiment of the application;
FIG. 3 shows a flow diagram of a method of converting communication data according to one embodiment of the application;
FIG. 4 shows a flow diagram of a method of converting communication data according to one embodiment of the application;
FIG. 5 shows a flow diagram of a method of converting communication data according to one embodiment of the application;
fig. 6 shows a schematic view of a scenario of a method of converting communication data according to an embodiment of the present application;
FIG. 7 shows a block diagram of a communication data conversion apparatus according to one embodiment of the present application;
Fig. 8 shows a schematic diagram of a computer system suitable for use in implementing an embodiment of the application.
Detailed Description
Example embodiments will now be described more fully with reference to the accompanying drawings. However, the exemplary embodiments may be embodied in many forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of the example embodiments to those skilled in the art.
Furthermore, the described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a thorough understanding of embodiments of the application. One skilled in the relevant art will recognize, however, that the application may be practiced without one or more of the specific details, or with other methods, components, devices, steps, etc. In other instances, well-known methods, devices, implementations, or operations are not shown or described in detail to avoid obscuring aspects of the application.
The block diagrams depicted in the figures are merely functional entities and do not necessarily correspond to physically separate entities. That is, the functional entities may be implemented in software, or in one or more hardware modules or integrated circuits, or in different networks and/or processor devices and/or microcontroller devices.
The flow diagrams depicted in the figures are exemplary only, and do not necessarily include all of the elements and operations/steps, nor must they be performed in the order described. For example, some operations/steps may be decomposed, and some operations/steps may be combined or partially combined, so that the order of actual execution may be changed according to actual situations.
It should be noted that: references herein to "a plurality" means two or more. "and/or" describes an association relationship of an association object, meaning that there may be three relationships, e.g., a and/or B may represent: a exists alone, A and B exist together, and B exists alone. The character "/" generally indicates that the context-dependent object is an "or" relationship.
Please refer to fig. 1. Fig. 1 is a schematic view of a scenario of a method for converting communication data according to an embodiment of the present application, as shown in fig. 1, the present application proposes a general method for converting a protocol of a ground test control system, and provides a conversion interface between service data and data frames received and transmitted on different communication connections according to a flow and configuration described by the method.
It should be noted that, the conversion in the present application refers to the mutual conversion between the communication data and the basic type of service data based on a specific protocol.
In the application, the service software can be defined to comprise a service module, a configuration and protocol conversion universal module, a TCP module or a UDP module, wherein the service software has TCP communication and UDP communication with the service software 1 and the service software 2, and the service data of the service software is converted into communication data through the protocol conversion universal module and is sent to the service software 1 and the service software 2 through the communication function of the communication module; the data frames sent by the service software 1 and the service software 2 are received by the communication module of the service software, are converted into service data after being processed by the protocol conversion universal module, and are sent to the service module for processing. The protocol conversion general-purpose module comprises the protocol conversion general-purpose method provided herein, reads configuration and conversion data to complete the conversion.
Please refer to fig. 2. Fig. 2 shows a flow diagram of a method of converting communication data according to an embodiment of the application, which method may comprise steps S201-S204, as shown in fig. 2:
Step S201, when a conversion transmission request for the communication data is received, determining a conversion transmission configuration of the communication data from a configuration library according to the conversion request, wherein the conversion transmission configuration comprises configuration parameters for completing conversion dependence of the communication data.
Step S202, analyzing the communication data list and the processing mark of the communication data in the conversion and transmission configuration, converting the communication data according to the processing mark, and generating a transmission frame to finish the conversion of the communication data.
Step S203, when a request for receiving a conversion of a received frame is received, determining a conversion receiving configuration of the received frame from the configuration library according to a connection where the received frame is located, where the conversion receiving configuration includes configuration parameters for completing communication data conversion.
Step S204, analyzing the processing mark of the received frame in the conversion receiving configuration, converting the received frame into unit data according to the processing mark, and completing the conversion of the received frame.
In the application, the method can be arranged in a configuration library according to preloaded various conversion configurations, and the proper conversion configuration can be quickly selected according to the needs in the actual use process, so that the conversion of communication data can be efficiently and quickly completed, the decoupling of the framing and analysis processes of the communication data and the measurement and control business processes can be realized, and the method has the configurable function aiming at the change of a communication protocol; aiming at the protocol conversion requirement which is not realized yet, the system has the extensible function.
In the present application, the conversion transmitting configuration and the conversion receiving configuration may mainly include:
Connection configuration: defining a group of connection IDs, post-processing marks and parameters of the transmission data of the connection IDs, pre-processing marks and parameters of the receiving data, wherein each connection ID corresponds to a group of transmission frame configuration and a group of receiving frame configuration, and the connection IDs are equivalent to the connection corresponding to the TCP/IP protocol and virtual protocol conversion of the custom application layer protocol.
Frame definition configuration: a set of uniquely identified frame ID identifiers is defined, one frame ID being equivalent to the frame configuration to which the frame ID corresponds.
And (3) transmitting frame configuration: for each frame ID, a set of elementary type unit data is defined, for each unit data, a data name thereof, an elementary data type, an offset with respect to a transmission frame, a byte length, a processing flag, and a processing parameter are defined.
Receiving a frame configuration: the processing flag and the processing parameter are different from the configuration of the transmission frame.
Cell mapping configuration: and defining a data list of output unit data names, data types, data bit offsets and data bit lengths corresponding to the input unit data names.
The virtual protocol conversion is a protocol conversion required by a specific function, and the input and output of the conversion are not associated with the transmission and reception of the communication module, and are only reflected on virtual logic processing.
It should be noted that, the unit data refers to data of a basic data type, where the basic data type includes: a fixed-length char type, byte (unsigned char) type, short type, word (unsigned short) type, int (long) type, dword (unsigned long) type, int64 (long) type, float type, double type, long double type and its array type (the number of elements of the array is at least 1), string (ASCII) type of indefinite length, and the like.
The processing mark refers to a group of unique ID, and different IDs represent processing methods and processing parameters corresponding to the processing mark.
In the present application, the method of determining a converted transmission configuration of the communication data from a configuration library according to the conversion request may include: determining a target transmission connection of the communication data according to the conversion request, wherein the target transmission connection is a transmission connection aimed by the conversion request; and accessing a configuration library, and determining the conversion sending configuration corresponding to the target transmission connection as the conversion sending configuration of the communication data.
Please refer to fig. 3. Fig. 3 is a flow chart illustrating a method for converting communication data according to an embodiment of the present application, and the method for generating a transmission frame according to the processing flag converting the communication data may include steps S301 to S302:
Step S301, converting the communication data according to the processing flag, and converting each unit data of the communication data according to a priority, wherein the priority is represented by the processing flag.
Step S302, post-processing is performed on each unit data to generate a transmission frame.
In the present application, examples of the processing flags and parameters may be as shown in table 1.
TABLE 1
In this embodiment, in step S301, converting each unit data of the communication data according to the priority specifically means that the processing flags of one unit data list are sorted from small to large, the processing flag of the high priority is small, and the processing flag of the low priority is large; the unit data with high priority is firstly acquired, the unit data with low priority can be acquired simultaneously independent of each other with the same priority, and the unit data with high priority is acquired after being dependent on the data with high priority.
In this embodiment, the method for post-processing each unit data to generate a transmission frame includes: and framing the unit data, and performing post-processing on the communication data after framing to generate a transmission frame.
In the present application, post-processing may also be performed based on processing flags and parameters, and table 2 shows an example of the post-processing flags and parameters in one embodiment of the present application.
TABLE 2
It should be noted that the escape is to perform special processing on a frame header flag (frame tail flag) where a data portion of a transmission frame appears so as to distinguish the frame header (frame tail) from the data, and the data can be restored in the same manner at a receiving end. For example, the processing flag 0x02 described in table 2 is processed by traversing the transmission frame byte by byte, looking for the presence of a frame header flag in the data portion, and repeating it once, the repeated frame header flag being an escape for the frame header.
In the present application, after generating the transmission frame, the method may further include: the communication transmits the transmission frame or virtually outputs the transmission frame.
A detailed embodiment will be described so that those skilled in the art may more fully understand the technical solution provided by the present application.
For example, as follows, the back end measurement and control software connects to port 6550 of the front end measurement and control software in TCP CLIENT manner, establishing a TCP communication connection "TCP-CK". The back-end measurement and control software sends a combined control command to the front-end measurement and control software, wherein the combined control command comprises an electromagnetic valve control command (on/off) and a regulating valve control command (regulating valve opening), the front-end measurement and control software receives the control command and then decomposes the control command into a plurality of CAN commands to be sent to a CAN bus, and the transmission frame is defined in the form of a TCP communication connection as shown in Table 3:
TABLE 3 Table 3
The newly added configuration information in the configuration library may be as follows:
The connection configuration information of the connection 'TCP-CK' is configured, the post-processing flag of the transmission frame on the connection is 2, the frame header mark Id of the processing parameter is HeadFlag, and whether the frame header is in false or not is not in false.
One frame list of configuration frame information is added, and the frame Id is 0x02, and the name is 'solenoid valve and regulating valve combination control command';
The connection "TCP-CK" in the transmission protocol conversion configuration is added with one frame, the frame Id is 0x02, and the unit data list is contained as follows:
(1) Unit data name "Len", data type "word", byte length "2", offset "0", processing flag "0x1", processing parameter "20";
(2) Unit data name "SendType", data type "word", byte length "2", offset "2", processing flag "0x1", processing parameter "1";
(3) Unit data name "FrameId", data type "word", byte length "2", offset "4", processing flag "0x1", processing parameter "0x02";
(4) The cell data name "TimeStamp", data type "dword", byte length "4", offset "6", processing flag "0x2", processing parameter ";
(5) Unit data name "DcfCommand", data type "dword", byte length "4", offset "10", processing flag "0x3", processing parameter "";
(6) Unit data name "Tjf1Command", data type "word", byte length "2", offset "14", processing flag "0x2", processing parameter ";
(7) Unit data name "Tjf2Command", data type "word", byte length "2", offset "16", processing flag "0x2", processing parameter ";
(8) Unit data name "CRC", data type "word", byte length "2", offset "18", processing flag "0x08", processing parameter "Len; sendType; frameId; timeStamp; dcfComma nd; tjf1Command; tjf2 Command).
The data mapping configuration increases the mapping configuration of the unit data "DcfCommand": the source unit data is "DcfC ommand", the destination unit data is a list, and each unit data is configured as follows:
(1) Unit data name "DCF1", data type "BYTE", bit length "1", bit offset "0";
(2) Unit data name "DCF2", data type "BYTE", bit length "1", bit offset "1";
(3) Unit data name "DCF7", data type "BYTE", bit length "1", bit offset "3";
……
(24) The cell data name "DCF24", the data type "BYTE", the bit length "1", the bit offset "31".
The service module initiates a request for transmitting protocol conversion to the protocol conversion universal module, and the form of command parameters is' connectName =TCP-CK; frameId =0x02 ", meaning that a TCP frame with a frame id of 0x02 (physical meaning that a combination control command is sent) is requested to be sent to the connection" TCP-CK ".
When the protocol conversion universal module executes the transmission protocol conversion of the frame 0x02, firstly inquiring whether the configuration of the frame 0x02 exists under the connection of the TCP-CK in the transmission protocol conversion configuration, if so, reading a unit data list of the frame configuration, sequencing according to the ascending order of a processing mark, and sequentially converting each unit data: processing parameters with processing marks of 0x01, such as '20', '1', '12', are converted into values of corresponding data types of the unit data Len, sendType, frameId according to literal values; the unit data with the processing mark of 0x02 has no parameter, the service module provides a value, and the value is directly copied to the unit data memory; processing the unit data with the mark of 0x03 as DcfCommand, sending a protocol conversion lookup DcfCommand to map the unit data into configuration, and obtaining DcfCommand values of DCF1, DCF2, … and DCF24 according to the configuration of bit mapping; processing a unit data CRC marked with 0x08, wherein the parameter is' Len; sendType; frameId; timeStamp; dcfCommand; tjf1Command; tjf2Command ", transmitting the data list corresponding to the protocol conversion lookup parameter, and inputting the data list into a predefined CRC16 operation from low byte to high byte, where the result is the unit data CRC value. And carrying out post-processing on the data frame after the transmission protocol conversion is finished, reading connection configuration information of the connection TCP-CK, adding a frame header mark to the frame header part, needing no escape of the frame header, outputting the post-processed transmission frame to a TCP module, and transmitting the post-processed transmission frame on the connection TCP-CK by the TCP module.
Please refer to fig. 4. Fig. 4 is a flow chart illustrating a method for converting communication data according to an embodiment of the present application, and as shown in fig. 4, the method for determining a converted reception configuration of the reception frame from the configuration library according to a connection in which the reception frame is located may include steps S401 to S403:
step S401, determining a preprocessing mode for the received frame from the configuration library according to the connection where the received frame is located.
Step S402, preprocessing the received frame according to the preprocessing mode, and generating a complete received frame.
Step S403, accessing the configuration library, and determining the conversion receiving configuration corresponding to the complete received frame as the conversion receiving configuration of the received frame.
In the application, the preprocessing of the received data is carried out according to the preprocessing mark and parameter configuration on the corresponding connection, and after the data of the connection is received, if the preprocessing mark indicates that the processing is not needed, the next processing is directly carried out; if the preprocessing mark indicates that the processing is needed, entering a receiving data ring buffer queue under the connection, and preprocessing the data according to the preprocessing rule.
Examples of pre-processing flags and parameter configurations may be as shown in table 4.
TABLE 4 Table 4
The data received from the TCP connection needs to be preprocessed, and the preprocessing flag includes a specific process; data received from the UDP connection generally does not need to be preprocessed, and the preprocessing flag indicates that it is not processed; and the data received from the customized virtual logic connection is preprocessed according to the service requirement, and the preprocessing mark is configured according to the service requirement.
Please refer to fig. 5. Fig. 5 is a flow chart illustrating a method for converting communication data according to an embodiment of the present application, wherein the method for resolving a processing flag of the received frame in the conversion receiving configuration and converting the received frame into unit data according to the processing flag may include steps S501-S502:
Step S501, analyzing the processing flag of the received frame in the conversion receiving configuration, and determining a receiving unit data list and processing flags corresponding to the unit data.
Step S502, converting the received frame into unit data according to the processing flag corresponding to each unit data.
The unit data receiving protocol conversion processing flag and the parameters can be shown in table 5.
TABLE 5
In the present application, after converting the received frame into unit data according to the processing flag, the method may further include: and outputting the unit data to a service end.
A detailed embodiment will be described as well.
The back-end measurement and control software is also added to a UDP multicast port 23344 of the front-end measurement and control software in a UDP multicast mode, and the connection name is UDP-CK. The front end measurement and control software periodically transmits the periodic state information of the front end measurement and control software to the user end joining the multicast through the multicast port. These information are identified as "comprehensive status telemetry 1" in the front-end and back-end measurement and control software communication interface protocol, and the defined form can be as shown in table 6:
TABLE 6
The newly added configuration information in the configuration of the configuration library may be as follows:
Connection configuration information of a connection UDP-CK is configured, a received frame preprocessing mark on the connection is 1, and no processing parameters exist.
Adding one item in a frame list of configuration frame information, wherein the frame Id is 0x21 and is named as 'comprehensive state telemetry information 1';
The connection "UDP-CK" in the receiving protocol conversion configuration is added with one frame, the frame Id is 0x21, and the contained unit data list is:
Unit data name "HeadFlag", data type "dword", byte length "4", offset "0", processing flag "0x1", processing parameter "0xDAE EAD";
unit data name "Len", data type "word", byte length "2", offset "4", processing flag "0x1", processing parameter "18";
Unit data name "SendType", data type "word", byte length "2", offset "6", processing flag "", processing parameter "";
unit data name "FrameId", data type "word", byte length "2", offset "8", processing flag "0x1", processing parameter "0x21";
the cell data name "TimeStamp", data type "dword", byte length "4", offset "10", processing flag "0x2", processing parameter ";
Unit data name "CKDCS", data type "byte", byte length "1", offset "14", processing flag "0x3", processing parameter "";
unit data name "CKState", data type "byte", byte length "1", offset "15", processing flag "0x2", processing parameter "";
Unit data name "CKVersion", data type "word", byte length "2", offset "16", processing flag "0x3", processing parameter "";
Unit data name "VBB0", data type "short", byte length "2", offset "18", processing flag "0x2", processing parameter "";
unit data name "VBB1", data type "short", byte length "2", offset "20", processing flag "0x2", processing parameter "".
The data mapping configuration adding unit data "CKDCS" is as follows:
unit data name "RAM", data type "BYTE", bit length "1", bit offset "0";
The unit data name "CAN1", the data type "BYTE", the bit length "1", the bit offset "1";
the unit data name "CAN2", the data type "BYTE", bit length "1", bit offset "2";
the cell data name "Timer", the data type "BYTE", bit length "1", bit offset "3";
Unit data name "AD", data type "BYTE", bit length "1", bit offset "4";
Unit data name "IO", data type "BYTE", bit length "1", bit offset "5".
The data mapping configuration adding unit data "CKVersion" is as follows:
unit data name "CKSubVersion", data type "BYTE", bit length "8", bit offset "0";
Unit data name "CKMainVersion", data type "BYTE", bit length "8", bit offset "8".
The unit data with the processing mark of 0x01 is a judging mark, namely, all received frames are circularly traversed, the received data are sequentially carried into configuration, when the frame header mark value is judged to be 0xDAE EAD, the data length value is judged to be 18, and the frame ID is judged to be 0x21, the received data are determined to be 'comprehensive state telemetry information 1', and each unit data are further analyzed: when the processing mark is 0x02, the unit data directly analyzes the data according to the type, byte length and offset; when the processing flag is 0x03, the unit data is stored, and the data mapping configuration is searched at the same time, so that the unit data is further analyzed. For example, the self-checking information CKDCS of the device in the 0x21 frame is mapped into the respective checking states RAM, CAN1, CAN2, timer, AD, IO and output to the service module; the software version information CKVersion is mapped to the sub version number CKSubVersion and the main version number CKMainVersion and output to the service module.
Please refer to fig. 6. Fig. 6 is a schematic view of a scenario of a method for converting communication data according to an embodiment of the present application, and as shown in fig. 6, conversion functions of the conversion transmitting configuration and the conversion receiving configuration may be integrated in the same unit data processing factory, which may define the same interface for unit data processing and be implemented in a factory manner. The unit data processing factory solidifies the transmitting unit data conversion interface and the receiving unit data conversion interface, abstracts the unit data ID and the attribute configuration, the processing mark and the processing parameter thereof, realizes the transmission data protocol conversion under the corresponding functions of different processing marks by inheriting the protocol conversion interface form, and meets the expandability.
An embodiment of the apparatus of the present application will be described with reference to the accompanying drawings
Please refer to fig. 7. Fig. 7 shows a block diagram of a conversion apparatus of communication data according to an embodiment of the present application, which may include, as shown in fig. 7: a first receiving unit 701, a first analyzing unit 702, a second receiving unit 703, and a second analyzing unit.
The specific configuration of the conversion device may be as follows:
A first receiving unit 701, configured to, when receiving a conversion transmission request for the communication data, determine a conversion transmission configuration of the communication data from a configuration library according to the conversion request, where the conversion transmission configuration includes configuration parameters on which conversion of the communication data is completed.
The first parsing unit 702 is configured to parse the communication data list and the processing flag of the communication data in the conversion and transmission configuration, convert the communication data according to the processing flag, and generate a transmission frame to complete conversion of the communication data.
And a second receiving unit 703, configured to, when receiving a request for conversion reception of a received frame, determine a conversion reception configuration of the received frame from the configuration library according to a connection in which the received frame is located, where the conversion reception configuration includes configuration parameters on which conversion of communication data is completed.
And a second parsing unit 704, configured to parse the processing flag of the received frame in the conversion receiving configuration, and convert the received frame into unit data according to the processing flag, so as to complete conversion of the received frame.
Please refer to fig. 8. Fig. 8 shows a schematic diagram of a computer system suitable for use in implementing an embodiment of the application.
It should be noted that, the computer system 800 of the electronic device shown in fig. 8 is only an example, and should not impose any limitation on the functions and the application scope of the embodiments of the present application.
As shown in fig. 8, the computer system 800 includes a central processing unit (Central Processing Unit, CPU) 801 that can perform various appropriate actions and processes, such as performing the methods described in the above embodiments, according to a program stored in a Read-Only Memory (ROM) 802 or a program loaded from a storage section 808 into a random access Memory (Random Access Memory, RAM) 803. In the RAM 803, various programs and data required for system operation are also stored. The CPU 801, ROM 802, and RAM 803 are connected to each other by a bus 804. An Input/Output (I/O) interface 805 is also connected to bus 804.
The following components are connected to the I/O interface 805: an input portion 806 including a keyboard, mouse, etc.; an output portion 807 including a Cathode Ray Tube (CRT), a Liquid crystal display (Liquid CRYSTAL DISPLAY, LCD), and a speaker, etc.; a storage section 808 including a hard disk or the like; and a communication section 809 including a network interface card such as a LAN (Local Area Network ) card, modem, or the like. The communication section 809 performs communication processing via a network such as the internet. The drive 810 is also connected to the I/O interface 805 as needed. A removable medium 811 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 810 as needed so that a computer program read out therefrom is mounted into the storage portion 808 as needed.
In particular, according to embodiments of the present application, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present application include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method shown in the flowcharts. In such an embodiment, the computer program may be downloaded and installed from a network via the communication section 809, and/or installed from the removable media 811. When executed by a Central Processing Unit (CPU) 801, performs the various functions defined in the system of the present application.
It should be noted that, the computer readable medium shown in the embodiments of the present application may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-Only Memory (ROM), an erasable programmable read-Only Memory (Erasable Programmable Read Only Memory, EPROM), a flash Memory, an optical fiber, a portable compact disc read-Only Memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present application, however, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the foregoing.
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present application. Where each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units involved in the embodiments of the present application may be implemented by software, or may be implemented by hardware, and the described units may also be provided in a processor. Wherein the names of the units do not constitute a limitation of the units themselves in some cases.
As another aspect, the present application also provides a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions so that the computer device performs the method of converting communication data described in the above embodiments.
As another aspect, the present application also provides a computer-readable medium that may be contained in the electronic device described in the above embodiment; or may exist alone without being incorporated into the electronic device. The computer-readable medium carries one or more programs that, when executed by one of the electronic devices, cause the electronic device to implement the communication data conversion method described in the above embodiment.
It should be noted that although in the above detailed description several modules or units of a device for action execution are mentioned, such a division is not mandatory. Indeed, the features and functions of two or more modules or units described above may be embodied in one module or unit in accordance with embodiments of the application. Conversely, the features and functions of one module or unit described above may be further divided into a plurality of modules or units to be embodied.
From the above description of embodiments, those skilled in the art will readily appreciate that the example embodiments described herein may be implemented in software, or may be implemented in software in combination with the necessary hardware. Thus, the technical solution according to the embodiments of the present application may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (may be a CD-ROM, a U-disk, a mobile hard disk, etc.) or on a network, and includes several instructions to cause a computing device (may be a personal computer, a server, a touch terminal, or a network device, etc.) to perform the method according to the embodiments of the present application.
Other embodiments of the application will be apparent to those skilled in the art from consideration of the specification and practice of the embodiments 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 to be understood that the 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 (6)
1. A method of converting communication data, the method comprising:
When a conversion sending request for the communication data is received, determining a conversion sending configuration of the communication data from a configuration library according to the conversion request, wherein the conversion sending configuration comprises configuration parameters for completing conversion dependence of the communication data;
Analyzing a communication data list and a processing mark of the communication data in the conversion and transmission configuration, converting the communication data according to the processing mark, and generating a transmission frame to finish conversion of the communication data;
when a conversion receiving request for a received frame is received, determining a conversion receiving configuration of the received frame from the configuration library according to the connection of the received frame, wherein the conversion receiving configuration comprises configuration parameters for completing communication data conversion dependence;
Analyzing a processing mark of the received frame in the conversion receiving configuration, converting the received frame into unit data according to the processing mark, and finishing conversion of the received frame;
The step of converting the communication data according to the processing mark to generate a transmission frame comprises the following steps:
Converting the communication data according to the processing mark, and converting each unit data of the communication data according to a priority, wherein the priority is represented by the processing mark;
post-processing is carried out on each unit of data to generate a transmission frame;
the post-processing of the unit data to generate a transmission frame includes:
framing operation is carried out on each unit data, post-processing is carried out on the communication data after framing, and a sending frame is generated;
The post-processing is to add a frame header mark or a frame tail mark to the communication data after framing;
the determining the conversion sending configuration of the communication data from the configuration library according to the conversion request comprises the following steps:
Determining a target transmission connection of the communication data according to the conversion request, wherein the target transmission connection is a transmission connection aimed by the conversion request;
accessing a configuration library, and determining the conversion transmission configuration corresponding to the target transmission connection as the conversion transmission configuration of the communication data;
The determining the conversion receiving configuration of the receiving frame from the configuration library according to the connection of the receiving frame comprises the following steps:
Determining a preprocessing mode for the received frame from the configuration library according to the connection of the received frame;
Preprocessing the received frame according to the preprocessing mode to generate a complete received frame;
accessing the configuration library, and determining the conversion receiving configuration corresponding to the complete receiving frame as the conversion receiving configuration of the receiving frame;
The preprocessing is configured according to the preprocessing mark and parameters on the corresponding connection, and after the received frame is received, if the preprocessing mark indicates that the processing is not needed, the next processing is directly carried out; if the preprocessing mark indicates that the processing is needed, entering a receiving data annular buffer queue under the connection, and preprocessing the data according to a preprocessing rule.
2. The method of claim 1, wherein after generating the transmission frame, the method further comprises:
The communication transmits the transmission frame or virtually outputs the transmission frame.
3. The method of claim 1, wherein said parsing a processing flag of said received frame in said converted reception configuration, converting said received frame into unit data based on said processing flag, comprises:
analyzing the processing mark of the received frame in the conversion receiving configuration, and determining a receiving unit data list and processing marks corresponding to the unit data;
and converting the received frame into the unit data according to the processing mark corresponding to each unit data.
4. The method of claim 1, wherein after converting the received frame into unit data according to the processing flag, the method further comprises:
And outputting the unit data to a service end.
5. A communication data conversion apparatus, the apparatus comprising:
a first receiving unit configured to determine, when a conversion transmission request for the communication data is received, a conversion transmission configuration of the communication data from a configuration library according to the conversion request, the conversion transmission configuration including configuration parameters on which conversion of the communication data is completed;
a first parsing unit, configured to parse a communication data list and a processing flag of the communication data in the conversion and transmission configuration, convert the communication data according to the processing flag, and generate a transmission frame to complete conversion of the communication data;
The second receiving unit is used for determining conversion receiving configuration of the received frame from the configuration library according to the connection where the received frame is located when receiving a conversion receiving request for the received frame, wherein the conversion receiving configuration comprises configuration parameters for completing communication data conversion dependence;
The second analyzing unit is used for analyzing the processing mark of the received frame in the conversion receiving configuration, converting the received frame into unit data according to the processing mark and finishing the conversion of the received frame;
The step of converting the communication data according to the processing mark to generate a transmission frame comprises the following steps:
Converting the communication data according to the processing mark, and converting each unit data of the communication data according to a priority, wherein the priority is represented by the processing mark;
post-processing is carried out on each unit of data to generate a transmission frame;
the post-processing of the unit data to generate a transmission frame includes:
framing operation is carried out on each unit data, post-processing is carried out on the communication data after framing, and a sending frame is generated;
The post-processing is to add a frame header mark or a frame tail mark to the communication data after framing;
the determining the conversion sending configuration of the communication data from the configuration library according to the conversion request comprises the following steps:
Determining a target transmission connection of the communication data according to the conversion request, wherein the target transmission connection is a transmission connection aimed by the conversion request;
accessing a configuration library, and determining the conversion transmission configuration corresponding to the target transmission connection as the conversion transmission configuration of the communication data;
The determining the conversion receiving configuration of the receiving frame from the configuration library according to the connection of the receiving frame comprises the following steps:
Determining a preprocessing mode for the received frame from the configuration library according to the connection of the received frame;
Preprocessing the received frame according to the preprocessing mode to generate a complete received frame;
accessing the configuration library, and determining the conversion receiving configuration corresponding to the complete receiving frame as the conversion receiving configuration of the receiving frame;
The preprocessing is configured according to the preprocessing mark and parameters on the corresponding connection, and after the received frame is received, if the preprocessing mark indicates that the processing is not needed, the next processing is directly carried out; if the preprocessing mark indicates that the processing is needed, entering a receiving data annular buffer queue under the connection, and preprocessing the data according to a preprocessing rule.
6. An electronic device comprising a memory, and one or more programs, wherein one or more programs are stored in the memory and configured to be executed by one or more processors, the one or more programs comprising instructions for performing the method of converting communication data according to any one of claims 1 to 4.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202210944620.5A CN115348320B (en) | 2022-08-08 | 2022-08-08 | Communication data conversion method and device and electronic equipment |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202210944620.5A CN115348320B (en) | 2022-08-08 | 2022-08-08 | Communication data conversion method and device and electronic equipment |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN115348320A CN115348320A (en) | 2022-11-15 |
| CN115348320B true CN115348320B (en) | 2024-07-02 |
Family
ID=83950331
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202210944620.5A Active CN115348320B (en) | 2022-08-08 | 2022-08-08 | Communication data conversion method and device and electronic equipment |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN115348320B (en) |
Families Citing this family (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN118015726A (en) * | 2023-12-29 | 2024-05-10 | 知迪汽车技术(北京)有限公司 | Data monitoring method and system of vehicle-mounted data recorder |
Citations (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN102098131A (en) * | 2009-12-15 | 2011-06-15 | 航天科工惯性技术有限公司 | Dynamic parameter configuration-based general framing and de-framing method for serial port data frames |
Family Cites Families (12)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US7778719B2 (en) * | 2005-12-14 | 2010-08-17 | Taiwan Semiconductor Manufacturing Company, Ltd. | Method, system, apparatus, and computer-readable medium for providing configure to service for a semiconductor manufacturing service guide system |
| US20090070338A1 (en) * | 2007-09-07 | 2009-03-12 | Bowe Bell + Howell Company | Centralized production management for measuring mail industry processing performance |
| JP5239618B2 (en) * | 2008-08-19 | 2013-07-17 | 沖電気工業株式会社 | Address translation apparatus, method and program, and node |
| JP2012063897A (en) * | 2010-09-15 | 2012-03-29 | Ricoh Co Ltd | Image processing device, image processing method, program and recording medium |
| CN103957134B (en) * | 2014-04-22 | 2017-05-10 | 航天恒星科技有限公司 | Modular configurable telemetry parameter analyzing and processing system |
| CN106603506B (en) * | 2016-11-28 | 2020-06-05 | 北京航空航天大学 | Data communication method, device and system based on multi-field bus |
| US11270201B2 (en) * | 2017-12-29 | 2022-03-08 | Intel Corporation | Communication optimizations for distributed machine learning |
| CN109669442B (en) * | 2018-12-25 | 2022-02-22 | 深圳市元征科技股份有限公司 | Protocol conversion method and conversion device |
| CN110827443B (en) * | 2019-10-24 | 2021-07-06 | 张东 | Remote measurement post data processing system |
| CN112713960B (en) * | 2019-10-25 | 2024-10-29 | 中兴通讯股份有限公司 | Data transmission method, data reception device, communication node, and storage medium |
| CN110933146B (en) * | 2019-11-14 | 2022-09-16 | 厦门网宿有限公司 | Data conversion method and device and server |
| CN111930666A (en) * | 2020-09-11 | 2020-11-13 | 之江实验室 | High-speed configurable industrial protocol converter |
-
2022
- 2022-08-08 CN CN202210944620.5A patent/CN115348320B/en active Active
Patent Citations (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN102098131A (en) * | 2009-12-15 | 2011-06-15 | 航天科工惯性技术有限公司 | Dynamic parameter configuration-based general framing and de-framing method for serial port data frames |
Also Published As
| Publication number | Publication date |
|---|---|
| CN115348320A (en) | 2022-11-15 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN112187558B (en) | Data verification method and device and electronic equipment | |
| CN110191021B (en) | Protocol testing method and device, electronic equipment and storage medium | |
| CN111683066A (en) | Heterogeneous system integration method and device, computer equipment and storage medium | |
| CN113050987B (en) | Method and device for generating interface document, storage medium and electronic equipment | |
| CN108881251B (en) | A system and method for access analysis and standardization of arbitrary binary devices | |
| CN110515944B (en) | Data storage method based on distributed database, storage medium and electronic equipment | |
| CN110263277A (en) | Display methods, update method, device, equipment and the storage medium of page data | |
| CN103197948A (en) | Communication protocol script analyzing method of electricity intelligent equipment | |
| CN117850753B (en) | Method, device, equipment and medium for generating interface code based on someip matrix | |
| CN114285793A (en) | Distribution method, distribution device, distribution equipment and storage medium | |
| CN115348320B (en) | Communication data conversion method and device and electronic equipment | |
| CN113393288A (en) | Order processing information generation method, device, equipment and computer readable medium | |
| CN112130860B (en) | JSON object analysis method and device, electronic equipment and storage medium | |
| CN112948306A (en) | Method and device for expanding system interface | |
| CN118138653A (en) | SomeIP communication matrix generation method and SomeIP communication matrix generation device | |
| CN115842861B (en) | Edge connection device adaptation method, device and computer readable storage medium | |
| CN116634036A (en) | Protocol conversion and configuration method and system for avionics data interface device | |
| CN113850988B (en) | Key value correction method, device, equipment and computer readable medium | |
| CN114374745A (en) | Protocol format processing method and system | |
| CN113824806B (en) | Equipment identification method and device and electronic equipment | |
| US11423247B2 (en) | Identifying fixed bits of a bitstring format | |
| CN111507080B (en) | Data quality inspection method, device, electronic equipment and storage medium | |
| CN115344330A (en) | Data transmission method and device, application processing method and device, and electronic device | |
| CN114168652A (en) | A smart contract interaction method, device, device and storage medium | |
| CN114095235A (en) | System identification method, apparatus, computer device and 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 |