CN114297306A - Data synchronization method and device, electronic equipment and storage medium - Google Patents

Data synchronization method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN114297306A
CN114297306A CN202111658237.5A CN202111658237A CN114297306A CN 114297306 A CN114297306 A CN 114297306A CN 202111658237 A CN202111658237 A CN 202111658237A CN 114297306 A CN114297306 A CN 114297306A
Authority
CN
China
Prior art keywords
data
acquisition request
data acquisition
terminal
cloud
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111658237.5A
Other languages
Chinese (zh)
Inventor
叶龙
马涛
姜红梅
田涵朴
段帅良
李松涛
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Super Wisdom Shanghai Internet Of Things Technology Co ltd
Henan Zilian Internet Of Things Technology Co ltd
Original Assignee
Super Wisdom Shanghai Internet Of Things Technology Co ltd
Henan Zilian Internet Of Things Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Super Wisdom Shanghai Internet Of Things Technology Co ltd, Henan Zilian Internet Of Things Technology Co ltd filed Critical Super Wisdom Shanghai Internet Of Things Technology Co ltd
Priority to CN202111658237.5A priority Critical patent/CN114297306A/en
Publication of CN114297306A publication Critical patent/CN114297306A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Information Transfer Between Computers (AREA)
  • Telephonic Communication Services (AREA)

Abstract

The application provides a data synchronization method, a data synchronization device, electronic equipment and a storage medium, and relates to the technical field of data processing. The method can be applied to a home server in an intelligent home system, the home server is in communication connection with a terminal and a cloud end in the intelligent home system respectively, and the home server is in communication connection with at least one home device, and the method comprises the following steps: receiving a first data acquisition request sent by a cloud end, wherein the first data acquisition request is a data acquisition request which is sent to the cloud end by a terminal in response to a data acquisition operation and is forwarded by the cloud end when it is determined that target data corresponding to the first data acquisition request is not latest data; according to the first data acquisition request, inquiring and acquiring target data corresponding to the first data acquisition request; according to the terminal identification, the target data are sent to the terminal corresponding to the terminal identification, and the terminal can acquire the latest target data by applying the embodiment of the application, so that the accuracy of the acquired target data is ensured.

Description

Data synchronization method and device, electronic equipment and storage medium
Technical Field
The present application relates to the field of smart home technologies, and in particular, to a data synchronization method and apparatus, an electronic device, and a storage medium.
Background
The intelligent home is characterized in that a home is used as a platform, facilities related to home life are integrated by utilizing a comprehensive wiring technology, a network communication technology, a safety precaution technology, an automatic control technology and an audio and video technology, an efficient management system of home facilities and family schedule affairs is constructed, home safety, convenience, comfortableness and artistry are improved, and an environment-friendly and energy-saving living environment is realized.
In the existing intelligent home system, a user can access a cloud end in the intelligent home system through a terminal to request to synchronously acquire related query data.
It can be seen that the existing data synchronization method is relatively simple, and therefore, the data acquired by the terminal often has the problem of being inaccurate.
Disclosure of Invention
An object of the present application is to provide a data synchronization method, an apparatus, an electronic device, and a storage medium, which can improve the applicability of the data synchronization method and ensure the accuracy of the synchronized data.
In order to achieve the above purpose, the technical solutions adopted in the embodiments of the present application are as follows:
in a first aspect, the present invention provides a data synchronization method, which is applied to a home server in an intelligent home system, where the home server is in communication connection with a terminal and a cloud end in the intelligent home system, respectively, and the home server is in communication connection with at least one home device, and the data synchronization method includes:
receiving a first data acquisition request sent by a cloud, wherein the first data acquisition request is a data acquisition request which is sent to the cloud by a terminal in response to a data acquisition operation and is forwarded by the cloud when it is determined that target data corresponding to the first data acquisition request is not latest data, and the first data acquisition request comprises a terminal identification;
according to the first data acquisition request, inquiring and acquiring target data corresponding to the first data acquisition request;
and sending the target data to a terminal corresponding to the terminal identification according to the terminal identification.
In an alternative embodiment, the method further comprises:
receiving a data change request sent by a terminal;
updating the data to be changed corresponding to the data change request in the home server according to the data change request;
and sending a data change response to the terminal, wherein the data change response is used for indicating whether the updating is successful or not.
In an optional embodiment, after the updating, according to the data change request, the method further includes:
according to the data change request, determining a data type corresponding to the data change request, and sending a data change signal to the cloud end so that the cloud end marks the data type corresponding to the data change signal as a first identifier according to the data change signal, wherein the data change signal comprises: the data type corresponding to the data change request and the server identifier of the home server;
receiving a second data acquisition request sent by the cloud according to the data change signal;
and sending change data to the cloud end according to the second data acquisition request, so that the data type corresponding to the data change signal is marked as a second identifier after the data to be changed in the cloud end is updated by the cloud end according to the change data.
In an optional embodiment, the sending a data change signal to the cloud includes:
if the data change signal sent to the cloud end is determined not to be sent successfully, storing a data change task corresponding to the data change signal into a first task queue;
and reading a data change signal corresponding to the data change task from the first task queue according to a first preset time interval, and resending the data change signal to the cloud.
In an optional implementation manner, the receiving a second data obtaining request sent by the cloud according to the data change signal includes:
and receiving a second data acquisition request corresponding to a data synchronization task acquired from a second task queue and sent by the cloud according to a second preset time interval, wherein the cloud stores the data synchronization task corresponding to the second data acquisition request into the second task queue when determining that the second data acquisition request sent to the home server according to the data change signal is not successfully sent.
In an optional implementation manner, if the cloud determines that the data type corresponding to the first data obtaining request is marked as a first identifier, it determines that the target data corresponding to the first data obtaining request is non-latest data.
In an alternative embodiment, the change data includes a full amount of data of a data type corresponding to the data change request.
In a second aspect, the present invention provides a data synchronization method, which is applied to a cloud in an intelligent home system, where the cloud is in communication connection with a home server and a terminal in the intelligent home system, respectively, and the home server is in communication connection with at least one home device, and the data synchronization method includes:
receiving a first data acquisition request sent by a terminal in response to a data acquisition operation, wherein the first data acquisition request comprises a terminal identifier;
and if the target data corresponding to the first data acquisition request is determined to be not the latest data, forwarding the first data acquisition request to the home server so that the home server acquires the target data according to the first data acquisition request and sends the target data to the terminal corresponding to the terminal identifier.
In an alternative embodiment, the method further comprises:
if the cloud end receives data change signals sent by a plurality of home servers, a second data acquisition request is sent to the home server corresponding to each data change signal by adopting multithreading;
and receiving the change data sent by each household server according to each second data acquisition request.
In a third aspect, the present invention provides a data synchronization method, which is applied to a terminal in an intelligent home system, where the terminal is in communication connection with a home server and a cloud end in the intelligent home system, and the home server is in communication connection with at least one home device, and the data synchronization method includes:
responding to data acquisition operation, and sending a first data acquisition request to the cloud end, wherein the first data acquisition request comprises a terminal identifier;
and receiving target data returned by the home server according to the first data acquisition request, wherein the cloud forwards the first data acquisition request to the home service when determining that the target data corresponding to the first data acquisition request sent by the terminal is not the latest data.
In a fourth aspect, an embodiment of the present application provides a data synchronization device, which is applied to a home server in an intelligent home system, where the home server is in communication connection with a terminal and a cloud in the intelligent home system, the home server is in communication connection with at least one home device, and the data synchronization device includes:
the receiving module is used for receiving a first data acquisition request sent by a cloud end, wherein the first data acquisition request is a data acquisition request which is sent to the cloud end by a terminal in response to a data acquisition operation and forwarded by the cloud end when it is determined that target data corresponding to the first data acquisition request is not latest data, and the first data acquisition request comprises a terminal identification;
the acquisition module is used for inquiring and acquiring target data corresponding to the first data acquisition request according to the first data acquisition request;
and the sending module is used for sending the target data to a terminal corresponding to the terminal identification according to the terminal identification.
In an optional embodiment, the data synchronization apparatus further includes: the change module is used for receiving a data change request sent by the terminal;
updating the data to be changed corresponding to the data change request in the home server according to the data change request;
and sending a data change response to the terminal, wherein the data change response is used for indicating whether the updating is successful or not.
In an optional implementation manner, the change module is further configured to determine, according to the data change request, a data type corresponding to the data change request, and send a data change signal to the cloud, so that the cloud marks, according to the data change signal, the data type corresponding to the data change signal as a first identifier, where the data change signal includes: the data type corresponding to the data change request and the server identifier of the home server;
receiving a second data acquisition request sent by the cloud according to the data change signal;
and sending change data to the cloud end according to the second data acquisition request, so that the data type corresponding to the data change signal is marked as a second identifier after the data to be changed in the cloud end is updated by the cloud end according to the change data.
In an optional embodiment, the change module is specifically configured to store a data change task corresponding to the data change signal into a first task queue if it is determined that the data change signal sent to the cloud is not successfully sent;
and reading a data change signal corresponding to the data change task from the first task queue according to a first preset time interval, and resending the data change signal to the cloud.
In an optional implementation manner, the changing module is specifically configured to receive a second data obtaining request, which is sent by the cloud end according to a second preset time interval and corresponds to a data synchronization task obtained from a second task queue, where the cloud end stores the data synchronization task corresponding to the second data obtaining request into the second task queue when it is determined that the second data obtaining request sent to the home server according to the data changing signal is not successfully sent.
In an optional implementation manner, if the cloud determines that the data type corresponding to the first data obtaining request is marked as a first identifier, it determines that the target data corresponding to the first data obtaining request is non-latest data.
In an alternative embodiment, the change data includes a full amount of data of a data type corresponding to the data change request.
In a fifth aspect, the present invention provides a data synchronization apparatus, which is applied to a cloud in an intelligent home system, wherein the cloud is in communication connection with a home server and a terminal in the intelligent home system, respectively, the home server is in communication connection with at least one home device, and the data synchronization apparatus includes:
the terminal comprises a receiving module, a sending module and a receiving module, wherein the receiving module is used for receiving a first data acquisition request sent by the terminal in response to a data acquisition operation, and the first data acquisition request comprises a terminal identifier;
and the forwarding module is used for forwarding the first data acquisition request to the home server if the target data corresponding to the first data acquisition request is determined to be not the latest data, so that the home server acquires the target data according to the first data acquisition request and sends the target data to the terminal corresponding to the terminal identifier.
In an optional embodiment, the data synchronization apparatus further includes: the updating module is used for sending a second data acquisition request to the home server corresponding to each data change signal by adopting multithreading respectively if the cloud end receives the data change signals sent by the home servers;
and receiving the change data sent by each household server according to each second data acquisition request.
In a sixth aspect, the present invention provides a data synchronization apparatus, which is applied to a terminal in an intelligent home system, where the terminal is in communication connection with a home server and a cloud end in the intelligent home system, the home server is in communication connection with at least one home device, and the data synchronization apparatus includes:
the response module is used for responding to data acquisition operation and sending a first data acquisition request to the cloud end, wherein the first data acquisition request comprises a terminal identification;
and the receiving module is used for receiving target data returned by the home server according to the first data acquisition request, wherein the cloud forwards the first data acquisition request to the home service when determining that the target data corresponding to the first data acquisition request sent by the terminal is not latest data.
In a fourth aspect, the present invention provides an electronic device comprising: the data synchronization system comprises a processor, a storage medium and a bus, wherein the storage medium stores machine-readable instructions executable by the processor, when an electronic device runs, the processor is communicated with the storage medium through the bus, and the processor executes the machine-readable instructions to execute the steps of the data synchronization method according to any one of the preceding embodiments.
In a fifth aspect, the present invention provides a computer-readable storage medium, having a computer program stored thereon, where the computer program is executed by a processor to perform the steps of the data synchronization method according to any of the previous embodiments.
The beneficial effect of this application is:
the data synchronization method, the data synchronization device, the electronic device and the storage medium provided by the embodiment of the application can be applied to a home server in an intelligent home system, the home server is in communication connection with a terminal and a cloud end in the intelligent home system respectively, the home server is in communication connection with at least one home device, and the data synchronization method comprises the following steps: receiving a first data acquisition request sent by a cloud end, wherein the first data acquisition request is a data acquisition request which is sent to the cloud end by a terminal in response to a data acquisition operation and is forwarded by the cloud end when it is determined that target data corresponding to the first data acquisition request is not latest data, and the first data acquisition request comprises a terminal identification; according to the first data acquisition request, inquiring and acquiring target data corresponding to the first data acquisition request; according to the terminal identification, the target data are sent to the terminal corresponding to the terminal identification, and the terminal can acquire the latest target data by applying the embodiment of the application, so that the accuracy of the acquired target data is ensured.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are required to be used in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered as limiting the scope, and for those skilled in the art, other related drawings can be obtained from the drawings without inventive effort.
Fig. 1 is a schematic architecture diagram of an intelligent home system provided in an embodiment of the present application;
fig. 2 is a schematic flowchart of a data synchronization method according to an embodiment of the present application;
fig. 3 is a schematic flowchart of another data synchronization method according to an embodiment of the present application;
fig. 4 is a schematic flowchart of another data synchronization method according to an embodiment of the present application;
fig. 5 is a schematic flowchart of another data synchronization method according to an embodiment of the present application;
fig. 6 is a schematic flowchart of another data synchronization method according to an embodiment of the present application;
fig. 7 is a schematic flowchart of another data synchronization method according to an embodiment of the present application;
fig. 8 is a schematic flowchart of another data synchronization method according to an embodiment of the present application;
fig. 9 is a schematic functional block diagram of a data synchronization apparatus according to an embodiment of the present application;
fig. 10 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments. The components of the embodiments of the present application, generally described and illustrated in the figures herein, can be arranged and designed in a wide variety of different configurations.
Thus, the following detailed description of the embodiments of the present application, presented in the accompanying drawings, is not intended to limit the scope of the claimed application, but is merely representative of selected embodiments of the application. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures.
In the existing intelligent home system, data of the intelligent home system is mainly stored in a cloud end, namely, a user mainly accesses the cloud end in the intelligent home system through a terminal to request for synchronous acquisition of related query data.
In view of this, the embodiments of the present application provide a data synchronization method, which can improve the applicability of the data synchronization method and ensure the accuracy of the synchronized data.
Fig. 1 is a schematic structural diagram of an intelligent home system provided in an embodiment of the present application, and as shown in fig. 1, the intelligent home system may include a home server 110, a cloud terminal 120, a terminal 130, and home devices, where the home devices may include: a printer 142, and a projector 143. It should be noted that the types of the home devices are not limited thereto, and according to an actual application scenario, the smart home system may include: lamps and lanterns, socket, (window) curtain, air conditioner, ware, projecting apparatus, water heater, air purifier, security protection class equipment, intelligent house equipment such as robot of sweeping the floor. As can be seen from fig. 1, the home server 110 is in communication connection with the terminal 130 and the cloud end 120 in the smart home system, and the home server 110 is in communication connection with at least one home device, where the terminal may be a mobile phone, a tablet computer, a wearable device, and the like, which is not limited herein. Certainly, the number of home servers in the smart home system is not limited herein, and according to an actual application scenario, the smart home system may include a plurality of home servers, and each home server may be deployed in different application environments. For example, the home servers may be deployed in different homes, and of course, each home server may also be configured to be accessible through multiple terminals in one home. Based on the above description, it can be seen that in the data synchronization method provided by the embodiment of the present application, the terminal may access the smart home system through the cloud and may also access the smart home system through the home server, that is, in the data synchronization method provided by the embodiment of the present application, the terminal may not only access the smart home system through the internet but also access the smart home system through the local area network, and thus, the applicability of the data synchronization method of the present application may be improved.
In addition, it should be further noted that the cloud may be implemented based on a micro service cluster, and optionally, the micro service cluster may include: the system comprises a plurality of micro services such as version service, home equipment service, a basic configuration center, authorization service and the like, and is used for returning corresponding data to a terminal according to different types of data acquisition requests, and the system is not limited herein and can be flexibly set according to actual application scenes.
Fig. 2 is a schematic flow diagram of a data synchronization method provided in an embodiment of the present application, where the method may be applied to a home server in an intelligent home system, and as shown in fig. 2, the data synchronization method may include:
s101, a first data acquisition request sent by a cloud is received, wherein the first data acquisition request is a data acquisition request which is sent to the cloud by a terminal in response to a data acquisition operation and is forwarded by the cloud when it is determined that target data corresponding to the first data acquisition request is not latest data, and the first data acquisition request comprises a terminal identification.
In an intelligent home scene, a terminal can be configured to access an intelligent home system through a preset webpage or a preset home device management application program, optionally, during access, the terminal can act on the terminal in a touch manner of clicking, long-pressing, re-pressing, sliding and the like to generate data acquisition operation, the terminal responds to the data acquisition operation, and can send a first data acquisition request to a cloud end in the intelligent home system to request to acquire target data, wherein the first data acquisition request can include a terminal identifier; for the cloud, after receiving the first data acquisition request, if it is determined that target data corresponding to the first data acquisition request stored in the cloud is not latest data, the cloud may forward the first data acquisition request to the home server, and the home server may receive the first data acquisition request sent by the remote end at this time.
In some embodiments, the first data obtaining request may specifically be a version data obtaining request, a state parameter obtaining request of a home device, a basic configuration data obtaining request of an intelligent home system, an authorization information obtaining request, and the like, which are not limited herein. Optionally. The terminal identifier may specifically be a device serial number of the terminal, a name of the terminal, and the like, which is not limited herein.
S102, according to the first data acquisition request, target data corresponding to the first data acquisition request are inquired and acquired.
The home server in the smart home system may be understood as a home host, and it may be understood that, since the home server is generally located in the same local area network as each home device in communication connection with the home server, and various control operations on each home device need to be implemented by sending a control instruction to each home device through the home server, target data acquired by the home server according to the first data acquisition request will be latest data.
S103, sending target data to a terminal corresponding to the terminal identification according to the terminal identification.
Based on the above description, after the home server queries and acquires the target data corresponding to the first data acquisition request, the home server may send the target data to the terminal corresponding to the terminal identifier according to the terminal identifier carried in the first data acquisition request, so that the terminal can acquire the latest target data, and the accuracy of the acquired data is ensured.
It should be noted that the process of sending the target data to the terminal corresponding to the terminal identifier by the home server may be direct sending or indirect sending, which is not limited herein, and may be flexibly limited according to the actual application scenario. The direct transmission means that the home server can directly transmit the target data to the terminal corresponding to the terminal identifier according to the terminal identifier; for indirect sending, optionally, the home server may return the acquired target data to the cloud, and the cloud sends the target data to the terminal.
To sum up, an embodiment of the present application provides a data synchronization method, which may be applied to a home server in an intelligent home system, where the home server is in communication connection with a terminal and a cloud in the intelligent home system, and the home server is in communication connection with at least one home device, and the data synchronization method includes: receiving a first data acquisition request sent by a cloud end, wherein the first data acquisition request is a data acquisition request which is sent to the cloud end by a terminal in response to a data acquisition operation and is forwarded by the cloud end when it is determined that target data corresponding to the first data acquisition request is not latest data, and the first data acquisition request comprises a terminal identification; according to the first data acquisition request, inquiring and acquiring target data corresponding to the first data acquisition request; according to the terminal identification, the target data are sent to the terminal corresponding to the terminal identification, and the terminal can acquire the latest target data by applying the embodiment of the application, so that the accuracy of the acquired target data is ensured.
Fig. 3 is a schematic flowchart of another data synchronization method according to an embodiment of the present application. Optionally, as shown in fig. 3, the method further includes:
s201, receiving a data change request sent by a terminal.
Wherein, the data change request may include: the data request for changing the state parameters of the home equipment, the data request for changing the basic configuration of the smart home system, the data request for changing the user permission, and the like, wherein the change type specifically may be: data addition, data deletion, data modification, and the like are not limited herein.
In some embodiments, the smart home system can be accessed through a preset webpage or a preset home device management application program based on the terminal, wherein a data change request can be generated according to a change demand in an access process, the generated data change request can be sent to the home server first, so that the home server can update in time according to the data change request sent by the terminal, and then the home service and the home devices in communication connection with the home server can be ensured to update in time.
S202, updating the data to be changed corresponding to the data change request in the home server according to the data change request.
And S203, sending a data change response to the terminal, wherein the data change response is used for indicating whether the updating is successful or not.
It can be understood that, for the home server, after receiving the data change request sent by the terminal, the home server may update the data to be changed corresponding to the data change request, thereby implementing data synchronization with the terminal; furthermore, after the home server is updated, a data change response can be sent to the terminal, so that the terminal can know whether the home server is updated successfully according to the data change response, data synchronization between the terminal and the home server is realized, and the updating experience of a user is improved.
Fig. 4 is a schematic flowchart of another data synchronization method according to an embodiment of the present application. Optionally, as shown in fig. 4, after updating the data to be changed corresponding to the data change request according to the data change request, the method further includes:
s301, according to the data change request, determining a data type corresponding to the data change request, and sending a data change signal to the cloud so that the cloud marks the data type corresponding to the data change signal as a first identifier according to the data change signal.
Wherein the data change signal includes: the data type corresponding to the data change request and the server identification of the home server.
Based on the intelligent home system provided by the embodiment of the application, if the home server receives a data change request sent by the terminal, the home server further can obtain a data type corresponding to the data change request, a data change signal can be generated according to the data type corresponding to the data change request and a server identifier of the home server, and the generated data change signal can be sent to the cloud end; for the cloud, after receiving the data change signal, the cloud may mark the data type corresponding to the data change signal in the cloud as a first identifier to represent that the data corresponding to the first identifier is non-latest data.
Optionally, the server identification of the home server may include: the device serial number, name, etc. of the home server are not limited herein. The data change signal may be sent to the cloud based on the HTTP protocol, but the specific sending manner is not limited thereto. Of course, the time for the home server to send the data change signal is not limited herein, and optionally, the data change signal may be sent to the cloud in an asynchronous manner. Specifically, the transmission may be according to a preset period, or may be transmitted when the home server is idle, which is not limited herein.
S302, receiving a second data acquisition request sent by the cloud according to the data change signal.
Based on the above description, since the data corresponding to the first identifier in the data stored in the cloud is not the latest data, at this time, the cloud may generate a second data obtaining request according to the data change signal and send the second data obtaining request to the home server, so that the change data corresponding to the data change signal may be obtained by the home server.
And S303, sending the change data to the cloud according to the second data acquisition request, so that the cloud updates the data to be changed in the cloud according to the change data, and then marking the data type corresponding to the data change signal as a second identifier.
After receiving the second data acquisition request sent by the cloud, the home server can return change data corresponding to the second data acquisition request to the cloud according to the second data acquisition request, and then after receiving the change data, the cloud can update the data to be changed in the cloud according to the change data, so that data synchronization between the cloud and the home server is realized. The data to be changed in the cloud is also the data type corresponding to the data change request in the cloud and the data corresponding to the server identifier of the home server.
In addition, after the cloud updates the data to be changed, the data type corresponding to the data change signal needs to be marked as a second identifier, so that the data corresponding to the second identifier can be represented as the latest data.
Compared with the mode of directly sending a large amount of changed data to the cloud end through the home server, the method for sending the second data acquisition request to the home server through the cloud end can make full use of the processing performance of the cloud end; the mode that the home server sends the data change signal to the cloud end can greatly reduce the pressure of the home server and ensure the operation performance of the home server.
Fig. 5 is a schematic flowchart of another data synchronization method according to an embodiment of the present application. Optionally, as shown in fig. 5, the sending the data change signal to the cloud includes:
s401, if it is determined that the data change signal sent to the cloud end is not sent successfully, storing the data change task corresponding to the data change signal into a first task queue.
S402, reading a data change signal corresponding to the data change task from the first task queue according to the first preset time interval, and resending the data change signal to the cloud.
Optionally, in order to ensure that the home server can timely send the data change signal to the cloud after working normally, the home server may store the data change tasks corresponding to the unsuccessfully sent change signals in a first task queue when determining that the data change signal sent to the cloud is unsuccessfully sent, and poll and read the data change signals corresponding to the data change tasks from the first task queue according to a first preset time interval to resend the data change signals to the cloud.
Alternatively, the first preset time interval may be 10 seconds, 30 seconds, 1 minute, etc., which is not limited herein and may be different according to the actual application scenario.
Optionally, the receiving a second data obtaining request sent by the cloud according to the data change signal includes:
and receiving a second data acquisition request corresponding to the data synchronization task acquired from the second task queue and sent by the cloud according to a second preset time interval.
When the cloud determines that the second data acquisition request sent to the home server according to the data change signal is not successfully sent, the cloud stores the data synchronization task corresponding to the second data acquisition request into a second task queue.
In some embodiments, for the cloud, due to the fact that the cloud may have abnormalities such as poor network signals and poor operation performance, that is, the cloud may fail to send the second data acquisition request to the home server according to the data change signal, optionally, in this case, the cloud may store the data synchronization task corresponding to the second data acquisition request that fails to be sent into the second task queue, and poll and read the second data acquisition request corresponding to each data synchronization task from the second task queue according to the second preset time interval to resend the second data acquisition request to the home server. It can be understood that, for the home server, after receiving the second data acquisition request, the home server may refer to the step of S303 to send the change data to the cloud, which is not described herein again.
Alternatively, the second preset time interval may be 10 seconds, 15 seconds, 30 minutes, and the like, which is not limited herein and may be different according to the actual application scenario. Of course, in some embodiments, the second predetermined time interval may be the same as or different from the first predetermined time interval, and is not limited herein.
Optionally, when the cloud determines that the data type corresponding to the first data obtaining request is marked as the first identifier, it is determined that the target data corresponding to the first data obtaining request is not the latest data.
As can be understood from the above description, for the cloud, each data type corresponds to an identifier, that is, the first identifier or the second identifier. For data stored in the cloud, if the data type corresponding to the first data acquisition request is marked as a first identifier, it may be considered that target data corresponding to the first data acquisition request is not latest data, otherwise, if the data type is a second identifier, it may be considered that the target data corresponding to the first data acquisition request is latest data.
In addition, it can be understood that, if the cloud determines that the data type corresponding to the first data obtaining request is marked as the second identifier, that is, the target data corresponding to the first data obtaining request stored in the cloud is the latest data, the cloud may query and obtain the target data corresponding to the first data obtaining request and return the target data to the terminal.
Optionally, the change data may include a total amount of data of a data type corresponding to the data change request.
In some embodiments, considering that a user may modify data corresponding to the same home server based on multiple terminals, optionally, after receiving the second data acquisition request sent by the cloud, the home server may acquire the full data of the data type corresponding to the data change request, and send the full data of the data type corresponding to the data change request to the cloud, so that the data synchronization consistency between the home server and the terminals may be ensured.
Fig. 6 is a schematic flow chart of another data synchronization method provided in an embodiment of the present application, where the method may be applied to a cloud in an intelligent home system, the cloud is in communication connection with a home server and a terminal in the intelligent home system, and the home server is in communication connection with at least one home device. As shown in fig. 6, the data synchronization method includes:
s501, receiving a first data acquisition request sent by a terminal in response to a data acquisition operation, wherein the first data acquisition request comprises a terminal identifier.
S502, if it is determined that the target data corresponding to the first data acquisition request is not the latest data, the first data acquisition request is forwarded to the home server, so that the home server acquires the target data according to the first data acquisition request and sends the target data to the terminal corresponding to the terminal identifier.
For the terminal, the terminal can act on the terminal in a touch manner such as clicking, long pressing, repeated pressing, sliding and the like to generate data acquisition operation, and the terminal can send a first data acquisition request comprising a terminal identifier to a cloud end in the intelligent home system to request for acquiring target data in response to the data acquisition operation; the cloud end can determine whether target data corresponding to the first data acquisition request is latest data or not after receiving the first data acquisition request, and if not, the cloud end can forward the first data acquisition request to the home server so that the target data corresponding to the first data acquisition request can be acquired through the home server, and then the target data can be sent to a terminal corresponding to the terminal identification. By applying the embodiment of the application, the terminal can acquire the latest target data in the data synchronization process, and the accuracy of the acquired target data is ensured.
Optionally, the process of sending the target data to the terminal corresponding to the terminal identifier may be that the home server directly sends the target data to the terminal corresponding to the terminal identifier, or may be that the cloud forwards the target data sent by the home server to the terminal corresponding to the terminal identifier, and the process may be flexibly selected according to an actual application scenario, which is not limited herein.
Fig. 7 is a schematic flowchart of another data synchronization method according to an embodiment of the present application. Optionally, as shown in fig. 7, the method further includes:
s601, if the cloud end receives data change signals sent by the plurality of home servers, sending second data acquisition requests to the home servers corresponding to the data change signals respectively by adopting multiple threads.
And S602, receiving the changed data sent by each home server according to each second data acquisition request.
In view of the smart home scenario, the cloud may communicate with the multiple home servers, that is, the cloud may receive data change signals sent by the multiple home servers, in this case, the cloud may send second data acquisition requests to the home servers corresponding to the data change signals respectively by using multiple threads, and after receiving the second data acquisition requests, the home servers may send change data corresponding to the second data acquisition requests to the cloud. Based on the above description, it can be seen that by applying the embodiment of the application, timeliness and reliability of data synchronization between the cloud and the multi-terminal home server can be guaranteed.
Based on the above description, optionally, for the cloud, the cloud may be configured to receive a data acquisition request with a large data access amount, which is sent by the terminal, of a management home page of the smart home system, a home device list under the home server, user permission information, and the like, so as to reduce loading pressure of the home server and ensure operation performance of the home server.
Fig. 8 is a schematic flow chart of another data synchronization method provided in an embodiment of the present application, where the method may be applied to a terminal in an intelligent home system, the terminal is in communication connection with a home server and a cloud end in the intelligent home system, and the home server is in communication connection with at least one home device. As shown in fig. 8, the data synchronization method may include:
s701, responding to data acquisition operation, and sending a first data acquisition request to a cloud end, wherein the first data acquisition request comprises a terminal identification.
S702, receiving target data returned by the home server according to the first data acquisition request, wherein the cloud forwards the first data acquisition request to the home service when determining that the target data corresponding to the first data acquisition request sent by the terminal is not the latest data.
For the descriptions of steps S701 and S702, refer to the descriptions of steps S101 and S102, or refer to the descriptions of steps S501 and S502, which are not described herein again. Based on the above description, it can be seen that, by applying the embodiment of the present application, the terminal can acquire the latest target data in the data synchronization process, and the accuracy of the acquired target data is ensured.
In addition, it should be further noted that the receiving, by the terminal, target data returned by the home server according to the first data obtaining request may specifically be the receiving, by the terminal, of target data directly returned by the home server according to the first data obtaining request, or may also be the receiving, by the terminal, of target data returned by the home server forwarded by the cloud according to the first data obtaining request, and may be different according to actual application scenarios.
Fig. 9 is a schematic diagram of functional modules of a data synchronization device according to an embodiment of the present application, where the data synchronization device may be applied to a home server in an intelligent home system, the home server is in communication connection with a terminal and a cloud end in the intelligent home system, respectively, and the home server is in communication connection with at least one home device. As shown in fig. 9, the data synchronization apparatus 200 may include:
the receiving module 210 is configured to receive a first data acquisition request sent by a cloud, where the first data acquisition request is a data acquisition request sent by a terminal to the cloud in response to a data acquisition operation and forwarded by the cloud when it is determined that target data corresponding to the first data acquisition request is not latest data, and the first data acquisition request includes a terminal identifier;
an obtaining module 220, configured to query and obtain target data corresponding to the first data obtaining request according to the first data obtaining request;
a sending module 230, configured to send the target data to a terminal corresponding to the terminal identifier according to the terminal identifier.
In an optional embodiment, the data synchronization apparatus further includes: the change module is used for receiving a data change request sent by the terminal;
updating the data to be changed corresponding to the data change request in the home server according to the data change request;
and sending a data change response to the terminal, wherein the data change response is used for indicating whether the updating is successful or not.
In an optional implementation manner, the change module is further configured to determine, according to the data change request, a data type corresponding to the data change request, and send a data change signal to the cloud, so that the cloud marks, according to the data change signal, the data type corresponding to the data change signal as a first identifier, where the data change signal includes: the data type corresponding to the data change request and the server identifier of the home server;
receiving a second data acquisition request sent by the cloud according to the data change signal;
and sending change data to the cloud end according to the second data acquisition request, so that the data type corresponding to the data change signal is marked as a second identifier after the data to be changed in the cloud end is updated by the cloud end according to the change data.
In an optional embodiment, the change module is specifically configured to store a data change task corresponding to the data change signal into a first task queue if it is determined that the data change signal sent to the cloud is not successfully sent;
and reading a data change signal corresponding to the data change task from the first task queue according to a first preset time interval, and resending the data change signal to the cloud.
In an optional implementation manner, the changing module is specifically configured to receive a second data obtaining request, which is sent by the cloud end according to a second preset time interval and corresponds to a data synchronization task obtained from a second task queue, where the cloud end stores the data synchronization task corresponding to the second data obtaining request into the second task queue when it is determined that the second data obtaining request sent to the home server according to the data changing signal is not successfully sent.
In an optional implementation manner, if the cloud determines that the data type corresponding to the first data obtaining request is marked as a first identifier, it determines that the target data corresponding to the first data obtaining request is non-latest data.
In an alternative embodiment, the change data includes a full amount of data of a data type corresponding to the data change request.
Optionally, the present invention further provides a data synchronization apparatus, which is applied to a cloud end in an intelligent home system, wherein the cloud end is in communication connection with a home server and a terminal in the intelligent home system, respectively, the home server is in communication connection with at least one home device, and the data synchronization apparatus includes:
the terminal comprises a receiving module, a sending module and a receiving module, wherein the receiving module is used for receiving a first data acquisition request sent by the terminal in response to a data acquisition operation, and the first data acquisition request comprises a terminal identifier;
and the forwarding module is used for forwarding the first data acquisition request to the home server if the target data corresponding to the first data acquisition request is determined to be not the latest data, so that the home server acquires the target data according to the first data acquisition request and sends the target data to the terminal corresponding to the terminal identifier.
In an optional embodiment, the data synchronization apparatus further includes: the updating module is used for sending a second data acquisition request to the home server corresponding to each data change signal by adopting multithreading respectively if the cloud end receives the data change signals sent by the home servers;
and receiving the change data sent by each household server according to each second data acquisition request.
Optionally, the present invention further provides a data synchronization apparatus, which is applied to a terminal in an intelligent home system, where the terminal is in communication connection with a home server and a cloud end in the intelligent home system, the home server is in communication connection with at least one home device, and the data synchronization apparatus includes:
the response module is used for responding to data acquisition operation and sending a first data acquisition request to the cloud end, wherein the first data acquisition request comprises a terminal identification;
and the receiving module is used for receiving target data returned by the home server according to the first data acquisition request, wherein the cloud forwards the first data acquisition request to the home service when determining that the target data corresponding to the first data acquisition request sent by the terminal is not latest data.
The above-mentioned apparatus is used for executing the method provided by the foregoing embodiment, and the implementation principle and technical effect are similar, which are not described herein again.
These above modules may be one or more integrated circuits configured to implement the above methods, such as: one or more Application Specific Integrated Circuits (ASICs), or one or more microprocessors, or one or more Field Programmable Gate Arrays (FPGAs), etc. For another example, when one of the above modules is implemented in the form of a Processing element scheduler code, the Processing element may be a general-purpose processor, such as a Central Processing Unit (CPU) or other processor capable of calling program code. For another example, these modules may be integrated together and implemented in the form of a system-on-a-chip (SOC).
Fig. 10 is a schematic structural diagram of an electronic device according to an embodiment of the present application, where the electronic device may be integrated in the data synchronization apparatus. As shown in fig. 10, the electronic device may include: a processor 310, a storage medium 320 and a bus 330, wherein the storage medium 320 stores machine-readable instructions executable by the processor 310, and when the electronic device is operated, the processor 310 communicates with the storage medium 320 via the bus 330, and the processor 310 executes the machine-readable instructions to perform the steps of the above-mentioned method embodiments. The specific implementation and technical effects are similar, and are not described herein again.
Optionally, the present application further provides a storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the computer program performs the steps of the above method embodiments. The specific implementation and technical effects are similar, and are not described herein again.
In the several embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, a division of a unit is merely a logical division, and an actual implementation may have another division, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
Units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional unit.
The integrated unit implemented in the form of a software functional unit may be stored in a computer readable storage medium. The software functional unit is stored in a storage medium and includes several instructions to enable a computer device (which may be a personal computer, a server, or a network device) or a processor (processor) to execute some steps of the methods according to the embodiments of the present application. And the aforementioned storage medium includes: a U disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
It is noted that, in this document, relational terms such as "first" and "second," and the like, may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The above description is only a preferred embodiment of the present application and is not intended to limit the present application, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present application shall be included in the protection scope of the present application. It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures. The above description is only a preferred embodiment of the present application and is not intended to limit the present application, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims (12)

1. A data synchronization method is applied to a home server in an intelligent home system, the home server is in communication connection with a terminal and a cloud end in the intelligent home system respectively, the home server is in communication connection with at least one home device, and the data synchronization method comprises the following steps:
receiving a first data acquisition request sent by a cloud, wherein the first data acquisition request is a data acquisition request which is sent to the cloud by a terminal in response to a data acquisition operation and is forwarded by the cloud when it is determined that target data corresponding to the first data acquisition request is not latest data, and the first data acquisition request comprises a terminal identification;
according to the first data acquisition request, inquiring and acquiring target data corresponding to the first data acquisition request;
and sending the target data to a terminal corresponding to the terminal identification according to the terminal identification.
2. The method of claim 1, further comprising:
receiving a data change request sent by a terminal;
updating the data to be changed corresponding to the data change request in the home server according to the data change request;
and sending a data change response to the terminal, wherein the data change response is used for indicating whether the updating is successful or not.
3. The method according to claim 2, wherein after updating the data to be changed corresponding to the data change request according to the data change request, the method further comprises:
according to the data change request, determining a data type corresponding to the data change request, and sending a data change signal to the cloud end so that the cloud end marks the data type corresponding to the data change signal as a first identifier according to the data change signal, wherein the data change signal comprises: the data type corresponding to the data change request and the server identifier of the home server;
receiving a second data acquisition request sent by the cloud according to the data change signal;
and sending change data to the cloud end according to the second data acquisition request, so that the data type corresponding to the data change signal is marked as a second identifier after the data to be changed in the cloud end is updated by the cloud end according to the change data.
4. The method of claim 3, wherein the sending a data change signal to the cloud comprises:
if the data change signal sent to the cloud end is determined not to be sent successfully, storing a data change task corresponding to the data change signal into a first task queue;
and reading a data change signal corresponding to the data change task from the first task queue according to a first preset time interval, and resending the data change signal to the cloud.
5. The method of claim 3, wherein the receiving a second data acquisition request sent by the cloud in accordance with the data change signal comprises:
and receiving a second data acquisition request corresponding to a data synchronization task acquired from a second task queue and sent by the cloud according to a second preset time interval, wherein the cloud stores the data synchronization task corresponding to the second data acquisition request into the second task queue when determining that the second data acquisition request sent to the home server according to the data change signal is not successfully sent.
6. The method of claim 3, wherein if the cloud determines that the data type corresponding to the first data acquisition request is marked as a first identifier, it determines that target data corresponding to the first data acquisition request is not latest data.
7. The method of claim 3, wherein the change data comprises a full amount of data of a data type to which the data change request corresponds.
8. A data synchronization method is applied to a cloud end in an intelligent home system, the cloud end is in communication connection with a home server and a terminal in the intelligent home system respectively, the home server is in communication connection with at least one home device, and the data synchronization method comprises the following steps:
receiving a first data acquisition request sent by a terminal in response to a data acquisition operation, wherein the first data acquisition request comprises a terminal identifier;
and if the target data corresponding to the first data acquisition request is determined to be not the latest data, forwarding the first data acquisition request to the home server so that the home server acquires the target data according to the first data acquisition request and sends the target data to the terminal corresponding to the terminal identifier.
9. The method of claim 8, further comprising:
if the cloud end receives data change signals sent by a plurality of home servers, a second data acquisition request is sent to the home server corresponding to each data change signal by adopting multithreading;
and receiving the change data sent by each household server according to each second data acquisition request.
10. A data synchronization method is applied to a terminal in an intelligent home system, the terminal is in communication connection with a home server and a cloud end in the intelligent home system respectively, the home server is in communication connection with at least one home device, and the data synchronization method comprises the following steps:
responding to data acquisition operation, and sending a first data acquisition request to the cloud end, wherein the first data acquisition request comprises a terminal identifier;
and receiving target data returned by the home server according to the first data acquisition request, wherein the cloud forwards the first data acquisition request to the home service when determining that the target data corresponding to the first data acquisition request sent by the terminal is not the latest data.
11. An electronic device, comprising: a processor, a storage medium and a bus, the storage medium storing machine-readable instructions executable by the processor, the processor and the storage medium communicating via the bus when the electronic device is operating, the processor executing the machine-readable instructions to perform the steps of the data synchronization method according to any one of claims 1 to 10.
12. A computer-readable storage medium, having stored thereon a computer program for performing, when being executed by a processor, the steps of the data synchronization method according to any one of claims 1 to 10.
CN202111658237.5A 2021-12-30 2021-12-30 Data synchronization method and device, electronic equipment and storage medium Pending CN114297306A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111658237.5A CN114297306A (en) 2021-12-30 2021-12-30 Data synchronization method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111658237.5A CN114297306A (en) 2021-12-30 2021-12-30 Data synchronization method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114297306A true CN114297306A (en) 2022-04-08

Family

ID=80973505

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111658237.5A Pending CN114297306A (en) 2021-12-30 2021-12-30 Data synchronization method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114297306A (en)

Similar Documents

Publication Publication Date Title
US10067652B2 (en) Providing access to a cloud based content management system on a mobile device
CN102638586B (en) Sharing method, system and device for application program information
US20160044136A1 (en) Virtual gateway
CN109361525B (en) Method, device, control terminal and medium for restarting distributed deployment of multiple services
US10148739B2 (en) M2M data querying and invoking methods, querying and invoking devices, and system
CN108306796B (en) Intelligent home system, and information processing method and device of intelligent home equipment
CN101460940A (en) Auto-subscribing to syndication feeds using contact lists
CN111711698A (en) Intelligent equipment network access method and device and intelligent equipment control system and method
CN114374602A (en) Master control equipment configuration method and device, cloud server and storage medium
JP2017503371A (en) Method and apparatus for sharing environmental context
CN104868939A (en) Bluetooth-based synchronized method and device between terminals
CN110958287B (en) Operation object data synchronization method, device and system
CN111191094A (en) CEPH storage object searching method and device and storage device
CN111885103B (en) Resource processing method, server, electronic device and storage medium
CN114297306A (en) Data synchronization method and device, electronic equipment and storage medium
CN112051816A (en) Data acquisition system and method
KR101275995B1 (en) Data storing system and data processing method of informational household appliance
CN113839991A (en) Method and device for confirming equipment information, storage medium and electronic device
CN111953722B (en) Synchronization method and device for terminal address book
CN114019821A (en) Smart home control method, device and system
CN115803736A (en) File generation method and device in Internet of things, computer equipment and storage medium
KR101831686B1 (en) Method and apparatus for determinig object change in home network
JP6241532B2 (en) COMMUNICATION SYSTEM, COMMUNICATION DEVICE, CONTROL METHOD, COMMUNICATION METHOD, AND COMPUTER PROGRAM
JP2015045975A (en) Management server, management system, control method and program
JP6036593B2 (en) COMMUNICATION SYSTEM, COMMUNICATION DEVICE, CONTROL METHOD, COMMUNICATION METHOD, AND COMPUTER PROGRAM

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination