Multi-platform communication method and device, electronic equipment and readable storage medium

By introducing platform managers and standardized callback functions, dynamically manage the communication platform and create independent receiving threads, the problems of high coupling and poor scalability of multi-platform communication systems in vehicle terminals are solved, and a multi-platform communication framework that is easy to maintain and expand is realized.

CN120475026APending Publication Date: 2025-08-12国汽智端(成都)科技有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510655351.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-20
Publication Date
2025-08-12

AI Technical Summary

Technical Problem

The existing multi-platform communication systems in vehicle terminals have problems such as high coupling, poor scalability and difficulty in maintenance, especially in the face of inconsistent interfaces of different communication platforms and lack of unified thread management.

Method used

The platform manager was introduced, and the interfaces of each communication platform were encapsulated through standardized callback functions, dynamically managed the communication platform, and independent receiving threads were created in the on-board terminal to achieve the unified thread management.

Benefits of technology

It reduces the coupling between platforms, improves the scalability and maintenance convenience of the system, and simplifies development complexity and operation stability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120475026A_ABST
    Figure CN120475026A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of Internet of Vehicles, and provides a multi-platform communication method and device, electronic equipment and a readable storage medium, and the method comprises the steps: creating a platform manager, and obtaining a platform operation function set of each communication platform, the platform operation function set comprising a standardized callback function; running the platform operation function set through the platform manager, and dynamically managing each communication platform; creating and maintaining an independent receiving thread for an enabled platform in each communication platform; and performing data exchange with the enabled platform based on the independent receiving thread. According to the technical scheme provided by one or more embodiments of the invention, a complete and reliable vehicle-mounted terminal multi-platform communication framework which is easy to maintain and expand can be provided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of vehicle networking technology, and in particular to a multi-platform communication method, device, electronic device, and readable storage medium. Background Art

[0002] With the rapid development of the Internet of Things (IoT) and cloud computing technologies, in-vehicle devices often need to simultaneously access multiple cloud communication platforms for data exchange and business processing. In practice, due to the differences in communication protocols between these platforms, in-vehicle devices often need to use different communication protocols and data formats to interact with different cloud communication platforms.

[0003] For example, the on-board terminal and the remote service platform (TSP) generally use the MQTT communication protocol for data interaction, the on-board terminal and the national standard platform (GB) generally use the TCP communication protocol for data interaction, and the on-board terminal and the enterprise private platform (PE) generally use the HTTPS communication protocol for data interaction.

[0004] Traditional multi-platform communication frameworks for in-vehicle terminals typically hard-code the communication protocol information for each cloud communication platform directly into the in-vehicle terminal's code. Once the code is successfully compiled and executed, the in-vehicle terminal can exchange data with each cloud communication platform. However, this multi-platform communication approach often suffers from issues such as high code coupling, poor scalability, and difficulty in maintenance. Summary of the Invention

[0005] In view of this, one or more embodiments of the present disclosure provide a multi-platform communication method, device, electronic device and readable storage medium, which can provide a complete, reliable, easy-to-maintain and expandable multi-platform communication framework for vehicle terminals.

[0006] In a first aspect, the present disclosure provides a multi-platform communication method, which is applied to a vehicle-mounted terminal, and the method includes: creating a platform manager and obtaining a platform operation function set of each communication platform, wherein the platform operation function set includes a standardized callback function; running the platform operation function set through the platform manager to dynamically manage each of the communication platforms; creating and maintaining an independent receiving thread for an enabled platform in each of the communication platforms; and exchanging data with the enabled platform based on the independent receiving thread.

[0007] In the second aspect, the present disclosure provides a multi-platform communication device, which is applied to a vehicle-mounted terminal, and the device includes: an initialization module, which is used to create a platform manager and obtain the platform operation function set of each communication platform, and the platform operation function set includes a standardized callback function; a platform management module, which is used to run the platform operation function set through the platform manager to dynamically manage each of the communication platforms; a thread management module, which is used to create and maintain an independent receiving thread for an enabled platform in each of the communication platforms, so that the vehicle-mounted terminal can exchange data with the enabled platform based on the independent receiving thread.

[0008] In a third aspect, the present disclosure provides an electronic device comprising a memory and a processor, wherein the memory is used to store a computer program, and when the computer program is executed by the processor, the multi-platform communication method of the first aspect or any corresponding embodiment thereof is implemented.

[0009] In a fourth aspect, the present disclosure provides a computer-readable storage medium for storing a computer program. When the computer program is executed by a processor, it implements the multi-platform communication method of the first aspect or any corresponding embodiment thereof.

[0010] The technical solution provided by one or more embodiments of the present disclosure effectively decouples the vehicle-mounted terminal from the communication logic and business processing of each communication platform by introducing a platform manager. As an intermediate layer, the platform manager assumes the responsibility of interacting with each communication platform. The vehicle-mounted terminal only needs to interact with the platform manager, without the need for direct and tight integration with each communication platform. In this way, when the communication logic or business processing of a communication platform changes, only the platform manager code related to that platform needs to be modified, without modifying other code in the vehicle-mounted terminal, which greatly reduces the coupling between platforms.

[0011] The technical solutions provided by one or more embodiments of the present disclosure obtain platform operation function sets provided by various communication platforms. These platform operation function sets include standardized callback functions. This means that although the interfaces of different communication platforms may differ in their underlying implementation, through this standardized encapsulation, a unified interface form is presented to the outside world. By calling these standardized function sets, the platform manager can interact with each communication platform for data without having to worry about the specific interface implementation details of each communication platform. In this way, the problem of inconsistent interfaces between different communication platforms is solved, and the development and maintenance complexity of the multi-platform communication system of the vehicle terminal is reduced.

[0012] The technical solutions provided by one or more embodiments of the present disclosure enable a platform manager to dynamically manage various communication platforms, enabling or disabling specific platforms as needed. When adding a new communication platform, the platform manager simply obtains the standardized platform operation function set provided by the new platform and registers it with the platform manager, without modifying existing code. This dynamic management mechanism ensures excellent scalability of the multi-platform communication system for in-vehicle terminals, enabling easy adaptation to new communication platforms that may emerge in the future.

[0013] The technical solutions provided by one or more embodiments of the present disclosure enable the creation and maintenance of independent receive threads on the vehicle terminal for data exchange, targeting the enabled platforms in each communication platform. This unifies and simplifies thread management, facilitating monitoring and optimization of receive threads.

[0014] The technical solution provided by one or more embodiments of the present disclosure effectively solves the defects of the multi-platform communication system of vehicle terminals in the prior art, such as high coupling degree, poor scalability, and difficult maintenance, and provides a complete, reliable, easy-to-maintain and expandable multi-platform communication framework solution for vehicle terminals, which can significantly improve the development efficiency, operational stability and maintenance convenience of the multi-platform communication system of vehicle terminals. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] The features and advantages of the various embodiments of the present disclosure will be more clearly understood by referring to the accompanying drawings, which are schematic and should not be construed as limiting the present disclosure in any way. In the accompanying drawings:

[0016] Figure 1 A schematic diagram showing the steps of a multi-platform communication method in one embodiment of the present disclosure is shown;

[0017] Figure 2 A schematic diagram of a system construction process of a multi-platform communication system in one embodiment of the present disclosure is shown;

[0018] Figure 3 A schematic diagram of a data interaction process of a multi-platform communication system in one embodiment of the present disclosure is shown;

[0019] Figure 4 A schematic diagram of functional modules of a multi-platform communication device in one embodiment of the present disclosure is shown;

[0020] Figure 5 A schematic diagram of functional modules of another multi-platform communication device in one embodiment of the present disclosure is shown;

[0021] Figure 6 A schematic structural diagram of an electronic device in one embodiment of the present disclosure is shown. DETAILED DESCRIPTION

[0022] To make the purpose, technical solutions, and advantages of the embodiments of the present disclosure more clear, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments of the present disclosure, all other embodiments obtained by those skilled in the art without making any creative efforts shall fall within the scope of protection of the present disclosure.

[0023] In related technologies, the multi-platform communication framework for vehicle-mounted terminals usually has the following technical difficulties: First, the communication logic and business processing of the vehicle-mounted terminal equipment and each communication platform are tightly integrated, resulting in high coupling between platforms and difficult code maintenance. Second, the interface implementation methods of different communication platforms are inconsistent, which increases the difficulty of developing and the complexity of maintaining the multi-platform communication system. Furthermore, if a new communication platform needs to be added, the multi-platform communication system for vehicle-mounted terminals needs to modify the existing code, which has poor scalability. Finally, each communication platform maintains its own communication thread, lacking a unified thread management mechanism and resource management mechanism.

[0024] See also Figure 1 , a multi-platform communication method provided by one embodiment of the present disclosure may include the following steps.

[0025] S1: Create a platform manager and obtain a platform operation function set of each communication platform, wherein the platform operation function set includes a standardized callback function.

[0026] In this embodiment, by introducing a platform manager, the communication logic and business processing of the vehicle terminal can be effectively decoupled from each communication platform. As an intermediate layer, the platform manager can assume the responsibility of data exchange with each communication platform. The vehicle terminal only needs to exchange data with the platform manager and does not need to be directly integrated with each communication platform. The communication platform can be various cloud platforms, including but not limited to the remote service platform (TSP), the national standard platform (GB), and the enterprise private platform (PE).

[0027] In this embodiment, the communication interfaces of different communication platforms may differ in their underlying implementations, but they can all be encapsulated in a standardized manner to form standardized callback functions, making them easier for vehicle terminals to access. Each communication platform packages its own standardized callback functions into a platform operation function set. Once a vehicle terminal has access to a platform operation function set, it can establish a communication connection with the corresponding communication platform, exchange data, and complete service processing.

[0028] In some embodiments, the standardized callback function includes at least one of the following: a connection callback function, used to establish a communication connection between the platform manager and the communication platform; a disconnection callback function, used to disconnect the communication connection between the platform manager and the communication platform; a sending callback function, used to send data to the communication platform; a receiving callback function, used to receive data from the communication platform; and a data processing callback function, used to perform data processing on the communication platform.

[0029] Specifically, the platform operation function set encapsulates the communication logic and service processing details of each communication platform. By calling the standardized callback functions in these platform operation function sets, you can interact with each communication platform and implement various functions. Standardized callback functions provide a unified abstraction for various operations targeting communication platforms, including connecting to and disconnecting from platforms, sending and receiving data, and remote data processing.

[0030] In a practical application example, each standardized callback function has clearly defined parameters and return values, and its specific form can be as follows.

[0031] typedef int(*platform_connect_cb)(void). This is a function pointer type that points to a function with no parameters and a return value of int. It is used to establish a connection with the communication platform. The return value usually indicates whether the connection is successful (for example, a return value of 0 indicates success, and a return value of non-zero indicates failure).

[0032] typedef int(*platform_connect_cb)(void). This is a function pointer type that points to a function with no parameters and returns an int type. It is used to disconnect from the communication platform. The return value usually indicates whether the disconnection is successful.

[0033] typedef int(*platform_send_cb)(const uint8_t *data, uint32_t len). This is a function pointer type that points to a function that accepts two parameters and returns an int value. It is used to send data to the communication platform, and the return value usually indicates whether the transmission is successful. "const uint8_t *data" is a pointer to the data to be sent, and "uint32_t len" is the length of the data to be sent.

[0034] typedef int(*platform_receive_cb)(uint8_t*data,uint32_t*len). This is a pointer to a function that accepts two parameters and returns an int value. It is used to receive data from the communication platform. The return value typically indicates whether the reception was successful. "uint8_t*data" is a pointer to the receive buffer, and "uint32_t*len" is a pointer to the length of the received data.

[0035] typedef void(*platform_data_process_cb)(uint8_t*data,uint32_t len). This is a function pointer type that points to a function that accepts two parameters and has no return value. It is used to process data received from the communication platform. "uint8_t*data" is a pointer to the received data, and "uint32_t len" is the length of the received data.

[0036] In a practical application example, all standardized callback functions of a communication platform can be encapsulated in a structure to form a complete set of platform operation functions. The specific code form of this structure can be as follows:

[0037]

[0038] In some implementations, the platform identifiers of various communication platforms can be obtained to distinguish between different communication platforms. For example, an enumeration type can be used to define the communication platform types supported by the vehicle terminal. Each communication platform type can correspond to a unique integer value as a platform identifier for easy indexing. A specific code example for creating a platform identifier can be as follows:

[0039]

[0040]

[0041] S2: Run the platform operation function set through the platform manager to dynamically manage each of the communication platforms.

[0042] In this embodiment, the platform manager can dynamically manage each communication platform, registering, managing status, and controlling resources for each platform. The platform manager can dynamically manage each communication platform and enable or disable specific platforms as needed. When adding a new communication platform, simply obtain the standardized platform operation function set provided by the new platform and register it with the platform manager, without modifying existing code.

[0043] In some embodiments, dynamic management of each communication platform may include, but is not limited to: enabling a communication platform and establishing a communication connection between the platform manager and the communication platform; deactivating a communication platform and disconnecting the communication connection between the platform manager and the communication platform; interacting with data from an enabled platform in the communication platform; and recording the enabled status of the communication platform.

[0044] In some implementations, the platform manager may not only run various platform operation function sets, but also store platform configuration information of various communication platforms, thereby better managing the platforms.

[0045] In some implementations, running the platform operation function set through the platform manager includes: registering the platform operation function set with the platform manager; acquiring a mutex lock, and running the platform operation function set based on the mutex lock.

[0046] Specifically, after a communication platform passes authentication, its platform operation function set can be registered and stored in the platform manager for easy operation and use. Each execution of the platform operation function set can be completed under a mutex mechanism. The main function of a mutex is to ensure mutual exclusion, that is, only one thread can hold the lock at a time. Once a thread acquires the mutex, other threads must wait until the holding thread releases the lock. Mutexes ensure thread-safe access to shared resources through locking and unlocking mechanisms, avoiding data races and inconsistencies. In a multithreaded environment, multiple threads may modify a shared variable simultaneously. Without a mutex, data inconsistencies may result. With a mutex, only one thread can modify the variable at a time, ensuring data correctness. Mutexes also ensure the order of operations between threads through synchronization, avoiding errors caused by concurrent access and improving program reliability and stability.

[0047] In a practical application example, a data structure of a platform manager may be as follows.

[0048]

[0049] Among them, platform_manager_t represents the core structure of the platform manager; the platform enable status array of bool type is used to record the enablement status of each platform; the platform operation function array of platform_ops_t type stores the platform operation function set; the receiving thread handle array of pthread_t type is used to manage independent receiving threads; the thread running status array of bool type is used to record the thread status of independent receiving threads; the mutex lock of pthread_mutex_t type is used for concurrent access protection.

[0050] In some implementations, before the platform operation function set is executed through the platform manager, the platform manager needs to be initialized. The platform manager initialization process may include initializing the platform manager structure, creating a mutex, and loading a communication platform configuration.

[0051] In a practical application example, the platform manager can be initialized through the platform_manager_init function. The specific process includes: validity verification, dynamic memory allocation of the platform manager structure, internal data initialization processing of the platform manager structure, creation and initialization of mutexes, initialization of the platform enable status array, clearing of the platform operation function array, initialization of the thread running status array, and application of platform configuration parameters.

[0052] In an actual application example, a globally unique platform manager instance can be created through the get_platform_manager function; and a platform manager instance can be deregistered and the resources occupied by the platform manager instance can be released through the platform_manager_deinit function.

[0053] S3: For each enabled platform in the communication platforms, create and maintain an independent receiving thread.

[0054] In this implementation, to ensure the independence and real-time nature of data reception across platforms, a separate receive thread can be created for each enabled platform at the vehicle terminal for data exchange. This unifies thread management, simplifies its complexity, and facilitates monitoring and optimization of receive threads. The creation process of an independent receive thread may include, but is not limited to, the following steps: checking the communication platform status, allocating thread control structures, initializing platform-specific data, creating a thread object, setting thread attributes, and starting the thread.

[0055] In some implementations, an independent receiving thread can be created for an enabled platform. The independent receiving thread's running status can then be monitored, and an exception handling mechanism can be configured for the independent receiving thread. This exception handling mechanism may include, but is not limited to, timeout retry, disconnection reconnection, and error logging. If the platform manager deactivates an enabled platform, the corresponding independent receiving thread can be deregistered.

[0056] In a practical application example, an independent receiving thread can be controlled by the following data structure.

[0057]

[0058] Among them, platform_thread_t represents the thread control structure; platform_type_t type identifier is used to distinguish different communication platforms; pthread_t thread handle is used for operation and control of thread instances; bool type running status flag is used to provide thread status information; void* type platform-specific data pointer is used to expand data storage.

[0059] In a practical application example, an independent receiving thread can set attributes using the thread_attributes_t thread attribute structure. The thread_attributes_t thread attribute structure consists of: a basic attribute set of type pthread_attr_t; a stack size configuration of type size_t; a priority setting of type int; and a detach status flag of type bool.

[0060] In a practical application example, an independent receiving thread can be created through the platform_create_thread function. The specific process includes: checking the validity of the communication platform; verifying the enabled status of the communication platform; dynamically allocating the thread control structure; initializing the thread attribute configuration; setting the thread running parameters; configuring communication platform-specific data; creating a thread instance; setting the attributes and priority of the thread instance; running the thread instance; and monitoring the status information of the thread instance.

[0061] In an actual application example, the platform_destroy_thread function can be used to deregister a thread instance of an independent receiving thread and release the resources occupied by the thread instance.

[0062] S4: Based on the independent receiving thread, exchange data with the enabling platform.

[0063] In this embodiment, an independent receiving thread can be allocated a certain storage resource buffer. Through the independent receiving thread, the vehicle terminal can send data to the activation platform, receive data from the activation platform, and perform data analysis and processing within the activation platform. It should be noted that the data exchange between the vehicle terminal and the activation platform can be a single operation or a cyclic operation.

[0064] In some implementations, the reliability of data exchange between the vehicle terminal and the activation platform can be improved through a pre-set exception handling mechanism. This pre-set exception handling mechanism may include, but is not limited to, strategies for handling reception timeouts, disconnection detection and reconnection strategies, resource allocation failure handling strategies, and error state recording and recovery strategies.

[0065] In a practical application example, the connection status of an independent receiving thread can be periodically monitored and connection status changes can be recorded. When an independent receiving thread is detected to be abnormally disconnected, a reconnection process can be triggered, the connection callback function recorded by the platform manager can be called to reestablish the connection, and a reconnection record log can be generated.

[0066] In some implementations, in response to the creation of the platform manager, a memory pool may be created for the platform manager; in response to the creation of the independent receiving thread, memory resources may be allocated to the independent receiving thread from the memory pool.

[0067] The memory pool mechanism enables unified management and allocation of resources used by each communication platform. This approach avoids the fragmentation and confusion caused by independent resource management by each communication platform, improving resource utilization efficiency and the overall performance of the multi-platform communication system.

[0068] In some implementations, in response to the deregistration of the independent receiving thread, the corresponding memory resources are reclaimed; in response to the deregistration of the platform manager, the memory pool is released. The memory resource reclaiming mechanism can achieve resource reuse and optimize resource utilization.

[0069] In a practical application example, the memory_pool_init function can be used to create and initialize a memory pool. This memory pool can contain multiple fixed buffers to facilitate the allocation and use of memory resources. The memory_pool_alloc function can be used to allocate memory resources to each independent receiving thread. During the memory resource allocation process, the memory pool can be searched for free buffers through traversal, and a mutex protection mechanism can be used to ensure thread safety.

[0070] In a practical application example, the platform_cleanup function can be used to execute the entire platform manager resource release process in a predefined order. First, all independent receive threads are stopped, then the communication connection between the platform manager and each communication platform is closed, memory pool resources are released, and various mutex objects are destroyed. Finally, the platform manager structure is released.

[0071] The technical solution provided by one or more embodiments of the present disclosure effectively decouples the vehicle-mounted terminal from the communication logic and business processing of each communication platform by introducing a platform manager. As an intermediate layer, the platform manager assumes the responsibility of interacting with each communication platform. The vehicle-mounted terminal only needs to interact with the platform manager, without the need for direct and tight integration with each communication platform. In this way, when the communication logic or business processing of a communication platform changes, only the platform manager code related to that platform needs to be modified, without modifying other code in the vehicle-mounted terminal, which greatly reduces the coupling between platforms.

[0072] The technical solutions provided by one or more embodiments of the present disclosure obtain platform operation function sets provided by various communication platforms. These platform operation function sets include standardized callback functions. This means that although the interfaces of different communication platforms may differ in their underlying implementation, through this standardized encapsulation, a unified interface form is presented to the outside world. By calling these standardized function sets, the platform manager can interact with each communication platform for data without having to worry about the specific interface implementation details of each communication platform. In this way, the problem of inconsistent interfaces between different communication platforms is solved, and the development and maintenance complexity of the multi-platform communication system of the vehicle terminal is reduced.

[0073] The technical solutions provided by one or more embodiments of the present disclosure enable a platform manager to dynamically manage various communication platforms, enabling or disabling specific platforms as needed. When adding a new communication platform, the platform manager simply obtains the standardized platform operation function set provided by the new platform and registers it with the platform manager, without modifying existing code. This dynamic management mechanism ensures excellent scalability of the multi-platform communication system for in-vehicle terminals, enabling easy adaptation to new communication platforms that may emerge in the future.

[0074] The technical solutions provided by one or more embodiments of the present disclosure enable the creation and maintenance of independent receive threads on the vehicle terminal for data exchange, targeting the enabled platforms in each communication platform. This unifies and simplifies thread management, facilitating monitoring and optimization of receive threads.

[0075] The technical solution provided by one or more embodiments of the present disclosure effectively solves the defects of the multi-platform communication system of vehicle terminals in the prior art, such as high coupling degree, poor scalability, and difficult maintenance, and provides a complete, reliable, easy-to-maintain and expandable multi-platform communication framework solution for vehicle terminals, which can significantly improve the development efficiency, operational stability and maintenance convenience of the multi-platform communication system of vehicle terminals.

[0076] See also Figure 2 and Figure 3A multi-platform communication system for in-vehicle terminals can be divided into five main phases during system operation: initialization, connection, data processing, sending, and cleanup. The initialization phase completes the configuration of the platform manager and resource manager and registers each communication platform with the platform manager; the connection phase establishes communication links between the platform manager and each communication platform; the data processing phase starts an independent receiving thread through the thread manager to receive and process data between the in-vehicle terminal and each communication platform; the sending phase is centralized by the platform manager and sends data to each communication platform; the cleanup phase disconnects all threads and communication links and releases all system resources.

[0077] See also Figure 4 The present disclosure further provides a multi-platform communication device, which is applied to a vehicle-mounted terminal and includes:

[0078] Initialization module 100, used to create a platform manager and obtain a platform operation function set of each communication platform, wherein the platform operation function set includes a standardized callback function;

[0079] The platform management module 200 is used to run the platform operation function set through the platform manager to dynamically manage each of the communication platforms;

[0080] The thread management module 300 is used to create and maintain an independent receiving thread for each activation platform in the communication platforms, so that the vehicle terminal exchanges data with the activation platform based on the independent receiving thread.

[0081] In one embodiment, the standardized callback function includes at least one of the following: a connection callback function, used to establish a communication connection between the platform manager and the communication platform; a disconnection callback function, used to disconnect the communication connection between the platform manager and the communication platform; a sending callback function, used to send data to the communication platform; a receiving callback function, used to receive data from the communication platform; and a data processing callback function, used to perform data processing on the communication platform.

[0082] In one embodiment, the platform management module 200 is specifically used to perform at least one of the following functions: enabling the communication platform, establishing a communication connection between the platform manager and the communication platform; deactivating the communication platform, disconnecting the communication connection between the platform manager and the communication platform; interacting with the enabled platform in the communication platform; and recording the enabled status of the communication platform.

[0083] In one embodiment, the platform management module 200 includes a registration management submodule 201. The registration management submodule 201 is specifically configured to register the platform operation function set with the platform manager, acquire a mutex, and execute the platform operation function set based on the mutex.

[0084] In one embodiment, the thread management module 300 is specifically used to create the independent receiving thread for the enabling platform; monitor the running status of the independent receiving thread, and set an exception handling mechanism for the independent receiving thread, the exception handling mechanism including at least one of timeout retry, interruption reconnection, and error logging; if the platform manager deactivates the enabling platform, the independent receiving thread is deregistered.

[0085] See also Figure 5 In one embodiment, a multi-platform communication device further includes a resource management module 400. The resource management module 400 is configured to, in response to the creation of the platform manager, create a memory pool for the platform manager; and in response to the creation of the independent receiving thread, allocate memory resources from the memory pool to the independent receiving thread.

[0086] In one embodiment, the resource management module 400 is further configured to, in response to the deregistration of the independent receiving thread, reclaim the corresponding memory resource; and in response to the deregistration of the platform manager, release the memory pool.

[0087] The various modules described in the above embodiments can be implemented by computer chips or products with certain functions. A typical implementation device is a computer. Specifically, the computer can be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smartphone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.

[0088] For the convenience of description, the above devices are described as being divided into various modules according to their functions. Of course, when implementing this application, the functions of each module can be implemented in the same or multiple software and / or hardware.

[0089] See also Figure 6 The present disclosure also provides an electronic device, which includes a memory and a processor, wherein the memory is used to store a computer program, and when the computer program is executed by the processor, the multi-platform communication method described above is implemented.

[0090] The present disclosure also provides a computer-readable storage medium, which is used to store a computer program. When the computer program is executed by a processor, the multi-platform communication method described above is implemented.

[0091] The processor may be a central processing unit (CPU). The processor may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or a combination of the above chips.

[0092] Memory, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs, non-transitory computer executable programs, and modules, such as the program instructions / modules corresponding to the methods in the embodiments of the present disclosure. The processor executes the non-transitory software programs, instructions, and modules stored in the memory to perform various processor functions and data processing, thereby implementing the methods in the aforementioned method embodiments.

[0093] The memory may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created by the processor, etc. In addition, the memory may include a high-speed random access memory, and may also include a non-transitory memory, such as at least one disk storage device, a flash memory device, or other non-transitory solid-state storage device. In some embodiments, the memory may optionally include a memory remotely located relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0094] Those skilled in the art will appreciate that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program. The program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. The storage medium can be a magnetic disk, an optical disk, a read-only memory (ROM), a random access memory (RAM), a flash memory, a hard disk drive (HDD), or a solid-state drive (SSD). The storage medium can also include a combination of the above-mentioned types of memory.

[0095] The various embodiments in this specification are described in a progressive manner. Similar portions between the various embodiments can be referenced to each other, and each embodiment focuses on the differences from the other embodiments. In particular, the device, equipment, and storage medium embodiments are generally similar to the method embodiments, so their descriptions are relatively simplified. For relevant portions, refer to the descriptions of the method embodiments.

[0096] The foregoing is merely an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principles of the present application should be included within the scope of the claims of the present application.

[0097] Although the embodiments of the present disclosure have been described with reference to the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present disclosure, and such modifications and variations are all within the scope defined by the appended claims.

Claims

1. A multi-platform communication method, characterized in that: The method is applied to a vehicle-mounted terminal, and the method includes: Creating a platform manager and obtaining a platform operation function set for each communication platform, wherein the platform operation function set includes a standardized callback function; By means of the platform manager, the platform operation function set is run to dynamically manage each of the communication platforms; For each enabled platform in the communication platforms, create and maintain an independent receiving thread; Based on the independent receiving thread, data is exchanged with the enabling platform.

2. The method according to claim 1, characterized in that The standardized callback function includes at least one of the following: A connection callback function, used to establish a communication connection between the platform manager and the communication platform; A disconnect callback function, used to disconnect the communication connection between the platform manager and the communication platform; Send callback function, used to send data to the communication platform; A receiving callback function, used to receive data from the communication platform; The data processing callback function is used to perform data processing on the communication platform.

3. The method according to claim 2, characterized in that The dynamically managing each of the communication platforms includes at least one of the following: activating the communication platform and establishing a communication connection between the platform manager and the communication platform; Deactivating the communication platform and disconnecting the communication connection between the platform manager and the communication platform; Interacting data with the enabling platform in the communication platform; The activation status of the communication platform is recorded.

4. The method according to claim 3, characterized in that The step of running the platform operation function set through the platform manager includes: Registering the platform operation function set with the platform manager; Acquire a mutex lock, and run the platform operation function set based on the mutex lock.

5. The method according to claim 1, wherein The step of creating and maintaining an independent receiving thread for each enabled platform in the communication platforms includes: For the activation platform, creating the independent receiving thread; Monitor the running status of the independent receiving thread and set an exception handling mechanism for the independent receiving thread, wherein the exception handling mechanism includes at least one of timeout retry, interrupt reconnection, and error logging; If the platform manager deactivates the enabled platform, the independent receiving thread is deregistered.

6. The method according to claim 1, characterized in that The method further comprises: In response to a creation instruction from the platform manager, creating a memory pool for the platform manager; In response to the creation instruction of the independent receiving thread, memory resources are allocated to the independent receiving thread from the memory pool.

7. The method according to claim 6, characterized in that The method further comprises: In response to the deregistration instruction of the independent receiving thread, reclaiming the corresponding memory resource; In response to a deregistration instruction from the platform manager, the memory pool is released.

8. A multi-platform communication device, characterized in that: The device is applied to a vehicle-mounted terminal, and includes: An initialization module, configured to create a platform manager and obtain a platform operation function set for each communication platform, wherein the platform operation function set includes a standardized callback function; A platform management module, configured to run the platform operation function set through the platform manager to dynamically manage each of the communication platforms; The thread management module is used to create and maintain an independent receiving thread for each activation platform in the communication platforms, so that the vehicle terminal exchanges data with the activation platform based on the independent receiving thread.

9. An electronic device, characterized in that: The electronic device includes a memory and a processor, the memory is used to store a computer program, and when the computer program is executed by the processor, the method according to any one of claims 1 to 7 is implemented.

10. A computer-readable storage medium, characterized in that The computer-readable storage medium is used to store a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.