A compatible communication method, device and equipment based on CAN protocol and medium

CN123020673APending Publication Date: 2026-10-30SHENZHEN POWEROAK NEWENER CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611146942.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-30
Publication Date
2026-10-30

AI Technical Summary

Technical Problem

[0005]本发明实施例提供一种基于CAN协议的兼容通信方法、装置、设备及介质,以解决如何在不进行复杂协议适配的情况下,实现设备间通信的兼容性,保证通信的正常交互的问题

Benefits of technology

[0010]上述基于CAN协议的兼容通信方法,通过接收第一设备发送的原始数据,根据原始数据,从预设插件库中匹配得到目标CAN协议插件,调用目标CAN协议插件,对原始数据进行转化处理,得到目标数据,将目标数据发送给第二设备。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123020673A_ABST
    Figure CN123020673A_ABST
Patent Text Reader

Abstract

The application relates to the technical field of communication, and discloses a compatible communication method, device and equipment based on a CAN protocol and a medium, which comprises the following steps: receiving original data sent by a first device, matching a target CAN protocol plug-in from a preset plug-in library according to the original data, calling the target CAN protocol plug-in, performing transformation processing on the original data to obtain target data, and sending the target data to a second device. The application does not need to perform protocol adaptation development between devices, reduces development and maintenance costs, realizes compatibility of communication between devices, and guarantees normal communication interaction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of communication technology, and in particular to a compatible communication method, apparatus, device and medium based on the CAN protocol. Background Technology

[0002] With the widespread application of energy storage systems in power dispatching, new energy access, and microgrids, communication and control of energy storage systems have become crucial for ensuring system reliability and efficiency. Currently, most energy storage systems use CAN (Controller Area Network) buses to achieve data transmission between energy storage devices, and utilize the system's open API (Application Programming Interface) to support the upper-level system in issuing control commands to the energy storage devices.

[0003] In traditional solutions, the CAN protocol of energy storage systems is usually customized by the manufacturer or uses standardized protocols such as GB / T and Modbus over CAN. However, due to significant differences in interface formats, data definitions, and communication mechanisms between different manufacturers, equipment types, or protocol versions, when expanding energy storage systems with new equipment or integrating third-party devices, it is often necessary to carry out a lot of adaptation development work for each protocol in order to ensure normal communication and interaction between devices within the system and between the system and upper-level systems. This results in long development cycles and high maintenance costs.

[0004] Therefore, how to achieve compatibility in communication between devices and ensure normal communication interaction without complex protocol adaptation has become an urgent problem to be solved. Summary of the Invention

[0005] This invention provides a CAN protocol-based compatible communication method, apparatus, device, and medium to solve the problem of how to achieve device-to-device communication compatibility and ensure normal communication interaction without complex protocol adaptation.

[0006] A CAN-compatible communication method, comprising: Receive raw data sent by the first device; Based on the raw data, the target CAN protocol plugin is matched from the preset plugin library; The target CAN protocol plugin is invoked to transform the raw data and obtain the target data; The target data is sent to the second device.

[0007] A CAN-compatible communication device includes: A receiving module is used to receive raw data sent by the first device; The matching module is used to match the target CAN protocol plugin from a preset plugin library based on the original data; The processing module is used to call the target CAN protocol plugin to transform the raw data and obtain the target data; The sending module is used to send the target data to the second device.

[0008] A computer device includes a processor and a memory, the memory storing a computer program that can run on the processor, and when the processor executes the computer program, it implements the above-described CAN protocol-based compatible communication method.

[0009] A computer-readable storage medium storing a computer program, which, when executed by a processor, implements the aforementioned CAN protocol-based compatible communication method.

[0010] The above-described CAN protocol-based compatible communication method receives raw data sent by the first device, matches the target CAN protocol plugin from a preset plugin library based on the raw data, calls the target CAN protocol plugin to convert and process the raw data to obtain the target data, and then sends the target data to the second device.

[0011] When receiving raw data from a device, the system automatically identifies and calls the target protocol plugin that matches the current device through a matching mechanism and the CAN protocol plugin in the plugin library. This transforms the raw data sent by the first device to adapt it to the second device receiving the data. This eliminates the need for protocol adaptation development between devices, reducing development and maintenance costs, and achieving compatibility between devices, thus ensuring normal communication interaction. Attached Figure Description

[0012] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0013] Figure 1 This is a schematic diagram of an application environment for a CAN protocol-based compatible communication method according to an embodiment of the present invention; Figure 2 This is a flowchart of a CAN protocol-based compatible communication method according to an embodiment of the present invention; Figure 3 This is another flowchart of a CAN protocol-based compatible communication method in one embodiment of the present invention; Figure 4This is a schematic diagram of a CAN protocol-compatible communication device according to an embodiment of the present invention; Figure 5 This is a schematic diagram of a computer device according to an embodiment of the present invention. Detailed Implementation

[0014] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0015] The CAN protocol-based compatible communication method provided in this invention can be applied to, for example... Figure 1 The application environment shown includes, for example: Figure 1 The diagram illustrates a client and server. The client and server communicate over a network to address the challenge of achieving device-to-device communication compatibility and ensuring normal interaction without complex protocol adaptations. The client, also known as the user terminal, is the program that provides local services to the client, corresponding to the server. The client can be installed on, but is not limited to, various personal computers, laptops, smartphones, tablets, and portable wearable devices. The server can be implemented using a standalone server or a server cluster consisting of multiple servers.

[0016] In one embodiment, such as Figure 2 As shown, a CAN protocol-based compatible communication method is provided and applied to a server as shown in Figure 1, including the following steps: Step S201: Receive the raw data sent by the first device.

[0017] In this embodiment, the first device may refer to a computer device that sends data, and the original data may refer to the data to be transmitted encoded based on the communication protocol of the first device.

[0018] For example, if the first device is a device in an energy storage system that communicates based on the CAN protocol, then the raw data sent by the first device can be obtained from the CAN bus connected to the first device.

[0019] Optionally, before receiving the raw data sent by the first device, the method further includes: For any CAN protocol plugin in the preset plugin library, perform a validity test on the CAN protocol plugin and obtain the test result; If the detection result meets the preset second condition, then the step of receiving the raw data sent by the first device is executed; If the detection result does not meet the preset second condition, the CAN protocol plugin will be removed from the preset plugin library.

[0020] The detection result can refer to the validity test result of the CAN protocol plugin, such as whether the CAN protocol plugin can be loaded and parsed normally, and whether the plugin version is compatible with the current system. The preset second condition can refer to the conditions that the CAN protocol plugin needs to meet to be loaded and used normally.

[0021] For example, before receiving the raw data sent by the first device, the energy storage system can load a preset plugin library. For any CAN protocol plugin in the preset plugin library, the system can perform a validity test on the CAN protocol plugin. The test can refer to checking the plugin's file integrity, version compatibility, and whether the protocol parsing function is normal. If the test result is that the plugin file is complete, the version is compatible, and the function is normal, then the test result is determined to meet the preset second condition, and the step of receiving the raw data sent by the first device is executed. If the test result is that the plugin file is corrupted, the version is incompatible, or the function is abnormal, then the test result is determined to not meet the preset second condition, and the CAN protocol plugin is removed from the preset plugin library.

[0022] Step S202: Based on the raw data, match the target CAN protocol plugin from the preset plugin library.

[0023] In this embodiment, a preset plugin library is used to store target CAN protocol plugins. A target CAN protocol plugin can refer to a plugin obtained by encapsulating the CAN protocol. The target CAN protocol plugin may include a protocol parser, a data encapsulator, a data decapsulator, and mapping rules, etc. The protocol parser is used to perform data radix conversion processing. The data decapsulator is used to decapsulate data without specific physical meaning according to the CAN protocol corresponding to the plugin to obtain data with specific physical meaning. The data encapsulator is used to encapsulate data with specific physical meaning according to the CAN protocol corresponding to the plugin to obtain data without specific physical meaning. The mapping rules are used to perform data format conversion.

[0024] Specifically, the raw data is parsed to determine the identification information of the target CAN protocol plugin in the raw data, and the target CAN protocol plugin is obtained by matching it from the preset plugin library based on the identification information.

[0025] Optionally, after receiving the raw data sent by the first device, the method further includes: Obtain the access control list of the second device; Determine the access permissions of the first device to the second device based on the access control list; If the access permission is set to allowed, then the target CAN protocol plugin will be matched from the preset plugin library based on the original data. If the access permission is not allowed, a message indicating no permission to communicate is returned to the first device.

[0026] In this context, an access control list can refer to a data table used to store access permission rules between storage devices, including permission records that allow or prohibit a specific device from accessing a second device.

[0027] For example, the first device is a computer device in the external upper-layer system of the energy storage system. Communication between the first device and the energy storage system can be based on the API interface provided by the energy storage system. The second device is a device within the energy storage system. All devices in the energy storage system are connected to a CAN bus, and communication between devices within the energy storage system is based on the CAN protocol. After receiving raw data from the first device, the access control list of the second device is obtained. Based on the access control list, the access permissions of the first device to the second device are determined. If the access permission is allowed, the request is approved, and the target CAN protocol plugin is matched from a preset plugin library based on the raw data. If the access permission is not allowed, a security log is recorded, and a message indicating no permission to communicate is returned to the first device.

[0028] By using access control lists to verify the access requests of the first device, the identity of the access subject can be identified and authorized before the communication link is established. This effectively prevents unauthorized devices from illegally accessing sensitive resources in the energy storage system, thereby improving the system's security and access controllability.

[0029] Step S203: The original data is transformed and processed by the target CAN protocol plugin to obtain the target data.

[0030] Step S204: Send the target data to the second device.

[0031] In this embodiment, the target data can refer to the data that has been transformed and processed by the target CAN protocol plugin and is compatible with the second device. The second device can refer to the computer device that communicates and transmits data with the first device.

[0032] Specifically, the original data is transformed and processed using the CAN protocol rules encapsulated in the target CAN protocol plugin to obtain target data compatible with the second device, and then the target data is sent to the second device.

[0033] For example, when sending target data to a second device, if the second device is a device in the energy storage system that communicates based on the CAN protocol, the target data is sent to the second device through the CAN bus connected to the second device; if the second device is a computer device in an external upper-level system of the energy storage system, the target data can be sent to the second device through the API exposed by the energy storage system. For example, the target data can be encapsulated in a standard format (such as JSON, Protobuf) and output to the second device through a transmission protocol corresponding to the second device (such as RESTful API, WebSocket, MQTT).

[0034] Optionally, after receiving the raw data sent by the first device, the method further includes: Store the raw data in a preset cache queue; When all the raw data in the preset cache queue meets the preset first condition, each raw data is parsed to determine the CAN identifier in the corresponding raw data. Group all raw data with the same CAN identifier into a data group; Based on the raw data, the target CAN protocol plugins are matched from the preset plugin library, including: For any data group, based on the CAN identifier corresponding to the data group, the fourth target CAN protocol plugin corresponding to the data group is matched from the preset plugin library; The target CAN protocol plugin is invoked to transform and process the raw data to obtain the target data, which also includes: The fourth target CAN protocol plugin corresponding to the data group is invoked to transform each piece of raw data in the data group to obtain the target data corresponding to each piece of raw data.

[0035] Among them, the preset cache queue can refer to a pre-set queue for caching raw data, the preset first condition can refer to the pre-set condition required for parsing and processing the raw data in the preset cache queue, for example, the preset first condition can be that the data volume of all raw data in the preset cache queue reaches the data volume threshold, or the caching time of the raw data in the preset cache queue reaches the time threshold, etc. The data group can refer to the set of raw data with the same CAN identifier. The CAN identifier is used to identify the transformation processing of the raw data to adapt to and be compatible with the CAN protocol plugin of the second device. The CAN identifier corresponding to the fourth target CAN protocol plugin data group matches the CAN protocol plugin of the target device.

[0036] That is, after receiving raw data sent by any device, the raw data can be stored in a preset cache queue. When the total amount of raw data in the preset cache queue meets the data amount threshold, or when the cache time in the preset cache queue reaches the time threshold, a batch operation task is generated for all raw data in the preset cache queue. Batch processing is performed, each raw data in the preset cache queue is parsed, the CAN identifier in the corresponding raw data is determined, and all raw data with the same CAN identifier are grouped into a data group. For any data group, the fourth target CAN protocol plugin corresponding to the data group is matched from the preset plugin library according to the CAN identifier corresponding to the data group. Through the fourth target CAN protocol plugin corresponding to the data group, each raw data in the data group is transformed and processed to obtain the target data corresponding to each raw data.

[0037] By caching the raw data in a queue, batch processing is triggered when a preset first condition is met. This allows the batch transformation of the same group of data to be completed by calling the matching plugin only once, reducing the number of plugin matching attempts, lowering system overhead, and improving processing efficiency.

[0038] In this embodiment, when the raw data sent by the device is received, the target protocol plugin that matches the current device is automatically identified and called through the matching mechanism and the CAN protocol plugin in the plugin library. The raw data sent by the first device is converted and processed to adapt to the second device receiving the data. There is no need to develop the adaptation of the protocol between devices, which reduces the development and maintenance costs and realizes the compatibility of communication between devices, ensuring normal communication interaction.

[0039] In one embodiment, such as Figure 3 As shown, a CAN protocol-based compatible communication method is provided. In step S202, the target CAN protocol plugin is matched from a preset plugin library based on the original data, including the following steps: Step S301: The raw data is CAN message data. The CAN message data is parsed to obtain the raw CAN message.

[0040] Step S302: Based on the first CAN identifier of the original CAN message, match the first target CAN protocol plugin from the preset plugin library.

[0041] In step S203 above, the target CAN protocol plugin is invoked to transform the raw data and obtain the target data, including: Step S303: Call the first target CAN protocol plugin to decapsulate the original CAN message and obtain the target data.

[0042] In this embodiment, the first device is a device that communicates based on the first CAN protocol. The first CAN protocol can refer to the CAN protocol used by the first device for communication. The second device is a device that communicates based on a non-CAN protocol. For example, the second device can be a device that communicates based on RESTful API, WebSocket, and MQTT transport protocols. The CAN message data is message data based on the CAN protocol. The original CAN message can refer to the message data sent by the first device after data encoding according to the first CAN protocol. The first CAN identifier can be used to identify the CAN protocol plugin that converts and processes the data communicated using the first CAN protocol. The first target CAN protocol plugin is a plugin that encapsulates the first CAN protocol.

[0043] For example, the first device can be a device in a storage system, where all devices are connected to a CAN bus. Communication between devices within the storage system is based on the CAN protocol, which is the CAN protocol used by the first device for communication. The second device can be a computer device in an external upper-layer system of the storage system, and its communication with the storage system can be based on the API provided by the energy storage system. After receiving CAN message data sent by the first device from the CAN bus connected to the first device, the CAN message data is parsed to obtain the original CAN message. Based on the first CAN identifier of the original CAN message, the first target CAN protocol plugin is matched from a preset plugin library, and the first target CAN protocol plugin is called to decapsulate the original CAN message according to the first CAN protocol to obtain the target data. The target data is then transmitted to the second device through the API provided by the energy storage system.

[0044] During the process of decapsulating the original CAN message to obtain the target data through the first target CAN protocol plugin, the parser in the first target CAN protocol plugin can perform base conversion on the data in the data segment of the original CAN message according to the first CAN protocol to obtain decimal data. The decapsulator then performs decapsulation on the decimal data according to the first CAN protocol to obtain data with specific physical meaning, such as first data representing specific voltage or current. Through mapping rules, the data with specific physical meaning is converted in terms of data format and field names to obtain target data compatible with the second device.

[0045] For example, the data in the data segment of the original CAN message represents the raw byte stream of voltage and current. The parser in the first target CAN protocol plugin performs a number conversion on the raw byte stream of voltage and current according to the first CAN protocol to obtain the raw decimal values ​​of voltage and current. The decapsulator performs unit and precision conversion on the raw decimal values ​​of voltage and current according to the first CAN protocol to obtain the specific voltage and current values. The field names of the specific voltage and current values ​​inside the plugin are mapped to a unified field name through mapping rules to obtain the target data.

[0046] Optionally, after decapsulating the original CAN message through the first target CAN protocol plugin to obtain the target data, the target data can also be stored in a preset data buffer pool, so that the second device can obtain the target data from the preset data buffer pool through the API provided by the energy storage system.

[0047] Optionally, step S203, which calls the first target CAN protocol plugin to decapsulate the first data to obtain the target data, further includes: The first target CAN protocol plugin is invoked to decapsulate the original CAN message and obtain the first data. Obtain the second CAN identifier used by the second device; Based on the second CAN identifier, the second target CAN protocol plugin is obtained from the preset plugin library; The second target CAN protocol plugin is invoked to encapsulate the first data and obtain the target data.

[0048] In this context, the first device is a device that communicates based on the first CAN protocol, and the second device is a device that communicates based on the second CAN protocol. The second CAN protocol can refer to the CAN protocol used by the second device for communication. The first CAN protocol and the second CAN protocol are different CAN protocols. The second CAN identifier can be used to identify a CAN protocol plugin that converts and processes data communicated using the second CAN protocol. The second target CAN protocol plugin is a plugin that encapsulates the second CAN protocol. The first data is the data after the original CAN message has been decapsulated and processed by calling the first target CAN protocol plugin.

[0049] For example, both the first and second devices are devices in an energy storage system, and both are connected to a CAN bus. The first device communicates based on a first CAN protocol, while the second device communicates based on a second CAN protocol. After receiving CAN message data sent by the first device from the CAN bus connected to the first device, the CAN message data is parsed to obtain the original CAN message. Based on the first CAN identifier of the original CAN message, a first target CAN protocol plugin is matched from a preset plugin library, and the first target CAN protocol plugin is called to decapsulate the original CAN message according to the first CAN protocol to obtain the first data. The second CAN identifier used by the second device is obtained, and based on the second CAN identifier, a second target CAN protocol plugin is matched from the preset plugin library. The second target CAN protocol plugin is called to encapsulate the first data to obtain the target data, which is then sent to the second device via the CAN bus.

[0050] During the process of calling the first target CAN protocol plugin to decapsulate the original CAN message according to the first CAN protocol and obtain the first data, the parser in the first target CAN protocol plugin can perform a number system conversion on the data segment in the original CAN message according to the first CAN protocol to obtain decimal data. The decapsulator then performs a number system conversion on the decimal data according to the first CAN protocol to obtain data with specific physical meaning, i.e., the first data. During the process of calling the second target CAN protocol plugin to encapsulate the first data and obtain the target data, the encapsulator can perform a number system conversion on the first data according to the second CAN protocol, converting the first data with specific physical meaning into first data without specific physical meaning suitable for the second CAN protocol. The parser then performs a number system conversion on the first data without specific physical meaning suitable for the second CAN protocol to obtain a CAN byte stream, which is the target data.

[0051] For example, the data segment in the original CAN message represents the raw byte stream of voltage and current. The parser in the first target CAN protocol plugin performs a number system conversion on the raw byte stream of voltage and current according to the first CAN protocol to obtain the raw voltage and current values ​​in decimal. The decapsulator performs unit and precision conversion on the raw decimal voltage and current values ​​according to the first CAN protocol to obtain the specific voltage and current values. The encapsulator in the second target CAN protocol plugin removes the units and precision from the specific voltage and current values ​​according to the second CAN protocol to obtain the raw voltage and current values ​​that do not explicitly indicate the meaning of voltage and current. The parser performs a number system conversion on the raw voltage and current values ​​that do not explicitly indicate the meaning of voltage and current to obtain the raw byte stream of voltage and current, which is the target data.

[0052] Optionally, step S202, which involves matching the target CAN protocol plugin from a preset plugin library based on the raw data, further includes: The original data is non-CAN message data. The non-CAN message data is parsed to obtain request data. The request data includes the third CAN identifier corresponding to the sending target of the non-CAN message data and the second data to be sent. Based on the third CAN identifier, the third target CAN protocol plugin is matched and obtained from the preset plugin library; The target CAN protocol plugin is invoked to transform and process the raw data to obtain the target data, which also includes: The third target CAN protocol plugin is invoked to encapsulate the second data to obtain the target data.

[0053] The first device is a device that communicates based on a non-CAN protocol, and the second device is a device that communicates based on a third CAN protocol. The third CAN protocol can refer to the CAN protocol used by the second device for communication. The request data can refer to the instruction data sent by the first device to request relevant data from the second device. The request data includes the third CAN identifier corresponding to the sending target of the non-CAN message data and the second data to be sent. The third CAN identifier can be used to identify the CAN protocol plug-in that converts and processes the data communicated using the third CAN protocol. The second data can refer to the content in the data segment of the request data. The third target CAN protocol plug-in is a plug-in obtained by encapsulating the third CAN protocol.

[0054] For example, the first device is a computer device in the external upper-level system of the energy storage system. Its communication with the energy storage system can be based on the API interface provided by the energy storage system. The second device is a device in the energy storage system, which is mounted on the CAN bus and communicates with other devices within the energy storage system based on the CAN protocol. After receiving non-message data sent by the first device through the API provided to the external upper-level system, the non-message data is parsed to obtain request data. Based on the third CAN identifier included in the request data, a third target CAN protocol plugin is matched from the preset plugin library, and the third target CAN protocol plugin is called to encapsulate the second data to obtain the target data. The target data is then sent to the second device through the CAN bus.

[0055] During the process of calling the third target CAN protocol plugin to encapsulate the second data and obtain the target data, the second data can be formatted using the mapping rules in the third target CAN protocol plugin. This mapping will map the second data back to the plugin's internal format. The encapsulator in the third target CAN protocol plugin will then encapsulate the second data according to the third CAN protocol, converting the second data with specific physical meaning into second data without specific physical meaning that is suitable for the third CAN protocol. Finally, the parser will perform a number system conversion on the second data without specific physical meaning that is suitable for the third CAN protocol to obtain a CAN byte stream, which is the target data.

[0056] For example, the second data represents specific voltage and current values. Through mapping rules, the field names of voltage and current values ​​are mapped to field names inside the plugin. Through the encapsulator in the third CAN protocol plugin, the specific voltage and current values ​​are processed according to the third CAN protocol to remove units, precision, etc., resulting in raw voltage and current values ​​that do not explicitly represent the meaning of voltage and current. Through the parser, the raw voltage and current values ​​that do not explicitly represent the meaning of voltage and current are converted to their bases to obtain the raw byte stream of voltage and current, which is the target data.

[0057] In this embodiment, when the raw data sent by the device is received, the target protocol plugin that matches the current device is automatically identified and called through the matching mechanism and the CAN protocol plugin in the plugin library. The raw data sent by the first device is converted and processed to adapt to the second device receiving the data. There is no need to carry out the adaptation development of protocols between devices within the system and between the system and the upper layer system, which reduces the development and maintenance costs, realizes the compatibility of communication between devices, and ensures normal communication interaction.

[0058] It should be understood that the sequence number of each step in the above embodiments does not imply 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 embodiments of the present invention.

[0059] In one embodiment, a CAN protocol-compatible communication device is provided, applied to... Figure 1 The server in the example corresponds one-to-one with the CAN protocol-based compatible communication method described in the above embodiments. For example... Figure 4 As shown, this CAN protocol-based compatible communication device includes a receiving module 41, a matching module 42, a processing module 43, and a transmitting module 44. Detailed descriptions of each functional module are as follows: The receiving module 41 is used to receive raw data sent by the first device; Matching module 42 is used to match the target CAN protocol plugin from a preset plugin library based on the original data; Processing module 43 is used to call the target CAN protocol plugin to transform the raw data and obtain the target data; The sending module 44 is used to send the target data to the second device.

[0060] Optionally, the matching module 42 mentioned above includes: The message parsing unit is used to parse the CAN message data to obtain the original CAN message; The first plug-in matching unit is used to match the first target CAN protocol plug-in from the preset plug-in library according to the first CAN identifier of the original CAN message; The aforementioned processing module 43 includes: The first decapsulation unit is used to call the first target CAN protocol plugin to decapsulate the original CAN message and obtain the target data.

[0061] Optionally, the above-mentioned processing module 43 further includes: The second decapsulation unit is used to call the first target CAN protocol plugin to decapsulate the original CAN message and obtain the first data. The first acquisition unit is used to acquire the second CAN identifier used by the second device; The second plug-in matching unit is used to match the second target CAN protocol plug-in from the preset plug-in library according to the second CAN identifier; The first encapsulation unit is used to call the second target CAN protocol plugin to encapsulate the first data to obtain the target data.

[0062] Optionally, the matching module 42 mentioned above further includes: The data parsing unit is used to parse the non-CAN message data when the original data is non-CAN message data to obtain request data. The request data includes a third CAN identifier corresponding to the sending target of the non-CAN message data and second data to be sent. The third plug-in matching unit is used to match a third target CAN protocol plug-in from the preset plug-in library according to the third CAN identifier; The aforementioned processing module 43 includes: The second encapsulation unit is used to call the third target CAN protocol plugin to encapsulate the second data to obtain the target data.

[0063] Optionally, the compatible communication device further includes: The second acquisition module is used to acquire the access control list of the second device; The permission determination module is used to determine the access permissions of the first device to the second device based on the access control list; The first judgment module is used to execute the step of parsing the original data if the access permission is allowed. The second judgment module is used to return a message indicating no permission to communicate to the first device if the access permission is not allowed.

[0064] Optionally, the compatible communication device further includes: A caching module is used to store the raw data into a preset cache queue; The batch parsing module is used to parse each piece of raw data and determine the CAN identifier in the corresponding raw data when all raw data in the preset cache queue meet the preset first condition. The combination module is used to form a data group from all the original data with the same CAN identifier; The matching module 42 mentioned above also includes: The fourth plug-in matching module is used to match the fourth target CAN protocol plug-in corresponding to any data group from the preset plug-in library based on the CAN identifier corresponding to the data group. The aforementioned processing module 43 further includes: The conversion unit is used to call the fourth target CAN protocol plugin corresponding to the data group to convert each original data in the data group to obtain the target data corresponding to each original data.

[0065] Optionally, the compatible communication device further includes: The detection module is used to perform validity detection on any CAN protocol plugin in the preset plugin library and obtain the detection result. The third judgment module is used to execute the step of receiving the original data sent by the first device if the detection result meets the preset second condition; The fourth judgment module removes the CAN protocol plugin from the preset plugin library if the detection result does not meet the preset second condition.

[0066] Specific limitations regarding CAN protocol-based compatible communication devices can be found in the limitations of CAN protocol-based compatible communication methods described above, and will not be repeated here. Each module in the aforementioned CAN protocol-based compatible communication device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in hardware or independently of the processor in a computer device, or stored in software in the memory of a computer device, so that the processor can call and execute the corresponding operations of each module.

[0067] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 5 As shown, the computer device includes a processor, memory, network interface, and database connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database stores target query plans. The network interface is used for communication with external terminals via a network connection. When executed by the processor, the computer program implements a CAN-compatible communication method.

[0068] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the CAN-compatible communication method described in the above embodiments, for example... Figure 2 As shown in S201-S204, or Figure 3 As shown, to avoid repetition, it will not be described again here. Alternatively, when the processor executes a computer program, it implements the functions of each module / unit in this embodiment of the data management device, for example, Figure 4 The functions of the receiving module 41, matching module 42, processing module 43, and sending module 44 shown are not described again here to avoid repetition.

[0069] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When executed by a processor, the computer program implements the CAN-compatible communication method described in the above embodiments, for example... Figure 2 As shown in S201-S204, or Figure 3 As shown, to avoid repetition, it will not be described again here. Alternatively, when the processor executes a computer program, it implements the functions of each module / unit in this embodiment of the data management device, for example, Figure 4The functions of the receiving module 41, matching module 42, processing module 43, and sending module 44 shown are not described again here to avoid repetition.

[0070] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. This computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

[0071] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is used as an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.

[0072] The above-described embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included within the protection scope of the present invention.

Claims

1. A CAN-compatible communication method, characterized in that, include: Receive raw data sent by the first device; Based on the raw data, the target CAN protocol plugin is matched from the preset plugin library; The target CAN protocol plugin is invoked to transform the raw data and obtain the target data; The target data is sent to the second device.

2. The CAN protocol-based compatible communication method according to claim 1, characterized in that, The step of matching the target CAN protocol plugin from a preset plugin library based on the original data includes: The original data is CAN message data. The CAN message data is parsed to obtain the original CAN message. Based on the first CAN identifier of the original CAN message, the first target CAN protocol plugin is matched from the preset plugin library.

3. The CAN protocol-based compatible communication method according to claim 2, characterized in that, The process of calling the target CAN protocol plugin to transform the raw data and obtain the target data includes: The first target CAN protocol plugin is invoked to decapsulate the original CAN message and obtain the target data.

4. The CAN protocol-based compatible communication method according to claim 2, characterized in that, The step of calling the target CAN protocol plugin to transform the raw data and obtain the target data also includes: The first target CAN protocol plugin is invoked to decapsulate the original CAN message and obtain the first data; Obtain the second CAN identifier used by the second device; Based on the second CAN identifier, a second target CAN protocol plugin is obtained from the preset plugin library; The second target CAN protocol plugin is invoked to encapsulate the first data to obtain the target data.

5. The CAN protocol-based compatible communication method according to claim 1, characterized in that, The step of matching the target CAN protocol plugin from a preset plugin library based on the original data also includes: The original data is non-CAN message data. The non-CAN message data is parsed to obtain request data. The request data includes a third CAN identifier corresponding to the sending target of the non-CAN message data and second data to be sent. Based on the third CAN identifier, a third target CAN protocol plugin is obtained by matching from the preset plugin library.

6. The CAN protocol-based compatible communication method according to claim 5, characterized in that, The step of calling the target CAN protocol plugin to transform the raw data and obtain the target data also includes: The third target CAN protocol plugin is invoked to encapsulate the second data to obtain the target data.

7. The CAN protocol-based compatible communication method according to claim 1, characterized in that, After receiving the raw data sent by the first device, the method further includes: Obtain the access control list of the second device; Based on the access control list, determine the access permissions of the first device to the second device; If the access permission is allowed, then the step of matching the target CAN protocol plugin from the preset plugin library based on the original data is executed. If the access permission is not allowed, then a message indicating no permission to communicate is returned to the first device.

8. The CAN protocol-based compatible communication method according to claim 1, characterized in that, After receiving the raw data sent by the first device, the method further includes: The raw data is stored in a preset cache queue; When all the original data in the preset cache queue meets the preset first condition, each original data is parsed to determine the CAN identifier in the corresponding original data; All raw data with the same CAN identifier are grouped into a single data set.

9. The CAN protocol-based compatible communication method according to claim 8, characterized in that, The step of matching the target CAN protocol plugin from a preset plugin library based on the original data includes: For any data group, based on the CAN identifier corresponding to the data group, the fourth target CAN protocol plugin corresponding to the data group is matched from the preset plugin library.

10. The CAN protocol-based compatible communication method according to claim 9, characterized in that, The step of calling the target CAN protocol plugin to transform the raw data and obtain the target data also includes: The fourth target CAN protocol plugin corresponding to the data group is invoked to perform transformation processing on each original data in the data group to obtain the target data corresponding to each original data.

11. The CAN protocol-based compatible communication method according to claim 1, characterized in that, Before receiving the raw data sent by the first device, it also includes: For any CAN protocol plugin in the preset plugin library, perform a validity test on the CAN protocol plugin and obtain the test result; If the detection result meets the preset second condition, then the step of receiving the raw data sent by the first device is executed; If the detection result does not meet the preset second condition, the CAN protocol plugin will be removed from the preset plugin library.

12. A CAN protocol-compatible communication device, characterized in that, include: A receiving module is used to receive raw data sent by the first device; The matching module is used to match the target CAN protocol plugin from a preset plugin library based on the original data; The processing module is used to call the target CAN protocol plugin to transform the raw data and obtain the target data; The sending module is used to send the target data to the second device.

13. A computer device, characterized in that, Including processor and memory; The memory stores a computer program that can run on the processor. When the processor executes the computer program, it implements the CAN protocol-based compatible communication method as described in any one of claims 1 to 11.

14. A computer-readable storage medium, characterized in that, The device stores a computer program, which, when executed by a processor, implements the CAN protocol-based compatible communication method as described in any one of claims 1 to 11.