Data communication method, device, electronic device and computer readable storage medium

By acquiring and determining the available communication channels of the target device in the control system and performing data communication through this channel, the compatibility problem between different types of communication devices is solved, and efficient data communication compatibility is achieved.

CN116032683BActive Publication Date: 2025-02-07IMOTION AUTOMOTIVE TECH (SUZHOU) CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202211650745.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-21
Publication Date
2025-02-07
Estimated Expiration
2042-12-21

AI Technical Summary

Technical Problem

The prior art is difficult to achieve compatibility between different types of communication devices, resulting in the problem of unavailability of the devices.

Method used

Compatibility of different types of communication devices (such as CAN devices and Ethernet devices) is achieved by a method of obtaining the available communication channels in the target device, determining the target communication channels, and performing data communication through the channel in the control system.

Benefits of technology

It effectively improves the compatibility of data communication technology, supports different types of communication devices, realizes compatibility of data communication, and avoids the problem of unavailability of equipment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116032683B_ABST
    Figure CN116032683B_ABST
Patent Text Reader

Abstract

The present application discloses a data communication method, which is applied to a control system, wherein the control system is communicatively connected with a target device, wherein the target device is a CAN device based on CAN communication and / or an Ethernet device based on Ethernet communication, and comprises: obtaining an available communication channel in the target device according to a communication instruction, wherein the available communication channel comprises a communication channel of each of the CAN devices and / or a communication channel of each of the Ethernet devices; determining a target communication channel among all the available communication channels; and communicating data with the target device through the target communication channel. The application of the technical solution provided by the present application can effectively improve the compatibility of data communication technology, so as to support different types of communication devices and thus realize data communication. The present application also discloses a data communication device, an electronic device, and a computer-readable storage medium, all of which have the above-mentioned technical effects.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of communication technology, and in particular to a data communication method, and also to a data communication device, an electronic device, and a computer-readable storage medium. Background Art

[0002] During the data communication process, different communication devices, such as CAN (Controller Area Network) devices, Ethernet devices, etc., generally need to adapt to the corresponding type of communication bus. Even if it is the same type of communication device, if it comes from different development companies, it is also necessary to adapt to the communication bus developed by the corresponding company. For example, the CAN devices developed by Zhou Liguo and the CAN devices developed by Vector all need to adapt to the CAN buses developed by the corresponding companies. They cannot be mixed and are incompatible with each other, otherwise it will cause the device to be unavailable.

[0003] Therefore, how to effectively improve the compatibility of data communication technology to support different types of communication devices and thus achieve data communication is an urgent problem to be solved by those skilled in the art. Summary of the invention

[0004] The purpose of the present application is to provide a data communication method, which can effectively improve the compatibility of data communication technology to support different types of communication equipment and thus realize data communication; another purpose of the present application is to provide a data communication device, an electronic device and a computer-readable storage medium, all of which have the above-mentioned beneficial effects.

[0005] In a first aspect, the present application provides a data communication method, which is applied to a control system, wherein the control system is communicatively connected with a target device, and the target device is a CAN device based on CAN communication and / or an Ethernet device based on Ethernet communication, and the method comprises:

[0006] Acquire an available communication channel in the target device according to the communication instruction, wherein the available communication channel includes a communication channel of each of the CAN devices and / or a communication channel of each of the Ethernet devices;

[0007] determining a target communication channel among all the available communication channels;

[0008] Data communication is performed with the target device through the target communication channel.

[0009] Optionally, performing data communication with the target device through the target communication channel includes:

[0010] In response to the message receiving request, receiving a first message sent by the target device through the target communication channel, and uploading the first message to the host computer;

[0011] In response to the message sending request, a second message sent by the host computer is received, and the second message is sent to the target device through the target communication channel.

[0012] Optionally, uploading the first message to a host computer includes:

[0013] Obtaining upload configuration information about the first message in the host computer;

[0014] Determining an upload mode of the first message according to the upload configuration information;

[0015] Reassembling the first message according to the upload mode to obtain a first reassembled message;

[0016] The first reassembled message is uploaded to the host computer.

[0017] Optionally, sending the second message to the target device through the target communication channel includes:

[0018] Obtaining sending configuration information about the second message in the host computer;

[0019] Determining a sending mode of the second message according to the sending configuration information;

[0020] Reassembling the second message according to the sending mode to obtain a second reassembled message;

[0021] The second reassembled message is sent to the target device through the target communication channel.

[0022] Optionally, the method further comprises:

[0023] Obtaining log configuration information about sent and received messages in the host computer, where the sent and received messages include the first message and the second message;

[0024] Determine a preset log format according to the log configuration information;

[0025] Read the log data corresponding to the sent and received messages;

[0026] The data format of the log data is converted into the preset log format.

[0027] Optionally, determining the target communication channel among all the available communication channels includes:

[0028] Uploading the channel information of all the available communication channels to the host computer;

[0029] Obtaining selection instructions for all the channel information in the host computer;

[0030] Determine target channel information according to the selection instruction;

[0031] The target communication channel is determined according to the target channel information.

[0032] Optionally, the method further comprises:

[0033] When a communication completion instruction is received, the connection with the target communication channel is disconnected according to the communication completion instruction.

[0034] In a second aspect, the present application further discloses a data communication device, which is applied to a control system, wherein the control system is communicatively connected with a target device, wherein the target device is a CAN device based on CAN communication and / or an Ethernet device based on Ethernet communication, and the device comprises:

[0035] An acquisition module, used for acquiring available communication channels in the target device according to a communication instruction, wherein the available communication channels include communication channels of each of the CAN devices and / or communication channels of each of the Ethernet devices;

[0036] A determination module, configured to determine a target communication channel among all the available communication channels;

[0037] A communication module is used to perform data communication with the target device through the target communication channel.

[0038] In a third aspect, the present application further discloses an electronic device, comprising:

[0039] Memory for storing computer programs;

[0040] A processor is used to implement the steps of any one of the data communication methods described above when executing the computer program.

[0041] In a fourth aspect, the present application further discloses a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of any one of the data communication methods described above are implemented.

[0042] The present application provides a data communication method, which is applied to a control system, wherein the control system is communicatively connected with a target device, and the target device is a CAN device based on CAN communication and / or an Ethernet device based on Ethernet communication, comprising: acquiring an available communication channel in the target device according to a communication instruction, wherein the available communication channel includes a communication channel of each of the CAN devices and / or a communication channel of each of the Ethernet devices; determining a target communication channel among all the available communication channels; and performing data communication with the target device through the target communication channel.

[0043] By applying the technical solution provided in the present application, a control system compatible with different types of communication devices is provided to realize data communication. The control system is connected to different types of communication devices. The communication devices may include CAN devices based on CAN communication and / or Ethernet devices based on Ethernet communication. During the data communication process, the control system can obtain all available communication channels in the specified target device for user selection. After selecting and determining the target communication channel, the control system can establish a communication connection relationship with the target device through the target communication channel, thereby realizing data communication with the target device based on the target communication channel. Obviously, this implementation method can be compatible with different types of communication devices at the same time, including CAN devices and Ethernet devices, effectively improving the compatibility of data communication technology.

[0044] The data communication device, electronic device and computer-readable storage medium provided in this application also have the above-mentioned technical effects, which will not be described in detail in this application. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] In order to more clearly illustrate the technical solutions in the prior art and the embodiments of the present application, the drawings required for use in the description of the prior art and the embodiments of the present application are briefly introduced below. Of course, the drawings described below in relation to the embodiments of the present application are only part of the embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without creative work, and the obtained other drawings also belong to the protection scope of the present application.

[0046] Figure 1 A schematic diagram of the structure of a data communication system provided by this application;

[0047] Figure 2 A flowchart of a data communication method provided by the present application;

[0048] Figure 3 A schematic diagram of the structure of another data communication system provided by the present application;

[0049] Figure 4A schematic diagram of a communication bus processing method provided by this application;

[0050] Figure 5 A flowchart of a method for receiving a data message provided by the present application;

[0051] Figure 6 A flowchart of a method for sending a data message provided by the present application;

[0052] Figure 7 A structural diagram of another data communication system provided by the present application;

[0053] Figure 8 A schematic diagram of the structure of a data communication device provided by the present application;

[0054] Fig. 9 A schematic diagram of the structure of an electronic device provided in this application. DETAILED DESCRIPTION

[0055] The core of this application is to provide a data communication method, which can effectively improve the compatibility of data communication technology to support different types of communication equipment and thus realize data communication; another core of this application is to provide a data communication device, an electronic device and a computer-readable storage medium, all of which have the above-mentioned beneficial effects.

[0056] In order to describe the technical solutions in the embodiments of the present application more clearly and completely, the technical solutions in the embodiments of the present application will be introduced below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0057] An embodiment of the present application provides a data communication method.

[0058] First, please refer to Figure 1 , Figure 1A structural diagram of a data communication system provided by the present application, the data communication system includes a control system 100 and a target device 200, the control system 100 is connected to the target device 200, wherein the target device 200 can be different types of communication devices, such as a CAN device based on CAN communication and / or an Ethernet device based on Ethernet communication, so that the control system 100 can be compatible with different types of communication devices to achieve data communication with different types of communication devices. The data communication method provided in the embodiment of the present application is applied to the control system 100. It should be noted that the type and quantity of the target device 200 do not affect the implementation of the present technical solution, and can be deployed by technical personnel according to actual needs, and the present application does not limit this.

[0059] For further information, please refer to Figure 2 , Figure 2 This is a flow chart of a data communication method provided in the present application. As mentioned above, the data communication method is applied to a control system in a data communication system and may include the following S101 to S103.

[0060] S101: Acquire available communication channels in the target device according to the communication instruction, where the available communication channels include communication channels of each CAN device and / or communication channels of each Ethernet device;

[0061] This step aims to achieve the acquisition of available communication channels in the target device. The target device is a communication device that needs to communicate data with the control system. The user selects and determines from multiple communication devices according to actual needs. The available communication channels are the communication channels available for use in the target device (except abnormal communication channels, occupied communication channels, etc.), such as the available communication channels of each CAN device and / or the available communication channels of each Ethernet device.

[0062] Among them, the operation of acquiring the available communication channels in the target device responds to the communication instruction, which is a data instruction for starting data communication, and can be initiated by the user through the host computer. For example, the control system is connected to the host computer, and human-computer interaction is realized through the host computer. The user initiates the communication instruction through the host computer and sends it to the control system, so that the control system responds to the communication instruction to collect all the available communication channels in the target device and feeds back to the host computer for user selection.

[0063] S102: Determine a target communication channel among all available communication channels;

[0064] This step aims to determine the target communication channel, which is the communication channel used to realize data communication between the control system and the target device. As mentioned above, after obtaining all available communication channels in the target device, the control system can feed back the channel information of all available communication channels to the host computer for user selection. Here, the user can select through a visual display method. Therefore, the user can select the communication channel that currently needs to communicate data as the target communication channel in the host computer display page.

[0065] Therefore, in a possible implementation manner, the above-mentioned determination of the target communication channel among all available communication channels may include the following steps:

[0066] Upload the channel information of all available communication channels to the host computer;

[0067] Get the selection instructions about all channel information in the host computer;

[0068] Determine target channel information according to the selection instruction;

[0069] The target communication channel is determined according to the target channel information.

[0070] The selection instruction is an instruction for selecting a target communication channel from all available communication channels, and is used to indicate the target channel information of the target communication channel selected by the user, thereby realizing the determination of the target communication channel.

[0071] It is understandable that each communication device generally provides multiple communication channels. Therefore, the above channel information may include relevant information of the communication device to which the corresponding communication channel belongs (such as device name, device manufacturer, device ID, etc.) and relevant information of the communication channel itself (such as channel name, channel number, etc.). Obviously, the channel information is similar to the identification information of the communication channel. Different communication channels correspond to different channel information, which is convenient for users to select the target communication channel and for the control system to determine the target communication channel.

[0072] S103: Perform data communication with the target device through the target communication channel.

[0073] This step is intended to achieve data communication. Specifically, after determining the target communication channel, the corresponding device connection port can be called to establish a connection relationship with the target device to which it belongs through the target communication channel, thereby achieving data communication between the control system and the target device based on the target communication channel, including data sending operations and data receiving operations (corresponding to the data message sending and receiving operations in the following embodiments).

[0074] It can be seen that the data communication method provided in the embodiment of the present application provides a control system that is compatible with different types of communication devices to achieve data communication. The control system is connected to different types of communication devices. The communication devices may include CAN devices based on CAN communication and / or Ethernet devices based on Ethernet communication. During the data communication process, the control system can obtain all available communication channels in the specified target device for user selection. After selecting and determining the target communication channel, the control system can establish a communication connection relationship with the target device through the target communication channel, thereby achieving data communication with the target device based on the target communication channel. Obviously, this implementation method can be compatible with different types of communication devices at the same time, including CAN devices and Ethernet devices, effectively improving the compatibility of data communication technology.

[0075] Based on the above embodiments:

[0076] In one embodiment of the present application, the data communication with the target device through the target communication channel may include the following steps:

[0077] In response to the message receiving request, receiving a first message sent by the target device through the target communication channel, and uploading the first message to the host computer;

[0078] In response to the message sending request, a second message sent by the upper computer is received, and the second message is sent to the target device through the target communication channel.

[0079] The embodiment of the present application provides a method for realizing data communication between a control system and a target device based on a target communication channel. It is understandable that data communication includes the reception and transmission of data messages. Therefore, when a message reception request is received, a first message sent by the target device can be received through the target communication channel, and uploaded to the host computer for the user to view. When a message transmission request is received, the second message sent by the host computer can be obtained and sent to the target device through the target communication channel. Among them, the message reception request can respond to the reception information of the first message, and the first message comes from the target device. The message transmission request can respond to the reception information of the second message, and the second message comes from the host computer. It should be noted that the above-mentioned "first" and "second" are only used to distinguish between the received data message and the data message to be sent, and no other restrictions are made.

[0080] In one embodiment of the present application, uploading the first message to the host computer may include the following steps:

[0081] Obtaining upload configuration information about the first message in the host computer;

[0082] Determining an upload mode of the first message according to the upload configuration information;

[0083] Reassemble the first message according to the upload mode to obtain a first reassembled message;

[0084] Upload the first reassembled message to the host computer.

[0085] The embodiment of the present application provides a method for uploading a first message to a host computer. Specifically, the user can pre-configure the upload mode of the first message according to actual needs, and the configuration process can be implemented based on configuration information, that is, the user can pre-configure parameters in the host computer to generate upload configuration information about the first message, and the upload configuration information is used to indicate various types of configuration information of the first message during the upload process, such as the message format of the first message during the upload process (which can be any type of data format), the upload method (which can include but is not limited to block upload, block upload data block size, real-time upload, scheduled upload, scheduled upload interval, etc.), etc.

[0086] Therefore, the control system can obtain the upload configuration information pre-set by the user from the upper computer, and determine the upload mode of the first message based on the upload configuration information, so as to reorganize the first message according to the upload mode to obtain the reorganized first message, that is, the above-mentioned first reorganized message, and finally upload the first reorganized message to the upper computer to realize the uploading of the first message.

[0087] In one embodiment of the present application, sending the second message to the target device through the target communication channel may include the following steps:

[0088] Obtaining the sending configuration information about the second message in the host computer;

[0089] Determining a sending mode of the second message according to the sending configuration information;

[0090] Reassembling the second message according to the sending mode to obtain a second reassembled message;

[0091] The second reassembled message is sent to the target device through the target communication channel.

[0092] The embodiment of the present application provides a method for implementing sending a second message to a target device. Specifically, the user can pre-configure the sending mode of the second message according to actual needs, and the configuration process can also be implemented based on configuration information, that is, the user can pre-configure parameters in the host computer to generate sending configuration information about the second message, and the sending configuration information is used to indicate various types of configuration information of the second message during the sending process, such as the message format of the second message during the sending process (which can be any type of data format), the sending mode (which can include but is not limited to block sending, the size of the data block sent in blocks, real-time sending, scheduled sending, the interval time of scheduled sending, etc.), etc.

[0093] Therefore, the control system can obtain the sending configuration information preset by the user from the upper computer, and determine the sending mode of the second message based on the sending configuration information, so as to reorganize the second message according to the sending mode to obtain the reorganized second message, that is, the above-mentioned second reorganized message, and finally send the second reorganized message to the target device through the target communication channel to realize the sending of the second message.

[0094] It should be noted that the above-mentioned upload configuration information and sending configuration information correspond to the communication mode of the data message, and the two can be the same or different, and can be set by the user according to actual needs, and this application does not limit this. In addition, since the configuration information (upload configuration information and sending configuration information) sets the message format, communication mode (upload mode and sending mode) of the data message (first message and second message) in the communication process (upload and send), the reorganization operation of the data message includes but is not limited to multi-frame splitting, LEN byte update, flow control frame definition, data block definition, interval time definition and other operations.

[0095] It can be understood that, through the above two embodiments, in the face of different types of communication devices, it is still possible to achieve a unified format for sending and receiving messages during the communication process, which is more convenient for subsequent users to view and manage communication data.

[0096] In one embodiment of the present application, the data communication method may further include the following steps:

[0097] Obtaining log configuration information about sent and received messages in the host computer, where the sent and received messages include a first message and a second message;

[0098] Determine the preset log format according to the log configuration information;

[0099] Read the log data corresponding to the sent and received messages;

[0100] Convert the data format of log data to the preset log format.

[0101] It is understandable that in order to facilitate exception tracing and data review, log recording is generally performed during the data communication process. However, due to the different types of communication equipment, the format of the log information recorded during the data communication process may also be different. In this regard, an embodiment of the present application provides a method for implementing a unified log format.

[0102] Specifically, the user can pre-set the log configuration information about the sent and received messages (i.e., the first message and the second message) according to actual needs, which is used to indicate the log format specified by the user, i.e., the preset log format, so that the control system can read the log data generated during the data communication process and convert its data format into the preset data format. Obviously, based on this implementation, in the face of different types of communication equipment, the format of the log data in the data communication process can still be unified, which is more convenient for subsequent users to view and manage the logs.

[0103] In one embodiment of the present application, the data communication method may further include: when a communication completion instruction is received, disconnecting from the target communication channel according to the communication completion instruction.

[0104] The data communication method provided in the embodiment of the present application can further realize the channel disconnection function, that is, after the control system completes the data communication with the target device, it can disconnect from the target communication channel, thereby ending the data communication with the target device, thereby realizing the release of the device communication port and the target communication channel. Of course, it can be reused after the resource release is completed. Among them, the channel disconnection operation can respond to the communication completion instruction, and its acquisition method can refer to the acquisition method of the above-mentioned communication instruction, and the embodiment of the present application will not be repeated here.

[0105] Based on the above embodiments:

[0106] The present application embodiment provides another data communication method, and its implementation process is as follows:

[0107] Step 1: Please refer to Figure 3 , Figure 3 This is a structural diagram of another data communication system provided by this application. The control system can be based on Windows system or Linux system, and the target device can be Ethernet device, CAN device shipped by Vector, CAN device shipped by Zhou Ligong, CAN device shipped by Pcan, other communication devices, etc. On this basis, the user can configure various parameters in the host computer in advance, and the control system can call the channel interface to automatically obtain all available communication channels in the target device. When multiple communication devices are connected at the same time, the channel interface will return an array to the host computer, which stores the channel information of all available communication channels, including but not limited to the communication device name, communication channel name, and communication channel number.

[0108] Step 2: Please refer to Figure 4 , Figure 4This is a schematic diagram of a communication bus processing method provided in the present application. The user selects the target communication channel in the host computer. The control system calls the corresponding driver to connect to the target communication channel according to the target communication channel selected by the host computer. After successful connection, the corresponding driver will be called to perform operations such as bus and cache initialization.

[0109] Step 3: Please refer to Figure 5 , Figure 5 A flow chart of a method for receiving data messages provided in the present application, wherein the host computer calls the message receiving interface to receive data messages (i.e., the first message mentioned above) in real time, and the control system can choose to filter the ID mode or not filter the ID mode (set according to actual needs) in the message receiving mode. Different modes are suitable for host computers with different functions. For example, the host computer with the diagnostic function can filter the ID, but the host computer for message monitoring does not need to filter the ID. In addition, the message receiving interface can support different forms of message receiving modes. When the received data message is single-frame data, the data message can be received in a single-frame format; when the received data message is the first frame data of continuous frame data, the flow control frame can be generated according to the host computer configuration to realize the reception of the data message. Among them, the flow control frame configuration includes data block size configuration, transmission interval time configuration, etc.

[0110] Step 4: Please refer to Figure 6 , Figure 6 A flow chart of a method for sending a data message provided by the present application (with Figure 5 The host computer calls the message sending interface to send a data message (i.e., the second message mentioned above). When sending a data message, it is only necessary to organize the data message to be sent into an array or list, and call the data processing module for processing. Among them, the data processing module can automatically parse and reorganize the incoming data message, and its functions include but are not limited to multi-frame splitting, LEN byte update, flow control frame definition, data block definition, interval time definition, etc. After the data processing is completed, the sending module will call the corresponding communication device interface, reorganize and package the data message and send it, and finally write the sending result into the log.

[0111] Step 5: The host computer can call the log information interface to obtain the current and previous log information, and unify the log format according to the configuration information.

[0112] Step 6: Figure 4 As shown, after the upper computer completes its work, that is, after completing the current data communication, it can call the disconnection interface to disconnect the target communication channel to release the interface, and the released interface can be reused.

[0113] On this basis, please refer to Figure 7 , Figure 7 This is a structural diagram of another data communication system provided by this application, and the functions of each functional module are as follows:

[0114] (1) Configuration module: provides unified configuration information for the host computer to perform parameter configuration.

[0115] (2) Channel module: It uses polling to poll all supported communication devices and the supportable communication channels in each communication device, and returns all available information.

[0116] (3) Connectivity module: supports the host computer to actively connect to communication devices, disconnect communication devices, initialize communication devices, and other operations.

[0117] (4) Sending parsing module: used to automatically parse the array of messages to be sent from the host computer into single-frame or multi-frame formats.

[0118] (5) Sending module: used to call the sending driver interface to send the results of the sending parsing module in sequence.

[0119] (6) Receiving and parsing module: used to parse and reassemble the single-frame or multi-frame messages received by the driver.

[0120] (7) Receiving module: used to continuously receive valid messages and support automatic sending of flow control frames.

[0121] (8) Log module: used to continuously record log information about data messages and unify the log format.

[0122] (9) Data structure reorganization module: used to reorganize parameters and data according to the driver used.

[0123] (10) CAN drive automatic calling module: used to automatically identify and call the communication device and communication channel selected by the host computer.

[0124] It can be seen that the data communication method provided in the embodiment of the present application provides a control system that is compatible with different types of communication devices to achieve data communication. The control system is connected to different types of communication devices. The communication devices may include CAN devices based on CAN communication and / or Ethernet devices based on Ethernet communication. During the data communication process, the control system can obtain all available communication channels in the specified target device for user selection. After selecting and determining the target communication channel, the control system can establish a communication connection relationship with the target device through the target communication channel, thereby achieving data communication with the target device based on the target communication channel. Obviously, this implementation method can be compatible with different types of communication devices at the same time, including CAN devices and Ethernet devices, effectively improving the compatibility of data communication technology.

[0125] An embodiment of the present application provides a data communication device.

[0126] Please refer to Figure 8 , Figure 8 This is a structural schematic diagram of a data communication device provided in the present application. The data communication device is applied to a control system, the control system is communicatively connected with a target device, the target device is a CAN device based on CAN communication and / or an Ethernet device based on Ethernet communication, and the device may include:

[0127] An acquisition module 1 is used to acquire available communication channels in a target device according to a communication instruction, where the available communication channels include communication channels of each CAN device and / or communication channels of each Ethernet device;

[0128] Determining module 2, used to determine a target communication channel among all available communication channels;

[0129] The communication module 3 is used to perform data communication with the target device through the target communication channel.

[0130] It can be seen that the data communication device provided in the embodiment of the present application provides a control system that is compatible with different types of communication equipment to achieve data communication. The control system is connected to different types of communication equipment. The communication equipment may include CAN equipment based on CAN communication and / or Ethernet equipment based on Ethernet communication. During the data communication process, the control system can obtain all available communication channels in the specified target device for user selection. After selecting and determining the target communication channel, the control system can establish a communication connection relationship with the target device through the target communication channel, thereby achieving data communication with the target device based on the target communication channel. Obviously, this implementation method can be compatible with different types of communication equipment at the same time, including CAN equipment and Ethernet equipment, effectively improving the compatibility of data communication technology.

[0131] In one embodiment of the present application, the communication module 3 may include:

[0132] A receiving unit, configured to receive a first message sent by a target device through a target communication channel in response to a message receiving request, and upload the first message to a host computer;

[0133] The sending unit is used to receive the second message sent by the upper computer in response to the message sending request, and send the second message to the target device through the target communication channel.

[0134] In one embodiment of the present application, the above-mentioned receiving unit can be specifically used to obtain upload configuration information about the first message in the upper computer; determine the upload mode of the first message according to the upload configuration information; reassemble the first message according to the upload mode to obtain a first reassembled message; and upload the first reassembled message to the upper computer.

[0135] In one embodiment of the present application, the above-mentioned sending unit can be specifically used to obtain sending configuration information about the second message in the upper computer; determine the sending mode of the second message according to the sending configuration information; reassemble the second message according to the sending mode to obtain a second reassembled message; and send the second reassembled message to the target device through the target communication channel.

[0136] In one embodiment of the present application, the data communication device may also include a log format conversion module, which is used to obtain log configuration information about sent and received messages in the upper computer, where the sent and received messages include a first message and a second message; determine a preset log format based on the log configuration information; read the log data corresponding to the sent and received messages; and convert the data format of the log data into a preset log format.

[0137] In one embodiment of the present application, the above-mentioned determination module 2 can be specifically used to upload channel information of all available communication channels to the host computer; obtain selection instructions about all channel information in the host computer; determine target channel information according to the selection instructions; and determine the target communication channel according to the target channel information.

[0138] In one embodiment of the present application, the data communication device may further include a disconnection module, which is used to disconnect from the target communication channel according to the communication completion instruction when a communication completion instruction is received.

[0139] For an introduction to the device provided in the embodiments of the present application, please refer to the above method embodiments, and the present application will not elaborate on them here.

[0140] An embodiment of the present application provides an electronic device.

[0141] Please refer to Fig. 9 , Fig. 9 This is a schematic diagram of the structure of an electronic device provided in this application, and the electronic device may include:

[0142] Memory for storing computer programs;

[0143] The processor is used to implement the steps of any one of the above-mentioned data communication methods when executing a computer program.

[0144] like Fig. 9, which is a schematic diagram of the composition structure of an electronic device, the electronic device may include: a processor 10, a memory 11, a communication interface 12 and a communication bus 13. The processor 10, the memory 11 and the communication interface 12 all communicate with each other through the communication bus 13.

[0145] In the embodiment of the present application, the processor 10 may be a central processing unit (CPU), an application specific integrated circuit, a digital signal processor, a field programmable gate array or other programmable logic devices, etc.

[0146] The processor 10 may call a program stored in the memory 11. Specifically, the processor 10 may execute operations in the embodiment of the data communication method.

[0147] The memory 11 is used to store one or more programs, which may include program codes, and the program codes include computer operation instructions. In the embodiment of the present application, the memory 11 at least stores programs for implementing the following functions:

[0148] Acquire available communication channels in the target device according to the communication instruction, where the available communication channels include communication channels of each CAN device and / or communication channels of each Ethernet device;

[0149] determining a target communication channel among all available communication channels;

[0150] Data communication is performed with the target device through the target communication channel.

[0151] In a possible implementation, the memory 11 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and an application required for at least one function, etc.; the data storage area may store data created during use.

[0152] In addition, the memory 11 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device or other volatile solid-state storage device.

[0153] The communication interface 12 may be an interface of a communication module, and is used to connect to other devices or systems.

[0154] Of course, it should be noted that Fig. 9 The structure shown does not constitute a limitation on the electronic device in the embodiment of the present application. In actual applications, the electronic device may include Fig. 9 More or fewer components than shown, or combinations of certain components.

[0155] An embodiment of the present application provides a computer-readable storage medium.

[0156] The computer-readable storage medium provided in the embodiment of the present application stores a computer program, and when the computer program is executed by a processor, the steps of any one of the above-mentioned data communication methods can be implemented.

[0157] The computer-readable storage medium may include: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and other media that can store program codes.

[0158] For an introduction to the computer-readable storage medium provided in the embodiments of the present application, please refer to the above method embodiments, and the present application will not elaborate on them here.

[0159] The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.

[0160] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0161] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

[0162] The technical solution provided by the present application is described in detail above. The principle and implementation method of the present application are described in detail using specific examples herein, and the description of the above embodiments is only used to help understand the method and core idea of ​​the present application. It should be pointed out that for ordinary technicians in this technical field, without departing from the principle of the present application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the scope of protection of the present application.

Claims

1. A data communication method, characterized in that: Applied to a control system, the control system is connected to multiple communication devices at the same time, the communication devices include CAN devices based on CAN communication and Ethernet devices based on Ethernet communication, the control system is also connected to a host computer, the method includes: Acquire available communication channels in all the communication devices according to the communication instructions issued by the host computer, wherein the available communication channels include communication channels of each of the CAN devices and communication channels of each of the Ethernet devices; determining a target communication channel among all the available communication channels; Performing data communication with a corresponding target communication device through the target communication channel; The data communication with the corresponding target communication device through the target communication channel includes: in response to a message receiving request, receiving a first message sent by the target communication device through the target communication channel, and uploading the first message to the host computer; in response to a message sending request, receiving a second message sent by the host computer, and sending the second message to the target communication device through the target communication channel; The uploading of the first message to the host computer includes: obtaining upload configuration information about the first message in the host computer; determining the upload mode of the first message according to the upload configuration information; reorganizing the first message according to the upload mode to obtain a first reorganized message; uploading the first reorganized message to the host computer; the upload configuration information includes the upload format of the first message; The sending of the second message to the target communication device through the target communication channel includes: obtaining sending configuration information about the second message in the host computer; determining a sending mode of the second message according to the sending configuration information; reassembling the second message according to the sending mode to obtain a second reassembled message; and sending the second reassembled message to the target communication device through the target communication channel; The message communication modes corresponding to the upload configuration information and the sending configuration information are the same.

2. The method according to claim 1, characterized in that: The obtaining of available communication channels in all the communication devices according to the communication instruction issued by the host computer includes: The channel information of the available communication channels in each of the communication devices is obtained according to the communication instruction issued by the host computer; the channel information includes one or more combinations of the communication device name, the communication channel name, and the communication channel number.

3. The method according to claim 1, characterized in that Also includes: Obtaining log configuration information about sent and received messages in the host computer, where the sent and received messages include the first message and the second message; Determine a preset log format according to the log configuration information; Read the log data corresponding to the sent and received messages; The data format of the log data is converted into the preset log format.

4. The method according to claim 1, characterized in that: The step of determining a target communication channel among all the available communication channels comprises: Uploading the channel information of all the available communication channels to the host computer; Obtaining selection instructions for all the channel information in the host computer; Determine target channel information according to the selection instruction; The target communication channel is determined according to the target channel information.

5. The method according to claim 1, characterized in that Also includes: When a communication completion instruction is received, the connection with the target communication channel is disconnected according to the communication completion instruction.

6. A data communication device, characterized in that: Applied to a control system, the control system is connected to multiple communication devices at the same time, the communication devices include CAN devices based on CAN communication and Ethernet devices based on Ethernet communication, the control system is also connected to a host computer, and the device includes: An acquisition module, used for acquiring available communication channels in all the communication devices according to the communication instructions issued by the host computer, wherein the available communication channels include the communication channels of each of the CAN devices and the communication channels of each of the Ethernet devices; A determination module, configured to determine a target communication channel among all the available communication channels; A communication module, used for performing data communication with a corresponding target communication device through the target communication channel; Wherein, the communication module includes: A receiving unit, configured to receive, in response to a message receiving request, a first message sent by the target communication device through the target communication channel, and upload the first message to a host computer; a sending unit, configured to receive, in response to a message sending request, a second message sent by the host computer, and send the second message to the target communication device through the target communication channel; The receiving unit is specifically used to obtain upload configuration information about the first message in the host computer; determine the upload mode of the first message according to the upload configuration information; reassemble the first message according to the upload mode to obtain a first reassembled message; upload the first reassembled message to the host computer; the upload configuration information includes an upload format of the first message; The sending unit is specifically used to obtain the sending configuration information about the second message in the host computer; determine the sending mode of the second message according to the sending configuration information; reassemble the second message according to the sending mode to obtain a second reassembled message; and send the second reassembled message to the target communication device through the target communication channel; The message communication modes corresponding to the upload configuration information and the sending configuration information are the same.

7. An electronic device, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the steps of the data communication method according to any one of claims 1 to 5 when executing the computer program.

8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the data communication method according to any one of claims 1 to 5 are implemented.

Citation Information

Patent Citations

  • System architecture and method for vehicle time synchronization and vehicle

    CN115348657A