Cross-system data interaction method and device and electronic equipment

By determining the target resolution template and compatibility processing method based on the protocol version identification of the data frame, the parsing error problem caused by the data frame encapsulation differences between different operating systems is solved, and efficient compatibility and accuracy of data transmission is achieved.

CN119721004APending Publication Date: 2025-03-28GUANGZHOU KETENG INFORMATION TECH
View PDF 0 Cites 3 Cited by

Patent Information

Application Number
CN202411861231.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-17
Publication Date
2025-03-28

AI Technical Summary

Technical Problem

The difference in data frame encapsulation format between different operating systems leads to data frame parsing errors and communication failures, affecting the integrity and accuracy of data transmission.

Method used

When receiving the to-process data frame, the target resolution template is determined according to its protocol version identification, and the data frame is analyzed, dynamically matched the target resolution template to realize data analysis processing, and the compatibility processing method is determined based on the field difference information to feedback the data frames adapted to the target operating system.

Benefits of technology

It solves the problem of inaccurate and incomplete data frame resolution caused by the difference in data frame encapsulation of different operating systems, and improves the compatibility, accuracy and completeness of data transmission.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119721004A_ABST
    Figure CN119721004A_ABST
Patent Text Reader

Abstract

The invention discloses a cross-system data interaction method and device and electronic equipment. According to the specific scheme, when a to-be-processed data frame is received, a target analysis template corresponding to a protocol version identifier is determined according to the protocol version identifier of the to-be-processed data frame; performing analysis processing on the to-be-processed data frame based on the target analysis template to obtain field information of at least one target field corresponding to the to-be-processed data frame; field difference information is determined according to the field information of the at least one target field and preset field information, and the field difference information is used for representing corresponding field differences when the data frames are packaged between different operating systems; and determining a compatibility processing mode corresponding to the field difference information, and feeding back a target data frame corresponding to the to-be-processed data frame based on the compatibility processing mode. According to the invention, data communication among different operating systems is realized, the communication efficiency is ensured, and the stability and integrity of data transmission are also ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing technology, and in particular to a cross-system data interaction method, device and electronic equipment. Background Art

[0002] With the development of intelligent networks, the types and number of devices connected to the system are increasing. In the system, there may be devices with different operating systems deployed, and the communication between these devices affects the normal operation of the system.

[0003] When devices deployed with different operating systems communicate, data frame parsing errors or communication failures may occur due to differences in the data frame encapsulation formats corresponding to different operating systems, making it difficult to ensure the integrity and accuracy of data transmission. Summary of the invention

[0004] The present invention provides a cross-system data interaction method, device and electronic device, which realize data communication between different operating systems, and ensure both communication efficiency and data transmission stability and integrity.

[0005] According to one aspect of the present invention, a cross-system data interaction method is provided, the method comprising:

[0006] When receiving a data frame to be processed, determining a target parsing template corresponding to the protocol version identifier according to the protocol version identifier of the data frame to be processed;

[0007] Parsing the data frame to be processed based on the target parsing template to obtain field information of at least one target field corresponding to the data frame to be processed;

[0008] Determine field difference information according to field information of at least one target field and preset field information, wherein the field difference information is used to characterize the field difference corresponding to encapsulating data frames between different operating systems;

[0009] A compatibility processing method corresponding to the field difference information is determined, and a target data frame corresponding to the data frame to be processed is fed back based on the compatibility processing method.

[0010] According to another aspect of the present invention, a cross-system data interaction device is provided, the device comprising:

[0011] A parsing template determination module is used to determine a target parsing template corresponding to the protocol version identifier according to the protocol version identifier of the data frame to be processed when receiving the data frame to be processed;

[0012] A field information determination module, used to parse the data frame to be processed based on the target parsing template to obtain field information of at least one target field corresponding to the data frame to be processed;

[0013] A difference information determination module, used to determine field difference information according to field information of at least one target field and preset field information, wherein the field difference information is used to characterize the corresponding field difference when encapsulating data frames between different operating systems;

[0014] The data frame feedback module is used to determine the compatibility processing method corresponding to the field difference information, and to feed back the target data frame corresponding to the data frame to be processed based on the compatibility processing method.

[0015] According to another aspect of the present invention, there is provided an electronic device, the electronic device comprising:

[0016] at least one processor; and

[0017] a memory communicatively connected to at least one processor; wherein,

[0018] The memory stores a computer program that can be executed by at least one processor. The computer program is executed by at least one processor so that the at least one processor can execute the cross-system data interaction method of any embodiment of the present invention.

[0019] According to another aspect of the present invention, a computer-readable storage medium is provided, which stores computer instructions for enabling a processor to implement the cross-system data interaction method of any embodiment of the present invention when the computer instructions are executed.

[0020] According to another aspect of the present invention, a computer program product is provided, including a computer program, characterized in that when the computer program is executed by a processor, the computer program implements the cross-system data interaction method as in any embodiment of the present invention.

[0021] The technical solution of the embodiment of the present invention, when receiving a data frame to be processed, determines a target parsing template corresponding to the protocol version identifier according to the protocol version identifier of the data frame to be processed. And parses and processes the data frame to be processed through the target parsing template to obtain field information of at least one target field corresponding to the data frame to be processed. By dynamically matching the target parsing template, data parsing processing of the data frame to be processed is realized. According to the field information of at least one target field and the preset field information, the field difference information is determined. Based on this, the field difference between the operating system corresponding to the device sending the data frame to be processed and the operating system of the current device when encapsulating the data frame can be determined. By determining the compatibility processing method corresponding to the field difference information, the target data frame adapted to the corresponding operating system can be sent subsequently, which solves the problem of inaccurate and incomplete data frame parsing caused by the difference in data frame encapsulation of different operating systems, which not only improves the compatibility of data transmission, but also ensures the accuracy and integrity of data transmission.

[0022] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0024] Figure 1 is a flow chart of a cross-system data interaction method provided by an embodiment of the present invention;

[0025] Figure 2 is a flow chart of a cross-system data interaction method provided by an embodiment of the present invention;

[0026] Figure 3 It is a structural diagram of a cross-system data interaction device provided by an embodiment of the present invention;

[0027] Figure 4 It is a schematic diagram of the structure of an electronic device for implementing the cross-system data interaction method according to an embodiment of the present invention. DETAILED DESCRIPTION

[0028] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0029] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0030] Embodiment 1

[0031] Figure 1 This is a flow chart of a cross-system data interaction method provided by the first embodiment of the present invention. This embodiment is applicable to data communication between different operating systems. The method can be executed by a cross-system data interaction device. The cross-system data interaction device can be implemented in the form of hardware and / or software. The cross-system data interaction device can be configured in electronic devices such as mobile phones, computers or servers. Figure 1 As shown, the method includes:

[0032] S110. When receiving a data frame to be processed, determine a target parsing template corresponding to the protocol version identifier according to the protocol version identifier of the data frame to be processed.

[0033] The data frame to be processed may be a data frame currently received and determined based on an application layer protocol of an operating system different from the current operating system and used for data communication. The protocol version identifier may be used to characterize the version number of the specific application layer protocol followed by the data frame to be processed. The target parsing template may be a template for parsing each field in the data frame to be processed. The target parsing template may include at least one field parsing rule. The corresponding field may be parsed by the field parsing rule.

[0034] Specifically, when receiving a data frame to be processed, a protocol version identifier is obtained from the header of the data frame to be processed. The major version number and the minor version number of the application layer protocol followed by the data frame to be processed are determined according to the protocol version identifier. The target parsing template matching the major version number and the minor version number is determined from the corresponding parsing template library through the major version number and the minor version number, so as to parse and process the data frame to be processed through the target parsing template.

[0035] Exemplarily, a 2-byte protocol version identifier is read from the starting position of the 4th byte of the header of the data frame to be processed, and the major version number and the minor version number corresponding to the protocol version identifier are determined according to the rule that the high byte is the major version number and the low byte is the minor version number. According to the major version number and the minor version number of the data frame to be processed, the corresponding target parsing template is determined from the parsing template library, and the target parsing template is applied to parse the data frame to be processed.

[0036] For example, take the industrial field protocol as an example for explanation. The protocol version identifier of the data frame to be processed corresponding to the industrial field protocol is stored in a fixed position using a 2-byte encoding method. Read the 2-byte protocol version identifier 0x0402 from the starting position of the 4th byte of the header of the data frame to be processed. Among them, the high byte 0x04 represents the major version number, and the low byte 0x02 represents the minor version number. By parsing the two-byte protocol version identifier, it can be determined that the protocol version corresponding to the data frame to be processed is version 4.2. For example, if the protocol version identifier of the data frame to be processed is 0x0503, it means that the protocol version corresponding to the data frame to be processed is version 5.3.

[0037] In an embodiment of the present invention, the target parsing template is a template in at least one preset parsing template, and the method also includes determining at least one preset parsing template. The specific method may be: based on the field type and field length corresponding to multiple sample fields, determining multiple field parsing rules; based on at least one preset protocol version identifier, combining and processing the multiple field parsing rules to obtain a preset parsing template corresponding to each preset protocol version identifier, wherein the preset parsing template includes at least one field parsing rule.

[0038] The sample field may be a predetermined sample field used to set a field parsing rule. The sample field may include a plurality of field types and field lengths. The field parsing rule may be a field parsing method set according to the field type and field length of the sample field. The preset protocol version identifier may be a preset protocol version number corresponding to the application layer protocol. The preset parsing template may include at least one field parsing rule.

[0039] Specifically, the corresponding field parsing rules are set according to the field types and field lengths corresponding to the multiple sample fields. According to the field type of at least one field included in each preset protocol version identifier, multiple field parsing rules are combined and processed to obtain a preset parsing template corresponding to each preset protocol version identifier, and at least one field parsing rule is included in each preset parsing template.

[0040] It should be noted that the sample field may be a field extracted from a sample data frame. The sample data frame may be a data frame used for data communication and determined based on an application layer protocol of an operating system different from the current operating system.

[0041] In an embodiment of the present invention, the method also includes: if there is no target parsing template corresponding to the protocol version identifier, scanning the data frame to be processed to obtain the field flag corresponding to the data frame to be processed; determining at least one field to be processed corresponding to the data frame to be processed according to the field flag; performing feature extraction processing on at least one field to be processed based on a preset classification model to obtain multiple feature information corresponding to the field to be processed; clustering the multiple feature information to obtain the field type corresponding to the field to be processed; determining at least one field parsing rule to be used according to the field type and field length of the field to be processed; testing the parsing template to be verified that contains at least one field parsing rule to be used, and when the test result meets the preset conditions, using the parsing template to be verified as the target parsing template corresponding to the data frame to be processed.

[0042] Among them, the field flag bit can be a bit used to mark the field. For example, if the field flag bit is 0xFF and 0xFE, the data between 0xFF and 0xFE can be used as a field to be processed. The field to be processed can be a data field located between the field flag bits. The preset classification model can be used to perform structured feature extraction processing on each field to be processed. The feature information can be used to characterize the field features corresponding to the field to be processed. The field type is the field type of the field to be processed. The field length is the data length corresponding to each field to be processed. The field parsing rule to be used can be a rule for parsing the field to be processed. The parsing template to be verified includes at least one field parsing rule to be used. By testing the parsing template to be verified, the parsing accuracy of the parsing template to be verified can be determined. The parsing accuracy is the test result mentioned in this embodiment. The preset condition can be pre-set, and the test result reaches the preset test accuracy threshold. The preset test accuracy threshold can be understood as the standard value corresponding to the parsing accuracy.

[0043] Specifically, if there is no target parsing template corresponding to the protocol version identifier, the data frame to be processed can be scanned and processed based on the preset window size, and the field flag bit can be detected by the feature byte identifier. And the data between the field flag bits is confirmed as a single field to be processed. According to the above method, at least one field to be processed corresponding to the data frame to be processed is obtained. Feature extraction processing is performed on at least one field to be processed according to the preset classification model to obtain multiple feature information corresponding to the field to be processed. Multiple feature information are clustered to determine the field type corresponding to the field to be processed. According to the field type and the field length of the field to be processed, at least one field parsing rule to be used is set. According to at least one field parsing rule, the parsing template to be verified is determined. The parsing template to be verified is tested based on the sample data frame to obtain a test result. When the test result reaches the preset test accuracy threshold, the parsing template to be verified is used as the target parsing template for the data frame to be processed.

[0044] Exemplarily, the preset classification model is a random forest classification model as an example for explanation. If there is no target parsing template corresponding to the protocol version identifier, the protocol version identifier is recorded, and a target parsing template corresponding to the protocol version identifier is generated. That is, the field boundary of the data frame to be processed is identified in a fixed window scanning manner. The fixed window can be set to 32 bytes. The data frame to be processed is scanned and processed with a fixed window size of 32 bytes, that is, the fixed window is used to slide and identify byte by byte in the data frame to be processed, and the field flag of the data frame to be processed is detected by a feature byte identifier. The data between the field flags is treated as a single field to be processed. For example, in industrial protocols, the field flags are usually 0xFF and 0xFE. For example, the data frame to be processed uploaded by the temperature sensor is 0xFF0x1234560xFE, where 0x123456 represents the field to be processed, 0xFF is the field flag at the start position of the field, and 0xFE is the field flag at the end position of the field.

[0045] Perform field completion and alignment processing on at least one field to be processed to obtain a complete field to be processed. And store at least one field to be processed in a temporary buffer. Read at least one field to be processed from the temporary buffer, and perform structured feature extraction processing on each field to be processed through a random forest classification model to obtain a numerical feature vector and a string feature vector corresponding to the field to be processed. Among them, the numerical feature vector includes a feature vector corresponding to the byte length, a feature vector corresponding to the value range, and a feature vector corresponding to the numerical distribution. The string feature vector includes a feature vector corresponding to the character set type and a feature vector corresponding to the encoding format. Based on the numerical feature vector and the string feature vector, cluster processing is performed on at least one field to be processed to obtain field attribute information such as the field type, data format, and value range corresponding to the field to be processed. For example, the feature vector of the field to be processed corresponding to the temperature shows that the field length of the field to be processed is 4 bytes, the value range is between 0 and 100, and the data format is a single-precision floating point number. After being processed by the random forest classification model, it is determined to be an analog type field.

[0046] Based on the field attribute information such as the field type, data format and value range corresponding to the field to be processed, the corresponding parsing method is determined. The position, field type and parsing method of the field to be processed are described in a standard format to generate at least one field parsing rule to be used. Among them, the field parsing rule to be used includes information such as the protocol version identifier, the number of fields that can be parsed, the field position, the field type and the parsing function. For example, the field parsing rule to be used for the field to be processed corresponding to the temperature may include information such as a starting position offset of 4 bytes, a field length of 4 bytes, a data type of a single-precision floating point number, and a parsing function of a floating point decoder. The parsing template to be verified containing at least one field parsing rule to be used is tested by randomly extracting a sample data frame to obtain the parsing accuracy. When the parsing accuracy exceeds 0.95, the parsing template to be verified is used as the target parsing template, and the protocol version identifier and the target parsing template corresponding to the protocol version identifier are stored in the parsing template library.

[0047] In actual application scenarios, the equipment protocols at industrial sites are diverse, and the corresponding protocol formats are also quite different. The generation method of the above parsing template can automatically adapt to the new version of the protocol. For example, if a new temperature and humidity sensor is currently connected, the sensor uses the 6.0 version protocol, and the data frame structure is different from the original device. By automatically analyzing the data frame structure characteristics, identifying the location and type of the temperature and humidity fields, and generating a new target parsing template, there is no need to manually write parsing code. Verification of the target parsing template ensures the reliability of the parsing process and avoids data distortion caused by parsing errors.

[0048] S120 , parsing the data frame to be processed based on the target parsing template to obtain field information of at least one target field corresponding to the data frame to be processed.

[0049] The at least one target field can be understood as a data field contained in the data frame to be processed, and the field information can be understood as field content information.

[0050] Specifically, the data frame to be processed is scanned and processed to determine at least one target field corresponding to the data frame to be processed. Each target field is parsed and processed according to at least one field parsing rule included in the target parsing template to determine the field information of each target field. For example, the target field may be a time field. The target field is parsed and processed according to the field parsing rule in the target parsing template, and the 8-byte time field can be converted into field information of year, month, day, hour, minute, and second.

[0051] It should be noted that, in order to ensure the integrity and accuracy of the field information, after determining the field information of the target field, the data verification method in the field parsing rule can be used to perform integrity data verification processing on the field information. For example, the field information of all target fields can be processed using a cyclic redundancy check algorithm to obtain a check value. The check value is compared with the standard check value carried in the data frame to be processed. If the check values ​​are the same, it means that the data frame to be processed is parsed correctly.

[0052] Exemplarily, the data frame to be processed may be stored in the original data area. The data frame to be processed is processed by a byte stream encoder to determine a field offset and a field length corresponding to the data frame to be processed. According to the field offset and the field length, at least one target field corresponding to the data frame to be processed is determined. At least one field parsing rule in the target parsing template is used to parse the at least one target field to obtain field information corresponding to each target field.

[0053] For example, the protocol version identifier is obtained according to the starting position of the 8th byte of the header of the data frame to be processed. If the protocol version identifier matches the protocol version identifier in the preset protocol mapping table, the corresponding parser is matched according to the protocol version identifier. If the parser is matched, the preset format definition corresponding to the data frame to be processed is loaded from the parser warehouse. If the parser is not matched, the log information is recorded and the parsing process of the data frame to be processed is terminated. In actual application scenarios, control equipment on industrial sites usually uses a dedicated communication protocol to transmit data. The device protocol versions are different. Some use old versions of the protocol such as 3.0, and some use new versions such as 5.2. By dynamically selecting the corresponding version of the parser, the compatibility with the old version of the protocol is guaranteed, and the enhanced functions provided by the new version of the protocol can be fully utilized. The starting position of the target field corresponding to the data frame to be processed is located by the field starting position specified in the preset format definition, and the position of the entire target field is determined according to the field offset. Among them, the field offset can be counted from zero in bytes. For example, if the field offset of the first target field in the data frame to be processed is 16, it means that the first target field is located at the 16th byte of the data frame to be processed, and the field length is 4 bytes. The byte stream encoder is used to read the field length of each target field, and the field boundary of the target field is calculated through the fixed format specification. Based on this, at least one target field corresponding to the data frame to be processed is obtained.

[0054] For at least one target field, a linear scan process is performed on at least one target field according to a field feature rule set. That is, target fields of different field types use different parsing methods. For numerical fields, a numerical decoder is used for parsing. For example, the 4-byte hexadecimal value 0x00000100 is converted into a decimal value 256 by a numerical decoder. For character fields, a string decoder is used for parsing. That is, the character field is converted into a readable string according to a specified character set. For complex fields or special fields, a naive Bayes classifier is used to identify the field type. According to the identified field type, the target field is parsed according to at least one field parsing rule in the target parsing template to obtain field information corresponding to each target field. It should be noted that field parsing rules corresponding to various field types are stored in the parsing rule library. Field information can be extracted from the target field through the field parsing rules.

[0055] S130. Determine field difference information according to field information of at least one target field and preset field information, wherein the field difference information is used to characterize corresponding field differences when encapsulating data frames between different operating systems.

[0056] The preset field information can be understood as the field format information and field content information of each field corresponding to the current operating system when encapsulating the data frame. The field format information may include field length information, field position information, etc. The field difference information may include field position difference information, field length difference information, and field content difference information.

[0057] Specifically, field difference information between the operating system sending the data frame to be processed and the current operating system is determined according to the received field information of at least one target field and the preset field information corresponding to the current operating system when encapsulating the data frame.

[0058] Exemplarily, the platform corresponding to the operating system that sends the data frame to be processed is the data sending platform, and the platform on which the current operating system is deployed is the data receiving platform. According to the field information of at least one target field and the preset field information of the data receiving platform, the field characteristics between the data sending platform and the data receiving platform are determined. According to the field characteristics, the field differences between the data sending platform and the data receiving platform are compared to obtain field difference information.

[0059] S140: Determine a compatibility processing method corresponding to the field difference information, and feed back a target data frame corresponding to the data frame to be processed based on the compatibility processing method.

[0060] Among them, the compatibility processing method can be understood as a compatibility processing method for data communication between the operating system that sends the data frame to be processed and the current operating system. Optionally, the compatibility processing method can be understood as a field conversion method when sending data frames between different operating systems. The compatibility processing method can be composed of at least one conversion function. The fields in the data frame to be sent are converted and processed by the compatibility processing method to obtain a target data frame adapted to the corresponding operating system. The target data frame can be a data frame adapted to the corresponding operating system.

[0061] Specifically, the corresponding compatibility processing method can be retrieved from the compatible processing library according to the field position difference information, the field length difference information, and the field content difference information in the field difference information. Through at least one conversion function corresponding to the compatibility processing method, the field in the to-be-transmitted data frame corresponding to the to-be-processed data frame is converted and processed to obtain a target data frame adapted to the operating system that sends the to-be-processed data frame.

[0062] It should be noted that the compatibility processing method can be encapsulated as a universal conversion interface so that when data frames are transmitted across systems, the adaptation layer detects the system characteristics between the current operating system and the operating system to which the data frames are to be sent, and dynamically adjusts and converts the fields in the data frames to be sent through the compatibility processing method to obtain a target data frame that is adapted to the corresponding operating system.

[0063] In an embodiment of the present invention, a method for determining a target data frame may be: determining a field conversion flag and field conversion content information based on field position difference information, field length difference information, and field content difference information in the field difference information; determining a conversion function based on the field conversion flag and the field conversion content information, so that when a data frame to be sent corresponding to a data frame to be processed is fed back, field conversion and field reorganization processing are performed on the data frame to be sent according to the conversion function to obtain a target data frame, and the target data frame is sent.

[0064] Among them, the field position difference information can be understood as the difference information of the field position when the current operating system and the operating system that sends the data frame to be processed are encapsulated. The field length difference information can be understood as the difference information of the field length when the current operating system and the operating system that sends the data frame to be processed are encapsulated. The field content difference information can be understood as the difference information of the field content when the current operating system and the operating system that sends the data frame to be processed are encapsulated. The field conversion flag can be used to identify the position of the field to be converted. The field conversion content information can be understood as the content information of the field to be converted. The conversion function can be a function for converting the field. The data frame to be sent can be understood as the data frame to be sent to the corresponding operating system. The corresponding operating system can be the operating system that sends the data frame to be processed. The field conversion and field reorganization processing can be to convert and reorganize the fields in the data frame to be sent to obtain a target data frame adapted to the corresponding operating system.

[0065] Specifically, the field conversion flag and the field conversion content information are determined according to the field position difference information, the field length difference information, and the field content difference information in the field difference information. The corresponding conversion function is called according to the field conversion flag and the field conversion content information, so that when a data frame to be sent corresponding to the data frame to be processed is fed back, field conversion and field reorganization processing are performed on the fields in the data frame to be sent according to the conversion function to obtain a target data frame adapted to the corresponding operating system.

[0066] Exemplarily, in combination with the above example, the end sequence difference of the field difference is taken as an example for explanation. The header identifier of the data frame to be processed in the source data area is obtained, and the byte sequence characteristics between the data sending platform that sends the data frame to be processed and the data receiving platform that receives the data frame to be processed are determined according to the header identifier and the platform mapping table. The end sequence difference between the data sending platform and the data receiving platform is compared according to the byte sequence characteristics. The byte sequence conversion list is used to record the field start bit, field length information and field conversion flag. According to the field length information and field conversion flag information, the numerical field in the data frame to be sent is reorganized by the floating point decoder, and the infinite and non-numerical fields in the data frame to be sent are identified by the naive Bayes classifier, and the infinite and non-numerical fields are processed to obtain the reorganized field. The checksum of the reorganized field is calculated by using the cyclic redundancy check, and the reorganized field is encapsulated according to the data frame encapsulation format of the data receiving platform to obtain the target data frame. And the target data frame is written into the target data area.

[0067] For example, the field information of at least one target field is read from the source data area to determine the platform identification value of the 8-byte header of the data frame to be processed. When the data frame is transmitted across systems, the platform identification value can be represented by a specific byte sequence, for example, 0xFFFE represents a little endian platform, and 0xFEFF represents a big endian platform. The byte order characteristics between the data sending platform and the data receiving platform are obtained according to the platform identification value mapping table. The byte order difference between the data sending platform and the data receiving platform is compared in the endian position to obtain the field difference information. For example, taking the 32-bit integer 0x12345678 as an example, it is stored as 12-34-56-78 in the big endian platform according to the high to low byte order, and is stored as 78-56-34-12 in the little endian platform according to the low to high byte order. The field difference information can be determined by the order in which the bytes are stored. The field difference information is recorded in the byte order conversion list according to the field position. Among them, the record content includes the field starting position information, the field length information and the conversion flag bit. According to the field type corresponding to at least one target field and the field type included when the data receiving platform sends the data frame, the field type definition of the data sending platform and the data receiving platform is read from the data type library. And the storage boundary requirements of each field type in the memory are calculated. Among them, the storage boundary requirements include the starting position alignment value and the number of padding bytes. For example, the memory alignment method is related to the data type. 32-bit platforms usually require data storage addresses to be aligned according to 4 bytes, while 64-bit platforms require 8-byte alignment. Taking structure data as an example, it contains a 1-byte character field and a 4-byte integer field. In the 32-bit platform, 3 bytes need to be filled after the character field to achieve 4-byte alignment, while in the 64-bit platform, 7 bytes need to be filled to achieve 8-byte alignment. The value of the padding byte is uniformly set to 0x00.

[0068] During the field conversion process, the problem of precision loss needs to be dealt with. For floating-point and integer fields, the difference between numerical precision and field length is recorded, and the boundary information and type characteristics of the field are recorded using a bidirectional queue. The field type is matched using the type characteristic matrix. The field to be converted is obtained from the bidirectional queue, and the field is reorganized according to the byte order conversion table. The integer field uses the displacement method to adjust the byte order. The floating-point field is converted into a numerical format through a floating-point decoder, and a naive Bayes classifier is used to identify special values ​​and perform corresponding conversions. Among them, special values ​​can include infinity, non-numeric values, and undefined values. The converted field value is written to the target buffer, and the alignment byte 0x00 is filled between each field. For example, for the floating-point field, the effective digits of a 32-bit single-precision floating point number are 6 digits, and the effective digits of a 64-bit double-precision floating point number are 15 digits. When the double-precision floating point number 3.14159265359 is converted to single precision, only 3.141593 is retained, and the excess precision is truncated.

[0069] The converted fields are read from the target buffer area, and the fields before and after the conversion are checked using a cyclic redundancy check to obtain a 16-bit data checksum. The accuracy of the converted fields is determined based on the data checksum. If the data checksums are the same, it means that no data error occurred during the data conversion process. The converted fields are repackaged according to the data frame format of the data sending platform, and the data sending platform identification value is written into the data frame header to obtain the target data frame. The target data frame is stored in the target data area to send the target data frame to the data sending platform. The above method also includes: recording data accuracy loss information during the field conversion and field reorganization process.

[0070] In actual application, there are differences in the representation of fields on platforms corresponding to different operating systems. Through the above field conversion processing, cross-platform transmission of data frames can be realized. Data frame format conversion is widely used in the field of Internet of Things. For example, the smart home gateway needs to process data from different devices. The temperature sensor uses an 8-bit single-chip platform and the data is stored in big-endian order, while the gateway uses a 32-bit processor and the data is stored in little-endian order. The accuracy of data transmission is ensured by dynamically identifying the data source and performing corresponding conversion. In the process of data type conversion, the precision loss is recorded and controlled to ensure that the converted data meets the application requirements. In the process of cross-platform transmission, byte order conversion and type mapping are the key links to ensure data correctness. Through standardized conversion processes and strict data verification, data interoperability between different platforms is ensured. For the processing of special values ​​and boundary conditions, the above identification and conversion mechanism is adopted to improve the robustness of data processing.

[0071] The technical solution of this embodiment, when receiving the data frame to be processed, determines the target parsing template corresponding to the protocol version identifier according to the protocol version identifier of the data frame to be processed. And parses the data frame to be processed through the target parsing template to obtain the field information of at least one target field corresponding to the data frame to be processed. By dynamically matching the target parsing template, data parsing processing of the data frame to be processed is realized. According to the field information of at least one target field and the preset field information, the field difference information is determined. Based on this, the field difference between the operating system corresponding to the device sending the data frame to be processed and the operating system of the current device when encapsulating the data frame can be determined. By determining the compatibility processing method corresponding to the field difference information, the target data frame adapted to the corresponding operating system can be sent subsequently, which solves the problem of inaccurate and incomplete data frame parsing caused by the difference in data frame encapsulation of different operating systems, which not only improves the compatibility of data transmission, but also ensures the accuracy and integrity of data transmission.

[0072] Embodiment 2

[0073] Figure 2 1 is a flow chart of a cross-system data interaction method provided by Embodiment 2 of the present invention. This embodiment is a preferred embodiment of the above embodiment. The specific implementation method can refer to the technical solution of this embodiment. Among them, the technical terms that are the same or corresponding to the above embodiment are not repeated here. Figure 2 As shown, the method includes:

[0074] S210: If at least two data frames to be processed are received, and the at least two data frames to be processed correspond to at least two protocol version identifiers, determine a target protocol version identifier based on version times corresponding to the at least two protocol version identifiers.

[0075] Among them, the protocol version identifier can be used to characterize the version number of the specific application layer protocol followed by the data frame to be processed. For different data frames to be processed, the corresponding protocol version identifiers are different. The version time can be understood as the time corresponding to the protocol version. The target protocol version identifier can be a protocol version identifier determined from at least two protocol version identifiers. Optionally, the target protocol version identifier can be a protocol version identifier corresponding to the latest version time.

[0076] Specifically, if at least two data frames to be processed are received, and the at least two data frames to be processed correspond to at least two protocol version identifiers, according to the version time of the at least two protocol version identifier pairs, the protocol version identifier corresponding to the latest version time is determined as the target version identifier, so as to perform protocol conversion processing on the data frames to be processed based on the target version identifier.

[0077] S220: Based on the target protocol version identifier and the preset conversion script, perform version conversion processing on at least one to-be-processed data frame that is not the target protocol version identifier, obtain the converted to-be-processed data frame, and determine the target parsing template corresponding to the target protocol version identifier.

[0078] The preset conversion script can be understood as converting the to-be-processed data frame that is not the target protocol identifier into a data frame corresponding to the target protocol version identifier. The converted to-be-processed data frame is the data frame corresponding to the target protocol version identifier.

[0079] Specifically, according to the target protocol version identifier, a preset conversion script corresponding to the target protocol version identifier is called, and based on the preset conversion script, version conversion processing is performed on at least one data frame to be processed that is not the target protocol version identifier to obtain a converted data frame to be processed, and the converted data frame to be processed is parsed and processed by the target parsing template corresponding to the target protocol version identifier.

[0080] Exemplarily, the data structure definition files corresponding to the to-be-processed data frames with different protocol version identifiers are compared to determine the field differences in the to-be-processed data frames due to different versions. According to the field differences, a corresponding preset conversion script is generated or called, and the preset conversion script is integrated into the protocol parsing engine, so that when the to-be-processed data frames corresponding to different protocol version identifiers are received, the corresponding preset conversion script is called by the parsing engine to implement version conversion processing of the to-be-processed data frames corresponding to different protocol version identifiers.

[0081] In an embodiment of the present invention, a method for obtaining the converted data frame to be processed may be: determining data difference information according to the data frame to be processed corresponding to the target protocol version identifier and at least one data frame to be processed that is not identified by the target protocol version, wherein the data difference information is used to characterize the field difference in the data frames corresponding to different protocol version identifiers, and the data difference information includes: at least one of field name difference information, field type difference information, field length difference information and field position difference information; based on the data difference information, performing field conversion processing on the fields in at least one data frame to be processed that is not identified by the target protocol version using a preset conversion script to obtain a field conversion result corresponding to each data frame to be processed; performing cyclic redundancy check processing on the field conversion result, and when the cyclic redundancy check result is a pass, obtaining the converted data frame to be processed based on the field conversion result.

[0082] Among them, the data difference information can be used to characterize the field difference information of the data frame to be processed corresponding to different protocol version identifiers. The data difference information includes: at least one of field name difference information, field type difference information, field length difference information and field position difference information. The field name difference information can be understood as the information that the field names in the encapsulated data frame to be processed are different due to different protocol version identifiers. The field type difference information can be understood as the information that the field types in the encapsulated data frame to be processed are different due to different protocol version identifiers. The field length difference information can be understood as the information that the field lengths in the encapsulated data frame to be processed are different due to different protocol version identifiers. The field position difference information can be understood as the information that the field positions in the encapsulated data frame to be processed are different due to different protocol version identifiers. The field conversion result can be the result of converting the field in the data frame to be processed that is not the target protocol version identifier into the field corresponding to the target version protocol identifier. The cyclic redundancy check processing can be used to verify the accuracy of the field conversion result.

[0083] Specifically, according to the to-be-processed data frame corresponding to the target protocol version identifier and at least one to-be-processed data frame whose protocol version identifier is not the target protocol version identifier, the data difference information between the to-be-processed data frames corresponding to different protocol version identifiers is determined. The data difference information includes at least one of field name difference information, field type difference information, field length difference information and field position difference information. According to the data difference information, a preset conversion script is used to perform field conversion processing on the fields in the to-be-processed data frame that is not the target protocol version identifier to obtain the converted fields, that is, the field conversion result. A cyclic redundancy check is performed on the field conversion result to verify the accuracy of the field conversion. When the cyclic redundancy check result is a pass, the converted to-be-processed data frame is determined according to the field conversion result.

[0084] Exemplarily, the corresponding preset conversion script is retrieved according to the protocol version identifier in the data frame to be processed, and at least one data frame to be processed is loaded into the script runner to perform conversion processing to obtain a field conversion result. A cyclic redundancy check is performed on the field conversion result. If the cyclic redundancy check result is a pass, the converted data frame to be processed is obtained based on the field conversion result. If the cyclic redundancy check result is a fail, an error message is recorded and an exception handling process is started.

[0085] Optionally, the method further includes: generating a preset conversion script. Reading the data structure files corresponding to the target protocol version identifier and other protocol version identifiers from the structure definition storage area. Obtaining the structure description blocks corresponding to different protocol version identifiers through a standardized parser. The structure description blocks contain field names, field types, field lengths, and field positions corresponding to different protocol version identifiers. According to the structure description blocks, a field feature comparer is used to compare the field names, field types, field lengths, and field positions corresponding to different protocol version identifiers one by one, obtain data difference information, and record it in a difference record table. Marking four types of change records of field extension, field segmentation, field merging, and field rearrangement from the difference record table, and performing integrity verification on the change records to generate a verification report. When the verification report shows that the verification is passed, a list of changed fields is obtained according to the change record. After comparing the similarity of the field names using a string matcher, a mapping relationship of field conversion is obtained according to a preset naming rule. A random forest classifier is used to determine the specific type of field change, and a field length check, a data type compatibility check, and a value range check are performed on the mapping relationship of the field conversion, and the mapping relationship of the field conversion is set as a field conversion rule to generate a conversion instruction in a standard format through the field conversion rule. The above conversion instructions include field read instructions, data conversion instructions and boundary filling instructions. The integrity and legality of the conversion instructions can be detected by an instruction verifier, and the verified conversion instructions can be encapsulated into a preset conversion script, and a data integrity verification code can be embedded in the script.

[0086] For example, let's take the industrial control protocol as an example. The temperature acquisition structure of version 1.0 contains 3 fields, the temperature value occupies 4 bytes, the acquisition timestamp occupies 4 bytes, and the device number occupies 8 bytes. Version 2.0 expands the structure, the temperature value field is split into 2 bytes for the integer part and 2 bytes for the decimal part, the timestamp field remains unchanged, the device number field is expanded to 16 bytes, and a 2-byte status identification field is added. From the above, it can be seen that the change of the temperature value field belongs to the field segmentation type, the original field is divided into two new fields, the data type is converted from a floating point number to an integer, the change of the device number field belongs to the field extension type, the field length increases but the data type remains unchanged, and the status identification field belongs to the new type.

[0087] The similarity of the field names of the above two versions is calculated by the edit distance algorithm. When the similarity exceeds 0.8, they are different versions of the same field. The generation of conversion instructions is based on standardized templates. For the field segmentation type, the conversion instructions include: reading the original temperature value, converting the original temperature value into an integer value and a decimal value, and storing two new fields respectively. For the field extension type, the generated instructions include reading the original device number, right-filling the original device number with blank characters, and writing to the new field. Each conversion instruction contains an opcode and an operand. The opcode indicates a specific operation, such as reading, converting, or storing. The operand contains parameters such as field position and length.

[0088] In actual application, different devices use different versions of the protocol. The above preset conversion scripts realize dynamic conversion of data formats. For example, taking temperature acquisition as an example, the old device uses version 1.0 of the protocol when transmitting data frames. The temperature value 23.5 is stored as a 4-byte floating point number 0x41BC0000. The new device uses version 2.0 of the protocol when transmitting data frames. The same temperature value is stored as the integer part 0x0017 and the decimal part 0x0032. Through the preset conversion script, the data frame corresponding to version 1.0 of the protocol is converted into a data frame adapted to version 2.0 of the protocol.

[0089] Data integrity verification uses a multiple verification mechanism, including field verification at the structural level and content verification at the data level. Each field has predefined value rules. For example, the valid range of temperature values ​​is between -40 and 85 degrees, and data outside the range will be marked as abnormal. Cyclic redundancy check is performed on the field conversion results, and the checksums are calculated for the fields before and after the conversion, and the checksums are compared to ensure the accuracy of the field conversion. When a verification failure occurs, the exception handling process will record detailed error information, including the failed field, error type, original value, and conversion value, to facilitate problem location and subsequent repair.

[0090] S230 , parsing the data frame to be processed based on the target parsing template to obtain field information of at least one target field corresponding to the data frame to be processed.

[0091] In an embodiment of the present invention, a method for determining the field information of the target field may be: scanning the data frame to be processed to determine at least one target field corresponding to the data frame to be processed; parsing at least one target field based on the field parsing rules in the target parsing template to obtain the field information to be processed corresponding to each target field; performing data integrity verification on at least one field information to be processed to obtain a verification result; when the verification result is passed, using at least one field information to be processed as the field information of at least one target field corresponding to the data frame to be processed.

[0092] The target field can be understood as the field corresponding to the data frame to be processed. The field parsing rule can be used to parse the field to obtain the content corresponding to the field. The field information to be processed can be understood as the field content information obtained after parsing the target field. The data integrity check process can be used to check the field integrity of the received data frame to be processed. The check result is the result of the integrity check.

[0093] Specifically, the data frame to be processed is scanned and processed to determine at least one target field corresponding to the data frame to be processed. Each target field is parsed and processed according to the field parsing rule in the target parsing template to obtain the field information to be processed corresponding to each target field. Data integrity check is performed on each field to be processed corresponding to the data frame to be processed to obtain a check result. If the check result is that the check passes, it means that the received data frame to be processed is complete, and the at least one field information to be processed is used as the field information of at least one target field corresponding to the data frame to be processed.

[0094] Exemplarily, a data frame to be processed is read from the original data area, and a target parsing template including a field identification number and a parsing function list is obtained through a byte stream encoder. According to the preset field offset and preset field length specified in the parsing function list, the data frame to be processed is segmented to obtain at least one target field. For each target field, the corresponding parsing function is called to parse the target field to obtain the field information to be processed corresponding to each target field. The parsed target field is marked, and the field information to be processed and the field identification number are stored in the parsing data area in correspondence.

[0095] According to the field identification number of the resolved target field, obtain the corresponding preset field length, preset field type, value range and other information from the metadata table. Based on the above information, use the data verifier to check the fields to be processed of the resolved field one by one. Determine the type matching degree according to the preset field type of the target field. Verify the data integrity of the field information to be processed through cyclic redundancy check processing. Record the field identification number that fails the data integrity in the resolved data area, that is, record the target field with the verification result as failed.

[0096] Optionally, if the check result is failed, a retransmission request is generated based on the check result and at least one target field, so that a retransmitted data frame is received based on the retransmission request; the retransmitted data frame is parsed and processed to obtain field information of at least one retransmission field; the field information of the target field is updated based on the field information of at least one retransmission field, and data integrity check is performed on the updated field information, so that when the check result is passed, the field information of at least one target field corresponding to the data frame to be processed is obtained.

[0097] The retransmission request may include information such as the field identification number of the target field to be retransmitted, the data frame identification number corresponding to the data frame to be processed, etc. The retransmitted data frame may be a received data frame of the retransmitted target field. The retransmission field may be understood as a field in the retransmitted data frame.

[0098] Specifically, when the check result of the data integrity check is not passed, a retransmission request is generated according to the check result and at least one target field that has not passed the check, so as to receive a retransmitted data frame based on the retransmission request. The retransmitted data frame is parsed to obtain field information of at least one retransmission field corresponding to the retransmitted data frame. The field information of the target field is updated according to the field information of at least one retransmission field. Data integrity check is performed on the field information of the updated target field to obtain a check result. When the check result is passed, the field information of the updated target field is used as the field information of at least one target field corresponding to the data frame to be processed.

[0099] Exemplarily, a retransmission request is generated according to the target field whose verification result is not passed. The retransmission request may include a transmission sequence number, a data frame identification number of the data frame to be processed, and a field identification number of the target field that is not passed. The retransmission process is controlled by a sliding window retransmission mechanism, and the retransmission counter is set to limit the maximum number of retransmissions to 32. When the number of retransmissions reaches the maximum number of retransmissions, a transmission failure log is recorded. When a retransmission response corresponding to the retransmission request is received, the retransmission data frame is recorded in the response data area. And the integrity and accuracy of the retransmitted data frame are verified by a data verifier. If the verification of the retransmitted data frame passes, the field corresponding to the target field that fails the verification in the data frame to be processed is replaced by the retransmission field in the retransmitted data frame. And the field parsing and field verification processing are re-performed on the replaced data frame to be processed, and the data frame to be processed that passes the field verification is recorded in the integrity verification table. Correspondingly, if the data frame to be processed fails the field verification, the data frame to be processed is marked as an abnormal state.

[0100] For example, the data frame to be processed is parsed and processed by the corresponding target parsing template. The target parsing template defines the specific location and processing method of each field in the data frame to be processed. Take the data frame to be processed corresponding to the temperature sensor as an example for explanation. The target parsing template may include the temperature field identification number 0x01, the field offset 8 bytes, the field length 4 bytes, and the parsing function is a floating point decoder, the humidity field identification number 0x02, the offset 12 bytes, the length 4 bytes, and the parsing function is an integer decoder. The target parsing template can accurately locate and extract the field information to be processed of each target field in the data frame to be processed. When the data integrity check is performed on the field information to be processed, the metadata table storing the standard attributes of the field can be used for verification. For example, taking the target field as the temperature field as an example, in the metadata table, the field standard attributes corresponding to the temperature field are preset field length of 4 bytes, field type of 32-bit floating point number, and value range between -40 and 85 degrees. The data verifier verifies the field information to be processed. If it is detected that the actual field length corresponding to the temperature field is 2 bytes, or the field type is not a 32-bit floating point number, or the value in the field information is not between -40 and 85 degrees, the temperature field is marked as needing to be retransmitted. A 16-bit polynomial is used to perform a cyclic redundancy check on the field information to be processed of each target field to obtain a check value, i.e., the check result. The target field that does not meet the preset check value is also retransmitted.

[0101] The data frame retransmission mechanism can be controlled by a preset sliding window. The preset sliding window can send 16 data frames at a time. The sender maintains a sending window and the receiver maintains a receiving window. Each data frame has a unique transmission sequence number. The sequence number of the data frame to be processed uploaded by the temperature sensor increases from 1. When the temperature field is found to be abnormal, a retransmission request containing the transmission sequence number and the temperature field identification number is generated. After receiving the retransmission request, the sender resends the temperature field content in the data frame to be processed with the corresponding sequence number, that is, sends the retransmitted data frame. The processing of retransmitted data adopts a field-level replacement method. Taking the temperature data anomaly as an example, the retransmitted data frame contains the correct temperature value. After the data verifier verifies that the retransmitted temperature value meets the field standard attributes specified in the metadata table, it directly replaces the temperature field that failed the verification in the data frame to be processed, and marks that the target field has been replaced, without replacing other normal fields.

[0102] Optionally, the verification results of each target field in each data frame to be processed can be recorded in the integrity verification table. If the verification results of all target fields in the current data frame to be processed are passed, the data frame to be processed is marked as a complete data frame. If there is a target field in the data frame to be processed whose verification result is not passed, the data frame to be processed is marked as an incomplete data frame.

[0103] In actual industrial field applications, the transmission of data frames is susceptible to electromagnetic interference, resulting in the destruction of field information in the data frame to be processed. Through the above-mentioned field information verification processing and retransmission mechanism, the target field that fails the verification can be accurately located and retransmitted without retransmitting the entire data frame to be processed, thereby improving the efficiency of data recovery. Multiple verification methods can be used for data integrity verification processing, such as field length verification, field type matching, value range checking, and checksum calculation, to ensure the integrity and accuracy of the updated data frame to be processed.

[0104] S240. Determine field difference information according to field information of at least one target field and preset field information, wherein the field difference information is used to characterize corresponding field differences when encapsulating data frames between different operating systems.

[0105] S250: Determine a compatibility processing method corresponding to the field difference information, and feed back a target data frame corresponding to the data frame to be processed based on the compatibility processing method.

[0106] Exemplarily, in combination with the above example, the data sending platform identification code corresponding to the data sending platform that sends the data frame to be processed and the data receiving platform identification code of the data receiving platform that receives the data frame to be processed are determined according to the field information of at least one target field. The platform feature record is obtained through the data sending platform identification code and the data receiving platform identification code. The data sending platform feature parameters and the data receiving platform feature parameters in the platform feature record are compared according to the preset feature comparison table, and the field difference information is determined according to the comparison result. The conversion function call sequence is obtained from the compatible processing library according to the field difference information. The conversion function combination is called from the compatible processing library according to the conversion function call sequence, that is, the compatibility processing method is determined. An adaptation interface file is generated according to the conversion function combination. The data signature is calculated for the adaptation interface file. The data frame to be sent is converted and processed according to the conversion function combination in the adaptation interface file to obtain a conversion result. The conversion result is verified by checking and verifying, and when the check passes, the target data frame is determined based on the conversion result.

[0107] For example, the 4-byte identification value of the header of the data frame to be processed is determined by a standard feature reader. For example, in the first four bytes of the header of the data frame to be processed, the first two bytes represent the data sending platform identification, and the last two bytes represent the data receiving byte identification. For example, 0x0001 represents an 8-bit single-chip microcomputer platform, 0x0002 represents a 32-bit embedded platform, and 0x0003 represents a 64-bit general-purpose processor platform. By parsing these 4 bytes, the transmission direction of the data frame to be processed can be determined.

[0108] According to the identification coding specification, the identification value is parsed to obtain the data sending platform identification code and the data receiving platform identification code. The platform feature record corresponding to the data sending platform identification code and the platform feature record corresponding to the data receiving platform identification code are obtained through the platform feature table. Among them, the platform feature record includes information such as data bit width, byte order type, and boundary alignment value. For example, the 8-bit single-chip platform feature record shows: the data bit width is 8 bits, the big endian byte order is used, and there is no alignment requirement, while the 32-bit embedded platform feature record shows: the data bit width is 32 bits, the little endian byte order is used, and 4 bytes are aligned. The platform feature record is verified and processed to obtain the verification result, so as to determine the integrity of the platform feature record through the verification result. The data sending platform feature parameters and the data receiving platform feature parameters are obtained from the platform feature record. The data sending platform feature parameters and the data receiving platform feature parameters are compared and processed using the preset feature comparison table to generate field difference information. Among them, the field difference information includes information such as field conversion mark, field type conversion mark, and field boundary alignment mark.

[0109] The corresponding conversion function combination is obtained from the compatible processing library through the field difference information. The execution priority and dependency of the conversion function are determined according to the conversion function combination. According to the execution priority and dependency, a function call sequence is generated. According to the function call sequence, a specific conversion function, that is, a compatibility processing method, is extracted from the compatibility processing library. The conversion function includes a byte order conversion function, a field type mapping function, and a field alignment supplement function. Among them, each conversion function is used to process a specific field conversion task. For example, the byte order conversion function is used to adjust the storage order of the field. For example, 0x12345678 is converted from big endian to little endian 0x78563412. The field type mapping function is used to process field conversions of different bit widths. For example, a 16-bit integer is mapped to a 32-bit integer. The field alignment supplement function is used to insert padding bytes between fields. It should be noted that the execution order of the conversion functions is: field type mapping function, byte order conversion function, and field alignment supplement function.

[0110] Encapsulate the conversion function into an adapter interface file. Write the data sending platform identification code, data receiving platform identification code, conversion function name, conversion function call order, data buffer size and other information into the adapter interface file, and calculate the digital signature of the adapter interface file through cyclic redundancy check. Extract the field to be converted from the data frame to be sent, and perform field conversion processing on the field to be converted according to the function call sequence defined in the adapter interface file to obtain the converted field. Compare the data checksum corresponding to the converted field with the data checksum corresponding to the field to be converted. When the checksum is consistent, reorganize the data frame to be sent according to the format of the data sending platform to feedback the target data frame corresponding to the data frame to be processed to the data sending platform. Set the adapter interface file as a dynamic load module and store it in the compatible processing library.

[0111] In practical applications, data acquisition devices usually use 8-bit single-chip microcomputers, while host computers use 64-bit processors. There are differences in data transmission between the two. Through the adaptation interface file of the adaptation layer, the compatibility of data transmission can be guaranteed and the seamless transmission of data frames can be realized. For example, the data collected by the temperature sensor is a 16-bit fixed-point number with an integer part of 8 bits and a decimal part of 8 bits. When transmitted to the 64-bit processor platform, the adaptation layer automatically converts the corresponding data frame into a 64-bit floating-point format. The dynamic loading mechanism of the adaptation interface provides good scalability. When adding a new hardware platform, you only need to add the corresponding feature record in the platform feature table and provide the necessary conversion function, and the adaptation layer can automatically support the platform. The correctness verification of the conversion function uses a checksum mechanism to ensure that no errors occur in the data frame during the conversion process. During the data format conversion process, detailed log records can also be used to track the execution of each conversion step. The implementation of the adaptation layer focuses on the standardized definition of the data format and the standardized processing of the conversion process. Through predefined platform features and conversion rules, an extensible data adaptation framework is constructed. The conversion interface is encapsulated in a standard module format, which is convenient for porting and reuse between different platforms. At the same time, a strict data verification mechanism is used to ensure the reliability of the conversion process.

[0112] The technical solution of this embodiment is that when two data frames to be processed are received, and at least two data frames to be processed correspond to at least two protocol version identifiers, the target protocol version identifier is determined according to the version time corresponding to the at least two protocol version identifiers. Based on the target protocol version identifier and the preset conversion script, at least one data frame to be processed that is not the target protocol version identifier is subjected to version conversion processing to obtain the converted data frame to be processed, and the target parsing template corresponding to the target protocol version identifier is determined, so as to parse and process the converted data frame to be processed based on the target parsing template, thereby realizing the conversion of data frames to be processed of different protocol versions. The data frame to be processed is parsed and processed by the target parsing template to obtain the field information of at least one target field corresponding to the data frame to be processed. By dynamically matching the target parsing template, data parsing processing of the data frame to be processed is realized. According to the field information of at least one target field and the preset field information, the field difference information is determined. Based on this, the field difference between the operating system corresponding to the device sending the data frame to be processed and the operating system of the current device when encapsulating the data frame can be determined. By determining the compatibility processing method corresponding to the field difference information, the subsequent sending of the target data frame compatible with the corresponding operating system can be made, which solves the problem of inaccurate and incomplete data frame parsing caused by the difference in data frame encapsulation of different operating systems, thereby improving the compatibility of data transmission and ensuring the accuracy and integrity of data transmission.

[0113] Embodiment 3

[0114] Figure 3 Schematic diagram of the structure of a cross-system data interaction device provided by Embodiment 3 of the present invention. Figure 3 As shown, the device includes: a parsing template determination module 310, a field information determination module 320, a difference information determination module 330 and a data frame feedback module 340.

[0115] The parsing template determination module 310 is used to determine the target parsing template corresponding to the protocol version identifier of the data frame to be processed when receiving the data frame to be processed; the field information determination module 320 is used to parse the data frame to be processed based on the target parsing template to obtain the field information of at least one target field corresponding to the data frame to be processed; the difference information determination module 330 is used to determine the field difference information based on the field information of at least one target field and the preset field information, wherein the field difference information is used to characterize the corresponding field difference when encapsulating data frames between different operating systems; the data frame feedback module 340 is used to determine the compatibility processing method corresponding to the field difference information, so as to feedback the target data frame corresponding to the data frame to be processed based on the compatibility processing method.

[0116] The technical solution of this embodiment, when receiving the data frame to be processed, determines the target parsing template corresponding to the protocol version identifier according to the protocol version identifier of the data frame to be processed. And parses the data frame to be processed through the target parsing template to obtain the field information of at least one target field corresponding to the data frame to be processed. By dynamically matching the target parsing template, data parsing processing of the data frame to be processed is realized. According to the field information of at least one target field and the preset field information, the field difference information is determined. Based on this, the field difference between the operating system corresponding to the device sending the data frame to be processed and the operating system of the current device when encapsulating the data frame can be determined. By determining the compatibility processing method corresponding to the field difference information, the target data frame adapted to the corresponding operating system can be sent subsequently, which solves the problem of inaccurate and incomplete data frame parsing caused by the difference in data frame encapsulation of different operating systems, which not only improves the compatibility of data transmission, but also ensures the accuracy and integrity of data transmission.

[0117] On the basis of the above embodiment, optionally, the parsing template determination module includes: a target protocol version identifier determination unit, which is used to determine the target protocol version identifier based on the version time corresponding to the at least two protocol version identifiers if at least two data frames to be processed are received and the at least two data frames to be processed correspond to at least two protocol version identifiers; a version conversion unit, which is used to perform version conversion processing on at least one data frame to be processed that is not the target protocol version identifier based on the target protocol version identifier and a preset conversion script, to obtain a converted data frame to be processed, and to determine a target parsing template corresponding to the target protocol version identifier.

[0118] Optionally, the target parsing template is a template in at least one preset parsing template, and the device also includes: a preset parsing template determination module, used to determine multiple field parsing rules based on field types and field lengths corresponding to multiple sample fields; based on at least one preset protocol version identifier, the multiple field parsing rules are combined and processed to obtain a preset parsing template corresponding to each preset protocol version identifier, wherein the preset parsing template includes at least one field parsing rule.

[0119] Optionally, the device also includes: a target parsing template configuration module, which is used to scan and process the data frame to be processed if there is no target parsing template corresponding to the protocol version identifier, and obtain the field flag corresponding to the data frame to be processed; determine at least one field to be processed corresponding to the data frame to be processed according to the field flag; perform feature extraction on at least one field to be processed based on a preset classification model to obtain multiple feature information corresponding to the field to be processed; perform clustering on multiple feature information to obtain the field type corresponding to the field to be processed; determine at least one field parsing rule to be used according to the field type and field length of the field to be processed; test the parsing template to be verified that contains at least one field parsing rule to be used, and when the test result meets the preset conditions, use the parsing template to be verified as the target parsing template corresponding to the data frame to be processed.

[0120] Optionally, the field information determination module includes: a target field determination unit, used to scan and process the data frame to be processed, and determine at least one target field corresponding to the data frame to be processed; a to-be-processed field information determination unit, used to parse and process at least one target field based on the field parsing rules in the target parsing template, and obtain to-be-processed field information corresponding to each target field; a data verification unit, used to perform data integrity verification on at least one to-be-processed field information and obtain a verification result; and a field information determination unit, used to use at least one to-be-processed field information as the field information of at least one target field corresponding to the data frame to be processed when the verification result is passed.

[0121] Optionally, the field information determination module also includes: a retransmission request generation unit, which is used to generate a retransmission request based on the verification result and at least one target field if the verification result is failed, so as to receive a retransmission data frame based on the retransmission request; a retransmission data frame parsing unit, which is used to parse the retransmission data frame to obtain field information of at least one retransmission field; a field information determination unit, which is used to update the field information of the target field based on the field information of at least one retransmission field, and perform data integrity verification on the updated field information, so as to obtain the field information of at least one target field corresponding to the data frame to be processed when the verification result is passed.

[0122] Optionally, a data frame feedback module is used to determine the field conversion flag and the field conversion content information based on the field position difference information, the field length difference information and the field content difference information in the field difference information; based on the field conversion flag and the field conversion content information, determine the conversion function, so that when feeding back the data frame to be sent corresponding to the data frame to be processed, the data frame to be sent is subjected to field conversion and field reorganization processing according to the conversion function to obtain the target data frame, and the target data frame is sent.

[0123] Optionally, the version conversion unit includes: a data difference information determination subunit, used to determine data difference information based on a to-be-processed data frame corresponding to a target protocol version identifier and at least one to-be-processed data frame that is not identified by the target protocol version, wherein the data difference information is used to characterize field differences in data frames corresponding to different protocol version identifiers, and the data difference information includes: at least one of field name difference information, field type difference information, field length difference information and field position difference information; a field conversion result determination subunit, used to perform field conversion processing on fields in at least one to-be-processed data frame that is not identified by the target protocol version based on the data difference information using a preset conversion script, to obtain a field conversion result corresponding to each to-be-processed data frame; a data verification subunit, used to perform a cyclic redundancy check on the field conversion result, and when the cyclic redundancy check result is a pass, obtain the converted to-be-processed data frame based on the field conversion result.

[0124] The cross-system data interaction device provided in the embodiment of the present invention can execute the cross-system data interaction method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0125] Embodiment 4

[0126] Figure 4 1 is a schematic diagram of the structure of an electronic device provided in Embodiment 4 of the present invention. The electronic device 10 is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.

[0127] like Figure 4As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0128] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0129] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as a cross-system data interaction method.

[0130] In some embodiments, the cross-system data interaction method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the cross-system data interaction method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to execute the cross-system data interaction method in any other appropriate manner (e.g., by means of firmware).

[0131] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0132] The computer program for implementing the cross-system data interaction method of the present invention can be written in any combination of one or more programming languages. These computer programs can be provided to a processor of a general-purpose computer, a special-purpose computer or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program can be executed completely on the machine, partially on the machine, partially on the machine as an independent software package and partially on a remote machine, or completely on a remote machine or server.

[0133] Embodiment 5

[0134] Embodiment 5 of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to execute a cross-system data interaction method, the method comprising:

[0135] When a data frame to be processed is received, a target parsing template corresponding to the protocol version identifier of the data frame to be processed is determined according to the protocol version identifier of the data frame to be processed; the data frame to be processed is parsed based on the target parsing template to obtain field information of at least one target field corresponding to the data frame to be processed; field difference information is determined according to the field information of at least one target field and preset field information, wherein the field difference information is used to characterize the corresponding field difference when encapsulating data frames between different operating systems; a compatibility processing method corresponding to the field difference information is determined, and a target data frame corresponding to the data frame to be processed is fed back based on the compatibility processing method.

[0136] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0137] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).

[0138] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0139] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.

[0140] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.

[0141] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A cross-system data interaction method, characterized in that: include: When receiving a data frame to be processed, determining a target parsing template corresponding to the protocol version identifier according to the protocol version identifier of the data frame to be processed; Parsing the data frame to be processed based on the target parsing template to obtain field information of at least one target field corresponding to the data frame to be processed; Determine field difference information according to the field information of the at least one target field and the preset field information, wherein the field difference information is used to characterize the corresponding field difference when encapsulating data frames between different operating systems; A compatibility processing method corresponding to the field difference information is determined, so as to feed back a target data frame corresponding to the data frame to be processed based on the compatibility processing method.

2. The method according to claim 1, characterized in that: The method of, when receiving a data frame to be processed, determining a target parsing template corresponding to the protocol version identifier of the data frame to be processed according to the protocol version identifier of the data frame to be processed, comprises: If at least two data frames to be processed are received, and the at least two data frames to be processed correspond to at least two protocol version identifiers, determining the target protocol version identifier based on the version times corresponding to the at least two protocol version identifiers; Based on the target protocol version identifier and a preset conversion script, version conversion processing is performed on at least one to-be-processed data frame that is not the target protocol version identifier to obtain a converted to-be-processed data frame, and a target parsing template corresponding to the target protocol version identifier is determined.

3. The method according to claim 1, characterized in that The target parsing template is a template in at least one preset parsing template, and the method further includes: Determine multiple field parsing rules based on field types and field lengths corresponding to multiple sample fields; Based on at least one preset protocol version identifier, a plurality of the field parsing rules are combined and processed to obtain a preset parsing template corresponding to each preset protocol version identifier, wherein the preset parsing template includes at least one field parsing rule.

4. The method according to claim 1, characterized in that: Also includes: If there is no target parsing template corresponding to the protocol version identifier, scanning the data frame to be processed to obtain a field flag bit corresponding to the data frame to be processed; Determine, according to the field flag bit, at least one to-be-processed field corresponding to the to-be-processed data frame; Performing feature extraction processing on the at least one field to be processed based on a preset classification model to obtain a plurality of feature information corresponding to the field to be processed; Performing clustering processing on the plurality of feature information to obtain a field type corresponding to the field to be processed; Determining at least one field parsing rule to be used according to the field type and field length of the field to be processed; The parsing template to be verified that includes the at least one field parsing rule to be used is tested, and when the test result meets a preset condition, the parsing template to be verified is used as the target parsing template corresponding to the data frame to be processed.

5. The method according to claim 1, characterized in that The parsing the data frame to be processed based on the target parsing template to obtain field information of at least one target field corresponding to the data frame to be processed includes: Scanning the data frame to be processed to determine at least one target field corresponding to the data frame to be processed; Parsing the at least one target field based on the field parsing rule in the target parsing template to obtain field information to be processed corresponding to each target field; Performing data integrity verification on at least one of the to-be-processed field information to obtain a verification result; When the verification result is passed, at least one of the to-be-processed field information is used as field information of at least one target field corresponding to the to-be-processed data frame.

6. The method according to claim 5, characterized in that Also includes: If the check result is a failure, generating a retransmission request based on the check result and the at least one target field, so as to receive a retransmitted data frame based on the retransmission request; Parsing the retransmission data frame to obtain field information of at least one retransmission field; The field information of the target field is updated based on the field information of the at least one retransmission field, and a data integrity check is performed on the updated field information to obtain the field information of at least one target field corresponding to the data frame to be processed when the check result is passed.

7. The method according to claim 1, characterized in that The determining a compatibility processing method corresponding to the field difference information, and feeding back a target data frame corresponding to the data frame to be processed based on the compatibility processing method, includes: Determine the field conversion flag and the field conversion content information according to the field position difference information, the field length difference information and the field content difference information in the field difference information; Based on the field conversion flag and the field conversion content information, a conversion function is determined so that when a data frame to be sent corresponding to the data frame to be processed is fed back, field conversion and field reorganization processing are performed on the data frame to be sent according to the conversion function to obtain a target data frame, and the target data frame is sent.

8. The method according to claim 2, characterized in that: The performing version conversion processing on at least one to-be-processed data frame that is not the target protocol version identifier based on the target protocol version identifier and the preset conversion script to obtain the converted to-be-processed data frame includes: Determine data difference information according to the to-be-processed data frame corresponding to the target protocol version identifier and at least one to-be-processed data frame that is not the target protocol version identifier, wherein the data difference information is used to characterize field differences in data frames corresponding to different protocol version identifiers, and the data difference information includes: at least one of field name difference information, field type difference information, field length difference information, and field position difference information; Based on the data difference information, using a preset conversion script, a field conversion process is performed on the field in the at least one data frame to be processed that is not identified by the target protocol version, to obtain a field conversion result corresponding to each data frame to be processed; A cyclic redundancy check is performed on the field conversion result, and when the cyclic redundancy check result is a pass, a converted data frame to be processed is obtained based on the field conversion result.

9. A cross-system data interaction device, characterized in that: include: A parsing template determination module, configured to determine, when receiving a data frame to be processed, a target parsing template corresponding to the protocol version identifier according to the protocol version identifier of the data frame to be processed; A field information determination module, configured to parse the data frame to be processed based on the target parsing template to obtain field information of at least one target field corresponding to the data frame to be processed; A difference information determination module, used to determine field difference information according to the field information of the at least one target field and the preset field information, wherein the field difference information is used to characterize the corresponding field difference when encapsulating data frames between different operating systems; The data frame feedback module is used to determine a compatibility processing method corresponding to the field difference information, and to feed back a target data frame corresponding to the data frame to be processed based on the compatibility processing method.

10. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the cross-system data interaction method according to any one of claims 1 to 8.

Citation Information

Cited By

  • IBI data set management system and method and electronic equipment

    CN120950577A

  • Method and device for analyzing multi-source heterogeneous test data of server

    CN121234909A

  • Flexible configurable data analysis device and method based on FPGA

    CN121367745A