Data synchronization method and electronic device
By using the synchronization state machine reset and switching state mechanism in the wearable device, the data synchronization problem caused by the electronic device not notifying the shutdown of the Bluetooth service is solved, and the data is effectively subscribed from the newly created Bluetooth service to ensure the integrity of the data synchronization. and reliability.
Patent Information
- Application Number
- CN202310548022.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-15
- Publication Date
- 2024-08-30
- Estimated Expiration
- 2043-05-15
AI Technical Summary
During the data synchronization process between the wearable device and the electronic device, the electronic device did not notify the wearable device after turning off the Bluetooth service, resulting in the inability to subscribe to target data from the recreated Bluetooth service, which may cause the user to miss important information.
By introducing a synchronization state machine in the wearable device, it is reset to the initial state and switches to the subscription state after receiving a notification from the recreated Bluetooth service, thereby ensuring that the device can Subscribe to data from the newly created Bluetooth service.
Ensure that wearable devices can completely synchronize target data in electronic devices, avoid missing important information, and improve user experience and reliability of data synchronization.
Smart Images

Figure CN117729623B
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of communication technology, and in particular, to a data synchronization method and an electronic device. Background Art
[0002] Wearable devices (such as smart bracelets, smart watches, etc.) are easy to wear, and can be used by electronic devices such as mobile phones and tablets to allow wearable devices to subscribe to target data (such as alarm information, incoming call information, etc.) from the target Bluetooth service of the electronic device, which is deeply loved by users. For example, when a user wears a smart bracelet, if there is incoming call information on the mobile phone, the smart bracelet will receive the incoming call information sent from the target Bluetooth service if the user does not check the incoming call information on the mobile phone, so that the incoming call information is synchronized to the smart bracelet. In this way, the user can check the incoming call information through the smart bracelet, which is more convenient, especially when the user is not convenient to check the mobile phone, it can prevent the user from missing the incoming call information. However, in some cases, after the electronic device turns off the target Bluetooth service, it recreates a Bluetooth service, but the electronic device does not notify the wearable device that the target Bluetooth service has been turned off, resulting in the wearable device being unable to subscribe to the target data from the recreated Bluetooth service. In this way, the wearable device cannot synchronize the target data in the electronic device, which may cause the user to miss important information. Summary of the invention
[0003] The present application provides a data synchronization method and an electronic device, which are used to subscribe to target data from a recreated Bluetooth service when the wearable device does not receive a message that a previously created Bluetooth service has been closed, so that the wearable device can completely synchronize the target data in the electronic device.
[0004] In order to achieve the above objectives, this application adopts the following technical solutions:
[0005] In a first aspect, a data synchronization method is provided, which may include: first, a second electronic device receives a first notification message from a first electronic device, and since the first notification message can be used to indicate that the Bluetooth service of the first electronic device has changed, the second electronic device can be used to subscribe to data from the Bluetooth service, so the synchronization state machine of the second electronic device is reset to the first state. Secondly, the second electronic device receives a second notification message from the first electronic device, and since the second notification message can be used to indicate: the second electronic device is allowed to subscribe to target data from the first Bluetooth service of the first electronic device; the target data is the data that the second electronic device has subscribed to from the second Bluetooth service of the first electronic device, so the synchronization state machine of the second electronic device is switched to the second state. Thirdly, in the second state, the second electronic device receives an encapsulation parameter from the first Bluetooth service, and switches the synchronization state machine of the second electronic device to a third state. The encapsulation parameter is used to encapsulate or decapsulate data transmitted between the first electronic device and the second electronic device. Then, in the third state, the second electronic device receives an encryption parameter from the first Bluetooth service, and switches the synchronization state machine of the second electronic device to a fourth state. The encryption parameter is used to encrypt or decrypt data transmitted between the first electronic device and the second electronic device. Then, in the fourth state, the second electronic device receives confirmation information of the data classification mapping table from the first Bluetooth service, and switches the synchronization state machine to the subscription state. The data classification mapping table includes a mapping relationship between a flag bit and an identifier of an application that uses data transmitted between the first electronic device and the second electronic device. Finally, in the subscription state, the second electronic device receives target data sent from the first Bluetooth service.
[0006] In the data synchronization method provided by the present application, the first electronic device can create a Bluetooth service at a time, and the second electronic device can subscribe to data from the Bluetooth service of the first electronic device. First, when the second electronic device determines that the Bluetooth service in the first electronic device has been changed (that is, the first electronic device has recreated a Bluetooth service), the synchronization state machine of the second electronic device is reset to the first state. In this way, the second electronic device no longer subscribes to the target data from the second Bluetooth service created previously. Then, when the second electronic device receives permission to subscribe to the target data from the recreated first Bluetooth service, the synchronization state machine switches from the first state to the second state, the third state, the fourth state in sequence, until the subscription state. In the subscription state, the second electronic device can receive the target data sent by the first Bluetooth service. It can be seen that regardless of whether the second electronic device receives a message that the second Bluetooth service has been closed, the second electronic device will no longer subscribe to the target data from the second Bluetooth service, but will subscribe to the target data from the first Bluetooth service. In this way, it can be ensured that the second electronic device can be completely synchronized to the target data in the first electronic device.
[0007] In a possible implementation of the first aspect, the receiving of the second notification message from the first electronic device may include: first, the second electronic device sends to the first electronic device first query information indicating that the first electronic device queries the identifier of the changed Bluetooth service; then, the second electronic device receives the second notification message from the first electronic device, and the second notification message may include the identifier of the first Bluetooth service. In this way, the second electronic device can determine which Bluetooth service of the first electronic device to subscribe to data from subsequently.
[0008] In another possible implementation of the first aspect, the data synchronization method provided by the present application may further include: first, the second electronic device determines the content of the target data and the target application using the target data according to the target data, the data classification mapping table, the encapsulation parameter, and the encryption parameter; then, the second electronic device displays the content of the target data through the target application. Based on this, the user can view the content of the target data on the second electronic device.
[0009] In another possible implementation of the first aspect, the above-mentioned determining the content of the target data and the target application using the target data based on the target data, the data classification mapping table, the encapsulation parameters, and the encryption parameters includes: first, the second electronic device decapsulates the target data according to the encapsulation parameters to obtain a flag bit corresponding to the identifier of the target application, and the data to be decrypted; then, the second electronic device decrypts the data to be decrypted according to the encryption parameters to obtain the content of the target data; then, the second electronic device determines the identifier of the target application according to the flag bit corresponding to the identifier of the target application and the data classification mapping table; finally, the second electronic device determines the target application according to the identifier of the target application.
[0010] In another possible implementation of the first aspect, the data synchronization method provided by the present application may also include: first, the second electronic device generates first control information in response to the user's target operation on the second electronic device; then, the second electronic device obtains a control instruction according to the identifier of the target application using the first control information, the data classification mapping table, the encapsulation parameter, and the encryption parameter; wherein the control instruction is used to instruct the target application in the first electronic device to perform the target operation; finally, the second electronic device sends the control instruction to the first Bluetooth service, and the first Bluetooth service is also used to send the control instruction to the target application in the first electronic device. Based on this, the target application on the first electronic device can be controlled by the second electronic device, which is convenient and fast, and can improve the user experience.
[0011] In another possible implementation of the first aspect, the above-mentioned obtaining of the control instruction based on the identifier of the target application using the first control information, the data classification mapping table, the encapsulation parameters, and the encryption parameters may include: first, the second electronic device may determine the flag bit corresponding to the identifier of the target application based on the identifier of the target application and the data classification mapping table; then, the second electronic device encrypts the first control information based on the encryption parameters to obtain the second control information; finally, the second electronic device may encapsulate the flag bit corresponding to the second control information and the identifier of the target application based on the encapsulation parameters to obtain the control instruction. Based on this process, not only can the data privacy of the first control information be protected, which helps to improve data security, but also the control instruction can be recognized by the first Bluetooth service of the first electronic device, thereby facilitating the target application of the first electronic device to execute the control instruction.
[0012] In a second aspect, an electronic device is provided, comprising a processor and a memory, wherein instructions are stored in the memory, and when the processor executes the instructions, the method described in the first aspect and any embodiment thereof is executed.
[0013] According to a third aspect, a computer-readable storage medium is provided, comprising instructions, which, when executed on an electronic device, enable the electronic device to execute the method according to the first aspect and any embodiment thereof.
[0014] In a fourth aspect, a computer program product comprising instructions is provided. When the instructions are executed on the electronic device, the electronic device executes the method as described in the first aspect and any embodiment thereof.
[0015] In a fifth aspect, a chip system is provided, the chip system including a processor for supporting an electronic device to implement the functions involved in the first aspect. In one possible design, the device also includes an interface circuit, which can be used to receive signals from other devices (such as a memory) or send signals to other devices (such as a communication interface). The chip system may include a chip and may also include other discrete devices.
[0016] The technical effects of the second to fifth aspects refer to the technical effects of the first aspect and any of its embodiments, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 A schematic diagram of the structure of a communication system provided in an embodiment of the present application;
[0018] Figure 2 A schematic diagram of the structure of a first electronic device provided in an embodiment of the present application;
[0019] Figure 3A schematic diagram of the structure of a second electronic device provided in an embodiment of the present application;
[0020] Figure 4 A schematic diagram of a software architecture running on a second electronic device provided in an embodiment of the present application;
[0021] Figure 5 One of the flowcharts of a data synchronization method provided in an embodiment of the present application;
[0022] Figure 6 A schematic diagram of an interface of a sports health application provided in an embodiment of the present application;
[0023] Figure 7 A schematic diagram of an interface for synchronizing data between a first electronic device and a second electronic device, and for the second device to control the first electronic device, provided in an embodiment of the present application;
[0024] Figure 8 A second flowchart of a data synchronization method provided in an embodiment of the present application;
[0025] Fig. 9 A schematic diagram of the structure of a chip system provided in an embodiment of the present application. DETAILED DESCRIPTION
[0026] The terms "first", "second", etc. involved in the embodiments of the present application are only used to distinguish features of the same type and cannot be understood as indicating relative importance, quantity, order, etc.
[0027] The terms "exemplary" or "for example" and the like in the embodiments of the present application are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of the terms "exemplary" or "for example" is intended to present the related concepts in a specific way.
[0028] The terms "coupling" and "connection" involved in the embodiments of the present application should be understood in a broad sense. For example, they may refer to a direct physical connection, or an indirect connection achieved through electronic devices, such as a connection achieved through resistors, inductors, capacitors or other electronic devices.
[0029] First, some concepts involved in the embodiments of the present application are introduced.
[0030] Message synchronization process (synergy): also known as Bluetooth message synchronization service (hereinafter referred to as Bluetooth service), is a message middleware in the first electronic device (such as mobile phones, tablets, etc.). On the one hand, the Bluetooth service can be used to monitor the data to be synchronized in the first electronic device (such as incoming call messages in the phone application, alarm messages in the alarm application, SMS messages in the SMS application, etc.), and to process the monitored data to be synchronized and send it to the second electronic device (that is, wearable devices, such as smart watches, smart bracelets, etc.). In this way, the second electronic device can synchronize the data in the first electronic device. On the other hand, the Bluetooth service can receive the control instructions sent by the second electronic device, and then send the control instructions to the corresponding application in the first electronic device, and the application can execute the target operation of the control instructions. In this way, the second electronic device can control the first electronic device.
[0031] Table 1 shows the applications that can interact with the Bluetooth service and the functions of the Bluetooth service.
[0032] Table 1
[0033]
[0034] A data synchronization method provided in an embodiment of the present application can be applied to Figure 1 The communication system shown in FIG. Figure 1 As shown, the communication system may include a first electronic device 101 (also called a server device) and a second electronic device 102 (also called a client device), and data may be transmitted between the first electronic device 101 and the second electronic device 102 by wireless communication (such as Bluetooth communication). In one scenario, the first electronic device may send data that has not been consulted in the first electronic device to the second electronic device. In this way, the data that has not been consulted in the first electronic device may be consulted through the second electronic device. In another scenario, the second electronic device may send a control instruction to the first electronic device, and after the first electronic device receives the control instruction, it may perform the operation corresponding to the control instruction. In this way, the first electronic device may be controlled by the second electronic device.
[0035] The first electronic device 101 involved in the embodiment of the present application may be a device with a communication function. Figure 2 As shown, the first electronic device 101 may include a processor 210, an external memory interface 220, an internal memory 221, an audio module 230, a speaker 230A, a microphone 230B, a display screen 240, a communication module 250, a power module 260, an input device 270, a sensor module 280, etc. Among them, the sensor module 280 may include a pressure sensor, a touch sensor, etc.
[0036] It is to be understood that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the first electronic device 101. In other embodiments of the present application, the first electronic device 101 may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0037] The processor 210 may include one or more processing units. For example, the processor 210 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), and / or a neural-network processing unit (NPU). Different processing units may be independent components or integrated into one or more processors. In some embodiments, the first electronic device 101 may also include one or more processors 210.
[0038] The controller is the nerve center and command center of the first electronic device 101. It can generate operation control signals according to instruction operation codes and timing signals to complete the control of fetching and executing instructions.
[0039] The application processor can run the operating system of the first electronic device 101, which is used to manage the hardware and software resources of the first electronic device 101. For example, it can manage and configure memory, determine the priority of system resource supply and demand, control input and output devices, operate the network, manage the file system, manage drivers, etc. The operating system can also be used to provide an operating interface for users to interact with the system. Among them, various types of software can be installed in the operating system, such as drivers, applications (applications, Apps), etc.
[0040] The NPU is a neural network (NN) computing processor that quickly processes input information by drawing on the structure of biological neural networks, such as the transmission mode between neurons in the human brain, and can also continuously self-learn. The NPU can realize applications such as intelligent cognition of the first electronic device 101.
[0041] The processor 210 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 210 is a cache memory. The memory may store instructions or data that the processor 210 has just used or cyclically used. If the processor 210 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 210, and thus improves the efficiency of the system.
[0042] In some embodiments, the processor 210 may include one or more interfaces. The interface may include an inter-integrated circuit (I2C) interface, an integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a SIM card interface, and / or a USB interface, etc.
[0043] It is understandable that the interface connection relationship between the modules illustrated in the embodiment of the present application is only a schematic illustration and does not constitute a structural limitation on the first electronic device 101. In other embodiments of the present application, the first electronic device 101 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
[0044] The external memory interface 220 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the first electronic device 101. The external memory card communicates with the processor 210 through the external memory interface 220 to implement a data storage function. For example, files such as music and videos are stored in the external memory card.
[0045] The internal memory 221 can be used to store one or more computer programs, which include instructions. The processor 210 can enable the first electronic device 101 to execute the application running method provided in some embodiments of the present application, as well as various applications and data management, etc. by running the above instructions stored in the internal memory 221. The internal memory 221 may include a code storage area and a data storage area. Among them, the data storage area can store data created during the use of the first electronic device 101. In addition, the internal memory 221 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more disk storage components, a flash memory component, a universal flash storage (UFS), etc. In some embodiments, the processor 210 can enable the first electronic device 101 to execute the application running method provided in the embodiment of the present application, as well as other applications and data management by running instructions stored in the internal memory 221, and / or instructions stored in a memory provided in the processor 210.
[0046] The first electronic device 101 can implement audio functions through the audio module 230, the speaker 230A, the microphone 230B, and the application processor. For example, music playing, recording, etc. The audio module 230 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. The audio module 230 can also be used to encode and decode audio signals. In some embodiments, the audio module 230 can be arranged in the processor 210, or some functional modules of the audio module 230 can be arranged in the processor 210.
[0047] The speaker 230A, also called a "horn", is used to convert audio electrical signals into sound signals.
[0048] The microphone 230B, also called a "microphone" or "microphone", is used to convert a sound signal into an electrical signal. A user can make a sound by approaching the microphone 230B with his or her mouth, and input the sound signal into the microphone 230B.
[0049] The communication function of the first electronic device 101 can be implemented through the antenna 1, the antenna 2 and the communication module 250.
[0050] The communication module 250 can provide solutions for wireless communications including cellular, Wi-Fi, Bluetooth (BT), wireless data transmission modules (e.g., 433MHz, 868MHz, 915MHz) applied to the first electronic device 101. The communication module 250 can be one or more devices integrating at least one communication processing module. The communication module 250 receives electromagnetic waves via antenna 1 or antenna 2, filters and frequency modulates the electromagnetic wave signals, and sends the processed signals to the processor 210. The communication module 250 can also receive the signal to be sent from the processor 210, frequency modulate it, amplify it, and convert it into electromagnetic waves for radiation through antenna 1 or antenna 2.
[0051] The first electronic device 101 implements the display function through a GPU, a display screen 240, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 240 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 210 may include one or more GPUs, which execute program instructions to generate or change display information.
[0052] The display screen 240 is used to display images, videos, etc. The display screen 240 includes a display panel. The display panel can be 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 (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the first electronic device 101 may include 1 or N display screens 240, where N is a positive integer greater than 1. In the embodiment of the present application, the display screen 240 can be used to display a UI and receive user operations on the UI.
[0053] In some embodiments, the display screen 240 is provided with a pressure sensor, a touch sensor, and the like. The pressure sensor is used to sense pressure signals and can convert pressure signals into electrical signals. When a touch operation is applied to the display screen 240, the first electronic device 101 detects the intensity of the touch operation according to the pressure sensor. The first electronic device 101 can also calculate the position of the touch according to the detection signal of the pressure sensor. The touch sensor, also known as a "touch panel", can form a touch screen, also known as a "touch screen", with the display screen 240. The touch sensor is used to detect touch operations applied thereto or thereabout. The touch sensor can pass the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can also be provided through the display screen 240.
[0054] The power module 260 may be used to supply power to various components included in the first electronic device 101. In some embodiments, the power module 260 may be a battery, such as a rechargeable battery.
[0055] The input device 270 may include a keyboard, a mouse, etc. The keyboard is used to input English letters, numbers, punctuation marks, etc. into the first electronic device 101, thereby issuing commands to the first electronic device 101, inputting data, etc. The mouse is an indicator for the vertical and horizontal coordinates of the display system of the first electronic device 101, and is used to input instructions, etc. to the first electronic device 101. The input device 270 may be connected to the first electronic device 101 via a wired connection, for example, the input device 270 is connected to the first electronic device 101 via a GPIO interface, a USB interface, etc. The input device 270 may also be connected to the first electronic device 101 wirelessly, for example, the input device 270 is connected to the first electronic device 101 via Bluetooth, infrared, etc.
[0056] like Figure 3 As shown, the second electronic device 102 may include a processor 301, a memory 302, a Bluetooth module 303, a display screen 304, and an audio module 305. The processor 301 executes the data synchronization method provided in the embodiment of the present application by executing the program and instructions stored in the memory 302. The Bluetooth module 303 is used to communicate with other devices. The display screen 304 is used to display the data synchronized by the first electronic device. The audio module 305 is used to play the data synchronized by the first electronic device.
[0057] Of course, the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the second electronic device 102. In other embodiments of the present application, the first electronic device 102 may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0058] It can be understood that, generally speaking, the realization of the functions of the second electronic device requires not only the support of the above-mentioned hardware but also the cooperation of software.
[0059] The software system of the second electronic device may adopt a layered architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture. The software architecture of the second electronic device may be based on a lightweight IoT operating system. Lightweight Android operating system Lightweight Apple (iOS) operating system Lightweight Windows operating system The embodiment of the present application is a lightweight IoT operating system with a layered architecture. Taking as an example, the software architecture of the second electronic device is exemplified.
[0060] Figure 4 It is a schematic diagram of the software architecture of the second electronic device provided in an embodiment of the present application.
[0061] The layered architecture divides the software into several layers, each with a clear role and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the lightweight IoT operating system From top to bottom, they are: application layer (Applications), application framework layer (application framework), hardware abstract layer (hardwareabstract layer, HAL), and kernel layer.
[0062] The application layer may include a series of application packages. Figure 4 As shown, the application package may include watch face applications, sports applications, health applications, weather applications, alarm clock applications, card package applications, information applications, and other applications.
[0063] The application in the application layer generates first control information in response to the user's operation, and calls an application programming interface (API) of the application framework layer to transfer the first control information to the application framework layer.
[0064] The application framework layer is used to provide API, system resource services, message synchronization services, etc. to the applications in the application layer. The message synchronization service may include a data classification mapping table. The data classification mapping table includes a mapping relationship between a flag bit and an identifier of an application using the data.
[0065] The application framework layer receives the first control information transmitted by the application of the application layer, and encapsulates and encrypts the first control information to obtain a first control instruction. Then, the application framework layer transmits the first control instruction to the Bluetooth driver module of the kernel layer through the hardware abstraction layer.
[0066] The application framework layer is also used to encapsulate parameters, encryption parameters, and confirmation information of the data classification mapping table transmitted by the Bluetooth driver module of the kernel layer, and store the encapsulation parameters, encryption parameters, and confirmation information of the data classification mapping table in the message synchronization service.
[0067] The application framework layer is also used to: process the target data transmitted by the Bluetooth driver module of the kernel layer according to the encapsulation parameters and encryption parameters, obtain the content of the target data, and the target application that displays the content of the target data, and transmit the content of the target data to the target application of the application layer (such as the alarm application).
[0068] The hardware abstraction layer is used to abstract the hardware and provide a virtual hardware platform to the system, making it hardware-independent and portable on multiple platforms.
[0069] The kernel layer includes the operating system (OS) kernel. The operating system kernel is used to manage the system's processes, memory, driver modules (such as display driver module, audio driver module, motor driver module, Bluetooth driver module, etc.), file system and network system. Among them, the display driver module is used to send the content synchronized by the second electronic device to the display screen for display. The audio driver module is used to send the content synchronized by the second electronic device to the audio module for playback. The motor driver module is used to make the motor produce a vibration effect when the second electronic device receives the synchronized data.
[0070] The Bluetooth driver module of the kernel layer sends the first control instruction to the Bluetooth chip of the hardware layer. The Bluetooth chip is used to send the first control instruction to the first electronic device.
[0071] The Bluetooth driver module of the kernel layer is also used to receive encapsulation parameters, encryption parameters, and confirmation information of the data classification mapping table transmitted by the Bluetooth chip, and transmit the encapsulation parameters, encryption parameters, and confirmation information of the data classification mapping table to the application framework layer through the hardware abstraction layer.
[0072] The Bluetooth driver module of the kernel layer is used to receive the target data transmitted by the Bluetooth chip of the hardware layer, and transmit the target data to the application framework layer through the hardware abstraction layer.
[0073] In the related art, the process of synchronizing data from the first electronic device to the second electronic device may include: first, after the first electronic device creates the second Bluetooth service, the first electronic device notifies the second electronic device that the second Bluetooth service has been created, so as to prompt the second electronic device to subscribe to the target data from the second Bluetooth service. Secondly, the second electronic device switches the synchronization state machine to the subscription state. In the subscription state, the second electronic device can receive the target data sent from the second Bluetooth service. Again, if the second Bluetooth service is turned off, the first electronic device notifies the second electronic device that the second Bluetooth service is turned off, so as to prompt that the second electronic device is no longer allowed to subscribe to the target data from the second Bluetooth service. At this time, the second electronic device switches the synchronization state machine to the first state. Then, if the first electronic recreates the first Bluetooth service, the first electronic device notifies the second electronic device that the first Bluetooth service has been created, so as to prompt the second electronic device to subscribe to the target data from the first Bluetooth service. Finally, the second electronic device switches the synchronization state machine to the subscription state, and at this time, in the subscription state, the second electronic device can receive the target data that continues to be sent from the first Bluetooth service.
[0074] However, if the second electronic device does not receive a message indicating that the second Bluetooth service has been turned off after the second Bluetooth service has been turned off, the synchronization state machine of the second electronic device is still in the subscription state, but the target data is subscribed from the second Bluetooth service. Therefore, the second electronic device can no longer subscribe to the target data from the first Bluetooth service. Since the second Bluetooth service has been turned off, the second electronic device will fail to subscribe and can no longer receive the target data in the first electronic device.
[0075] The process of the second electronic device sending a control instruction to the first electronic device to control the application in the first electronic device is the opposite of the process of the first electronic device synchronizing data with the second electronic device. Specifically, if the first electronic device does not notify the second electronic device after the second Bluetooth service is turned off, the second electronic device will still send the control instruction to the second Bluetooth service. Since the second Bluetooth service has been turned off, the first electronic device cannot receive the control instruction, and the second electronic device cannot control the application in the first electronic device.
[0076] Based on this, an embodiment of the present application provides a data synchronization method. When the second electronic device determines that the Bluetooth service in the first electronic device has changed (that is, the first electronic device has recreated a Bluetooth service), first, the synchronization state machine of the second electronic device is reset to the first state. In this way, the second electronic device no longer subscribes to the target data from the second Bluetooth service created previously. Then, when the second electronic device receives permission to subscribe to the target data from the recreated first Bluetooth service, the synchronization state machine switches from the first state to the second state, the third state, the fourth state in sequence, until the subscription state. In the subscription state, the second electronic device can continue to receive the target data sent by the first Bluetooth service. It can be seen that regardless of whether the second electronic device receives a message that the second Bluetooth service has been closed, since the second electronic device has reset the synchronization state machine to the first state after determining that the Bluetooth service in the first electronic device has changed, the second electronic device will no longer subscribe to the target data from the second Bluetooth service. And the second electronic device has re-determined to subscribe to the target data from the changed first Bluetooth service. Therefore, it can be ensured that the second electronic device can be completely synchronized to the target data in the first electronic device.
[0077] The methods in the following embodiments can all be implemented in the first electronic device and the second electronic device having the above hardware structure or software architecture.
[0078] The following combination Figure 5 , the data synchronization method provided in the embodiment of the present application is described in detail. Figure 5 This is one of the flow charts of a data synchronization method provided in an embodiment of the present application. Figure 5 As shown, the data synchronization method may include:
[0079] S501: A first electronic device establishes a connection with a second electronic device.
[0080] Before data is transmitted between the first electronic device and the second electronic device, Figure 5 As shown, a connection needs to be established between the Bluetooth module of the first electronic device and the Bluetooth module of the second electronic device. During the connection establishment process, the first electronic device needs to turn on the Bluetooth function, and the first electronic device and the second electronic device are within a preset range so that the first electronic device can scan the second electronic device.
[0081] S502: The first electronic device sends a first notification message to the second electronic device.
[0082] The first notification information is used to indicate that the Bluetooth service of the first electronic device has been changed, and the second electronic device is used to subscribe data from the Bluetooth service. The Bluetooth service has been changed, which can indicate that a previously created Bluetooth service (such as the second Bluetooth service) has been closed, and the first electronic device has re-created a Bluetooth service (such as the first Bluetooth service).
[0083] The Bluetooth service is created by the first electronic device in response to the first operation of the user. After the Bluetooth service is created, the Bluetooth service will actively notify the Bluetooth module of the first electronic device that the Bluetooth service has been changed. Then, the Bluetooth module of the first electronic device will notify the Bluetooth module of the second electronic device of the message that the Bluetooth service has been changed.
[0084] For example, the first electronic device is a mobile phone, and a sports health application is installed in the mobile phone. Figure 6 As shown, the mobile phone displays the connected device page 601 of the sports health application. The connected device page 601 may include: a schematic diagram 602 showing that the mobile phone and the smart watch are connected, an inquiry prompt box 603, and an consent control 604. Among them, the content in the inquiry prompt box 603 is: "In order to improve the communication stability between the mobile phone and the wearable device, the Bluetooth message synchronization service (synergy) needs to be connected to the Internet and call the phone (make calls, read call status and mobile network information), information, address book, call log and other application permissions". When the user clicks the consent control 604 (ie, the first operation), the sports health application creates a Bluetooth service in response to the click operation.
[0085] S503: The second electronic device resets the synchronization state machine to the first state according to the first notification message.
[0086] The synchronization state machine can transfer states according to a pre-set state based on a message received from the first electronic device. When the second electronic device receives a first notification message from the first electronic device, the synchronization state machine will be reset to the first state. In the first state, the second electronic device cancels the subscription to data from the Bluetooth service of the first electronic device. Based on this, after the second Bluetooth service is turned off, regardless of whether the first electronic device notifies the second electronic device, the second electronic device will cancel the subscription to the target data from the second Bluetooth service.
[0087] S504: The second electronic device receives a second notification message from the first electronic device.
[0088] The second notification message is used to indicate that the second electronic device is allowed to subscribe to the target data from the first Bluetooth service of the first electronic device (i.e., the changed Bluetooth service). The target data is the data that the second electronic device has subscribed to from the second Bluetooth service of the first electronic device (i.e., the Bluetooth service before the change). In other words, the second electronic device can continue to subscribe to the target data from the changed Bluetooth service.
[0089] S505: The second electronic device switches the synchronization state machine to the second state.
[0090] The second notification message is a condition for triggering the synchronization state machine to switch from the first state to the second state. Therefore, after receiving the second notification message, the second electronic device switches the synchronization state machine to the second state.
[0091] S506: The first Bluetooth service of the first electronic device sends encapsulation parameters to the second electronic device.
[0092] In the second state, the processing module of the second electronic device receives encapsulation parameters from the first Bluetooth service. The encapsulation parameters are used to encapsulate or decapsulate data transmitted between the first electronic device and the second electronic device. Specifically, the data transmitted between the first electronic device and the second electronic device may include: target data sent by the first electronic device to the second electronic device, control instructions sent by the second electronic device to the first electronic device, data related to the target data, such as data to be synchronized, and data related to the control instructions, such as first control information and second control information.
[0093] S507: The second electronic device switches the synchronization state machine to the third state.
[0094] When the processing module of the second electronic device receives the encapsulated data, it triggers the synchronization state machine to switch from the second state to the third state.
[0095] S508: The first Bluetooth service of the first electronic device sends encryption parameters to the second electronic device.
[0096] In the third state, the processing module of the second electronic device receives encryption parameters from the first Bluetooth service of the first electronic device. The encryption parameters are used to encrypt or decrypt data transmitted between the first electronic device and the second electronic device.
[0097] S509: The second electronic device switches the synchronization state machine to the fourth state.
[0098] When the processing module of the second electronic device receives the encrypted data, it triggers the synchronization state machine to switch from the third state to the fourth state.
[0099] S510: The first Bluetooth service of the first electronic device sends confirmation information of the data classification mapping table to the second electronic device.
[0100] In the fourth state, the processing module of the second electronic device receives confirmation information of the data classification mapping table from the first Bluetooth service. The data classification mapping table includes a mapping relationship between a flag bit and an identifier of an application using the target data, but is not limited thereto.
[0101] S511: The second electronic device switches the synchronization state machine to a subscription state.
[0102] When the processing module of the second electronic device receives confirmation information of the data classification mapping table, it triggers the synchronization state machine to switch from the fourth state to the subscription state.
[0103] S512: The first Bluetooth service of the first electronic device acquires target data.
[0104] The Bluetooth service can be used to encapsulate and encrypt the data to be synchronized when monitoring the data to be synchronized in the application of the first electronic device to obtain the target data, and can also be used to send the target data to the second electronic device through the Bluetooth module of the first electronic device.
[0105] Specifically, when the first Bluetooth service monitors the data to be synchronized from an application of the first electronic device, it can determine the identifier of the application that uses the data to be synchronized. Since the first Bluetooth service also pre-stores a data classification mapping table, the first Bluetooth service can determine the flag bit corresponding to the identifier of this application based on the identifier of this application. Then, the first Bluetooth service encrypts the data to be synchronized according to the encryption parameters to obtain encrypted data. Next, the first Bluetooth service encapsulates the flag bit and the encrypted data according to the encapsulation parameters to obtain the target data.
[0106] It should be noted that the data to be synchronized is the data that has not been viewed in the first electronic device. In other words, the data that has been viewed in the first electronic device will not be synchronized on the second electronic device. In this way, the amount of transmission between the first electronic device and the second electronic device can be reduced, the power consumption of the first electronic device and the second electronic device can be reduced, and transmission resources can be saved. The sources of the data to be synchronized are as follows:
[0107] In one example, the application in the first electronic device may be a notification bar application of the first electronic device. The notification bar application may obtain data that is not consulted by other applications in the first electronic device. That is, the data to be synchronized may be all data in the notification bar application.
[0108] In another example, the application in the first electronic device may be an application other than the notification bar application. The unchecked data in the application other than the notification bar application is the data to be synchronized.
[0109] S513: The second electronic device receives target data from the first Bluetooth service of the first electronic device.
[0110] S514: The second electronic device determines the content of the target data and the target application using the target data according to the target data, the data classification mapping table, the encapsulation parameters, and the encryption parameters.
[0111] Optionally, when the processing module of the second electronic device receives the target data, first, the processing module of the second electronic device decapsulates the target data according to the encapsulation parameters to obtain the data to be decrypted (i.e., the encrypted data after the data to be synchronized is encrypted as mentioned above), and a flag bit corresponding to the identifier of the target application. Secondly, the processing module of the second electronic device decrypts the data to be decrypted according to the encryption parameters to obtain the content of the target data (or the content of the data to be synchronized). Then, the processing module of the second electronic device can determine the identifier of the target application according to the flag bit corresponding to the identifier of the target application and the data classification mapping table. Finally, the processing module of the second electronic device can determine the target application according to the identifier of the target application.
[0112] S515: The second electronic device displays the content of the target data through the target application.
[0113] After the processing module of the second electronic device determines the content of the target data and the target application that displays the content of the target data, the processing module of the second electronic device will send the content of the target data to the target application so that the target application can display the content of the target data for the user to view.
[0114] For example, the first electronic device is a mobile phone and the second electronic device is a smart watch. Figure 7 As shown, when the phone application of the mobile phone has incoming call information, the phone application of the smart watch will display the incoming call information.
[0115] S516: The second electronic device generates first control information in response to the user's operation.
[0116] The target application of the second electronic device may generate first control information in response to the user's operation on the target application of the second electronic device, control the target application of the second electronic device, and further control the target application of the first electronic device.
[0117] For example, when the alarm application of the second electronic device is synchronized with the alarm information of the alarm application of the first electronic device, the user turns off the alarm in the alarm application of the second electronic device, and the alarm application of the second electronic device generates control information (i.e., first control information) to turn off the alarm in response to the operation.
[0118] For another example, when the phone application of the second electronic device is synchronized with the incoming call information of the phone application of the first electronic device, the user rejects the incoming call in the phone application of the second electronic device, and the phone application of the second electronic device generates control information (i.e., first control information) for rejecting the incoming call in response to the operation.
[0119] S517: The second electronic device determines a control instruction according to the first control information, an identifier of a target application using the first control information, a data classification mapping table, encapsulation parameters, and encryption parameters.
[0120] Optionally, after the target application of the second electronic device generates the first control information, the first control information is sent to the processing module of the second electronic device. The processing module of the second electronic device will perform the following operations: First, the processing module of the second electronic device determines the flag bit corresponding to the identifier of the target application (such as an alarm application, a telephone application) using the first control information and the data classification mapping table. Then, the processing module of the second electronic device encrypts the first control information according to the encryption parameters to obtain the second control information. Finally, according to the encapsulation parameters, the flag bit corresponding to the second control information and the identifier of the target application is encapsulated to obtain a control instruction. The control instruction is used to instruct the target application in the first electronic device to perform a target operation (such as hanging up the phone, turning off the alarm), etc.
[0121] The purpose of determining the flag bit corresponding to the identifier of the target application is to enable the first Bluetooth service of the first electronic device to determine to which application in the first electronic device the control instruction is to be distributed.
[0122] S518: The second electronic device sends a control instruction to the first Bluetooth service of the first electronic device.
[0123] After the data processing module of the second electronic device obtains the control instruction, it sends the control instruction to the Bluetooth module of the first electronic device through the Bluetooth module of the second electronic device. The Bluetooth module of the first electronic device then sends the control instruction to the first Bluetooth service of the first electronic device. In this way, the first Bluetooth service receives the control instruction.
[0124] S519: The first electronic device executes the target operation corresponding to the control instruction.
[0125] After the first Bluetooth service receives the control instruction, first, the first Bluetooth service decapsulates the control instruction to obtain the second control information and the flag bit corresponding to the identifier of the target application using the first control information. Secondly, the first Bluetooth service decrypts the second control information according to the encryption parameters to obtain the first control information. Then, the first Bluetooth service can determine the identifier of the target application according to the flag bit corresponding to the identifier of the target application and the data classification mapping table. Finally, the first Bluetooth service can determine the target application according to the identifier of the target application and send the first control information to the target application. The target application can execute the target operation corresponding to the first control information, that is, the target application can execute the target operation corresponding to the control instruction. In this way, the process of controlling the first electronic device through the second electronic device is completed.
[0126] For example, when the user clicks the reject control 701 on the smart watch, in response to the operation, Figure 7 A in Figure 7 As shown in B, the phone application on the smart watch rejects the incoming call, and the smart watch switches from the first incoming call interface 702 to the first main interface 703; the phone application on the mobile phone also rejects the incoming call, and the mobile phone switches from the second incoming call interface 704 to the second main interface 705.
[0127] In summary, in the data synchronization method provided by the embodiment of the present application, when the second electronic device receives a message that the Bluetooth service in the first electronic device has been changed, the synchronization state machine of the second electronic device will be reset to the first state, so that the second electronic device no longer subscribes to data from the Bluetooth service before the change. When the second electronic device receives permission to subscribe to data from the changed Bluetooth service, the synchronization state machine of the second electronic device switches to the subscription state again. In this way, the second electronic device can subscribe to data from the changed Bluetooth service. Since the second electronic device has reset the synchronization state machine to the first state when it determines that the Bluetooth service has been changed, that is, the subscription to data from the Bluetooth service before the change is canceled. Then, regardless of whether the message that the Bluetooth service before the change has been closed is notified to the second electronic device, the second electronic device will cancel the subscription to data from the Bluetooth service before the change, but instead subscribe to data from the Bluetooth service after the change. Similarly, the second electronic device sends a control instruction to the changed Bluetooth service to control the first electronic device.
[0128] Combine the following Figure 8 , briefly introduces the interaction process between the relevant modules inside the first electronic device and the relevant modules inside the second electronic device during the execution of the data synchronization method of an embodiment of the present application.
[0129] S901: A Bluetooth module of a first electronic device establishes a connection with a Bluetooth module of a second electronic device.
[0130] During the connection process, the first electronic device turns on the Bluetooth function, and the first electronic device and the second electronic device are within a preset range, so that the first electronic device can scan the second electronic device. If the first electronic device and the second electronic device are connected for the first time, the two need to be paired by Bluetooth. The process of Bluetooth pairing and connection can adopt any technical means in the prior art, and the embodiments of the present application are not limited to this.
[0131] It should be noted that S901 is equivalent to the above-mentioned S501.
[0132] S902: The Bluetooth service of the first electronic device notifies the Bluetooth module of the second electronic device through the Bluetooth module of the first electronic device that the Bluetooth service has been changed.
[0133] When the first electronic device creates a new Bluetooth service or closes a Bluetooth service, the Bluetooth service will change.
[0134] S903: The Bluetooth module of the second electronic device notifies the processing module and the synchronization state machine of the second electronic device that the Bluetooth service has been changed.
[0135] S904: The synchronization state machine is reset to the first state.
[0136] The message that the Bluetooth service has been changed will trigger the synchronization state machine to reset to the first state.
[0137] It should be noted that S902-S904 are equivalent to the above-mentioned S502 and S503.
[0138] S 905 . The processing module notifies the Bluetooth module of the first electronic device through the Bluetooth module of the second electronic device: querying the identifier of the changed Bluetooth service.
[0139] S 906. The Bluetooth module of the first electronic device notifies the Bluetooth service of querying the identifier of the changed Bluetooth service.
[0140] S 907 . The Bluetooth service notifies the Bluetooth module of the second electronic device through the Bluetooth module of the first electronic device that the first Bluetooth service has been started.
[0141] S908: The Bluetooth module of the second electronic device notifies the processing module and the synchronization state machine of the second electronic device that the first Bluetooth service has been started.
[0142] It should be noted that S902-S904 are equivalent to the above-mentioned S504.
[0143] S909: The synchronization state machine switches from the first state to the second state.
[0144] It should be noted that S902-S904 are equivalent to the above-mentioned S505.
[0145] S910: The processing module notifies the Bluetooth module of the first electronic device through the Bluetooth module of the second electronic device: querying the encapsulation parameters of the first Bluetooth service.
[0146] After receiving the query request, the Bluetooth module of the first electronic device sends the query request to the Bluetooth service.
[0147] S911. The Bluetooth service sends, via the Bluetooth module of the first electronic device, to the Bluetooth module of the second electronic device: encapsulation parameters of the first Bluetooth service.
[0148] After receiving the request information for querying the packaging parameters of the first Bluetooth service, the Bluetooth service sends the packaging parameters of the first Bluetooth service to the Bluetooth module of the first electronic device, and the Bluetooth module of the first electronic device then forwards the packaging parameters of the first Bluetooth service to the Bluetooth module of the second electronic device.
[0149] S912: The Bluetooth module of the second electronic device sends the encapsulation parameters of the first Bluetooth service to the processing module.
[0150] It should be noted that S910-S912 are equivalent to the above-mentioned S506.
[0151] S913: The synchronization state machine switches from the second state to the third state.
[0152] When the second electronic device receives the encapsulation parameters of the first Bluetooth service, it triggers the synchronization state machine to switch from the second state to the third state.
[0153] It should be noted that S913 is equivalent to the above-mentioned S507.
[0154] S914: The processing module notifies the Bluetooth module of the first electronic device through the Bluetooth module of the second electronic device: query the encryption parameters of the first Bluetooth service.
[0155] After receiving the query request, the Bluetooth module of the first electronic device sends the query request to the Bluetooth service.
[0156] S915. The Bluetooth service sends encryption parameters of the first Bluetooth service to the Bluetooth module of the second electronic device through the Bluetooth module of the first electronic device.
[0157] After receiving the request information for querying the encryption parameters of the first Bluetooth service, the Bluetooth service sends the encryption parameters of the first Bluetooth service to the Bluetooth module of the first electronic device, and the Bluetooth module of the first electronic device then forwards the encryption parameters of the first Bluetooth service to the Bluetooth module of the second electronic device.
[0158] S916: The Bluetooth module of the second electronic device sends the encryption parameters of the first Bluetooth service to the processing module.
[0159] It should be noted that S914-S916 are equivalent to the above-mentioned S508.
[0160] S917: The synchronization state machine switches from the third state to the fourth state.
[0161] When the second electronic device receives the encryption parameter of the first Bluetooth service, it triggers the synchronization state machine to switch from the second state to the third state.
[0162] It should be noted that S917 is equivalent to the above-mentioned S509.
[0163] S918: The processing module sends the data classification mapping table to the Bluetooth module of the first electronic device through the Bluetooth module of the second electronic device.
[0164] The data classification mapping table may include an application relationship between a flag bit and an identifier of an application using the data, but is not limited thereto. The data here refers to data transmitted between the first electronic device and the second electronic device and processed by the Bluetooth service, for example, target data.
[0165] After receiving the data classification mapping table, the Bluetooth module of the first electronic device sends the data classification mapping table to the Bluetooth service.
[0166] S919. The Bluetooth service sends confirmation information of the data classification mapping table to the Bluetooth module of the second electronic device through the Bluetooth module of the first electronic device.
[0167] After the Bluetooth module of the second electronic device receives the confirmation information, it will send the confirmation information to the processing module and the synchronization state machine. In this way, the first electronic device and the second electronic device successfully negotiate the data classification table to facilitate the subsequent confirmation of the application using the data. The data here also refers to the data transmitted between the first electronic device and the second electronic device and processed by the Bluetooth service.
[0168] It should be noted that S918 and S919 are equivalent to the above-mentioned S510.
[0169] S920: The synchronization state machine switches from the fourth state to the subscription state.
[0170] The confirmation information of the data classification mapping table triggers the synchronization state machine to switch from the fourth state to the subscription state. In the subscription state, the second electronic device subscribes successfully. That is, in the subscription state, the second electronic device can subscribe to data from the first Bluetooth service.
[0171] It should be noted that S920 is equivalent to the above-mentioned S511.
[0172] S921. The Bluetooth service obtains the data to be synchronized and the identifier of the application using the data to be synchronized from the application of the first electronic device.
[0173] The first Bluetooth service may monitor data in a notification bar application in the first electronic device, or the first Bluetooth service may monitor data in applications other than the notification bar in the first electronic device. These data may be used as data to be synchronized.
[0174] The data in the notification bar are all obtained from other applications. When obtaining these data, the notification bar also obtains the identifier of the application that uses each data.
[0175] It can be seen from this that when the first Bluetooth service obtains the data to be synchronized, it can also obtain the identifier of the application that uses the data to be synchronized.
[0176] S922: The Bluetooth service processes the data to be synchronized and the identifier of the application using the data to be synchronized to obtain target data.
[0177] First, the first Bluetooth service determines the flag bit corresponding to the identifier of the application using the data to be synchronized according to the identifier of the application using the data to be synchronized and the data classification mapping table. Then, the first Bluetooth service encrypts the data to be synchronized according to the encryption parameters to obtain encrypted data. Finally, the first Bluetooth service encapsulates the flag bit and the encrypted data according to the encapsulation parameters to obtain the target data.
[0178] It should be noted that S921-S924 are equivalent to the above-mentioned S512.
[0179] S923: The Bluetooth service sends the target data to the Bluetooth module of the second electronic device through the Bluetooth module of the first electronic device.
[0180] After the Bluetooth module of the second electronic device receives the target data, the Bluetooth module of the second electronic device sends the target data to the processing module.
[0181] It should be noted that S923 is equivalent to the above-mentioned S513.
[0182] S924: The processing module processes the target data to obtain the content of the target data and a target application in the second electronic device that uses the target data.
[0183] It should be noted that S924 is equivalent to the above S514. Therefore, the detailed process of S924 will not be repeated here.
[0184] S925: The processing module sends the content of the target data to the target application of the second electronic device.
[0185] After receiving the target content, the target application will display the target content for the user to view.
[0186] It should be noted that S925 is equivalent to the above-mentioned S515.
[0187] S926. In response to the user's operation, the target application of the second electronic device generates first control information.
[0188] It should be noted that S926 is equivalent to the above S516. Therefore, the detailed process in S926 will not be repeated here.
[0189] S927: The target application of the second electronic device sends the first control information to the processing module.
[0190] It should be noted that S926 and S927 are equivalent to the above S516. Therefore, the detailed processes in S926 and S927 are not repeated here.
[0191] S928: The processing module processes the first control information to obtain a control instruction.
[0192] It should be noted that S928 is equivalent to the above S517. Therefore, the detailed process in S928 is not repeated here.
[0193] S929: The processing module sends the control instruction to the Bluetooth module of the first electronic device through the Bluetooth module of the second electronic device.
[0194] The Bluetooth module of the first electronic device sends the control instruction to the Bluetooth service.
[0195] It should be noted that S928 and S929 are equivalent to the above-mentioned S518.
[0196] S930: The Bluetooth service processes the control instruction to obtain first control information and a target application in the first electronic device that uses the first control information.
[0197] S931. The first Bluetooth service sends first control information to a target application in the first electronic device.
[0198] S932: The target application in the first electronic device executes the target operation corresponding to the first control information.
[0199] It should be understood that S931-S933 are equivalent to the above S519. Therefore, the detailed process in S931-S933 is not repeated here.
[0200] It should be noted that the Bluetooth service has been changed, including: creating a Bluetooth service for the first time, re-creating a Bluetooth service, and closing a Bluetooth service. The above embodiment mainly describes the situation of re-creating a Bluetooth service. That is, when the first electronic device re-creates a Bluetooth service, the second electronic device will reset the synchronization state machine to the first state when it determines that the Bluetooth service has been changed. In the other two cases, the second electronic device will also reset the synchronization state machine to the first state when it determines that the Bluetooth service has been changed.
[0201] like Fig. 9 As shown, the embodiment of the present application also provides a chip system. The chip system 900 includes at least one processor 901 and at least one interface circuit 902. The at least one processor 901 and the at least one interface circuit 902 can be interconnected through a line. The processor 901 is used to support the electronic device to implement each step in the above method embodiment, such as Figure 5 and Figure 8 In the method shown, at least one interface circuit 902 may be used to receive signals from other devices (eg, memory) or to send signals to other devices (eg, communication interface). The chip system may include a chip and may also include other discrete devices.
[0202] The present application also provides a computer storage medium, which includes instructions. When the instructions are executed on the electronic device, the electronic device executes each step in the method embodiment, such as executing Figure 5 and Figure 8 The method shown.
[0203] The present application also provides a computer program product including instructions. When the instructions are executed on the electronic device, the electronic device executes each step in the method embodiment, such as executing Figure 5 and Figure 8 The method shown.
[0204] Regarding the technical effects of the chip system, computer storage medium, and computer program product, refer to the technical effects of the previous method embodiments.
[0205] It should be understood that in the various embodiments of the present application, the size of the serial numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0206] Those of ordinary skill in the art will appreciate that the modules and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0207] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and modules described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0208] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the modules is only a logical function division. There may be other division methods in actual implementation, such as multiple modules or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or modules, which can be electrical, mechanical or other forms.
[0209] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical modules, that is, they may be located in one device or distributed on multiple devices. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0210] In addition, each functional module in each embodiment of the present application may be integrated into one device, or each module may exist physically separately, or two or more modules may be integrated into one device.
[0211] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using a software program, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer storage medium, or transmitted from one computer storage medium to another computer storage medium, for example, the computer instructions may be transmitted from one website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (digital subscriber line, DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer storage medium may be any available medium that a computer can access or a data storage device such as a server, data center, etc. that contains one or more servers that can be integrated with a medium. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid state disk (SSD)), etc.
[0212] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A data synchronization method, characterized in that: Applied to a second electronic device, the second electronic device comprising a synchronization state machine; The data synchronization method comprises: Receive a first notification message from a first electronic device, and reset the synchronization state machine to a first state; the first notification message is used to indicate that the Bluetooth service of the first electronic device has been changed, and the second electronic device is used to subscribe to data from the Bluetooth service; Receive a second notification message from the first electronic device, and switch the synchronization state machine to a second state; the second notification message is used to indicate: the second electronic device is allowed to subscribe to target data from the first Bluetooth service of the first electronic device; the target data is data that the second electronic device has subscribed to from the second Bluetooth service of the first electronic device; In the second state, receiving encapsulation parameters from the first Bluetooth service, switching the synchronization state machine to a third state; the encapsulation parameters are used to encapsulate or decapsulate data transmitted between the first electronic device and the second electronic device; In the third state, receiving encryption parameters from the first Bluetooth service, switching the synchronization state machine to a fourth state; the encryption parameters are used to encrypt or decrypt data transmitted between the first electronic device and the second electronic device; In the fourth state, receiving confirmation information of the data classification mapping table from the first Bluetooth service, switching the synchronization state machine to the subscription state; the data classification mapping table includes a mapping relationship between a flag bit and an identifier of an application using the data; In the subscription state, the target data sent from the first Bluetooth service is received.
2. The method according to claim 1, characterized in that: Receiving a second notification message from the first electronic device includes: Sending query information to the first electronic device; the query information is used to instruct the first electronic device to query the identifier of the changed Bluetooth service; The second notification message is received from the first electronic device, where the second notification message includes an identifier of the first Bluetooth service.
3. The method according to claim 1 or 2, characterized in that: The method further comprises: Determining the content of the target data and a target application using the target data according to the target data, the data classification mapping table, the encapsulation parameter, and the encryption parameter; The content of the target data is displayed through the target application.
4. The method according to claim 3, characterized in that: The determining, according to the target data, the data classification mapping table, the encapsulation parameter, and the encryption parameter, the content of the target data and the target application using the target data comprises: Decapsulating the target data according to the encapsulation parameters to obtain a flag bit corresponding to the identifier of the target application and the data to be decrypted; Decrypting the data to be decrypted according to the encryption parameters to obtain the content of the target data; Determine the identifier of the target application according to the flag bit corresponding to the identifier of the target application and the data classification mapping table; The target application is determined according to the identifier of the target application.
5. The method according to any one of claims 1 to 4, characterized in that: The method further comprises: generating first control information in response to a user's operation on the second electronic device; Obtaining a control instruction according to the identifier of the target application using the first control information, the first control information, the data classification mapping table, the encapsulation parameter, and the encryption parameter; the control instruction is used to instruct the target application in the first electronic device to perform a target operation; The control instruction is sent to the first Bluetooth service, and the first Bluetooth service is further used to send the control instruction to a target application in the first electronic device, and the target application is used to execute the target operation.
6. The method according to claim 5, characterized in that The obtaining of the control instruction according to the identifier of the target application using the first control information, the data classification mapping table, the encapsulation parameter, and the encryption parameter includes: Determine a flag bit corresponding to the identifier of the target application according to the identifier of the target application and the data classification mapping table; Encrypting the first control information according to the encryption parameter to obtain second control information; According to the encapsulation parameter, the second control information and the flag bit corresponding to the identifier of the target application are encapsulated to obtain the control instruction.
7. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores instructions, and when the processor executes the instructions, the method according to any one of claims 1 to 6 is executed.
8. A computer-readable storage medium, characterized in that: The method comprises instructions, which, when executed on an electronic device, cause the electronic device to execute the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Wearable communication device and information synchronization method thereof
CN103780758A
Bluetooth physical connection method and system based on state machine control
CN111884684A
