WO2023241582A1 - Data synchronization method and system, and medium, program product and electronic device - Google Patents

Data synchronization method and system, and medium, program product and electronic device Download PDF

Info

Publication number
WO2023241582A1
WO2023241582A1 PCT/CN2023/099963 CN2023099963W WO2023241582A1 WO 2023241582 A1 WO2023241582 A1 WO 2023241582A1 CN 2023099963 W CN2023099963 W CN 2023099963W WO 2023241582 A1 WO2023241582 A1 WO 2023241582A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
electronic device
group
check code
check
Prior art date
Application number
PCT/CN2023/099963
Other languages
French (fr)
Chinese (zh)
Inventor
田元元
Original Assignee
华为技术有限公司
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 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2023241582A1 publication Critical patent/WO2023241582A1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • H04L9/3236Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials using cryptographic hash functions
    • H04L9/3239Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials using cryptographic hash functions involving non-keyed hash functions, e.g. modification detection codes [MDCs], MD5, SHA or RIPEMD
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W4/00Services specially adapted for wireless communication networks; Facilities therefor
    • H04W4/80Services using short range communication, e.g. near-field communication [NFC], radio-frequency identification [RFID] or low energy communication
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W76/00Connection management
    • H04W76/10Connection setup
    • H04W76/14Direct-mode setup

Definitions

  • This application relates to the field of data processing, and in particular to a data synchronization method, system, medium, program product and electronic device.
  • embodiments of the present application provide a data synchronization method, system, medium, program product and electronic device, which can reduce the amount of data synchronized when data synchronization is not performed for the first time between electronic devices, and is conducive to improving synchronization efficiency and improving user experience. experience.
  • this application provides a data synchronization method, applied to a first electronic device.
  • the method includes: receiving a data synchronization message from a second electronic device, wherein the data synchronization message includes M check codes, and the check code
  • the code is used to identify the data content of the corresponding data packet, and M ⁇ 1; the M check codes are compared with the N check codes of the N data packets stored on the first electronic device to determine different check codes.
  • Check code where N ⁇ 1; based on the determined different check codes, update the N data packets stored on the first electronic device to M data packets identified by the M check codes.
  • the first electronic device when the first electronic device (target electronic device) and the second electronic device (source electronic device) are not performing data synchronization for the first time, the first electronic device can perform data synchronization based on the verification code received from the second electronic device. , it is determined that the first electronic device and the second electronic device include data packets with different data contents (that is, packets corresponding to different check codes, such as the difference data packets below), so that only the included data need to be Synchronizing data in data groups with different contents reduces the amount of data synchronized by the first electronic device from the second electronic device, which is beneficial to improving synchronization efficiency and user experience.
  • M is equal to N, and there is a one-to-one correspondence between the M check codes and the N check codes; and based on the determined different check codes, the first The N data packets stored on the electronic device are updated to M data packets identified by M check codes, including: the first check code exists among the N check codes, and the M check codes match the first check code.
  • the second check code corresponding to the check code is different from the first check code, update the first data packet corresponding to the first check code stored on the first electronic device to be the same as the second check code. The corresponding second data packet.
  • the first electronic device compares the check code of the first data packet in the first electronic device with the check code of the second data packet corresponding to the data packet in the second electronic device. If they are different, then It is explained that the data content in the first data packet and the second data packet are different, and the first electronic device updates the content in the first data packet to the content in the second data packet.
  • the N data packets stored on the first electronic device are updated to M data packets identified by the M check codes, Including: there is a third check code among N check codes, When there is no third check code among the M check codes, delete the third data packet corresponding to the third check code stored on the first electronic device; or there is a fourth check code among the M check codes. Check code, and if the fourth check code does not exist among the N check codes, store the fourth data packet corresponding to the fourth check code on the first electronic device.
  • only packets containing data are stored in the first electronic device and the second electronic device, which can reduce the amount of data stored in the first electronic device and the second electronic device, which is beneficial to saving money on the first electronic device. and storage space for a second electronic device.
  • the check code of the data packet is determined by the message digest of each data in the data packet.
  • the check code of the above data group is determined by the message digest of each data in the data group, including: the check code of the data group is differentiated one by one from the message digest of each data in the data group. Obtained by OR operation.
  • the data group to which each data belongs is determined based on the characters of the preset fields in the data.
  • the group in which each data is located is determined based on the characters of the preset fields of each data.
  • the above preset field includes at least one of the following fields: when the data includes contact information, the preset field includes the contact's phone number; when the data includes text messages
  • the default field includes the number of the recipient or sender of the text message
  • the default field includes the creation time of the memo
  • the default field includes the sending Person or recipient information, where the sender or recipient information includes an email address and/or name
  • the preset field includes the time of sending or receiving the instant message.
  • the above-mentioned preset fields are used to determine the grouping of each data. Since the content of each field is relatively simple and the calculation speed is fast, it is conducive to quickly determining the grouping of each data.
  • the data content in the above data packet includes at least one of the following data: contact information, text messages, memos, emails, and instant messages.
  • the first application or the first service is installed in both the first electronic device and the second electronic device; and the first application or the first service installed in the first electronic device is obtained from The first application or the first service installed in the first electronic device receives the data synchronization message; the first application or the first service in the first electronic device compares the M check codes with the N pieces of data stored on the first electronic device. The grouped N check codes are compared to determine different check codes; the different check codes determined by the first application or the first service in the first electronic device are compared with the N stored on the first electronic device. The data packets are updated to M data packets identified by M check codes.
  • the first electronic device and the second electronic device can implement the data synchronization methods of various embodiments of the present application based on the same first application, or can also implement the data synchronization methods of various embodiments of the present application based on the first service.
  • the present application provides a data synchronization method applied to a second electronic device, which is characterized in that it includes: obtaining P check codes, which are used to identify the data content of the corresponding data packets, P ⁇ 1; Send a data synchronization message to the first electronic device.
  • the data synchronization message includes P check codes, and the P check codes are used to determine the P data packets corresponding to the P check codes. Data packets synchronized to the first electronic device.
  • the second electronic device when the second electronic device synchronizes data to the first electronic device, it may only group data containing different data contents between the first electronic device and the second electronic device (for example, the difference data below). Grouping) for synchronization, reducing the amount of synchronized data, improving synchronization efficiency, and improving user experience.
  • the above method further includes: determining the check code of the data packet based on the message digest of each data stored in the data packet.
  • P check codes are determined based on the message digest of each data in each data packet.
  • the P check codes are obtained by performing XOR operations one by one based on the message digest of each data in each data group.
  • the above preset field includes at least one of the following fields: when the data includes contact information, the preset field includes the contact's phone number; when the data includes text messages
  • the default field includes the number of the recipient or sender of the text message
  • the default field includes the creation time of the memo
  • the default field includes the sending Person or recipient information, where the sender or recipient information includes an email address and/or name
  • the preset field includes the sending or receiving time of the instant message.
  • the data synchronization system further includes a third electronic device, the third electronic device is configured to receive a data synchronization message from the second electronic device and send the data synchronization message to the first electronic device. .
  • the second electronic device may send the data packet and the check code of the data packet to the third electronic device, and the third electronic device may synchronize the data to the first electronic device. Therefore, the third electronic device can perform data synchronization with multiple first electronic devices.
  • the first electronic device and the second electronic device are terminal devices, and the third electronic device is a server.
  • the terminal device includes any one of a mobile phone, a car machine, a wearable device, and a tablet computer.
  • the present application provides a readable storage medium, which stores instructions.
  • the electronic device When the instructions are executed on an electronic device, the electronic device enables the electronic device to implement any one of the above-mentioned first aspect and the above-mentioned second aspect. Data synchronization method.
  • the present application provides an electronic device, which includes: a memory for storing instructions executed by one or more processors of the electronic device; and a processor that is one of the processors of the electronic device, Used to execute instructions stored in the memory to implement any one of the data synchronization methods provided by the above-mentioned first aspect and the above-mentioned second aspect.
  • Figure 4B shows a schematic diagram of group storage of emails according to some embodiments of the present application.
  • Figure 5 shows a schematic flowchart of group storage of data according to some embodiments of the present application.
  • Figure 7B shows a schematic diagram of the contact interface added in the Changlian TM application displayed on the mobile phone 10 according to some embodiments of the present application;
  • Figure 7C shows a schematic diagram of the contact interface details of the Changlian TM application displayed on the mobile phone 10 according to some embodiments of the present application;
  • Figure 7D shows a schematic diagram of the contact modification interface of the Changlian TM application displayed on the mobile phone 10 according to some embodiments of the present application;
  • Figure 8 shows a schematic interactive flow diagram of a data synchronization method according to some embodiments of the present application.
  • Figure 9B shows a schematic diagram of the Bluetooth pairing interface in the drop-down menu bar of the mobile phone 10 according to some embodiments of the present application.
  • Figure 10 shows a schematic diagram of a data synchronization scenario according to some embodiments of the present application.
  • Figure 11 shows an interactive flow diagram of yet another data synchronization method according to some embodiments of the present application.
  • Figure 12A shows a schematic diagram of a vehicle machine 41 performing contact synchronization with the server 30 for the first time according to some embodiments of the present application
  • Figure 12B shows a schematic diagram of the vehicle machine 41 synchronizing contacts with the server 30 again according to some embodiments of the present application;
  • Figure 13 shows a schematic diagram of a scenario for synchronizing memos in a distributed system according to some embodiments of the present application
  • Figure 14 shows a schematic diagram of the software architecture of a mobile phone 10 according to some embodiments of the present application.
  • Figure 15 shows a schematic diagram of coupling the mobile phone 10 to other electronic devices through a distributed soft bus 041 according to some embodiments of the present application
  • the mobile phone 10 can record a log of data synchronization with other electronic devices, and record the last time the mobile phone 10 synchronized data with other electronic devices.
  • the data content that has changed due to the user's modification, deletion, addition, etc. operations, so that only the changed data can be synchronized the next time the data is synchronized with other electronic devices, reducing the amount of synchronized data and thus improving data synchronization. efficiency.
  • this method of synchronizing data requires occupying the storage space of the mobile phone 10 to store the logs synchronized with various electronic devices and the above-mentioned changed data.
  • the data storage structure is complex, and the recorded logs or changed data are cleared. Afterwards, it is still necessary to synchronize all the data stored in the mobile phone 10 to the smart watch 20, which is time-consuming and inefficient, affecting the user experience.
  • the check code of the group can be obtained by XORing the result of X1 and
  • the source electronic device After the source electronic device detects changes in the data in a certain group, for example, the source electronic device responds to the user's maintenance operations (such as adding, deleting, modifying, etc.), adding, deleting, or modifying data in the group.
  • the check code of the group can be updated based on the changed data, so that the check code of the group can correspond to the content of the changed data stored in the group. Therefore, when the target electronic device synchronizes data from the source electronic device, it can obtain the updated check code and determine that the group is a differential group, so as to synchronize the data of the group.
  • the source electronic device when the source electronic device detects that the user modified a piece of data in a certain group, causing the grouping of the piece of data to change to another group, the source electronic device can update the check code of the group to the one before the modification of the piece of data.
  • the message digest obtained includes a 128-bit binary number), Secure Hash Algorithm (SHA) algorithm 1 (by The MD algorithm designed by NIST NSA, for a piece of data, the message digest obtained includes 160-bit binary number), SHA224, SHA256, SHA384, SHA512, etc.
  • SHA Secure Hash Algorithm
  • the following embodiments take the message digest of each piece of data obtained through the MD5 algorithm as an example.
  • the check code of group 01 of the mobile phone 10 changes due to the contact information in the group 01.
  • the user operates the mobile phone 10 to modify, delete or add contact information
  • the check code 01 is changed to the check code.
  • the verification code is 01', so when the smart watch 20 synchronizes the contact information from the mobile phone 10, the verification code of group 01 obtained is the verification code 01', and the verification code of group 01 in the smart watch 20 is the verification code. 01, the two are different, and then group 01 is determined to be the difference group.
  • the smart watch 20 only needs to obtain the data in group 01 from the mobile phone 10 to complete the synchronization of contacts without synchronizing the contacts of the other 99 groups, which improves the synchronization efficiency.
  • the data synchronized by the source electronic device to the target electronic device may be, for example, any data that can be conveniently grouped, such as item-type data.
  • the entry data can be any data stored in items.
  • the entry data can include at least one field, and at least one field in each piece of data includes specific content.
  • the entry data includes but is not limited to contacts, text messages, emails, memos, Instant messaging etc.
  • the contact information includes name, phone number, and work unit
  • the contact information includes three fields, namely name, phone number, and work unit.
  • the fields can all have specific content, or only some of the fields can have specific content.
  • the following introduction takes the synchronized data as entry-type data as an example.
  • a single piece of data in the entry-type data includes at least one field. Therefore, the mobile phone 10 can use any one of the fields as the grouping field of the entry-type data, and determine each piece of data based on at least part of the content of the grouping field of each piece of data.
  • Grouping of data Generally speaking, you can use fields that have specific content for each piece of data as grouping fields or fields that are usually not modified as grouping fields. For example, when the entry data is a contact, the grouping field can be a phone number, name, etc.; when the entry data is a text message, the grouping field can be the number of the recipient or sender; when the entry data is In the case of emails, the grouping field can be the email address, name, etc.
  • FIG. 3A shows a schematic diagram of group storage of contact information according to some embodiments of the present application.
  • the contact information fields at least include a phone number and a name.
  • the mobile phone 10 can determine the grouping of each piece of contact information based on the phone number. For example, the last two digits of the phone number are used as the grouping of each piece of contact information.
  • the contact information stored in the mobile phone 10 is divided into 100 groups (group 00 to group 99).
  • the mobile phone 10 can add a group identifier to each piece of contact information to indicate the group in which each piece of contact information is located, so that each piece of contact information in the mobile phone 10 can be stored in the memory in any order.
  • the mobile phone 10 can determine the group it belongs to according to the group identification of each piece of contact information, and the mobile phone 10 does not need to change the data structure for storing the contact information.
  • the mobile phone 10 can also partition the contact information, that is, store the data of one group in adjacent areas in the memory to improve the access speed of data in the same group.
  • the mobile phone 10 when the mobile phone 10 stores the contact information shown in Figure 3A, it can set 100 storage partitions in the memory, and store the contact information of the same group in the same storage partition, so that the mobile phone 10 can Improve the efficiency of data synchronization when reading data of the same group from memory faster.
  • the mobile phone 10 may not store the contact information in groups first, but only uses the grouping field of the contact information to determine the check codes of group 00 to group 99, so that the mobile phone 10 may not store the contact information in groups. Adjust the data structure of the stored contact information, for example, add a group identifier to each piece of contact information or store the contact information of the same group in an adjacent area in the memory, and only need to maintain the check codes of different groups.
  • the data synchronization method provided by each embodiment of the present application is used to perform data synchronization on a group basis with other electronic devices.
  • FIG. 4B shows a schematic diagram of group storage of emails.
  • the email includes at least two fields: sender/recipient and content.
  • the electronic device uses sender/recipient as the grouping field to determine the grouping of each email, for example, according to the sender or recipient.
  • Each email is divided into 100 groups based on the last two digits of the American Standard Code for Information Interchange (ASCII) corresponding to the first letter of the sender's email address.
  • ASCII American Standard Code for Information Interchange
  • S503 Determine the message digest of each piece of data in each group.
  • the mobile phone 10 can determine the message digest of each piece of data through the aforementioned message digest algorithms such as MD4, MD5, SHA-1, etc., and the message digest can be used to determine the check code of each packet.
  • message digest algorithms such as MD4, MD5, SHA-1, etc.
  • the message digest of the first contact information "123456798LILY" obtained using the MD5 algorithm is a 32-bit hexadecimal number "0FA340B963445F53D9EFC042E39AB3AA” (32-bit hexadecimal number corresponds to (based on a 128-bit binary number), use the MD5 algorithm to obtain the information summary of the 1001st contact information "123457698RALPH” which is a 32-bit hexadecimal number "EF93E986151D6912858BF5BE101E4029".
  • S504 Determine the check code of each group based on the message digest of each piece of data in each group.
  • maintenance operations on entry-type data include but are not limited to adding, deleting, and modifying.
  • Figure 7A shows a schematic diagram of the contact interface of the Changlian TM application displayed on the mobile phone 10.
  • the user can click the "Add" control 70 to enter the option interface shown in Figure 7B, which includes an option menu 71; Contacts can be added by clicking on the "Add Contact” control 711 (i.e., adding a new operation).
  • the mobile phone 10 can detect entry data maintenance operations.
  • the mobile phone 10 can also perform maintenance operations on the entry data. Maintenance operations on entry-based data are detected in other situations, which are not limited here.
  • S603 Determine the target group corresponding to the newly added or deleted target data.
  • the target group can be determined based on the last two digits of the phone number of the new contact information input by the user. For example, assume that the phone number of the new contact is "123684798" , the target group corresponding to the newly added contact information is group 98. For another example, assuming that the contact information deleted by the user is LILY's contact information, referring to Figure 3A, it can be seen that the target group corresponding to LILY's contact information is group 98.
  • the mobile phone 10 determines the message summary of the target data based on the specific content of the user's newly added data or deleted data, and updates the check code of the target group based on the message summary.
  • the message summary of the target data obtained by using the MD5 algorithm is: 2566590C52CB05017DB7A3E3A102C392; for another example, Assuming that the contact information deleted by the user is LILY's contact information, the message digest of the target data obtained using the MD5 algorithm is: 0FA340B963445F53D9EFC042E39AB3AA.
  • the method used by the mobile phone 10 to determine the message digest of the target data in the process of updating the check code of the group is the same as the method used by the mobile phone 10 to calculate the message digest of each piece of data when it first generates the check code of each group of entry-type data stored in the group.
  • the approach should be the same.
  • the mobile phone 10 can perform an XOR operation on the message digest of the target data and the check code of the target group, and use the operation result as a new check code of the target group. For example, when the maintenance operation is to delete LILY's contact information, the mobile phone 10 can perform an XOR operation on the message digest 0FA340B963445F53D9EFC042E39AB3AA of the aforementioned target data and the check code D11EEB639BC9B20AE321AF1CF384F383 of group 98 obtained in the aforementioned step S504 to obtain a new checksum.
  • the mobile phone 10 can also update the check code in other ways, such as XORing the message digest of each piece of data in the target group to recalculate the check code of the target group. Specifically, Refer to the aforementioned step S504, which will not be described again here.
  • S605 Determine the target group corresponding to the target data for modification operation.
  • the mobile phone 10 determines the target group corresponding to the target data for the modification operation based on the group identification of the target data for the modification operation by the user.
  • the mobile phone 10 may determine the target group according to the group identifier of the contact information corresponding to the modification operation.
  • the contact information modified by the user is LILY's contact information. Referring to FIG. 3A , it can be seen that the target group corresponding to LILY's contact information is group 98.
  • the target group may include two groups: one is a group corresponding to the group identifier of the contact information corresponding to the modification operation (hereinafter referred to as the first target group). ), and the other is a group determined based on the modified grouping field (hereinafter referred to as the second target group).
  • the modification operation modifies the phone number in LILY's contact information from 123456798 to 123654720
  • the first target group can be the group ID corresponding to the group 98 in LILY's contact information
  • the second target group It can be group 20 corresponding to the modified phone number 123654720.
  • S606 Determine the message digest of the target data before modification and after modification, and update the check code of the target group based on the message digest of the target data before modification and after modification.
  • the mobile phone 10 determines the message digest of the target data before modification and after modification, and updates the target packet check code based on the message digest of the target data before modification and after modification.
  • the mobile phone 10 can first perform an XOR operation on the message digest of the target data before modification and the check code of the target group, and then perform an XOR operation on the operation result and the target data after modification. Perform XOR operation on the message digest to obtain the new check code of the target group. In this way, for the modification of a piece of data, the mobile phone 10 can update the check code of the target group through two XOR operations, which requires less calculation and fast update speed.
  • the target data is LILY's contact information
  • the target group is the aforementioned group 98
  • LILY's contact information is modified to "123456798135654525LILY" (that is, a new phone number 135654525 is added)
  • the MD5 algorithm can be used to obtain the target data modification
  • the final message digest is 7E327F6E3E117847411E52B2D9B0B3CE.
  • the mobile phone 10 can first perform an XOR operation on the message digest 0FA340B963445F53D9EFC042E39AB3AA before the modification of the target data and the check code D11EEB639BC9B20AE321AF1CF384F383 of the aforementioned group 98 to obtain the operation result EF93E986151D6912858BF5BE101E4029, and then perform the operation
  • the result is XORed with the modified message digest 7E327F6E3E117847411E52B2D9B0B3CE , get the new check code F01F765D9A99AE06AB98C210C9AEF3E7 of the target group.
  • the modification operation can actually be decomposed into a deletion operation in the first target group and a new operation in the second target group, so that the mobile phone 10 can
  • the check code of the first target group is updated to the XOR operation result of the message digest before the target data is modified and the current check code of the first target group, and the check code of the second target group is updated to the message after the target data is modified.
  • the modified message summary of the target data is: the message summary corresponding to "123654720LILY" obtained using the MD5 algorithm: 613AC4F4E14A19583B05EACD3EF51357.
  • Mobile phone 10 can combine the message digest 0FA340B963445F53D9EFC042E39AB3AA before the aforementioned target data modification with the current check code D11EEB639BC9B20AE321AF1CF384F383 of group 98.
  • Mobile phone 10 can also perform an XOR operation on the modified message digest 613AC4F4E14A19583B05EACD3EF51357 of the target data and the current check code 9123674BA490B1E6CB5F45536BC8DEE2 of group 20 to obtain the new check code F019A3BF45DAA8BEF05AAF9E553DCDB5 of group 20.
  • the mobile phone 10 can also update the check code of the target group through other methods, such as performing an XOR operation on the message digests of each piece of data in the target data after the maintenance operation is performed one by one to update.
  • the check code of the target group is not limited here.
  • the smart watch 20 when the smart watch 20 synchronizes contact information from the mobile phone 10 for the first time, it can obtain the verification codes of each group from the mobile phone 10 and then compare the obtained group verification codes with the smart watch 20 Compare the check codes of the corresponding groups in the mobile phone 10 to determine the difference group whose contact information is different from that of the smart watch 20, then obtain the contact information of the difference group from the mobile phone 10, and store the contact information of the difference group In the corresponding group in the smart watch 20 , the check code of the corresponding group is updated to the check code of the difference group in the mobile phone 10 . In this way, the smart watch 20 only needs to synchronize the differentially grouped contact information with the mobile phone 10, thereby improving the synchronization efficiency.
  • FIG. 8 shows a schematic interactive flow diagram of a data synchronization method according to some embodiments of the present application. The process includes the following steps.
  • the mobile phone 10 detects the Bluetooth pairing operation with the smart watch 20 .
  • the data synchronization method in the embodiment of the present application is triggered.
  • the user can trigger the Bluetooth pairing interface 902 shown in Figure 9B by clicking on the Bluetooth control 901 in the drop-down menu bar of the mobile phone 10.
  • the mobile phone 10 detects the user's selection of the control 903 on the smart watch 20. After the click operation, the operation of Bluetooth pairing with the smart watch 20 can be detected.
  • the user can also trigger the Bluetooth pairing instruction with the smart watch 20 through the method provided by the operating system of other mobile phones 10 , which is not limited here.
  • S802 The mobile phone 10 and the smart watch 20 establish a Bluetooth communication connection.
  • the mobile phone 10 and the smart watch 20 establish a Bluetooth communication connection for synchronizing contacts.
  • connection established by the mobile phone 10 and the smart watch for contact synchronization can also be other connections, such as near field communication, wireless local area network, etc.
  • This application describes the connection between the mobile phone 10 and the smart watch 20
  • the communication connection method is not limited.
  • S803 The smart watch 20 sends a contact synchronization request to the mobile phone 10.
  • the smart watch 20 After establishing a Bluetooth communication connection with the mobile phone 10, the smart watch 20 sends a contact synchronization request to the mobile phone 10.
  • the contact synchronization request sent by the smart watch 20 when the smart watch 20 does not store contact information, that is, when the smart watch 20 performs contact synchronization with the mobile phone 10 for the first time, the contact synchronization request sent by the smart watch 20 also contains The identifier of the first synchronization may be included, so that the mobile phone 10 can adopt the synchronization method of the first synchronization according to the identifier.
  • the system service used for data synchronization in the smart watch 20 can initiate a data synchronization request to other electronic devices after establishing a communication connection with other electronic devices.
  • the data synchronization request may also be initiated by an application in the smart watch 20 .
  • the Contacts application may initiate a synchronization request for the contacts in the address book to the mobile phone 10
  • the Changlian TM application may initiate a synchronization request for the contacts in the address book.
  • the mail application initiates the synchronization request for emails
  • the SMS application initiates the synchronization request for text messages
  • the memo application initiates the synchronization request for memos
  • the instant messaging application initiates the synchronization request for instant messaging applications. Messages in the message to perform synchronization requests, etc.
  • the embodiment of this application does not limit the applications or services that initiate data synchronization requests. Certainly.
  • the mobile phone 10 is provided with different calling interfaces for first-time synchronization and non-first-time synchronization, so that other electronic devices can synchronize first-time or non-first-time contact information with the mobile phone 10 through different calling interfaces.
  • the mobile phone 10 can set a full synchronization interface for the first synchronization, so that the smart watch 20 can synchronize all contact information from the mobile phone 10 through the full synchronization interface.
  • the mobile phone 10 can set a group synchronization interface for non-first-time synchronization, so that the smart watch 20 can synchronize at least one group of contact information from the mobile phone 10 through the group synchronization interface.
  • the mobile phone 10 determines that the smart watch 20 is synchronizing contacts with the mobile phone 10 for the first time, the mobile phone 10 sends the group stored contact information to the smart watch 20.
  • the group stored contact information includes the contact information of each group. Check code.
  • the mobile phone 10 can send the contact information stored in groups as shown in the aforementioned FIG. 3A or FIG. 3B to the smart watch 20 .
  • the smart watch 20 stores contact information in groups.
  • the smart watch 20 also stores the received contact information stored in groups, and simultaneously stores the verification code of each group.
  • steps S801 to S805 introduce the technical solution for the smart watch 20 to synchronize contact data from the mobile phone 10 for the first time.
  • the following describes how the smart watch 20 synchronizes contacts with the mobile phone 10 again after the user maintains the contact information in the mobile phone 10.
  • the mobile phone 10 can update the data and check codes of each group according to the contact information maintenance operation.
  • the specific update method please refer to the aforementioned figure 6. Relevant descriptions of the embodiments will not be repeated here.
  • S807 The mobile phone 10 and the smart watch 20 establish a Bluetooth communication connection.
  • the mobile phone 10 and the smart phone 20 establish a Bluetooth communication connection for synchronizing contact information.
  • a Bluetooth communication connection for synchronizing contact information.
  • S808 The smart watch 20 sends a contact synchronization request to the mobile phone 10.
  • the smart watch 20 determines that a communication connection has been established with the mobile phone 10 , the smart watch 20 sends a contact synchronization request to the mobile phone 10 .
  • the smart watch 20 determines the difference group based on the check code of each group in the mobile phone 10 and the verification identification of each group in the smart watch 20.
  • the number of groups in the smart watch 20 is the same as the number of groups in the mobile phone 10 , and there is a one-to-one correspondence between the groups in the smart watch 20 and the groups in the mobile phone 10 .
  • the smart watch 20 After receiving the check codes of each group in the mobile phone 10, the smart watch 20 compares the obtained check codes of each group with the check codes of the corresponding groups in the smart watch 20, and determines the groups with inconsistent check codes. Group differences. For example, referring to the aforementioned FIG. 2B, the smart watch 20 can obtain the check codes corresponding to the group 00 to the group 99 in the mobile phone 10, and then combine the group check codes corresponding to the group 00 to the group 99 in the smart watch 20 with the obtained check codes. After comparison, it is determined that the check code 01 is different from the check code 01', that is, the group 01 in the mobile phone 10 is a differential group.
  • groups that do not include contact information in the mobile phone 10 and the smart watch 20 may not be stored in their respective memories, thereby saving storage space in the mobile phone 10 and the smart watch 20 .
  • packets excluding contact information may not be stored in their respective memories.
  • the number of data packets stored in the smart watch 20 and the mobile phone 10 may be different, that is, the smart watch 20 receives
  • the number of verification codes sent by the mobile phone 10 and the number of verification codes in the smart watch 20 may be different, and there is no one-to-one correspondence. Therefore, the difference groups determined by the smart watch 20 include:
  • the second type of differential grouping is a grouping that does not exist in the mobile phone 10 but exists in the smart watch 20.
  • the smart watch 20 can identify the group corresponding to a certain check code X in the smart watch 20 and does not exist in the received In the case of the group identification corresponding to each check code X, the group corresponding to the check code X is determined to be the second type of difference group. For example, assuming that the smart watch 20 has a packet with a packet ID of 98, but the received packet IDs corresponding to each check code sent by the mobile phone 10 do not have 98, it means that the packet 98 is a second type of difference packet.
  • the third type of differential grouping is a grouping that exists in both the mobile phone 10 and the smart watch 20 but has different verification codes.
  • the smart watch 20 can have a group identification of a group with a verification code Y in the smart watch 20, which is the same as the received verification code.
  • group corresponding to the check code X When the group identifiers of the groups corresponding to the check code X are the same, but the check code X and the check code Y are different, the group corresponding to the check code
  • the group ID of the group corresponding to the check code F019A3BF45DAA8BEF05AAF9E553DCDB5 received by the smart watch 20 is 98
  • the check code of the group with the group ID 98 in the smart watch 20 is D11EEB639BC9B20AE321AF1CF384F383
  • group 98 is the third type of difference group.
  • the number of difference groups determined by the smart watch 20 may be one or more, which is not limited here.
  • the smart watch 20 obtains and stores the contact information and verification codes of each differential group in the mobile phone 10.
  • the smart watch 20 obtains the contact information and verification codes of each differential group from the mobile phone 10 , and stores the obtained contact information and verification codes of the differential groups in the smart watch 20 in the corresponding group. For example, when the smart watch 20 determines that group 01 in the mobile phone 10 is a differential group, the smart watch 20 can send a request to obtain the contact information and verification code of the group 01 to the mobile phone 10. After receiving the request, the mobile phone 10 will group the group. The contact information in 01 and the verification code 01' are sent to the smart watch 20. After receiving the contact information in the group 01 and the verification code 01', the smart watch 20 stores the received contact information in the group 01. , and update the check code of group 01 to check code 01'.
  • the smart watch 20 can obtain the contact information in the differential group from the mobile phone 10 through the above-mentioned group synchronization interface.
  • the smart watch 20 can Add a new group, obtain the contact information in the first type of difference group from the mobile phone 10, and store the obtained contact information in the newly added group; for the second type of difference group, the smart watch 20 can obtain the contact information from the smart watch 10 The contact information in the second type of difference group is deleted from the watch; for the third type of difference group, the smart watch 20 can obtain the contact information of the third type of difference group from the mobile phone 10 and replace the third type of difference with the obtained contact information. Contact information grouped in smart watch 20.
  • the mobile phone 10 and the smart watch 20 do not need to synchronize all the contact information during the contact synchronization process that is not the first time, but only need to synchronize the differentially grouped contact information, which reduces The amount of synchronized data improves the synchronization efficiency.
  • the mobile phone 10 does not need to record synchronization logs with other electronic devices and contact information that has changed since the last synchronization with other electronic devices, improving the user experience.
  • the above embodiments introduce a scenario in which two electronic devices directly perform data synchronization.
  • the following describes a scenario in which two electronic devices perform data synchronization through a third electronic device as an intermediate device.
  • Figure 10 shows a schematic diagram of a data synchronization scenario according to some embodiments of the present application.
  • the same application program (such as Changlian TM application) or service (such as Huawei Cloud Service) is installed in the mobile phone 10 and the machine 41 of the car 40.
  • the electronic device installing the application program or service can use the server 30 for data exchange.
  • the mobile phone 10 stores contact information stored in groups. Synchronizing the contact information in the mobile phone 10 from the server 30 may include the following steps: S11: The mobile phone 10 can store the contact information in groups. and the verification code of each group is uploaded to the server 30; S12: After the vehicle computer 41 is connected to the server 30, the server 30 sends the verification code of each group to the vehicle computer 41; S13: The vehicle computer 41 obtains the verification code of each group.
  • the check code is compared with the check code of the corresponding group in the vehicle machine 41 to determine the difference group, and the group identification of the difference group is sent to the server 30;
  • FIG. 11 shows an interactive flow diagram of yet another data synchronization method according to some embodiments of the present application. As shown in Figure 11, the process includes the following steps.
  • S1101 The mobile phone 10 and the server 30 establish a communication connection.
  • the mobile phone 10 establishes a communication connection with a server through an application or service.
  • the mobile phone 10 can access the Internet through a mobile network or a wireless network, so that applications or services in the mobile phone 10, such as ChanglianTM applications, Huawei CloudTM services, etc., can be connected to the corresponding server 30, so that the mobile phone 10 Data can be exchanged with the server 30.
  • applications or services in the mobile phone 10 such as ChanglianTM applications, Huawei CloudTM services, etc.
  • S1102 The mobile phone 10 uploads the contact information stored in groups and the verification code of each group to the server 30.
  • the contact information stored in groups in the mobile phone and the verification code of each group can be uploaded to the server 30 so that the same user account as the mobile phone 10 can be used to connect to the server 30
  • Other electronic devices can synchronize the contact information in the mobile phone 10 from the server 30 .
  • the car machine 41 can access the Internet through a mobile network, a wireless network, a wired network, etc., so that applications or services in the car machine 41, such as Changlian TM applications, Huawei Cloud TM services, etc., can be connected to the corresponding
  • the server 30 allows the vehicle machine 41 to exchange data with the server 30.
  • S1104 The vehicle machine 41 sends a data synchronization request to the server 30.
  • the vehicle engine 41 After establishing a communication connection with the server 30, the vehicle engine 41 sends a data synchronization request to the server 30.
  • the vehicle engine 41 when it sends a data synchronization request to the server 30 for the first time, it may include an identification of the first data synchronization, so that the server 30 can respond to the data synchronization request in a corresponding manner according to the identification.
  • the synchronization of contact information in this embodiment is just an example.
  • the data synchronization requests sent may be different, and the data that needs to be synchronized may also be different.
  • the server 30 is provided with different calling interfaces for first synchronization and non-first synchronization, so as to This facilitates other electronic devices to synchronize first-time or non-first-time contact information with the server 30 through different calling interfaces.
  • the server 30 can set a full synchronization interface for the first synchronization, so that the vehicle machine 41 can synchronize all contact information from the server 30 through the full synchronization interface.
  • the server 30 may set a group synchronization interface for non-first-time synchronization, so that the vehicle 41 can synchronize the contact information of at least one group from the server 30 through the group synchronization interface.
  • S1105 In response to the data synchronization request, the server 30 sends the contact information stored in groups and the check code of each group to the vehicle machine 41.
  • the server 30 determines that it is the first time that the vehicle computer 41 synchronizes contact information with the server 30 , the server 30 sends the grouped stored contact information and the check code of each group to the vehicle computer 41 .
  • the server 30 may determine that the vehicle machine 41 is synchronizing contact information with the server 30 for the first time, and send the grouped stored contact information and the calibration of each group to the vehicle machine 41. Code verification.
  • the vehicle machine 41 stores the received contact information in groups and the check codes of each group.
  • the vehicle machine 41 receives the grouped stored contact information and the verification codes of each group sent by the server 30 , and stores the contact information and the verification codes of each group in the vehicle machine 41 .
  • the contact information in each group stored in the vehicle machine 41 is the same as the check code of each group.
  • group 98 including two pieces of contact information, namely LILY's contact information and RALPH's contact information
  • the corresponding check code 98 of group 98 is D11EEB639BC9B20AE321AF1CF384F38.
  • the aforementioned steps S1101 to S1106 introduce the technical solution for the vehicle machine 41 to synchronize the contact information in the mobile phone 10 for the first time.
  • the technical solution for the mobile phone 10 to maintain the contact information is introduced below.
  • S1107 The mobile phone 10 updates the contact information and verification code of the corresponding group according to the data maintenance operation.
  • the mobile phone 10 can update the contact information and verification code of the corresponding group according to the data maintenance operation.
  • S1108 The mobile phone 10 uploads the data in the group corresponding to the data maintenance operation and the verification code to the server 30.
  • the mobile phone 10 can upload the data and verification code in the group corresponding to the data maintenance operation to the server 30 so as to use the same method as the mobile phone 10
  • Other electronic devices connected to the server 30 with the user account can be synchronized in time.
  • the mobile phone 10 can update the data and verification code in the group corresponding to the data maintenance operation.
  • the above goes to server 30.
  • the mobile phone 10 may record the data maintenance operation and update the contact information and verification code of the corresponding group. Verify the code, and after the mobile phone 10 is connected to the server 30, the recorded data maintenance operation updates the contact information of the corresponding group and the verification code is uploaded to the server 30.
  • S1109 The server 30 updates the data stored in the group.
  • the server 30 After receiving the data and check code in the group corresponding to the data maintenance operation uploaded by the mobile phone 10, the server 30 updates the data and check code of the group to the corresponding group.
  • steps S1107 to S1109 introduce the technical solution for the mobile phone 10 to synchronize the data to the server 30 after the user maintains the contact information.
  • the following introduces the technical solution for the mobile phone 41 to synchronize the contact information from the server 30 not for the first time.
  • the vehicle machine 41 sends a data synchronization request to the server 30.
  • the vehicle engine 41 may send a data synchronization request to the server 30.
  • the vehicle computer 41 when the vehicle computer 41 is not synchronizing data with the server 30 for the first time, the data synchronization request sent by the vehicle computer 41 The first synchronization identifier is not included in the request.
  • the method of establishing a communication connection between the vehicle computer 41 and the server 30 can be described with reference to the method of establishing a communication connection between the vehicle computer 41 and the server 30 in step S1103, and will not be described again here.
  • S1111 The server 30 responds to the data synchronization request and sends the check code of each group to the vehicle machine 41.
  • the server 30 After the server 30 receives the data synchronization request sent by the vehicle machine 41 and determines that it is not the first time that the vehicle machine 41 performs data synchronization with the server 30, it sends the verification of each packet stored in the server 30 to the vehicle machine 41. code.
  • the vehicle computer 41 determines the difference group based on the check code of each group in the vehicle computer 41 and the verification identification of each group in the server 30 .
  • the vehicle machine 41 After receiving the check code of each group in the server 30, the vehicle machine 41 compares the check code of each group with the check code of the corresponding group in the vehicle machine 41 to determine the difference between the different check codes. Group.
  • the contact information obtained by the vehicle machine 41 in step S1106 is the contact information shown in FIG. 3A , where the group 98 in the vehicle machine 41 includes two pieces of contact information, namely LILY and RALPH.
  • the contact information, the corresponding check code 98 is D11EEB639BC9B20AE321AF1CF384F38.
  • the user added KATE's contact information through the mobile phone 11. Therefore, among the contact information stored by the mobile phone 10 and the server 30, the group 98 includes three pieces of contact information, namely LILY, RALPH and KATE.
  • the contact information, the corresponding check code 98 is D3488EF35EE50808184EE10752863011.
  • the vehicle computer 41 receives the check code 98 corresponding to the group 98 sent by the server 30 (i.e., 98D3488EF35EE50808184EE10752863011), it compares it with the corresponding check code 98 (i.e., D11EEB639BC9B20AE321AF1CF384F38) in the vehicle computer 41, and determines that the check code 98' is consistent with the check code 98.
  • the check codes 98 are different, thereby determining that the packet 98 in the server 30 is a differential packet.
  • the vehicle machine 41 obtains and stores the contact information and verification code of each differential group in the server 30.
  • the vehicle machine 41 obtains and stores the contact information of the differential group and the check code of the differential group from the server 30 according to the group identifier of the differential group.
  • the car machine 41 can obtain the contact information of LILY, RALPH and KATE from the server 30 , store the obtained contact information in the group 98 of the car machine 41 , and then add the check code of the group 98 Updated to D3488EF35EE50808184EE10752863011.
  • the vehicle machine 41 can obtain the contact information in the differential group from the server 30 through the above-mentioned group synchronization interface.
  • the car machine 41 in the process of synchronizing the contact information in the mobile phone 10 from the server 30, the car machine 41 does not need to synchronize all the contact information every time, but only needs to synchronize the contact information in the differential group. , reducing the amount of synchronized data and improving synchronization efficiency, and the vehicle computer 41 or the server 30 only needs to maintain the check code of each group without any other additional overhead, which improves the user experience.
  • entry data as contact information in the above embodiments
  • the technical solution of the above embodiments is also applicable to the scenario of synchronizing any other type of entry data. , such as text messages, memos, emails, messages from instant messaging applications, etc., which are not limited here.
  • FIG. 13 shows a schematic diagram of a scenario for synchronizing memos in a distributed system according to some embodiments of the present application.
  • the distributed system includes the master device mobile phone 10, the slave devices smart watch 20, tablet computer 50 and smart phone 10.
  • the TV 60 and the mobile phone 10 establish communication connections with other slave devices through the distributed soft bus, and the mobile phone 10, the smart watch 20, the tablet computer 50, and the smart TV 60 are all installed with memo applications or services.
  • the memo information is stored in groups in the mobile phone 10. For the grouping fields of each piece of memo information, please refer to the related description of FIG. 4A.
  • synchronizing memo information from the mobile phone 10 by the smart watch 20, the tablet computer 50, and the smart TV 60 may include the following steps: S131: The memo application or service installed in the smart watch 20/tablet computer 50/smart TV 60 detects that After establishing a communication connection with the mobile phone 10, the verification code of each group in the mobile phone 10 is obtained through the distributed soft bus; S132: The memo application or service installed in the smart watch 20/tablet computer 50/smart TV 60 will obtain the group identification and The check codes in the corresponding groups are compared to determine the difference group corresponding to each device. For example, the smart watch 20 can determine the difference group 1, the tablet computer 50 can determine the difference group 2, and the smart TV 60 can determine the difference group. 3.
  • the smart watch 20 can send the group identification of the difference group 1, the tablet computer 50 can send the group identification of the difference group 2, and the smart TV 3 can send the difference group 3.
  • the verification code is sent to each device, so that the memo application or service installed in each device can update the memo information in each device based on the received differentially grouped memo information and verification code, thereby realizing synchronization of memo information in the distributed system.
  • the distributed soft bus is a technology provided by the operating system of the electronic device to couple multiple electronic devices through the same or different communication methods. The details will be introduced when the software architecture of the electronic device is introduced below. This will not be described in detail.
  • the way in which the smart watch 20, the tablet computer 50, and the smart TV 60 determine the differential grouping can refer to the differential grouping method of the smart watch 20 and the car machine 41 in the aforementioned embodiments, and will not be described again here.
  • the mobile phone 10 can quickly synchronize data with other electronic devices in the distributed system, because only the data in the differential grouping need to be synchronized. Data is synchronized, reducing the amount of synchronized data and improving synchronization efficiency.
  • the operating system used by the above-mentioned electronic devices such as the mobile phone 10 can be one of Android TM , iOS TM (Input Output System), Harmony OS, etc., and is not limited here.
  • the following uses Hongmeng operating system as an example to introduce the software architecture of Mobile Phone 10.
  • Figure 14 shows a schematic diagram of the software architecture of a mobile phone 10 according to some embodiments of the present application.
  • the software architecture of mobile phone 10 mainly includes:
  • the application layer 02 may include system applications 021 and extension applications 022 (or third-party applications).
  • the system application 021 can include desktop memo 0211, settings, camera, text messages, emails, etc.
  • the extended application 022 can include Changlian TM 0221, other instant messaging applications (such as WeChat TM , QQ TM , etc.) and other applications.
  • the data synchronization method provided by the embodiment of the present application can be applied to various applications in the application layer 02.
  • the instructions of the data synchronization method are embedded in the memo 0211 or Changlian TM 0221, so that the memo 0211 can pass
  • the data synchronization method provided by this application is used to synchronize memos with other electronic devices.
  • ChanglianTM 0221 can synchronize contact information or messages with other electronic devices through the data synchronization method provided by the embodiment of this application.
  • the framework layer 03 provides a multi-language framework for the application layer, including an interface (User Interface, UI) framework 031, a user program framework 032, a capability framework 033, etc.
  • UI framework 031 includes window manager, content provider, view system, phone manager, resource manager, notification manager, etc., which will not be described in detail here.
  • User program frame 032 and capability frame 033 may be application Provide the capabilities of various capability components required by the application, such as computing power (which can include CPU computing power, Graphics Processing Unit (GPU) computing power, Image Signal Processor (ISP) computing power, etc.), Sound pickup capabilities (can include microphone pickup capabilities, speech recognition capabilities, etc.), device security capabilities (can include trusted operating environment security levels, etc.), display capabilities (can include screen resolution, screen size, etc.), Playback capabilities (including amplification capabilities, stereo effect capabilities, etc.), and storage capabilities (which may include device memory capabilities, random access memory (RAM) capabilities, etc.) are not limited here.
  • computing power which can include CPU computing power, Graphics Processing Unit (GPU) computing power, Image Signal Processor (ISP) computing power, etc.
  • Sound pickup capabilities can include microphone pickup capabilities, speech recognition capabilities, etc.
  • device security capabilities can include trusted operating environment security levels, etc.
  • display capabilities can include screen resolution, screen size, etc.
  • Playback capabilities including amplification capabilities, stereo effect capabilities, etc.
  • storage capabilities
  • the system service layer 04 is the core of the mobile phone 10 software system and can provide services to the applications of the application layer 02 through the framework layer 03.
  • System service layer 04 includes distributed soft bus 041, distributed data management module 042, data synchronization service 043, etc. in:
  • the distributed soft bus 041 is used to couple the mobile phone 10 with other electronic devices to form a distributed system.
  • FIG. 15 shows a schematic diagram of coupling the mobile phone 10 to other electronic devices through a distributed soft bus 041 according to some embodiments of the present application.
  • the mobile phone 10, the smart watch 20, the tablet 50, and the smart TV 60 are coupled through a distributed soft bus 041.
  • the distributed soft bus 041 includes a bus hub 0411, a task and data bus 0412, a device information 0413, and a basic Communication 0414 etc. in:
  • the bus hub 0411 is used to parse commands issued by the mobile phone 10 application layer 02, discover and connect devices, etc., including data and computing center, decision-making center, interconnection management center, etc.
  • the bus hub 0411 can be used to discover electronic devices that have the same application or service (such as memo) installed on the mobile phone 10;
  • the task and data bus 0412 is used for transferring tasks and data between the mobile phone 10 and other electronic devices.
  • the task and data bus 0412 can be used to transmit the check code of each group, the identification of the difference group, the memo information of the difference group, the check code of the difference group, etc.;
  • the device information 0413 is used to obtain and manage information about the mobile phone 10 and other electronic devices.
  • the device information module 0413 can be used to obtain the device identification of the electronic device that sends the differential packet to the mobile phone 10;
  • Basic communication 0414 is used to establish communication connections between the mobile phone 10 and other electronic devices through wired and/or wireless methods such as wireless, Bluetooth, near field communication, and local area networks, and shields protocol differences between electronic devices through protocol stacks and software and hardware collaboration.
  • Distributed data management 042 is based on distributed soft bus to realize distributed management of application data and user data.
  • the mobile phone 10 can send the differentially grouped memo information to the corresponding electronic device through the distributed data management 042 .
  • the data synchronization service 043 is used to synchronize data according to the data synchronization method provided by the embodiment of this application. For example, corresponding to an application program that does not embed the instructions of the data synchronization method provided by the embodiment of the present application, the entry-type data in the application program can be stored in groups through the data synchronization service 043, and the data synchronization service 043 and other electronic devices can be used to perform data synchronization.
  • Kernel layer 05 includes kernel subsystem 051 and driver subsystem 052. Kernel subsystem 051 provides basic kernel capabilities to the upper layer by shielding multi-core differences, including process/thread management, memory management, file system, network management, and peripheral management.
  • the driver subsystem 052 includes a hardware driver framework, which can provide unified peripheral access capabilities and management framework for the mobile phone 10 .
  • the software architecture of the mobile phone 10 shown in FIG. 14 and the connection method between the mobile phone 10 and other electronic devices shown in FIG. 15 are just examples. In other embodiments, the mobile phone 10 can also adopt different methods.
  • the above-mentioned other software architectures in Figure 14, or the connection with other electronic devices through other connection methods different from that shown in Figure 15 to form a distributed system, are not limited by the embodiments of this application.
  • each electronic device in the embodiment of the present application may adopt the same or similar software architecture as the mobile phone 10 , or may adopt a different software architecture, which is not limited here.
  • the technical solution of the present application is only an example.
  • the technical solution of the embodiment of the present application can be applied to any electronic device that can exchange data with other electronic devices, including but not limited to laptop computers, smart TVs, Smart speakers, tablet computers, servers, wearable devices (such as smart watches, smart bracelets, smart glasses, etc.), head-mounted displays, mobile email devices, portable game consoles, portable music players, reader devices, etc.
  • the application examples are not limiting.
  • the following takes the hardware structure of the mobile phone 10 as an example to describe the structure of the electronic device applicable to the embodiments of the present application.
  • FIG. 16 shows a schematic structural diagram of a mobile phone 10 according to some embodiments of the present application.
  • the mobile phone 10 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, and a battery 142.
  • SIM subscriber identification module
  • the sensor module 180 may include a pressure sensor 180A, a gyro sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, and ambient light. Sensor 180L, bone conduction sensor 180M, etc.
  • the processor 110 may include one or more processing units, such as a central processing unit (Central Processing Unit, CPU), a graphics processor (Graphics Processing Unit, GPU), a digital signal processor (Digital Signal Processor, DSP), Processing modules or processing circuits such as microprocessors (Micro-programmed Control Unit, MCU), artificial intelligence (Artificial Intelligence, AI) processors or programmable logic devices (Field Programmable Gate Array, FPGA).
  • processing units can be independent devices or integrated in one or more processors.
  • the processor 110 can be used for instructions of the data synchronization method provided by the embodiments of the present application.
  • processor 110 may include one or more interfaces.
  • Interfaces can include integrated circuit built-in audio (inter-integrated circuit sound, I2S) interface, pulse code modulation (PCM) interface, serial peripheral interface (Serial Peripheral Interface, SPI), universal asynchronous receiver and transmitter (universal asynchronous receiver/transmitter (UART) interface, mobile industry processor interface (MIPI), general-purpose input/output (GPIO) interface, subscriber identity module (SIM) interface, and/or universal serial bus (USB) interface, etc.
  • I2S integrated circuit sound
  • PCM pulse code modulation
  • SPI serial Peripheral Interface
  • SPI serial Peripheral Interface
  • UART universal asynchronous receiver and transmitter
  • MIPI mobile industry processor interface
  • MIPI general-purpose input/output
  • SIM subscriber identity module
  • USB universal serial bus
  • the I2S interface can be used for audio communication.
  • processor 110 may include multiple sets of I2S buses.
  • the processor 110 can be coupled with the audio module 170 through the I2S bus to implement communication between the processor 110 and the audio module 170 .
  • the audio module 170 can transmit audio signals to the wireless communication module 160 through the I2S interface to implement the function of answering calls through a Bluetooth headset.
  • the PCM interface can also be used for audio communications to sample, quantize and encode analog signals.
  • the audio module 170 and the wireless communication module 160 may be coupled through a PCM bus interface.
  • the audio module 170 can also transmit audio signals to the wireless communication module 160 through the PCM interface to implement the function of answering calls through a Bluetooth headset. Both the I2S interface and the PCM interface can be used for audio communication.
  • the UART interface is a universal serial data bus used for asynchronous communication.
  • the bus can be a bidirectional communication bus. It converts the data to be transmitted between serial communication and parallel communication.
  • a UART interface is generally used to connect the processor 110 and the wireless communication module 160 .
  • the processor 110 communicates with the Bluetooth module in the wireless communication module 160 through the UART interface to implement the Bluetooth function, such as establishing a communication connection with other electronic devices through Bluetooth to send calibration data of each group to other electronic devices through Bluetooth. Code verification, data of each group, obtaining data synchronization requests through Bluetooth, receiving abnormal packets, etc.
  • the MIPI interface can be used to connect the processor 110 with peripheral devices such as the display screen 194 and the camera 193 .
  • MIPI interface includes camera string serial interface (camera serial interface, CSI), display serial interface (display serial interface, DSI), etc.
  • the processor 110 and the camera 193 communicate through the CSI interface to implement the shooting function of the mobile phone 10 .
  • the processor 110 and the display screen 194 communicate through the DSI interface to realize the display function of the mobile phone 10 .
  • the GPIO interface can be configured through software.
  • the GPIO interface can be configured as a control signal or as a data signal.
  • the GPIO interface can be used to connect the processor 110 with the camera 193, display screen 194, wireless communication module 160, audio module 170, sensor module 180, etc.
  • the GPIO interface can also be configured as an I2C interface, I2S interface, UART interface, MIPI interface, etc.
  • the external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the mobile phone 10 .
  • the external memory card communicates with the processor 110 through the external memory interface 120 to implement the data storage function. For example, store classified entry-type data such as contacts, text messages, memos, emails, etc. in an external memory card.
  • Internal memory 121 may be used to store computer executable program code, which includes instructions.
  • Internal memory 121 may include program storage areas and data storage areas.
  • the program storage area can store the operating system, at least one application program required for the function (such as the aforementioned ChanglianTM application, memo application, contact application, SMS application, email application), etc.
  • the data storage area can store data created during the use of the mobile phone 10, such as various entry-type data stored in groups (such as contacts, text messages, memos, emails, etc.), check codes of each group, and so on.
  • the internal memory 121 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, universal flash storage (UFS), etc.
  • the processor 110 executes various functional applications of the mobile phone 10 by executing instructions stored in the internal memory 121 and/or instructions stored in a memory provided in the processor 110 .
  • the USB interface 130 is an interface that complies with the USB standard specification, and may be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc.
  • the USB interface 130 can be used to connect a charger to charge the mobile phone 10, and can also be used to transmit data between the mobile phone 10 and peripheral devices. It can also be used to connect headphones to play audio through them. This interface can also be used to connect other electronic devices, such as AR devices, etc.
  • the charging management module 140 is used to receive charging input from the charger. While the charging management module 140 charges the battery 142, it can also provide power to the mobile phone 10 through the power management module 141.
  • the power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110.
  • the power management module 141 receives input from the battery 142 and/or the charging management module 140, and supplies power to the processor 110, the internal memory 121, the display screen 194, the camera 193, the wireless communication module 160, and the like.
  • the wireless communication function of the mobile phone 10 can be realized through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.
  • Antenna 1 and Antenna 2 are used to transmit and receive electromagnetic wave signals.
  • the mobile communication module 150 can provide wireless communication solutions including 2G/3G/4G/5G applied on the mobile phone 10 .
  • the mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (LNA), etc.
  • the mobile communication module 150 can receive electromagnetic waves through the antenna 1, perform filtering, amplification and other processing on the received electromagnetic waves, and transmit them to the modem processor for demodulation.
  • the mobile communication module 150 can also amplify the signal modulated by the modem processor and convert it into electromagnetic waves through the antenna 1 for radiation.
  • at least part of the functional modules of the mobile communication module 150 may be disposed in the processor 110 .
  • at least part of the functional modules of the mobile communication module 150 and at least part of the modules of the processor 110 may be provided in the same device.
  • the wireless communication module 160 can provide applications on the mobile phone 10 including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) network), Bluetooth (bluetooth, BT), and global navigation satellite system. (global navigation satellite system, GNSS), frequency modulation (FM), NFC, infrared technology (infrared, IR) and other wireless communication solutions.
  • WLAN wireless local area networks
  • BT Bluetooth
  • GNSS global navigation satellite system
  • FM frequency modulation
  • NFC infrared technology
  • IR infrared technology
  • the wireless communication module 160 may be one or more devices integrating at least one communication processing module.
  • the wireless communication module 160 receives electromagnetic waves through the antenna 2, frequency modulates and filters the electromagnetic wave signals, and converts the processed The signal is sent to processor 110.
  • the wireless communication module 160 can also receive the signal to be sent from the processor 110, frequency modulate it, amplify it, and convert it into electromagnetic waves through the antenna 2 for radiation.
  • the mobile phone 10 can use the mobile communication module 150 or the wireless communication solution provided by the mobile communication module to establish a communication connection with other electronic devices, and use the data synchronization method provided by various embodiments of the present application based on the established communication connection. Data synchronization with other electronic devices.
  • the mobile phone 10 can implement audio functions through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone interface 170D, and the application processor. Such as music playback, recording, etc.
  • the audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals. Audio module 170 may also be used to encode and decode audio signals.
  • Speaker 170A also called “speaker” is used to convert audio electrical signals into sound signals.
  • Receiver 170B also called “earpiece” is used to convert audio electrical signals into sound signals.
  • Microphone 170C also called “microphone” or “microphone”, is used to convert sound signals into electrical signals.
  • the headphone interface 170D is used to connect wired headphones.
  • the pressure sensor 180A is used to sense pressure signals and can convert the pressure signals into electrical signals.
  • pressure sensor 180A may be disposed on display screen 194 .
  • pressure sensors 180A such as resistive pressure sensors, inductive pressure sensors, capacitive pressure sensors, etc.
  • a capacitive pressure sensor may include at least two parallel plates of conductive material.
  • the mobile phone 10 determines the intensity of the pressure based on changes in capacitance.
  • the mobile phone 10 detects the intensity of the touch operation according to the pressure sensor 180A.
  • the mobile phone 10 can also calculate the touch position based on the detection signal of the pressure sensor 180A.
  • the acceleration sensor 180E can detect the acceleration of the mobile phone 10 in various directions (generally three axes). When the mobile phone 10 is stationary, the magnitude and direction of gravity can be detected. It can also be used to identify the posture of electronic devices and be used in horizontal and vertical screen switching, pedometer and other applications.
  • the ambient light sensor 180L is used to sense ambient light brightness.
  • the mobile phone 10 can adaptively adjust the brightness of the display screen 194 according to the perceived ambient light brightness.
  • the ambient light sensor 180L can also be used to automatically adjust the white balance when taking pictures.
  • the ambient light sensor 180L can also cooperate with the proximity light sensor 180G to detect whether the mobile phone 10 is in the pocket to prevent accidental touching.
  • Fingerprint sensor 180H is used to collect fingerprints. Mobile phone 10 can use the collected fingerprint characteristics to achieve fingerprint unlocking, access to application locks, fingerprint photography, fingerprint answering incoming calls, etc.
  • Touch sensor 180K also known as "touch device”.
  • the touch sensor 180K can be disposed on the display screen 194.
  • the touch sensor 180K and the display screen 194 form a touch screen, which is also called a "touch screen”.
  • the touch sensor 180K is used to detect a touch operation on or near the touch sensor 180K.
  • the touch sensor can pass the detected touch operation to the application processor to determine the touch event type.
  • Visual output related to the touch operation may be provided through display screen 194 .
  • the touch sensor 180K may also be disposed on the surface of the mobile phone 10 in a position different from that of the display screen 194 .
  • Bone conduction sensor 180M can acquire vibration signals.
  • the bone conduction sensor 180M can acquire the vibration signal of the vibrating bone mass of the human body's vocal part.
  • the bone conduction sensor 180M can also contact the human body's pulse and receive blood pressure beating signals.
  • the buttons 190 include a power button, a volume button, etc.
  • Key 190 may be a mechanical key. It can also be a touch button.
  • the mobile phone 10 can receive key input and generate key signal input related to user settings and function control of the mobile phone 10 .
  • the motor 191 can generate vibration prompts.
  • the indicator 192 may be an indicator light, which may be used to indicate charging status, power changes, or may be used to indicate messages, missed calls, notifications, etc.
  • Camera 193 is used to capture still images or video.
  • the object passes through the lens to produce an optical image that is projected onto the photosensitive element.
  • the photosensitive element can It is a charge coupled device (CCD) or complementary metal-oxide-semiconductor (CMOS) phototransistor.
  • CCD charge coupled device
  • CMOS complementary metal-oxide-semiconductor
  • the photosensitive element converts the optical signal into an electrical signal, and then passes the electrical signal to the ISP to convert it into a digital image signal.
  • ISP outputs digital image signals to DSP for processing.
  • DSP converts digital image signals into standard RGB, YUV and other format image signals.
  • the mobile phone 10 may include 1 or N cameras 193, where N is a positive integer greater than 1.
  • the display screen 194 is used to display images, videos, etc.
  • Display 194 includes a display panel.
  • the display panel can use a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active matrix organic light emitting diode or an active matrix organic light emitting diode (active-matrix organic light emitting diode).
  • LED organic light-emitting diode
  • AMOLED organic light-emitting diode
  • FLED flexible light-emitting diode
  • Mini-LED Micro-LED, Micro-OLED, quantum dot light-emitting diode (QLED), etc.
  • the mobile phone 10 may include 1 or N display screens 194, where N is a positive integer greater than 1.
  • the mobile phone 10 can implement display functions through the GPU, the display screen 194, and the application processor.
  • the GPU is an image processing microprocessor and is connected to the display screen 194 and the application processor. GPUs are used to perform mathematical and geometric calculations for graphics rendering.
  • Processor 110 may include one or more GPUs that execute program instructions to generate or alter display information.
  • the SIM card interface 195 is used to connect a SIM card.
  • the structure of the mobile phone 10 shown in the embodiment of the present application does not constitute a specific limitation on the mobile phone 10 .
  • the mobile phone 10 may include more or less components than shown in the figures, or some components may be combined, some components may be separated, or some components may be arranged differently.
  • the components illustrated may be implemented in hardware, software, or a combination of software and hardware.
  • the electronic device to which the data synchronization method provided by the embodiments of the present application is applicable may have the same or similar structure as the mobile phone 10 , and may also include more or fewer modules than the mobile phone 10 , which is not limited here.
  • Embodiments of the mechanisms disclosed in this application may be implemented in hardware, software, firmware, or a combination of these implementation methods.
  • Embodiments of the present application may be implemented as a computer program or program code executing on a programmable system including at least one processor, a storage system (including volatile and non-volatile memory and/or storage elements) , at least one input device and at least one output device.
  • Program code may be applied to input instructions to perform the functions described herein and to generate output information.
  • Output information can be applied to one or more output devices in a known manner.
  • a processing system includes any system having a processor such as, for example, a digital signal processor (DSP), a microcontroller, an application specific integrated circuit (ASIC), or a microprocessor.
  • DSP digital signal processor
  • ASIC application specific integrated circuit
  • Program code may be implemented in a high-level procedural language or an object-oriented programming language to communicate with the processing system.
  • assembly language or machine language can also be used to implement program code.
  • the mechanisms described in this application are not limited to the scope of any particular programming language. In either case, the language may be a compiled or interpreted language.
  • the disclosed embodiments may be implemented in hardware, firmware, software, or any combination thereof.
  • the disclosed embodiments may also be implemented as instructions carried on or stored on one or more transitory or non-transitory machine-readable (e.g., computer-readable) storage media, which may be operated by one or more processors Read and execute.
  • instructions may be distributed over a network or through other computer-readable media.
  • machine-readable media may include any mechanism for storing or transmitting information in a form readable by a machine (e.g., a computer), including, but not limited to, floppy disks, optical disks, optical disks, read-only memories (CD-ROMs), magnetic Optical disk, read-only memory (ROM), random-access memory (RAM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), magnetic or optical card, flash memory, or Tangible machine-readable storage used to transmit information (e.g., carrier waves, infrared signals, digital signals, etc.) using electrical, optical, acoustic, or other forms of propagated signals over the Internet.
  • machine-readable media includes any type of machine-readable media suitable for storing or transmitting electronic instructions or information in a form readable by a machine (eg, computer).
  • each unit/module mentioned in each device embodiment of this application is a logical unit/module.
  • a logical unit/module can be a physical unit/module, or it can be a physical unit/module.
  • Part of the module can also be implemented as a combination of multiple physical units/modules.
  • the physical implementation of these logical units/modules is not the most important.
  • the combination of functions implemented by these logical units/modules is what solves the problem of this application. Key technical issues raised.
  • the above-mentioned equipment embodiments of this application do not introduce units/modules that are not closely related to solving the technical problems raised by this application. This does not mean that the above-mentioned equipment embodiments do not exist. Other units/modules.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Computing Systems (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The present application relates to the field of data processing. Disclosed are a data synchronization method and system, and a medium, a program product and an electronic device. A source electronic device stores data in groups, and sets a check code for each group, wherein the check code is used for identifying the content of the data stored in each group, such that when synchronizing the data from the source electronic device, another target electronic device determines difference groups with different check codes by acquiring the check code of each group and comparing same with a check code of each group in the target electronic device, and then synchronizes the data in the difference groups with the source electronic device, such that when the target electronic device performs non-first synchronization with the source electronic device, there is no need to synchronize all the data, thereby reducing the volume of data for synchronization, and thus improving the efficiency of data synchronization.

Description

数据同步方法、系统、介质、程序产品和电子设备Data synchronization methods, systems, media, program products and electronic devices
本申请要求于2022年06月14日提交中国专利局、申请号为202210671444.2、申请名称为“数据同步方法、系统、介质、程序产品和电子设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application requires the priority of the Chinese patent application submitted to the China Patent Office on June 14, 2022, with the application number 202210671444.2 and the application name "data synchronization method, system, medium, program product and electronic device", and its entire content has been approved This reference is incorporated into this application.
技术领域Technical field
本申请涉及数据处理领域,特别涉及一种数据同步方法、系统、介质、程序产品和电子设备。This application relates to the field of data processing, and in particular to a data synchronization method, system, medium, program product and electronic device.
背景技术Background technique
随着用户持有的电子设备数量和种类的增加,经常需要在各电子设备之间进行数据同步,例如在各电子设备间进行联系人、短信、邮件、备忘录、即时消息(Instant Messaging,IM)等数据的同步。As the number and types of electronic devices held by users increase, it is often necessary to synchronize data between various electronic devices, such as contacts, text messages, emails, memos, and instant messaging (IM) between various electronic devices. Waiting for data synchronization.
目前,在某一电子设备和另一电子设备进行过数据的同步后,若用户修改了其中一个电子设备中的数据,该两个电子设备再次进行同步时,需要将所有的数据传送给另一个电子设备来进行同步,耗时长、效率低,影响用户体验。Currently, after data synchronization between an electronic device and another electronic device, if the user modifies the data in one of the electronic devices, all the data needs to be transferred to the other electronic device when the two electronic devices are synchronized again. Electronic devices are used for synchronization, which is time-consuming and inefficient, affecting the user experience.
发明内容Contents of the invention
有鉴于此,本申请实施例提供了一种数据同步方法、系统、介质、程序产品和电子设备,可以减少电子设备间非首次进行数据同步时同步的数据量,有利于提高同步效率、提升用户体验。In view of this, embodiments of the present application provide a data synchronization method, system, medium, program product and electronic device, which can reduce the amount of data synchronized when data synchronization is not performed for the first time between electronic devices, and is conducive to improving synchronization efficiency and improving user experience. experience.
第一方面,本申请提供了一种数据同步方法,应用于第一电子设备,该方法包括:从第二电子设备接收到数据同步消息,其中,数据同步消息包括M个校验码,校验码用于标识所对应的数据分组的数据内容,并且M≥1;将M个校验码与第一电子设备上存储的N个数据分组的N个校验码进行对比,确定出不同的校验码,其中N≥1;基于确定出的不同的校验码,将第一电子设备上存储的N个数据分组更新为M个校验码所标识的M个数据分组。In a first aspect, this application provides a data synchronization method, applied to a first electronic device. The method includes: receiving a data synchronization message from a second electronic device, wherein the data synchronization message includes M check codes, and the check code The code is used to identify the data content of the corresponding data packet, and M≥1; the M check codes are compared with the N check codes of the N data packets stored on the first electronic device to determine different check codes. Check code, where N≥1; based on the determined different check codes, update the N data packets stored on the first electronic device to M data packets identified by the M check codes.
在本申请实施例中,第一电子设备(目标电子设备)和第二电子设备(源电子设备)在非首次进行数据同步时,第一电子设备可以根据从第二电子设备接收的校验码,确定出第一电子设备和第二电子设备中,包括的数据内容不同的数据分组(即不同的校验码对应的分组,例如下文中的差异数据分组),从而只需要对该包括的数据内容不同的数据分组中的数据进行同步,减少了第一电子设备从第二电子设备中同步数据的数据量,有利于提高同步效率、提升用户体验。In this embodiment of the present application, when the first electronic device (target electronic device) and the second electronic device (source electronic device) are not performing data synchronization for the first time, the first electronic device can perform data synchronization based on the verification code received from the second electronic device. , it is determined that the first electronic device and the second electronic device include data packets with different data contents (that is, packets corresponding to different check codes, such as the difference data packets below), so that only the included data need to be Synchronizing data in data groups with different contents reduces the amount of data synchronized by the first electronic device from the second electronic device, which is beneficial to improving synchronization efficiency and user experience.
在上述第一方面的一种可能实现中,M等于N,并且M个校验码与N个校验码存在一一对应的关系;并且上述基于确定出的不同的校验码,将第一电子设备上存储的N个数据分组更新为M个校验码所标识的M个数据分组,包括:在N个校验码中存在第一校验码,并且M个校验码中与第一校验码对应的第二校验码与第一校验码不同的情况下,将第一电子设备上存储的与第一校验码对应的第一数据分组更新为,与第二校验码对应的第二数据分组。In a possible implementation of the first aspect above, M is equal to N, and there is a one-to-one correspondence between the M check codes and the N check codes; and based on the determined different check codes, the first The N data packets stored on the electronic device are updated to M data packets identified by M check codes, including: the first check code exists among the N check codes, and the M check codes match the first check code. When the second check code corresponding to the check code is different from the first check code, update the first data packet corresponding to the first check code stored on the first electronic device to be the same as the second check code. The corresponding second data packet.
也就是说,第一电子设备将第一电子设备中第一数据分组的校验码,和第二电子设备中与该数据分组对应的第二数据分组的校验码进行对比,如果不同,则说明第一数据分组与第二数据分组中的数据内容不同,第一电子设备将第一数据分组中的内容更新为第二数据分组中的内容。That is to say, the first electronic device compares the check code of the first data packet in the first electronic device with the check code of the second data packet corresponding to the data packet in the second electronic device. If they are different, then It is explained that the data content in the first data packet and the second data packet are different, and the first electronic device updates the content in the first data packet to the content in the second data packet.
在上述第一方面的一种可能实现中,上述基于确定出的不同的校验码,将第一电子设备上存储的N个数据分组更新为M个校验码所标识的M个数据分组,包括:在N个校验码中存在第三校验码, 而M个校验码中不存在第三校验码的情况下,删除第一电子设备上存储的与第三校验码对应的第三数据分组;或者在M个校验码中存在第四校验码,而N个校验码中不存在第四校验码的情况下,在第一电子设备上存储与第四校验码对应的第四数据分组。In a possible implementation of the first aspect, based on the determined different check codes, the N data packets stored on the first electronic device are updated to M data packets identified by the M check codes, Including: there is a third check code among N check codes, When there is no third check code among the M check codes, delete the third data packet corresponding to the third check code stored on the first electronic device; or there is a fourth check code among the M check codes. Check code, and if the fourth check code does not exist among the N check codes, store the fourth data packet corresponding to the fourth check code on the first electronic device.
在本申请实施例中,第一电子设备中和第二电子设备中只存储有数据的分组,可以减少第一电子设备和第二电子设备中存储的数据的量,有利于节省第一电子设备和第二电子设备的存储空间。In the embodiment of the present application, only packets containing data are stored in the first electronic device and the second electronic device, which can reduce the amount of data stored in the first electronic device and the second electronic device, which is beneficial to saving money on the first electronic device. and storage space for a second electronic device.
在上述第一方面的一种可能实现中,数据分组的校验码由数据分组中各数据的消息摘要确定。In a possible implementation of the above first aspect, the check code of the data packet is determined by the message digest of each data in the data packet.
在上述第一方面的一种可能实现中,上述数据分组的校验码由数据分组中各数据的消息摘要确定,包括:数据分组的校验码由数据分组中各数据的消息摘要逐个进行异或运算得到。In a possible implementation of the above first aspect, the check code of the above data group is determined by the message digest of each data in the data group, including: the check code of the data group is differentiated one by one from the message digest of each data in the data group. Obtained by OR operation.
在上述第一方面的一种可能实现中,各数据所属的数据分组是根据数据中预设字段的字符确定的。In a possible implementation of the above first aspect, the data group to which each data belongs is determined based on the characters of the preset fields in the data.
也就是说,根据各数据的预设字段的字符来确定各个数据所在的分组。That is to say, the group in which each data is located is determined based on the characters of the preset fields of each data.
在上述第一方面的一种可能实现中,上述预设字段包括以下字段中的至少一种:在数据包括联系人信息的情况下,预设字段包括联系人的电话号码;在数据包括短信的情况下,预设字段包括短信的收件人或发件人的号码;在数据包括备忘录的情况下,预设字段包括备忘录的创建时间;在数据包括邮件的情况下,预设字段包括发件人或收件人信息,其中发件人或收件人信息包括电子邮箱地址和/或姓名;在数据即时消息的情况下,预设字段包括即时消息的发送或接收时间。In a possible implementation of the above first aspect, the above preset field includes at least one of the following fields: when the data includes contact information, the preset field includes the contact's phone number; when the data includes text messages In this case, the default field includes the number of the recipient or sender of the text message; in the case where the data includes a memo, the default field includes the creation time of the memo; in the case of the data including an email, the default field includes the sending Person or recipient information, where the sender or recipient information includes an email address and/or name; in the case of data instant messaging, the preset field includes the time of sending or receiving the instant message.
通过上述预设字段来确定各数据的分组,由于各字段包括内容较简单,计算速度快,有利于快速确定各数据的分组。The above-mentioned preset fields are used to determine the grouping of each data. Since the content of each field is relatively simple and the calculation speed is fast, it is conducive to quickly determining the grouping of each data.
在上述第一方面的一种可能实现中,上述数据分组中的数据内容包括以下数据中的至少一种:联系人信息、短信、备忘录、邮件、即时消息。In a possible implementation of the above first aspect, the data content in the above data packet includes at least one of the following data: contact information, text messages, memos, emails, and instant messages.
在上述第一方面的一种可能实现中,第一电子设备和第二电子设备中都安装有第一应用或第一服务;并且由第一电子设备中安装的第一应用或第一服务从第一电子设备中安装的第一应用或第一服务接收数据同步消息;由第一电子设备中的第一应用或第一服务将M个校验码与第一电子设备上存储的N个数据分组的N个校验码进行对比,确定出不同的校验码;由第一电子设备中的第一应用或第一服务确定出的不同的校验码,将第一电子设备上存储的N个数据分组更新为M个校验码所标识的M个数据分组。In a possible implementation of the above first aspect, the first application or the first service is installed in both the first electronic device and the second electronic device; and the first application or the first service installed in the first electronic device is obtained from The first application or the first service installed in the first electronic device receives the data synchronization message; the first application or the first service in the first electronic device compares the M check codes with the N pieces of data stored on the first electronic device. The grouped N check codes are compared to determine different check codes; the different check codes determined by the first application or the first service in the first electronic device are compared with the N stored on the first electronic device. The data packets are updated to M data packets identified by M check codes.
也就是说,第一电子设备和第二电子设备可以基于相同的第一应用实现本申请各实施例的数据同步方法,也可以基于第一服务来实现本申请各实施例的数据同步方法。That is to say, the first electronic device and the second electronic device can implement the data synchronization methods of various embodiments of the present application based on the same first application, or can also implement the data synchronization methods of various embodiments of the present application based on the first service.
在上述第一方面的一种可能实现中,上述第一应用包括以下应用中的一种:联系人应用、备忘录应用、短信应用、邮件应用、即时通信应用。In a possible implementation of the first aspect, the first application includes one of the following applications: a contact application, a memo application, a text message application, an email application, and an instant messaging application.
第二方面,本申请提供了一种数据同步方法,应用于第二电子设备,其特征在于,包括:获取P个校验码,该校验码用于标识所对应的数据分组的数据内容,P≥1;向第一电子设备发送数据同步消息,该数据同步消息包括P个校验码,并且,P个校验码用于确定P个校验码所对应的P个数据分组中,待同步到第一电子设备的数据分组。In a second aspect, the present application provides a data synchronization method applied to a second electronic device, which is characterized in that it includes: obtaining P check codes, which are used to identify the data content of the corresponding data packets, P≥1; Send a data synchronization message to the first electronic device. The data synchronization message includes P check codes, and the P check codes are used to determine the P data packets corresponding to the P check codes. Data packets synchronized to the first electronic device.
在本申请实施例中,第二电子设备在向第一电子设备同步数据时,可以只对第一电子设备和第二电子设备中,包括的数据内容不同的数据分组(例如下文中的差异数据分组)进行同步,减少了同步的数据量,提高了同步效率,提升了用户体验。In this embodiment of the present application, when the second electronic device synchronizes data to the first electronic device, it may only group data containing different data contents between the first electronic device and the second electronic device (for example, the difference data below). Grouping) for synchronization, reducing the amount of synchronized data, improving synchronization efficiency, and improving user experience.
在上述第二方面的一种可能实现中,上述方法还包括:基于数据分组中存储的各数据的消息摘要确定数据分组的校验码。 In a possible implementation of the above second aspect, the above method further includes: determining the check code of the data packet based on the message digest of each data stored in the data packet.
也就是说,P个校验码是根据各数据分组中的各数据的消息摘要确定的。That is to say, P check codes are determined based on the message digest of each data in each data packet.
在上述第二方面的一种可能实现中,上述基于数据分组中存储的各数据的消息摘要确定数据分组的校验码,包括:将数据分组中各数据的消息摘要逐个进行异或运算,得到数据分组的校验码。In a possible implementation of the above second aspect, determining the check code of the data group based on the message digest of each data stored in the data group includes: XORing the message digest of each data in the data group one by one to obtain Check code of data packet.
也就是说,P个校验码是根据各数据分组中的各数据的消息摘要逐个进行异或运算得到的。That is to say, the P check codes are obtained by performing XOR operations one by one based on the message digest of each data in each data group.
在上述第二方面的一种可能实现中,基于数据分组中存储的各数据的消息摘要确定数据分组的校验码,还包括:在检测到第五数据分组中的第一数据被删除的情况下,将第五数据分组的校验码更新为第一数据的信息摘要与第五数据分组当前校验码的异或运算结果,其中,第五数据分组为P个校验码对应的数据分组中的一个;或者在检测到第六数据分组中新增第二数据的情况下,将第六数据分组的校验码更新为第二数据的信息摘要与第六数据分组当前校验码的异或运算结果,其中,第六数据分组为P个校验码对应的数据分组中的一个;或者在检测到第七数据分组中的第三数据被修改为第四数据的情况下,将第七数据分组的校验码更新为第三数据的信息摘要、第四数据的信息摘要、第七数据分组当前校验码逐个进行异或运算结果,其中,第七数据分组为P个校验码对应的数据分组中的一个。In a possible implementation of the above second aspect, determining the check code of the data packet based on the message digest of each data stored in the data packet further includes: detecting that the first data in the fifth data packet is deleted. Next, update the check code of the fifth data packet to the XOR operation result of the information digest of the first data and the current check code of the fifth data packet, where the fifth data packet is a data packet corresponding to P check codes. One of; or when it is detected that the second data is added to the sixth data packet, update the check code of the sixth data packet to the difference between the information digest of the second data and the current check code of the sixth data packet. OR operation result, wherein the sixth data packet is one of the data packets corresponding to the P check codes; or when it is detected that the third data in the seventh data packet is modified into the fourth data, the seventh data packet is The check code of the data group is updated to the information summary of the third data, the information summary of the fourth data, and the current check code of the seventh data group, and the results of the XOR operation are performed one by one. The seventh data group corresponds to P check codes. One of the data groups.
在本申请实施例中,第二电子设备更新各数据分组的校验码时,只需要根据有变化的数据的消息摘要和各数据分组的当前校验码间的异或运算,即可进行校验码的更新,而无需基于各数据的消息摘要来重新计算,有利于提高校验码的更新速度。In the embodiment of the present application, when the second electronic device updates the check code of each data packet, it only needs to perform the check based on the XOR operation between the message digest of the changed data and the current check code of each data packet. The update of the check code does not need to be recalculated based on the message digest of each data, which is beneficial to improving the update speed of the check code.
在上述第二方面的一种可能实现中,各数据所属的数据分组是根据数据中预设字段的字符确定的。In a possible implementation of the above second aspect, the data group to which each data belongs is determined based on the characters of the preset fields in the data.
在上述第二方面的一种可能实现中,上述预设字段包括以下字段中的至少一种:在数据包括联系人信息的情况下,预设字段包括联系人的电话号码;在数据包括短信的情况下,预设字段包括短信的收件人或发件人的号码;在数据包括备忘录的情况下,预设字段包括备忘录的创建时间;在数据包括邮件的情况下,预设字段包括发件人或收件人信息,其中发件人或收件人信息包括电子邮箱地址和/或姓名;在数据即时消息的情况下,预设字段包括即时的消息的发送或接收时间。In a possible implementation of the above second aspect, the above preset field includes at least one of the following fields: when the data includes contact information, the preset field includes the contact's phone number; when the data includes text messages In this case, the default field includes the number of the recipient or sender of the text message; in the case where the data includes a memo, the default field includes the creation time of the memo; in the case of the data including an email, the default field includes the sending Person or recipient information, where the sender or recipient information includes an email address and/or name; in the case of data instant messaging, the preset field includes the sending or receiving time of the instant message.
第三方面,本申请提供了一种数据同步系统,该数据同步系统包括第一电子设备和第二电子设备;并且第二电子设备用于向第一电子设备发送数据同步消息,其中,数据同步消息包括R个校验码,校验码用于标识所对应的数据分组的数据内容,并且R≥1;第一电子设备用于接收数据同步消息,将R个校验码与第一电子设备上存储的S个数据分组的S个校验码进行对比,确定出不同的校验码,并基于确定出的不同的校验码,将第一电子设备上存储的S个数据分组更新为R个校验码所标识的R个数据分组,其中,S≥1。In a third aspect, the present application provides a data synchronization system. The data synchronization system includes a first electronic device and a second electronic device; and the second electronic device is used to send a data synchronization message to the first electronic device, wherein the data synchronization The message includes R check codes, the check codes are used to identify the data content of the corresponding data packet, and R≥1; the first electronic device is used to receive the data synchronization message, and compare the R check codes with the first electronic device Compare the S check codes of the S data packets stored on the first electronic device to determine different check codes, and based on the determined different check codes, update the S data packets stored on the first electronic device to R R data packets identified by check codes, where S≥1.
在本申请实施例中,第一电子设备(目标电子设备)和第二电子设备(源电子设备)在非首次进行数据同步时,第一电子设备可以根据从第二电子设备接收的校验码,确定出第一电子设备和第二电子设备中,包括的数据内容不同的数据分组(即不同的校验码对应的分组,例如下文中的差异数据分组),从而只需要对该包括的数据内容不同的数据分组中的数据进行同步,减少了第一电子设备从第二电子设备中同步数据的数据量,有利于提高同步效率、提升用户体验。In this embodiment of the present application, when the first electronic device (target electronic device) and the second electronic device (source electronic device) are not performing data synchronization for the first time, the first electronic device can perform data synchronization based on the verification code received from the second electronic device. , it is determined that the first electronic device and the second electronic device include data packets with different data contents (that is, packets corresponding to different check codes, such as the difference data packets below), so that only the included data need to be Synchronizing data in data groups with different contents reduces the amount of data synchronized by the first electronic device from the second electronic device, which is beneficial to improving synchronization efficiency and user experience.
在上述第三方面的一种可能实现中,数据分组的校验码由数据分组中各数据的消息摘要逐个进行异或运算得到。In a possible implementation of the above third aspect, the check code of the data packet is obtained by XORing the message digest of each data in the data packet one by one.
在上述第三方面的一种可能实现中,第二电子设备还用于:在检测到第八数据分组中的第五数据被删除的情况下,将第八数据分组的校验码更新为第五数据的信息摘要与第八数据分组当前校验码的异或运算结果,其中,第八数据分组为R个校验码对应的数据分组中的一个;或者在检测到第九 数据分组中新增第六数据的情况下,将第九数据分组的校验码更新为第六数据的信息摘要与第九数据分组当前校验码的异或运算结果,其中,第九数据分组为R个校验码对应的数据分组中的一个;或者在检测到第十数据分组中的第七数据被修改为第八数据的情况下,将第十数据分组的校验码更新为第七数据的信息摘要、第八数据的信息摘要、第十数据分组当前校验码逐个进行异或运算结果,其中第十数据分组为R个校验码对应的数据分组中的一个。In a possible implementation of the third aspect, the second electronic device is further configured to: when detecting that the fifth data in the eighth data packet is deleted, update the check code of the eighth data packet to the third data packet. The XOR operation result between the information summary of the five data and the current check code of the eighth data group, where the eighth data group is one of the data groups corresponding to the R check codes; or when the ninth data group is detected When the sixth data is added to the data group, the check code of the ninth data group is updated to the XOR operation result of the information summary of the sixth data and the current check code of the ninth data group, where the ninth data group is one of the data packets corresponding to the R check codes; or when it is detected that the seventh data in the tenth data packet is modified to the eighth data, update the check code of the tenth data packet to the seventh data The information summary of the data, the information summary of the eighth data, and the current check code of the tenth data group are XORed one by one, where the tenth data group is one of the data groups corresponding to the R check codes.
在上述第三方面的一种可能实现中,第一电子设备和第二电子设备为终端设备,或者第一电子设备为终端设备、第二电子设备为服务器。In a possible implementation of the above third aspect, the first electronic device and the second electronic device are terminal devices, or the first electronic device is a terminal device and the second electronic device is a server.
在上述第三方面的一种可能实现中,该数据同步系统还包括第三电子设备,第三电子设备用于从第二电子设备接收数据同步消息,并将数据同步消息发送给第一电子设备。In a possible implementation of the above third aspect, the data synchronization system further includes a third electronic device, the third electronic device is configured to receive a data synchronization message from the second electronic device and send the data synchronization message to the first electronic device. .
在本申请实施例中,第二电子设备可以将数据分组和数据分组的校验码发送给第三电子设备,并由第三电子设备向第一电子设备同步数据。从而第三电子设备可以向多台第一电子设备进行数据同步。In this embodiment of the present application, the second electronic device may send the data packet and the check code of the data packet to the third electronic device, and the third electronic device may synchronize the data to the first electronic device. Therefore, the third electronic device can perform data synchronization with multiple first electronic devices.
在上述第三方面的一种可能实现中,第一电子设备和第二电子设备为终端设备,第三电子设备为服务器。In a possible implementation of the above third aspect, the first electronic device and the second electronic device are terminal devices, and the third electronic device is a server.
在上述第三方面的一种可能实现中,终端设备包括手机、车机、可穿戴设备、平板电脑中的任意一种。In a possible implementation of the above third aspect, the terminal device includes any one of a mobile phone, a car machine, a wearable device, and a tablet computer.
第四方面,本申请提供了一种可读存储介质,该可读存储介质上存储有指令,指令在电子设备上执行时使电子设备实现上述第一方面和上述第二方面提供的任意一种数据同步方法。In a fourth aspect, the present application provides a readable storage medium, which stores instructions. When the instructions are executed on an electronic device, the electronic device enables the electronic device to implement any one of the above-mentioned first aspect and the above-mentioned second aspect. Data synchronization method.
第五方面,本申请提供了一种电子设备,该电子设备包括:存储器,用于存储由电子设备的一个或多个处理器执行的指令;以及处理器,是电子设备的处理器之一,用于执行存储器中存储的指令以实现上述第一方面和上述第二方面提供的任意一种数据同步方法。In a fifth aspect, the present application provides an electronic device, which includes: a memory for storing instructions executed by one or more processors of the electronic device; and a processor that is one of the processors of the electronic device, Used to execute instructions stored in the memory to implement any one of the data synchronization methods provided by the above-mentioned first aspect and the above-mentioned second aspect.
第六方面,本申请提供了一种计算机程序产品,该计算机程序产品包括指令,指令在电子设备上执行时使电子设备实现上述第一方面和上述第二方面提供的任意一种数据同步方法。In a sixth aspect, the present application provides a computer program product that includes instructions that, when executed on an electronic device, cause the electronic device to implement any of the data synchronization methods provided in the first aspect and the second aspect.
附图说明Description of the drawings
图1A根据本申请的一些实施例,示出了一种手机10对联系人信息进行分组存储的示意图;Figure 1A shows a schematic diagram of a mobile phone 10 grouping and storing contact information according to some embodiments of the present application;
图1B根据本申请的一些实施例,示出了一种智能手表20首次从手机10同步联系人信息的场景示意图;Figure 1B shows a schematic diagram of a scenario in which the smart watch 20 synchronizes contact information from the mobile phone 10 for the first time according to some embodiments of the present application;
图2A根据本申请的一些实施例,示出了一种智能手表20非首次从手机10同步联系人信息的场景示意图;Figure 2A shows a schematic diagram of a scenario in which the smart watch 20 synchronizes contact information from the mobile phone 10 for the first time according to some embodiments of the present application;
图2B根据本申请的一些实施例,示出了一种智能手表20非首次从手机10同步联系人信息的过程示意图;Figure 2B shows a schematic diagram of a process in which the smart watch 20 synchronizes contact information from the mobile phone 10 for a non-first time according to some embodiments of the present application;
图3A根据本申请的一些实施例,示出了一种联系人信息的分组存储示意图;Figure 3A shows a schematic diagram of group storage of contact information according to some embodiments of the present application;
图3B根据本申请的一些实施例,示出了一种对联系人进行分区存储的示意图;Figure 3B shows a schematic diagram of partitioned storage of contacts according to some embodiments of the present application;
图4A根据本申请的一些实施例,示出了一种备忘录的分组存储示意图;Figure 4A shows a schematic diagram of group storage of memos according to some embodiments of the present application;
图4B根据本申请的一些实施例,示出了一种邮件的分组存储示意图;Figure 4B shows a schematic diagram of group storage of emails according to some embodiments of the present application;
图4C根据本申请的一些实施例,示出了一种短信的分组存储示意图;Figure 4C shows a schematic diagram of group storage of short messages according to some embodiments of the present application;
图5根据本申请的一些实施例,示出了一种对数据进行分组存储的流程示意图;Figure 5 shows a schematic flowchart of group storage of data according to some embodiments of the present application;
图6根据本申请的一些实施例,示出了一种分组校验码的更新方法流程示意图;Figure 6 shows a schematic flow chart of a method for updating a group check code according to some embodiments of the present application;
图7A根据本申请的一些实施例,示出一种手机10中显示的畅连TM应用的联系人界面示意图; Figure 7A shows a schematic diagram of the contact interface of the Changlian TM application displayed on the mobile phone 10 according to some embodiments of the present application;
图7B根据本申请的一些实施例,示出一种手机10中显示的在畅连TM应用添加的联系人界面示意图;Figure 7B shows a schematic diagram of the contact interface added in the Changlian TM application displayed on the mobile phone 10 according to some embodiments of the present application;
图7C根据本申请的一些实施例,示出一种手机10中显示的畅连TM应用联系人界详情面示意图;Figure 7C shows a schematic diagram of the contact interface details of the Changlian TM application displayed on the mobile phone 10 according to some embodiments of the present application;
图7D根据本申请的一些实施例,示出一种手机10中显示的畅连TM应用修改联系人界面示意图;Figure 7D shows a schematic diagram of the contact modification interface of the Changlian TM application displayed on the mobile phone 10 according to some embodiments of the present application;
图8根据本申请的一些实施例,示出了一种数据同步方法的交互流程示意图;Figure 8 shows a schematic interactive flow diagram of a data synchronization method according to some embodiments of the present application;
图9A根据本申请的一些实施例,示出一种手机10中的下拉菜单栏的界面示意图;Figure 9A shows a schematic interface diagram of a drop-down menu bar in a mobile phone 10 according to some embodiments of the present application;
图9B根据本申请的一些实施例,示出一种手机10中的下拉菜单栏中的蓝牙配对界面示意图;Figure 9B shows a schematic diagram of the Bluetooth pairing interface in the drop-down menu bar of the mobile phone 10 according to some embodiments of the present application;
图10根据本申请的一些实施例,示出了一种数据同步的场景示意图;Figure 10 shows a schematic diagram of a data synchronization scenario according to some embodiments of the present application;
图11根据本申请的一些实施例,示出了又一种数据同步方法的交互流程示意图;Figure 11 shows an interactive flow diagram of yet another data synchronization method according to some embodiments of the present application;
图12A根据本申请的一些实施例,示出了一种车机41首次与服务器30进行联系人同步的示意图;Figure 12A shows a schematic diagram of a vehicle machine 41 performing contact synchronization with the server 30 for the first time according to some embodiments of the present application;
图12B根据本申请的一些实施例,示出了一种车机41再次与服务器30进行联系人同步的示意图;Figure 12B shows a schematic diagram of the vehicle machine 41 synchronizing contacts with the server 30 again according to some embodiments of the present application;
图13根据本申请的一些实施例,示出了一种分布式系统中对备忘录进行同步的场景示意图;Figure 13 shows a schematic diagram of a scenario for synchronizing memos in a distributed system according to some embodiments of the present application;
图14根据本申请的一些实施例,示出了一种手机10的软件架构示意图;Figure 14 shows a schematic diagram of the software architecture of a mobile phone 10 according to some embodiments of the present application;
图15根据本申请的一些实施例,示出了一种通过分布式软总线041将手机10与其他电子设备进行耦接的示意图;Figure 15 shows a schematic diagram of coupling the mobile phone 10 to other electronic devices through a distributed soft bus 041 according to some embodiments of the present application;
图16根据本申请的一些实施例,示出了一种手机10的结构示意图。Figure 16 shows a schematic structural diagram of a mobile phone 10 according to some embodiments of the present application.
具体实施方式Detailed ways
本申请的说明性实施例包括但不限于数据同步方法、系统、介质、程序产品和电子设备。Illustrative embodiments of the present application include, but are not limited to, data synchronization methods, systems, media, program products, and electronic devices.
下面结合附图详细说明本申请实施例提供的技术方案的具体实现过程。The specific implementation process of the technical solution provided by the embodiments of the present application will be described in detail below with reference to the accompanying drawings.
如前所述,目前在某一电子设备和另一电子设备之间进行过数据的同步后,若用户修改了其中一个电子设备中的数据,则两电子设备之间再次进行数据同步时,仍需将全部数据发送给另一个电子设备来完成同步,这种数据同步的过程耗时长、效率低,用户体验较差。例如,手机10中存储有10000条联系人信息,并且该10000条联系人信息已经同步至智能手表20,当用户修改了手机10中的其中一条联系人信息后,手机10再一次向智能手表20同步联系人信息时,仍需要将包含该修改后联系人信息的10000条联系人信息再次发送给智能手表20,如此存在耗时长、效率低的问题。As mentioned above, after data synchronization is currently carried out between an electronic device and another electronic device, if the user modifies the data in one of the electronic devices, the data will still be synchronized between the two electronic devices again. All data needs to be sent to another electronic device to complete the synchronization. This data synchronization process is time-consuming, inefficient, and has a poor user experience. For example, there are 10,000 pieces of contact information stored in the mobile phone 10, and the 10,000 contact information has been synchronized to the smart watch 20. When the user modifies one of the contact information in the mobile phone 10, the mobile phone 10 once again sends the contact information to the smart watch 20. When synchronizing contact information, the 10,000 pieces of contact information containing the modified contact information still need to be sent to the smart watch 20 again, which is time-consuming and low-efficiency.
为了提高电子设备之间数据同步效率,在一些实施例中,可以由手机10记录与其他电子设备之间进行数据同步的日志,并记录手机10在上一次与其他电子设备之间同步数据之后,由于用户的修改、删除、新增等操作而导致发生变化的数据内容,从而在下一次与其他电子设备同步数据时可以仅对有变化的数据进行同步,减少了同步的数据量,进而提高数据同步效率。但是,这种同步数据的方式,需要占用手机10的存储空间来存储与各个电子设备进行同步的日志以及上述有变化的数据,数据存储结构复杂,并且在记录的日志或有变化的数据被清理后,仍需将手机10中存储的全部数据同步至智能手表20,耗时长、效率低,影响用户体验。In order to improve the efficiency of data synchronization between electronic devices, in some embodiments, the mobile phone 10 can record a log of data synchronization with other electronic devices, and record the last time the mobile phone 10 synchronized data with other electronic devices. The data content that has changed due to the user's modification, deletion, addition, etc. operations, so that only the changed data can be synchronized the next time the data is synchronized with other electronic devices, reducing the amount of synchronized data and thus improving data synchronization. efficiency. However, this method of synchronizing data requires occupying the storage space of the mobile phone 10 to store the logs synchronized with various electronic devices and the above-mentioned changed data. The data storage structure is complex, and the recorded logs or changed data are cleared. Afterwards, it is still necessary to synchronize all the data stored in the mobile phone 10 to the smart watch 20, which is time-consuming and inefficient, affecting the user experience.
为了便于描述,在本申请实施例中,同步数据时向外发送数据的电子设备,例如上述手机10,以下可以称之为源电子设备,同步数据时接收源电子设备发来的同步数据的电子设备,可以称为目标电子设备。For the convenience of description, in the embodiment of the present application, the electronic device that sends data to the outside during data synchronization, such as the above-mentioned mobile phone 10, may be referred to as the source electronic device below, and the electronic device that receives the synchronization data sent from the source electronic device during data synchronization. The device can be called the target electronic device.
为了解决上述数据同步过程中耗时长、效率低的问题,本申请实施例提供了一种数据同步方法。具体地,该方法中源电子设备通过对存储的各条数据进行分组,并为每个分组确定一个校验码,该 校验码可以基于分组中的各条数据来确定,分组中的数据的内容不同,则分组的校验码也不同。基于此,目标电子设备从源电子设备中再次同步数据时,目标电子设备只需要获取源电子设备中各分组的校验码,并将获取的源电子设备中各分组的校验码与目标电子设备中已同步的对应分组的校验码进行对比,从而确定出校验码不同的差异分组,即所包括的数据存在差异的分组。进而,目标电子设备可以从源电子设备获取差异分组的数据,完成数据同步。In order to solve the above-mentioned problems of long time consumption and low efficiency in the data synchronization process, embodiments of the present application provide a data synchronization method. Specifically, in this method, the source electronic device groups each piece of stored data and determines a check code for each group. The check code can be determined based on each piece of data in the group. If the content of the data in the group is different, the check code of the group will also be different. Based on this, when the target electronic device synchronizes data again from the source electronic device, the target electronic device only needs to obtain the check codes of each group in the source electronic device, and compare the obtained check codes of each group in the source electronic device with the target electronic device. The check codes of the synchronized corresponding groups in the device are compared to determine the difference groups with different check codes, that is, the groups with different data included. Furthermore, the target electronic device can obtain differentially grouped data from the source electronic device to complete data synchronization.
如此,目标电子设备只需要从源电子设备同步差异分组的数据,可以在减少同步数据的数量、提高同步效率的同时,不会增加源电子设备的额外开销,例如,源电子设备不需要记录电子设备与各个目标电子设备的同步日志,也不需要记录电子设备上一次与各目标电子设备进行同步后,源电子设备中有变化的数据。In this way, the target electronic device only needs to synchronize differentially grouped data from the source electronic device, which can reduce the amount of synchronized data and improve synchronization efficiency without increasing the additional overhead of the source electronic device. For example, the source electronic device does not need to record electronic data. The synchronization log between the device and each target electronic device does not need to record the changed data in the source electronic device after the electronic device was last synchronized with each target electronic device.
可以理解,在一些实施例中,源电子设备对存储的各条数据进行分组,可以是对各条数据进行分组存储,例如为每条数据增加一个分组标识,该分组标识用于指示每条数据的分组,又例如在源电子设备的存储器中设置多个存储区域,每个存储区域中的数据为一个分组等。在另一些实施例中,源电子设备对存储的各条数据进行分组也可以是预设一个分组规则,而不对各条数据进行分组存储,源电子设备在确定某一分组的校验码时,可以先根据该分组规则从各条数据中筛选出该分组的数据,并基于筛选出的数据来确定该分组的校验码。为便于描述,以下以“源电子设备对存储的各条数据进行分组存储”进行介绍。It can be understood that in some embodiments, the source electronic device groups each piece of data stored, and may store each piece of data in groups, for example, adding a grouping identifier to each piece of data, and the grouping identifier is used to indicate each piece of data. Grouping, for example, multiple storage areas are set in the memory of the source electronic device, and the data in each storage area is a group. In other embodiments, the source electronic device may also preset a grouping rule to group each piece of stored data without grouping and storing each piece of data. When the source electronic device determines the check code of a certain group, The data of the group can be filtered out from each piece of data according to the grouping rule, and the check code of the group can be determined based on the filtered data. For the convenience of description, the following introduction is based on "the source electronic device stores each piece of stored data in groups".
可以理解,各分组的校验码可以基于各分组中各条数据的具体内容来确定,用于唯一标识一个分组中存储的数据,分组中存储的数据的内容不同,则分组的校验码不同。例如,在一些实施例中,各分组的校验码可以由分组中的各条数据的消息摘要进行逻辑和/或算术运算来确定,例如由各条数据的消息摘要逐个进行异或运算来确定。假设某一分组中包括三条数据,该三条数据的消息摘要为X1、X2、X3,则该分组的校验码可以由X1与X2进行异或运算的结果再与X3进行异或运算得到。其中异或运算是指,进行运算的两个数据具有相同的二进制数位数,按照二进制数的位数逐位比较,某一位相同则输入数据的该位为0,某一位不同则输出数据的该位为1,例如X1=0101与X2=1001的异或运算的结果为1100。需要说明的是,多个数据异或运算的运算结果与各个数据进行运算的顺序无关,从而上述分组的校验码也可以由X1和X3进行异或的运算结果再与X2异或运算得到,还可由X2和X3进行异或的运算结果再与X1异或运算得到。It can be understood that the check code of each group can be determined based on the specific content of each piece of data in each group, and is used to uniquely identify the data stored in a group. If the content of the data stored in the group is different, the check code of the group will be different. . For example, in some embodiments, the check code of each group can be determined by performing logical and/or arithmetic operations on the message digest of each piece of data in the group, for example, by performing an XOR operation on the message digest of each piece of data one by one. . Assume that a certain group includes three pieces of data, and the message digests of the three pieces of data are X1, X2, and X3. Then the check code of the group can be obtained by XORing the result of X1 and The XOR operation means that the two data to be operated have the same number of binary digits, and are compared bit by bit according to the number of binary digits. If a certain bit is the same, the bit of the input data is 0, and if a certain bit is different, the output data This bit is 1. For example, the result of the XOR operation of X1=0101 and X2=1001 is 1100. It should be noted that the result of the XOR operation of multiple data has nothing to do with the order in which each data is operated. Therefore, the check code of the above group can also be obtained by the XOR operation result of X1 and X3 and then XOR operation with X2. It can also be obtained by XORing the result of X2 and X3 and then XORing it with X1.
可以理解,源电子设备在检测到某一个分组中的数据发生变化后,例如源电子设备响应于用户的维护操作(例如新增、删除、修改等),在该分组中新增、删除或修改一条数据时,可以基于发生变化的数据来更新该分组的校验码,使得该分组的校验码可以与该分组中存储的发生变化后的数据的内容相对应。从而目标电子设备在从源电子设备中同步数据时,可以获取到更新后的校验码并确定出该分组为差异分组,以对该分组的数据进行同步。It can be understood that after the source electronic device detects changes in the data in a certain group, for example, the source electronic device responds to the user's maintenance operations (such as adding, deleting, modifying, etc.), adding, deleting, or modifying data in the group. When a piece of data is received, the check code of the group can be updated based on the changed data, so that the check code of the group can correspond to the content of the changed data stored in the group. Therefore, when the target electronic device synchronizes data from the source electronic device, it can obtain the updated check code and determine that the group is a differential group, so as to synchronize the data of the group.
例如,假设该分组的校验码是由分组中的各条数据的消息摘要逐个进行异或运算来确定的,则源电子设备在检测到对某一条数据的新增或删除操作后,可以将该分组的校验码更新为该条数据的消息摘要与该分组当前的校验码的异或运算结果。又例如,源电子设备在检测到对该分组中的一条数据的修改操作后,可以将该分组的校验码更新为:该条数据修改前的消息摘要、该条数据修改后的消息摘要、该分组当前的校验码逐个进行异或运算的结果。再例如,源电子设备在检测到由于用户修改某一分组中的一条数据,使得该条数据的分组变更为另一分组的情况下,可以将该分组的校验码更新为该条数据修改前的消息摘要与该分组当前的校验码的异或运算结果、将该另一分组的校验码更新为该条数据修改后的消息摘要与该另一分组当前的校验码的异或运算结果。具体将在下文 进行详细介绍,在此不做赘述。For example, assuming that the check code of the group is determined by XORing the message digests of each piece of data in the group one by one, after detecting the addition or deletion of a certain piece of data, the source electronic device can The check code of the group is updated as the result of the XOR operation between the message digest of the data and the current check code of the group. For another example, after detecting a modification operation to a piece of data in the group, the source electronic device can update the check code of the group to: the message digest before the data is modified, the message digest after the data is modified, The result of XOR operation on the current check codes of this group one by one. For another example, when the source electronic device detects that the user modified a piece of data in a certain group, causing the grouping of the piece of data to change to another group, the source electronic device can update the check code of the group to the one before the modification of the piece of data. The XOR operation result of the message digest and the current check code of the group, and the XOR operation of the modified message digest and the current check code of the other group to update the check code of the other group. result. Details will be given below A detailed introduction will not be given here.
可以理解,各条数据的消息摘要(Message Digest,MD)可根据各条数据的具体内容得到,用于唯一标识一条数据,也就是说包括不同具体内容的数据,该数据的消息摘要也不同。例如,在一些实施例中,各条数据的消息摘要可以是利用消息摘要算法,例如MD4算法(由Ronald L.Rivest在1990年设计的消息摘要算法,对于一条数据,得到的消息摘要包括128位的二进制数)、MD5算法(由Rivest在1991年对MD4的改进版本。对于一条数据,得到的消息摘要包括128位的二进制数)、安全散列算法(Secure Hash Algorithm,SHA)算法1(由NIST NSA设计的MD算法,对于一条数据,得到的消息摘要包括160位的二进制数)、SHA224、SHA256、SHA384、SHA512等来计算得到。为便于描述,以下各实施例中以通过MD5算法来得到各条数据的消息摘要为例进行介绍。It can be understood that the message digest (Message Digest, MD) of each piece of data can be obtained according to the specific content of each piece of data, and is used to uniquely identify a piece of data. That is to say, data including different specific contents will have different message digests. For example, in some embodiments, the message digest of each piece of data may use a message digest algorithm, such as the MD4 algorithm (a message digest algorithm designed by Ronald L. Rivest in 1990. For a piece of data, the resulting message digest includes 128 bits binary number), MD5 algorithm (an improved version of MD4 by Rivest in 1991. For a piece of data, the message digest obtained includes a 128-bit binary number), Secure Hash Algorithm (SHA) algorithm 1 (by The MD algorithm designed by NIST NSA, for a piece of data, the message digest obtained includes 160-bit binary number), SHA224, SHA256, SHA384, SHA512, etc. For the convenience of description, the following embodiments take the message digest of each piece of data obtained through the MD5 algorithm as an example.
可以理解,源电子设备和目标电子设备可以是任意电子设备,包括但不限于膝上型计算机、智能电视、智能音箱、平板计算机、服务器、可穿戴设备(例如智能手表、智能手环、智能眼镜等)、头戴式显示器、移动电子邮件设备、便携式游戏机、便携式音乐播放器、阅读器设备等,本申请实施例不做限定。下面以源电子设备为手机10,目标电子设备为智能手表20为例进行介绍。It can be understood that the source electronic device and the target electronic device can be any electronic device, including but not limited to laptop computers, smart TVs, smart speakers, tablet computers, servers, wearable devices (such as smart watches, smart bracelets, smart glasses) etc.), head-mounted displays, mobile email devices, portable game consoles, portable music players, reader devices, etc., the embodiments of this application are not limited. The following introduction takes the source electronic device as the mobile phone 10 and the target electronic device as the smart watch 20 as an example.
具体地,图1A根据本申请的一些实施例,示出了一种手机10对联系人信息进行分组存储的示意图;图1B根据本申请的一些实施例,示出了一种智能手表20首次从手机10同步联系人信息的场景示意图;图2A根据本申请的一些实施例,示出了一种智能手表20非首次从手机10同步联系人信息的场景示意图;图2B根据本申请的一些实施例,示出了一种智能手表20非首次从手机10同步联系人信息的过程示意图。Specifically, FIG. 1A shows a schematic diagram of a mobile phone 10 grouping and storing contact information according to some embodiments of the present application; FIG. 1B shows a smart watch 20 for the first time according to some embodiments of the present application. A schematic diagram of a scenario in which the mobile phone 10 synchronizes contact information; Figure 2A shows a schematic diagram of a scenario in which a smart watch 20 synchronizes contact information from the mobile phone 10 for a non-first time according to some embodiments of the present application; Figure 2B shows a schematic diagram of a scenario in which the smart watch 20 synchronizes contact information from the mobile phone 10 according to some embodiments of the present application; , shows a schematic diagram of a process in which the smart watch 20 synchronizes contact information from the mobile phone 10 for a non-first time.
参考图1A,手机10中存储有10000条联系人信息,手机10可以根据联系人信息中的电话号码的后两位,将该10000条联系人信息分为100组,即分组00组到分组99,再根据每个分组的具体内容为各个分组确定一个校验码,例如通过将一个分组中的各条联系人信息的信息摘要进行异或运算来确定该分组的校验码,即校验码00至校验码99。从而参考图1B,智能手表20首次从手机10同步联系人信息时,可以从手机1获取10000条联系人信息,采用和手机10相同的方式对该10000条联系人信息进行分组存储,并同时存储各个分组的校验码。Referring to Figure 1A, there are 10,000 pieces of contact information stored in the mobile phone 10. The mobile phone 10 can divide the 10,000 pieces of contact information into 100 groups according to the last two digits of the phone number in the contact information, that is, group 00 to group 99. , and then determine a check code for each group based on the specific content of each group, for example, by performing an XOR operation on the information summary of each contact information in a group to determine the check code of the group, that is, the check code 00 to check code 99. Therefore, referring to Figure 1B, when smart watch 20 synchronizes contact information from mobile phone 10 for the first time, it can obtain 10,000 contact information from mobile phone 1, use the same method as mobile phone 10 to group and store the 10,000 contact information, and store them simultaneously. Check code for each group.
图2A根据本申请的一些实施例,示出了一种智能手表20再次从手机10同步联系人信息的场景示意图。FIG. 2A shows a schematic diagram of a scenario in which the smart watch 20 synchronizes contact information from the mobile phone 10 again according to some embodiments of the present application.
参考图2A,智能手表20再次从手机10同步联系人信息时,主要包括如下步骤:S21智能手表20可以先从手机10中获取各分组的校验码,并将各分组的校验码和智能手表20中相对应的分组的校验码进行对比,确定出校验码不同的差异分组;S22:智能手表20将差异分组的分组标识发送给手机10;S23:手机10响应于接收到的差异分组的分组标识,将差异分组的联系人信息发送给智能手表20,智能手表20将获取的联系人存储在智能手表20中,完成联系人信息同步。例如,参考图2B,假设手机10的分组01的校验码由于分组01中的联系人信息发生变动,例如用户操作手机10修改、删除或新增联系人信息,由校验码01变更为校验码01',从而智能手表20在从手机10同步联系人信息时,获取到的分组01的校验码为校验码01',而智能手表20中分组01的校验码为校验码01,两者不同,进而确定出分组01为差异分组。智能手表20只需从手机10中获取分组01中的数据,即可完成联系人的同步,而无需对其他99个分组的联系人进行同步,提升了同步效率。Referring to Figure 2A, when the smart watch 20 synchronizes the contact information from the mobile phone 10 again, it mainly includes the following steps: S21 The smart watch 20 can first obtain the verification code of each group from the mobile phone 10, and combine the verification code of each group with the smart phone 10. The check codes of the corresponding groups in the watch 20 are compared to determine the difference groups with different check codes; S22: The smart watch 20 sends the group identification of the difference group to the mobile phone 10; S23: The mobile phone 10 responds to the received difference The group identification of the group is used to send the contact information of the different groups to the smart watch 20. The smart watch 20 stores the obtained contacts in the smart watch 20 to complete the synchronization of the contact information. For example, referring to Figure 2B, assume that the check code of group 01 of the mobile phone 10 changes due to the contact information in the group 01. For example, the user operates the mobile phone 10 to modify, delete or add contact information, and the check code 01 is changed to the check code. The verification code is 01', so when the smart watch 20 synchronizes the contact information from the mobile phone 10, the verification code of group 01 obtained is the verification code 01', and the verification code of group 01 in the smart watch 20 is the verification code. 01, the two are different, and then group 01 is determined to be the difference group. The smart watch 20 only needs to obtain the data in group 01 from the mobile phone 10 to complete the synchronization of contacts without synchronizing the contacts of the other 99 groups, which improves the synchronization efficiency.
可以理解,源电子设备向目标电子设备同步的数据例如可以是能够便于分组的任意数据,例如条目式数据。其中,条目式数据可以是按条进行存储的任意数据,条目数据可以包括至少一个字段,每条数据中至少一个字段包括具体内容,条目式数据包括但不限于联系人、短信、邮件、备忘录、 即时消息等。具体地例如,假设联系人信息包括姓名、电话号码、工作单位,则联系人信息包括三个字段,即姓名、电话号码和工作单位,对于一条联系人信息,姓名、电话号码和工作单位三个字段可以都有具体内容,也可以只是其中部分字段有具体内容。为便于描述,以下以同步的数据为条目式数据为例进行介绍。It can be understood that the data synchronized by the source electronic device to the target electronic device may be, for example, any data that can be conveniently grouped, such as item-type data. The entry data can be any data stored in items. The entry data can include at least one field, and at least one field in each piece of data includes specific content. The entry data includes but is not limited to contacts, text messages, emails, memos, Instant messaging etc. Specifically, for example, assuming that the contact information includes name, phone number, and work unit, the contact information includes three fields, namely name, phone number, and work unit. For a piece of contact information, there are three fields: name, phone number, and work unit. The fields can all have specific content, or only some of the fields can have specific content. For the convenience of description, the following introduction takes the synchronized data as entry-type data as an example.
为便于理解,首先介绍对条目式数据进行分组的技术方案。To facilitate understanding, the technical solution for grouping entry-based data is first introduced.
如前所述,条目式数据中单条数据包括至少一个字段,因此,手机10可以以其中任意一个字段作为该条目式数据的分组字段,并根据每条数据的分组字段的至少部分内容来确定各条数据的分组。一般地,可以以采用每条数据都有具体内容的字段作为分组字段或通常不会进行修改的字段作为分组字段。例如,在条目式数据为联系人的情况下,分组字段可以是电话号码、姓名等;在条目式数据为短信的情况下,分组字段可以是收信人或发信人的号码;在条目式数据为邮件的情况下,分组字段可以是发件人或收件人的邮箱、姓名等;在条目式数据为备忘录的情况下,分组字段可以是备忘录的创建时间;在条目式数据为即时消息的情况下,分组字段可以是各条消息的发送或接收时间等。电子设备可以利用预设的分组规则,根据分组字段中的至少部分内容来确定各条数据的分组。As mentioned above, a single piece of data in the entry-type data includes at least one field. Therefore, the mobile phone 10 can use any one of the fields as the grouping field of the entry-type data, and determine each piece of data based on at least part of the content of the grouping field of each piece of data. Grouping of data. Generally speaking, you can use fields that have specific content for each piece of data as grouping fields or fields that are usually not modified as grouping fields. For example, when the entry data is a contact, the grouping field can be a phone number, name, etc.; when the entry data is a text message, the grouping field can be the number of the recipient or sender; when the entry data is In the case of emails, the grouping field can be the email address, name, etc. of the sender or recipient; in the case of the item data being a memo, the grouping field can be the creation time of the memo; in the case of the item data being instant messages Below, the grouping field can be the sending or receiving time of each message, etc. The electronic device can use preset grouping rules to determine the grouping of each piece of data based on at least part of the content in the grouping field.
具体地,图3A根据本申请的一些实施例,示出了一种联系人信息的分组存储示意图。如图3A所示,联系人信息的字段至少包括电话号码和姓名,手机10可以根据电话号码来确定各条联系人信息的分组,例如将电话号码的后两位作为各条联系人信息的分组,将手机10中存储的联系人信息分为100组(分组00至分组99)。在一些实施例中,手机10可以为每条联系人信息增加一个分组标识,用于指示各条联系人信息所在的分组,从而手机10中各条联系人信息可以按照任意的顺序存储在存储器中,手机10根据各条联系人信息的分组标识即可确定其所在分组,进而手机10无需更改存储联系人信息的数据结构。在另一些实施例中,手机10也可以将联系人信息进行分区存储,即将一个分组的数据存储于存储器中相邻的区域来提高同一个分组中的数据的访问速度。例如,参考图3B,手机10在存储图3A所示的联系人信息时,可以在存储器中设置100个存储分区,并将同一个分组的联系人信息存储到同一存储分区中,从而手机10可以更快地从存储器中读取同一分组的数据时,提升数据同步的效率。Specifically, FIG. 3A shows a schematic diagram of group storage of contact information according to some embodiments of the present application. As shown in FIG. 3A , the contact information fields at least include a phone number and a name. The mobile phone 10 can determine the grouping of each piece of contact information based on the phone number. For example, the last two digits of the phone number are used as the grouping of each piece of contact information. , the contact information stored in the mobile phone 10 is divided into 100 groups (group 00 to group 99). In some embodiments, the mobile phone 10 can add a group identifier to each piece of contact information to indicate the group in which each piece of contact information is located, so that each piece of contact information in the mobile phone 10 can be stored in the memory in any order. , the mobile phone 10 can determine the group it belongs to according to the group identification of each piece of contact information, and the mobile phone 10 does not need to change the data structure for storing the contact information. In other embodiments, the mobile phone 10 can also partition the contact information, that is, store the data of one group in adjacent areas in the memory to improve the access speed of data in the same group. For example, referring to Figure 3B, when the mobile phone 10 stores the contact information shown in Figure 3A, it can set 100 storage partitions in the memory, and store the contact information of the same group in the same storage partition, so that the mobile phone 10 can Improve the efficiency of data synchronization when reading data of the same group from memory faster.
可以理解,在一些实施例中,手机10也可以不先对联系人信息进行分组存储,只是利用联系人信息的分组字段确定出分组00至分组99的校验码,从而手机10可以不对手机10存储的联系人信息的数据结构进行调整,例如为每条联系人信息增加分组标识或将同一分组的联系人信息存储于存储器中的相邻区域,只用维护不同分组的校验码,即可通过本申请各实施例提供的数据同步方法和其他电子设备按分组进行数据同步。It can be understood that in some embodiments, the mobile phone 10 may not store the contact information in groups first, but only uses the grouping field of the contact information to determine the check codes of group 00 to group 99, so that the mobile phone 10 may not store the contact information in groups. Adjust the data structure of the stored contact information, for example, add a group identifier to each piece of contact information or store the contact information of the same group in an adjacent area in the memory, and only need to maintain the check codes of different groups. The data synchronization method provided by each embodiment of the present application is used to perform data synchronization on a group basis with other electronic devices.
可以理解,在另一些实施例中,也可以使用电话号码字段的其他位来确定联系人信息的分组,还可以使用联系人信息的其他字段来确定联系人信息的分组,在此不做限定。It can be understood that in other embodiments, other bits of the phone number field can also be used to determine the grouping of contact information, and other fields of the contact information can also be used to determine the grouping of contact information, which is not limited here.
又例如,图4A示出了一种备忘录的分组存储示意图。参考图4A,备忘录至少包括创建时间和备忘录内容两个字段,手机10可以以备忘录的创建时间为分组字段,确定各条备忘录的分组,例如根据各条备忘录的创建时间对应的秒来确定各条备忘录的分组,将备忘录分为60组。或者,将各条备忘录创建时间对应的毫秒数对10取余数,将备忘录分为100组。As another example, FIG. 4A shows a schematic diagram of group storage of memos. Referring to Figure 4A, the memo includes at least two fields: creation time and memo content. The mobile phone 10 can use the creation time of the memo as a grouping field to determine the grouping of each memo. For example, determine the grouping of each memo based on the seconds corresponding to the creation time of each memo. Grouping of memos, divide memos into 60 groups. Or, take the remainder of 10 from the number of milliseconds corresponding to the creation time of each memo, and divide the memos into 100 groups.
可以理解,在另一些实施例中,也可以使用创建时间的其他位来确定备忘录的分组,还可以使用备忘录的其他字段来确定备忘录的分组,在此不做限定。It can be understood that in other embodiments, other bits of the creation time can also be used to determine the grouping of the memo, and other fields of the memo can also be used to determine the grouping of the memo, which is not limited here.
又例如,图4B示出了一种邮件的分组存储示意图。参考图4B,邮件至少包括发件人/收件人和内容两个字段,电子设备以发件人/收件人为分组字段,确定各封邮件的分组,例如根据发件人或收 件人的电子邮件地址的首字母对应的美国信息交换标准代码(American Standard Code for Information Interchange,ASCII)的后两位,将各封邮件分为100组。As another example, FIG. 4B shows a schematic diagram of group storage of emails. Referring to Figure 4B, the email includes at least two fields: sender/recipient and content. The electronic device uses sender/recipient as the grouping field to determine the grouping of each email, for example, according to the sender or recipient. Each email is divided into 100 groups based on the last two digits of the American Standard Code for Information Interchange (ASCII) corresponding to the first letter of the sender's email address.
可以理解,在另一些实施例中,也可以使用发件人/收件人字段的其他位来确定邮件的分组,还可以使用邮件的其他字段来确定邮件的分组,在此不做限定。It can be understood that in other embodiments, other bits of the sender/recipient field can also be used to determine the grouping of emails, and other fields of the email can also be used to determine the grouping of emails, which is not limited here.
再例如,图4C示出了一种短信的分组存储示意图。参考图4C,短信至少包括发信人/收信人号码、内容两个字段,手机10可以以短信的发信人/收信人号码字段为分组字段,确定各条短信的分组,例如将发信人/收信人号码字段中的后两位作为分组,将短信为100组。As another example, FIG. 4C shows a schematic diagram of group storage of short messages. Referring to Figure 4C, a text message includes at least two fields: sender/recipient number and content. The mobile phone 10 can use the sender/recipient number field of the text message as a grouping field to determine the grouping of each text message, for example, the sender/recipient. The last two digits in the number field are used as groups, and the text messages are divided into 100 groups.
可以理解,在另一些实施例中,也可以使用发信人/收信人字段的其他位来确定短信的分组,还可以使用短信的其他字段来确定短信的分组,在此不做限定。It can be understood that in other embodiments, other bits of the sender/recipient field can also be used to determine the grouping of short messages, and other fields of the short message can also be used to determine the grouping of short messages, which is not limited here.
可以理解,以上各类条目式数据的分组字段和根据分组字段进行分组的方式只是一种示例,在另一些实施例中,也可以采用其他分组字段以其他方式对各类条目式数据进行分组,在此不做限定。It can be understood that the above grouping fields of various types of item-type data and the method of grouping according to the grouping fields are just examples. In other embodiments, other grouping fields can also be used to group various types of item-type data in other ways. No limitation is made here.
为便于理解,下面先介绍手机10对条目式数据进行分组存储、生成及更新各分组的校验码的技术方案。For ease of understanding, the technical solution for the mobile phone 10 to store entry-type data in groups, generate and update the check codes of each group is first introduced below.
具体地,图5根据本申请的一些实施例,示出了一种对数据进行分组存储的流程示意图。该流程的执行主体为手机10,例如手机10中的至少一个应用程序或服务,如图5所示,该流程包括如下步骤。Specifically, FIG. 5 shows a schematic flowchart of group storage of data according to some embodiments of the present application. The execution subject of this process is the mobile phone 10, for example, at least one application or service in the mobile phone 10. As shown in Figure 5, the process includes the following steps.
S501:获取条目式数据。S501: Obtain entry-level data.
示例性地,手机10中的应用程序,例如联系人应用、短信就用、邮件应用、备忘录应用、即时通信应用(例如畅连TM、微信TM、QQTM等),可以从手机10的存储器中或者应用程序对应的服务器中获取条目式数据,例如联系人、短信、邮件、备忘录、即时通信应用的消息等。为便于描述,以下各步骤以条目式数据为联系人信息为例进行介绍。For example, applications in the mobile phone 10, such as contact applications, text messaging applications, email applications, memo applications, instant messaging applications (such as ChanglianTM , WeChatTM , QQTM, etc.), can be retrieved from the memory of the mobile phone 10. Or obtain item-type data from the server corresponding to the application, such as contacts, text messages, emails, memos, messages from instant messaging applications, etc. For the convenience of description, the following steps are introduced using entry-type data as contact information as an example.
S502:确定条目式数据中各条数据的分组。S502: Determine the grouping of each piece of data in the itemized data.
示例性地,手机10根据获取的条目式数据,确定出条目式数据的分组字段,并基于确定出的分组字段得到各条数据的分组。For example, the mobile phone 10 determines the grouping field of the itemized data based on the acquired itemized data, and obtains the grouping of each piece of data based on the determined grouping field.
例如,参考图3A,对于联系人信息,手机10可以将电话号码字段作为分组字段,并将电话号码的后2位作为各条数据的分组,将联系人信息分为100组;又例如,参考图4A,对于备忘录,可以以备忘录的创建时间为分组字段,将备忘录的创建时间的秒位作为各条备忘录的分组字段,将备忘录分为60组;又例如,参考图4B,对于邮件,可以将邮件的发件人/收件人的电子邮件地址的首字母的ASCII码的后2位作为分组字段,将邮件分为100组;再例如,参考图4C,对于短信,可以以发信人/收信人号码为分组字段,以发信人/收信人号码的后两位作为分组,将短信分为100组。For example, referring to Figure 3A, for contact information, the mobile phone 10 can use the phone number field as a grouping field, and use the last 2 digits of the phone number as a grouping of each piece of data to divide the contact information into 100 groups; for another example, refer to Figure 4A, for memos, the creation time of the memo can be used as the grouping field, and the seconds of the memo's creation time can be used as the grouping field of each memo, and the memos can be divided into 60 groups; for another example, referring to Figure 4B, for emails, you can Use the last 2 digits of the ASCII code of the first letter of the email address of the sender/recipient of the email as the grouping field to divide the email into 100 groups; for another example, refer to Figure 4C, for text messages, you can use the sender/ The recipient number is a grouping field, and the last two digits of the sender/recipient number are used as groups to divide the text messages into 100 groups.
可以理解,在另一些实施例中,也可以采用其他字段对各类条目式数据进行分组,在此不做限定。It can be understood that in other embodiments, other fields may also be used to group various types of entry-type data, which is not limited here.
可以理解,手机10在确定出各条数据的分组后,可以对各条数据进行分组存储,例如,参考图3A,手机10可以为各条联系人信息增加一个分组标识,用于指示各条联系人数据的分组,从而不需要对存储的各条联系人信息的存储位置和结构进行调整;又例如,参考图3B,手机10可以在存储器中设置多个存储分区,并将属于同一分组的联系人信息存储器在同一个存储分区中,从而可以提高手机10从存储器中读取同一分组的数据的速度,提升手机10向其他电子设备发送同一分组中的数据的速度。It can be understood that after determining the grouping of each piece of data, the mobile phone 10 can group and store each piece of data. For example, referring to Figure 3A, the mobile phone 10 can add a grouping identifier to each piece of contact information to indicate each piece of contact. Grouping of personal data, so that there is no need to adjust the storage location and structure of each stored contact information; for another example, referring to Figure 3B, the mobile phone 10 can set multiple storage partitions in the memory, and store contacts belonging to the same group The personal information memory is in the same storage partition, which can increase the speed of the mobile phone 10 reading data in the same group from the memory and improve the speed of the mobile phone 10 sending data in the same group to other electronic devices.
S503:确定各分组中各条数据的消息摘要。 S503: Determine the message digest of each piece of data in each group.
示例性地,手机10可以通过前述MD4、MD5、SHA-1等消息摘要算法确定各条数据的消息摘要,该消息摘要可以用于确定各分组的校验码。For example, the mobile phone 10 can determine the message digest of each piece of data through the aforementioned message digest algorithms such as MD4, MD5, SHA-1, etc., and the message digest can be used to determine the check code of each packet.
例如,对于前述图3A所示的联系人信息中,利用MD5算法得到的第1条联系人信息“123456798LILY”的消息摘要为32位的16进制数“0FA340B963445F53D9EFC042E39AB3AA”(32位16进制数对应于128位二进制数),利用MD5算法得到第1001条联系人信息“123457698RALPH”的息摘要为32位的16进制数“EF93E986151D6912858BF5BE101E4029”。For example, in the contact information shown in Figure 3A, the message digest of the first contact information "123456798LILY" obtained using the MD5 algorithm is a 32-bit hexadecimal number "0FA340B963445F53D9EFC042E39AB3AA" (32-bit hexadecimal number corresponds to (based on a 128-bit binary number), use the MD5 algorithm to obtain the information summary of the 1001st contact information "123457698RALPH" which is a 32-bit hexadecimal number "EF93E986151D6912858BF5BE101E4029".
S504:根据各分组中各条数据的消息摘要,确定各分组的校验码。S504: Determine the check code of each group based on the message digest of each piece of data in each group.
示例性地,手机10可以根据步骤S503确定出的各条数据的消息摘要,将各条数据的消息摘要进行逻辑运算(例如与、或、非、异或等)或算术运算(例如加、减、乘、除等),得到各个分组的校验码。For example, the mobile phone 10 can perform logical operations (such as AND, OR, NOT, XOR, etc.) or arithmetic operations (such as addition, subtraction) on the message digest of each piece of data determined in step S503. , multiplication, division, etc.) to obtain the check code of each group.
在一些实施例中,手机10可以将一个分组中的各条数据的消息摘要逐个进行异或运算,来得到各分组的校验码。例如,假设某个分组中包括n条数据,第i条数据的消息摘要为Hashi,则该分组的校验码可以标识为Hash1⊕Hash2⊕……⊕Hashn(⊕为异或运算符),其中各条数据的消息摘要的顺序可以任意调整。具体地例如,前述图3A中分组98中包括第1条联系人信息和第1001条联系人信息,则分组98的校验码为该两条联系人信息的消息摘要的异或运算结果,即0FA340B963445F53D9EFC042E39AB3AA⊕EF93E986151D6912858BF5BE101E4029=D11EEB639BC9B20AE321AF1CF384F383。In some embodiments, the mobile phone 10 can perform XOR operations on the message digests of each piece of data in a group one by one to obtain the check code of each group. For example, assuming that a certain group includes n pieces of data, and the message digest of the i-th piece of data is Hash i , then the check code of the group can be identified as Hash 1 ⊕Hash 2 ⊕...⊕Hash n (⊕ is an exclusive OR operation symbol), the order of the message digest of each piece of data can be adjusted arbitrarily. For example, if the group 98 in Figure 3A includes the first piece of contact information and the 1001st piece of contact information, then the check code of the group 98 is the XOR operation result of the message digests of the two pieces of contact information, that is, 0FA340B963445F53D9EFC042E39AB3AA⊕EF93E986151D6912858BF5BE101E4029=D11EEB639BC9B20AE321AF1CF384F383.
可以理解,在另一些实施例中,也可以通过其他方式来确定各分组的校验码,在此不做限定。It can be understood that in other embodiments, the check code of each group can also be determined in other ways, which is not limited here.
可以理解,在一些实施例中,手机10可以维护一个数据用于存储各分组的校验码,例如可以用一个包括k个元素的向量,来存储各分组的校验码,其中k为分组的数量,从而该向量中的一个元素可以对应于一个分组的校验码。It can be understood that in some embodiments, the mobile phone 10 can maintain a data for storing the check code of each group. For example, a vector including k elements can be used to store the check code of each group, where k is the group. Quantity, so that one element in the vector can correspond to the check code of a group.
可以理解,手机10在首次对条目式数据进行分组存储时,可以通过前述步骤S501至步骤S504来得到各条数据的分组及各分组的校验码,并在首次将分组存储的条目式数据同步给其他电子设备,例如前述智能手表20时,将各分组中的数据及各分组的校验码发送给智能手表20。It can be understood that when the mobile phone 10 groups and stores the entry-type data for the first time, it can obtain the grouping of each piece of data and the check code of each group through the aforementioned steps S501 to S504, and synchronizes the grouped storage of the entry-type data for the first time. When sending the data to other electronic devices, such as the aforementioned smart watch 20 , the data in each group and the verification code of each group are sent to the smart watch 20 .
可以理解,前述步骤S501至步骤S504的执行顺序只是一种示例,在另一些实施例中,可以调整部分步骤的执行顺序,也可以拆分或组合部分步骤,在此不做限定。例如前述步骤S502和步骤S503的顺序可以交换、前述步骤S503和步骤504可以合并等。It can be understood that the execution order of steps S501 to S504 is just an example. In other embodiments, the execution order of some steps can be adjusted, and some steps can be split or combined, which is not limited here. For example, the order of the aforementioned steps S502 and step S503 can be exchanged, the aforementioned steps S503 and step 504 can be combined, and so on.
下面介绍手机10在对条目式数据进行维护时,更新各分组的校验码的技术方案。The following describes the technical solution for the mobile phone 10 to update the check codes of each group when maintaining the entry-type data.
具体地,图6根据本申请的一些实施例,示出了一种分组校验码的更新方法流程示意图。该流程的执行主体为手机10,例如手机10中的至少一个应用程序或服务,如图6所示,该流程包括如下步骤。Specifically, FIG. 6 shows a schematic flowchart of a method for updating a group check code according to some embodiments of the present application. The execution subject of this process is the mobile phone 10, for example, at least one application or service in the mobile phone 10. As shown in Figure 6, the process includes the following steps.
S601:检测到对条目式数据的维护操作。S601: Maintenance operation on entry-based data is detected.
示例性地,手机10可以在检测到用户对条目式数据的维护操作的情况下,通过执行以下步骤S602至步骤S606来更新各个分组的校验码。For example, the mobile phone 10 may update the check codes of each group by performing the following steps S602 to S606 when detecting the user's maintenance operation on the entry-type data.
可以理解,对条目式数据的维护操作包括但不限于新增、删除、修改。It can be understood that maintenance operations on entry-type data include but are not limited to adding, deleting, and modifying.
例如,图7A示出手机10中显示的畅连TM应用的联系人界面示意图,用户可以通过点击“增加”控件70,进入图7B所示的选项界面,该选项界面中包括选项菜单71;用户可以通过对“添加联系人”控件711的点击来添加联系人(即新增操作),手机10在检测到用户对“添加联系人”控件711的点击操作后,即可检测到对条目式数据的维护操作。 For example, Figure 7A shows a schematic diagram of the contact interface of the Changlian TM application displayed on the mobile phone 10. The user can click the "Add" control 70 to enter the option interface shown in Figure 7B, which includes an option menu 71; Contacts can be added by clicking on the "Add Contact" control 711 (i.e., adding a new operation). After detecting the user's click operation on the "Add Contact" control 711, the mobile phone 10 can detect entry data maintenance operations.
又例如,用户可以在图7A所示的联系人界面中查看一个联系人的详细信息,例如通过点击JIM的头像,进入到图7C所示的JIM的联系人详情界面,用户可以通过对“选项”控件72的点击操作,进入图7D所示的选项界面,该选项界面中包括选项菜单73;用户可通过对“编辑联系人”控件731的操作来编辑JIM的联系人信息、通过对“删除联系人”控件732的操作来删除JIM的联系人信息。从而手机10在检测到用户“对编辑联系人”控件731或“删除联系人”控件732的操作后,可以检测到对条目式数据的维护操作。For another example, the user can view the detailed information of a contact in the contact interface shown in Figure 7A, for example, by clicking on JIM's avatar to enter the JIM contact details interface shown in Figure 7C. The user can click on the "option" "Click operation on the control 72 to enter the option interface shown in Figure 7D, which includes an option menu 73; the user can edit JIM's contact information by operating the "Edit Contact" control 731, and by operating the "Delete" The operation of "Contact" control 732 is to delete JIM's contact information. Therefore, after detecting the user's operation of the "edit contact" control 731 or the "delete contact" control 732, the mobile phone 10 can detect the maintenance operation of the entry-type data.
可以理解,以上所示手机10检测到对条目式数据的维护操作的情况只是一种示例,在另一些实施例中,针对不同的条目式数据,不同的应用程序或服务,手机10也可以在其他情形下检测到对条目式数据的维护操作,在此不做限定。It can be understood that the situation where the mobile phone 10 detects the maintenance operation on the entry data shown above is just an example. In other embodiments, for different entry data, different applications or services, the mobile phone 10 can also perform maintenance operations on the entry data. Maintenance operations on entry-based data are detected in other situations, which are not limited here.
S602:确定维护操作的类型。S602: Determine the type of maintenance operation.
示例性地,手机10检测到用户对条目式数据的维护操作后,可以确定出维护操作的类型。在确定出维护操作为新增或删除的情况下,转至步骤S603;在确定出维护操作为修改的情况下,转至步骤S605。For example, after the mobile phone 10 detects the user's maintenance operation on the entry-type data, the type of the maintenance operation can be determined. If it is determined that the maintenance operation is adding or deleting, go to step S603; if it is determined that the maintenance operation is modifying, go to step S605.
可以理解,维护操作的类型可以包括新增、删除和修改,针对不同类型的维护操作,手机10可以采用不同的方式来更新维护操作对应的目标分组的校验码。It can be understood that the types of maintenance operations may include addition, deletion, and modification. For different types of maintenance operations, the mobile phone 10 may use different methods to update the check code of the target group corresponding to the maintenance operation.
S603:确定新增或删除的目标数据所对应的目标分组。S603: Determine the target group corresponding to the newly added or deleted target data.
示例性地,手机10可以根据用户新增的目标数据中的分组字段,确定新增的目标数据对应的目标分组,或者根据用户删除的目标数据的分组标识确定删除操作的目标数据对应的目标分组。For example, the mobile phone 10 can determine the target group corresponding to the newly added target data according to the group field in the target data added by the user, or determine the target group corresponding to the target data of the deletion operation based on the group identification of the target data deleted by the user. .
例如,手机10在新增一个联系人信息时,可以根据用户输入的新增的联系人信息的电话号码的后两位确定目标分组,例如,假设新增的联系人的电话号码为“123684798”,新增的联系人信息对应的目标分组为分组98,又例如,假设用户删除的联系人信息为LILY的联系人信息,则参考图3A可知LILY的联系人信息对应的目标分组为分组98。For example, when the mobile phone 10 adds a new contact information, the target group can be determined based on the last two digits of the phone number of the new contact information input by the user. For example, assume that the phone number of the new contact is "123684798" , the target group corresponding to the newly added contact information is group 98. For another example, assuming that the contact information deleted by the user is LILY's contact information, referring to Figure 3A, it can be seen that the target group corresponding to LILY's contact information is group 98.
S604:确定目标数据的消息摘要,并基于目标数据的消息摘要更新目标分组的校验码。S604: Determine the message digest of the target data, and update the check code of the target packet based on the message digest of the target data.
手机10根据用户新增的数据或删除的数据的具体内容,确定出目标数据的消息摘要,并基于该消息摘要更新目标分组的校验码。The mobile phone 10 determines the message summary of the target data based on the specific content of the user's newly added data or deleted data, and updates the check code of the target group based on the message summary.
例如,假设用户新增的联系人信息为“123684798KATE”(即新增的联系人的姓名为KATE,电话号码为123684798),则利用MD5算法得到的目标数据的消息摘要为:2566590C52CB05017DB7A3E3A102C392;又例如,假设用户删除的联系人信息为LILY的联系人信息,则利用MD5算法得到的目标数据的消息摘要为:0FA340B963445F53D9EFC042E39AB3AA。For example, assuming that the contact information added by the user is "123684798KATE" (that is, the name of the new contact is KATE and the phone number is 123684798), the message summary of the target data obtained by using the MD5 algorithm is: 2566590C52CB05017DB7A3E3A102C392; for another example, Assuming that the contact information deleted by the user is LILY's contact information, the message digest of the target data obtained using the MD5 algorithm is: 0FA340B963445F53D9EFC042E39AB3AA.
可以理解,手机10在更新分组的校验码过程中确定目标数据的消息摘要的方法,与手机10首次生成分组存储的条目式数据各分组的校验码采用的计算各条数据的消息摘要的方法应当相同。It can be understood that the method used by the mobile phone 10 to determine the message digest of the target data in the process of updating the check code of the group is the same as the method used by the mobile phone 10 to calculate the message digest of each piece of data when it first generates the check code of each group of entry-type data stored in the group. The approach should be the same.
在确定出目标数据的消息摘要后,手机10可以将目标数据的消息摘要和目标分组的校验码进行异或运算,并将运算结果作为目标分组的新校验码。例如,在维护操作为删除LILY的联系人信息的情况下,手机10可以将前述目标数据的消息摘要0FA340B963445F53D9EFC042E39AB3AA与前述步骤S504中得到的分组98的校验码D11EEB639BC9B20AE321AF1CF384F383进行异或运算,得到新的校验码EF93E986151D6912858BF5BE101E4029;又例如,在维护操作为新增KATE的联系人信息的情况下,手机10可以将前述目标数据的消息摘要2566590C52CB05017DB7A3E3A102C392与前述步骤S504中得到的分组98的校验码D11EEB639BC9B20AE321AF1CF384F383进行异或运算,得到新的校验码D3488EF35EE50808184EE10752863011。如此,对于一条数据的新增或删除,手机10通过一次异或运 算即可更新目标分组的校验码,运算量少,更新速度快。After determining the message digest of the target data, the mobile phone 10 can perform an XOR operation on the message digest of the target data and the check code of the target group, and use the operation result as a new check code of the target group. For example, when the maintenance operation is to delete LILY's contact information, the mobile phone 10 can perform an XOR operation on the message digest 0FA340B963445F53D9EFC042E39AB3AA of the aforementioned target data and the check code D11EEB639BC9B20AE321AF1CF384F383 of group 98 obtained in the aforementioned step S504 to obtain a new checksum. The verification code is EF93E986151D6912858BF5BE101E4029; for another example, when the maintenance operation is to add the contact information of KATE, the mobile phone 10 can combine the message digest 2566590C52CB05017DB7A3E3A102C392 of the aforementioned target data with the verification code D11EEB639BC9B20 of group 98 obtained in the aforementioned step S504. AE321AF1CF384F383 XOR After calculation, the new check code D3488EF35EE50808184EE10752863011 is obtained. In this way, for the addition or deletion of a piece of data, the mobile phone 10 performs an XOR operation The check code of the target group can be updated by calculation, which requires less calculation and fast update speed.
可以理解,在另一些实施例中,手机10也可以通过其他方式来更新校验码,例如将目标分组中的各条数据的消息摘要进行异或来重新计算目标分组的校验码,具体可以参考前述步骤S504,在此不做赘述。It can be understood that in other embodiments, the mobile phone 10 can also update the check code in other ways, such as XORing the message digest of each piece of data in the target group to recalculate the check code of the target group. Specifically, Refer to the aforementioned step S504, which will not be described again here.
S605:确定进行修改操作的目标数据对应的目标分组。S605: Determine the target group corresponding to the target data for modification operation.
示例性地,手机10根据用户进行修改操作目标数据的分组标识,确定进行修改操作的目标数据对应的目标分组。For example, the mobile phone 10 determines the target group corresponding to the target data for the modification operation based on the group identification of the target data for the modification operation by the user.
例如,手机10在确定修改操作对应的字段不是分组字段的情况下,可以根据修改操作对应的联系人信息的分组标识来确定目标分组。例如用户修改的联系人信息为LILY的联系人信息,则参考图3A可知LILY的联系人信息对应的目标分组为分组98。For example, when the mobile phone 10 determines that the field corresponding to the modification operation is not a group field, the mobile phone 10 may determine the target group according to the group identifier of the contact information corresponding to the modification operation. For example, the contact information modified by the user is LILY's contact information. Referring to FIG. 3A , it can be seen that the target group corresponding to LILY's contact information is group 98.
又例如,手机10在确定修改操作对应的字段是分组字段的情况下,目标分组可以包括两个分组:一个是修改操作对应的联系人信息的分组标识对应的分组(以下称为第一目标分组),另一个是根据修改后的分组字段确定的分组(以下称为第二目标分组)。具体地,参考图3A,假设修改操作将LILY的联系人信息中的电话号码由123456798修改为123654720,则第一目标分组可以是LILY的联系人信息中的分组标识对应分组98、第二目标分组可以是修改后的电话号码123654720对应的分组20。For another example, when the mobile phone 10 determines that the field corresponding to the modification operation is a group field, the target group may include two groups: one is a group corresponding to the group identifier of the contact information corresponding to the modification operation (hereinafter referred to as the first target group). ), and the other is a group determined based on the modified grouping field (hereinafter referred to as the second target group). Specifically, referring to Figure 3A, assuming that the modification operation modifies the phone number in LILY's contact information from 123456798 to 123654720, the first target group can be the group ID corresponding to the group 98 in LILY's contact information, the second target group It can be group 20 corresponding to the modified phone number 123654720.
S606:确定目标数据在修改前和修改后的消息摘要,并基于目标数据在修改前和修改后的消息摘要更新目标分组的校验码。S606: Determine the message digest of the target data before modification and after modification, and update the check code of the target group based on the message digest of the target data before modification and after modification.
示例性地,手机10确定目标数据在修改前和修改后的消息摘要,并基于目标数据在修改前和修改后的消息摘要更新目标分组校验码。For example, the mobile phone 10 determines the message digest of the target data before modification and after modification, and updates the target packet check code based on the message digest of the target data before modification and after modification.
例如,手机10在修改操作对应的字段不是分组字段的情况下,可以先将目标数据在修改前的消息摘要与目标分组的校验码进行异或运算,再将运算结果与目标数据在修改后的消息摘要进行异或运算,得到目标分组的新校验码。如此,对于一条数据的修改,手机10通过两次异或运算即可更新目标分组的校验码,运算量少,更新速度快。For example, when the field corresponding to the modification operation of the mobile phone 10 is not a grouping field, the mobile phone 10 can first perform an XOR operation on the message digest of the target data before modification and the check code of the target group, and then perform an XOR operation on the operation result and the target data after modification. Perform XOR operation on the message digest to obtain the new check code of the target group. In this way, for the modification of a piece of data, the mobile phone 10 can update the check code of the target group through two XOR operations, which requires less calculation and fast update speed.
具体地,假设目标数据为LILY的联系人信息,目标分组为前述分组98,LILY的联系人信息修改后为“123456798135654525LILY”(即新增一个电话号码135654525),则利用MD5算法可以得到目标数据修改后的消息摘要为7E327F6E3E117847411E52B2D9B0B3CE。从而手机10可以先将前述目标数据修改前的消息摘要0FA340B963445F53D9EFC042E39AB3AA与前述分组98的校验码D11EEB639BC9B20AE321AF1CF384F383进行异或运算,得到运算结果EF93E986151D6912858BF5BE101E4029,再将该运算结果与修改后的消息摘要7E327F6E3E117847411E52B2D9B0B3CE进行异或运算,得到目标分组的新校验码F01F765D9A99AE06AB98C210C9AEF3E7。Specifically, assuming that the target data is LILY's contact information, the target group is the aforementioned group 98, and LILY's contact information is modified to "123456798135654525LILY" (that is, a new phone number 135654525 is added), then the MD5 algorithm can be used to obtain the target data modification The final message digest is 7E327F6E3E117847411E52B2D9B0B3CE. Therefore, the mobile phone 10 can first perform an XOR operation on the message digest 0FA340B963445F53D9EFC042E39AB3AA before the modification of the target data and the check code D11EEB639BC9B20AE321AF1CF384F383 of the aforementioned group 98 to obtain the operation result EF93E986151D6912858BF5BE101E4029, and then perform the operation The result is XORed with the modified message digest 7E327F6E3E117847411E52B2D9B0B3CE , get the new check code F01F765D9A99AE06AB98C210C9AEF3E7 of the target group.
又例如,手机10在修改操作对应的字段是分组字段的情况下,修改操作实际可以分解为在第一目标分组中的删除操作和在第二目标分组中的新增操作,从而手机10可以将第一目标分组的校验码更新为目标数据修改前的消息摘要和第一目标分组的当前校验码的异或运算结果、将第二目标分组的校验码更新为目标数据修改后的消息摘要和第二目标分组的当前校验码的异或运算结果。For another example, when the field corresponding to the modification operation of the mobile phone 10 is a group field, the modification operation can actually be decomposed into a deletion operation in the first target group and a new operation in the second target group, so that the mobile phone 10 can The check code of the first target group is updated to the XOR operation result of the message digest before the target data is modified and the current check code of the first target group, and the check code of the second target group is updated to the message after the target data is modified. The XOR operation result of the digest and the current check code of the second target group.
具体地,假设目标数据为LILY的联系人信息,修改操作为将LILY的电话号码由123456798修改为123654720,则目标数据修改后的消息摘要为:利用MD5算法得到的“123654720LILY”对应的消息摘要:613AC4F4E14A19583B05EACD3EF51357。手机10可以将前述目标数据修改前的消息摘要0FA340B963445F53D9EFC042E39AB3AA与分组98的当前校验码D11EEB639BC9B20AE321AF1CF384F383 做异或运算,得到分组98的新校验码EF93E986151D6912858BF5BE101E4029。手机10还可以将目标数据修改后的消息摘要613AC4F4E14A19583B05EACD3EF51357,与分组20当前的校验码9123674BA490B1E6CB5F45536BC8DEE2做异或运算,得到分组20的新校验码F019A3BF45DAA8BEF05AAF9E553DCDB5。可以理解,在另一些实施例中,手机10也可以通过其他方式来更新目标分组的校验码,例如将进行维护操作后的目标数据中的各条数据的消息摘要逐个进行异或运算来更新目标分组的校验码,在此不做限定。Specifically, assuming that the target data is LILY's contact information, and the modification operation is to modify LILY's phone number from 123456798 to 123654720, then the modified message summary of the target data is: the message summary corresponding to "123654720LILY" obtained using the MD5 algorithm: 613AC4F4E14A19583B05EACD3EF51357. Mobile phone 10 can combine the message digest 0FA340B963445F53D9EFC042E39AB3AA before the aforementioned target data modification with the current check code D11EEB639BC9B20AE321AF1CF384F383 of group 98. Do XOR operation to get the new check code EF93E986151D6912858BF5BE101E4029 of group 98. Mobile phone 10 can also perform an XOR operation on the modified message digest 613AC4F4E14A19583B05EACD3EF51357 of the target data and the current check code 9123674BA490B1E6CB5F45536BC8DEE2 of group 20 to obtain the new check code F019A3BF45DAA8BEF05AAF9E553DCDB5 of group 20. It can be understood that in other embodiments, the mobile phone 10 can also update the check code of the target group through other methods, such as performing an XOR operation on the message digests of each piece of data in the target data after the maintenance operation is performed one by one to update. The check code of the target group is not limited here.
下面结合具体的应用场景介绍本申请的技术方案。The technical solution of this application is introduced below based on specific application scenarios.
在前述图2A所示的场景中,智能手表20在非首次从手机10同步联系人信息时,可以从手机10中获取各分组的校验码,然后将获取的分组校验码与智能手表20中对应分组的校验码进行对比,确定出手机10中与智能手表20联系人信息有差异的差异分组,再从手机10中获取差异分组的联系人信息,并将差异分组的联系人信息存储在智能手表20中的对应分组中、将该对应分组的校验码更新为手机10中的差异分组的校验码。如此,智能手表20只需和手机10对差异分组的联系人信息进行同步,提高了同步效率。In the scenario shown in FIG. 2A , when the smart watch 20 synchronizes contact information from the mobile phone 10 for the first time, it can obtain the verification codes of each group from the mobile phone 10 and then compare the obtained group verification codes with the smart watch 20 Compare the check codes of the corresponding groups in the mobile phone 10 to determine the difference group whose contact information is different from that of the smart watch 20, then obtain the contact information of the difference group from the mobile phone 10, and store the contact information of the difference group In the corresponding group in the smart watch 20 , the check code of the corresponding group is updated to the check code of the difference group in the mobile phone 10 . In this way, the smart watch 20 only needs to synchronize the differentially grouped contact information with the mobile phone 10, thereby improving the synchronization efficiency.
具体地,图8根据本申请的一些实施例,示出了一种数据同步方法的交互流程示意图。该流程的包括如下步骤。Specifically, FIG. 8 shows a schematic interactive flow diagram of a data synchronization method according to some embodiments of the present application. The process includes the following steps.
S801:手机10检测到与智能手表20进行蓝牙配对的操作。S801: The mobile phone 10 detects the Bluetooth pairing operation with the smart watch 20 .
示例性地,手机10检测到用户在手机10上与智能手表20进行蓝牙配对的操作后,触发本申请实施例的数据同步方法。For example, after the mobile phone 10 detects that the user performs a Bluetooth pairing operation on the mobile phone 10 with the smart watch 20, the data synchronization method in the embodiment of the present application is triggered.
例如,参考图9A,用户可以通过对手机10的下拉菜单栏中的蓝牙控件901的点击操作,触发图9B所示的蓝牙配对界面902,手机10在检测到用户对智能手表20的选择控件903的点击操作后,可以检测到与智能手表20进行蓝牙配对的操作。For example, referring to Figure 9A, the user can trigger the Bluetooth pairing interface 902 shown in Figure 9B by clicking on the Bluetooth control 901 in the drop-down menu bar of the mobile phone 10. The mobile phone 10 detects the user's selection of the control 903 on the smart watch 20. After the click operation, the operation of Bluetooth pairing with the smart watch 20 can be detected.
可以理解,在另一些实施例中,用户也可以通过其他手机10的操作系统提供的方式触发与智能手表20进行蓝牙配对的指令,在此不做限定。It can be understood that in other embodiments, the user can also trigger the Bluetooth pairing instruction with the smart watch 20 through the method provided by the operating system of other mobile phones 10 , which is not limited here.
S802:手机10和智能手表20建立蓝牙通信连接。S802: The mobile phone 10 and the smart watch 20 establish a Bluetooth communication connection.
示例性地,手机10和智能手表20建立蓝牙通信连接,以用于进行联系人的同步。For example, the mobile phone 10 and the smart watch 20 establish a Bluetooth communication connection for synchronizing contacts.
可以理解,在另一些实施例中,手机10和智能手表建立的用于进行联系人同步的连接也可以是其他连接,例如近场通信、无线局域网等,本申请对手机10和智能手表20间的通信连接方式不做限定。It can be understood that in other embodiments, the connection established by the mobile phone 10 and the smart watch for contact synchronization can also be other connections, such as near field communication, wireless local area network, etc. This application describes the connection between the mobile phone 10 and the smart watch 20 The communication connection method is not limited.
S803:智能手表20向手机10发送联系人同步请求。S803: The smart watch 20 sends a contact synchronization request to the mobile phone 10.
示例性地,智能手表20在和手机10建立蓝牙通信连接后,向手机10发送联系人同步请求。For example, after establishing a Bluetooth communication connection with the mobile phone 10, the smart watch 20 sends a contact synchronization request to the mobile phone 10.
在一些实施例中,在智能手表20中未存储有联系人信息的情况下,也即是智能手表20首次与手机10进行联系人同步的情况下,智能手表20发送的联系人同步请求中还可以包括首次同步的标识,以便于手机10根据该标识采用首次同步的同步方法。In some embodiments, when the smart watch 20 does not store contact information, that is, when the smart watch 20 performs contact synchronization with the mobile phone 10 for the first time, the contact synchronization request sent by the smart watch 20 also contains The identifier of the first synchronization may be included, so that the mobile phone 10 can adopt the synchronization method of the first synchronization according to the identifier.
可以理解,在一些实施例中,智能手表20中用于进行数据同步的系统服务,可以在和其他电子设备建立通信连接后,向其他电子设备发起数据同步请求。在另一些实施例中,也可以由智能手表20中的应用程序来发起数据同步请求,例如由联系人应用向手机10发起对通讯录中的联系人的同步请求,由畅连TM应用发起对畅连TM应用中的联系人的同步请求,由邮件应用发起对邮件的同步请求,由短信应用发起对短信的同步请求,由备忘录应用发起对备忘录同步请求,由即时通信应用发起对即时通信应用中的消息进行同步的请求等。本申请实施例对发起数据同步请求的应用或服务不做限 定。It can be understood that in some embodiments, the system service used for data synchronization in the smart watch 20 can initiate a data synchronization request to other electronic devices after establishing a communication connection with other electronic devices. In other embodiments, the data synchronization request may also be initiated by an application in the smart watch 20 . For example, the Contacts application may initiate a synchronization request for the contacts in the address book to the mobile phone 10 , and the Changlian TM application may initiate a synchronization request for the contacts in the address book. For synchronization requests of contacts in the ChanglianTM application, the mail application initiates the synchronization request for emails, the SMS application initiates the synchronization request for text messages, the memo application initiates the synchronization request for memos, and the instant messaging application initiates the synchronization request for instant messaging applications. Messages in the message to perform synchronization requests, etc. The embodiment of this application does not limit the applications or services that initiate data synchronization requests. Certainly.
可以理解,在一些实施例中,手机10针对首次同步和非首次同步设置有不同的调用接口,以便于其他电子设备可以通过不同的调用接口,与手机10进行首次或非首次联系人信息的同步。例如,手机10可以针对首次同步设置全量同步接口,从而智能手表20可以通过该全量同步接口,来从手机10中同步所有的联系人信息。又例如,手机10可以针对非首次同步设置分组同步接口,从而智能手表20可以通过该分组同步接口,来从手机10中同步至少一个分组的联系人信息。It can be understood that in some embodiments, the mobile phone 10 is provided with different calling interfaces for first-time synchronization and non-first-time synchronization, so that other electronic devices can synchronize first-time or non-first-time contact information with the mobile phone 10 through different calling interfaces. . For example, the mobile phone 10 can set a full synchronization interface for the first synchronization, so that the smart watch 20 can synchronize all contact information from the mobile phone 10 through the full synchronization interface. For another example, the mobile phone 10 can set a group synchronization interface for non-first-time synchronization, so that the smart watch 20 can synchronize at least one group of contact information from the mobile phone 10 through the group synchronization interface.
S804:手机10响应于联系人同步请求,向智能手表20发送分组存储的联系人信息。S804: In response to the contact synchronization request, the mobile phone 10 sends the group-stored contact information to the smart watch 20.
示例性地,手机10在确定出智能手表20是首次和手机10进行联系人同步的情况下,向智能手表20发送分组存储的联系人信息,该分组存储的联系人信息中包括了各分组的校验码。For example, when the mobile phone 10 determines that the smart watch 20 is synchronizing contacts with the mobile phone 10 for the first time, the mobile phone 10 sends the group stored contact information to the smart watch 20. The group stored contact information includes the contact information of each group. Check code.
例如,手机10可以将如前述图3A或图3B所示的分组存储的联系人信息发送给智能手表20。For example, the mobile phone 10 can send the contact information stored in groups as shown in the aforementioned FIG. 3A or FIG. 3B to the smart watch 20 .
S805:智能手表20分组存储联系人信息。S805: The smart watch 20 stores contact information in groups.
示例性地,智能手表20将接收到的分组存储的联系人信息也进行分组存储,并同时存储各分组的校验码。For example, the smart watch 20 also stores the received contact information stored in groups, and simultaneously stores the verification code of each group.
前述步骤S801至步骤S805介绍了智能手表20首次从手机10中同步联系数据的技术方案,以下介绍用户在手机10中对联系人信息进行维护后,智能手表20再次和手机10进行联系人同步的技术方案。The aforementioned steps S801 to S805 introduce the technical solution for the smart watch 20 to synchronize contact data from the mobile phone 10 for the first time. The following describes how the smart watch 20 synchronizes contacts with the mobile phone 10 again after the user maintains the contact information in the mobile phone 10. Technical solutions.
S806:根据联系人信息维护操作更新分组数据和校验码。S806: Update the group data and check code according to the contact information maintenance operation.
示例性地,手机10在检测到用户对手机10中的联系数据的维护操作后,可以根据联系人信息维护操作更新各分组的数据及校验码,具体的更新方式可以参考前述图6所示实施例的相关描述,在此不做赘述。For example, after detecting the user's maintenance operation on the contact data in the mobile phone 10, the mobile phone 10 can update the data and check codes of each group according to the contact information maintenance operation. For the specific update method, please refer to the aforementioned figure 6. Relevant descriptions of the embodiments will not be repeated here.
S807:手机10和智能手表20建立蓝牙通信连接。S807: The mobile phone 10 and the smart watch 20 establish a Bluetooth communication connection.
示例性地,手机10和智能手机20建立用于同步联系人信息的蓝牙通信连接,具体可以参考前述步骤S801至步骤S802的相关描述,在此不做赘述。For example, the mobile phone 10 and the smart phone 20 establish a Bluetooth communication connection for synchronizing contact information. For details, reference may be made to the related descriptions of the foregoing steps S801 to S802, which will not be described again here.
S808:智能手表20向手机10发送联系人同步请求。S808: The smart watch 20 sends a contact synchronization request to the mobile phone 10.
示例性地,智能手表20在确定和手机10已经建立通信连接的情况下,向手机10发送联系人同步请求。For example, when the smart watch 20 determines that a communication connection has been established with the mobile phone 10 , the smart watch 20 sends a contact synchronization request to the mobile phone 10 .
S809:响应于联系人同步请求,向智能手表20发送各分组的校验码。S809: In response to the contact synchronization request, send the verification code of each group to the smart watch 20.
示例性地,手机10在确定出智能手表20不是首次和手机10进行联系人同步的情况下,向智能手表20发送各分组的校验码。例如,手机10可以在接收到的联系人同步请求中不包括首次同步的标识的情况下,确定智能手表20不是首次和手机10进行联系人同步,向智能手表20发送手机10中各分组的校验码。For example, when the mobile phone 10 determines that the smart watch 20 is not synchronizing contacts with the mobile phone 10 for the first time, the mobile phone 10 sends the verification code of each group to the smart watch 20 . For example, when the contact synchronization request received does not include a first-time synchronization identifier, the mobile phone 10 can determine that the smart watch 20 is not synchronizing contacts with the mobile phone 10 for the first time, and send the calibration data of each group in the mobile phone 10 to the smart watch 20. Code verification.
S810:智能手表20基于手机10中各分组的校验码和智能手表20中各分组的较验标识,确定差异分组。S810: The smart watch 20 determines the difference group based on the check code of each group in the mobile phone 10 and the verification identification of each group in the smart watch 20.
示例性地,在一些实施例中,智能手表20中的分组与手机10中的分组数量相同,并且智能手表20中的分组与手机10中的分组存在一一对应关系。智能手表20在接收到手机10中的各分组的校验码后,将获取的各分组的校验码和智能手表20中对应的分组的校验码进行对比,将校验码不一致的分组确定为差异分组。例如,参考前述图2B,智能手表20可以获取手机10中分组00至分组99对应的校验码,再将智能手表20中与分组00至分组99对应的分组校验码与获取的校验码进行对比,确定出校验码01与校验码01'不同,也即是手机10中的分组01为差异分组。 For example, in some embodiments, the number of groups in the smart watch 20 is the same as the number of groups in the mobile phone 10 , and there is a one-to-one correspondence between the groups in the smart watch 20 and the groups in the mobile phone 10 . After receiving the check codes of each group in the mobile phone 10, the smart watch 20 compares the obtained check codes of each group with the check codes of the corresponding groups in the smart watch 20, and determines the groups with inconsistent check codes. Group differences. For example, referring to the aforementioned FIG. 2B, the smart watch 20 can obtain the check codes corresponding to the group 00 to the group 99 in the mobile phone 10, and then combine the group check codes corresponding to the group 00 to the group 99 in the smart watch 20 with the obtained check codes. After comparison, it is determined that the check code 01 is different from the check code 01', that is, the group 01 in the mobile phone 10 is a differential group.
可以理解,在一些实施例中,手机10和智能手表20中不包括联系人信息的分组可以不存储在各自的存储器中,从而可以节省手机10和智能手表20中的存储空间。在手机10和智能手表20中,不包括联系人信息的分组可以不存储在各自的存储器的情况下,智能手表20和手机10中存储的数据分组的数量可以不同,也即是智能手表20接收到的手机10发送的校验码的数量和智能手表20中的校验码的数量可以不同,不存在一一对应关系。从而智能手表20确定出的差异分组包括:It can be understood that in some embodiments, groups that do not include contact information in the mobile phone 10 and the smart watch 20 may not be stored in their respective memories, thereby saving storage space in the mobile phone 10 and the smart watch 20 . In the mobile phone 10 and the smart watch 20 , packets excluding contact information may not be stored in their respective memories. The number of data packets stored in the smart watch 20 and the mobile phone 10 may be different, that is, the smart watch 20 receives The number of verification codes sent by the mobile phone 10 and the number of verification codes in the smart watch 20 may be different, and there is no one-to-one correspondence. Therefore, the difference groups determined by the smart watch 20 include:
第一类差异分组,即手机10中存在的分组,但智能手表20中不存在的分组,智能手表20可以在智能手表20中各校验码对应的分组的分组标识中,不存在接收到的校验码X对应的分组的分组标识的情况下,确定校验码X对应的分组为第一类差异分组。例如,假设智能手表20接收到的校验码X的分组标识为98,而智能手表20中没有分组标识为98的分组,则分组98为第一类差异分组。The first type of differential grouping is a grouping that exists in the mobile phone 10 but does not exist in the smart watch 20. The smart watch 20 can find that there is no received group ID in the group identification of the group corresponding to each check code in the smart watch 20. In the case of the group identification of the group corresponding to the check code X, it is determined that the group corresponding to the check code X is the first type of difference group. For example, assuming that the packet ID of the verification code
第二类差异分组,即手机10中不存在,但智能手表20中存在的分组,,智能手表20可以在智能手表20中某一校验码X对应的分组的分组标识,不存在于接收到的各校验码对应的分组标识中的情况下,确定校验码X对应的分组为第二类差异分组。例如,假设智能手表20有分组标识为98的分组,但接收到的手机10发送的各个校验码对应的分组的分组标识没有98,则说明分组98是第二类差异分组。The second type of differential grouping is a grouping that does not exist in the mobile phone 10 but exists in the smart watch 20. The smart watch 20 can identify the group corresponding to a certain check code X in the smart watch 20 and does not exist in the received In the case of the group identification corresponding to each check code X, the group corresponding to the check code X is determined to be the second type of difference group. For example, assuming that the smart watch 20 has a packet with a packet ID of 98, but the received packet IDs corresponding to each check code sent by the mobile phone 10 do not have 98, it means that the packet 98 is a second type of difference packet.
第三类差异分组,手机10和智能手表20中都存在、但校验码不同的分组,智能手表20可以在智能手表20中存在校验码为Y的分组的分组标识,与接收到的校验码X对应的分组的分组标识相同,但该校验码X与校验码Y不同的情况下,确定校验码X对应的分组为第三类差异分组。例如,假设智能手表20接收到的校验码F019A3BF45DAA8BEF05AAF9E553DCDB5对应的分组的分组标识为98,而智能手表20中分组标识为98的分组的校验码为D11EEB639BC9B20AE321AF1CF384F383,则分组98为第三类差异分组。The third type of differential grouping is a grouping that exists in both the mobile phone 10 and the smart watch 20 but has different verification codes. The smart watch 20 can have a group identification of a group with a verification code Y in the smart watch 20, which is the same as the received verification code. When the group identifiers of the groups corresponding to the check code X are the same, but the check code X and the check code Y are different, the group corresponding to the check code For example, assume that the group ID of the group corresponding to the check code F019A3BF45DAA8BEF05AAF9E553DCDB5 received by the smart watch 20 is 98, and the check code of the group with the group ID 98 in the smart watch 20 is D11EEB639BC9B20AE321AF1CF384F383, then group 98 is the third type of difference group.
可以理解,智能手表20确定出的差异分组可以是一个或多个,在此不做限定。It can be understood that the number of difference groups determined by the smart watch 20 may be one or more, which is not limited here.
S811:智能手表20获取并存储手机10中各差异分组的联系人信息和校验码。S811: The smart watch 20 obtains and stores the contact information and verification codes of each differential group in the mobile phone 10.
示例性地,智能手表20在确定出差异分组后,从手机10中获取各差异分组的联系人信息和校验码,并将获取的差异分组的联系人信息和校验码存储到智能手表20对应的分组中。例如,智能手表20在确定出手机10中分组01为差异分组的情况下,可以向手机10发送获取分组01的联系人信息和校验码的请求,手机10在收到该请求后,将分组01中的联系人信息和校验码01'发送给智能手表20,智能手表20接收到分组01中的联系人信息后和校验码01'后,将接收到的联系人信息存储到分组01中,并将分组01的校验码更新为校验码01'。Exemplarily, after determining the differential groups, the smart watch 20 obtains the contact information and verification codes of each differential group from the mobile phone 10 , and stores the obtained contact information and verification codes of the differential groups in the smart watch 20 in the corresponding group. For example, when the smart watch 20 determines that group 01 in the mobile phone 10 is a differential group, the smart watch 20 can send a request to obtain the contact information and verification code of the group 01 to the mobile phone 10. After receiving the request, the mobile phone 10 will group the group. The contact information in 01 and the verification code 01' are sent to the smart watch 20. After receiving the contact information in the group 01 and the verification code 01', the smart watch 20 stores the received contact information in the group 01. , and update the check code of group 01 to check code 01'.
可以理解,在一些实施例中,智能手表20可以在确定出差异分组后,通过上述分组同步接口,以从手机10中获取差异分组中的联系人信息。It can be understood that in some embodiments, after determining the differential group, the smart watch 20 can obtain the contact information in the differential group from the mobile phone 10 through the above-mentioned group synchronization interface.
可以理解,在一些实施例中,在差异分组包括前述步骤S810中的第一类差异分组、第二类差异分组、第三类差异分组的情况下,针对第一类差异分组,智能手表20可以新增一个分组,从手机10中获取第一类差异分组中的联系人信息,并将获取的联系人信息存储在该新增的分组中;针对第二类差异分组,智能手表20可以从智能手表中删除第二类差异分组中的联系人信息;针对第三类差异分组,智能手表20可以从手机10中获取第三差异分组的联系人信息,并用获取的联系人信息替换第三类差异分组在智能手表20中的联系人信息。It can be understood that in some embodiments, when the difference grouping includes the first type of difference grouping, the second type of difference grouping, and the third type of difference grouping in the aforementioned step S810, for the first type of difference grouping, the smart watch 20 can Add a new group, obtain the contact information in the first type of difference group from the mobile phone 10, and store the obtained contact information in the newly added group; for the second type of difference group, the smart watch 20 can obtain the contact information from the smart watch 10 The contact information in the second type of difference group is deleted from the watch; for the third type of difference group, the smart watch 20 can obtain the contact information of the third type of difference group from the mobile phone 10 and replace the third type of difference with the obtained contact information. Contact information grouped in smart watch 20.
可以理解,在另一些实施例中,在对差异分组的联系人信息进行同步的过程中,也可以先通过对智能手表20和手机10中差异分组的联系人信息进行比对,确定出有差异的联系人信息,从而只对有差异的联系人信息进行同步,进一步减小同步的数据量,提高同步效率。 It can be understood that in other embodiments, during the process of synchronizing the differentially grouped contact information, it is also possible to first compare the differentially grouped contact information in the smart watch 20 and the mobile phone 10 to determine the difference. contact information, thereby only synchronizing contact information with differences, further reducing the amount of synchronized data and improving synchronization efficiency.
通过本申请实施例提供的方法,手机10和智能手表20在非首次进行联系人同步的过程中,无需对所有的联系人信息进行同步,只需要对差异分组的联系人信息进行同步,减少了同步的数据量,提高了同步效率,同时,手机10也无需记录与其他电子设备进行同步的日志以及与其他电子设备上一次同步后,有变化的联系人信息,提升了用户体验。Through the method provided by the embodiment of the present application, the mobile phone 10 and the smart watch 20 do not need to synchronize all the contact information during the contact synchronization process that is not the first time, but only need to synchronize the differentially grouped contact information, which reduces The amount of synchronized data improves the synchronization efficiency. At the same time, the mobile phone 10 does not need to record synchronization logs with other electronic devices and contact information that has changed since the last synchronization with other electronic devices, improving the user experience.
以上实施例中介绍了两个电子设备直接进行数据同步的场景,下面介绍两个电子设备通过第三电子设备作为中间设备进行数据同步的场景。The above embodiments introduce a scenario in which two electronic devices directly perform data synchronization. The following describes a scenario in which two electronic devices perform data synchronization through a third electronic device as an intermediate device.
图10根据本申请的一些实施例,示出了一种数据同步的场景示意图。Figure 10 shows a schematic diagram of a data synchronization scenario according to some embodiments of the present application.
如图10所示,手机10和汽车40的车机41中安装有相同的应用程序(例如畅连TM应用)或服务(例如华为云服务),安装该应用程序或服务的电子设备可以利用服务器30进行数据交换。该数据同步场景中,手机10中存储有分组存储的联系人信息,车机41从服务器30中同步手机10中的联系人信息可以包括如下步骤:S11:手机10可以将分组存储的联系人信息和各分组的校验码上传到服务器30;S12:车机41在连接到服务器30后,服务器30将各分组的校验码发送给车机41;S13:车机41将获取的各分组的校验码与车机41中对应的分组的校验码进行对比,确定出差异分组,并将差异分组的分组标识发送给服务器30;S14:服务器30在接收到差异分组的分组标识后,可以向车机41发送差异分组的联系人信息,从而车机41在接收到联系人信息后,将联系人信息存储到对应的分组中。如此,车机41在通过服务器30同步手机10中的联系人信息时,只需要对差异分组的联系人信息进行同步,而不必同步所有的联系人信息,减少了同步的数据量,提高了同步效率。As shown in Figure 10, the same application program (such as Changlian TM application) or service (such as Huawei Cloud Service) is installed in the mobile phone 10 and the machine 41 of the car 40. The electronic device installing the application program or service can use the server 30 for data exchange. In this data synchronization scenario, the mobile phone 10 stores contact information stored in groups. Synchronizing the contact information in the mobile phone 10 from the server 30 may include the following steps: S11: The mobile phone 10 can store the contact information in groups. and the verification code of each group is uploaded to the server 30; S12: After the vehicle computer 41 is connected to the server 30, the server 30 sends the verification code of each group to the vehicle computer 41; S13: The vehicle computer 41 obtains the verification code of each group. The check code is compared with the check code of the corresponding group in the vehicle machine 41 to determine the difference group, and the group identification of the difference group is sent to the server 30; S14: After receiving the group identification of the difference group, the server 30 can The contact information of the differential group is sent to the vehicle machine 41, so that after receiving the contact information, the vehicle machine 41 stores the contact information in the corresponding group. In this way, when the car machine 41 synchronizes the contact information in the mobile phone 10 through the server 30, it only needs to synchronize the differentially grouped contact information without having to synchronize all the contact information, which reduces the amount of synchronized data and improves the synchronization efficiency. efficiency.
具体地,图11根据本申请的一些实施例,示出了又一种数据同步方法的交互流程示意图。如图11所示,该流程包括如下步骤。Specifically, FIG. 11 shows an interactive flow diagram of yet another data synchronization method according to some embodiments of the present application. As shown in Figure 11, the process includes the following steps.
S1101:手机10和服务器30建立通信连接。S1101: The mobile phone 10 and the server 30 establish a communication connection.
示例性地,手机10通过应用程序或服务和服务器建立通信连接。For example, the mobile phone 10 establishes a communication connection with a server through an application or service.
例如,手机10可以通过移动网络或无线网络等接入因特网,从而手机10中的应用程序或服务,例如畅连TM应用、华为云TM服务等,可连接到相对应的服务器30,使得手机10可以和服务器30进行数据交换。For example, the mobile phone 10 can access the Internet through a mobile network or a wireless network, so that applications or services in the mobile phone 10, such as ChanglianTM applications, Huawei CloudTM services, etc., can be connected to the corresponding server 30, so that the mobile phone 10 Data can be exchanged with the server 30.
S1102:手机10将分组存储的联系人信息及各分组的校验码上传到服务器30。S1102: The mobile phone 10 uploads the contact information stored in groups and the verification code of each group to the server 30.
示例性地,手机10和服务器30建立通信连接后,可以将手机中分组存储的联系人信息和各分组的校验码上传到服务器30,以便于使用与手机10相同的用户账号连接到服务器30的其他电子设备可以从服务器30中同步手机10中的联系人信息。For example, after the mobile phone 10 and the server 30 establish a communication connection, the contact information stored in groups in the mobile phone and the verification code of each group can be uploaded to the server 30 so that the same user account as the mobile phone 10 can be used to connect to the server 30 Other electronic devices can synchronize the contact information in the mobile phone 10 from the server 30 .
S1103:车机41和服务器30建立通信连接。S1103: The vehicle computer 41 and the server 30 establish a communication connection.
示例性地,车机41可以通过移动网络、无线网络、有线网络等接入因特网,从而车机41中的应用程序或服务,例如畅连TM应用、华为云TM服务等,可连接到相对应的服务器30,使得车机41可以和服务器30进行数据交换。For example, the car machine 41 can access the Internet through a mobile network, a wireless network, a wired network, etc., so that applications or services in the car machine 41, such as Changlian TM applications, Huawei Cloud TM services, etc., can be connected to the corresponding The server 30 allows the vehicle machine 41 to exchange data with the server 30.
S1104:车机41向服务器30发送数据同步请求。S1104: The vehicle machine 41 sends a data synchronization request to the server 30.
示例性地,车机41在和服务器30建立通信连接后,向服务器30发送数据同步请求。For example, after establishing a communication connection with the server 30, the vehicle engine 41 sends a data synchronization request to the server 30.
可以理解,车机41在首次向服务器30发送的数据同步请求时,可以包括首次数据同步的标识,以便于服务器30可以根据该标识采用相应的方式响应数据同步请求。It can be understood that when the vehicle engine 41 sends a data synchronization request to the server 30 for the first time, it may include an identification of the first data synchronization, so that the server 30 can respond to the data synchronization request in a corresponding manner according to the identification.
可以理解,本实施例中以联系人信息的同步进行介绍只是一种示例,对于不同的应用程序或服务,发送的数据同步请求可以不同,需要同步的数据也可以不同。It can be understood that the synchronization of contact information in this embodiment is just an example. For different applications or services, the data synchronization requests sent may be different, and the data that needs to be synchronized may also be different.
可以理解,在一些实施例中,服务器30针对首次同步和非首次同步设置有不同的调用接口,以 便于其他电子设备可以通过不同的调用接口,与服务器30进行首次或非首次联系人信息的同步。例如,服务器30可以针对首次同步设置全量同步接口,从而车机41可以通过该全量同步接口,来从服务器30中同步所有的联系人信息。又例如,服务器30可以针对非首次同步设置分组同步接口,从而车机41可以通过该分组同步接口,来从服务器30中同步至少一个分组的联系人信息。It can be understood that in some embodiments, the server 30 is provided with different calling interfaces for first synchronization and non-first synchronization, so as to This facilitates other electronic devices to synchronize first-time or non-first-time contact information with the server 30 through different calling interfaces. For example, the server 30 can set a full synchronization interface for the first synchronization, so that the vehicle machine 41 can synchronize all contact information from the server 30 through the full synchronization interface. For another example, the server 30 may set a group synchronization interface for non-first-time synchronization, so that the vehicle 41 can synchronize the contact information of at least one group from the server 30 through the group synchronization interface.
S1105:服务器30响应于数据同步请求,向车机41发送分组存储的联系人信息及各分组的校验码。S1105: In response to the data synchronization request, the server 30 sends the contact information stored in groups and the check code of each group to the vehicle machine 41.
示例性地,服务器30在确定车机41是首次和服务器30进行联系人信息同步的情况下,向车机41发送分组存储的联系人信息及各分组的校验码。例如,服务器30可以在数据同步请求中包括首次同步的标识的情况下,确定车机41是首次和服务器30进行联系人信息同步,向车机41发送分组存储的联系人信息及各分组的校验码。For example, when the server 30 determines that it is the first time that the vehicle computer 41 synchronizes contact information with the server 30 , the server 30 sends the grouped stored contact information and the check code of each group to the vehicle computer 41 . For example, when the data synchronization request includes an identification of the first synchronization, the server 30 may determine that the vehicle machine 41 is synchronizing contact information with the server 30 for the first time, and send the grouped stored contact information and the calibration of each group to the vehicle machine 41. Code verification.
S1106:车机41分组存储接收到的联系人信息及各分组的校验码。S1106: The vehicle machine 41 stores the received contact information in groups and the check codes of each group.
示例性地,车机41接收服务器30发送的分组存储的联系人信息及各分组的校验码,并将联系人信息及各分组的校验码存储到车机41中。For example, the vehicle machine 41 receives the grouped stored contact information and the verification codes of each group sent by the server 30 , and stores the contact information and the verification codes of each group in the vehicle machine 41 .
例如,参考图12A,车机41首次和服务器30进行联系人同步后,车机41中存储的各分组中的联系人信息和各分组的校验码相同。示例性地,对于分组98,包括2条联系信息,即LILY的联系人信息和RALPH的联系人信息,分组98的对应校验码98为D11EEB639BC9B20AE321AF1CF384F38。For example, referring to FIG. 12A , after the vehicle machine 41 performs contact synchronization with the server 30 for the first time, the contact information in each group stored in the vehicle machine 41 is the same as the check code of each group. For example, for group 98, including two pieces of contact information, namely LILY's contact information and RALPH's contact information, the corresponding check code 98 of group 98 is D11EEB639BC9B20AE321AF1CF384F38.
前述步骤S1101至步骤S1106介绍了车机41首次同步手机10中的联系人信息的技术方案,以下介绍手机10维护联系人信息的技术方案。The aforementioned steps S1101 to S1106 introduce the technical solution for the vehicle machine 41 to synchronize the contact information in the mobile phone 10 for the first time. The technical solution for the mobile phone 10 to maintain the contact information is introduced below.
S1107:手机10根据数据维护操作更新对应分组的联系人信息及校验码。S1107: The mobile phone 10 updates the contact information and verification code of the corresponding group according to the data maintenance operation.
示例性地,手机10在检测到用户对联系人信息的数据维护操作后,可以根据数据维护操作更新对应分组的联系人信息及校验码,具体可以参考前述步骤S601至步骤S606的相关描述,在此不做赘述。For example, after detecting the user's data maintenance operation on the contact information, the mobile phone 10 can update the contact information and verification code of the corresponding group according to the data maintenance operation. For details, please refer to the relevant descriptions of the aforementioned steps S601 to S606. No further details will be given here.
S1108:手机10将数据维护操作对应的分组中数据及校验码上传到服务器30。S1108: The mobile phone 10 uploads the data in the group corresponding to the data maintenance operation and the verification code to the server 30.
示例性地,手机10在根据数据维护操作更新对应分组的联系人信息及校验码后,可以将数据维护操作对应的分组中数据及校验码上传到服务器30,以便于与手机10采用相同的用户账号连接服务器30的其他电子设备可以及时进行同步。For example, after the mobile phone 10 updates the contact information and the verification code of the corresponding group according to the data maintenance operation, the mobile phone 10 can upload the data and verification code in the group corresponding to the data maintenance operation to the server 30 so as to use the same method as the mobile phone 10 Other electronic devices connected to the server 30 with the user account can be synchronized in time.
可以理解,在一些实施例中,若手机10在根据数据维护操作更新对应分组的联系人信息及校验码时连接到了服务器30,手机10可以将数据维护操作对应的分组中数据及校验码上述到服务器30。在另一些实施例中,若手机10在根据数据维护操作更新对应分组的联系人信息及校验码时未连接到服务器30,则手机10可以记录数据维护操作更新对应分组的联系人信息及校验码,并在手机10连接到服务器30后将记录的数据维护操作更新对应分组的联系人信息及校验码上传到服务器30。It can be understood that in some embodiments, if the mobile phone 10 is connected to the server 30 when updating the contact information and verification code of the corresponding group according to the data maintenance operation, the mobile phone 10 can update the data and verification code in the group corresponding to the data maintenance operation. The above goes to server 30. In other embodiments, if the mobile phone 10 is not connected to the server 30 when updating the contact information and verification code of the corresponding group according to the data maintenance operation, the mobile phone 10 may record the data maintenance operation and update the contact information and verification code of the corresponding group. Verify the code, and after the mobile phone 10 is connected to the server 30, the recorded data maintenance operation updates the contact information of the corresponding group and the verification code is uploaded to the server 30.
S1109:服务器30更新分组存储的数据。S1109: The server 30 updates the data stored in the group.
示例性地,服务器30在接收到手机10上传的数据维护操作对应的分组中数据及校验码后,将该分组的数据和校验码更新到对应的分组中。For example, after receiving the data and check code in the group corresponding to the data maintenance operation uploaded by the mobile phone 10, the server 30 updates the data and check code of the group to the corresponding group.
上述步骤S1107至步骤S1109介绍了手机10在用户维护联系人信息后的数据同步到服务器30的技术方案,以下介绍车机41非首次从服务器30同步联系人信息的技术方案。The above-mentioned steps S1107 to S1109 introduce the technical solution for the mobile phone 10 to synchronize the data to the server 30 after the user maintains the contact information. The following introduces the technical solution for the mobile phone 41 to synchronize the contact information from the server 30 not for the first time.
S1110:车机41向服务器30发送数据同步请求。S1110: The vehicle machine 41 sends a data synchronization request to the server 30.
示例性地,车机41在和服务器30建立通信连接后,可以向服务器30发送数据同步请求。For example, after establishing a communication connection with the server 30, the vehicle engine 41 may send a data synchronization request to the server 30.
可以理解,车机41在并非首次和服务器30进行数据同步的情况下,车机41发送的数据同步请 求中不包括首次同步标识。It can be understood that when the vehicle computer 41 is not synchronizing data with the server 30 for the first time, the data synchronization request sent by the vehicle computer 41 The first synchronization identifier is not included in the request.
车机41和服务器30建立通信连接的方式可以参考前述步骤S1103中车机41与服务器30之间建立通信连接的方式描述,在此不做赘述。The method of establishing a communication connection between the vehicle computer 41 and the server 30 can be described with reference to the method of establishing a communication connection between the vehicle computer 41 and the server 30 in step S1103, and will not be described again here.
S1111:服务器30响应于数据同步请求,向车机41发送各分组的校验码。S1111: The server 30 responds to the data synchronization request and sends the check code of each group to the vehicle machine 41.
示例性地,服务器30接收到车机41发送的数据同步请求后,确定出车机41不是首次和服务器30进行数据同步的情况下,向车机41发送服务器30中存储的各分组的校验码。For example, after the server 30 receives the data synchronization request sent by the vehicle machine 41 and determines that it is not the first time that the vehicle machine 41 performs data synchronization with the server 30, it sends the verification of each packet stored in the server 30 to the vehicle machine 41. code.
S1112:车机41基于车机41中各分组的校验码和服务器30中各分组的较验标识,确定差异分组。S1112: The vehicle computer 41 determines the difference group based on the check code of each group in the vehicle computer 41 and the verification identification of each group in the server 30 .
示例性地,车机41接收到服务器30中各分组的校验码后,将各分组的校验码与车机41中对应的分组的校验码进行对比,确定出校验码不同的差异分组。For example, after receiving the check code of each group in the server 30, the vehicle machine 41 compares the check code of each group with the check code of the corresponding group in the vehicle machine 41 to determine the difference between the different check codes. Group.
例如,参考图12B,假设车机41在步骤S1106中获取到的联系人信息为图3A所示的联系人信息,其中,车机41中的分组98包括两条联系人信息,即LILY和RALPH的联系人信息,对应的校验码98为D11EEB639BC9B20AE321AF1CF384F38。而在前述步骤S1107至步骤S1109中,用户通过手机11增加了KATE的联系人信息,从而手机10和服务器30存储的联系人信息中,分组98中包括三条联系人信息,即LILY、RALPH和KATE的联系人信息,对应的校验码98为D3488EF35EE50808184EE10752863011。车机41接收到服务器30发送的分组98对应的校验码'(即98D3488EF35EE50808184EE10752863011)后,与车机41中对应的校验码98(即D11EEB639BC9B20AE321AF1CF384F38进行对比),确定出校验码98'与校验码98不同,从而确定出服务器30中的分组98为差异分组。For example, referring to FIG. 12B , assume that the contact information obtained by the vehicle machine 41 in step S1106 is the contact information shown in FIG. 3A , where the group 98 in the vehicle machine 41 includes two pieces of contact information, namely LILY and RALPH. The contact information, the corresponding check code 98 is D11EEB639BC9B20AE321AF1CF384F38. In the aforementioned steps S1107 to S1109, the user added KATE's contact information through the mobile phone 11. Therefore, among the contact information stored by the mobile phone 10 and the server 30, the group 98 includes three pieces of contact information, namely LILY, RALPH and KATE. The contact information, the corresponding check code 98 is D3488EF35EE50808184EE10752863011. After the vehicle computer 41 receives the check code 98 corresponding to the group 98 sent by the server 30 (i.e., 98D3488EF35EE50808184EE10752863011), it compares it with the corresponding check code 98 (i.e., D11EEB639BC9B20AE321AF1CF384F38) in the vehicle computer 41, and determines that the check code 98' is consistent with the check code 98. The check codes 98 are different, thereby determining that the packet 98 in the server 30 is a differential packet.
S1113:车机41获取并存储服务器30中各差异分组的联系人信息和校验码。S1113: The vehicle machine 41 obtains and stores the contact information and verification code of each differential group in the server 30.
示例性地,车机41根据差异分组的分组标识,从服务器30中获取并存储差异分组的联系人信息及差异分组的校验码。For example, the vehicle machine 41 obtains and stores the contact information of the differential group and the check code of the differential group from the server 30 according to the group identifier of the differential group.
例如,参考图12B,车机41可以从服务器30中获取LILY、RALPH和KATE的联系人信息,并将获取的联系人信息存储到车机41的分组98中,再将分组98的校验码更新为D3488EF35EE50808184EE10752863011。For example, referring to FIG. 12B , the car machine 41 can obtain the contact information of LILY, RALPH and KATE from the server 30 , store the obtained contact information in the group 98 of the car machine 41 , and then add the check code of the group 98 Updated to D3488EF35EE50808184EE10752863011.
可以理解,在一些实施例中,车机41可以在确定出差异分组后,可以通过上述分组同步接口,从服务器30中获取差异分组中的联系人信息。It can be understood that in some embodiments, after determining the differential group, the vehicle machine 41 can obtain the contact information in the differential group from the server 30 through the above-mentioned group synchronization interface.
通过本申请实施例提供的方法,车机41从服务器30中同步手机10中的联系人信息过程中,无需每次都同步全部的联系人信息,只需要对差异分组中的联系人信息进行同步,减少了同步的数据量,提高同步效率,并且车机41或服务器30只需维护各分组的校验码,而无需其他的额外开销,提升了用户体验。Through the method provided by the embodiment of the present application, in the process of synchronizing the contact information in the mobile phone 10 from the server 30, the car machine 41 does not need to synchronize all the contact information every time, but only needs to synchronize the contact information in the differential group. , reducing the amount of synchronized data and improving synchronization efficiency, and the vehicle computer 41 or the server 30 only needs to maintain the check code of each group without any other additional overhead, which improves the user experience.
可以理解,以上各实施例中以条目式数据为联系人信息介绍了本申请的技术方案只是一种示例,上述各实施例的技术方案也适用于对其他任意类型的条目式数据进行同步的场景,例如短信、备忘录、邮件、即时通信应用的消息等,在此不做限定。It can be understood that the technical solution of the present application using entry data as contact information in the above embodiments is only an example, and the technical solution of the above embodiments is also applicable to the scenario of synchronizing any other type of entry data. , such as text messages, memos, emails, messages from instant messaging applications, etc., which are not limited here.
进一步,本申请实施例的技术方案还使用于分布式系统中,从设备和主设备间进行数据同步的场景。Furthermore, the technical solutions of the embodiments of this application are also used in the scenario of data synchronization between slave devices and master devices in distributed systems.
例如,图13根据本申请的一些实施例,示出了一种分布式系统中对备忘录进行同步的场景示意图。For example, FIG. 13 shows a schematic diagram of a scenario for synchronizing memos in a distributed system according to some embodiments of the present application.
图13所示的场景中,分布式系统包括主设备手机10,从设备智能手表20、平板电脑50和智能 电视60,手机10通过分布式软总线与其他从设备建立通信连接,并且手机10、智能手表20、平板电脑50、智能电视60中都安装有备忘录应用或服务。其中,手机10中分组存储有备忘录信息,各条备忘录信息的分组字段可以参考前述图4A的相关描述。In the scenario shown in Figure 13, the distributed system includes the master device mobile phone 10, the slave devices smart watch 20, tablet computer 50 and smart phone 10. The TV 60 and the mobile phone 10 establish communication connections with other slave devices through the distributed soft bus, and the mobile phone 10, the smart watch 20, the tablet computer 50, and the smart TV 60 are all installed with memo applications or services. Among them, the memo information is stored in groups in the mobile phone 10. For the grouping fields of each piece of memo information, please refer to the related description of FIG. 4A.
参考图13,智能手表20、平板电脑50、智能电视60从手机10中同步备忘录信息可以包括如下步骤:S131:智能手表20/平板电脑50/智能电视60中安装的备忘录应用或服务在检测到和手机10建立通信连接后,通过分布式软总线获取手机10中各分组的校验码;S132:智能手表20/平板电脑50/智能电视60中安装的备忘录应用或服务将获取的分组标识与各自对应的分组中的校验码进行对比,确定出各设备对应的差异分组,例如智能手表20可以确定出差异分组1、平板电脑50可以确定出差异分组2、智能电视60可以确定出差异分组3,再将各设备的差异分组和设备标识发送给手机10,例如智能手表20可以发送差异分组1的分组标识、平板电脑50可以发送差异分组2的分组标识、智能电视3可以发送差异分组3的分组标识;S133:手机10根据各设备发送的差异分组的分组标识和设备标识,通过分布式软总线将各设备对应的差异分组(例如前述差异分组1/2/3)的备忘录信息和校验码发送到各设备,从而各设备中安装的备忘录应用或服务可以根据接收到的差异分组的备忘录信息和校验码来更新各设备中的备忘录信息,实现分布式系统中备忘录信息的同步。Referring to Figure 13, synchronizing memo information from the mobile phone 10 by the smart watch 20, the tablet computer 50, and the smart TV 60 may include the following steps: S131: The memo application or service installed in the smart watch 20/tablet computer 50/smart TV 60 detects that After establishing a communication connection with the mobile phone 10, the verification code of each group in the mobile phone 10 is obtained through the distributed soft bus; S132: The memo application or service installed in the smart watch 20/tablet computer 50/smart TV 60 will obtain the group identification and The check codes in the corresponding groups are compared to determine the difference group corresponding to each device. For example, the smart watch 20 can determine the difference group 1, the tablet computer 50 can determine the difference group 2, and the smart TV 60 can determine the difference group. 3. Then send the difference group and device identification of each device to the mobile phone 10. For example, the smart watch 20 can send the group identification of the difference group 1, the tablet computer 50 can send the group identification of the difference group 2, and the smart TV 3 can send the difference group 3. The group identification; S133: According to the group identification and device identification of the difference group sent by each device, the mobile phone 10 uses the distributed soft bus to obtain the memo information and calibration information of the difference group corresponding to each device (for example, the aforementioned difference group 1/2/3). The verification code is sent to each device, so that the memo application or service installed in each device can update the memo information in each device based on the received differentially grouped memo information and verification code, thereby realizing synchronization of memo information in the distributed system.
可以理解,分布式软总线是由电子设备的操作系统提供的、将多个电子设备通过相同或不同的通信方式进行耦接的技术,具体将在下文介绍电子设备的软件架构时进行介绍,在此不做赘述。It can be understood that the distributed soft bus is a technology provided by the operating system of the electronic device to couple multiple electronic devices through the same or different communication methods. The details will be introduced when the software architecture of the electronic device is introduced below. This will not be described in detail.
可以理解,智能手表20、平板电脑50、智能电视60确定差异分组的方式可以参考前述各实施例中智能手表20、车机41差异分组的方法,在此不做赘述。It can be understood that the way in which the smart watch 20, the tablet computer 50, and the smart TV 60 determine the differential grouping can refer to the differential grouping method of the smart watch 20 and the car machine 41 in the aforementioned embodiments, and will not be described again here.
通过本申请实施例提供的方法,无论与手机10建立过通信连接的从设备有多少个,手机10都可以快速与分布式系统中的其他电子设备进行数据同步,由于只需要对差异分组中的数据进行同步,减少了同步的数据量,提升了同步效率。Through the method provided by the embodiment of the present application, no matter how many slave devices have established communication connections with the mobile phone 10, the mobile phone 10 can quickly synchronize data with other electronic devices in the distributed system, because only the data in the differential grouping need to be synchronized. Data is synchronized, reducing the amount of synchronized data and improving synchronization efficiency.
可以理解,上述图13所示的电子设备间通过分布式软总线耦接的分布式系统只是一种示例,分布式软总线只是作为各个电子设备进行通信的载体,本申请的技术方案可以应用于其他任意分布式系统,在此不做限定。It can be understood that the distributed system in which electronic devices are coupled through a distributed soft bus shown in Figure 13 is just an example. The distributed soft bus is only used as a carrier for communication between various electronic devices. The technical solution of the present application can be applied to Any other distributed system is not limited here.
可以理解,上述手机10等电子设备所使用的操作系统可以是安卓TM、iOSTM(Input Output System)以及鸿蒙(Harmony OS)等操作系统中的一种,在此不做限制。下面以鸿蒙操作系统为例,介绍手机10的软件架构。It can be understood that the operating system used by the above-mentioned electronic devices such as the mobile phone 10 can be one of Android TM , iOS TM (Input Output System), Harmony OS, etc., and is not limited here. The following uses Hongmeng operating system as an example to introduce the software architecture of Mobile Phone 10.
图14根据本申请的一些实施例,示出了一种手机10的软件架构示意图。如图14所示,手机10的软件架构主要包括:Figure 14 shows a schematic diagram of the software architecture of a mobile phone 10 according to some embodiments of the present application. As shown in Figure 14, the software architecture of mobile phone 10 mainly includes:
应用层02可以包括系统应用021和扩展应用022(或第三方应用)。其中,系统应用021可以包括桌面备忘录0211、设置、相机、短信、邮件等等;扩展应用022可以包括畅连TM0221、其他即时通信应用(例如微信TM、QQTM等、)等应用程序。在一些实施例中,本申请实施例提供的数据同步方法可以应用于应用层02中的各个应用程序,例如将数据同步方法的指令嵌入到备忘录0211或畅连TM0221中,从而备忘录0211可以通过本申请提供的数据同步方法和其他电子设备进行备忘录的同步、畅连TM0221可以通过本申请实施例提供的数据同步方法和其他电子设备进行联系人信息或消息的同步。The application layer 02 may include system applications 021 and extension applications 022 (or third-party applications). Among them, the system application 021 can include desktop memo 0211, settings, camera, text messages, emails, etc.; the extended application 022 can include Changlian TM 0221, other instant messaging applications (such as WeChat TM , QQ TM , etc.) and other applications. In some embodiments, the data synchronization method provided by the embodiment of the present application can be applied to various applications in the application layer 02. For example, the instructions of the data synchronization method are embedded in the memo 0211 or Changlian TM 0221, so that the memo 0211 can pass The data synchronization method provided by this application is used to synchronize memos with other electronic devices. ChanglianTM 0221 can synchronize contact information or messages with other electronic devices through the data synchronization method provided by the embodiment of this application.
框架层03为应用层提供多语言框架,包括界面(User Interface,UI)框架031、用户程序框架032和能力框架033等。其中,UI框架031包括窗口管理器,内容提供器,视图系统,电话管理器,资源管理器,通知管理器等,在此不做赘述。用户程序框架032和能力框架033可为应用程序 提供应用所需的各能力部件的能力,例如运算能力(可以包括CPU算力、图形处理器(Graphics Processing Unit,GPU)算力、图像信号处理器(Image Signal Processor,ISP)算力等)、拾音能力(可以包括麦克风拾音能力、语音识别能力等)、设备安全防护方面的安全能力(可以包括可信任运行环境安全等级等)、显示能力(可以包括屏幕分辨率、屏幕尺寸等)、播放能力(包括扩音能力、立体声效能力等、以及存储能力(可以包括设备的内存能力、随机存取存储器(random access memory,RAM)能力等)等,在此不做限制。The framework layer 03 provides a multi-language framework for the application layer, including an interface (User Interface, UI) framework 031, a user program framework 032, a capability framework 033, etc. Among them, UI framework 031 includes window manager, content provider, view system, phone manager, resource manager, notification manager, etc., which will not be described in detail here. User program frame 032 and capability frame 033 may be application Provide the capabilities of various capability components required by the application, such as computing power (which can include CPU computing power, Graphics Processing Unit (GPU) computing power, Image Signal Processor (ISP) computing power, etc.), Sound pickup capabilities (can include microphone pickup capabilities, speech recognition capabilities, etc.), device security capabilities (can include trusted operating environment security levels, etc.), display capabilities (can include screen resolution, screen size, etc.), Playback capabilities (including amplification capabilities, stereo effect capabilities, etc.), and storage capabilities (which may include device memory capabilities, random access memory (RAM) capabilities, etc.) are not limited here.
系统服务层04是手机10软件系统的核心,可以通过框架层03对应用层02的应用程序提供服务。系统服务层04包括分布式软总线041、分布式数据管理模块042、数据同步服务043等。其中:The system service layer 04 is the core of the mobile phone 10 software system and can provide services to the applications of the application layer 02 through the framework layer 03. System service layer 04 includes distributed soft bus 041, distributed data management module 042, data synchronization service 043, etc. in:
分布式软总线041用于将手机10与其他电子设备进行耦接,构成分布式系统。例如,图15根据本申请的一些实施例,示出了一种通过分布式软总线041将手机10与其他电子设备进行耦接的示意图。如图15所示,手机10、智能手表20、平板电脑50、智能电视60通过分布式软总线041耦接,分布式软总线041包括总线中枢0411、任务和数据总线0412、设备信息0413、基础通信0414等。其中:The distributed soft bus 041 is used to couple the mobile phone 10 with other electronic devices to form a distributed system. For example, FIG. 15 shows a schematic diagram of coupling the mobile phone 10 to other electronic devices through a distributed soft bus 041 according to some embodiments of the present application. As shown in Figure 15, the mobile phone 10, the smart watch 20, the tablet 50, and the smart TV 60 are coupled through a distributed soft bus 041. The distributed soft bus 041 includes a bus hub 0411, a task and data bus 0412, a device information 0413, and a basic Communication 0414 etc. in:
总线中枢0411用于对手机10应用层02发布的命令进行解析、对设备的发现与连接等,包括数据与计算中心、决策中心、互联管理中心等。例如,在图13所示的场景中,总线中枢0411可以用于发现与手机10安装有相同的应用程序或服务(例如备忘录)的电子设备;The bus hub 0411 is used to parse commands issued by the mobile phone 10 application layer 02, discover and connect devices, etc., including data and computing center, decision-making center, interconnection management center, etc. For example, in the scenario shown in Figure 13, the bus hub 0411 can be used to discover electronic devices that have the same application or service (such as memo) installed on the mobile phone 10;
任务和数据总线0412用于手机10与其他电子设备间的任务和数据的传送。例如,在一些实施例中,任务和数据总线0412可以用于传输各分组的校验码、差异分组的标识、差异分组的备忘录信息、差异分组的校验码等;The task and data bus 0412 is used for transferring tasks and data between the mobile phone 10 and other electronic devices. For example, in some embodiments, the task and data bus 0412 can be used to transmit the check code of each group, the identification of the difference group, the memo information of the difference group, the check code of the difference group, etc.;
设备信息0413用于获取和管理手机10及其他电子设备的信息,例如在一些实施中,设备信息模块0413可以用于获取向手机10发送差异分组的电子设备的设备标识;The device information 0413 is used to obtain and manage information about the mobile phone 10 and other electronic devices. For example, in some implementations, the device information module 0413 can be used to obtain the device identification of the electronic device that sends the differential packet to the mobile phone 10;
基础通信0414用于通过无线、蓝牙、近场通信、局域网等有线和/或无线的方式建立手机10与其他电子设备的通信连接,并通过协议栈和软硬协同屏蔽电子设备间协议的差别。Basic communication 0414 is used to establish communication connections between the mobile phone 10 and other electronic devices through wired and/or wireless methods such as wireless, Bluetooth, near field communication, and local area networks, and shields protocol differences between electronic devices through protocol stacks and software and hardware collaboration.
分布式数据管理042基于分布式软总线,实现应用程序数据和用户数据的分布式管理。例如,在一些实施例中,手机10可以通过分布式数据管理042将差异分组的备忘录信息发送给相应的电子设备。Distributed data management 042 is based on distributed soft bus to realize distributed management of application data and user data. For example, in some embodiments, the mobile phone 10 can send the differentially grouped memo information to the corresponding electronic device through the distributed data management 042 .
数据同步服务043用于根据本申请实施例提供的数据同步方法进行数据同步。例如,对应未嵌入本申请实施例提供的数据同步方法的指令的应用程序,可以通过数据同步服务043来对应用程序中的条目式数据进行分组存储,并基于数据同步服务043和其他电子设备进行数据同步。The data synchronization service 043 is used to synchronize data according to the data synchronization method provided by the embodiment of this application. For example, corresponding to an application program that does not embed the instructions of the data synchronization method provided by the embodiment of the present application, the entry-type data in the application program can be stored in groups through the data synchronization service 043, and the data synchronization service 043 and other electronic devices can be used to perform data synchronization.
内核层05包括内核子系统051和驱动子系统052。内核子系统051通过屏蔽多内核差异,对上层提供基础的内核能力,包括进程/线程管理、内存管理、文件系统、网络管理和外设管理等。驱动子系统052包括硬件驱动框架,硬件驱动框架可以为手机10提供统一外设访问能力和管理框架。Kernel layer 05 includes kernel subsystem 051 and driver subsystem 052. Kernel subsystem 051 provides basic kernel capabilities to the upper layer by shielding multi-core differences, including process/thread management, memory management, file system, network management, and peripheral management. The driver subsystem 052 includes a hardware driver framework, which can provide unified peripheral access capabilities and management framework for the mobile phone 10 .
可以理解,图14所示的手机10的软件架构和图15所示的手机10与其他电子设备之间的连接方式,只是一种示例,在其他的实施例中,手机10也可以采用不同于上述图14的其他软件架构,或者通过不同于图15所示的其他连接方式与其他电子设备之间连接形成分布式系统,本申请实施例不做限定。It can be understood that the software architecture of the mobile phone 10 shown in FIG. 14 and the connection method between the mobile phone 10 and other electronic devices shown in FIG. 15 are just examples. In other embodiments, the mobile phone 10 can also adopt different methods. The above-mentioned other software architectures in Figure 14, or the connection with other electronic devices through other connection methods different from that shown in Figure 15 to form a distributed system, are not limited by the embodiments of this application.
可以理解,本申请实施例中的各电子设备可以采用和手机10相同或相似的软件架构,也可以采用不同的软件架构,在此不做限定。It can be understood that each electronic device in the embodiment of the present application may adopt the same or similar software architecture as the mobile phone 10 , or may adopt a different software architecture, which is not limited here.
可以理解的是,上述以手机10、智能手表20、服务器30、汽车40的车机41、平板电脑50、智 能电视60等介绍本申请的技术方案只是一种示例,本申请实施例的技术方案可以应用于能够与其他电子设备进行数据交换的任意电子设备,包括但不限于膝上型计算机、智能电视、智能音箱、平板计算机、服务器、可穿戴设备(例如智能手表、智能手环、智能眼镜等)、头戴式显示器、移动电子邮件设备、便携式游戏机、便携式音乐播放器、阅读器设备等,本申请实施例不做限定。It can be understood that the above-mentioned mobile phone 10, smart watch 20, server 30, car 40 machine 41, tablet computer 50, smartphone The technical solution of the present application is only an example. The technical solution of the embodiment of the present application can be applied to any electronic device that can exchange data with other electronic devices, including but not limited to laptop computers, smart TVs, Smart speakers, tablet computers, servers, wearable devices (such as smart watches, smart bracelets, smart glasses, etc.), head-mounted displays, mobile email devices, portable game consoles, portable music players, reader devices, etc. The application examples are not limiting.
以下以手机10的硬件结构为例,说明本申请实施例适用的电子设备的结构。The following takes the hardware structure of the mobile phone 10 as an example to describe the structure of the electronic device applicable to the embodiments of the present application.
具体地,图16根据本申请的一些实施例,示出了一种手机10的结构示意图。如图16所示,手机10可以包括处理器110,外部存储器接口120,内部存储器121,通用串行总线(universal serial bus,USB)接口130,充电管理模块140,电源管理模块141,电池142,天线1,天线2,移动通信模块150,无线通信模块160,音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,传感器模块180,按键190,马达191,指示器192,摄像头193,显示屏194,以及用户标识模块(subscriber identification module,SIM)卡接口195等。其中传感器模块180可以包括压力传感器180A,陀螺仪传感器180B,气压传感器180C,磁传感器180D,加速度传感器180E,距离传感器180F,接近光传感器180G,指纹传感器180H,温度传感器180J,触摸传感器180K,环境光传感器180L,骨传导传感器180M等。Specifically, FIG. 16 shows a schematic structural diagram of a mobile phone 10 according to some embodiments of the present application. As shown in Figure 16, the mobile phone 10 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, and a battery 142. Antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone interface 170D, sensor module 180, button 190, motor 191, indicator 192, camera 193, Display 194, and subscriber identification module (subscriber identification module, SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyro sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, and ambient light. Sensor 180L, bone conduction sensor 180M, etc.
处理器110可以包括一个或多个处理单元,例如,可以包括中央处理器(Central Processing Unit,CPU)、图像处理器(Graphics Processing Unit,GPU)、数字信号处理器(Digital Signal Processor,DSP)、微处理器(Micro-programmed Control Unit,MCU)、人工智能(Artificial Intelligence,AI)处理器或可编程逻辑器件(Field Programmable Gate Array,FPGA)等的处理模块或处理电路。其中,不同的处理单元可以是独立的器件,也可以集成在一个或多个处理器中。例如,处理器110可以用于本申请实施例提供的数据同步方法的指令。The processor 110 may include one or more processing units, such as a central processing unit (Central Processing Unit, CPU), a graphics processor (Graphics Processing Unit, GPU), a digital signal processor (Digital Signal Processor, DSP), Processing modules or processing circuits such as microprocessors (Micro-programmed Control Unit, MCU), artificial intelligence (Artificial Intelligence, AI) processors or programmable logic devices (Field Programmable Gate Array, FPGA). Among them, different processing units can be independent devices or integrated in one or more processors. For example, the processor 110 can be used for instructions of the data synchronization method provided by the embodiments of the present application.
在一些实施例中,处理器110可以包括一个或多个接口。接口可以包括集成电路内置音频(inter-integrated circuit sound,I2S)接口,脉冲编码调制(pulse code modulation,PCM)接口,串行外设接口(Serial Peripheral Interface,SPI),通用异步收发传输器(universal asynchronous receiver/transmitter,UART)接口,移动产业处理器接口(mobile industry processor interface,MIPI),通用输入输出(general-purpose input/output,GPIO)接口,用户标识模块(subscriber identity module,SIM)接口,和/或通用串行总线(universal serial bus,USB)接口等。In some embodiments, processor 110 may include one or more interfaces. Interfaces can include integrated circuit built-in audio (inter-integrated circuit sound, I2S) interface, pulse code modulation (PCM) interface, serial peripheral interface (Serial Peripheral Interface, SPI), universal asynchronous receiver and transmitter (universal asynchronous receiver/transmitter (UART) interface, mobile industry processor interface (MIPI), general-purpose input/output (GPIO) interface, subscriber identity module (SIM) interface, and/or universal serial bus (USB) interface, etc.
I2S接口可以用于音频通信。在一些实施例中,处理器110可以包含多组I2S总线。处理器110可以通过I2S总线与音频模块170耦合,实现处理器110与音频模块170之间的通信。在一些实施例中,音频模块170可以通过I2S接口向无线通信模块160传递音频信号,实现通过蓝牙耳机接听电话的功能。The I2S interface can be used for audio communication. In some embodiments, processor 110 may include multiple sets of I2S buses. The processor 110 can be coupled with the audio module 170 through the I2S bus to implement communication between the processor 110 and the audio module 170 . In some embodiments, the audio module 170 can transmit audio signals to the wireless communication module 160 through the I2S interface to implement the function of answering calls through a Bluetooth headset.
PCM接口也可以用于音频通信,将模拟信号抽样,量化和编码。在一些实施例中,音频模块170与无线通信模块160可以通过PCM总线接口耦合。在一些实施例中,音频模块170也可以通过PCM接口向无线通信模块160传递音频信号,实现通过蓝牙耳机接听电话的功能。所述I2S接口和所述PCM接口都可以用于音频通信。The PCM interface can also be used for audio communications to sample, quantize and encode analog signals. In some embodiments, the audio module 170 and the wireless communication module 160 may be coupled through a PCM bus interface. In some embodiments, the audio module 170 can also transmit audio signals to the wireless communication module 160 through the PCM interface to implement the function of answering calls through a Bluetooth headset. Both the I2S interface and the PCM interface can be used for audio communication.
UART接口是一种通用串行数据总线,用于异步通信。该总线可以为双向通信总线。它将要传输的数据在串行通信与并行通信之间转换。在一些实施例中,UART接口通常被用于连接处理器110与无线通信模块160。在一些实施例中,处理器110通过UART接口与无线通信模块160中的蓝牙模块通信,实现蓝牙功能,例如通过蓝牙和其他电子设备建立通信连接,以通过蓝牙向其他电子设备发送各分组的校验码、各分组的数据,通过蓝牙获取数据同步请求、接收异常分组等。The UART interface is a universal serial data bus used for asynchronous communication. The bus can be a bidirectional communication bus. It converts the data to be transmitted between serial communication and parallel communication. In some embodiments, a UART interface is generally used to connect the processor 110 and the wireless communication module 160 . In some embodiments, the processor 110 communicates with the Bluetooth module in the wireless communication module 160 through the UART interface to implement the Bluetooth function, such as establishing a communication connection with other electronic devices through Bluetooth to send calibration data of each group to other electronic devices through Bluetooth. Code verification, data of each group, obtaining data synchronization requests through Bluetooth, receiving abnormal packets, etc.
MIPI接口可以被用于连接处理器110与显示屏194,摄像头193等外围器件。MIPI接口包括摄像头串 行接口(camera serial interface,CSI),显示屏串行接口(display serial interface,DSI)等。在一些实施例中,处理器110和摄像头193通过CSI接口通信,实现手机10的拍摄功能。处理器110和显示屏194通过DSI接口通信,实现手机10的显示功能。The MIPI interface can be used to connect the processor 110 with peripheral devices such as the display screen 194 and the camera 193 . MIPI interface includes camera string serial interface (camera serial interface, CSI), display serial interface (display serial interface, DSI), etc. In some embodiments, the processor 110 and the camera 193 communicate through the CSI interface to implement the shooting function of the mobile phone 10 . The processor 110 and the display screen 194 communicate through the DSI interface to realize the display function of the mobile phone 10 .
GPIO接口可以通过软件配置。GPIO接口可以被配置为控制信号,也可被配置为数据信号。在一些实施例中,GPIO接口可以用于连接处理器110与摄像头193,显示屏194,无线通信模块160,音频模块170,传感器模块180等。GPIO接口还可以被配置为I2C接口,I2S接口,UART接口,MIPI接口等。The GPIO interface can be configured through software. The GPIO interface can be configured as a control signal or as a data signal. In some embodiments, the GPIO interface can be used to connect the processor 110 with the camera 193, display screen 194, wireless communication module 160, audio module 170, sensor module 180, etc. The GPIO interface can also be configured as an I2C interface, I2S interface, UART interface, MIPI interface, etc.
外部存储器接口120可以用于连接外部存储卡,例如Micro SD卡,实现扩展手机10的存储能力。外部存储卡通过外部存储器接口120与处理器110通信,实现数据存储功能。例如将分类存储的条目式数据如联系人、短信、备忘录、邮件等保存在外部存储卡中。The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the mobile phone 10 . The external memory card communicates with the processor 110 through the external memory interface 120 to implement the data storage function. For example, store classified entry-type data such as contacts, text messages, memos, emails, etc. in an external memory card.
内部存储器121可以用于存储计算机可执行程序代码,所述可执行程序代码包括指令。内部存储器121可以包括程序存储区和数据存储区。其中,程序存储区可存储操作系统,至少一个功能所需的应用程序(比如前述畅连TM应用、备忘录应用、联系人应用、短信应用、邮件应用)等。数据存储区可存储手机10使用过程中所创建的数据,例如分组存储的各类条目式数据(如联系人、短信、备忘录、邮件等),各分组的校验码等等。此外,内部存储器121可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件,闪存器件,通用闪存存储器(universal flash storage,UFS)等。处理器110通过运行存储在内部存储器121的指令,和/或存储在设置于处理器110中的存储器的指令,执行手机10的各种功能应用。Internal memory 121 may be used to store computer executable program code, which includes instructions. Internal memory 121 may include program storage areas and data storage areas. Among them, the program storage area can store the operating system, at least one application program required for the function (such as the aforementioned ChanglianTM application, memo application, contact application, SMS application, email application), etc. The data storage area can store data created during the use of the mobile phone 10, such as various entry-type data stored in groups (such as contacts, text messages, memos, emails, etc.), check codes of each group, and so on. In addition, the internal memory 121 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, universal flash storage (UFS), etc. The processor 110 executes various functional applications of the mobile phone 10 by executing instructions stored in the internal memory 121 and/or instructions stored in a memory provided in the processor 110 .
USB接口130是符合USB标准规范的接口,具体可以是Mini USB接口,Micro USB接口,USB Type C接口等。USB接口130可以用于连接充电器为手机10充电,也可以用于手机10与外围设备之间传输数据。也可以用于连接耳机,通过耳机播放音频。该接口还可以用于连接其他电子设备,例如AR设备等。The USB interface 130 is an interface that complies with the USB standard specification, and may be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc. The USB interface 130 can be used to connect a charger to charge the mobile phone 10, and can also be used to transmit data between the mobile phone 10 and peripheral devices. It can also be used to connect headphones to play audio through them. This interface can also be used to connect other electronic devices, such as AR devices, etc.
充电管理模块140用于从充电器接收充电输入。充电管理模块140为电池142充电的同时,还可以通过电源管理模块141为手机10供电。The charging management module 140 is used to receive charging input from the charger. While the charging management module 140 charges the battery 142, it can also provide power to the mobile phone 10 through the power management module 141.
电源管理模块141用于连接电池142,充电管理模块140与处理器110。电源管理模块141接收电池142和/或充电管理模块140的输入,为处理器110,内部存储器121,显示屏194,摄像头193,和无线通信模块160等供电。手机10的无线通信功能可以通过天线1,天线2,移动通信模块150,无线通信模块160,调制解调处理器以及基带处理器等实现。The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and/or the charging management module 140, and supplies power to the processor 110, the internal memory 121, the display screen 194, the camera 193, the wireless communication module 160, and the like. The wireless communication function of the mobile phone 10 can be realized through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.
天线1和天线2用于发射和接收电磁波信号。Antenna 1 and Antenna 2 are used to transmit and receive electromagnetic wave signals.
移动通信模块150可以提供应用在手机10上的包括2G/3G/4G/5G等无线通信的解决方案。移动通信模块150可以包括至少一个滤波器,开关,功率放大器,低噪声放大器(low noise amplifier,LNA)等。移动通信模块150可以由天线1接收电磁波,并对接收的电磁波进行滤波,放大等处理,传送至调制解调处理器进行解调。移动通信模块150还可以对经调制解调处理器调制后的信号放大,经天线1转为电磁波辐射出去。在一些实施例中,移动通信模块150的至少部分功能模块可以被设置于处理器110中。在一些实施例中,移动通信模块150的至少部分功能模块可以与处理器110的至少部分模块被设置在同一个器件中。The mobile communication module 150 can provide wireless communication solutions including 2G/3G/4G/5G applied on the mobile phone 10 . The mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves through the antenna 1, perform filtering, amplification and other processing on the received electromagnetic waves, and transmit them to the modem processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modem processor and convert it into electromagnetic waves through the antenna 1 for radiation. In some embodiments, at least part of the functional modules of the mobile communication module 150 may be disposed in the processor 110 . In some embodiments, at least part of the functional modules of the mobile communication module 150 and at least part of the modules of the processor 110 may be provided in the same device.
无线通信模块160可以提供应用在手机10上的包括无线局域网(wireless local area networks,WLAN)(如无线保真(wireless fidelity,Wi-Fi)网络),蓝牙(bluetooth,BT),全球导航卫星系统(global navigation satellite system,GNSS),调频(frequency modulation,FM),NFC,红外技术(infrared,IR)等无线通信的解决方案。无线通信模块160可以是集成至少一个通信处理模块的一个或多个器件。无线通信模块160经由天线2接收电磁波,将电磁波信号调频以及滤波处理,将处理后的 信号发送到处理器110。无线通信模块160还可以从处理器110接收待发送的信号,对其进行调频,放大,经天线2转为电磁波辐射出去。The wireless communication module 160 can provide applications on the mobile phone 10 including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) network), Bluetooth (bluetooth, BT), and global navigation satellite system. (global navigation satellite system, GNSS), frequency modulation (FM), NFC, infrared technology (infrared, IR) and other wireless communication solutions. The wireless communication module 160 may be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves through the antenna 2, frequency modulates and filters the electromagnetic wave signals, and converts the processed The signal is sent to processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, frequency modulate it, amplify it, and convert it into electromagnetic waves through the antenna 2 for radiation.
在一些实施例中,手机10可以利用移动通信模块150或移动通信模块提供的无线通信解决方案,与其他电子设备建立通信连接,并基于建立的通信连接通过本申请各实施例提供的数据同步方法与其他电子设备进行数据同步。In some embodiments, the mobile phone 10 can use the mobile communication module 150 or the wireless communication solution provided by the mobile communication module to establish a communication connection with other electronic devices, and use the data synchronization method provided by various embodiments of the present application based on the established communication connection. Data synchronization with other electronic devices.
手机10可以通过音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,以及应用处理器等实现音频功能。例如音乐播放,录音等。The mobile phone 10 can implement audio functions through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone interface 170D, and the application processor. Such as music playback, recording, etc.
音频模块170用于将数字音频信息转换成模拟音频信号输出,也用于将模拟音频输入转换为数字音频信号。音频模块170还可以用于对音频信号编码和解码。The audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals. Audio module 170 may also be used to encode and decode audio signals.
扬声器170A,也称“喇叭”,用于将音频电信号转换为声音信号。Speaker 170A, also called "speaker", is used to convert audio electrical signals into sound signals.
受话器170B,也称“听筒”,用于将音频电信号转换成声音信号。Receiver 170B, also called "earpiece", is used to convert audio electrical signals into sound signals.
麦克风170C,也称“话筒”,“传声器”,用于将声音信号转换为电信号。Microphone 170C, also called "microphone" or "microphone", is used to convert sound signals into electrical signals.
耳机接口170D用于连接有线耳机。The headphone interface 170D is used to connect wired headphones.
压力传感器180A用于感受压力信号,可以将压力信号转换成电信号。在一些实施例中,压力传感器180A可以设置于显示屏194。压力传感器180A的种类很多,如电阻式压力传感器,电感式压力传感器,电容式压力传感器等。电容式压力传感器可以是包括至少两个具有导电材料的平行板。当有力作用于压力传感器180A,电极之间的电容改变。手机10根据电容的变化确定压力的强度。当有触摸操作作用于显示屏194,手机10根据压力传感器180A检测所述触摸操作强度。手机10也可以根据压力传感器180A的检测信号计算触摸的位置。The pressure sensor 180A is used to sense pressure signals and can convert the pressure signals into electrical signals. In some embodiments, pressure sensor 180A may be disposed on display screen 194 . There are many types of pressure sensors 180A, such as resistive pressure sensors, inductive pressure sensors, capacitive pressure sensors, etc. A capacitive pressure sensor may include at least two parallel plates of conductive material. When a force is applied to pressure sensor 180A, the capacitance between the electrodes changes. The mobile phone 10 determines the intensity of the pressure based on changes in capacitance. When a touch operation is performed on the display screen 194, the mobile phone 10 detects the intensity of the touch operation according to the pressure sensor 180A. The mobile phone 10 can also calculate the touch position based on the detection signal of the pressure sensor 180A.
加速度传感器180E可检测手机10在各个方向上(一般为三轴)加速度的大小。当手机10静止时可检测出重力的大小及方向。还可以用于识别电子设备姿态,应用于横竖屏切换,计步器等应用。The acceleration sensor 180E can detect the acceleration of the mobile phone 10 in various directions (generally three axes). When the mobile phone 10 is stationary, the magnitude and direction of gravity can be detected. It can also be used to identify the posture of electronic devices and be used in horizontal and vertical screen switching, pedometer and other applications.
环境光传感器180L用于感知环境光亮度。手机10可以根据感知的环境光亮度自适应调节显示屏194亮度。环境光传感器180L也可用于拍照时自动调节白平衡。环境光传感器180L还可以与接近光传感器180G配合,检测手机10是否在口袋里,以防误触。The ambient light sensor 180L is used to sense ambient light brightness. The mobile phone 10 can adaptively adjust the brightness of the display screen 194 according to the perceived ambient light brightness. The ambient light sensor 180L can also be used to automatically adjust the white balance when taking pictures. The ambient light sensor 180L can also cooperate with the proximity light sensor 180G to detect whether the mobile phone 10 is in the pocket to prevent accidental touching.
指纹传感器180H用于采集指纹。手机10可以利用采集的指纹特性实现指纹解锁,访问应用锁,指纹拍照,指纹接听来电等。Fingerprint sensor 180H is used to collect fingerprints. Mobile phone 10 can use the collected fingerprint characteristics to achieve fingerprint unlocking, access to application locks, fingerprint photography, fingerprint answering incoming calls, etc.
触摸传感器180K,也称“触控器件”。触摸传感器180K可以设置于显示屏194,由触摸传感器180K与显示屏194组成触摸屏,也称“触控屏”。触摸传感器180K用于检测作用于其上或附近的触摸操作。触摸传感器可以将检测到的触摸操作传递给应用处理器,以确定触摸事件类型。可以通过显示屏194提供与触摸操作相关的视觉输出。在另一些实施例中,触摸传感器180K也可以设置于手机10的表面,与显示屏194所处的位置不同。Touch sensor 180K, also known as "touch device". The touch sensor 180K can be disposed on the display screen 194. The touch sensor 180K and the display screen 194 form a touch screen, which is also called a "touch screen". The touch sensor 180K is used to detect a touch operation on or near the touch sensor 180K. The touch sensor can pass the detected touch operation to the application processor to determine the touch event type. Visual output related to the touch operation may be provided through display screen 194 . In other embodiments, the touch sensor 180K may also be disposed on the surface of the mobile phone 10 in a position different from that of the display screen 194 .
骨传导传感器180M可以获取振动信号。在一些实施例中,骨传导传感器180M可以获取人体声部振动骨块的振动信号。骨传导传感器180M也可以接触人体脉搏,接收血压跳动信号。Bone conduction sensor 180M can acquire vibration signals. In some embodiments, the bone conduction sensor 180M can acquire the vibration signal of the vibrating bone mass of the human body's vocal part. The bone conduction sensor 180M can also contact the human body's pulse and receive blood pressure beating signals.
按键190包括开机键,音量键等。按键190可以是机械按键。也可以是触摸式按键。手机10可以接收按键输入,产生与手机10的用户设置以及功能控制有关的键信号输入。The buttons 190 include a power button, a volume button, etc. Key 190 may be a mechanical key. It can also be a touch button. The mobile phone 10 can receive key input and generate key signal input related to user settings and function control of the mobile phone 10 .
马达191可以产生振动提示。The motor 191 can generate vibration prompts.
指示器192可以是指示灯,可以用于指示充电状态,电量变化,也可以用于指示消息,未接来电,通知等。The indicator 192 may be an indicator light, which may be used to indicate charging status, power changes, or may be used to indicate messages, missed calls, notifications, etc.
摄像头193用于捕获静态图像或视频。物体通过镜头生成光学图像投射到感光元件。感光元件可以 是电荷耦合器件(charge coupled device,CCD)或互补金属氧化物半导体(complementary metal-oxide-semiconductor,CMOS)光电晶体管。感光元件把光信号转换成电信号,之后将电信号传递给ISP转换成数字图像信号。ISP将数字图像信号输出到DSP加工处理。DSP将数字图像信号转换成标准的RGB,YUV等格式的图像信号。在一些实施例中,手机10可以包括1个或N个摄像头193,N为大于1的正整数。Camera 193 is used to capture still images or video. The object passes through the lens to produce an optical image that is projected onto the photosensitive element. The photosensitive element can It is a charge coupled device (CCD) or complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, and then passes the electrical signal to the ISP to convert it into a digital image signal. ISP outputs digital image signals to DSP for processing. DSP converts digital image signals into standard RGB, YUV and other format image signals. In some embodiments, the mobile phone 10 may include 1 or N cameras 193, where N is a positive integer greater than 1.
显示屏194用于显示图像,视频等。显示屏194包括显示面板。显示面板可以采用液晶显示屏(liquid crystal display,LCD),有机发光二极管(organic light-emitting diode,OLED),有源矩阵有机发光二极体或主动矩阵有机发光二极体(active-matrix organic light emitting diode的,AMOLED),柔性发光二极管(flex light-emitting diode,FLED),Mini-LED,Micro-LED,Micro-OLED,量子点发光二极管(quantum dot light emitting diodes,QLED)等。在一些实施例中,手机10可以包括1个或N个显示屏194,N为大于1的正整数。The display screen 194 is used to display images, videos, etc. Display 194 includes a display panel. The display panel can use a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active matrix organic light emitting diode or an active matrix organic light emitting diode (active-matrix organic light emitting diode). emitting diode (AMOLED), flexible light-emitting diode (FLED), Mini-LED, Micro-LED, Micro-OLED, quantum dot light-emitting diode (QLED), etc. In some embodiments, the mobile phone 10 may include 1 or N display screens 194, where N is a positive integer greater than 1.
手机10可以通过GPU,显示屏194,以及应用处理器等实现显示功能。GPU为图像处理的微处理器,连接显示屏194和应用处理器。GPU用于执行数学和几何计算,用于图形渲染。处理器110可包括一个或多个GPU,其执行程序指令以生成或改变显示信息。The mobile phone 10 can implement display functions through the GPU, the display screen 194, and the application processor. The GPU is an image processing microprocessor and is connected to the display screen 194 and the application processor. GPUs are used to perform mathematical and geometric calculations for graphics rendering. Processor 110 may include one or more GPUs that execute program instructions to generate or alter display information.
SIM卡接口195用于连接SIM卡。The SIM card interface 195 is used to connect a SIM card.
可以理解,本申请实施例示出的手机10的结构并不构成对手机10的具体限定。在本申请另一些实施例中,手机10可以包括比图示更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。图示的部件可以以硬件,软件或软件和硬件的组合实现。It can be understood that the structure of the mobile phone 10 shown in the embodiment of the present application does not constitute a specific limitation on the mobile phone 10 . In other embodiments of the present application, the mobile phone 10 may include more or less components than shown in the figures, or some components may be combined, some components may be separated, or some components may be arranged differently. The components illustrated may be implemented in hardware, software, or a combination of software and hardware.
可以理解,本申请各实施例提供的数据同步方法适用的电子设备可以和手机10具有相同或相似的结构,也可包括比手机10更多或更少的模块,在此不做限定。It can be understood that the electronic device to which the data synchronization method provided by the embodiments of the present application is applicable may have the same or similar structure as the mobile phone 10 , and may also include more or fewer modules than the mobile phone 10 , which is not limited here.
本申请公开的机制的各实施例可以被实现在硬件、软件、固件或这些实现方法的组合中。本申请的实施例可实现为在可编程系统上执行的计算机程序或程序代码,该可编程系统包括至少一个处理器、存储系统(包括易失性和非易失性存储器和/或存储元件)、至少一个输入设备以及至少一个输出设备。Various embodiments of the mechanisms disclosed in this application may be implemented in hardware, software, firmware, or a combination of these implementation methods. Embodiments of the present application may be implemented as a computer program or program code executing on a programmable system including at least one processor, a storage system (including volatile and non-volatile memory and/or storage elements) , at least one input device and at least one output device.
可将程序代码应用于输入指令,以执行本申请描述的各功能并生成输出信息。可以按已知方式将输出信息应用于一个或多个输出设备。为了本申请的目的,处理系统包括具有诸如例如数字信号处理器(DSP)、微控制器、专用集成电路(ASIC)或微处理器之类的处理器的任何系统。Program code may be applied to input instructions to perform the functions described herein and to generate output information. Output information can be applied to one or more output devices in a known manner. For the purposes of this application, a processing system includes any system having a processor such as, for example, a digital signal processor (DSP), a microcontroller, an application specific integrated circuit (ASIC), or a microprocessor.
程序代码可以用高级程序化语言或面向对象的编程语言来实现,以便与处理系统通信。在需要时,也可用汇编语言或机器语言来实现程序代码。事实上,本申请中描述的机制不限于任何特定编程语言的范围。在任一情形下,该语言可以是编译语言或解释语言。Program code may be implemented in a high-level procedural language or an object-oriented programming language to communicate with the processing system. When necessary, assembly language or machine language can also be used to implement program code. In fact, the mechanisms described in this application are not limited to the scope of any particular programming language. In either case, the language may be a compiled or interpreted language.
在一些情况下,所公开的实施例可以以硬件、固件、软件或其任何组合来实现。所公开的实施例还可以被实现为由一个或多个暂时或非暂时性机器可读(例如,计算机可读)存储介质承载或存储在其上的指令,其可以由一个或多个处理器读取和执行。例如,指令可以通过网络或通过其他计算机可读介质分发。因此,机器可读介质可以包括用于以机器(例如,计算机)可读的形式存储或传输信息的任何机制,包括但不限于,软盘、光盘、光碟、只读存储器(CD-ROMs)、磁光盘、只读存储器(ROM)、随机存取存储器(RAM)、可擦除可编程只读存储器(EPROM)、电可擦除可编程只读存储器(EEPROM)、磁卡或光卡、闪存、或用于利用因特网以电、光、声或其他形式的传播信号来传输信息(例如,载波、红外信号数字信号等)的有形的机器可读存储器。因此,机器可读介质包括适合于以机器(例如,计算机)可读的形式存储或传输电子指令或信息的任何类型的机器可读介质。 In some cases, the disclosed embodiments may be implemented in hardware, firmware, software, or any combination thereof. The disclosed embodiments may also be implemented as instructions carried on or stored on one or more transitory or non-transitory machine-readable (e.g., computer-readable) storage media, which may be operated by one or more processors Read and execute. For example, instructions may be distributed over a network or through other computer-readable media. Thus, machine-readable media may include any mechanism for storing or transmitting information in a form readable by a machine (e.g., a computer), including, but not limited to, floppy disks, optical disks, optical disks, read-only memories (CD-ROMs), magnetic Optical disk, read-only memory (ROM), random-access memory (RAM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), magnetic or optical card, flash memory, or Tangible machine-readable storage used to transmit information (e.g., carrier waves, infrared signals, digital signals, etc.) using electrical, optical, acoustic, or other forms of propagated signals over the Internet. Thus, machine-readable media includes any type of machine-readable media suitable for storing or transmitting electronic instructions or information in a form readable by a machine (eg, computer).
在附图中,可以以特定布置和/或顺序示出一些结构或方法特征。然而,应该理解,可能不需要这样的特定布置和/或排序。而是,在一些实施例中,这些特征可以以不同于说明性附图中所示的方式和/或顺序来布置。另外,在特定图中包括结构或方法特征并不意味着暗示在所有实施例中都需要这样的特征,并且在一些实施例中,可以不包括这些特征或者可以与其他特征组合。In the drawings, some structural or methodological features may be shown in specific arrangements and/or orders. However, it should be understood that such specific arrangement and/or ordering may not be required. Rather, in some embodiments, the features may be arranged in a manner and/or order different than that shown in the illustrative figures. Additionally, the inclusion of structural or methodological features in a particular figure is not meant to imply that such features are required in all embodiments, and in some embodiments these features may not be included or may be combined with other features.
需要说明的是,本申请各设备实施例中提到的各单元/模块都是逻辑单元/模块,在物理上,一个逻辑单元/模块可以是一个物理单元/模块,也可以是一个物理单元/模块的一部分,还可以以多个物理单元/模块的组合实现,这些逻辑单元/模块本身的物理实现方式并不是最重要的,这些逻辑单元/模块所实现的功能的组合才是解决本申请所提出的技术问题的关键。此外,为了突出本申请的创新部分,本申请上述各设备实施例并没有将与解决本申请所提出的技术问题关系不太密切的单元/模块引入,这并不表明上述设备实施例并不存在其它的单元/模块。It should be noted that each unit/module mentioned in each device embodiment of this application is a logical unit/module. Physically, a logical unit/module can be a physical unit/module, or it can be a physical unit/module. Part of the module can also be implemented as a combination of multiple physical units/modules. The physical implementation of these logical units/modules is not the most important. The combination of functions implemented by these logical units/modules is what solves the problem of this application. Key technical issues raised. In addition, in order to highlight the innovative part of this application, the above-mentioned equipment embodiments of this application do not introduce units/modules that are not closely related to solving the technical problems raised by this application. This does not mean that the above-mentioned equipment embodiments do not exist. Other units/modules.
需要说明的是,在本专利的示例和说明书中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。It should be noted that in the examples and descriptions of this patent, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply There is no such actual relationship or sequence between these entities or operations. Furthermore, the terms "comprises," "comprises," or any other variations thereof are intended to cover a non-exclusive inclusion such that a process, method, article, or apparatus that includes a list of elements includes not only those elements, but also those not expressly listed other elements, or elements inherent to the process, method, article or equipment. Without further limitation, an element defined by the statement "comprises a" does not exclude the presence of additional identical elements in a process, method, article, or device that includes the stated element.
虽然通过参照本申请的某些优选实施例,已经对本申请进行了图示和描述,但本领域的普通技术人员应该明白,可以在形式上和细节上对其作各种改变,而不偏离本申请的精神和范围。 Although the present application has been illustrated and described with reference to certain preferred embodiments thereof, it will be understood by those of ordinary skill in the art that various changes may be made in form and detail without departing from the present invention. The spirit and scope of the application.

Claims (26)

  1. 一种数据同步方法,应用于第一电子设备,其特征在于,包括:A data synchronization method, applied to a first electronic device, characterized by including:
    从第二电子设备接收到数据同步消息,其中,所述数据同步消息包括M个校验码,所述校验码用于标识所对应的数据分组的数据内容,并且M≥1;A data synchronization message is received from the second electronic device, wherein the data synchronization message includes M check codes, the check codes are used to identify the data content of the corresponding data packet, and M≥1;
    将所述M个校验码与所述第一电子设备上存储的N个数据分组的N个校验码进行对比,确定出不同的校验码,其中N≥1;Compare the M check codes with the N check codes of the N data packets stored on the first electronic device to determine different check codes, where N≥1;
    基于确定出的不同的校验码,将所述第一电子设备上存储的N个数据分组更新为所述M个校验码所标识的M个数据分组。Based on the determined different check codes, the N data packets stored on the first electronic device are updated to M data packets identified by the M check codes.
  2. 根据权利要求1所述的方法,其特征在于,M等于N,并且所述M个校验码与所述N个校验码存在一一对应的关系;并且The method according to claim 1, wherein M is equal to N, and there is a one-to-one correspondence between the M check codes and the N check codes; and
    所述基于确定出的不同的校验码,将所述第一电子设备上存储的N个数据分组更新为所述M个校验码所标识的M个数据分组,包括:Based on the determined different check codes, updating the N data packets stored on the first electronic device to M data packets identified by the M check codes includes:
    在所述N个校验码中存在第一校验码,并且所述M个校验码中与所述第一校验码对应的第二校验码与所述第一校验码不同的情况下,将所述第一电子设备上存储的与所述第一校验码对应的第一数据分组更新为,与所述第二校验码对应的第二数据分组。There is a first check code among the N check codes, and the second check code corresponding to the first check code among the M check codes is different from the first check code. In this case, the first data packet corresponding to the first check code stored on the first electronic device is updated to a second data packet corresponding to the second check code.
  3. 根据权利要求1所述的方法,其特征在于,所述基于确定出的不同的校验码,将所述第一电子设备上存储的N个数据分组更新为所述M个校验码所标识的M个数据分组,包括:The method according to claim 1, characterized in that, based on the determined different check codes, the N data packets stored on the first electronic device are updated to the ones identified by the M check codes. M data groups, including:
    在所述N个校验码中存在第三校验码,而所述M个校验码中不存在所述第三校验码的情况下,删除所述第一电子设备上存储的与所述第三校验码对应的第三数据分组;或者When there is a third check code among the N check codes and the third check code does not exist among the M check codes, delete the data stored on the first electronic device that is related to all the check codes. The third data packet corresponding to the third check code; or
    在所述M个校验码中存在第四校验码,而所述N个校验码中不存在所述第四校验码的情况下,在所述第一电子设备上存储与所述第四校验码对应的第四数据分组。When there is a fourth check code among the M check codes and the fourth check code does not exist among the N check codes, the first electronic device stores the same as the fourth check code. The fourth data packet corresponding to the fourth check code.
  4. 根据权利要求1所述的方法,其特征在于,所述数据分组的校验码由数据分组中各数据的消息摘要确定。The method according to claim 1, characterized in that the check code of the data packet is determined by the message digest of each data in the data packet.
  5. 根据权利要求4所述的方法,其特征在于,所述数据分组的校验码由数据分组中各数据的消息摘要确定,包括:The method according to claim 4, characterized in that the check code of the data packet is determined by the message digest of each data in the data packet, including:
    所述数据分组的校验码由所述数据分组中各数据的消息摘要逐个进行异或运算得到。The check code of the data packet is obtained by performing an XOR operation one by one on the message digest of each data in the data packet.
  6. 根据权利要求1所述的方法,其特征在于,各数据所属的数据分组是根据所述数据中预设字段的字符确定的。The method according to claim 1, characterized in that the data group to which each data belongs is determined based on the characters of a preset field in the data.
  7. 根据权利要求6所述的方法,其特征在于,所述预设字段包括以下字段中的至少一种:The method according to claim 6, characterized in that the preset fields include at least one of the following fields:
    在所述数据包括联系人信息的情况下,所述预设字段包括联系人的电话号码;In the case where the data includes contact information, the preset field includes the contact's phone number;
    在所述数据包括短信的情况下,所述预设字段包括短信的收件人或发件人的号码;In the case where the data includes a text message, the preset field includes the number of the recipient or sender of the text message;
    在所述数据包括备忘录的情况下,所述预设字段包括备忘录的创建时间;In the case where the data includes a memo, the preset field includes the creation time of the memo;
    在所述数据包括邮件的情况下,所述预设字段包括发件人或收件人信息,其中发件人或收件人信息包括电子邮箱地址和/或姓名;In the case where the data includes an email, the preset field includes sender or recipient information, where the sender or recipient information includes an email address and/or name;
    在所述数据即时消息的情况下,所述预设字段包括即时消息的发送或接收时间。In the case of the data instant message, the preset field includes the sending or receiving time of the instant message.
  8. 根据权利要求1所述的方法,其特征在于,所述数据分组中的数据内容包括以下数据中的至少一种:联系人信息、短信、备忘录、邮件、即时消息。The method according to claim 1, wherein the data content in the data packet includes at least one of the following data: contact information, text messages, memos, emails, and instant messages.
  9. 根据权利要求1至8中任一项所述的方法,其特征在于,所述第一电子设备和所述第二电子设备中都安装有第一应用或第一服务;并且 The method according to any one of claims 1 to 8, wherein a first application or a first service is installed in both the first electronic device and the second electronic device; and
    由所述第一电子设备中安装的第一应用或第一服务从所述第一电子设备中安装的第一应用或第一服务接收所述数据同步消息;receiving the data synchronization message from the first application or first service installed in the first electronic device by a first application or a first service installed in the first electronic device;
    由所述第一电子设备中的第一应用或第一服务将所述M个校验码与所述第一电子设备上存储的N个数据分组的N个校验码进行对比,确定出不同的校验码;The first application or first service in the first electronic device compares the M check codes with the N check codes of the N data packets stored on the first electronic device, and determines the difference check code;
    由所述第一电子设备中的第一应用或第一服务确定出的不同的校验码,将所述第一电子设备上存储的N个数据分组更新为所述M个校验码所标识的M个数据分组。Using different check codes determined by the first application or the first service in the first electronic device, the N data packets stored on the first electronic device are updated to be identified by the M check codes. M data groups.
  10. 根据权利要求9所述的方法,其特征在于,所述第一应用包括以下应用中的一种:联系人应用、备忘录应用、短信应用、邮件应用、即时通信应用。The method of claim 9, wherein the first application includes one of the following applications: a contact application, a memo application, a text message application, an email application, and an instant messaging application.
  11. 一种数据同步方法,应用于第二电子设备,其特征在于,包括:A data synchronization method applied to a second electronic device, characterized by including:
    获取P个校验码,所述校验码用于标识所对应的数据分组的数据内容,P≥1;Obtain P check codes, the check codes are used to identify the data content of the corresponding data packets, P≥1;
    向第一电子设备发送数据同步消息,所述数据同步消息包括所述P个校验码,并且,所述P个校验码用于确定所述P个校验码所对应的P个数据分组中,待同步到所述第一电子设备的数据分组。Send a data synchronization message to the first electronic device, where the data synchronization message includes the P check codes, and the P check codes are used to determine P data packets corresponding to the P check codes. , the data packet to be synchronized to the first electronic device.
  12. 根据权利要求11所述的方法,其特征在于,还包括:The method according to claim 11, further comprising:
    基于数据分组中存储的各数据的消息摘要确定所述数据分组的校验码。The check code of the data packet is determined based on the message digest of each data stored in the data packet.
  13. 根据权利要求12所述的方法,其特征在于,所述基于数据分组中存储的各数据的消息摘要确定所述数据分组的校验码,包括:The method according to claim 12, characterized in that determining the check code of the data packet based on the message digest of each data stored in the data packet includes:
    将所述数据分组中各数据的消息摘要逐个进行异或运算,得到所述数据分组的校验码。XOR operations are performed on the message digests of each data in the data group one by one to obtain the check code of the data group.
  14. 根据权利要求13所述的方法,其特征在于,所述基于数据分组中存储的各数据的消息摘要确定所述数据分组的校验码,还包括:The method of claim 13, wherein determining the check code of the data packet based on the message digest of each data stored in the data packet further includes:
    在检测到第五数据分组中的第一数据被删除的情况下,将所述第五数据分组的校验码更新为所述第一数据的信息摘要与所述第五数据分组当前校验码的异或运算结果,其中,所述第五数据分组为所述P个校验码对应的数据分组中的一个;或者When it is detected that the first data in the fifth data packet is deleted, the check code of the fifth data packet is updated to the information digest of the first data and the current check code of the fifth data packet. The result of the XOR operation, wherein the fifth data packet is one of the data packets corresponding to the P check codes; or
    在检测到第六数据分组中新增第二数据的情况下,将所述第六数据分组的校验码更新为所述第二数据的信息摘要与所述第六数据分组当前校验码的异或运算结果,其中,所述第六数据分组为所述P个校验码对应的数据分组中的一个;或者When it is detected that the second data is newly added to the sixth data packet, the check code of the sixth data packet is updated to the information digest of the second data and the current check code of the sixth data packet. XOR operation result, wherein the sixth data packet is one of the data packets corresponding to the P check codes; or
    在检测到第七数据分组中的第三数据被修改为第四数据的情况下,将所述第七数据分组的校验码更新为所述第三数据的信息摘要、所述第四数据的信息摘要、所述第七数据分组当前校验码逐个进行异或运算结果,其中,所述第七数据分组为所述P个校验码对应的数据分组中的一个。When it is detected that the third data in the seventh data packet is modified into the fourth data, the check code of the seventh data packet is updated to the information digest of the third data and the information digest of the fourth data. The information summary and the current check code of the seventh data packet are XORed one by one, wherein the seventh data packet is one of the data packets corresponding to the P check codes.
  15. 根据权利要求14所述的方法,其特征在于,各数据所属的数据分组是根据所述数据中预设字段的字符确定的。The method according to claim 14, characterized in that the data group to which each data belongs is determined based on the characters of a preset field in the data.
  16. 根据权利要求15所述的方法,其特征在于,所述预设字段包括以下字段中的至少一种:The method according to claim 15, characterized in that the preset fields include at least one of the following fields:
    在所述数据包括联系人信息的情况下,所述预设字段包括联系人的电话号码;In the case where the data includes contact information, the preset field includes the contact's phone number;
    在所述数据包括短信的情况下,所述预设字段包括短信的收件人或发件人的号码;In the case where the data includes a text message, the preset field includes the number of the recipient or sender of the text message;
    在所述数据包括备忘录的情况下,所述预设字段包括备忘录的创建时间;In the case where the data includes a memo, the preset field includes the creation time of the memo;
    在所述数据包括邮件的情况下,所述预设字段包括发件人或收件人信息,其中发件人或收件人信息包括电子邮箱地址和/或姓名;In the case where the data includes an email, the preset field includes sender or recipient information, where the sender or recipient information includes an email address and/or name;
    在所述数据即时消息的情况下,所述预设字段包括即时的消息的发送或接收时间。In the case of the data instant message, the preset field includes the sending or receiving time of the instant message.
  17. 一种数据同步系统,其特征在于,所述数据同步系统包括第一电子设备和第二电子设备;并且 A data synchronization system, characterized in that the data synchronization system includes a first electronic device and a second electronic device; and
    所述第二电子设备用于向所述第一电子设备发送数据同步消息,其中,所述数据同步消息包括R个校验码,所述校验码用于标识所对应的数据分组的数据内容,并且R≥1;The second electronic device is configured to send a data synchronization message to the first electronic device, wherein the data synchronization message includes R check codes, and the check codes are used to identify the data content of the corresponding data packet. , and R≥1;
    所述第一电子设备用于接收所述数据同步消息,将所述R个校验码与所述第一电子设备上存储的S个数据分组的S个校验码进行对比,确定出不同的校验码,并基于确定出的不同的校验码,将所述第一电子设备上存储的S个数据分组更新为所述R个校验码所标识的R个数据分组,其中,S≥1。The first electronic device is configured to receive the data synchronization message, compare the R check codes with the S check codes of the S data packets stored on the first electronic device, and determine different Check codes, and based on the determined different check codes, update the S data packets stored on the first electronic device to R data packets identified by the R check codes, where S≥ 1.
  18. 根据权利要求17所述的系统,其特征在于,所述数据分组的校验码由所述数据分组中各数据的消息摘要逐个进行异或运算得到。The system according to claim 17, characterized in that the check code of the data packet is obtained by performing an XOR operation one by one on the message digest of each data in the data packet.
  19. 根据权利要求18所述的系统,其特征在于,所述第二电子设备还用于:The system according to claim 18, characterized in that the second electronic device is also used for:
    在检测到第八数据分组中的第五数据被删除的情况下,将所述第八数据分组的校验码更新为所述第五数据的信息摘要与所述第八数据分组当前校验码的异或运算结果,其中,所述第八数据分组为所述R个校验码对应的数据分组中的一个;或者When it is detected that the fifth data in the eighth data packet is deleted, the check code of the eighth data packet is updated to the information digest of the fifth data and the current check code of the eighth data packet. The result of the XOR operation, wherein the eighth data packet is one of the data packets corresponding to the R check codes; or
    在检测到第九数据分组中新增第六数据的情况下,将所述第九数据分组的校验码更新为所述第六数据的信息摘要与所述第九数据分组当前校验码的异或运算结果,其中,所述第九数据分组为所述R个校验码对应的数据分组中的一个;或者When it is detected that the sixth data is newly added to the ninth data packet, the check code of the ninth data packet is updated to the information digest of the sixth data and the current check code of the ninth data packet. XOR operation result, wherein the ninth data packet is one of the data packets corresponding to the R check codes; or
    在检测到第十数据分组中的第七数据被修改为第八数据的情况下,将所述第十数据分组的校验码更新为所述第七数据的信息摘要、所述第八数据的信息摘要、所述第十数据分组当前校验码逐个进行异或运算结果,其中所述第十数据分组为所述R个校验码对应的数据分组中的一个。When it is detected that the seventh data in the tenth data packet is modified into the eighth data, the check code of the tenth data packet is updated to the information digest of the seventh data and the information digest of the eighth data. The information summary and the current check codes of the tenth data group are XORed one by one, where the tenth data group is one of the data groups corresponding to the R check codes.
  20. 根据权利要求17至19中任一项所述的系统,其特征在于,所述第一电子设备和所述第二电子设备为终端设备,或者所述第一电子设备为终端设备、所述第二电子设备为服务器。The system according to any one of claims 17 to 19, characterized in that the first electronic device and the second electronic device are terminal devices, or the first electronic device is a terminal device, and the second electronic device is a terminal device. Two electronic devices are servers.
  21. 根据权利要求17至19中任一项所述的系统,其特征在于,所述数据同步系统还包括第三电子设备,所述第三电子设备用于从所述第二电子设备接收所述数据同步消息,并将所述数据同步消息发送给所述第一电子设备。The system according to any one of claims 17 to 19, characterized in that the data synchronization system further includes a third electronic device, the third electronic device is used to receive the data from the second electronic device synchronize the message, and send the data synchronization message to the first electronic device.
  22. 根据权利要求21所述的系统,其特征在于,所述第一电子设备和所述第二电子设备为终端设备,所述第三电子设备为服务器。The system of claim 21, wherein the first electronic device and the second electronic device are terminal devices, and the third electronic device is a server.
  23. 根据权利要求20或权利要求22中任一项所述的系统,其特征在于,所述终端设备包括手机、车机、可穿戴设备、平板电脑、智能电视中的至少一种。The system according to claim 20 or claim 22, wherein the terminal device includes at least one of a mobile phone, a car machine, a wearable device, a tablet computer, and a smart TV.
  24. 一种可读存储介质,其特征在于,所述可读存储介质上存储有指令,所述指令在电子设备上执行时使所述电子设备实现权利要求1至16中任一项所述的数据同步方法。A readable storage medium, characterized in that instructions are stored on the readable storage medium, and when the instructions are executed on an electronic device, the electronic device realizes the data described in any one of claims 1 to 16 sync method.
  25. 一种电子设备,其特征在于,包括:An electronic device, characterized by including:
    存储器,用于存储由电子设备的一个或多个处理器执行的指令;memory for storing instructions for execution by one or more processors of the electronic device;
    以及处理器,是所述电子设备的处理器之一,用于执行所述存储器中存储的所述指令以实现权利要求1至16中任一项所述的数据同步方法。and a processor, one of the processors of the electronic device, configured to execute the instructions stored in the memory to implement the data synchronization method according to any one of claims 1 to 16.
  26. 一种计算机程序产品,其特征在于,所述计算机程序产品包括指令,所述指令在电子设备上执行时使所述电子设备实现权利要求1至16中任一项所述的数据同步方法。 A computer program product, characterized in that the computer program product includes instructions that, when executed on an electronic device, cause the electronic device to implement the data synchronization method according to any one of claims 1 to 16.
PCT/CN2023/099963 2022-06-14 2023-06-13 Data synchronization method and system, and medium, program product and electronic device WO2023241582A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210671444.2 2022-06-14
CN202210671444.2A CN117271655A (en) 2022-06-14 2022-06-14 Data synchronization method, system, medium, program product and electronic device

Publications (1)

Publication Number Publication Date
WO2023241582A1 true WO2023241582A1 (en) 2023-12-21

Family

ID=89192285

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/099963 WO2023241582A1 (en) 2022-06-14 2023-06-13 Data synchronization method and system, and medium, program product and electronic device

Country Status (2)

Country Link
CN (1) CN117271655A (en)
WO (1) WO2023241582A1 (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040025072A1 (en) * 2002-07-30 2004-02-05 International Business Machines Corporation Method, system and program for synchronizing data
CN104243508A (en) * 2013-06-07 2014-12-24 富鸿康科技(深圳)有限公司 Server, client side and file synchronization method
CN104639651A (en) * 2015-03-04 2015-05-20 成都维远艾珏信息技术有限公司 Mobile equipment information transmission method
WO2015181462A1 (en) * 2014-05-28 2015-12-03 Preezms Method for synchronising data among various devices via a server
CN106528125A (en) * 2016-10-26 2017-03-22 腾讯科技(深圳)有限公司 Data file incremental updating method, server, client and system
WO2020199724A1 (en) * 2019-04-04 2020-10-08 中国银联股份有限公司 Data processing method, server and device

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040025072A1 (en) * 2002-07-30 2004-02-05 International Business Machines Corporation Method, system and program for synchronizing data
CN104243508A (en) * 2013-06-07 2014-12-24 富鸿康科技(深圳)有限公司 Server, client side and file synchronization method
WO2015181462A1 (en) * 2014-05-28 2015-12-03 Preezms Method for synchronising data among various devices via a server
CN104639651A (en) * 2015-03-04 2015-05-20 成都维远艾珏信息技术有限公司 Mobile equipment information transmission method
CN106528125A (en) * 2016-10-26 2017-03-22 腾讯科技(深圳)有限公司 Data file incremental updating method, server, client and system
WO2020199724A1 (en) * 2019-04-04 2020-10-08 中国银联股份有限公司 Data processing method, server and device

Also Published As

Publication number Publication date
CN117271655A (en) 2023-12-22

Similar Documents

Publication Publication Date Title
JP6858826B2 (en) How to provide notifications and their electronic devices
US20170083494A1 (en) Electronic device and operation control method therefor
WO2020041952A1 (en) Method and electronic apparatus for controlling express delivery cabinet on the basis of express delivery message
WO2020134872A1 (en) Message processing method, related device, and system
US10558427B2 (en) Electronic device for reproducing audio signal via external device and operating method thereof
CN114125786B (en) Message synchronization method, readable medium and electronic device
WO2019214498A1 (en) Dci transmission method, terminal and base station
CN111245745A (en) Message sending method, device, node equipment and storage medium
US20170163786A1 (en) Communication method, electronic device, and storage medium
CN114553814B (en) Method and device for processing push message
WO2019206039A1 (en) Unread message processing method and terminal
CN113806105A (en) Message processing method and device, electronic equipment and readable storage medium
KR20150125464A (en) Method for displaying message and electronic device
KR102133514B1 (en) Status message service providing method of electronic apparatus and electronic apparatus thereof
CN109845224B (en) Electronic device and method for operating an electronic device
WO2015102451A1 (en) Image processing method and electronic device implementing the same
US9804814B2 (en) Electronic device and method of interconnecting the same
WO2023241582A1 (en) Data synchronization method and system, and medium, program product and electronic device
CN113709024B (en) Data transmission method, medium and electronic device thereof
KR20150112252A (en) Electronic apparatus and connecting method thereof
CN110380956B (en) Method, device and system for transmitting instant communication message
KR20190139175A (en) Method for presenting a notification and an electronic device thereof
WO2024082977A1 (en) Data processing method, readable storage medium, and electronic device
EP4290375A1 (en) Display method, electronic device and system
EP4297366A1 (en) Message processing method and apparatus

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 23823150

Country of ref document: EP

Kind code of ref document: A1