Data transmission method and device, monitoring equipment and storage medium

By splicing and performing second verification of the packets of the interrupted frame during data transmission and performing second verification, the resolution error problem caused by the interrupted frame of the packet is solved, and the efficiency and reliability of data transmission are improved.

CN119484449APending Publication Date: 2025-02-18XIAMEN KEHUA DIGITAL ENERGY TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411341486.5
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, message frame breakage results in parsing errors. The prior art usually discards messages and triggers retransmission, increasing the system burden and reducing data transmission efficiency.

Method used

By splicing the packets that fail the first verification operation with the abnormal packets stored in the cache area, and quickly completing the second verification operation, avoiding waiting for retransmission and saving time, and speeding up data transmission efficiency.

Benefits of technology

Even if there is a problem with the message during data transmission, the data is repaired through splicing and the second verification operation ensures that the spliced ​​messages remain accurate during parsing, avoiding data failure due to transmission errors and improving data transmission. overall reliability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119484449A_ABST
    Figure CN119484449A_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 verification operation on a message obtained by splicing the message failed in the first verification operation and an abnormal message stored in a cache region; according to the failure of the second verification operation, storing the spliced message as an abnormal message in the cache region; and executing a second processing operation on the spliced message according to the success of the second verification operation, or, according to the success of the first verification operation, executing a second processing operation on the message, wherein the second processing operation comprises the step of carrying out an analysis operation on 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 broken, which in turn leads to problems such as parsing errors. In order to ensure the integrity and accuracy of the data, broken messages are usually discarded and a data retransmission mechanism is triggered, which increases the system burden and reduces 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 frame breakage in messages during data transmission.

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

[0005] In a first aspect, the present application provides a data transmission method, comprising:

[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 verification operation on a message obtained by splicing the message that failed the first verification operation and the abnormal message stored in the buffer area; according to the failure of the second verification operation, storing the spliced ​​message as an abnormal message in the buffer area; according to the success of the second verification operation, performing a second processing operation on the spliced ​​message;

[0009] or,

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

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

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

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

[0014] According to the fact that the length of the message obtained by splicing is greater than the first preset threshold, discarding the message obtained by splicing;

[0015] or,

[0016] According to the length of the message obtained by splicing being less than or equal to the first preset threshold, performing the second verification operation on the message obtained by splicing;

[0017] The first preset threshold is used to represent the upper limit of the length of the message.

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

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

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

[0021] In some embodiments, the first check operation and the second check operation are CRC checks.

[0022] In some embodiments, the method further comprises:

[0023] Comparing the length of the message with the first preset threshold and the second preset threshold;

[0024] According to the length of the message being less than or equal to the second preset threshold, performing the first processing operation on the message;

[0025] or,

[0026] According to the fact that the length of the message is greater than the second preset threshold and less than or equal to the first preset threshold, the first verification operation is performed on the message; wherein the second preset threshold is less than the first preset threshold.

[0027] In a second aspect, 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 verification operation on a message obtained by splicing the message that failed the first verification operation and the abnormal message stored in the buffer area; according to the failure of the second verification operation, storing the spliced ​​message as an abnormal message in the buffer area; according to the success of the second verification operation, performing a second processing operation on the spliced ​​message;

[0031] or,

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

[0033] The second processing operation includes: performing a parsing operation on the message.

[0034] In some embodiments, the processing module is further configured to:

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

[0036] According to the fact that the length of the message obtained by splicing is greater than the first preset threshold, discarding the message obtained by splicing;

[0037] or,

[0038] According to the length of the message obtained by splicing being less than or equal to the first preset threshold, performing the second verification operation on the message obtained by splicing;

[0039] The first preset threshold is used to represent the upper limit of the length of the message.

[0040] In a third aspect, 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.

[0041] In a fourth aspect, 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.

[0042] In the embodiment of the present application, when the first check operation performed on the received message fails, the message is not directly discarded and retransmission is triggered, but the message that failed the first check is spliced ​​with the abnormal message stored in the buffer area, and the second check operation is completed quickly, avoiding waiting for retransmission and saving time, thereby speeding up data transmission efficiency. In addition, in the embodiment of the present application, even if there is a problem with the message during the data transmission process, the data can still be repaired by splicing, and the second check operation is used to ensure that the spliced ​​message remains accurate during parsing, thereby avoiding the situation where data failure is caused by transmission errors, and improving the overall reliability of data transmission. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] 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.

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

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

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

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

[0048] 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.

[0049] 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.

[0050] 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.

[0051] 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.

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

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

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

[0055] 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.

[0056] 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.

[0057] Step S101: Receive a message.

[0058] 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.

[0059] 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.

[0060] 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.

[0061] 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.

[0062] 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.

[0063] 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.

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

[0065] 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.

[0066] Step S103: Based on the failure of the first verification operation, performing a first processing operation on the message; the first processing operation includes: performing a second verification operation on a message obtained by splicing the message that failed the first verification operation and the abnormal message stored in the cache area; based on the failure of the second verification operation, storing the spliced ​​message as an abnormal message in the cache area; based on the success of the second verification operation, performing a second processing operation on the spliced ​​message.

[0067] Here, the failure of the first check operation indicates that an abnormality occurs in the message during data transmission, such as frame breakage. At this time, a second check operation is performed on the message obtained by splicing the message that failed the first check operation with the abnormal message stored in the cache area. For example, a CRC check is performed on the spliced ​​message.

[0068] It should be noted that the abnormal message stored in the buffer area can be understood as a message that failed the first verification operation or a message that failed the second verification operation in the processing of the previous message before receiving the current message.

[0069] In some embodiments, after receiving the current message and the first verification operation performed on the message fails, if no abnormal message is stored in the buffer area, the message that failed the first verification operation is directly stored in the buffer area as an abnormal message, and the next message is received. After receiving the current message and the first verification operation performed on the message fails, if an abnormal message is stored in the buffer area, the 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.

[0070] In some embodiments, based on the failure of the second verification operation, the spliced ​​message is stored in the cache area as an abnormal message; based on the success of the second verification operation, a second processing operation is performed on the spliced ​​message, exemplarily, a parsing operation is performed on the spliced ​​message.

[0071] Step S104: Based on the success of the first verification operation, a second processing operation is performed on the message. Exemplarily, a parsing operation is performed on the message.

[0072] Here, the second 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.

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

[0074] In the embodiment of the present application, when the first check operation performed on the received message fails, the message is not directly discarded and retransmission is triggered, but the message that failed the first check is spliced ​​with the abnormal message stored in the buffer area, and the second check operation is completed quickly, avoiding waiting for retransmission and saving time, thereby speeding up data transmission efficiency. In addition, in the embodiment of the present application, even if there is a problem with the message during the data transmission process, the data can still be repaired by splicing, and the second check operation is used to ensure that the spliced ​​message remains accurate during parsing, thereby avoiding the situation where data failure is caused by transmission errors, and improving the overall reliability of data transmission.

[0075] In some embodiments, the first processing operation also includes: comparing the length of the spliced ​​message with a first preset threshold; discarding the spliced ​​message based on the length of the spliced ​​message being greater than the first preset threshold; or performing the second checking operation on the spliced ​​message based on the length of the spliced ​​message being less than or equal to the first preset threshold; wherein the first preset threshold is used to characterize the upper limit of the length of the message.

[0076] Here, the first preset threshold is used to limit the length of the message to not exceed a specific value. If the length of the spliced ​​message exceeds this preset value, it will be regarded as an abnormal message and discarded to avoid further processing of messages with abnormal lengths. If the length of the spliced ​​message is less than or equal to the first preset threshold, it will be further processed, which can prevent resource waste and improve efficiency.

[0077] 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 first 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 first preset threshold can be flexibly adjusted to meet the requirements of the specific application scenario for the message length.

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

[0079] In some embodiments, after the first verification operation or the second verification operation is successful, the message is parsed and the abnormal message stored in the buffer area is cleared, aiming 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 message has passed the verification and will be parsed, and the abnormal message stored in the buffer area no longer needs to be repaired. Timely clearing of abnormal messages stored in the buffer area can effectively release memory resources and ensure the effectiveness and reliability of subsequent spliced ​​messages.

[0080] In some embodiments, the static variables in the buffer area are used to store abnormal messages. In some embodiments, through static variables, abnormal messages can be continuously tracked and managed to facilitate subsequent processing. Static variables maintain their status during the program life cycle, and data can be shared 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.

[0081] 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.

[0082] 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.

[0083] In some embodiments, the buffer area can be a storage area in a device (such as 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 message that failed the first verification operation or the message obtained by splicing the failed second verification operation, so as to perform subsequent processing and verification.

[0084] In some embodiments, the method further includes: comparing the length of the message with the first preset threshold and the second preset threshold; based on the length of the message being less than or equal to the second preset threshold, performing the first processing operation on the message; or, based on the length of the message being greater than the second preset threshold and less than or equal to the first preset threshold, performing the first verification operation on the message; wherein the second preset threshold is less than the first preset threshold.

[0085] By comparing the length of the message with the second preset threshold, it is possible to quickly determine whether the message is too short, and then infer possible frame breaks. For example, if the message length is less than or equal to the second preset threshold, it means that the message is incomplete. If the message length is less than or equal to the second preset threshold, the first processing operation can be directly performed on the received message. If the message length is between the second preset threshold and the first preset threshold, a first verification operation can be performed on the received message to ensure that a more in-depth verification is performed only when the length is reasonable. Judging the validity of the message in advance can reduce the complexity of subsequent processing and improve the overall performance of the system. By quickly filtering non-compliant messages, the waste of resources can be reduced.

[0086] 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 process of implementing the data transmission method provided in the embodiment of the present application is described.

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

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

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

[0090] If the first verification operation is successful, step S208 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 S208, step S209 is continued to determine whether all messages have been received. If all messages have been received, step S210 is executed to end the operation. If there are still messages that have not been received, step S211 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.

[0091] If the first verification operation fails, step S202 is executed.

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

[0093] Continue to execute step S203 to determine whether the length of the message obtained by splicing is greater than a first preset threshold.

[0094] If the length of the concatenated message is greater than the first preset threshold, step S204 is executed to discard the concatenated message, and step S209 and subsequent steps are continued.

[0095] If the length of the concatenated message is less than or equal to the first preset threshold, step S205 is executed.

[0096] In step S205, a second verification operation is performed on the concatenated message.

[0097] In step S206, it is mainly determined whether the second verification operation is successful.

[0098] If the second verification operation is successful, step S208 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 step S209 and subsequent steps are continued after step S208.

[0099] If the second verification operation fails, step S207 is executed to store the spliced ​​message in the buffer area, and step S209 and subsequent steps are continued.

[0100] Understandably, Figure 2 The steps performed after the first verification operation in step S201 fails can be understood as specific implementation steps of the first processing operation, and the steps performed after the first verification operation in step S201 succeeds can be understood as specific implementation steps of the second processing operation.

[0101] also, Figure 2 For the specific implementation of the first verification operation and the second verification operation, reference may be made to the relevant description of the aforementioned embodiment, which will not be repeated here.

[0102] In the embodiment of the present application, when the first check operation performed on the received message fails, the message is not directly discarded and retransmission is triggered, but the message that failed the first check is spliced ​​with the abnormal message stored in the buffer area, and the second check operation is completed quickly, avoiding waiting for retransmission and saving time, thereby speeding up data transmission efficiency. In addition, in the embodiment of the present application, even if there is a problem with the message during the data transmission process, the data can still be repaired by splicing, and the second check operation is used to ensure that the spliced ​​message remains accurate during parsing, thereby avoiding the situation where data failure is caused by transmission errors, and improving the overall reliability of data transmission.

[0103] In a second aspect, an embodiment of the present application provides a data transmission device, such as Figure 3 As shown, the data transmission device 30 includes: a receiving module 301, used to receive a message; a processing module 302, used to perform a first verification operation on the message; the processing module 302 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 verification operation on the message obtained by splicing the message that failed the first verification operation and the abnormal message stored in the cache area; according to the failure of the second verification operation, storing the spliced ​​message as an abnormal message in the cache area; according to the success of the second verification operation, performing a second processing operation on the spliced ​​message; or, according to the success of the first verification operation, performing a second processing operation on the message; wherein, the second processing operation includes: performing a parsing operation on the message.

[0104] In some embodiments, the processing module 302 is also used to: compare the length of the spliced ​​message with a first preset threshold; discard the spliced ​​message based on the length of the spliced ​​message being greater than the first preset threshold; or, perform the second check operation on the spliced ​​message based on the length of the spliced ​​message being less than or equal to the first preset threshold; wherein the first preset threshold is used to characterize the upper limit of the length of the message.

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

[0106] In some embodiments, the processing module 302 is also used to: compare the length of the message with the first preset threshold and the second preset threshold; based on the length of the message being less than or equal to the second preset threshold, perform the first processing operation on the message; or, based on the length of the message being greater than the second preset threshold and less than or equal to the first preset threshold, perform the first verification operation on the message; wherein the second preset threshold is less than the first preset threshold.

[0107] 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.

[0108] 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.

[0109] 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; of course, they can also be implemented by a specific logic circuit; exemplarily, in 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.

[0110] 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.

[0111] 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.

[0112] Combine the following Figure 4 The monitoring device 40 shown is used to illustrate the structural diagram of the monitoring device.

[0113] In one example, if Figure 4As shown, the monitoring device 40 includes: a processor 41, at least one communication bus 42, at least one external communication interface 43 and a memory 44. The communication bus 42 is configured to achieve connection and communication between these components. The external communication interface 43 may include a standard wired interface and a wireless interface.

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

[0115] 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.

[0116] 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.

[0117] 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.

[0118] 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.

[0119] 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.

[0120] 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.

[0121] 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.

[0122] 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.

[0123] 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.

[0124] 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.

[0125] 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.

[0126] 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 verification operation on a message obtained by splicing the message that failed the first verification operation and the abnormal message stored in the buffer area; based on the failure of the second verification operation, storing the spliced ​​message as an abnormal message in the buffer area; based on the success of the second verification operation, performing a second processing operation on the spliced ​​message; or, According to success of the first verification operation, performing a second processing operation on the message; The second processing operation includes: performing a parsing operation on the message.

2. The data transmission method according to claim 1, characterized in that: The first processing operation further comprises: Comparing the length of the message obtained by splicing with a first preset threshold; According to the fact that the length of the message obtained by splicing is greater than the first preset threshold, discarding the message obtained by splicing; or, According to the length of the message obtained by splicing being less than or equal to the first preset threshold, performing the second verification operation on the message obtained by splicing; The first preset threshold is used to represent the upper limit of the length of the message.

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

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

5. The data transmission method according to claim 1, characterized in that: The first check operation and the second check operation are CRC checks.

6. The data transmission method according to claim 2, characterized in that: The method further comprises: Comparing the length of the message with the first preset threshold and the second preset threshold; According to the length of the message being less than or equal to the second preset threshold, performing the first processing operation on the message; or, According to the fact that the length of the message is greater than the second preset threshold and less than or equal to the first preset threshold, the first verification operation is performed on the message; wherein the second preset threshold is less than the first preset threshold.

7. 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 verification operation on a message obtained by splicing the message that failed the first verification operation and the abnormal message stored in the buffer area; based on the failure of the second verification operation, storing the spliced ​​message as an abnormal message in the buffer area; based on the success of the second verification operation, performing a second processing operation on the spliced ​​message; or, According to success of the first verification operation, performing a second processing operation on the message; The second processing operation includes: performing a parsing operation on the message.

8. The data transmission device according to claim 7, characterized in that: The processing module is also used for: Comparing the length of the message obtained by splicing with a first preset threshold; According to the fact that the length of the message obtained by splicing is greater than the first preset threshold, discarding the message obtained by splicing; or, According to the length of the message obtained by splicing being less than or equal to the first preset threshold, performing the second verification operation on the message obtained by splicing; The first preset threshold is used to represent the upper limit of the length of the message.

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 6 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 6 is implemented.

Citation Information

Cited By

  • Message splicing method based on sliding window

    CN120186236A