DDS-based vehicle service code generation and compilation method and readable storage medium

By defining the content of in-vehicle function services and generating code files, and using an automatic compilation engine to generate executable files, the problem of complexity and high threshold for DDS in-vehicle service development in the existing technology is solved, simplifying development and improving code maintainability.

CN114546341BActive Publication Date: 2024-09-13CHONGQING CHANGAN TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210146970.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-02-17
Publication Date
2024-09-13
Estimated Expiration
2042-02-17

Smart Images

  • Figure CN114546341B
    Figure CN114546341B
Patent Text Reader

Abstract

The present invention specifically relates to a vehicle-mounted service code generation and compilation method based on DDS and a readable storage medium, including: defining the vehicle-mounted functional service content; defining a template file for code generation; reading a configuration file, and then rendering the template file for code generation through the vehicle-mounted functional service content to generate a corresponding code file, so that the corresponding functional service business logic code can be written based on the code file; obtaining the functional service business logic code and automatically compiling it to generate a corresponding executable file, and then deploying the executable file to a running server with a data distribution service environment to run the service. The present invention also discloses a readable storage medium. The vehicle-mounted service code generation and compilation method of the present invention can reduce the complexity of the system and the threshold for service development based on DDS, thereby improving the service development efficiency, shortening the service development cycle, and increasing the maintainability, reliability and reusability of the service code.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of automobile software development, and in particular to a DDS-based vehicle service code generation and compilation method and a readable storage medium. Background Art

[0002] "Software-defined cars" is the direction of future cars. With the deepening of automobile intelligence and networking, the complexity of functions such as automatic driving, in-car entertainment, remote diagnosis and upgrade will become increasingly higher. If the traditional signal-based architecture is still used to achieve this, the entire system will become extremely complex and lack flexibility and scalability. The service-oriented architecture can support complex application systems, provide maximum flexibility and scalability in processing distribution and computing resource allocation, and better support the distributed deployment and update iteration of software, which can provide a good solution for future vehicle software services.

[0003] The implementation of service-oriented architecture needs to be based on service communication middleware. Data Distribution Service (DDS) is a new generation of distributed real-time communication middleware released by the Object Management Group (OMG). It adopts a publish / subscribe architecture, emphasizes data-centricity, and provides a rich service quality strategy to ensure real-time, efficient, and flexible data distribution, which can meet the needs of various distributed real-time communication applications. DDS can provide the environment required for the development and operation of upper-level application software, making it convenient for developers to quickly, efficiently, and flexibly develop and integrate autonomous driving software.

[0004] However, to develop in-vehicle functional service applications based on DDS communication middleware, it is necessary to be familiar with and master the basic principles of DDS and related underlying code interfaces, which brings great challenges to in-vehicle functional service developers. To this end, the Chinese patent with publication number CN105205183B discloses "A method for automatically building a DDS distributed system based on XML", which uses XML system solution files to describe the system's participant information, order release information, object model structure information, etc., and then generates DDS runtime plug-ins through automatic code generation and compilation to build a DDS distributed system.

[0005] However, when developing functional service applications, the above existing solutions need to integrate the DDS running plug-in on each node of the DDS distributed system, which increases the complexity of the system. At the same time, the existing solutions require more participation from developers throughout the development life cycle of the in-vehicle service, which increases the threshold for DDS-based service development and reduces the maintainability, reliability and reusability of the service code. Therefore, how to design an in-vehicle service code generation and compilation method that can reduce the system complexity and the threshold for DDS-based service development is a technical problem that needs to be solved urgently. Summary of the invention

[0006] In view of the above-mentioned deficiencies in the prior art, the technical problem to be solved by the present invention is: how to provide a DDS-based in-vehicle service code generation and compilation method to reduce the complexity of the system and the threshold for service development based on DDS, thereby improving the service development efficiency, shortening the service development cycle, and increasing the maintainability, reliability and reusability of the service code.

[0007] In order to solve the above technical problems, the present invention adopts the following technical solutions:

[0008] The DDS-based vehicle service code generation and compilation method includes the following steps:

[0009] S1: Define the in-vehicle functional service content;

[0010] S2: template file that defines code generation;

[0011] S3: Read the configuration file, and then generate a corresponding code file through the template file generated by the vehicle function service content rendering code, so that the corresponding function service business logic code can be written based on the code file;

[0012] S4: Obtain the business logic code of the functional service and automatically compile it to generate the corresponding executable file, and then deploy the executable file to the running server with the data distribution service environment to run the service.

[0013] Preferably, in step S1, the vehicle-mounted functional service content is defined by electronic spreadsheet software.

[0014] Preferably, in step S1, the in-vehicle functional service content includes but is not limited to a service name, a method name, a method type, a method input parameter type, a method output parameter type, a method requirement subject, and a method reply subject.

[0015] Preferably, in step S2, the template file generated by the code is defined by extensible markup language.

[0016] Preferably, in step S2, the types of template files include but are not limited to interface description language template files, general configuration file template files, data distribution service core code template files and adaptation layer code template files.

[0017] Preferably, in step S2, the content of the template file includes but is not limited to the file name, file path and file content.

[0018] Preferably, in step S3, the code file is generated by an automatic code generation engine, which specifically includes the following steps:

[0019] S301: parsing service content to obtain corresponding programming language object data;

[0020] S302: Read the template file generated by the code and obtain the corresponding file name, file path and file content;

[0021] S303: Rendering the file content of the template file using the programming language object data through the automatic code generation engine;

[0022] S304: Output the rendered file content to a file to generate a corresponding code file.

[0023] Preferably, in step S3, the generated code file is uploaded to a code hosting platform, so that the corresponding code file can be downloaded from the code hosting platform to implement writing of the corresponding functional service business logic code based on the code file.

[0024] Preferably, in step S4, the acquired functional service business logic code is uploaded to a compilation server through an automatic compilation engine for automatic compilation and generation of a corresponding executable file.

[0025] The present invention also discloses a readable storage medium on which a computer management program is stored. When the computer management program is executed by a processor, the steps of the DDS-based vehicle service code generation and compilation method of the present invention are implemented.

[0026] Compared with the prior art, the vehicle service code generation and compilation method of the present invention has the following beneficial effects:

[0027] The present invention does not need to integrate the DDS running plug-in on each node, which can reduce the complexity of the system; at the same time, the present invention generates a corresponding code file through a template file generated by the vehicle-mounted functional service content rendering code, so that developers only need to define the vehicle-mounted service content and write the corresponding functional service business logic code based on the code file, which can lower the threshold for developers to develop services based on DDS, thereby improving the development efficiency of services and shortening the development cycle of services. Secondly, the present invention obtains the functional service business logic code and automatically compiles it to generate the corresponding executable file, so that developers can directly obtain the executable file without setting up a separate compilation environment, reducing compilation errors caused by different compilation environments, making the service development compilation based on DDS simpler and more efficient, thereby increasing the maintainability, reliability and reusability of the service code. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] In order to make the purpose, technical solution and advantages of the invention more clear, the present invention will be further described in detail below with reference to the accompanying drawings, in which:

[0029] Figure 1 Logic block diagram of the compilation method for DDS-based vehicle service code generation. DETAILED DESCRIPTION

[0030] The following is a further detailed description through specific implementation methods:

[0031] Embodiment 1:

[0032] This embodiment discloses a DDS-based vehicle service code generation and compilation method.

[0033] like Figure 1 As shown, the DDS-based vehicle service code generation and compilation method includes the following steps:

[0034] S1: Define the in-vehicle functional service content;

[0035] S2: template file that defines code generation;

[0036] S3: Read the configuration file, and then generate a corresponding code file through the template file generated by the vehicle function service content rendering code, so that the corresponding function service business logic code can be written based on the code file;

[0037] S4: Obtain the functional service business logic code and automatically compile it to generate a corresponding executable file, and then deploy the executable file to a running server with a data distribution service (DDS) environment to run the service. In this embodiment, the obtained functional service business logic code is uploaded to the compilation server through an automatic compilation engine for automatic compilation and generation of a corresponding executable file.

[0038] It should be noted that the DDS-based vehicle service code generation and compilation method of the present invention can generate corresponding software codes or software services through program programming, and then can be run and implemented on servers and computers.

[0039] The present invention does not need to integrate the DDS running plug-in on each node, which can reduce the complexity of the system; at the same time, the present invention generates a corresponding code file through a template file generated by the vehicle-mounted functional service content rendering code, so that developers only need to define the vehicle-mounted service content and write the corresponding functional service business logic code based on the code file, which can lower the threshold for developers to develop services based on DDS, thereby improving the development efficiency of services and shortening the development cycle of services. Secondly, the present invention obtains the functional service business logic code and automatically compiles it to generate the corresponding executable file, so that developers can directly obtain the executable file without setting up a separate compilation environment, reducing compilation errors caused by different compilation environments, making the service development compilation based on DDS simpler and more efficient, thereby increasing the maintainability, reliability and reusability of the service code.

[0040] During the specific implementation process, the in-vehicle functional service content is defined through electronic spreadsheet software (in this embodiment, the electronic spreadsheet software is Excel). The in-vehicle functional service content includes but is not limited to the service name, method name, method type (remote procedure call / publish and subscribe), method input parameter type, method output parameter type, method request (Request) subject and method reply (Reply) subject.

[0041] In this embodiment, the format of Excel defining the in-vehicle function service content is as follows:

[0042]

[0043] In the present invention, developers only need to define the in-vehicle service content through Excel and write the corresponding functional service business logic code to realize DDS-based service development, which can lower the threshold for developers to develop services based on DDS, thereby improving service development efficiency and shortening the service development cycle.

[0044] In the specific implementation process, the template file generated by the code is defined by using the extensible markup language (in this embodiment, the extensible markup language is XML).

[0045] In this embodiment, the content of the template file includes but is not limited to a file name (fileName), a file path (path) and a file content (content). The file name indicates the name of the generated code file, the file path indicates the directory of the server where the generated code file is stored, and the file content indicates the specific content of the generated code file.

[0046] In this embodiment, the types of template files include but are not limited to interface description language (IDL) template files, general configuration file (in this embodiment, the general configuration file uses ARXML) template files, data distribution service (DDS) core code template files and adaptation layer code template files.

[0047] The core code template file of the Data Distribution Service (DDS) is as follows:

[0048]

[0049]

[0050] In step S3, a code file is generated by an automatic code generation engine, which specifically includes the following steps:

[0051] S301: Parse the service content to obtain corresponding programming language (Java) object data;

[0052] S302: Read the template file generated by the code and obtain the corresponding file name, file path and file content;

[0053] S303: Rendering the file content of the template file using programming language (Java) object data through an automatic code generation engine;

[0054] S304: Output the rendered file content to a file to generate a corresponding code file.

[0055] In this embodiment, FreeMarker is used as the automatic code generation engine. The generated code file is as follows:

[0056]

[0057]

[0058] During the specific implementation process, the generated code files are uploaded to the code hosting platform (in this embodiment, the code hosting platform selects the GitLab warehouse, and the code files are uploaded to the GitLab warehouse through the jgit toolkit), so that (developers) can download the corresponding code files from the code hosting platform to realize the writing of corresponding functional service business logic codes based on the code files.

[0059] Through the above-mentioned template file and code file generation steps, the present invention can effectively realize the generation of corresponding code files through the template files generated by the vehicle-mounted functional service content rendering code, so that developers only need to define the vehicle-mounted service content and write the corresponding functional service business logic code based on the code file, which can lower the service development threshold for developers based on DDS, thereby improving the service development efficiency and shortening the service development cycle.

[0060] Embodiment 2:

[0061] This embodiment discloses a readable storage medium.

[0062] A readable storage medium stores a computer management program, which, when executed by a processor, implements the steps of the DDS-based vehicle service code generation and compilation method of the present invention. The readable storage medium may be a device with a readable storage function such as a USB flash drive or a computer.

[0063] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit the technical solution. Those skilled in the art should understand that those modifications or equivalent substitutions of the technical solution of the present invention that do not depart from the purpose and scope of the technical solution should be included in the scope of the claims of the present invention.

Claims

1. A DDS-based vehicle service code generation and compilation method, characterized in that: The following steps are involved: S1: Define the in-vehicle functional service content; S2: template file that defines code generation; S3: Read the configuration file, and then generate a corresponding code file through the template file generated by the vehicle function service content rendering code, so that the corresponding function service business logic code can be written based on the code file; S4: Obtain the business logic code of the functional service and automatically compile it to generate the corresponding executable file, and then deploy the executable file to the running server with the data distribution service environment to run the service.

2. The DDS-based vehicle service code generation and compilation method according to claim 1, characterized in that: In step S1, the vehicle-mounted functional service content is defined by electronic spreadsheet software.

3. The DDS-based vehicle service code generation and compilation method according to claim 2, characterized in that: In step S1, the in-vehicle function service content includes but is not limited to the service name, method name, method type, method input parameter type, method output parameter type, method requirement subject and method reply subject.

4. The DDS-based vehicle service code generation and compilation method according to claim 1, characterized in that: In step S2, a template file generated by the code is defined by extensible markup language.

5. The DDS-based vehicle service code generation and compilation method according to claim 1, characterized in that: In step S2, the types of template files include but are not limited to interface description language template files, general configuration file template files, data distribution service core code template files and adaptation layer code template files.

6. The DDS-based vehicle service code generation and compilation method according to claim 1, characterized in that: In step S2, the content of the template file includes but is not limited to the file name, file path and file content.

7. The DDS-based vehicle service code generation and compilation method according to claim 6, characterized in that: In step S3, a code file is generated by an automatic code generation engine, which specifically includes the following steps: S301: parsing service content to obtain corresponding programming language object data; S302: Read the template file generated by the code and obtain the corresponding file name, file path and file content; S303: Rendering the file content of the template file using the programming language object data through the automatic code generation engine; S304: Output the rendered file content to a file to generate a corresponding code file.

8. The DDS-based vehicle service code generation and compilation method according to claim 1, characterized in that: In step S3, the generated code file is uploaded to the code hosting platform, so that the corresponding code file can be downloaded from the code hosting platform to implement writing of the corresponding functional service business logic code based on the code file.

9. The DDS-based vehicle service code generation and compilation method according to claim 1, characterized in that: In step S4, the acquired functional service business logic code is uploaded to the compilation server through the automatic compilation engine for automatic compilation and generation of a corresponding executable file.

10. A readable storage medium, characterized in that: A computer management program is stored thereon, and when the computer management program is executed by a processor, the steps of the DDS-based vehicle service code generation and compilation method as described in any one of claims 1 to 9 are implemented.