A CAN bus business process processing method based on XML

Through the XML-based CAN bus business process processing method, the problem of difficulty in modifying CAN bus data in industrial simulation equipment is solved, and the flexibility and efficiency of data transmission are realized.

CN116781447BActive Publication Date: 2025-08-22TIANJIN JINHANG COMP TECH RES INST
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310876642.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-07-18
Publication Date
2025-08-22
Estimated Expiration
2043-07-18

AI Technical Summary

Technical Problem

In the prior art, during the data interaction between industrial simulation equipment and the main control platform, CAN bus data is stored in constant form, resulting in difficulty in modifying and unable to meet the simulation requirements under different working conditions.

Method used

Using XML-based CAN bus business process processing method, we can set XML files, define structure array variables and buffers, and parse XML node trees to realize flexible configuration and transmission of CAN data.

Benefits of technology

It simplifies data modification operations, facilitates rapid data transmission under different working conditions, reduces the difficulty of modification, and improves the flexibility and efficiency of data transmission.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116781447B_ABST
    Figure CN116781447B_ABST
Patent Text Reader

Abstract

The present invention provides an XML-based CAN bus business process processing method, comprising: setting an XML file; defining structure array variables corresponding to CAN data receiving and sending information, CAN message content filling, and CAN message data handling information, as well as a CAN frame basic structure, a CAN frame management structure, a CAN bus receiving buffer, and a CAN bus sending buffer; then parsing the XML file and filling the CAN bus sending buffer with data; using a processing function index to perform a parsing operation on the first structure array variable; and finally sending the data in the CAN bus sending buffer to the next business process. The above method can store the data required for the simulation process under the current working condition into the CAN bus buffer, and directly send the data from the CAN bus sending buffer during use, facilitating data transmission and greatly reducing the difficulty of data modification; simplifying the operation, and enabling easy and quick modification or transmission of data under different working conditions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention generally relates to the field of computer control technology, and in particular to a CAN bus business process processing method based on XML. Background Art

[0002] The pre-operational preparations for industrial equipment require extensive data exchange, typically on a response-response basis. Each interaction requires the control platform to send several messages, and the industrial equipment to process the messages accordingly and respond to the control platform according to the prescribed protocol. This process typically constitutes a single transaction.

[0003] The pre-operational preparation process for industrial equipment involves several tasks. During the adaptation process between industrial equipment and the control platform, industrial simulation devices are often used instead of actual equipment for verification, due to safety and cost considerations. The control platform and the industrial simulation devices interact according to the bus interface protocol, and the industrial simulation devices perform the corresponding tasks.

[0004] Industrial simulation equipment often exchanges data with the main control platform in a large number of request-response-style processes. The CAN bus is one of the most commonly used buses. Industrial simulation equipment typically stores this data as constants in the code, using it as simulation data during business processing. This data format is monotonous and difficult to modify, making it inconvenient for simulations under varying operating conditions. Consequently, simulating different operating conditions or modifying functional parameters requires modifying the entire code, which is very inconvenient. Summary of the Invention

[0005] In view of the above-mentioned defects or deficiencies in the prior art, it is desired to provide a CAN bus business process processing method based on XML.

[0006] In a first aspect, the present invention provides an XML-based CAN bus business process processing method, comprising:

[0007] Setting an XML file includes: setting label data of CAN data receiving and sending information, CAN message content filling, and CAN message data handling information under the XML file;

[0008] Respectively define structure array variables corresponding to the CAN data receiving and transmitting information, CAN message content filling, and CAN message data handling information, and obtain a first structure array variable, a second structure array variable, and a third structure array variable;

[0009] Define the CAN frame basic structure, CAN frame management structure, CAN bus receive buffer and CAN bus send buffer respectively;

[0010] Get the handle of the XML file;

[0011] Convert the XML file into an XML node tree;

[0012] Parsing the XML node tree to obtain an updated XML node tree;

[0013] Get the tag data of CAN message content filling and CAN message data handling information;

[0014] Fill the data in the second structure array variable into the CAN bus send buffer;

[0015] The CAN bus receives the data in the CAN bus sending buffer;

[0016] Performing a copy operation on the first structure array variable according to the data under the second structure array variable;

[0017] Performing a parsing operation on the first structure array variable according to the processing function index under the third structure array variable;

[0018] Start the timer, and after the set time has passed, send the data in the CAN bus send buffer to the next business process.

[0019] According to the technical solution provided by the present invention, the first length information is recorded in the CAN data transceiver information tag data, and the first length information includes: the CAN data transceiver information number ID, the first number of bytes of the sent message, the first number of CAN frames of the sent message, the first number of bytes of the received message, the first number of CAN frames of the received message, the first processing flag, the sequence number of the basic function, and the first timeout period;

[0020] The CAN message content filling tag data records second length information, the second length information including: CAN message content filling number ID, the index number of each frame in the CAN bus, the index number of each byte in each frame of the CAN bus, and the data content to be filled;

[0021] The CAN message data transport information tag data records third length information, and the third length information includes: CAN message data transport information number ID, transport data source index number, transport data source sub-index, transport destination index number, transport destination sub-index, and transport byte count.

[0022] According to the technical solution provided by the present invention, the first structure array variable represents a CAN data transceiver information processing table, the number of elements of the first structure array variable is greater than the first length information, and the element content of the first structure array variable is a structure of the CAN data transceiver information type;

[0023] The second structure array variable represents an initial data table of a CAN message transmission, the number of elements of the second structure array variable is greater than the second length information, and the element content of the second structure array variable is a structure of the CAN message content filling type;

[0024] The third structure array variable represents a CAN data transceiver information processing table, the number of elements of the third structure array variable is greater than the third length information, and the element content of the third structure array variable is a structure of the CAN message data handling information type; a second timeout period is set under the ID entry of the third structure array variable;

[0025] Each record table contains the number of entries in the third structure array variable.

[0026] According to the technical solution provided by the present invention, the set time is set to be smaller than the second timeout time.

[0027] According to the technical solution provided by the present invention, the basic structure of the CAN frame includes: CAN bus ID, data length, and a first array;

[0028] The CAN frame management structure includes: the basic structure of the CAN frame and the current number of frames in the CAN bus;

[0029] The indexes of the CAN bus receive buffer and the CAN bus send buffer are arranged according to ID numbers; the elements in the CAN bus receive buffer and the CAN bus send buffer are all the CAN frame management structures; the initial values ​​of the CAN bus receive buffer and the CAN bus send buffer are set to empty.

[0030] According to the technical solution provided by the present invention, the step of parsing the XML node tree to obtain an updated XML node tree includes:

[0031] An XML element search function is used to search for elements contained in the CAN data transceiver information; the current node and the top node of the CAN data transceiver information are both selected from the XML node tree, and the search mode of the XML element search function is set to only view nodes at the same level;

[0032] Saving the elements contained in the CAN data receiving and sending information as a first node tree in an XML node structure format;

[0033] Setting the first node tree as the top node of the CAN data receiving and sending information;

[0034] Obtaining the second-level nodes and the third-level nodes of the first node tree;

[0035] The second-level nodes and the third-level nodes are updated to obtain the updated XML node tree.

[0036] According to the technical solution provided by the present invention, the step of updating the second-level node and the third-level node includes:

[0037] Using the XML element search function to traverse all initial nodes of the first node tree; the current node and the top node of the XML element search function are both selected from the first node tree, the search mode of the XML element search function is set to only view nodes at the same level, and the attributes and names of the secondary nodes are both set to none;

[0038] Judgment: When the initial node is not empty, use the element attribute acquisition function to obtain the first length information in the CAN data receiving and sending information into the memory variable of the initial node, and proceed to the next step; otherwise, report an error and exit the program;

[0039] Using the XML element search function to obtain the third-level node of the first node tree, the current node of the third-level node is selected as the initial node, the top node is selected as the first node tree, and the attributes and name of the third-level node are both set to none;

[0040] Taking the third-level node as the initial node;

[0041] The initial node is re-substituted into the XML node tree to obtain the updated XML node tree.

[0042] According to the technical solution provided by the present invention, the step of the CAN bus receiving the data in the CAN bus send buffer includes:

[0043] Get the data received by the CAN bus and match the serial number according to the CAN bus ID value;

[0044] The data received by the CAN bus are stored in the CAN bus receiving buffer corresponding to the CAN ID respectively;

[0045] Updating the current number of frames in the CAN bus in the CAN frame management structure;

[0046] Judgment: When the current number of frames in the CAN bus is equal to the number of CAN frames of the first received message of the CAN data transceiver information, proceed to the next step; otherwise, report an error and exit the program;

[0047] Judgment: When the number of CAN frames of the first sent message is equal to the number of received messages of the third structure array variable, the data received by the CAN bus is verified; otherwise, an error is reported and the program exits.

[0048] In a second aspect, the present invention provides a computer device comprising: a memory, a processor, and a program stored in the memory for performing an XML-based CAN bus service process processing method; the program for performing an XML-based CAN bus service process processing method is configured to:

[0049] The method for processing a CAN bus business process based on XML is carried out.

[0050] In a third aspect, the present invention provides a storage medium storing a program for a method for processing a CAN bus service flow based on XML; when the program for processing a CAN bus service flow based on XML is executed, the storage medium is used to:

[0051] The method for processing a CAN bus business process based on XML is carried out.

[0052] The beneficial effects of the present invention are:

[0053] By setting up an XML file; defining structure array variables corresponding to the CAN data receiving and sending information, CAN message content filling, and CAN message data handling information, as well as the CAN frame basic structure, CAN frame management structure, CAN bus receive buffer, and CAN bus send buffer; then parsing the XML file and filling the CAN bus send buffer with data; using the processing function index to parse the first structure array variable; and finally sending the data in the CAN bus send buffer to the next business process. The above method can store the data required for the simulation process under the current working condition into the CAN bus buffer, and directly send the data from the CAN bus send buffer during use, facilitating data transmission and greatly reducing the difficulty of data modification; simplifying the operation, and enabling easy and quick modification or transmission of data under different working conditions. BRIEF DESCRIPTION OF THE DRAWINGS

[0054] Other features, objects and advantages of the present invention will become more apparent upon reading the detailed description of non-limiting embodiments made with reference to the following drawings:

[0055] Figure 1 A schematic diagram of a CAN bus service process processing method based on XML provided by the present invention;

[0056] Figure 2 The present invention is a flowchart of a CAN bus receiving data in the CAN bus sending buffer. DETAILED DESCRIPTION

[0057] The present invention will be further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are intended only to illustrate the relevant invention and are not intended to limit the invention. It should also be noted that, for ease of description, only portions relevant to the invention are shown in the accompanying drawings.

[0058] It should be noted that, in the absence of conflict, the embodiments and features of the embodiments of the present invention can be combined with each other. The present invention will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0059] Example 1

[0060] Please refer to Figure 1 , which is a flow chart of a CAN bus business process processing method based on XML provided by the present invention, including:

[0061] S1: Setting an XML file, including: setting label data of CAN data receiving and sending information, CAN message content filling and CAN message data handling information under the XML file;

[0062] S2: respectively defining structure array variables corresponding to the CAN data receiving and transmitting information, CAN message content filling, and CAN message data handling information, and obtaining a first structure array variable, a second structure array variable, and a third structure array variable;

[0063] S3: define the CAN frame basic structure, CAN frame management structure, CAN bus receive buffer and CAN bus send buffer respectively;

[0064] S4: Get the handle of the XML file;

[0065] S5: Convert the XML file into an XML node tree;

[0066] S6: Parse the XML node tree to obtain an updated XML node tree;

[0067] S7: Obtain tag data of CAN message content filling and CAN message data handling information;

[0068] S8: Filling the data in the second structure array variable into the CAN bus transmit buffer;

[0069] S9: The CAN bus receives the data in the CAN bus send buffer;

[0070] S10: performing a copy operation on the first structure array variable according to the data under the second structure array variable;

[0071] S11: performing a parsing operation on the first structure array variable according to the processing function index under the third structure array variable;

[0072] S12: Start the timer, and after the set time has passed, send the data in the CAN bus send buffer to the next business process.

[0073] In some implementations, the XML file is specifically represented as settings.xml;

[0074] The tag data of CAN data sending and receiving information is info;

[0075] The tag data filled with CAN message content is initial;

[0076] The tag data of CAN message data handling information is process;

[0077] The basic structure of the CAN frame is represented as CAN_BASIC_STRU;

[0078] The CAN frame management structure is represented as CAN_MANI_STRU;

[0079] The CAN bus receive buffer is represented by CAN_RECV_BUFF;

[0080] The CAN bus send buffer is represented by CAN_SND_BUFF.

[0081] In some implementations, obtaining a handle to the XML file; converting the XML file into an XML node tree; and parsing the XML node tree to obtain an updated XML node tree are performed in the following manner:

[0082] Use fopen to open the XML file in read-only mode. After successful opening, the XML file handle fp is returned.

[0083] Use mxmlLoadFile to convert the XML file into an XML node tree;

[0084] The conversion method is to parse all data into text form;

[0085] Save the successfully converted nodes as a tree in XML node structure (mxml_node_t) format;

[0086] Use fclose to close the file.

[0087] Specifically, in XML files, a handle is often used to manipulate XML documents. It is an identifier used to reference a node in an XML document. By using a handle, you can perform operations such as reading, writing, modifying, and deleting XML documents.

[0088] In some implementations, the advantage of using function indexes to parse CAN data is that it can convert CAN data into elements of a structure array, thereby facilitating the identification, processing, and analysis of CAN data. Parsing CAN data using function indexes can achieve flexible control of the CAN bus and efficient data processing.

[0089] Specifically, the above method can configure CAN data parameters using XML files, allowing for dynamic reconfiguration of interaction data and interaction logic. The data required for the simulation process under the current working condition is stored in the CAN bus buffer. During use, the data is directly sent from the CAN bus send buffer, facilitating data transmission and significantly reducing the difficulty of data modification. This simplifies operations and allows for quick and easy modification or transmission of data under different working conditions.

[0090] Furthermore, the CAN data transceiver information tag data records first length information, wherein the first length information includes: a CAN data transceiver information number ID, a first number of bytes of a sent message, a first number of CAN frames of a sent message, a first number of bytes of a received message, a first number of CAN frames of a received message, a first processing flag, a sequence number of a basic function, and a first timeout period;

[0091] The CAN message content filling tag data records second length information, the second length information including: CAN message content filling number ID, the index number of each frame in the CAN bus, the index number of each byte in each frame of the CAN bus, and the data content to be filled;

[0092] The CAN message data transport information tag data records third length information, and the third length information includes: CAN message data transport information number ID, transport data source index number, transport data source sub-index, transport destination index number, transport destination sub-index, and transport byte count.

[0093] In some embodiments, the CAN data transceiver information tag data includes,

[0094] The number of bytes of the first message sent is represented as tsize;

[0095] The number of CAN frames of the first sent message is expressed as tcnt;

[0096] The number of bytes of the first received message is represented as rsize;

[0097] The number of CAN frames of the first received message is represented as rcnt;

[0098] The first processing flag is expressed as needtotackle;

[0099] The serial number of the basic function is represented by num;

[0100] The first timeout is expressed as timeout.

[0101] In some embodiments, the CAN message content fills the tag data contained in,

[0102] The index number of each frame in the CAN bus is represented as IDX;

[0103] The index number of each byte in each frame of the CAN bus is represented as SUBIDX.

[0104] In some embodiments, the CAN message data carries information tag data including,

[0105] The index number of the transport data source is represented as SRCIDX;

[0106] The sub-index of the transport data source is represented as SRCSUBIDX;

[0107] The transport destination index number is represented as DSTIDX;

[0108] The transport sub-index is represented by DSTSUBIDX;

[0109] The number of bytes transferred is expressed as size.

[0110] Furthermore, the first structure array variable represents a CAN data transceiver information processing table, the number of elements of the first structure array variable is greater than the first length information, and the element content of the first structure array variable is a structure of the CAN data transceiver information type;

[0111] The second structure array variable represents an initial data table of a CAN message transmission, the number of elements of the second structure array variable is greater than the second length information, and the element content of the second structure array variable is a structure of the CAN message content filling type;

[0112] The third structure array variable represents a CAN data transceiver information processing table, the number of elements of the third structure array variable is greater than the third length information, and the element content of the third structure array variable is a structure of the CAN message data handling information type; a second timeout period is set under the ID entry of the third structure array variable;

[0113] Each record table contains the number of entries in the third structure array variable.

[0114] In some embodiments, the first structure array variable is represented as chart_info, which represents the CAN data transceiver information processing table; the second structure array variable is represented as chart_initial, which represents the CAN message sending initial data table; the third structure array variable is represented as chart_process, which represents the CAN data transceiver information processing table.

[0115] The CAN data transceiver information processing table, the CAN message sending initial data table, and the CAN data transceiver information processing table all include the number of entries in their respective tables.

[0116] Furthermore, the set time is set to be smaller than the second timeout time.

[0117] In some embodiments, the set time is set to 80% of the second timeout period. Sending the data in the CAN bus send buffer to the next business process before the CAN data transceiver information processing table processing process times out can ensure stable data transmission and avoid the situation where the data is sent due to timeout and the transmission fails.

[0118] Furthermore, the basic structure of the CAN frame includes: CAN bus ID, data length, and a first array;

[0119] The CAN frame management structure includes: the basic structure of the CAN frame and the current number of frames in the CAN bus;

[0120] The indexes of the CAN bus receive buffer and the CAN bus send buffer are arranged according to ID numbers; the elements in the CAN bus receive buffer and the CAN bus send buffer are all the CAN frame management structures; the initial values ​​of the CAN bus receive buffer and the CAN bus send buffer are set to empty.

[0121] In some implementations, the data length contained in the CAN frame basic structure CAN_BASIC_STRU is represented as DLC, and the first array is an eight-byte array represented as DATA.

[0122] The CAN frame management structure CAN_MANI_STRU contains the current number of frames on the CAN bus, represented by FRM_CNT. The indexes of the CAN bus receive buffer CAN_RECV_BUFF and the CAN bus transmit buffer CAN_SND_BUFF are arranged according to the ID number, and the ID number arrangement is determined by the constant table ID_TABLE.

[0123] In some implementations, setting the initial values ​​of the CAN bus receive buffer and the CAN bus send buffer to empty can facilitate the transmission of new data and avoid transmission errors.

[0124] Furthermore, the step of parsing the XML node tree to obtain an updated XML node tree includes:

[0125] An XML element search function is used to search for elements contained in the CAN data transceiver information; the current node and the top node of the CAN data transceiver information are both selected from the XML node tree, and the search mode of the XML element search function is set to only view nodes at the same level;

[0126] Saving the elements contained in the CAN data receiving and sending information as a first node tree in an XML node structure format;

[0127] Setting the first node tree as the top node of the CAN data receiving and sending information;

[0128] Obtaining the second-level nodes and the third-level nodes of the first node tree;

[0129] The second-level nodes and the third-level nodes are updated to obtain the updated XML node tree.

[0130] In some implementations, the XML element search function is specifically mxmlFindElement; the elements contained in the CAN data receiving and transmitting information are represented by an XML node structure as mxml_node_t, which is stored in a tree1 format; and the node is represented by node.

[0131] Furthermore, the step of updating the second-level node and the third-level node includes:

[0132] Using an XML element search function to traverse all initial nodes of the first node tree; the current node and the top node of the XML element search function are both selected from the first node tree, the search mode of the XML element search function is set to only view nodes at the same level, and the attributes and names of the secondary nodes are both set to none;

[0133] Judgment: When the initial node is not empty, use the element attribute acquisition function to obtain the first length information in the CAN data receiving and sending information into the memory variable of the initial node, and proceed to the next step; otherwise, report an error and exit the program;

[0134] Using the XML element search function to obtain the third-level node of the first node tree, the current node of the third-level node is selected as the initial node, the top node is selected as the first node tree, and the attributes and name of the third-level node are both set to none;

[0135] Taking the third-level node as the initial node;

[0136] The initial node is re-substituted into the XML node tree to obtain the updated XML node tree.

[0137] In some implementations, the element attribute acquisition function is specifically mxmlElementGetAttr.

[0138] Specifically, a node tree is a way to parse XML files. By traversing the node tree, you can parse the data in the XML file and convert it into a data structure that the program can process. Updating each node in the node tree allows for faster reading, writing, searching, and filtering of data, enabling convenient data modification or transfer under different operating conditions.

[0139] Further, refer to Figure 2 The step of the CAN bus receiving the data in the CAN bus sending buffer includes:

[0140] S81: Obtain the data received by the CAN bus and perform serial number matching according to the CAN bus ID value;

[0141] S82: storing the data received by the CAN bus into the CAN bus receiving buffer corresponding to the CAN ID;

[0142] S83: Update the current number of frames in the CAN bus in the CAN frame management structure;

[0143] S84: Determine: When the current number of frames in the CAN bus is equal to the number of CAN frames of the first received message of the CAN data transceiver information, proceed to the next step; otherwise, report an error and exit the program;

[0144] S85: Judge: When the number of CAN frames of the first sent message is equal to the number of received messages of the third structure array variable, proceed to the next step; otherwise, report an error and exit the program

[0145] S86: Verify the data received by the CAN bus.

[0146] Specifically, nodes on the CAN bus can be controlled based on their ID values ​​and sequence numbers. By matching sequence numbers, node behavior can be controlled, for example, allowing certain nodes to send data while blocking others. This approach effectively identifies nodes, matches data, controls behavior, and optimizes transmission, making the CAN bus more flexible and reliable.

[0147] Example 2

[0148] A computer device comprising: a memory, a processor, and a program stored in the memory for performing an XML-based CAN bus service process processing method; the program for performing an XML-based CAN bus service process processing method is configured to:

[0149] The method for processing a CAN bus business process based on XML is carried out.

[0150] Specifically, a computer device includes a central processing unit (CPU), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) or a program loaded from a storage portion into a random access memory (RAM). In the RAM, various programs and data required for system operation are also stored. The CPU, ROM, and RAM are connected to each other via a bus. An input / output (I / O) interface is also connected to the bus.

[0151] The following components are connected to the I / O interface: an input section including a keyboard, mouse, and the like; an output section including a cathode ray tube (CRT), liquid crystal display (LCD), and speakers; a storage section including a hard disk; and a communication section including a network interface card such as a LAN card and a modem. The communication section performs communication processing via a network such as the Internet. A drive is also connected to the I / O interface as needed. Removable media such as magnetic disks, optical disks, magneto-optical disks, semiconductor memories, and the like are installed in the drive as needed, so that computer programs read from them can be installed in the storage section as needed.

[0152] Example 3

[0153] A storage medium storing a program for a method for processing a CAN bus service flow based on XML; when the program for processing a CAN bus service flow based on XML is executed, the program is used to:

[0154] The method for processing a CAN bus business process based on XML is carried out.

[0155] Specifically, the present invention further provides a storage medium, which may be included in the electronic device described in the above embodiments, or may exist independently and not be incorporated into the electronic device. The storage medium carries one or more programs, and when executed by the electronic device, the electronic device implements the method described in the above embodiments, specifically the XML-based CAN bus service process processing and calculation method described in any of the above embodiments.

[0156] The above description is merely a preferred embodiment of the present invention and an illustration of the technical principles employed. Those skilled in the art should understand that the scope of the invention is not limited to the technical solutions formed by the specific combination of the above-mentioned technical features, but also encompasses other technical solutions formed by any combination of the above-mentioned technical features or their equivalents without departing from the inventive concept. For example, a technical solution formed by replacing the above-mentioned features with (but not limited to) technical features with similar functions disclosed in the present invention.

Claims

1. A CAN bus business process processing method based on XML, characterized in that: include: Setting an XML file includes: setting label data of CAN data receiving and sending information, CAN message content filling, and CAN message data handling information under the XML file; Respectively define structure array variables corresponding to the CAN data receiving and transmitting information, CAN message content filling, and CAN message data handling information, and obtain a first structure array variable, a second structure array variable, and a third structure array variable; Define the CAN frame basic structure, CAN frame management structure, CAN bus receive buffer and CAN bus send buffer respectively; Get the handle of the XML file; Convert the XML file into an XML node tree; Parsing the XML node tree to obtain an updated XML node tree; Get the tag data of CAN message content filling and CAN message data handling information; Fill the data in the second structure array variable into the CAN bus send buffer; The CAN bus receives the data in the CAN bus sending buffer; Performing a copy operation on the first structure array variable according to the data under the second structure array variable; Performing a parsing operation on the first structure array variable according to the processing function index under the third structure array variable; Start the timer, and after the set time has passed, send the data in the CAN bus send buffer to the next business process.

2. The XML-based CAN bus business process processing method according to claim 1, characterized in that: The CAN data transceiver information tag data records first length information, wherein the first length information includes: a CAN data transceiver information number ID, a first sent message byte number, a first sent message CAN frame number, a first received message byte number, a first received message CAN frame number, a first processing flag, a sequence number of a basic function, and a first timeout period; The CAN message content filling tag data records second length information, the second length information including: CAN message content filling number ID, the index number of each frame in the CAN bus, the index number of each byte in each frame of the CAN bus, and the data content to be filled; The CAN message data transport information tag data records third length information, and the third length information includes: CAN message data transport information number ID, transport data source index number, transport data source sub-index, transport destination index number, transport destination sub-index, and transport byte count.

3. The XML-based CAN bus business process processing method according to claim 2, characterized in that: The first structure array variable represents a CAN data transceiver information processing table, the number of elements of the first structure array variable is greater than the first length information, and the element content of the first structure array variable is a structure of the CAN data transceiver information type; The second structure array variable represents an initial data table of a CAN message transmission, the number of elements of the second structure array variable is greater than the second length information, and the element content of the second structure array variable is a structure of the CAN message content filling type; The third structure array variable represents a CAN data transceiver information processing table, the number of elements of the third structure array variable is greater than the third length information, and the element content of the third structure array variable is a structure of the CAN message data handling information type; a second timeout period is set under the ID entry of the third structure array variable; Each record table contains the number of entries in the third structure array variable.

4. The XML-based CAN bus business process processing method according to claim 3, characterized in that: The set time is set to be smaller than the second timeout time.

5. The XML-based CAN bus business process processing method according to claim 3 is characterized in that: The basic structure of the CAN frame includes: CAN bus ID, data length, and a first array; The CAN frame management structure includes: the basic structure of the CAN frame and the current number of frames in the CAN bus; The indexes of the CAN bus receive buffer and the CAN bus send buffer are arranged according to ID numbers; the elements in the CAN bus receive buffer and the CAN bus send buffer are all the CAN frame management structures; the initial values ​​of the CAN bus receive buffer and the CAN bus send buffer are set to empty.

6. The XML-based CAN bus business process processing method according to claim 5, characterized in that: The step of parsing the XML node tree to obtain an updated XML node tree includes: An XML element search function is used to search for elements contained in the CAN data transceiver information; the current node and the top node of the CAN data transceiver information are both selected from the XML node tree, and the search mode of the XML element search function is set to only view nodes at the same level; Saving the elements contained in the CAN data receiving and sending information as a first node tree in an XML node structure format; Setting the first node tree as the top node of the CAN data receiving and sending information; Obtaining the second-level nodes and the third-level nodes of the first node tree; The second-level nodes and the third-level nodes are updated to obtain the updated XML node tree.

7. The XML-based CAN bus business process processing method according to claim 6, characterized in that: The steps of updating the second-level node and the third-level node include: Using an XML element search function to traverse all initial nodes of the first node tree; the current node and the top node of the XML element search function are both selected from the first node tree, the search mode of the XML element search function is set to only view nodes at the same level, and the attributes and names of the secondary nodes are both set to none; Judgment: When the initial node is not empty, use the element attribute acquisition function to obtain the first length information in the CAN data receiving and sending information into the memory variable of the initial node, and proceed to the next step; otherwise, report an error and exit the program; Using the XML element search function to obtain the third-level node of the first node tree, the current node of the third-level node is selected as the initial node, the top node is selected as the first node tree, and the attributes and name of the third-level node are both set to none; Taking the third-level node as the initial node; The initial node is re-substituted into the XML node tree to obtain the updated XML node tree.

8. The XML-based CAN bus business process processing method according to claim 5, characterized in that: The step of the CAN bus receiving the data in the CAN bus send buffer includes: Get the data received by the CAN bus and match the serial number according to the CAN bus ID value; The data received by the CAN bus are stored in the CAN bus receiving buffer corresponding to the CAN ID respectively; Updating the current number of frames in the CAN bus in the CAN frame management structure; Judgment: When the current number of frames in the CAN bus is equal to the number of CAN frames of the first received message of the CAN data transceiver information, proceed to the next step; otherwise, report an error and exit the program; Judgment: When the number of CAN frames of the first sent message is equal to the number of received messages of the third structure array variable, the data received by the CAN bus is verified; otherwise, an error is reported and the program exits.

9. A computer device, characterized in that: include: A memory, a processor, and a program stored in the memory for performing an XML-based CAN bus service process processing method; the program for performing an XML-based CAN bus service process processing method is configured to: Perform an XML-based CAN bus business process processing method as described in any one of claims 1 to 7.

10. A storage medium, characterized in that: The storage medium stores a program of a method for processing a CAN bus service flow based on XML; when the program of the method for processing a CAN bus service flow based on XML is executed, it is used to: Perform an XML-based CAN bus business process processing method as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • PC (Personal Computer) simulated automobile CAN (Controller Area Network) bus communication system

    CN115643124A

  • CAN bus data transmission method and management platform

    CN115766331A