Data transmission method and device, monitoring equipment and storage medium

By checksum splicing of received messages, the parsing errors caused by message exceptions in data transmission are solved, and more efficient and reliable data transmission is achieved.

CN119484448APending Publication Date: 2025-02-18KEHUA DATA CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411340698.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-25
Publication Date
2025-02-18

AI Technical Summary

Technical Problem

During data transmission, packet exceptions lead to parsing errors. The prior art usually discards exceptional packets and triggers retransmission mechanisms, increasing the system burden and reducing data transmission efficiency.

Method used

The first verification operation is performed by receiving the message. If it fails, it is spliced ​​with the abnormal messages stored in the buffer area, and a second processing operation is performed, including splitting and second verification operations. If it is successful, the message is parsed , if it fails, store or discard the exception message.

Benefits of technology

It avoids directly discarding abnormal messages, maximizes the use of packets that have problems during transmission, reduces dependence on retransmission, saves time, speeds up data transmission efficiency, and improves the reliability of data transmission.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119484448A_ABST
    Figure CN119484448A_ABST
Patent Text Reader

Abstract

The invention discloses a data transmission method and device, monitoring equipment and a storage medium. The data transmission method comprises the following steps: receiving a message; executing a first verification operation on the message; executing a first processing operation on the message according to the failure of the first verification operation; the first processing operation comprises the step of executing a second processing operation on a message obtained by splicing the message failed in the first verification operation and an abnormal message stored in the cache region; the second processing operation comprises the following steps: performing splitting operation on the spliced message subjected to packet sticking to obtain a plurality of split messages; executing a second verification operation on the plurality of split messages; according to the failure of the second verification operation, taking the split message with the failure of the second verification operation as an abnormal message to be stored in a cache region or discarded; executing a third processing operation on the split message according to the success of the second verification operation; or, according to the success of the first verification operation, executing a third processing operation on the message; the third processing operation comprises the step of analyzing the message.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of communication technology, and relates to but is not limited to a data transmission method, device, monitoring equipment and medium. Background Art

[0002] In modern communication systems, the accuracy and stability of data transmission are crucial. However, during data transmission, due to factors such as channel interference and network fluctuations, messages may be abnormal, which may lead to parsing errors and other problems. In order to ensure the integrity and accuracy of data, abnormal messages are usually discarded and the data retransmission mechanism is triggered, which will increase the system burden and reduce the efficiency of data transmission. Summary of the invention

[0003] The embodiments of the present application provide a data transmission method, apparatus, monitoring device and storage medium to solve the problem of parsing errors caused by abnormal messages during data transmission.

[0004] The technical solution of this application is implemented as follows:

[0005] In a first aspect, an embodiment of the present application provides a data transmission method, including:

[0006] Receive messages;

[0007] Performing a first verification operation on the message;

[0008] According to the failure of the first verification operation, a first processing operation is performed on the message; the first processing operation includes: performing a second processing operation on the message obtained by splicing the message that failed the first verification operation and the abnormal message stored in the buffer area; the second processing operation includes: performing a splitting operation on the message obtained by splicing with sticky packets to obtain multiple split messages; performing a second verification operation on the multiple split messages; according to the failure of the second verification operation, the split message that failed the second verification operation is stored in the buffer area as an abnormal message or discarded; according to the success of the second verification operation, performing a third processing operation on the split message;

[0009] or,

[0010] According to success of the first verification operation, performing the third processing operation on the message;

[0011] The third processing operation includes: performing a parsing operation on the message.

[0012] In some embodiments, the second processing operation further comprises:

[0013] Comparing the length of the message obtained by splicing with a preset threshold;

[0014] According to the fact that the length of the spliced ​​message is greater than the preset threshold, a third verification operation is performed on the spliced ​​message, and according to the failure of the third verification operation, it is determined that the spliced ​​message has packet sticking.

[0015] In some embodiments, the second processing operation further includes:

[0016] Performing a split operation on the message obtained by splicing the sticky packets to obtain N split messages; performing the second verification operation on the N messages;

[0017] According to the message that fails the second verification operation being the Nth message among the N messages, storing the message that fails the second verification operation as an abnormal message in the buffer area;

[0018] According to the message that fails the second verification operation being one of the 1st to N-1th messages among the N messages, discarding the message that fails the second verification operation;

[0019] Wherein, N is a positive integer greater than 1.

[0020] In some embodiments, the second processing operation further comprises:

[0021] According to the length of the spliced ​​message being greater than the preset threshold, a third verification operation is performed on the spliced ​​message, and according to the third verification operation being successful, the spliced ​​message is discarded.

[0022] In some embodiments, the second processing operation further comprises:

[0023] According to the fact that the length of the spliced ​​message is less than or equal to the preset threshold, a fourth verification operation is performed on the spliced ​​message; according to the success of the fourth verification operation, the third processing operation is performed on the spliced ​​message; according to the failure of the fourth verification operation, the message that fails the fourth verification operation is stored in the cache area as an abnormal message.

[0024] In some embodiments, the third processing operation further includes:

[0025] Clear the abnormal messages stored in the buffer area.

[0026] In some embodiments, the static variables in the cache area are used to store abnormal messages.

[0027] In a second aspect, an embodiment of the present application provides a data transmission device, including:

[0028] A receiving module, used for receiving messages;

[0029] A processing module, configured to perform a first verification operation on the message;

[0030] The processing module is further used to perform a first processing operation on the message according to the failure of the first verification operation; the first processing operation includes: performing a second processing operation on the message obtained by splicing the message that failed the first verification operation and the abnormal message stored in the buffer area; the second processing operation includes: performing a splitting operation on the message obtained by splicing with sticky packets to obtain multiple split messages; performing a second verification operation on the multiple split messages; according to the failure of the second verification operation, storing the split message that failed the second verification operation as an abnormal message in the buffer area or discarding it; according to the success of the second verification operation, performing a third processing operation on the split message;

[0031] or,

[0032] According to success of the first verification operation, performing the third processing operation on the message;

[0033] The third processing operation includes: performing a parsing operation on the message;

[0034] The second processing operation is different from both the first processing operation and the third processing operation.

[0035] In a third aspect, an embodiment of the present application provides a monitoring device, comprising: a memory and a processor; the memory stores a computer program that can be run on the processor, and when the processor executes the computer program, it implements any one of the methods described in the first aspect.

[0036] In a fourth aspect, an embodiment of the present application provides a storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the method described in any one of the first aspects is implemented.

[0037] In an embodiment of the present application, when a received message fails in the first verification operation, the message will not be directly discarded and retransmission will be triggered. Instead, the message that failed the first verification is spliced ​​with the abnormal message stored in the buffer area, and the second processing operation is quickly performed. The second processing operation includes: splitting the message obtained by splicing the sticky packets to obtain multiple split messages; performing a second verification operation on the multiple split messages. If the second verification operation fails, the split message that failed the second verification is stored in the buffer area as an abnormal message or directly discarded; if the second verification operation is successful, the third processing operation is performed, that is, parsing the message.

[0038] In this way, the direct discarding of the message obtained by splicing the sticky packets is avoided, and the valid data is retained by splitting and further verification operation (second verification operation). Through the splicing operation, splitting operation and second verification operation, the message with problems in the transmission process can be used to the maximum extent, reducing the dependence on retransmission, saving time, and speeding up the data transmission efficiency. In addition, even if the message has problems during the data transmission or splicing process, the accuracy of the data can still be ensured at the time of final analysis through the splitting operation and the second verification operation, thereby significantly improving the reliability of the overall data transmission. Premature discarding of problematic messages is avoided, and the data transmission efficiency and data reliability are improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0040] Figure 1 A schematic diagram of a first optional flow chart of a data transmission method provided in an embodiment of the present application;

[0041] Figure 2 A second optional flow chart of the data transmission method provided in the embodiment of the present application;

[0042] Figure 3 A third optional flow chart of the data transmission method provided in the embodiment of the present application;

[0043] Figure 4 A schematic diagram of an optional structure of a data transmission device provided in an embodiment of the present application;

[0044] Figure 5 An optional structural diagram of the monitoring device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0045] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the specific technical solution of the application will be further described in detail below in conjunction with the drawings in the embodiments of the present application. The following embodiments are used to illustrate the present application, but are not used to limit the scope of the present application.

[0046] In the following description, reference is made to “some embodiments” which describe a subset of all possible embodiments, but it will be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.

[0047] In the following description, the terms "first\second\third" are used only as examples to distinguish different objects, and do not represent a specific order for the objects, nor do they have a limitation on the order of precedence. It is understandable that "first\second\third" can be interchanged with a specific order or order of precedence where permitted, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.

[0048] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.

[0049] It should be noted that the technical solutions described in the embodiments of the present application can be combined arbitrarily without conflict.

[0050] During data transmission, message anomalies can affect the correct reception and parsing of data, leading to data loss, parsing errors, or communication delays. To ensure data integrity and accuracy, a retransmission mechanism is usually required to make up for lost data, but this will increase system load and transmission delays, affecting data transmission efficiency and system performance.

[0051] In this regard, the present application proposes the following implementation methods.

[0052] In the first aspect, the present application provides a data transmission method, the functions implemented by the method can be implemented by calling program code by a processor in an electronic device (such as a monitoring device). Of course, the program code can be stored in a storage medium. It can be seen that the electronic device includes at least a processor and a storage medium.

[0053] Figure 1 A first optional flow chart of the data transmission method provided in the embodiment of the present application is as follows: Figure 1 As shown, the process may include but is not limited to the following S101 to S104.

[0054] Step S101: Receive a message (also referred to as a first message in this article).

[0055] In some embodiments, the process of receiving a message generally involves obtaining data from a communication link, and the received message generally contains several fields, which may include information such as data bits, control bits, and check bits. The message type is closely related to the protocol type, and the protocol determines the structure and transmission rules of the message. For example, different protocols define different message formats and field uses, so the message type will vary depending on the protocol.

[0056] In some embodiments, Modbus is a standard protocol for communication in industrial automation systems. Modbus messages are divided into multiple fields and are mainly used for communication between master and slave devices. They are usually used for status query and data reading and writing between devices in monitoring devices. For example, the main control device of the monitoring device sends a request message to the display screen of the monitoring device through the Modbus protocol, and the display screen replies with a response message containing device status information. Each message follows the format specified by Modbus to ensure the reliability and accuracy of communication.

[0057] The basic structure of a Modbus message usually contains the following fields: Slave Address, Function Code, Data Field, and Checksum. Among them, the station number is used to identify the slave device (or slave station). Each slave device has a unique address on the bus, and the master device identifies and communicates with a specific slave device through this address. For example, the station number is 0x01, which means that the communication target is a device with an address of 1. The function code is used to specify the operation to be performed by the master device, such as reading a register, writing data, or a diagnostic command. Different function codes represent different operations. For example, the function code 0x03 indicates that the master device wants to read the value of the holding register from the slave device. The data field carries specific information related to the function code, such as the register address, the data to be read or written, the number of registers to be read, etc. Its length depends on the type of function code and the amount of data transmitted. For example, when reading a register, the data field contains the register address and number to be read. For example, the data field 0x0001 specifies that the register address to be read is 1. The checksum is used to ensure the integrity of data transmission and is generated based on all the previous fields.

[0058] Assume that the master device wants to read the holding register (function code 0x03) of the slave device (station number 0x01), the register address is 0x0001, and the number of registers to be read is 3. Then the station number is 0x01, the function code is 0x03, the data field is 0x0001 (register address) and 0x0003 (number of registers to be read), and the cyclic redundancy check (CRC) check code is 0x1234 (assumed check value), then the Modbus message is: 0x01 0x03 0x00 0x01 0x00 0x030x12 0x34.

[0059] Here, the CRC checksum is calculated by the CRC algorithm. CRC checksum is a checksum method with good error detection capability. Using CRC checksum can further improve the error detection capability and provide flexible checksum.

[0060] In some embodiments, the specific composition of the message of the controller area network (CAN) protocol is based on its standard format (standard frame or extended frame). For example, the message composition of the standard frame (11-bit identifier) ​​includes a start bit (Start of Frame, SOF), an arbitration field (Arbitration Field), a control field (Control Field), a data field, a CRC check field (CRC Field), an acknowledgement field (Acknowledge Field) and an end field (End of Frame, EOF). Among them, the start bit is 1 bit, which is used to mark the beginning of a frame. The arbitration field is composed of an 11-bit identifier and a 1-bit remote transmission request (RTR). The control field contains a data length code (Data Length Code, DLC) and a 1-bit extended identifier bit (Identifier Extension, IDE). The data field is 0 to 8 bytes of data. The CRC check field contains a 15-bit CRC code and a 1-bit CRC receipt bit. The acknowledgement field contains an acknowledgement gap and an acknowledgement bit, a total of 2 bits. The end field is 7 bits, which is used to mark the end of the message.

[0061] In other embodiments, in some application scenarios, in order to meet specific needs, the system may adopt a custom protocol. The message structure of the custom protocol is flexible, and a specific frame structure can be used to define the format of data transmission as needed. For example, the message of the custom protocol includes a frame header, a data segment and a checksum. The frame header is used to identify the starting position of the message and may contain some fixed byte values ​​to distinguish the message type. Exemplarily, the frame header is 7E0110, where 7E represents the synchronization byte of the frame header, which is used to identify the beginning of the message and usually uses a fixed value (such as 0x7E). 01 represents the message type, that is, this message belongs to a certain specific type (such as reading data, sending commands). 10 represents the data length, which specifies the number of bytes of the data segment to be transmitted next. The data segment contains specific application data, which may include commands, status, etc. according to the definition of the protocol. The length of the data segment depends on the data length defined in the frame header, which may be fixed or variable length. For example, if 10 in the frame header represents 16 bytes of data, the data segment contains 16 bytes of content. The check code is used to ensure that the data is not damaged during the transmission process. For example, the check code may be a CRC check code.

[0062] Step S102: Perform a first verification operation on the message.

[0063] In some embodiments, a first check operation is performed on the received message. For example, a CRC check is performed on the received message. The CRC check can be flexibly applied to the entire message or a specific part of the message (such as the data segment of the message), depending on application requirements and design choices.

[0064] Step S103: Based on the failure of the first verification operation, perform a first processing operation on the message; the first processing operation includes: performing a second processing operation on the message obtained by splicing the message that failed the first verification operation and the abnormal message stored in the cache area; the second processing operation includes: performing a splitting operation on the message obtained by splicing with sticky packets to obtain multiple split messages; performing a second verification operation on the multiple split messages; based on the failure of the second verification operation, storing the split message that failed the second verification operation as an abnormal message in the cache area or discarding it; based on the success of the second verification operation, performing a third processing operation on the split message.

[0065] Here, failure of the first verification operation indicates that an abnormality occurs in the message during data transmission, such as frame breakage. At this time, the second processing operation is performed on the message obtained by splicing the message that fails the first verification operation with the abnormal message stored in the buffer area.

[0066] In some embodiments, the second processing operation includes: performing a splitting operation on the message obtained by splicing the packets to obtain a plurality of split messages; and performing a second checking operation on the plurality of split messages.

[0067] Exemplarily, a CRC check is performed on the multiple split messages.

[0068] For ease of understanding, in the present application, the spliced ​​message may also be referred to as the second message, and the split message may also be referred to as the third message.

[0069] In some embodiments, the second processing operation also includes: based on the failure of the second verification operation, storing the split message that failed the second verification operation as an abnormal message in the cache area or discarding it; based on the success of the second verification operation, performing a third processing operation on the split message, exemplarily, performing a parsing operation on the split message.

[0070] Step S104: according to the success of the first verification operation, the third processing operation is performed on the message, illustratively, a parsing operation is performed on the message.

[0071] Here, the third processing operation can be understood as further analysis and processing of the message that succeeded the first verification operation or the second verification operation to ensure that the parsed message is complete and accurate, and to avoid parsing problems caused by erroneous data. The purpose of parsing the message is to extract useful information from the message, such as data values, status instructions, etc. This process usually parses the contents of different fields according to the protocol format of the message (such as Modbus protocol, CAN protocol, custom protocol, etc.). Through the parsing operation, the extracted data can be used for subsequent application logic, such as controlling equipment, updating displays, and recording data.

[0072] In an embodiment of the present application, when a received message fails in the first verification operation, the message will not be directly discarded and retransmission will be triggered. Instead, the message that failed the first verification is spliced ​​with the abnormal message stored in the buffer area, and the second processing operation is quickly performed. The second processing operation includes: splitting the message obtained by splicing the sticky packets to obtain multiple split messages; performing a second verification operation on the multiple split messages. If the second verification operation fails, the split message that failed the second verification is stored in the buffer area as an abnormal message or directly discarded; if the second verification operation is successful, the third processing operation is performed, that is, parsing the message.

[0073] In this way, the direct discarding of the message obtained by splicing the sticky packets is avoided, and the valid data is retained by splitting and further verification operation (second verification operation). Through the splicing operation, splitting operation and second verification operation, the message with problems in the transmission process can be used to the maximum extent, reducing the dependence on retransmission, saving time, and speeding up the data transmission efficiency. In addition, even if the message has problems during the data transmission or splicing process, the accuracy of the data can still be ensured at the time of final analysis through the splitting operation and the second verification operation, thereby significantly improving the reliability of the overall data transmission. Premature discarding of problematic messages is avoided, and the data transmission efficiency and data reliability are improved.

[0074] In some embodiments, the second processing operation also includes: comparing the length of the spliced ​​message with a preset threshold; performing a third verification operation on the spliced ​​message based on the length of the spliced ​​message being greater than the preset threshold, and judging that the spliced ​​message has a sticky packet based on the failure of the third verification operation.

[0075] In some embodiments, the second processing operation further includes: performing a third verification operation on the spliced ​​message according to the length of the spliced ​​message being greater than the preset threshold, and discarding the spliced ​​message according to the success of the third verification operation.

[0076] Here, the preset threshold is used to characterize the upper limit of the length of the message. It is understandable that the preset threshold is used to limit the length of the message to not exceed a specific value. Different data transmission protocols have different message length limits. For example, the standard data segment of the CAN protocol message is up to 8 bytes, and the message length of the Modbus protocol (such as the Modbus RTU protocol) is up to 256 bytes, of which up to 253 bytes are used to transmit data. The preset threshold can be set according to the requirements of the specific protocol to ensure that the data transmission complies with the protocol specifications. In the custom protocol, the setting of the preset threshold can be flexibly adjusted to meet the requirements of the message length of the specific application scenario.

[0077] In an embodiment of the present application, if the length of the spliced ​​message (also referred to as the second message in this article) exceeds this preset value, it will be regarded as an abnormal message. However, in order to maximize the use of messages with problems during transmission, the present application will not immediately discard the second message, but will perform a third verification operation on the second message and continue with subsequent processing steps based on the result of the third verification operation.

[0078] Here, the third check operation is to check whether the second message is stuck. It should be noted that sticking does not only mean that multiple complete messages are stuck together. In this application, sticking can be further understood as splicing anomalies caused by frame breakage, data loss or errors during data transmission.

[0079] Specifically, according to the failure of the third check operation, it is judged that the spliced ​​message, that is, the second message, has a sticky packet, and the processing will continue. Exemplarily, if other bytes appear in front of the frame header in the second message, it can be considered that the third check operation has failed, and it is judged that the second message has a sticky packet. Even if the overall length of the second message exceeds the preset threshold, since the second message has a sticky packet, that is, the boundary of the second message has not been correctly identified, the second message may still contain useful data. Therefore, further processing (such as splitting operation) of the second message that has a sticky packet instead of directly discarding it can effectively avoid discarding the useful data in the second message, thereby improving the fault tolerance of data transmission.

[0080] According to the success of the third verification operation, the spliced ​​message, i.e., the second message, is discarded. Here, the length of the second message exceeds the preset threshold and no packet sticking occurs, which means that there is a problem with the structure or content of the second message. At this time, in order to protect the accuracy and reliability of the data, it is a safer choice to directly discard the second message that succeeded the third verification operation.

[0081] In some embodiments, the second processing operation also includes: splitting the message obtained by splicing the sticky packets to obtain N split messages; performing the second verification operation on the N messages; based on the message failing the second verification operation being the Nth message among the N messages, storing the message failing the second verification operation as an abnormal message in the cache area; based on the message failing the second verification operation being one of the 1st to N-1th messages among the N messages, discarding the message failing the second verification operation; wherein N is a positive integer greater than 1.

[0082] In some embodiments, a split operation is performed on the second message in which the sticking occurs to obtain N third messages. A second verification operation is performed on the N third messages, and according to the message that fails the second verification operation being the Nth third message among the N third messages, the third message that fails the second verification operation is stored as an abnormal message in the cache area. Here, the Nth third message among the N third messages is recorded as the last third message.

[0083] According to the message that fails the second verification operation being one of the 1st to N-1th third messages among the N third messages, the third message that fails the second verification operation is discarded. Here, one of the 1st to N-1th third messages among the N third messages is recorded as an intermediate third message.

[0084] It is understandable that the last third message that fails the second verification operation may be broken, that is, it still has repair value. It is stored in the cache area and waits for the subsequent receipt of the first message for splicing, avoiding the discarding of valuable messages and improving the effective utilization of data.

[0085] The intermediate third message that fails the second verification operation cannot be repaired due to data loss (for example, a part of the data bits are lost), and cannot be spliced ​​with the subsequently received first message for subsequent processing. Timely discarding the intermediate third message that fails the second verification operation is beneficial to improving efficiency and preventing waste of resources.

[0086] In some embodiments, the second processing operation also includes: based on the length of the spliced ​​message being less than or equal to the preset threshold, performing a fourth verification operation on the spliced ​​message; based on the success of the fourth verification operation, performing the third processing operation on the spliced ​​message; based on the failure of the fourth verification operation, storing the message that failed the fourth verification operation as an abnormal message in the cache area.

[0087] In some implementations, according to the length of the second message being less than or equal to a preset threshold, a fourth check operation, such as a CRC check, is performed on the second message. According to the success of the fourth check operation, a third processing operation is performed on the second message, specifically, a parsing operation is performed on the second message; according to the failure of the fourth check operation, the second message that fails the fourth check operation is stored as an abnormal message in the cache area.

[0088] It should be noted that the first verification operation, the second verification operation and the fourth verification operation may also include error checking and correction (ECC) verification or other verification methods, depending on the actual application requirements. The specific verification method depends on the actual application requirements, such as the protocol type and message type.

[0089] It can be understood that although the second message here (the spliced ​​message) does not pass the fourth verification operation, its length is less than or equal to the preset threshold and has not exceeded the upper limit of the message length, indicating that the second message can still be used in the processing of the next message.

[0090] It should be noted that, in the embodiment of the present application, the abnormal message stored in the cache area can be understood as a first message that failed the first verification operation, a third message that failed the second verification operation, or a second message that failed the fourth verification operation during the processing of the previous message before receiving the current first message.

[0091] In addition, after receiving the current first message and the first verification operation performed on the first message fails, if no abnormal message is stored in the buffer area, the first message that failed the first verification operation is directly stored in the buffer area as an abnormal message, and the next message is continued to be received. After receiving the current first message and the first verification operation performed on the first message fails, if an abnormal message is stored in the buffer area, the first message that failed the first verification operation is spliced ​​with the abnormal message stored in the buffer area, and the spliced ​​message is processed by the method in the subsequent steps.

[0092] In some embodiments, the third processing operation further includes: clearing abnormal messages stored in the cache area.

[0093] In some embodiments, after the first verification operation, the second verification operation, or the fourth verification operation is successful, the first message that successfully completed the first verification operation, the third message that successfully completed the second verification operation, or the second message that successfully completed the fourth verification operation is parsed and the abnormal messages stored in the cache area are cleared, in order to ensure data integrity and resource management, prevent abnormal messages from interfering with subsequent operations, release system resources, improve system performance, and maintain the integrity and consistency of the data processing flow. Exemplarily, the success of the first verification operation indicates that the currently received first message has passed the verification and will be parsed, and the abnormal messages stored in the cache area no longer need to be repaired. Timely clearing of abnormal messages stored in the cache area can effectively release memory resources and ensure the effectiveness and reliability of subsequent spliced ​​messages.

[0094] In some embodiments, the static variables in the cache area are used to store abnormal messages.

[0095] In some implementations, static variables can be used to continuously track and manage abnormal messages for easy subsequent processing. Static variables maintain their state during the program life cycle and can share data in different function calls. When the system state changes, such as receiving a new message, the data in the static variables can be directly used to quickly access and splice these abnormal messages. Using static variables to store abnormal messages can effectively improve the flexibility and efficiency of data processing.

[0096] Exemplarily, a static variable is declared in the message processing function to temporarily store messages that have failed the verification operation. After receiving a new message, the content of the static variable can be easily checked to determine whether it needs to be spliced ​​with the new message or further processed. Since static variables retain their values ​​throughout the program life cycle, this ensures that the contents of the variable still exist even after the function returns. By using static variables in the buffer area in the message processing function to temporarily store messages that have failed the verification operation, data can be effectively managed and processed.

[0097] In some implementations, it is possible to flexibly decide whether to clear or update the abnormal message in the static variable as needed, so as to better adapt to different processing scenarios. For example, the abnormal message in the static variable is cleared after the newly received message is successfully verified.

[0098] In some embodiments, the buffer area may be a storage area in a device (e.g., a main control device of a monitoring device), usually using a random access memory (RAM). The static variables in this buffer area are used to temporarily store the first message that fails the first verification operation, the third message that fails the second verification operation, or the second message that fails the fourth verification operation, so as to perform subsequent processing and verification.

[0099] Figure 2 A second optional flow chart of the data transmission method provided in the embodiment of the present application is shown below. Figure 2 The following describes the process of implementing the data transmission method provided by one embodiment of the present application.

[0100] In step S101, a message is received.

[0101] In step S102, a first check operation is performed on the message. Next, step S201 is performed.

[0102] In step S201, it is mainly determined whether the first verification operation is successful.

[0103] If the first verification operation is successful, step S202 is executed to parse the message that the first verification operation is successful and clear the abnormal message stored in the buffer area. After step S202, step S203 is continued to determine whether all messages have been received. If all messages have been received, step S204 is executed to end the operation. If there are still messages that have not been received, step S205 is executed to enter the processing process of the next message and return to step S101. It should be noted that the message received in step S101 at this time refers to another newly received message.

[0104] If the first verification operation fails, step S206 is executed.

[0105] In step S206, the message that fails the first verification operation is concatenated with the abnormal message stored in the buffer area.

[0106] The process continues with step S207 to determine whether the length of the concatenated message is greater than a preset threshold.

[0107] If the judgment result of step S207 is "No", that is, the length of the concatenated message is less than or equal to the preset threshold, step S208 is executed.

[0108] In step S208, a fourth verification operation is performed on the concatenated message, and it is determined whether the fourth verification operation is successful.

[0109] If the judgment result of step S208 is "yes", that is, the fourth verification operation performed on the spliced ​​message is successful, the message on which the fourth verification operation is successful is parsed and the abnormal message stored in the buffer area is cleared, and the steps after step S202 are continued. If the judgment result of step S208 is "no", that is, the fourth verification operation performed on the spliced ​​message fails, step S216 is executed.

[0110] In step S216, the spliced ​​messages that failed the fourth verification operation are stored in a buffer area, and step S203 and subsequent steps are executed after step S216.

[0111] If the judgment result of step S207 is "yes", that is, the length of the concatenated message is greater than the preset threshold, step S209 is executed.

[0112] In step S209, a third verification operation is performed on the concatenated message, and it is determined whether the third verification operation is successful.

[0113] If the judgment result of step S209 is "yes", that is, the third verification operation is successful, step S215 is executed to discard the spliced ​​message. After step S215, step S203 and steps after step S203 are executed.

[0114] If the judgment result of step S209 is "No", that is, the third verification operation fails, step S210 is executed.

[0115] In step S210, a splitting operation is performed on the concatenated message to obtain a plurality of split messages; a second verification operation is performed on the plurality of split messages, and step S211 is continued.

[0116] In step S211, a second verification operation is performed on the multiple split messages, and it is determined whether the second verification operation is successful.

[0117] If the judgment result of step S211 is "yes", that is, the second verification operation is successful, step S202 is executed to parse the message on which the second verification operation is successful and clear the abnormal message stored in the buffer area, and then continue with the steps after step S202.

[0118] If the judgment result of step S211 is "No", that is, the second verification operation fails, step S212 is executed.

[0119] In step S212, it is mainly determined whether the message that fails the second verification operation is the last message among multiple split messages.

[0120] If the judgment result of step S212 is "no", that is, the message that fails the second verification operation is not the last message among the multiple split messages, then execute step S213, discard the message that fails the second verification operation, and continue to execute step S203 and steps after step S203.

[0121] If the judgment result of step S212 is "yes", that is, the message that failed the second verification operation is the last message among multiple split messages, then execute step S214, store the last message among the multiple split messages in the cache area, and continue to execute step S203 and steps after step S203.

[0122] Understandably, Figure 2The steps executed after the first verification operation in step S201 fails can be understood as specific implementation steps of the first processing operation. Further, the steps executed after step S206 can be understood as specific implementation steps of the second processing operation. The steps executed after the first verification operation in step S201 succeeds can be understood as specific implementation steps of the third processing operation.

[0123] In the embodiment of the present application, after the first check operation failed message is spliced ​​with the abnormal message stored in the buffer area to obtain the second message (the spliced ​​message), the relationship between the length of the second message and the preset threshold is first determined, and for the second message whose length is less than or equal to the preset threshold, a fourth check operation such as CRC check is performed, and for the second message whose length is greater than the preset threshold, a third check operation is performed. In this way, messages that may have problems (such as sticky packets) can be preferentially screened out by message length at an early stage, potential errors can be quickly identified at an early stage, and directly performing the fourth check operation on the second message whose length is less than or equal to the preset threshold can save processing time and computing resources. By combining the sticky packet check of long messages and the CRC check of short messages, the reliability and accuracy of data transmission can be improved while ensuring data transmission efficiency.

[0124] Figure 3 A third optional flow chart of the data transmission method provided in the embodiment of the present application. Figure 3 The process of implementing the data transmission method provided by another embodiment of the present application is described.

[0125] In step S101, a message is received.

[0126] In step S102, a first check operation is performed on the message. Next, step S201 is performed.

[0127] In step S201, it is mainly determined whether the first verification operation is successful.

[0128] If the first verification operation is successful, step S202 is executed to parse the message that the first verification operation is successful and clear the abnormal message stored in the buffer area. After step S202, step S203 is continued to determine whether all messages have been received. If all messages have been received, step S204 is executed to end the operation. If there are still messages that have not been received, step S205 is executed to enter the processing process of the next message and return to step S101. It should be noted that the message received in step S101 at this time refers to another newly received message.

[0129] If the first verification operation fails, step S206 is executed.

[0130] In step S206, the message that fails the first verification operation is concatenated with the abnormal message stored in the buffer area.

[0131] Continue to step S208, perform a fourth verification operation on the spliced ​​message, and determine whether the fourth verification operation is successful.

[0132] If the judgment result of step S208 is "yes", that is, the fourth verification operation performed on the spliced ​​message is successful, the message on which the fourth verification operation is successful is parsed and the abnormal message stored in the buffer area is cleared, and the steps after step S202 are continued. If the judgment result of step S208 is "no", that is, the fourth verification operation performed on the spliced ​​message fails, step S207 is executed.

[0133] In step S207, it is determined whether the length of the concatenated message is greater than a preset threshold.

[0134] If the judgment result of step S207 is "No", that is, the length of the concatenated message is less than or equal to the preset threshold, step S216 is executed.

[0135] In step S216, the spliced ​​messages that failed the fourth verification operation are stored in a buffer area, and step S203 and subsequent steps are executed after step S216.

[0136] If the judgment result of step S207 is "yes", that is, the length of the concatenated message is greater than the preset threshold, step S209 is executed.

[0137] In step S209, a third verification operation is performed on the concatenated message, and it is determined whether the third verification operation is successful.

[0138] If the judgment result of step S209 is "yes", that is, the third verification operation is successful, step S215 is executed to discard the spliced ​​message. After step S215, step S203 and steps after step S203 are executed.

[0139] If the judgment result of step S209 is "No", that is, the third verification operation fails, step S210 is executed.

[0140] In step S210, a splitting operation is performed on the concatenated message to obtain a plurality of split messages; a second verification operation is performed on the plurality of split messages, and step S211 is continued.

[0141] In step S211, a second verification operation is performed on the multiple split messages, and it is determined whether the second verification operation is successful.

[0142] If the judgment result of step S211 is "yes", that is, the second verification operation is successful, step S202 is executed to parse the message on which the second verification operation is successful and clear the abnormal message stored in the buffer area, and then continue with the steps after step S202.

[0143] If the judgment result of step S211 is "No", that is, the second verification operation fails, step S212 is executed.

[0144] In step S212, it is mainly determined whether the message that fails the second verification operation is the last message among multiple split messages.

[0145] If the judgment result of step S212 is "no", that is, the message that fails the second verification operation is not the last message among the multiple split messages, then execute step S213, discard the message that fails the second verification operation, and continue to execute step S203 and steps after step S203.

[0146] If the judgment result of step S212 is "yes", that is, the message that failed the second verification operation is the last message among multiple split messages, then execute step S214, store the last message among the multiple split messages in the cache area, and continue to execute step S203 and steps after step S203.

[0147] It should be noted that Figure 2 and Figure 3 For the specific implementation of the first verification operation, the second verification operation, the third verification operation and the fourth verification operation, reference may be made to the relevant description of the aforementioned embodiment and will not be repeated here.

[0148] In the embodiment of the present application, after the first verification operation failed message and the abnormal message stored in the buffer area are spliced ​​to obtain the second message (the spliced ​​message), the fourth verification operation such as CRC verification is first performed on the second message, and the second message that succeeded the fourth verification operation is directly parsed and the operation is terminated. For the second message that failed the fourth verification operation, the relationship between the length of the second message and the preset threshold is determined, and the second message whose length is less than or equal to the preset threshold is stored in the buffer area, and the second message whose length is greater than the preset threshold is subjected to the third verification operation. In this way, the fourth verification operation is preferentially performed, and the second message whose fourth verification operation is successful is directly parsed, which can avoid unnecessary subsequent judgments, save processing time and computing resources, and improve data transmission efficiency. In addition, the third verification operation is further performed on the second message whose length is greater than the preset threshold and whose fourth verification operation failed, so as to avoid prematurely discarding further messages with problems (such as sticky packets), thereby improving the effective utilization rate of data.

[0149] In a second aspect, an embodiment of the present application provides a data transmission device, such as Figure 4As shown, the data transmission device 40 includes: a receiving module 401, which is used to receive a message; a processing module 402, which is used to perform a first verification operation on the message; the processing module 402 is also used to: according to the failure of the first verification operation, perform a first processing operation on the message; the first processing operation includes: performing a second processing operation on the message obtained by splicing the message that failed the first verification operation and the abnormal message stored in the buffer area; the second processing operation includes: performing a splitting operation on the message obtained by splicing the sticky packet to obtain a plurality of split messages; performing a second verification operation on the plurality of split messages; according to the failure of the second verification operation, the split message that failed the second verification operation is stored in the buffer area as an abnormal message or discarded; according to the success of the second verification operation, perform a third processing operation on the split message; or, according to the success of the first verification operation, perform the third processing operation on the message; wherein the third processing operation includes: performing a parsing operation on the message; wherein the second processing operation is different from both the first processing operation and the third processing operation.

[0150] In some embodiments, the processing module 402 is also used to: compare the length of the spliced ​​message with a preset threshold; based on the length of the spliced ​​message being greater than the preset threshold, perform a third verification operation on the spliced ​​message; based on the failure of the third verification operation, determine that the spliced ​​message has packet sticking.

[0151] In some embodiments, the processing module 402 is further used to: clear the abnormal messages stored in the buffer area.

[0152] In some embodiments, the processing module 402 is also used to: split the message obtained by splicing the sticky packets to obtain N split messages; perform the second verification operation on the N messages; based on the fact that the message failing the second verification operation is the Nth message among the N messages, store the message failing the second verification operation as an abnormal message in the cache area; based on the fact that the message failing the second verification operation is one of the 1st to N-1th messages among the N messages, discard the message failing the second verification operation; wherein N is a positive integer greater than 1.

[0153] In some embodiments, the processing module 402 is further used to: perform a third verification operation on the spliced ​​message according to the length of the spliced ​​message being greater than the preset threshold, and discard the spliced ​​message according to the success of the third verification operation.

[0154] In some embodiments, the processing module 402 is also used for: performing a fourth verification operation on the spliced ​​message based on the length of the spliced ​​message being less than or equal to the preset threshold; and performing the third processing operation on the spliced ​​message based on the success of the fourth verification operation; and storing the message that fails the fourth verification operation as an abnormal message in the cache area based on the failure of the fourth verification operation.

[0155] In some embodiments, the processing module 402 is further used to: clear the abnormal messages stored in the buffer area.

[0156] In some embodiments, the above-mentioned data transmission device can be set in a display screen communication test device of a monitoring device, wherein the display screen communication test device is used to simulate a main control device of the monitoring device and realize data communication with the display screen of the monitoring device through the steps in the data transmission method provided in the above-mentioned embodiment.

[0157] As a slave device, the display screen test device receives data and instructions from the display screen. By simulating the actual master control device, the display screen test device can communicate data and interact with the display screen, thereby verifying and testing the communication process and protocol implementation between the display screen and the master control device. By simulating the communication between the real master control device and the display screen, the data transmission protocol and function can be fully verified in the test environment to improve the accuracy and reliability of the test. Without the actual use of the master control device, the simulation function can be used to quickly debug and verify the data transmission process, saving test time and cost. The device can simulate communications under different protocols (such as Modbus, CAN, etc.), has flexibility, and is suitable for testing in a variety of scenarios.

[0158] It should be noted that the modules included in the data transmission device provided in the embodiment of the present application can be implemented by a processor in an electronic device (such as a monitoring device); of course, they can also be implemented by a specific logic circuit; illustratively, during the implementation process, the processor can be a central processing unit (CPU), a microprocessor (MPU), a digital signal processor (DSP) or a field programmable gate array (FPGA), etc.

[0159] The description of the above device embodiment is similar to the description of the above method embodiment, and has similar beneficial effects as the method embodiment. For technical details not disclosed in the device embodiment of the present application, please refer to the description of the method embodiment of the present application for understanding.

[0160] In a third aspect, an embodiment of the present application further provides a monitoring device, comprising: a memory and a processor; the memory stores a computer program that can be run on the processor, and the processor implements the steps in the data transmission method provided in the above embodiment when executing the computer program.

[0161] Combine the following Figure 5 The monitoring device 50 shown is used to illustrate the structural diagram of the monitoring device.

[0162] In one example, if Figure 5 As shown, the monitoring device 50 includes: a processor 51, at least one communication bus 52, at least one external communication interface 53 and a memory 54. The communication bus 52 is configured to realize the connection and communication between these components. The external communication interface 53 may include a standard wired interface and a wireless interface.

[0163] The memory 54 is configured to store instructions and applications executable by the processor 51, and can also cache data to be processed or processed by the processor 51 and various modules in the monitoring device 50 (for example, image data, audio data, voice communication data, and video communication data), which can be implemented through flash memory (FLASH) or RAM.

[0164] In some embodiments, the monitoring device includes: a display screen and a main control device; the main control device and the display screen achieve data communication by executing the steps in the data transmission method provided in the above embodiments.

[0165] In a fourth aspect, an embodiment of the present application further provides a storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps in the data transmission method provided in the above embodiment are implemented.

[0166] In some specific embodiments, the storage medium can be a magnetic random access memory (FRAM), a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a flash memory, a magnetic surface storage, an optical disk, or a compact disc read-only memory (CD-ROM) and other memories.

[0167] It should be noted here that the description of the above storage medium and device embodiments is similar to the description of the above method embodiments, and has similar beneficial effects as the method embodiments. For technical details not disclosed in the storage medium and device embodiments of this application, please refer to the description of the method embodiments of this application for understanding.

[0168] It should be understood that "one embodiment" or "an embodiment" mentioned throughout the specification means that specific features, structures or characteristics related to the embodiment are included in at least one embodiment of the present application. Therefore, "in one embodiment" or "in some embodiments" appearing throughout the specification may not necessarily refer to the same embodiment. In addition, these specific features, structures or characteristics can be combined in one or more embodiments in any suitable manner. It should be understood that in various embodiments of the present application, the size of the sequence number of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present application. The above-mentioned sequence numbers of the embodiments of the present application are for description only and do not represent the advantages and disadvantages of the embodiments.

[0169] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.

[0170] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as: multiple units or components can be combined, or can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.

[0171] The units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units; they may be located in one place or distributed on multiple network units; some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0172] In addition, all functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may be a separate unit, or two or more units may be integrated into one unit; the above-mentioned integrated units may be implemented in the form of hardware or in the form of hardware plus software functional units.

[0173] A person skilled in the art can understand that: all or part of the steps of implementing the above method embodiment can be completed by hardware related to program instructions, the aforementioned program can be stored, and when the program is executed, the execution includes the steps of the above method embodiment; and the aforementioned storage medium includes: mobile storage devices, read-only memories, magnetic disks or optical disks, and other media that can store program codes.

[0174] Alternatively, if the above-mentioned integrated unit of the present application is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application can be essentially or partly embodied in the form of a software product that contributes to the relevant technology. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as mobile storage devices, ROMs, magnetic disks, or optical disks.

[0175] The above is only an implementation method of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application.

Claims

1. A data transmission method, characterized in that: include: Receive messages; Performing a first verification operation on the message; According to the failure of the first verification operation, performing a first processing operation on the message; The first processing operation includes: performing a second processing operation on a message obtained by splicing a message that fails the first verification operation and an abnormal message stored in a buffer area; the second processing operation includes: performing a splitting operation on the message obtained by splicing with sticky packets to obtain multiple split messages; performing a second verification operation on the multiple split messages; according to the failure of the second verification operation, storing the split message that fails the second verification operation as an abnormal message in the buffer area or discarding it; according to the success of the second verification operation, performing a third processing operation on the split message; or, According to success of the first verification operation, performing the third processing operation on the message; The third processing operation includes: performing a parsing operation on the message.

2. The data transmission method according to claim 1, characterized in that: The second processing operation further comprises: Comparing the length of the message obtained by splicing with a preset threshold; According to the fact that the length of the spliced ​​message is greater than the preset threshold, a third verification operation is performed on the spliced ​​message, and according to the failure of the third verification operation, it is determined that the spliced ​​message has packet sticking.

3. The data transmission method according to claim 2, characterized in that: The second processing operation further includes: Performing a split operation on the message obtained by splicing the sticky packets to obtain N split messages; performing the second verification operation on the N messages; According to the message that fails the second verification operation being the Nth message among the N messages, storing the message that fails the second verification operation as an abnormal message in the buffer area; According to the message that fails the second verification operation being one of the 1st to N-1th messages among the N messages, discarding the message that fails the second verification operation; Wherein, N is a positive integer greater than 1.

4. The data transmission method according to claim 2, characterized in that: The second processing operation further comprises: According to the length of the spliced ​​message being greater than the preset threshold, a third verification operation is performed on the spliced ​​message, and according to the third verification operation being successful, the spliced ​​message is discarded.

5. The data transmission method according to claim 2, characterized in that: The second processing operation further comprises: According to the fact that the length of the spliced ​​message is less than or equal to the preset threshold, a fourth verification operation is performed on the spliced ​​message; according to the success of the fourth verification operation, the third processing operation is performed on the spliced ​​message; according to the failure of the fourth verification operation, the message that fails the fourth verification operation is stored in the cache area as an abnormal message.

6. The data transmission method according to claim 1, characterized in that: The third processing operation further includes: Clear the abnormal messages stored in the buffer area.

7. The data transmission method according to claim 1, characterized in that: The static variables in the buffer area are used to store abnormal messages.

8. A data transmission device, characterized in that: include: A receiving module, used for receiving messages; A processing module, configured to perform a first verification operation on the message; The processing module is further configured to perform a first processing operation on the message according to the failure of the first verification operation; The first processing operation includes: performing a second processing operation on a message obtained by splicing a message that fails the first verification operation and an abnormal message stored in a buffer area; the second processing operation includes: performing a splitting operation on the message obtained by splicing with sticky packets to obtain multiple split messages; performing a second verification operation on the multiple split messages; according to the failure of the second verification operation, storing the split message that fails the second verification operation as an abnormal message in the buffer area or discarding it; according to the success of the second verification operation, performing a third processing operation on the split message; or, According to success of the first verification operation, performing the third processing operation on the message; The third processing operation includes: performing a parsing operation on the message; The second processing operation is different from both the first processing operation and the third processing operation.

9. A monitoring device, characterized in that: include: Memory and processor; The memory stores a computer program that can be run on the processor, and the processor implements the method according to any one of claims 1 to 7 when executing the computer program.

10. A storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.