Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present application more apparent, the technical solutions of the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application, and it is apparent that the described embodiments are some embodiments of the present application, but not all embodiments of the present application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
The following disclosure provides many different embodiments, or examples, for implementing different structures of the invention. In order to simplify the present disclosure, components and arrangements of specific examples are described below. They are, of course, merely examples and are not intended to limit the invention. Furthermore, the present invention may repeat reference numerals and/or letters in the various examples. This repetition is for the purpose of simplicity and clarity and does not in itself dictate a relationship between the various embodiments and/or configurations discussed.
The application provides a method for dynamically loading channels and instances of a service based on AutosarAP platform, which can be applied to an electronic control unit and is used for shortening the time for issuing items, as shown in figure 1, and comprises the following contents.
Step 101, loading a configuration file of a service to be accessed into a memory bank of a shared memory through a file loading program, wherein the service to be accessed exists in a AutosarAP platform, and the configuration file comprises a communication channel and a service instance of the service to be accessed;
102, reading a configuration file from a memory library when detecting that an adaptive application needs to create a service or discover the service, wherein the adaptive application is an application program capable of dynamically adjusting functions and performances according to user requirements and environments;
and step 103, transmitting the configuration file to the adaptive application so that the adaptive application adopts the configuration file to create the service or discover the service.
Generally, accessing a service requires specifying the communication channel and instance id of the service. The code indicates the accessed instance and channel to discover or create the service before the adaptive application creates or consumes the service. Therefore, the channel and the instance are hard coded into the program, and once the channel and the instance of the service are changed, the self-adaptive application must be recompiled and then burnt on the board to run, so that the problems of increasing the project release and deployment flow and replacing the normal running program, and carrying unpredictable factors in the re-release program can increase the running risk are brought.
Based on the above problems, the present application provides a system architecture schematic diagram of a service channel and an instance dynamically loaded on the AutosarAP platform, as shown in fig. 2, the service channel and the service instance to be accessed are loaded into a repository of a shared memory through a file loader, so that when a self-adaptive application needs to create a service or discover the service, the self-adaptive application can directly read the service channel and the service instance from the repository, even if the service channel and the service instance are changed, only a configuration file needs to be replaced, the service channel and the service instance in the repository can keep the latest state, the code of the self-adaptive application does not need to be recompiled, the flow of project release deployment is reduced, and the project release deployment flow is simplified.
In addition, the application does not need to adjust the original written program, avoids uncontrollable risks caused by replacing the program, and improves the running stability of the system.
Optionally, the file loader not only can automatically load the communication channel and the service instance into the memory bank at preset time intervals, but also can monitor any change of the communication channel and the service instance in real time and update the data in the memory bank in real time, and the mechanism ensures that the system can respond to the change of the underlying service quickly.
Optionally, the service to be accessed in the embodiment of the present application is AutosarAP (Automotive Profile) service, which is a standardized software architecture for automotive applications, and is specifically aimed at 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.
Optionally, the adaptive application (Adaptive Application) in the embodiment of the present application is an application program capable of dynamically adjusting its functions and performances according to the needs and environments of the user, and can intelligently allocate system resources according to the network conditions and device performances of the user, so as to improve the performance and response speed of the application.
When the configuration files are loaded into the repository of the shared memory, the memory segments in the repository need to be allocated for the configuration files, which comprises two embodiments, namely, one embodiment configures the same shared memory segment for all the configuration files, the other embodiment configures one shared memory segment for different configuration files respectively, and the following adaptive application searches the target configuration files of the target access service in different ways for the two cases.
The first embodiment includes the following steps.
Step 1, respectively distributing a shared memory segment for each configuration file of the service to be accessed in a memory bank, wherein the configuration files of different services to be accessed are different;
step 2, loading the configuration file of each service to be accessed into the corresponding shared memory section through a file loading program;
And step 3, determining a target shared memory segment corresponding to the target access service, and reading a target configuration file of the target access service from the target shared memory segment.
Each service to be accessed corresponds to a configuration file, and for each service to be accessed, the system allocates a separate shared memory segment for the configuration file, which means that the configuration information of each service is stored in a unique memory area completely isolated from other services. By the method, configuration files among different services are not mixed or covered, potential problems caused by data collision are greatly reduced, and each service can be ensured to have a stable and safe running environment and is not influenced by other services.
After the allocation of the shared memory segments is completed, the system uses a special file loader to load the configuration file of each service to be accessed into its corresponding shared memory segment. This loading process is automated and ensures that the configuration file is placed correctly in the predetermined location. In addition, since the configuration file of each service is stored in the exclusive shared memory section, even under the condition of high concurrency, the quick access of the data can be ensured, thereby improving the overall performance of the system.
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 typically involves parsing of service identifiers (e.g., service names, IDs, etc.) to pinpoint the correct shared memory segment. Once the target shared memory segment is determined, the system can directly read the target configuration file for the target access service therefrom. Because the configuration file of each service to be accessed is stored in the independent memory segment, the process is efficient and safe, and delay or error possibly occurring in data retrieval is effectively avoided.
By implementing the strategy, the system not only realizes effective management and quick access to 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 the respective memory section, so that not only can data conflict among different services be prevented, but also the fault checking and maintenance work can be simplified.
The second embodiment includes the following steps.
Step 1, distributing the same shared memory segment for configuration files of a plurality of services to be accessed in a memory bank, wherein the configuration files of different services to be accessed are different;
Step 2, loading configuration files of a plurality of services to be accessed into the same shared memory section through a file loading program;
And 3, reading configuration files of all the services to be accessed from the shared memory segment, and searching target configuration files of the target access service in a data traversing mode through the self-adaptive application.
The system allocates the same shared memory segment for a plurality of configuration files of the service to be accessed. Although the configuration files of these services are different, they are stored in the same memory area in a centralized manner, which not only effectively saves memory resources, but also simplifies the complexity of memory management. Through centralized storage, memory fragments can be reduced, and the memory utilization rate is improved, so that the system is more efficient and flexible in processing a large number of services.
The file loader is responsible for loading configuration files of a plurality of services to be accessed into the same shared memory segment. This loading process needs to ensure the accuracy and integrity of the data, i.e. the configuration file of each service to be accessed must be placed correctly in the specified memory location. The file loader ensures that the loading of the configuration files in a multi-service environment is both fast and reliable through efficient algorithms and mechanisms. In addition, centralized loading is convenient for unified management and updating of configuration files, and maintainability of the system is further improved.
When a specific target access service needs to be accessed, the adaptive application reads 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 searched in a data traversing mode. This process relies on the powerful processing power of the adaptive application to be able to efficiently screen out the desired piece from a large number of profiles. By the method, the retrieval speed of the configuration file is increased, and the consistency and accuracy of the data are ensured.
In the two embodiments, the independent memory segment policy emphasizes data isolation and security, and is suitable for application scenarios with high requirements on stability and reliability. The shared memory segment strategy highlights the resource sharing and response speed, and is suitable for service scenes sensitive to memory resources or needing quick deployment. The most appropriate strategy can be selected according to the service requirements and resource conditions to achieve the best performance and efficiency of the system. Whichever policy is chosen, effective shared memory management is critical to ensure stable operation and efficient response of the system.
In a second embodiment, the file loader enables access to the shared memory segment based on topic publishing and subscription, and then the adaptive application subscribes to topics in the shared memory segment.
In a second embodiment, the specific content in step 1 includes reading, by a file loader, a plurality of configuration files of the service to be accessed from a set location, converting the configuration files into a set file format, creating a topic message by means of a Publisher constructor, calling the set function, and allocating the same shared memory segment to the configuration files in the repository based on the topic message.
FIG. 3 is a signaling diagram for implementing access to shared memory segments based on topic, and Publisher, topic, memory may be packaged in FIG. 3 to provide file loader calls for dynamic libraries in the repository. The file loader is responsible for reading a json format configuration file which contains communication channels and instances corresponding to different services to be accessed. For example, the configuration file contains deployment information of two services to be accessed, KEY MANAGEMENT SERVICE and Update Service, which use IPC:1 and IPC:2 channel instances, respectively.
The file loader converts these json formatted files into a settings file format, such as a settings file format of map format (std:: map < std:: string >), which allows the system to process and store configuration data more efficiently. After the file loader has completed the data format conversion, publisher constructors create a topic message named "map_message" that is designed to carry critical information about the configuration file for efficient management and access in the repository. The file loader then calls the create_memory_segment function, which allocates a shared memory segment according to the topic message, which will be used to store the format-converted configuration file, to which the step of configuring the shared memory segment for the configuration file is completed.
In a second embodiment, the specific content in step 2 includes calling Publisher a method to transfer a configuration file in a configuration file format, converting the configuration file from the configuration file format to a data structure suitable for storing in a repository, and calling a writing method to write the configuration file in the converted format into the shared memory segment.
As shown in FIG. 3, the file loader calls Publisher a method, takes the converted map message as a parameter, and in the method, data is firstly converted into a data structure which accords with the data stored in the shared memory, and then calls the write method to store the data in the shared memory segment which is created based on topic before, so that the data storage mode not only improves the response speed and the data processing capacity of the system, but also enhances the expandability and the flexibility of the system.
In order to improve modularization and reusability, the related functions of Publisher, topic and memory can be packaged into a dynamic library, so that a file loader can call an interface in the library when needed, the logic for sharing memory management is not required to be repeatedly realized, the development process is simplified, and the maintainability of codes is improved.
The overall flow steps of fig. 3 are as follows.
1) And reading the json configuration file.
The file loader first reads a specified json configuration file that contains communication channels and instances corresponding to different services to be accessed. The data in the configuration file is converted into a message in the format of std:: map < std: string, std:: string >, which is convenient for subsequent processing and storage.
2) A shared memory segment is created.
In the construction function Publisher, a topmessage named "map_message" is created first, then the create_memory_segment function is called, and a shared memory segment is allocated to the configuration file according to the topmessage, which ensures that data can be shared safely and efficiently among multiple processes.
3) And issuing the message to the shared memory.
The file loader then invokes the method Publisher and passes in the previously read and converted map message as a parameter. In the method, firstly, a map-format file is converted into a data structure suitable for being stored in a shared memory, and after conversion is completed, a write method is called to write a configuration file into a shared memory segment.
4) The shared memory is refreshed periodically.
The file loader is designed to run periodically, considering that json profiles may be updated at any time. In each run, it will re-read the configuration file and update 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 state, and in order to achieve this, a timer or thread loop may be used to periodically check the modification time of the file and perform a corresponding update.
In a second embodiment, the specific content in the step 3 includes obtaining a topic parameter and a callback function which are transmitted by the adaptive application, returning an address of a shared memory segment to the adaptive application according to the topic parameter, wherein the topic parameter is used for determining the address of the shared memory segment subscribed by the topic, the callback function is used for obtaining configuration files of all services to be accessed from the address of the shared memory segment, calling the callback function to send the configuration files to the adaptive application, traversing the configuration files of all the services to be accessed by the adaptive application, and searching the configuration files of the target access service.
The self-adaptive application transmits a topic parameter and a callback function to the system, wherein the topic parameter is used for determining the address of the shared memory segment subscribed by the topic, and the callback function is used for acquiring the configuration file in the shared memory segment.
The system performs corresponding logic processing to determine the address of the shared memory segment to be searched according to the received topic parameter, the step involves resolving the topic parameter to accurately match to the corresponding memory location, and then the system needs to check whether the address of the memory segment does exist in the memory bank. If so, this address information is returned to the adaptive application, otherwise, if not, it may be necessary to trigger an error handling procedure or return specific error information to the caller.
Once the adaptive application has obtained the correct address of the shared memory segment, it initiates the topic information that is used to request the callback function that was passed in before the system call to pass all the configuration files read to the adaptive application.
The self-adaptive application traverses the received configuration files of all the services to be accessed, and identifies the target configuration files of the target access service. The process is realized based on keyword searching, regular expression matching and other technologies, and the final purpose is to precisely locate the required files from a plurality of configuration files.
Fig. 4 is a signaling diagram of the subscription of the adaptive application to the shared memory data, including the following steps.
1) And calling a subscniber method to acquire data.
In an adaptive application, the subscnber constructor accepts two parameters, a topic parameter and a callback function.
Topic parameter this parameter is used to find the shared memory segment. By calling the create memory segment function, the system checks whether the shared memory segment corresponding to the topic parameter already exists. If the function exists, the function returns the address of the shared memory segment for subsequent data reading, and if the function does not exist, an exception may be thrown or an error code may be returned to prompt the user to perform corresponding processing.
Callback function, which is used to obtain data from shared memory segment. Through this mechanism, the subscore can pass the found profile to the adaptive application.
1) The shared memory address is obtained.
And the system calls a subscore method to acquire the topic parameter and the callback function which are transmitted by the data self-adaptive application, then calls a create_memory_segment function to determine whether the shared memory segment created by the topic exists, and if so, determines that the subscription is completed.
2) And executing the callback function.
The self-adaptive application initiates topic information, and the system adopts a callback function to package and send all the configuration files read from the shared memory segment to the self-adaptive application. The execution of the callback function not only returns the data, but may also perform some additional logic in the process, such as data parsing, format conversion, etc., to facilitate subsequent processing.
3) Traversing and processing the returned data.
The self-adaptive application receives all the configuration files and traverses and analyzes the configuration files, so that the communication channels and the instance information of the target access service are extracted.
In the application, the communication channel and the instance information of the service to be accessed are distributed to the memory bank in a configurable mode in a topic mode, and the self-adaptive application can subscribe the topic to acquire the communication channel and the instance information from the memory bank. When the communication channel and the instance information are changed, only the json file needs to be changed, the file loader can read the json file and release the json file to the shared memory at intervals, the self-adaptive application subscribes to topic to acquire the latest channel and instance of the target access service, and the self-adaptive application does not need to be recompiled, so that the new channel and instance can be dynamically loaded.
The adaptive application receives the communication channel and instance information of the target access service, and can deliver the content to the service provider and the service consumer, the service consumer discovers the service by using the method FIND SERVICE, and the service provider creates the service by using the method CREATE SERVICE, and the creation and discovery of the service are described in detail below.
The AP service is first introduced.
Services in the AP are provided and consumed in processes, and the processes are uniformly managed by an em execution management module (running on one process of the AP platform) of the AP platform. The SOA service interfaces are divided into three types in total, including method, event, field.
The Method comprises the steps that a client can call an interface in a service, the client is triggered to call once and run once, and the service is passively received.
The Event is that the server can periodically inform the client, and the client is informed by actively triggering the local Event of the server.
Field includes Set, get, notifier modes, can be Set (Set), can be read (Get), and can be notified (Notifier). When the server triggers and changes data, notification (Notifier) is performed. The client may alter (Set) or read (Get) the data.
Fig. 5 is a schematic flow chart of service creation, including the following four steps.
The first step, the AP service matrix mainly configures information related to services and communication protocols, wherein the information is configured as follows, a communication channel adopted by the services (comprising a someip, dds and ipc) and parameter configuration related to the communication channel protocols are configured, the someip and the dds are used for cross-ECU communication, dds is used for high-load transmission data, the ipc is used for ECU internal communication, the interface under the services is indicated to be of which type (method, event or field), the access parameters of each interface are indicated, the implementation mode of each interface is indicated, the data type of the access parameters of the interfaces is defined, and the communication behavior definition of the services is mainly used for reflecting the interaction relation of each service among or in the ECU.
In the second step, the AP service matrix imports Mainfest the configuration tool, and the Mainfest configuration tool combines the configuration information in the first step, and configures the process resource allocation, the process lifecycle management, the access rights, and the like running on the AP platform to generate a ARMXML file.
Thirdly, the code generating tool generates configuration information related to the platform, skeleton codes and proxy codes of the service according to the imported armxml files.
And fourthly, integrating the business process, namely the self-adaptive application as required, enabling the proxy code of the service to be called by the consumer to initiate access to the service, and enabling the provider to call the skeleton code of the service to realize the service.
Fig. 6 is a schematic flow chart of service registration and discovery, including five steps as shown in fig.
① The service provider registers to the service registry of the ECU1 by providing instance ids (deployment information binding the service, including event, field, method interface information under the service, ip and port information of ECU, etc.), channels (employed communication protocol someip, dds, ipc).
The service consumer sends the instance id and the channel to the service registry of the ECU2 indicating that it needs to find a certain service.
② The service registration center of the ECU2 determines whether the present ECU provides the searched service. If not, the service registry of the ECU2 will send a multicast message to the service registry of the ECU1, and if so, directly back to the service consumer.
③ The service registry of the ECU1 receives the multicast message sent by the service registry of the ECU2, and discovers that the service is provided in the ECU1, and then the service registry of the ECU1 replies a unicast message (carrying ip and port information for providing the service).
④ The service registry of the ECU2 receives the unicast message and forwards it to the service consumer in the ECU 2.
⑤ The service consumer of the ECU2 takes in ip and port providing the service and establishes a connection directly with the service provider of the ECU 1.
The application provides a AutosarAP overall flow step of service creation and discovery, comprising the following steps.
And 1, realizing access to the repository in a publish and subscribe mode based on topic.
1) And reading the json configuration file.
The file loader first reads a specified json configuration file that contains communication channels and instances corresponding to different services to be accessed. The data in the configuration file is converted into a message in the format of std:: map < std: string, std:: string >, which is convenient for subsequent processing and storage.
2) A shared memory segment is created.
In the constructor Publisher, a topmessage named "map_message" is created first, then the create_memory_segment function is called, and a shared memory segment is allocated to the configuration file according to the topmessage.
3) And issuing the message to the shared memory.
The file loader then invokes the method Publisher and passes in the previously read and converted map message as a parameter. Within this method, a map-formatted file is first converted into a data structure suitable for storage in shared memory. After the conversion is completed, a write method is called to write the configuration file into the shared memory segment.
And 2, self-adapting application subscribes to the configuration files in the repository.
1) The shared memory address is obtained.
And the system calls a subscore method to acquire the data self-adaptive application incoming topic parameter and a callback function, and the system calls a create_memory_segment function to determine whether a shared memory segment created by topic exists or not, and if so, determines that subscription is completed.
2) And executing the callback function.
And calling a Subscriber method to acquire data, and then initiating the topic information by the self-adaptive application, wherein the topic information carries a callback function, and the callback function of the system packages and sends all the configuration files read from the shared memory section to the self-adaptive application. The execution of the callback function not only returns the data, but may also perform some additional logic in the process, such as data parsing, format conversion, etc., to facilitate subsequent processing.
3) Traversing and processing the returned data.
The self-adaptive application receives all the configuration files and traverses and analyzes the configuration files, so that the communication channels and the instance information of the target access service are extracted.
And 3, the service creator creates the service by using the method CREATE SERVICE.
And 4, registering the service by the service creator and the service consumer, and discovering the service by the service consumer by using the method FIND SERVICE.
Based on the same technical concept, the application provides a device for dynamically loading channels and instances of services based on AutosarAP platforms, as shown in fig. 7, the device comprises:
The loading module 701 is configured to load, by using a file loader, a configuration file of a service to be accessed into a memory bank of the shared memory, where the service to be accessed exists in the AutosarAP platform, and the configuration file includes a communication channel and a service instance of the service to be accessed;
The reading module 702 is configured to read a configuration file from a memory bank when it is detected that the adaptive application needs to create a service or discover a service, where the adaptive application is an application program capable of dynamically adjusting functions and performances according to a user requirement and an environment;
a delivery module 703, configured 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.
Optionally, the loading module 701 is configured to allocate a shared memory segment to each configuration file of the service to be accessed in the repository, where the configuration files of different services to be accessed are different;
the reading module 702 is configured to determine a target shared memory segment corresponding to the target access service, and read a target configuration file of the target access service from the target shared memory segment.
Optionally, the loading module 701 is configured to load the configuration files of the service to be accessed into a memory bank of the shared memory through a file loading program, where the allocation of the same shared memory segment to the configuration files of the plurality of services to be accessed is performed in the memory bank, and the configuration files of different services to be accessed are different;
the reading module 702 is configured to read configuration files of all services to be accessed from the shared memory segment, and search, by using the adaptive application, a target configuration file of a target access service in a manner of traversing data.
Optionally, the loading module 701 is configured to:
reading configuration files of a plurality of services to be accessed from a set position through a file loading program, and converting the configuration files into a set file format;
creating a topic message by Publisher constructors;
and calling a setting function and distributing the same shared memory segment in the repository for the configuration file based on the topic message.
Optionally, the loading module 701 is configured to:
calling Publisher a method to transfer a configuration file with a set file format;
converting the configuration file from a configuration file format to a data structure suitable for storing in a repository;
and calling a writing method to write the configuration file with the converted format into the shared memory segment.
Optionally, the reading module 702 is configured to:
The method comprises the steps of obtaining a topic parameter and a callback function which are transmitted by the self-adaptive application, wherein the topic parameter is used for determining an address of a shared memory segment subscribed by the topic, and the callback function is used for obtaining a configuration file in the shared memory segment;
Returning the address of the shared memory segment to the self-adaptive application according to the topic parameter;
acquiring configuration files of all services to be accessed from addresses of the shared memory segment, and calling a callback function to send the configuration files to the self-adaptive application;
traversing all the configuration files of the service to be accessed through the self-adaptive application, and searching out the configuration files of the target access service.
Optionally, the reading module 702 is configured to:
determining the address of the memory segment to be searched according to the topic parameter;
judging whether a memory segment address exists in a memory bank or not;
If so, returning the memory segment address to the adaptive application.
As shown in fig. 8, an embodiment of the present application provides an electronic device, which includes a processor 801, a communication interface 802, a memory 803, and a communication bus 804, where the processor 801, the communication interface 802, and the memory 803 complete communication with each other through the communication bus 804.
A memory 803 for storing a computer program.
In one embodiment of the present application, the processor 801 is configured to implement the method for dynamically loading channels and instances of services based on AutosarAP platforms provided in any of the foregoing method embodiments when executing a program stored on the memory 803, where the method includes:
The method comprises the steps of 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 a AutosarAP platform, the configuration file comprises a communication channel and a service instance of the service to be accessed, reading the configuration file from the memory library when the self-adaptive application is detected to need to create the service or discover the service, wherein the self-adaptive application is an application program capable of dynamically adjusting functions and performances according to user requirements and environments, and transmitting the configuration file to the self-adaptive application so that the self-adaptive application can use the configuration file to create the service or discover the service.
Optionally, loading the configuration files of the service to be accessed into the memory bank of the shared memory through the file loading program comprises the steps of respectively distributing a shared memory segment for the configuration files of each service to be accessed in the memory bank, wherein the configuration files of different services to be accessed are different, loading the configuration files of each service to be accessed into the corresponding shared memory segment through the file loading program, and reading the configuration files from the memory bank comprises the steps of determining a target shared memory segment corresponding to the target access service and reading the target configuration files of the target access service from the target shared memory segment.
Optionally, loading the configuration files of the service to be accessed into a memory bank of the shared memory through the file loading program comprises the steps of distributing the same shared memory section for the configuration files of the service to be accessed in the memory bank, wherein the configuration files of different services to be accessed are different, loading the configuration files of the service to be accessed into the same shared memory section through the file loading program, and reading the configuration files from the memory bank comprises the steps of reading the configuration files of all the services to be accessed from the shared memory section and searching the target configuration files of the target access service in a traversal data mode through the adaptive application.
Optionally, allocating the same shared memory segment to the configuration files of the plurality of services to be accessed in the repository includes reading the configuration files of the plurality of services to be accessed from the set location by a file loader and converting the configuration files to a set file format, creating a topic message by a Publisher constructor, calling the set function and allocating the same shared memory segment to the configuration files in the repository based on the topic message.
Optionally, loading the configuration files of the plurality of services to be accessed into the same shared memory segment through the file loading program comprises calling Publisher a method to transfer the configuration files with the configuration file format, converting the configuration files from the configuration file format into a data structure suitable for being stored in a memory bank, and calling a writing method to write the configuration files with the converted format into the shared memory segment.
The method comprises the steps of obtaining a topic parameter and a callback function which are transmitted by an adaptive application, wherein the topic parameter is used for determining an address of a shared memory segment subscribed by the topic, the callback function is used for obtaining 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 the configuration file of all the services to be accessed from the address of the shared memory segment, calling the callback function to send the configuration file to the adaptive application, traversing the configuration file of all the services to be accessed by the adaptive application, and finding the configuration file of the target access service.
Optionally, returning the address of the shared memory segment to the adaptive application according to the topic parameter includes determining the address of the memory segment to be searched according to the topic parameter, determining whether the address of the memory segment exists in the memory bank, and returning the address of the memory segment to the adaptive application if the address of the memory segment exists.
The embodiment of the application also provides a computer readable storage medium, on which a computer program is stored, the computer program implementing the steps of the method for dynamically loading channels and instances of services based on AutosarAP platforms provided in any one of the method embodiments described above when executed by a processor.
The apparatus embodiments described above are merely illustrative, wherein the elements illustrated as separate elements may or may not be physically separate, and the elements shown as elements may or may not be physical elements, may be located in one place, or may be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
From the above description of embodiments, it will be apparent to those skilled in the art that the embodiments may be implemented by means of software plus a general purpose hardware platform, or may be implemented by hardware. Based on such understanding, the foregoing technical solution may be embodied essentially or in a part contributing to the related art in the form of a software product, which may be stored in a computer readable storage medium, such as ROM/RAM, a magnetic disk, an optical disk, etc., including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to perform the method described in the respective embodiments or some parts of the embodiments.
It is to be understood that the terminology used herein is for the purpose of describing particular example embodiments only, and is not intended to be limiting. As used herein, the singular forms "a", "an" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. The terms "comprises," "comprising," "includes," "including," and "having" are inclusive and therefore specify the presence of stated features, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, steps, operations, elements, components, and/or groups thereof. The method steps, processes, and operations described herein are not to be construed as necessarily requiring their performance in the particular order described or illustrated, unless an order of performance is explicitly stated. It should also be appreciated that additional or alternative steps may be used.
The foregoing is only a specific embodiment of the invention to enable those skilled in the art to understand or practice the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.