Data interaction method, apparatus and electronic device

By employing a data processing and packet transmission method between the first and second control units of the vehicle-mounted equipment, the problem of the inability of the vehicle-mounted equipment to export log files and perform command-line interaction in the prior art is solved, thereby achieving efficient data interaction and debugging support.

CN121367702BActive Publication Date: 2026-06-02MOTOVIS TECH SHANGHAI CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
MOTOVIS TECH SHANGHAI CO LTD
Filing Date
2025-12-22
Publication Date
2026-06-02

AI Technical Summary

Technical Problem

The existing CAN or CAN FD interfaces of vehicle-mounted equipment are only used to transmit real-time signals. They cannot export log files generated inside the equipment to external devices, and they cannot support command-line interaction between external devices and vehicle-mounted equipment, thus failing to meet debugging requirements.

Method used

Through communication between the first control unit and the second control unit of the vehicle-mounted equipment, data processing is performed in response to the request parameters of the interaction request, the interaction request is executed, and the target data is packetized and transmitted according to the preset data volume, adapting to the transmission rate of the controller area network bus channel or the variable rate controller area network bus channel.

Benefits of technology

It enables log file export and command-line interaction between vehicle-mounted devices and external devices, meeting debugging needs and improving transmission efficiency and reliability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121367702B_ABST
    Figure CN121367702B_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of computer, disclose data interaction method, device and electronic equipment, the present application is in response to the request parameter of the interaction request sent by the second control unit, based on the request parameter carries out data processing to execute the interaction request, obtains the target data corresponding to the interaction request;The target data is packed according to the preset data volume, obtains multiple target data packages, and multiple target data packages are sent to the second control unit in turn.The present application is analyzed by the second control unit to the interaction request sent by the external device, obtains the request parameter of the interaction request, so that the vehicle-mounted device can receive and identify the interaction request of log reading or command execution;At the same time, the first control unit is based on the request parameter to execute the interaction request by data processing, so that the vehicle-mounted device can normally execute the interaction request sent through the controller area network bus channel or the variable speed controller area network bus channel, thereby meeting the debugging requirement of the vehicle-mounted device.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer technology, and more specifically to data interaction methods, devices, and electronic devices. Background Technology

[0002] To ensure the security and real-time performance of data transmission between in-vehicle equipment and external devices, while also considering stability and cost requirements, in-vehicle equipment currently often retains only the CAN (Controller Area Network) or CANFD (CAN with Flexible Data rate) interface as the sole external signal interface. However, the CAN or CANFD interface is only used for transmitting real-time signals and cannot export various log files generated internally to external devices. Furthermore, it cannot support command-line interaction between external devices and in-vehicle equipment, thus failing to meet the debugging needs of in-vehicle equipment. Summary of the Invention

[0003] This invention provides a data interaction method, apparatus, and electronic device to solve the problems of being unable to export various log files generated internally by the device to external devices and being unable to support command-line interaction between external devices and in-vehicle devices.

[0004] In a first aspect, the present invention provides a data interaction method applied in a first control unit of an in-vehicle device, wherein the first control unit is communicatively connected to a second control unit of the in-vehicle device, the method comprising:

[0005] In response to the request parameters of the interaction request sent by the second control unit, data processing is performed based on the request parameters to execute the interaction request and obtain the target data corresponding to the interaction request. The request parameters of the interaction request are obtained by the second control unit after obtaining the interaction request through the controller local area network bus channel or the variable rate controller local area network bus channel and parsing the interaction request. The request type of the interaction request is at least log reading and / or command execution.

[0006] The target data is divided into multiple target data packets according to a preset data volume, and these multiple target data packets are sent to the second control unit in sequence. The preset data volume is matched with the transmission rate of the controller LAN bus channel or the variable rate controller LAN bus channel.

[0007] In one optional implementation, if the request type of the interaction request is log reading, then data processing is performed based on the request parameters to execute the interaction request and obtain the target data corresponding to the interaction request, including:

[0008] Based on the log location information in the request parameters, the logs of the vehicle device are filtered to obtain the log files corresponding to the interaction requests;

[0009] The log files corresponding to the interaction requests are compressed to obtain the target data corresponding to the interaction requests.

[0010] In one optional implementation, after compressing the log file corresponding to the interaction request to obtain the target data corresponding to the interaction request, the method further includes:

[0011] Store the target data corresponding to the interaction request in a temporary file.

[0012] In one optional implementation, if the request type of the interaction request is command execution, then data processing is performed based on the request parameters to execute the interaction request and obtain the target data corresponding to the interaction request, including:

[0013] Parse the command string in the request parameters to obtain the request command corresponding to the interactive request;

[0014] Execute the request command corresponding to the interaction request to obtain the target data corresponding to the interaction request.

[0015] In one optional implementation, data processing is performed based on request parameters to execute the interaction request and obtain the target data corresponding to the interaction request, further including:

[0016] The execution result of the request command corresponding to the interaction request is redirected to a temporary file so that the target data is stored in the temporary file.

[0017] In one optional implementation, multiple target data packets are sequentially sent to the second control unit, including:

[0018] If a reception completion signal is received from the second control unit, the next target data packet is sent to the second control unit according to the packet sequence number of the target data packet. The packet sequence number of the target data packet is determined based on the packet order of the target data.

[0019] If a reception completion signal is not received from the second control unit within the preset time, or if a reception failure signal is received from the second control unit, the target data packet is resent to the second control unit.

[0020] Secondly, the present invention provides a data interaction method applied in a second control unit of an in-vehicle device, wherein the second control unit is communicatively connected to a first control unit of the in-vehicle device and external devices, the method comprising:

[0021] In response to an interaction request sent by an external device through a controller area network bus channel or a variable rate controller area network bus channel, the interaction request is parsed to obtain the request parameters of the interaction request, wherein the request type of the interaction request is at least log reading and / or command execution;

[0022] The request parameters are sent to the first control unit so that the first control unit executes the interaction request based on the request parameters and obtains multiple target data packets corresponding to the interaction request.

[0023] The system acquires multiple target data packets sent by the first control unit and sends these packets to external devices via the controller LAN bus channel or a variable-rate controller LAN bus channel.

[0024] Thirdly, the present invention provides a data interaction device applied in a first control unit of an in-vehicle device, wherein the first control unit is communicatively connected to a second control unit of the in-vehicle device, the device comprising:

[0025] The interaction request execution module is used to respond to the request parameters of the interaction request sent by the second control unit, perform data processing based on the request parameters to execute the interaction request and obtain the target data corresponding to the interaction request. The request parameters of the interaction request are obtained by the second control unit after obtaining the interaction request through the controller local area network bus channel or the variable rate control local area network bus channel and parsing the interaction request. The request type of the interaction request is at least log reading and / or command execution.

[0026] The data packet sending module is used to divide the target data into multiple target data packets according to a preset data amount, and send the multiple target data packets to the second control unit in sequence. The preset data amount is matched with the transmission rate of the controller local area network bus channel or the variable rate controller local area network bus channel.

[0027] Fourthly, the present invention provides a data interaction device applied in a second control unit of an in-vehicle device, wherein the second control unit is communicatively connected to a first control unit of the in-vehicle device and external devices, and the device includes:

[0028] The interaction request parsing module is used to respond to interaction requests sent by external devices through the controller LAN bus channel or the variable rate controller LAN bus channel, parse the interaction requests, and obtain the request parameters of the interaction requests. The request type of the interaction request is at least log reading and / or command execution.

[0029] The request parameter sending module is used to send request parameters to the first control unit so that the first control unit can execute the interaction request based on the request parameters and obtain multiple target data packets corresponding to the interaction request.

[0030] The data packet transmission module is used to acquire multiple target data packets sent by the first control unit and send the multiple target data packets to external devices through the controller LAN bus channel or the variable rate controller LAN bus channel.

[0031] Fifthly, the present invention provides an electronic device, comprising: a memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the computer instructions to perform the data interaction method described in the first aspect, the second aspect, or any corresponding embodiment thereof.

[0032] In a sixth aspect, the present invention provides a computer-readable storage medium storing computer instructions for causing a computer to perform the data interaction method described in the first aspect, the second aspect, or any corresponding embodiment thereof.

[0033] In a seventh aspect, the present invention provides a computer program product, including computer instructions for causing a computer to execute the data interaction method described in the first aspect or any corresponding embodiment thereof.

[0034] The data interaction method provided in this invention involves the second control unit of the vehicle-mounted device parsing interaction requests sent by external devices through a controller local area network (CLAN) bus channel or a variable rate CLAN bus channel to obtain request parameters. This enables the vehicle-mounted device to receive and identify log reading or command execution interaction requests through the CLAN bus channel or the variable rate CLAN bus channel. Simultaneously, the first control unit of the vehicle-mounted device processes data based on the request parameters to execute the interaction requests. This allows the vehicle-mounted device to normally execute the interaction requests sent through the CLAN bus channel or the variable rate CLAN bus channel, meeting the debugging requirements of the vehicle-mounted device. Furthermore, when returning the target data obtained from the execution of the interaction requests, the data is packetized and transmitted according to a preset data volume that matches the transmission rate of the CLAN bus channel or the variable rate CLAN bus channel, thereby adapting to the transmission rate of the CLAN bus channel or the variable rate CLAN bus channel and improving transmission efficiency. Attached Figure Description

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

[0036] Figure 1 This is a schematic diagram of the first type of data interaction method according to an embodiment of the present invention;

[0037] Figure 2 This is a schematic diagram of a second type of data interaction method according to an embodiment of the present invention;

[0038] Figure 3 This is a schematic diagram of the third process of the data interaction method according to an embodiment of the present invention;

[0039] Figure 4 This is a schematic diagram of the fourth process of the data interaction method according to an embodiment of the present invention;

[0040] Figure 5 This is a fifth flowchart illustrating the data interaction method according to an embodiment of the present invention;

[0041] Figure 6 This is a schematic diagram of the interaction when the request type of the interaction request is log reading in the data interaction method of this embodiment of the invention;

[0042] Figure 7 This is a schematic diagram of the interaction when the request type of the interaction request is command execution in the data interaction method of this embodiment of the invention;

[0043] Figure 8 This is a first structural block diagram of a data interaction device according to an embodiment of the present invention;

[0044] Figure 9 This is a second structural block diagram of a data interaction device according to an embodiment of the present invention;

[0045] Figure 10 This is a schematic diagram of the hardware structure of an electronic device according to an embodiment of the present invention. Detailed Implementation

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

[0047] It is understood that before using the technical solutions disclosed in the various embodiments of the present invention, users should be informed of the types, scope of use, and usage scenarios of the personal information involved in the present invention and their authorization should be obtained in accordance with relevant laws and regulations through appropriate means.

[0048] The terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this invention, "a plurality of" means two or more, unless otherwise explicitly specified.

[0049] To ensure the security and real-time performance of data transmission between in-vehicle equipment and external devices, while also considering stability and cost requirements, in-vehicle equipment currently often retains only the CAN (Controller Area Network) or CANFD (CAN with Flexible Data rate) interface as the sole external signal interface. However, the CAN or CANFD interface is only used for transmitting real-time signals and cannot export various log files generated internally to external devices. Furthermore, it cannot support command-line interaction between external devices and in-vehicle equipment, thus failing to meet the debugging needs of in-vehicle equipment.

[0050] To address the aforementioned technical problems, this invention provides a data interaction method applied to a first control unit of an in-vehicle device. The first control unit is communicatively connected to a second control unit of the in-vehicle device. The method responds to request parameters of an interaction request sent by the second control unit, performs data processing based on the request parameters to execute the interaction request and obtain the target data corresponding to the interaction request. The request parameters are obtained by the second control unit after parsing the interaction request received through a controller local area network (CLAN) bus channel or a variable-rate CLAN bus channel. The request type of the interaction request is at least log reading and / or command execution. The target data is divided into multiple target data packets according to a preset data volume, and these packets are sequentially sent to the second control unit. The preset data volume matches the transmission rate of the CLAN bus channel or the variable-rate CLAN bus channel. On the other hand, a data interaction method is also provided, applied to the second control unit of an in-vehicle device. The second control unit is communicatively connected to the first control unit of the in-vehicle device and external devices respectively. The method responds to an interaction request sent by an external device through a controller area network (CLAN) bus channel or a variable rate CLAN bus channel, parses the interaction request to obtain the request parameters of the interaction request, wherein the request type of the interaction request is at least log reading and / or command execution; sends the request parameters to the first control unit so that the first control unit executes the interaction request based on the request parameters to obtain multiple target data packets corresponding to the interaction request; obtains the multiple target data packets sent by the first control unit, and sends the multiple target data packets to the external device through the CLAN bus channel or the variable rate CLAN bus channel. Therefore, the second control unit of the vehicle-mounted equipment parses the interaction requests sent by external devices through the Controller Area Network (CLAN) bus channel or the variable-rate CLAN bus channel to obtain the request parameters. This enables the vehicle-mounted equipment to receive and identify log reading or command execution interaction requests through the CLAN bus channel or the variable-rate CLAN bus channel. Simultaneously, the first control unit of the vehicle-mounted equipment processes data based on the request parameters to execute the interaction requests. This allows the vehicle-mounted equipment to normally execute the interaction requests sent through the CLAN bus channel or the variable-rate CLAN bus channel, meeting the debugging requirements of the vehicle-mounted equipment. Furthermore, when returning the target data obtained from the execution of the interaction requests, the data is packetized and transmitted according to a preset data volume that matches the transmission rate of the CLAN bus channel or the variable-rate CLAN bus channel, thereby adapting to the transmission rate of the CLAN bus channel or the variable-rate CLAN bus channel and improving transmission efficiency.

[0051] The data interaction method provided in this invention can be applied to in-vehicle devices, providing comprehensive and reliable support for the diagnosis and debugging of these devices. The in-vehicle terminal includes a first control unit and a second control unit. The first control unit, as the core control unit of the in-vehicle device, manages and controls the entire device. The second control unit is a microprocessor used to manage the communication system of the in-vehicle device. The data interaction method provided in this invention does not require additional hardware or modification of existing hardware, ensuring hardware compatibility while meeting the debugging needs of in-vehicle devices.

[0052] According to an embodiment of the present invention, a data interaction method embodiment is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.

[0053] In this embodiment, a data interaction method is provided, which can be used in the first control unit of the vehicle-mounted device, wherein the first control unit is communicatively connected to the second control unit of the vehicle-mounted device. Figure 1 This is a schematic diagram of the first type of data interaction method according to an embodiment of the present invention, such as... Figure 1 As shown, the process includes the following steps:

[0054] Step S101: In response to the request parameters of the interaction request sent by the second control unit, data processing is performed based on the request parameters to execute the interaction request and obtain the target data corresponding to the interaction request.

[0055] In this embodiment of the invention, the request parameters of the interaction request are obtained by the second control unit after it receives the interaction request through the controller LAN bus channel or the variable-rate controller LAN bus channel and parses the interaction request. The request type of the interaction request is at least log reading and / or command execution. It should be noted that the interaction request may include more request types that can be implemented by the current controller LAN bus channel or the variable-rate controller LAN bus channel, such as real-time signals, etc., which will not be elaborated on here.

[0056] In this embodiment of the invention, after receiving the request parameters of the interaction request sent by the second control unit, the first control unit performs corresponding data processing on the data area pointed to by the interaction request based on the request parameters, thereby completing the execution of the interaction request and obtaining the target data corresponding to the interaction request. Specifically, if the request type of the interaction request is log reading, the target data corresponding to the interaction request is the read log data; if the request type of the interaction request is command execution, the target data corresponding to the interaction request is the command execution result.

[0057] Step S102: The target data is divided into multiple target data packets according to a preset data volume, and the multiple target data packets are sent to the second control unit in sequence.

[0058] In this embodiment of the invention, the preset data volume is matched with the transmission rate of the controller LAN bus channel or the variable-rate controller LAN bus channel, thereby improving the transmission rate of a single data packet, avoiding timeouts in the transmission of a single data packet, and reducing the risk of data loss. The target data is packetized according to the preset data volume to obtain multiple target data packets, and these multiple target data packets are sequentially sent to the second control unit according to the packetization order, so that the second control unit can transmit the target data packets to external devices.

[0059] This embodiment provides a data interaction method that can be used in the first control unit of an in-vehicle device, wherein the first control unit is communicatively connected to the second control unit of the in-vehicle device. Figure 2 This is a schematic diagram of a second type of data interaction method according to an embodiment of the present invention, such as... Figure 2 As shown, the process includes the following steps:

[0060] Step S201: In response to the request parameters of the interaction request sent by the second control unit, data processing is performed based on the request parameters to execute the interaction request and obtain the target data corresponding to the interaction request.

[0061] In this embodiment of the invention, the request type of the interaction request is determined based on the request parameters of the interaction request. The request parameters of the interaction request include at least a request type field or identifier. This request type field or identifier can be a request identifier field defined in the protocol header of the interaction request, a request path of the interaction request, or a command prefix of the interaction request, used to uniquely identify and distinguish an interaction request of a certain type. Furthermore, the type of the interaction request can be further confirmed by combining the business parameters in the request parameters. For example, if the business parameters include log location information, such as a log module ID, the request type of the interaction request can be confirmed as log reading; if the business parameters include a command string for the interaction request, the request type of the interaction request can be confirmed as command execution.

[0062] In this embodiment of the invention, if the request type of the interaction request is log reading, then step S201 may include:

[0063] Step S2011: Based on the log location information in the request parameters, filter the logs of the vehicle-mounted device to obtain the log file corresponding to the interaction request.

[0064] In this embodiment of the invention, log location information is used to locate the log module containing the log to be read. The log location information includes at least the log module ID and may also include limiting information about the log to be read, such as the time range of the log to be read. Based on the log location information in the request parameters, the logs of the vehicle-mounted device are searched and located to obtain the target log to be read by the interaction request. If the log location information further includes limiting information about the log to be read, the located target log is filtered based on this limiting information. For example, if the limiting information includes the time range of the log to be read, then logs with timestamps within that time range are filtered to obtain the log file corresponding to the interaction request.

[0065] Step S2012: Compress the log file corresponding to the interaction request to obtain the target data corresponding to the interaction request.

[0066] In this embodiment of the invention, the selected log files are packaged and compressed into a gz format compressed file using the tar command, and this compressed file is used as the final target data fed back to the external device to reduce the amount of data transmitted.

[0067] In one optional implementation, after compressing the log file corresponding to the interaction request to obtain the target data corresponding to the interaction request, the target data corresponding to the interaction request is stored in a temporary file so that the target data can be transmitted in packets later.

[0068] Step S202: The target data is divided into multiple target data packets according to a preset data size, and these multiple target data packets are sent sequentially to the second control unit. For details, please refer to [link to relevant documentation]. Figure 1 Step S102 of the illustrated embodiment will not be described again here.

[0069] This embodiment provides a data interaction method that can be used in the first control unit of an in-vehicle device, wherein the first control unit is communicatively connected to the second control unit of the in-vehicle device. Figure 3 This is a schematic diagram of a third type of data interaction method according to an embodiment of the present invention, such as... Figure 3 As shown, the process includes the following steps:

[0070] Step S301: In response to the request parameters of the interaction request sent by the second control unit, data processing is performed based on the request parameters to execute the interaction request and obtain the target data corresponding to the interaction request.

[0071] In this embodiment of the invention, the request type of the interaction request is determined based on the request parameters of the interaction request. The request parameters of the interaction request include at least a request type field or identifier. This request type field or identifier can be a request identifier field defined in the protocol header of the interaction request, a request path of the interaction request, or a command prefix of the interaction request, used to uniquely identify and distinguish an interaction request of a certain type. Furthermore, the type of the interaction request can be further confirmed by combining the business parameters in the request parameters. For example, if the business parameters include log location information, such as a log module ID, the request type of the interaction request can be confirmed as log reading; if the business parameters include a command string for the interaction request, the request type of the interaction request can be confirmed as command execution.

[0072] In an optional implementation, if the request type of the interaction request is command execution, then step S301 includes:

[0073] Step S3011: Parse the command string in the request parameters to obtain the request command corresponding to the interactive request.

[0074] In this embodiment of the invention, the command string contains at least the command name corresponding to the interaction request, and may also contain command parameters corresponding to the interaction request. The command string is split along spaces to separate it into the command name and command parameters, thus obtaining the request command for the interaction request. If the command string does not contain spaces, it indicates that it does not contain command parameters, and the resulting request command is a five-parameter command.

[0075] In one optional implementation, after parsing the request command corresponding to the interactive request, it is determined whether the request command conforms to the command restriction rules. If it conforms to the command restriction rules, the further request command is executed. The command restriction rules may include the following: the command length is a maximum of 63 characters and ends with \0; commands ending with \n are not supported, such as "cat / log / sys.txt\n"; continuous execution commands are not supported, such as top and tail -f.

[0076] Step S3012: Execute the request command corresponding to the interaction request to obtain the target data corresponding to the interaction request.

[0077] In this embodiment of the invention, the parsed request command is executed to perform the interactive request, and the execution result of the request command is used as the target data corresponding to the interactive request fed back to the external device.

[0078] In one alternative implementation, the execution result of the request command corresponding to the interaction request is directed to a temporary file so that the target data is stored in the temporary file for subsequent packet transmission.

[0079] In one alternative implementation, the target data is compressed when it is stored in a temporary file. The target data is packaged and compressed using the `tar` command into a `.gz` format compressed file to reduce the amount of data transferred.

[0080] Step S302: The target data is divided into multiple target data packets according to a preset data size, and these multiple target data packets are sent sequentially to the second control unit. For details, please refer to [link to relevant documentation]. Figure 1 Step S102 of the illustrated embodiment will not be described again here.

[0081] This embodiment provides a data interaction method that can be used in the first control unit of an in-vehicle device, wherein the first control unit is communicatively connected to the second control unit of the in-vehicle device. Figure 4 This is a schematic diagram of the fourth process of the data interaction method according to an embodiment of the present invention, such as... Figure 4 As shown, the process includes the following steps:

[0082] Step S401: In response to the request parameters of the interaction request sent by the second control unit, data processing is performed based on the request parameters to execute the interaction request and obtain the target data corresponding to the interaction request. For details, please refer to [link to details]. Figure 1 Step S101 of the illustrated embodiment will not be described again here.

[0083] Step S402: The target data is divided into multiple target data packets according to a preset data volume, and the multiple target data packets are sent to the second control unit in sequence.

[0084] In this embodiment of the invention, when the target data is divided into packets according to a preset data volume, the packet sequence number of each target data packet is recorded according to the packet division order, and the total number of target data packets is counted to verify the data integrity of subsequent target data packet transmissions based on the packet sequence number and the total number. Accordingly, in step S402, multiple target data packets are sequentially sent to the second control unit, including:

[0085] Step S4021: If a reception completion signal is received from the second control unit, the next target data packet is sent to the second control unit according to the packet sequence number of the target data packet.

[0086] In this embodiment of the invention, the reception completion signal is sent from the second control unit to the first control unit after successfully receiving a target data packet. If the reception completion signal is received from the second control unit, it indicates that the currently transmitted target data packet has been successfully transmitted to the second control unit. Therefore, according to the packet sequence number of the target data packet, the next target data packet corresponding to the next packet sequence number is sent to the second control unit. The packet sequence number of the target data packet is determined based on the packet order of the target data.

[0087] In this embodiment of the invention, for the target data packet with packet sequence number 1, which is the first target data packet, if no target data packets have been transmitted before it, the target data packet is transmitted after the data packet is completed, and the first target data packet is sent to the second control unit. For target data packets with packet sequence number 2 and thereafter, the target data packets are transmitted according to the reception completion signal fed back by the second control unit.

[0088] Step S4022: If a reception completion signal is not received from the second control unit within a preset time, or a reception failure signal is received from the second control unit, the target data packet is resent to the second control unit.

[0089] In this embodiment of the invention, if a reception completion signal is not received from the second control unit within a preset time, it indicates that the transmission of the current target data packet has timed out. If a reception failure signal is received from the second control unit, it indicates that the transmission of the current target data packet has failed. At this time, the target data packet is resent to the second control unit for retransmission. The number of retransmissions is recorded. When the number of retransmissions of a target data packet reaches a preset number, it indicates that the data transmission has failed, and the transmission of the target data ends. At the same time, the second control unit can send a fault signal indicating data transmission failure to an external device.

[0090] In this embodiment, on the other hand, a data interaction method is provided, which can be used in the second control unit of an in-vehicle device. The second control unit is communicatively connected to the first control unit of the in-vehicle device and external devices, respectively. Figure 5 This is a schematic diagram of the fifth type of data interaction method according to an embodiment of the present invention, such as... Figure 5 As shown, the process includes the following steps:

[0091] Step S501: In response to an interaction request sent by an external device through a controller local area network (CLAN) bus channel or a variable rate CLAN bus channel, the interaction request is parsed to obtain the request parameters of the interaction request.

[0092] In this embodiment of the invention, since the external device sends an interaction request through the Controller Area Network (CLAN) bus channel or the variable-rate CLAN bus channel, and the CLAN bus channel or the variable-rate CLAN bus channel uses the UDS diagnostic protocol for data transmission, the interaction request is sent to the second control unit using the UDS diagnostic protocol. The second control unit parses the interaction request and extracts the request parameters. The request type of the interaction request is at least log reading and / or command execution. It should be noted that the interaction request can include more request types that the current CLAN bus channel or the variable-rate CLAN bus channel can implement, such as real-time signals, etc., which will not be elaborated further here.

[0093] Step S502: Send the request parameters to the first control unit so that the first control unit executes the interaction request based on the request parameters and obtains multiple target data packets corresponding to the interaction request.

[0094] In this embodiment of the invention, after parsing the request parameters, the request parameters are sent to the first control unit so that the first control unit executes the interaction request based on the request parameters, obtains the target data corresponding to the interaction request, and then packages the target data into multiple target data packets and sends them to the second control unit.

[0095] Step S503: Obtain multiple target data packets sent by the first control unit, and send the multiple target data packets to external devices through the controller LAN bus channel or the variable rate controller LAN bus channel.

[0096] In this embodiment of the invention, after receiving all the target data packets, the second control unit uses the UDS diagnostic protocol to send multiple target data packets to external devices via the controller LAN bus channel or the variable rate controller LAN bus channel, so that the external devices can decompress and restore the target data packets after receiving all the target data packets to obtain the data they need.

[0097] In one specific implementation, Figure 6 This is a schematic diagram of the interaction when the request type of the interaction request is log reading in the data interaction method of this embodiment of the invention, as shown in the figure. Figure 6 As shown, depending on the function and the operation performed, the first control unit may include at least a data processing unit and a log filtering and packaging unit. The data processing unit is responsible for identifying the request type of the interaction request parameters sent by the second control unit. When the request type is identified as log reading, the log filtering and packaging unit is invoked to read the logs. The first and second control units use inter-core communication for data transmission and interaction. Figure 6As shown, the external device sends a log read request to the in-vehicle device using a diagnostic protocol. The second control unit directly receives this log read request, parses it, and sends the parsed request parameters to the data processing unit of the first control unit via inter-core communication. Upon receiving the request parameters, the data processing unit identifies it as a log read request, calls the log filtering and packaging unit, filters the logs according to the request parameters, obtains the filtered log file, and performs a packaging and compression operation. The compressed target data is stored in a temporary file. After storing the target data in the temporary file, the target data is divided into packets with a preset data size of 2KB. The data processing unit performs serial packet transmission according to the packet order, sequentially returning the target data packets corresponding to the interaction request. After receiving the target data packet, the second control unit sends a reception completion signal to the first control unit. Upon receiving the reception completion signal, the first control unit continues to transmit the next target data packet according to the packet order until all target data packets are transmitted to the second control unit. After receiving all target data packets, the second control unit transmits all target data packets to the external device using the diagnostic protocol, thus completing the response and feedback of the in-vehicle device to the interaction request from the external device.

[0098] In one specific implementation, Figure 7 This is a schematic diagram illustrating the interaction method of the present invention, where the request type of the interaction request is command execution. Figure 7 As shown, depending on the function and the operation performed, the first control unit may include at least a data processing unit and a command execution and result capture unit. The data processing unit is responsible for identifying the request type of the interaction request parameters sent by the second control unit. When the request type is identified as command execution, the command execution and result capture unit is invoked to execute the command. The first and second control units communicate and interact via inter-core communication. Figure 7As shown, the external device sends a command request to the vehicle-mounted device using a diagnostic protocol. The second control unit directly receives the command request, parses it, and sends the parsed request parameters to the data processing unit of the first control unit via inter-core communication. Upon receiving the request parameters, the data processing unit identifies it as a command request, parses the command string in the request parameters, and calls the command execution and result capture unit to execute the command. Simultaneously, the execution result is redirected to a temporary file so that the command execution and result capture unit can return the execution result to the temporary file after execution. The data processing unit performs a compression operation, and after compression, the data is packetized into pre-defined 2KB packets. The data processing unit performs serial packet transmission according to the packet order, sequentially returning the target data packets corresponding to the interaction requests. After receiving the target data packet, the second control unit sends a reception completion signal to the first control unit. Upon receiving the reception completion signal, the first control unit continues to transmit the next target data packet according to the packet order until all target data packets are transmitted to the second control unit. After receiving all target data packets, the second control unit transmits all target data packets to external devices using a diagnostic protocol, thereby completing the response and feedback of the vehicle equipment to the interaction requests of external devices.

[0099] The data interaction method provided in this invention involves the second control unit of the vehicle-mounted device parsing interaction requests sent by external devices through a controller local area network (CLAN) bus channel or a variable rate CLAN bus channel to obtain request parameters. This enables the vehicle-mounted device to receive and identify log reading or command execution interaction requests through the CLAN bus channel or the variable rate CLAN bus channel. Simultaneously, the first control unit of the vehicle-mounted device processes data based on the request parameters to execute the interaction requests. This allows the vehicle-mounted device to normally execute the interaction requests sent through the CLAN bus channel or the variable rate CLAN bus channel, meeting the debugging requirements of the vehicle-mounted device. Furthermore, when returning the target data obtained from the execution of the interaction requests, the data is packetized and transmitted according to a preset data volume that matches the transmission rate of the CLAN bus channel or the variable rate CLAN bus channel, thereby adapting to the transmission rate of the CLAN bus channel or the variable rate CLAN bus channel and improving transmission efficiency.

[0100] This embodiment also provides a data interaction device for implementing the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can refer to a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.

[0101] This embodiment provides a data interaction device applied in a first control unit of an in-vehicle device, wherein the first control unit is communicatively connected to a second control unit of the in-vehicle device, such as... Figure 8 As shown, it includes:

[0102] The interaction request execution module 801 is used to respond to the request parameters of the interaction request sent by the second control unit, perform data processing based on the request parameters to execute the interaction request and obtain the target data corresponding to the interaction request. The request parameters of the interaction request are obtained by the second control unit after obtaining the interaction request through the controller local area network bus channel or the variable rate control local area network bus channel and parsing the interaction request. The request type of the interaction request is at least log reading and / or command execution.

[0103] The data packet sending module 802 is used to divide the target data into multiple target data packets according to a preset data amount, and send the multiple target data packets to the second control unit in sequence. The preset data amount is matched with the transmission rate of the controller local area network bus channel or the variable rate controller local area network bus channel.

[0104] In an optional implementation, if the request type of the interaction request is log reading, then the interaction request execution module 801 includes:

[0105] The log filtering unit is used to filter the logs of the vehicle device based on the log location information in the request parameters, and obtain the log file corresponding to the interaction request;

[0106] The log compression unit is used to compress the log files corresponding to the interaction requests to obtain the target data corresponding to the interaction requests.

[0107] In one optional implementation, the interactive request execution module 801 further includes:

[0108] The data storage unit is used to store the target data corresponding to the interactive request into a temporary file.

[0109] In an optional implementation, if the request type of the interaction request is command execution, then the interaction request execution module 801 includes:

[0110] The command parsing unit is used to parse the command string in the request parameters to obtain the request command corresponding to the interactive request;

[0111] The command execution unit is used to execute the request command corresponding to the interactive request and obtain the target data corresponding to the interactive request.

[0112] In one optional implementation, the interactive request execution module 801 further includes:

[0113] The information storage unit is used to direct the execution result of the request command corresponding to the interactive request to a temporary file so as to store the target data in the temporary file.

[0114] In one optional implementation, the data packet sending module 802 includes:

[0115] The first data transmission unit is configured to, upon receiving a reception completion signal from the second control unit, send the next target data packet to the second control unit according to the packet sequence number of the target data packet, wherein the packet sequence number of the target data packet is determined based on the packet order of the target data.

[0116] The second data transmission unit is used to retransmit the target data packet to the second control unit if it does not receive a reception completion signal from the second control unit within a preset time, or if it receives a reception failure signal from the second control unit.

[0117] Another aspect of this embodiment provides a data interaction device applied in the second control unit of an in-vehicle device. The second control unit is communicatively connected to the first control unit of the in-vehicle device and external devices, such as... Figure 9 As shown, it includes:

[0118] The interaction request parsing module 901 is used to respond to interaction requests sent by external devices through the controller LAN bus channel or the variable rate controller LAN bus channel, parse the interaction requests, and obtain the request parameters of the interaction requests. The request type of the interaction requests is at least log reading and / or command execution.

[0119] The request parameter sending module 902 is used to send request parameters to the first control unit so that the first control unit can execute the interaction request based on the request parameters and obtain multiple target data packets corresponding to the interaction request;

[0120] The data packet transmission module 903 is used to acquire multiple target data packets sent by the first control unit and send the multiple target data packets to external devices through the controller local area network bus channel or the variable rate controller local area network bus channel.

[0121] The data interaction device provided in this embodiment of the invention can execute the data interaction method provided in any embodiment of the invention, and has the corresponding functional modules and beneficial effects for executing the method. Further functional descriptions of the various modules and units described above are the same as those in the corresponding embodiments described above, and will not be repeated here.

[0122] Figure 10 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention.

[0123] The following is a detailed reference. Figure 10This diagram illustrates a suitable structural schematic for implementing an electronic device according to embodiments of the present invention. The electronic device may include a processor (e.g., a central processing unit, graphics processor, etc.) 1001, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1002 or a program loaded from memory 1008 into random access memory (RAM) 1003. The RAM 1003 also stores various programs and data required for the operation of the electronic device. The processor 1001, ROM 1002, and RAM 1003 are interconnected via a bus 1004. An input / output (I / O) interface 1005 is also connected to the bus 1004.

[0124] Typically, the following devices can be connected to the I / O interface 1005: input devices 1006 including, for example, a touchscreen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; output devices 1007 including, for example, a liquid crystal display (LCD), speaker, vibrator, etc.; memory devices 1008 including, for example, magnetic tape, hard disk, etc.; and communication devices 1009. Communication device 1009 allows electronic devices to exchange data via wireless or wired communication with other devices. Although Figure 10 Electronic devices with various devices are shown, but it should be understood that it is not required to implement or have all of the devices shown, and more or fewer devices may be implemented or have instead.

[0125] In particular, according to embodiments of the present invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of the present invention include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device 1009, or installed from a memory 1008, or installed from a ROM 1002. When the computer program is executed by the processor 1001, it performs the functions defined in the data interaction method of the embodiments of the present invention.

[0126] Figure 10 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of use of the embodiments of the present invention.

[0127] This invention also provides a computer-readable storage medium. The methods described above according to embodiments of the invention can be implemented in hardware or firmware, or implemented as computer code that can be recorded on a storage medium, or implemented as computer code downloaded via a network and originally stored on a remote storage medium or a non-transitory machine-readable storage medium and then stored on a local storage medium. Thus, the methods described herein can be processed by software stored on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. The storage medium can be a magnetic disk, optical disk, read-only memory, random access memory, flash memory, hard disk, or solid-state drive, etc.; further, the storage medium can also include combinations of the above types of memory. It is understood that computers, processors, microprocessor controllers, or programmable hardware include storage components capable of storing or receiving software or computer code. When the software or computer code is accessed and executed by the computer, processor, or hardware, the data interaction methods shown in the above embodiments are implemented.

[0128] A portion of this invention can be applied as a computer program product, such as computer program instructions, which, when executed by a computer, can invoke or provide the methods and / or technical solutions according to the invention through the operation of the computer. Those skilled in the art will understand that the forms in which computer program instructions exist in a computer-readable medium include, but are not limited to, source files, executable files, installation package files, etc. Correspondingly, the ways in which computer program instructions are executed by a computer include, but are not limited to: the computer directly executing the instructions, or the computer compiling the instructions and then executing the corresponding compiled program, or the computer reading and executing the instructions, or the computer reading and installing the instructions and then executing the corresponding installed program. Here, the computer-readable medium can be any available computer-readable storage medium or communication medium accessible to a computer.

[0129] Although embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations all fall within the scope defined by the present invention.

Claims

1. A data interaction method, characterized in that, In a first control unit applied to an in-vehicle device, the first control unit is communicatively connected to a second control unit of the in-vehicle device. The first control unit is the core control unit of the in-vehicle device, managing and controlling the entire in-vehicle device. The second control unit is a microprocessor used to manage the communication system of the in-vehicle device. The method includes: In response to the request parameters of the interaction request sent by the second control unit, data processing is performed based on the request parameters to execute the interaction request and obtain the target data corresponding to the interaction request. The request parameters of the interaction request are obtained by the second control unit after it obtains the interaction request through the controller local area network bus channel or the variable rate controller local area network bus channel and parses the interaction request. The request type of the interaction request is at least log reading and / or command execution. The target data is divided into multiple target data packets according to a preset data volume, and the multiple target data packets are sent to the second control unit in sequence. The preset data volume is matched with the transmission rate of the controller local area network bus channel or the variable rate controller local area network bus channel.

2. The method according to claim 1, characterized in that, If the request type of the interaction request is log reading, then the data processing based on the request parameters to execute the interaction request and obtain the target data corresponding to the interaction request includes: Based on the log location information in the request parameters, the logs of the vehicle device are filtered to obtain the log file corresponding to the interaction request; The log file corresponding to the interaction request is compressed to obtain the target data corresponding to the interaction request.

3. The method according to claim 2, characterized in that, After compressing the log file corresponding to the interaction request to obtain the target data corresponding to the interaction request, the process further includes: The target data corresponding to the interaction request is stored in a temporary file.

4. The method according to claim 1, characterized in that, If the request type of the interaction request is command execution, then the data processing based on the request parameters to execute the interaction request and obtain the target data corresponding to the interaction request includes: The command string in the request parameters is parsed to obtain the request command corresponding to the interaction request; Execute the request command corresponding to the interaction request to obtain the target data corresponding to the interaction request.

5. The method according to claim 4, characterized in that, The step of processing data based on the request parameters to execute the interaction request and obtain the target data corresponding to the interaction request further includes: The execution result of the request command corresponding to the interaction request is directed to a temporary file so that the target data is stored in the temporary file.

6. The method according to claim 1, characterized in that, The step of sequentially sending multiple packets of the target data to the second control unit includes: If a reception completion signal is received from the second control unit, the next target data packet is sent to the second control unit according to the packet sequence number of the target data packet, wherein the packet sequence number of the target data packet is determined based on the packet order of the target data; If a reception completion signal is not received from the second control unit within a preset time, or if a reception failure signal is received from the second control unit, the target data is re-packetized and sent to the second control unit.

7. A data interaction method, characterized in that, In a second control unit applied to an in-vehicle device, the second control unit is communicatively connected to the first control unit of the in-vehicle device and external devices, respectively. The first control unit is the core control unit of the in-vehicle device, managing and controlling the entire in-vehicle device. The second control unit is a microprocessor used to manage the communication system of the in-vehicle device. The method includes: In response to an interaction request sent by the external device via a controller local area network (CLAN) bus channel or a variable rate CLAN bus channel, the interaction request is parsed to obtain the request parameters of the interaction request, wherein the request type of the interaction request is at least log reading and / or command execution; The request parameters are sent to the first control unit, so that the first control unit executes the interaction request based on the request parameters and obtains multiple target data packets corresponding to the interaction request; The system acquires multiple target data packets sent by the first control unit and sends these packets to the external device via the controller local area network bus channel or the variable rate controller local area network bus channel.

8. A data interaction device, characterized in that, In a first control unit applied to an in-vehicle device, the first control unit is communicatively connected to a second control unit of the in-vehicle device. The first control unit is the core control unit of the in-vehicle device, managing and controlling the entire in-vehicle device. The second control unit is a microprocessor used to manage the communication system of the in-vehicle device. The device includes: An interaction request execution module is used to respond to the request parameters of the interaction request sent by the second control unit, perform data processing based on the request parameters to execute the interaction request and obtain the target data corresponding to the interaction request. The request parameters of the interaction request are obtained by the second control unit after it obtains the interaction request through the controller local area network bus channel or the variable rate control local area network bus channel and parses the interaction request. The request type of the interaction request is at least log reading and / or command execution. The data packet sending module is used to divide the target data into multiple target data packets according to a preset data amount, and send the multiple target data packets to the second control unit in sequence, wherein the preset data amount matches the transmission rate of the controller local area network bus channel or the variable rate controller local area network bus channel.

9. A data interaction device, characterized in that, In a second control unit applied to an in-vehicle device, the second control unit is communicatively connected to the first control unit of the in-vehicle device and external devices respectively. The first control unit is the core control unit of the in-vehicle device, managing and controlling the entire in-vehicle device. The second control unit is a microprocessor used to manage the communication system of the in-vehicle device. The device includes: An interaction request parsing module is used to respond to an interaction request sent by the external device through a controller area network bus channel or a variable rate controller area network bus channel, parse the interaction request, and obtain the request parameters of the interaction request, wherein the request type of the interaction request is at least log reading and / or command execution; The request parameter sending module is used to send the request parameters to the first control unit, so that the first control unit executes the interaction request based on the request parameters and obtains multiple target data packets corresponding to the interaction request; The data packet transmission module is used to acquire multiple target data packets sent by the first control unit, and send the multiple target data packets to the external device through the controller local area network bus channel or the variable rate controller local area network bus channel.

10. An electronic device, characterized in that, include: A memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, the processor executing the computer instructions to perform the data interaction method of any one of claims 1 to 6 or 7.