Data transmission method, device, electronic device and storage medium
By judging the data type in the data transmission device and looking for matching items in the configuration file, it ensures that only matching flow control frame data is sent, which solves the problem of remote data transmission failure caused by misjudgment of the data transmission device and improves the accuracy of transmission.
Patent Information
- Application Number
- CN202211372813.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-03
- Publication Date
- 2024-09-10
- Estimated Expiration
- 2042-11-03
AI Technical Summary
The data transmission equipment misjudged the bus data to be the first frame data of ISO15765 and mistakenly replaced the flow control frame data, causing the remote data transmission to fail.
By determining whether the data is the first frame data of ISO15765 and searching for a match between the response CANID and the service request ID in the preset configuration file, it is ensured that only matching data is sent to the flow control frame data to avoid misjudgment.
Improved the accuracy of flow control frame data replacement to prevent remote data transmission failure due to misjudgment.
Smart Images

Figure CN115834281B
Abstract
Description
Technical Field
[0001] The present application belongs to the field of computer technology, and in particular, relates to a data transmission method, device, electronic device and storage medium. Background Art
[0002] Remote data transmission has very high latency requirements, usually requiring a response time of no more than 55 milliseconds. Timeouts will cause transmission failures. To solve this problem, data transmission equipment will replace flow control frame data in remote data transmission to avoid response time timeouts.
[0003] However, in actual applications, it is found that data transmission equipment will inevitably misjudge some bus data as ISO15765 first frame data and mistakenly replace it with flow control frame data, which will lead to failure of remote data transmission. Summary of the invention
[0004] The embodiments of the present application provide a data transmission method, device, electronic device and storage medium, which can solve the problem of remote data transmission failure caused by misjudging some bus data as ISO15765 first frame data and erroneously substituting flow control frame data.
[0005] In a first aspect, an embodiment of the present application provides a data transmission method, the method being applied to a first data transmission device in a data transmission system, the data transmission system further comprising a data sending device, a data receiving device, and a second data transmission device, wherein the first data transmission device is connected to the second data transmission device and the data receiving device, respectively, and the method comprising:
[0006] Acquire first data, where the first data is bus data sent by the data receiving device to the first data transmitting device;
[0007] Determine whether the first data is ISO15765 first frame data;
[0008] If the first data is ISO15765 first frame data, obtaining a response CANID and a first service request ID of the first data, and searching in a preset configuration file based on the response CANID and the first service request ID whether there is a matching request CANID and a second service request ID;
[0009] If so, sending flow control frame data to the data receiving device based on the first data;
[0010] The request CANID and the second service request ID are information carried by the second data sent by the data sending device to the first data transmission device.
[0011] Optionally, before sending the flow control frame data to the data receiving device based on the first data, the method further includes:
[0012] Obtain the response CAN channel number of the first data;
[0013] Based on the response CAN channel number, a search is performed in a preset configuration file to determine whether there is a matching request CAN channel number.
[0014] Optionally, before obtaining the first data, the method further includes:
[0015] acquiring the second data;
[0016] Determine whether the second data is ISO15765 single frame data or first frame data;
[0017] If the second data is ISO15765 single frame data or first frame data, obtaining the requested CAN channel number, requested CANID and second service request ID of the second data;
[0018] The requested CAN channel number, the requested CAN ID and the second service request ID are stored in a preset data structure.
[0019] Optionally, after obtaining the requested CAN channel number, requested CANID and second service request ID of the second data, the method further includes:
[0020] Searching whether the requested CAN channel number and the requested CANID exist in the preset data structure;
[0021] If it exists, the second service request ID corresponding to the requested CAN channel number and the requested CANID stored in the preset data structure is updated with the current second service request ID.
[0022] Optionally, searching a preset configuration file based on the response CANID and the first service request ID to see whether there is a matching request CANID and a second service request ID includes:
[0023] Searching the preset configuration file for a matching request CANID based on the response CANID;
[0024] If so, obtaining a second service request ID corresponding to the request CANID from the preset data structure;
[0025] If the first service request ID is equal to the second service request ID plus 0x40, it is determined that there are a request CANID and a second service request ID matching the response CANID and the first service request ID in the preset configuration file.
[0026] Optionally, the sending flow control frame data to the data receiving device based on the first data includes:
[0027] Searching for flow control frame data corresponding to the response CANID in the preset configuration file;
[0028] The flow control frame data is sent to the data receiving device.
[0029] Optionally, before or after sending the flow control frame data to the data receiving device based on the first data, the method further includes:
[0030] The requested CAN channel number, the requested CAN ID and the second service request ID stored in the preset data structure are deleted.
[0031] In a second aspect, an embodiment of the present application provides a data transmission device, wherein the data transmission device is built into a data transmission device in a data transmission system, wherein the data transmission system further includes a data sending device and a data receiving device, wherein the data transmission device is communicatively connected to the data sending device and the data receiving device respectively, and the data transmission device includes:
[0032] A first data acquisition module, used for acquiring first data, where the first data is bus data sent by the data receiving device to the first data transmission device;
[0033] A first judging module, used to judge whether the first data is ISO15765 first frame data;
[0034] a first search module, configured to obtain a response CANID and a first service request ID of the first data if the first data is ISO15765 first frame data, and search a preset configuration file for a matching request CANID and a second service request ID based on the response CANID and the first service request ID, wherein the request CANID and the second service request ID are information carried by the second data sent by the data sending device to the first data transmission device;
[0035] A flow control frame sending module is used to send flow control frame data to the data receiving device based on the first data, if any.
[0036] Optionally, the data transmission device further includes:
[0037] The second search module is used to obtain the response CAN channel number of the first data, and search whether there is a matching request CAN channel number in a preset configuration file based on the response CAN channel number.
[0038] Optionally, the data transmission device further includes:
[0039] A second data acquisition module, used for acquiring the second data;
[0040] A second judgment module is used to judge whether the second data is ISO15765 single frame data or first frame data;
[0041] A request data acquisition module, used for acquiring a request CAN channel number, a request CANID and a second service request ID of the second data if the second data is ISO15765 single frame data or first frame data;
[0042] The request data storage module is used to store the request CAN channel number, the request CANID and the second service request ID in a preset data structure.
[0043] Optionally, the data transmission device further includes:
[0044] A third search module, used for searching whether the requested CAN channel number and the requested CANID exist in the preset data structure;
[0045] An updating module is used to update the second service request ID corresponding to the requested CAN channel number and the requested CANID stored in the preset data structure with the current second service request ID if it exists.
[0046] Optionally, the first search module includes:
[0047] A first searching unit, configured to search the preset configuration file for a matching request CANID based on the response CANID;
[0048] a service request ID acquiring unit, configured to acquire, if any, a second service request ID corresponding to the request CANID from the preset data structure;
[0049] A determination unit is configured to determine whether there is a request CANID and a second service request ID matching the response CANID and the first service request ID in a preset configuration file if the first service request ID is equal to the second service request ID plus 0x40.
[0050] Optionally, the flow control frame sending module includes:
[0051] A second searching unit, configured to search the preset configuration file for flow control frame data corresponding to the response CANID;
[0052] A flow control frame sending unit is used to send the flow control frame data to the data receiving device.
[0053] Optionally, the data transmission device further includes:
[0054] A request data deletion module is used to delete the request CAN channel number, the request CANID and the second service request ID stored in the preset data structure.
[0055] In a third aspect, an embodiment of the present application provides an electronic device, including:
[0056] A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the steps of the data transmission method described in the first aspect above.
[0057] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, including: the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the data transmission method described in the first aspect above are implemented.
[0058] In a fifth aspect, an embodiment of the present application provides a computer program product. When the computer program product is run on an electronic device, the electronic device executes the steps of the data transmission method described in the first aspect above.
[0059] Compared with the prior art, the beneficial effect of the embodiment of the present application is as follows: since the flow control frame data is sent based on the first data only after it is determined that the first data is the first frame data of ISO15765 and the matching request CANID and the second service request ID can be found in the preset configuration file based on the response CANID and the first service request ID of the first data, the flow control frame data can be sent based on the first data only after it is determined that there is second data corresponding to the first data, and it can be avoided that other bus data similar to the first frame data of ISO15765 sent by the data receiving device is misjudged as the first frame data of ISO15765 that needs to be substituted for the flow control frame data, and the flow frame data is sent based on the other bus data similar to the first frame data of ISO15765, thereby improving the accuracy of the substituted flow control, and further solving the problem of failure of remote data transmission due to misjudging some bus data as the first frame data of ISO15765 and erroneously substituting the flow control frame data. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0061] Figure 1 is a structural diagram of a data transmission system provided by an embodiment of the present application;
[0062] Figure 2 It is a flowchart of a data transmission method provided by an embodiment of the present application;
[0063] Figure 3 is a schematic diagram of the structure of a data transmission device provided in an embodiment of the present application;
[0064] Figure 4 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0065] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.
[0066] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.
[0067] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0068] As used in the specification and appended claims of this application, the term "if" can be interpreted as "when" or "uponce" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "uponce it is determined" or "in response to determining" or "uponce [described condition or event] is detected" or "in response to detecting [described condition or event]", depending on the context.
[0069] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.
[0070] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.
[0071] When data is transmitted between a data sending device and a data receiving device, since one of the two devices may not have remote communication capabilities, or in order to meet the requirements of the data transmission protocol, a data transmission device connected to the two devices is often used as an intermediary to assist in achieving remote data transmission.
[0072] During remote data transmission, when the data sending device sends out the first frame data, it needs to receive the flow control frame data sent by the data receiving device before continuing to send continuous frame data corresponding to the first frame data to the data receiving device.
[0073] Considering the problem of data transmission delay, it is usually required that the response time of the data sending device from sending the first frame data to receiving the flow control frame data does not exceed the time threshold (for example, 55 milliseconds). If it times out, it will be invalid. To avoid timeout, the data transmission device needs to solve this problem by replying to the proxy flow control frame, that is, the data transmission device queries the response CANID corresponding to the request CANID of the first frame or single frame data in the configuration file, and then sends the flow control frame data associated with the response CANID to the data sending device instead of the data receiving device.
[0074] For example, if the data transmission device is a diagnostic device and the data receiving device is a vehicle, when the diagnostic device sends the first frame of data, it needs to receive the flow control frame data sent by the vehicle before it can continue to send the continuous frames corresponding to the first frame of data. For remote diagnosis, even if the data transmission devices all use wired Ethernet transmission, it is difficult to ensure that the delay does not exceed 55 milliseconds, not to mention that the data transmission device connected to the vehicle may not have Ethernet, and it is likely to use wireless connections such as WIFI or 5G.
[0075] The data transmission device will process some ISO15765 diagnostic data locally according to the CANID configured in the configuration file, for example, to solve the timeout problem by sending flow control frame data on behalf of the device.
[0076] The usual practice is to pre-write configuration files according to different brands of vehicles, and the configuration files store the mapping relationship between the request CANID and the response CANID. During initialization, the data transmission device reads the configuration file, and if it receives the first frame data that matches the request CANID, it will substitute the flow control frame data back. For example, if the data transmission device on the vehicle side receives the first frame data with a request CANID of 0x5797 sent by the vehicle, it will search the configuration file for the corresponding flow control frame CANID of 0x0617, and substitute the flow control frame data 3008000000000000 with CANID of 0x0617 back to the vehicle.
[0077] In addition to receiving the ISO15765 diagnostic data sent by the diagnostic device, the data transmission device also receives other bus data sent by the vehicle. The bus data sent by the vehicle will inevitably contain data with a format similar to the first frame or single frame data of the ISO15765 diagnostic data. Therefore, the data transmission device will inevitably misjudge some bus data as the ISO15765 first frame data and mistakenly replace it with flow control frame data, which will lead to diagnosis failure.
[0078] In order to solve the above problems, Figure 1 A structural schematic diagram of a data transmission system provided in an embodiment of the present application is shown. In the data transmission system schematic diagram, data is sent from end B to end C as an example for explanation. In this embodiment, the diagnostic device at end B can be a data sending device, and the vehicle at end C can be a data receiving device. In actual operation, the diagnostic device can both send data to the vehicle and receive data sent by the vehicle; the vehicle can both send data to the diagnostic device and receive data sent by the diagnostic device. The data transmission system includes a first data transmission device at end C, a data receiving device, a second data transmission device at end B, and a data sending device.
[0079] The data receiving device is connected to the first data transmission device, the first data transmission device is connected to the second data transmission device, and the second data transmission device is connected to the data sending device.
[0080] It should be noted that the connection method between the above-mentioned devices can be selected according to actual conditions. In some specific implementations, the data receiving device and the first data transmission device and the second data transmission device and the data sending device can be connected by short-range communication, such as CAN bus connection, while the first data transmission device and the second data transmission device can be connected by long-range communication.
[0081] In the implementation manner of the present application, the data interaction process between the various devices in the above data transmission system is as follows: Figure 2 As shown, the method can be applied to the first data transmission device at the C end, and specifically includes the following steps S210 to S240, and the specific implementation principle of each step is as follows:
[0082] S210, acquiring first data, where the first data is bus data sent by the data receiving device to the first data transmitting device.
[0083] In some embodiments, after receiving the service request data sent by the data sending device, the data receiving device may send response data to the data sending device.
[0084] For the convenience of description, the response data sent by the data receiving device to the first data transmission device is recorded as first data, and the data sent by the data sending device to the first data transmission device is recorded as second data.
[0085] After the data sending device sends the service request data to the second data transmission device via the CAN bus, the second data transmission device converts the service request data into second data and transparently transmits it to the first data transmission device via the network.
[0086] After receiving the service request data sent by the data sending device, the data receiving device may send corresponding response data to the data sending device, and the response data may be the first frame data of ISO15765.
[0087] In addition to the response data in the first frame data format of IS015765, the first data sent by the data sending device to the first data transmission device also includes other bus data sent by the data receiving device. These other bus data can be continuous frame data or bus data similar to the first frame data format of IS015765.
[0088] Step S220, determining whether the first data is ISO15765 first frame data.
[0089] In some embodiments, the first data may include ISO15765 single frame data, each frame of data may include multiple bytes, for example, 8 bytes.
[0090] The first frame data may refer to the first frame data of the first data, and the single frame data may refer to a frame of bus data.
[0091] Because the CAN standard is that a frame has a maximum of 8 bytes of data. However, the length of the Unified Diagnostic Services (UDS) command data may be greater than 8 bytes. If the UDS command data cannot be sent through one frame of bus data, it needs to be sent in multiple frames. In this case, the first frame of bus data is the first frame data, and the data following the first frame data is the continuous frame data.
[0092] After the first data transmission device receives the first data, it can parse the first data to extract the upper four bits of the first byte of the first data. If the upper four bits of the first byte of the first data are 0, the first data is ISO15765 single frame data; if the upper four bits of the first byte of the first data are 1, the first data is ISO15765 first frame data.
[0093] If the first data transmission device determines that the first data is ISO15765 first frame data, step S230 is further executed.
[0094] S230, if the above-mentioned first data is the ISO15765 first frame data, obtain the response CANID and the first service request ID of the above-mentioned first data, and based on the above-mentioned response CANID and the above-mentioned first service request ID, search in the preset configuration file whether there is a matching request CANID and the second service request ID, the above-mentioned request CANID and the second service request ID are the information carried by the second data sent by the above-mentioned data sending device to the above-mentioned first data transmission device.
[0095] In some embodiments, the second data is transparent data corresponding to the service request data sent by the data sending device to the data receiving device, and the second data and the service request data carry the same information.
[0096] After receiving the service request data sent by the data sending device, the data receiving device will send response data to the data sending device. The response data sent by the data receiving device is sent to the first data transmission device in the form of bus data. However, when sending bus data, the data receiving device will send bus data other than the response data in addition to the response data. Therefore, after the first transmission device receives the first data sent by the data receiving device, it is necessary to parse the first data to obtain the response CANID and the first service request ID of the first data, and search for matching request CANID and second service request ID in the preset configuration file based on the response CANID of the first data and the first service request ID of the first data. If there is no request CANID and second service request ID matching the response CANID and the first service request ID in the preset configuration file, it can be determined that the first data is not the response data of the second data, and the first data can be directly converted into transparent transmission data, which is transparently transmitted to the second data transmission device. After the second data transmission device converts the transparent transmission data into bus data, it is transmitted to the data sending device through the CAN bus without sending flow control frame data, thereby eliminating the bus data of non-response data in the first data.
[0097] If the request CANID and the second service request ID that match the response CANID and the first service request ID exist in the preset configuration file, it can be determined that the first data is the response data of the second data, and step S240 is further executed.
[0098] The configuration file stores the request CANID and the response CANID matching the request CANID. The request CANID and the second service request ID are information carried by the second data sent by the data sending device to the first data transmission device. The request CANID and the second service request ID can be obtained by parsing the second data.
[0099] S240: Send flow control frame data to the data receiving device based on the first data.
[0100] In some embodiments, if there is a request CANID and a second service request ID that match the response CANID and the first service request ID in the preset configuration file, flow control frame data can be sent to the data receiving device based on the first data, so that the flow control frame data can be accurately replaced, thereby improving the reliability of the flow control frame data replacement.
[0101] It should be understood that in the above steps S210 to S240, since the flow control frame data is sent based on the first data only after it is determined that the first data is the ISO15765 first frame data and the matching request CANID and the second service request ID can be found in the preset configuration file based on the response CANID and the first service request ID of the first data, the flow control frame data can be sent based on the first data only after it is determined that there is second data corresponding to the first data, and it can be avoided that other bus data similar to the ISO15765 first frame data sent by the data receiving device is misjudged as the ISO15765 first frame data that needs to be substituted for the flow control frame data, and the flow frame data is sent based on the other bus data similar to the ISO15765 first frame data, thereby improving the accuracy of the substituted flow control, and further solving the problem of remote data transmission failure caused by misjudging some bus data as the ISO15765 first frame data and erroneously substituted for the flow control frame data.
[0102] In some embodiments, in the above Figure 2 Based on the embodiment of the data transmission method shown, before sending the flow control frame data to the data receiving device based on the first data in step S230, the following steps may be included:
[0103] Step 11: Obtain the response CAN channel number of the first data.
[0104] Step 12: Based on the above response CAN channel number, search in the preset configuration file whether there is a matching request CAN channel number.
[0105] It should be understood that in the above steps 11 to 12, before sending the flow control frame, the request CAN channel number that matches the response CAN channel number can be searched in the preset configuration file, so that after further determining that there is second data corresponding to the first data, the flow control frame data is sent based on the first data, which can further improve the accuracy of the returned flow control frame data.
[0106] In some embodiments, in the above Figure 2 Based on the embodiment of the data transmission method shown, before acquiring the first data in step S210, the following steps may also be included:
[0107] Step 21: Obtain second data.
[0108] In some embodiments, when the data sending device and the data receiving device communicate, it is in the form of question and answer. Therefore, if the bus data sent by the data sending device is service request data, then the bus data sent by the data receiving device to the data sending device is response data, and the two are in a one-to-one correspondence.
[0109] Among them, after the second data transmission device receives the service request data sent by the data sending device, it converts the service request data into second data, transmits it to the first data transmission device through the network, and then the first data transmission device converts the second data into service request data and sends it to the data receiving device.
[0110] Step 22: determine whether the second data is ISO15765 single frame data or first frame data;
[0111] Step 23: If the second data is ISO15765 single-frame data or first-frame data, obtain the requested CAN channel number, requested CANID and second service request ID of the second data;
[0112] Step 24: Store the requested CAN channel number, the requested CAN ID and the second service request ID in a preset data structure.
[0113] In a specific implementation of the present application, after the first data transmission device receives the second data sent by the data sending device, it first parses the second data and extracts the upper four bits of the first byte of the second data. If the upper four bits of the first byte of the second data are 0, the second data is ISO15765 single frame data; if the upper four bits of the first byte of the second data are 1, the second data is ISO15765 first frame data.
[0114] After determining that the second data is ISO15765 first frame data or single frame data, the ISO15765 first frame data or single frame data can be parsed to extract the ISO15765 first frame data or single frame data request CAN channel number, request CANID and second service request ID, and the extracted request CAN channel number, request CANID and second service request ID are stored.
[0115] The requested CAN channel number, requested CANID and second service request ID of the second data may be stored in a preset data structure, which may be an array, etc., and is not limited here.
[0116] The storage of the requested CAN channel number, the requested CAN ID, and the second service request ID in the array may be as follows:
[0117] Struct rev_id
[0118] {
[0119] uint8_t can_id[5];
[0120] int can_channel;
[0121] uint8_t sid;
[0122] }
[0123] Among them, can_id[5] is used to store the request CANID, can_channel is used to store the CANID channel number, and sid is used to store the service request ID.
[0124] The above data structure is stored in the first data transmission device, or can be stored in a separate storage medium, as long as the first data transmission device can operate the data structure, and no limitation is made here. The operation here refers to access, modification or deletion, etc.
[0125] It should be understood that in the above steps 21 to 24, the first data transmission device can store the requested CAN channel number, requested CAN ID and second service request ID of the first frame data or single frame data sent by the data sending device for subsequent use.
[0126] In some embodiments, in the above Figure 2 Based on the embodiment of the data transmission method shown in FIG. 1 , after obtaining the requested CAN channel number, the requested CAN ID and the second service request ID of the second data in step 23, the following steps may also be implemented:
[0127] Step 31, searching whether the requested CAN channel number and the requested CANID exist in the preset data structure;
[0128] Step 32: If it exists, the second service request ID corresponding to the requested CAN channel number and the requested CANID stored in the preset data structure is updated with the current second service request ID.
[0129] It should be understood that in the above steps 31 to 32, only the above request CAN channel number and the last second service request ID under the above request CANID are stored, which is conducive to saving storage space.
[0130] In some embodiments, in the above Figure 2 Based on the embodiment of the data transmission method shown, step S230 searches for a matching request CANID and a second service request ID in a preset configuration file based on the response CANID and the first service request ID, which can be implemented by the following steps:
[0131] Step 41: Based on the response CANID, search in the preset configuration file whether there is a matching request CANID.
[0132] Step 42: If it exists, obtain the second service request ID corresponding to the request CANID from the preset data structure.
[0133] Step 43: If the first service request ID is equal to the second service request ID plus 0x40, it is determined that there are a request CANID and a second service request ID matching the response CANID and the first service request ID in the preset configuration file.
[0134] In some embodiments of the present application, since the data receiving device will definitely respond to the service request sent by the data sending device, the first byte of the response message is the service request ID sent by the data sending device + 0x40. For example, if the data sending device sends service request data with a second service request ID of 0x22, the first byte of the response data returned by the data receiving device, that is, the first service request ID is 0x62, that is, 0x22+0x40.
[0135] After receiving the first data, the first data transmission device can parse the first data, extract the CANID channel number of the first data and the response CANID of the first data, and then read the preset configuration file to obtain the request CANID that matches the response CANID of the first data.
[0136] If the CANID channel number of the second data sent by the data sending device stored in the preset data structure is 1, the request CANID is 0x0617, and the second service request ID is 0x22; and the response CANID of the first data is 0x0617, and the first byte of the first data, that is, the first service request ID is 0x22+0x40, it means that the relationship between the first data and the second data is service request data and response data. If the data with the second service request ID of 0x22 is not stored in the preset data structure, it means that there is no data stored in the preset data structure or other service request data is stored in the preset data structure, then it can be determined that the first data received by the first data transmission device is not the response data to the service request data sent by the data receiving device, and the flow control frame data is not sent to the data receiving device.
[0137] It should be understood that the above steps 41 to 43 can determine that the first data is the response data of the second data, filter out the bus data that is not the response data, and send the flow control frame data only for the response data, which is more accurate.
[0138] In some embodiments, in the above Figure 2 Based on the embodiment of the data transmission method shown, step S240 sends flow control frame data to the data receiving device based on the first data, which can be implemented by the following steps:
[0139] Step 51: Search the preset configuration file for the flow control frame data corresponding to the response CANID.
[0140] Step 52: Send the flow control frame data to the data receiving device.
[0141] In an embodiment of the present application, the preset configuration file also stores the correspondence between the response CANID and the flow control frame data. The first data transmission device can search the preset configuration file, search the configuration file for the flow control frame data corresponding to the response CANID of the first data, and then send the flow control frame data to the data receiving device.
[0142] It should be understood that the above steps 51 to 52 can realize sending corresponding flow control frame data to the data sending device.
[0143] In some embodiments, in the above Figure 2 Based on the embodiment of the data transmission method shown, before or after step S240 sending the flow control frame data to the data receiving device based on the first data, the following steps may also be included:
[0144] Step 61: Delete the requested CAN channel number, the requested CAN ID and the second service request ID stored in the preset data structure.
[0145] It should be understood that in the above step 61, because UDS stipulates that the data sending device sends a service request and the data receiving device responds, and the communication between the two is a question-and-answer method. Therefore, when the data receiving device has replied with response data, it is no longer necessary to store the information of the service request data in the preset data structure. Therefore, the data in the preset data structure can be deleted to save storage space of the first data transmission device.
[0146] Corresponding to the above Figure 3 The data transmission method shown, Figure 3 The embodiment of the present application shows a data transmission device M100, which is built in a data transmission device in a data transmission system. The data transmission system also includes a data sending device and a data receiving device, wherein the data transmission device is respectively connected to the data sending device and the data receiving device for communication. The data transmission device M100 includes:
[0147] A first data acquisition module M110, configured to acquire first data, where the first data is bus data sent by the data receiving device to the first data transmission device;
[0148] A first judging module M120, used to judge whether the first data is ISO15765 first frame data;
[0149] A first search module M130 is configured to obtain a response CANID and a first service request ID of the first data if the first data is ISO15765 first frame data, and search a preset configuration file for a matching request CANID and a second service request ID based on the response CANID and the first service request ID, wherein the request CANID and the second service request ID are information carried by the second data sent by the data sending device to the first data transmission device;
[0150] The flow control frame sending module M140 is used to send flow control frame data to the data receiving device based on the first data, if any.
[0151] Optionally, the data transmission device M100 further includes:
[0152] The second search module is used to obtain the response CAN channel number of the first data, and search whether there is a matching request CAN channel number in a preset configuration file based on the response CAN channel number.
[0153] Optionally, the data transmission device M100 further includes:
[0154] A second data acquisition module, used for acquiring the second data;
[0155] A second judgment module is used to judge whether the second data is ISO15765 single frame data or first frame data;
[0156] A request data acquisition module, used for acquiring a request CAN channel number, a request CANID and a second service request ID of the second data if the second data is ISO15765 single frame data or first frame data;
[0157] The request data storage module is used to store the request CAN channel number, the request CANID and the second service request ID in a preset data structure.
[0158] Optionally, the data transmission device M100 further includes:
[0159] A third search module, used for searching whether the requested CAN channel number and the requested CANID exist in the preset data structure;
[0160] An updating module is used to update the second service request ID corresponding to the requested CAN channel number and the requested CANID stored in the preset data structure with the current second service request ID if it exists.
[0161] Optionally, the first search module M130 includes:
[0162] A first searching unit, configured to search the preset configuration file for a matching request CANID based on the response CANID;
[0163] a service request ID acquiring unit, configured to acquire, if any, a second service request ID corresponding to the request CANID from the preset data structure;
[0164] A determination unit is configured to determine whether there is a request CANID and a second service request ID matching the response CANID and the first service request ID in a preset configuration file if the first service request ID is equal to the second service request ID plus 0x40.
[0165] Optionally, the flow control frame sending module M140 includes:
[0166] A second searching unit, configured to search the preset configuration file for flow control frame data corresponding to the response CANID;
[0167] A flow control frame sending unit is used to send the flow control frame data to the data receiving device.
[0168] Optionally, the data transmission device M100 further includes:
[0169] The request data deletion module is used to delete the request CAN channel number, the request CANID and the second service request ID stored in the preset data structure. It can be understood that the various implementations and implementation combinations and their beneficial effects in the above embodiments are also applicable to this embodiment and will not be repeated here.
[0170] Figure 4 This is a schematic diagram of the structure of an electronic device provided by an embodiment of the present application. Figure 4 As shown, the electronic device D10 of this embodiment includes: at least one processor D100 ( Figure 4 Only one processor, a memory D101, and a computer program D102 stored in the memory D101 and executable on the at least one processor D100 are shown in the figure. When the processor D100 executes the computer program D102, the steps in any of the above-mentioned method embodiments are implemented. Alternatively, when the processor D100 executes the computer program D102, the functions of the modules / units in the above-mentioned device embodiments are implemented, such as Figure 3 Functions of modules M110 to M140 are shown.
[0171] In some embodiments, the processor D100 implements the following steps when executing the computer program D102:
[0172] Acquire first data, where the first data is bus data sent by the data receiving device to the first data transmitting device;
[0173] Determine whether the first data is ISO15765 first frame data;
[0174] If the first data is ISO15765 first frame data, obtaining a response CANID and a first service request ID of the first data, and searching a preset configuration file for a matching request CANID and a second service request ID based on the response CANID and the first service request ID, where the request CANID and the second service request ID are information carried by the second data sent by the data sending device to the first data transmission device;
[0175] If so, flow control frame data is sent to the data receiving device based on the first data.
[0176] When the processor D100 executes the computer program D102, before sending the flow control frame data to the data receiving device based on the first data, the following steps may also be included:
[0177] Obtain the response CAN channel number of the first data;
[0178] Based on the response CAN channel number, a search is performed in a preset configuration file to determine whether there is a matching request CAN channel number.
[0179] When the processor D100 executes the computer program D102, before obtaining the first data, the processor D100 may further perform the following steps:
[0180] acquiring the second data;
[0181] Determine whether the second data is ISO15765 single frame data or first frame data;
[0182] If the second data is ISO15765 single frame data or first frame data, obtaining the requested CAN channel number, requested CANID and second service request ID of the second data;
[0183] The requested CAN channel number, the requested CAN ID and the second service request ID are stored in a preset data structure.
[0184] When the processor D100 executes the computer program D102, after obtaining the requested CAN channel number, the requested CAN ID and the second service request ID of the second data, the following steps may be further performed:
[0185] Searching whether the requested CAN channel number and the requested CANID exist in the preset data structure;
[0186] If it exists, the second service request ID corresponding to the requested CAN channel number and the requested CANID stored in the preset data structure is updated with the current second service request ID.
[0187] When the processor D100 executes the computer program D102, when implementing the step of searching in a preset configuration file based on the response CANID and the first service request ID whether there is a matching request CANID and a second service request ID, the following steps may be included:
[0188] Searching the preset configuration file for a matching request CANID based on the response CANID;
[0189] If so, obtaining a second service request ID corresponding to the request CANID from the preset data structure;
[0190] If the first service request ID is equal to the second service request ID plus 0x40, it is determined that there are a request CANID and a second service request ID matching the response CANID and the first service request ID in the preset configuration file.
[0191] When the processor D100 executes the computer program D102, the implementation of sending the flow control frame data to the data receiving device based on the first data may include the following steps:
[0192] Searching for flow control frame data corresponding to the response CANID in the preset configuration file;
[0193] The flow control frame data is sent to the data receiving device.
[0194] When the processor D100 executes the computer program D102, before or after implementing the sending of flow control frame data to the data receiving device based on the first data, the processor D100 may further perform the following steps:
[0195] The requested CAN channel number, the requested CAN ID and the second service request ID stored in the preset data structure are deleted.
[0196] The electronic device D10 may be a computing device such as a desktop computer, a notebook, a PDA, or a cloud server. The electronic device may include, but is not limited to, a processor D100 and a memory D101. Those skilled in the art will appreciate that Figure 4 This is only an example of the electronic device D10 and does not constitute a limitation on the electronic device D10. The electronic device D10 may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, it may also include input and output devices, network access devices, etc.
[0197] The processor D100 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0198] In some embodiments, the memory D101 may be an internal storage unit of the electronic device D10, such as a hard disk or memory of the electronic device D10. In other embodiments, the memory D101 may also be an external storage device of the electronic device D10, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the electronic device D10. Further, the memory D101 may also include both an internal storage unit of the electronic device D10 and an external storage device. The memory D101 is used to store an operating system, an application program, a boot loader (BootLoader), data, and other programs, such as the program code of the computer program, etc. The memory D101 may also be used to temporarily store data that has been output or is to be output.
[0199] It should be noted that the information interaction, execution process, etc. between the above-mentioned devices / units are based on the same concept as the method embodiment of the present application. Their specific functions and technical effects can be found in the method embodiment part and will not be repeated here.
[0200] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.
[0201] An embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in the above-mentioned method embodiments can be implemented.
[0202] An embodiment of the present application provides a computer program product. When the computer program product runs on an electronic device, the electronic device can implement the steps in the above-mentioned method embodiments when executing the computer program product.
[0203] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may at least include: any entity or device that can carry the computer program code to the camera / terminal device, recording medium, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium. For example, a USB flash drive, a mobile hard disk, a magnetic disk or an optical disk. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electric carrier signals and telecommunication signals.
[0204] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0205] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can 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.
[0206] In the embodiments provided in the present application, it should be understood that the disclosed devices / network equipment and methods can be implemented in other ways. For example, the device / network equipment embodiments described above are merely schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0207] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0208] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. A data transmission method, characterized in that: The method is applied to a first data transmission device in a data transmission system, the data transmission system further comprising a data sending device, a data receiving device, and a second data transmission device, wherein the first data transmission device is connected to the second data transmission device and the data receiving device respectively, and the method comprises: Acquire first data, where the first data is bus data sent by the data receiving device to the first data transmitting device; Determine whether the first data is ISO15765 first frame data; If the first data is ISO15765 first frame data, obtain a response CANID and a first service request ID of the first data, and search a preset configuration file for a matching request CANID and a second service request ID based on the response CANID and the first service request ID, where the request CANID and the second service request ID are information carried by the second data sent by the data sending device to the first data transmission device; If so, flow control frame data is sent to the data receiving device based on the first data.
2. The data transmission method according to claim 1, characterized in that: Before sending the flow control frame data to the data receiving device based on the first data, the method further includes: Obtain the response CAN channel number of the first data; Based on the response CAN channel number, a search is performed in a preset configuration file to determine whether there is a matching request CAN channel number.
3. The data transmission method according to claim 2, characterized in that: Before obtaining the first data, the method further includes: acquiring the second data; Determine whether the second data is ISO15765 single frame data or first frame data; If the second data is ISO15765 single frame data or first frame data, obtaining the requested CAN channel number, requested CANID and second service request ID of the second data; The requested CAN channel number, the requested CAN ID and the second service request ID are stored in a preset data structure.
4. The data transmission method according to claim 3, characterized in that: After obtaining the request CAN channel number, request CANID and second service request ID of the second data, it also includes: Searching whether the requested CAN channel number and the requested CANID exist in the preset data structure; If it exists, the second service request ID corresponding to the requested CAN channel number and the requested CANID stored in the preset data structure is updated with the current second service request ID.
5. The data transmission method according to claim 4, characterized in that: The searching, based on the response CANID and the first service request ID, in a preset configuration file to determine whether there is a matching request CANID and a second service request ID comprises: Searching the preset configuration file for a matching request CANID based on the response CANID; If so, obtaining a second service request ID corresponding to the request CANID from the preset data structure; If the first service request ID is equal to the second service request ID plus 0x40, it is determined that there are a request CANID and a second service request ID matching the response CANID and the first service request ID in the preset configuration file.
6. The data transmission method according to claim 5, characterized in that: The sending flow control frame data to the data receiving device based on the first data includes: Searching for flow control frame data corresponding to the response CANID in the preset configuration file; The flow control frame data is sent to the data receiving device.
7. The data transmission method according to claim 6, characterized in that: Before or after sending the flow control frame data to the data receiving device based on the first data, the method further includes: The requested CAN channel number, the requested CAN ID and the second service request ID stored in the preset data structure are deleted.
8. A data transmission device, characterized in that: The data transmission device is built into a data transmission device in a data transmission system, and the data transmission system further includes a data sending device and a data receiving device, wherein the data transmission device is communicatively connected with the data sending device and the data receiving device respectively, and the data transmission device includes: A first data acquisition module, used for acquiring first data, where the first data is bus data sent by the data receiving device to the first data transmission device; A first judging module, used to judge whether the first data is ISO15765 first frame data; a first search module, configured to obtain a response CANID and a first service request ID of the first data if the first data is ISO15765 first frame data, and search a preset configuration file for a matching request CANID and a second service request ID based on the response CANID and the first service request ID, wherein the request CANID and the second service request ID are information carried by the second data sent by the data sending device to the first data transmission device; A flow control frame sending module is used to send flow control frame data to the data receiving device based on the first data, if any.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and capable of running on the processor, characterized in that: When the processor executes the computer program, the data transmission method according to any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the data transmission method according to any one of claims 1 to 7 is implemented.
