Service discovery method and device, equipment, storage medium and product

By synchronizing the service data and version identification of the second electronic device on the first electronic device and updating the local service database, service discovery is directly carried out from the local database, and the problem of inefficient service discovery in the existing technology is solved, and more efficient is achieved service discovery process.

CN119496812APending Publication Date: 2025-02-21GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311041310.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-08-17
Publication Date
2025-02-21

AI Technical Summary

Technical Problem

In the era of the Internet of Things, service discovery between electronic devices is low, and the existing technology requires querying service data on other devices through complex operations, resulting in inefficiency.

Method used

By implementing the service synchronization module on the first electronic device, synchronize the service data and version identification of the second electronic device registration service based on the data synchronization message, and update the local service database, and directly perform service discovery from the local service database.

Benefits of technology

Improve the efficiency of service discovery, reduce dependence on other devices, and directly conduct service discovery from the local service database, avoiding complex query operations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119496812A_ABST
    Figure CN119496812A_ABST
Patent Text Reader

Abstract

The invention provides a service discovery method and device, equipment, a storage medium and a product, and belongs to the technical field of communication. The method is executed by first electronic equipment and comprises the following steps: synchronizing first service data of registration service of second electronic equipment and a first version identifier of the first service data based on a data synchronization message; updating a service database of the first electronic equipment based on the first service data; based on the first version identifier of the first service data, updating a version identifier of service data of a second electronic equipment registration service stored in a service database; and when a service discovery instruction is received, determining second service data from the service database. The first electronic device synchronizes the service data of the registration service of the second electronic device to the service database of the home terminal, when service discovery is carried out, the service discovery can be directly carried out from the service database of the home terminal, and the service data does not need to be inquired on other devices through a series of complex operations, so that the service discovery efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

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 being performed by a first electronic device, the method comprising:

[0005] Based on the data synchronization message, synchronize first service data of a second electronic device registration service and a first version identifier of the first service data, where the second electronic device is a device that establishes a connection with the first electronic device;

[0006] Based on the first service data, updating a service database of the first electronic device, the service database being used to store service data synchronized from other electronic devices;

[0007] Based on the first version identifier of the first service data, updating the version identifier of the service data of the second electronic device registration service stored in the service database;

[0008] When the service discovery instruction is received, second service data is determined from the service database.

[0009] In another aspect, a service discovery device is provided, the device being applied to a first electronic device, the device comprising:

[0010] A synchronization module, configured to synchronize first service data of a second electronic device registration service and a first version identifier of the first service data based on a data synchronization message, wherein the second electronic device is a device connected to the first electronic device;

[0011] A first updating module, configured to update a service database of the first electronic device based on the first service data, wherein the service database is configured to store service data synchronized from other electronic devices;

[0012] A second updating module, configured to update a version identifier of the service data of the second electronic device registration service stored in the service database based on the first version identifier of the first service data;

[0013] The discovery module is used to determine the second service data from the service database when receiving a service discovery instruction.

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

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

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

[0017] In an embodiment of the present application, the first electronic device synchronizes the service data of the registration service of the second electronic device to the service database of the local end based on the data synchronization message. When a service discovery instruction is received, service discovery can be performed directly from the service database of the local end without going through a series of complex operations to query service data on other devices, thereby improving the efficiency of service discovery. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] 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;

[0019] Figure 2 A schematic diagram of service synchronization shown in an exemplary embodiment of the present application is shown;

[0020] Figure 3 A schematic diagram of service synchronization shown in an exemplary embodiment of the present application is shown;

[0021] Figure 4 A flowchart of a service discovery method shown in an exemplary embodiment of the present application is shown;

[0022] Figure 5 A flowchart of a service discovery method shown in an exemplary embodiment of the present application is shown;

[0023] Figure 6 A flowchart of full service data synchronization is shown in an exemplary embodiment of the present application;

[0024] Figure 7 A flowchart of a service discovery method shown in an exemplary embodiment of the present application is shown;

[0025] Figure 8 A flowchart of incremental service data synchronization is shown in an exemplary embodiment of the present application;

[0026] Fig. 9 A flowchart of a service discovery method shown in an exemplary embodiment of the present application is shown;

[0027] Fig.10 A schematic diagram showing a version out of order according to an exemplary embodiment of the present application is shown;

[0028] Fig.11 A schematic diagram showing the cause of version out of sequence shown in an exemplary embodiment of the present application is shown;

[0029] Fig.12 A flowchart of a service discovery method shown in an exemplary embodiment of the present application is shown;

[0030] Fig.13 A flowchart of a service discovery method shown in an exemplary embodiment of the present application is shown;

[0031] Fig.14 A flowchart of a service discovery method shown in an exemplary embodiment of the present application is shown;

[0032] Fig.15 A flowchart of a service discovery method shown in an exemplary embodiment of the present application is shown;

[0033] Fig.16 A block diagram of a service discovery device shown in an exemplary embodiment of the present application is shown;

[0034] Fig.17 A block diagram of an electronic device according to an exemplary embodiment of the present application is shown. DETAILED DESCRIPTION

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

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

[0037] 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 the relevant countries and regions. For example, the data synchronization messages and service data involved in this application are all obtained with full authorization.

[0038] 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. 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. The first electronic device 101 can register a service, and the second electronic device 102 can also register a service. The first electronic device 101 and the second electronic device 102 synchronize services through the cloud server 103, so as to perform service discovery operations based on synchronized service data.

[0039] In some embodiments, the first electronic device 101 is provided with a first service synchronization program, and the second electronic device 102 is provided with a second service synchronization program. The first service synchronization program and the second service synchronization program synchronize service data, and finally achieve the final data consistency between the first electronic device 101 and the second electronic device 102. For example, please refer to Figure 2 The first electronic device 101 registers service 3, the second electronic device 102 registers service 4, the first service synchronization program synchronizes service data with the second service synchronization program, and ultimately the service database of the first electronic device 101 stores the service data of service 3 and the service data of service 4, and the service database of the second electronic device 102 stores the service data of service 3 and the service data of service 4.

[0040] In some other embodiments, the first electronic device 101 and the second electronic device 102 may also synchronize their service data with the cloud server 103; Figure 2, the first service synchronization program synchronizes the service data of service 3 to the cloud server 103, specifically to the third service synchronization program included in the cloud server 103; the second service synchronization program synchronizes the service data of service 4 to the cloud server 103, specifically to the third service synchronization program included in the cloud server 103. If service 1 and service 2 are registered in advance in the cloud server 103, the service data of service 1, service 2, service 3 and service 4 are stored in the service database of the cloud server 103, so that the cloud server 103 has the service data of all electronic device registered services. In addition, the first electronic device 101 and the second electronic device 102 can synchronize service data to the cloud server 103, but the cloud server 103 will not synchronize the service data to the terminal side, that is, the cloud server 103 will not synchronize the service data to the first electronic device 101 and the second electronic device 102, thereby ensuring the reliability of the data.

[0041] For an electronic device, the service data of the registered service is credible, that is, the service data produced by this electronic device is credible and can be transmitted to other electronic devices, that is, it can be synchronized with other electronic devices. In this case, this electronic device is called a data producer. As for the data synchronized from other electronic devices, it is untrustworthy data for this electronic device and cannot be sent by this electronic device to other electronic devices, that is, it cannot be synchronized with other electronic devices. In this case, this electronic device is a data consumer. For example, please refer to Figure 3 When the first electronic device 101 (first service synchronization program) synchronizes service data to the second electronic device 102 (second service synchronization program) and the cloud server 103 (third service synchronization program), the first electronic device 101 is the data producer, and the second electronic device 102 and the cloud server 103 are data consumers.

[0042] In some embodiments, the embodiments of the present application are explained by taking the synchronization of service data as an example; the synchronization process of the embodiments of the present application can also synchronize other data of programs or applications, that is, modify the service data into programs or applications, and the specific process will not be repeated.

[0043] The first electronic device 101 can be any device that can be connected to the Internet; for example, the first electronic device 101 can 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 the installation of the first service synchronization program. Similarly, the second electronic device 102 can also be any device that can be connected to the Internet; for example, the second electronic device 102 can 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 the installation of the second service synchronization program.

[0044] 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:

[0045] Step 401: Synchronize first service data of a registration service of a second electronic device and a first version identifier of the first service data based on a data synchronization message, where the second electronic device is a device that establishes a connection with the first electronic device.

[0046] The data synchronization message carries the first service data and the first version identifier of the first service data; the first electronic device obtains the first service data and the first version identifier of the first service data from the data synchronization message. The first service data includes service configuration information, and the service configuration information includes configuration information such as the service name, service identifier (Identity document, ID) and service uniform resource locator (Uniform Resource Locator, URL). The first version identifier can be a version number. The second electronic device and the first electronic device log in to the same user account, and the user account is the user account registered by the user in the cloud server. In some embodiments, the data synchronization message is a first data synchronization message or a second data synchronization message, and the first service data carried by the first data synchronization message can be the full service data of the second electronic device, and the first service data carried by the second data synchronization message can be the incremental service data of the second electronic device. It can be seen that the present application can not only realize full service discovery, but also realize incremental service discovery.

[0047] Step 402: Update the service database of the first electronic device based on the first service data.

[0048] The service database of the first electronic device is used to store service data synchronized from other devices; other electronic devices refer to electronic devices that establish a connection with the first electronic device, that is, other electronic devices refer to electronic devices that log in to the same user account as the first electronic device. In addition, the service database of the first electronic device is also used to store service data registered by the first electronic device.

[0049] In some embodiments, the data synchronization message may be a new service message or a deleted service message; in the case where the data synchronization message is a new service message, the first electronic device stores the first service data in the service database of the first electronic device; in the case where the data synchronization message is a deleted service message, the first electronic device updates the mark information of the first service data stored in the service database of the first electronic device to deleted. When the duration of the deleted state of the mark information of the first service data reaches a preset duration, the first electronic device deletes the first service data from the service database of the first electronic device, thereby achieving that the deletion of service data of other devices is a false deletion, and only the status is updated to the deleted state. If the service database checks the deleted state data operation time for more than the preset duration (24 hours), the service database directly discards the data.

[0050] In the case where the data synchronization message is a new service message, the first service data may be the incremental service data of the second electronic device, or it may be the full service data of the second electronic device. In the case where the first service data is the incremental service data of the second electronic device, the first electronic device directly stores the first service data in the service database of the first electronic device. In the case where the first service data is the full service data of the second electronic device, it is necessary to consider whether the service data of the second electronic device has been stored in the service database of the first electronic device. In the case where the service data of the second electronic device has been stored in the service database of the first electronic device, the step of storing the first service data in the service database of the first electronic device may be: the first electronic device deletes the service data of the second electronic device stored in the service database, and stores the first service data in the service database, so as to modify the service data of the second electronic device stored in the service database to the latest service data. In the case where the service data of the second electronic device is not stored in the service database of the first electronic device, the first electronic device directly stores the first service data in the service database.

[0051] In an embodiment of the present application, the first service data of the registration service of the second electronic device is synchronized to the service database of the first electronic device; and the first electronic device can also synchronize the service data of the registration service of the first electronic device to the service database of the second electronic device, thereby realizing synchronization of the service data registered in the device database between different devices, so as to achieve the situation where the final data of each electronic device is consistent.

[0052] Step 403: Based on the first version identifier of the first service data, the version identifier of the service data of the second electronic device registration service stored in the service database is updated.

[0053] The version identifier of the service data is stored in the file cache of the service database and is stored in a key-value format, where the key field is used to store the device identifier and the value field is used to store the version identifier. In the case where the version identifier of the service data for the registration service of the second electronic device has been stored in the service database, the first electronic device modifies the version identifier stored in the value field corresponding to the stored second electronic device to the first version identifier of the first service data; in the case where the version identifier of the service data for the registration service of the second electronic device is not stored in the service database, the first electronic device adds a pair of key-values ​​to the service database, stores the device identifier of the second electronic device in the key field, and stores the first version identifier of the first service data in the value field.

[0054] In some embodiments, the data synchronization message may not carry a version identifier, and the first electronic device generates a first version identifier for the first service data; for example, when the service data for the registration service of the second electronic device does not exist in the service database, the first version identifier of the first service data is set to 1; and when the service data for the registration service of the second electronic device exists in the service database, the first version identifier of the first service data is the stored version identifier plus 1.

[0055] Step 404: When the service discovery instruction is received, second service data is determined from the service database.

[0056] When the first electronic device needs to use the service of the second electronic device, the user can trigger a service discovery instruction to the first electronic device. When the first electronic device receives the service discovery instruction, it determines the second service data of the service registered by the second electronic device from the service database.

[0057] In an embodiment of the present application, the first electronic device synchronizes the service data of the registration service of the second electronic device to the service database of the local end based on the data synchronization message. When a service discovery instruction is received, service discovery can be performed directly from the service database of the local end without going through a series of complex operations to query service data on other devices, thereby improving the efficiency of service discovery.

[0058] 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:

[0059] Step 501: When detecting that the second electronic device is online, the first electronic device sends a first full synchronization request to the second electronic device.

[0060] The first full synchronization request is used to request synchronization of the full service data of the second electronic device registration service, and the first full synchronization request carries a second version identifier, which is a version identifier of the service data of the second electronic device registration service stored in the service database. In some embodiments, when the service data of the second electronic device registration service is not stored in the service database of the first electronic device, the second version identifier carried by the first full synchronization request may be 0; or, when the service data of the second electronic device registration service is not stored in the service database of the first electronic device, the first full synchronization request may not carry the second version identifier.

[0061] In some embodiments, a first service synchronization program is provided in the first electronic device, and the first service synchronization program is used to perform service synchronization operations. Accordingly, step 501 may be: when the second electronic device is detected to be online, the first electronic device triggers the first service synchronization program in the first electronic device; through the first service synchronization program, a first full synchronization request is sent to the second electronic device. In an embodiment of the present application, by setting the first service synchronization program in the first electronic device, the synchronization of service data between devices is achieved through the first service synchronization program.

[0062] In some embodiments, the first electronic device is provided with a first device connection management module, and the second electronic device is also provided with a second device connection management module. A data channel can be established between the first device connection management module and the second device connection management module, and the status of the opposite device (online status or offline status) can be known based on the data channel. For example, please refer to Figure 6 , the first device connection management module communicates with the second device connection management module to determine that when the second electronic device is online, the first device connection management module sends a device connection online notification to the first service synchronization program, and the device connection online notification carries the device identification of the second electronic device; the first service synchronization program receives the device connection online notification, and based on the device identification of the second electronic device, obtains the second version identification, the second version identification is the version identification of the service data of the second electronic device registration service stored in the service database, and sends a first full synchronization request to the first device connection management module, and the first full synchronization request carries the second version identification; the first device connection management module forwards the first full synchronization request to the second device connection management module.

[0063] Step 502: The second electronic device receives the first full synchronization request sent by the first electronic device, and sends a first data synchronization message to the first electronic device, where the first data synchronization message carries the first service data of the service registered by the second electronic device and a first version identifier of the first service data.

[0064] The first service data is the full service data of the service registered by the second electronic device. The second electronic device receives the first full synchronization request, obtains the second version identifier from the first full synchronization request, obtains the first service data of the service registered by the second electronic device and the first version identifier of the first service data; when the first version identifier is inconsistent with the second version identifier, it means that the service data stored in the first electronic device is the old version of the service data, and the second electronic device sends a first data synchronization message to the first electronic device. When the first version identifier is consistent with the second version identifier, it means that the service data stored in the first electronic device is the latest version of the service data, and the second electronic device does not need to send the first data synchronization message to the first electronic device.

[0065] For example, continue to refer to Figure 6 , the second device connection management module receives the first full synchronization request, and forwards the first full synchronization request to the second service synchronization program; the second service synchronization program receives the first full synchronization request, and compares the first version identifier with the second version identifier. If the first version identifier and the second version identifier are consistent, no synchronization is required; if the first version identifier and the second version identifier are inconsistent, synchronization is required, and at this time, a first data synchronization message is sent to the second device connection management module, and the first data synchronization message carries the first service data and the first version identifier. The second device connection management module receives the first data synchronization message, and forwards the first data synchronization message to the first device connection management module.

[0066] Step 503: The first electronic device receives a first data synchronization message sent by the second electronic device.

[0067] In some embodiments, after the first electronic device receives the first data synchronization message, it obtains the first service data and the first version identifier of the first service data from the first data synchronization message, and then directly executes step 504, thereby improving the data synchronization message. After the first electronic device obtains the first service data and the first version identifier of the first service data, it can also verify the version identifier again to determine whether synchronization is required; for example, the first electronic device determines whether the first version identifier is consistent with the second version identifier; if the first version identifier is consistent with the second version identifier, the first data synchronization message is discarded; if the first version identifier is inconsistent with the second version identifier, step 504 is executed, thereby improving the reliability of the data.

[0068] For example, please refer to Figure 6 The first device connection management module receives the first data synchronization message forwarded by the second device connection management module, and forwards the first data synchronization message to the first service synchronization program; the first service synchronization program receives the first data synchronization message, and updates the first service data and the first version identifier of the first service data in the service database of the first electronic device.

[0069] Step 504: The first electronic device updates the service database of the first electronic device based on the first service data.

[0070] In some embodiments, this step is the same as step 402 and will not be repeated here.

[0071] Step 505: The first electronic device updates the version of the service data of the second electronic device registration service stored in the service database based on the first version identifier of the first service data.

[0072] In some embodiments, this step is the same as step 403 and will not be repeated here.

[0073] Step 506: When receiving the service discovery instruction, the first electronic device determines the second service data from the service database.

[0074] In some embodiments, this step is the same as step 404 and will not be repeated here.

[0075] In the embodiment of the present application, the first electronic device synchronizes the service data of the second electronic device's registered service to the service database of the local end based on the data synchronization message. When receiving the service discovery instruction, the service discovery can be performed directly from the service database of the local end, without the need to query the service data on other devices through a series of complex operations, thereby improving the efficiency of service discovery. In addition, the first electronic device synchronizes the full service data of the second electronic device to the service database, which can increase the comprehensiveness of the service data in the service database, thereby improving the reliability of service discovery based on the service database.

[0076] Please refer to Figure 7 , which shows a flow chart of a service discovery method shown in an exemplary embodiment of the present application. Figure 7 , the method comprising:

[0077] Step 701: When the second electronic device newly registers for a service after going online this time, the second electronic device sends a second data synchronization message to the first electronic device.

[0078] The second data synchronization message carries the first service data of the newly registered service of the second electronic device after going online this time and the first version identifier of the first service data. In some embodiments, this step can be implemented by the following steps (1) to (3), including:

[0079] (1) When the second electronic device newly registers for a service after going online this time, the second electronic device updates the version identifier of the service database of the second electronic device, obtains the first version identifier of the first service data, and triggers the incremental synchronization process.

[0080] The version identifier may be a version number, and the second electronic device adds 1 to the version number of the service database of the second electronic device to obtain the first version number of the first service data. Figure 8 , when the second electronic device goes online and registers service 4, the incremental synchronization process is triggered.

[0081] (2) The second electronic device determines a first online device list, where the first online device list includes a device identifier of at least one electronic device connected to the second electronic device, and the at least one first electronic device includes the first electronic device, that is, the acquired device identifier of the first electronic device.

[0082] The second electronic device includes a second device connection management module, and the second device connection management module communicates data with the device connection management module of other electronic devices to obtain the status of other electronic devices, that is, to obtain the first online device list. In addition to the device identifier of the first electronic device, the first online device list may also include the device identifiers of other electronic devices; when the device identifiers of other electronic devices are also included in the first online device list, the second electronic device also synchronizes the first service data and the first version identifier of the first service data to the other electronic devices. This process is similar to the process of synchronizing the first service data and the first version identifier of the first service data to the first electronic device in step (3), and will not be repeated here. For example, please continue to refer to Figure 8 The second device connection management module included in the second electronic device communicates data with the first device connection management module included in the first electronic device and the third device connection management module included in the third electronic device to obtain a second online device list, and the second online device list includes the device identification of the first electronic device and the device identification of the third electronic device.

[0083] (3) The second electronic device sends a second data synchronization message to the first electronic device based on the device identifier of the first electronic device, where the second data synchronization message carries the first service data of the newly registered service and the first version identifier of the first service data.

[0084] For example, please refer to Figure 8 The second device connection management module sends a first online device list to a second service synchronization program included in a second electronic device, the second service synchronization program receives the first online device list, and based on the device identifier of the first electronic device included in the first online device list, sends a second data synchronization message to the second service synchronization program through the second device connection management module and the first device connection management module; based on the device identifier of the third electronic device included in the first online device list, sends a second data synchronization message to the fourth service synchronization program included in the third electronic device through the second device connection management module and the third device connection management module.

[0085] Step 702: The first electronic device receives a second data synchronization message sent by the second electronic device.

[0086] The first electronic device obtains the first service data and the version identifier of the first service data from the second data synchronization message, and then executes step 703 .

[0087] Step 703: The first electronic device updates the service database of the first electronic device based on the first service data.

[0088] In some embodiments, this step is the same as step 402 and will not be repeated here.

[0089] Step 704: The first electronic device updates the version identifier of the service data of the second electronic device registration service stored in the service database based on the first version identifier of the first service data.

[0090] In some embodiments, this step is the same as step 403 and will not be repeated here.

[0091] Step 705: When the service discovery instruction is received, second service data is determined from the service database.

[0092] In some embodiments, this step is the same as step 404 and will not be repeated here.

[0093] In the embodiment of the present application, the first electronic device synchronizes the service data of the service registered by the second electronic device to the service database of the local end based on the data synchronization message. When receiving the service discovery instruction, the service discovery can be performed directly from the service database of the local end, without the need to query the service data on other devices through a series of complex operations, thereby improving the efficiency of service discovery. In addition, the first electronic device obtains the service data of the newly registered service of the second electronic device through incremental synchronization, thereby saving the power consumption and bandwidth consumption required for synchronization.

[0094] 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:

[0095] Step 901: When the second electronic device newly registers for a service after going online this time, the second electronic device sends a second data synchronization message to the first electronic device.

[0096] In some embodiments, this step is the same as step 701 and will not be repeated here.

[0097] Step 902: The first electronic device receives a second data synchronization message sent by the second electronic device.

[0098] In some embodiments, this step is the same as step 703 and will not be repeated here.

[0099] Step 903: The first electronic device obtains the first update time of the first service data based on the second data synchronization message.

[0100] In an embodiment of the present application, in order to avoid excessive bandwidth consumption, it is necessary to minimize unnecessary synchronization processes of the full service data. To this end, we introduce a synchronization version identification mechanism, that is, to synchronize the first version identification, and the first version identification is generated by the data producer and passed to the data consumer together with the synchronized data (first service data) during the synchronization process. In some embodiments, the version identifier is a version number, and the version numbers synchronized by the data producer increase sequentially, and the service database of the data consumer will store the most recent version of the synchronized data. After receiving the first service data, the data consumer will check whether the first version number carried is equal to the most recent version number plus 1. If not, it means that there is a loss of service data during the synchronization process. This situation is synchronization disorder. For example, please refer to Fig.10 , the data producer generates multiple service data, and the version numbers of the multiple service data are 99, 100, 101...110 respectively; the data producer synchronizes the multiple service data and the version numbers of the service data to the data consumer through multiple data synchronization messages, and the version numbers of the multiple service data received by the data consumer are 99, 100, 101, 107 respectively, that is, synchronization disorder occurs.

[0101] When the first electronic device and the second electronic device perform data synchronization, they need to use the message channel to send and receive data, and the second data synchronization message is a transmission message based on the Hypertext Transfer Protocol (HTTP) protocol; due to the stability of the message channel and the fact that Http itself does not support the ability to preserve order, incremental synchronization may cause version disorder. For example, when the second data synchronization message 1 is sent, a connection problem occurs, resulting in failure to send; and the second data synchronization message 2 is triggered during the sending process of the second data synchronization message 1, which may cause the second data synchronization message 2 to be sent earlier than the second data synchronization message 1, resulting in version identification timing. For another example, the Http message itself cannot preserve order, resulting in version identification timing. Therefore, the update time of the service data is increased, and the incremental synchronization is based on the latest data at the time point. Therefore, after the first electronic device receives the second data synchronization message, it obtains the first update time of the first service data based on the second data synchronization message. For example, the second data synchronization message carries the first service data, and the first service data includes the first update time, then the first electronic device obtains the first service data from the second data synchronization message, and obtains the first update time from the first service data.

[0102] In some embodiments, after the first electronic device obtains the first update time, it obtains the second update time, where the second update time is the time when the first electronic device last updated the service data of the second electronic device's registration service, and then determines whether the first update time is later than the second update time; if the first update time is later than the second update time, execute step 904; if the first update time is not later than the second update time, execute step 907.

[0103] Step 904: When the first update time is later than the second update time, the first electronic device stores the first service data in a service database of the first electronic device.

[0104] The second update time is the time when the first electronic device last updated the service data of the second electronic device's registration service. In the case where the first update time is later than the second update time, it means that the first service data is the latest service data, and the first electronic device stores the first service data in the service database of the first electronic device. In the case where the first update time is not later than the second update time, it means that the first service data is not the latest service data, and the first electronic device discards the first service data, thereby updating the database only when the update time of the received service data is later than the update time of the service data in the database, otherwise it will not be updated and will be directly discarded, thereby ensuring that the service data stored in the service database of the first electronic device is the latest service data, thereby improving the accuracy of subsequent service discovery based on the service database.

[0105] For example, see Fig.11 , the data producer produces 4 service data, the version identifiers of these 4 service data are 100, 101, 102 and 103 respectively, however, the second data synchronization message 1 is to add the service data corresponding to 101, the second data synchronization message 2 is to delete the service data corresponding to 102, and the second data synchronization message 3 is to add the service data corresponding to 103. The data producer sends the second data synchronization message 1, the second data synchronization message 2 and the second data synchronization message 3 to the data consumer, however, the three second data synchronization messages are out of order when they are sent, for example, the second data synchronization message 1 fails to be sent due to a connection problem, and the second data synchronization message 2 is triggered in this process, resulting in the second data synchronization message 2 arriving first, resulting in version time sequence; or because the transmission protocol Http of these three second data synchronization messages itself cannot maintain order, resulting in version time sequence, at this time, it is necessary to judge whether to store or discard based on the update time of these three second data synchronization messages.

[0106] Step 905: The first electronic device updates the version identifier of the service data of the second electronic device registration service stored in the service database based on the first version identifier of the first service data.

[0107] In some embodiments, this step is the same as step 403 and will not be repeated here.

[0108] Step 906: When the service discovery instruction is received, determine the second service data from the service database.

[0109] In some embodiments, this step is the same as step 404 and will not be repeated here.

[0110] Step 907: When the first update time is not later than the second update time, the first electronic device determines the out-of-sequence version identifier of the second electronic device, and records the out-of-sequence version identifier in the version list.

[0111] The version identifier may be a version number; the first electronic device determines the missing version number between the first version number and the second version number based on the first version number of the first service data and the second version number of the stored service data of the second electronic device, and the missing version number is the version identifier of the time sequence, and the determined version number is recorded in the version list. For example, if the first version number is 4 and the second version number is 2, the missing version number is 3, that is, version number 3 is recorded in the version list.

[0112] Step 908: Upon receiving the out-of-sequence version identifier and its corresponding service data sent by the second electronic device, the first electronic device deletes the out-of-sequence version identifier in the version list.

[0113] Each time the second electronic device registers a new service, it will synchronize incremental service data with the first electronic device based on the above process; when the second electronic device receives the second data synchronization message sent by the second electronic device for the next time and the version identifier carried by the second data synchronization message sent next time is an out-of-sequence version identifier and its corresponding service data, the first electronic device deletes the sequential version identifier in the version list, and updates the service data carried by the second data synchronization message sent next time to the service database of the first electronic device, and updates the version identifier of the service data of the second electronic device registration service stored in the service database based on the version identifier carried by the second data synchronization message sent next time.

[0114] Step 909: When performing service synchronization next time, the first electronic device determines whether there are out-of-order version identifiers in the version list.

[0115] The first electronic device and the second electronic device can synchronize the full service data, or can synchronize the incremental service data, or can combine these two synchronization methods. For example, after the first electronic device synchronizes the service data based on the synchronization process of the incremental service data; after the first electronic device goes offline and comes online again, the first electronic device can perform the next service synchronization. In some embodiments, when the first electronic device performs service synchronization next time, it can directly select the full service data synchronization method, that is, synchronize the service data through the process of steps 501-505, thereby avoiding the problem of incomplete synchronization of the service data due to the version sequence of the previous incremental service data. In other embodiments, when the first electronic device performs service synchronization next time, it can directly select the incremental service data synchronization method, that is, synchronize the service data through the process of steps 701-704, thereby saving the power consumption and bandwidth consumption required for synchronization. In other embodiments, when the first electronic device performs service synchronization next time, it first determines whether it is through the incremental service data synchronization method or the full service data synchronization method, that is, the first electronic device determines whether there is an out-of-order version identifier in the version list. When there are out-of-order version identifiers in the version list, it is determined to adopt the full service data synchronization method and step 910 is executed; when there are no out-of-order version identifiers in the version list, the incremental service data synchronization method is adopted.

[0116] In some embodiments, the first electronic device corresponds to a version list for an electronic device at the opposite end; for example, the first electronic device establishes a connection with the second electronic device and the third electronic device, then two version lists are stored in the first electronic device, one version list corresponding to the second electronic device, and one version list corresponding to the third electronic device; when the first electronic device synchronizes service data with the second electronic device, it obtains the version list corresponding to the second electronic device, and then determines whether there are any out-of-order version identifiers in the version list, so that the first electronic device can synchronize service data with different electronic devices using different service data synchronization methods, thereby improving the flexibility of service data synchronization.

[0117] Step 910: When there are out-of-order version identifiers in the version list, the first electronic device sends a second full synchronization request to the second electronic device, where the second full synchronization request is used to request synchronization of full service data of a registration service of the second electronic device.

[0118] The second full synchronization request carries the fourth version identifier of the service data of the second electronic device stored in the service database of the first electronic device; the second electronic device receives the second full synchronization request sent by the first electronic device, and determines whether it is necessary to synchronize the service data of the second electronic device based on the fourth version identifier and the fifth version identifier of the service database of the second electronic device, and when it is determined that it is necessary to synchronize the service data of the second electronic device, sends a fourth data synchronization message to the first electronic device, and the fourth data synchronization message carries the full service data of the service registered by the second electronic device and the version identifier of the full service data. The first electronic device receives the fourth data synchronization message, and based on the full service data and the version identifier of the full service data, updates the service data and the version identifier of the service database of the first electronic device, and this process is similar to the process of the first electronic device synchronizing the full service data and the version identifier of the second electronic device based on the first full synchronization request, and will not be repeated here.

[0119] In an embodiment of the present application, the database is updated only when the update time of the received service data is later than the update time of the service data in the database; otherwise, the database is not updated but directly discarded, thereby ensuring that the service data stored in the service database of the first electronic device is the latest service data, thereby improving the accuracy of subsequent service discovery based on the service database.

[0120] 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:

[0121] Step 1201: When the first electronic device newly registers a service, the first electronic device stores the service data of the newly registered service of the first electronic device and the version identifier corresponding to the service data of the newly registered service in the service database of the first terminal, and marks the mark information of the service data of the newly registered service as unsynchronized.

[0122] When the first electronic device newly registers a service, the first electronic device generates service data of the newly registered service and a version identifier corresponding to the service data of the newly registered service. In some embodiments, the version identifier is a version number; when the first electronic device registers the service for the first time, the version number of the newly registered service is 0; when the first electronic device is not registering the service for the first time, the version number of the newly registered service is the stored version number + 1.

[0123] Step 1202: the first electronic device determines third service data and a version identifier of the third service data from a service database, where the third service data is service data registered by the first electronic device and has marking information indicating that the data is not synchronized.

[0124] When the first electronic device newly registers a service, the service data of the newly registered service of the first electronic device and the corresponding version identifier are stored in the service database of the first electronic device; therefore, the service database of the first electronic device stores not only the service data synchronized from other electronic devices, but also the service data of the service registered by the first electronic device. In addition, the first electronic device synchronizes the service data produced by itself to the cloud server, that is, the third service data determined from the service database is the service data of the service registered by the first electronic device, and the service data synchronized from other electronic devices will not be synchronized to the cloud server, that is, the service data synchronized from other devices will not be selected from the service database, thereby improving the reliability of the data.

[0125] Step 1203: The first electronic device sends a third data synchronization message to the cloud server, where the third data synchronization message carries the third service data and a version identifier of the third service data.

[0126] The cloud server receives the third data synchronization message sent by the first electronic device, obtains the third service data and the version identifier of the third service data from the third data synchronization message, and updates the service data and the version identifier in the service database of the cloud server based on the third service data and the version identifier of the third service data. The process in which the cloud server updates the service data and the version identifier in the service database of the cloud server based on the third service data and the version identifier of the third service data is similar to the process in which the first electronic device updates the service data and the version identifier in the service database of the first electronic device based on the first service data and the version identifier of the first service data, and will not be repeated here.

[0127] Step 1204: After sending the third data synchronization message to the cloud server, the first electronic device modifies the marking information of the third service data in the service database of the first electronic device from unsynchronized to synchronized.

[0128] In an embodiment of the present application, when the device synchronizes service data to the cloud server, it does not distinguish between full service data synchronization and incremental service data synchronization, and each synchronization only synchronizes the service data in the local service database that is marked as unsynchronized. In addition, after the service is registered in the local service database, the status of the service data is marked as unsynchronized in the local service database. After the synchronization to the cloud server is successful, the status of the service data is marked as synchronized. Through the above mechanism, when a new service is registered, the third service data of the newly registered service is synchronized to the cloud server, which improves the timeliness of service data synchronization, that is, improves the efficiency of service data synchronization. In addition, the accuracy of service data synchronization can be guaranteed by setting the marking information.

[0129] Please refer to Fig.13, which shows a flow chart of a service discovery method shown in an exemplary embodiment of the present application. Fig.13 , the method comprising:

[0130] Step 1301: When the first electronic device newly deletes a service, the first electronic device marks the marking information of the service data of the newly deleted service by the first electronic device as deleted but not synchronized.

[0131] In some embodiments, when the first electronic device newly deletes a service, the first electronic device may also directly delete the service data of the newly deleted service, thereby truly deleting the service data to save storage resources of the first electronic device. In other embodiments, when the first electronic device newly deletes a service, the first electronic device may first update the status of the service data, and then delete the service data of the newly deleted service after synchronizing the deletion event to the cloud server.

[0132] Step 1302: the first electronic device determines third service data and a version identifier of the third service data from a service database, where the third service data is service data registered by the first electronic device and has marking information indicating that the data is not synchronized.

[0133] In some embodiments, this step is the same as step 1202 and will not be repeated here.

[0134] Step 1303: The first electronic device sends a third data synchronization message to the cloud server, where the third data synchronization message carries the third service data and a version identifier of the third service data.

[0135] The third data synchronization message is a service deletion message. The cloud server receives the third data synchronization message from the first electronic device, and deletes the third service data and the version identifier of the third service data stored in the service database of the cloud server based on the third data synchronization message.

[0136] Step 1304: After sending the third data synchronization message to the cloud server, the first electronic device deletes the service data of the newly deleted service of the first electronic device from the service database of the first electronic device.

[0137] The service database of the first electronic device stores an ID, an update time, and a status (mark information); the type of the ID is a string (String), the type of the update time is a long integer (Long), and the type of the status is an integer (Int); for example, the service database of the first electronic device is shown in Table 1 below:

[0138] Table 1

[0139]

[0140] In an embodiment of the present application, when the device synchronizes service data to the cloud server, it does not distinguish between full service data synchronization and incremental service data synchronization, and each synchronization only synchronizes the service data in the local service database that is marked as unsynchronized. In addition, after the service is deleted, the status of the service data is marked as deleted but not synchronized in the local service database, and the service data of the newly deleted service is deleted only after the synchronization to the cloud server is successful. Through the above mechanism, when a service is newly deleted, the third service data of the newly deleted service is synchronized to the cloud server, which improves the timeliness of service data synchronization, that is, improves the efficiency of service data synchronization. In addition, the accuracy of service data synchronization can be guaranteed by setting the marking information.

[0141] Please refer to Fig.14 , which shows a flow chart of a service discovery method shown in an exemplary embodiment of the present application. Fig.14 , the method comprising:

[0142] Step 1401: When the first electronic device establishes a connection with the cloud server, the first electronic device determines the third service data and the version identifier of the third service data from the service database, where the third service data is registered by the first electronic device and has marking information indicating that the service data is not synchronized.

[0143] In an embodiment of the present application, when the first electronic device establishes a connection with the cloud server, a process of synchronizing service data to the cloud server is triggered.

[0144] Step 1402: The first electronic device sends a third data synchronization message to the cloud server, where the third data synchronization message carries third service data and a version identifier of the third service data.

[0145] The third data synchronization message may be a new service message or a deleted service message; when the third data synchronization message is a new service message, the cloud server may synchronize the service data with reference to the processing procedure of step 1103; when the third data synchronization message is a deleted service message, the cloud server may synchronize the service data with reference to the processing procedure of step 1303.

[0146] Step 1403: The first electronic device modifies the marking information of the third service data in the service database from unsynchronized to synchronized.

[0147] In the case that the third data synchronization message is a service deletion message, the first electronic device deletes the third service data from the service database to save storage resources.

[0148] In an embodiment of the present application, when the first electronic device establishes a connection with the cloud server, the process of synchronizing service data to the cloud server is triggered, so that the last added or deleted service data can be synchronized to the cloud server at one time, saving power consumption of the first electronic device.

[0149] Please refer to Fig.15 , which shows a flow chart of a service discovery method shown in an exemplary embodiment of the present application. Fig.15 , the method comprising:

[0150] Step 1501: When a first electronic device newly registers a service, the first electronic device updates a version identifier of service data of the newly registered service.

[0151] In some embodiments, the process of the first electronic device updating the version identification of the service data of the newly registered service is similar to the process of the second electronic device updating the version identification of the service data of the newly registered service, and will not be repeated here. In other embodiments, when the first electronic device newly deletes a service, the first electronic device may also update the version identification of the service data of the newly deleted service, and then execute step 1502, so that when the service data on the first electronic device is changed, it is synchronized to other electronic devices in a timely manner.

[0152] Step 1502: The first electronic device determines a second online device list, where the second online device list includes at least one second electronic device that has established a connection with the first electronic device.

[0153] In some embodiments, the process of the first electronic device determining the second online device list is similar to the process of the second electronic device determining the first online device list, which is not described in detail here.

[0154] Step 1503: the first electronic device sends a fourth data synchronization message to at least one second electronic device in the second online device list, where the fourth data synchronization message carries service data of the newly registered service of the first electronic device and its corresponding version identifier.

[0155] In some embodiments, the process of the first electronic device sending the fourth data synchronization message to at least one second electronic device in the second online device list is similar to the process of the second electronic device sending the fourth data synchronization message to at least one first electronic device in the first online device list, and is not repeated here.

[0156] In an embodiment of the present application, the first electronic device can also synchronize service data to the second electronic device through an incremental service data synchronization method, thereby realizing two-way synchronization between the first electronic device and the second electronic device, so that the service database of the first electronic device and the service database of the second electronic device ultimately achieve data consistency, thereby improving the efficiency of the first electronic device and the second electronic device in service discovery based on their own service databases.

[0157] Please refer to Fig.16 , which shows a block diagram of a service discovery device shown in an exemplary embodiment of the present application, the device is applied to a first electronic device, and the device includes:

[0158] A synchronization module 1601 is used to synchronize first service data of a registration service of a second electronic device and a first version identifier of the first service data based on a data synchronization message, where the second electronic device is a device connected to the first electronic device;

[0159] A first updating module 1602, configured to update a service database of the first electronic device based on the first service data, the service database being configured to store service data synchronized from other electronic devices;

[0160] The second updating module 1603 is used to update the version identifier of the service data of the second electronic device registration service stored in the service database based on the first version identifier of the first service data;

[0161] The discovery module 1604 is configured to determine the second service data from the service database when receiving a service discovery instruction.

[0162] In some embodiments, the synchronization module 1601 is used to send a first full synchronization request to the second electronic device when it is detected that the second electronic device is online, the first full synchronization request is used to request synchronization of the full service data of the registration service of the second electronic device, and the first full synchronization request carries a second version identifier, which is the version identifier of the service data of the registration service of the second electronic device stored in the service database; receive a first data synchronization message sent by the second electronic device, the first data synchronization message carries the first service data of the registration service of the second electronic device and the first version identifier of the first service data.

[0163] In some embodiments, the synchronization module 1601 is used to trigger a service synchronization program in the first electronic device when it is detected that the second electronic device is online; and send a first full synchronization request to the second electronic device through the service synchronization program.

[0164] In some embodiments, the synchronization module 1601 is used to receive a second data synchronization message sent by a second electronic device, the second data synchronization message carries the first service data of the newly registered service after the second electronic device goes online this time and the first version identifier of the first service data, and the second data synchronization message is triggered when the second electronic device newly registers for the service after the second electronic device goes online this time.

[0165] In some embodiments, the synchronization module 1601 is also used to obtain a first update time of the first service data based on a second data synchronization message; when the first update time is later than the second update time, the first service data is stored in a service database of the first electronic device, and the second update time is the time when the first electronic device last updated the service data of the second electronic device registration service.

[0166] In some embodiments, the apparatus further comprises:

[0167] A first determining module, configured to determine, when the first update time is not later than the second update time, the out-of-sequence version identifier of the second electronic device, and record the out-of-sequence version identifier in a version list;

[0168] The first deleting module is used to delete the out-of-order version identifier in the version list when receiving the out-of-order version identifier and its corresponding service data sent by the second electronic device.

[0169] In some embodiments, the apparatus further comprises:

[0170] The second determination module is used to determine whether there are out-of-order version identifiers in the version list when performing service synchronization next time;

[0171] The first sending module is used to send a second full synchronization request to the second electronic device when there is an out-of-order version identifier in the version list, and the second full synchronization request is used to request synchronization of full service data of a registration service of the second electronic device.

[0172] In some embodiments, the first update module 1602 is used to store the first service data in the service database of the first electronic device when the data synchronization message is a new service message; and to update the marking information of the first service data stored in the service database of the first electronic device to deleted when the data synchronization message is a deletion service message.

[0173] In some embodiments, the apparatus further comprises:

[0174] The second deleting module is used to delete the first service data from the service database of the first electronic device when the duration of the mark information of the first service data being in the deleted state reaches a preset duration.

[0175] In some embodiments, the service database further stores service data of the first electronic device registration service; the device further includes:

[0176] A third determining module, configured to determine third service data and a version identifier of the third service data from a service database, wherein the third service data is service data registered by the first electronic device and has marking information indicating that the service data is not synchronized;

[0177] The second sending module is used to send a third data synchronization message to the cloud server, where the third data synchronization message carries the third service data and a version identifier of the third service data.

[0178] In some embodiments, the apparatus further comprises at least one of the following:

[0179] A first processing module is used to store the service data of the newly registered service of the first electronic device and the version identifier corresponding to the service data of the newly registered service in the service database of the first terminal when the first electronic device newly registers a service, and mark the marking information of the service data of the newly registered service as unsynchronized, and after sending a third data synchronization message to the cloud server, modify the marking information of the third service data in the service database of the first electronic device from unsynchronized to synchronized;

[0180] The second processing module is used to mark the marking information of the service data of the newly deleted service of the first electronic device as deleted but not synchronized when the first electronic device newly deletes the service, and after sending a third data synchronization message to the cloud server, delete the service data of the newly deleted service of the first electronic device from the service database of the first electronic device.

[0181] In some embodiments, the third determination module is used to determine the third service data and the version identifier of the third service data from the service database when the first electronic device establishes a connection with the cloud server;

[0182] A third determining module, configured to determine the third service data and a version identifier of the third service data from a service database when the first electronic device newly registers for a service;

[0183] The third determining module is used to determine the third service data and the version identifier of the third service data from the service database when the first electronic device newly deletes the service.

[0184] In some embodiments, the apparatus further comprises:

[0185] An updating module, used for updating a version identifier of service data of a newly registered service when the first electronic device newly registers a service;

[0186] A fourth determining module, configured to determine an online device list, the online device list including at least one second electronic device connected to the first electronic device;

[0187] The third sending module is used to send a fourth data synchronization message to at least one second electronic device in the online device list, where the fourth data synchronization message carries service data of the newly registered service of the first electronic device and its corresponding version identifier.

[0188] In an embodiment of the present application, the first electronic device synchronizes the service data of the registration service of the second electronic device to the service database of the local end based on the data synchronization message. When a service discovery instruction is received, service discovery can be performed directly from the service database of the local end without going through a series of complex operations to query service data on other devices, thereby improving the efficiency of service discovery.

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

[0190] Please refer to Fig.17 , which shows a block diagram of an electronic device 1700 according to an exemplary embodiment of the present application. The electronic device 1700 in the present application may include one or more of the following components: a processor 1710 , a memory 1720 , and a display screen 1730 .

[0191] The processor 1710 may include one or more processing cores. The processor 1710 uses various interfaces and lines to connect the various parts of the entire electronic device 1700, and executes various functions and processes data of the electronic device 1700 by running or executing instructions, programs, code sets or instruction sets stored in the memory 1720, and calling data stored in the memory 1720. Optionally, the processor 1710 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 1710 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 1730; 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 1710, but may be implemented by a separate chip.

[0192] The memory 1720 may include a random access memory (RAM) or a read-only memory (ROM). Optionally, the memory 1720 includes a non-transitory computer-readable storage medium. The memory 1720 may be used to store instructions, programs, codes, code sets, or instruction sets. The memory 1720 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 1700.

[0193] The display screen 1730 is a display component for displaying a user interface. Optionally, the display screen 1730 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 1730.

[0194] The display screen 1730 is usually arranged on the front panel of the electronic device 1700. The display screen 1730 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 1730 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.

[0195] In addition, those skilled in the art can understand that the structure of the electronic device 1700 shown in the above drawings does not constitute a limitation on the electronic device 1700, and the electronic device 1700 may include more or fewer components than shown, or combine certain components, or arrange the components differently. For example, the electronic device 1700 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.

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

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

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

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

[0200] 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 is performed by a first electronic device, and includes: Based on the data synchronization message, synchronize first service data of a second electronic device registration service and a first version identifier of the first service data, where the second electronic device is a device that establishes a connection with the first electronic device; Based on the first service data, updating a service database of the first electronic device, the service database being used to store service data synchronized from other electronic devices; Based on the first version identifier of the first service data, updating the version identifier of the service data of the second electronic device registration service stored in the service database; When the service discovery instruction is received, second service data is determined from the service database.

2. The method according to claim 1, characterized in that The step of synchronizing the first service data of the second electronic device registration service and the first version identifier of the first service data based on the data synchronization message includes: When it is detected that the second electronic device is online, a first full synchronization request is sent to the second electronic device, where the first full synchronization request is used to request synchronization of the full service data of the registration service of the second electronic device, and the first full synchronization request carries a second version identifier, where the second version identifier is a version identifier of the service data of the registration service of the second electronic device stored in the service database; A first data synchronization message sent by the second electronic device is received, where the first data synchronization message carries first service data of a registration service of the second electronic device and a first version identifier of the first service data.

3. The method according to claim 2, characterized in that When detecting that the second electronic device is online, sending a first full synchronization request to the second electronic device includes: When detecting that the second electronic device is online, triggering a service synchronization program in the first electronic device; The first full synchronization request is sent to the second electronic device through the service synchronization program.

4. The method according to claim 1, characterized in that The step of synchronizing the first service data of the second electronic device registration service and the first version identifier of the first service data based on the data synchronization message includes: Receive a second data synchronization message sent by the second electronic device, the second data synchronization message carries the first service data of the newly registered service after the second electronic device goes online this time and the first version identifier of the first service data, and the second data synchronization message is triggered when the second electronic device newly registers for the service after the second electronic device goes online this time.

5. The method according to claim 4, characterized in that The method further comprises: Based on the second data synchronization message, obtaining a first update time of the first service data; When the first update time is later than the second update time, the step of storing the first service data in the service database of the first electronic device is performed, and the second update time is the time when the first electronic device last updated the service data of the second electronic device registration service.

6. The method according to claim 5, characterized in that The method further comprises: In a case where the first update time is not later than the second update time, determining a version identifier of the second electronic device that is out of sequence, and recording the version identifier of the out of sequence in a version list; When the out-of-sequence version identifier and the corresponding service data are received from the second electronic device, the out-of-sequence version identifier in the version list is deleted.

7. The method according to claim 6, characterized in that The method further comprises: When performing service synchronization next time, determining whether there are out-of-order version identifiers in the version list; In the case where there are out-of-order version identifiers in the version list, a second full synchronization request is sent to the second electronic device, where the second full synchronization request is used to request synchronization of full service data of a registration service of the second electronic device.

8. The method according to claim 1, characterized in that: The updating of the service database of the first electronic device based on the first service data includes: In the case where the data synchronization message is a newly added service message, storing the first service data in a service database of the first electronic device; In a case where the data synchronization message is a service deletion message, the marking information of the first service data stored in the service database of the first electronic device is updated to deleted.

9. The method according to claim 8, characterized in that The method further comprises: When the duration of the deleted state of the mark information of the first service data reaches a preset duration, the first service data is deleted from the service database of the first electronic device.

10. The method according to claim 1, characterized in that The service database also stores service data of the first electronic device registration service; the method further includes: Determine third service data and a version identifier of the third service data from the service database, wherein the third service data is service data registered by the first electronic device and has marking information indicating that the data is not synchronized; A third data synchronization message is sent to the cloud server, where the third data synchronization message carries the third service data and a version identifier of the third service data.

11. The method according to claim 10, characterized in that The method further comprises at least one of the following: When the first electronic device newly registers a service, the service data of the newly registered service of the first electronic device and the version identifier corresponding to the service data of the newly registered service are stored in the service database of the first terminal, and the marking information of the service data of the newly registered service is marked as unsynchronized, and after sending the third data synchronization message to the cloud server, the marking information of the third service data in the service database of the first electronic device is modified from unsynchronized to synchronized; When the first electronic device newly deletes a service, the marking information of the service data of the newly deleted service of the first electronic device is marked as deleted but not synchronized, and after sending the third data synchronization message to the cloud server, the service data of the newly deleted service of the first electronic device is deleted from the service database of the first electronic device.

12. The method according to claim 10 or 11, characterized in that: The method further comprises at least one of the following: When the first electronic device establishes a connection with the cloud server, performing the step of determining the third service data and the version identifier of the third service data from the service database; When the first electronic device newly registers a service, performing the step of determining the third service data and the version identifier of the third service data from the service database; When the first electronic device newly deletes a service, the step of determining the third service data and the version identifier of the third service data from the service database is performed.

13. The method according to claim 1, characterized in that The method further comprises: When the first electronic device newly registers a service, updating a version identifier of the service data of the newly registered service; Determine an online device list, where the online device list includes at least one second electronic device connected to the first electronic device; A fourth data synchronization message is sent to at least one second electronic device in the online device list, where the fourth data synchronization message carries service data of a newly registered service of the first electronic device and its corresponding version identifier.

14. A service discovery device, characterized in that: The device is applied to a first electronic device, and includes: A synchronization module, configured to synchronize first service data of a second electronic device registration service and a first version identifier of the first service data based on a data synchronization message, wherein the second electronic device is a device connected to the first electronic device; A first updating module, configured to update a service database of the first electronic device based on the first service data, wherein the service database is configured to store service data synchronized from other electronic devices; A second updating module, configured to update a version identifier of the service data of the second electronic device registration service stored in the service database based on the first version identifier of the first service data; The discovery module is used to determine the second service data from the service database when receiving a service discovery instruction.

15. 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 13.

16. 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 13.

17. 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 13.