Data communication method based on CAN bus communication protocol and related equipment

By defining the network layer protocol and data segmentation transmission method, the compatibility problem of CAN communication protocol and other protocols is solved, its flexibility and application scope in the field of power communication is improved, and compatibility of large data transmission is achieved.

CN119182622APending Publication Date: 2024-12-24BEIJING GUODIANTONG NETWORK TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411100863.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-12
Publication Date
2024-12-24

AI Technical Summary

Technical Problem

The existing CAN communication protocol cannot be compatible with other communication protocols in large data transmission scenarios, which limits its flexibility and application scope.

Method used

By defining the network layer protocol, the application data can carry any existing communication protocol, and obtain application layer data at the source device, determine whether its data volume is greater than the preset amount, divide and generate data frames, and use reverse order method Transmission to the target device solves the compatibility issue between the CAN communication protocol and other protocols.

Benefits of technology

It improves the application scope and flexibility of the CAN bus communication protocol, so that it can seamlessly integrate multiple existing power communication protocols in the field of power communication to meet the needs of large data transmission.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119182622A_ABST
    Figure CN119182622A_ABST
Patent Text Reader

Abstract

The invention provides a data communication method based on a CAN bus communication protocol and related equipment. The method comprises the following steps: acquiring application layer data based on a first communication protocol at source equipment; judging whether the data volume of the application layer data is greater than a preset data volume or not; in response to the situation that the data volume of the application layer data is greater than the preset data volume, segmenting the application layer data to obtain a plurality of data packets; generating a corresponding first data frame based on the data packet, wherein the first data frame comprises a priority, a frame type, a last frame identifier, a source logic address and a target logic address corresponding to the data packet, and the data packet; and based on a link layer and / or a physical layer of the CAN bus communication protocol, transmitting the first data frame to a target device indicated by the target logic address in an inverted order mode.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of communications, and in particular to a data communication method and related equipment based on a CAN bus communication protocol. Background Art

[0002] The CAN communication protocol is often used in transmission scenarios with smaller data volumes. However, when faced with scenarios with larger data volumes, the network layer and application layer in the existing CAN communication protocol are not compatible with data from other communication protocols, which limits the flexibility of the CAN communication protocol. Summary of the invention

[0003] The present disclosure proposes a data communication method and related equipment based on the CAN bus communication protocol, so as to solve the technical problem that the network layer and application layer in the CAN communication protocol are not fully compatible with other communication protocols to a certain extent.

[0004] In a first aspect of the present disclosure, a data communication method based on a CAN bus communication protocol is provided, comprising:

[0005] Acquire application layer data based on a first communication protocol at a source device;

[0006] Determining whether the data volume of the application layer data is greater than a preset data volume;

[0007] In response to the data volume of the application layer data being greater than the preset data volume, segmenting the application layer data to obtain a plurality of data packets;

[0008] Generate a corresponding first data frame based on the data packet, the first data frame including a priority, a frame type, an end frame identifier, a source logical address, a target logical address and the data packet corresponding to the data packet;

[0009] The first data frame is transmitted to the target device indicated by the target logical address in reverse order based on the link layer and / or physical layer of the CAN bus communication protocol.

[0010] In a second aspect of the present disclosure, a data communication device based on a CAN bus communication protocol is provided, comprising:

[0011] An acquisition module, configured to acquire application layer data based on a first communication protocol at a source device;

[0012] A judging module, used to judge whether the data volume of the application layer data is greater than a preset data volume;

[0013] A packet splitting module, configured to split the application layer data into multiple data packets in response to the data volume of the application layer data being greater than the preset data volume;

[0014] A data frame module, configured to generate a corresponding first data frame based on the data packet, wherein the first data frame includes a priority, a frame type, an end frame identifier, a source logical address, a target logical address and the data packet corresponding to the data packet;

[0015] A transmission module is used to transmit the first data frame to the target device indicated by the target logical address in reverse order based on the link layer and / or physical layer of the CAN bus communication protocol.

[0016] In a third aspect of the present disclosure, an electronic device is provided, comprising one or more processors, a memory; and one or more programs, wherein the one or more programs are stored in the memory and executed by the one or more processors, and the programs include instructions for executing the method described in the first aspect.

[0017] According to a fourth aspect of the present disclosure, a non-volatile computer-readable storage medium containing a computer program is provided. When the computer program is executed by one or more processors, the processors execute the method described in the first aspect.

[0018] In a fifth aspect of the present disclosure, a computer program product is provided, comprising computer program instructions, which, when executed on a computer, enable the computer to execute the method described in the first aspect.

[0019] From the above description, it can be seen that the data communication method and related equipment based on the CAN bus communication protocol provided by the present disclosure realize that application data can carry any existing communication protocol by defining the network layer protocol, thereby improving the application scope and flexibility of the CAN bus communication protocol. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] In order to more clearly illustrate the technical solutions in the present disclosure or related technologies, the drawings required for use in the embodiments or related technical descriptions are briefly introduced below. Obviously, the drawings described below are only embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0021] Figure 1 Schematic diagram of a data communication architecture based on the CAN bus communication protocol according to an embodiment of the present disclosure.

[0022] Figure 2 The figure is a schematic diagram of the hardware structure of an exemplary electronic device according to an embodiment of the present disclosure.

[0023] Figure 3 The present invention is a flowchart of a data communication method based on the CAN bus communication protocol according to an embodiment of the present invention.

[0024] Figure 4 It is a schematic diagram of a data communication method based on the CAN bus communication protocol according to an embodiment of the present disclosure.

[0025] Figure 5 Schematic diagram of a second data packet according to an embodiment of the present disclosure.

[0026] Figure 6 It is a schematic diagram of a data communication device based on the CAN bus communication protocol according to an embodiment of the present disclosure. DETAILED DESCRIPTION

[0027] In order to make the objectives, technical solutions and advantages of the present disclosure more clearly understood, the present disclosure is further described in detail below in combination with specific embodiments and with reference to the accompanying drawings.

[0028] It should be noted that, unless otherwise defined, the technical terms or scientific terms used in the embodiments of the present disclosure should be understood by people with ordinary skills in the field to which the present disclosure belongs. The "first", "second" and similar words used in the embodiments of the present disclosure do not indicate any order, quantity or importance, but are only used to distinguish different components. "Including" or "comprising" and similar words mean that the elements or objects appearing before the word cover the elements or objects listed after the word and their equivalents, without excluding other elements or objects. "Connect" or "connected" and similar words are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. "Up", "down", "left", "right" and the like are only used to indicate relative positional relationships. When the absolute position of the described object changes, the relative positional relationship may also change accordingly.

[0029] It is understandable that before using the technical solutions disclosed in the embodiments of the present disclosure, the types, scope of use, usage scenarios, etc. of the personal information involved in the present disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.

[0030] For example, in response to receiving an active request from a user, a prompt message is sent to the user to clearly prompt the user that the operation requested to be performed will require obtaining and using the user's personal information. Thus, the user can autonomously choose whether to provide personal information to software or hardware such as an electronic device, application, server, or storage medium that performs the operation of the technical solution of the present disclosure according to the prompt message.

[0031] It is understandable that the above notification and the process of obtaining user authorization are merely illustrative and do not constitute a limitation on the implementation of the present disclosure. Other methods that meet the relevant laws and regulations may also be applied to the implementation of the present disclosure.

[0032] Figure 1 A schematic diagram of a data communication architecture based on the CAN bus communication protocol according to an embodiment of the present disclosure is shown. Figure 1 , the data communication architecture 100 based on the CAN bus communication protocol may include a server 110, a terminal 120, and a network 130 providing a communication link. The server 110 and the terminal 120 may be connected via a wired or wireless network 130. The server 110 may be an independent physical server, or a server cluster or distributed system consisting of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, security services, and CDN.

[0033] The terminal 120 may be implemented in hardware or software. For example, when the terminal 120 is implemented in hardware, it may be various electronic devices having a display screen and supporting page display, including but not limited to smart phones, tablet computers, e-book readers, laptop portable computers, and desktop computers, etc. When the terminal 120 device is implemented in software, it may be installed in the electronic devices listed above; it may be implemented as multiple software or software modules (such as software or software modules used to provide distributed services), or it may be implemented as a single software or software module, which is not specifically limited here.

[0034] It should be noted that the data communication method based on the CAN bus communication protocol provided in the embodiment of the present application can be executed by the terminal 120 or by the server 110. It should be understood that Figure 1 The number of terminals, networks and servers in the embodiment is only for illustration and is not intended to limit the number of terminals, networks and servers. Any number of terminals, networks and servers may be provided as required.

[0035] Figure 2 FIG. 2 shows a schematic diagram of the hardware structure of an exemplary electronic device 200 provided in an embodiment of the present disclosure. Figure 2 As shown, the electronic device 200 may include: a processor 202, a memory 204, a network module 206, a peripheral interface 208 and a bus 210. The processor 202, the memory 204, the network module 206 and the peripheral interface 208 are connected to each other in communication within the electronic device 200 through the bus 210.

[0036] Processor 202 may be a central processing unit (CPU), a neural network processor (NPU), a microcontroller (MCU), a programmable logic device, a digital signal processor (DSP), an application specific integrated circuit (ASIC), or one or more integrated circuits. Processor 202 may be used to perform functions related to the technology described in this disclosure. In some embodiments, processor 202 may also include multiple processors integrated into a single logical component. For example, Figure 2 As shown, processor 202 may include a plurality of processors 202a, 202b, and 202c.

[0037] The memory 204 may be configured to store data (eg, instructions, computer code, etc.). Figure 2 As shown, the data stored in the memory 204 may include program instructions (for example, program instructions for implementing the data communication method based on the CAN bus communication protocol of the embodiment of the present disclosure) and data to be processed (for example, the memory may store configuration files of other modules, etc.). The processor 202 may also access the program instructions and data stored in the memory 204, and execute the program instructions to operate on the data to be processed. The memory 204 may include a volatile storage device or a non-volatile storage device. In some embodiments, the memory 204 may include a random access memory (RAM), a read-only memory (ROM), an optical disk, a magnetic disk, a hard disk, a solid-state drive (SSD), a flash memory, a memory stick, etc.

[0038] The network module 206 can be configured to provide communication with other external devices to the electronic device 200 via a network. The network can be any wired or wireless network capable of transmitting and receiving data. For example, the network can be a wired network, a local wireless network (e.g., Bluetooth, WiFi, near field communication (NFC) etc.), a cellular network, the Internet or a combination thereof. It is understood that the type of network is not limited to the above specific examples. In some embodiments, the network module 306 can include any number of network interface controllers (NICs), radio frequency modules, transceivers, modems, routers, gateways, adapters, cellular network chips, etc., in any combination.

[0039] The peripheral interface 208 can be configured to connect the electronic device 200 to one or more peripheral devices to achieve information input and output. For example, the peripheral devices can include input devices such as a keyboard, a mouse, a touch pad, a touch screen, a microphone, and various sensors, and output devices such as a display, a speaker, a vibrator, and an indicator light.

[0040] The bus 210 can be configured to transmit information between various components of the electronic device 200 (e.g., the processor 202, the memory 204, the network module 206, and the peripheral interface 208), such as an internal bus (e.g., a processor-memory bus), an external bus (USB port, PCI-E bus), etc.

[0041] It should be noted that, although the architecture of the electronic device 200 only shows the processor 202, the memory 204, the network module 206, the peripheral interface 208 and the bus 210, in the specific implementation process, the architecture of the electronic device 200 may also include other components necessary for normal execution. In addition, it can be understood by those skilled in the art that the architecture of the electronic device 200 may also only include the components necessary for implementing the embodiments of the present disclosure, and does not necessarily include all the components shown in the figure.

[0042] Fieldbus technology has become a hot spot in the development of industrial automation technology today. CAN (Controller Area Network) is one of the most widely used fieldbuses in the world. CAN is a multi-master serial data communication bus with high bit rate, high resistance to electromagnetic interference, and the ability to detect any errors that occur. As a remote network communication control method with advanced technology, high reliability, complete functions and reasonable cost, CAN has been widely used in various automation control fields. As a fieldbus standard, CAN is mainly used for communication in automotive and industrial environments. With the development of power Internet of Things technology, CAN has also begun to be used in the field of power communication.

[0043] Although the CAN communication protocol is widely used in the automotive industry and industrial control, it is mainly used in the control field and is used in scenarios where large amounts of data transmission are not required. In the field of power communication, large amounts of data transmission are often required, such as reading voltage and current waveform data when a fault occurs; however, in the existing CAN communication protocol (network layer, application layer), there is no communication protocol that can well support this requirement. There are many communication protocols used in the field of power communication, such as DLT645, DLT698, IEC104, MODBUS, etc., and the commonly used CAN communication protocols (network layer, application layer) are mostly designed for industrial control, and it is difficult to achieve seamless integration with the existing multiple power communication protocols. Therefore, it has become an urgent need to design a CAN network layer communication protocol to support the seamless integration of multiple existing power communication protocols and meet the requirements of power communication.

[0044] The current CAN hardware layer (physical layer + link layer) protocols include CAN1.0, CAN2.0A, CAN2.0B and CAN FD. CAN 1.0 is the original standard, supporting a data rate of 1Mbps, suitable for simple control applications. CAN 2.0A adds error detection functions, improves reliability and safety, and the data rate can be extended to 5Mbps. CAN 2.0B is basically the same as 2.0A, but allows longer frame lengths, further improving transmission efficiency. CAN FD is the latest extended version that supports data rates of up to 8Mbps or even higher, and is particularly suitable for application scenarios that require fast transmission of large amounts of information, but most existing MCUs cannot support it. Therefore, designing a network layer communication protocol based on CAN2.0B to meet power communication is the best choice.

[0045] At present, the common application layer protocols based on CAN bus are SAEJ1939, CANOpen, DeviceNet and iCAN. Among them, the SAEJ1939 protocol essentially defines the 11-bit ID and 18-bit extended ID that are not clearly defined in the CAN extended frame format, and the ID is followed by 8 bytes of data. SAEJ1939 is designed for vehicle use, built on the standard CAN2.0B, and specifies the extended frame format using a 29-bit identifier. The protocol has a network layer, which defines network units such as repeaters, bridges, routers, and gateways, defines the initialization state diagram and restrictions on address use; and supports the application layer to transmit long data. Although SAEJ1939 is suitable for power communication applications to a certain extent, such as the application layer can transmit long data, its long data transmission is based on point-to-point sessions, and uses connection management and data transmission in request and response mode, which has a slow transmission speed and low efficiency; its protocol stack is large and complex. When used in power communication, it is necessary to strip off the unnecessary application layer, and its application layer is deeply associated with other layers, making it difficult to transplant and use.

[0046] CANopen is developed on the basis of CAL, using the CAL communication and service protocol subset, and provides an implementation solution for distributed control systems. CAL provides all network management services and message transmission protocols, but does not define the content of CMS objects or the type of objects being communicated. This is exactly where CANopen comes in. The core concept of CANopen is the device object dictionary (OD), which is not part of CAL but is implemented in CANopen. CANopen was developed as a standardized embedded network with flexible debugging configuration capabilities, and is mainly used for motion-oriented machine control networks. It supports CAN2.0A 11-bit and CAN2.0B 29-bit identifiers. It adopts a one-master-multiple-slave bus organization mode. There is no clear network layer in the protocol, but the object dictionary defines four objects: network management objects (NMT), service data objects (SDO), process data objects (PDO), predefined messages or special function objects. Network management objects are responsible for layer management, network management and ID allocation services. In network management, only one master node and one or more slave nodes are allowed in the same network, and the master / slave mode is followed. Therefore, CANOpen can only work in a one-master-multiple-slave network organization mode. This makes it difficult for CANOpen to be widely used in power communication and difficult to integrate with existing power communication protocols.

[0047] DeviceNet is an open, low-cost, high-performance communication network based on CAN technology that is in line with global industrial standards. It is more suitable for use in sensor devices, micro-actuator devices and other devices. It connects field intelligent devices such as PLC, sensors, photoelectric switches, operator terminals, motors, shaft seats, inverters and soft starters through a cable. It is an ideal solution for distributed control systems to reduce field I / O interfaces and wiring establishment and download control functions to field devices. DeviceNet can be used not only as a device-level network, but also as a control-level network. Through the services provided by DeviceNet, real-time control on Ethernet can be achieved. Compared with some other fieldbuses, DeviceNet can not only access more and more complex devices, but also provide more information and services for the upper layer. DeviceNet is designed for industrial control use. It works in a multi-master mode based on CAN, uses a producer / consumer transmission model, can accommodate 64 nodes on the bus, uses a short frame structure, and supports hot plugging of devices. It is based on the standard CAN2.0A protocol, uses an 11-bit standard message identifier, and defines message priorities in groups. The protocol does not define the network layer and cannot support long data transmission at the application layer. The application layer uses the common industrial protocol CIP. CIP communication is connection-based, and a logical connection must be established before any two nodes on the bus can communicate. DeviceNet uses an 11-bit identifier instead of a more efficient 29-bit identifier, and a connection must be established before communication, which makes it difficult to meet the requirements of fast transmission of big data and the need to integrate existing power communication protocols.

[0048] The full name of iCAN protocol is "industry CAN-bus Application Protocol", which is the industrial CAN-bus application layer protocol. The iCAN protocol follows the physical layer and data link layer of the bus network specified by the CAN protocol standard, and redefines the frame identifier and data field in the CAN-bus message. The iCAN protocol is located at the 7th layer of the OSI model. The iCAN protocol defines in detail the allocation and application of frame identifiers and data in CAN-bus messages, establishes a unified device model, and defines the I / O resources and access rules of the device. The main contents are as follows: iCAN message format definition, which specifies the CAN frame type used in the iCAN protocol specification, as well as the use of frame ID and message data. Based on the essence of DeviceNET and CANopen protocols, iCAN fully inherits and develops the two core functions based on connection and object addressing. It supports multiple transmission methods, including polling, state triggering, and timing looping. However, it is still designed for industrial control, and there is also the problem that DeviceNET and CANopen protocols are difficult to integrate with existing power communication protocols.

[0049] Therefore, how to make the CAN communication protocol compatible with other communication protocols and improve the flexibility of the CAN communication protocol has become a technical problem that needs to be solved urgently.

[0050] In view of this, the embodiment of the present disclosure provides a data communication method and related equipment based on the CAN bus communication protocol. By defining the network layer protocol, the application data can carry any existing communication protocol, thereby improving the application scope and flexibility of the CAN bus communication protocol.

[0051] See also Figure 3 , Figure 3 The schematic flow chart of the data communication method based on the CAN bus communication protocol according to the embodiment of the present disclosure is shown. The data communication method based on the CAN bus communication protocol according to the embodiment of the present disclosure can be deployed on the server side or the terminal. Figure 3 In the data communication method 300 based on the CAN bus communication protocol may further include the following steps.

[0052] In step S310, application layer data based on a first communication protocol is acquired at a source device.

[0053] Among them, the first communication protocol may refer to any communication protocol of the application layer, such as IEC104, MODBUS, etc. The method of the embodiment of the present disclosure may be based on the standard CAN2.0B, using an extended frame format of a 29-bit identifier. According to the method of the embodiment of the present disclosure, a network layer communication protocol is defined, and above the network layer is the application layer, which may be any form of communication protocol. Below the network layer may be a link layer and a physical layer from top to bottom, such as the link layer and the physical layer in the CAN2.0B communication protocol.

[0054] In some embodiments, the method 300 may further include:

[0055] Broadcasting and sending a first network connection detection frame for detecting a network connection of the source device;

[0056] In response to the first network detection frame not detecting a device, determining that the source device fails to connect to the network; and sending the network detection frame again after a preset detection time interval;

[0057] In response to the first networking detection frame detecting a device, it is determined that the source device is successfully networked.

[0058] Among them, after the protocol network layer starts working, it first broadcasts and sends the "network connection detection" network management frame. If a "send ACK error" occurs, it means that the device is not connected to the CAN bus. Then wait for a while and detect again until it is detected that it is connected to the CAN bus.

[0059] In some embodiments, the method 300 may further include:

[0060] Sending a second networking detection frame for detecting a network connection of a first device, wherein the second networking detection frame includes a first logical address of the first device;

[0061] In response to the second networking detection frame being received, determining that the first device has accessed the network;

[0062] In response to the second networking detection frame not being received, it is determined that the first device has not joined the network.

[0063] Among them, the frame type of the first network detection frame and the second network detection frame is a network management frame, and the network detection command does not need to be responded to. When the destination address is a broadcast address, it is used to detect whether there are other devices on the CAN bus. If no other devices are detected, it can be considered that the device has not been connected to the CAN bus; when the destination address is a specified device, it is used to detect whether the device exists on the bus.

[0064] In some embodiments, the method 300 further includes:

[0065] Acquiring a source physical address of the source device at the source device; and manually configuring or automatically configuring a source logical address of the source device;

[0066] Wherein, automatically configuring the source logical address of the source device further includes:

[0067] Sending a first physical address request for acquiring a physical address to a first preset logical address;

[0068] In response to receiving a first response to the first physical address request, sending a second physical address request for acquiring a physical address to a second preset logical address;

[0069] In response to not receiving a first response to the first physical address request, determining the first logical address to be a source logical address of the source device.

[0070] Among them, the network layer must configure two working parameters before starting - the device MAC address and the communication logical address. The MAC address is 6 bytes long and is used to uniquely identify a device. The communication logical address is the number used to identify a device in CAN bus communication, which can also be referred to as the logical address. The logical address can be configured manually or automatically. If manual configuration is used, its uniqueness in the network must be manually guaranteed; automatic allocation is recommended. After the network protocol is started, if the configured logical address is an invalid address, the network layer automatically obtains a logical address through interactive negotiation.

[0071] CAN driver hardware devices all have an ID filter group. The method of the disclosed embodiment configures the ID filter group of the CAN driver hardware so that only protocol frames whose destination addresses are broadcast addresses or local logical addresses can pass through the filter and be received by the network layer. Thus, the communication messages on the CAN bus can automatically complete device addressing.

[0072] After the device is successfully connected to the network, it enters the logical address configuration process. If the logical address of the pre-startup configuration parameter is a valid address, the logical address is directly added to the filter; if the configured logical address is an invalid address, the automatic allocation process is executed to automatically obtain a logical address, and then the logical address is added to the filter. Specifically, the logical address automatic allocation process is as follows: Figure 4 As shown, Figure 4 A schematic diagram of automatic allocation of logical addresses according to an embodiment of the present disclosure is shown. Figure 4 In the process, first send the "get MAC address" network management command frame to the device with logical address 1. If there is a device response, it means that this logical address has been occupied. Then send this command frame to the device with logical address 2... until there is no device response. To ensure that the detected logical address is indeed not occupied, perform another confirmation test. After confirming that this logical address is not occupied, this device uses this logical address and the automatic allocation process is completed.

[0073] In some embodiments, the method 300 further includes:

[0074] In response to the source logical address configuration of the source device being completed, a first network access notification frame is broadcast to indicate that the source device has accessed the network; wherein the first network access notification frame includes a source physical address and a source logical address of the source device.

[0075] Among them, after completing the logical address configuration process, the "network access notification" network management frame is immediately broadcast to notify other devices that this device has joined the network; the "network access notification" network management frame contains the logical address and MAC address of this device.

[0076] In some embodiments, the method 300 further includes:

[0077] A first off-network notification frame is broadcasted to indicate that the source device has gone off-network, wherein the first off-network notification frame includes a source logical address of the source device.

[0078] When the device needs to stop network communication, it can broadcast an "off-network notification" network management frame.

[0079] In some embodiments, the method 300 further includes:

[0080] In response to receiving the second network access notification frame, the device physical address in the second network access notification frame and the corresponding device logical address are stored in association with each other to form an address resolution table.

[0081] Among them, the device that receives the "network access notification" can record the logical address and MAC address in its address resolution table. The network layer can provide address resolution services, which can query the MAC address through the logical address, and can also query the logical address through the MAC address. It is recommended to maintain an address resolution table in the network layer protocol stack to record the logical address and MAC address of other devices, so as to quickly implement address resolution and reduce the transmission of management commands on the bus.

[0082] In some embodiments, the method 300 further includes:

[0083] In response to receiving the second off-network notification frame, the locally stored device logical address and the corresponding device physical address are removed based on the device logical address in the second off-network notification frame.

[0084] Among them, the device that receives the "off-network notification" can delete the record of the corresponding logical address in the address resolution table.

[0085] In step S320, it is determined whether the data volume of the application layer data is greater than a preset data volume.

[0086] When the amount of application layer data is too large, it can be transmitted in frames. For example, when the application layer data exceeds 8 bytes, it must be transmitted multiple times in frames.

[0087] In step S330, in response to the data volume of the application layer data being greater than the preset data volume, the application layer data is segmented to obtain a plurality of data packets.

[0088] In step S340, a corresponding first data frame is generated based on the data packet, wherein the first data frame includes a priority, a frame type, an end frame identifier, a source logical address, a target logical address and the data packet corresponding to the data packet.

[0089] Among them, the data frame structure in the network layer according to the embodiment of the present disclosure can be based on the 29-bit ID (bit28-bit0) of the CAN2.0B communication protocol and the data field of the CAN2.0B communication protocol, as shown in Table 1.

[0090]

[0091] Table 1

[0092] Among them, priority: the value range is 0-7, 0 is the highest priority, 7 is the lowest priority; the default priority is 5. Frame type: 0 represents the network management frame, which is used for network management; 1 represents the data frame, which is used for data transmission. Last frame identification: 0 means it is not the last frame; 1 means it is the last frame. If the frame number of the last frame is 0, it means this is a single frame. Frame sequence number: the value range is 0-255. When multiple packets are transmitted, it indicates the sequence number of the data packet. 0 represents the first packet, 1 represents the second packet... The maximum packet length that can be transmitted by the application layer is 256*8=2048 bytes. Source address: refers to the logical address of the device sending this frame, and the value range is 1-254. Logical address: It is a number used to identify a device. The logical address is mainly used for device addressing and is unique. That is, the logical addresses of different devices in the same CAN network must be different. 0 is an invalid address, and 255 is a broadcast address. Destination address: refers to the logical address of the device receiving this frame, and the value range is 1-255. Application data: is the transmitted application payload. When the frame type is 0, the application payload is network management data; when the frame type is 1, the application payload is application layer data.

[0093] In step S350, the first data frame is transmitted to the target device indicated by the target logical address in reverse order based on the link layer and / or the physical layer of the CAN bus communication protocol.

[0094] In some embodiments, the method 300 further includes:

[0095] In response to receiving a second data frame including the source logical address, determining the frame type of the second data frame; in response to the frame type of the second data frame being a data frame, obtaining corresponding data to be processed based on the second data frame for processing by the application layer of the source device.

[0096] Among them, the application layer of the embodiment of the present disclosure can use reverse transmission when performing multiple frame transmissions, that is, transmit the last frame first and the first frame last. When the receiver receives the last frame, it can calculate the length of the complete frame through the frame sequence number and the data length of this frame, and prepare the data cache according to the complete frame length. The receiver receives the framed data in sequence. When the framed data with a frame sequence number of 0 is received, it indicates that the entire frame has been received, and then notifies the application layer to process the data. During the frame transmission process, if a transmission error occurs, the sender can retransmit; if multiple consecutive retransmissions fail, the current transmission is terminated and the transmission failure is returned.

[0097] In some embodiments, the method 300 further includes:

[0098] In response to receiving a request for obtaining a source physical address or a source logical address for the source device, the source logical address and the source physical address of the source device are returned.

[0099] In some embodiments, the method 300 further includes:

[0100] Sending a third physical address request, where the third physical address request is used to request a second physical address corresponding to the second logical address; and receiving a first response result for the third physical address request, where the first response result includes the second physical address.

[0101] In some embodiments, the method 300 further includes:

[0102] Broadcasting a first logical address request, where the first logical address request is used to request a third logical address corresponding to a third physical address; and receiving a second response result to the first logical address request, where the second response result includes the third logical address.

[0103] Among them, the source physical address acquisition request, the source logical address acquisition request, the third physical address request, and the first logical address request are all network management frames. The functions of the network management frame are shown in Table 2:

[0104]

[0105]

[0106] Table 2

[0107] In some embodiments, the method 300 further includes at least one of the following:

[0108] In response to determining that the source physical address and the source logical address of the network layer of the source device are not configured, determining that the state of the network layer of the source device is an unconfigured state;

[0109] In response to the source physical address and the source logical address of the network layer of the source device being configured, converting the state of the network layer of the source device from an unconfigured state to an initialized state;

[0110] In response to the source device having accessed the network, converting the state of the network layer of the source device from an initialization state to a networked state;

[0111] In response to the source device being disconnected, converting the state of the network layer of the source device from a connected state to a disconnected state;

[0112] In response to shutting down the protocol stack of the network layer of the device, the state of the network layer of the source device is converted from an online state to an unconfigured state; or, in response to restarting the protocol stack of the network layer of the device, the state of the network layer of the source device is converted from an online state to an initialized state.

[0113] Among them, the network layer working state may refer to the working state of the network layer protocol stack in the method of the embodiment of the present disclosure, including unconfigured, initialized, connected to the network, and disconnected from the network. The unconfigured state may refer to the state in which the protocol stack is not configured with working parameters and has not started working. The initialized state may refer to the protocol stack starting to work and configuring the logical address and the filter of the driver device. The connected state may refer to the successful connection of the protocol stack to the network, and application data can be transmitted. The disconnected state may refer to the protocol stack actively disconnecting from the network, or being disconnected from the network due to a fault. Specifically, the protocol stack is in an unconfigured state at startup. In this state, it periodically checks whether the configuration parameters are valid. If the user configures valid working parameters, the state changes to an initializing state. In the initializing state, the filter of the CAN driver device is configured according to the working parameters, the address resolution table is initialized, and the network status is periodically checked. If it is detected that it is connected to the CAN bus, a "network access notification" is broadcast to the bus, and the state changes to a networked state. In the networked state, it receives data sent by other devices on the CAN bus, completes the parsing and processing of network commands, and receives and reorganizes application data and notifies the application layer for processing. At the same time, it accepts service requests from the application layer, completes address network services, and application data sending services. When the user actively disconnects the network connection or detects a network connection failure, it changes to an offline state. In the offline state, the protocol stack waits for the user to shut down or restart. When the user performs a shutdown operation, the protocol stack changes to an unconfigured state. If the user performs a restart operation, the protocol stack changes to an initializing state. Figure 5 As shown, Figure 5 A schematic diagram showing the status of a network layer according to an embodiment of the present disclosure.

[0114] According to the method of the embodiment of the present disclosure, the application layer uses the protocol stack, which may include: first, calling the can netcreate function to create a network protocol stack instance for the specified CAN device; then calling the can_net_cfg function to configure the working parameters for the protocol stack, calling the set_evt_cb function to configure the event callback function, and calling the can_net_open function to start the protocol stack; by calling the can_net_status function, the current working status of the protocol stack can be obtained. When it is detected that the network has been connected, the can_net_write and can_net_read functions can be called to send and receive application data; calling the can_net_disconn function can actively disconnect the network and use the protocol stack to enter the off-network state; in the off-network state, the can_net_open function can be called to restart the protocol stack, and the can_net_close can be called to stop the protocol stack; finally, the can_net_destory function can be called to destroy the protocol stack instance and release the resources occupied by the protocol stack instance.

[0115] Specifically, the protocol stack application interface design, API function and data structure definition can be as follows:

[0116] Network protocol stack definition:

[0117] struct can_net_inst;

[0118] typedef struct can_net_inst can_net_inst_t;

[0119] Among them, can_net_inst_t is a type definition pointing to struct can_net_inst, which is used to represent an instance of the CAN network protocol stack. The specific struct can_net_inst usually contains information related to the operation of the protocol stack, such as CAN device handles, state variables, configuration parameters, etc.

[0120] Protocol stack status definition:

[0121] typedef enum{

[0122] CAN_NET_STA_NOCFG=0, / / Not configured

[0123] CAN_NET_STA_INITING, / / Initializing

[0124] CAN_NET_STA_ONLINE, / / Connected to the network

[0125] CAN_NET_STA_OFFLINE, / / Offline

[0126] }net_sta_t;

[0127] Among them, net_sta_t defines the status of the protocol stack. Specifically, CAN_NET_STA_NOCFG: the protocol stack has not been configured; CAN_NET_STA_INITING: the protocol stack is in the initialization process; CAN_NET_STA_ONLINE: the protocol stack has successfully joined the network; CAN_NET_STA_OFFLINE: the protocol stack has been offline from the network.

[0128] Protocol stack event definition:

[0129] typedef enum{

[0130] CAN_NET_EVT_OPEN=0, / / Open

[0131] CAN_NET_EVT_CLOSE, / / Close

[0132] CAN_NET_EVT_ONLINE, / / Connect to the network

[0133] CAN_NET_EVT_OFFLINE, / / Off-grid

[0134] }net_evt_t;

[0135] Among them, net_evt_t defines the event type of the protocol stack. Specifically, CAN_NET_EVT_OPEN: the protocol stack is opened. CAN_NET_EVT_CLOSE: the protocol stack is closed. CAN_NET_EVT_ONLINE: the protocol stack has been connected to the network. CAN_NET_EVT_OFFLINE: the protocol stack has been disconnected from the network.

[0136] Network transmission information definition:

[0137] typedef struct{

[0138] u8 prio; / / priority

[0139] u8 src_addr; / / source address

[0140] u8 dst_addr; / / destination address

[0141] u16 dlen; / / data length

[0142] u8 datas[0]; / / data

[0143] }net_msg_t;

[0144] Among them, net_msg_t defines a data structure for network transmission information. Specifically, prio: indicates the priority of the message. src_addr: source address, that is, the logical address of the device sending the message. dst_addr: destination address, that is, the logical address of the device receiving the message. dlen: data length, indicating the number of data bytes in the datas array. datas[0]: a data array of variable length, used to store the actual data content. This definition allows dynamic allocation of data space to adapt to data transmission requirements of different sizes.

[0145] 1) Create a CAN network protocol stack instance:

[0146] can_net_inst_t*can_net_create(const char*can_dev);

[0147] Parameter 1: can_dev is the device name of the can driver device.

[0148] Return value: pointer to the created network protocol stack instance. If it is empty, it means the creation failed.

[0149] Here, a CAN network protocol stack instance is created. can_dev is the device name of the CAN driver device, such as / dev / can0. The return value is a pointer to the can_net_inst_t structure, and NULL is returned if the creation fails.

[0150] 2) Destroy the CAN network protocol stack instance:

[0151] void can_net_destory(can_net_inst_t*hinst);

[0152] Parameter 1: hinst is the protocol stack instance pointer.

[0153] Return value: None.

[0154] Destroys a created CAN network protocol stack instance. hinst is a pointer to the can_net_inst_t structure. No return value.

[0155] 3) Destroy the CAN network protocol stack instance:

[0156] void can_net_cfg(can_net_inst_t*hinst,u8 laddr,u8 mac[6]);

[0157] Parameter 1: hinst is the protocol stack instance pointer.

[0158] Parameter 2: laddr is the communication logical address.

[0159] Parameter 3: mac is the device MAC address.

[0160] Return value: None.

[0161] The basic information of the protocol stack instance is configured, including the logical address and MAC address. hinst is a pointer to the can_net_inst_t structure. laddr is the communication logical address. mac is an array that stores the MAC address of the device. There is no return value.

[0162] 4) Set the protocol stack event callback function:

[0163] void can_set_evt_cb(can_net_inst_t*hinst,void(*cb)(int));

[0164] Parameter 1: hinst is the protocol stack instance pointer.

[0165] Parameter 2: cb is the event callback function pointer.

[0166] Return value: None.

[0167] Here, the event callback function is set, which is called when a specific event occurs in the protocol stack. hinst is a pointer to the can_net_inst_t structure. cb is a pointer to a function that accepts an integer parameter. There is no return value.

[0168] 5) Open the CAN network protocol stack instance and start the protocol stack to work:

[0169] bool can_net_open(can_net_inst_t*hinst);

[0170] Parameter 1: hinst is the protocol stack instance pointer.

[0171] Return value: true if successful, false if failed.

[0172] The protocol stack is started. hinst is a pointer to the can_net_inst_t structure. The return value is a Boolean value, which returns true if successful and false if failed.

[0173] 6) Close the CAN network protocol stack instance and stop the protocol stack from working:

[0174] void can_net_close(can_net_inst_t*hinst);

[0175] Parameter 1: hinst is the protocol stack instance pointer.

[0176] Return value: None.

[0177] Among them, close and stop the protocol stack. hinst is a pointer to the can_net_inst_t structure. There is no return value.

[0178] 7) Actively disconnect the network layer connection:

[0179] void can_net_disconn(can_net_inst_t*hinst);

[0180] Parameter 1: hinst is the protocol stack instance pointer.

[0181] Return value: None.

[0182] It actively disconnects from the network. hinst is a pointer to the can_net_inst_t structure. There is no return value.

[0183] 8) Read the data received by the network layer:

[0184] bool can_net_read(can_net_inst_t*hinst,net_msg_t*msg);

[0185] Parameter 1: hinst is the protocol stack instance pointer.

[0186] Parameter 2: msg is the pointer to the message body that stores the received data.

[0187] Return value: true if successful, false if failed.

[0188] Here, the received data is read from the network layer. hinst is a pointer to the can_net_inst_t structure. msg is a pointer to the net_msg_t structure, which is used to store the received message. The return value is a Boolean value, which returns true if successful and false if failed.

[0189] 9) Send data:

[0190] bool can_net_write(can_net_inst_t*hinst,net_msg_t*msg);

[0191] Parameter 1: hinst is the protocol stack instance pointer.

[0192] Parameter 2: pointer to the message body of the data sent by msg.

[0193] Return value: true if successful, false if failed.

[0194] Here, data is sent to the network layer. hinst is a pointer to the can_net_inst_t structure. msg is a pointer to the net_msg_t structure, which contains the data to be sent. The return value is a Boolean value, which returns true if successful and false if failed.

[0195] 10) Get the working status of the network protocol stack:

[0196] net_sta_t can_net_status(can_net_inst_t*hinst);

[0197] Parameter 1: hinst is the protocol stack instance pointer.

[0198] Return value: current protocol stack working status.

[0199] The current working status of the protocol stack is obtained. hinst is a pointer to the can_net_inst_t structure. The return value is a value in the net_sta_t enumeration type, indicating the current status.

[0200] It can be seen that according to the method of the embodiment of the present disclosure, since the application layer can carry any communication protocol, it can solve the problem that the existing CAN application communication protocol is difficult to integrate with other existing communication protocols, so it has wide applicability and can be directly applied to other communication fields. The frame structure is simple, easy to apply to embedded terminal devices, with a small amount of code and easy to design and implement. It can work based on CAN2.0B, and data transmission is fast and efficient. The network node device can work in a point-to-point communication mode based on connection, in a bus communication mode without connection, or in a hybrid communication mode with both modes, which can meet various communication requirements. The point-to-point communication mode means that the network node device clearly specifies the destination logical address to which the application data is sent in each application communication, and the application data can only be received by the specified destination device; the bus communication mode means that the network node device can not specify the destination logical address in each application communication, but directly use the broadcast address, so that the application data can be received by all network node devices, and further address identification is handled by the application layer.

[0201] It should be noted that the method of the embodiment of the present disclosure can be performed by a single device, such as a computer or a server. The method of the present embodiment can also be applied in a distributed scenario and completed by multiple devices cooperating with each other. In the case of such a distributed scenario, one of the multiple devices can only perform one or more steps in the method of the embodiment of the present disclosure, and the multiple devices will interact with each other to complete the described method.

[0202] It should be noted that the above describes some embodiments of the present disclosure. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the above embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0203] Based on the same technical concept, corresponding to any of the above-mentioned embodiments and methods, the present disclosure also provides a data communication device based on the CAN bus communication protocol, see Figure 6 , the data communication device based on the CAN bus communication protocol, the device comprising:

[0204] An acquisition module, configured to acquire application layer data based on a first communication protocol at a source device;

[0205] A judging module, used to judge whether the data volume of the application layer data is greater than a preset data volume;

[0206] A packet splitting module, configured to split the application layer data into multiple data packets in response to the data volume of the application layer data being greater than the preset data volume;

[0207] A data frame module, configured to generate a corresponding first data frame based on the data packet, wherein the first data frame includes a priority, a frame type, an end frame identifier, a source logical address, a target logical address and the data packet corresponding to the data packet;

[0208] A transmission module is used to transmit the first data frame to the target device indicated by the target logical address in reverse order based on the link layer and / or physical layer of the CAN bus communication protocol.

[0209] For the convenience of description, the above device is described by dividing it into various modules according to its functions. Of course, when implementing the present disclosure, the functions of each module can be implemented in the same or multiple software and / or hardware.

[0210] The device of the above embodiment is used to implement the corresponding data communication method based on the CAN bus communication protocol in any of the above embodiments, and has the beneficial effects of the corresponding method embodiment, which will not be repeated here.

[0211] Based on the same technical concept, corresponding to any of the above-mentioned embodiment methods, the present disclosure also provides a non-transitory computer-readable storage medium, wherein the non-transitory computer-readable storage medium stores computer instructions, and the computer instructions are used to enable the computer to execute the data communication method based on the CAN bus communication protocol as described in any of the above embodiments.

[0212] The computer-readable medium of this embodiment includes permanent and non-permanent, removable and non-removable media, and information storage can be implemented by any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, read-only compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device.

[0213] The computer instructions stored in the storage medium of the above embodiment are used to enable the computer to execute the data communication method based on the CAN bus communication protocol as described in any of the above embodiments, and have the beneficial effects of the corresponding method embodiments, which will not be repeated here.

[0214] Those skilled in the art should understand that the discussion of any of the above embodiments is merely illustrative and is not intended to imply that the scope of the present disclosure (including the claims) is limited to these examples. Based on the concept of the present disclosure, the technical features in the above embodiments or different embodiments may be combined, the steps may be implemented in any order, and there are many other variations of the different aspects of the embodiments of the present disclosure as described above, which are not provided in detail for the sake of simplicity.

[0215] In addition, to simplify the description and discussion, and in order not to make the embodiments of the present disclosure difficult to understand, the known power / ground connections to the integrated circuit (IC) chips and other components may or may not be shown in the provided figures. In addition, the device can be shown in the form of a block diagram to avoid making the embodiments of the present disclosure difficult to understand, and this also takes into account the fact that the details of the implementation of these block diagram devices are highly dependent on the platform on which the embodiments of the present disclosure will be implemented (that is, these details should be fully within the scope of understanding of those skilled in the art). Where specific details (e.g., circuits) are set forth to describe exemplary embodiments of the present disclosure, it is apparent to those skilled in the art that the embodiments of the present disclosure can be implemented without these specific details or with changes in these specific details. Therefore, these descriptions should be considered illustrative rather than restrictive.

[0216] Although the present disclosure has been described in conjunction with specific embodiments of the present disclosure, many replacements, modifications and variations of these embodiments will be apparent to those skilled in the art from the foregoing description. For example, other memory architectures (e.g., dynamic RAM (DRAM)) may use the embodiments discussed.

[0217] The embodiments of the present disclosure are intended to cover all such substitutions, modifications and variations that fall within the broad scope of the appended claims. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the embodiments of the present disclosure should be included in the scope of protection of the present disclosure.

Claims

1. A data communication method based on the CAN bus communication protocol, comprising: Acquire application layer data based on a first communication protocol at a source device; Determining whether the data volume of the application layer data is greater than a preset data volume; In response to the data volume of the application layer data being greater than the preset data volume, segmenting the application layer data to obtain a plurality of data packets; Generate a corresponding first data frame based on the data packet, the first data frame including a priority, a frame type, an end frame identifier, a source logical address, a target logical address and the data packet corresponding to the data packet; The first data frame is transmitted to the target device indicated by the target logical address in reverse order based on the link layer and / or physical layer of the CAN bus communication protocol.

2. The method according to claim 1, further comprising: Broadcasting and sending a first network connection detection frame for detecting a network connection of the source device; In response to the first network detection frame not detecting a device, determining that the source device fails to connect to the network; and sending the network detection frame again after a preset detection time interval; In response to the first networking detection frame detecting a device, determining that the source device is successfully connected to the network; or, Sending a second networking detection frame for detecting a network connection of a first device, wherein the second networking detection frame includes a first logical address of the first device; In response to the second networking detection frame being received, determining that the first device has accessed the network; In response to the second networking detection frame not being received, it is determined that the first device has not joined the network.

3. The method according to claim 1, further comprising: Acquiring, at the source device, a source physical address of the source device; and manually or automatically configuring a source logical address of the source device; Wherein, automatically configuring the source logical address of the source device further includes: Sending a first physical address request for acquiring a physical address to a first preset logical address; In response to receiving a first response to the first physical address request, sending a second physical address request for acquiring a physical address to a second preset logical address; In response to not receiving a first response to the first physical address request, determining the first logical address to be a source logical address of the source device.

4. The method according to claim 1, further comprising: In response to the source logical address configuration of the source device being completed, broadcasting a first network access notification frame to indicate that the source device has accessed the network; wherein the first network access notification frame includes a source physical address and a source logical address of the source device; Alternatively, a first off-network notification frame is broadcasted to indicate that the source device has gone off-network, wherein the first off-network notification frame includes a source logical address of the source device.

5. The method according to claim 1, further comprising: In response to receiving the second network access notification frame, the device physical address in the second network access notification frame and the corresponding device logical address are stored in association with each other to form an address resolution table; Alternatively, in response to receiving the second off-network notification frame, the locally stored device logical address and the corresponding device physical address are removed based on the device logical address in the second off-network notification frame.

6. The method according to claim 1, further comprising at least one of the following: In response to determining that the source physical address and the source logical address of the network layer of the source device are not configured, determining that the state of the network layer of the source device is an unconfigured state; In response to the source physical address and the source logical address of the network layer of the source device being configured, converting the state of the network layer of the source device from an unconfigured state to an initialized state; In response to the source device having accessed the network, converting the state of the network layer of the source device from an initialization state to a networked state; In response to the source device being disconnected, converting the state of the network layer of the source device from a connected state to a disconnected state; In response to shutting down the protocol stack of the network layer of the device, the state of the network layer of the source device is converted from an online state to an unconfigured state; or, in response to restarting the protocol stack of the network layer of the device, the state of the network layer of the source device is converted from an online state to an initialized state.

7. The method according to claim 1, further comprising: In response to receiving a second data frame including the source logical address, determining a frame type of the second data frame; In response to the frame type of the second data frame being a data frame, obtaining corresponding data to be processed based on the second data frame, so as to be processed by an application layer of the source device; or, in response to receiving a request for obtaining a source physical address or a source logical address for the source device, returning the source logical address and the source physical address of the source device; Alternatively, sending a third physical address request, where the third physical address request is used to request a second physical address corresponding to the second logical address; receiving a first response result for the third physical address request, where the first response result includes the second physical address; Alternatively, broadcast a first logical address request, where the first logical address request is used to request a third logical address corresponding to a third physical address; and receive a second response result for the first logical address request, where the second response result includes the third logical address.

8. A data communication device based on the CAN bus communication protocol, comprising: An acquisition module, configured to acquire application layer data based on a first communication protocol at a source device; A judging module, used to judge whether the data volume of the application layer data is greater than a preset data volume; A packet splitting module, configured to split the application layer data into multiple data packets in response to the data volume of the application layer data being greater than the preset data volume; A data frame module, configured to generate a corresponding first data frame based on the data packet, wherein the first data frame includes a priority, a frame type, an end frame identifier, a source logical address, a target logical address and the data packet corresponding to the data packet; A transmission module is used to transmit the first data frame to the target device indicated by the target logical address in reverse order based on the link layer and / or physical layer of the CAN bus communication protocol.

9. An electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method according to any one of claims 1 to 7 when executing the program. 10 . A non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to cause a computer to execute the method according to claim 1 .