Cross-process bidirectional communication system and processing method for C++ and QML

By introducing a cross-process bidirectional communication system between C++ and QML into the automotive instrument cluster, and utilizing modules and interfaces from the DetC-Secreen library, the problem of high data communication complexity in existing technologies is solved, achieving efficient and flexible data transmission and reducing development difficulty and cost.

CN115033402BActive Publication Date: 2026-01-02DONGFENG ELECTRONICS TECH
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210733729.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-27
Publication Date
2026-01-02
Estimated Expiration
2042-06-27

AI Technical Summary

Technical Problem

Existing QML data communication methods in automotive instruments require a significant amount of time and resources, and it is difficult to guarantee the real-time performance and reliability of the data. In particular, when C++ communicates across processes with QML, the communication protocol definition is complex, and development and testing are complicated.

Method used

A cross-process bidirectional communication system using C++ and QML is adopted. By setting up C++ and QML communication modules in the Detc-Secreen library, and using the DHandler and DLocalDataSource classes as interfaces, it supports multiple data types based on TCP/IP protocol Socket communication, simplifying the data transmission process.

Benefits of technology

It achieves efficient and flexible data communication, reduces development difficulty and cost, optimizes communication links, supports the transmission of various data types, and ensures the real-time performance and reliability of data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115033402B_ABST
    Figure CN115033402B_ABST
Patent Text Reader

Abstract

The application relates to a C++ and QML cross-process bidirectional communication system, wherein the system comprises a C++ communication module arranged in a Detc-Secreen library of the bidirectional communication system (Detc-Secreen) and used for providing a DHandler class based on a C++ language and taking the DHandler class as a unique interface for data transmission; and a QML communication module arranged in the Detc-Secreen library of the bidirectional communication system (Detc-Secreen) and connected with the C++ communication module to perform data interaction processing, used for providing a DLocalDataSource class based on a QML language and taking the DLocalDataSource class as an API interface for external use. The application also relates to a corresponding processing method. The C++ and QML cross-process bidirectional communication system and the processing method have the advantages that the communication link is optimized, data communication is more efficient and effective, various data types are supported, data types and quantities can be defined more flexibly according to scene requirements, the development difficulty is reduced due to the C++ and QML direct calling interfaces, and human cost and time cost are reduced.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of automobile electronic control, in particular to the technical field of automobile instrument, and more particularly to a bidirectional communication system and processing method for C++ and QML cross-process. BACKGROUND

[0002] In recent years, with the vigorous development of the automobile industry, the functions of automobiles are becoming more and more rich, which is reflected in the instrument as more and more functions, not just limited to the display requirements of the conventional speed and speed, and while the richness of the functions is improving, the amount of data involved in the underlying is also growing. In consideration of the cost and the performance of the chip, while ensuring the stability of the automobile and the practicability and aesthetic demand of the customer for the instrument, based on QML, graphical objects can be created in scripts, and various graphic effects and state machines are supported, so that the application of QML in the development of UI interface on the automobile instrument is more and more. This involves data communication with QML. As the core part of the instrument, when processing instrument data, we not only need to ensure the accuracy of the data, but also need to ensure the real-time performance of the data.

[0003] The existing general inter-process communication uses shared memory and other methods, which requires software developers to make trade-offs between the timeliness of data and the integrity of data, such as Figure 1 As shown, the implementation of data communication needs to define a complex communication protocol, including but not limited to locks, semaphores, pipes and other methods. Not only a lot of time is spent on development, but also a lot of testing is needed to verify the reliability and real-time performance of the data.

[0004] Therefore, there is a higher demand for QML data communication today. SUMMARY

[0005] The purpose of the present application is to overcome the shortcomings of the prior art, and to provide a bidirectional communication system and processing method for C++ and QML cross-process, which can effectively solve the difficulty of C++ and QML data cross-process communication.

[0006] In order to achieve the above purpose, the bidirectional communication system and processing method for C++ and QML cross-process are as follows:

[0007] The bidirectional communication system for C++ and QML cross-process, its main feature is that the system includes:

[0008] The C++ communication module is arranged in the Detc-Secreen library of the bidirectional communication system, and is used to provide a DHandler class based on C++ language and to use it as the only interface for data transmission; and

[0009] The QML communication module is arranged in the Detc-Secreen library of the bidirectional communication system, is connected with the C++ communication module to interact and process data, and is used to provide a DLocalDataSource class based on the QML language and provide the class as an API interface.

[0010] Preferably, the system further comprises an internal communication module, wherein,

[0011] The C++ communication module is provided with a first internal communication module, the QML communication module is provided with a second internal communication module, and the first internal communication module and the second internal communication module realize Socket communication processing based on the TCP / IP protocol.

[0012] Preferably, the DHandler class in the C++ communication module is used to provide a setProperty interface, and the setProperty interface is used as the only interface for data transmission in the bidirectional communication process.

[0013] Preferably, the setProperty interface takes the Qt framework as data support and supports multiple data types based on the QVariant class.

[0014] Preferably, the DLocalDataSource class in the QML communication module receives data transmitted by the C++ communication module and maps the received data to a slot function to realize fast response between the C++ communication module and the QML communication module.

[0015] Preferably, a data Map table is provided between the C++ communication module and the QML communication module to realize the data diversity requirement by registering data types.

[0016] Preferably, the bidirectional communication system is arranged in a C++ process and a QML process respectively.

[0017] When the C++ process and the QML process are used to interact data, the C++ process loads a data transmission module in the bidirectional communication system to perform data transmission processing on received original data.

[0018] The QML process loads a data processing module in the bidirectional communication system to receive original data transmitted by the data transmission module and perform corresponding data processing on the original data.

[0019] Preferably, the system uses a 1-to-1 communication mode for bidirectional communication processing.

[0020] The system realizes the cross-process bidirectional communication processing method for C++ and QML, and the main features are as follows:

[0021] (1) The data processing is coded by C++ language, the UI display is coded by QML language, and the data processing and the UI display are not in the same process;

[0022] (2) The cross-process bidirectional communication processing is performed by using the bidirectional communication system;

[0023] (3) The C++ process and the QML process load the bidirectional communication system library respectively;

[0024] (4) According to the data transmission requirement, the communication data type table is defined;

[0025] (5) The form of receiving data is defined in the C++ process and the QML process respectively;

[0026] (6) The C++ process and the QML process respectively perform the interactive processing of data transmission;

[0027] (7) The completed business function is tested and verified;

[0028] (8) The test is completed, and the function acceptance is performed.

[0029] Preferably, the step (1) specifically includes the following steps:

[0030] (1.1) The data processing is the original data in the processing project, and the C++ language is used for coding;

[0031] (1.2) The UI display is the human-computer interaction for providing data display and setting, and the QML language is used for coding;

[0032] (1.3) The display data and the setting data of the UI display are provided by the C++ process and received.

[0033] Preferably, the step (3) is specifically:

[0034] The C++ process loads the bidirectional communication system library and inherits the DHandler class, and the QML process loads the bidirectional communication system library and loads the DLocalDataSource module.

[0035] Preferably, the step (4) is specifically:

[0036] According to the data transmission requirement, a communication data type table, i.e., a data Map table, is defined, wherein the data Map table comprises two types of C++ sending and QML sending, and the two types have the same form, i.e., the form of <QString key, QVariant value>.

[0037] Preferably, the step (5) is specifically as follows:

[0038] In the C++ process, a function is defined in the form of on_xxx, wherein xxx is the QML sending key defined in the data Map table.

[0039] In the QML process, a variable is defined in the DLocalDataSource module, and the variable name is consistent with the C++ sending key in the data Map table.

[0040] Preferably, the step (6) is specifically as follows:

[0041] In the C++ process, the data to be sent is sent to the QML process by calling the setProperty interface.

[0042] In the QML process, the data to be sent is sent to the C++ process by calling the request interface.

[0043] The C++ and QML cross-process bidirectional communication system and the processing method can provide the requirement for data communication in various scenarios, simplify the complexity of data communication, optimize the communication link, make the data communication more efficient and effective, support various data types, can more flexibly define the data type and quantity according to the scene requirement, effectively reduce the development difficulty, and reduce the labor cost and time cost due to the direct calling interface of C++ and QML. BRIEF DESCRIPTION OF DRAWINGS

[0044] Figure 1 A schematic diagram of data communication of the prior art.

[0045] Figure 2 A communication principle schematic diagram of the bidirectional communication module of the application.

[0046] Figure 3 A schematic diagram of the bidirectional communication module of the application in the actual application process.

[0047] Figure 4 A data communication development process schematic diagram of the application compared with the prior art. DETAILED DESCRIPTION

[0048] In order to make the technical contents of the present application clearer, further description will be made in combination with specific examples.

[0049] Before the detailed description of the embodiments according to the present application, it should be noted that in the following, the terms "comprise", "include" or any other variants are intended to cover the non-exclusive inclusion, so that the process, method, article or device including a series of elements not only includes these elements, but also includes other elements not explicitly listed or inherent to such process, method, article or device.

[0050] The system for the bi-directional communication between C++ and QML cross-process, wherein the system comprises:

[0051] The C++ communication module is arranged in the Detc-Secreen library of the bi-directional communication system Detc-Secreen, and is used for providing the DHandler class based on the C++ language and taking it as the only interface for data sending; and

[0052] The QML communication module is arranged in the Detc-Secreen library of the bi-directional communication system Detc-Secreen, and is connected with the C++ communication module to perform data interaction processing, and is used for providing the DLocalDataSource class based on the QML language and taking it as the API interface to the outside.

[0053] As the preferred embodiment of the present application, the system further comprises an internal communication module, wherein,

[0054] The first internal communication module is arranged in the C++ communication module, the second internal communication module is arranged in the QML communication module, and the first internal communication module and the second internal communication module realize the Socket communication processing based on the TCP / IP protocol.

[0055] As the preferred embodiment of the present application, the DHandler class in the C++ communication module is used for providing the setProperty interface, and taking the setProperty interface as the only interface for data sending in the bi-directional communication process.

[0056] As the preferred embodiment of the present application, the setProperty interface takes the Qt framework as the data support, and supports multiple data types based on the QVariant class.

[0057] As a preferred embodiment of the present application, the DLocalDataSource class in the QML communication module receives the data sent by the C++ communication module, and maps the received data into a slot function, so as to realize the fast response between the C++ communication module and the QML communication module.

[0058] As a preferred embodiment of the present application, the data Map table needs to be provided between the C++ communication module and the QML communication module, so as to realize the data diversity requirement by registering the data type.

[0059] As a preferred embodiment of the present application, the bidirectional communication system Detc-Secreen is respectively arranged in the C++ process and the QML process.

[0060] When the C++ process and the QML process are used for data interaction, the C++ process performs data sending processing on the received raw data by loading the data sending module in the bidirectional communication system Detc-Secreen.

[0061] The QML process receives the raw data sent by the data sending module by loading the data processing module in the bidirectional communication system Detc-Secreen, and performs corresponding data processing on the raw data.

[0062] Please refer to Figure 2 The bidirectional communication system Detc-Secreen mainly includes a C++ communication module, an internal communication module and a QML communication module, wherein the C++ communication module mainly provides a DHandler class based on the C++ language, the QML communication module provides a DLocalDataSource based on the QML language as an API interface, the DHandler class provides a setProperty(const char*name, const QVariant&value) interface as the only interface for data sending, is supported by the Qt framework, supports various data types based on QVariant, the DLocalDataSource module maps the received data into a slot function, so as to realize fast response, and the internal communication module is based on a Socket mode for data communication. When the user uses the bidirectional communication system Detc-Secreen, a data Map table needs to be provided, which is mainly used to flexibly support the data diversity requirement of the user.

[0063] As a preferred embodiment of the present application, the system uses a 1-to-1 communication mode for bidirectional communication processing.

[0064] As shown in Figure 3 As shown in the figure, based on the characteristics of the DS bidirectional communication system Detc-Secreen, in use, the C++ process and the QML process only need to load the corresponding modules of the DS bidirectional communication system Detc-Secreen respectively, and call the corresponding module API to realize inter-process communication, without the need to define the communication protocol and the simultaneous mode separately, making the development more convenient and greatly shortening the development cycle.

[0065] As shown in Figure 4 As shown in the figure, compared with the conventional development process, the DS bidirectional communication system Detc-Secreen greatly reduces the development process and reduces the development difficulty.

[0066] In actual application, the technical scheme maps into Qt signal and slot in data sending and receiving by means of the signal and slot mechanism provided by the Qt framework, to realize fast data sending and data receiving.

[0067] As a further improvement of the above technology, based on the TCP / IP principle, less memory can be occupied, and the requirement for hardware is reduced.

[0068] As a further improvement of the above technology, the Qt framework is used, so that the type of communication data is widely supported and can be defined flexibly.

[0069] As a further improvement of the above technology, the communication protocol is optimized, and unified processing is performed as signal and slot, without the need to define the data interaction mode, and the original message, pipe and shared memory method are replaced.

[0070] As a further improvement of the above technology, the communication steps are simplified, the C++ process and the QML process are directly connected for data interaction, without the need to use the data conversion channel of C++, the data link is reduced, and the data transmission is accelerated.

[0071] As a further improvement of the above technology, the communication mode is optimized, the data communication difficulty is simplified, the user does not need to care about the data transmission form, the data communication sending and receiving interface is provided in the form of C++ class and QML module, and the developer is easier to start.

[0072] The system uses the above-mentioned method to realize the bidirectional communication processing method for C++ and QML cross-processes, wherein the method comprises the following steps:

[0073] (1) The data processing is implemented by using C++ language coding, the UI display is implemented by using QML language coding, and the data processing and the UI display are not in the same process;

[0074] (2) using a bidirectional communication system (Detc-Secreen) to perform cross-process bidirectional communication processing;

[0075] (3) the C++ process and the QML process load the bidirectional communication system Detc-Secreen library respectively;

[0076] (4) defining a communication data type table according to data transmission requirements;

[0077] (5) defining the form of received data in the C++ process and the QML process respectively;

[0078] (6) the C++ process and the QML process perform interactive processing of data transmission respectively;

[0079] (7) testing and verifying the completed business functions;

[0080] (8) completing the test and performing function acceptance.

[0081] As a preferred embodiment of the application, the step (1) specifically comprises the following steps:

[0082] (1.1) the data processing is the original data in the processing project, and C++ language is used for coding;

[0083] (1.2) the UI display is human-computer interaction for providing data display and setting, and QML language is used for coding;

[0084] (1.3) the display data and the setting data of the UI display are provided by the C++ process and received by the C++ process.

[0085] As a preferred embodiment of the application, the step (3) is specifically:

[0086] the C++ process loads the bidirectional communication system Detc-Secreen library and inherits the DHandler class, and the QML process loads the bidirectional communication system Detc-Secreen library and loads the DLocalDataSource module.

[0087] As a preferred embodiment of the application, the step (4) is specifically:

[0088] defining a communication data type table, i.e. a data Map table, according to data transmission requirements; wherein the data Map table contains two types of C++ sending and QML sending, and the two types have consistent forms, both in the form of <QString key,QVariantvalue>.

[0089] In practical applications, data is defined in the form of a Map table, which includes the number of data items and their data types.

[0090] In a preferred embodiment of the present invention, step (5) specifically comprises:

[0091] In the C++ process, the data to be received is defined in the form of on_xxx, where xxx is the QML sending key defined in the data Map table.

[0092] In the QML process, the data to be received is defined as variables in the DLocalDataSource module, and the variable names are consistent with the C++ send key in the data Map table.

[0093] In a preferred embodiment of the present invention, step (6) specifically comprises:

[0094] In the C++ process, the data to be sent is sent to the QML process by calling the setProperty interface;

[0095] In the QML process, the data to be sent is sent to the C++ process by calling the request interface.

[0096] In practical applications, the implementation of this technical solution specifically includes the following steps:

[0097] (1) The project development environment is designed so that the UI interface is coded in QML language, and the business processing (raw data processing) is coded in C++ language. The software architecture is designed so that the UI interface and the business processing (raw data processing) are not in the same process. The data displayed and set by the UI is provided and received by the business processing (raw data processing) process.

[0098] (2) Determine the cross-process data communication method and perform bidirectional communication processing based on the bidirectional communication system DetC-Secreen;

[0099] (3) The business processing process (C++ process) loads the Det-Secreen library of the two-way communication system and inherits the DHandler class. The UI process (QML process) loads the Det-Secreen library of the two-way communication system and loads the DLocalDataSource module.

[0100] (4) Based on data transmission requirements, define a communication data type table (Map table), which includes two types: C++ sending and QML sending. The two types have the same format.<QString key,QVariant value> form.

[0101] (5) In the C++ process, the data to be received defines a function in the form of on_xxx, where xxx is the QML sending key defined in the Map table. In the QML process, the data to be received defines a variable in the DLocalDataSource module, and the variable name is consistent with the C++ sending key in the Map table.

[0102] (6) In the C++ process, the data to be sent to the QML process calls the setProperty interface, and in the QML process, the data to be sent to the C++ process calls the request interface.

[0103] (7) For the completed function, test verification processing is performed;

[0104] (8) After the test is completed, the function is accepted.

[0105] In a specific embodiment of the present application, example one: a 7-inch screen automobile combination instrument

[0106] 1. In order to ensure the display effect of the instrument, the instrument software architecture adopts a layered structure. It includes a business processing process (DataCenter) implemented by C++ and a UI process (FT20UI) implemented by QML.

[0107] 2. The instrument needs to collect 146 CAN message data and 32 RPC data, of which 123 CAN messages and 32 RPC data are received and processed by the DataCenter process.

[0108] 3. The FT20UI process receives the data transmitted by the Datacenter process and displays it.

[0109] 4. When implementing the Datacenter process and the FT20UI process, the DS bidirectional communication system is transplanted.

[0110] 5. A data relationship correspondence table is designed.

[0111] 6. The combination instrument product software development is implemented.

[0112] Any process or method descriptions in flow charts or described elsewhere herein can be understood as representing one or more steps of a method implemented by one or more computers, and according to one preferred embodiment of the present application, the scope of the present application includes additional implementation in which the functions described are performed in a different order, or are performed concurrently, or are performed by different computers, or are performed by one computer according to one preferred embodiment of the present application, and those skilled in the art will understand that the scope of the present application includes additional implementation in which the functions described are performed in a different order, or are performed concurrently, or are performed by different computers, or are performed by one computer.

[0113] It should be understood that parts of the present application can be realized by hardware, software, firmware, or a combination thereof. In the above-described embodiments, a plurality of steps or methods can be realized by software or firmware stored in a memory and executed by a suitable instruction execution apparatus.

[0114] Those skilled in the art can understand that all or part of the steps carried out by the above-mentioned embodiment method can be completed by programs instructing related hardware, and the programs can be stored in a computer readable storage medium, and when the programs are executed, one or a combination of the steps of the method embodiment is included.

[0115] The storage medium mentioned above can be a read-only memory, a magnetic disk or an optical disk, etc.

[0116] In the description of the present specification, the description of the terms "an embodiment", "some embodiments", "an example", "a specific example", or "embodiments" and the like means that the specific features, structures, materials or characteristics described in connection with the embodiment or example are included in at least one embodiment or example of the present application. In the present specification, the illustrative description of the above terms does not necessarily mean the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner.

[0117] Although the embodiments of the present application have been shown and described above, it should be understood that the above-described embodiments are exemplary and cannot be construed as limiting the present application, and those skilled in the art can make changes, modifications, replacements and variations to the above-described embodiments within the scope of the present application.

[0118] The C++ and QML cross-process bidirectional communication system and processing method of the present application provides requirements for data communication in various scenarios, simplifies the complexity of data communication, optimizes the communication link, makes data communication more efficient and effective, supports various data types, can more flexibly define data types and quantities according to scene requirements, effectively reduces development difficulty, reduces labor cost and time cost due to the direct calling interface of C++ and QML.

[0119] In this specification, the present application has been described with reference to its specific embodiments. However, it is obvious that various modifications and changes can be made without departing from the spirit and scope of the present application. Therefore, the specification and drawings should be considered as illustrative rather than limiting.

Claims

1. A bidirectional communication system for cross-process communication between C++ and QML, characterized in that, The system includes: The C++ communication module, located in the DetC-Secreen library of the two-way communication system DetC-Secreen, provides the DHandler class based on the C++ language and serves as the sole interface for data transmission; and The QML communication module is located in the Det-Secreen library of the bidirectional communication system Det-Secreen. It is connected to the C++ communication module to perform data interaction processing. It provides the DLocalDataSource class based on the QML language and uses it as an external API interface. The system also includes: an internal communication module, wherein, The C++ communication module includes a first internal communication module, and the QML communication module includes a second internal communication module. The first internal communication module and the second internal communication module communicate via Socket based on the TCP / IP protocol. The DHandler class in the C++ communication module provides the setProperty interface, which is used as the sole interface for sending data during bidirectional communication. The C++ communication module and the QML communication module need to provide a data Map table to meet the data diversity requirements by registering data types.

2. The bidirectional communication system for cross-process communication between C++ and QML according to claim 1, characterized in that, The setProperty interface uses the Qt framework as its data support and supports multiple data types based on the QVariant class.

3. The bidirectional communication system for cross-process communication between C++ and QML according to claim 2, characterized in that, The DLocalDataSource class in the QML communication module receives data sent by the C++ communication module and maps the received data to slot functions to achieve fast response between the C++ communication module and the QML communication module.

4. The bidirectional communication system for cross-process communication between C++ and QML according to claim 1, characterized in that, The bidirectional communication system Detc-Secreen is set up in both the C++ process and the QML process. When using the C++ process and QML process for data interaction, the C++ process loads the data sending module in the bidirectional communication system DetC-Secreen to process the received raw data for data transmission. The QML process receives raw data sent by the data sending module by loading the data processing module in the bidirectional communication system Detc-Secreen, and performs corresponding data processing on the raw data.

5. The bidirectional communication system for cross-process communication between C++ and QML according to claim 4, characterized in that, The system described uses a one-to-one communication method for bidirectional communication processing.

6. A method for implementing bidirectional cross-process communication between C++ and QML using the system described in claim 5, characterized in that, The method includes the following steps: (1) Data processing is implemented using C++ language encoding, and UI display is implemented using QML language encoding, and the data processing and UI display are not in the same process; (2) Cross-process bidirectional communication is performed using the DetC-Secreen bidirectional communication system; (3) The C++ process and the QML process respectively load the Detc-Secreen bidirectional communication system library; (4) Define the communication data type table according to the data transmission requirements; Step (4) specifically refers to: Based on data transmission requirements, a communication data type table, namely a data Map table, is defined. This data Map table includes two types: C++ transmission and QML transmission, and both types have the same format.<QString key,QVariant value> form; (5) Define the data receiving format in the C++ process and the QML process respectively; The specific steps (5) are as follows: In the C++ process, the data to be received is defined in the form of on_xxx, where xxx is the QML sending key defined in the data Map table. In the QML process, the data to be received is defined as a variable in the DLocalDataSource class, and the variable name is consistent with the C++ send key in the data Map table; (6) The C++ process and the QML process respectively perform interactive data transmission processing; (7) Conduct testing and verification of completed business functions; (8) Complete the test and conduct functional acceptance.

7. The method for implementing bidirectional communication between C++ and QML across processes according to claim 6, characterized in that, Step (1) specifically includes the following steps: (1.1) The data processing described refers to processing the raw data in the project, and is coded using C++ language; (1.2) The UI display described above is a human-computer interaction used to provide data display and settings, and is coded using QML language; (1.3) The display data and setting data of the UI are provided and received by the C++ process.

8. The method for implementing bidirectional communication between C++ and QML across processes according to claim 7, characterized in that, Step (3) specifically refers to: The C++ process loads the Detc-Secreen bidirectional communication system library and inherits the DHandler class; the QML process loads the Detc-Secreen bidirectional communication system library and loads the DLocalDataSource class.

9. The method for implementing bidirectional communication between C++ and QML across processes according to claim 6, characterized in that, The specific steps (6) are as follows: In the C++ process, the data to be sent is sent to the QML process by calling the setProperty interface; In the QML process, the data to be sent is sent to the C++ process by calling the request interface.

Citation Information

Patent Citations

  • Terminal equipment and cross-process communication method thereof

    CN111443961A