Data synchronization method, system and device, electronic equipment and readable storage medium
By implementing data synchronization methods in the Internet of Things system, through dual write operations on the cloud and device side, the problem of data inconsistency between terminal applications, cloud and device side is solved, and data consistency and synchronization status are updated.
Patent Information
- Application Number
- CN202411937357.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-26
- Publication Date
- 2025-03-21
AI Technical Summary
In the field of the Internet of Things, how to effectively ensure the data consistency of terminal applications, cloud and device, and avoid the problem of inconsistency between different endpoints.
Through a data synchronization method, when receiving scene data sent by the user terminal, it is sent to the cloud to perform cloud write operations, and the cloud data state is set to the unsynchronized state. After the cloud write is successful, the data is sent to the device side to perform the device write operation, and the cloud data status is updated to the synchronous state when the device writes successfully.
The consistency of terminal applications, cloud and device data is achieved. User terminals can determine whether the data is consistent based on the cloud data state, avoiding the inconsistency between different endpoints.
Smart Images

Figure CN119676253A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of Internet of Things, and in particular to a data synchronization method, and also to a data synchronization system, device, electronic device and computer-readable storage medium. Background Art
[0002] In the field of IoT, there is often a need to write some data to the device side through APP (terminal application), and at the same time, this data must be stored in the cloud for display on the APP side and the cloud side, such as: local scene information, configuration attribute information of multi-function devices, etc. This requires a method to ensure that the data on the APP side, the cloud side, and the device side are consistent, so that there will not be a situation where a certain configuration exists on the APP or cloud side but is not effective on the device side, or the configuration has been effective on the device side but is not found on the APP or cloud side.
[0003] Therefore, how to effectively ensure data consistency among terminal applications, the cloud, and device ends is an urgent problem to be solved by those skilled in the art. Summary of the invention
[0004] The purpose of this application is to provide a data synchronization method, which can effectively ensure the data consistency of terminal applications, cloud and device ends; another purpose of this application is to provide a data synchronization system, device, electronic device and computer-readable storage medium, all of which have the above-mentioned beneficial effects.
[0005] In a first aspect, the present application discloses a data synchronization method, which is applied to a terminal application, comprising:
[0006] When receiving the scene data sent by the user terminal, the scene data is sent to the cloud to perform a cloud write operation, so that the cloud sets the cloud data state to an unsynchronized state;
[0007] When the cloud write operation is successfully executed, the scene data is sent to the device end to execute the device write operation;
[0008] When the device write operation is successfully executed, a device write success message is sent to the cloud, so that the cloud changes the cloud data state from the unsynchronized state to the synchronized state;
[0009] When a status check instruction sent by the user terminal is received, the cloud data status is obtained from the cloud and fed back to the user terminal.
[0010] Optionally, when the cloud write operation is successfully executed, the scene data is sent to the device end to execute the device write operation, including:
[0011] When the cloud writing operation is successfully executed, a cloud writing success message is sent to the user terminal;
[0012] Receiving a device write instruction initiated by the user terminal based on the cloud write success message;
[0013] The scene data is sent to the device end according to the device write instruction to perform the device write operation.
[0014] Optionally, the data synchronization method further includes:
[0015] When the cloud write operation fails to execute or the device write operation fails to execute, a retry prompt is sent to the user terminal.
[0016] Optionally, the data synchronization method further includes:
[0017] Counting the number of times the retry prompt is sent;
[0018] When the sending times reaches the preset times, an abnormal prompt is output.
[0019] Optionally, the data synchronization method further includes:
[0020] When receiving a data write success message fed back by the cloud, determining that the cloud write operation is executed successfully;
[0021] When no data writing success message fed back by the cloud is received, it is determined that the cloud writing operation has failed.
[0022] Optionally, the data synchronization method further includes:
[0023] When receiving a data write success message fed back by the device, determining that the device write operation is executed successfully;
[0024] When no data writing success message fed back by the device is received, it is determined that the device writing operation has failed.
[0025] In a second aspect, the present application also discloses a data synchronization system, including a user terminal, a terminal application, a cloud, and a device end;
[0026] The terminal application is used to, when receiving the scene data sent by the user terminal, send the scene data to the cloud to perform a cloud write operation, so that the cloud sets the cloud data status to an unsynchronized state; when the cloud write operation is successfully executed, send the scene data to the device end to perform a device write operation; when the device write operation is successfully executed, send a device write success message to the cloud, so that the cloud changes the cloud data status from the unsynchronized state to the synchronized state; when receiving a status check instruction sent by the user terminal, obtain the cloud data status from the cloud and feed it back to the user terminal.
[0027] In a third aspect, the present application further discloses a data synchronization device, including:
[0028] A first sending module is used for sending the scene data to the cloud to perform a cloud write operation when receiving the scene data sent by the user terminal, so that the cloud sets the cloud data state to an unsynchronized state;
[0029] A second sending module is used to send the scene data to the device end to perform the device write operation when the cloud write operation is successfully executed;
[0030] A third sending module is used to send a device write success message to the cloud when the device write operation is successfully executed, so that the cloud changes the cloud data state from the unsynchronized state to the synchronized state;
[0031] The feedback module is used to obtain the cloud data status from the cloud and feed back to the user terminal when receiving the status viewing instruction sent by the user terminal.
[0032] In a fourth aspect, the present application further discloses an electronic device, comprising:
[0033] Memory for storing computer programs;
[0034] A processor is used to implement the steps of any one of the data synchronization methods described above when executing the computer program.
[0035] In a fifth aspect, the present application further discloses a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of any one of the data synchronization methods described above are implemented.
[0036] The present application provides a data synchronization method, which is applied to terminal applications, including: when receiving scene data sent by a user terminal, sending the scene data to the cloud to perform a cloud write operation, so that the cloud sets the cloud data status to an unsynchronized state; when the cloud write operation is successfully executed, sending the scene data to the device end to perform a device write operation; when the device write operation is successfully executed, sending a device write success message to the cloud, so that the cloud changes the cloud data status from the unsynchronized state to the synchronized state; when receiving a status check instruction sent by the user terminal, obtaining the cloud data status from the cloud and feeding it back to the user terminal.
[0037] Applying the technical solution provided by this application, for the scene data sent by the user terminal, that is, the target data that needs to be written to the cloud and the device side to ensure the data consistency of the terminal application, the cloud, and the device side, first upload it to the cloud to perform the cloud write operation. At this time, the cloud can synchronously set its own data status to an unsynchronized state; further, when the cloud write operation is successfully executed, the scene data will be sent to the device side to perform the device write operation, and when the device write operation is successfully executed, the cloud will be informed to update its own data status to a synchronized state, otherwise the cloud data status will not be processed. Thus, the user terminal can determine whether the cloud and the device side have consistent data according to the cloud data status. Obviously, when the cloud data status is unsynchronized, the cloud and the device side data are inconsistent; when the cloud data status is synchronized, the cloud and the device side data are consistent, thereby effectively ensuring the data consistency of the cloud and the device side from the user's perspective. It can be seen that this technical solution can effectively ensure the data consistency of the terminal application, the cloud, and the device side.
[0038] The data synchronization system, device, electronic device and computer-readable storage medium provided in this application also have the above-mentioned technical effects, which will not be described in detail in this application. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] In order to more clearly illustrate the technical solutions in the prior art and the embodiments of the present application, the drawings required for use in the description of the prior art and the embodiments of the present application are briefly introduced below. Of course, the drawings described below in relation to the embodiments of the present application are only part of the embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without creative work, and the obtained other drawings also belong to the protection scope of the present application.
[0040] Figure 1 A receiving schematic diagram of a data synchronization system provided by the present application;
[0041] Figure 2A flowchart of a data synchronization method provided by this application;
[0042] Figure 3 A timing diagram of a data synchronization method in the prior art;
[0043] Figure 4 A timing diagram of a data synchronization method provided by the present application;
[0044] Figure 5 A user terminal interface provided by this application in a data unsynchronized state;
[0045] Figure 6 A user terminal interface in a data synchronization state provided by this application;
[0046] Figure 7 A schematic diagram of the structure of a data synchronization device provided by the present application;
[0047] Figure 8 A schematic diagram of the structure of an electronic device provided in this application. DETAILED DESCRIPTION
[0048] The core of this application is to provide a data synchronization method, which can effectively ensure the data consistency of terminal applications, cloud and device ends; another core of this application is to provide a data synchronization system, device, electronic device and computer-readable storage medium, all of which have the above-mentioned beneficial effects.
[0049] In order to describe the technical solutions in the embodiments of the present application more clearly and completely, the technical solutions in the embodiments of the present application will be introduced below in conjunction with the drawings in the embodiments of the present application. 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 this field without making creative work are within the scope of protection of this application.
[0050] An embodiment of the present application provides a data synchronization method.
[0051] First, please refer to Figure 1 , Figure 1 This is a structural diagram of a data synchronization system provided in the present application. The data synchronization system includes a user terminal, a terminal application, a cloud side, and a device side. The consistency of data written between the cloud side and the device side is achieved through multi-terminal interaction.
[0052] For further information, please refer to Figure 2 , Figure 2 A data synchronization method is provided in this application. Figure 1The terminal application shown may include the following S101 to S104.
[0053] S101: When scene data sent by a user terminal is received, the scene data is sent to the cloud to perform a cloud write operation, so that the cloud sets the cloud data state to an unsynchronized state.
[0054] This step is intended to achieve the reception and upload of scene data, wherein the scene data is the target data that needs to be written to the cloud and the device side, and the consistency of the target data between the cloud and the device side needs to be ensured, and its specific content may include but is not limited to local scene information, device configuration attribute information, etc. Specifically, the user can input the scene data through the user terminal so that the user terminal sends it to the terminal application, whereby the terminal application can upload the scene data to the cloud to perform a cloud write operation (i.e., an operation of writing the scene data to the cloud); at the same time, the cloud can set its own data status to an unsynchronized state, which is used to indicate that the write data between the cloud and the device side is not synchronized, because the device side has not yet written the data at this time. It can be understood that at this time, the cloud data status that the user can see on the display interface of the user terminal is unsynchronized, thereby determining that the cloud and device data are not synchronized at this time.
[0055] S102: When the cloud write operation is successfully executed, the scene data is sent to the device to execute the device write operation.
[0056] This step is intended to achieve device-side writing, that is, when it is determined that the cloud write operation is successful (that is, the scene data is successfully written to the cloud), the scene data can be sent to the device to perform the device write operation (that is, the operation of writing the scene data to the device). Of course, when the cloud write operation fails, the step of sending the scene data to the device to perform the device write operation will not be continued. It can be understood that since the device write operation is being performed at this time, regardless of whether the cloud write operation is successful or failed, the cloud data status that the user can see on the display interface of the user terminal is still an unsynchronized state.
[0057] On this basis, the method for determining whether the cloud write operation is successful can be: when a data write success message is received from the cloud, it is determined that the cloud write operation is successful; when no data write success message is received from the cloud, it is determined that the cloud write operation has failed.
[0058] In one embodiment of the present application, when the cloud write operation is successfully executed, sending the scene data to the device end to execute the device write operation may include:
[0059] When the cloud write operation is executed successfully, a cloud write success message is sent to the user terminal;
[0060] Receive a device write instruction initiated by the user terminal based on a cloud write success message;
[0061] According to the device write instruction, the scene data is sent to the device end to perform the device write operation.
[0062] The embodiment of the present application provides a method for implementing a device write operation by sending scene data to a device end when a cloud write operation is successfully executed, that is, it can be implemented based on user instructions. Specifically, when it is determined that the cloud write operation is successfully executed, a cloud write success message can be sent to the user terminal to inform the user that the cloud write data is successful; at this time, the user can initiate a device write instruction through the user terminal, so that the terminal application can send the scene data to the device end to execute the device write operation. In other words, the embodiment of the present application implements a device write operation based on user instructions. Of course, when the terminal application determines that the cloud write operation is successfully executed, it can also directly send the scene data to the device end to execute the device write operation, which is an automated device write operation.
[0063] S103: When the device write operation is successfully executed, a device write success message is sent to the cloud, so that the cloud changes the cloud data state from an unsynchronized state to a synchronized state.
[0064] This step is intended to achieve the update of the cloud data status after the device write operation is successfully executed. Specifically, when the device write operation is successfully executed, a device write success message can be sent to the cloud to inform the cloud that the device has successfully written data. As a result, the cloud can change its own data status from an unsynchronized state to a synchronized state, which is used to indicate the synchronization of the written data between the cloud and the device. It can be understood that at this time, the cloud data status that the user can see on the display interface of the user terminal is synchronized, which can determine that the data on the cloud and the device are synchronized at this time.
[0065] Of course, if the device write operation fails, the step of sending the device write success message to the cloud will not be executed to enable the cloud to change the cloud data status from an unsynchronized state to a synchronized state. At this time, the cloud data status that the user can see on the display interface of the user terminal is still out of sync, which means that the cloud and device data are out of sync.
[0066] On this basis, the method for determining whether the device write operation is successful can be: when a data write success message is received from the device end, it is determined that the device write operation is successful; when no data write success message is received from the device end, it is determined that the device write operation has failed.
[0067] S104: When receiving a status check instruction sent by the user terminal, obtaining the cloud data status from the cloud and feeding it back to the user terminal.
[0068] This step aims to realize data status viewing based on the user terminal. This process can be realized based on the status viewing instruction initiated by the user, that is, based on the status viewing instruction initiated by the user terminal, the cloud data status is obtained from the cloud and fed back to the user terminal for display for the user to view. It can be understood that for the user, he can initiate the status viewing instruction at any time during the execution of S101~S103. On this basis, when the cloud data status is not synchronized, it can be determined that the cloud and device data are not synchronized; when the remote data status is synchronized, it can be determined that the cloud and device data are synchronized, so that the data synchronization between the cloud and the device can be clearly understood.
[0069] It can be seen that the data synchronization method provided in the embodiment of the present application, for the scene data sent by the user terminal, that is, the target data that needs to be written to the cloud and the device end to ensure the data consistency of the terminal application, the cloud, and the device end, first uploads it to the cloud to perform the cloud write operation. At this time, the cloud can synchronously set its own data status to an unsynchronized state; further, when the cloud write operation is successfully executed, the scene data will be sent to the device end to perform the device write operation, and when the device write operation is successfully executed, the cloud will be informed to update its own data status to a synchronized state, otherwise the cloud data status will not be processed. Thus, the user terminal can determine whether the cloud and the device end have consistent data according to the cloud data status. Obviously, when the cloud data status is unsynchronized, the cloud and the device end data are inconsistent; when the cloud data status is synchronized, the cloud and the device end data are consistent, thereby effectively ensuring the data consistency of the cloud and the device end from the user's perspective. It can be seen that the technical solution can effectively ensure the data consistency of the terminal application, the cloud, and the device end.
[0070] Based on the above embodiments:
[0071] In one embodiment of the present application, the data synchronization method may further include: when a cloud write operation fails to execute or a device write operation fails to execute, sending a retry prompt to the user terminal.
[0072] In an embodiment of the present application, when it is determined that a cloud write operation has failed or a device write operation has failed, a retry prompt can be further sent to the user terminal to inform the user that the current scene data write has failed and the data write operation needs to be re-executed.
[0073] Furthermore, the data synchronization method may also include: counting the number of times the retry prompt is sent; when the number of times the retry prompt is sent reaches a preset number, an abnormal prompt is output. In other words, the number of retries of the data write operation can be limited. When multiple data write operations fail, it means that there is an abnormality in the system at this time, and the user may no longer be prompted to continue to retry, but an abnormal prompt is output to inform the technician to perform operation and maintenance. It should be noted that the specific value of the preset number does not affect the implementation of this technical solution, and it can be set by the technician according to the actual situation. This application does not limit this.
[0074] Based on the above-mentioned application embodiments, the present application provides another data synchronization method.
[0075] first, Figure 3 This is a timing diagram of a data synchronization method in the prior art. The APP (terminal application) writes to the cloud first and then to the device. Since the communication protocol between the APP and the device is different from that between the APP and the cloud, failure may occur easily. If writing to one end succeeds but writing to the other end fails, data inconsistency may occur. At this time, it is unacceptable to the APP user and should be considered a BUG.
[0076] For further information, please refer to Figure 4 , Figure 4 This is a timing diagram of a data synchronization method provided by this application, and its implementation process is as follows:
[0077] 1. The user enters the scene data in the APP according to the UI guidance. The APP uploads the scene data to the cloud. The cloud uses database transactions to complete the insertion of the rule scene, and records its own data status as unsynchronized. At the same time, it feeds back a message of successful scene addition to the APP.
[0078] 2. The APP will send a message to the user that the scene has been successfully added. At this time, the user will see that the scene on the APP is not synchronized. Figure 5 As shown, Figure 5 This application provides a user terminal interface in a data unsynchronized state.
[0079] 3. The user triggers the write scene rule button on the APP, causing the APP to write scene data to the device.
[0080] 4. When the device receives the scene data, it performs a write operation.
[0081] 5. If the device fails to write, it will send a write failure message to the APP, so that the APP will inform the user that the scene data writing failed and output a retry prompt. At this time, the user will still see that the scene on the APP is not synchronized. Figure 5 shown.
[0082] 6. If the device successfully executes the write operation, it will feed back the write success message to the APP, so that the APP will inform the cloud to update the scene status to written (i.e. synchronized).
[0083] 7. When the APP receives the update success message from the cloud, it can inform the user that the scene data has been written successfully. The user can now view the scene on the APP in a synchronized state. Figure 6 As shown, Figure 6 This is a user terminal interface in a data synchronization state provided by this application.
[0084] It can be seen that the data synchronization method provided in the embodiment of the present application, for the scene data sent by the user terminal, that is, the target data that needs to be written to the cloud and the device end to ensure the data consistency of the terminal application, the cloud, and the device end, first uploads it to the cloud to perform the cloud write operation. At this time, the cloud can synchronously set its own data status to an unsynchronized state; further, when the cloud write operation is successfully executed, the scene data will be sent to the device end to perform the device write operation, and when the device write operation is successfully executed, the cloud will be informed to update its own data status to a synchronized state, otherwise the cloud data status will not be processed. Thus, the user terminal can determine whether the cloud and the device end have consistent data according to the cloud data status. Obviously, when the cloud data status is unsynchronized, the cloud and the device end data are inconsistent; when the cloud data status is synchronized, the cloud and the device end data are consistent, thereby effectively ensuring the data consistency of the cloud and the device end from the user's perspective. It can be seen that the technical solution can effectively ensure the data consistency of the terminal application, the cloud, and the device end.
[0085] An embodiment of the present application provides a data synchronization system.
[0086] like Figure 1 As shown, the data synchronization system provided in the embodiment of the present application may include a user terminal, a terminal application, a cloud, and a device end;
[0087] The terminal application is used to send the scene data to the cloud to perform a cloud write operation when receiving the scene data sent by the user terminal, so that the cloud sets the cloud data status to an unsynchronized state; when the cloud write operation is successfully executed, the scene data is sent to the device to perform a device write operation; when the device write operation is successfully executed, a device write success message is sent to the cloud, so that the cloud changes the cloud data status from an unsynchronized state to a synchronized state; when a status check instruction is received from the user terminal, the cloud data status is obtained from the cloud and fed back to the user terminal.
[0088] It can be seen that the data synchronization system provided in the embodiment of the present application, for the scene data sent by the user terminal, that is, the target data that needs to be written to the cloud and the device end to ensure the data consistency of the terminal application, the cloud, and the device end, first uploads it to the cloud to perform the cloud write operation. At this time, the cloud can synchronously set its own data status to an unsynchronized state; further, when the cloud write operation is successfully executed, the scene data will be sent to the device end to perform the device write operation, and when the device write operation is successfully executed, the cloud will be informed to update its own data status to a synchronized state, otherwise the cloud data status will not be processed. Therefore, the user terminal can determine whether the cloud and the device end have consistent data according to the cloud data status. Obviously, when the cloud data status is unsynchronized, the cloud and the device end data are inconsistent; when the cloud data status is synchronized, the cloud and the device end data are consistent, thereby effectively ensuring the data consistency of the cloud and the device end from the user's perspective. It can be seen that the technical solution can effectively ensure the data consistency of the terminal application, the cloud, and the device end.
[0089] For an introduction to the system provided in the embodiments of the present application, please refer to the above method embodiments, and this application will not go into details here.
[0090] An embodiment of the present application provides a data synchronization device.
[0091] Please refer to Figure 7 , Figure 7 This is a structural diagram of a data synchronization device provided by the present application. The data synchronization device is applied to a terminal application and may include:
[0092] The first sending module 1 is used for sending the scene data to the cloud to perform a cloud write operation when receiving the scene data sent by the user terminal, so that the cloud sets the cloud data state to an unsynchronized state;
[0093] The second sending module 2 is used to send the scene data to the device end to perform the device write operation when the cloud write operation is successfully executed;
[0094] The third sending module 3 is used to send a device write success message to the cloud when the device write operation is successfully executed, so that the cloud changes the cloud data state from the unsynchronized state to the synchronized state;
[0095] The feedback module 4 is used to obtain the cloud data status from the cloud and feed back to the user terminal when receiving the status check instruction sent by the user terminal.
[0096] It can be seen that the data synchronization device provided in the embodiment of the present application, for the scene data sent by the user terminal, that is, the target data that needs to be written to the cloud and the device end to ensure the data consistency of the terminal application, the cloud, and the device end, first uploads it to the cloud to perform the cloud write operation. At this time, the cloud can synchronously set its own data status to an unsynchronized state; further, when the cloud write operation is successfully executed, the scene data will be sent to the device end to perform the device write operation, and when the device write operation is successfully executed, the cloud will be informed to update its own data status to a synchronized state, otherwise the cloud data status will not be processed. Therefore, the user terminal can determine whether the cloud and the device end have consistent data according to the cloud data status. Obviously, when the cloud data status is unsynchronized, the cloud and the device end data are inconsistent; when the cloud data status is synchronized, the cloud and the device end data are consistent, thereby effectively ensuring the data consistency of the cloud and the device end from the user's perspective. It can be seen that the technical solution can effectively ensure the data consistency of the terminal application, the cloud, and the device end.
[0097] In one embodiment of the present application, the above-mentioned second sending module 2 can be specifically used to send a cloud write success message to the user terminal when the cloud write operation is successfully executed; receive a device write instruction initiated by the user terminal based on the cloud write success message; and send the scene data to the device end according to the device write instruction to execute the device write operation.
[0098] In one embodiment of the present application, the data synchronization device may further include a first prompt module, which is used to send a retry prompt to the user terminal when the cloud write operation fails or the device write operation fails.
[0099] In one embodiment of the present application, the data synchronization device may further include a second prompt module for counting the number of times the retry prompt is sent; when the number of times the retry prompt is sent reaches a preset number, an abnormal prompt is output.
[0100] In one embodiment of the present application, the data synchronization device may also include a first judgment module, which is used to determine that the cloud write operation is successful when a data write success message is received from the cloud; when no data write success message is received from the cloud, it is used to determine that the cloud write operation has failed.
[0101] In one embodiment of the present application, the data synchronization device may also include a second judgment module, which is used to determine that the device write operation is successful when a data write success message is received from the device end; when no data write success message is received from the device end, it is used to determine that the device write operation fails.
[0102] For an introduction to the device provided in the embodiments of the present application, please refer to the above method embodiments, and the present application will not elaborate on them here.
[0103] An embodiment of the present application provides an electronic device.
[0104] Please refer to Figure 8 , Figure 8 This is a schematic diagram of the structure of an electronic device provided in this application, and the electronic device may include:
[0105] A memory 11, used for storing computer programs;
[0106] The processor 10 can implement the steps of any one of the above-mentioned data synchronization methods when executing a computer program.
[0107] like Figure 8 , which is a schematic diagram of the composition structure of an electronic device, the electronic device may include: a processor 10, a memory 11, a communication interface 12 and a communication bus 13. The processor 10, the memory 11 and the communication interface 12 all communicate with each other through the communication bus 13.
[0108] In the embodiment of the present application, the processor 10 may be a central processing unit (CPU), an application specific integrated circuit, a digital signal processor, a field programmable gate array or other programmable logic devices, etc.
[0109] The processor 10 may call a program stored in the memory 11. Specifically, the processor 10 may execute operations in an embodiment of the data synchronization method.
[0110] The memory 11 is used to store one or more programs, which may include program codes, and the program codes include computer operation instructions. In the embodiment of the present application, the memory 11 at least stores programs for implementing the following functions:
[0111] When receiving the scene data sent by the user terminal, the scene data is sent to the cloud to perform a cloud write operation, so that the cloud sets the cloud data state to an unsynchronized state;
[0112] When the cloud write operation is successfully executed, the scene data is sent to the device to execute the device write operation;
[0113] When the device write operation is executed successfully, a device write success message is sent to the cloud, so that the cloud changes the cloud data state from the unsynchronized state to the synchronized state;
[0114] When receiving the status check instruction sent by the user terminal, the cloud data status is obtained from the cloud and fed back to the user terminal.
[0115] In a possible implementation, the memory 11 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and an application required for at least one function, etc.; the data storage area may store data created during use.
[0116] In addition, the memory 11 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device or other volatile solid-state storage device.
[0117] The communication interface 12 may be an interface of a communication module, and is used to connect to other devices or systems.
[0118] Of course, it should be noted that Figure 8 The structure shown does not constitute a limitation on the electronic device in the embodiment of the present application. In actual applications, the electronic device may include Figure 8 More or fewer components than shown, or combinations of certain components.
[0119] An embodiment of the present application provides a computer-readable storage medium.
[0120] The computer-readable storage medium provided in the embodiment of the present application stores a computer program, and when the computer program is executed by a processor, the steps of any one of the above-mentioned data synchronization methods can be implemented.
[0121] The computer-readable storage medium may include: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and other media that can store program codes.
[0122] For an introduction to the computer-readable storage medium provided in the embodiments of the present application, please refer to the above method embodiments, and the present application will not elaborate on them here.
[0123] The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description.
[0124] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0125] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0126] The technical solution provided by the present application is described in detail above. The principle and implementation method of the present application are described in detail using specific examples herein, and the description of the above embodiments is only used to help understand the method and core idea of the present application. It should be pointed out that for ordinary technicians in this technical field, without departing from the principle of the present application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the scope of protection of the present application.
Claims
1. A data synchronization method, characterized in that: Applied to terminal applications, including: When receiving the scene data sent by the user terminal, the scene data is sent to the cloud to perform a cloud write operation, so that the cloud sets the cloud data state to an unsynchronized state; When the cloud write operation is successfully executed, the scene data is sent to the device end to execute the device write operation; When the device write operation is successfully executed, a device write success message is sent to the cloud, so that the cloud changes the cloud data state from the unsynchronized state to the synchronized state; When a status check instruction sent by the user terminal is received, the cloud data status is obtained from the cloud and fed back to the user terminal.
2. The data synchronization method according to claim 1, characterized in that: When the cloud write operation is successfully executed, the scene data is sent to the device end to execute the device write operation, including: When the cloud writing operation is successfully executed, a cloud writing success message is sent to the user terminal; Receiving a device write instruction initiated by the user terminal based on the cloud write success message; The scene data is sent to the device end according to the device write instruction to perform the device write operation.
3. The data synchronization method according to claim 1, characterized in that: Also includes: When the cloud write operation fails to execute or the device write operation fails to execute, a retry prompt is sent to the user terminal.
4. The data synchronization method according to claim 3, characterized in that: Also includes: Counting the number of times the retry prompt is sent; When the sending times reaches the preset times, an abnormal prompt is output.
5. The data synchronization method according to claim 1, characterized in that: Also includes: When receiving a data write success message fed back by the cloud, determining that the cloud write operation is executed successfully; When no data writing success message fed back by the cloud is received, it is determined that the cloud writing operation has failed.
6. The data synchronization method according to claim 1, characterized in that: Also includes: When receiving a data write success message fed back by the device, determining that the device write operation is executed successfully; When no data writing success message fed back by the device is received, it is determined that the device writing operation has failed.
7. A data synchronization system, characterized in that: Including user terminals, terminal applications, cloud, and device terminals; The terminal application is used to, when receiving the scene data sent by the user terminal, send the scene data to the cloud to perform a cloud write operation, so that the cloud sets the cloud data status to an unsynchronized state; when the cloud write operation is successfully executed, send the scene data to the device end to perform a device write operation; when the device write operation is successfully executed, send a device write success message to the cloud, so that the cloud changes the cloud data status from the unsynchronized state to the synchronized state; when receiving a status check instruction sent by the user terminal, obtain the cloud data status from the cloud and feed it back to the user terminal.
8. A data synchronization device, characterized in that: Applied to terminal applications, including: A first sending module, configured to, when receiving scene data sent by a user terminal, send the scene data to a cloud to perform a cloud write operation, so that the cloud sets a cloud data state to an unsynchronized state; A second sending module is used to send the scene data to the device end to perform the device write operation when the cloud write operation is successfully executed; A third sending module is used to send a device write success message to the cloud when the device write operation is successfully executed, so that the cloud changes the cloud data state from the unsynchronized state to the synchronized state; The feedback module is used to obtain the cloud data status from the cloud and feed back to the user terminal when receiving the status viewing instruction sent by the user terminal.
9. An electronic device, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the steps of the data synchronization method as described in any one of claims 1 to 6 when executing the computer program.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the data synchronization method according to any one of claims 1 to 6 are implemented.