Data synchronization method capable of being deployed in OpenHarmony

Through OpenHarmony's distributed soft bus technology and data synchronization model, the protocol fragmentation, real-time and security of data synchronization in the OpenHarmony ecosystem is solved, and efficient and secure data synchronization between devices is achieved to meet industrial control needs.

CN120583100APending Publication Date: 2025-09-02GUIZHOU WUJIANG HYDROPOWER DEV
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510480680.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-17
Publication Date
2025-09-02

AI Technical Summary

Technical Problem

The existing data synchronization solution has protocol fragmentation, insufficient real-time and security defects in the OpenHarmony ecosystem, and cannot meet the real-time scenario needs such as industrial control.

Method used

OpenHarmony's distributed soft bus technology is used to synchronize data, use the data synchronization model to handle data conflicts and merge and update, and combine encryption technology and access control mechanism to ensure data security and consistency.

Benefits of technology

It realizes efficient and secure data synchronization between equipment, meets the real-time needs of industrial control, reduces development difficulties and costs, and supports multiple data types and synchronization strategies.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120583100A_ABST
    Figure CN120583100A_ABST
Patent Text Reader

Abstract

A data synchronization method capable of being deployed in OpenHarmony comprises the steps that data needing to be synchronized are collected from source equipment, and the data at least comprise user preference settings, application states, files and database records; the distributed soft bus technology of OpenHarmony is utilized, and the collected data is transmitted to target equipment through a network; storing the received data in the target equipment, and synchronizing the data according to a pre-constructed data synchronization model; local data is updated in target equipment by processing data conflicts and merging updating operations, and consistency with source equipment is ensured. According to the method, the distributed soft bus technology and the data fragmentation technology of OpenHarmony are utilized, and efficient data synchronization between devices is achieved. Through an encryption technology and an access control mechanism, privacy and security of user data in a synchronization process are ensured. According to the method, simple and easy-to-use APIs and configuration options are provided, and the development difficulty and cost of developers are reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of Internet of Things, and in particular to a data synchronization method that can be deployed in OpenHarmoney. Background Art

[0002] With the rapid development of IoT technology, data synchronization between edge devices has become a key issue. Traditional data synchronization methods often rely on centralized servers, which have problems such as single point failure and network delay. OpenHarmony, as a distributed operating system for all scenarios, provides powerful distributed capabilities for IoT devices. Existing data synchronization solutions face the following technical pain points in the OpenHarmony ecosystem: 1. Protocol fragmentation: Traditional synchronization methods (such as RSync, MQTT) are not compatible with the communication framework of OpenHarmony Distributed Soft Bus (DSoftBus). 2. Insufficient real-time performance: The cross-device data synchronization delay is generally >200ms, which is difficult to meet the real-time scenario requirements such as industrial control (requires <50ms). 3. Security flaws: The existing solution lacks device identity chain verification and is vulnerable to man-in-the-middle attacks. Therefore, there is an urgent need for a data synchronization method that can be deployed in OpenHarmoney to solve existing technical problems. Summary of the Invention

[0003] In view of the above problems, the present invention is proposed to provide a data synchronization method that can be deployed in OpenHarmoney and overcomes the above problems or at least partially solves the above problems.

[0004] In order to solve the above technical problems, the embodiments of the present application disclose the following technical solutions:

[0005] In a first aspect, an embodiment of the present invention discloses a data synchronization method that can be deployed in OpenHarmoney, comprising:

[0006] S100. Collecting data to be synchronized from the source device, the data including at least user preferences, application status, files, and database records;

[0007] S200. Using OpenHarmony's distributed soft bus technology, the collected data is transmitted to the target device via the network;

[0008] S300 stores the received data in the target device and synchronizes the data according to the pre-built data synchronization model;

[0009] S400. Update local data in the target device by handling data conflicts and merging update operations to ensure consistency with the source device.

[0010] Furthermore, in S100, data that needs to be synchronized is collected from the source device. When the data is user preference settings, the specific method includes: collecting through the user preference interface provided by OpenHarmony, obtaining a user preference instance, calling the get method of the instance, obtaining the value of the user preference setting according to the specified key, and caching or processing the obtained value for subsequent synchronization.

[0011] Furthermore, in S100, data that needs to be synchronized is collected from the source device. When the data is the application status, the specific method includes: collecting through the status management mechanism within the application, defining state variables in the application to record various status information of the application; updating these state variables when the application status changes; and reading the values ​​of these state variables when synchronization is required, caching or processing them.

[0012] Furthermore, in S100, data to be synchronized is collected from the source device. When the data is a file, the specific method includes: collecting through the file operation interface, and obtaining the file object using the file operation interface; reading the file content and converting it into a byte array or other transmittable format; caching or processing the file content for subsequent synchronization.

[0013] Furthermore, in S100, data that needs to be synchronized is collected from the source device. When the data is a database record, the specific method includes: collecting through a database query interface, opening a database connection, and obtaining a writable database object; executing an SQL query statement to obtain the database records that need to be synchronized; converting the query results into a transmittable format; and caching or processing the converted data for subsequent synchronization.

[0014] Furthermore, in S200, the distributed soft bus technology of OpenHarmony is used to transmit the collected data to the target device through the network. The specific method includes: according to the API interface provided by OpenHarmony's distributed soft bus, in the source device, the discovery module of the distributed soft bus is used to find and connect to the target device; once the connection is established, the source device uses the transmission module of the distributed soft bus to send the collected data to the target device; during the data transmission process, the source device needs to monitor the transmission results to ensure that the data has been successfully sent to the target device; if the transmission fails, the source device can try to resend the data or take other error handling measures.

[0015] Furthermore, in S300, the method for synchronizing data using the data synchronization model includes:

[0016] Device initialization and synchronization task creation: When each device on the OpenHarmony platform is initialized, a unique device identifier and local data storage path are generated. When data synchronization is required, the device creates a synchronization task through the synchronization manager and marks the source and target devices of the data.

[0017] Data change monitoring and synchronization triggering: When data is changed on the device, the synchronization operation is triggered through the change monitoring mechanism of the local data storage; the data change record will be passed to the target device through the synchronization manager to ensure that the target device receives the data synchronization request;

[0018] Data transmission and synchronization: Use standardized data protocols such as Protobuf or JSON to package data and send the data to the target device through the network transmission module; during the transmission process, use a differential synchronization algorithm to synchronize only the data that has actually changed, thereby improving synchronization efficiency and reducing network bandwidth consumption.

[0019] Furthermore, in S300, the method for synchronizing data by the data synchronization model further includes: detecting and resolving data conflicts; after the target device receives the data, the system compares the data status of the source device and the target device to check whether there is a data conflict; if there is a conflict, the system handles it according to a preset conflict resolution strategy, and the handling method includes at least timestamp priority: using the data with the latest timestamp first;

[0020] Version number management: determine which version of data is correct based on the data version number; user confirmation: in some complex situations, allow users to manually confirm data synchronization.

[0021] Furthermore, in S300, the method for synchronizing data by the data synchronization model also includes: data consistency verification and completion; after the synchronization is completed, the system will perform a consistency verification to ensure that the data on the source device and the target device are completely consistent; after the verification passes, the system will feedback the synchronization success status to the synchronization manager and release related resources.

[0022] In a second aspect, an embodiment of the present invention discloses an electronic device, including:

[0023] one or more processors;

[0024] a memory for storing one or more programs;

[0025] When the one or more programs are executed by the one or more processors, the one or more processors implement the method for automatic slag skimming control of molten iron.

[0026] The beneficial effects of the above technical solutions provided by the embodiments of the present invention include at least:

[0027] The present invention discloses a data synchronization method that can be deployed in OpenHarmony, comprising: collecting data that needs to be synchronized from a source device, the data including at least user preference settings, application status, files, and database records; utilizing OpenHarmony's distributed soft bus technology to transmit the collected data to a target device via a network; storing the received data in the target device, and synchronizing the data according to a pre-built data synchronization model; updating local data in the target device by processing data conflicts and merging update operations to ensure consistency with the source device. The present invention utilizes OpenHarmony's distributed soft bus technology and data sharding technology to achieve efficient data synchronization between devices. The present invention ensures the privacy and security of user data during the synchronization process through encryption technology and access control mechanisms. The present invention provides simple and easy-to-use APIs and configuration options to reduce the development difficulty and cost for developers. The present invention supports the configuration of multiple data types and synchronization strategies to meet the needs of different application scenarios.

[0028] The technical solution of the present invention is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] The accompanying drawings are used to provide a further understanding of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the present invention and do not constitute a limitation of the present invention. In the accompanying drawings:

[0030] Figure 1 This is a flow chart of a data synchronization method that can be deployed in OpenHarmoney in Example 1 of the present invention;

[0031] Figure 2 This is a structural diagram of an electronic device in Example 2 of the present invention. DETAILED DESCRIPTION

[0032] Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. Rather, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.

[0033] In order to solve the problems existing in the prior art, an embodiment of the present invention provides a data synchronization method that can be deployed in OpenHarmoney.

[0034] Example 1

[0035] The present invention discloses a data synchronization method that can be deployed in OpenHarmoney, such as Figure 1 ,include:

[0036] S100. Collecting data to be synchronized from the source device, the data including at least user preferences, application status, files, and database records;

[0037] In S100 of this embodiment, data to be synchronized is collected from the source device. When the data is user preference settings, the specific method includes: collecting the data through the user preference interface provided by OpenHarmony, using the dataPreferences.getPreferences method to obtain a user preference instance, calling the get method of the instance, obtaining the value of the user preference setting according to the specified key, and caching or processing the obtained value for subsequent synchronization.

[0038] In S100 of this embodiment, data to be synchronized is collected from a source device. When the data is an application state, a specific method includes: collecting the data through a state management mechanism within the application, defining state variables in the application to record various state information of the application; updating these state variables when the application state changes; and reading the values ​​of these state variables for caching or processing when synchronization is required.

[0039] In S100 of this embodiment, data to be synchronized is collected from a source device. When the data is a file, the specific method includes: collecting the data through a file operation interface and obtaining a file object using the file operation interface; reading the file content and converting it into a byte array or other transmittable format; caching or processing the file content for subsequent synchronization.

[0040] In S100 of this embodiment, data to be synchronized is collected from a source device. When the data is a database record, the specific method includes: collecting the data through a database query interface, opening a database connection, and obtaining a writable database object; executing an SQL query statement to obtain the database records to be synchronized; converting the query results into a transmittable format; and caching or processing the converted data for subsequent synchronization.

[0041] When collecting data, ensure the uniformity and readability of the data format to ensure correct parsing and processing during synchronization. When collecting and transmitting sensitive data, implement security measures such as encryption to ensure data security. When collecting large amounts of data, consider performance optimization, such as adopting batch collection and asynchronous processing, to improve synchronization efficiency.

[0042] Through the above method, data that needs to be synchronized, such as user preferences, application status, files, and database records, can be collected from the OpenHarmony source device. After being cached or processed, this data can be transmitted to the target device via OpenHarmony's distributed soft bus technology or other communication methods to achieve data synchronization.

[0043] S200. Using OpenHarmony's distributed soft bus technology, the collected data is transmitted to the target device via the network;

[0044] In S200 of this embodiment, the collected data is transmitted to the target device through the network using OpenHarmony's distributed soft bus technology. The specific method includes: according to the API interface provided by OpenHarmony's distributed soft bus, in the source device, the target device is found and connected to through the discovery module of the distributed soft bus; once the connection is established, the source device uses the transmission module of the distributed soft bus to send the collected data to the target device; during the data transmission process, the source device needs to monitor the transmission results to ensure that the data has been successfully sent to the target device; if the transmission fails, the source device can try to resend the data or take other error handling measures.

[0045] S300 stores the received data in the target device and synchronizes the data according to the pre-built data synchronization model;

[0046] In S300 of this embodiment, the method for synchronizing data using the data synchronization model includes:

[0047] Device initialization and synchronization task creation: When each device on the OpenHarmony platform is initialized, a unique device identifier and local data storage path are generated. When data synchronization is required, the device creates a synchronization task through the synchronization manager and marks the source and target devices of the data.

[0048] Data change monitoring and synchronization triggering: When data is changed on the device, the synchronization operation is triggered through the change monitoring mechanism of the local data storage; the data change record will be passed to the target device through the synchronization manager to ensure that the target device receives the data synchronization request;

[0049] Data transmission and synchronization: Use standardized data protocols based on Protobuf or JSON to package data and send the data to the target device through the network transmission module; during the transmission process, use a differential synchronization algorithm to synchronize only the data that has actually changed, so as to improve synchronization efficiency and reduce network bandwidth consumption.

[0050] In S300 of some preferred embodiments, the method for synchronizing data by the data synchronization model also includes: detecting and resolving data conflicts; after the target device receives the data, the system will compare the data status of the source device and the target device to check whether there is a data conflict; if there is a conflict, the system will process it according to a preset conflict resolution strategy, and the processing method includes at least timestamp priority: giving priority to the data with the latest timestamp; version number management: judging which version of the data is correct based on the version number of the data; user confirmation: in some complex cases, allowing the user to manually confirm data synchronization.

[0051] In S300 of some preferred embodiments, the method for synchronizing data by the data synchronization model also includes: data consistency verification and completion; after the synchronization is completed, the system will perform a consistency verification to ensure that the data on the source device and the target device are completely consistent; after the verification passes, the system will feedback the synchronization success status to the synchronization manager and release related resources.

[0052] S400. Update local data on the target device by handling data conflicts and merging updates to ensure consistency with the source device. Specifically, data conflicts are a common problem in distributed systems, especially in multi-device synchronization scenarios. To ensure that the data on the target device remains consistent with the source device, it is necessary to effectively handle data conflicts and merge updates.

[0053] Specifically, conflicts are detected using timestamps, version numbers, or hash values. Appropriate conflict resolution strategies are selected based on data type and business requirements. A merge algorithm is applied to update the target device's data. Data consistency is maintained through bidirectional synchronization and regular validation.

[0054] This embodiment discloses a data synchronization method that can be deployed in OpenHarmoney, including: collecting data that needs to be synchronized from the source device, the data including at least user preference settings, application status, files, and database records; using OpenHarmony's distributed soft bus technology to transmit the collected data to the target device via the network; storing the received data in the target device, and synchronizing the data according to a pre-built data synchronization model; updating the local data in the target device by processing data conflicts and merging update operations to ensure consistency with the source device. The present invention utilizes OpenHarmony's distributed soft bus technology and data sharding technology to achieve efficient data synchronization between devices. The present invention ensures the privacy and security of user data during the synchronization process through encryption technology and access control mechanisms. The present invention provides simple and easy-to-use APIs and configuration options to reduce the development difficulty and cost of developers. The present invention supports the configuration of multiple data types and synchronization strategies to meet the needs of different application scenarios.

[0055] Example 2

[0056] Based on the same inventive concept, an embodiment of the present disclosure further provides an electronic device. Figure 2 FIG. 1 is a schematic diagram of the structure of an electronic device according to an embodiment of the present disclosure. Figure 2 As shown, an embodiment of the present disclosure provides an electronic device comprising: one or more processors 101, a memory 102, and one or more I / O interfaces 103. The memory 102 stores one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors implement any of the optimization methods described in the above embodiments; the one or more I / O interfaces 103 are connected between the processor and the memory and are configured to implement information exchange between the processor and the memory.

[0057] Among them, the processor 101 is a device with data processing capabilities, including but not limited to a central processing unit (CPU); the memory 102 is a device with data storage capabilities, including but not limited to random access memory (RAM, more specifically such as SDRAM, DDR, etc.), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), and flash memory (FLASH); the I / O interface (read-write interface) 103 is connected between the processor 101 and the memory 102, and can realize information interaction between the processor 101 and the memory 102, including but not limited to a data bus (Bus), etc.

[0058] In some embodiments, the processor 101 , the memory 102 , and the I / O interface 103 are connected to each other via a bus 104 , and further connected to other components of the computing device.

[0059] In some embodiments, the one or more processors 101 include a field programmable gate array.

[0060] According to an embodiment of the present disclosure, a computer-readable medium is further provided, wherein a computer program is stored on the computer-readable medium, wherein when the program is executed by a processor, the steps of any optimization method in the above-mentioned embodiment are implemented.

[0061] It should be understood that the specific order or hierarchy of steps in the disclosed processes is an example of an exemplary method. Based on design preferences, it should be understood that the specific order or hierarchy of steps in the process can be rearranged without departing from the scope of the present disclosure. The accompanying method claims present elements of the various steps in an exemplary order and are not intended to be limited to the specific order or hierarchy described.

[0062] In the foregoing detailed description, various features are grouped together in a single embodiment to simplify the disclosure. This method of disclosure should not be interpreted as reflecting an intention that embodiments of the claimed subject matter require more features than are expressly recited in each claim. On the contrary, as reflected in the appended claims, the invention comprises less than all the features of any individual disclosed embodiment. The appended claims are therefore hereby expressly incorporated into the detailed description, with each claim standing on its own as a separate preferred embodiment of the invention.

[0063] Those skilled in the art will also appreciate that the various illustrative logic blocks, modules, circuits, and algorithmic steps described in conjunction with the embodiments herein may be implemented as electronic hardware, computer software, or a combination thereof. In order to clearly illustrate the interchangeability between hardware and software, the various illustrative components, blocks, modules, circuits, and steps described above are generally described around their functions. Whether such functions are implemented as hardware or software depends on the specific application and the design constraints imposed on the entire system. A skilled person may implement the described functions in an adaptable manner for each specific application, but such implementation decisions should not be interpreted as departing from the scope of protection of this disclosure.

[0064] The steps of the methods or algorithms described in conjunction with the embodiments herein may be directly embodied as hardware, software modules executed by a processor, or a combination thereof. The software module may be located in a RAM memory, flash memory, ROM memory, EPROM memory, EEPROM memory, register, hard disk, removable disk, CD-ROM, or any other form of storage medium well known in the art. An exemplary storage medium is connected to the processor so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium may also be an integral part of the processor. The processor and storage medium may be located in an ASIC. The ASIC may be located in a user terminal. Of course, the processor and storage medium may also be present in a user terminal as discrete components.

[0065] For software implementation, the techniques described in this application can be implemented using modules (e.g., procedures, functions, etc.) that perform the functions described in this application. These software codes can be stored in a memory unit and executed by a processor. The memory unit can be implemented within the processor or external to the processor. In the latter case, it is communicatively coupled to the processor via various means, which are well known in the art.

[0066] The foregoing description includes examples of one or more embodiments. Of course, it is not possible to describe all possible combinations of components or methods for the purposes of describing the above embodiments, but one of ordinary skill in the art will recognize that the various embodiments may be further combined and arranged. Therefore, the embodiments described herein are intended to encompass all such changes, modifications and variations that fall within the scope of the appended claims. Furthermore, to the extent the term "comprising" is used in the specification or claims, the term is intended to be encompassed in a manner similar to the term "including," as explained in terms of "including," used as a transitional word in the claims. Furthermore, any use of the term "or" in the specification of the claims is intended to mean a "non-exclusive or."

Claims

1. A data synchronization method that can be deployed in OpenHarmoney, characterized in that: include: S100. Collecting data to be synchronized from the source device, the data including at least user preferences, application status, files, and database records; S200. Using OpenHarmony's distributed soft bus technology, the collected data is transmitted to the target device via the network; S300 stores the received data in the target device and synchronizes the data according to the pre-built data synchronization model; S400. Update local data in the target device by handling data conflicts and merging update operations to ensure consistency with the source device.

2. A data synchronization method deployable in OpenHarmoney as claimed in claim 1, characterized in that: In S100, data that needs to be synchronized is collected from the source device. When the data is user preference settings, the specific method includes: collecting through the user preference interface provided by OpenHarmony, obtaining a user preference instance, calling the get method of the instance, obtaining the value of the user preference setting according to the specified key, and caching or processing the obtained value for subsequent synchronization.

3. A data synchronization method deployable in OpenHarmoney as claimed in claim 1, characterized in that: In S100, data that needs to be synchronized is collected from the source device. When the data is the application status, the specific method includes: collecting through the state management mechanism within the application, defining state variables in the application to record various status information of the application; updating these state variables when the application status changes; and reading the values ​​of these state variables when synchronization is required, caching or processing them.

4. A data synchronization method deployable in OpenHarmoney as claimed in claim 1, characterized in that: In S100, data to be synchronized is collected from the source device. When the data is a file, the specific method includes: collecting through the file operation interface and obtaining the file object using the file operation interface; reading the file content and converting it into a byte array or other transmittable format; caching or processing the file content for subsequent synchronization.

5. A data synchronization method deployable in OpenHarmoney as claimed in claim 1, characterized in that: In S100, data that needs to be synchronized is collected from the source device. When the data is a database record, the specific method includes: collecting through a database query interface, opening a database connection, and obtaining a writable database object; executing an SQL query statement to obtain the database records that need to be synchronized; converting the query results into a transmittable format; and caching or processing the converted data for subsequent synchronization.

6. A data synchronization method deployable in OpenHarmoney as claimed in claim 1, characterized in that: In S200, OpenHarmony's distributed soft bus technology is used to transmit the collected data to the target device through the network. The specific method includes: based on the API interface provided by OpenHarmony's distributed soft bus, the source device uses the discovery module of the distributed soft bus to find and connect to the target device; once the connection is established, the source device uses the transmission module of the distributed soft bus to send the collected data to the target device; during the data transmission process, the source device needs to monitor the transmission results to ensure that the data has been successfully sent to the target device; if the transmission fails, the source device can try to resend the data or take other error handling measures.

7. A data synchronization method deployable in OpenHarmoney as claimed in claim 1, characterized in that: In S300, the method for synchronizing data by the data synchronization model includes: Device initialization and synchronization task creation: When each device on the OpenHarmony platform is initialized, a unique device identifier and local data storage path are generated. When data synchronization is required, the device creates a synchronization task through the synchronization manager and marks the source and target devices of the data. Data change monitoring and synchronization triggering: When data is changed on the device, the synchronization operation is triggered through the change monitoring mechanism of the local data storage; the data change record will be passed to the target device through the synchronization manager to ensure that the target device receives the data synchronization request; Data transmission and synchronization: Use standardized data protocols based on Protobuf or JSON to package data and send the data to the target device through the network transmission module; during the transmission process, use a differential synchronization algorithm to synchronize only the data that has actually changed, so as to improve synchronization efficiency and reduce network bandwidth consumption.

8. A data synchronization method deployable in OpenHarmoney as claimed in claim 1, characterized in that: In S300, the method for synchronizing data by the data synchronization model also includes: detecting and resolving data conflicts; after the target device receives the data, the system will compare the data status of the source device and the target device to check whether there is a data conflict; if there is a conflict, the system will process it according to the preset conflict resolution strategy, and the processing method includes at least timestamp priority: giving priority to the data with the latest timestamp; version number management: judging which version of the data is correct based on the version number of the data; user confirmation: in some complex situations, allowing users to manually confirm data synchronization.

9. A data synchronization method deployable in OpenHarmoney as claimed in claim 1, characterized in that: In S300, the method for synchronizing data by the data synchronization model also includes: data consistency verification and completion; after the synchronization is completed, the system will perform a consistency check to ensure that the data on the source device and the target device are completely consistent; after the verification passes, the system will feedback the synchronization success status to the synchronization manager and release related resources.

10. An electronic device, characterized in that: include: one or more processors; a memory for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement any one of the data synchronization methods described in claims 1-9.

Citation Information

Cited By

  • Remote synchronous control method and system for industrial equipment based on OpenHarmony

    CN121418442A