Service discovery method and device, equipment, storage medium and product
By registering service data in the target database and querying based on service discovery parameters, the problem of low service discovery efficiency between electronic devices is solved, and a more efficient service discovery process is achieved.
Patent Information
- Application Number
- CN202311041316.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-17
- Publication Date
- 2025-02-21
- Estimated Expiration
- 2043-08-17
AI Technical Summary
In the era of the Internet of Things, the efficiency of service discovery between electronic devices is low, resulting in long and time-consuming service discovery links, which affects efficiency.
By registering the service data in the target database and querying the service data directly from the target database based on the service discovery parameters, the service discovery link is shortened and time-consuming is saved.
It improves the efficiency of service discovery, shortens the link and time-consuming of service discovery, and enhances the reliability and efficiency of service discovery.
Smart Images

Figure CN119496813A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and in particular to a service discovery method, device, equipment, storage medium and product. Background Art
[0002] In the era of the Internet of Everything, electronic devices such as mobile phones, laptops, tablets, cars, and home appliances can be seamlessly connected and communicate. Different electronic devices may register different services, and electronic devices can communicate with each other to use services on other electronic devices. When an electronic device uses services on other electronic devices, it needs to discover the services registered by other electronic devices. Summary of the invention
[0003] The embodiments of the present application provide a service discovery method, apparatus, device, storage medium and product, which can improve the efficiency of service discovery. The technical solution is as follows:
[0004] In one aspect, a service discovery method is provided, the method comprising:
[0005] Determine a target database, the target database including at least one of a first database and a second database, the first database is used to store terminal-side service data of the first electronic device, and the second database is used to store cloud-side service data of the cloud server;
[0006] Determining service discovery parameters, where the service discovery parameters are used to constrain discovered services;
[0007] Based on the service discovery parameters, a service discovery operation is performed in the target database.
[0008] In another aspect, a service discovery device is provided, the device comprising:
[0009] A first determining module, configured to determine a target database, the target database comprising at least one of a first database and a second database, the first database being configured to store terminal-side service data of the first electronic device, and the second database being configured to store cloud-side service data of the cloud server;
[0010] A second determination module is used to determine a service discovery parameter, where the service discovery parameter is used to constrain the discovered service;
[0011] A discovery module is used to perform a service discovery operation in the target database based on the service discovery parameters.
[0012] On the other hand, an electronic device is provided, which includes one or more processors and one or more memories, wherein at least one program code is stored in the one or more memories, and the at least one program code is loaded and executed by the one or more processors to implement the service discovery method described above.
[0013] On the other hand, a computer-readable storage medium is provided, wherein at least one program code is stored in the storage medium, and the at least one program code is loaded and executed by a processor to implement the service discovery method described above.
[0014] On the other hand, a computer program product is provided. The computer program product stores at least one program code, and the at least one program code is used to be executed by a processor to implement the service discovery method described above.
[0015] In an embodiment of the present application, by registering service data in a target database, when performing service discovery, the service data can be directly queried from the target database based on the service discovery parameters, thereby shortening the service discovery link, saving the time of service discovery, and thereby improving the efficiency of service discovery. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 A schematic diagram showing an implementation environment of a service discovery method shown in an exemplary embodiment of the present application is shown;
[0017] Figure 2 A schematic diagram of a service discovery database shown in an exemplary embodiment of the present application is shown;
[0018] Figure 3 A schematic diagram of a service discovery database shown in an exemplary embodiment of the present application is shown;
[0019] Figure 4 A flowchart of a service discovery method shown in an exemplary embodiment of the present application is shown;
[0020] Figure 5 A flowchart of a service discovery method shown in an exemplary embodiment of the present application is shown;
[0021] Figure 6 A flowchart of a service discovery method shown in an exemplary embodiment of the present application is shown;
[0022] Figure 7 A flowchart of a service discovery method shown in an exemplary embodiment of the present application is shown;
[0023] Figure 8 A flowchart of a service discovery method shown in an exemplary embodiment of the present application is shown;
[0024] Fig. 9 A flowchart of a service discovery method shown in an exemplary embodiment of the present application is shown;
[0025] Fig.10 A schematic diagram of a service discovery method shown in an exemplary embodiment of the present application is shown;
[0026] Fig.11 A flowchart of a service discovery method shown in an exemplary embodiment of the present application is shown;
[0027] Fig.12 A flowchart of a service discovery method shown in an exemplary embodiment of the present application is shown;
[0028] Fig.13 A block diagram of a service discovery device shown in an exemplary embodiment of the present application is shown;
[0029] Fig.14 A block diagram of an electronic device according to an exemplary embodiment of the present application is shown. DETAILED DESCRIPTION
[0030] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.
[0031] The term "multiple" as used herein refers to two or more than two. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the related objects are in an "or" relationship.
[0032] It should be noted that the information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data used for analysis, stored data, displayed data, etc.) and signals involved in this application are all authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions. For example, the data service discovery parameters and service data involved in this application are all obtained with full authorization.
[0033] In order to more clearly describe the technical solution of the embodiment of the present application, the functions and definitions of the terms involved in the embodiment of the present application are described in detail below:
[0034] Service discovery: The service caller provides an interface through the service discovery, passing in some or all of the specified query conditions (service discovery parameters). Service discovery can perform service discovery operations through the conditional service discoverer. The result of service discovery is a list of (service data + device identification), which includes at least one service data + device identification. In order to increase the comprehensiveness of the target service, not only can service discovery operations be performed on the end side (service discovery operations are performed in the first database of the local end), but also under certain conditions, the cloud service discovery interface can be requested to discover remote devices, cloud system services, and service market services.
[0035] Service registration: After the service is installed, the service data needs to be inserted into the local data database. Service registration is divided into two categories: static service registration and dynamic service registration. Static registration refers to scanning the valid services in the device's operating system for registration when the device's system is started or the service program is installed; while dynamic registration is when the service is used externally and needs to be re-downloaded and installed locally. The service data of service registration constitutes part of the data source for service discovery.
[0036] Service synchronization: The process of sending services registered by a device to other related devices for storage is called synchronization. The main purpose is to achieve the ability to perform cross-end service discovery. Service synchronization ensures that cross-end device services can be discovered without cross-end queries during service discovery, thereby improving the efficiency of service discovery. The service data of service synchronization is also part of the data source that constitutes service discovery.
[0037] Service Market: The service market is similar to the application market, a place where services are listed and released. You can find various services developed by developers in the service market, enriching the ability of service discovery. The data in the service market is also the data source for service discovery.
[0038] Data DB: service storage database, which stores the service data of services registered on each device and the service data of services filtered by service synchronization.
[0039] Data source: The data warehouse that the service discovery module queries is collectively referred to as the data source. The data source includes the end-side data DB (also referred to as the first database below), the cloud-side data DB (also referred to as the first sub-database below), and the service market (also referred to as the second sub-database below). The end-side data DB is registered by the end-side service and the service is inserted synchronously; the cloud-side data DB is registered by the cloud-side service and the service is inserted synchronously; the service market is uploaded by service developers or service market managers, and the service market parses the service and stores it in the warehouse.
[0040] Please refer to Figure 1, which shows a schematic diagram of an implementation environment of a service discovery method shown in an exemplary embodiment of the present application. Figure 1 , the implementation environment includes: a first electronic device 101, a second electronic device 102 and a cloud server 103. In some embodiments, the first electronic device 101 and the second electronic device 102 establish a connection through the cloud server 103; for example, the first electronic device 101 and the second electronic device 102 log in to the same user account to establish a connection through the cloud server 103. In other embodiments, the first electronic device 101 and the second electronic device 102 may also establish a connection through near field communication; for example, the first electronic device 101 and the second electronic device 102 establish a connection through Bluetooth or through near field communication (NFC).
[0041] Please refer to Figure 2 , services can be registered in the first electronic device 101, and services can also be registered in the second electronic device 102, and service synchronization can be performed between the first electronic device 101 and the second electronic device 102. For example, the first electronic device 101 synchronizes service data from the second electronic device 102, and stores the service data of the service registered by the first electronic device 101 and the synchronized service data in the first database. Similarly, services can also be registered in the cloud server 103, and service data can also be synchronized from other electronic devices (the first electronic device 101 and the second electronic device 102). The second database of the cloud server 103 includes a first sub-database and a second sub-database. The cloud server 103 stores the service data of the service registered by the cloud server 103 and the synchronized service data in the first sub-database, and the second sub-database is used to store service data in the service market. The first electronic device 101 performs a service discovery operation in the first database; or the first electronic device 101 performs a service discovery operation in the first sub-database or the second sub-database.
[0042] Based on the above, it can be seen that the data source of service discovery includes three parts. The first part is the local first database, that is, the local database (DB); the second part is the first sub-database in the cloud, that is, the cloud-side data DB, and the third part is the second sub-database in the cloud, that is, the service market. For these three parts of the data source, it is not necessary to perform all queries to ensure the discovery of the service. Therefore, the embodiment of the present application can set two priority schemes, namely the end-side priority scheme and the cloud-side priority scheme. The end-side priority scheme refers to first performing a service discovery operation in the first database, and if the target service is not found in the first database, then performing a service discovery operation in the first sub-database, and if the target service is not found in the first sub-database, then performing a service discovery operation in the second sub-database. The cloud-side priority scheme refers to first performing a service discovery operation in the first sub-database, and if the target service is not found in the first sub-database, then performing a service discovery operation in the second sub-database, and if the target service is not found in the second sub-database, then performing a service discovery operation in the first database. The end-side priority scheme can save power consumption and traffic bandwidth, while the cloud-side priority scheme can ensure that services can be discovered in a timely manner and improve service discovery efficiency.
[0043] In some embodiments, for example, see Figure 3 , the first database (end-side data DB) of the first electronic device 101 mainly includes the service data of the first electronic device 101 and the service data of the near-field device, and the service data of the first electronic device 101 includes the service data of the service scanned locally by the first electronic device 101 and the service data of the service downloaded from the cloud server 103, specifically the service downloaded from the cloud warehouse of the cloud server 103. The service data of the first electronic device 101 is inserted into the first database by service registration, and the near-field device service is inserted into the first database by service synchronization. Similarly, the second electronic device 102 also has its corresponding first database, and the generation process of the first database of the second electronic device 102 is similar to the generation process of the first database of the first electronic device 101, which will not be repeated here. The first sub-database of the cloud server 103 mainly includes the service data of the cloud server 103 and the service data of the end-side device. The service data of the cloud server 103 includes the service data of the service scanned locally by the cloud server 103 and the service data of the service downloaded from the cloud warehouse. The service data of the end-side device is synchronized to the first sub-database by other electronic devices.
[0044] The first electronic device 101 may be any device that can be connected to the Internet; for example, the first electronic device 101 may be a mobile phone, a laptop computer, a desktop computer, a tablet computer, a vehicle terminal, a home appliance, a vehicle computer, a wearable device, or any other electronic device that supports a service discovery function. Similarly, the second electronic device 102 may also be any device that can be connected to the Internet; for example, the second electronic device 102 may be a mobile phone, a laptop computer, a desktop computer, a tablet computer, a vehicle terminal, a home appliance, a vehicle computer, a wearable device, or any other electronic device that supports a service discovery function.
[0045] Please refer to Figure 4 , which shows a flow chart of a service discovery method shown in an exemplary embodiment of the present application. The method is executed by a first electronic device, referring to Figure 4 , the method comprising:
[0046] Step 401: Determine a target database, the target database includes at least one of a first database and a second database, the first database is used to store terminal-side service data of a first electronic device, and the second database is used to store cloud-side service data of a cloud server.
[0047] The service data includes service configuration information, and the service configuration information includes configuration information such as a service name, a service identifier (Identity document, ID) and a service uniform resource locator (Uniform Resource Locator, URL). In some embodiments, the target database includes a first database, and the first database is an end-side database of the first electronic device, that is, the present application can implement service discovery operations in the end-side database. In other embodiments, the target database includes a second database, and the second database is a cloud database, that is, the present application can implement service discovery operations in the cloud database. In some embodiments, the target database includes a first database and a second database, that is, the present application can implement service discovery operations in the end-side database and the cloud-side database, thereby improving the reliability of service discovery.
[0048] It should be noted that the execution subject of this application is the first electronic device. When the target database includes the second database, the first electronic device can only determine the object database to be used for service discovery operation, and will not pull the second database from the cloud server, and use the cloud server to perform service discovery operation, thereby saving the storage resources of the first electronic device. In other embodiments, the first electronic device can also pull the second database from the cloud server, that is, the local service data can be expanded to have the remote service data, and the remote service can be discovered more quickly and conveniently.
[0049] Step 402: Determine service discovery parameters, where the service discovery parameters are used to constrain discovered services.
[0050] The service discovery parameters include at least one of the target device identifier, target service identifier, target capability identifier, target service intent, target capability intent and target assembly protocol; the target device identifier is used to indicate the device identifier of the device to which the service to be discovered belongs, the target service identifier is used to indicate the service identifier of the service to be discovered; the capability identifier is used to indicate the capability identifier of the capability of the service to be discovered; the service intent is used to indicate the service intent of the service to be discovered; the capability intent is used to indicate the capability intent of the service to be discovered; the target assembly protocol is used to indicate the assembly protocol used by the service to be discovered.
[0051] Step 403: Based on the service discovery parameters, a service discovery operation is performed in the target database.
[0052] The first electronic device searches the target database for a target service that meets the service discovery parameter based on the service discovery parameter. In addition, the target database can also store the device identification corresponding to the service. After the first electronic device determines the target service, it can also determine the device identification of the device to which the target service belongs; therefore, the result of service discovery is service data + device identification; in addition, there may be multiple target services; therefore, the result of service discovery is a (service data + device identification) list.
[0053] In an embodiment of the present application, by registering service data in a target database, when performing service discovery, the service data can be directly queried from the target database based on the service discovery parameters, thereby shortening the service discovery link, saving the time of service discovery, and thereby improving the efficiency of service discovery.
[0054] Please refer to Figure 5 , which shows a flow chart of a service discovery method shown in an exemplary embodiment of the present application. Figure 5 , the method comprising:
[0055] Step 501: The first electronic device determines a target database, which includes a first database and a second database, the first database is used to store terminal-side service data of the first electronic device, and the second database is used to store cloud-side service data of a cloud server.
[0056] In some embodiments, this step is the same as step 401 and will not be repeated here.
[0057] Step 502: The first electronic device determines a service discovery parameter, where the service discovery parameter is used to constrain the discovered service.
[0058] In some embodiments, this step is the same as step 402 and will not be repeated here.
[0059] In the embodiment of the present application, the target database includes a first database and a second database, therefore, the first electronic device performs service discovery operations in the first database and the second database through service discovery parameters based on the priority level of the first database and the priority level of the second database. If the priority level of the first database is not lower than the priority level of the second database, steps 503-504 are executed; if the priority level of the first database is lower than the priority level of the second database, steps 505-506 are executed.
[0060] Step 503: When the priority level of the first database is not lower than the priority level of the second database, the first electronic device performs a service discovery operation in the first database based on the service discovery parameters.
[0061] The first electronic device searches the first database for a target service that meets the service discovery parameter based on the service discovery parameter. In addition, the target database can also store the device identification corresponding to the service. After the first electronic device determines the target service, it can also determine the device identification of the device to which the target service belongs; therefore, the result of service discovery is service data + device identification; in addition, there may be multiple target services; therefore, the result of service discovery is a (service data + device identification) list.
[0062] Step 504: When the target service is not found in the first database, the first electronic device performs a service discovery operation in the second database based on the service discovery parameters.
[0063] The first electronic device sends a service discovery request to the cloud server, and the service discovery request carries service discovery parameters; the cloud server receives the service discovery request, and based on the service discovery parameters, queries the target service that meets the service discovery parameters from the second database, and sends a service discovery response to the first electronic device, and the service discovery response carries the service data of the target service; the first electronic device receives the service discovery response, and obtains the service data of the target service from the service discovery response. In addition, the cloud server can also determine the device identification of the device to which the target service belongs, and the service discovery response also carries the device identification of the device to which the target service belongs. In an embodiment of the present application, access to the second database of the cloud server ensures that cloud-side services and far-field services can be discovered, expanding the scope of service discovery, and allowing users to remotely process service content.
[0064] The second database includes a first sub-database and a second sub-database, the first sub-database is used to store service data registered and synchronized with the cloud server, and the second sub-database is used to store service data in the service market. Accordingly, the first electronic device performs a service discovery operation in the second database based on the service discovery parameter, including: the first electronic device performs a service discovery operation in the first sub-database and the second sub-database based on the priority level of the first sub-database and the priority level of the second sub-database through the service discovery parameter.
[0065] In the case where the priority level of the first sub-database is not lower than the priority level of the second sub-database, the first electronic device performs a service discovery operation in the first sub-database based on the service discovery parameters; for example, the first electronic device searches the first sub-database for a target service that meets the service discovery parameters based on the service discovery parameters. In the case where the priority level of the first sub-database is lower than the priority level of the second sub-database, the first electronic device performs a service discovery operation in the second sub-database based on the service discovery parameters; for example, the first electronic device searches the second sub-database for a target service that meets the service discovery parameters based on the service discovery parameters.
[0066] In some embodiments, when neither the local first database nor the first sub-database of the cloud server can find the service, the service will be queried from the service market of the cloud server, that is, the service discovery will be performed in the second sub-database. And after the target service data is found in the second sub-database, the first electronic device downloads the target service data to the local computer and stores the target service data in the first database to provide data basis for subsequent service discovery.
[0067] Step 505: When the priority level of the first database is lower than the priority level of the second database, the first electronic device performs a service discovery operation in the second database based on the service discovery parameters.
[0068] In some embodiments, the process of the first electronic device performing a service discovery operation in the second database based on the service discovery parameters is the same as the process of the first electronic device performing a service discovery operation in the second database based on the service discovery parameters in step 504, and is not repeated here.
[0069] Step 506: When the target service is not found in the second database, the first electronic device performs a service discovery operation in the first database based on the service discovery parameters.
[0070] In some embodiments, the process of the first electronic device performing a service discovery operation in the first database based on the service discovery parameters is the same as the process of the first electronic device performing a service discovery operation in the first database based on the service discovery parameters in step 503, and is not repeated here.
[0071] In the embodiment of the present application, by registering the service data in the target database, when performing service discovery, the service data can be directly queried from the target database based on the service discovery parameters, thereby shortening the service discovery link, saving the time consumption of service discovery, and thus improving the efficiency of service discovery. In addition, by adopting a priority strategy, it can ensure that the service discovery is short and comprehensive.
[0072] Please refer to Figure 6 , which shows a flow chart of a service discovery method shown in an exemplary embodiment of the present application. In the embodiment of the present application, the priority level of the first database is not lower than the priority level of the second database, and the priority level of the first sub-database included in the second database is not lower than the priority level of the second sub-database. Figure 6 , the method comprising:
[0073] Step 601: The first electronic device determines a service discovery parameter, where the service discovery parameter is used to constrain the discovered service.
[0074] In some embodiments, this step is the same as step 402 and will not be repeated here.
[0075] Step 602: The first electronic device performs a service discovery operation in the first database based on the service discovery parameters.
[0076] In some embodiments, this step is the same as the process in step 503 where the first electronic device performs a service discovery operation in the first database based on the service discovery parameter, and is not described in detail here. Figure 7 The service caller calls the service discovery interface, and the first electronic device performs a service discovery operation in the local first database based on the service discovery interface, that is, queries the (service data + device identification) list in the local DB.
[0077] Step 603: When the target service is not found in the first database, the first electronic device performs a service discovery operation in the first sub-database based on the service discovery parameters.
[0078] In some embodiments, the process of the first electronic device performing a service discovery operation in the first sub-database based on the service discovery parameter is the same as the process of the first electronic device performing a service discovery operation in the first sub-database based on the service discovery parameter in step 504, and will not be described in detail here. Figure 7 If the target service is not found in the local first database, the first electronic device requests the cloud server to perform service discovery; the cloud server performs a service discovery operation in the first sub-database, that is, queries the cloud DB for a list of (service data + device identification).
[0079] Step 604: When the target service is not found in the first sub-database, the first electronic device performs a service discovery operation in the second sub-database based on the service discovery parameters.
[0080] In some embodiments, the process of the first electronic device performing a service discovery operation in the second sub-database based on the service discovery parameter is the same as the process of the first electronic device performing a service discovery operation in the second sub-database based on the service discovery parameter in step 504, and will not be described in detail here. Figure 7 ,When the target service is not found in the first sub-database, the cloud server performs a service discovery operation in the second sub-database, that is, querying the (service data + device identification) list from the service market.
[0081] In the embodiment of the present application, when performing a service discovery operation, the first database of the local terminal is first queried, and when the first database is not found, the second database in the cloud is queried. Since after the target service is queried in the local first database, there is no need to request the cloud to perform a service discovery operation, thereby saving power consumption and traffic bandwidth of the first electronic device.
[0082] Please refer to Figure 8 , which shows a flow chart of a service discovery method shown in an exemplary embodiment of the present application. In the embodiment of the present application, the priority level of the first database is not lower than the priority level of the second database, and the priority level of the first sub-database included in the second database is not lower than the priority level of the second sub-database. Figure 8 , the method comprising:
[0083] Step 801: The first electronic device determines a service discovery parameter, where the service discovery parameter is used to constrain the discovered service.
[0084] In some embodiments, this step is the same as step 402 and will not be repeated here.
[0085] Step 802: The first electronic device performs a service discovery operation in the first sub-database based on the service discovery parameters.
[0086] In some embodiments, the process of the first electronic device performing a service discovery operation in the first sub-database based on the service discovery parameters is the same as the process of the first electronic device performing a service discovery operation in the first sub-database based on the service discovery parameters in step 504, and is not repeated here.
[0087] Step 803: When the target service is not found in the first sub-database, the first electronic device performs a service discovery operation in the second sub-database based on the service discovery parameters.
[0088] In some embodiments, the process of the first electronic device performing a service discovery operation in the second sub-database based on the service discovery parameters is the same as the process of the first electronic device performing a service discovery operation in the second sub-database based on the service discovery parameters in step 504, and is not repeated here.
[0089] Step 804: When the target service is not found in the second sub-database, the first electronic device performs a service discovery operation in the first database based on the service discovery parameters.
[0090] In some embodiments, this step is the same as the process in step 503 where the first electronic device performs a service discovery operation in the first database based on the service discovery parameters, and is not described again here.
[0091] In the embodiment of the present application, when performing a service discovery operation, the first sub-database and the second sub-database on the cloud are queried first, and when the cloud cannot find the service data, the first database on the local end is queried. Since the first sub-database and the second sub-database on the cloud include more comprehensive service data, it is more likely that the target service can be queried on the cloud, thereby improving the efficiency of service discovery.
[0092] Please refer to Fig. 9 , which shows a flow chart of a service discovery method shown in an exemplary embodiment of the present application. Fig. 9 , the method comprising:
[0093] Step 901: The first electronic device determines a target database, the target database includes at least one item of a first database and a second database, the first database is used to store terminal-side service data of the first electronic device, and the second database is used to store cloud-side service data of a cloud server.
[0094] In some embodiments, this step is the same as step 401 and will not be repeated here.
[0095] Step 902: The first electronic device determines a service discovery parameter, where the service discovery parameter is used to constrain the discovered service.
[0096] In some embodiments, this step is the same as step 402 and will not be repeated here.
[0097] Step 903: The first electronic device configures filtering conditions of the service filter based on the service discovery parameters.
[0098] The filtering conditions are used to filter services that do not meet the service discovery parameters. The service discovery parameters include at least one of a target device identifier, a target service identifier, a target capability identifier, a target service intent, a target capability intent, and a target assembly protocol. In this step, the step of configuring the filtering conditions of the service filter based on the service discovery parameters by the first electronic device can be: the first electronic device sets the filtering conditions of the service filter to filter at least one of the services whose device identifier of the device to which the service belongs is not the target device identifier, the services whose service identifier is not the target service identifier, the services whose capability identifier is not the target capability identifier, the services whose service intent is not the target service intent, the services whose capability intent is not the target capability intent, and the services whose assembly protocol is the target assembly protocol.
[0099] The target device identifier is used to represent the device identifier of the device to which the service to be discovered belongs. When the service discovery parameters include the target device identifier, the service filter will query the service data of the device corresponding to the target device identifier; when the service discovery parameters do not include the target device identifier, the service filter will query the service data in the service data of all devices of the current login account in the target database. In some embodiments, before the first electronic device configures the filtering conditions of the filter based on the target device identifier, it first determines whether the target device identifier is the device identifier of the device to which the current login account belongs; when the target device identifier is the device identifier of the device to which the current login account belongs, the step of configuring the filtering conditions of the filter based on the target device identifier is performed; when the target device identifier is not the device identifier of the device to which the current login account belongs, the target device identifier is discarded, that is, the filtering conditions are not configured based on the target device identifier, thereby ensuring the security of service discovery.
[0100] The target service identifier is used to indicate the service identifier of the service to be discovered, that is, to specify a specific service ID. The capability identifier is used to indicate the capability identifier of the capability of the service to be discovered, that is, to specify a specific capability ID. The capability identifier can be an identifier of a standard capability or an identifier of a specific service capability; when the capability identifier is an identifier of a standard capability, the first electronic device first converts the standard capability into a specific capability that supports the standard capability, and then configures the filtering conditions of the service filter based on the converted capability identifier.
[0101] Service intent is used to indicate the service intent of the service to be discovered; the current service supports intent matching through keywords (Action), and the object of intent matching is the intent field in the config.json of the service data, that is, after the first electronic device configures the filtering conditions of the service filter based on the service intent, when the first electronic device filters the service based on the configured service filter, it filters the services that do not meet the service intent by matching the intent field.
[0102] Capability intent is used to indicate the capability intent of the service to be discovered; the capability intent of a service is described through Action, input parameter list, and output parameter list. After the first electronic device configures the filtering conditions of the service filter based on the capability intent, when filtering services based on the configured service filter, it performs fuzzy matching through the tags in the Action and capability implementation definition information, and then matches the input parameter type and output parameter type of the capability implementation based on the input parameter list and output parameter list, and finally matches the target service.
[0103] The target assembly protocol is used to represent the assembly protocol used by the service to be discovered. Currently, services can use the service assembly protocol for intent matching, and the object of the assembly protocol matching is the service offer assembly protocol (offer) defined in the config.json of the service data, that is, after the first electronic device configures the filtering conditions of the service filter based on the target assembly protocol, when the first electronic device filters the service based on the configured service filter, it filters the services that do not conform to the target assembly protocol by matching the assembly protocol.
[0104] In some embodiments, the format of a service filter is as follows:
[0105] {
[0106] "filters":[
[0107] {
[0108] "type": "DEVICE_ID",
[0109] "value":{"ids":["xxx"]}
[0110] },
[0111] {
[0112] "type":"SERVICE_ID",
[0113] "value":{"serviceId":"xxx"}
[0114] },
[0115] {
[0116] "type":"CAPABILITY_ID",
[0117] "value":{"capabilityId":"xxx"}
[0118] },
[0119] {
[0120] "type":"SERVICE_INTENT",
[0121] "value":{
[0122] "actions": ["navigation"]
[0123] }
[0124] },
[0125] {
[0126] "type":"CAPABILITY_INTENT",
[0127] "value":{
[0128] "actions": ["navigation"],
[0129] "inputs":["String","Video"],
[0130] "outputs": ["Video"]
[0131] }
[0132] },
[0133] {
[0134] "type": "USE_ACTION",
[0135] "value":{
[0136] "actions":["pantanal.pidl.PIDL_STANDARD_ACTION"],
[0137] }
[0138] }, ]
[0140] }
[0141] In some embodiments, service discovery parameters can be set and changed according to needs. The above service discovery parameters are only examples. Based on different needs, the service discovery parameters may change, such as adding one or more service discovery parameters, or changing to other service discovery parameters, thereby configuring service filters with other filtering conditions, thereby ensuring the adaptability of the service filters for service discovery.
[0142] Step 904: The first electronic device filters services in the target service database that do not meet at least one filtering condition through the configured service filter to obtain at least one service set.
[0143] At least one service set includes at least one service set from among the first service set, the second service set, the third service set, the fourth service set, the fifth service set and the sixth service set. The first service set includes at least one service whose device identifier is a target device identifier, the second service set includes at least one service whose service identifier is a target service identifier, the third service set includes at least one service whose capability identifier is a target capability identifier, the fourth service set includes at least one service whose service intent is a target service intent, the fifth service set includes at least one service whose capability intent is a target capability intent, and the sixth service set includes at least one service whose assembly protocol is a target assembly protocol.
[0144] Step 905: The first electronic device determines a union of at least one service set to obtain a target service.
[0145] The first electronic device determines an intersection of at least one service set to obtain a target service set, wherein the target service set includes at least one record, and one record includes a target service data and a device identifier of a device to which the target service data belongs.
[0146] For example, see Fig.10 The service discovery parameters determined by the first electronic device include the target device identifier, the target service identifier, the target capability identifier, the target service intent, the target capability intent and the target assembly protocol. A service filter is configured based on the target device identifier, the target service identifier, the target capability identifier, the target service intent, the target capability intent and the target assembly protocol. Based on the service filter, services in the target service database that do not meet at least one filtering condition are filtered to obtain 6 query results, each query result being a service data + device identifier list. Therefore, 6 lists are obtained, and the intersection of the 6 lists is determined to obtain the target service.
[0147] In the embodiment of the present application, a service filter is configured according to at least one service discovery parameter input by a user, and the corresponding target service is obtained based on the configured service filter. When discovering a target, one service discovery parameter corresponds to one filter condition, so that one filter condition can independently query the target service from the target database, and finally these query results are merged and the intersection is taken, and finally the target service that meets at least one service discovery condition is obtained, thereby simplifying the setting and discovery process of the service filter and improving the service discovery process.
[0148] Please refer to Fig.11 , which shows a flow chart of a service discovery method shown in an exemplary embodiment of the present application. Fig.11 , the method comprising:
[0149] Step 1101: The first electronic device obtains service data of a service registered by the first electronic device, and stores the service data in a first database.
[0150] Service registration is divided into static service registration and dynamic service registration. Static service registration mainly searches for services existing in the operating system of the first electronic device by scanning, and parses the service data and stores it in the first database; dynamic service registration is when the service is used, after the service is downloaded and installed, the service data is stored in the first database. Accordingly, this step may include at least one of the following implementation methods:
[0151] Static registration of service: the first electronic device obtains the first service existing in the first electronic device by scanning, parses the first service to obtain service data of the first service, and stores the service data of the first service in the first database.
[0152] The service data includes service configuration information, which is mainly in files such as config.json. Therefore, the first electronic device obtains the configuration service information from files such as config.json. A simple example of config.json is shown below:
[0153] {
[0154] "identifier":{
[0155] "url":"com.pantanal.helloworld.train",
[0156] "id":"auto_generate", / / Distributed when published, easy to manage
[0157] "type":"apk", / / Extended field, refers to the service type, indicating Android APK
[0158] "name":"HelloAPK",
[0159] "version":"1.2.1", / / Major version number. Minor version number. Revision number
[0160] "versionCode":1002001 / / 001+002+001
[0161] },
[0162] "intent":{
[0163] "domain":"travel_preparation_service", / / The scenario or domain to which the intent belongs "action":["pantanal.intent.action.TRAVE"] / / The intent under the domain, a customizable field, a string used to query or trigger the service
[0164] }
[0165] }
[0166] When the operating system of the first electronic device is an Android system, the first electronic device scans these service apps through the system-related methods of PackageManager and registers them in the local first database. For example, please refer to Fig.12 , the first electronic device includes a package scanning module, a service registration module, and a package management system service module (Package Manager Service, PMS); the package scanning module sends a query request to the PMS (querying queryIntentContentProviders through app_action); the PMS receives the query request, obtains the metadata (Meta data) of the service existing in the first electronic device, and sends the metadata of the service to the package scanning module; the package scanning module receives the metadata of the service, obtains the address information of the configuration file from the metadata, and the configuration file is config.json; based on the address information of the configuration file, reads the configuration file, reads the service data (including service configuration information) from the configuration file, and sends the service data to the service registration module to complete the service registration. When the first electronic device has a new registered service, the package scanning module broadcasts the installation status of the service through the operating system, and the PMS discovers the broadcast when the APP package of the service changes; and the scanning module will determine whether the configuration file parsing process of the service APP has been completed. If the configuration file parsing process has not been completed, the configuration file parsing process will continue to be completed, and then the service data will be obtained, and the service registration will be performed in the service registration module based on the service data. In addition, when the service is uninstalled, the first electronic device will also monitor the system broadcast. If a service uninstall broadcast is received, it will also scan based on the above process and cancel the service. In some embodiments, when the operating system of the first electronic device is not an Android system, the first electronic device can scan the service through the Internet of Things (IOT) and other methods.
[0167] Dynamic registration of services: When the first electronic device uses the second service of the first electronic device, it downloads the second service from the cloud server, registers the second service in the first electronic device, parses the second service to obtain service data of the second service, and stores the service data of the second service in the first database. In the embodiment of the present application, after the dynamic registration of the service is completed, the dynamically registered service will also constitute a part of the first database, and subsequent service discovery can be performed directly in the local first database, without the need for dynamic registration again, thereby improving the efficiency of service discovery.
[0168] Step 1102: The first electronic device synchronizes the service data of the service registered by the second electronic device, and stores the service data of the service registered by the second electronic device in the first database.
[0169] The second electronic device is a device that establishes a connection with the first electronic device; the service data of the service registered by the first electronic device can also be synchronized to the second electronic device; and the service data of the service dynamically registered and the service data of the service statically registered both constitute part of the content of the local first database, and can both be synchronized to the second electronic device; they can also be synchronized to the cloud server.
[0170] In the embodiment of the present application, the first electronic device can insert service data into the local first database by means of dynamic service registration and static service registration; and after the dynamic service registration is completed, the dynamically registered service will also constitute a part of the first database, and subsequent service discovery can be performed directly in the local first database without the need for dynamic registration again, thereby improving the efficiency of service discovery. In addition, the first electronic device can also synchronize the service data of other electronic devices to enrich the service data of the first database, thereby improving the reliability of service discovery based on the first database.
[0171] Please refer to Fig.12 , which shows a flow chart of a service discovery method shown in an exemplary embodiment of the present application. Fig.12 , the method comprising:
[0172] Step 1201: The cloud server obtains service data of the cloud server registration service and stores the service data in the second database.
[0173] The second database includes a first sub-database and a second sub-database. The first sub-database is used to store the service data registered and synchronized by the cloud server, and the second sub-database is used to store the service data in the service market. The first sub-database of the cloud server is similar to the first database on the client side. The cloud server also has a service discovery system, and some services will be deployed and run in the cloud server. Therefore, the first sub-database of the cloud server also consists of two parts, service registration data and service synchronization data. Step 1201 is the process of obtaining service registration data, and step 1202 is the process of obtaining service synchronization data.
[0174] Step 1202: The cloud server synchronizes the service data of the registration service of other electronic devices, and stores the service data of the registration service of other electronic devices in the second database, where the other electronic devices are devices that establish a connection with the cloud server.
[0175] In an embodiment of the present application, the service synchronization data of the first database on the terminal side only includes the service information of the near-field device, while the first sub-database of the cloud server is the service data of all devices. This is because the terminal-side service data will be uniformly deployed in the first sub-database of the cloud server. Therefore, the first sub-database of the cloud server stores the service data of all electronic devices, that is, based on the first sub-database, a more comprehensive discovery of related services can be achieved.
[0176] Please refer to Fig.13 , which shows a block diagram of a service discovery device shown in an exemplary embodiment of the present application. The device includes:
[0177] A first determining module 1301 is used to determine a target database, where the target database includes at least one of a first database and a second database, where the first database is used to store the terminal-side service data of the first electronic device, and the second database is used to store the cloud-side service data of the cloud server;
[0178] The second determining module 1302 is used to determine a service discovery parameter, where the service discovery parameter is used to constrain the discovered service;
[0179] The discovery module 1303 is used to perform a service discovery operation in the target database based on the service discovery parameters.
[0180] In some embodiments, the target database includes a first database and a second database;
[0181] The discovery module 1303 is used to perform service discovery operations in the first database and the second database through service discovery parameters based on the priority level of the first database and the priority level of the second database.
[0182] In some embodiments, the discovery module 1303 is configured to perform a service discovery operation in the first database based on the service discovery parameters if the priority level of the first database is not lower than the priority level of the second database; and perform a service discovery operation in the second database based on the service discovery parameters if the target service is not found in the first database;
[0183] Discovery module 1303 is used to perform service discovery operations in the second database based on service discovery parameters when the priority level of the first database is lower than the priority level of the second database; and to perform service discovery operations in the first database based on service discovery parameters when the target service is not found in the second database.
[0184] In some embodiments, the second database includes a first sub-database and a second sub-database, the first sub-database is used to store service data registered and synchronized with the cloud server, and the second sub-database is used to store service data in the storage service market;
[0185] The discovery module 1303 is configured to perform a service discovery operation in the first sub-database and the second sub-database through a service discovery parameter based on the priority level of the first sub-database and the priority level of the second sub-database.
[0186] In some embodiments, the discovery module 1303 is used to configure the filtering conditions of the service filter based on the service discovery parameters, and the filtering conditions are used to filter out services that do not meet the service discovery parameters; through the configured service filter, the services in the target database that do not meet the service discovery parameters are filtered to obtain the target service.
[0187] In some embodiments, the number of service discovery parameters is at least one, the number of filtering conditions of the service filter is also at least one, and one service discovery parameter corresponds to one filtering condition;
[0188] The discovery module 1303 is used to filter services in the target service database that do not meet at least one filtering condition through the configured service filter, determine at least one service set; determine the union of at least one service set to obtain the target service;
[0189] At least one filtering condition is to filter at least one of the following: services whose device identifier of the device to which the service belongs is not the target device identifier, services whose service identifier is not the target service identifier, services whose capability identifier is not the target capability identifier, services whose service intent is not the target service intent, services whose capability intent is not the target capability intent, and services whose assembly protocol is the target assembly protocol.
[0190] In some embodiments, the apparatus further comprises at least one of the following;
[0191] A first acquisition module, used to acquire service data of a first electronic device registration service, and store the service data of the first electronic device registration service in a first database;
[0192] The first synchronization module is used to synchronize the service data of the second electronic device registration service and store the service data of the second electronic device registration service in the first database. The second electronic device is a device that establishes a connection with the first electronic device.
[0193] In some embodiments, the first acquisition module is used to acquire the first service existing in the first electronic device by scanning, and parse the first service to obtain service data of the first service; or
[0194] The first acquisition module is used to download the second service from the cloud server when using the second service of the first electronic device, register the second service in the first electronic device, and parse the second service to obtain service data of the second service.
[0195] In some embodiments, the apparatus further comprises at least one of the following:
[0196] A second acquisition module is used to acquire service data of a cloud server registration service and store the service data in a second database;
[0197] The second synchronization module is used to synchronize the service data of other electronic device registration services and store the service data of other electronic device registration services in the second database. The other electronic devices are devices that establish connection with the cloud server.
[0198] In an embodiment of the present application, by registering service data in a target database, when performing service discovery, the service data can be directly queried from the target database based on the service discovery parameters, thereby shortening the service discovery link, saving the time of service discovery, and thereby improving the efficiency of service discovery.
[0199] It should be noted that the service discovery device provided in the above embodiment only uses the division of the above functional modules as an example when performing service discovery. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the user terminal is divided into different functional modules to complete all or part of the functions described above. In addition, the service discovery device provided in the above embodiment and the service discovery method embodiment belong to the same concept, and the specific implementation process is detailed in the method embodiment, which will not be repeated here.
[0200] Please refer to Fig.14 , which shows a block diagram of an electronic device 1400 according to an exemplary embodiment of the present application. The electronic device 1400 in the present application may include one or more of the following components: a processor 1410 , a memory 1420 , and a display screen 1430 .
[0201] The processor 1410 may include one or more processing cores. The processor 1410 uses various interfaces and lines to connect the various parts of the entire electronic device 1400, and executes various functions and processes data of the electronic device 1400 by running or executing instructions, programs, code sets or instruction sets stored in the memory 1420, and calling data stored in the memory 1420. Optionally, the processor 1410 can be implemented in at least one hardware form of digital signal processing (DSP), field programmable gate array (FPGA), and programmable logic array (PLA). The processor 1410 can integrate one or more combinations of a central processing unit (CPU), a graphics processing unit (GPU), a neural network processor (NPU), and a modem. Among them, the CPU mainly processes the operating system, user interface, and application programs; the GPU is responsible for rendering and drawing the content that needs to be displayed on the display screen 1430; the NPU is used to implement artificial intelligence (AI) functions; and the modem is used to process wireless communications. It is understandable that the above-mentioned modem may not be integrated into the processor 1410, but may be implemented by a separate chip.
[0202] The memory 1420 may include a random access memory (RAM) or a read-only memory (ROM). Optionally, the memory 1420 includes a non-transitory computer-readable storage medium. The memory 1420 may be used to store instructions, programs, codes, code sets, or instruction sets. The memory 1420 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the following various method embodiments, etc.; the data storage area may store data (such as audio data, a phone book), etc., created according to the use of the electronic device 1400.
[0203] The display screen 1430 is a display component for displaying a user interface. Optionally, the display screen 1430 is a display screen with a touch function, through which the user can use any suitable object such as a finger, a touch pen, etc. to perform touch operations on the display screen 1430.
[0204] The display screen 1430 is usually arranged on the front panel of the electronic device 1400. The display screen 1430 can be designed as a full screen, a curved screen, a special-shaped screen, a double-sided screen or a folding screen. The display screen 1430 can also be designed as a combination of a full screen and a curved screen, a combination of a special-shaped screen and a curved screen, etc., which is not limited in this embodiment.
[0205] In addition, those skilled in the art can understand that the structure of the electronic device 1400 shown in the above drawings does not constitute a limitation on the electronic device 1400, and the electronic device 1400 may include more or fewer components than shown, or combine certain components, or arrange the components differently. For example, the electronic device 1400 also includes an audio acquisition device, a speaker, a radio frequency circuit, an input unit, a sensor, an audio circuit, a wireless fidelity (Wireless Fidelity, Wi-Fi) module, a power supply, a Bluetooth module and other components, which will not be repeated here.
[0206] An embodiment of the present application also provides a computer-readable medium, which stores at least one program code, and the at least one program code is loaded and executed by the processor to implement the service discovery method shown in the above embodiments.
[0207] An embodiment of the present application also provides a computer program product, which stores at least one program code, and the at least one program code is loaded and executed by the processor to implement the service discovery method shown in the above embodiments.
[0208] In some embodiments, the computer program product involved in the embodiments of the present application may be deployed and executed on a user electronic device, or on multiple user electronic devices located at one location, or on multiple user electronic devices distributed at multiple locations and interconnected by a communication network. Multiple user electronic devices distributed at multiple locations and interconnected by a communication network may constitute a blockchain system.
[0209] Those skilled in the art should be aware that in one or more of the above examples, the functions described in the embodiments of the present application can be implemented with hardware, software, firmware, or any combination thereof. When implemented using software, these functions can be stored in a computer-readable medium or transmitted as one or more instructions or codes on a computer-readable medium. Computer-readable media include computer storage media and communication media, wherein the communication media include any media that facilitates the transmission of a computer program from one place to another. The storage medium can be any available medium that a general or special-purpose computer can access.
[0210] The above description is only an optional embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.
Claims
1. A service discovery method, characterized in that: The method comprises: Determine a target database, the target database including at least one of a first database and a second database, the first database is used to store terminal-side service data of the first electronic device, and the second database is used to store cloud-side service data of the cloud server; Determining service discovery parameters, where the service discovery parameters are used to constrain discovered services; Based on the service discovery parameters, a service discovery operation is performed in the target database.
2. The method according to claim 1, characterized in that The target database includes the first database and the second database; The performing a service discovery operation in the target database based on the service discovery parameter includes: Based on the priority level of the first database and the priority level of the second database, a service discovery operation is performed in the first database and the second database using the service discovery parameters.
3. The method according to claim 2, characterized in that The performing a service discovery operation in the first database and the second database by using the service discovery parameter based on the priority level of the first database and the priority level of the second database includes: When the priority level of the first database is not lower than the priority level of the second database, based on the service discovery parameters, a service discovery operation is performed in the first database; when no target service is found in the first database, a service discovery operation is performed in the second database based on the service discovery parameters; When the priority level of the first database is lower than that of the second database, a service discovery operation is performed in the second database based on the service discovery parameters; when the target service is not found in the second database, a service discovery operation is performed in the first database based on the service discovery parameters.
4. The method according to claim 3, characterized in that The second database includes a first sub-database and a second sub-database, the first sub-database is used to store the service data registered and synchronized by the cloud server, and the second sub-database is used to store the service data in the service market; The performing a service discovery operation in the second database based on the service discovery parameter includes: Based on the priority level of the first sub-database and the priority level of the second sub-database, a service discovery operation is performed in the first sub-database and the second sub-database using the service discovery parameter.
5. The method according to claim 1, characterized in that The performing a service discovery operation in the target database based on the service discovery parameter includes: Based on the service discovery parameters, configure a filtering condition of a service filter, wherein the filtering condition is used to filter services that do not meet the service discovery parameters; The services in the target database that do not meet the service discovery parameters are filtered through the configured service filter to obtain the target service.
6. The method according to claim 5, characterized in that The number of the service discovery parameter is at least one, the number of the filtering condition of the service filter is also at least one, and one service discovery parameter corresponds to one filtering condition; The configured service filter filters the services in the target database that do not meet the service discovery parameters to obtain the target service, including: Filtering the services in the target service database that do not meet at least one filtering condition through the configured service filter to determine at least one service set; Determine a union of the at least one service set to obtain a target service; The at least one filtering condition is to filter at least one of the following: services whose device identifier of the device to which the service belongs is not the target device identifier, services whose service identifier is not the target service identifier, services whose capability identifier is not the target capability identifier, services whose service intent is not the target service intent, services whose capability intent is not the target capability intent, and services whose assembly protocol is the target assembly protocol.
7. The method according to claim 1, characterized in that The method further comprises at least one of the following: Acquire service data of the first electronic device registration service, and store the service data of the first electronic device registration service in the first database; Synchronize service data of a second electronic device registration service, and store the service data of the second electronic device registration service in the first database, where the second electronic device is a device that establishes a connection with the first electronic device.
8. The method according to claim 7, characterized in that The obtaining of service data of the first electronic device registration service includes: Acquire a first service existing in a first electronic device by scanning, and parse the first service to obtain service data of the first service; or When using the second service of the first electronic device, the second service is downloaded from the cloud server, and the second service is registered in the first electronic device, and the second service is parsed to obtain service data of the second service.
9. The method according to claim 1, characterized in that: The method further comprises at least one of the following: Acquire service data of the cloud server registration service, and store the service data in the second database; Synchronize service data of other electronic device registration services, and store the service data of the other electronic device registration services in the second database, where the other electronic device is a device that establishes a connection with the cloud server.
10. A service discovery device, characterized in that: The device comprises: A first determining module, configured to determine a target database, the target database comprising at least one of a first database and a second database, the first database being configured to store terminal-side service data of the first electronic device, and the second database being configured to store cloud-side service data of the cloud server; A second determination module is used to determine a service discovery parameter, where the service discovery parameter is used to constrain the discovered service; A discovery module is used to perform a service discovery operation in the target database based on the service discovery parameters.
11. An electronic device, characterized in that: The electronic device includes one or more processors and one or more memories, wherein at least one program code is stored in the one or more memories, and the at least one program code is loaded and executed by the one or more processors to implement the service discovery method as described in any one of claims 1 to 9.
12. A computer-readable storage medium, characterized in that: The storage medium stores at least one program code, and the at least one program code is loaded and executed by the processor to implement the service discovery method according to any one of claims 1 to 9.
13. A computer program product, characterized in that The computer program product stores at least one program code, and the at least one program code is used to be executed by a processor to implement the service discovery method according to any one of claims 1 to 9.
Citation Information
Patent Citations
Data resource acquisition method, device and system
CN105338026A
Service discovery processing method and apparatus based on tree structure
CN108809838A
Service discovery method and device, electronic equipment and storage medium
CN114598743A
Automated network service discovery and communication
US20140204803A1