Transmission method and system of communication data in vehicle domain, storage medium and electronic equipment

By establishing a dynamic library for vehicle domain communication using shared memory and event-driven processing, the inefficiencies of existing SOME/IP protocol stacks are addressed, resulting in improved communication efficiency and resource utilization.

CN120321313APending Publication Date: 2025-07-15ECARX (HUBEI) TECHCO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510536987.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-27
Publication Date
2025-07-15

AI Technical Summary

Technical Problem

The existing SOME/IP protocol stack has problems such as low communication efficiency and high resource utilization in vehicle domain communication, especially in the UDS mode, the performance degradation caused by four copies, while the lack of notification mechanism in the SHM mode leads to increased CPU load and increased system complexity.

Method used

By establishing a dynamic library between the application and the protocol stack background program, combining the shared memory area for data transmission, the dynamic library responds quickly to events and reduces data copying, and the shared memory enables rapid storage and reading. The dynamic library includes connection modules, storage modules and thread pool modules to optimize communication.

Benefits of technology

It improves the efficiency and resource utilization of vehicle domain communication, reduces system resource consumption, and improves system performance and reliability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120321313A_ABST
    Figure CN120321313A_ABST
Patent Text Reader

Abstract

The invention discloses a vehicle intra-domain communication data transmission method and system, a storage medium and electronic equipment, and the transmission method comprises the steps that a dynamic library receives request information sent by an application program and sends the request information to a protocol stack background program, and intra-domain communication connection is established; identifying a socket event according to a socket of the communication connection; receiving communication data sent by the application program and the protocol stack background program, and storing the communication data in the shared memory area; reading corresponding communication data from the shared memory area according to the socket event, and sending the communication data to an application program and / or a protocol stack background program; the dynamic library can quickly respond to various events and process request information from different application programs in time, and the shared memory can realize quick storage and reading of data, so that frequent data copying and transmission are avoided, and the communication efficiency is greatly improved. The combination mode can give full play to the event-driven characteristic of the dynamic library and the high-speed data sharing advantage of the shared memory.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of in-vehicle communication, and particularly to a method, system, storage medium, and electronic device for transmitting in-vehicle communication data. Background Art

[0002] With the rapid development of the automotive industry, the traditional automotive electronic and electrical architecture can no longer meet the requirements of modern vehicles for intelligence, networking, and autonomous driving. As a modular design approach, the Service-Oriented Architecture (SOA) greatly improves the scalability and maintainability of the system by decomposing complex systems into independent service modules. To achieve efficient communication of SOA in automotive electronic systems, the SOME / IP protocol (Scalable service-Oriented MiddlewarE over IP) is widely used in various in-vehicle domain controllers. With the SOME / IP protocol, each service module can perform efficient data exchange and collaborative work in a distributed environment, thereby realizing the intelligence and networking of automotive electronic systems. The SOME / IP protocol is essentially an IP-based middleware protocol that provides an efficient and reliable service discovery and communication mechanism. The ultimate users are various applications within each System on Chip (SOC). The general design of the SOME / IP protocol stack is to have a daemon process within the SOC. This daemon process is used to serialize the data sent by each application, load it into the SOME / IP protocol packet, and send it to the Ethernet. At the same time, it also forwards the SOME / IP protocol packets sent on the Ethernet to each application within the SOC that needs the data. Thus, the SOME / IP protocol stack, as a data transfer station, is divided into two parts. One part is the communication with the Ethernet outside the SOC domain, and the other part is the communication with the applications within the SOC domain. There are mainly two channels provided by the existing SOME / IP protocol stack for application IPC (inter-project communication). One is IPC based on the UDS (unix domain socket) method, and the other is IPC based on the SHM (shared memory) method.

[0003] If IPC based on the UDS method is adopted, then during data transmission, four copies will occur. Specifically, these four copies include from the application program buffer to the kernel buffer, data transmission within the kernel space, from the kernel buffer to the kernel buffer of the receiving party, and finally from the kernel buffer of the receiving party to the application program buffer of the receiving party. Each copy consumes system resources, increases the latency and overhead of data transmission, and causes a significant decline in the performance of IPC.

[0004] If IPC using the SHM method is adopted, the communication efficiency will be improved. However, due to the lack of a notification mechanism, there are obvious limitations in IPC using the SHM method. To obtain the data changes in the shared memory in a timely manner, a separate thread is required to specifically poll the shared memory. In this polling operation, the thread needs to continuously check the status of the shared memory, which will not only cause a significant increase in CPU load, but also result in an increase in the number of threads, thereby increasing the complexity and management cost of the system. In a high-concurrency or resource-constrained environment, these problems may be more prominent, affecting the performance and stability of the entire system. Summary of the Invention

[0005] The purpose of the present invention is to solve the deficiencies existing in the prior art, and a method, system, storage medium and electronic device for transmitting communication data within a vehicle domain are proposed.

[0006] To achieve the above object, the present invention adopts the following technical solution: A method for transmitting communication data within a vehicle domain, a dynamic library is established between an application program and a protocol stack background program, a communication connection is established through the dynamic library, and the communication data of the application program and / or the protocol stack background program is saved and applied to the dynamic library. The transmission method includes:

[0007] Receiving the request information sent by the application program and sending it to the protocol stack background program to establish an in-domain communication connection;

[0008] Identifying socket events according to the socket of the communication connection;

[0009] Receiving the communication data sent by the application program and the protocol stack background program and saving it in the shared memory area, where the shared memory area is used to save and be called to send communication data;

[0010] Reading the corresponding communication data from the shared memory area according to the socket event and sending it to the application program and / or the protocol stack background program.

[0011] As a further description of the above technical solution: The method by which the dynamic library receives the request information sent by the application program and sends it to the protocol stack background program includes:

[0012] Receiving the connection socket and request information created by the application program;

[0013] Receiving the listening socket created by the protocol stack background program according to the request information;

[0014] Sending the request information to the protocol stack background program through the listening socket and the connection socket for in-domain communication connection.

[0015] As a further description of the above technical solution: The method for the dynamic library to identify socket events based on the communication-connected socket includes:

[0016] Create an interface, register the socket corresponding to the communication connection into the interface, and the interface listens according to the socket to determine whether a socket event occurs;

[0017] If there is, read the corresponding communication data according to the socket event;

[0018] If not, set a timeout period within the interface for super blocking waiting.

[0019] As a further description of the above technical solution: The method for the dynamic library to read corresponding communication data from the shared memory area according to the socket event includes:

[0020] Receive a callback message, where the callback message is set by the application program and / or the protocol stack background program according to the communication-connected socket;

[0021] Call the communication data saved in the shared memory area according to the callback message;

[0022] Read the called communication data according to the socket event, and send the read communication data to the application program and / or the protocol stack background program through the interface.

[0023] As a further description of the above technical solution: When the application program and the protocol stack background program establish a communication connection, set a reconnection configuration time. If the communication connection is disconnected, re-establish the communication connection within the configuration time.

[0024] There is also a method for transmitting communication data within a vehicle domain, which is applied to an application program and includes:

[0025] Send a request message to the dynamic library, which is sent by the dynamic library to the protocol stack background program, and receive the socket returned by the protocol stack background program to establish a communication connection;

[0026] Send the communication data to the dynamic library, which stores or calls the communication data, and reads the called communication data according to the socket event of the protocol stack background program and sends it to the protocol stack background program;

[0027] Send the socket event to the dynamic library to enable the dynamic library to read the called communication data according to the socket event;

[0028] Receive the communication data sent by the dynamic library, where the communication data is the communication data sent by the protocol stack background program to be stored in the dynamic library.

[0029] It also includes a transmission system for communication data within a vehicle domain, comprising:

[0030] An application program that sends request information and a socket, establishes a communication connection with the protocol stack background program, and receives communication data sent by the protocol stack background program;

[0031] A protocol stack background program that receives request information, sends a socket, establishes a communication connection with the application program, and receives communication data sent by the application program;

[0032] A dynamic library that receives request information, sockets, and communication data sent by the application program and / or the protocol stack background program; wherein, the dynamic library includes:

[0033] A connection module that is provided with a communication interface, receives sockets of the application program and the protocol stack background program to establish an in-domain communication connection, monitors socket events during communication, reads communication data according to the socket events, and sends it to the application program and / or the protocol stack background program;

[0034] A storage module that is provided with a shared memory area and receives and stores the communication data of the application program and the protocol stack background program;

[0035] A thread pool module that consists of several task threads and calls corresponding communication data from the storage module according to callback information.

[0036] As a further description of the above technical solution: The dynamic library further includes a timing module that monitors and maintains the in-domain communication connection and controls the reconnection operation between the application program and the protocol stack background program within a set time when the connection is disconnected.

[0037] It also includes a computer-readable storage medium that stores a computer program for running the transmission method, wherein the computer program causes a computer to execute the transmission method described in any one of the above technical solutions.

[0038] It also includes an electronic device, comprising:

[0039] One or more processors; a memory; and

[0040] One or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by the one or more processors, and the programs include those for executing the transmission method described in any one of the above technical solutions.

[0041] The above technical solution has the following advantages or beneficial effects:

[0042] 1. By establishing a dynamic library and combining it with shared memory, the problem of low communication efficiency and high resource utilization rate between various application programs in the SOC domain and the background program of the SOME / IP protocol stack is effectively solved. During the communication process, the dynamic library can quickly respond to various events and timely process the request information from different application programs, while the shared memory can achieve fast data storage and reading, avoiding frequent data copying and transmission, thus greatly improving the communication efficiency. This combination method can give full play to the event-driven characteristics of the dynamic library and the high-speed data sharing advantage of the shared memory.

[0043] 2. The communication data is shared in the shared memory, reducing the number of memory allocations and releases, lowering the consumption of system resources, further improving the resource utilization rate, providing more efficient and stable communication support for various application programs in the SOC domain and the background program of the SOME / IP protocol stack, and helping to improve the performance and reliability of the entire system. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the following drawings are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on these drawings.

[0045] Figure 1 It is a flowchart of the transmission method proposed by the present invention;

[0046] Figure 2 It is a flowchart of the method for the dynamic library in the present invention to receive the request information sent by the application program and send it to the background program of the protocol stack;

[0047] Figure 3 It is a flowchart of the method for the dynamic library in the present invention to identify socket events according to the socket of the communication connection;

[0048] Figure 4 It is a flowchart of the method for the dynamic library in the present invention to read the corresponding communication data from the shared memory area according to the socket event;

[0049] Figure 5 It is a schematic structural diagram of the transmission system proposed by the present invention.

[0050] LEGEND DESCRIPTION:

[0051] 1. Application program; 2. Background program of the protocol stack; 3. Dynamic library; 31. Connection module; 32. Storage module; 33. Thread pool module; 34. Timing module. DETAILED IMPLEMENTATION MANNER

[0052] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.

[0053] There are mainly two channels provided by the existing SOME / IP protocol stack for application IPC (inter-project communication). One is IPC based on the UDS (unix domain socket) method, and the other is IPC based on the SHM (shared memory) method.

[0054] If IPC based on the UDS method is adopted, then during data transmission, four copies will occur. Each copy consumes system resources, increases the latency and overhead of data transmission, and causes a significant decline in the performance of IPC.

[0055] If IPC based on the SHM method is adopted, there is a lack of a notification mechanism, and IPC based on the SHM method has obvious limitations. In order to timely obtain data changes in the shared memory, a separate thread is required to specifically poll the shared memory. In this polling operation, the thread needs to continuously check the status of the shared memory, which not only causes a significant increase in CPU load, but also increases the number of threads, thereby increasing the complexity and management cost of the system.

[0056] To solve the problems of low communication efficiency and high resource utilization rate between each application program in the SOC domain and the SOME / IP protocol stack background program, an embodiment of a method for transmitting communication data within a vehicle domain is provided in the present invention:

[0057] Refer to Figure 1 , a dynamic library is established between the application program and the protocol stack background program, a communication connection is established through the dynamic library, and the communication data of the application program and / or the protocol stack background program is saved. The dynamic library calls the corresponding communication data for mutual transmission and is applied to the dynamic library. The transmission method includes:

[0058] S1: Receive the request information sent by the application program and send it to the protocol stack background program to establish an in-domain communication connection;

[0059] S2: Identify socket events according to the socket of the communication connection;

[0060] S3: Receive the communication data sent by the application program and the protocol stack background program and save it in the shared memory area, where the shared memory area is used to save and be called for sending communication data;

[0061] S4: Read the corresponding communication data from the shared memory area according to the socket event, and send it to the application program and / or the protocol stack background program.

[0062] In this embodiment, the dynamic library receives the request information sent by the application program. After receiving the request, it needs to perform preliminary parsing and verification on the request information to ensure that its format and content meet the requirements, and forward the verified request information to the protocol stack background program. During the forwarding process, considering the reliability of network transmission, a retry mechanism is adopted. If the response from the protocol stack background program is not received within a certain time, the application program resends the request. After successfully sending the request and receiving the response from the protocol stack background program, an in-domain communication connection is established.

[0063] The dynamic library identifies socket events based on the sockets of the communication connection. Common socket events include connection establishment, data arrival, connection closure, etc. In this embodiment, connection socket events and receive socket events are set. The dynamic library needs to monitor and identify these events in real time. The I / O multiplexing mechanism provided by the operating system, such as select, poll, epoll, can be used to handle the events of multiple sockets.

[0064] The dynamic library needs to continuously listen for the communication data sent by the application program and the protocol stack background program. When receiving data, the integrity and accuracy of the data need to be considered. By setting up a shared memory area, the received data is first stored in the shared memory area. The application program and the protocol stack background program copy the data they want to send into the shared memory area and send a notification that the data has been sent through the connection socket and the receive socket; the purpose is to send the IPC data between the application program and the protocol stack background program and notify that the data has been sent. According to the identified socket event, the corresponding communication data is read from the shared memory area, and the data read from the shared memory area is accurately sent to the application program or the protocol stack background program to achieve the transmission of communication data. Further, the shared memory area is divided into multiple cache areas and stored in different areas according to the access frequency and importance of the communication data.

[0065] By establishing a dynamic library and combining it with shared memory, the problem of low communication efficiency and high resource utilization rate between various application programs and the protocol stack background program within the SOC domain is effectively solved. During the communication process, the dynamic library can quickly respond to various events and process the request information from different application programs in a timely manner, while the shared memory can achieve fast data storage and reading, avoiding frequent data copying and transmission, thus greatly improving the communication efficiency. This combination method can give full play to the event-driven characteristics of the dynamic library and the high-speed data sharing advantages of the shared memory. The communication data is shared in the shared memory, reducing the number of memory allocations and releases, reducing the consumption of system resources, further improving the resource utilization rate, providing more efficient and stable communication support for various application programs and the protocol stack background program within the SOC domain, and helping to improve the performance and reliability of the entire system.

[0066] Refer to Figure 2 , the method for the dynamic library to receive the request information sent by the application program and send it to the protocol stack background program includes:

[0067] S11: Receive the connection socket and request information created by the application program;

[0068] S12: Receive the listening socket created by the protocol stack background program according to the request information;

[0069] S13: Send the request information to the protocol stack background program through the listening socket and the connection socket for in-domain communication connection.

[0070] In this embodiment, after the dynamic library detects the startup of the application program and the protocol stack background program, it receives the connection socket (connect socket) and request information created by the application program, and receives the listening socket (listen socket) created by the protocol stack background program, and sends the request information to the protocol stack background program through the listening socket and the connection socket for in-domain communication connection.

[0071] After the dynamic library receives the socket and request information, it is necessary to check the validity of the socket and request information. For the socket, it is necessary to check whether it is in a legal state and whether it can be used for communication; for the request information, it is necessary to check whether its format, length, etc. meet the expectations to avoid subsequent communication errors caused by incorrect information. After the communication connection is successfully established, the dynamic library sends the previously stored request information to the protocol stack background program through the listening socket; if multiple application programs send requests to the dynamic library at the same time, a concurrent access problem will occur. Synchronization mechanisms such as mutexes and semaphores can be used to ensure secure access, and asynchronous I / O technology can improve the concurrent processing ability of the dynamic library and reduce the thread blocking time. For example, when waiting for the response of the protocol stack background program, asynchronous I / O functions can be used to allow the thread to process other tasks while waiting.

[0072] Refer to Figure 3 , the method for the dynamic library to identify socket events based on the socket of the communication connection includes:

[0073] S21: Create an interface, register the socket corresponding to the communication connection into the interface, and the interface listens according to the socket to determine whether there is a socket event;

[0074] S22: If there is, read the corresponding communication data according to the socket event;

[0075] S23: If not, set a timeout in the interface and perform super blocking waiting.

[0076] In this embodiment, the dynamic library needs to design an interface for registering sockets, use the I / O multiplexing mechanism provided by the operating system, such as select, poll or epoll, to listen for socket events. This embodiment uses epoll, which has better performance when dealing with a large number of sockets. When there are active sockets returned, it is necessary to traverse all registered sockets to determine which sockets have events. For the sockets with events, read the communication data called in the shared memory area.

[0077] Perform epoll_wait on the created interface. Epoll_wait is part of epoll in Linux and is used to wait for events on file descriptors registered in an epoll instance. Start a thread to listen for events on the sockets registered in the epoll instance through epoll_wait. This thread will perform super-blocking waiting according to the timeout set within epoll_wait. Set the timeout within the interface. If no socket events occur within the timeout, the dynamic library performs super-blocking waiting, and the timeout is set according to the actual application scenario and network conditions. If the timeout is set too short, it may cause frequent timeouts and affect system performance; if set too long, the program may be blocked for a long time when there are no events.

[0078] Furthermore, the protocol stack background program sets read and write events for the received sockets into epoll, and the application program sets read and write events for the successfully connected sockets into epoll. By registering the sockets into epoll, epoll helps to monitor the read and write events that occur on these sockets.

[0079] Refer to Figure 4 , the method for the dynamic library to read the corresponding communication data from the shared memory area according to the socket event includes:

[0080] S41: Receive callback information, where the callback information is set by the application program and / or the protocol stack background program according to the socket of the communication connection;

[0081] S42: Call the communication data saved in the shared memory area according to the callback information;

[0082] S43: According to the socket event, read the called communication data and send the read communication data to the application program and / or the protocol stack background program through the interface.

[0083] In this embodiment, the application program and the protocol stack background program set callback information (callback) for data reception of the received sockets. The protocol stack background program sets the received sockets. When an event occurs, it is distributed by the threads in the application program and the protocol stack background program, and the specific events executed after distribution are implemented by the callback information. The callback information is the set function to read the sent communication data. Furthermore, the dynamic library receives the callback information set by the application program and the protocol stack background program and adds it to the thread pool, and calls the communication data saved in the shared memory area according to the callback information. In this embodiment, a hybrid indexing method is adopted. Optionally, a hybrid index structure combining hash index and B-tree index is adopted to call the communication data corresponding to the callback information.

[0084] According to socket events, read the communication data of the call. The socket registered in the interface can generate three types of events, namely read, write, and error events. When a read event occurs, it means there is data readable on the socket. When a write event occurs, it means a message can be sent through the socket. The error event indicates that an error has occurred on the socket, such as the socket being abnormally closed. This embodiment is directed to the in-domain data transmission of the event type in the SOME / IP protocol. For the events of the SOME / IP protocol, a unique event is determined by three elements: service ID, event identifier, and instance ID. Therefore, the corresponding communication data read through the socket is a structure composed of service ID, event identifier, and instance ID, and the communication data corresponding to the confirmed event is sent to the application program and the protocol stack background program through the interface, informing the application program and the protocol stack background program which specific event the current transmitted IPC message is.

[0085] When the application program and the protocol stack background program establish a communication connection, set the configuration time for reconnection in case of disconnection. If the communication connection is disconnected, re-establish the communication connection within the configuration time.

[0086] In this embodiment, if the communication connection between the application program and the protocol stack background program is disconnected during initialization or operation, the connection with the protocol stack background program will be re-established within the configuration time. The configuration time can be adjusted based on the communication network status, system load, or user intervention. Specifically, when based on the communication network status, when the network status is poor, appropriately increase the disconnection reconnection time to avoid additional pressure on the network caused by frequent reconnection attempts; when the network status improves, reduce the disconnection reconnection time to enable the connection to recover faster. When based on the system load, monitor system load indicators such as the CPU usage rate and memory occupancy rate of the servers where the application program and the protocol stack background program are located. When the system load is high, extend the disconnection reconnection time to prevent the reconnection operation from consuming too many system resources and affecting the operation of normal services; when the system load is low, shorten the disconnection reconnection time to improve the speed of connection recovery.

[0087] It also includes an embodiment of a method for transmitting in-vehicle domain communication data, which is applied to an application program and includes:

[0088] Send a request message to the dynamic library, which is sent to the protocol stack background program by the dynamic library, and receive the socket returned by the protocol stack background program to establish a communication connection;

[0089] Send communication data to the dynamic library, which stores or invokes the communication data, reads the invoked communication data according to the socket event of the protocol stack background program, and sends it to the protocol stack background program;

[0090] Send the socket event to the dynamic library to enable the dynamic library to read and invoke the communication data according to the socket event;

[0091] Receive the communication data sent by the dynamic library, where the communication data is the communication data sent by the protocol stack background program and stored in the dynamic library.

[0092] In this embodiment, the application sends the request information to the dynamic library. After receiving the request, the dynamic library performs preliminary parsing and verification on the request information, forwards the verified request information to the protocol stack background program, and establishes an in-domain communication connection after successfully sending the request and receiving the response from the protocol stack background program.

[0093] Send the communication data to the shared memory area of the dynamic library for storage. The dynamic library invokes the communication data in the shared memory area according to the callback information set by the application, reads the invoked data according to the socket event of the protocol stack background program, and sends it to the protocol stack background program, sending the communication data of the application to the protocol stack background program.

[0094] The application sends the socket event to the dynamic library, enabling the dynamic library to invoke the communication data in the shared memory area sent by the protocol stack background program according to the callback information set by the protocol stack background program. The application receives the communication data read according to the socket event, enabling the application to receive the communication data sent by the protocol stack background program, and realizing the mutual transmission of communication data between the application and the protocol stack background program.

[0095] Refer to Figure 5 , and there is also an embodiment of a vehicle in-domain communication data transmission system, including:

[0096] Application 1, which sends request information and sockets, establishes a communication connection with the protocol stack background program, and receives the communication data sent by the protocol stack background program;

[0097] Protocol stack background program 2, which receives the request information, sends sockets, establishes a communication connection with the application, and receives the communication data sent by the application;

[0098] Dynamic library 3, which receives the request information, sockets, and communication data sent by the application and / or the protocol stack background program; where the dynamic library includes:

[0099] The connection module 31 is provided with a communication interface, which receives the socket of the application program and the protocol stack background program to establish an in-domain communication connection, monitors the socket events during the communication process, reads the communication data according to the socket events, and sends it to the application program and / or the protocol stack background program;

[0100] The storage module 32 sets up a shared memory area to receive and store the communication data of the application program and the protocol stack background program;

[0101] The thread pool module 33 consists of several task threads, which call the corresponding communication data from the storage module according to the callback information; according to the socket events, the number of task threads is configured according to the application program and the protocol stack background program.

[0102] In this embodiment, the communication connection between the application program 1 and the protocol stack background program 2 is realized by setting up the dynamic library 3. The dynamic library 3 receives the request information, socket and communication data from the application program 1 and the protocol stack background program 2, and stores the communication data through the storage module 32 in the dynamic library 3. The application program 1 sends the request information and the socket to establish a communication connection with the protocol stack background program 2.

[0103] The dynamic library 3 includes: the connection module 31, which is responsible for handling the UDS (unix domain socket) connection between the application program 1 and the protocol stack background program 2, configuring the communication interface, and establishing an in-domain communication connection by means of receiving the sockets of the application program and the protocol stack background program. The main component of the connection module 31 is epoll (the I / O multiplexing mechanism of the Linux operating system). The protocol stack background program 2 will create a listening socket during initialization and register the listening socket read event into epoll. The application program 1 will create a connection socket during initialization and register the read and write events into epoll. When the protocol stack background program completes the UDS connection with the application program, epoll is used as the driver to transmit the communication data between the application program 1 and the protocol stack background program 2.

[0104] The storage module 32 sets up a shared memory area, which is responsible for storing the specific IPC message data for communication data transmission between the application program 1 and the protocol stack background program 2. The shared memory area can realize data sharing between different processes. The shared memory area is divided into multiple cache areas and saved in different areas according to the access frequency and importance of the communication data to improve the data access speed.

[0105] The thread pool module 33 consists of several task threads. The thread pool module 33 receives the callback information set by the application program 1 and the protocol stack background program 2, and calls the communication data saved in the storage module 32 according to the callback information. The thread pool module 33 is mainly composed of several task threads, and the number of task threads can be generated according to the thread configurations of the application program 1 and the protocol stack background program 2.

[0106] Specifically, the dynamic library 3 further includes a timing module 34, which includes a timeout detection thread and a minimum heap, monitors and maintains the in-domain communication connection, and controls the reconnection operation between the application program and the protocol stack background program within a set time when the connection is disconnected.

[0107] In this embodiment, during the process of establishing a communication connection between the application program 1 and the protocol stack background program 2, the connection establishment time may be too long due to reasons such as network latency and high server load. The timeout detection thread can monitor the process of establishing the communication connection and perform the reconnection operation between the application program 1 and the protocol stack background program 2 within the set time. When the connection still cannot be successfully established after exceeding the set time, it notifies the relevant module for processing in a timely manner, such as attempting to reconnect or feedback the connection failure information to the user. In the timeout detection thread, using the minimum heap can more efficiently manage and process the timeout tasks. The minimum heap is a heap data structure, and the value of its root node is the smallest in the heap. The timeout communication connection tasks are stored in the minimum heap according to the set time. Each time it is checked, only the task at the top of the heap, that is, the earliest possible timeout communication connection task, needs to be checked, greatly reducing the time complexity of the check and improving the efficiency of timeout detection.

[0108] It also includes a computer-readable storage medium that stores a computer program for running the transmission method. Among them, the computer program causes the computer to execute the following steps:

[0109] S1: Receive the request information sent by the application program and send it to the protocol stack background program to establish an in-domain communication connection;

[0110] S2: Identify the socket event according to the socket of the communication connection;

[0111] S3: Receive the communication data sent by the application program and the protocol stack background program and save it in the shared memory area. Among them, the shared memory area is used to save and be called to send the communication data;

[0112] S4: Read the corresponding communication data from the shared memory area according to the socket event and send it to the application program and / or the protocol stack background program.

[0113] Among them, the computer-readable storage medium can be a computer storage medium or a communication medium. The communication medium includes any medium that facilitates the transmission of a computer program from one place to another. The computer storage medium can be any available medium that can be accessed by a general-purpose or special-purpose computer. For example, the computer-readable storage medium is coupled to the processor, so that the processor can read information from the computer-readable storage medium and write information to the computer-readable storage medium. Of course, the computer-readable storage medium can also be a component of the processor. The processor and the computer-readable storage medium can be located in an Application Specific Integrated Circuits (ASIC). In addition, the ASIC can be located in the user equipment. Of course, the processor and the computer-readable storage medium can also exist as discrete components in the communication device.

[0114] Specifically, the computer-readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as Static Random-Access Memory (SRAM), Electrically-Erasable Programmable Read-Only Memory (EEPROM), Erasable Programmable Read Only Memory (EPROM), Programmable read-only memory (PROM), Read-Only Memory (ROM), magnetic memory, flash memory, a magnetic disk or an optical disk. The storage medium can be any available medium that can be accessed by a general-purpose or special-purpose computer.

[0115] It also includes an electronic device, including:

[0116] One or more processors; a memory; and

[0117] One or more programs, where one or more programs are stored in the memory and are configured to be executed by one or more processors. The programs include steps for performing the following:

[0118] S1: Receive the request information sent by the application program and send it to the protocol stack background program to establish an in-domain communication connection;

[0119] S2: Identify the socket event according to the socket of the communication connection;

[0120] S3: Receive the communication data sent by the application and the protocol stack background program, and save it in the shared memory area, where the shared memory area is used to save and be called to send communication data;

[0121] S4: Read the corresponding communication data from the shared memory area according to the socket event, and send it to the application and / or the protocol stack background program.

[0122] A memory for storing computer programs. This memory may include high-speed random access memory (Random Access Memory, RAM), and may also include non-volatile memory (Non-Volatile Memory, NVM), such as at least one disk memory, and may also be a USB flash drive, a mobile hard disk, a read-only memory, a disk, or an optical disc, etc.

[0123] A processor for executing the computer programs stored in the memory. The processor may be a central processing unit (Central Processing Unit, CPU), or may also be other general-purpose processors, digital signal processors (Digital Signal Processor, DSP), application-specific integrated circuits (Application Specific Integrated Circuit, ASIC), etc. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The steps of the method disclosed in combination with the invention can be directly embodied as being executed and completed by a hardware processor, or executed and completed by a combination of hardware and software modules in the processor.

[0124] Optionally, the memory can be either independent or integrated with the processor.

[0125] When the memory is a device independent of the processor, the electronic device may further include a bus. This bus is used to connect the memory and the processor. The bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc.

[0126] It should be noted that through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a necessary general hardware platform. Based on such an understanding, the essence of the above technical solution or the part that contributes to the prior art can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments. In this article, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed, or further includes elements inherent to such a process, method, article or device. Without further limitation, an element defined by the statement "including a..." does not exclude the existence of additional identical elements in the process, method, article or device including the said element.

[0127] Finally, it should be noted that the above are only the preferred embodiments of the present invention and are not used to limit the present invention. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements for some of the technical features. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A method for transmitting communication data within a vehicle domain, characterized in that, A dynamic library is established between the application and the protocol stack background program. A communication connection is established through the dynamic library, and the communication data of the application and / or the protocol stack background program is saved. Applied to the dynamic library, the transmission method includes: Receiving the request information sent by the application and sending it to the protocol stack background program to establish an in-domain communication connection; Identifying socket events according to the socket of the communication connection; Receiving the communication data sent by the application and the protocol stack background program and saving it in the shared memory area, where the shared memory area is used to save and be called to send communication data; Reading the corresponding communication data from the shared memory area according to the socket event and sending it to the application and / or the protocol stack background program.

2. The transmission method according to claim 1, wherein: The method for the dynamic library to receive the request information sent by the application and send it to the protocol stack background program includes: Receiving the connection socket and request information created by the application; Receiving the listening socket created by the protocol stack background program according to the request information; Sending the request information to the protocol stack background program through the listening socket and the connection socket to establish an in-domain communication connection.

3. The transmission method according to claim 1, wherein: The method for the dynamic library to identify socket events according to the socket of the communication connection includes: Creating an interface, registering the socket corresponding to the communication connection into the interface, and the interface listens according to the socket to determine whether there is a socket event; If so, reading the corresponding communication data according to the socket event; If not, setting a timeout in the interface for super blocking waiting.

4. The transmission method according to claim 3, wherein: The method for the dynamic library to read the corresponding communication data from the shared memory area according to the socket event includes: Receiving a callback message, where the callback message is set by the application and / or the protocol stack background program according to the socket of the communication connection; Calling the communication data saved in the shared memory area according to the callback message; Reading the called communication data according to the socket event and sending the read communication data to the application and / or the protocol stack background program through the interface.

5. The transmission method according to claim 1, characterized in that: When the application and the protocol stack background program establish a communication connection, a reconnection configuration time is set. If the communication connection is disconnected, a new communication connection is established within the configuration time.

6. A method for transmitting communication data within a vehicle domain, characterized in that, Applied to the application, it includes: Sending request information to the dynamic library, which is sent by the dynamic library to the protocol stack background program, and receiving the socket returned by the protocol stack background program to establish a communication connection; Sending communication data to the dynamic library, which stores or calls the communication data, and reading the called communication data according to the socket event of the protocol stack background program and sending it to the protocol stack background program; Sending the socket event to the dynamic library to enable the dynamic library to read the called communication data according to the socket event; Receiving the communication data sent by the dynamic library, where the communication data is the communication data sent by the protocol stack background program and stored in the dynamic library.

7. A transmission system for communication data within a vehicle domain, characterized in that, It includes: An application that sends request information and a socket to establish a communication connection with a protocol stack background program and receives communication data sent by the protocol stack background program; A protocol stack background program that receives request information, sends a socket, establishes a communication connection with the application, and receives communication data sent by the application; A dynamic library that receives request information, a socket, and communication data sent by the application and / or the protocol stack background program; wherein, the dynamic library includes: A connection module that is provided with a communication interface, receives sockets of the application and the protocol stack background program to establish an in-domain communication connection, monitors socket events during communication, reads communication data according to the socket events, and sends it to the application and / or the protocol stack background program; A storage module that is provided with a shared memory area and receives and stores the communication data of the application and the protocol stack background program; A thread pool module composed of several task threads that calls corresponding communication data from the storage module according to callback information.

8. The transmission system according to claim 7, wherein: The dynamic library further includes a timing module that monitors and maintains the in-domain communication connection and controls the reconnection operation between the application and the protocol stack background program within a set time when the connection is disconnected.

9. A computer-readable storage medium, characterized in that, It stores a computer program for running a transmission method, wherein the computer program causes a computer to execute the transmission method according to any one of claims 1-6.

10. An electronic device, characterized in that, It includes: One or more processors; A memory; And One or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by the one or more processors, and the programs include those for executing the transmission method according to any one of claims 1-6.

Citation Information

Cited By

  • Data transmission method and device, vehicle and storage medium

    CN121691493A