Communication frame processing method, electronic equipment and storage medium

By compressing CAN frames in unmanned vehicles, smaller target communication frames are generated, which solves the problem of excessive CAN frame data size, improves communication efficiency and stability, and saves storage space.

CN119854379APending Publication Date: 2025-04-18UISEE TECH BEIJING LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411981685.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-30
Publication Date
2025-04-18

AI Technical Summary

Technical Problem

In driverless vehicles, since long-term communication and recording of CAN frames are required, how to reduce the data size of CAN frames, improve communication efficiency, stability and save storage space has become a technical challenge.

Method used

By performing compression processing on the frame before the communication frame is transmitted, the specific method includes performing first-level compression based on the first preset field in the current original communication frame, generating a first intermediate frame, and determining the target communication frame for transmission based on the first intermediate frame.

Benefits of technology

The frame size of the communication frame is reduced, the transmission efficiency and stability of the communication frame are improved, the storage space is occupied, and the data rollback problem is solved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119854379A_ABST
    Figure CN119854379A_ABST
Patent Text Reader

Abstract

The invention relates to a communication frame processing method, electronic equipment and a storage medium, and the communication frame processing method applied to a sending end of a communication frame comprises the steps: carrying out the first-stage compression processing of a current original communication frame according to a first preset field in the current original communication frame when the current original communication frame needs to be sent to a receiving end, obtaining a first intermediate frame corresponding to the current original communication frame, wherein the frame size of the first intermediate frame is smaller than that of the current original communication frame; determining a target communication frame corresponding to the current original communication frame according to the first intermediate frame; and sending the target communication frame. According to the scheme, before the communication frame is sent, the communication frame is compressed, so that the frame size of the communication frame is reduced, and the transmission efficiency and stability of the communication frame are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of vehicle communication technology, and in particular to a communication frame processing method, an electronic device and a storage medium. Background Art

[0002] CAN (Controller Area Network) is an ISO internationally standardized serial communication protocol. Due to its high performance and reliability, CAN is widely used in the vehicle industry. The status information and control commands of many vehicles are communicated based on CAN frames on the CAN bus.

[0003] In unmanned vehicles, since long-term communication and recording of CAN frames are required, how to reduce the data size of CAN frames to improve communication efficiency and stability and save storage space has become a technical problem to be solved. Summary of the invention

[0004] In order to solve the above technical problems or at least partially solve the above technical problems, the embodiments of the present disclosure provide a communication frame processing method, an electronic device and a storage medium, which reduce the frame size of the communication frame, thereby facilitating improving the transmission efficiency and stability of the communication frame.

[0005] In a first aspect, an embodiment of the present disclosure provides a communication frame processing method, which is applied to a transmitting end of a communication frame, and the method includes:

[0006] When the current original communication frame needs to be sent to the receiving end, the current original communication frame is compressed according to the first preset field in the current original communication frame to obtain a first intermediate frame corresponding to the current original communication frame, wherein the frame size of the first intermediate frame is smaller than the frame size of the current original communication frame;

[0007] Determine a target communication frame corresponding to the current original communication frame according to the first intermediate frame;

[0008] The target communication frame is sent.

[0009] In a second aspect, an embodiment of the present disclosure provides a communication frame processing method, which is applied to a receiving end of a communication frame, and the method includes:

[0010] Receive target communication frame;

[0011] The target communication frame is stored or the target communication frame is decompressed to obtain an original communication frame corresponding to the target communication frame, wherein the frame size of the target communication frame is smaller than the frame size of the original communication frame corresponding to the target communication frame.

[0012] In a third aspect, an embodiment of the present disclosure further provides an electronic device, comprising: one or more processors; a storage device for storing one or more programs; when the one or more programs are executed by the one or more processors, the one or more processors implement the communication frame processing method as described above.

[0013] In a fourth aspect, an embodiment of the present disclosure further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the communication frame processing method as described above.

[0014] The embodiment of the present disclosure provides a communication frame processing method. When the current original communication frame needs to be sent to the receiving end, the current original communication frame is compressed according to the first preset field in the current original communication frame to obtain the first intermediate frame corresponding to the current original communication frame, and the frame size of the first intermediate frame is smaller than the frame size of the current original communication frame; the target communication frame corresponding to the current original communication frame is determined according to the first intermediate frame; and the target communication frame is sent. By compressing the communication frame before sending it, the frame size of the communication frame is reduced, which is conducive to improving the transmission efficiency and stability of the communication frame. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale.

[0016] Figure 1 A communication frame processing method according to an embodiment of the present disclosure Figure 1 ;

[0017] Figure 2 is a schematic diagram from a current original communication frame to a first intermediate frame in an embodiment of the present disclosure;

[0018] Figure 3 is another schematic diagram from the current original communication frame to the first intermediate frame in an embodiment of the present disclosure;

[0019] Figure 4 is a schematic diagram of a sending cycle in an embodiment of the present disclosure;

[0020] Figure 5 is a schematic diagram from a current original communication frame to a second intermediate frame in an embodiment of the present disclosure;

[0021] Figure 6 is a schematic diagram of a communication process from a second intermediate frame to a target communication frame in an embodiment of the present disclosure;

[0022] Figure 7 A communication frame processing method according to an embodiment of the present disclosure Figure 2 ;

[0023] Figure 8 A schematic diagram of the structure of a communication frame processing device in an embodiment of the present disclosure Figure 1 ;

[0024] Fig. 9 A schematic diagram of the structure of a communication frame processing device in an embodiment of the present disclosure Figure 2 ;

[0025] Fig.10 It is a structural schematic diagram of an electronic device in an embodiment of the present disclosure. DETAILED DESCRIPTION

[0026] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.

[0027] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.

[0028] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.

[0029] Figure 1 1 is a flow chart of a communication frame processing method in an embodiment of the present disclosure. The method is applied to the transmitting end of the communication frame and can be executed by a communication frame processing device, which can be implemented in software and / or hardware, and can be configured in an electronic device. Figure 1 As shown, the method may specifically include the following steps:

[0030] S110. When the current original communication frame needs to be sent to the receiving end, the current original communication frame is compressed at the first level according to the first preset field in the current original communication frame to obtain a first intermediate frame corresponding to the current original communication frame, and the frame size of the first intermediate frame is smaller than the frame size of the current original communication frame.

[0031] The communication frame (specifically, the first intermediate frame, the current original communication frame, the second intermediate frame, and the target communication frame) may be a CAN frame. At present, CAN frames are widely used in vehicles, especially in unmanned vehicles, which require long-term transmission and storage of CAN frames. Therefore, by compressing the CAN frames to be transmitted to a certain extent, the frame size of the CAN frames can be reduced, thereby improving the transmission efficiency of the CAN frames and reducing the space occupied when storing the CAN frames.

[0032] In a real-time CAN communication scenario, the current frame size of a CAN frame is typically 22 bytes, which consists of an 8-byte timestamp identification field, a 2-byte identity identification field, a 2-byte transmission direction identification field, a 2-byte data length identification field, and an 8-byte data identification field (i.e., data body).

[0033] In some implementations, the frame size of the communication frame can be reduced by deleting or merging fields in the communication frame. Exemplarily, the first preset field includes one or more of an identity identification field, a data length identification field, and a transmission direction identification field. The first intermediate frame corresponding to the current original communication frame is compressed according to the first preset field in the current original communication frame, and the first intermediate frame is obtained, including:

[0034] The data length identification field of the current original communication frame is deleted, and the current original communication frame that does not include the data length identification field is determined as the first intermediate frame. The data length identification field is a default value. Since the data length identification field is a default value, deleting the data length identification field does not affect the recovery of the original communication frame by the receiving end, and can also reduce the frame size of the communication frame. Specifically, when the receiving end of the communication frame receives a communication frame with the data length identification field deleted, it can restore the data length identification field according to the agreed default value. As mentioned above, the data size of a CAN frame is usually 22 bytes at present, and its components are an 8-byte timestamp identification field, a 2-byte identity identification field, a 2-byte transmission direction identification field, a 2-byte data length identification field and an 8-byte data identification field (i.e., the data body). Through the processing operation of this embodiment, the 2-byte data length identification field is deleted. Therefore, the data size of the first intermediate frame corresponding to the current original communication frame (data size is 22 bytes) is 20 bytes. For example, you can refer to the following Figure 2 A schematic diagram from a current original communication frame to a first intermediate frame is shown.

[0035] Furthermore, in addition to deleting the data length identification field of the current original communication frame, the target data corresponding to the identity identification field and the transmission direction identification field in the current original communication frame can be determined based on a preset mapping relationship, and the target data can be used to replace the value of the identity identification field and the value of the transmission direction identification field. Among them, the minimum value of the target data can be set to 0, the purpose is to minimize the number of bytes occupied by the target data. When the receiving end of the communication frame receives the processed communication frame, it determines the value of the identity identification field and the value of the transmission direction identification field corresponding to the target data based on the target data therein and the preset mapping relationship, thereby realizing the recovery of the value of the identity identification field and the value of the transmission direction identification field. Specifically, the target data can be recorded through a comprehensive identification field, and the comprehensive identification field occupies 1 byte. As mentioned above, currently the frame size of a CAN frame is usually 22 bytes, and its components include an 8-byte timestamp identification field, a 2-byte identity identification field, a 2-byte transmission direction identification field, a 2-byte data length identification field, and an 8-byte data identification field (i.e., data body). Through the processing operation of this embodiment, the 2-byte data length identification field is deleted, and the 2-byte identity identification field and the 2-byte transmission direction identification field are processed into a 1-byte comprehensive identification field. Therefore, the data size of the first intermediate frame corresponding to the current original communication frame (data size is 22 bytes) is 17 bytes, which reduces the frame size. For example, you can refer to Figure 3 A schematic diagram from a current original communication frame to a first intermediate frame is shown.

[0036] Exemplarily, referring to a preset mapping relationship as shown in Table 1, the target data corresponding to the identity field "115" and the transmission direction identification field "Tx" is 1; the target data corresponding to the identity field "38E" and the transmission direction identification field "Tx" is 3; the target data corresponding to the identity field "737" and the transmission direction identification field "Tx" is 5; the target data corresponding to the identity field "111" and the transmission direction identification field "Tx" is 7; the target data corresponding to the identity field "113" and the transmission direction identification field "Tx" is 9; the target data corresponding to the identity field "243" and the transmission direction identification field "Rx" is 0; the target data corresponding to the identity field "237" and the transmission direction identification field "Rx" is 2... etc. It can be seen from the above that when the transmission direction identification field is "Tx", the corresponding target data is an odd number, and when the transmission direction identification field is "Rx", the corresponding target data is an even number. The number of bytes occupied by the target data is significantly smaller than the sum of the number of bytes occupied by the value of the identity field and the value of the transmission direction identification field. Therefore, by replacing the value of the identity field and the value of the transmission direction identification field with the target data, the frame size of the communication frame can be further reduced.

[0037] Table 1

[0038] Identification field Transmission direction identification field Target data 115 Tx 1 38E Tx 3 737 Tx 5 111 Tx 7 113 Tx 9 243 Rx 0 237 Rx 2 …… …… ……

[0039] In summary, in some implementations, the first preset field includes an identity identification field and a transmission direction identification field; the first intermediate frame includes a timestamp identification field, a comprehensive identification field, and a data identification field. The first intermediate frame corresponding to the current original communication frame is compressed according to the first preset field in the current original communication frame to obtain the first intermediate frame, including:

[0040] Based on a preset mapping relationship, determine the target data corresponding to the identity identification field and the transmission direction identification field in the current original communication frame; generate the value of the comprehensive identification field according to the target data; use the value of the timestamp identification field in the current original communication frame as the value of the timestamp identification field of the first intermediate frame; and use the value of the data identification field in the current original communication frame as the value of the data identification field of the first intermediate frame.

[0041] The step of generating the value of the comprehensive identification field according to the target data includes:

[0042] The target data is determined as the value of the comprehensive identification field.

[0043] Alternatively, the target data and the additional identifier are combined into the value of the comprehensive identifier field, wherein the additional identifier includes an integrity identifier, and the integrity identifier is 1. The integrity identifier 1 is used to indicate the integrity of the communication frame, or in other words, if the integrity identifier is 1, it indicates that the value of the timestamp identifier field of the corresponding communication frame is the value of the unprocessed original timestamp identifier field, and the value of the data identifier field is the value of the unprocessed original data identifier field. Figure 2 and Figure 3 The first intermediate frame shown has an integrity flag of 1, a value of a timestamp field of the ... data frame of the data frame of the data frame of the data frame of the data frame of the data frame of the data frame of the data frame of the data frame of the data frame of the data frame of the data frame of the data frame of the data frame of the data frame of the data frame of the data frame of the data frame of the data frame of the data frame of the data frame of the data frame of the data frame of the data frame of the data frame of the data frame of the data frame of the data frame of the data frame of the data frame of the data frame of the data frame of the data frame of the data frame of the data frame of the

[0044] S120. Determine a target communication frame corresponding to the current original communication frame according to the first intermediate frame.

[0045] In one implementation, determining the target communication frame corresponding to the current original communication frame according to the first intermediate frame includes: determining the first intermediate frame as the target communication frame corresponding to the current original communication frame.

[0046] In another embodiment, it is further determined whether the first intermediate frame can be further compressed, and if so, the first intermediate frame is further compressed to obtain a corresponding target communication frame, and if not, the first intermediate frame is sent as the target communication frame. Exemplarily, determining the target communication frame corresponding to the current original communication frame according to the first intermediate frame includes:

[0047] It is determined whether a difference between a value of a timestamp identification field of the first intermediate frame and a value of a timestamp identification field of a reference communication frame is greater than a first threshold, wherein the reference communication frame is a target communication frame with an integrity identification of 1 that was last sent.

[0048] In response to the difference being less than or equal to the first threshold, the first intermediate frame is subjected to secondary compression processing according to the timestamp identification field of the reference communication frame and the timestamp identification field of the first intermediate frame to obtain a second intermediate frame corresponding to the current original communication frame, and the target communication frame is determined according to the second intermediate frame; wherein the first threshold is less than or equal to the maximum value that can be stored in the timestamp identification field of the second intermediate frame. For example, if the maximum value that can be stored in the timestamp identification field of the second intermediate frame is 1000, then the first threshold is 1000. The maximum value that the timestamp identification field of the second intermediate frame can store is determined according to the number of bytes reserved for the timestamp identification field of the second intermediate frame. For example, if the number of bytes reserved for the timestamp identification field of the second intermediate frame is 3 bytes, the maximum value is 16777215, 16777215s≈4.6h. That is to say, when the difference between the value of the timestamp identification field of the first intermediate frame and the value of the timestamp identification field of the reference communication frame (that is, the relative time of the first intermediate frame relative to the reference communication frame) is less than or equal to 16777215s, the first intermediate frame is subjected to secondary compression processing according to the timestamp identification field of the reference communication frame and the timestamp identification field of the first intermediate frame to obtain the second intermediate frame corresponding to the current original communication frame, and the target communication frame is determined according to the second intermediate frame.

[0049] In other words, whether the first intermediate frame can be further compressed can be determined according to the sending order of the first intermediate frame in a sending cycle. If it can be further compressed, the first intermediate frame is further compressed to obtain the corresponding target communication frame. If it cannot be further compressed, the first intermediate frame is determined as the corresponding target communication frame. Wherein, the sending cycle starts from when the first intermediate frame is directly sent as the target communication frame and ends when a preset number of target communication frames are sent. When the first intermediate frame is used as the target communication frame, the first intermediate frame is also regarded as a reference communication frame. A reference communication frame is sent in one sending cycle, and the remaining communication frames are obtained by further compressing the corresponding first intermediate frame according to the reference communication frame. Specifically, the relative timestamp of the first intermediate frame relative to the reference communication frame is determined according to the time interval between the reference communication frame and the corresponding first intermediate frame, so as to replace the timestamp identification field in the first intermediate frame with the relative timestamp, thereby achieving the purpose of reducing the size of the communication frame. When the receiving end receives the processed target communication frame, it determines the value of the original timestamp identification field in the target communication frame (i.e., absolute time) according to the relative timestamp in the target communication frame and the value of the timestamp identification field of the reference communication frame (which value represents absolute time). For example, if the value of the timestamp identification field of the reference communication frame is 8:000 on November 1, 2024, and the relative timestamp in the target communication frame is 50s, then the value of the original timestamp identification field in the target communication frame is 8:050 on November 1, 2024.

[0050] The preset number is determined according to the degree of compression. If the degree of compression is large, that is, the frame size of the compressed communication frame is small, then the preset number will be small. If the degree of compression is small, that is, the frame size of the compressed communication frame is large, then the preset number will be large. For example, 3 bytes are set to record the relative timestamp, then a maximum of 16777215s≈4.6h can be recorded. Therefore, when the relative timestamp of a communication frame relative to the reference communication frame is greater than 4h, it indicates that a transmission cycle has ended, and a reference communication frame needs to be sent again to start the next transmission cycle. For example, you can refer to Figure 4 A schematic diagram of a sending cycle is shown, in which the first communication frame of each sending cycle is a reference communication frame, and subsequent communication frames are further compressed into simplified frames according to the reference communication frame.

[0051] In summary, determining the target communication frame corresponding to the current original communication frame according to the first intermediate frame includes: determining whether the processing sequence number is within a preset range; in response to the processing sequence number being within the preset range, performing secondary compression processing on the first intermediate frame according to the timestamp identification field of the reference communication frame and the timestamp identification field of the first intermediate frame to obtain the second intermediate frame corresponding to the current original communication frame; determining the target communication frame according to the second intermediate frame, and controlling the processing sequence number to increase by 1. The preset range is determined according to the time interval between two adjacent communication frames and the number of bytes occupied by the timestamp identification field in the target communication frame. For example, if the number of bytes occupied by the timestamp identification field in the target communication frame is 3 bytes, then a maximum of 16777215s≈4.6h can be recorded. If the time interval between two adjacent communication frames is 1s, then the preset range is [1, 16777215].

[0052] In response to the processing sequence number not being within the preset range, the first intermediate frame is determined as the target communication frame, the reference communication frame is updated using the first intermediate frame, and the processing sequence number is controlled to be updated to an initial value. That is, if the processing sequence number is not within the preset range, it indicates that a transmission cycle is over and the next transmission cycle needs to be started, so the first intermediate frame is determined as the target communication frame for transmission, and the first intermediate frame is used as a reference communication frame in a new transmission cycle.

[0053] By performing secondary compression processing on the first intermediate frame according to the timestamp identification field of the reference communication frame and the timestamp identification field of the first intermediate frame, a second intermediate frame corresponding to the current original communication frame is obtained, and the target communication frame is determined to be sent according to the second intermediate frame, thereby further reducing the data size of the target communication frame, which is beneficial to improving communication efficiency and reducing the storage space occupied during storage.

[0054] In some implementations, the second intermediate frame includes: a timestamp identification field, a comprehensive identification field, and a data identification field; in response to the difference being less than or equal to the first threshold, performing secondary compression processing on the first intermediate frame according to the timestamp identification field of the reference communication frame and the timestamp identification field of the first intermediate frame to obtain the second intermediate frame corresponding to the current original communication frame, comprising:

[0055] In response to the difference being less than or equal to the first threshold, the difference is used as the value of the timestamp identification field of the second intermediate frame, the value of the comprehensive identification field after the integrity identifier in the comprehensive identification field of the first intermediate frame is changed from 1 to 0 is used as the value of the comprehensive identification field of the second intermediate frame, and the value of the data identification field of the first intermediate frame is used as the value of the data identification field of the second intermediate frame, wherein the number of bytes occupied by the timestamp identification field of the second intermediate frame is less than the number of bytes occupied by the timestamp identification field in the first intermediate frame.

[0056] In response to the difference being greater than the first threshold, the first intermediate frame is determined as the target communication frame, and the reference communication frame is updated using the first intermediate frame.

[0057] Alternatively, in some implementations, in response to the processing sequence number being within a preset range, performing secondary compression processing on the first intermediate frame according to the timestamp identification field of the reference communication frame and the timestamp identification field of the first intermediate frame to obtain a second intermediate frame corresponding to the current original communication frame includes:

[0058] According to the value of the timestamp identification field of the reference communication frame and the value of the timestamp identification field of the first intermediate frame, a relative timestamp of the first intermediate frame relative to the reference communication frame is determined, and the relative timestamp indicates the relative time of the first intermediate frame relative to the reference communication frame; the value of the timestamp identification field in the first intermediate frame is replaced by the relative timestamp, and the integrity identifier in the first intermediate frame is changed from 1 to 0 (this is because the processed first intermediate frame no longer includes the value of the original timestamp identification field, but is replaced by the relative timestamp, so the change is marked by the integrity identifier 0), to obtain the second intermediate frame, the number of bytes occupied by the relative timestamp is less than the number of bytes occupied by the value of the timestamp identification field in the first intermediate frame. Assuming that the number of bytes occupied by the relative timestamp is 3, as mentioned above, the current frame size of a CAN frame is usually 22 bytes, and its components are an 8-byte timestamp identification field, a 2-byte identity identification field, a 2-byte transmission direction identification field, a 2-byte data length identification field and an 8-byte data identification field (i.e., data body). Through the processing operation of this embodiment, the 2-byte data length identification field is deleted, the 2-byte identity identification field and the 2-byte transmission direction identification field are processed into a 1-byte comprehensive identification field, and the 8-byte timestamp identification field is replaced with a 3-byte relative timestamp. Therefore, the data size of the second intermediate frame corresponding to the current original communication frame (data size is 22 bytes) is 12 bytes. For example, you can refer to the following example. Figure 5 A schematic diagram from a current original communication frame to a second intermediate frame is shown.

[0059] Further, the additional identifier also includes: a validity identifier, wherein if the value of the data identification field in the current original communication frame is different from the value of the data identification field in the adjacent previous communication frame with the same identity identification field, the validity identifier is 1, and if the value of the data identification field in the current original communication frame is the same as the value of the data identification field in the adjacent previous communication frame with the same identity identification field, the validity identifier is 0. If the validity identifier of the current communication frame is 1, the value of the data identification field of the current communication frame should be retained and should not be deleted; if the validity identifier of the current communication frame is 0, the value of the data identification field of the current communication frame can be further deleted (this is because the value of the data identification field of the current communication frame has been recorded once by the communication frame with the same identity identification field), so as to further reduce the frame size of the communication frame, and when the receiving end receives a communication frame that does not include the data identification field, it can be restored according to the data identification field in the previous communication frame with the same identity identification field. Therefore, the purpose of setting the validity identifier is to determine whether the communication frame can continue to be compressed, and on the other hand, it is used for the receiving end of the communication frame to determine how to restore the value of the data identification field of the communication frame.

[0060] In summary, determining the target communication frame according to the second intermediate frame includes:

[0061] In response to the validity flag in the second intermediate frame being 0, the data identification field in the second intermediate frame is deleted to obtain the target communication frame; in response to the validity flag in the second intermediate frame being 1, the second intermediate frame is determined as the target communication frame.

[0062] In other words, in response to the data identification field in the second intermediate frame being the same as the data identification field in the adjacent previous communication frame having the same identity identification field, the data identification field in the second intermediate frame is deleted to obtain the target communication frame; in response to the data identification field in the second intermediate frame being different from the data identification field in the adjacent previous communication frame having the same identity identification field, the second intermediate frame is determined as the target communication frame.

[0063] In general, if the data body content in the second intermediate frame is the same as the data body content in the last communication frame with the same identity identifier that has been sent, the data body content in the second intermediate frame is deleted, and the communication frame after the data body content is deleted is determined as the target communication frame to be sent, which can further reduce the size of the communication frame. Correspondingly, when the receiving end receives the communication frame that does not include the data body content, the data body content of the currently received communication frame is restored according to the data body content in the last received communication frame with the same identity identifier, that is, the data body content in the last received communication frame with the same identity identifier is used as the data body content of the currently received communication frame. Exemplarily, you can refer to the following Figure 6 A schematic diagram from a second intermediate frame to a target communication frame is shown.

[0064] If the data body content in the second intermediate frame is different from the data body content in the last sent communication frame with the same identity identifier, the second intermediate frame is directly sent as the target communication frame.

[0065] Specifically, it can be determined whether the data identification field in the second intermediate frame is the same as the data identification field in the adjacent previous communication frame having the same identity identification field according to the validity identifier in the comprehensive identification field in the second intermediate frame. Specifically, if the validity identifier in the comprehensive identification field in the second intermediate frame is 0, it means that the data identification field in the second intermediate frame is the same as the data identification field in the adjacent previous communication frame having the same identity identification field; if the validity identifier in the comprehensive identification field in the second intermediate frame is 1, it means that the data identification field in the second intermediate frame is different from the data identification field in the adjacent previous communication frame having the same identity identification field.

[0066] S130: Send the target communication frame.

[0067] The communication frame processing method provided in this embodiment compresses the communication frame before sending it, so as to reduce the data size of the communication frame, thereby improving the transmission efficiency and stability of the communication frame, and at the same time solves the data rollback problem caused by excessive data volume when the receiving end receives and stores the communication frame for a long time (the data rollback problem refers to the problem that new data may overwrite historical data, resulting in the loss of historical data).

[0068] Based on the above embodiments, Figure 7 A communication frame processing method is shown, which is applied to the receiving end of the communication frame, such as Figure 7 As shown, the communication frame processing method includes the following steps:

[0069] S710: Receive a target communication frame.

[0070] S720. Store the target communication frame or decompress the target communication frame to obtain an original communication frame corresponding to the target communication frame, wherein a frame size of the target communication frame is smaller than a frame size of the original communication frame corresponding to the target communication frame.

[0071] The target communication frame is compressed, so compared with the original communication frame, storing the target communication frame can reduce the occupation of storage space.

[0072] In some implementations, the decompressing the target communication frame to obtain an original communication frame corresponding to the target communication frame includes:

[0073] Determine the target data in the comprehensive identification field of the target communication frame; determine the value of the identity identification field and the value of the transmission direction identification field corresponding to the target data based on a preset mapping relationship; determine the value of the data identification field of the original communication frame corresponding to the target communication frame; in response to the integrity identification of the target communication frame being 1, determine the value of the timestamp identification field of the target communication frame as the value of the timestamp identification field of the original communication frame; in response to the integrity identification of the target communication frame being 0, determine the value of the timestamp identification field of the original communication frame according to the value of the timestamp identification field of the reference communication frame, when the integrity identification of the target communication frame is 0, the value of the timestamp identification field of the target communication frame represents the relative time with the value of the timestamp identification field of the reference communication frame, and the reference communication frame is the last received target communication frame with an integrity identification of 1; combine the value of the identity identification field corresponding to the target data and the value of the transmission direction identification field, the value of the data identification field of the original communication frame, the value of the timestamp identification field of the original communication frame, and the value of the default data length identification field to obtain the original communication frame corresponding to the target communication frame.

[0074] The method of determining the value of the data identification field of the original communication frame corresponding to the target communication frame comprises: in response to the target communication frame including the data identification field, determining the value of the data identification field of the target communication frame as the value of the data identification field of the original communication frame corresponding to the target communication frame; in response to the target communication frame not including the data identification field, determining the value of the data identification field of the previous target communication frame adjacent to the target communication frame and having the same comprehensive identification field as the value of the data identification field of the original communication frame.

[0075] In other words, in response to the validity identifier in the target communication frame being 1, the value of the data identification field of the target communication frame is determined to be the value of the data identification field of the original communication frame corresponding to the target communication frame; in response to the validity identifier in the target communication frame being 0, the value of the data identification field of the previous target communication frame adjacent to the target communication frame and having the same comprehensive identification field is determined to be the value of the data identification field of the original communication frame.

[0076] Figure 8 FIG. 1 is a schematic diagram of the structure of a communication frame processing device in an embodiment of the present disclosure. The device is integrated at the transmitting end of the communication frame. Figure 8 As shown: the device includes: a processing module 810, which is used to perform a first-level compression processing on the current original communication frame according to the first preset field in the current original communication frame when the current original communication frame needs to be sent to the receiving end, so as to obtain a first intermediate frame corresponding to the current original communication frame, and the frame size of the first intermediate frame is smaller than the frame size of the current original communication frame; a determination module 820, which is used to determine the target communication frame corresponding to the current original communication frame according to the first intermediate frame; and a sending module 830, which is used to send the target communication frame.

[0077] The communication frame processing device provided in the embodiment of the present disclosure can execute the steps of the communication frame processing method provided in the method embodiment of the present disclosure and applied to the sending end of the communication frame. The execution steps and beneficial effects are no longer repeated here.

[0078] Fig. 9 FIG. 1 is a schematic diagram of the structure of a communication frame processing device in an embodiment of the present disclosure. The device is integrated at the receiving end of the communication frame. Fig. 9 As shown: the device includes: a receiving module 910, used to receive a target communication frame, which is compressed; a storage module 920, used to store the target communication frame, and a decompression module 930, used to decompress the target communication frame to obtain an original communication frame corresponding to the target communication frame, wherein the frame size of the target communication frame is smaller than the frame size of the original communication frame corresponding to the target communication frame.

[0079] The communication frame processing device provided in the embodiment of the present disclosure can execute the steps of the communication frame processing method provided in the method embodiment of the present disclosure and applied to the receiving end of the communication frame. The execution steps and beneficial effects are no longer repeated here.

[0080] Fig.10 Schematic diagram of the structure of an electronic device in the embodiment of the present disclosure. Fig.10 , which shows a structural schematic diagram of an electronic device 500 suitable for implementing the embodiments of the present disclosure. Fig.10The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

[0081] like Fig.10 As shown, the electronic device 500 may include a processing device 501, a ROM 502, a RAM 503, a bus 504, an input / output (I / O) interface 505, an input device 506, an output device 507, a storage device 508, and a communication device 509. The processing device (e.g., a central processing unit, a graphics processor, etc.) 501 can perform various appropriate actions and processes to implement the method of the embodiment described in the present disclosure according to the program stored in the read-only memory (ROM) 502 or the program loaded from the storage device 508 to the random access memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the electronic device 500 are also stored. The processing device 501, the ROM 502, and the RAM 503 are connected to each other through the bus 504. The input / output (I / O) interface 505 is also connected to the bus 504.

[0082] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart, thereby implementing the communication frame processing method as described above. In such an embodiment, the computer program can be downloaded and installed from the network through the communication device 509, or installed from the storage device 508, or installed from the ROM 502. When the computer program is executed by the processing device 501, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.

[0083] It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, 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 above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.

[0084] The computer-readable medium may be included in the electronic device; or it may exist independently without being assembled into the electronic device. The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device: when it is necessary to send the current original communication frame to the receiving end, the current original communication frame is compressed at the first level according to the first preset field in the current original communication frame to obtain the first intermediate frame corresponding to the current original communication frame, the frame size of the first intermediate frame is smaller than the frame size of the current original communication frame; the target communication frame corresponding to the current original communication frame is determined according to the first intermediate frame; and the target communication frame is sent.

[0085] Optionally, when the above one or more programs are executed by the electronic device, the electronic device may also execute other steps described in the above embodiments.

[0086] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. 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.

[0087] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.

Claims

1. A communication frame processing method, applied to a transmitting end of a communication frame, characterized in that: The method comprises: When the current original communication frame needs to be sent to the receiving end, the current original communication frame is compressed according to the first preset field in the current original communication frame to obtain a first intermediate frame corresponding to the current original communication frame, wherein the frame size of the first intermediate frame is smaller than the frame size of the current original communication frame; Determine a target communication frame corresponding to the current original communication frame according to the first intermediate frame; The target communication frame is sent.

2. The method according to claim 1, characterized in that The first preset field includes an identity identification field and a transmission direction identification field; The first intermediate frame includes a timestamp identification field, a comprehensive identification field and a data identification field; The step of performing a first-level compression process on the current original communication frame according to the first preset field in the current original communication frame to obtain a first intermediate frame corresponding to the current original communication frame includes: Determine the target data corresponding to the identity identification field and the transmission direction identification field in the current original communication frame based on a preset mapping relationship; Generate a value of the comprehensive identification field according to the target data; The value of the timestamp identification field in the current original communication frame is used as the value of the timestamp identification field in the first intermediate frame; and the value of the data identification field in the current original communication frame is used as the value of the data identification field in the first intermediate frame.

3. The method according to claim 2, characterized in that The step of generating the value of the comprehensive identification field according to the target data includes: Determine the target data as the value of the comprehensive identification field; Alternatively, the target data and an additional identifier are combined into a value of the comprehensive identifier field, wherein the additional identifier includes an integrity identifier, and the integrity identifier is 1; The determining, according to the first intermediate frame, a target communication frame corresponding to the current original communication frame comprises: Determine whether a difference between a value of a timestamp identification field of the first intermediate frame and a value of a timestamp identification field of a reference communication frame is greater than a first threshold, the reference communication frame being a target communication frame with an integrity identification of 1 that was last sent; In response to the difference being less than or equal to the first threshold, performing secondary compression processing on the first intermediate frame according to the timestamp identification field of the reference communication frame and the timestamp identification field of the first intermediate frame to obtain a second intermediate frame corresponding to the current original communication frame, and determining the target communication frame according to the second intermediate frame; wherein the first threshold is less than or equal to the maximum value that can be stored in the timestamp identification field of the second intermediate frame; In response to the difference being greater than the first threshold, the first intermediate frame is determined as the target communication frame, and the reference communication frame is updated using the first intermediate frame.

4. The method according to claim 3, characterized in that The second intermediate frame includes: a timestamp identification field, a comprehensive identification field and a data identification field; In response to the difference being less than or equal to the first threshold, performing secondary compression processing on the first intermediate frame according to the timestamp identification field of the reference communication frame and the timestamp identification field of the first intermediate frame to obtain a second intermediate frame corresponding to the current original communication frame, including: In response to the difference being less than or equal to the first threshold, the difference is used as the value of the timestamp identification field of the second intermediate frame, the value of the comprehensive identification field after the integrity identifier in the comprehensive identification field of the first intermediate frame is changed from 1 to 0 is used as the value of the comprehensive identification field of the second intermediate frame, and the value of the data identification field of the first intermediate frame is used as the value of the data identification field of the second intermediate frame, wherein the number of bytes occupied by the timestamp identification field of the second intermediate frame is less than the number of bytes occupied by the timestamp identification field in the first intermediate frame.

5. The method according to claim 3, characterized in that: The additional identifier also includes: a validity identifier, wherein if the value of the data identification field in the current original communication frame is different from the value of the data identification field in the adjacent previous communication frame having the same identity identification field, the validity identifier is 1; if the value of the data identification field in the current original communication frame is the same as the value of the data identification field in the adjacent previous communication frame having the same identity identification field, the validity identifier is 0; The determining the target communication frame according to the second intermediate frame comprises: In response to the validity identifier in the second intermediate frame being 0, deleting the data identification field in the second intermediate frame to obtain the target communication frame; In response to the validity flag in the second intermediate frame being 1, the second intermediate frame is determined as the target communication frame.

6. A communication frame processing method, applied to a receiving end of a communication frame, characterized in that: The method comprises: Receive target communication frame; The target communication frame is stored or the target communication frame is decompressed to obtain an original communication frame corresponding to the target communication frame, wherein the frame size of the target communication frame is smaller than the frame size of the original communication frame corresponding to the target communication frame.

7. The method according to claim 6, characterized in that The decompressing the target communication frame to obtain an original communication frame corresponding to the target communication frame includes: Determining target data in a comprehensive identification field of the target communication frame; Based on a preset mapping relationship, determine a value of an identity identification field and a value of a transmission direction identification field corresponding to the target data; Determine the value of the data identification field of the original communication frame corresponding to the target communication frame; In response to the integrity flag of the target communication frame being 1, determining the value of the timestamp flag field of the target communication frame as the value of the timestamp flag field of the original communication frame; In response to the integrity identifier of the target communication frame being 0, the value of the timestamp identifier field of the original communication frame is determined according to the value of the timestamp identifier field of the reference communication frame, wherein when the integrity identifier of the target communication frame is 0, the value of the timestamp identifier field of the target communication frame represents the relative time with the value of the timestamp identifier field of the reference communication frame, and the reference communication frame is the last received target communication frame with an integrity identifier of 1; Combine the value of the identity identification field and the value of the transmission direction identification field corresponding to the target data, the value of the data identification field of the original communication frame, the value of the timestamp identification field of the original communication frame, and the value of the default data length identification field to obtain the original communication frame corresponding to the target communication frame.

8. The method according to claim 7, characterized in that The determining a value of a data identification field of an original communication frame corresponding to the target communication frame comprises: In response to the validity flag in the target communication frame being 1, determining the value of the data identification field of the target communication frame to be the value of the data identification field of the original communication frame corresponding to the target communication frame; In response to the validity identification in the target communication frame being 0, the value of the data identification field of the last target communication frame adjacent to the target communication frame and having the same comprehensive identification field is determined as the value of the data identification field of the original communication frame.

9. An electronic device, characterized in that: The electronic device comprises: one or more processors; A storage device for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 8.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.