Data conversion method and device, electronic equipment and storage medium

By using automated data conversion methods, the problems of low efficiency and error in manual operation during the transition from CAN protocol to CAN FD protocol were solved, achieving efficient and accurate data conversion and ensuring the reliability of the system and the accuracy of data parsing.

CN121486483APending Publication Date: 2026-02-06CHINA FAW CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511795807.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-02
Publication Date
2026-02-06

AI Technical Summary

Technical Problem

During the transition from the CAN protocol to the CAN FD protocol, existing technologies require manual operation to achieve compatible communication, resulting in low efficiency and easy occurrence of signal definition misalignment and ID matching errors, which affect the accuracy of data parsing and system reliability.

Method used

By using automated data conversion methods, the data structure of the message is obtained. Based on the comparison between the data code length and the target threshold, mapping or frame splitting is performed. Combined with signal attributes, the message is converted into a new data format to ensure accurate positioning and mapping of signal location and sequence.

Benefits of technology

It achieves efficient and accurate data conversion, avoids human error, improves conversion efficiency, ensures the reliability of data parsing, and reduces system failures caused by errors.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121486483A_ABST
    Figure CN121486483A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of data processing, in particular to a data conversion method and device, electronic equipment and a storage medium. The data conversion method comprises the following steps: acquiring a first data structure of a first message; wherein the first data structure comprises a data code length and a first signal attribute; in response to determining that the data code length is not greater than the target threshold, mapping the first message into a second message based on the first signal attribute; and in response to determining that the data code length is greater than the target threshold, determining the number of split frames of the first message, and mapping the first message into a second message based on the number of split frames and the first signal attribute.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of data processing, in particular to a data conversion method, a data conversion device, an electronic device and a computer readable storage medium. BACKGROUND

[0002] With the continuous improvement of digitalization level, the communication protocol is also continuously evolving. CAN FD protocol is gradually replacing CAN protocol as the new generation of mainstream communication protocol due to its higher transmission rate and support for single frame 64 byte data length.

[0003] However, in the process of transitioning from CAN protocol to CAN FD protocol, a real problem needs to be faced: the terminal devices deployed on the market using CAN bus protocol have perfect functions and large data volume. In order to realize compatible communication of new and old devices, the related technology generally adopts the way of splitting the long message of CAN FD into multiple standard CAN messages or reverse merging, but this compatible way highly depends on manual operation, which is not only inefficient and heavy work, but also is easy to cause signal definition dislocation, ID matching error and other problems due to human negligence, which seriously affects the analysis accuracy of test data and system reliability. SUMMARY

[0004] The present application aims to at least solve one of the technical problems existing in the prior art. To this end, the first aspect of the present application provides a data conversion method, which realizes automatic analysis and conversion of message files, effectively improves conversion efficiency, avoids manual operation errors, and further guarantees the reliability of data analysis.

[0005] The second aspect of the present application provides a data conversion device.

[0006] The third aspect of the present application provides an electronic device.

[0007] The fourth aspect of the present application provides a computer readable storage medium.

[0008] In the first aspect, the embodiments of the present application provide a data conversion method, comprising: obtaining a first data structure of a first message; wherein the first data structure comprises a data code length and a first signal attribute; in response to determining that the data code length is not greater than a target threshold, mapping the first message to a second message based on the first signal attribute; and in response to determining that the data code length is greater than the target threshold, determining the number of split frames of the first message, and mapping the first message to the second message based on the number of split frames and the first signal attribute.

[0009] In some embodiments of the present application, the first signal attribute comprises a start bit, a bit length and a byte sequence of each signal in the first message; and the mapping of the first message to the second message based on the first signal attribute comprises: mapping the first message to the second message with the start bit as a reference and the bit length as a mapping size according to the byte sequence.

[0010] In some embodiments of the present application, the determination of the split frame number of the first message comprises: in response to determining that the quotient of the data code length and the target threshold is an integer, taking the quotient of the data code length and the target threshold as the split frame number; and in response to determining that the quotient of the data code length and the target threshold is not an integer, taking an integer part of the quotient of the data code length and the target threshold plus a preset value as the split frame number.

[0011] In some embodiments of the present application, the mapping of the first message to the second message based on the split frame number and the first signal attribute comprises: mapping valid data in a data field of the first message to a data field of the second message based on the split frame number; performing signal allocation on each piece of data in the data field of the second message based on the first signal attribute, and generating a signal field of the second message; and generating the second message based on the data field of the second message and the signal field of the second message.

[0012] In some embodiments of the present application, the mapping of the valid data in the data field of the first message to the data field of the second message based on the split frame number comprises: splitting the valid data in the data field of the first message based on the split frame number, and obtaining split data; performing data padding on data with a data length less than a target threshold in the split data based on a preset padding value, and obtaining padded data; and mapping the padded data and data with a data length not less than the target threshold in the split data to the data field of the second message.

[0013] In some embodiments of the present application, the signal allocation on each piece of data in the data field of the second message based on the first signal attribute, and the generation of the signal field of the second message comprises: determining a start byte and an end byte of each of a plurality of signals in the signal field of the first message based on the start bit and the bit length; splitting a signal with an unequal start byte and end byte in the plurality of signals, and obtaining split signals; and mapping the split signals and signals with an equal start byte and end byte to the signal field of the second message based on the byte sequence.

[0014] In some embodiments of this application, the method further includes: obtaining a second data structure of a second message; wherein the second data structure includes a second signal attribute and an identifier; determining a second message group belonging to the same original message in the second message based on the identifier; concatenating the data fields of the second message group to obtain a first message data field; concatenating several sub-signals in the second message group based on the split identifier in the second signal attribute to obtain a first message signal field; and generating a first message based on the first message data field and the first message signal field.

[0015] Secondly, embodiments of this application provide a data conversion apparatus, comprising: a data structure acquisition module configured to acquire a first data structure of a first message; wherein the first data structure includes a data code length and a first signal attribute; a second message generation module configured to, in response to determining that the data code length is not greater than a target threshold, map the first message to a second message based on the first signal attribute; and, in response to determining that the data code length is greater than the target threshold, determine the number of segments of the first message, and map the first message to a second message based on the number of segments and the first signal attribute.

[0016] Thirdly, embodiments of this application provide an electronic device, including: a processor and a memory, wherein the memory stores a program or instructions that can run on the processor, and when the program or instructions are executed by the processor, they implement the steps of the data conversion method as described in the first aspect.

[0017] Fourthly, embodiments of this application provide a computer-readable storage medium on which a program or instructions are stored, and when the program or instructions are executed by a processor, the steps of the data conversion method as described in the first aspect are implemented.

[0018] The technical solution provided in this application, after obtaining the data structure of the original message, compares the data code length with the target threshold length, and further processes data codes whose data code length is not greater than the target threshold length and data codes whose data code length is greater than the target threshold length separately, and combines them with signal attributes to map them into new data messages. Through the data conversion method provided in this application, data messages in two communication protocols can be converted efficiently and accurately, effectively improving data conversion efficiency while ensuring data accuracy, thereby effectively reducing failures caused by message errors.

[0019] Additional aspects and advantages of this application will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of this application. Attached Figure Description

[0020] The above and / or additional aspects and advantages of this application will become apparent and readily understood from the description of the embodiments taken in conjunction with the following drawings, in which: Figure 1 A flowchart illustrating the data conversion method provided in this application embodiment; Figure 2 A flowchart illustrating the mapping of a second message based on the number of split frames and the first signal attribute, provided in this application embodiment; Figure 3 A flowchart illustrating how valid data in a first message data field is mapped to a second message data field, provided in an embodiment of this application; Figure 4 A flowchart for generating the second message signal field provided in this application embodiment; Figure 5 A flowchart illustrating a method for generating a first message from a second message, provided in an embodiment of this application; Figure 6 A schematic diagram of a data conversion apparatus provided in an embodiment of this application; Figure 7 This is a schematic diagram of a more specific electronic device hardware structure provided for an embodiment of this application.

[0021] Reference numerals: 600-Data processing device; 610-Data structure acquisition module; 620-Second message generation module; 710-Processor; 720-Memory; 730-Input / output interface; 740-Communication interface; 750-Bus. Detailed Implementation

[0022] Embodiments of this application will now be described in more detail with reference to the accompanying drawings. While some embodiments of this application are shown in the drawings, it should be understood that this application can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this application. It should be understood that the drawings and embodiments of this application are for illustrative purposes only and are not intended to limit the scope of protection of this application.

[0023] It should be understood that the steps described in the method embodiments of this application may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of this application is not limited in this respect.

[0024] The data conversion method, conversion device, electronic device, and storage medium provided in the embodiments of this application are described below with reference to the accompanying drawings.

[0025] refer to Figure 1 This is a flowchart of a data conversion method provided in an embodiment of this application.

[0026] Step S101: Obtain the first data structure of the first message; wherein the first data structure includes the data code length and the first signal attribute; In step S102, in response to determining that the data code length is not greater than the target threshold, the first message is mapped to the second message based on the first signal attribute; and in response to determining that the data code length is greater than the target threshold, the number of split frames of the first message is determined, and the first message is mapped to the second message based on the number of split frames and the first signal attribute.

[0027] Specifically, the first message is first acquired, analyzed to obtain and store the first data structure of the first message, wherein the first data structure includes a data code length and a first signal attribute. Further, the data code length in the first data structure is compared with a target threshold. If the data code length is not greater than the target threshold, the first message is mapped to a second message according to the first signal attribute. If the data code length is greater than the target threshold, the number of frames to be split in the first message is determined according to the data code length, and the first message is mapped to a second message based on the number of frames to be split and the first signal attribute.

[0028] In the embodiments of this application, the first message is preferably a DBC file of the CAN FD protocol; the second message is preferably a DBC file of the CAN protocol; and the target threshold is preferably 8 bits.

[0029] In addition to the corresponding first data structure, the first message also includes a unique ID, a name for identification, node information that sent the message, a data list containing all signals, a Boolean value indicating whether it is a second message, and a group identifier for associating split or merged messages.

[0030] This application obtains the data code length of the first message and maps it in different ways according to the data code length to obtain the second message. This enables the first message to be quickly converted into the second message according to rules. Since no manual intervention is required during the conversion, the conversion efficiency is effectively improved while avoiding errors caused by manual operation, ensuring the accuracy of message attributes, further guaranteeing the reliability of the second message data, and reducing the occurrence of system failures caused by errors in the converted content.

[0031] As an optional embodiment, the first signal attributes include the start bit, bit length, and byte order of each signal in the first message; mapping the first message to the second message based on the first signal attributes includes: mapping the first message to the second message in byte order, with the start bit as the offset reference and the bit length as the mapping size.

[0032] Specifically, the first signal attributes include the start bit, bit length, and byte order of each signal in the first message. In addition, the first signal attributes also include the signal name, data type, precision and offset for physical value conversion, physical unit, maximum and minimum values ​​of the value range, split identifier for marking the split status, and associated fields pointing to the original signal name for each signal. When mapping the first message to the second message, the other attribute information in the first signal attributes will also be mapped to the signal attribute information of the second message.

[0033] When the data code length of the first data structure is no greater than the target threshold, the starting bit position of the signal in the first message data field is used as the starting reference point for its positioning in the second message data field. This ensures that the relative position of the signal is maintained in the data, effectively and accurately locating the signal. Furthermore, during the mapping of the first message to the second message, the corresponding bit sequence is extracted from the original data of the first message strictly according to the bit length of the signal, and copied completely and without modification to the second message data field. This ensures that the binary content of the signal is not truncated or expanded, thus guaranteeing that the original numerical information it represents and the physical value calculated by precision and offset remain completely unchanged. Moreover, during the mapping process, the original byte order setting of the signal must be strictly followed, and the signal is laid out in the second message data field according to the same rules. This ensures that the signal value can be correctly parsed across different systems or devices, avoiding data distortion due to incorrect byte order.

[0034] As an optional embodiment, determining the number of frames to be split in the first message includes: in response to determining that the quotient of the data code length and the target threshold is an integer, using the quotient of the data code length and the target threshold as the number of frames to be split; in response to determining that the quotient of the data code length and the target threshold is not an integer, adding a preset value to the integer part of the quotient of the data code length and the target threshold and using it as the number of frames to be split.

[0035] Specifically, when the data code length of the first data structure is greater than the target threshold, it is necessary to calculate the quotient of the data code length of the first data structure and the target threshold to determine the number of frames to be split in the first message. When the quotient of the data code length and the target threshold is an integer, the quotient of the current data code length and the target threshold is directly determined as the number of frames to be split; when the quotient of the data code length and the target threshold is not an integer, the integer part of the quotient of the data code length and the target threshold is increased by a preset value and then used as the number of frames to be split, wherein the preset value of the increase is preferably 1. For example, if the data code length is 32 bytes and the target threshold is 8 bytes, then the quotient obtained by dividing 32 by 8 is 4, and 4 is an integer, so it can be directly used as the number of frames to be split; when the data code length is 18 bytes and the target threshold is 8 bytes, then the quotient obtained by dividing 18 by 8 is 2.25, and the integer part of the quotient 2 is increased by 1 to obtain the number of frames to be split as 3.

[0036] refer to Figure 2 This is a flowchart of a second message based on the number of split frames and the first signal attribute mapping provided in an embodiment of this application.

[0037] Step S201: Based on the number of split frames, map the valid data in the first message data field to the second message data field.

[0038] Specifically, based on the number of split frames, the valid data in the first message data field is mapped accordingly to obtain the second message data field. The valid data in the data field is the original data byte with specific physical meaning defined by the top number in the first message data field, excluding empty bytes or invalid data filled to meet the protocol length requirements.

[0039] refer to Figure 3 This is a flowchart illustrating how valid data in the first message data field is mapped to the second message data field, as provided in this application embodiment.

[0040] Step S301: Based on the number of split frames, split the valid data in the data field of the first message and obtain the split data; Step S302: Based on the preset padding value, pad the data in the split data whose length is less than the target threshold to obtain the padded data; Step S303: Map the padded data and the data in the split data whose length is not less than the target threshold to the second message data field.

[0041] Specifically, when mapping valid data in the first message data field to the second message data field, the valid data in the first message data first needs to be split based on the splitting radix. Taking a data code length of 18 bytes and a target threshold of 8 bytes as an example, the number of splitting frames is 3. Further, based on the number of splitting frames, the valid data in the first message data is split into 3 segments starting from the start bit: two segments of 8 bytes each and one segment of 2 bytes each.

[0042] For data segments in the split data whose length is less than the target threshold, a preset padding value is used. In this embodiment, the preset padding value is preferably a null byte (0x00). Taking the specific embodiment above as an example, data with a length of 2 bytes needs to be padded so that the length of this data reaches the target threshold, so that the length of the second message data field meets the communication requirements of the protocol described in the first message.

[0043] Furthermore, the padded data and the split data with a length not less than the target threshold are mapped to the second message data field to complete the precise division of physical data bits from large data length to small data length, laying the foundation for subsequent signal analysis.

[0044] Step S202: Based on the first signal attribute, assign a signal to each data item in the second message data field and generate the second message signal field.

[0045] Specifically, based on the first signal attribute, each data item in the second message data field is assigned a signal, and a second message signal field is generated, so as to fully adapt the signal definition of the first message to the signal structure of the second message.

[0046] refer to Figure 4 This is a flowchart of generating the second message signal field provided in an embodiment of this application.

[0047] Step S401: Based on the start bit and bit length, determine the start byte and end byte of several signals in the first message signal field respectively; Step S402: Separate the signals in which the start byte and the end byte are not equal from the signals to obtain the separated signals. Step S403: Based on byte order, the split signals and signals with equal start and end bytes are mapped to the second message signal field.

[0048] Specifically, the system acquires signals that need to cross a single target threshold length by calculating the start byte and end byte of each signal's start and end bits, thus determining whether a splitting operation is necessary. The calculation rules for the start and end bytes are as follows: for the start bit, the quotient obtained by dividing the start bit by the target threshold and taking the integer part is used as the start byte; for the end bit, the end bit is usually the start bit plus the signal bit length minus one, and the quotient obtained by dividing the end bit by the target threshold and taking the integer part is used as the end byte.

[0049] Taking a signal with a target threshold of 8 bytes, a signal start bit of 12, and a bit length of 16 as an example, the quotient of the start bit 12 divided by 8 is rounded down to 1. Calculate 12 plus 16 minus 1 to get the end bit of 27. Further divide 27 by 8 and round down to 3. At this point, we can see that the start byte is not equal to the end byte.

[0050] For signals where the start byte and end byte are not equal, the signal is split into several signals at the first byte boundary it crosses. Furthermore, during the splitting process, splitting markers are added to several signals. For example, the original signal "EngineSpeed" may be split into two sub-signals, "EngineSpeed_split0" and "EngineSpeed_split1".

[0051] Furthermore, the split signals and the signals that do not need to be split are uniformly mapped to obtain the information field of the second message, which is used to describe the physical meaning of each bit in the current second message data field and includes the second attribute information of all signals assigned to this second message.

[0052] During the mapping process, the original byte order of each signal must be strictly followed so that the signal field of the second message can match the data field of the second message. This ensures that the binary representation of the signal value can be correctly parsed in multi-byte systems and avoids data errors caused by byte order misunderstanding.

[0053] Step S203: Generate a second message based on the second message data field and the second message signal field.

[0054] Specifically, the second message data field that conforms to the corresponding communication protocol specification is integrated with the second message signal field that accurately describes the meaning of its data to obtain a complete second message.

[0055] It should be noted that during the generation of the second message, the ID of the second message also needs to be configured based on the ID information of the first message. The communication protocol corresponding to the second message has an extended frame format, which can use a 29-bit identifier to add extra encoded information to the second message. The highest 3 bits are selected from the 29-bit address of the identifier, starting from 0, to store the position of the current second message in the split sequence, that is, the frame number of the current second message. For example, if a first message can be split into 3 second messages, the frame numbers of the second messages are "000", "001" and "010", which are used to represent the 0th frame message, the 1st frame message and the 2nd frame message, respectively. Thus, the extended identifier of the second message is composed of "3-bit frame number + 26-bit basic ID of the first message".

[0056] refer to Figure 5 This is a flowchart of a method for generating a first message from a second message, provided in an embodiment of this application.

[0057] Step S501: Obtain the second data structure of the second message; wherein the second data structure includes a second signal attribute and an identifier.

[0058] Specifically, the second message is acquired, the second message is analyzed to obtain the second data structure, wherein the second data structure includes the second signal attribute and the identifier.

[0059] The second signal attributes include the complete definition of each signal in the second message, including but not limited to the signal name (which may include a split identifier), start bit, bit length, byte order, data type, precision, offset, etc.; the identifier is the ID of the second message. In this embodiment, the identifier refers to the above-mentioned 29-bit identifier, whose high 3 bits store the frame sequence number written when converting from the first message to the second message.

[0060] Step S502: Determine the second message group belonging to the same original message in the second message based on the identifier.

[0061] Specifically, all second messages are traversed, the lower 26 bits of the second message identifier are extracted and compared, and second messages with the same lower 26 bits are identified as belonging to the same original message second message group.

[0062] Step S503: Concatenate the data fields of the second message group to obtain the data field of the first message.

[0063] Specifically, further, the high 3 bits of any second message identifier in the second message group are extracted sequentially in ascending order of frame sequence number to form the target threshold byte number data field of each second message in the second message group, and these data fields are concatenated end to end to form the first message data field. For the concatenated first message data field, the padding bytes inserted when converting from the first message to the second message need to be removed to remove invalid padding data and obtain all valid data in the first message data field. The padding bytes to be removed can be confirmed by confirming the valid data based on the length of the corresponding data code, or by identifying a preset padding value.

[0064] Step S504: Based on the split identifier in the second signal attribute, several sub-signals in the second message group are spliced ​​together to obtain the first message signal field.

[0065] Specifically, for multiple second messages in the second message group, some second messages have a split identifier in their corresponding second signal attributes, indicating that the signals in the second message need to be concatenated to recover the complete signal. For second messages with split identifiers, they are concatenated in order according to the sequence number in the split identifier (e.g., "_split0", "_split1") to recover the complete signal before conversion from the first message. While concatenating the signals, the bit lengths of the signals with split identifiers need to be added to obtain the bit length of the signal corresponding to the first message. At the same time, according to the layout of the original first message or the byte alignment principle, the starting position of the concatenated complete signal in the data field of the first message needs to be calculated, while retaining all other signal attributes such as byte order, precision, and offset unchanged, and removing the split identifier to obtain the processed signal. Furthermore, the above-mentioned processed signal is integrated with the signals in the second message that do not have split identifiers to obtain the signal field of the first message.

[0066] Step S505: Generate a first message based on the first message data field and the first message signal field.

[0067] Specifically, the first message data field obtained in the above steps is used as the data payload of the first message, and the first message signal field obtained in the above steps is used as the database describing the data payload, thereby generating the corresponding first message. This achieves efficient, accurate and automated reverse conversion from multiple second messages to a single first message, and together with the conversion from the first message to the second message, it constitutes a complete bidirectional data conversion method, effectively ensuring the compatibility and reliability of data transmission under different protocols.

[0068] According to the data conversion method of this application embodiment, after obtaining the data structure of the original message, the data code length is compared with the target threshold length. Furthermore, data codes with a data code length not greater than the target threshold length and data codes with a data code length greater than the target threshold length are processed separately, and combined with signal attributes to be mapped into new data messages. The data conversion method provided by this application can efficiently and accurately convert data messages in two communication protocols, effectively improving data conversion efficiency while ensuring data accuracy, thereby effectively reducing faults caused by message errors.

[0069] refer to Figure 6 This is a schematic diagram of a data conversion device provided in an embodiment of this application.

[0070] Based on the same concept, corresponding to the data conversion method provided in any of the above embodiments, this application also proposes a data conversion device 600, including a data structure acquisition module 610 and a second message generation module 620.

[0071] The data structure acquisition module 610 is configured to acquire a first data structure of the first message; wherein the first data structure includes a data code length and a first signal attribute; the second message generation module 620 is configured to, in response to determining that the data code length is not greater than a target threshold, map the first message to a second message based on the first signal attribute; and, in response to determining that the data code length is greater than the target threshold, determine the number of segments of the first message, and map the first message to a second message based on the number of segments and the first signal attribute.

[0072] In some embodiments, the first signal attributes include the start bit, bit length, and byte order of each signal in the first message; the second message generation module 620 is further configured to map the first message into a second message in byte order, with the start bit as the offset reference and the bit length as the mapping size.

[0073] In some embodiments, the second message generation module 620 is further configured to: in response to determining that the quotient of the data code length and the target threshold is an integer, use the quotient of the data code length and the target threshold as the number of frames to be split; in response to determining that the quotient of the data code length and the target threshold is not an integer, add a preset value to the integer part of the quotient of the data code length and the target threshold and use it as the number of frames to be split.

[0074] In some embodiments, the second message generation module 620 is further configured to: map valid data in the first message data field to a second message data field based on the number of split frames; allocate signals to each data item in the second message data field based on the first signal attribute, and generate a second message signal field; and generate a second message based on the second message data field and the second message signal field.

[0075] In some embodiments, the second message generation module 620 is further configured to: split the valid data in the first message data field based on the number of split frames, and obtain the split data; fill the data in the split data whose data length is less than a second threshold based on a preset padding value, and obtain the filled data; and map the filled data and the data in the split data whose data length is not less than the second threshold to the second message data field.

[0076] In some embodiments, the second message generation module 620 is further configured to: determine the start byte and end byte of several signals in the first message signal field based on the start bit and the bit length; split the signals in the several signals whose start byte and end byte are not equal to obtain several split signals; and map the several split signals and the signals whose start byte and end byte are equal to the byte order to the second message signal field.

[0077] In some embodiments, the data conversion device 600 is further configured to: acquire a second data structure of a second message; wherein the second data structure includes a second signal attribute and an identifier; determine a second message group belonging to the same original message in the second message based on the identifier; concatenate the data fields of the second message group to obtain a first message data field; concatenate several sub-signals in the second message group based on the split identifier in the second signal attribute to obtain a first message signal field; and generate a first message based on the first message data field and the first message signal field.

[0078] According to the data conversion apparatus of this application embodiment, after acquiring the data structure of the original message, the data code length is compared with the target threshold length. Further, data codes with a data code length not greater than the target threshold length and data codes with a data code length greater than the target threshold length are processed separately, and combined with signal attributes to be mapped into new data messages. The data conversion method provided by this application can efficiently and accurately convert data messages in two communication protocols, effectively improving data conversion efficiency while ensuring data accuracy, thereby effectively reducing faults caused by message errors.

[0079] Based on the same concept, corresponding to the data conversion method provided in any of the above embodiments, this application also provides an electronic device, including a processor and a memory, wherein the memory stores a program or instructions that can run on the processor, and the program or instructions implement the above data conversion method when executed by the processor.

[0080] Figure 7 This illustration shows a more specific hardware structure diagram of an electronic device according to an embodiment of this application. The device may include: a processor 710, a memory 720, an input / output interface 730, a communication interface 740, and a bus 750. The processor 710, memory 720, input / output interface 730, and communication interface 740 are interconnected internally via the bus 750.

[0081] The processor 710 can be implemented using a general-purpose CPU (Central Processing Unit), microprocessor, application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this specification.

[0082] The memory 720 can be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory), static storage device, dynamic storage device, etc. The memory 720 can store the operating system and other application programs. When the technical solutions provided in the embodiments of this specification are implemented by software or firmware, the relevant program code is stored in the memory 720 and is called and executed by the processor 710.

[0083] The input / output interface 730 is used to connect input / output modules to enable information input and output. Input / output modules can be configured as components within the device (not shown in the figure) or externally connected to the device to provide corresponding functions. Input devices may include keyboards, mice, touchscreens, microphones, various sensors, etc., while output devices may include displays, speakers, vibrators, indicator lights, etc.

[0084] The communication interface 740 is used to connect a communication module (not shown in the figure) to enable communication between this device and other devices. The communication module can communicate via wired means (such as USB, Ethernet cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.).

[0085] Bus 750 includes a pathway for transmitting information between various components of the device, such as processor 710, memory 720, input / output interface 730, and communication interface 740.

[0086] It should be noted that although the above-described device only shows the processor 710, memory 720, input / output interface 730, communication interface 740, and bus 750, in specific implementations, the device may also include other components necessary for normal operation. Furthermore, those skilled in the art will understand that the above-described device may only include the components necessary for implementing the embodiments of this specification, and not necessarily all the components shown in the figures.

[0087] The electronic devices described above are used to implement the corresponding data conversion methods in any of the foregoing embodiments and have the beneficial effects of the corresponding data conversion method embodiments, which will not be repeated here.

[0088] Based on the same concept, corresponding to the data conversion method provided in any of the above embodiments, this application also provides a computer-readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, it implements the steps of the above data conversion method.

[0089] The aforementioned computer-readable storage medium can be any available medium or data storage device that a computer can access, including but not limited to magnetic storage (e.g., floppy disks, hard disks, magnetic tapes, magneto-optical disks (MOs), etc.), optical storage (e.g., CDs, DVDs, BDs, HVDs, etc.), and semiconductor storage (e.g., ROMs, EPROMs, EEPROMs, non-volatile memory (NAND flash), solid-state drives (SSDs)).

[0090] The computer instructions stored in the storage medium of the above embodiments are used to cause the computer to execute the corresponding data conversion method in any of the foregoing embodiments, and have the beneficial effects of the corresponding data conversion method embodiments, which will not be repeated here.

[0091] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, it should be noted that the scope of the methods and apparatuses in the embodiments of this application is not limited to performing functions in the order shown or discussed, but may also include performing functions substantially simultaneously or in the reverse order, depending on the functions involved. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.

[0092] From the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of computer software products plus necessary general-purpose hardware platforms, and of course, they can also be implemented by hardware. The computer software product is stored in a storage medium (such as ROM, RAM, magnetic disk, optical disk, etc.) and includes several instructions to cause the terminal or network-side device to execute the methods described in the various embodiments of this application.

[0093] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other implementations under the guidance of this application without departing from the spirit and scope of the claims. All of these implementations are within the protection scope of this application.

Claims

1. A data conversion method, characterized in that, include: Obtain the first data structure of the first message; wherein the first data structure includes the data code length and the first signal attribute; In response to determining that the data code length is not greater than a target threshold, the first message is mapped to a second message based on the first signal attribute; and, In response to determining that the data code length is greater than the target threshold, the number of split frames of the first message is determined, and the first message is mapped to a second message based on the number of split frames and the first signal attribute.

2. The data conversion method according to claim 1, characterized in that, The first signal attribute includes the start bit, bit length, and byte order of each signal in the first message; The step of mapping the first message to the second message based on the first signal attribute includes: Using the starting bit as the offset reference and the bit length as the mapping size, the first message is mapped to the second message in byte order.

3. The data conversion method according to claim 1, characterized in that, Determining the number of frames to be split from the first message includes: In response to determining that the quotient of the data code length and the target threshold is an integer, the quotient of the data code length and the target threshold is used as the number of frames to be split; In response to determining that the quotient of the data code length and the target threshold is not an integer, the integer part of the quotient of the data code length and the target threshold is increased by a preset value and used as the number of split frames.

4. The data conversion method according to claim 2, characterized in that, The step of mapping the first message to the second message based on the number of split frames and the first signal attribute includes: Based on the number of split frames, the valid data in the first message data field is mapped to the second message data field; Based on the first signal attribute, signal allocation is performed on each data item in the second message data field, and a second message signal field is generated; The second message is generated based on the second message data field and the second message signal field.

5. The data conversion method according to claim 4, characterized in that, The step of mapping valid data in the first message data field to the second message data field based on the number of split frames includes: The valid data in the first message data field is split based on the number of split frames to obtain the split data; Based on a preset padding value, data with a length less than the target threshold in the split data is padded to obtain padded data; The filled data and the data whose length is not less than the target threshold in the split data are mapped to the second message data field.

6. The data conversion method according to claim 4, characterized in that, The step of allocating signals to each data item in the second message data field based on the first signal attribute and generating the second message signal field includes: Based on the start bit and the bit length, the start byte and end byte of several signals in the first message signal field are determined respectively; The signals in which the start byte and the end byte are not equal are split to obtain the split signals; Based on the byte order, the split signals and the signals whose start byte and end byte are equal are mapped to the second message signal field.

7. The data conversion method according to claim 1, characterized in that, The method further includes: Obtain the second data structure of the second message; wherein the second data structure includes a second signal attribute and an identifier; Based on the identifier, a second message group belonging to the same original message in the second message is determined; The data fields of the second message group are concatenated to obtain the data field of the first message; Based on the split identifier in the second signal attribute, several sub-signals in the second message group are spliced ​​together to obtain the first message signal field; The first message is generated based on the first message data field and the first message signal field.

8. A data conversion device, characterized in that, include: The data structure acquisition module is configured to acquire the first data structure of the first message; wherein, the first data structure includes the data code length and the first signal attribute; The second message generation module is configured to, in response to determining that the data code length is not greater than a target threshold, map the first message to a second message based on the first signal attribute; and, in response to determining that the data code length is greater than the target threshold, determine the number of split frames of the first message, and map the first message to a second message based on the number of split frames and the first signal attribute.

9. An electronic device, characterized in that, include: A processor and a memory, the memory storing a program or instructions executable on the processor, the program or instructions, when executed by the processor, implementing the steps of the data conversion method as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, The readable storage medium stores a program or instructions that, when executed by a processor, implement the steps of the data conversion method as described in any one of claims 1 to 7.