Data synchronization method, storage medium and equipment

By searching and judging the Bluetooth device that has subscribed to the broadcast in the first device, sending data requests to broadcast to obtain service data packets, and reporting data to the server side, the problem of cumbersome data synchronization process in the prior art is solved, and automation is realized Synchronize with insensible data to improve user experience.

CN119449817APending Publication Date: 2025-02-14ZHEJIANG SHAOXING SUPOR DOMESTIC ELECTRICAL APPLIANCE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410955311.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-16
Publication Date
2025-02-14

AI Technical Summary

Technical Problem

In the prior art, the data synchronization process of Bluetooth equipment relies too much on the user to manually operate the application software, resulting in cumbersome operational processes and poor user experience.

Method used

By searching for Bluetooth devices within the preset range in the first device, it is determined whether there is a device that has been subscribed to the broadcast, and sends a data request to broadcast to obtain a service data packet, and finally reports the data to the server side to realize automatic data synchronization.

Benefits of technology

The data synchronization process is simplified, and the senseless automatic data synchronization is realized, which improves the user experience and reduces the user's needs for manual operations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119449817A_ABST
    Figure CN119449817A_ABST
Patent Text Reader

Abstract

The invention discloses a data synchronization method, a storage medium and equipment, and the method comprises the steps: searching Bluetooth equipment in a preset range, obtaining a Bluetooth equipment list, judging whether the Bluetooth equipment which subscribes the broadcast of the Bluetooth equipment exists in the Bluetooth equipment list or not, and if yes, taking the Bluetooth equipment which subscribes the broadcast of the Bluetooth equipment in the Bluetooth equipment list as second equipment. Then, a data request broadcast for the second equipment is sent, a service data packet returned by the second equipment in response to the data request broadcast is received, and the service data packet carries service data of the second equipment; and reporting the service data to a server side. The first device can actively request to obtain the data of the second device and synchronize the obtained data to the server side, automatic synchronization of the data is achieved, the whole process does not need user participation and is non-inductive to the user, and the user experience 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 data synchronization method, a storage medium and a device. Background Art

[0002] With the development of technology, when users currently obtain data from Bluetooth devices, generally speaking, they need to open the application software or applet for the Bluetooth device in the terminal device and wait for the Bluetooth device to connect before data synchronization can be performed.

[0003] However, this method requires the user to manually open the application software or applet for the Bluetooth device and perform some operations to achieve data synchronization. The data synchronization process is overly dependent on the application software or applet, the operation process is relatively cumbersome, and the user experience is poor.

[0004] Therefore, how to simplify the data synchronization process and realize active data synchronization process to improve user experience is an urgent problem to be solved. Summary of the invention

[0005] The present application provides a data synchronization method, a storage medium and a device to realize the process of automatic data synchronization and improve the user experience.

[0006] This application adopts the following technical solutions:

[0007] The present application provides a data synchronization method, which is applied to a first device and includes:

[0008] Search for Bluetooth devices within the preset range and obtain a list of Bluetooth devices;

[0009] Determine whether there is a Bluetooth device in the Bluetooth device list that has subscribed to its broadcast, and if so, use the Bluetooth device in the Bluetooth device list that has subscribed to its broadcast as the second device;

[0010] Sending a data request broadcast to the second device;

[0011] receiving a service data packet broadcasted and returned by the second device in response to the data request, wherein the service data packet carries service data of the second device;

[0012] The business data is reported to the server.

[0013] The first device in the present application can actively request to obtain data from the second device within a preset communication range by sending a broadcast, and synchronize the obtained data to the server, thereby realizing active data synchronization. The user does not need to manually operate the application software to synchronize data. The entire synchronization process is imperceptible to the user, thereby improving the user experience.

[0014] Optionally, before sending the data request broadcast for the second device, the method further includes:

[0015] Determine whether the time from the last receipt of the service data packet returned by the second device is not less than a preset time;

[0016] Sending a data request broadcast to the second device includes:

[0017] If the time from the last receipt of the service data packet returned by the second device to the preset time is not less than the preset time, a data request broadcast is sent to the second device.

[0018] In the present application, the first device can only send a data request broadcast if the time length since the last time it received a service data packet returned by the second device is not less than a preset time length, thereby controlling the frequency of data synchronization.

[0019] Optionally, determining whether there is a Bluetooth device in the Bluetooth device list that has subscribed to its broadcast includes:

[0020] Obtaining a preset whitelist, the preset whitelist including unique device identifiers of Bluetooth devices that have subscribed to its broadcast;

[0021] For each Bluetooth device in the Bluetooth device list, determining whether the unique device identifier of the Bluetooth device matches the unique device identifier in the preset whitelist;

[0022] If so, it is determined that the broadcast of the Bluetooth device has been subscribed.

[0023] A preset whitelist is set in the present application, which stores the unique device identifier of the second device whose broadcast the first device has subscribed to. The first device decides whether to send a data request broadcast based on the preset whitelist and the Bluetooth device list. The first device can only send a data request broadcast to the device that has subscribed to the broadcast, thereby improving the accuracy and efficiency of data acquisition.

[0024] Optionally, before sending the data request broadcast for the second device, the method further includes:

[0025] Acquire a service identifier of the second device, where the service identifier is used to identify each service data;

[0026] A data request broadcast for the second device is generated according to the service identifier of the second device.

[0027] In the present application, the first device generates a data request broadcast for the second device according to the acquired service identifier of the second device, so that the corresponding service data can be obtained according to the service identifier.

[0028] Optionally, the service data packet carries a unique device identifier of the second device;

[0029] Before reporting the service data to the server, the method further includes:

[0030] Determining whether the unique device identifier of the second device carried in the service data packet is in the preset whitelist;

[0031] If it is determined that the unique device identifier of the second device carried in the service data packet is in the preset whitelist, the service data packet is parsed to obtain the service data of the second device.

[0032] The present application is provided with a preset whitelist. For a received service data packet, the first device will process the service data packet only when it determines that the unique device identifier of the second device carried in the service data packet is in the preset whitelist. That is, the first device will process the service data packet sent by the second device only when it has subscribed to the broadcast of the second device, thereby improving the accuracy and efficiency of processing.

[0033] Optionally, the service data packet carries a service identifier of the second device and service data corresponding to the service identifier, and the preset whitelist also includes service identifiers of Bluetooth devices that have subscribed to its broadcast, and the service identifier is used to identify each service data;

[0034] Before reporting the service data to the server, the method further includes:

[0035] Determine whether the service identifier carried in the service data packet is in the preset whitelist;

[0036] If the service identifier carried in the service data packet is in the preset white list, the service data packet is parsed to obtain the service data of the second device.

[0037] In this application, before the first device reports the service data to the server, it needs to determine whether the service data in the service data packet is the service data subscribed by itself. Only when it is determined that the service identifier carried in the service data packet is in the preset whitelist will the service data packet be processed.

[0038] Optionally, before reporting the service data to the server, the method further includes:

[0039] The business data is verified.

[0040] Before uploading the business data, the application may also verify the business data to avoid situations where the business data packet format is illegal.

[0041] Optionally, before reporting the service data to the server, the method further includes:

[0042] Determine whether the electronic control firmware consumption data identifier corresponding to the business data is a preset electronic control identifier;

[0043] If the electronic control firmware consumption data identifier corresponding to the business data is the preset electronic control identifier, the business data is processed by the electronic control module in the first device.

[0044] In the present application, electronic control processing can only be performed when the electronic control firmware consumption data identifier corresponding to the business data is a preset electronic control identifier, so that the first device can both synchronize the business data to the server and use the business data for consumption processing.

[0045] Optionally, the service data packet carries power information of the second device;

[0046] The method further comprises:

[0047] The power information is reported to the server so that the server performs corresponding service processing according to the power information.

[0048] The service data packet received in the present application may also include the power level of the second device, so as to realize synchronization and prompt of power level information.

[0049] The present application provides a data synchronization method, which is applied to a second device and includes:

[0050] receiving a data request broadcast sent by a first device, wherein the data request broadcast carries a unique device identifier and a service identifier, and the service identifier is used to identify each service data;

[0051] Determine whether the unique device identifier carried in the data request broadcast is the unique device identifier of the second device, and whether the service identifier carried in the data request broadcast is in the service identifier list of the second device;

[0052] If the unique device identifier carried by the data request broadcast is the unique device identifier of the second device and the service identifier carried by the data request broadcast is in the service identifier list of the second device, determining the service data corresponding to the service identifier carried by the data request broadcast, and generating a service data packet including the service data;

[0053] The service data packet is broadcasted so that the first device synchronizes the service data to the server after receiving the service data packet.

[0054] In the present application, the second device automatically responds to the data request broadcast according to the received data request broadcast, and synchronizes the corresponding business data without the need for user participation. The entire synchronization process is imperceptible to the user, thereby improving the user experience.

[0055] Optionally, determining the service data corresponding to the service identifier carried in the data request broadcast, and generating a service data packet including the service data, includes:

[0056] Reading a designated storage space of the second device to determine whether the designated storage space stores service data corresponding to the service identifier;

[0057] If so, obtain the business data corresponding to the business identifier stored in the designated storage space, and generate a business data packet including the business data.

[0058] Before determining the service data packet, the present application determines whether there is corresponding service data in the storage space to avoid broadcasting empty packets and causing waste of resources.

[0059] Optionally, broadcasting and sending the service data packet includes:

[0060] If the data volume corresponding to the service data packet exceeds the preset data volume, the service data packet is sub-packetized to obtain sub-service data packets;

[0061] The sub-service data packets are broadcast and sent.

[0062] When the service data packet is too large, the application performs packet processing to ensure the efficiency and reliability of the broadcast transmission of the service data packet.

[0063] Optionally, the method further comprises:

[0064] After the service data packet is broadcasted, the service data corresponding to the service identifier stored in the designated storage space is cleared.

[0065] In the present application, after the synchronization of the business data is completed, the business data stored in the storage space can be cleared to store the subsequently generated business data, thereby avoiding the same business data from being sent repeatedly.

[0066] The present application provides a computer-readable storage medium, wherein the storage medium stores a computer program, and when the computer program is executed by a processor, the above-mentioned data synchronization method is implemented.

[0067] The present application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned data synchronization method when executing the program.

[0068] At least one of the above technical solutions adopted in this application can achieve the following beneficial effects:

[0069] In the data synchronization method provided by the present application, Bluetooth devices within a preset range are searched to obtain a Bluetooth device list, and it is determined whether there is a Bluetooth device in the Bluetooth device list that has subscribed to its broadcast. If so, the Bluetooth device in the Bluetooth device list that has subscribed to its broadcast is used as the second device. Then, a data request broadcast is sent to the second device, and a service data packet returned by the second device in response to the data request broadcast is received, the service data packet carries the service data of the second device, and the service data is reported to the server side, thereby realizing automatic synchronization of data on the server side.

[0070] It can be seen from the above method that in the present application, when the second device appears within the preset range of the first device, the first device can actively broadcast a data request to synchronize the business data in the second device. In this process, the first device and the second device can complete data synchronization without the participation of the user, which simplifies the data synchronization process and makes the entire synchronization process imperceptible to the user, thereby improving the user experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0071] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the specification of the present application. The illustrative embodiments and descriptions of the specification of the present application are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0072] Figure 1 A flowchart of a data synchronization method provided by this application;

[0073] Figure 2 A schematic diagram of a storage format of a preset whitelist is provided for this application;

[0074] Figure 3 A schematic diagram of a storage format of a preset whitelist is provided for this application;

[0075] Figure 4 A timing diagram of data synchronization provided for this application;

[0076] Figure 5 A flowchart of a data synchronization method provided by this application;

[0077] Figure 6 A schematic diagram of a data synchronization device provided by the present application;

[0078] Figure 7 A schematic diagram of a data synchronization device provided by the present application;

[0079] Figure 8 A method corresponding to the present application Figure 1 or Figure 5 Schematic diagram of electronic equipment. DETAILED DESCRIPTION

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

[0081] With the development of technology, when current users obtain business data of Bluetooth devices, they generally install application software for Bluetooth devices in the terminal device in advance, and then wait for the Bluetooth device to be connected before data synchronization can be performed. The process is rather cumbersome and does not provide a seamless experience.

[0082] Based on this, the present application provides a data synchronization method, which searches for Bluetooth devices within a preset range, obtains a Bluetooth device list, determines whether there is a Bluetooth device in the Bluetooth device list that has subscribed to its broadcast, and if so, uses the Bluetooth device in the Bluetooth device list that has subscribed to its broadcast as the second device. Then, a data request broadcast is sent to the second device, and a service data packet returned by the second device in response to the data request broadcast is received. The service data carried in the service data packet is reported to the server side to synchronize the service data to the server side. After receiving the service data, the server side can perform corresponding service processing or storage according to the service data. The first device in the present application actively requests to obtain the data of the second device to realize automatic data synchronization, and does not require the user to manually operate the application software for data synchronization, which simplifies the data synchronization process, and the entire synchronization process is imperceptible to the user, thereby improving the user experience.

[0083] The technical solutions provided by various embodiments of the present application are described in detail below in conjunction with the accompanying drawings.

[0084] Figure 1 A schematic diagram of a data synchronization method provided in the present application, the method is applied to a first device, and includes the following steps:

[0085] S101: Searching for Bluetooth devices within a preset range to obtain a Bluetooth device list.

[0086] The first device may include a WiFi module and a Bluetooth module, wherein the WiFi module may be used for data transmission between the first device and the server, and the Bluetooth module may be used for data transmission between the first device and the second device. Of course, the data transmission between the first device and the second device is not limited to Bluetooth transmission, but may also be WiFi transmission.

[0087] The first device searches for Bluetooth devices within a preset range through a Bluetooth module at a set frequency to obtain a Bluetooth device list, wherein the Bluetooth device list is used to store unique device identifiers of the Bluetooth devices within the preset range that are searched.

[0088] S102: Determine whether there is a Bluetooth device in the Bluetooth device list that has subscribed to its broadcast, and if so, use the Bluetooth device in the Bluetooth device list that has subscribed to its broadcast as the second device.

[0089] The first device determines whether the broadcast of the Bluetooth device in the Bluetooth device list has been subscribed by the first device, and if there is a Bluetooth device that has subscribed to its broadcast, it is used as the second device. That is, when the device whose broadcast the first device has subscribed to appears within the preset range of the first device, the first device can actively send a data request to synchronize data with the second device.

[0090] It should be noted that the second device here does not refer to a specific device, and there may be more than one device. For any device, as long as its broadcast has been subscribed by the first device and appears within the preset range of the first device, it can be regarded as a second device. Therefore, the first device can send data requests to multiple second devices at the same time to request the second devices to synchronize data.

[0091] The second device can be an IOT device such as a smart kitchen appliance or smart home appliance with Bluetooth function. The second device is not specifically limited here. In this embodiment, the second device mainly refers to other devices with Bluetooth function except the first device. Any first device or second device can send and receive Bluetooth broadcasts. The device that actively sends data request broadcasts and can implement data reporting can be understood as the above-mentioned first device. Correspondingly, the device that responds to the data request broadcast and returns the service data packet can be understood as the above-mentioned second device. Equal interaction is achieved between the first device and the second device through broadcasting.

[0092] S103: Send a data request broadcast to the second device.

[0093] When there is a Bluetooth device that has subscribed to its broadcast in the Bluetooth device list obtained by the first device according to the set frequency, it is regarded as the second device, and a data request broadcast is sent to the second device.

[0094] In order to avoid wasting the power of the first device by repeatedly and frequently broadcasting data requests, in the present application, after determining that it has subscribed to the broadcast of a second device and before sending a data request broadcast to the second device, the first device needs to first determine whether the time since the last time it received a service data packet returned by the second device is not less than a preset time. That is, the first device needs to first determine whether the time since the last time it received a service data packet returned by the second device is greater than or equal to the preset time. If so, send a data request broadcast to the second device.

[0095] For determining whether the broadcast of each Bluetooth device in the Bluetooth device list has been subscribed by the first device, the present application provides a preset whitelist, which stores the unique device identifiers of the devices whose broadcasts the first device has subscribed to. Specifically, the first device obtains the preset whitelist, and then, for each Bluetooth device in the Bluetooth device list, determines whether the unique device identifier of the Bluetooth device matches the unique device identifier in the preset whitelist, and if so, determines that the broadcast of the Bluetooth device has been subscribed. Furthermore, the first device can use the Bluetooth device as a second device and generate a data request broadcast for the second device.

[0096] When generating a data request broadcast, the first device will also obtain the service identifier of the second device, where the service identifier is used to identify each service data (that is, the service identifier can be used to know what service data the first device can obtain from the second device). Then, the first device generates a data request broadcast for the second device based on the service identifier of the second device.

[0097] It should be noted that the service identifier corresponding to the service data that the first device needs to obtain from the second device can be stored in a separate table or in a preset whitelist. In practical applications, it is sometimes necessary to use the unique device identifier and the corresponding service identifier of the Bluetooth device at the same time. In order to reduce the consumption of storage resources, the unique device identifier and the corresponding service identifier of the Bluetooth device can be stored in a preset whitelist. The preset whitelist stores both the unique device identifier of the device to which the first device has subscribed to broadcast and the service identifier of the device to which the first device has subscribed to broadcast, such as Figure 2 shown.

[0098] Figure 2 A schematic diagram of a storage format of a preset whitelist is provided for this application.

[0099] from Figure 2 It can be seen that the first row of the table is the table header, the data stored in the first column is the unique device identifier of the second device that has subscribed to its broadcast (such as MAC1, MAC2), and the data stored in the second column is the service identifier of the second device that has subscribed to its broadcast (such as Topic1, Topic2).

[0100] In actual applications, there can be multiple first devices and multiple second devices. When multiple first devices send data request broadcasts, each data request broadcast carries a unique device identifier of the target second device. This is to enable multiple second devices to receive the data request broadcast and determine whether to reply to the business data based on the unique device identifier in the data request broadcast.

[0101] For example, for a data synchronization scenario, the first devices are device A and device B, and the second devices are device C and device D. Device A wants to obtain the business data of device C (device A has subscribed to the broadcast of device C), and device B wants to obtain the business data of device D (device B has subscribed to the broadcast of device D). When device A broadcasts a data request broadcast A (carrying the unique device identifier of device C) and device B broadcasts a data request broadcast B (carrying the unique device identifier of device D), at this time, although device C and device D can both receive data request broadcast A and data request broadcast B, device C and device D can determine whether the unique device identifier carried in the data request broadcast matches their own unique device identifier, and then decide whether to broadcast a reply to the data request broadcast.

[0102] Furthermore, when the second device determines that it is itself that is making the reply, it determines the service data corresponding to the data request, generates a service data packet, and broadcasts the service data packet.

[0103] Of course, in order to obtain more accurate business data, rather than directly requesting all the business data in the second device, the first device may also carry the business identifier of the second device in the data request broadcast broadcasted by the first device. Continuing with the above example, when device A broadcasts a data request broadcast A (carrying the unique device identifier of device C and the business identifier of device C), at this time, when device C receives the data request broadcast A, it first determines whether the unique device identifier in the data request broadcast A is the unique device identifier of device C. If so, it then determines whether the business identifier carried in the data request broadcast A is in the business identifier list of device C. If so, it obtains the corresponding business data according to the business identifier carried in the data request broadcast A to generate a business data packet, and broadcasts the business data packet.

[0104] S104: Receive a service data packet broadcasted back by the second device in response to the data request, where the service data packet carries service data of the second device.

[0105] The second device broadcasts a service data packet carrying corresponding service data, and the first device receives the service data packet broadcasted by the second device.

[0106] In actual scenarios, the first device can not only receive the service data packets broadcasted by the second device, but also receive service data packets broadcasted by other devices. However, these service data packets are not necessarily all needed by the first device. Therefore, the service data packet can carry the unique device identifier of the device that broadcasts the service data packet. The first device determines whether the unique device identifier in the service data packet is the unique device identifier of the device that has been subscribed to the broadcast by the first device (that is, whether the unique device identifier in the service data packet is in the preset whitelist). If so, the first device can perform the next step of processing on the corresponding service data packet.

[0107] When the service data packet also carries the service identifier corresponding to the second device and the service data corresponding to the service identifier, the first device needs to determine whether it is the service data it needs based on the service identifier in the service data packet (that is, if the service identifier corresponding to the service data required by the first device is stored in the preset whitelist, determine whether the service identifier carried in the service data packet is in the preset whitelist). If so, the first device can proceed to the next step of processing the service data packet.

[0108] S105: Report the service data to the server.

[0109] In some embodiments, the service data packet may be parsed first to obtain the service data of the second device, and then the service data may be uploaded to the server to realize the seamless synchronization of the data of the second device to the server. The server provides data storage and processing services. In a specific embodiment, the server is a cloud platform.

[0110] The first device parses the received service data packet to obtain service data of the second device that is broadcast in reply to the data request.

[0111] Then, before uploading the business data of the second device to the server, in order to avoid errors when the server processes the business data, the first device can also verify the business data first, such as: whether the business data is complete, whether the data format of the business data is legal, etc. After verification, the business data is reported to the server so that the server can process the business data.

[0112] Of course, sometimes the business data packet is large. The second device will sub-packetize the business data packet before broadcasting it to obtain sub-business data packets. After receiving the sub-business data packets, the first device needs to assemble the sub-business data packets to obtain a complete business data packet.

[0113] The first device can report the business data to the server through the WiFi module, so that the server performs corresponding business processing or storage according to the business data. For example, the server can store the business data; for another example, the server can send the business data to the corresponding client, and enable the client to perform corresponding business processing according to the business data, or the server can analyze the received business data and send the analysis results to the corresponding client, and the user can view the analysis results through the client.

[0114] For example, in an actual scenario, the first device is a smart water dispenser and the second device is a smart water cup. When the user's child comes home from school, the smart water cup used by the user's child enters the communication range of the smart water dispenser, and the smart water dispenser can automatically synchronize the drinking data of the smart water cup to the server of the smart water dispenser. The server can generate a drinking analysis report based on the drinking data and push it to the user, and the user can check the child's drinking situation through the server even if he is not at home. In some application scenarios, the server can also remind the child to drink water based on the drinking data through the application software corresponding to the smart water dispenser.

[0115] It should be noted that in actual applications, before reporting the business data to the server, the first device can also determine whether the electric control firmware consumption data identifier corresponding to the business data is a preset electric control identifier. If the electric control firmware consumption data identifier corresponding to the business data is a preset electric control identifier, the business data is pushed to the electric control module of the first device so that the electric control module processes the business data. The first device receives and processes the business data broadcast by the second device, which can expand the functions and application scenarios of the first device and improve data utilization.

[0116] The service data packet returned by the second device may also carry the power information of the second device. When the first device receives the service data packet, it parses the service data packet to obtain the service data and power information of the second device, and reports the service data and power information to the server. For example, when the server obtains the power information of the second device, if it finds that the power of the second device is lower than the preset power, the server can remind the user to charge the second device or replace the battery in time through the corresponding client.

[0117] The preset whitelist in the present application may also store a preset time, which is the preset minimum time interval for each time the first device receives a business data packet sent by the second device. The first device sends a data request broadcast to the second device only when the time from the last time the first device received a business data packet sent by the second device is greater than or equal to the preset time, and stores an electronic control firmware consumption data identifier corresponding to the business data (the electronic control firmware consumption data identifier indicates whether the first device processes the business data corresponding to the business identifier). If the first device is required to consume the business data corresponding to the business identifier, the corresponding electronic control firmware consumption data identifier is the preset electronic control identifier; if the first device is not required to consume the business data corresponding to the business identifier, the corresponding electronic control firmware consumption data identifier is not the preset electronic control identifier, such as Figure 3 shown.

[0118] Figure 3 A schematic diagram of a storage format of a preset whitelist is provided for this application.

[0119] from Figure 3 As can be seen from the above, the preset whitelist can store the unique device identifiers of the devices whose broadcasts the first device has subscribed to and the corresponding service identifiers, and can also store the preset minimum time interval (i.e., the minimum time interval for the first device to receive each service data packet returned by each device that has subscribed to its broadcast) Figure 3 to determine whether to send a data request broadcast according to the preset time. Figure 3 The electronic control firmware consumption data identifier in the service data packet refers to whether the first device needs to perform local consumption processing on the service data in the service data packet. The preset electronic control identifier is 1. If the first device needs to perform local consumption processing, the corresponding electronic control firmware consumption data identifier is 1 (such as Figure 3 ), that is, the electronic control firmware consumption data identifier corresponding to the business data is a preset electronic control identifier, then the first device needs to push the business data to its own electronic control module so that the electronic control module performs local consumption processing on the business data; if no processing is required, the corresponding electronic control firmware consumption data identifier is 0 (such as Figure 3 ), that is, the electronic control firmware consumption data identifier corresponding to the business data is not the preset electronic control identifier, then the business data will not be pushed to the electronic control module.

[0120] Next, this application will use a complete example to explain in detail the implementation process of the method in this application, such as Figure 4 shown.

[0121] Figure 4 A timing diagram of data synchronization provided for this application.

[0122] from Figure 4It can be seen that the first device includes: a Bluetooth module, a WiFi module and an electronic control module. The first device searches for Bluetooth devices through the Bluetooth module to obtain a list of Bluetooth devices. Then, for each Bluetooth device in the Bluetooth device list, it is determined whether the broadcast of the Bluetooth device has been subscribed. If so, the Bluetooth device is used as the second device. It is further determined whether the time from the last time the first device received a service data packet returned by the second device is greater than a preset time. If so, a data request broadcast is sent, wherein the data request broadcast carries a unique device identifier and a service identifier.

[0123] Furthermore, the second device has cached and accumulated business data for a period of time since the last time it sent a business data packet, and receives a data request broadcast sent by the first device. At this time, the second device can determine whether the unique device identifier carried in the data request broadcast is the second device's own unique device identifier, and determine whether the business identifier in the data request broadcast is in the second device's own business identifier list. If so, further determine whether the cache of business data corresponding to the business identifier is empty. If not empty, obtain the business data, and generate a business data packet for broadcast.

[0124] When the first device receives a service data packet, it first determines whether the unique device identifier and service identifier in the service data packet are in the preset whitelist. If they are in the preset whitelist, it determines whether the service data in the service data packet needs to be processed locally based on the electronic control firmware consumption data identifier corresponding to the service identifier (i.e. the electronic control firmware consumption data identifier corresponding to the above service data). If so, the service data is pushed to the electronic control module through the serial port so that the electronic control module processes the service data accordingly. The service data is then reported to the cloud platform in the preset data format.

[0125] In the present application, the first device can actively search for Bluetooth devices within a preset range, and send a data request broadcast to the second device to obtain the business data of the second device, and report the business data to the server. During this process, no user participation is required. The first device and the second device can automatically complete data synchronization. The entire data synchronization process is imperceptible to the user, has a high degree of intelligence, and provides a good user experience.

[0126] When a device that has subscribed to its broadcast appears within the communication range of the first device, the first device can send a data request broadcast to the device instead of blindly sending a broadcast. This not only saves the power of the first device, but also avoids occupying resource space for unnecessary communication.

[0127] This specification also provides a preset whitelist. The first device can store the unique device identifiers of devices that have subscribed to its broadcast in the preset whitelist, and can also store the service identifiers of devices that have subscribed to its broadcast in the preset whitelist to generate a more accurate data request broadcast based on the preset whitelist.

[0128] The first device receives the service data packet and determines whether the unique device identifier carried in the service data packet is in the preset whitelist, and whether the service identifier carried in the service data packet is in the preset whitelist. If both are in the whitelist, the service data packet is further processed.

[0129] Furthermore, the first device may verify the business data in the business data before uploading it to the server, so as to avoid incomplete business data, format errors, etc. caused by abnormal situations.

[0130] Based on the above data synchronization method applied to the first device, Figure 5 A schematic diagram of a data synchronization method provided in the present application, the method is applied to a second device, and includes the following steps:

[0131] S501: Receive a data request broadcast sent by a first device, where the data request broadcast carries a unique device identifier and a service identifier, and the service identifier is used to identify each service data.

[0132] The second device includes a Bluetooth module, and the second device receives the data request broadcast and broadcast data sent by the first device through the Bluetooth module. Of course, the second device can also communicate with the first device through WiFi communication. The first device can be any device with WiFi function and Bluetooth function, such as a smart terminal such as a mobile phone, a tablet, or an IOT device such as a smart home appliance, a smart kitchen appliance, etc.

[0133] The data request broadcast carries a unique device identifier and a service identifier. The service identifier is used to identify each service data.

[0134] S502: Determine whether the unique device identifier carried in the data request broadcast is the unique device identifier of the second device, and whether the service identifier carried in the data request broadcast is in the service identifier list of the second device.

[0135] Specifically, when the data request broadcast carries a unique device identifier and a service identifier, first, determine whether the unique device identifier carried in the data request broadcast matches the unique device identifier of the second device itself. If the unique device identifier carried in the data request broadcast matches the unique device identifier of the second device itself, it can be further determined whether the service identifier carried in the data request broadcast is in the service identifier list of the second device. If the unique device identifier carried in the data request broadcast does not match the unique device identifier of the second device, no reply is made to the data request broadcast. In other words, if the second device determines that the data request broadcast sent by the first device is for itself, it replies with service data, otherwise it does not process the data request broadcast, thereby avoiding wasting communication resources and ensuring the security of data interaction.

[0136] Further, the second device determines whether the service identifier carried by the data request broadcast is in the service identifier list of the second device itself, and if the service identifier carried by the data request broadcast is in the service identifier list of the second device itself, determines and obtains the corresponding service data. If the service identifier carried by the data request broadcast is not in the service identifier list of the second device, no reply is made to the data request broadcast.

[0137] S503: If the unique device identifier carried by the data request broadcast is the unique device identifier of the second device and the service identifier carried by the data request broadcast is in the service identifier list of the second device, determine the service data corresponding to the service identifier carried by the data request broadcast, and generate a service data packet including the service data.

[0138] If the unique device identifier carried by the data request broadcast is the second device's own unique device identifier and the service identifier carried by the data request broadcast is in the second device's own service identifier list, the second device can further determine whether it has service data corresponding to the service identifier. If so, the second device can broadcast the service data.

[0139] Specifically, the designated storage space of the second device is read to determine whether the designated storage space stores service data corresponding to the service identifier, and when the designated storage space stores service data corresponding to the service identifier, the service data corresponding to the service identifier stored in the designated storage space is obtained, and a service data packet including the service data is generated. If the designated storage space does not store service data corresponding to the service identifier, no reply is made to the data request broadcast.

[0140] It can be seen that there can be three judgment conditions before determining the service data packet corresponding to the data request broadcast. The first judgment condition is to determine whether the unique device identifier carried by the data request broadcast matches the unique device identifier of the second device itself, the second judgment condition is to determine whether the service identifier carried by the data request broadcast is in the service identifier list of the second device itself, and the third judgment condition is to determine whether the service data corresponding to the service identifier is stored in the specified storage space. In actual applications, only the first judgment condition can be used to determine whether to reply to the data request broadcast, or only the second judgment condition can be used to determine whether to reply to the data request broadcast, or the second and third judgment conditions can be used at the same time, or all three judgment conditions can be used at the same time. Different usage methods can be adopted in different situations.

[0141] It should be noted that in order to avoid the second device from repeatedly broadcasting the same business data, after the second device broadcasts the business data packet, the second device can clear the broadcasted business data in the designated storage space, thereby avoiding a large amount of cached data occupying the memory resources of the second device.

[0142] When broadcasting a service data packet, the second device can also carry the power level of the second device to inform the first device of the power level of the second device. In this way, the first device can also remind the user to charge the second device or replace its battery in time.

[0143] S504: Broadcast the service data packet, so that the first device synchronizes the service data to the server after receiving the service data packet.

[0144] The second device broadcasts the service data packet through the Bluetooth module. At this time, the service data packet may include the unique device identifier of the second device, the service identifier of the second device, and the service data corresponding to the service identifier, so that after the first device receives the service data packet, it can report the obtained service data to the server. The specific process has been described in the above content and will not be repeated here. The second device only broadcasts service data externally when it receives a data request broadcast, so that the service data can be effectively synchronized to the first device and the server. Compared with spontaneous and active data broadcasting, on the one hand, it can avoid blindly broadcasting data without receiving the device and causing invalid data interaction, and on the other hand, on-demand broadcasting can save more energy. Before the second device broadcasts and sends the service data packet, if the data volume corresponding to the service data packet exceeds the preset data volume, the service data packet can be sub-packetized to obtain each sub-service data packet, and each sub-service data packet is broadcast and sent.

[0145] In the present application, when the second device receives a data request broadcast, it needs to first determine whether the unique device identifier carried by the data request broadcast is the unique device identifier of the second device, and also needs to determine whether the service identifier carried by the data request broadcast is in its own service identifier list. If so, it can generate a service data packet and broadcast it. In this way, the second device only needs to reply to its own data request broadcast, avoiding the waste of communication resources caused by blindly replying to the data request broadcast.

[0146] Furthermore, the service data packet can be determined only when the cache of the service data corresponding to the service identifier is not empty, so that the waste of resources caused by sending empty packets is avoided.

[0147] When the service data packet is too large, the second device may perform packet processing on the service data packet and broadcast the data packet in the form of packets.

[0148] The above are one or more data synchronization methods of the present application. Based on the same idea, the present application also provides a corresponding data synchronization device, such as Figure 6 , Figure 7 shown.

[0149] Figure 6 A schematic diagram of a data synchronization device provided in this application includes:

[0150] A search module 601 is used to search for Bluetooth devices within a preset range and obtain a list of Bluetooth devices;

[0151] A determination module 602 is used to determine whether there is a Bluetooth device in the Bluetooth device list that has subscribed to its broadcast, and if so, use the Bluetooth device in the Bluetooth device list that has subscribed to its broadcast as the second device;

[0152] A sending module 603, configured to send a data request broadcast to the second device;

[0153] A receiving module 604 is configured to receive a service data packet broadcasted back by the second device in response to the data request, wherein the service data packet carries service data of the second device;

[0154] The reporting module 605 is used to report the business data to the server.

[0155] Figure 7 A schematic diagram of a data synchronization device provided in this application includes:

[0156] A receiving module 701 is configured to receive a data request broadcast sent by a first device, wherein the data request broadcast carries a unique device identifier and a service identifier, and the service identifier is used to identify each service data;

[0157] A judgment module 702 is used to judge whether the unique device identifier carried by the data request broadcast is the unique device identifier of the second device, and whether the service identifier carried by the data request broadcast is in the service identifier list of the second device;

[0158] A determination module 703 is configured to determine the service data corresponding to the service identifier carried by the data request broadcast if the unique device identifier carried by the data request broadcast is the unique device identifier of the second device and the service identifier carried by the data request broadcast is in the service identifier list of the second device, and generate a service data packet including the service data;

[0159] The broadcast module 704 is used to broadcast and send the service data packet, so that after the first device receives the service data packet, it synchronizes the service data to the server.

[0160] The present application also provides a computer-readable storage medium, which stores a computer program, which can be used to execute the above Figure 1 or Figure 5 Provides a data synchronization method.

[0161] This application also provides Figure 8 The one shown corresponds to Figure 1 or Figure 5 A schematic diagram of the electronic device. Figure 8 As mentioned above, at the hardware level, the electronic device includes a processor, an internal bus, a network interface, a memory, and a non-volatile memory, and may also include other hardware required for the business. The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it to achieve the above Figure 1 or Figure 5 Of course, in addition to the software implementation, this application does not exclude other implementations, such as logic devices or a combination of software and hardware, etc., that is, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.

[0162] In the 1990s, improvements to a technology could be clearly distinguished as hardware improvements (for example, improvements to the circuit structure of diodes, transistors, switches, etc.) or software improvements (improvements to the method flow). However, with the development of technology, many improvements to the method flow today can be regarded as direct improvements to the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that an improvement in a method flow cannot be implemented using a hardware entity module. For example, a programmable logic device (PLD) (such as a field programmable gate array (FPGA)) is such an integrated circuit whose logical function is determined by the user's programming of the device. Designers can "integrate" a digital system on a PLD by programming it themselves, without having to ask a chip manufacturer to design and produce a dedicated integrated circuit chip. Moreover, nowadays, instead of manually making integrated circuit chips, this kind of programming is mostly implemented by "logic compiler" software, which is similar to the software compiler used when developing and writing programs, and the original code before compilation must also be written in a specific programming language, which is called hardware description language (HDL). There is not only one HDL, but many kinds, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones are VHDL (Very-High-Speed ​​Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also know that it is only necessary to program the method flow slightly in the above-mentioned hardware description languages ​​and program it into the integrated circuit, and then it is easy to obtain the hardware circuit that implements the logic method flow.

[0163] The controller can be implemented in any appropriate manner, for example, the controller can take the form of a microprocessor or processor and a computer-readable medium storing a computer-readable program code (such as software or firmware) that can be executed by the (micro)processor, a logic gate, a switch, an application-specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320. The memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art also know that in addition to implementing the controller in a purely computer-readable program code manner, the controller can be implemented in the form of a logic gate, a switch, an application-specific integrated circuit, a programmable logic controller, and an embedded microcontroller by logically programming the method steps. Therefore, this controller can be considered as a hardware component, and the devices included therein for implementing various functions can also be regarded as structures within the hardware component. Or even, the devices for implementing various functions can be regarded as both software modules for implementing the method and structures within the hardware component.

[0164] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.

[0165] For the convenience of description, the above device is described in various units according to their functions. Of course, when implementing the present application, the functions of each unit can be implemented in the same or multiple software and / or hardware.

[0166] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.

[0167] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0168] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0169] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0170] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0171] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0172] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0173] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0174] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.

[0175] The present application may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.

[0176] Each embodiment in this application is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0177] The above is only an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims

1. A data synchronization method, characterized in that: The method is applied to a first device, comprising: Search for Bluetooth devices within the preset range and obtain a list of Bluetooth devices; Determine whether there is a Bluetooth device in the Bluetooth device list that has subscribed to its broadcast, and if so, use the Bluetooth device in the Bluetooth device list that has subscribed to its broadcast as the second device; Sending a data request broadcast to the second device; receiving a service data packet broadcasted and returned by the second device in response to the data request, wherein the service data packet carries service data of the second device; The business data is reported to the server.

2. The method according to claim 1, characterized in that Before sending the data request broadcast for the second device, the method further includes: Determine whether the time from the last receipt of the service data packet returned by the second device is not less than a preset time; Sending a data request broadcast to the second device includes: If the time from the last receipt of the service data packet returned by the second device to the preset time is not less than the preset time, a data request broadcast is sent to the second device.

3. The method according to claim 1, characterized in that Determining whether there is a Bluetooth device in the Bluetooth device list that has subscribed to its broadcast includes: Obtaining a preset whitelist, the preset whitelist including unique device identifiers of Bluetooth devices that have subscribed to its broadcast; For each Bluetooth device in the Bluetooth device list, determining whether the unique device identifier of the Bluetooth device matches the unique device identifier in the preset whitelist; If so, it is determined that the broadcast of the Bluetooth device has been subscribed.

4. The method according to claim 1, characterized in that Before sending the data request broadcast for the second device, the method further includes: Acquire a service identifier of the second device, where the service identifier is used to identify each service data; A data request broadcast for the second device is generated according to the service identifier of the second device.

5. The method according to claim 3, characterized in that The service data packet carries a unique device identifier of the second device; Before reporting the service data to the server, the method further includes: Determining whether the unique device identifier of the second device carried in the service data packet is in the preset whitelist; If it is determined that the unique device identifier of the second device carried in the service data packet is in the preset whitelist, the service data packet is parsed to obtain the service data of the second device.

6. The method according to claim 3 or 5, characterized in that The service data packet carries the service identifier of the second device and the service data corresponding to the service identifier. The preset whitelist also includes the service identifiers of the Bluetooth devices that have subscribed to its broadcast, and the service identifier is used to identify each service data; Before reporting the service data to the server, the method further includes: Determine whether the service identifier carried in the service data packet is in the preset whitelist; If the service identifier carried in the service data packet is in the preset white list, the service data packet is parsed to obtain the service data of the second device.

7. The method according to claim 1, characterized in that Before reporting the service data to the server, the method further includes: The business data is verified.

8. The method according to claim 1, characterized in that Before reporting the service data to the server, the method further includes: Determine whether the electronic control firmware consumption data identifier corresponding to the business data is a preset electronic control identifier; If the electronic control firmware consumption data identifier corresponding to the business data is the preset electronic control identifier, the business data is processed by the electronic control module in the first device.

9. The method according to claim 1, characterized in that The service data packet carries power information of the second device; The method further comprises: The power information is reported to the server so that the server performs corresponding service processing according to the power information.

10. A data synchronization method, characterized in that: The method is applied to a second device, comprising: receiving a data request broadcast sent by a first device, wherein the data request broadcast carries a unique device identifier and a service identifier, and the service identifier is used to identify each service data; Determine whether the unique device identifier carried in the data request broadcast is the unique device identifier of the second device, and whether the service identifier carried in the data request broadcast is in the service identifier list of the second device; If the unique device identifier carried by the data request broadcast is the unique device identifier of the second device and the service identifier carried by the data request broadcast is in the service identifier list of the second device, determining the service data corresponding to the service identifier carried by the data request broadcast, and generating a service data packet including the service data; The service data packet is broadcasted so that the first device synchronizes the service data to the server after receiving the service data packet.

11. The method according to claim 10, characterized in that Determining the service data corresponding to the service identifier carried by the data request broadcast, and generating a service data packet including the service data, including: Reading a designated storage space of the second device to determine whether the designated storage space stores service data corresponding to the service identifier; If so, obtain the business data corresponding to the business identifier stored in the designated storage space, and generate a business data packet including the business data.

12. The method according to claim 10, characterized in that Broadcasting and sending the service data packet includes: If the data volume corresponding to the service data packet exceeds the preset data volume, the service data packet is sub-packetized to obtain sub-service data packets; The sub-service data packets are broadcast and sent.

13. The method according to claim 11, characterized in that The method further comprises: After the service data packet is broadcasted, the service data corresponding to the service identifier stored in the designated storage space is cleared.

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

15. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the method according to any one of claims 1 to 13 is implemented.