A service subscription method, a computer readable storage medium and a smart device

By using a service subscription method that maps message identifiers to data structures in an SOA architecture, the problems of high resource consumption and high update costs are solved, and an efficient and flexible service subscription process is achieved.

CN118972440BActive Publication Date: 2026-05-19NIO TECH ANHUI CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
NIO TECH ANHUI CO LTD
Filing Date
2024-08-23
Publication Date
2026-05-19

AI Technical Summary

Technical Problem

In existing technologies, each upper-layer application consumes a lot of resources when requesting SOA services, and when the IDL changes, all applications need to update their SOA service access code, resulting in high update and iteration costs.

Method used

By obtaining the application's registration configuration parameters, using the message identifier and message data structure mapping table to determine the required subscription message data, and sending a service subscription request to the server based on this data, the original message data is obtained and split into message units and sent to the application, thereby achieving unified access and management and simplifying the service subscription process.

Benefits of technology

It enables unified access and management of different servers, reduces resource consumption, simplifies service subscription, avoids frequent application updates caused by server updates, and reduces update and iteration costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118972440B_ABST
    Figure CN118972440B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of communication, and particularly provides a service subscription method, a computer readable storage medium and an intelligent device, aiming to solve the problems of large resource consumption and high updating and iteration cost in the existing service subscription process. For this purpose, the service subscription method comprises the following steps: acquiring registration configuration parameters of an application program, wherein the registration configuration parameters at least comprise a request message identifier; performing service subscription based on the request message identifier, acquiring original message data published by a server when the server publishes the message; acquiring a message unit corresponding to the original message data based on a pre-stored message identifier and message data structure mapping table; the message unit comprises a published message identifier and a message value; and sending the message unit to the application program based on at least the published message identifier and the registration configuration parameters. The method can avoid the problems of large resource consumption, high updating and iteration cost caused by the access of multiple application programs.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of communication technology, specifically providing a service subscription method, a computer-readable storage medium, and a smart device. Background Technology

[0002] As a core area of ​​automotive intelligence, the intelligent cockpit not only integrates advanced information technology, artificial intelligence, and human-machine interaction technology, but also provides drivers with a safer, more comfortable, and convenient driving experience through intelligent and connected means. In an intelligent cockpit system based on SOA (Service Oriented Architecture), the capabilities of sensors and controllers can be abstracted as services, and these services can be provided to upper-layer applications, such as in-vehicle entertainment systems, navigation systems, and intelligent driving assistance services. Upper-layer applications can register and use these services to realize various intelligent functions, such as navigation, voice recognition, intelligent driving assistance, remote monitoring, and entertainment.

[0003] However, in existing technologies, each upper-layer application operates independently when requesting SOA services, with each application possessing its own service access code, caching mechanisms, and processing operations. This decentralization leads to redundancy in network data transmission, significantly increasing resource consumption. Furthermore, when the service's Interface Definition Language (IDL) changes, all applications that depend on that service must update their SOA service access code and recompile, potentially resulting in high update and iteration costs. Summary of the Invention

[0004] The present invention aims to solve the above-mentioned technical problems, namely, to solve the problems of high resource consumption and high update and iteration costs in the existing service subscription process.

[0005] In a first aspect, the present invention provides a service subscription method, comprising:

[0006] Obtain the application's registration configuration parameters, which include at least a request message identifier; wherein the request message identifier is the identifier corresponding to the attribute field in the required subscription message data;

[0007] Based on the request message identifier and the pre-stored message identifier and message data structure mapping table, determine the required subscription message data; and send a service subscription request to the server based at least on the required subscription message data.

[0008] Obtain the original message data published by the server;

[0009] Based on the pre-stored mapping table between the message identifier and the message data structure, the message unit corresponding to the original message data is obtained; the message unit includes a published message identifier and a message value;

[0010] The message unit is sent to the application based at least on the published message identifier and the registration configuration parameters.

[0011] In some embodiments, obtaining the application's registration configuration parameters further includes obtaining the application's subscription message type and / or subscription period.

[0012] In some embodiments, after obtaining the application's registration configuration parameters, the method further includes:

[0013] Obtain the process identifier of the application;

[0014] A registration information list is constructed based on the process identifier and the registration configuration parameters.

[0015] In some embodiments, before determining the required subscription message data based on the request message identifier and the pre-stored message identifier and message data structure mapping table, the method further includes:

[0016] Retrieve multiple attribute fields from each of multiple message data structures;

[0017] Configure the message identifier for each of the multiple attribute fields, and associate the multiple attribute fields of each message data structure with the message identifier corresponding to each of the multiple attribute fields to construct a mapping table between the message identifier and the message data structure.

[0018] In some embodiments, sending a service subscription request to the server based at least on the required subscription message data includes:

[0019] Based on the required subscription message data and interface definition language file, generate service access code;

[0020] A service subscription request is sent to the server based on the service access code.

[0021] In some embodiments, before generating service access code based on the required subscription message data and interface definition language file, the method further includes:

[0022] Obtain the modified interface definition language file;

[0023] Compare the modified interface definition language file with the locally cached interface definition language file;

[0024] The service access code is updated based on the comparison results, and a service subscription request is sent based on the updated service access code.

[0025] In some embodiments, after comparing the modified interface definition language file with the locally cached interface definition language file, the method further includes:

[0026] The change information is determined based on the comparison results;

[0027] Determine whether the changed information is a preset automatic processing type;

[0028] If yes, automatically update the message identifier and message data structure mapping table based on the change information; if no, generate change entries based on the change information and issue change reminders based on the change entries.

[0029] In some embodiments, sending the message unit to the application based at least on the published message identifier and the registration configuration parameters includes:

[0030] Based on the published message identifier, the process identifier and registration configuration parameters of the application are obtained from the registration information list;

[0031] When the registration configuration parameters include a request message identifier and a subscription message type, and the subscription message type is incremental subscription, it is determined whether the message value corresponding to the message unit is consistent with the historical message value; if not, the message unit is sent to the application based on the process identifier and the request message identifier.

[0032] When the registration configuration parameters include a request message identifier and a subscription period, the message unit is sent to the application based on the process identifier, the subscription period, and the request message identifier;

[0033] When the registration setting parameters include a request message identifier, a subscription message type, and a subscription period, and the subscription message type is an incremental subscription, it is determined whether the message value corresponding to the message unit is consistent with the historical message value; if not, the message unit is sent to the application based on the process identifier, the subscription period, and the request message identifier.

[0034] In some embodiments, before sending the message unit to the application based at least on the published message identifier and the registration configuration parameters, the method further includes:

[0035] The priority of the message unit is determined based on a pre-stored priority configuration file, and the message unit is sent to the application based on the priority, the published message identifier, and the registration configuration parameters.

[0036] In a second aspect, this application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the service subscription method described in any of the preceding claims.

[0037] In a third aspect, this application provides a smart device comprising:

[0038] At least one processor;

[0039] A memory that is communicatively connected to the at least one processor;

[0040] The memory stores a computer program that, when executed by the at least one processor, implements the service subscription method described above.

[0041] Solution 1. A service subscription method, characterized by comprising:

[0042] Obtain the application's registration configuration parameters, which include at least a request message identifier; wherein the request message identifier is the identifier corresponding to the attribute field in the required subscription message data;

[0043] Based on the request message identifier and the pre-stored message identifier and message data structure mapping table, determine the required subscription message data; and send a service subscription request to the server based at least on the required subscription message data.

[0044] Obtain the original message data published by the server;

[0045] Based on the pre-stored mapping table between the message identifier and the message data structure, the message unit corresponding to the original message data is obtained; the message unit includes a published message identifier and a message value;

[0046] The message unit is sent to the application based at least on the published message identifier and the registration configuration parameters.

[0047] Solution 2. The method according to Solution 1, wherein obtaining the registration configuration parameters of the application further includes: obtaining the subscription message type and / or subscription period of the application.

[0048] Solution 3. The method according to Solution 1 or 2, characterized in that, after obtaining the registration configuration parameters of the application, the method further includes:

[0049] Obtain the process identifier of the application;

[0050] A registration information list is constructed based on the process identifier and the registration configuration parameters.

[0051] Solution 4. The method according to Solution 1, characterized in that, before determining the required subscription message data based on the request message identifier and the pre-stored message identifier and message data structure mapping table, it further includes:

[0052] Retrieve multiple attribute fields from each of multiple message data structures;

[0053] Configure the message identifier for each of the multiple attribute fields, and associate the multiple attribute fields of each message data structure with the message identifier corresponding to each of the multiple attribute fields to construct a mapping table between the message identifier and the message data structure.

[0054] Solution 5. The method according to Solution 1, characterized in that, sending a service subscription request to the server based at least on the required subscription message data includes:

[0055] Based on the required subscription message data and interface definition language file, generate service access code;

[0056] A service subscription request is sent to the server based on the service access code.

[0057] Solution 6. The method according to Solution 5, characterized in that, before generating the service access code based on the required subscription message data and interface definition language file, the method further includes:

[0058] Obtain the modified interface definition language file;

[0059] Compare the modified interface definition language file with the locally cached interface definition language file;

[0060] The service access code is updated based on the comparison results, and a service subscription request is sent based on the updated service access code.

[0061] Solution 7. The method according to Solution 6, characterized in that, after comparing the modified interface definition language file and the locally cached interface definition language file, the method further includes:

[0062] The change information is determined based on the comparison results;

[0063] Determine whether the changed information is a preset automatic processing type;

[0064] If yes, automatically update the message identifier and message data structure mapping table based on the change information; if no, generate change entries based on the change information and issue change reminders based on the change entries.

[0065] Solution 8. The method according to Solution 3, characterized in that, sending the message unit to the application based at least on the published message identifier and the registration configuration parameters includes:

[0066] Based on the published message identifier, the process identifier and registration configuration parameters of the application are obtained from the registration information list;

[0067] When the registration configuration parameters include a request message identifier and a subscription message type, and the subscription message type is incremental subscription, it is determined whether the message value corresponding to the message unit is consistent with the historical message value; if not, the message unit is sent to the application based on the process identifier and the request message identifier.

[0068] When the registration configuration parameters include a request message identifier and a subscription period, the message unit is sent to the application based on the process identifier, the subscription period, and the request message identifier;

[0069] When the registration setting parameters include a request message identifier, a subscription message type, and a subscription period, and the subscription message type is an incremental subscription, it is determined whether the message value corresponding to the message unit is consistent with the historical message value; if not, the message unit is sent to the application based on the process identifier, the subscription period, and the request message identifier.

[0070] Solution 9. The method according to Solution 1, characterized in that, before sending the message unit to the application based at least on the published message identifier and the registration configuration parameters, the method further includes:

[0071] The priority of the message unit is determined based on a pre-stored priority configuration file, and the message unit is sent to the application based on the priority, the published message identifier, and the registration configuration parameters.

[0072] Solution 10. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program, which, when executed by a processor, implements the service subscription method as described in any one of Solutions 1 to 9.

[0073] Option 11. A smart device, characterized in that it comprises:

[0074] At least one processor;

[0075] A memory that is communicatively connected to the at least one processor;

[0076] The memory stores a computer program that, when executed by the at least one processor, implements the service subscription method as described in any one of schemes 1 to 9.

[0077] By adopting the above technical solution, this application can obtain the application's registration configuration parameters, which at least include a request message identifier; determine the required subscription message data based on the request message identifier and a pre-stored message identifier and message data structure mapping table; and send a service subscription request to the server based at least on the required subscription message data; obtain the original message data published by the server; obtain the message unit corresponding to the original message data based on the pre-stored message identifier and message data structure mapping table; the message unit includes a published message identifier and a message value; and send the message unit to the application based at least on the published message identifier and the registration configuration parameters. This method can achieve unified access and management of different servers, avoiding the problem of high resource consumption caused by multiple application accesses. At the same time, based on the message identifier and message data structure mapping table, the original message data can be split into multiple message units and each message unit can be assigned a globally unique message identifier, allowing the application to subscribe to services based on the message identifier, i.e., the request message identifier, simplifying the difficulty of service subscription and avoiding the problem of high update and iteration costs caused by the application needing to adapt to server updates and iterations. Attached Figure Description

[0078] The preferred embodiments of the present invention are described below with reference to the accompanying drawings, in which:

[0079] Figure 1 This is a schematic diagram of the service subscription system provided in the embodiments of this application;

[0080] Figure 2 This is a schematic flowchart of a service subscription method provided in an embodiment of this application;

[0081] Figure 3 This is a schematic diagram of the method for constructing a message identifier and message data structure mapping table provided in an embodiment of this application;

[0082] Figure 4 This is a schematic diagram of the method flow for accessing the update service code provided in an embodiment of this application;

[0083] Figure 5 This is a schematic diagram of the service subscription system structure provided in another embodiment of this application;

[0084] Figure 6 This is a schematic diagram of the message registration phase of the service subscription system provided in this application embodiment;

[0085] Figure 7 This is a schematic diagram of the message publishing phase of the service subscription system provided in this application embodiment;

[0086] Figure 8 This is a schematic diagram of the IDL change access control processing stage of the message registration and publishing system provided in this application embodiment;

[0087] Figure 9 This is a schematic diagram of the structure of the smart device provided in the embodiments of this application. Detailed Implementation

[0088] Some embodiments of this application are described below with reference to the accompanying drawings. Those skilled in the art should understand that these embodiments are merely illustrative of the technical principles of this application and are not intended to limit the scope of protection of this application.

[0089] As described in the background section, in existing technologies, each upper-layer application consumes significant resources when requesting SOA services. Furthermore, when the IDL changes, all applications dependent on the service must update their SOA service access code and recompile, resulting in high update and iteration costs. Therefore, when multiple applications request services simultaneously, fault points are scattered, making centralized troubleshooting and repair difficult. Additionally, the strong coupling between applications and the IDL reduces the flexibility of service subscription. In view of this, this application provides a service subscription method.

[0090] It should be noted that the service subscription method provided in this application can be implemented based on SOA architecture. SOA architecture provides more flexible, efficient and stable service selection and usage methods for subscribers, i.e., applications, by providing componentized, loosely coupled and reusable services during the service subscription process.

[0091] See Figure 1 As shown, Figure 1 This is a schematic diagram of a service subscription system provided in an embodiment of this application. It may include an application, a message registration and publishing system, and a server. The message registration and publishing system can execute the service subscription method provided in this application, send the service subscription request of the application to the server, and provide the message data published by the server to the corresponding application.

[0092] In some embodiments, multiple applications can be configured (not shown in the figure), and these applications and the message registration and publishing system can all reside on the Linux / QNX operating system. Connections between these applications and the message registration and publishing system can be established through inter-process communication. Linux is an open-source Unix-like operating system, and QNX is a distributed real-time operating system.

[0093] In some embodiments, the server may include multiple nodes (not shown in the figure), which can be publishers of SOA services. These nodes may include at least one of sensors, actuators, ECUs (Electronic Control Units), and I / O (Input / Output) devices. The message registration and publishing system can establish a connection with the server via a network.

[0094] In some embodiments, see Figure 2 As shown, Figure 2 This is a schematic flowchart of a service subscription method provided in an embodiment of this application, which can be applied to the implementation of a message registration and publishing system, and includes:

[0095] Step S21: Obtain the application's registration configuration parameters, which include at least the request message identifier; wherein, the request message identifier is the identifier corresponding to the attribute field in the required subscription message data;

[0096] Step S22: Based on the request message identifier and the pre-stored message identifier and message data structure mapping table, determine the required subscription message data; and send a service subscription request to the server based at least on the required subscription message data;

[0097] Step S23: Obtain the original message data published by the server;

[0098] Step S24: Based on the pre-stored message identifier and message data structure mapping table, obtain the message unit corresponding to the original message data; the message unit includes the published message identifier and the message value;

[0099] Step S25: Send the message unit to the application based at least on the published message identifier and registration configuration parameters.

[0100] In some embodiments, obtaining the application's registration configuration parameters in step S21 can be obtaining the application's request message identifier. The request message identifier can be obtained through the following steps: obtaining the application's required subscription message data, which may include multiple attribute fields; for each attribute field's corresponding variable name string, using the MD5 (Message-Digest Algorithm 5) algorithm to obtain the corresponding field's value, which serves as the request message identifier. As an example, the required subscription message data includes a "username" field, whose variable name string is "Username". Using the MD5 algorithm, a 16-byte hash value can be obtained, which serves as the message identifier for this field, i.e., the message ID (Identification).

[0101] In other embodiments, obtaining the application's registration configuration parameters in step S21 may further include obtaining the application's subscription message type and / or subscription period. In some embodiments, the subscription message type may include new listeners and / or full listeners. The subscription period can be flexibly set according to requirements.

[0102] In other embodiments, after step S21, the method may further include: obtaining the process identifier of the application; and constructing a registration information list based on the process identifier and registration configuration parameters.

[0103] The process identifier is a number used to uniquely identify a running process. By associating process identifiers with registration configuration parameters to construct a registration information list, the message registration and publishing system can accurately identify and manage the application's processes. Furthermore, after obtaining the raw message data published by the server, the message registration and publishing system can query the registration information list to determine the application subscribing to the current server, as well as the application's process and registration configuration parameter information. This allows the system to send message units to the appropriate application through the correct process, meeting the application's requirements.

[0104] In the embodiments of this application, see Figure 3 As shown, a mapping table between message identifiers and message data structures can be pre-built using the following steps:

[0105] Step S31: Obtain multiple attribute fields for each message data structure in multiple message data structures;

[0106] Step S32: Configure the message identifier for each of the multiple attribute fields, and associate the multiple attribute fields of each message data structure with the message identifier corresponding to each of the multiple attribute fields to construct a mapping table between message identifier and message data structure.

[0107] As an example, multiple message data structures can be obtained: message data structure A, message data structure B, ..., message data structure N. Message data structure A may include multiple attribute fields: field a1, field a2, ...; message data structure B may include multiple attribute fields: field b1, field b2, ...; message data structure N may include multiple attribute fields: field n1, field n2, ...; For each message data structure, the message identifier corresponding to each attribute field can be obtained using the same method as in step S21 above. Thus, the message identifier corresponding to each attribute field in each message data structure can be obtained. Based on the association between message data structure, attribute fields, and message identifiers, such as message data structure A: field a1 - message identifier ID1, message data structure A: field a2 - message identifier ID2, etc., a mapping table between message identifiers and message data structures can be constructed.

[0108] By assigning a globally unique message identifier to each attribute field, applications can use this message identifier as a unique identifier to access the registration and publishing system, simplifying the integration process. Furthermore, by adding a mapping table between message identifiers and message data structures, and assigning a globally unique message identifier to each attribute field, message identifier stability is ensured, effectively avoiding the problem of frequent application modifications due to changes in the IDL file.

[0109] In step S22, the pre-stored message identifier and message data structure mapping table obtained based on steps S31 and S32 above can be used to determine the required subscription message data corresponding to the request message identifier.

[0110] In some embodiments, sending a service subscription request to the server based at least on the required subscription message data in step S22 may include:

[0111] Generate service access code based on the required subscription message data and interface definition language file; send a service subscription request to the server based on the service access code.

[0112] In some embodiments, service access code based on the DDS (Data Distribution Service) protocol can be generated using scripts according to the definitions in the Interface Definition Language (IDL) file. The service access code can cover functions such as service registration, message listening and callback processing, message publishing and connection management.

[0113] In some embodiments, the Interface Definition Language (IDL) file can be an IDL file cached locally; in other embodiments, when the server's services and messages change, the corresponding IDL file version number will be updated, and the updated IDL file, i.e., the modified IDL file, can be committed to the code repository. See [link to relevant documentation] for details. Figure 4 As shown, before generating service access code based on the required subscription message data and interface definition language file, the method may further include:

[0114] Step S41: Obtain the modified interface definition language file;

[0115] Step S42: Compare the modified interface definition language file with the locally cached interface definition language file;

[0116] Step S43: Update the service access code based on the comparison results, and send a service subscription request based on the updated service access code.

[0117] This method can automatically track changes in IDL file versions and update the service access code accordingly to adapt to new services or new message data structures.

[0118] In some embodiments, the interface definition language file may include at least one of the following: message name, field name, message type, method name, method parameters, and method type. When at least one of the above information changes and / or when at least one of the services is modified, deleted, or added, the version number and content of the interface definition language file will change accordingly.

[0119] Accordingly, in some embodiments, step S42 may specifically involve comparing the version numbers of the modified interface definition language file and the locally cached interface definition language file. When the version numbers are the same, the contents of the modified interface definition language file and the locally cached interface definition language file are compared.

[0120] In some embodiments, step S43 may specifically involve generating an updated service access code based on the change information when the comparison is inconsistent, to adapt to the new interface or data structure, and sending a service subscription request based on the updated service access code.

[0121] In some other embodiments, the step S42 may further include:

[0122] The change information is determined based on the comparison results;

[0123] Determine whether the changed information is a preset automatic processing type;

[0124] If yes, automatically update the message identifier and message data structure mapping table based on the change information; if no, generate change entries based on the change information and provide change reminders based on the change entries.

[0125] This method automatically tracks IDL version changes and, for changes that can be processed automatically, automatically updates the message identifier and message data structure mapping table, reducing manual intervention. For changes that cannot be processed automatically, it automatically generates change entries and sends change notifications, facilitating timely updates to the message identifier and message data structure mapping table. The method allows for the setting of preset automatic processing types to handle different types of changes as needed.

[0126] In some embodiments, when the change information indicates the addition of a new service or modification of method parameters, the message identifier-to-message data structure mapping table can be automatically updated based on the change information. For example, when the change information indicates the addition of a new service, the message data structure of the new service can be split into multiple message units, and a globally unique message identifier can be generated for each message unit. Then, the message identifier-to-message data structure mapping table can be updated based on the message data structure and message identifier of the new service.

[0127] In some embodiments, when the change information is a message name, field name, or method name, change entries can be generated based on the change information, and change notifications can be sent based on these change entries. In some embodiments, change notifications can be sent to external devices or users via email or report notifications, enabling users to update the message identifier and message data structure mapping table based on the change notifications.

[0128] In some embodiments, step S23 may specifically involve obtaining the original message data published by the server by setting a callback function.

[0129] In some embodiments, the original message data obtained through the callback function can be sequenced message data. Accordingly, after step S23, the method may further include deserializing the original message data and performing validity verification and / or value range verification to ensure the integrity and correctness of data transmission. Furthermore, this message registration and publishing system can achieve unified access and management of servers, uniformly verifying the value range and validity of original message data published by different servers, thus avoiding the problem of high resource consumption caused by multiple upper-layer applications accessing the system.

[0130] In some embodiments, the original message data may include multiple attribute fields and a message value corresponding to each attribute field. Step S24 may specifically involve determining the message identifier corresponding to each attribute field in the original message data based on a pre-stored message identifier and message data structure mapping table, and treating the message identifier corresponding to the attribute field and the message value corresponding to that attribute field as a message unit. In some embodiments, the message value may be basic data types such as integer, floating-point, and enumerated values.

[0131] In some embodiments, when the registration configuration parameters include a request message identifier, step S25 may specifically involve obtaining the application corresponding to the request message identifier that is consistent with the current published message identifier, and forwarding the message unit to the determined application.

[0132] In other embodiments, after the registration information list has been pre-constructed based on the process identifier and registration configuration parameters, step S25 may further be as follows:

[0133] The application's process identifier and registration configuration parameters are obtained from the registration information list based on the published message identifier.

[0134] When the registration configuration parameters include a request message identifier and a subscription message type, and the subscription message type is incremental subscription, it is determined whether the message value corresponding to the message unit is consistent with the historical message value; if not, the message unit is sent to the application based on the process identifier and the request message identifier; if yes, it does not need to be forwarded to the application.

[0135] When the registration configuration parameters include a request message identifier and a subscription period, message units are sent to the application based on the process identifier, subscription period, and request message identifier.

[0136] In some embodiments, a timer task for the corresponding subscription period can be started, and when the timer period is met, a message unit is sent to the application based on the process identifier and the request message identifier.

[0137] When the registration parameters include the request message identifier, the subscription message type, and the subscription period, and the subscription message type is incremental subscription, it is determined whether the message value corresponding to the message unit is consistent with the historical message value; if not, the message unit is sent to the application based on the process identifier, the subscription period, and the request message identifier.

[0138] When the message value corresponding to a message unit is inconsistent with the historical message value, i.e., the message value has changed, and the timing period meets the subscription period, the message unit is sent to the application based on the process identifier and the request message identifier.

[0139] In some embodiments, when the message value corresponding to a message unit is consistent with the historical message value, i.e. there is no change in the message value, it is not necessary to forward the message unit to the corresponding application.

[0140] In some other embodiments, step S25 may also include:

[0141] The priority of message units is determined based on a pre-stored priority configuration file, and the message units are sent to the application based on the priority, the published message identifier, and the registration configuration parameters.

[0142] In some embodiments, the priority configuration file stores the correspondence between message identifiers and priorities, where the priority level can be set according to actual application requirements. For example, priorities can be divided into high priority, medium priority, and low priority based on security level. By determining the priority of message units based on the pre-stored priority configuration file, step S25 can correspondingly send message units to the application in descending order of priority. Specifically, the sending can be performed by combining at least the message unit's published message identifier and registration configuration parameters.

[0143] This method can ensure that high-priority messages are prioritized for scheduling and forwarding, thereby effectively guaranteeing the reliability and stability of the system when processing critical information such as information with high security levels.

[0144] The above describes a service subscription method provided in this application embodiment. The method involves obtaining the application's registration configuration parameters, which at least include a request message identifier; determining the required subscription message data based on the request message identifier and a pre-stored message identifier-to-message data structure mapping table; sending a service subscription request to the server based at least on the required subscription message data; obtaining the original message data published by the server; obtaining the message unit corresponding to the original message data based on the pre-stored message identifier-to-message data structure mapping table; the message unit includes a published message identifier and a message value; and sending the message unit to the application based at least on the published message identifier and registration configuration parameters. This method enables unified access and management of different servers, avoiding the problem of high resource consumption caused by multiple application accesses. Furthermore, by using the message identifier-to-message data structure mapping table, the original message data can be divided into multiple message units, and each message unit can be assigned a globally unique message identifier. This allows the application to subscribe to services based on the message identifier, i.e., the request message identifier, thus decoupling the upper-layer application from IDL changes, simplifying service subscription, and avoiding the problem of high update and iteration costs caused by the application needing adaptive updates when the server updates and iterates.

[0145] Another aspect of this application provides a service subscription system, see [link to relevant documentation]. Figure 5 As shown, Figure 5 This is a schematic diagram of a service subscription system structure provided in another embodiment of this application. It may include an application, a message registration and publishing system, and multiple nodes, all of which are servers. The message registration and publishing system can execute the service subscription method provided in this application, which can send the application's service subscription request to any node and provide the message data published by any node to the corresponding application.

[0146] In some embodiments, the application can be configured with multiple [specific configurations]. Figure 5 The example illustrates a scenario with only one application. Multiple applications and message registry / publishing systems can all reside on the Linux / QNX operating system, and connections between these applications and systems can be established through inter-process communication. Linux is an open-source Unix-like operating system, and QNX is a distributed real-time operating system.

[0147] In some embodiments, multiple nodes can be different publishers of SOA services, and these nodes may include at least one of sensors, actuators, ECUs (Electronic Control Units), and I / O (Input / Output) devices. The message registration and publishing system can establish a connection with the server via a network.

[0148] In some embodiments, such as Figure 5 As shown, a message registration and publishing system may include:

[0149] Inter-process communication module, used for communication with applications.

[0150] The application registration module is used to obtain the application's registration configuration parameter table, parse the registration configuration parameter table, associate the parsed registration configuration parameters with the application's process identifier, and store them in the registration information list. It can also be used to specify the list of message IDs to listen for, incremental changes or full updates of listened messages, and change the call cycle of callback functions according to business needs.

[0151] The registration configuration parameters include at least a request message identifier; wherein the request message identifier is the identifier corresponding to the attribute field in the required subscription message data; in some embodiments, the registration configuration parameters may also include the application's subscription message type and / or subscription period. Figure 5 The example shows that the registration configuration parameters include the request message identifier (i.e., message ID), the subscription message type (incremental listening or full listening), and a list of registration information with multiple different values ​​for the subscription period.

[0152] The service access code generation module is used to generate service access code based on the IDL file.

[0153] In some embodiments, SOA service access code based on the DDS protocol can be generated using a script based on the IDL file. The service access code can cover functions such as service registration, message listening, callback processing, message publishing, and connection management.

[0154] The data transfer module is used to acquire the original message data published by each node, read the message identifier-message data structure mapping table (i.e., the message ID-message data structure mapping table), decompose the original message data structure into multiple message units, and store them in a message unit list. In some embodiments, when the original message data is sequential message data, the data transfer module can also be used to deserialize the original message data and perform value range and / or validity checks. A message unit may include a message ID and a message value.

[0155] By setting up a message ID-message data structure mapping table in the message registration and publishing system, the message data structure is divided into multiple smallest units such as attribute fields, and a globally unique and stable message ID is assigned to each attribute field. This avoids the problem of needing to frequently update application-related configurations due to changes in IDL files, and also facilitates internal transfer and fast retrieval.

[0156] The data priority sorting module includes three different priority processing queues: high, medium, and low. It is used to determine the priority of message units according to the priority configuration file and to pass the message units to the corresponding processing queues according to the priority. During scheduling, message units in each processing queue can be forwarded from high to low priority.

[0157] In some embodiments, the service subscription system can be applied to driving equipment, and can prioritize the message units required for each service subscription according to the level of safety. For example, message units related to vehicle speed and gear can be set to high priority, while non-urgent messages such as air conditioning temperature and / or seat height can be configured to low priority, which can be transmitted when idle, avoiding the occupation of communication bandwidth and saving communication resources.

[0158] The message forwarding module is used to forward message units, which have been processed by the data priority sorting module, to the corresponding applications according to the registration information list. In some embodiments, the message forwarding module can also serialize the message units to enable cross-process data interaction based on the serialized message units, i.e., byte stream data, and provide them to the applications.

[0159] The IDL change access control module is used to trigger the reading of the IDL file version information when the IDL file is changed and committed to the code repository. It compares the IDL file with the locally cached IDL file to detect whether the IDL file has changed. If it has changed, it can call the service access code generation module to generate new service access code.

[0160] In some embodiments, comparing an IDL file with a locally cached IDL file can involve comparing the version number of the IDL file with the version number of the locally cached IDL file. When the version number changes, further change information can be determined. The change information may include information such as message name, field name, message type, method name, method parameters, and method type, as well as whether it is a newly added, deleted, or modified service.

[0161] In some embodiments, it can also be determined whether the change information is a preset automatic processing type. If so, the IDL change access control module can also automatically update the message ID-message data structure mapping table based on the change information. If not, the IDL change access control module can also generate change entries and issue change reminders to notify relevant personnel to process them.

[0162] When the message registration and publishing system is running, it can achieve the same beneficial effects as any of the above-described method embodiments of this application.

[0163] like Figure 5As shown, in some embodiments, the application may include an inter-process communication module for communicating with the message registration and publishing system; a message registration module for creating registration tasks based on subscription requirements of other functions and provided registration information and registering with the message registration and publishing system through the inter-process communication module; and a message parsing module for obtaining message units forwarded by the message registration and publishing system and parsing the message units to obtain message values ​​for other functional modules.

[0164] Figure 5 The example illustrates three nodes: a sensor, an actuator, and an ECU. Each node can include a message writing module, a DDS protocol layer, and a TCP / IP protocol layer. TCP (Transmission Control Protocol) and IP (Internet Protocol) are the basic communication protocols of the Internet. Similarly, the message registration and publishing system can also be configured with a DDS protocol layer and a TCP / IP protocol layer for communication.

[0165] The service subscription system can include a message registration phase and a message publishing phase during its operation. See [link to documentation] Figure 6 As shown, the message registration phase of the service subscription system includes:

[0166] Application registration message listening: The application creates a registration task and registers with the application registration module to listen for messages; registration information such as the registration configuration parameter table can be provided during registration.

[0167] Application registration module processing: The application registration module obtains and parses the registration configuration parameter table to get the relevant registration information.

[0168] Storing registration information: The application registration module associates the registration configuration parameters with the application's process identifier and stores them in the registration information list.

[0169] Subscribing to the corresponding SOA service: Based on the registration information list and the message ID-message data structure mapping table, the application registration module retrieves the message dataset that the application needs to listen to and the message data to be subscribed to, and calls the service access code generated by the service access code generation module to send a service subscription request to the server based on the required message data to subscribe to the service.

[0170] Register message listener callback functions: The service access code covers functions such as service registration, message listening and callback processing, message publishing and connection management, so that it can wait for the server to publish messages and trigger the callback functions to process the corresponding messages.

[0171] See Figure 7As shown, the message publishing phase of a service subscription system includes:

[0172] The service publisher publishes a message. This can be achieved through service access code, which provides the published message to the message registration and publishing system. The service publisher can be any one of multiple nodes.

[0173] Deserialization: The data transfer module obtains the message published by the service publisher, i.e., the original message data; when the original message data is serialized message data, i.e., byte stream data, the data transfer module deserializes the original message data.

[0174] Value range and validity verification: The data transfer module performs value range and validity verification on the deserialized original message data to ensure the accuracy of the data.

[0175] Converted into message units: The verified original message data can be provided to the data transfer module. The data transfer module reads the message ID-message data structure mapping table and decomposes the original message data structure into multiple message units.

[0176] Store to message unit list: The data transfer module stores the disassembled message units into the message unit list.

[0177] Query the priority corresponding to the message unit ID: The message unit ID is the message ID. The data priority sorting module determines the priority of the message unit according to the priority configuration file.

[0178] Insertion into processing queue: The data priority sorting module inserts message units into the processing queue of the corresponding priority according to their priority.

[0179] Query Registrant Information: The message forwarding module obtains message units forwarded by the data priority sorting module and queries the registrant information from the registration information list, i.e., the registration configuration parameters. When the registration configuration parameters include message ID, subscribed message type, and subscription period, the following steps can be performed:

[0180] Determine whether to change the listening cycle;

[0181] If so, start a timer to periodically return the task, serialize the message unit, and feed the serialized message unit back to the application. The message publishing ends and the application obtains the subscribed message.

[0182] If not, determine whether the subscribed message type is incremental listening, i.e., whether incremental changes are being monitored; if not, serialize the message unit and send the serialized message unit back to the application, and the message publishing ends; if yes, determine whether the message value has changed. If it has changed, serialize the message unit and send the serialized message unit back to the application, and the message publishing ends; if it has not changed, do not forward the message unit to the application, and the message publishing ends.

[0183] In some embodiments, see Figure 8 As shown, the message registration and publishing system may also include an IDL change access control processing stage, including:

[0184] Update the IDL file and commit it to the code repository;

[0185] Trigger IDL to change access control;

[0186] Comparing local files and code repository files: The IDL change access control module compares the locally cached IDL files with the IDL files in the code repository;

[0187] Generate change entries;

[0188] Determine if it is a preset automatic processing type: The IDL change access control module can determine whether the change information in the change entry is a preset automatic processing type. If there is a damaged automatic processing type, it can be set according to the requirements.

[0189] If yes, update the message ID-message data structure mapping table; if no, the IDL change access control module can also generate change entries and issue change reminders to notify relevant personnel and manually handle the mapping relationship; thus obtaining the updated ID-message data structure mapping table.

[0190] Furthermore, the service access code generation module is invoked to trigger compilation, resulting in the generated service access code, and the access control process ends.

[0191] It should be noted that, in this embodiment of the application, there is no particular limitation on the order of the steps of calling the service access code generation module to generate new service access code, determining whether the change information is a preset automatic processing type, and performing corresponding operations based on the determination result. These steps can be performed according to requirements.

[0192] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments of this application can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable file, or some intermediate form. The computer-readable storage medium can include any entity or device capable of carrying the computer program code, a medium, a USB flash drive, a portable hard drive, a magnetic disk, an optical disk, a computer memory, a read-only memory, a random access memory, an electrical carrier signal, a telecommunication signal, and a software distribution medium, etc.

[0193] In another aspect, this application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the service subscription method described in any of the above embodiments. This computer-readable storage medium may be a storage device comprising various electronic devices; optionally, in the embodiments of this application, the computer-readable storage medium is a non-transitory computer-readable storage medium.

[0194] In another aspect, this application also provides a smart device that may include at least one processor; a memory communicatively connected to the at least one processor; wherein the memory stores a computer program that, when executed by the at least one processor, implements the service subscription method described in any of the above embodiments.

[0195] In some embodiments, the smart device may include a driving device, a smart vehicle, a robot, or other similar devices. In some embodiments of this application, the smart device further includes at least one sensor for sensing information. The sensor is communicatively connected to any type of processor mentioned in this application. Optionally, the smart device further includes an autonomous driving system for guiding the smart device to drive autonomously or providing driving assistance. The processor communicates with the sensor and / or the autonomous driving system to perform the methods described in any of the above embodiments.

[0196] See Figure 9 As shown, Figure 9 This is a schematic diagram of the structure of the smart device provided in the embodiments of this application. Figure 9 The example shows a configuration where memory 91 and processor 92 are connected via a bus, and both memory 91 and processor 92 are configured with only one instance.

[0197] In other embodiments, the smart device may include multiple memories 91 and multiple processors 92. The program executing the service subscription method of any of the above embodiments may be divided into multiple subroutines, each of which may be loaded and run by a processor 92 to perform different steps of the service subscription method of the above method embodiments. Specifically, each subroutine may be stored in a different memory 91, and each processor 92 may be configured to execute programs in one or more memories 91 to jointly implement the service subscription method of the above method embodiments.

[0198] In addition, the relevant user personal information that may be involved in the various embodiments of this application is processed in strict accordance with the requirements of laws and regulations, following the principles of legality, legitimacy and necessity, based on the reasonable purpose of the business scenario, and is personal information that users actively provide or that is generated due to the use of the product / service, as well as personal information obtained with the user's authorization.

[0199] The personal information of users processed in this application will vary depending on the specific product / service scenario and will be subject to the specific scenario in which the user uses the product / service. This may involve the user's account information, device information, driving information, vehicle information, or other related information. The applicant will treat the user's personal information and its processing with the utmost diligence.

[0200] The applicant attaches great importance to the security of users' personal information and has taken reasonable and feasible security protection measures that comply with industry standards to protect users' information and prevent unauthorized access, disclosure, use, modification, damage or loss of personal information.

[0201] The technical solution of the present invention has been described above with reference to the preferred embodiments shown in the accompanying drawings. However, it will be readily understood by those skilled in the art that the scope of protection of the present invention is obviously not limited to these specific embodiments. Without departing from the principles of the present invention, those skilled in the art can make equivalent changes or substitutions to the relevant technical features, and the technical solutions after such changes or substitutions will all fall within the scope of protection of the present invention.

Claims

1. A service subscription method, characterized in that, include: Obtain the application's registration configuration parameters, which include at least a request message identifier; wherein the request message identifier is the identifier corresponding to the attribute field in the required subscription message data; Based on the request message identifier and the pre-stored message identifier and message data structure mapping table, determine the required subscription message data; and send a service subscription request to the server based at least on the required subscription message data. Obtain the original message data published by the server; Based on the pre-stored message identifier and message data structure mapping table, the message unit corresponding to the original message data is obtained; the message unit includes a published message identifier and a message value; wherein, each message data structure includes multiple attribute fields, and the message identifier and message data structure mapping table includes a message identifier corresponding to each attribute field in the message data structure; the original message data includes multiple attribute fields and a message value corresponding to each attribute field; obtaining the message unit corresponding to the original message data based on the pre-stored message identifier and message data structure mapping table includes: based on the pre-stored message identifier and message data structure mapping table, determining the message identifier corresponding to each attribute field in the original message data as the published message identifier; and taking the published message identifier and message value corresponding to each attribute field as a message unit; The message unit is sent to the application based at least on the published message identifier and the registration configuration parameters.

2. The method according to claim 1, characterized in that, The process of obtaining the application's registration configuration parameters further includes obtaining the application's subscription message type and / or subscription period.

3. The method according to claim 1 or 2, characterized in that, After obtaining the application's registration configuration parameters, the method further includes: Obtain the process identifier of the application; A registration information list is constructed based on the process identifier and the registration configuration parameters.

4. The method according to claim 1, characterized in that, Before determining the required subscription message data based on the request message identifier and the pre-stored message identifier and message data structure mapping table, the process also includes: Retrieve multiple attribute fields from each of multiple message data structures; Configure the message identifier for each of the multiple attribute fields, and associate the multiple attribute fields of each message data structure with the message identifier corresponding to each of the multiple attribute fields to construct a mapping table between the message identifier and the message data structure.

5. The method according to claim 1, characterized in that, Sending a service subscription request to the server based at least on the required subscription message data includes: Based on the required subscription message data and interface definition language file, generate service access code; A service subscription request is sent to the server based on the service access code.

6. The method according to claim 5, characterized in that, Before generating the service access code based on the required subscription message data and interface definition language file, the method further includes: Obtain the modified interface definition language file; Compare the modified interface definition language file with the locally cached interface definition language file; The service access code is updated based on the comparison results, and a service subscription request is sent based on the updated service access code.

7. The method according to claim 6, characterized in that, After comparing the modified interface definition language file with the locally cached interface definition language file, the method further includes: The change information is determined based on the comparison results; Determine whether the changed information is a preset automatic processing type; If yes, automatically update the message identifier and message data structure mapping table based on the change information; if no, generate change entries based on the change information and issue change reminders based on the change entries.

8. The method according to claim 3, characterized in that, Sending the message unit to the application based at least on the published message identifier and the registration configuration parameters includes: Based on the published message identifier, the process identifier and registration configuration parameters of the application are obtained from the registration information list; When the registration configuration parameters include a request message identifier and a subscription message type, and the subscription message type is incremental subscription, it is determined whether the message value corresponding to the message unit is consistent with the historical message value; if not, the message unit is sent to the application based on the process identifier and the request message identifier. When the registration configuration parameters include a request message identifier and a subscription period, the message unit is sent to the application based on the process identifier, the subscription period, and the request message identifier; When the registration configuration parameters include a request message identifier, a subscription message type, and a subscription period, and the subscription message type is an incremental subscription, it is determined whether the message value corresponding to the message unit is consistent with the historical message value; if not, the message unit is sent to the application based on the process identifier, the subscription period, and the request message identifier.

9. The method according to claim 1, characterized in that, Before sending the message unit to the application based at least on the published message identifier and the registration configuration parameters, the method further includes: The priority of the message unit is determined based on a pre-stored priority configuration file, and the message unit is sent to the application based on the priority, the published message identifier, and the registration configuration parameters.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the service subscription method according to any one of claims 1 to 9.

11. A smart device, characterized in that, include: At least one processor; A memory that is communicatively connected to the at least one processor; The memory stores a computer program that, when executed by the at least one processor, implements the service subscription method according to any one of claims 1 to 9.