Service architecture code generation method, device and equipment, vehicle and storage medium
By obtaining and processing the communication protocol identifier of the vehicle service content, the service architecture code is generated, which solves the problem of low development efficiency under different communication protocols in the existing technology, realizes automatic code generation under multiple protocols, and improves development efficiency and System flexibility.
Patent Information
- Application Number
- CN202310214098.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-28
- Publication Date
- 2024-08-30
AI Technical Summary
The configuration tool software based on the Autosar architecture can only encode service content under the SOME/IP communication protocol, which results in the need to replace the configuration tool software under other communication protocols, resulting in low development efficiency of application services.
By obtaining the vehicle service content and its bound communication protocol identifier, abstraction processing is performed to generate the current system code, and instantiation processing is performed according to the target matching rules to obtain the service architecture code and realize automatic service architecture code generation for multiple communication protocols.
It improves the development efficiency of application services, allows service architecture code to be generated under different communication protocols, and enhances the flexibility and scalability of the system.
Smart Images

Figure CN118567618A
Abstract
Description
Technical Field
[0001] The present disclosure relates to the technical field of vehicle-mounted software development, and in particular to a service architecture code generation method, device, equipment, vehicle and storage medium. Background Art
[0002] "Software-defined cars" is the direction of future cars. With the deepening of car intelligence and networking, the complexity of functions such as automatic driving, in-car entertainment, and remote diagnosis and upgrade will become increasingly higher.
[0003] The service-oriented architecture (SOA) can support complex application systems, provide maximum flexibility and scalability in processing distribution and computing resource allocation, and better support distributed deployment and update iteration of software, providing a good solution for future vehicle software services.
[0004] The configuration tool software based on the Autosar architecture can only realize the encoding of service content under the SOME / IP communication protocol, that is, the service content is encoded using the programming language corresponding to the SOME / IP communication protocol. If you want to obtain the corresponding encoding of the service content under other communication protocols, you need to replace other configuration tool software and use the programming corresponding to the communication protocol through the configuration tool software to re-encode the service content, resulting in low efficiency in application service development. Summary of the invention
[0005] The present disclosure provides a service architecture code generation method, device, equipment, vehicle and storage medium to realize automatic service architecture code generation for multiple communication protocols, effectively improving the development efficiency of application services.
[0006] In a first aspect, an embodiment of the present disclosure provides a method for generating service architecture code, comprising:
[0007] Obtaining vehicle service content and a communication protocol identifier bound to the vehicle service content;
[0008] Abstracting the vehicle service content to generate a current system code corresponding to the vehicle service content;
[0009] Obtaining a target matching rule corresponding to the bound communication protocol identifier;
[0010] The current system code is instantiated using the target matching rule to obtain a service architecture code.
[0011] In one embodiment of the present disclosure, the step of obtaining the communication protocol identifier bound to the vehicle service content includes:
[0012] In response to receiving a communication protocol identifier modification instruction input by a user, releasing the binding relationship between the bound communication protocol identifier and the vehicle service content;
[0013] Obtaining a new communication protocol identifier corresponding to the modification instruction;
[0014] A binding relationship between the new communication protocol identifier and the vehicle service content is established to obtain the communication protocol identifier bound to the vehicle service content.
[0015] In one embodiment of the present disclosure, the communication protocol includes at least one of the following: a data distribution service DDS communication protocol, an IP-based scalable service-oriented SOME / IP communication protocol, and an inter-process communication IPC protocol;
[0016] When the communication protocol is the DDS communication protocol, the target matching rule includes a correspondence between the current system code and the interactive data language IDL class code;
[0017] When the communication protocol is the SOME / IP communication protocol, the matching rule includes a correspondence between the current system code and the ARXML class code;
[0018] When the communication protocol is an IPC communication protocol, the matching rule includes a corresponding relationship between a current system code and an extensible markup language XML class code.
[0019] In one embodiment of the present disclosure, the vehicle service content is represented in the form of a graph structure, and the abstract processing of the vehicle service content to generate the current system code corresponding to the vehicle service content includes:
[0020] Generate a data structure based on the connection relationship between each node in the graph structure;
[0021] Get the content code included in each node;
[0022] The content code is written as a data element into a set position of the data structure to obtain the current system code.
[0023] In one embodiment of the present disclosure, the target matching rule includes: a first type of data element defined by a system code corresponding standard, a second type of data element corresponding to a communication protocol standard, and a corresponding relationship between the first type of data element and the second type of data element;
[0024] The current system code is instantiated using the target matching rule to obtain a service architecture code, including:
[0025] The first-category data elements included in the current system code are traversed, and a corresponding second-category data element is created for each first-category data element to obtain a service architecture code.
[0026] In one embodiment of the present disclosure, it further includes: obtaining a verification rule corresponding to the bound communication protocol identifier;
[0027] Obtain code statements included in the service architecture code; for each code statement, determine whether the code statement complies with verification rules; if it complies with the verification rules, the verification passes; if it does not comply with the verification rules, the verification fails.
[0028] In one embodiment of the present disclosure, the service architecture code includes an interface file, which is used to define various interfaces and / or functions, wherein the interfaces and / or functions are used to transmit data with the application code.
[0029] In a second aspect, an embodiment of the present disclosure provides a service architecture code generation device, including:
[0030] An acquisition module, used to acquire vehicle service content and a communication protocol identifier bound to the vehicle service content;
[0031] A code generation module, used for abstracting the vehicle service content and generating a current system code corresponding to the vehicle service content;
[0032] A matching rule acquisition module, used to acquire a target matching rule corresponding to the bound communication protocol identifier;
[0033] The code processing module is used to process the current system code using the target matching rule to obtain a service architecture code.
[0034] In one embodiment of the present disclosure, the acquisition module includes: a binding release unit, used to release the binding relationship between the bound communication protocol identifier and the vehicle service content in response to receiving a communication protocol identifier modification instruction input by a user; an identifier acquisition unit, used to obtain a new communication protocol identifier corresponding to the modification instruction; and a binding establishment unit, used to establish a binding relationship between the new communication protocol identifier and the vehicle service content, and obtain the communication protocol identifier bound to the vehicle service content.
[0035] In one embodiment of the present disclosure, the communication protocol includes at least one of the following: a data distribution service DDS communication protocol, an IP-based scalable service-oriented SOME / IP communication protocol, and an inter-process communication IPC protocol;
[0036] When the communication protocol is the DDS communication protocol, the target matching rule includes a correspondence between the current system code and the interactive data language IDL class code;
[0037] When the communication protocol is the SOME / IP communication protocol, the matching rule includes a correspondence between the current system code and the ARXML class code;
[0038] When the communication protocol is an IPC communication protocol, the matching rule includes a corresponding relationship between a current system code and an extensible markup language XML class code.
[0039] In one embodiment of the present disclosure, the vehicle service content is represented in the form of a graph structure, and the code generation module includes: a data structure generation unit, which is used to generate a data structure based on the connection relationship between each node in the graph structure; a content code acquisition unit, which is used to acquire the content code included in each node; and a current system code determination unit, which is used to write the content code as a data element into a set position of the data structure to obtain the current system code.
[0040] In one embodiment of the present disclosure, the target matching rules include: the first type of data elements defined by the system code corresponding standard, and the second type of data elements corresponding to the communication protocol standard, and the corresponding relationship between the first type of data elements and the second type of data elements; a code processing module, which is specifically used to traverse the first type of data elements included in the current system code, create a corresponding second type of data element for each first type of data element, and obtain a service architecture code.
[0041] In one embodiment of the present disclosure, it also includes: a verification rule acquisition module, used to obtain the verification rule corresponding to the bound communication protocol identifier; a code verification module, used to obtain the code statements included in the service architecture code; for each code statement, determine whether the code statement complies with the verification rule; if it complies with the verification rule, the verification passes; if it does not comply with the verification rule, the verification fails.
[0042] In one embodiment of the present disclosure, the service architecture code includes an interface file, which is used to define various interfaces and / or functions, wherein the interfaces and / or functions are used to transmit data with the application code.
[0043] In a third aspect, an embodiment of the present disclosure provides an electronic device, including:
[0044] Memory;
[0045] Processor; and
[0046] Computer programs;
[0047] The computer program is stored in the memory and is configured to be executed by the processor to implement the service architecture code generation method as described in the first aspect.
[0048] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program is executed by a processor to implement the service architecture code generation method as described in the first aspect.
[0049] In a fifth aspect, an embodiment of the present disclosure provides a vehicle, comprising the electronic device as described in the third aspect above.
[0050] The service architecture code generation method, device, equipment, vehicle and storage medium provided in the embodiments of the present disclosure include: obtaining vehicle service content and the communication protocol identifier bound to the vehicle service content; abstracting the vehicle service content to generate the current system code corresponding to the vehicle service content; obtaining the target matching rule corresponding to the bound communication protocol identifier; and instantiating the current system code using the target matching rule to obtain the service architecture code. The technical solution provided by the present disclosure first abstracts the vehicle service content to obtain the current system code, and then determines the target matching rule that matches the communication protocol according to the bound communication protocol code, and instantiates the current system code according to the target matching rule to obtain the service architecture code. Different communication protocol identifiers can match different matching rules, and then obtain service architecture codes corresponding to different communication protocols, thereby realizing automatic service architecture code generation for multiple communication protocols and effectively improving the development efficiency of application services. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0052] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0053] Figure 1 A flowchart of a method for generating service architecture code provided in an embodiment of the present disclosure;
[0054] Figure 2 A schematic diagram of a service architecture code generation system provided in an embodiment of the present disclosure;
[0055] Figure 3A schematic diagram of the structure of a service architecture code generation device provided in an embodiment of the present disclosure;
[0056] Figure 4 A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0057] In order to more clearly understand the above-mentioned objectives, features and advantages of the present disclosure, the scheme of the present disclosure will be further described below. It should be noted that the embodiments of the present disclosure and the features in the embodiments can be combined with each other without conflict.
[0058] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.
[0059] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.
[0060] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.
[0061] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0062] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0063] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only for illustrative purposes and are not used to limit the scope of these messages or information.
[0064] "Software-defined cars" is the direction of future cars. With the deepening of car intelligence and networking, the complexity of functions such as automatic driving, in-car entertainment, and 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.
[0065] The service-oriented architecture (SOA) can support complex application systems, provide maximum flexibility and scalability in processing distribution and computing resource allocation, and better support distributed deployment and update iteration of software, providing a good solution for future vehicle software services.
[0066] As the core component of new energy vehicles, the ECU (Electronic Control Unit) controller is responsible for vehicle status monitoring and safety. The reliability and stability of the ECU controller are important parameter indicators when new energy vehicles are working. Multiple software programs are deployed on the ECU to implement various functions provided by the on-board terminal. Based on the current electronic and electrical architecture of the whole vehicle and the status of each electronic control unit and actuator, the hardware resources of the electronic control unit can be analyzed and mapped to the functions of the whole vehicle based on this. The analyzed hardware resources need to be classified according to the hardware resource type to facilitate the unified standard for subsequent interface definition. Then, according to the functional definition of the whole vehicle, the hardware resources are associated, and the corresponding part of the control logic is bound to the minimum hardware resource module to facilitate the subsequent service logic design.
[0067] For a certain function of the whole vehicle, it can be realized by different types of actuators, but the types of actuators used in the industry are similar, and the corresponding electronic control unit is used to control them. Therefore, the service-oriented design and implementation of the hardware resources of the electronic control unit have good versatility. When the electronic control unit is integrated, the various software modules based on the service of each minimum unit can be directly transplanted and integrated. The functional logic of this part is also integrated again accordingly, but it will not cause a major impact on the entire system, thereby reducing R&D costs and improving upgrade iteration efficiency. Furthermore, the service-oriented abstraction of the whole vehicle based on hardware resources can flexibly combine hardware resources. The integrated hardware resources can be used as the design input for defining the overall hardware resources of the electronic control unit, which promotes the flexibility of the design of the electronic and electrical architecture of the whole vehicle.
[0068] The configuration tool software based on the Autosar architecture can only realize the encoding of service content under the SOME / IP communication protocol, that is, the service content is encoded using the programming language corresponding to the SOME / IP communication protocol. If you want to obtain the corresponding encoding of the service content under other communication protocols, you need to replace other configuration tool software and use the configuration tool software to re-encode the service content using the programming corresponding to the communication protocol, resulting in low efficiency in the development of application services.
[0069] In order to solve all or part of the above-mentioned technical problems, an embodiment of the present disclosure provides a method for generating a service architecture code, including: obtaining vehicle service content and a communication protocol identifier bound to the vehicle service content; abstracting the vehicle service content to generate a current system code corresponding to the vehicle service content; obtaining a target matching rule corresponding to the bound communication protocol identifier; and using the target matching rule to instantiate the current system code to obtain a service architecture code.
[0070] In the technical solution provided by the embodiment of the present disclosure, the vehicle service content is firstly processed abstractly to obtain the current system code, and then the target matching rule matching the communication protocol is determined according to the bound communication protocol code, and the current system code is instantiated according to the target matching rule to obtain the service architecture code. Different communication protocol identifiers can be matched to different matching rules, and then the service architecture codes corresponding to different communication protocols can be obtained, so as to realize the automatic service architecture code generation of multiple communication protocols, and effectively improve the development efficiency of application services.
[0071] Figure 1 This is a flowchart of a service architecture code generation method in an embodiment of the present disclosure. This embodiment is applicable to the generation of service architecture codes for vehicles. The method can be executed by a service architecture code generation device. The service architecture code generation device can be implemented in software and / or hardware. The service architecture code generation device can be configured in an electronic device.
[0072] Specifically, Figure 1 As shown, the service architecture code generation method provided by the embodiment of the present disclosure mainly includes steps S101-S104.
[0073] S101. Obtain vehicle service content and a communication protocol identifier bound to the vehicle service content.
[0074] The vehicle service can be understood as the functional service provided by the vehicle end to the vehicle owner, such as navigation function, multimedia playback function, driving record function, etc. The vehicle service content can be understood as the file describing the electronic and electrical architecture of the whole vehicle.
[0075] In the embodiment of the present disclosure, the vehicle service content can be designed by the designer at the front end and then uploaded to the electronic device that executes the service architecture code generation method provided by the embodiment of the present disclosure. The embodiment of the present disclosure does not limit the design method of the vehicle service content.
[0076] Furthermore, according to the received vehicle service content, the service hierarchical relationship is abstracted and a data structure matching it is formed. The data structure refers to a data structure reflecting the logical relationship between data elements, and the logical relationship refers to the front-end relationship between data elements.
[0077] In the disclosed embodiments, the Service Oriented Architecture (SOA) is a component model that connects different functional units of an application (called services) through well-defined interfaces and contracts between these services. As the guiding direction for the current development of the vehicle software architecture, the service-oriented architecture defines and describes each function in the vehicle as a service. The service itself needs to be accurately described and encapsulated, and services are independent of each other. Services can be distributed in different system environments, and services can communicate with each other. Communication does not require that all services are in the same system environment, but only needs to follow the same communication protocol. Services all come with clear interface description files, and calling the interfaces of each or a single service in a specific order can implement the corresponding business processes.
[0078] In the disclosed embodiments, the communication protocol identifier refers to an identifier used to represent the communication protocol. The disclosed embodiments no longer specify the specific representation of the communication protocol identifier. The communication protocol identifier bound to the vehicle service content refers to the identifier corresponding to the communication protocol used to write the vehicle service content, wherein the communication protocol identifier bound to the vehicle service content can be freely bound by the front-end staff, and the disclosed embodiments do not specify which communication protocol the vehicle service content uses.
[0079] In one embodiment of the present disclosure, the communication protocol includes at least one of the following: a data distribution service DDS communication protocol, an IP-based scalable service-oriented SOME / IP communication protocol, and an inter-process communication IPC protocol.
[0080] The service provider and the service consumer interact based on service-based communication. The service-based communication defined by the AutoSa (AUTomotive Open System Architecture) includes the data distribution service DDS communication protocol, the IP-based scalable service-oriented SOME / IP communication protocol, and the inter-process communication IPC protocol. Each electronic control unit implements the corresponding communication middle layer according to the definition and verifies it during testing.
[0081] Among them, Data Distribution Service (DDS) is a data-centric middleware protocol and API standard released by the Object Management Group (OMG). It adopts a distributed publish / subscribe architecture, provides communication services in the form of middleware, and emphasizes data-centricity. DDS middleware is a software layer that abstracts applications from the details of the operating system, network transmission, and underlying data formats. The same concepts and APIs are provided to different programming languages, allowing applications to exchange information between different operating systems, programming languages, and processing architectures. The underlying details including data transmission format, discovery, connection, reliability, protocol, QoS strategy, etc. are managed by the middleware.
[0082] Among them, SOME / IP, the scalable service-oriented middleware based on IP, is the full name of Scalable service-Oriented MiddlewarE over IP. It is an automotive middleware solution for control messages and a service-oriented scalable protocol.
[0083] IPC, the full name of which is Inter Process Communication, is inter-process communication. Two processes on the same machine can use the IPC protocol, but the IPC protocol cannot cross physical machines. IPC includes centralized methods such as shared memory, queues, and semaphores.
[0084] S102: Abstract the vehicle service content to generate a current system code corresponding to the vehicle service content.
[0085] In one embodiment of the present disclosure, the vehicle service content is represented in the form of a graph structure, and the vehicle service content is abstracted to generate a current system code corresponding to the vehicle service content, including: generating a data structure based on the connection relationship between each node in the graph structure; obtaining the content code included in each node; writing the content code as a data element into a set position of the data structure to obtain the current system code.
[0086] In the disclosed embodiment, the designer designs the service architecture at the front end, and receives the vehicle service content uploaded by the designer through the front-end device. Among them, the vehicle service content is represented in the form of a graph structure, and each graph node in the graph structure represents the association relationship between the vehicle service levels. The service level can be understood as the level corresponding to each functional service. For example: the wiper control function needs to obtain the weather conditions of the vehicle's location, and the wiper control function service level needs an interface to obtain the positioning information in the navigation service function. The wiper control function needs an interface to connect with the navigation function. Another example: the breathing lights in the car need to move with the music, and the same breathing light control function service and the multimedia control function service have an association relationship.
[0087] In the disclosed embodiment, the association relationship between multiple service levels included in the graph structure is abstracted to obtain a corresponding data structure. The corresponding data structure means that the data structure can clearly represent the association relationship between the service levels. The content code included in each graph node is obtained, and the content code is written as a data element into the set position of the data structure to obtain the current system code.
[0088] S103: Obtain a target matching rule corresponding to the bound communication protocol identifier.
[0089] In one embodiment of the present disclosure, a matching rule corresponding to a communication protocol identifier is pre-set. When a bound communication protocol identifier is obtained, a query is performed in the above correspondence relationship based on the communication protocol identifier, and the matching rule obtained by the query is used as the target matching rule corresponding to the bound communication protocol identifier.
[0090] In one embodiment of the present disclosure, according to the communication protocol bound to the above vehicle service, the staff needs to set different configuration information according to different communication protocols, wherein the configuration information can also be referred to as configuration items. The specific parameters of the configuration information are set by the staff and are not specifically limited in the embodiments of the present disclosure.
[0091] In the embodiment of the present disclosure, the communication protocol includes at least one of the following: a data distribution service DDS communication protocol, an IP-based extensible service-oriented SOME / IP communication protocol, and an inter-process communication IPC protocol; when the communication protocol is the DDS communication protocol, the target matching rule includes the correspondence between the current system code and the interactive data language IDL class code; when the communication protocol is the SOME / IP communication protocol, the matching rule includes the correspondence between the current system code and the ARXML class code; when the communication protocol is the IPC communication protocol, the matching rule includes the correspondence between the current system code and the extensible markup language XML class code.
[0092] S104: Utilize the target matching rule to instantiate the current system code to obtain a service architecture code.
[0093] In the disclosed embodiment, the service architecture code is similar to the middle-layer software, which is a software layer between the communication protocol layer and the application program, so that the various components of the system can communicate and share data more easily. The service architecture code simplifies the development of distributed systems, allowing software developers to focus on the business of the application itself, rather than spending energy on studying the mechanism of transmitting information between the application program and the system.
[0094] In one embodiment of the present disclosure, the service architecture code includes an interface file, which is used to define various interfaces and / or functions, wherein the interfaces and / or functions are used to transmit data with the application code.
[0095] Specifically, the service architecture code includes code files and interface files, wherein the types of the interface files include: interface description language IDL type, general configuration information ARXML type, extensible markup language XML type, and the types of the code files include: C++ type, JAVA type.
[0096] In one embodiment of the present disclosure, a corresponding standard interface file is defined for vehicle service content. Services at different levels realize overall functions by calling interfaces and transferring information to each other. The calling methods and transferable data between services at two levels are solidified according to functional requirements, and then consistency can be guaranteed by following the standard interface design template.
[0097] The description language of the interface file may be any one of an interface description language IDL type, a general configuration information ARXML type, and an extensible markup language XML type, and the embodiment of the present disclosure does not make any specific limitation.
[0098] Among them, the types of the code files include: C++ type, JAVA type, and the code type of the service architecture code can be selected according to the code type adopted by the vehicle bottom layer or application layer.
[0099] In one embodiment of the present disclosure, for application software, the service architecture code has the best reusability, and can call the standard function interface reserved by the underlying software to manipulate the hardware, and does not need to care about the specific implementation details of the underlying software. This part of the software will have less dependence on the hardware platform. Usually, the service architecture code will involve various calling interfaces, and will convert data into data interfaces required by the specification to support the above calling interfaces and standardize the implementation of various applications.
[0100] In one embodiment of the present disclosure, the target matching rules include: first-category data elements defined by the system code corresponding standard, and second-category data elements corresponding to the communication protocol standard, and the corresponding relationship between the first-category data elements and the second-category data elements; the current system code is instantiated using the target matching rules to obtain a service architecture code, including: traversing the first-category data elements included in the current system code, creating a corresponding second-category data element for each first-category data element, and obtaining a service architecture code.
[0101] The first type of data element can be understood as the definition of data types included in the system code. The second type of data element can be understood as various types of data included in the communication protocol standard. The actual meanings of the first and second data elements are the same, but they are expressed in different machine languages. For example, if the first data element is "int 16" and the corresponding second type of data element is "short int 16", then create the corresponding "short int 16" for "int 16".
[0102] The instantiation operation is performed on each first-category data element in the current system code to obtain the service architecture code.
[0103] In one embodiment of the present disclosure, the method also includes: obtaining the verification rules corresponding to the bound communication protocol identifier; obtaining the code statements included in the service architecture code; for each code statement, determining whether the code statement complies with the verification rules; if it complies with the verification rules, the verification passes; if it does not comply with the verification rules, the verification fails.
[0104] In the disclosed embodiment, each layer of service data in the data structure is verified in layers, and after the verification is successful, an intermediate layer file is generated based on the data structure and the configuration information to ensure the availability of the final generated code.
[0105] Based on the above embodiments, a flowchart of service architecture code generation is provided in the embodiment of the present disclosure, such as Figure 2 As shown, the business process supported by the present disclosure is: the SOA architect designs the service architecture at the front end, obtains the vehicle service content, binds the service content with the communication protocol identifier, and sets the configuration information of the communication protocol. After completing and submitting the vehicle service content, the architect executes the service architecture code generation method provided in the embodiment of the present disclosure to generate the service architecture code; the service architecture code is abstractly verified layer by layer. If it passes, the generated service code will be automatically uploaded to the code repository, and the service developers will develop related functions based on the generated service architecture code.
[0106] The service architecture code generation method provided by the embodiment of the present disclosure includes: obtaining vehicle service content and the communication protocol identifier bound to the vehicle service content; abstracting the vehicle service content to generate the current system code corresponding to the vehicle service content; obtaining the target matching rule corresponding to the bound communication protocol identifier; and instantiating the current system code using the target matching rule to obtain the service architecture code. The technical solution provided by the present disclosure first abstracts the vehicle service content to obtain the current system code, and then determines the target matching rule that matches the communication protocol according to the bound communication protocol code, and instantiates the current system code according to the target matching rule to obtain the service architecture code. Different communication protocol identifiers can match different matching rules, and then obtain service architecture codes corresponding to different communication protocols, thereby realizing automatic service architecture code generation for multiple communication protocols and effectively improving the development efficiency of application services.
[0107] On the basis of the above-mentioned embodiments, the "generating the communication protocol identifier bound to the vehicle service content" is optimized in the embodiments of the present disclosure. After the optimization, the generating of the communication protocol identifier bound to the vehicle service content includes: in response to receiving a communication protocol identifier modification instruction input by a user, releasing the binding relationship between the bound communication protocol identifier and the vehicle service content; obtaining a new communication protocol identifier corresponding to the modification instruction; establishing a binding relationship between the new communication protocol identifier and the vehicle service content, and obtaining the communication protocol identifier bound to the vehicle service content.
[0108] In the embodiment of the present disclosure, after the user generates the service architecture code using the service architecture code generation method provided by the embodiment of the present disclosure, if the designer wants to use the service structure code under another communication protocol, the communication protocol identifier modification instruction input by the user can be received. The binding relationship between the bound communication protocol identifier and the vehicle service content is contacted; a new communication protocol identifier corresponding to the modification instruction is obtained; a binding relationship between the new communication protocol identifier and the vehicle service content is established to obtain the communication protocol identifier bound to the vehicle service content. And the step of "obtaining the target matching rule corresponding to the bound communication protocol identifier" and subsequent steps are re-executed.
[0109] For example: the vehicle service content described by the designer is bound to the SOME / IP communication protocol. Through the service architecture code generation method provided in the embodiment of the present disclosure, the service architecture code under the SOME / IP communication protocol is obtained. If the communication protocol corresponding to the communication protocol identifier modification instruction input by the user is the IPC communication protocol, then the binding relationship between the SOME / IP communication protocol and the vehicle service content is released, and the binding relationship between the SOME / IP communication protocol and the vehicle service content is established. And execute the step of "obtaining the target matching rule corresponding to the bound communication protocol identifier" and subsequent steps to obtain the service architecture code under the IPC communication protocol.
[0110] In the disclosed embodiment, it is only necessary to modify the communication protocol bound to the vehicle service content to obtain the service architecture code under the communication protocol, thereby effectively improving the development efficiency of the application service.
[0111] Figure 3 This is a structural diagram of a service architecture code generation device in an embodiment of the present disclosure. This embodiment can be applied to the situation of automatically generating an intermediate layer code framework. The service architecture code generation device can be implemented in software and / or hardware, and the service architecture code generation device can be configured in an electronic device.
[0112] Specifically, Figure 3 As shown, the service architecture code generation device provided by the embodiment of the present disclosure mainly includes an acquisition module 31, a code generation module 32, a matching rule acquisition module 33 and a code processing module 34.
[0113] Among them, the acquisition module 31 is used to obtain the vehicle service content and the communication protocol identifier bound to the vehicle service content; the code generation module 32 is used to abstract the vehicle service content and generate the current system code corresponding to the vehicle service content; the matching rule acquisition module 33 is used to obtain the target matching rule corresponding to the bound communication protocol identifier; the code processing module 34 is used to process the current system code using the target matching rule to obtain the service architecture code.
[0114] The service architecture code generation device provided by the embodiment of the present disclosure is used to execute the following process: obtain vehicle service content and the communication protocol identifier bound to the vehicle service content; abstract the vehicle service content to generate the current system code corresponding to the vehicle service content; obtain the target matching rule corresponding to the bound communication protocol identifier; use the target matching rule to instantiate the current system code to obtain the service architecture code. The technical solution provided by the present disclosure first abstracts the vehicle service content to obtain the current system code, and then determines the target matching rule that matches the communication protocol according to the bound communication protocol code, and instantiates the current system code according to the target matching rule to obtain the service architecture code. Different communication protocol identifiers can match different matching rules, and then obtain service architecture codes corresponding to different communication protocols, thereby realizing automatic service architecture code generation for multiple communication protocols and effectively improving the development efficiency of application services.
[0115] In one embodiment of the present disclosure, the acquisition module includes: a binding release unit, used to release the binding relationship between the bound communication protocol identifier and the vehicle service content in response to receiving a communication protocol identifier modification instruction input by a user; an identifier acquisition unit, used to obtain a new communication protocol identifier corresponding to the modification instruction; and a binding establishment unit, used to establish a binding relationship between the new communication protocol identifier and the vehicle service content, and obtain the communication protocol identifier bound to the vehicle service content.
[0116] In one embodiment of the present disclosure, the communication protocol includes at least one of the following: a data distribution service DDS communication protocol, an IP-based scalable service-oriented SOME / IP communication protocol, and an inter-process communication IPC protocol;
[0117] When the communication protocol is the DDS communication protocol, the target matching rule includes a correspondence between the current system code and the interactive data language IDL class code;
[0118] When the communication protocol is the SOME / IP communication protocol, the matching rule includes a correspondence between the current system code and the ARXML class code;
[0119] When the communication protocol is an IPC communication protocol, the matching rule includes a corresponding relationship between a current system code and an extensible markup language XML class code.
[0120] In one embodiment of the present disclosure, the vehicle service content is represented in the form of a graph structure, and the code generation module includes: a data structure generation unit, which is used to generate a data structure based on the connection relationship between each node in the graph structure; a content code acquisition unit, which is used to acquire the content code included in each node; and a current system code determination unit, which is used to write the content code as a data element into a set position of the data structure to obtain the current system code.
[0121] In one embodiment of the present disclosure, the target matching rules include: the first type of data elements defined by the system code corresponding standard, and the second type of data elements corresponding to the communication protocol standard, and the corresponding relationship between the first type of data elements and the second type of data elements; a code processing module, which is specifically used to traverse the first type of data elements included in the current system code, create a corresponding second type of data element for each first type of data element, and obtain a service architecture code.
[0122] In one embodiment of the present disclosure, it also includes: a verification rule acquisition module, used to obtain the verification rule corresponding to the bound communication protocol identifier; a code verification module, used to obtain the code statements included in the service architecture code; for each code statement, determine whether the code statement complies with the verification rule; if it complies with the verification rule, the verification passes; if it does not comply with the verification rule, the verification fails.
[0123] In one embodiment of the present disclosure, the service architecture code includes an interface file, which is used to define various interfaces and / or functions, wherein the interfaces and / or functions are used to transmit data with the application code.
[0124] Figure 3 The service architecture code generation device of the illustrated embodiment can be used to execute the technical solution of the above-mentioned method embodiment. Its implementation principle and technical effects are similar and will not be repeated here.
[0125] Figure 4 Schematic diagram of the structure of an electronic device in the embodiment of the present disclosure. Figure 4 , which shows a schematic diagram of the structure of an electronic device 400 suitable for implementing the embodiment of the present disclosure. The electronic device 400 in the embodiment of the present disclosure may include, but is not limited to, mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), wearable terminal devices, etc., and fixed terminals such as digital TVs, desktop computers, smart home devices, etc. Figure 3 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0126] like Figure 4 As shown, the electronic device 400 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 401, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 402 or a program loaded from a storage device 408 into a random access memory (RAM) 403 to implement the service architecture code generation method of the embodiment described in the present disclosure. In the RAM 403, various programs and data required for the operation of the terminal device 400 are also stored. The processing device 401, the ROM 402, and the RAM 403 are connected to each other via a bus 404. An input / output (I / O) interface 405 is also connected to the bus 404.
[0127] Typically, the following devices may be connected to the I / O interface 405: an input device 406 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 407 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 408 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 409. The communication device 409 may allow the terminal device 400 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 4 The terminal device 400 is shown to have various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.
[0128] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program contains a program code for executing the method shown in the flowchart, thereby implementing the service architecture code generation method as described above. In such an embodiment, the computer program can be downloaded and installed from the network through the communication device 409, or installed from the storage device 408, or installed from the ROM 402. When the computer program is executed by the processing device 401, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.
[0129] It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0130] In some embodiments, the client and the server may communicate using any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.
[0131] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0132] The computer-readable medium carries one or more programs. When the one or more programs are executed by the terminal device, the terminal device implements the method described in any one of the embodiments.
[0133] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages or a combination thereof, including, but not limited to, object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).
[0134] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0135] The units involved in the embodiments described in the present disclosure may be implemented by software or hardware, wherein the name of a unit does not, in some cases, limit the unit itself.
[0136] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.
[0137] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0138] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.
[0139] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.
[0140] Although the subject matter has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.
Claims
1. A method for generating service architecture code, characterized in that: include: Obtaining vehicle service content and a communication protocol identifier bound to the vehicle service content; Abstracting the vehicle service content to generate a current system code corresponding to the vehicle service content; Obtaining a target matching rule corresponding to the bound communication protocol identifier; The current system code is instantiated using the target matching rule to obtain a service architecture code.
2. The method according to claim 1, characterized in that The obtaining of the communication protocol identifier bound to the vehicle service content includes: In response to receiving a communication protocol identifier modification instruction input by a user, releasing the binding relationship between the bound communication protocol identifier and the vehicle service content; Obtaining a new communication protocol identifier corresponding to the modification instruction; A binding relationship between the new communication protocol identifier and the vehicle service content is established to obtain the communication protocol identifier bound to the vehicle service content.
3. The method according to claim 1, characterized in that The communication protocol includes at least one of the following: a data distribution service DDS communication protocol, an IP-based scalable service-oriented SOME / IP communication protocol, and an inter-process communication IPC protocol; When the communication protocol is the DDS communication protocol, the target matching rule includes a correspondence between the current system code and the interactive data language IDL class code; When the communication protocol is the SOME / IP communication protocol, the matching rule includes a correspondence between the current system code and the ARXML class code; When the communication protocol is an IPC communication protocol, the matching rule includes a corresponding relationship between a current system code and an extensible markup language XML class code.
4. The method according to claim 1, characterized in that: The vehicle service content is represented in the form of a graph structure, and the abstract processing of the vehicle service content is performed to generate a current system code corresponding to the vehicle service content, including: Generate a data structure based on the connection relationship between each node in the graph structure; Get the content code included in each node; The content code is written as a data element into a set position of the data structure to obtain the current system code.
5. The method according to claim 1, characterized in that The target matching rule includes: a first type of data element defined by the system code corresponding standard, a second type of data element corresponding to the communication protocol standard, and a corresponding relationship between the first type of data element and the second type of data element; The current system code is instantiated using the target matching rule to obtain a service architecture code, including: The first-category data elements included in the current system code are traversed, and a corresponding second-category data element is created for each first-category data element to obtain a service architecture code.
6. The method according to claim 1, characterized in that Also includes: Obtaining the verification rule corresponding to the bound communication protocol identifier; Obtain code statements included in the service architecture code; For each code statement, determine whether the code statement complies with the verification rule; If the verification rules are met, the verification passes; If the verification rules are not met, the verification fails.
7. The method according to claim 1, characterized in that The service architecture code includes an interface file, which is used to define various interfaces and / or functions, wherein the interfaces and / or functions are used to perform data transmission with the application code.
8. A service architecture code generation device, characterized in that: include: An acquisition module, used to acquire vehicle service content and a communication protocol identifier bound to the vehicle service content; A code generation module, used for abstracting the vehicle service content and generating a current system code corresponding to the vehicle service content; A matching rule acquisition module, used to acquire a target matching rule corresponding to the bound communication protocol identifier; The code processing module is used to process the current system code using the target matching rule to obtain a service architecture code.
9. An electronic device, characterized in that: include: Memory; processor; as well as Computer programs; The computer program is stored in the memory and is configured to be executed by the processor to implement the method according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the method according to any one of claims 1 to 7.
11. A vehicle comprising the electronic device as claimed in claim 9.
