Method and device for dynamically loading service channel and instance based on AutosraAP platform

By using file loaders to load service configuration files into shared memory in the AutoSar AP platform, adaptive applications can dynamically load channels and instances, solving complex deployment problems caused by hard coding and achieving a simplified project release deployment process.

CN119496815AActive Publication Date: 2025-02-21CHONGQING SELIS PHOENIX INTELLIGENT INNOVATION TECH CO LTD

Patent Information

Application Number
CN202411470125.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-21
Publication Date
2025-02-21
Estimated Expiration
2044-10-21

AI Technical Summary

Technical Problem

In the AutoSar AP platform, adaptive applications must hardcode channels and instances when creating or discovering services, resulting in complex project release and deployment process, and modifying code to recompile when migrating services.

Method used

The configuration files of the service to be accessed are loaded into the memory library of shared memory through a file loader. When an adaptive application needs to create or discover a service, it reads the configuration files from the memory library and dynamically loads channels and instances.

Benefits of technology

It implements adaptive applications dynamically load the latest channels and instances without recompiling the code, simplifying the project release and deployment process and reducing deployment risks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119496815A_ABST
    Figure CN119496815A_ABST
Patent Text Reader

Abstract

The invention relates to a method and device for dynamically loading a channel and an instance of a service based on an AutosraAP platform, and the method is characterized in that the method comprises the steps that a configuration file of the service to be accessed is loaded into a memory bank of a shared memory through a file loading program, the service to be accessed exists in the AutosraAP platform, and the configuration file of the service to be accessed is loaded into the memory bank of the shared memory through a file loading program; the configuration file comprises a communication channel and a service instance of the to-be-accessed service; when it is detected that a self-adaptive application needs to create a service or discover the service, the configuration file is read from the memory bank, and the self-adaptive application is an application program capable of dynamically adjusting functions and performance according to user requirements and environment; and transmitting the configuration file to the self-adaptive application, so that the self-adaptive application adopts the configuration file to create a service or discover a service. The project release deployment process is simplified.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method and device for dynamically loading service channels and instances based on an AutosraAP platform. Background Art

[0002] With the continuous development of automobile intelligence and diversification of functions, information interaction between ECUs (Electronic Control Units) and applications is becoming more and more frequent. Especially after the addition of advanced application scenarios such as autonomous driving, the dynamic interaction of large amounts of data leads to increased communication pressure. AutoSar AP (Automotive Profile) adopts a service-oriented architecture (SOA) designed for high-performance computing and communication to meet the communication needs of modern automotive intelligent ECUs.

[0003] When integrating someip, dds, ipc and other communication protocols, AP software developers use a unified interface to implement SOA service provision and service consumption, so as to achieve docking with different underlying channel protocols. Among them, the service consumer uses the Find Service method to discover the service, and the service provider uses the Create Service method to create the service. Both interfaces retain the same communication protocol and service instance (endpoint contains IP and port information). In the actual process of developing adaptive applications (Apache APISIX, adaptive applications), each service on the platform must specify the channel and instance in the code when creating and discovering services, and the channel and instance will be hard-coded into the adaptive application. If the service is migrated to other channel protocols, the adaptive application code must be modified and recompiled, and then burned to the board for operation, which will increase the process of project release and deployment. Summary of the invention

[0004] The present application provides a method and device for dynamically loading service channels and instances based on the AutosraAP platform to solve the problem of complex project release and deployment processes.

[0005] In the first aspect, the present application provides a method for dynamically loading channels and instances of services based on the AutosraAP platform, the method comprising: loading a configuration file of the service to be accessed into a memory library of a shared memory through a file loader, wherein the service to be accessed exists in the AutosraAP platform, and the configuration file includes a communication channel and a service instance of the service to be accessed; when it is detected that an adaptive application needs to create a service or discover a service, reading the configuration file from the memory library, wherein the adaptive application is an application that can dynamically adjust functions and performance according to user needs and environment; passing the configuration file to the adaptive application so that the adaptive application uses the configuration file to create a service or discover a service.

[0006] Optionally, loading the configuration file of the service to be accessed into the memory library of the shared memory through the file loader includes: allocating a shared memory segment for each configuration file of the service to be accessed in the memory library, wherein the configuration files of different services to be accessed are different; loading the configuration file of each service to be accessed into the corresponding shared memory segment through the file loader; reading the configuration file from the memory library includes: determining the target shared memory segment corresponding to the target access service, and reading the target configuration file of the target access service from the target shared memory segment.

[0007] Optionally, loading the configuration file of the service to be accessed into the memory library of the shared memory through the file loader includes: allocating the same shared memory segment for the configuration files of multiple services to be accessed in the memory library, wherein the configuration files of different services to be accessed are different; loading the configuration files of multiple services to be accessed into the same shared memory segment through the file loader; reading the configuration file from the memory library includes: reading the configuration files of all services to be accessed from the shared memory segment, and searching for the target configuration file of the target access service by traversing the data through the adaptive application.

[0008] Optionally, allocating the same shared memory segment for configuration files of multiple services to be accessed in the memory library includes: reading the configuration files of multiple services to be accessed from a set location through the file loader, and converting the configuration files into a set file format; creating a topic message through a Publisher constructor; calling a setting function and allocating the same shared memory segment for the configuration files in the memory library based on the topic message.

[0009] Optionally, loading multiple configuration files of services to be accessed into the same shared memory segment through the file loader includes: calling a Publisher method to pass in the configuration file in the set file format; converting the configuration file from the set file format into a data structure suitable for storage in the memory library; and calling a write method to write the converted configuration file into the shared memory segment.

[0010] Optionally, reading configuration files of all services to be accessed from the shared memory segment, and searching for a target configuration file of a target access service by traversing data through the adaptive application includes: obtaining a topic parameter and a callback function passed in by the adaptive application, wherein the topic parameter is used to determine the address of the shared memory segment to which the topic is subscribed, and the callback function is used to obtain the configuration file in the shared memory segment; returning the address of the shared memory segment to the adaptive application according to the topic parameter; obtaining configuration files of all services to be accessed from the address of the shared memory segment, and calling the callback function to send the configuration files to the adaptive application; traversing the configuration files of all services to be accessed through the adaptive application, and searching for the configuration file of the target access service.

[0011] Optionally, returning the address of the shared memory segment to the adaptive application according to the topic parameter includes: determining the memory segment address to be searched according to the topic parameter; judging whether the memory segment address exists in the memory library; if so, returning the memory segment address to the adaptive application.

[0012] In the second aspect, the present application provides a device for dynamically loading channels and instances of services based on the AutosraAP platform, the device comprising: a loading module, used to load the configuration file of the service to be accessed into the memory library of the shared memory through a file loader, wherein the service to be accessed exists in the AutosraAP platform, and the configuration file includes the communication channel and service instance of the service to be accessed; a reading module, used to read the configuration file from the memory library when it is detected that an adaptive application needs to create a service or discover a service, wherein the adaptive application is an application that can dynamically adjust functions and performance according to user needs and environment; a delivery module, used to deliver the configuration file to the adaptive application so that the adaptive application uses the configuration file to create a service or discover a service.

[0013] In a third aspect, the present application provides an electronic device comprising: at least one communication interface; at least one bus connected to the at least one communication interface; at least one processor connected to the at least one bus; and at least one memory connected to the at least one bus.

[0014] In a fourth aspect, the present application also provides a computer storage medium storing computer executable instructions, wherein the computer executable instructions are used to execute the method of dynamically loading channels and instances of services based on the AutosraAP platform as described in any of the above items of the present application.

[0015] Compared with the prior art, the technical solution provided by the embodiment of the present application has the following advantages: the communication channel and service instance of the service to be accessed are loaded into the memory library of the shared memory through a file loader, so that when the adaptive application needs to create a service or discover a service, the communication channel and service instance can be directly read from the memory library. Even if the communication channel and service instance change, only the configuration file needs to be replaced, and the communication channel and service instance in the memory library can be kept up to date without having to recompile the code of the adaptive application, thereby reducing the project release and deployment process and simplifying the project release and deployment process. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.

[0017] 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.

[0018] One or more embodiments are exemplarily described by pictures in the corresponding drawings, and these exemplified descriptions do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, and unless otherwise stated, the figures in the drawings do not constitute proportional limitations.

[0019] Figure 1 A flow chart of a method for dynamically loading service channels and instances based on the AutosraAP platform provided in an embodiment of the present application;

[0020] Figure 2 A schematic diagram of a system architecture of channels and instances based on the AutosraAP platform dynamically loading services provided in an embodiment of the present application;

[0021] Figure 3 A signaling diagram for accessing a shared memory segment based on a topic provided in an embodiment of the present application;

[0022] Figure 4 A signaling diagram for an adaptive application subscribing to shared memory data provided in an embodiment of the present application;

[0023] Figure 5 A schematic diagram of a process flow for creating services provided by an embodiment of the present application;

[0024] Figure 6 A schematic diagram of the service registration and discovery process provided in the embodiment of the present application;

[0025] Figure 7 A schematic diagram of the structure of a device for dynamically loading service channels and instances based on the AutosraAP platform provided in an embodiment of the present application;

[0026] Figure 8 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0027] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0028] The disclosure below provides many different embodiments or examples to implement different structures of the present invention. In order to simplify the disclosure of the present invention, the parts and settings of specific examples are described below. Of course, they are only examples, and the purpose is not to limit the present invention. In addition, the present invention can repeat reference numbers and / or letters in different examples. This repetition is for the purpose of simplification and clarity, and does not itself indicate the relationship between the various embodiments and / or settings discussed.

[0029] This application provides a method for dynamically loading service channels and instances based on the AutosraAP platform, which can be applied to electronic control units to shorten the time of project release, such as Figure 1 As shown, it includes the following contents.

[0030] Step 101: Loading a configuration file of a service to be accessed into a memory library of a shared memory through a file loading program, wherein the service to be accessed exists in the AutosraAP platform, and the configuration file includes a communication channel and a service instance of the service to be accessed;

[0031] Step 102: when it is detected that an adaptive application needs to create a service or discover a service, read a configuration file from a memory library, wherein the adaptive application is an application program that can dynamically adjust functions and performance according to user needs and environment;

[0032] Step 103: The configuration file is delivered to the adaptive application, so that the adaptive application uses the configuration file to create a service or discover a service.

[0033] Generally speaking, accessing a service requires specifying the communication channel and instance ID of the service. Before an adaptive application creates or consumes a service, the code must first specify the instance and channel to be accessed to discover or create the service. Therefore, the channel and instance will be hard-coded into the program. Once the channel and instance of the service change, the adaptive application must be recompiled and burned to the board for operation. This will bring two problems: first, it will increase the process of project release and deployment; second, replacing the program that is already running normally and re-releasing the program may carry unpredictable factors, which will increase the risk of operation.

[0034] Based on the above problems, this application provides a system architecture diagram of channels and instances based on the AutosraAP platform dynamically loading services, such as Figure 2 As shown, the communication channel and service instance of the service to be accessed are loaded into the memory library of the shared memory through the file loader. In this way, when the adaptive application needs to create or discover a service, it can directly read the communication channel and service instance from the memory library. Even if the communication channel and service instance change, only the configuration file needs to be replaced. The communication channel and service instance in the memory library can be kept up to date, and there is no need to recompile the code of the adaptive application, which reduces the process of project release and deployment and simplifies the project release and deployment process.

[0035] In addition, this application does not require adjustment of the original written program, avoiding the uncontrollable risks brought by replacing the program and improving the stability of system operation.

[0036] Optionally, the file loader can not only automatically load communication channels and service instances into the memory library at preset time intervals, but also monitor any changes to the communication channels and service instances in real time and update the data in the memory library immediately. This mechanism ensures that the system can respond quickly to changes in the underlying services.

[0037] Optionally, the service to be accessed in the embodiment of the present application is an AutosraAP (Automotive Profile) service, which is a standardized software architecture for automotive applications, specifically for efficient communication between automotive electronic control units. For example, the service to be accessed is access to millimeter-level microwaves or access to radar waves.

[0038] Optionally, the adaptive application in the embodiment of the present application is an application that can dynamically adjust its functions and performance according to the user's needs and environment, and can intelligently allocate system resources according to the user's network conditions and device performance to improve the performance and response speed of the application.

[0039] Among them, each service to be accessed corresponds to a configuration file. When the present application loads the configuration file into the memory library of the shared memory, it is necessary to allocate a memory segment in the memory library for the configuration file. This includes two implementations: one implementation is to configure the same shared memory segment for all configuration files, and the other implementation is to configure a shared memory segment for different configuration files respectively. For these two situations, the subsequent adaptive application will also have different ways of searching for the target configuration file of the target access service. The two implementations are as follows.

[0040] The first embodiment includes the following steps.

[0041] Step 1. Allocate a shared memory segment in the memory library for each configuration file of the service to be accessed, wherein the configuration files of different services to be accessed are different;

[0042] Step 2. Load the configuration file of each service to be accessed into the corresponding shared memory segment through the file loader;

[0043] Step 3: Determine the target shared memory segment corresponding to the target access service, and read the target configuration file of the target access service from the target shared memory segment.

[0044] Each service to be accessed corresponds to a configuration file. For each service to be accessed, the system will allocate a separate shared memory segment for its configuration file, which means that the configuration information of each service will be stored in a unique memory area that is completely isolated from other services. This approach not only ensures that the configuration files between different services will not be confused or overwritten, but also greatly reduces potential problems caused by data conflicts. In this way, it can ensure that each service can have a stable and secure operating environment without being affected by other services.

[0045] After the shared memory segment is allocated, the system uses a dedicated file loader to load the configuration file of each service to be accessed into its corresponding shared memory segment. This loading process is automated, ensuring that the configuration file is correctly placed in the intended location. In addition, since the configuration file of each service is stored in its own shared memory segment, fast data access is guaranteed even in high concurrency situations, thereby improving the overall performance of the system.

[0046] When the system needs to access a specific service, it first determines the target shared memory segment corresponding to the target access service. This process usually involves parsing the service identifier (such as service name, ID, etc.) to accurately locate the correct shared memory segment. Once the target shared memory segment is determined, the system can directly read the target configuration file of the target access service from it. Since the configuration file of each service to be accessed is stored in a separate memory segment, this process is both efficient and secure, and effectively avoids possible delays or errors in data retrieval.

[0047] By implementing the above strategies, the system not only achieves effective management and fast access to the configuration files of different services to be accessed, but also greatly enhances the security and manageability of data. The configuration files of each service to be accessed are strictly isolated in their own memory segments, which not only prevents data conflicts between different services, but also simplifies troubleshooting and maintenance.

[0048] The second embodiment includes the following steps.

[0049] Step 1. Allocate a same shared memory segment in the memory library for configuration files of multiple services to be accessed, wherein the configuration files of different services to be accessed are different;

[0050] Step 2. Load multiple configuration files of services to be accessed into the same shared memory segment through a file loader;

[0051] Step 3: Read all configuration files of the services to be accessed from the shared memory segment, and search for the target configuration file of the target access service by traversing the data through the adaptive application.

[0052] The system allocates the same shared memory segment for the configuration files of multiple services to be accessed. Although the configuration files of these services are different, they are centrally stored in the same memory area, which not only effectively saves memory resources, but also simplifies the complexity of memory management. Centralized storage can reduce memory fragmentation, improve memory utilization, and make the system more efficient and flexible when processing a large number of services.

[0053] The file loader is responsible for loading the configuration files of multiple services to be accessed into the same shared memory segment. This loading process needs to ensure the accuracy and integrity of the data, that is, the configuration file of each service to be accessed must be correctly placed in the specified memory location. The file loader uses efficient algorithms and mechanisms to ensure that the loading of configuration files in a multi-service environment is fast and reliable. In addition, centralized loading also facilitates unified management and updating of configuration files, further improving the maintainability of the system.

[0054] When a specific target access service is needed, the adaptive application reads the configuration files of all the services to be accessed from the shared memory segment. Then, the target configuration file of the target access service is quickly found by traversing the data. This process relies on the powerful processing power of the adaptive application, which can efficiently filter out the required one from a large number of configuration files. In this way, not only the retrieval speed of the configuration file is accelerated, but also the consistency and accuracy of the data are ensured.

[0055] In the above two embodiments, the independent memory segment strategy emphasizes data isolation and security, which is suitable for application scenarios with high requirements for stability and reliability. The shared memory segment strategy emphasizes resource sharing and response speed, which is suitable for service scenarios that are sensitive to memory resources or require rapid deployment. The most appropriate strategy can be selected according to business needs and resource conditions to achieve the best performance and efficiency of the system. No matter which strategy is selected, effective shared memory management is the key to ensuring stable operation and efficient response of the system.

[0056] In the second embodiment, the file loader accesses the shared memory segment based on topic publishing and subscription, and then the adaptive application subscribes to the topic in the shared memory segment.

[0057] In the second embodiment, the specific contents of step 1 include: reading multiple configuration files of services to be accessed from a set location through a file loader, and converting the configuration files into a set file format; creating a topic message through a Publisher constructor; calling a setting function and allocating the same shared memory segment in the memory library for the configuration files based on the topic message.

[0058] Figure 3 To implement the signaling diagram for accessing shared memory segments based on topics, Figure 3 In the example, Publisher, Topic, and memory can be encapsulated as a dynamic library in the memory library and provided to the file loader for calling. The file loader is responsible for reading the configuration file in json format, which contains the communication channels and instances corresponding to different services to be accessed. For example, the configuration file contains the deployment information of two services to be accessed, namely Key Management Service and UpdateService, which use IPC:1 and IPC:2 channel instances respectively.

[0059] The file loader converts these json format files into a set file format, such as setting the file format to map format (std::map<std::string,std::string> ), this message format allows the system to process and store configuration data more efficiently. After the file loader completes the data format conversion, the Publisher constructor creates a topic message named "map_message", which is designed to carry key information about the configuration file for efficient management and access in the memory library. Subsequently, the file loader calls the create_memory_segment function, which allocates a shared memory segment based on the topic message. This shared memory segment will be used to store the configuration file after the format conversion, thus completing the steps of configuring a shared memory segment for the configuration file.

[0060] In the second embodiment, the specific contents of step 2 include: calling the Publisher method to pass in a configuration file of a set file format; converting the configuration file from the set file format into a data structure suitable for storage in a memory library; and calling the write method to write the converted configuration file into a shared memory segment.

[0061] like Figure 3 As shown, the file loader calls the Publisher method and passes the converted map message as a parameter. Inside this method, the data is first converted into a data structure that is suitable for storage in shared memory, and then the write method is called to store the data in the shared memory segment previously created based on the topic. This data storage method not only improves the system's response speed and data processing capabilities, but also enhances the system's scalability and flexibility.

[0062] In order to improve modularity and reusability, the related functions of Publisher, Topic and memory can be encapsulated into a dynamic library. In this way, the file loader can call the interface in this library when needed, without having to repeatedly implement the logic of shared memory management, which simplifies the development process and improves the maintainability of the code.

[0063] Below is Figure 3 The overall process steps.

[0064] 1) Read the json configuration file.

[0065] The file loader first reads the specified json configuration file, which contains the communication channels and instances corresponding to the different services to be accessed. The data in the configuration file will be converted into a std::map<std::string,std::string> format for easy subsequent processing and storage.

[0066] 2) Create a shared memory segment.

[0067] In the Publisher constructor, a topic message named "map_message" is first created, and then the create_memory_segment function is called to allocate a shared memory segment for the configuration file based on this topic message. This step ensures that data can be shared safely and efficiently between multiple processes.

[0068] 3) Publish messages to shared memory.

[0069] The file loader then calls the Publisher method and passes the previously read and converted map message as a parameter. Inside this method, the map format file is first converted into a data structure suitable for storage in shared memory. After the conversion is completed, the write method is called to write the configuration file to the shared memory segment.

[0070] 4) Refresh shared memory regularly.

[0071] Considering that the json configuration file may be updated at any time, the file loader is designed to run periodically. In each run, it re-reads the configuration file and updates the configuration file in the shared memory segment. In this way, it is ensured that the data in the shared memory segment always reflects the current service deployment status. To achieve this, a timer or thread loop can be used to periodically check the modification time of the file and update it accordingly.

[0072] In the second embodiment, the specific contents of step 3 include: obtaining the topic parameters and callback function passed by the adaptive application; returning the address of the shared memory segment to the adaptive application according to the topic parameters, wherein the topic parameters are used to determine the address of the shared memory segment subscribed to the topic, and the callback function is used to obtain the configuration file in the shared memory segment; obtaining the configuration files of all services to be accessed from the address of the shared memory segment, and calling the callback function to send the configuration files to the adaptive application; traversing the configuration files of all services to be accessed through the adaptive application, and finding the configuration file of the target access service.

[0073] The adaptive application passes topic parameters and callback functions to the system. The topic parameters are used to determine the address of the shared memory segment to which the topic is subscribed, and the callback function is used to obtain the configuration file in the shared memory segment.

[0074] Based on the received topic parameters, the system performs corresponding logical processing to determine the address of the shared memory segment to be found. This step involves parsing the topic parameters to accurately match the corresponding memory location. Subsequently, the system needs to check whether the memory segment address actually exists in the memory library. If it does, this address information is returned to the adaptive application; otherwise, if it does not exist, it may be necessary to trigger an error handling process or return specific error information to the caller.

[0075] Once the adaptive application obtains the address of the correct shared memory segment, it will initiate a topic message, which is used to request the callback function passed in before the system call to pass all the read configuration files to the adaptive application.

[0076] The adaptive application traverses all the configuration files of the services to be accessed and identifies the target configuration files of the target access services. This process is implemented based on technologies such as keyword search and regular expression matching, and the ultimate goal is to accurately locate the required files from a large number of configuration files.

[0077] Figure 4 A signaling diagram for subscribing to shared memory data for an adaptive application includes the following steps.

[0078] 1) Call the Subscriber method to obtain data.

[0079] In adaptive applications, the Subscriber constructor accepts two parameters: the topic parameter and the callback function.

[0080] Topic parameter: This parameter is used to find the shared memory segment. By calling the create_memory_segment function, the system will check whether the shared memory segment corresponding to the topic parameter already exists. If it does, the function will return the address of the shared memory segment for subsequent data reading; if it does not exist, an exception may be thrown or an error code may be returned to prompt the user to take appropriate action.

[0081] Callback function: This callback function is used to obtain data from the shared memory segment. Through this mechanism, the Subscriber can pass the found configuration file to the adaptive application.

[0082] 1) Get the shared memory address.

[0083] The system calls the Subscriber method to obtain the topic parameters and callback function passed in by the data adaptive application, and then calls the create_memory_segment function to determine whether the shared memory segment created by the topic exists. If so, the subscription is completed.

[0084] 2) Execute the callback function.

[0085] The adaptive application initiates the topic information, and the system uses the callback function to package all the configuration files read from the shared memory segment and send them to the adaptive application. The execution of the callback function not only transmits the data back, but also may execute some additional logic in the process, such as data parsing, format conversion, etc., for subsequent processing.

[0086] 3) Traverse and process the returned data.

[0087] The adaptive application receives all configuration files, traverses and parses them, and extracts the communication channel and instance information of the target access service.

[0088] In this application, the communication channel and instance information of the service to be accessed can be published to the memory library in a configurable manner as a topic, and the adaptive application can subscribe to the topic to obtain the communication channel and instance information from the memory library. When the communication channel and instance information change, you only need to replace the json file. The file loader will read the json file and publish it to the shared memory after a period of time. The adaptive application can obtain the latest channel and instance of the target access service by subscribing to the topic. There is no need to recompile the adaptive application, and new channels and instances can be dynamically loaded.

[0089] The adaptive application receives the communication channel and instance information of the target access service, and can pass the content to the service provider and service consumer. The service consumer uses the Find Service method to discover the service, and the service provider uses the Create Service method to create the service. The creation and discovery of services are described in detail below.

[0090] First, the AP service is introduced.

[0091] The services in AP are provided and consumed in the process, and the process is managed by the em execution management module of the AP platform (a process running on the AP platform). SOA service interfaces are divided into three types, including method, event, and field.

[0092] Method: The client can call the internal interface of the service, which is triggered by the client call. It runs once for each call, and the server receives it passively.

[0093] Event: The server can periodically notify the client, which is actively triggered by the local event on the server and notified to the client.

[0094] Field: Contains three modes: Set, Get, and Notifier. It can be set (Set), read (Get), and notified (Notifier). The server triggers and notifies (Notifier) ​​when data changes. The client can change (Set) or read (Get) data.

[0095] Figure 5 The process diagram created for the service includes the following four steps.

[0096] In the first step, in the AP service matrix, the main configuration is the information related to the service and communication protocol. The information to be configured is as follows: the communication channel adopted by the service (including someip, dds and ipc) and the parameter configuration related to the communication channel protocol; among them, someip and dds are used for cross-ecu communication, dds is used for high-load data transmission, and ipc is used for internal ecu communication; specify the type of interface under the service (method, event or field), the input and output parameters of each interface, and the implementation method of each interface; the data type definition of the interface input and output parameters; the communication behavior definition of the service, which mainly reflects the interaction relationship between services between ECUs or within ECUs.

[0097] In the second step, the AP service matrix is ​​imported into the Mainfest configuration tool. The Mainfest configuration tool combines the configuration information in the first step above, as well as the resource allocation, process lifecycle management, and access rights of the processes running on the AP platform, to generate an ARMXML file.

[0098] In the third step, the code generation tool generates platform-related configuration information, service skeleton code and proxy code based on the imported armxml file.

[0099] In the fourth step, the business process, i.e., the adaptive application, is integrated as needed. The consumer calls the proxy code of the service to initiate access to the service, and the provider calls the skeleton code of the service to implement the service.

[0100] Figure 6 A flow chart of service registration and discovery, including Figure 5 Steps.

[0101] ① Service provider: registers to the service registration center of ECU1 by providing instance ID (deployment information of bound service, including event, field, method interface information under the service, IP and port information of ECU, etc.) and channel (communication protocol used, such as someip, dds, ipc).

[0102] Service consumer: sends the instance ID and channel to the service registration center of ECU2, indicating that it needs to find a certain service.

[0103] ②The service registration center of ECU2 determines whether the ECU provides the service it is looking for. If not, the service registration center of ECU2 will send a multicast message to the service registration center of ECU1. If it is provided, it will be directly returned to the service consumer.

[0104] ③ The service registration center of ECU1 receives the multicast message sent by the service registration center of ECU2 and finds that this service is provided inside ECU1. Then the service registration center of ECU1 will reply with a unicast message (carrying the IP and port information of the service provided).

[0105] ④The service registration center of ECU2 receives the unicast message and forwards it to the service consumer in ECU2.

[0106] ⑤The service consumer of ECU2 obtains the IP and port of the service provider and directly establishes a connection with the service provider of ECU1.

[0107] This application provides an overall process of creating and discovering an AutosraAP service, including the following steps.

[0108] Step 1: Access the memory library in a publish and subscribe manner based on topics.

[0109] 1) Read the json configuration file.

[0110] The file loader first reads the specified json configuration file, which contains the communication channels and instances corresponding to the different services to be accessed. The data in the configuration file will be converted into a std::map<std::string,std::string> format for easy subsequent processing and storage.

[0111] 2) Create a shared memory segment.

[0112] In the Publisher constructor, first create a topic message named "map_message", then call the create_memory_segment function to allocate a shared memory segment for the configuration file based on this topic message.

[0113] 3) Publish messages to shared memory.

[0114] The file loader then calls the Publisher method and passes the previously read and converted map message as a parameter. Inside this method, the map format file is first converted into a data structure suitable for storage in shared memory. After the conversion is completed, the write method is called to write the configuration file to the shared memory segment.

[0115] Step 2: The adaptive application subscribes to the configuration file in the memory library.

[0116] 1) Get the shared memory address.

[0117] The system calls the Subscriber method to obtain the topic parameters and callback function passed in by the data adaptive application. The system calls the create_memory_segment function to determine whether the shared memory segment created by the topic exists. If so, the subscription is completed.

[0118] 2) Execute the callback function.

[0119] Call the Subscriber method to obtain data and then the adaptive application initiates topic information. The topic information carries a callback function. The system callback function packages all configuration files read from the shared memory segment and sends them to the adaptive application. The execution of the callback function not only returns the data, but also may execute some additional logic in the process, such as data parsing, format conversion, etc., for subsequent processing.

[0120] 3) Traverse and process the returned data.

[0121] The adaptive application receives all configuration files, traverses and parses them, and extracts the communication channel and instance information of the target access service.

[0122] Step 3: The service creator creates the service using the Create Service method.

[0123] Step 4: The service creator and service consumer register the service, and the service consumer uses the FindService method to discover the service.

[0124] Based on the same technical concept, the present application provides a device for dynamically loading service channels and instances based on the AutosraAP platform, such as Figure 7 As shown, the device comprises:

[0125] A loading module 701, used for loading a module, used for loading a configuration file of a service to be accessed into a memory library of a shared memory through a file loading program, wherein the service to be accessed exists in the AutosraAP platform, and the configuration file includes a communication channel and a service instance of the service to be accessed;

[0126] A reading module 702 is used to read a configuration file from a memory library when it is detected that an adaptive application needs to create a service or discover a service, wherein the adaptive application is an application program that can dynamically adjust functions and performance according to user needs and environment;

[0127] The transfer module 703 is used to transfer the configuration file to the adaptive application, so that the adaptive application uses the configuration file to create a service or discover a service.

[0128] Optionally, the loading module 701 is used to: allocate a shared memory segment in the memory library for each configuration file of the service to be accessed, wherein the configuration files of different services to be accessed are different; and load the configuration file of each service to be accessed into the corresponding shared memory segment through a file loading program;

[0129] The reading module 702 is used to determine the target shared memory segment corresponding to the target access service, and read the target configuration file of the target access service from the target shared memory segment.

[0130] Optionally, the loading module 701 is used to: load the configuration file of the service to be accessed into the memory library of the shared memory through the file loading program, including: allocating the same shared memory segment for the configuration files of multiple services to be accessed in the memory library, wherein the configuration files of different services to be accessed are different; and loading the configuration files of multiple services to be accessed into the same shared memory segment through the file loading program;

[0131] The reading module 702 is used to read configuration files of all services to be accessed from the shared memory segment, and search for a target configuration file of a target access service by traversing data through an adaptive application.

[0132] Optionally, the loading module 701 is used to:

[0133] Reading multiple configuration files of services to be accessed from a set location through a file loader, and converting the configuration files into a set file format;

[0134] Create topic messages through the Publisher constructor;

[0135] Call the setup function and allocate the same shared memory segment in the memory bank for the configuration file based on the topic message.

[0136] Optionally, the loading module 701 is used to:

[0137] Call the Publisher method to pass in the configuration file that sets the file format;

[0138] Convert the configuration file from the set file format to a data structure suitable for storage in the memory bank;

[0139] Call the write method to write the converted configuration file into the shared memory segment.

[0140] Optionally, the reading module 702 is used to:

[0141] Get the topic parameters and callback function passed in by the adaptive application, where the topic parameters are used to determine the address of the shared memory segment subscribed to the topic, and the callback function is used to obtain the configuration file in the shared memory segment;

[0142] Return the address of the shared memory segment to the adaptive application based on the topic parameter;

[0143] Get the configuration files of all services to be accessed from the address of the shared memory segment, and call the callback function to send the configuration files to the adaptive application;

[0144] The configuration files of all services to be accessed are traversed through the adaptive application, and the configuration file of the target access service is found.

[0145] Optionally, the reading module 702 is used to:

[0146] Determine the memory segment address to be searched based on the topic parameter;

[0147] Determine whether the memory segment address exists in the memory bank;

[0148] If it exists, the memory segment address is returned to the adaptive application.

[0149] like Figure 8 As shown, an embodiment of the present application provides an electronic device, including a processor 801, a communication interface 802, a memory 803 and a communication bus 804, wherein the processor 801, the communication interface 802, and the memory 803 communicate with each other through the communication bus 804.

[0150] The memory 803 is used to store computer programs.

[0151] In one embodiment of the present application, the processor 801 is used to execute the program stored in the memory 803 to implement the method of dynamically loading the channel and instance of the service based on the AutosraAP platform provided by any of the aforementioned method embodiments, including:

[0152] The configuration file of the service to be accessed is loaded into the memory library of the shared memory through a file loader, wherein the service to be accessed exists in the AutosraAP platform, and the configuration file includes the communication channel and service instance of the service to be accessed; when it is detected that the adaptive application needs to create a service or discover a service, the configuration file is read from the memory library, wherein the adaptive application is an application that can dynamically adjust functions and performance according to user needs and environment; the configuration file is passed to the adaptive application so that the adaptive application uses the configuration file to create a service or discover a service.

[0153] Optionally, loading the configuration file of the service to be accessed into the memory library of the shared memory through the file loader includes: allocating a shared memory segment for each configuration file of the service to be accessed in the memory library, wherein the configuration files of different services to be accessed are different; loading the configuration file of each service to be accessed into the corresponding shared memory segment through the file loader; reading the configuration file from the memory library includes: determining the target shared memory segment corresponding to the target access service, and reading the target configuration file of the target access service from the target shared memory segment.

[0154] Optionally, loading the configuration file of the service to be accessed into the memory library of the shared memory through the file loader includes: allocating the same shared memory segment for the configuration files of multiple services to be accessed in the memory library, wherein the configuration files of different services to be accessed are different; loading the configuration files of multiple services to be accessed into the same shared memory segment through the file loader; reading the configuration file from the memory library includes: reading the configuration files of all services to be accessed from the shared memory segment, and searching for the target configuration file of the target access service by traversing the data through the adaptive application.

[0155] Optionally, allocating the same shared memory segment in the memory library for configuration files of multiple services to be accessed includes: reading the configuration files of multiple services to be accessed from a set location through a file loader, and converting the configuration files into a set file format; creating a topic message through a Publisher constructor; calling a set function and allocating the same shared memory segment in the memory library for the configuration files based on the topic message.

[0156] Optionally, loading multiple configuration files of services to be accessed into the same shared memory segment through a file loader includes: calling a Publisher method to pass in a configuration file in a set file format; converting the configuration file from the set file format into a data structure suitable for storage in a memory library; and calling a write method to write the converted configuration file into the shared memory segment.

[0157] Optionally, reading configuration files of all services to be accessed from the shared memory segment, and searching for the target configuration file of the target access service by traversing the data through the adaptive application includes: obtaining the topic parameter and callback function passed in by the adaptive application, wherein the topic parameter is used to determine the address of the shared memory segment subscribed to the topic, and the callback function is used to obtain the configuration file in the shared memory segment; returning the address of the shared memory segment to the adaptive application according to the topic parameter; obtaining configuration files of all services to be accessed from the address of the shared memory segment, and calling the callback function to send the configuration files to the adaptive application; traversing the configuration files of all services to be accessed through the adaptive application, and searching for the configuration file of the target access service.

[0158] Optionally, returning the address of the shared memory segment to the adaptive application according to the topic parameter includes: determining the memory segment address to be searched according to the topic parameter; judging whether the memory segment address exists in the memory library; if so, returning the memory segment address to the adaptive application.

[0159] An embodiment of the present application also provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the steps of the method for dynamically loading channels and instances of services based on the AutosraAP platform as provided in any of the aforementioned method embodiments are implemented.

[0160] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0161] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a general hardware platform, and of course, by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the relevant technology can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0162] It should be understood that the terms used herein are only for the purpose of describing specific example embodiments and are not intended to be limiting. Unless the context clearly indicates otherwise, the singular forms "one", "an" and "said" as used herein may also be meant to include plural forms. The terms "include", "comprise", "contain", and "have" are inclusive, and therefore specify the existence of stated features, steps, operations, elements and / or parts, but do not exclude the existence or addition of one or more other features, steps, operations, elements, parts, and / or combinations thereof. The method steps, processes, and operations described herein are not interpreted as necessarily requiring them to be performed in the specific order described or illustrated, unless the execution order is clearly indicated. It should also be understood that additional or alternative steps may be used.

[0163] The foregoing is merely a specific embodiment of the present invention, which enables those skilled in the art to understand or implement the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features claimed herein.

Claims

1. A method for dynamically loading service channels and instances based on the AutosraAP platform, characterized in that: The method comprises: Loading a configuration file of the service to be accessed into a memory library of the shared memory through a file loading program, wherein the service to be accessed exists in the AutosraAP platform, and the configuration file includes a communication channel and a service instance of the service to be accessed; When it is detected that an adaptive application needs to create a service or discover a service, the configuration file is read from the memory bank, wherein the adaptive application is an application program that can dynamically adjust functions and performance according to user needs and environment; The configuration file is delivered to the adaptive application, so that the adaptive application uses the configuration file to create a service or discover a service.

2. The method according to claim 1, characterized in that Loading the configuration file of the service to be accessed into the memory bank of the shared memory by the file loading program includes: allocating a shared memory segment in the memory bank for each configuration file of the service to be accessed, wherein the configuration files of different services to be accessed are different; loading the configuration file of each service to be accessed into the corresponding shared memory segment by the file loading program; Reading the configuration file from the memory library includes: determining a target shared memory segment corresponding to a target access service, and reading a target configuration file of the target access service from the target shared memory segment.

3. The method according to claim 1, characterized in that Loading the configuration file of the service to be accessed into the memory bank of the shared memory through the file loading program includes: allocating a same shared memory segment in the memory bank for the configuration files of multiple services to be accessed, wherein the configuration files of different services to be accessed are different; loading the configuration files of multiple services to be accessed into the same shared memory segment through the file loading program; Reading the configuration file from the memory library includes: reading configuration files of all services to be accessed from the shared memory segment, and searching for a target configuration file of a target access service by traversing data through the adaptive application.

4. The method according to claim 3, characterized in that Allocating a same shared memory segment for configuration files of multiple services to be accessed in the memory bank includes: Reading configuration files of multiple services to be accessed from a set location through the file loading program, and converting the configuration files into a set file format; Create topic messages through the Publisher constructor; A setting function is called and a same shared memory segment is allocated in the memory bank for the configuration file based on the topic message.

5. The method according to claim 4, characterized in that Loading the configuration files of multiple services to be accessed into the same shared memory segment through the file loading program includes: Call the Publisher method to pass in the configuration file that sets the file format; Converting the configuration file from the setting file format into a data structure suitable for storage in the memory bank; The write method is called to write the configuration file after the format conversion into the shared memory segment.

6. The method according to claim 3, characterized in that Reading configuration files of all services to be accessed from the shared memory segment, and searching for a target configuration file of a target access service by traversing data through the adaptive application includes: Obtaining the topic parameters and callback function passed in by the adaptive application, wherein the topic parameters are used to determine the address of the shared memory segment subscribed to the topic, and the callback function is used to obtain the configuration file in the shared memory segment; Returning the address of the shared memory segment to the adaptive application according to the topic parameter; Obtaining configuration files of all services to be accessed from the addresses of the shared memory segment, and calling the callback function to send the configuration files to the adaptive application; The configuration files of all the services to be accessed are traversed through the adaptive application, and the configuration file of the target access service is found.

7. The method according to claim 6, characterized in that Returning the address of the shared memory segment to the adaptive application according to the topic parameter includes: Determine the memory segment address to be searched according to the topic parameter; Determine whether the memory segment address exists in the memory bank; If it exists, the memory segment address is returned to the adaptive application.

8. A device for dynamically loading service channels and instances based on the AutosraAP platform, characterized in that: The device comprises: A loading module, used for loading a configuration file of a service to be accessed into a memory library of a shared memory through a file loading program, wherein the service to be accessed exists in the AutosraAP platform, and the configuration file includes a communication channel and a service instance of the service to be accessed; A reading module, configured to read the configuration file from the memory bank when it is detected that the adaptive application needs to create a service or discover a service, wherein the adaptive application is an application program that can dynamically adjust functions and performance according to user needs and environment; The transfer module is used to transfer the configuration file to the adaptive application, so that the adaptive application uses the configuration file to create a service or discover a service.

9. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, for implementing any of the methods described in claims 1-7 when executing a program stored in a memory.

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

Citation Information

Patent Citations

  • Secure communication method based on adaptive application and server

    CN114980083A

  • Method and system for vehicle-mounted application to access network service, vehicle and storage medium

    CN116233214A

  • Data processing method and device based on AUTOSAR, medium and equipment

    CN118210453A

  • Adaptive AUTOSAR middleware protocol conformance fuzzy test method

    CN118250203A

  • Inter-process communication method and device, electronic equipment and storage medium

    CN118277117A

Cited By

  • SOMEIP communication method, vehicle and medium

    CN121455719A