Communication method and system for vehicle diagnosis and electronic equipment
By adopting UDS and DoIP services in the Ethernet protocol stack service in the vehicle diagnostic communication system, the problem that the existing CAN communication protocol cannot meet the complex diagnostic scenarios is solved, and more efficient and flexible vehicle diagnostic communication is achieved.
Patent Information
- Application Number
- CN202510201509.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-24
- Publication Date
- 2025-05-06
AI Technical Summary
Existing vehicle diagnostic communications based on CAN communication protocol cannot meet the complex diagnostic scenario requirements in modern cars, resulting in communication flexibility and inefficiency.
Through the modular design of UDS services and DoIP services in the Ethernet protocol stack service, the DoIP services and UDS protocol stack functions of the vehicle diagnostic communication system are realized, and Ethernet routing connection and diagnostic communication sessions are established between the client and the server, and diagnostic data communication is supported in a multi-threaded environment.
It improves the maintainability and scalability of vehicle diagnostic communications, improves communication efficiency, and meets the needs of complex diagnostic scenarios.
Smart Images

Figure CN119937527A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of vehicle diagnosis and communication technology, and in particular to a communication method, system and electronic equipment for vehicle diagnosis. Background Art
[0002] With the continuous improvement of the degree of electrification of vehicles, vehicle diagnostic technology plays an increasingly important role in ensuring vehicle safety and performance. Vehicle diagnosis is the process of fault detection and location of vehicles. Through the diagnosis of diagnostic tools (Tester), the fault of the vehicle or specific controller and the corresponding fault cause can be quickly and accurately determined. In this process, the diagnostic tool is an indispensable device, which can be a host computer software, hardware diagnostic instrument or test script that implements the diagnostic protocol.
[0003] At present, vehicle diagnostic communication is generally based on the CAN communication protocol. CAN communication can only achieve one-to-one diagnostic scenarios through physical addressing or functional addressing, which cannot meet the needs of complex diagnostic scenarios such as one-to-many and many-to-one in modern automobile diagnosis, reducing the communication flexibility of vehicle diagnosis. In addition, due to the bandwidth limitation of the CAN communication bus, the communication efficiency of vehicle diagnosis is reduced. Summary of the invention
[0004] In view of this, the purpose of the present application is to provide a communication method, system and electronic device for vehicle diagnosis. Through the modular design of the UDS service and DoIP service included in the Ethernet protocol stack service, the functions of the DoIP service and UDS protocol stack of the vehicle diagnosis communication system are realized, an Ethernet routing connection and a diagnostic communication session are established between the client and the server, and according to the target vehicle and diagnostic requirements, communication about diagnostic data between the server and the client in a multi-threaded environment is carried out through the diagnostic communication session, thereby improving the maintainability and scalability of vehicle diagnosis communication, and thereby improving the communication efficiency of vehicle diagnosis.
[0005] The embodiment of the present application provides a communication method for vehicle diagnosis, and the communication method is applied to a communication system for vehicle diagnosis; wherein the communication system for vehicle diagnosis includes a client provided in an external diagnostic device and a server provided in a target vehicle, and the communication method includes:
[0006] The client uses the Ethernet protocol stack service to obtain the vehicle information of the target vehicle to discover the target vehicle and establish an Ethernet routing connection with the server in the target vehicle; wherein the Ethernet protocol stack service includes UDS service and DoIP service;
[0007] In response to the Ethernet routing connection being established, the server establishes a diagnostic communication session with the client based on the Ethernet protocol stack service;
[0008] In response to the diagnostic communication session being established, the client determines, based on the vehicle information and externally input diagnostic requirement information for the target vehicle, a diagnostic request message for requesting to obtain diagnostic data of the target vehicle, and sends the diagnostic request message to the server through the diagnostic communication session;
[0009] In response to receiving the diagnostic request message, the server obtains the diagnostic data of the target vehicle and sends the diagnostic data to the client through the diagnostic communication session, so that the client obtains the diagnostic data of the target vehicle.
[0010] Further, the client uses the Ethernet protocol stack service to obtain the vehicle information of the target vehicle to discover the target vehicle and establish an Ethernet routing connection with the server in the target vehicle, including:
[0011] The client uses the UDP communication included in the DoIP service to obtain the vehicle information of the target vehicle to discover the target vehicle, and sets an online monitoring mechanism corresponding to the client;
[0012] In response to discovering the target vehicle, the client activates the TCP communication included in the DoIP service to establish a TCP communication connection with the client, and sends a routing activation request signal to the server in the target vehicle through the TCP communication connection;
[0013] In response to receiving the routing activation request signal, the server associates the logical address of the client with the socket information of the server, and sets the corresponding communication security policy of the server to establish an Ethernet routing connection between the client and the server.
[0014] Furthermore, the communication security strategy includes DoIP node synchronization strategy, routing activation security authentication strategy, DoIP edge node transparent transmission strategy and TLS secure transmission strategy.
[0015] Further, in response to the Ethernet routing connection being established, the server establishes a diagnostic communication session with the client based on the Ethernet protocol stack service, including:
[0016] In response to the Ethernet routing connection being established, the server uses the UDS service to establish a data transmission channel with the client;
[0017] In response to the data transmission channel being established, starting a UDS session management service using the UDS service, and reading a configuration file corresponding to the diagnostic communication session from a preset configuration file library;
[0018] Based on the data transmission channel, the UDS session management service and the configuration file, a diagnostic communication session is established with the client using the DoIP service.
[0019] Further, in response to the diagnostic communication session being established, the client determines, based on the vehicle information and externally input diagnostic requirement information for the target vehicle, a diagnostic request message for requesting to obtain diagnostic data of the target vehicle, and sends the diagnostic request message to the server through the diagnostic communication session, including:
[0020] In response to the diagnostic communication session being established, the client obtains externally input diagnostic requirement information for the target vehicle using the callback function and external interface set by the UDS service;
[0021] Based on the vehicle information and the diagnostic requirement information, using the UDS service to determine a diagnostic request message for requesting to obtain diagnostic data of the target vehicle;
[0022] The DoIP service is used to package the diagnostic request message, and the packaged diagnostic request message is sent to the service end through the diagnostic communication session.
[0023] Further, in response to receiving the diagnostic request message, the server obtains the diagnostic data of the target vehicle, and sends the diagnostic data to the client through the diagnostic communication session, so that the client obtains the diagnostic data of the target vehicle, including:
[0024] In response to receiving the diagnostic request message, the server uses the DoIP service to unpack the diagnostic request message, and uses the UDS service to obtain the diagnostic data of the target vehicle collected by the diagnostic tool;
[0025] The diagnostic data is packaged using the DoIP service, and the packaged diagnostic data is sent to the client through the diagnostic communication session, so that the client obtains the diagnostic data of the target vehicle.
[0026] The present application also provides a vehicle diagnosis communication system, the communication system comprising:
[0027] A client, used to obtain vehicle information of a target vehicle by using an Ethernet protocol stack service to discover the target vehicle and establish an Ethernet routing connection with a server in the target vehicle; wherein the Ethernet protocol stack service includes a UDS service and a DoIP service; in response to a diagnostic communication session being established, based on the vehicle information and externally input diagnostic requirement information for the target vehicle, determine a diagnostic request message for requesting to obtain diagnostic data of the target vehicle, and send the diagnostic request message to the server through the diagnostic communication session;
[0028] The server is used to establish a diagnostic communication session with the client based on the Ethernet protocol stack service in response to the Ethernet routing connection being established; obtain the diagnostic data of the target vehicle in response to receiving a diagnostic request message, and send the diagnostic data to the client through the diagnostic communication session, so that the client obtains the diagnostic data of the target vehicle.
[0029] Furthermore, the client includes:
[0030] A routing connection module, used to obtain vehicle information of a target vehicle by using an Ethernet protocol stack service to discover the target vehicle and establish an Ethernet routing connection with a service end in the target vehicle; wherein the Ethernet protocol stack service includes a UDS service and a DoIP service;
[0031] A diagnostic request module is used to determine, in response to a diagnostic communication session being established, a diagnostic request message for requesting to obtain diagnostic data of the target vehicle based on the vehicle information and externally input diagnostic requirement information for the target vehicle, and send the diagnostic request message to the service end through the diagnostic communication session.
[0032] Further, when the routing connection module is used to obtain vehicle information of a target vehicle using an Ethernet protocol stack service to discover the target vehicle and establish an Ethernet routing connection with a service end in the target vehicle, the routing connection module is used to:
[0033] Utilize the UDP communication included in the DoIP service to obtain the vehicle information of the target vehicle to discover the target vehicle, and set the online monitoring mechanism corresponding to the client;
[0034] In response to discovering the target vehicle, activating the TCP communication included in the DoIP service to establish a TCP communication connection with the client, and sending a routing activation request signal to the server in the target vehicle through the TCP communication connection;
[0035] In response to receiving the routing activation request signal, the server associates the logical address of the client with the socket information of the server, and sets the corresponding communication security policy of the server to establish an Ethernet routing connection between the client and the server.
[0036] Further, when the diagnostic request module is used to determine, in response to the diagnostic communication session being established, a diagnostic request message for requesting to obtain diagnostic data of the target vehicle based on the vehicle information and externally input diagnostic requirement information for the target vehicle, and send the diagnostic request message to the server through the diagnostic communication session, the diagnostic request module is used to:
[0037] In response to the diagnostic communication session being established, obtaining externally input diagnostic requirement information for the target vehicle using the callback function and external interface set by the UDS service;
[0038] Based on the vehicle information and the diagnostic requirement information, using the UDS service to determine a diagnostic request message for requesting to obtain diagnostic data of the target vehicle;
[0039] The DoIP service is used to package the diagnostic request message, and the packaged diagnostic request message is sent to the service end through the diagnostic communication session.
[0040] Furthermore, the server includes:
[0041] a communication session module, configured to establish a diagnostic communication session with the client based on the Ethernet protocol stack service in response to the Ethernet routing connection being established;
[0042] The diagnostic data module is used to obtain the diagnostic data of the target vehicle in response to receiving the diagnostic request message, and send the diagnostic data to the client through the diagnostic communication session, so that the client obtains the diagnostic data of the target vehicle.
[0043] Further, when the communication session module is used to establish a diagnostic communication session with the client based on the Ethernet protocol stack service in response to the Ethernet routing connection being established, the communication session module is used to:
[0044] In response to the Ethernet routing connection being established, establishing a data transmission channel with the client using the UDS service;
[0045] In response to the data transmission channel being established, starting a UDS session management service using the UDS service, and reading a configuration file corresponding to the diagnostic communication session from a preset configuration file library;
[0046] Based on the data transmission channel, the UDS session management service and the configuration file, a diagnostic communication session is established with the client using the DoIP service.
[0047] Further, when the diagnostic data module is used to obtain the diagnostic data of the target vehicle in response to receiving the diagnostic request message, and send the diagnostic data to the client through the diagnostic communication session so that the client obtains the diagnostic data of the target vehicle, the diagnostic data module is used to:
[0048] In response to receiving the diagnostic request message, unpacking the diagnostic request message using the DoIP service, and acquiring diagnostic data of the target vehicle collected by the diagnostic tool using the UDS service;
[0049] The diagnostic data is packaged using the DoIP service, and the packaged diagnostic data is sent to the client through the diagnostic communication session, so that the client obtains the diagnostic data of the target vehicle.
[0050] An embodiment of the present application also provides an electronic device, comprising: a processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor and the memory communicate via the bus, and when the machine-readable instructions are executed by the processor, the steps of the communication method for vehicle diagnosis as described above are performed.
[0051] An embodiment of the present application further provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the steps of the communication method for vehicle diagnosis as described above are executed.
[0052] The communication method, system and electronic device for vehicle diagnosis provided by the embodiments of the present application, the communication method is applied to the communication system for vehicle diagnosis; wherein the communication system for vehicle diagnosis includes a client arranged in an external diagnostic device and a server arranged in a target vehicle, and the communication method includes: the client uses an Ethernet protocol stack service to obtain vehicle information of the target vehicle to discover the target vehicle and establish an Ethernet routing connection with the server in the target vehicle; wherein the Ethernet protocol stack service includes a UDS service and a DoIP service; in response to the establishment of the Ethernet routing connection, the server establishes a diagnostic communication session with the client based on the Ethernet protocol stack service; in response to the establishment of the diagnostic communication session, the client determines a diagnostic request message for requesting to obtain diagnostic data of the target vehicle based on the vehicle information and externally input diagnostic requirement information for the target vehicle, and sends the diagnostic request message to the server through the diagnostic communication session; in response to receiving the diagnostic request message, the server obtains the diagnostic data of the target vehicle and sends the diagnostic data to the client through the diagnostic communication session so that the client obtains the diagnostic data of the target vehicle.
[0053] Compared with the diagnostic communication method based on CAN communication protocol in the prior art, the modular design of UDS service and DoIP service included in the Ethernet protocol stack service realizes the functions of DoIP service and UDS protocol stack of the vehicle diagnostic communication system, establishes Ethernet routing connection and diagnostic communication session between the client and the server, and communicates about diagnostic data between the server and the client in a multi-threaded environment through the diagnostic communication session according to the target vehicle and diagnostic requirements, thereby improving the maintainability and scalability of vehicle diagnostic communication, and thus improving the communication efficiency of vehicle diagnosis.
[0054] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0056] Figure 1 A flow chart of a vehicle diagnosis communication method provided in an embodiment of the present application;
[0057] Figure 2 A schematic diagram of the structure of a vehicle diagnosis communication system provided in an embodiment of the present application;
[0058] Figure 3 A schematic diagram of the structure of a client provided in an embodiment of the present application;
[0059] Figure 4 A schematic diagram of the structure of a server provided in an embodiment of the present application;
[0060] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0061] To make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. The components of the embodiments of the present application usually described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, each other embodiment obtained by those skilled in the art without making creative work belongs to the scope of protection of the present application.
[0062] Research has found that, at present, vehicle diagnostic communication is generally based on the CAN communication protocol. CAN communication can only achieve one-to-one diagnostic scenarios through physical addressing or functional addressing, and cannot meet the needs of complex diagnostic scenarios such as one-to-many and many-to-one in modern automobile diagnosis, thus reducing the communication flexibility of vehicle diagnosis. In addition, due to the bandwidth limitation of the CAN communication bus, the communication efficiency of vehicle diagnosis is reduced.
[0063] Based on this, an embodiment of the present application provides a communication method for vehicle diagnosis. Through the modular design of the UDS service and DoIP service included in the Ethernet protocol stack service, the functions of the DoIP service and UDS protocol stack of the vehicle diagnosis communication system are implemented, an Ethernet routing connection and a diagnostic communication session are established between the client and the server, and according to the target vehicle and diagnostic requirements, communication about diagnostic data between the server and the client in a multi-threaded environment is carried out through the diagnostic communication session, thereby improving the maintainability and scalability of vehicle diagnosis communication, and thereby improving the communication efficiency of vehicle diagnosis.
[0064] See also Figure 1 , Figure 1 This is a flow chart of a vehicle diagnosis communication method provided by an embodiment of the present application. Figure 1 As shown in, the vehicle diagnosis communication method provided in the embodiment of the present application is generally applied to a vehicle diagnosis communication system; wherein the vehicle diagnosis communication system includes a client provided in an external diagnostic device and a server provided in a target vehicle, and the communication method includes:
[0065] S101. The client obtains the vehicle information of the target vehicle by using the Ethernet protocol stack service to discover the target vehicle and establish an Ethernet routing connection with the server in the target vehicle; wherein the Ethernet protocol stack service includes UDS service and DoIP service.
[0066] It should be noted that the UDS (UDS, Unified Diagnostic Services) service represents the unified diagnostic service protocol. The UDS protocol is an application layer protocol defined by the ISO-14229 standard. It provides a basic framework for vehicle diagnosis and defines a common diagnostic data format, diagnostic process and a series of diagnostic services. As an application layer protocol, the UDS service can be implemented based on different transmission methods, and the transmission data format must comply with the UDS protocol specification.
[0067] The DoIP (Diagnostics over Internet Protocol) service represents an Ethernet-based on-board diagnostic communication protocol. The DoIP protocol is a diagnostic communication protocol defined under the ISO-13400 standard. It carries the UDS diagnostic service over Ethernet. Compared with vehicle diagnosis based on CAN communication, the DoIP service has a higher transmission rate and better scalability.
[0068] In response to the problem that the diagnostic method of diagnostic communication based on CAN communication protocol in the prior art is relatively limited, an embodiment of the present application provides a communication method for vehicle diagnosis, based on Ethernet protocol stack services including UDS service and DoIP service; wherein, DoIP service, as a middleware for vehicle diagnostic communication, ensures that the application layer protocol of UDS service remains unchanged while realizing the migration of diagnostic functions to Ethernet, and ensures the portability of vehicle diagnosis of UDS service on different vehicle networks.
[0069] In an embodiment of the present application, the Ethernet protocol stack service is typically integrated and deployed in the electronic devices of the vehicle as a software basic module to implement diagnostic functions including reading version numbers, fault detection, firmware flashing, and offline detection. In addition, the Ethernet protocol stack service is designed with reference to the OSI seven-layer network model.
[0070] Here, the client and the server are respectively configured with functional modules for implementing Ethernet protocol stack services, that is, the client is configured with a client UDS service module and a client DoIP service module; the server is configured with a server UDS service module and a server DoIP service module.
[0071] In an embodiment of the present application, the Ethernet routing connection refers to establishing a TCP communication connection included in the DoIP service, associating the logical address of the client with the socket information of the server, and setting an online monitoring mechanism corresponding to the client and a communication security policy corresponding to the server.
[0072] Here, the DoIP service includes but is not limited to UDP communication service and TCP communication service.
[0073] In one implementation of the present application, during specific implementation, step S101 may include:
[0074] S1011. The client obtains the vehicle information of the target vehicle by using the UDP communication included in the DoIP service to discover the target vehicle, and sets an online monitoring mechanism corresponding to the client.
[0075] In this step, after the target vehicle establishes a physical connection with the client and configures relevant network parameters, first, the client uses the UDP communication included in the DoIP service to obtain the vehicle information of the target vehicle by broadcasting information.
[0076] Here, the vehicle discovery request is sent through the "end_vehicle_identify_request" class of the DoIP service module of the client.
[0077] The vehicle information may include but is not limited to control system parameters, server information, the maximum number of parallel diagnostic instrument connections supported, the maximum acceptable diagnostic message length, and the power status of the current node (i.e., whether all components are powered on).
[0078] It should be noted that the diagnostic communication of the DoIP service establishes a TCP communication connection. Since the establishment of socket information (socket) consumes memory resources, the DoIP service cannot create connections indefinitely. It needs to be based on the maximum number of clients that can be connected in parallel on the target vehicle's server side. Once the number of clients connected in parallel reaches the upper limit, new TCP communication connections cannot be established.
[0079] In an embodiment of the present application, in order to avoid the communication channel being invalidly occupied, the online monitoring mechanism corresponding to the client is utilized, and the node of the DoIP service will send a client online monitoring request to the channel of the existing TCP communication connection. If there is a connection but the response message from the client cannot be received, the connection will be reset to wait for a new client to access.
[0080] S1012. In response to discovering the target vehicle, the client activates the TCP communication included in the DoIP service to establish a TCP communication connection with the client, and sends a routing activation request signal to the server in the target vehicle through the TCP communication connection.
[0081] In an embodiment of the present application, the TCP communication included in the DoIP service is activated, a TCP communication connection is established with the client, and a routing activation request signal is sent to the server in the target vehicle through the TCP communication connection (the "send_routing_active_request" class of the client's DoIP service module).
[0082] S1013. In response to receiving the routing activation request signal, the server associates the logical address of the client with the socket information of the server, and sets the corresponding communication security policy of the server to establish an Ethernet routing connection between the client and the server.
[0083] In this step, after establishing the TCP communication connection, the server enters the initialization completed state and waits for the routing activation request signal sent from the client; in response to receiving the routing activation request signal, the server changes the state of the entity of the Doip service to registered, and associates the logical address of the client with the socket information of the server to establish an Ethernet routing connection between the client and the server.
[0084] Furthermore, the server needs to set the corresponding communication security policy of the server when activating the route; the communication security policy includes DoIP node synchronization policy, route activation security authentication policy, DoIP edge node transparent transmission policy and TLS security transmission policy.
[0085] In the DoIP node synchronization strategy, GID (Group ID) is the group identifier of a group of DoIP nodes on the target vehicle. VIN (Vehicle Identification Number) can also be used to identify all DoIP nodes on a vehicle, which can play the same role as GID. However, sometimes VIN may not have been written into the DoIP node. For example, during testing or before offline calibration, GID is needed to identify a group of DoIP nodes on the vehicle.
[0086] However, when the DoIP node is first configured on the vehicle, the GID has not been synchronized. Most DoIP nodes on the vehicle must first synchronize the GID before communicating. The GID synchronization is initiated by the edge node to ensure that all nodes on the vehicle store the same GID. Among them, the GID is usually 6 bytes, and the MAC address of the DoIP edge node is usually used as the GID of all nodes.
[0087] In the routing activation security authentication strategy, since the "routing activation" in the DoIP service protocol is different from the "routing" of the traditional gateway, it refers to the message transmission between the external diagnostic device and the diagnosed node. After the service end of the target vehicle establishes a communication connection with the external diagnostic device (client), the routing activation request signal sent needs to be verified by the DoIP node to ensure its legitimacy.
[0088] In addition, the routing activation security authentication strategy also includes the security authentication of the DoIP node to the external diagnostic device (client), and through a preset security authentication algorithm, it prevents illegal external diagnostic devices from accessing the server in the target vehicle.
[0089] In the DoIP edge node transparent transmission strategy, it is necessary to control the DoIP edge node for transparent transmission or non-transparent transmission through a configuration file. The in-vehicle Ethernet is divided into an in-vehicle network and an external network. In the in-vehicle network, the node that is directly physically connected to the external diagnostic device (client) is called a DoIP edge node. The DoIP edge node can be used as a network switch to form the in-vehicle network and the external network into the same subnet. The DoIP edge node can also be used as a gateway to securely isolate the in-vehicle network from the external network and shield illegal network access and network attacks.
[0090] In addition to the DoIP edge node, there is another type of gateway, namely, the DoIP gateway node inside the car. The DoIP gateway node inside the car is used to realize the message routing from Ethernet to other network buses (for example, CAN, LIN), and realize the compatibility of DoIP communication diagnosis with traditional network buses, so that multiple network buses converge to the DoIP gateway, reducing the complexity of wiring and improving the diagnostic efficiency of the server in each bus network.
[0091] Here, since the DoIP edge node serves as a hub between the in-vehicle network and the external network, the transparent transmission or non-transparent transmission strategy of the DoIP edge node can be determined according to the application scenario of the DoIP edge node.
[0092] Exemplarily, the external diagnostic device (client) is mainly used for fault diagnosis and ECU flashing of multiple vehicles. However, in order to achieve fast ECU access and online monitoring, each ECU in the vehicle is required to have a unique IP address, and the DoIP edge node transparent transmission strategy is used; if the external diagnostic device is connected to a control unit with networking function such as TBOX, in order to protect the in-vehicle network from external network attacks, the DoIP edge node non-transparent transmission strategy is used.
[0093] In the TLS secure transmission strategy, since data packets may be intercepted and tampered by others when transmitting data based on the TCP communication protocol, there are information security issues. Therefore, the TLS protocol is added to the DOIP service protocol. The TLS protocol can prevent data leakage and tampering by negotiating keys and encrypting application data, and perform identity authentication through a certificate mechanism to prevent third parties from forging communication nodes.
[0094] Among them, TLS secure transmission strategy may include TLS Record Protocol and TLS Handshake Protocol. TLS Handshake Protocol may include Handshake Protocol, Cipher Specification Change Protocol, Warning Protocol and Application Data Protocol, etc. TLS Handshake Protocol is responsible for negotiating cryptographic algorithms and shared keys between the client and the server, including certificate authentication operations; TLS Record Protocol is responsible for message compression, encryption and data authentication.
[0095] S102: In response to the Ethernet routing connection being established, the server establishes a diagnostic communication session with the client based on the Ethernet protocol stack service.
[0096] In the embodiment of the present application, the server uses the "uds_server_manager" class as the central class of the UDP service module, which is responsible for implementing the logical processing, channel management, session management and other functions of the uds service; the session management of the uds service and the data processing of each uds service are implemented through the "uds_session" class.
[0097] In one implementation of the present application, during specific implementation, step S102 may include:
[0098] S1021. In response to the Ethernet routing connection being established, the server uses the UDS service to establish a data transmission channel with the client.
[0099] In this step, when the Ethernet routing connection is successfully established, the server calls the interface of the "doip_server" class of the DoIP service module through the UDS service to establish a data transmission channel.
[0100] S1022: In response to the data transmission channel being established, start a UDS session management service using the UDS service, and read a configuration file corresponding to the diagnostic communication session from a preset configuration file library.
[0101] In this step, when the data transmission channel is established, the server starts the UDS session management service through the "uds_session" class of the UDS service module and processes the data of the UDS service; then, the configuration file corresponding to the diagnostic communication session is read and parsed in the preset configuration file library through the call of the "configuration" class.
[0102] In an embodiment of the present application, both the client and the server are provided with a configuration management module, which is used to manage all configuration parameters and configuration files, such as parameters such as address, GID and EID, as well as configurations of services such as logs, TLS, DoIP and UDS, and provides a unified configuration access interface and tool support for the Ethernet protocol stack and related services by encapsulating the parsing and management logic of configuration items.
[0103] Among them, the configuration management module supports functions such as log configuration, TLS configuration, DoIP service configuration and UDS service configuration.
[0104] S1023: Based on the data transmission channel, the UDS session management service and the configuration file, establish a diagnostic communication session with the client using the DoIP service.
[0105] In this step, based on the data transmission channel, UDS session management service and configuration file, the DoIP service module is used to establish a diagnostic communication session between the server and the client, so as to perform communication transmission of vehicle diagnostic data in the diagnostic communication session.
[0106] Here, the session class of the UDS service completes the data exchange of diagnostic request messages and responses between the server and the client.
[0107] S103. In response to the diagnostic communication session being established, the client determines a diagnostic request message for requesting to obtain diagnostic data of the target vehicle based on the vehicle information and externally input diagnostic requirement information for the target vehicle, and sends the diagnostic request message to the server through the diagnostic communication session.
[0108] In an embodiment of the present application, both the client and the server are provided with a message processing module, which is responsible for parsing and constructing messages or data transmitted through the diagnostic communication session, including serialization and deserialization of message headers and message bodies.
[0109] Exemplarily, in a message processing module, the core classes of message processing may include a "doip_message_header" class and a "doip_message_payload" class; wherein the "doip_message_header" class is used to process the message or data header (for example, message length, protocol version), and the "doip_message_payload" class is used to store sequence information of data content.
[0110] Furthermore, the virtual base classes in the message processing module ("serializable" class and "deserializable" class) can provide general serialization and deserialization interfaces; the "doip_header_processor" class is a class used to process message header information, and provides underlying support through the "doip_message_header" class; the "command" class is the general base class of DoIP messages, and supports calling its interface to implement message parsing and processing.
[0111] In one implementation of the present application, during specific implementation, step S103 may include:
[0112] S1031 . In response to the diagnostic communication session being established, the client uses the callback function and external interface set by the UDS service to obtain externally input diagnostic requirement information for the target vehicle.
[0113] In an embodiment of the present application, the "uds_client" class of the UDS service module of the client mainly provides interfaces such as starting and stopping the client and registering callback functions; the external interface provides a unified interface for external calls, including initializing, starting, stopping DoIP and UDS services, configuring service parameters, and registering callback functions.
[0114] S1032: Based on the vehicle information and the diagnostic requirement information, determine, using the UDS service, a diagnostic request message for requesting to obtain diagnostic data of the target vehicle.
[0115] In this step, the client uses the UDS service to integrate the vehicle information of the target vehicle and the externally input diagnostic requirement information into a diagnostic request message for requesting to obtain the diagnostic data of the target vehicle.
[0116] S1033: Packaging the diagnosis request message using the DoIP service, and sending the packaged diagnosis request message to the server through the diagnostic communication session.
[0117] In an embodiment of the present application, the client and the server are both provided with an EndPoint module under the DoIP service module, which is used to establish and use UDP communication and TCP communication, and manage the connection establishment and connection status of UDP communication and TCP communication. The EndPoint module serves as a window for data sending and interface, receiving data sent from the other end or performing data sending tasks.
[0118] Here, the diagnostic communication session is based on the EndPoint module under the DoIP service module to perform data communication regarding UDP communication and TCP communication.
[0119] In this way, after the client sends a diagnostic request message to the server, the server will complete the processing and return a response message. Specifically, first, it determines whether the response is a positive response. If it is a positive response, the positive response class is called to parse the message; then, the client's callback function is called; finally, the parsed data is given to the callback function for processing.
[0120] S104: In response to receiving the diagnostic request message, the server obtains diagnostic data of the target vehicle, and sends the diagnostic data to the client through the diagnostic communication session, so that the client obtains the diagnostic data of the target vehicle.
[0121] In one implementation of the present application, during specific implementation, step S104 may include:
[0122] S1041. In response to receiving the diagnosis request message, the server uses the DoIP service to unpack the diagnosis request message, and uses the UDS service to obtain the diagnosis data of the target vehicle collected by the diagnosis tool.
[0123] In an embodiment of the present application, the method of obtaining the diagnostic data of the target vehicle can be determined according to actual diagnostic requirements and vehicle information. The diagnostic data can be obtained directly from a database, or the target vehicle can be diagnosed using a diagnostic tool inside the vehicle in response to receiving a diagnostic request message, and the diagnostic data collected by the diagnostic tool can be obtained.
[0124] S1042: Packaging the diagnostic data using the DoIP service, and sending the packaged diagnostic data to the client through the diagnostic communication session, so that the client obtains the diagnostic data of the target vehicle.
[0125] The vehicle diagnosis communication method provided in the embodiment of the present application realizes the functions of the DoIP service and UDS protocol stack of the vehicle diagnosis communication system through the modular design of the UDS service and DoIP service included in the Ethernet protocol stack service, establishes an Ethernet routing connection and a diagnostic communication session between the client and the server, and communicates about diagnostic data between the server and the client in a multi-threaded environment through the diagnostic communication session according to the target vehicle and diagnostic requirements, thereby improving the maintainability and scalability of vehicle diagnosis communication, and further improving the communication efficiency of vehicle diagnosis.
[0126] See also Figure 2 , Figure 2 This is a schematic diagram of the structure of a vehicle diagnosis communication system provided by an embodiment of the present application. Figure 2 As shown in , the communication system 20 includes:
[0127] The client 210 is used to obtain vehicle information of a target vehicle by using an Ethernet protocol stack service to discover the target vehicle and establish an Ethernet routing connection with a server in the target vehicle; wherein the Ethernet protocol stack service includes a UDS service and a DoIP service; in response to a diagnostic communication session being established, based on the vehicle information and externally input diagnostic requirement information for the target vehicle, determine a diagnostic request message for requesting to obtain diagnostic data of the target vehicle, and send the diagnostic request message to the server through the diagnostic communication session;
[0128] The server 220 is used to establish a diagnostic communication session with the client based on the Ethernet protocol stack service in response to the Ethernet routing connection being established; in response to receiving a diagnostic request message, obtain the diagnostic data of the target vehicle, and send the diagnostic data to the client through the diagnostic communication session, so that the client obtains the diagnostic data of the target vehicle.
[0129] For further information, see Figure 3 , Figure 3 This is a schematic diagram of the structure of a client provided in an embodiment of the present application. Figure 3 As shown in , the client 210 includes:
[0130] The routing connection module 211 is used to obtain the vehicle information of the target vehicle by using the Ethernet protocol stack service to find the target vehicle and establish an Ethernet routing connection with the server in the target vehicle; wherein the Ethernet protocol stack service includes UDS service and DoIP service;
[0131] The diagnostic request module 212 is used to determine, in response to a diagnostic communication session being established, a diagnostic request message for requesting to obtain diagnostic data of the target vehicle based on the vehicle information and externally input diagnostic requirement information for the target vehicle, and send the diagnostic request message to the server through the diagnostic communication session.
[0132] Further, when the routing connection module 211 is used to obtain the vehicle information of the target vehicle by using the Ethernet protocol stack service to discover the target vehicle and establish an Ethernet routing connection with the server in the target vehicle, the routing connection module 211 is used to:
[0133] Utilize the UDP communication included in the DoIP service to obtain the vehicle information of the target vehicle to discover the target vehicle, and set the online monitoring mechanism corresponding to the client;
[0134] In response to discovering the target vehicle, activating the TCP communication included in the DoIP service to establish a TCP communication connection with the client, and sending a routing activation request signal to the server in the target vehicle through the TCP communication connection;
[0135] In response to receiving the routing activation request signal, the server associates the logical address of the client with the socket information of the server, and sets the corresponding communication security policy of the server to establish an Ethernet routing connection between the client and the server.
[0136] Further, when the diagnostic request module 212 is used to determine a diagnostic request message for requesting to obtain diagnostic data of the target vehicle based on the vehicle information and externally input diagnostic requirement information for the target vehicle in response to the diagnostic communication session being established, and send the diagnostic request message to the server through the diagnostic communication session, the diagnostic request module 212 is used to:
[0137] In response to the diagnostic communication session being established, obtaining externally input diagnostic requirement information for the target vehicle using the callback function and external interface set by the UDS service;
[0138] Based on the vehicle information and the diagnostic requirement information, using the UDS service to determine a diagnostic request message for requesting to obtain diagnostic data of the target vehicle;
[0139] The DoIP service is used to package the diagnostic request message, and the packaged diagnostic request message is sent to the service end through the diagnostic communication session.
[0140] For further information, see Figure 4 , Figure 4 This is a schematic diagram of the structure of a server provided in an embodiment of the present application. Figure 4 As shown in , the server 220 includes:
[0141] The communication session module 221 is used for establishing a diagnostic communication session with the client based on the Ethernet protocol stack service in response to the Ethernet routing connection being established;
[0142] The diagnostic data module 222 is used to obtain the diagnostic data of the target vehicle in response to receiving the diagnostic request message, and send the diagnostic data to the client through the diagnostic communication session, so that the client obtains the diagnostic data of the target vehicle.
[0143] Further, when the communication session module 221 is used to establish a diagnostic communication session with the client based on the Ethernet protocol stack service in response to the Ethernet routing connection being established, the communication session module 221 is used to:
[0144] In response to the Ethernet routing connection being established, establishing a data transmission channel with the client using the UDS service;
[0145] In response to the data transmission channel being established, starting a UDS session management service using the UDS service, and reading a configuration file corresponding to the diagnostic communication session from a preset configuration file library;
[0146] Based on the data transmission channel, the UDS session management service and the configuration file, a diagnostic communication session is established with the client using the DoIP service.
[0147] Further, when the diagnostic data module 222 is used to obtain the diagnostic data of the target vehicle in response to receiving the diagnostic request message, and send the diagnostic data to the client through the diagnostic communication session so that the client obtains the diagnostic data of the target vehicle, the diagnostic data module 222 is used to:
[0148] In response to receiving the diagnostic request message, unpacking the diagnostic request message using the DoIP service, and acquiring diagnostic data of the target vehicle collected by the diagnostic tool using the UDS service;
[0149] The diagnostic data is packaged using the DoIP service, and the packaged diagnostic data is sent to the client through the diagnostic communication session, so that the client obtains the diagnostic data of the target vehicle.
[0150] The vehicle diagnosis communication system provided in the embodiment of the present application realizes the functions of the DoIP service and UDS protocol stack of the vehicle diagnosis communication system through the modular design of the UDS service and DoIP service included in the Ethernet protocol stack service, establishes an Ethernet routing connection and a diagnostic communication session between the client and the server, and communicates about diagnostic data between the server and the client in a multi-threaded environment through the diagnostic communication session according to the target vehicle and diagnostic requirements, thereby improving the maintainability and scalability of vehicle diagnosis communication, and further improving the communication efficiency of vehicle diagnosis.
[0151] See also Figure 5 , Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 5 As shown in , the electronic device 500 includes a processor 510 , a memory 520 and a bus 530 .
[0152] The memory 520 stores machine-readable instructions executable by the processor 510. When the electronic device 500 is running, the processor 510 communicates with the memory 520 via the bus 530. When the machine-readable instructions are executed by the processor 510, the above-mentioned Figure 1 The specific implementation of the steps of the vehicle diagnosis communication method in the method embodiment shown can be found in the method embodiment, and will not be repeated here.
[0153] The present application also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the computer program can execute the above-mentioned Figure 1 The specific implementation of the steps of the vehicle diagnosis communication method in the method embodiment shown can be found in the method embodiment, and will not be repeated here.
[0154] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0155] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, 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 communication interfaces, and the indirect coupling or communication connection of devices or units can be electrical, mechanical or other forms.
[0156] 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.
[0157] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0158] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present application can essentially be embodied in the form of a software product, or in other words, the part that contributes to the prior art or the part of the technical solution. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0159] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present application, which are used to illustrate the technical solutions of the present application, rather than to limit them. The protection scope of the present application is not limited thereto. Although the present application is described in detail with reference to the above-mentioned embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-mentioned embodiments within the technical scope disclosed in the present application, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.
Claims
1. A communication method for vehicle diagnosis, characterized in that: The communication method is applied to a communication system for vehicle diagnosis; wherein the communication system for vehicle diagnosis includes a client provided in an external diagnostic device and a server provided in a target vehicle, and the communication method includes: The client uses the Ethernet protocol stack service to obtain the vehicle information of the target vehicle to discover the target vehicle and establish an Ethernet routing connection with the server in the target vehicle; wherein the Ethernet protocol stack service includes UDS service and DoIP service; In response to the Ethernet routing connection being established, the server establishes a diagnostic communication session with the client based on the Ethernet protocol stack service; In response to the diagnostic communication session being established, the client determines, based on the vehicle information and externally input diagnostic requirement information for the target vehicle, a diagnostic request message for requesting to obtain diagnostic data of the target vehicle, and sends the diagnostic request message to the server through the diagnostic communication session; In response to receiving the diagnostic request message, the server obtains the diagnostic data of the target vehicle and sends the diagnostic data to the client through the diagnostic communication session, so that the client obtains the diagnostic data of the target vehicle.
2. The method according to claim 1, characterized in that The client uses the Ethernet protocol stack service to obtain the vehicle information of the target vehicle to discover the target vehicle and establish an Ethernet routing connection with the server in the target vehicle, including: The client obtains the vehicle information of the target vehicle by using the UDP communication included in the DoIP service to discover the target vehicle, and sets an online monitoring mechanism corresponding to the client; In response to discovering the target vehicle, the client activates the TCP communication included in the DoIP service to establish a TCP communication connection with the client, and sends a routing activation request signal to the server in the target vehicle through the TCP communication connection; In response to receiving the routing activation request signal, the server associates the logical address of the client with the socket information of the server, and sets the corresponding communication security policy of the server to establish an Ethernet routing connection between the client and the server.
3. The method according to claim 2, characterized in that The communication security strategy includes DoIP node synchronization strategy, routing activation security authentication strategy, DoIP edge node transparent transmission strategy and TLS security transmission strategy.
4. The method according to claim 1, characterized in that: In response to the Ethernet routing connection being established, the server establishes a diagnostic communication session with the client based on the Ethernet protocol stack service, including: In response to the Ethernet routing connection being established, the server uses the UDS service to establish a data transmission channel with the client; In response to the data transmission channel being established, starting a UDS session management service using the UDS service, and reading a configuration file corresponding to the diagnostic communication session from a preset configuration file library; Based on the data transmission channel, the UDS session management service and the configuration file, a diagnostic communication session is established with the client using the DoIP service.
5. The method according to claim 1, characterized in that: The client determines, in response to the diagnostic communication session being established, a diagnostic request message for requesting to obtain diagnostic data of the target vehicle based on the vehicle information and externally input diagnostic requirement information for the target vehicle, and sends the diagnostic request message to the server through the diagnostic communication session, including: In response to the diagnostic communication session being established, the client uses the callback function and external interface set by the UDS service to obtain external input diagnostic requirement information for the target vehicle; Based on the vehicle information and the diagnostic requirement information, using the UDS service to determine a diagnostic request message for requesting to obtain diagnostic data of the target vehicle; The DoIP service is used to package the diagnostic request message, and the packaged diagnostic request message is sent to the service end through the diagnostic communication session.
6. The method according to claim 1, characterized in that The server obtains the diagnostic data of the target vehicle in response to receiving the diagnostic request message, and sends the diagnostic data to the client through the diagnostic communication session, so that the client obtains the diagnostic data of the target vehicle, including: In response to receiving the diagnostic request message, the server uses the DoIP service to unpack the diagnostic request message, and uses the UDS service to obtain the diagnostic data of the target vehicle collected by the diagnostic tool; The diagnostic data is packaged using the DoIP service, and the packaged diagnostic data is sent to the client through the diagnostic communication session, so that the client obtains the diagnostic data of the target vehicle.
7. A vehicle diagnostic communication system, characterized in that: The communication system comprises: A client, used to obtain vehicle information of a target vehicle by using an Ethernet protocol stack service to discover the target vehicle and establish an Ethernet routing connection with a server in the target vehicle; wherein the Ethernet protocol stack service includes a UDS service and a DoIP service; in response to a diagnostic communication session being established, based on the vehicle information and externally input diagnostic requirement information for the target vehicle, determine a diagnostic request message for requesting to obtain diagnostic data of the target vehicle, and send the diagnostic request message to the server through the diagnostic communication session; The server is used to establish a diagnostic communication session with the client based on the Ethernet protocol stack service in response to the Ethernet routing connection being established; obtain the diagnostic data of the target vehicle in response to receiving a diagnostic request message, and send the diagnostic data to the client through the diagnostic communication session, so that the client obtains the diagnostic data of the target vehicle.
8. The system according to claim 7, characterized in that The client comprises: A routing connection module, used to obtain vehicle information of a target vehicle by using an Ethernet protocol stack service to discover the target vehicle and establish an Ethernet routing connection with a service end in the target vehicle; wherein the Ethernet protocol stack service includes a UDS service and a DoIP service; A diagnostic request module is used to determine, in response to a diagnostic communication session being established, a diagnostic request message for requesting to obtain diagnostic data of the target vehicle based on the vehicle information and externally input diagnostic requirement information for the target vehicle, and send the diagnostic request message to the service end through the diagnostic communication session.
9. The system according to claim 7, characterized in that The server includes: a communication session module, configured to establish a diagnostic communication session with the client based on the Ethernet protocol stack service in response to the Ethernet routing connection being established; The diagnostic data module is used to obtain the diagnostic data of the target vehicle in response to receiving the diagnostic request message, and send the diagnostic data to the client through the diagnostic communication session, so that the client obtains the diagnostic data of the target vehicle.
10. An electronic device, characterized in that: include: A processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor and the memory communicate via the bus, and the machine-readable instructions are executed by the processor to execute the steps of the vehicle diagnosis communication method as described in any one of claims 1 to 6.
Citation Information
Cited By
Vehicle maintenance method and system
CN121193794A