Device collaboration methods
The device collaboration method enhances efficiency by associating data objects with session identifiers to transmit only changed attributes, reducing data transmission and maintaining consistency, thus addressing inefficiencies in existing collaboration methods.
Patent Information
- Application Number
- JP2024556280
- Authority / Receiving Office
- JP · JP
- Patent Type
- Patents
- Current Assignee / Owner
- Priority Date
- 2022-03-24
- Filing Date
- 2023-03-22
- Publication Date
- 2026-01-27
- Estimated Expiration
- 2043-03-22
AI Technical Summary
Existing device collaboration methods are inefficient due to the complexity of establishing data transmission links and interfaces between devices, leading to increased operational complexity and delays.
A device collaboration method that associates data objects and their instances with unique session identifiers, allowing devices to transmit only changed attributes, thereby reducing data transmission and enhancing collaboration efficiency.
This approach reduces data transmission volume and improves collaboration efficiency by ensuring only changed data is transmitted, maintaining data consistency across devices, and eliminating the need for persistent connections.
Smart Images

Figure 0007807569000002 
Figure 0007807569000003 
Figure 0007807569000004
Abstract
Description
[Technical Field]
[0001] This application claims priority to Chinese Patent Application No. 202210297167.3 entitled "DEVICE COLLABORATION METHOD," filed with the State Intellectual Property Office of China on March 24, 2022, the entire contents of which are incorporated herein by reference.
[0002] The present application relates to the field of electronic device technology, and in particular to a device collaboration method. [Background technology]
[0003] With the development of electronic devices, multi-device interconnection scenarios are becoming more and more prevalent in daily life, and the demand for cross-device access and multi-device collaboration is becoming stronger and stronger.
[0004] Currently, resource sharing can be implemented between devices during multi-device collaboration. However, when data collaboration is performed between devices, data transmission links and interfaces need to be established between the devices, which makes the operation complicated. Therefore, how to improve the efficiency of device collaboration is an urgent problem to be solved. Summary of the Invention
[0005] The present application provides a device collaboration method for reducing the amount of data transmitted between collaborating devices and improving the collaboration efficiency of the collaborating devices. [Means for solving the problem]
[0006] According to a first aspect, the present application provides a device collaboration method, including a first electronic device establishing a collaboration connection to a second electronic device. The first electronic device acquires a first instance attribute of a first data object and a second instance attribute of a second data object. The first electronic device transmits the first instance attribute to the second electronic device via a first session and transmits the second instance attribute to the second electronic device via a second session, the first instance attribute being used by the second electronic device to generate the first data object, and the second instance attribute being used by the second electronic device to generate the second data object. A session identifier for the first session is the first session identifier. A session identifier for the second session is the second session identifier. Before the first electronic device acquires the first instance attribute of the first data object and the second instance attribute of the second data object, the first electronic device further generates the first data object and the second data object. According to a device collaboration method provided in a first aspect, a first electronic device transmits different types of data objects to a second electronic device through different sessions. Data objects that are the same on the first electronic device and the second electronic device are associated with the same session identifier. In other words, both a first instance on the first electronic device and a first instance on the second electronic device are associated with a first session identifier, and both a second instance on the first electronic device and a second instance on the second electronic device are associated with a second session identifier. In this way, the first electronic device can monitor attribute changes of the different types of data objects and transmit only data objects whose attributes have changed to the second electronic device. This reduces the amount of data transmitted between collaborating devices, improves collaboration efficiency between the collaborating devices, and avoids device collaboration delays caused by excessively large amounts of transmitted data.
[0007] Referring to the first aspect, in a possible implementation, the method further includes the first electronic device acquiring a third instance attribute of the first data object. The first electronic device transmits the third instance attribute to the second electronic device via the first session, and the first and third instance attributes are jointly used by the second electronic device to generate the first data object. In this manner, if the first data object includes two types of instances, the first electronic device transmits both the first and third instances to the second electronic device via the first session. In other words, data objects that are the same on the first and second electronic devices are associated with the same session identifier, and different types of instances included in the same type of data object are not distinguished. When an attribute of the first data object on the first electronic device changes, the first electronic device transmits the changed first data object to the second electronic device.
[0008] Referring to the first aspect, in a possible implementation, the method further includes the first electronic device acquiring a third instance attribute of the first data object. The first electronic device transmits the third instance attribute to the second electronic device via a third session, and the first and third instance attributes are jointly used by the second electronic device to generate the first data object. In this way, if the first data object includes two types of instances, the first electronic device transmits the first and third instances separately to the second electronic device via different sessions. In other words, instances that are the same on the first and second electronic devices are associated with the same session identifier, and different types of instances included in the same type of data object are distinguished. If an attribute of the first instance on the first electronic device changes, the first electronic device transmits only the changed attribute of the first instance to the second electronic device, and does not need to transmit the third instance attribute. This reduces the amount of data transmitted between collaboration devices and improves collaboration efficiency.
[0009]
[0013] Referring to the first aspect, in a possible implementation, after the first electronic device transmits the first instance attribute to the second electronic device via the first session, the method further includes: the electronic device detecting that the first instance attribute has changed and transmitting the changed first instance attribute to the second electronic device via the first session; the changed first instance attribute is used by the second electronic device to update the first data object. In this way, the first electronic device transmits only the changed instance attribute to the second electronic device, and does not need to transmit the unchanged instance attribute. In this case, the amount of data transmitted between collaboration devices is reduced, improving collaboration efficiency.
[0010]
[0013] Referring to the first aspect, in a possible implementation, the first electronic device establishing a collaboration connection to the second electronic device specifically includes the first electronic device sending a collaboration message to the second electronic device, the collaboration message including an instance identifier of the first instance and a session identifier of the first session, the session identifier of the first session being associated with the first instance. In this manner, the first electronic device associates the first instance with the session identifier of the first session, and as a result, after receiving the session identifier of the first session, the second electronic device associates the first instance on the second electronic device with the session identifier of the first session. In this manner, the same session identifier is associated with two instances that are the same on the first electronic device and the second electronic device. This ensures consistency of attributes of the two instances that are the same on the first electronic device and the second electronic device, and ensures consistency of collaboration data.
[0011] Referring to the first aspect, in a possible implementation, the method further includes the first electronic device establishing a collaboration connection to a third electronic device, wherein the first electronic device sends a first instance attribute to the third electronic device via a fourth session and a second instance attribute to the third electronic device via a fifth session, the first instance attribute being used by the third electronic device to generate a first data object, and the second instance attribute being used by the third electronic device to generate a second data object.
[0012] The session identifier for the fourth session is the fourth session identifier, and the session identifier for the fifth session is the fifth session identifier. Sending the first instance attribute by the first electronic device to the third electronic device via the fourth session and sending the second instance attribute to the third electronic device via the fifth session may be understood as associating the first instance on the first electronic device with the fourth session identifier and associating the second instance on the first electronic device with the fifth session identifier by the first electronic device. The first electronic device sends the first instance identifier and the fourth session identifier to the third electronic device, and the first electronic device sends the second instance identifier and the fifth session identifier to the third electronic device. The third electronic device associates the first instance on the third electronic device with the fourth session identifier. The third electronic device associates the second instance on the third electronic device with the fifth session identifier. In other words, both the first instance on the first electronic device and the first instance on the third electronic device are associated with a fourth session identifier, and both the second instance on the first electronic device and the second instance on the third electronic device are associated with a fifth session identifier.
[0013] In this way, three electronic devices can simultaneously establish collaboration connections, and the attributes of the same instance on multiple devices are the same, ensuring the consistency of collaboration data.
[0014] Referring to the first aspect, in a possible implementation, the method further includes the first electronic device establishing a collaboration connection to a third electronic device. The first electronic device generates a third data object. The first electronic device obtains a fourth instance attribute of the third data object. The first electronic device transmits the fourth instance attribute to the third electronic device via a sixth session, and the fourth instance attribute is used by the third electronic device to generate the third data object.
[0015] The session identifier of the sixth session is the sixth session identifier. Sending the fourth instance attribute by the first electronic device to the third electronic device via the sixth session may be understood as the first electronic device associating the fourth instance on the first electronic device with the sixth session identifier. The first electronic device then sends the identifier of the fourth instance and the sixth session identifier to the third electronic device. The third electronic device associates the fourth instance on the third electronic device with the sixth session identifier. In other words, both the fourth instance on the first electronic device and the fourth instance on the third electronic device are associated with the sixth session identifier.
[0016] In this way, when the first electronic device establishes collaboration connections to multiple different electronic devices, the first electronic device can simultaneously transmit different collaboration data to the multiple different electronic devices, thereby improving the versatility of device collaboration capabilities.
[0017]
[0013] Referring to the first aspect, in a possible implementation, the first electronic device acquiring the first instance attribute of the first data object and the second instance attribute of the second data object may specifically include the first electronic device acquiring the first instance attribute of the first data object and the second instance attribute of the second data object through data interception. In this way, through data interception, it is possible to monitor whether the first instance attribute and the second instance attribute have changed, and to timely update the changed first instance attribute and / or second instance attribute. This ensures data consistency between the collaborating devices.
[0018]
[0013] Referring to the first aspect, in a possible implementation, a first data object is associated with a first session and a second data object is associated with a second session. The first data object includes at least one of a text data object, a picture data object, an audio data object, and a video data object. The second data object includes at least one of a text data object, a picture data object, an audio data object, and a video data object. The first data object is different from the second data object.
[0019] According to a second aspect, the present application provides a collaboration method. The method includes: a second electronic device establishes a collaboration connection to a first electronic device; the second electronic device receives, via a first session, a first instance attribute of a first data object transmitted by the first electronic device; the second electronic device receives, via a second session, a second instance attribute of a second data object transmitted by the first electronic device; the second electronic device generates a first data object based on the first instance attribute; the second electronic device generates a second data object based on the second instance attribute; a session identifier of the first session is the first session identifier; and a session identifier of the second session is the second session identifier. Before the first electronic device obtains the first instance attribute of the first data object and the second instance attribute of the second data object, the first electronic device further generates a first data object and a second data object. According to a device collaboration method provided in a second aspect, a second electronic device receives different types of data objects transmitted by the second electronic device through different sessions. Data objects that are the same on the second electronic device and the first electronic device are associated with the same session identifier. In other words, both a first instance on the first electronic device and a first instance on the second electronic device are associated with a first session identifier, and both a second instance on the first electronic device and a second instance on the second electronic device are associated with a second session identifier. In this way, the first electronic device can monitor attribute changes of different types of data objects and transmit only data objects whose attributes have changed to the second electronic device. This reduces the amount of data transmitted between collaborating devices, improves collaboration efficiency between collaborating devices, and avoids device collaboration delays caused by excessively large amounts of transmitted data.
[0020] Referring to the second aspect, in a possible implementation, the method further includes the second electronic device receiving a third instance attribute of the first data object transmitted by the first electronic device via the first session. The second electronic device generates the first data object based on both the first instance attribute and the third instance attribute. In this way, if the first data object includes two types of instances, the second electronic device receives both the first instance and the third instance transmitted by the first electronic device via the first session. In other words, data objects that are the same on the first electronic device and the second electronic device are associated with the same session identifier, and different types of instances included in the same type of data object are not distinguished. When an attribute of the first data object on the first electronic device changes, the first electronic device transmits the changed first data object to the second electronic device.
[0021] Referring to the second aspect, in a possible implementation, the method further includes the second electronic device receiving a third instance attribute of the first data object transmitted by the first electronic device via the third session. The second electronic device generates the first data object based on both the first instance attribute and the third instance attribute. In this way, if the first data object includes two types of instances, the second electronic device separately receives the first instance and the third instance transmitted by the second electronic device via different sessions. In other words, two instances that are the same on the first electronic device and the second electronic device are associated with the same session identifier, and different types of instances included in the same type of data object are not distinguished. If an attribute of the first instance on the first electronic device changes, the first electronic device transmits only the changed attribute of the first instance to the second electronic device, and does not need to transmit the third instance attribute. This reduces the amount of data transmitted between collaboration devices and improves collaboration efficiency.
[0022] In relation to the second aspect, in a possible implementation, after the second electronic device receives the first instance attribute of the first data object transmitted by the first electronic device via the first session, the method further includes the second electronic device receiving the changed first instance attribute of the first data object transmitted by the first electronic device via the first session. The second electronic device generates the first data object based on the changed first instance attribute. In this way, the first electronic device transmits only the changed instance attribute to the second electronic device, and does not need to transmit the unchanged instance attribute. In this case, the amount of data transmitted between collaboration devices is reduced, improving collaboration efficiency.
[0023] Referring to the second aspect, in a possible implementation, the second electronic device establishing a collaboration connection with the first electronic device particularly includes the second electronic device receiving a collaboration message sent by the first electronic device, the collaboration message including an instance identifier of the first instance attribute and a session identifier of the first session, the session identifier of the first session being associated with the first instance attribute. In this manner, the first electronic device associates the first instance with the session identifier of the first session. As a result, after receiving the session identifier of the first session, the second electronic device associates the first instance on the second electronic device with the session identifier of the first session. In this manner, the same session identifier is associated with two instances that are the same on the first electronic device and the second electronic device. This ensures consistency of the attributes of the two instances that are the same on the first electronic device and the second electronic device, and ensures consistency of collaboration data.
[0024] Referring to the second aspect, in a possible implementation, the first data object is associated with a first session, the second data object is associated with a second session, and the first data object is different from the second data object.
[0025] Referring to the second aspect, in a possible implementation, the first data object includes at least one of a text data object, an image data object, an audio data object, and a video data object.
[0026] According to a third aspect, the present application provides an electronic device, the electronic device being a first electronic device, the first electronic device including one or more functional units, the one or more functional units being used by the first electronic device to perform a device collaboration method provided in any possible implementation form of any one of the preceding aspects.
[0027] According to a fourth aspect, the present application provides an electronic device, the electronic device being a second electronic device, the second electronic device including one or more functional units, the one or more functional units being used by the second electronic device to perform a device collaboration method provided in any possible implementation form of any one of the preceding aspects.
[0028] According to a fifth aspect, the present application provides an electronic device. The electronic device is a first electronic device. The first electronic device includes one or more processors and one or more memories. The one or more memories are coupled to the one or more processors. The one or more memories are configured to store computer program code. The computer program code includes computer instructions. When the computer instructions are invoked by the one or more processors, the first electronic device is enabled to perform a device collaboration method provided in any possible implementation form of any one of the aforementioned aspects.
[0029] According to a sixth aspect, the present application provides an electronic device. The electronic device is a second electronic device. The second electronic device includes one or more processors and one or more memories. The one or more memories are coupled to the one or more processors. The one or more memories are configured to store computer program code. The computer program code includes computer instructions. When the computer instructions are invoked by the one or more processors, the second electronic device is enabled to perform a device collaboration method provided in any possible implementation form of any one of the aforementioned aspects.
[0030] According to a seventh aspect, the present application provides a computer-readable storage medium configured to store computer instructions that, when executed on a first electronic device, enable the first electronic device to perform a device collaboration method provided in any possible implementation form of any one of the preceding aspects.
[0031] According to an eighth aspect, the present application provides a computer-readable storage medium configured to store computer instructions that, when executed on a second electronic device, enable the second electronic device to perform a device collaboration method provided in any possible implementation form of any one of the preceding aspects.
[0032] According to a ninth aspect, the present application provides a computer program product that, when executed on a first electronic device, enables the first electronic device to perform a device collaboration method provided in any possible implementation form of any one of the preceding aspects.
[0033] According to a tenth aspect, the present application provides a computer program product, which, when executed on a second electronic device, enables the second electronic device to perform a device collaboration method provided in any possible implementation form of any one of the preceding aspects.
[0034] For the beneficial effects of the second to tenth aspects, please refer to the relevant descriptions of the beneficial effects in the first aspect. Details will not be described again in the embodiments of the present application. [Brief explanation of the drawings]
[0035] [Figure 1] FIG. 2 is a partial process diagram of an RPC mechanism according to an embodiment of the present application. [Figure 2] 4 is a diagram of the architecture of a system 400 according to an embodiment of the present application. [Figure 3] 1 is a diagram of the structure of an electronic device 100 according to an embodiment of the present application. [Figure 4] FIG. 1 is a block diagram of the software architecture of an electronic device 100 according to an embodiment of the present application. [Figure 5]FIG. 2 is a diagram of functional modules of a JS programming framework according to an embodiment of the present application. [Figure 6] 1 is a diagram of a collaboration interaction between electronic device 100 and electronic device 200 according to an embodiment of the present application. [Figure 7] FIG. 10 is an exemplary UI diagram in which any two instances of two collaboration devices in a group are associated with the same session ID. [Figure 8] FIG. 10 is an exemplary UI diagram in which any two instances of two collaboration devices in a group are associated with the same session ID. [Figure 9] FIG. 10 is an exemplary UI diagram in which any two instances of two collaboration devices in a group are associated with the same session ID. [Figure 10] 1 is an example of a UI diagram in which any two instances of multiple collaboration devices in a group are associated with the same session ID. [Figure 11] 1 is an example of a UI diagram in which any two instances of multiple collaboration devices in a group are associated with the same session ID. [Figure 12] 1 is an example of a UI diagram in which any two instances of multiple collaboration devices in a group are associated with the same session ID. [Figure 13] FIG. 1 is a diagram illustrating an implementation of data synchronization between collaboration devices according to an embodiment of the present application. [Figure 14] 1 is a schematic flowchart of a device collaboration method according to an embodiment of the present application; [Figure 15A] 1 is a group of UI diagrams according to one embodiment of the present application. [Figure 15B] 1 is a group of UI diagrams according to one embodiment of the present application. [Figure 15C] 1 is a group of UI diagrams according to one embodiment of the present application. [Figure 15D]1 is a group of UI diagrams according to one embodiment of the present application. [Figure 15E] 1 is a group of UI diagrams according to one embodiment of the present application. [Figure 15F] 1 is a group of UI diagrams according to one embodiment of the present application. [Figure 15G] 1 is a group of UI diagrams according to one embodiment of the present application. DETAILED DESCRIPTION OF THE INVENTION
[0036] The technical solutions according to the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. In the description of the embodiments of the present application, unless otherwise specified, " / " means "or". For example, A / B may represent A or B. In this specification, "and / or" simply describes an association relationship between related objects and represents that three relationships may exist. For example, A and / or B may represent the following three cases: when only A exists, when both A and B exist, and when only B exists. In addition, in the description of the embodiments of the present application, "plurality" means two or more.
[0037] The terms "first" and "second" referred to below are used merely for descriptive purposes and should not be understood as an implicit or implied indication of the number or relative importance of the technical features indicated. Thus, features qualified by "first" and "second" may explicitly or implicitly include one or more of those features. In the description of the embodiments of this application, unless otherwise specified, "plurality" means two or more.
[0038] The term "user interface (UI)" in the following embodiments of this application refers to a media interface for interaction and information exchange between a user and an application or an operating system, and implements the conversion between the internal form of information and a form acceptable to the user. A user interface is usually in the form of a graphical user interface (GUI), which is a user interface related to computer operation and in the form of graphics. A user interface can be visual interface elements such as text, icons, buttons, menus, tabs, text boxes, dialog boxes, status bars, navigation bars, or widgets displayed on the display of an electronic device.
[0039] Currently, links and interfaces for data transfer can be established between electronic devices by using a remote procedure call (RPC) mechanism to perform data collaboration.
[0040] FIG. 1 is an exemplary diagram of the partial processes of an RPC mechanism.
[0041] The RPC mechanism mainly includes the following steps:
[0042] 1. The serving end defines and implements an AIDL interface for invoking remote messages.
[0043] 2. The serving end exposes the AIDL interface to the client end by using the server.
[0044] 3. A persistent connection is established between the client end and the serving end.
[0045] 4. The client end binds to the client end, invokes the AIDL interface of the client end, and invokes messages on the client end.
[0046] From the above steps, we can see that during a specific implementation of the existing RPC mechanism, the client end needs to be bound to the serving end and a persistent connection needs to be maintained between the client end and the serving end, which increases the internal resource consumption of the client end. Developers also need to implement internal code implementation aspects, such as creating a communication interface for the serving end, binding the client end and the serving end (i.e., establishing a communication connection between the client end and the serving end), and maintaining a persistent connection between the client end and the serving end, which increases the developer's burden.
[0047] Therefore, one embodiment of the present application provides a device collaboration method. The method includes the following: By using the programming framework provided in this embodiment of the present application, the electronic device 100 can redefine a data object according to a getter / setter method through data interception to obtain a distributed data object. The electronic device 100 can detect whether an attribute value of the distributed data object has changed, and then the electronic device 100 sends the distributed data to the electronic device 200. In addition, two instances or data objects that are the same on the electronic device 100 and the electronic device 200 are associated with the same session identifier (session ID), so that the data of the two instances that are the same on the electronic device 100 and the electronic device 200 are the same. In this way, automatic synchronization of distributed data objects on electronic devices is implemented.
[0048] In some embodiments, electronic device 100 may be referred to as a first electronic device, and electronic device 200 may be referred to as a second electronic device.
[0049] According to the method provided in this embodiment of the present application, by using the programming framework provided in this embodiment of the present application, there is no need to distinguish between the client end and the serving end, and there is no need to maintain a persistent connection between electronic devices. In this case, the development efficiency of application developers is improved. Furthermore, distributed data objects are created through data interception. The electronic device 100 can monitor the instance attribute values of the distributed data object and send only the changed instance attribute values to the electronic device 200. In this way, the amount of data transmitted is reduced, and device collaboration efficiency is improved. In addition, this embodiment of the present application can implement resource sharing among multiple electronic devices.
[0050] For example, if it is inconvenient for a user to use a mobile phone for navigation while cycling, the mobile phone cannot process navigation information. When the mobile phone and the smartwatch are in the same distributed network, the mobile phone can seamlessly switch the map information for navigation on the mobile phone to the smartwatch with one tap, and then the smartwatch continues to display the navigation information. In this way, the user can view the navigation information while cycling.
[0051] In another example, when a mobile phone and a TV are in the same distributed network, the mobile phone can seamlessly switch the video being watched on the mobile phone to the TV with a single tap, and the TV then continues to provide video playback services, allowing the user to enjoy a big screen experience.
[0052] As another example, in an office scenario, during a meeting, a staff member may operate an office computer to display a presentation file. The office computer may establish a collaboration connection to another person's office device, so that the presentation file on the office computer can be displayed on the other person's office device. In this way, office efficiency is improved.
[0053] The following describes the system architecture provided in one embodiment of the present application.
[0054] Please refer to Figure 2. Figure 2 is a diagram of the architecture of a system 400 according to one embodiment of the present application.
[0055] System 400 may include multiple electronic devices. The multiple electronic devices may be of various types. The specific types of the multiple electronic devices are not particularly limited in this embodiment of the present application. For example, the multiple electronic devices may include mobile phones, tablet computers, desktop computers, laptop computers, handheld computers, notebook computers, smart screens, wearable devices, augmented reality (AR) devices, virtual reality (VR) devices, artificial intelligence (AI) devices, telematics, smart headsets, and game consoles, and may further include Internet of Things (IoT) devices or smart home devices such as smart water heaters, smart lamps, or smart air conditioners. This is not limited to this. The multiple electronic devices in system 400 may also include non-portable terminal devices such as laptop computers with touch-sensitive surfaces or touch panels, or desktop computers with touch-sensitive surfaces or touch panels.
[0056] Different software operating systems (OS) may be configured for multiple electronic devices, including but not limited to Harmony, Android, iOS, Windows, Linux, etc. Harmony is Huawei HarmonyOS.
[0057] Multiple electronic devices may all be configured with the same software operating system, for example, all configured with Harmony.
[0058] Multiple electronic devices can establish a collaboration connection in any one of the following ways:
[0059] Method 1: Multiple electronic devices can be connected to the same network. For example, multiple electronic devices can be connected to the same local area network to establish a collaboration connection.
[0060] Method 2: To establish a collaboration connection, the same system account is used to log in to multiple electronic devices. For example, the system account used to log in to multiple electronic devices may be “HW1234”.
[0061] Method 3: The system accounts used to log in to multiple electronic devices may all belong to the same account group. For example, the system accounts used to log in to multiple electronic devices include "HW001", "HW002", and "HW003". The system accounts "HW001", "HW002", and "HW003" belong to the account group "Huawei Home".
[0062] Method 4: Multiple electronic devices can establish a collaboration connection through methods such as Near Field Communication (NFC), Bluetooth (BT), wireless local area network (WLAN) such as wireless fidelity point to point (Wi-Fi P2P), or infrared (IR) technology.
[0063] Method 5: Multiple electronic devices may establish a temporary account group by scanning the same two-dimensional barcode to establish a collaborative connection for communication.
[0064] In addition to the above five ways, the electronic device 100 may further establish a collaboration connection in another way, which is not limited in this embodiment of the present application.
[0065] In addition, multiple electronic devices can also be connected to and communicate with each other according to any number of combinations of the aforementioned methods, which is not limited in this embodiment of the present application.
[0066] In another embodiment, the system 400 may include only two electronic devices, for example, the electronic device 100 and the electronic device 200, and the electronic device 100 establishes a collaboration connection to the electronic device 100. In the following embodiments of the present application, an example in which the system 400 includes two electronic devices is used for explanation: the electronic device 100 is a mobile phone, and the electronic device 200 is a wristwatch.
[0067] One or more applications are installed on electronic device 100, and one or more applications are also installed on electronic device 200. After electronic device 100 establishes a collaboration connection to electronic device 200, electronic device 100 creates a distributed data object of application 1 by using the JS programming framework provided in this embodiment of the present application. Electronic device 100 then sends the distributed data object to electronic device 200, and electronic device 200 can output the distributed data object. When it is inconvenient for a user to use a mobile phone for navigation while cycling and the mobile phone and smartwatch are in the same distributed network, the mobile phone can seamlessly switch map information for navigation on the mobile phone to the smartwatch with one tap, and then the smartwatch displays the navigation information. In this way, the user can view the navigation information while cycling.
[0068] When electronic device 100 establishes a collaboration connection to electronic device 200, the JS programming framework creates a session ID and associates the session ID with instance 1 of application 1 created locally. Electronic device 200 then obtains the session ID and associates the session ID with instance 1 of application 1 on electronic device 200. In this manner, after a distributed data object on electronic device 100 changes (e.g., the distributed data object is updated), the distributed data object on electronic device 100 also changes accordingly.
[0069] Note that a data object can be understood as memory data (also referred to as service data) generated during the execution of an application, and an instance can be understood as a specification of a particular type of data object. A data object includes one or more types of data objects, and each type of data object can include one or more types of instances. Data object types include, but are not limited to, audio data objects, text data objects, image data objects, video data objects, etc. For example, when a navigation application on electronic device 100 is started and executed, electronic device 100 can announce route information for navigation on the application navigation while displaying the route information for navigation on the navigation application. In this case, the route information displayed by electronic device 100 for navigation on the navigation application may be referred to as a picture data object, and the route information for navigation on the navigation application announced by electronic device 100 is referred to as an audio data object. For example, a data object may be a text data object in navigation information, and the text data object in the navigation information may further include multiple different types of instances. The multiple different types of instances may be a time instance, a remaining distance instance, a duration instance, etc.
[0070] In some embodiments, for one type of data object, the data object includes multiple instances of different types, which may be collectively referred to as the same instance in the electronic device, or the types of instances may not be distinguished, and each type of data object includes only one instance.
[0071] The specific implementation of creating distributed data objects through the JS programming framework will be described in detail in subsequent embodiments, and the details will not be described in this embodiment of the present application.
[0072] FIG. 3 is a diagram showing the structure of the electronic device 100. As shown in FIG.
[0073] The electronic device 100 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, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, a headset jack 170D, a sensor module 180, buttons 190, a motor 191, an indicator 192, a camera 193, a display 194, a subscriber identity module (SIM) card interface 195, and the like. 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, an optical proximity sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, and the like.
[0074] It may be understood that the structure shown in this embodiment of the present application does not constitute a particular limitation on the electronic device 100. In some other embodiments of the present application, the electronic device 100 may include more or fewer components than those shown in the figures, or some components may be combined, or some components may be divided, or a different component arrangement may be used. The components shown in the figures may be implemented by hardware, software, or a combination of software and hardware.
[0075] Processor 110 may include one or more processing units. For example, processor 110 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU). The different processing units may be separate components or may be integrated into one or more processors.
[0076] The controller can generate operation control signals based on the instruction operation codes and time series signals to control instruction fetching and instruction execution.
[0077] Memory may also be located within processor 110 and configured to store instructions and data. In some embodiments, the memory within processor 110 is cache memory. The memory may store instructions or data that have been used or are periodically used by processor 110. When processor 110 needs to use the instructions or data again, the processor can retrieve the instructions or data directly from memory. This avoids repeated accesses, reduces latency for processor 110, and improves system efficiency.
[0078] In some embodiments, processor 110 may include one or more interfaces, which may include an inter-integrated circuit (I2C) interface, an inter-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 subscriber identity module (SIM) interface, a universal serial bus (USB) interface, etc.
[0079] The I2C interface is a bidirectional synchronous serial bus that includes a serial data line (SDA) and a serial clock line (SCL). In some embodiments, the processor 110 may include multiple groups of I2C buses. The processor 110 may be separately coupled to the touch sensor 180K, a charger, a flash, the camera 193, etc. via different I2C bus interfaces. For example, the processor 110 may be coupled to the touch sensor 180K via the I2C interface, such that the processor 110 communicates with the touch sensor 180K via the I2C bus interface to implement touch functionality of the electronic device 100.
[0080] The I2S interface may be configured to perform audio communication. In some embodiments, processor 110 may include multiple groups of I2S buses. Processor 110 may be coupled to audio module 170 via the I2S bus to implement communication between processor 110 and audio module 170. In some embodiments, audio module 170 may send audio signals to wireless communication module 160 via the I2S interface to implement functionality for answering a call via a Bluetooth headset.
[0081] The PCM interface can also be used for audio communication, analog signal sampling, quantization, and encoding. In some embodiments, audio module 170 may be coupled to wireless communication module 160 through a PCM bus interface. In some embodiments, audio module 170 may also send audio signals to wireless communication module 160 via the PCM interface to implement functionality for answering a call via a Bluetooth headset. Both the I2S interface and the PCM interface may be used for audio communication.
[0082] The UART interface is a universal serial data bus configured to perform asynchronous communication. The bus may be a bidirectional communication bus. The bus converts transmitted data between serial and parallel communication. In some embodiments, the UART interface is typically configured to connect the processor 110 to the wireless communication module 160. For example, the processor 110 communicates with a Bluetooth module in the wireless communication module 160 via the UART interface to implement Bluetooth functionality. In some embodiments, the audio module 170 can send audio signals to the wireless communication module 160 via the UART interface to implement functionality for playing music through a Bluetooth headset.
[0083] MIPI may be configured to connect processor 110 to peripheral components such as display 194 or camera 193. MIPI includes a camera serial interface (CSI), a display serial interface (DSI), etc. In some embodiments, processor 110 communicates with camera 193 via CSI to implement photography functionality of electronic device 100. Processor 110 communicates with display 194 via a DSI interface to realize display functionality of electronic device 100.
[0084] The GPIO interface may be configured using software. The GPIO interface may be configured as a control signal or a data signal. In some embodiments, the GPIO interface may be configured to connect the processor 110 to the camera 193, the display 194, the wireless communication module 160, the audio module 170, the sensor module 180, etc. The GPIO interface may further be configured as an I2C interface, an I2S interface, a UART interface, a MIPI interface, etc.
[0085] The USB interface 130 is an interface that complies with the USB standard specifications, and may specifically be a mini USB interface, a micro USB interface, a USB Type-C interface, etc. The USB interface 130 may be configured to connect to a charger to charge the electronic device 100, to transmit data between the electronic device 100 and a peripheral device, or to connect to a headset to play audio through the headset. The interface may further be configured to connect to another electronic device, such as an AR device.
[0086] It may be understood that the interfacing relationships between modules shown in this embodiment of the present invention are merely examples for purposes of illustration and do not constitute limitations on the structure of electronic device 100. In some other embodiments of the present application, electronic device 100 may alternatively use a different interfacing scheme than the aforementioned embodiment, or may use a combination of multiple interfacing schemes.
[0087] The charging management module 140 is configured to receive a charging input from a charger. The charger may be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 may receive the charging input of the wired charger via the USB interface 130. In some wireless charging embodiments, the charging management module 140 may receive the wireless charging input via a wireless charging coil of the electronic device 100. The charging management module 140 provides power to the electronic device via the power management module 141 while charging the battery 142.
[0088] Power management module 141 is configured to connect to battery 142, charging management module 140, and processor 110. Power management module 141 receives input from battery 142 and / or charging management module 140 and provides power to processor 110, internal memory 121, display 194, camera 193, wireless communication module 160, etc. Power management module 141 may be further configured to monitor parameters such as battery capacity, battery cycle count, and battery health status (fault or impedance). In some other embodiments, power management module 141 may alternatively be located within processor 110. In some other embodiments, power management module 141 and charging management module 140 may alternatively be located within the same device.
[0089] The wireless communication functionality of the electronic device 100 may be implemented by using Antenna 1, Antenna 2, mobile communication module 150, wireless communication module 160, a modem processor, a baseband processor, and the like.
[0090] Antenna 1 and Antenna 2 are configured to transmit and receive electromagnetic signals. Each antenna in electronic device 100 may be configured to cover one or more communication bands. Different antennas may be multiplexed to improve antenna utilization. For example, Antenna 1 may be multiplexed as a diversity antenna for a wireless local area network. In some other embodiments, antennas may be used in combination with tuning switches.
[0091] Mobile communication module 150 may provide a solution applied to electronic device 100 for wireless communications, including 2G, 3G, 4G, 5G, etc. Mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (LNA), etc. Mobile communication module 150 may receive electromagnetic waves via antenna 1, perform processing such as filtering or amplification on the received electromagnetic waves, and send the electromagnetic waves to a modem processor for demodulation. Mobile communication module 150 may further amplify signals modulated by the modem processor and convert the signals to electromagnetic waves for emission via antenna 1. In some embodiments, at least some functional modules in mobile communication module 150 may be located within processor 110. In some embodiments, at least some functional modules of mobile communication module 150 and at least some modules of processor 110 may be located within the same device.
[0092] The modem processor may include a modulator and a demodulator. The modulator is configured to modulate a low-frequency baseband signal to be transmitted into a medium- to high-frequency signal. The demodulator is configured to demodulate a received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the low-frequency baseband signal obtained through demodulation to the baseband processor for processing. The low-frequency baseband signal is processed by the baseband processor and then transmitted to the application processor. The application processor outputs an audio signal through an audio device (such as, but not limited to, speaker 170A, receiver 170B, etc.) or displays an image or video using display 194. In some embodiments, the modem processor may be an independent component. In some other embodiments, the modem processor may be separate from processor 110, and the modem processor and mobile communication module 150 or another functional module may be located within the same device.
[0093] The wireless communication module 160 may be applied to the electronic device 100 to provide wireless communication solutions, including wireless local area networks (WLANs) (e.g., wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite systems (GNSS), frequency modulation (FM), near field communication (NFC) technology, infrared (IR) technology, etc. The wireless communication module 160 may be one or more components integrating at least one communication processor module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, performs demodulation and filtering processes on the electromagnetic wave signals, and transmits the processed signals to the processor 110. The wireless communication module 160 may further receive signals transmitted from the processor 110, perform frequency modulation and amplification on the signals, and convert the signals into electromagnetic waves for emission via the antenna 2.
[0094] In some embodiments, in electronic device 100, antenna 1 is coupled to mobile communication module 150 and antenna 2 is coupled to wireless communication module 160, such that electronic device 100 can communicate with a network and another device by using a wireless communication technology. The wireless communication technology may include technologies such as global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR. GNSS may include a global positioning system (GPS), a global navigation satellite system (GLONASS), a BeiDou navigation satellite system (BDS), a quasi-zenith satellite system (QZSS), and / or a satellite-based augmentation system (SBAS).
[0095] The electronic device 100 can implement display functionality via a GPU, a display 194, an application processor, etc. The GPU is a microprocessor for image processing and is connected to the display 194 and the application processor. The GPU is configured to perform mathematical and geometric calculations and render images. The processor 110 may include one or more GPUs that execute program instructions to generate or modify display information.
[0096] Display 194 is configured to display images, videos, etc. Display 194 includes a display panel. The display panel may be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a mini-LED, a micro-LED, a micro-OLED, a quantum dot light-emitting diode (QLED), etc. In some embodiments, electronic device 100 may include one or N displays 194, where N is a positive integer greater than 1.
[0097] The electronic device 100 can implement the image capture function through an ISP, a camera 193, a video codec, a GPU, a display 194, an application processor, and the like.
[0098] The ISP is configured to process data fed back by the camera 193. For example, during photography, the shutter is pressed and light is sent through the lens to the camera's photosensitive elements. The light signal is converted into an electrical signal, which the camera's photosensitive elements send to the ISP for processing, converting the electrical signal into a visible image. The ISP can further perform algorithmic optimization for image noise and brightness. The ISP can further optimize parameters such as exposure and color temperature for the photography scenario. In some embodiments, the ISP can be located within the camera 193.
[0099] The camera 193 is configured to capture still images or video. An optical image of an object is generated through a lens and projected onto a photosensitive element. The photosensitive element may be a charge-coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts an optical signal into an electrical signal, which is then sent to an ISP for conversion into a digital image signal. The ISP outputs the digital image signal to a DSP for processing. The DSP converts the digital image signal into an image signal in a standard format, such as RGB or YUV. In some embodiments, the electronic device 100 may include one or N cameras 193, where N is a positive integer greater than 1.
[0100] The digital signal processor is configured to process digital signals and can process other digital signals in addition to the digital image signal, for example, when the electronic device 100 selects a frequency, the digital signal processor is configured to perform a Fourier transform on the frequency energy.
[0101] A video codec is configured to compress or decompress digital video. Electronic device 100 may support one or more types of video codecs. In this manner, electronic device 100 may play or record video in multiple coding formats, for example, Moving Picture Experts Group (MPEG)-1, MPEG-2, MPEG-3, and MPEG-4.
[0102] The NPU is a neural network (NN) computing processor. The NPU can rapidly process input information and continuously perform self-learning by referencing the structure of biological neural networks, such as the communication mode between human brain neurons. The NPU can realize intelligent cognition applications in the electronic device 100, such as image recognition, face recognition, speech recognition, and text comprehension.
[0103] The internal memory 121 may be one or more random access memories (RAMs) and one or more non-volatile memories (NVMs).
[0104] Random access memory may include static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM, such as the fifth generation DDR SDRAM commonly referred to as DDR5 SDRAM), etc. Non-volatile memory may include magnetic disk storage devices and flash memory.
[0105] Based on the operating principle, flash memory can be classified into NOR flash, NAND flash, 3D NAND flash, etc.; based on the amount of potential levels of the cell, it can be classified into single-level cell (SLC), multi-level cell (MLC), triple-level cell (TLC), quad-level cell (QLC), etc.; or based on the storage specifications, flash memory can be classified into universal flash storage (UFS), embedded multi-media card (eMMC), etc.
[0106] The random access memory may be read and written directly using the processor 110. The random access memory may be configured to store executable programs (e.g., machine instructions) within an operating system or another executing program, and may further be configured to store user data, application data, etc.
[0107] The non-volatile memory may also store executable programs, user and application data, etc., which may be pre-loaded into the random access memory so that the processor 110 can read and write them directly.
[0108] The external memory interface 120 may be configured to connect to an external non-volatile memory to expand the storage capabilities of the electronic device 100. The external non-volatile memory communicates with the processor 110 via the external memory interface 120 to implement data storage functions. The external non-volatile memory stores, for example, music and video files.
[0109] The electronic device 100 can implement audio functions, such as music playback and recording, via an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, a headset jack 170D, and an application processor.
[0110] Audio module 170 is configured to convert digital audio information into analog audio signals for output, and to convert analog audio input into digital audio signals. Audio module 170 may be further configured to encode and decode audio signals. In some embodiments, audio module 170 may be located within processor 110, or some functional modules within audio module 170 may be located within processor 110.
[0111] Speaker 170A, also referred to as a "loudspeaker," is configured to convert audio electrical signals into voice signals. Electronic device 100 can be used to listen to music in hands-free mode or answer phone calls via speaker 170A.
[0112] Receiver 170B, also referred to as an "earpiece," is configured to convert electrical audio signals into speech signals. When answering a call or receiving audio information via electronic device 100, receiver 170B can be held close to a person's ear to hear the audio.
[0113] The microphone 170C, also referred to as a "mike" or "mic," is configured to convert audio signals into electrical signals. When making a phone call or sending a voice message, a user can input an audio signal into the microphone 170C by making a sound through the user's mouth near the microphone 170C. At least one microphone 170C can be disposed within the electronic device 100. In some other embodiments, two microphones 170C can be disposed in the electronic device 100 to collect audio signals and implement noise cancellation functions. In some other embodiments, three, four, or more microphones 170C can alternatively be disposed in the electronic device 100 to collect audio signals, implement noise cancellation, identify sound sources, implement directional recording functions, etc.
[0114] The headset jack 170D is configured to connect to a wired headset and may be a USB interface 130, or a 3.5 mm open mobile terminal platform (OMTP) standard interface or a cellular telecommunications industry association of the USA (CTIA) standard interface.
[0115] The pressure sensor 180A is configured to sense a pressure signal and convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor 180A may be disposed on the display 194. There are several types of pressure sensors 180A, such as resistive pressure sensors, inductive pressure sensors, and capacitive pressure sensors. A capacitive pressure sensor may include at least two parallel plates made of a conductive material. When a force is applied to the pressure sensor 180A, a capacitance between the electrodes changes. The electronic device 100 determines the pressure intensity based on the change in capacitance. When a touch operation is performed on the display 194, the electronic device 100 detects the intensity of the touch operation via the pressure sensor 180A. The electronic device 100 can also calculate the touch position based on the detection signal of the pressure sensor 180A. In some embodiments, touch operations performed at the same touch position but with different touch operation intensities may correspond to different operation commands. For example, when a touch operation with a touch operation intensity below a first pressure threshold is performed on an SMS message application icon, an instruction to view SMS messages is executed. When a touch operation with a touch intensity equal to or greater than a first pressure threshold is performed on the SMS message application icon, instructions are executed to compose an SMS message.
[0116] The gyro sensor 180B may be configured to determine the movement attitude of the electronic device 100. In some embodiments, the angular velocity of the electronic device 100 around three axes (axes x, y, and z) may be determined using the gyro sensor 180B. The gyro sensor 180B may be configured to implement image stabilization during photography. For example, when the shutter is pressed, the gyro sensor 180B detects the angle at which the electronic device 100 jitters, and based on that angle, calculates the distance the lens module needs to compensate, and the lens cancels the jitter of the electronic device 100 through reverse movement to implement image stabilization. The gyro sensor 180B may also be used in navigation scenarios and physical game scenarios.
[0117] The barometric pressure sensor 180C is configured to measure barometric pressure. In some embodiments, the electronic device 100 calculates altitude based on the barometric pressure value measured by the barometric pressure sensor 180C to assist in positioning and navigation.
[0118] The magnetic sensor 180D includes a Hall sensor. The electronic device 100 may use the magnetic sensor 180D to detect whether the flip cover is open or closed. In some embodiments, if the electronic device 100 is a clamshell phone, the electronic device 100 can detect whether the flip cover is open or closed based on the magnetic sensor 180D. Furthermore, functions such as automatic unlocking upon opening can be configured based on the detected open or closed state of the flip cover or clamshell.
[0119] The acceleration sensor 180E can detect acceleration in various directions (typically on three axes) of the electronic device 100. When the electronic device 100 is stationary, the magnitude and direction of gravity can be detected. The acceleration sensor 180E may be further configured to identify the orientation of the electronic device, which is used in applications such as switching between landscape and portrait modes or a pedometer.
[0120] The distance sensor 180F is configured to measure distance. The electronic device 100 can measure distance using an infrared method or a laser method. In some embodiments, in a photography scenario, the electronic device 100 can measure distance via the distance sensor 180F to implement rapid focusing.
[0121] The optical proximity sensor 180G may include, for example, a light-emitting diode (LED) and a photodetector, such as a photodiode. The light-emitting diode may be an infrared light-emitting diode. The electronic device 100 uses the light-emitting diode to emit infrared light. The electronic device 100 detects the infrared light reflected from a nearby object through the photodiode. If sufficient reflected light is detected, the electronic device 100 may determine that an object is present near the electronic device 100. If insufficient reflected light is detected, the electronic device 100 may determine that no object is present near the electronic device 100. By using the optical proximity sensor 180G, the electronic device 100 may detect when a user is holding the electronic device 100 close to their ear for a call and automatically turn off the screen to save power. The optical proximity sensor 180G may also be used in flip cover mode or pocket mode to automatically unlock or lock the screen.
[0122] The ambient light sensor 180L is configured to sense the brightness of ambient light. The electronic device 100 may adaptively adjust the brightness of the display 194 based on the sensed ambient light brightness. The ambient light sensor 180L may also be configured to automatically adjust the white balance during capture. The ambient light sensor 180L may also cooperate with the optical proximity sensor 180G to detect whether the electronic device 100 is in a pocket to avoid accidental touches.
[0123] Fingerprint sensor 180H is configured to collect fingerprints, and electronic device 100 can use the collected fingerprint characteristics to implement fingerprint-based unlocking, application lock access, fingerprint-based photo taking, fingerprint-based phone answering, etc.
[0124] Temperature sensor 180J detects temperature. In some embodiments, electronic device 100 executes a temperature handling policy based on the temperature detected by temperature sensor 180J. For example, when the temperature reported by temperature sensor 180J exceeds a threshold, electronic device 100 reduces the performance of processors near temperature sensor 180J to reduce power consumption and implement thermal protection. In some other embodiments, when the temperature is below another threshold, electronic device 100 heats battery 142 to prevent electronic device 100 from abnormal shutdown caused by low temperature. In some other embodiments, when the temperature is below yet another threshold, electronic device 100 boosts the output voltage of battery 142 to avoid abnormal shutdown caused by low temperature.
[0125] The touch sensor 180K is also referred to as a "touch component." The touch sensor 180K may be disposed on the display 194, and the touch sensor 180K and the display 194 form a touch screen, referred to as a "touch screen." The touch sensor 180K is configured to detect touch operations performed on or near the touch sensor. The touch sensor can forward the detected touch operations to an application processor to determine the type of touch event. A visual output associated with the touch operation may be provided via the display 194. In some other embodiments, the touch sensor 180K may also be disposed on the surface of the electronic device 100 at a location different from the location of the display 194.
[0126] The bone conduction sensor 180M can acquire vibration signals. In some embodiments, the bone conduction sensor 180M can acquire vibration signals from the vibrating bones of the human vocal cords. The bone conduction sensor 180M can be in contact with a body pulse to receive blood pressure pulsation signals. In some embodiments, the bone conduction sensor 180M can be disposed within a headset to acquire a bone conduction headset. The audio module 170 can acquire audio signals by analyzing the vibration signals from the vibrating bones of the vocal cords acquired by the bone conduction sensor 180M to implement a voice function. The application processor can analyze heart rate information based on the blood pressure pulsation signals acquired by the bone conduction sensor 180M to implement a heart rate detection function.
[0127] The buttons 190 include a power button, a volume button, etc. The buttons 190 may be mechanical buttons or touch buttons. The electronic device 100 can receive button inputs and generate button signal inputs related to user settings and function control of the electronic device 100.
[0128] The motor 191 can generate vibration prompts. The motor 191 may be configured to provide incoming vibration prompts and touch vibration feedback. For example, touch operations performed in different applications (e.g., taking pictures and playing audio) may correspond to different vibration feedback effects. For touch operations performed in different areas of the display 194, the motor 191 may also correspond to different vibration feedback effects. Different application scenarios (e.g., time reminders, receiving information, alarm clocks, and games) may correspond to different vibration feedback effects. The touch vibration feedback effects may be further customized.
[0129] The indicator 192 may be an indicator light and may be configured to indicate charging status and power changes, or may be configured to indicate messages, missed calls, notifications, and the like.
[0130] The SIM card interface 195 is configured to connect to a SIM card. The SIM card can be inserted into or removed from the SIM card interface 195 to implement contact with or separation from the electronic device 100. The electronic device 100 can support one or N SIM card interfaces, where N is a positive integer greater than one. The SIM card interface 195 can support nano-SIM cards, micro-SIM cards, SIM cards, etc. Multiple cards can be inserted into the same SIM card interface 195 simultaneously. The multiple cards can be the same type or different types. Different types of SIM cards are compatible in the SIM card interface 195. The SIM card interface 195 is also compatible with external storage cards. The electronic device 100 interacts with a network through the SIM card to implement functions such as call and data communication. In some embodiments, the electronic device 100 uses an eSIM, i.e., an embedded SIM card. The eSIM card may be embedded in the electronic device 100 and cannot be separated from the electronic device 100.
[0131] The software system of electronic device 100 may use a layered architecture, an event-driven architecture, a microkernel architecture, a microservices architecture, or a cloud architecture. In this embodiment of the present invention, the Android system with a layered architecture is used as an example to explain the software structure of electronic device 100.
[0132] FIG. 4 is a block diagram of the software architecture of electronic device 100 according to one embodiment of the present invention.
[0133] The software is divided into layers based on a layered architecture, and each layer implements a different function. The layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers from top to bottom: the application layer, the application framework layer, the Android runtime and system libraries, and the kernel layer.
[0134] The application layer may include various application packages.
[0135] As shown in FIG. 4, the application package may include applications such as Camera, Gallery, Calendar, Call, Map, Navigation, WLAN, Bluetooth, Music, Videos, and Messages.
[0136] The application framework layer provides an application programming interface (API) and a programming framework for applications in the application layer, and includes some predefined functions.
[0137] As shown in FIG. 4, the application framework layer may include a window manager, a content provider, a view system, a telephony manager, a resource manager, a JS programming framework, and the like.
[0138] A window manager is configured to manage window programs, and can do things like get the size of the display, determine if there is a status bar, perform screen locking, take screenshots, etc.
[0139] Content providers are configured to store and retrieve data and make the data accessible to applications. Data may include video, images, audio, calls made and received, browsing history and bookmarks, address books, etc.
[0140] The view system includes visual controls, such as controls for displaying text and controls for displaying images. The view system can be configured to build applications. A display interface can include one or more views. For example, a display interface that includes an SMS message notification icon can include a view that displays text and a view that displays a picture.
[0141] The telephone manager is configured to provide communication functions of the electronic device 100, such as managing call status (including answering, rejecting, etc.).
[0142] The resource manager provides various resources such as localized strings, icons, images, layout files, video files, etc. to the application.
[0143] The JS programming framework can be used to redefine the JS data object transferred by the application according to the getter / setter methods through JS data interception to obtain a JS wrapper object, and then wrap the JS wrapper object into a JS distributed data object to obtain the JS distributed data object.
[0144] The JS programming framework is further used to invoke the distributed in-memory database in the system library and store the retrieved JS distributed data objects in the distributed in-memory database.
[0145] When electronic device 100 establishes a collaboration connection to electronic device 200, the JS programming framework creates a session ID and associates the session ID with instance 1 of the distributed data object.
[0146] Then, when electronic device 100 sends a collaboration message to electronic device 200, the collaboration message carries the session ID.
[0147] After receiving the adjustment message, the electronic device 200 obtains the session ID carried in the adjustment message through analysis, and based on the session ID, the electronic device 100 stores the session ID. Next, the electronic device 100 sends instance 1 of the distributed data object to the electronic device 200. After receiving instance 1, the electronic device 200 generates a distributed data object based on instance 1. Furthermore, the electronic device 200 associates the local instance 1 with the session ID. The instance 1 on the electronic device 100 and the instance 1 on the electronic device 200 are associated with the same session ID. In this way, after an attribute value of instance 1 on the electronic device 100 changes (e.g., is added, deleted, queried, or modified), the attribute value of instance 1 on the electronic device 200 also changes accordingly.
[0148] The Android Runtime includes the kernel library and virtual machine, and is responsible for scheduling and managing the Android system.
[0149] The kernel library includes two parts: the functions that need to be called in the java language and the Android kernel library.
[0150] The application layer and the application framework layer run on a virtual machine. The virtual machine executes the java files of the application layer and the application framework layer as binary files. The virtual machine is configured to implement functions such as object lifecycle management, stack management, thread management, security and exception management, and garbage collection.
[0151] The system library may include multiple functional modules, such as a surface manager, a media library, a three-dimensional graphics processing library (e.g., OpenGL ES), a 2D graphics engine (e.g., SGL), and a distributed in-memory database.
[0152] The surface manager is configured to manage the display subsystem and provide a blend of 2D and 3D layers for multiple applications.
[0153] The media library supports playback and recording in multiple commonly used audio and video formats, as well as still image files. The media library can support multiple audio and video encoding formats, for example, MPEG-4, H.264, MP3, AAC, AMR, JPG, and PNG.
[0154] The 3D graphics processing library is configured to implement 3D graphics drawing, image rendering, compositing, layer processing, and the like.
[0155] The 2D graphics engine is a drawing engine for 2D drawing.
[0156] A distributed in-memory database provides the ability to manage distributed databases, synchronize distributed databases across electronic devices, and access (add, delete, modify, and query) distributed data objects.
[0157] The kernel layer is a layer between the hardware and the software, and includes at least a display driver, a camera driver, an audio driver, and a sensor driver.
[0158] The following describes an example of the software and hardware working process of the electronic device 100 with reference to a shooting scenario.
[0159] When the touch sensor 180K receives a touch operation, a corresponding hardware interrupt is sent to the kernel layer. The kernel layer processes the touch operation into an original input event (including information such as touch coordinates and a timestamp of the touch operation). The original input event is stored in the kernel layer. The application framework layer obtains the original input event from the kernel layer and identifies a control corresponding to the input event. An example is used in which the touch operation is a tap operation and the control corresponding to the tap operation is a control of a camera application icon. The camera application calls an interface of the application framework layer to enable the camera application, then enables the camera driver by calling the kernel layer, and captures still images or videos by using the camera 193.
[0160] The following describes the functional modules of the JS programming framework provided in this application.
[0161] FIG. 5 is an exemplary diagram of functional modules of a JS programming framework according to one embodiment of the present application.
[0162] The functional module diagram of the JS programming framework in FIG. 5 is a diagram of the functional modules on the collaboration initiation device side.
[0163] As shown in FIG. 5, the JS programming framework includes a distributed data object creation module 401, a distributed data object synchronization module 402, and a distributed data object monitoring module 403.
[0164] It should be noted that multiple function modules may exist independently to implement preset functions, or any two or more function modules may be combined to implement the preset functions of the two or more function modules, which is not limited in this embodiment of the present application.
[0165] In some embodiments, the distributed data object creation module 401 is configured to receive a data object generated by application 1, redefine the data object transferred by the application through data interception by getter / setter methods to obtain a wrapper object, and wrap the wrapper object into a distributed data object.
[0166] Data interception is the use of a pre-configured code function to perform additional operations when accessing or modifying a specific instance attribute of a data object is intercepted. For example, after the distributed data object creation module 401 obtains data object 1, the distributed data object creation module 401 invokes a getter method to obtain the attribute value of instance 1 of data object 1. The distributed data object creation module 401 then invokes a setter method to add data listening and data interception to the attribute value of instance 1. In this way, when the attribute value of instance 1 changes, the distributed data object creation module 401 can detect the change in the attribute value of instance 1 and then update the attribute value of instance 1 in a timely manner.
[0167] The distributed data object creation module 401 sends the distributed data object to application 1. After application 1 obtains the distributed data object, application 1 can perform an operation on the distributed data object (e.g., perform a value update operation on the distributed data object).
[0168] The data object may be a JS (java script) data object. The distributed data object creation module 401 can redefine the JS data object through JS data interception according to a getter method or a setter method to obtain a final JS wrapper object, and then wrap the JS wrapper object into a distributed data object to obtain a JS distributed data object. In the following embodiments of the present application, an example in which the data object is a JS data object is used for description. The JS distributed data object may also be referred to as a distributed data object in the following embodiments of the present application.
[0169] In some embodiments, the distributed data object creation module 401 is further configured to generate a session ID and associate the session ID with the instance corresponding to the distributed data object.
[0170] In some embodiments, the distributed data object creation module 401 invokes a cross-device communication module (not shown in FIG. 5 ) to send the session ID to the peer device (or the device accepting the collaboration). After receiving the session ID, the peer device associates the session ID with instance 1 of application 1. In this way, after instance 1 on the local device (or collaboration-initiating device) and instance 1 on the peer device are associated with the same session ID, the attribute value of instance 1 on electronic device 100 changes, and the attribute value of instance 1 on electronic device 200 changes, data synchronization between different devices is implemented.
[0171] After the distributed data object creation module 401 obtains the distributed data object, the distributed data object creation module 401 sends the distributed data object to the distributed data object synchronization module 402 and the distributed data object monitoring module 403 separately.
[0172] The distributed data object synchronization module 402 is configured to store the distributed data objects in a distributed in-memory database in a key-value format.
[0173] [Table 1]
[0174] Table 1 shows an exemplary storage format of distributed data objects in a distributed database. For example, distributed data object 1 includes field 1 and field 2. Field 1 is stored in a distributed content database named kv store1, and the attribute value of field 1 stored in kv store1 is key1. Field 2 is stored in a distributed content database named kv store1, and the attribute value of field 2 stored in kv store1 is key2. Distributed data object 2 includes field 3 and field 4. Field 3 is stored in a distributed content database named kv store2, and the attribute value of field 3 stored in kv store2 is key3. Field 4 is stored in a distributed content database named kv store2, and the attribute value of field 4 stored in kv store2 is key4. Distributed data object n includes field 5 and field 6. Field 5 is stored in a distributed content database named kv store n, and the attribute value of field 5 stored in kv store n is key5. Field 6 is stored in a distributed content database named kv store n, and the attribute value of field 6 stored in kv store n is key6.
[0175] The distributed data object monitoring module 403 is configured to monitor whether an attribute value of a distributed data object has changed. If the attribute value has changed, the distributed data object monitoring module 403 sends the changed distributed data object to the distributed data object synchronization module 402.
[0176] The distributed data object synchronization module 402 is further configured to receive the changed distributed data object sent by the distributed data object monitoring module 403 and store the changed distributed data object in a distributed in-memory database in key-value format.
[0177] In some embodiments, the distributed data object synchronization module 402 can simultaneously store the changed and pre-change distributed data objects in the distributed in-memory database, or the distributed data object synchronization module 402 can replace the pre-change distributed data object with the changed distributed data object. Based on this, the distributed data object synchronization module 402 stores only the changed distributed data object and does not store the pre-change distributed data object.
[0178] FIG. 6 is an exemplary interaction diagram of collaboration between electronic device 100 and electronic device 200. As shown in FIG.
[0179] Electronic device 100 includes an application 601, a JS programming framework 602, a communication module 603, and a distributed in-memory database 604. Electronic device 200 includes an application 605, a JS programming framework 606, a communication module 607, and a distributed in-memory database 608.
[0180] It should be noted that application 601 and application 605 may be the same application, for example, both being the same map application. Alternatively, application 601 and application 605 may be different applications of the same type. For example, both application 601 and application 605 may be applications that provide navigation services, but application 601 and application 605 are not applications developed by the same developer. In the following embodiments of the present application, an example in which application 601 and application 605 are the same application (for example, both are application 1) is used for explanation.
[0181] For example, this embodiment of the present application is described by using an example in which electronic device 100 is a collaboration initiating device and electronic device 200 is a collaboration accepting device.
[0182] The steps of the collaboration interaction between the electronic device 100 and the electronic device 200 are as follows.
[0183] 1. When electronic device 100 initiates collaboration with electronic device 200, application 601 in the electronic device creates a data object and sends the data object to JS programming framework 602.
[0184] In some embodiments, step 1 may alternatively be performed after electronic device 100 receives a message sent by electronic device 200 indicating an agreement to establish a collaboration connection. That is, step 1 may occur after step 4.
[0185] 2. When the electronic device 100 initiates a collaboration with the electronic device 200, the JS programming framework 602 in the electronic device 100 is configured to generate a distributed data object and a session ID associated with an instance corresponding to the distributed data object and send the session ID to the communication module 603 in the electronic device 100.
[0186] 3. After the communication module 603 receives the session ID, the communication module 603 sends a collaboration message to the electronic device 200 (e.g., the communication module 607 in the electronic device 200), which is used to request establishing a collaboration connection to the electronic device 200.
[0187] In some embodiments, the collaboration message further carries a session ID.
[0188] In some embodiments, the collaboration message may not carry the session ID, and the communication module 603 in the electronic device 100 separately transmits the session ID to the electronic device 200, for example, to the communication module 607 in the electronic device 200.
[0189] The step of the communication module 603 separately transmitting the session ID to the communication module 607 may be performed after the electronic device 100 receives the message sent by the electronic device 200 indicating an agreement to establish the collaboration connection. For example, after step 4 and before step 8, the communication module 603 may separately transmit the session ID to the communication module 607.
[0190] In some embodiments, electronic device 100 may perform the step of transmitting the session ID to communication module 607 only once. For example, electronic device 100 transmits the session ID to communication module 607 only once.
[0191] In some embodiments, the electronic device 100 may periodically perform the step of transmitting the session ID to the communication module 607, such that the electronic device 100 periodically transmits the session ID to the electronic device 200. In this way, a case where the electronic device 200 does not receive the session ID can be avoided because the electronic device 100 transmits the session ID only once.
[0192] 4. After the communication module 607 receives the collaboration message sent by the electronic device 100, the electronic device 200 decides to establish a collaboration connection to the electronic device 100. In this case, the electronic device 200 can send a message to the electronic device 100 (e.g., the communication module 603 on the electronic device 100) indicating an agreement to establish the collaboration connection.
[0193] 5. After the communication module 603 receives the message sent by the electronic device 200 indicating an agreement to establish a collaboration connection, the communication module 603 sends a collaboration start command to the JS programming framework 602, and the collaboration start command instructs the JS programming framework 602 to wrap the data object into a distributed data object through data interception and send the distributed data object to the electronic device 200, so that the electronic device 100 starts collaboration with the electronic device 200.
[0194] 6. After the JS programming framework 602 in the electronic device 100 receives the collaboration start command, the JS programming framework 602 is configured to wrap the data object into a distributed data object through data interception and store the distributed data object and the session ID in the distributed in-memory database 604.
[0195] After the distributed in-memory database 604 receives the distributed data object and the session ID, the distributed in-memory database 604 stores the distributed data object in the distributed in-memory database 604 in a key-value format. In some embodiments, the distributed in-memory database 604 further needs to associate the session ID with the instance of the distributed data object. For how to associate the session ID with the instance of the distributed data object, please refer to the related description of step 9. Details will not be described herein in this embodiment of the present application.
[0196] In some embodiments, step 6 may be performed at any time after step 1 begins and before step 5 begins. JS programming framework 602 wraps the data objects generated by application 601 into distributed data objects in advance. This can avoid the case where the JS programming framework starts wrapping the data objects generated by the application into distributed data objects after receiving a collaboration start command. Based on this, the method provided in the embodiment of the present application can avoid collaboration delays.
[0197] 7. After the distributed in-memory database 604 retrieves the distributed data object, the distributed in-memory database 604 sends the distributed data object to the communication module 603 .
[0198] In some embodiments, step 7 may be performed at a time point after JS programming framework 602 obtains the distributed data object. This can avoid the case where JS programming framework 602 starts sending the distributed data object to communication module 603 only after receiving a collaboration start command. Based on this, the method provided in the embodiments of the present application can avoid collaboration delays.
[0199] 8. The communication module 603 transmits the distributed data to the communication module 607 on the electronic device 200.
[0200] The distributed data includes the type of the data object and the attribute values of the instances of the data object.
[0201] In some embodiments, step 8 may occur immediately after step 4. Electronic device 100 prepares the distributed data object in advance and immediately transmits the distributed data object to communication module 607 on electronic device 200 after receiving a message indicating an agreement to establish a collaboration connection. In this way, collaboration delays can be reduced.
[0202] 9. After receiving the session ID, the communication module 607 sends the distributed data and the session ID to the JS programming framework 606 on the electronic device 200.
[0203] In some embodiments, the communication module 607 may send the distribution data and the session ID separately to the JS programming framework 606 .
[0204] In some embodiments, the communication module 607 may send the distribution data and the session ID to the JS programming framework 606 simultaneously.
[0205] In some embodiments, the communication module 607 may send the session ID to the JS programming framework 606 after step 4 and before step 9.
[0206] After receiving the distributed data, the JS programming framework 606 generates a distributed data object based on the attribute values of the data object instance.
[0207] After receiving the distributed data and the session ID, the JS programming framework 606 associates the instance of the data object with the session ID. Different instances are associated with different session IDs, and as a result, the session ID associated with any two instances that are the same on electronic device 100 and electronic device 200 is the same. The data of two instances that are the same on electronic device 100 and electronic device 200 is consistent. In this way, after a data object in instance 1 on electronic device 100 changes, instance 1 on electronic device 200 also changes. Data synchronization is implemented when electronic device 100 cooperates with electronic device 200.
[0208] 10. The JS programming framework 606 sends the distributed data objects to a distributed in-memory database 608.
[0209] After the distributed in-memory database 608 receives the distributed data object, the distributed in-memory database 608 stores the distributed data object in the distributed in-memory database 608 in a key-value format.
[0210] Specifically, FIGS. 7-9 are exemplary UI diagrams in which any two instances of a group of two collaboration devices are associated with the same session ID.
[0211] It should be noted that there may be more than one type of data object in the distributed data sent by electronic device 100 to electronic device 200 .
[0212] In some embodiments, data objects of the same type may also contain instances of one or more different types.
[0213] Electronic device 100 establishes a collaboration connection to electronic device 200. Electronic device 100 creates a distributed data object based on the JS programming framework provided in this embodiment of the present application by using the data object generated by application 1. There may be one or more data types of the distributed data object.
[0214] For example, as shown in FIG. 7, if a distributed data object (data object 1) has one data type, one instance of data object 1 exists. Alternatively, data object 1 has multiple instances, but the types of the different instances are not distinguished. In this case, one instance of a distributed data object having multiple instances of different types also exists. The electronic device 100 creates session ID-1 by using the JS programming framework and associates session ID-1 with instance 1. Then, the electronic device 100 sends the attribute values of instance 1, the data object type, and session ID-1 to the electronic device 200. After receiving instance 1 and the data object type, the electronic device 200 generates data object 1 based on instance 1 and the data object type and associates instance 1 on the electronic device 200 with session ID-1. In this way, if a distributed data object has one data type, instance 1 on the electronic device 100 and instance 2 on the electronic device 200 are associated with the same session ID (session ID-1). In this way, after a data object of instance 1 on electronic device 100 changes, the data object of instance 2 on electronic device 200 also changes. Data synchronization is implemented when electronic device 100 cooperates with electronic device 200.
[0215] 8, if a distributed data object (data object 1) has one data type and data object 1 has multiple instances, it is necessary to distinguish between the instances of the distributed data object having multiple instances of different types. In addition, the electronic device 100 creates multiple different session IDs by using a JS programming framework and sends the multiple different session IDs, attribute values of the different instances, and types of the data object to the electronic device 200. After receiving the multiple different session IDs, attribute values of the different instances, and types of the data object, the electronic device 200 generates data object 1 based on the attribute values of the different instances and the types of the data object, and associates the same instance as the instance on the electronic device 100 with the same session ID.
[0216] For example, as shown in FIG. 8 , data object 1 has n instance types. The electronic device 100 creates n different session IDs by using a JS programming framework, and associates instance 1 with session ID-1, instance 2 with session ID-2, and instance n with session ID-n. Next, the electronic device 100 transmits the multiple different session IDs, the attribute values of the different instances, and the types of the data object to the electronic device 200. The electronic device 100 generates data object 1 based on the attribute values of instance 1, instance 2, and instance n. The electronic device 200 then associates instance 1 with session ID-1, instance 2 with session ID-2, and instance n with session ID-n. In this way, when the same data object has n instance types, the same instances on the electronic device 100 and the electronic device 200 are associated with the same session ID.
[0217] In this manner, after an attribute value of any instance on electronic device 100 changes, the attribute value of the instance associated with the same session ID on electronic device 200 also changes. For example, after an attribute value of instance 1 on electronic device 100 changes, the attribute value of instance 1 on electronic device 200 also changes. Data synchronization is implemented when electronic device 100 cooperates with electronic device 200.
[0218] 9, when a data object has multiple data types (two or more), each type of data object has multiple instances. The electronic device 100 creates multiple different session IDs by using a JS programming framework and sends the multiple different session IDs, attribute values of the different instances, and types of the data object to the electronic device 200. After receiving the multiple different session IDs, attribute values of the different instances, and types of the data object, the electronic device 200 generates a data object 1 based on the attribute values of the different instances and the types of the data object, and associates the same instance as the instance on the electronic device 100 with the same session ID.
[0219] For example, as shown in FIG. 9 , there are n types of instances of data object 1. The electronic device 100 creates n different session IDs by using a JS programming framework, and associates instance 1 with session ID-1, instance 2 with session ID-2, and instance n with session ID-n. The electronic device 100 then transmits the multiple different session IDs, the attribute values of the different instances, and the types of the data object to the electronic device 200. The electronic device 200 generates data object 1 based on the attribute values of instance 1, instance 2, and instance n. The electronic device 200 then associates instance 1 with session ID-1, instance 2 with session ID-2, and instance n with session ID-n. In this way, when the same data object has n instance types, the same instances on the electronic device 100 and the electronic device 200 are associated with the same session ID.
[0220] There are m types of instances of data object 2. The electronic device 100 creates m different session IDs by using a JS programming framework, and associates instance n+1 with session ID-n+1, instance n+2 with session ID-n+2, and instance n+m with session ID-n+m. Next, the electronic device 100 transmits the multiple different session IDs, attribute values of the different instances, and types of data objects to the electronic device 200. The electronic device 200 generates data object 2 based on the attribute values of instance n+1, instance n+2, and instance n+m. Then, the electronic device 200 associates instance n+1 with session n+1, instance n+2 with session ID-n+2, and instance n+m with session ID-n+m.
[0221] In this way, if a data object has multiple data types, the same instance on electronic device 100 and electronic device 200 is associated with the same session ID. Data synchronization is implemented when electronic device 100 cooperates with electronic device 200.
[0222] 7-9 are exemplary UI diagrams in which any two instances of two collaboration devices in a group are associated with the same session ID. In another embodiment, multiple devices (more than two devices) can establish a collaboration connection simultaneously. When multiple devices establish a collaboration connection simultaneously, any two instances of the multiple devices can be associated with the same session ID to implement data synchronization.
[0223] 10 to 12 are examples of UI diagrams in which any two instances of multiple collaboration devices in a group are associated with the same session ID.
[0224] In an embodiment of the present application, a principle is described in which when three devices (e.g., electronic device 100, electronic device 200, and electronic device 300) establish a collaboration connection simultaneously, data synchronization is implemented by associating the instances with the same session ID.
[0225] In some embodiments, the electronic device 300 may be referred to as a third electronic device.
[0226] For example, as shown in FIG. 10, electronic device 100 is a collaboration initiating device, and electronic device 200 and electronic device 300 are collaboration accepting devices.
[0227] If the data object (data object 1) has one data type and the data object also has one instance type, the electronic device 100 creates session ID-1 by using the JS programming framework and associates session ID-1 with instance 1. Then, the electronic device 100 sends the attribute values of instance 1 and session ID-1 to the electronic device 200 and the electronic device 300 separately.
[0228] After receiving the attribute values of instance 1 and session ID-1, electronic device 200 generates data object 1 based on the attribute values of instance 1 and associates instance 1 with session ID-1. In this way, instance 1 on electronic device 100 and instance 1 on electronic device 200 are associated with the same session ID (session ID-1).
[0229] Similarly, after receiving the attribute values of instance 1 and session ID-1, electronic device 300 generates data object 1 based on the attribute values of instance 1 and associates instance 1 with session ID-1. In this way, instance 1 on electronic device 300 and instance 1 on electronic device 100 are associated with the same session ID (session ID-1).
[0230] Instance 1 on electronic device 100, instance 1 on electronic device 200, and instance 1 on electronic device 300 are associated with the same session ID.
[0231] In this manner, after a data object of an instance of electronic device 100 changes, the data objects of the instances associated with the same session ID on electronic device 200 and electronic device 300 also change. For example, after a data object of instance 1 on electronic device 100 changes, the data object of instance 1 on electronic device 200 and the data object of instance 1 on electronic device 300 also change. Data synchronization is implemented when electronic device 100 cooperates with electronic device 200 and electronic device 300.
[0232] For example, as shown in FIG. 11, electronic device 100 is a collaboration initiating device, and electronic device 200 and electronic device 300 are collaboration accepting devices.
[0233] Data object 1 has multiple instances. Instances of a distributed data object having different types of instances need to be distinguished. In addition, electronic device 100 creates multiple different session IDs by using a JS programming framework and transmits the multiple different session IDs and attribute values of the multiple different instances to electronic device 200 and electronic device 300. After receiving the multiple different session IDs and attribute values of the multiple different instances, electronic device 200 generates data object 1 based on the attribute values of the multiple different instances and associates the same instance on electronic device 200 with the same session ID. After receiving the multiple different session IDs and attribute values of the multiple different instances, electronic device 300 generates data object 1 based on the attribute values of the multiple different instances and associates the same instance on electronic device 300 with the same session ID.
[0234] For example, as shown in Figure 11, there are n types of instances of data object 1. The electronic device 100 creates n different session IDs by using a JS programming framework, and associates instance 1 with session ID-1, instance 2 with session ID-2, and instance n with session ID-n. Then, the electronic device 100 transmits the multiple different session IDs and attribute values of the different instances to the electronic device 200 and the electronic device 300. The electronic device 200 generates data object 1 based on the attribute values of instance 1, instance 2, and instance n. Then, the electronic device 200 associates instance 1 with session ID-1, instance 2 with session ID-2, and instance n with session ID-n.
[0235] Similarly, the electronic device 300 generates a data object 1 based on the attribute values of instance 1, instance 2, and instance n. The electronic device 300 then associates instance 1 with session ID-1, instance 2 with session ID-2, and instance n with session ID-n.
[0236] In this way, if the same data object has n instance types, the same instance on electronic device 100, electronic device 200, and electronic device 300 are associated with the same session ID. In this way, after a data object of any instance on electronic device 100 changes, the data object of the instances associated with the same session ID on electronic device 200 and electronic device 300 also changes. For example, after a data object of instance 1 on electronic device 100 changes, the data object of instance 1 on electronic device 200 and the data object of instance 1 on electronic device 300 also change. Data synchronization is implemented when electronic device 100 cooperates with electronic device 200 and electronic device 300.
[0237] It should be noted that the embodiments of the present application are not limited to two or three devices establishing a collaboration connection simultaneously, and more devices may establish a collaboration connection simultaneously, and the number of devices establishing a collaboration connection simultaneously is not limited in the embodiments of the present application.
[0238] In some embodiments, when electronic device 100 establishes collaboration connections to multiple other devices, electronic device 100 can send different types of data objects to the different collaboration devices.
[0239] For example, as shown in FIG. 12, electronic device 100 is a collaboration initiating device, and electronic device 200 and electronic device 300 are collaboration accepting devices.
[0240] Data object 1 has multiple instances. Instances of a distributed data object having different types of instances need to be distinguished. In addition, electronic device 100 creates multiple different session IDs by using a JS programming framework and transmits the multiple different session IDs and attribute values of the multiple different instances to electronic device 200. After receiving the multiple different session IDs and attribute values of the multiple different instances, electronic device 200 generates data object 1 based on the attribute values of the multiple different instances and associates the same instance on electronic device 200 with the same session ID. After receiving the multiple different session IDs and attribute values of the multiple different instances, electronic device 300 generates data object 1 based on the attribute values of the multiple different instances and associates the same instance on electronic device 300 with the same session ID.
[0241] For example, as shown in FIG. 12 , the electronic device 100 collaborates with the electronic device 300 based on a data object 1. There are n types of instances of the data object 1. The electronic device 100 creates n different session IDs by using a JS programming framework, and associates instance 1 with session ID-1, instance 2 with session ID-2, and instance n with session ID-n. Then, the electronic device 100 transmits the different session IDs and attribute values of the different instances to the electronic device 300. The electronic device 300 generates a data object 1 based on the attribute values of instance 1, instance 2, and instance n. Then, the electronic device 300 associates instance 1 with session ID-1, instance 2 with session ID-2, and instance n with session ID-n.
[0242] For example, as shown in FIG. 12 , the electronic device 100 collaborates with the electronic device 200 based on the data object 2. There are m types of instances of the data object 2. The electronic device 100 creates m different session IDs by using a JS programming framework, and associates instance n+1 with session ID-n+1, instance n+2 with session ID-n+2, and instance n+m with session ID-n+m. Next, the electronic device 100 transmits the multiple different session IDs and attribute values of the different instances to the electronic device 200. The electronic device 200 generates the data object 2 based on the attribute values of instance n+1, instance n+2, and instance n+m. Then, the electronic device 200 associates instance n+1 with session ID-n+1, instance n+2 with session ID-n+2, and instance n+m with session ID-n+m.
[0243] 11. The distributed in-memory database 608 sends the distributed data object to the application 605 on the electronic device 200.
[0244] After the application 605 receives the distributed data object, the application 605 outputs the distributed data object and the electronic device 200 initiates collaboration with the electronic device 100 .
[0245] In some embodiments, when there are multiple (e.g., three) devices that simultaneously establish a collaboration connection, for example, when electronic device 100 establishes a collaboration connection to electronic device 200, electronic device 100 further establishes a collaboration connection to electronic device 300, and how electronic device 300 performs collaboration interaction with electronic device 100 is shown in FIG. 6 , which illustrates how electronic device 200 performs collaboration interaction with electronic device 100. The principle is similar. Details are not described herein in the embodiments of the present application.
[0246] After the application on electronic device 300 obtains the distributed data object sent by electronic device 100, electronic device 300 can output the distributed data object, and electronic device 300 begins to collaborate with electronic device 100. Electronic device 100, electronic device 200, and electronic device 300 simultaneously establish a collaboration connection.
[0247] It should be noted that session identifiers, for example, session ID-1, session ID-2, ..., session ID-n, session ID-n+1, session ID-n+2, ..., and session ID-n+m, are different from one another, and the session identifiers are used merely to indicate that different instances are associated with different session identifiers. In another embodiment, the session identifiers may be expressed in other formats. This is not limited to the embodiments of the present application.
[0248] Note that some of steps 1 to 10 may be deleted or replaced. Alternatively, some of steps 1 to 10 may be executed before or after another step. The execution sequence of steps 1 to 10 shown in FIG. 6 is merely an exemplary diagram for describing collaboration between the electronic device 100 and the electronic device 200 and should not be construed as limiting.
[0249] The above embodiment describes a process for implementing collaboration between devices. After the devices establish a collaboration connection, the data object on application 1 may change (e.g., the attribute value of an instance in the data object is updated). In this case, the attribute value of the corresponding instance on electronic device 200 may also change to implement data synchronization between the collaborating devices. The following describes a specific implementation for implementing data synchronization between the collaborating devices.
[0250] FIG. 13 is a diagram illustrating an implementation of data synchronization between collaboration devices.
[0251] Data synchronization between collaboration devices mainly includes the following steps:
[0252] 1. The application 601 sends the mutated data object to the JS programming framework 602.
[0253] Compared to the data object before the change, the type of the changed data object does not change, but the attribute value of the data object instance changes. For example, for data object 1, the attribute value of instance 1 of the data object before the change is a first value, and the attribute value of instance 1 of the changed data object is a second value.
[0254] 2. The JS programming framework 602 wraps the mutated data object into a mutated distributed data object through data interception and stores the mutated distributed data object in a key-value format in the distributed in-memory database 604.
[0255] 3. The distributed in-memory database 604 sends the changed distributed data object and the session identifier corresponding to the changed distributed data object to the communication module 603.
[0256] 4. The communication module 603 sends the changed distributed data and the session identifier corresponding to the changed distributed data object to the communication module 607.
[0257] The changed distributed data includes the changed attribute values of the instances and types of the data objects.
[0258] The distributed in-memory database 604 listens to the instance attributes of the distributed data object and monitors whether the instance attributes of the distributed data object have changed, and if the instance attributes of the distributed data object have changed, the distributed in-memory database 604 sends the changed distributed data object and a session identifier corresponding to the changed distributed data object to the communication module 603.
[0259] The distributed in-memory database 604 sends the changed distributed data object to the communication module 603, which in turn sends the changed distributed data object to the electronic device 200. The electronic device 200 then updates the distributed data object.
[0260] The distributed in-memory database 604 transmits a session identifier corresponding to the changed distributed data object to the communication module 603, which then transmits the session identifier corresponding to the changed distributed data object to the electronic device 200. The electronic device 200 then determines an instance identifier associated with the received session identifier on the electronic device 200 based on the received session identifier and replaces the attribute value of the instance corresponding to the instance identifier with the changed attribute value. The electronic device 200 generates the changed distributed data object based on the changed attribute value of the instance.
[0261] In some embodiments, step 3 above may be replaced with the following steps:
[0262] The distributed in-memory database 604 sends the changed distributed data object and the instance identifier to the communication module 603 .
[0263] In some embodiments, step 4 above may be replaced with the following step:
[0264] The communication module 603 transmits the changed distribution data and the instance identifier to the communication module 607 .
[0265] The communication module 603 transmits the instance identifier to the electronic device 200. The electronic device 200 can also determine the instance on the electronic device 200 based on the instance identifier and replace the attribute value of the instance with the changed attribute value. The electronic device 200 generates a changed distributed data object based on the changed attribute value of the instance.
[0266] 5. After receiving the mutated distributed data, the communication module 607 sends the mutated distributed data and the session identifier to the JS programming framework 606 on the electronic device 200.
[0267] In some embodiments, the communication module 607 may send the changed distribution data and the session identifier (session ID) separately to the JS programming framework 606 .
[0268] In some embodiments, the communication module 607 may send the distribution data and the session ID to the JS programming framework 606 simultaneously.
[0269] After the JS programming framework 606 receives the mutated distributed data, the JS programming framework 606 generates the mutated distributed data object based on the instance's changed attribute values.
[0270] Specifically, after JS programming framework 606 receives the mutated distributed data object and the session ID, JS programming framework 606 determines an instance identifier associated with the received session ID and replaces the attribute value of the instance corresponding to the instance identifier with the mutated attribute value. JS programming framework 606 generates a mutated distributed data object based on the mutated attribute value of the instance.
[0271] 6. The JS programming framework 606 sends the mutated distributed data objects to the distributed in-memory database 608.
[0272] After the distributed in-memory database 608 receives the changed distributed data object, the distributed in-memory database 608 stores the changed distributed data object locally in a key-value format.
[0273] 7. The distributed in-memory database 608 sends the changed distributed data object to the application 605.
[0274] After application 605 receives the mutated distributed data object, application 605 can output the mutated distributed data object.
[0275] In this way, after a data object on electronic device 100 changes, the data object on electronic device 200 also changes accordingly. In this way, data synchronization between devices is implemented.
[0276] FIG. 14 is an exemplary schematic flowchart of a device collaboration method according to an embodiment of the present application.
[0277] S1401. The electronic device 100 establishes a collaboration connection to the electronic device 200.
[0278] Electronic device 100 is a collaboration initiating device, and electronic device 200 is a collaboration accepting device.
[0279] Electronic device 100 can establish a collaboration connection to electronic device 200 in any one of the following ways:
[0280] Method 1: The electronic device 100 and the electronic device 200 are connected to the same network. For example, the electronic device 100 and the electronic device 200 may be connected to the same local area network to establish a collaboration connection.
[0281] Method 2: To establish a collaboration connection, the same system account is used to log in to electronic device 100 and electronic device 200. For example, the system account used to log in to multiple electronic devices may be “HW1234.”
[0282] Scheme 3: The system accounts used to log in to the electronic device 100 and the electronic device 200 may both belong to the same account group. For example, the system accounts used to log in to the electronic device 100 and the electronic device 200 include "HW001" and "HW002". The system accounts "HW001" and "HW002" belong to the account group "Huawei Home".
[0283] Method 4: The electronic device 100 may establish a collaboration connection to the electronic device 200 by methods such as Near Field Communication (NFC), Bluetooth (BT), wireless local area network (WLAN) such as wireless fidelity point to point (Wi-Fi P2P), or infrared (IR) technology.
[0284] Method 5: The electronic device 100 and the electronic device 200 may establish a temporary account group by scanning the same two-dimensional barcode to establish a collaboration connection for communication.
[0285] In addition to the above five methods, the electronic device 100 may alternatively establish a collaboration connection to the electronic device 200 in another manner, which is not limited in the embodiments of the present application.
[0286] In addition, the electronic device 100 and the electronic device 200 may alternatively be connected to and communicate with each other according to any number of combinations of the above-mentioned methods, which is not limited in the embodiments of the present application.
[0287] 1402. The electronic device 100 obtains a data object 1, the data object 1 includes an instance 1, and the attribute value of the instance 1 is a first value.
[0288] In some embodiments, data object 1 may be referred to as the first data object, instance 1 may be referred to as the first instance, and the first value of the attribute value of instance 1 may be referred to as the first instance attribute.
[0289] The electronic device 100 starts the application 1 and obtains the data object 1 of the instance 1, where the data object 1 includes the instance 1 and the attribute value of the instance 1 is a first value.
[0290] From the above embodiment, it can be seen that the application 1 may have multiple types of data objects, and each type of data object may have multiple instance types, which is not limited in the embodiment of the present application.
[0291] The electronic device 100 creates a distributed data object through data interception. The electronic device 100 can monitor the instance attribute values of the distributed data object and send only the changed instance attribute values to the electronic device 200. In this way, the amount of data transmitted is reduced and device collaboration efficiency is improved.
[0292] For example, data object 1 includes instance 1 and instance 2, and electronic device 100 can monitor the attribute values of instance 1 and instance 2. If electronic device 100 detects that the attribute value of instance 2 has changed and the attribute value of instance 1 has not changed, electronic device 100 can send only the changed attribute value of instance 2 to electronic device 200, and does not need to send the attribute value of instance 1 to electronic device 100. In this way, the amount of data transmitted between collaborating devices is reduced, and device collaboration efficiency is improved.
[0293] In some embodiments, instance 2 may also be referred to as a third instance, and the attribute values of instance 2 may also be referred to as third instance attributes.
[0294] In some embodiments, electronic device 100 acquires data object 1 and data object 2. Data object 1 includes instance 1 and instance 2, and data object 2 includes instance 3 and instance 4. Electronic device 100 can monitor changes in the instance attribute values of data object 1 and data object 2. If electronic device 100 detects that the attribute value of instance 3 has changed and the attribute value of instance 1 has not changed, electronic device 100 can send only data object 2 (instances 3 and 4) to electronic device 200, and there is no need to send data object 1 and data object 2 to electronic device 200. Only the changed data objects (instances 3 and 4) are sent to electronic device 200. In this way, the amount of data sent between collaboration devices can be reduced compared to a scheme in which electronic device 100 sends all data objects to electronic device 200.
[0295] In some embodiments, data object 2 may be referred to as a second data object, instance 3 may be referred to as a second instance, and the attribute values of instance 3 may be referred to as second instance attributes.
[0296] 1403. The electronic device 100 wraps data object 1 into distributed data object 1 through data interception and learns that the attribute value of the obtained instance 1 is the first value.
[0297] The electronic device 100 obtains the attribute value of the instance 1 through data interception. In this way, through data interception, it can monitor whether the attribute value of the instance 1 has changed, and can timely update the changed attribute value of the instance 1. This ensures data consistency between collaboration devices.
[0298] In some embodiments, electronic device 100 obtains the attribute value of instance 2 through data interception. In this way, electronic device 100 can monitor whether the attribute value of instance 2 has changed through data interception, and can timely update the changed attribute value of instance 2. This ensures data consistency between collaboration devices.
[0299] For example, the following shows a specific implementation of an interface for creating a distributed data object: var obj=distributed({ title:'Title', desc:'Description' })
[0300] It should be noted that in another embodiment, the name of the interface for creating a distributed data object may vary, but the principle remains the same, which is not limited in this embodiment of the present application.
[0301] After the electronic device 100 wraps the data object 1 into a distributed data object 1 through data interception, the electronic device 100 further needs to store the distributed data object 1 in a key-value format in a distributed database. For details, please refer to the related description in Table 1. The details will not be described again in this embodiment of the present application.
[0302] After the electronic device 100 creates the distributed data object 1, the electronic device 100 can further access the distributed data object.
[0303] For example, the following shows a specific implementation of an interface for accessing distributed data objects: console.info(obj.title)
[0304] It should be noted that in another embodiment, the name of the interface for accessing the distributed data object may vary, but the principle remains the same, which is not limited in this embodiment of the present application.
[0305] 1404. The electronic device 100 sends the attribute value of instance 1 to the electronic device 200.
[0306] In some embodiments, the electronic device 100 further obtains an instance 3 of the data object 2 , and the electronic device 100 sends attribute values of the instance 3 to the electronic device 200 .
[0307] In some embodiments, transmitting the attribute value of instance 1 by electronic device 100 to electronic device 200 may also be referred to as transmitting the attribute value of instance 1 by electronic device 100 to electronic device 200 via a first session. The session identifier of the first session is the first session identifier. Instance 1 is associated with the session identifier of the first session.
[0308] In some embodiments, electronic device 100 establishes a collaboration connection to electronic device 200, and electronic device 100 sends a collaboration message to electronic device 200. The collaboration message includes the instance identifier of instance 1 and the session identifier of the first session. The session identifier of the first session is associated with instance 1. In this manner, electronic device 100 associates instance 1 with the session identifier of the first session, and as a result, after receiving the session identifier of the first session, electronic device 200 associates instance 1 on electronic device 200 with the session identifier of the first session. In this manner, the same session identifier is associated with two instances that are the same on electronic device 100 and electronic device 200. This ensures consistency of attributes of the two instances that are the same on electronic device 100 and electronic device 200 and ensures consistency of collaboration data.
[0309] In some embodiments, transmitting the attribute value of instance 3 by electronic device 100 to electronic device 200 may also be referred to as transmitting the attribute value of instance 3 by electronic device 100 to electronic device 200 via a second session. The session identifier of the second session is the second session identifier. Instance 3 is associated with the session identifier of the second session.
[0310] Electronic device 100 sends different types of instances to electronic device 200 through different sessions. The same instances on electronic device 100 and electronic device 200 are associated with the same session identifier. In other words, both instance 1 on electronic device 100 and instance 1 on electronic device 200 are associated with a first session identifier, and both instance 3 on electronic device 100 and instance 3 on electronic device 200 are associated with a second session identifier.
[0311] In some embodiments, electronic device 100 further acquires instance 2 of data object 1, and electronic device 100 transmits attribute values of instance 2 to electronic device 200 via the first session. Electronic device 200 generates distributed data object 1 based on the attribute values of instance 1 and instance 2. In this manner, if data object 1 includes two types of instances, electronic device 100 transmits both instance 1 and instance 2 to electronic device 200 via the first session. In other words, data objects that are the same on electronic device 100 and electronic device 200 are associated with the same session identifier, and different types of instances included in the same type of data object are not distinguished. When an attribute of data object 1 on electronic device 100 changes, electronic device 100 transmits the changed data object 1 to electronic device 200.
[0312] In some embodiments, electronic device 100 further acquires instance 2 of data object 1, and electronic device 100 transmits attribute values of instance 2 to electronic device 200 via a third session. Electronic device 200 generates distributed data object 1 based on the attribute values of instance 1 and instance 2. In this manner, if data object 1 includes two types of instances, electronic device 100 transmits instance 1 and instance 2 separately to electronic device 200 via different sessions. In other words, two instances that are the same on electronic device 100 and electronic device 200 are associated with the same session identifier, and different types of instances included in the same type of data object are distinguished. When an attribute of instance 1 on electronic device 100 changes, electronic device 100 transmits only the changed attribute of instance 1 to electronic device 200, and does not need to transmit the attribute value of instance 2. This reduces the amount of data transmitted between collaboration devices and improves collaboration efficiency.
[0313] In some embodiments, a first electronic device establishes a collaboration connection to a second electronic device and a third electronic device, the first electronic device sends a first instance attribute to the third electronic device over a fourth session and a second instance attribute to the third electronic device over a fifth session, the first instance attribute being used by the third electronic device to generate a first data object and the second instance attribute being used by the third electronic device to generate a second data object.
[0314] The session identifier of the fourth session is the fourth session identifier, and the session identifier of the fifth session is the fifth session identifier. The fourth session identifier may be session ID-1 shown in Figure 11, and the fifth session identifier may be session ID-n shown in Figure 11. For details, please refer to the related description of Figure 11.
[0315] Sending the first instance attribute to the third electronic device via the fourth session and sending the second instance attribute to the third electronic device via the fifth session by the first electronic device may be understood as associating the first instance on the first electronic device with the fourth session identifier and associating the second instance on the first electronic device with the fifth session identifier by the first electronic device. The first electronic device sends the first instance identifier and the fourth session identifier to the third electronic device, and the first electronic device sends the second instance identifier and the fifth session identifier to the third electronic device. The third electronic device associates the first instance on the third electronic device with the fourth session identifier. The third electronic device associates the second instance on the third electronic device with the fifth session identifier. In other words, both the first instance on the first electronic device and the first instance on the third electronic device are associated with a fourth session identifier, and both the second instance on the first electronic device and the second instance on the third electronic device are associated with a fifth session identifier.
[0316] In this way, three electronic devices can simultaneously establish collaboration connections, and the attributes of the same instance on multiple devices are the same, ensuring the consistency of collaboration data.
[0317] In some embodiments, a first electronic device establishes a collaboration connection to a second electronic device and a third electronic device. The first electronic device generates a third data object. The first electronic device obtains a fourth instance attribute of the third data object. The first electronic device sends the fourth instance attribute to the third electronic device over a sixth session, and the fourth instance attribute is used by the third electronic device to generate the third data object.
[0318] The session identifier of the sixth session is a sixth session identifier. The sixth session identifier may be any one of session ID-n+1, session ID-n+2, ..., and session ID-n+m shown in Figure 12. The fourth instance attribute may be any one of instance n+1, instance n+2, ..., and instance n+m shown in Figure 12. For details, please refer to the related description of Figure 12.
[0319] The first electronic device transmitting the fourth instance attribute to the third electronic device via the sixth session may be understood as the first electronic device associating the fourth instance on the first electronic device with the sixth session identifier. The first electronic device then transmits the fourth instance identifier and the sixth session identifier to the third electronic device. The third electronic device associates the fourth instance on the third electronic device with the sixth session identifier. In other words, both the fourth instance on the first electronic device and the fourth instance on the third electronic device are associated with the sixth session identifier.
[0320] In this way, when the first electronic device establishes collaboration connections to multiple different electronic devices, the first electronic device can simultaneously transmit different collaboration data to the multiple different electronic devices, thereby improving the versatility of device collaboration capabilities.
[0321] 1405. The electronic device 200 generates a distributed data object 1 based on the attribute values of the instance 1 and outputs the distributed data object 1.
[0322] After receiving the attribute values of instance 1, the electronic device 100 generates a distributed data object 1 based on the attribute values of instance 1 and outputs the distributed data object 1.
[0323] After the electronic device 200 generates the distributed data object 1, the electronic device 200 further needs to store the distributed data object 1 in a distributed database in a key-value format. For details, please refer to the relevant description in Table 1. The details will not be described again in this embodiment of the present application.
[0324] After the electronic device 100 performs data collaboration with the electronic device 200, the electronic device 100 can further monitor the status of the data collaboration with the electronic device 200, and the electronic device 200 can also monitor the status of the data collaboration with the electronic device 100.
[0325] The data collaboration status includes data collaboration success and data collaboration failure. Data collaboration may fail because electronic device 100 is disconnected from electronic device 200, or data collaboration fails because the format of the distributed data object stored on electronic device 100 is different from the format of the distributed data object stored on electronic device 200.
[0326] For example, the following shows a specific implementation of an interface for monitoring data coordination failures: obj.on('sync-failer',(changedKeys:Array[string])=>{})
[0327] It should be noted that in another embodiment, the name of the interface for monitoring data collaboration failures may be changed, but the principle is similar, which is not limited in this embodiment of the present application.
[0328] 1406. The electronic device 100 associates instance 1 on the electronic device 100 and instance 1 on the electronic device 200 with the same session identifier (session identifier 1).
[0329] In some embodiments, session identifier 1 may also be referred to as the first session identifier, where the first session identifier is the session identifier of the first session.
[0330] In this way, the two instances that are the same on electronic device 100 and electronic device 200 are bound to the same session identifier, and the data of the two instances that are the same on electronic device 100 and electronic device 200 is consistent.
[0331] After the data for instance 1 on electronic device 100 changes, the data for instance 1 on electronic device 200 also changes correspondingly.
[0332] For specific implementations of how the electronic device 100 and the electronic device 200 associate two identical instances with the same session ID, please refer to the specific descriptions in Figures 7 to 12. The details will not be described again in this embodiment of the present application.
[0333] For example, the following shows a specific implementation of an interface for initiating a collaboration: session ID=genSession ID(); j.setSession ID(session ID)
[0334] A particular implementation of an interface for transmitting a session identifier by electronic device 100 to electronic device 200 is shown.
[0335] For example, the following shows a specific implementation of an interface for accepting collaborations: j.setSession ID(session ID)
[0336] The electronic device 200 analyzes and obtains the session identifier sent by the electronic device 200, and associates the instance 1 on the electronic device 200 with the same session identifier (session identifier 1) associated with the instance 1 on the electronic device 100, so that the data of the two instances that are the same on the electronic device 100 and the electronic device 200 match.
[0337] It should be noted that in another embodiment, the names of the interfaces for initiating collaboration and accepting collaboration may vary, but the principles remain the same, which is not limited in this embodiment of the present application.
[0338] 1407. The electronic device 100 detects that the attribute value of instance 1 has changed from a first value to a second value.
[0339] In some embodiments, the second value of instance 1 may also be referred to as the first instance attribute that changed.
[0340] For example, the following shows a specific implementation of an interface for monitoring data object changes: obj.on('change',(changedKeys:Array[string])=>{})
[0341] It should be noted that in another embodiment, the name of the interface for monitoring changes in the data object may be different, but the principle is similar, which is not limited in this embodiment of the present application.
[0342] 1408. The electronic device 100 updates the distributed data object 1 and learns that the attribute value of the obtained instance 1 is the second value.
[0343] The type of the updated distributed data object 1 remains unchanged; only the attribute values of the instances on the updated distributed data object 1 change.
[0344] For example, data object 1 may be audio navigation information, and a first value of the attribute value of instance 1 may be the audio content "5 kilometers remaining." A second value of the attribute value of instance 1 may be the audio content "3 kilometers remaining."
[0345] After the electronic device 100 updates the distributed data object 1, the electronic device 100 further needs to store the updated distributed data object 1 in the distributed database in a key-value format. For details, please refer to the related description in Table 1. The details will not be described again in this embodiment of the present application.
[0346] In some embodiments, electronic device 100 may store both distributed data object 1 and updated distributed data object 1 in the distributed database, or electronic device 100 may store only updated distributed data object 1 and delete distributed data object 1.
[0347] 1409. The electronic device 100 sends the attribute value of instance 1 and session identifier 1 to the electronic device 200.
[0348] In some embodiments, the transmission of the attribute values of instance 1 and session identifier 1 by electronic device 100 to electronic device 200 may also be referred to as the transmission of the changed attribute values of instance 1 by electronic device 100 to second electronic device 200 via the first session. In this manner, the first electronic device transmits only the changed instance attributes to the second electronic device, and does not need to transmit the unchanged instance attributes. In this case, the amount of data transmitted between collaboration devices is reduced, improving collaboration efficiency.
[0349] The electronic device 100 transmits the attribute value (second value) of the instance 1 to the electronic device 200, and as a result, the electronic device 200 updates the distributed data object 1 based on the attribute value (second value) of the instance 1.
[0350] The electronic device 100 sends the session identifier 1 to the electronic device 200, and as a result, the electronic device 200 determines, based on the received session identifier 1, an instance identifier (the identifier of instance 1) that is on the electronic device 200 and associated with the session identifier 1, changes the attribute value of instance 1 on the electronic device 200 from a first value to a second value, and updates the distributed data object 1 based on the attribute value of instance 1.
[0351] 1410. The electronic device 200 modifies the attribute value of instance 1 from a first value to a second value, updates distributed data object 1 based on the attribute value of instance 1, and outputs the updated distributed data object 1.
[0352] The electronic device 200 modifies the attribute value of the instance 1 from a first value to a second value, updates the distributed data object 1 based on the attribute value of the instance 1, and outputs the updated distributed data object 1.
[0353] The electronic device 200 further needs to store the updated distributed data object 1 in a distributed database in a key-value format. For details, please refer to the relevant description in Table 1. The details will not be described again in this embodiment of the present application.
[0354] In some embodiments, electronic device 200 may store both distributed data object 1 and updated distributed data object 1 in the distributed database, or electronic device 200 may store only updated distributed data object 1 and delete distributed data object 1.
[0355] For example, the following shows a specific implementation of an interface for updating a distributed data object: Obj.title="New Title"
[0356] It should be noted that in another embodiment, the name of the interface for updating the distributed data object may vary, but the principle remains the same, which is not limited in this embodiment of the present application.
[0357] The following describes, by using examples, application scenarios provided by the device collaboration method provided in the embodiments of the present application.
[0358] For example, electronic device 100 is a mobile phone and electronic device 200 is a smartwatch. When using the mobile phone for navigation while cycling is inconvenient for the user, the mobile phone cannot process navigation information. When the mobile phone and the smartwatch are in the same distributed network, the mobile phone can seamlessly switch the map information for navigation on the mobile phone to the smartwatch with one tap, and then the smartwatch continues to display the navigation information. In this way, the user can view the navigation information while cycling.
[0359] 15A , electronic device 100 may display home screen interface 1301. Interface 1301 displays a page on which application icons are arranged, and the page includes multiple application icons (e.g., a weather application icon, a stocks application icon, a calculator application icon, a settings application icon, an email application icon, a music application icon, a video application icon, a browser application icon, and a map application icon 1302). A page indicator is further displayed below the multiple application icons to indicate the positional relationship between the currently displayed page and another page. Below the page indicator are multiple tray icons (e.g., a dial application icon, an SMS message application icon, a contacts application icon, and a camera application icon), which remain displayed during page switching.
[0360] The electronic device 100 may receive an input operation (e.g., a single tap) performed by a user on the map application icon 1302. In response to the input operation, the electronic device 100 may respond to the input operation, and the electronic device 100 may display the map application interface 1303 shown in FIG.
[0361] 15B, the electronic device 100 displays a map application interface 1303. The map application interface 1303 includes a map 1304 and a search box. The map 1304 displays map information of the surrounding environment of the user's current location. The search box can be used to receive a destination name entered by the user.
[0362] 15C , the electronic device 100 may receive a destination name (e.g., “Tian'an Cloud Park”) entered by a user into a destination search box. In response to the input action, the electronic device 100 may display a window 1305. The window 1305 may include the distance between the current geographic location of the electronic device 100 and the destination (e.g., 5.2 km), the destination address information (e.g., “Campus 163, Banxuegang Avenue, Longgang District, Shenzhen, Guangdong”), and “Navigation” controls 1306.
[0363] The electronic device 100 may receive a user input (e.g., a single tap) on the navigation control 1306. In response to the input, the electronic device 100 may enable navigation, obtain information from a map server about a route from the current location of the electronic device 100 to the destination, and display the interface 1307 shown in FIG. 15D in full screen.
[0364] 15D , the interface 1307 may include a map, a location marker 1308, a driving route 1309 from the current location of the electronic device 100 to a destination, a "More" control 1310, and an "Exit" control 1311. The location marker 1308 may indicate the current location of the electronic device 100 on the map. The "More" control 1310 may be configured to trigger the display of more other function controls. The "Exit" control 1311 may be configured to trigger the electronic device 100 to end navigation.
[0365] As shown in FIGS. 15D and 15E, after the electronic device 100 establishes a collaboration connection to the electronic device 200, the electronic device 100 transmits navigation information to the electronic device 200, and the electronic device 200 displays the navigation information.
[0366] 15F and 15G, after electronic device 100 establishes a collaboration connection to electronic device 200, electronic device 100 can send navigation information and audio information to electronic device 200. Electronic device 200 displays the navigation information and plays the audio information by using an audio output device. The information can be "Turn onto Bell Road in 500 meters, the journey from destination is 4.5 km, and it will take 17 minutes."
[0367] The implementations of the present application may be randomly combined to achieve different technical effects.
[0368] All or part of the foregoing embodiments may be implemented using software, hardware, firmware, or any combination thereof. When software is used to implement an embodiment, all or part of the embodiment may be implemented in the form of a computer program product. A computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the procedures or functions according to the present application are 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 on a computer-readable storage medium or transmitted from a computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, optical fiber, or digital subscriber line) or wireless (e.g., infrared, radio, or microwave) transmission. The computer-readable storage medium may be any available medium accessible by a computer or a data storage device, such as a server or data center integrating one or more available media. The usable medium may be a magnetic medium (e.g., a floppy disk, a hard disk drive, or a magnetic tape), an optical medium (e.g., a DVD), a semiconductor medium (e.g., a solid-state disk (SSD)), or the like.
[0369] Those skilled in the art can understand that all or part of the steps of the method in the embodiments can be implemented by a computer program that instructs related hardware. The program can be stored in a computer-readable storage medium. When the program is executed, the steps of the method in the embodiments can be performed. The storage medium includes any medium that can store program code, such as a ROM, a random access memory (RAM), a magnetic disk, or a compact disk. [Explanation of symbols]
[0370] 1 antenna 2 antennas 100 Electronic Devices 200 Electronic Devices 300 Electronic Devices 400 System 110 processors 120 External Memory Interface 121 internal memory 130 USB interface 140 Charging Management Module 141 Power Management Module 142 Battery 150 Mobile Communication Module 160 Wireless Communication Module 170 Audio Module 170A speaker 170B receiver 170C Microphone 170D Headset Jack 180 Sensor Module 180A Pressure Sensor 180B Gyro Sensor 180C Barometric Pressure Sensor 180D Magnetic Sensor 180E Accelerometer 180F distance sensor 180G Optical Proximity Sensor 180H fingerprint sensor 180J Temperature Sensor 180K touch sensor 180L Ambient Light Sensor 180M Bone Conduction Sensor 190 Buttons 191 Motor 192 indicators 193 Camera 194 displays 195 SIM card interface 401 Distributed Data Object Creation Module 402 Distributed Data Object Synchronization Module 403 Distributed Data Object Monitoring Module 601 Applications 602 JS Programming Frameworks 603 Communication Module 604 Distributed In-Memory Database 605 Applications 606 JS Programming Framework 607 Communication Module 608 Distributed In-Memory Database 1301 Interface 1302 Map Application Icon 1303 Map Application Interface 1304 Map 1305 Window 1306 Navigation Controls 1307 Interface 1308 Position Marker 1309 Travel route 1310 Other 1311 Exit
Claims
1. 1. A device collaboration method, the method comprising: establishing, by a first electronic device, a collaboration connection to a second electronic device; obtaining, by the first electronic device, a first instance attribute of a first data object and a second instance attribute of a second data object, wherein the first instance attribute and the second instance attribute are each associated with a different session identifier; sending, by the first electronic device, the first instance attribute to the second electronic device over a first session and the second instance attribute to the second electronic device over a second session, wherein the first instance attribute is used by the second electronic device to generate the first data object and the second instance attribute is used by the second electronic device to generate the second data object; transmitting, by the first electronic device, a session identifier associated with the instance attribute detected to have changed to the second electronic device, wherein the session identifier associated with the instance attribute detected to have changed is used by the second electronic device to generate a changed object; A method comprising:
2. The method comprises: obtaining, by the first electronic device, a third instance attribute of the first data object; transmitting, by the first electronic device, the third instance attribute to the second electronic device over the first session, wherein the first instance attribute and the third instance attribute are jointly used by the second electronic device to generate the first data object; The method of claim 1 further comprising:
3. The method comprises: obtaining, by the first electronic device, a third instance attribute of the first data object; transmitting, by the first electronic device, the third instance attribute to the second electronic device over a third session, wherein the first instance attribute and the third instance attribute are jointly used by the second electronic device to generate the first data object; The method of claim 1 further comprising:
4. After the step of transmitting, by the first electronic device, the first instance attribute to the second electronic device over a first session, the method further comprises: detecting, by the electronic device, that the first instance attribute has changed and transmitting the changed first instance attribute to the second electronic device over the first session, wherein the changed first instance attribute is used by the second electronic device to update the first data object.
4. The method of claim 1, further comprising:
5. Establishing a collaboration connection by a first electronic device to a second electronic device includes: sending, by the first electronic device, a collaboration message to the second electronic device, the collaboration message including an instance identifier of a first instance and a session identifier of the first session, the session identifier of the first session being associated with the first instance; 4. The method of claim 1, comprising:
6. The method comprises: establishing, by the first electronic device, a collaboration connection to a third electronic device; sending, by the first electronic device, the first instance attribute to the third electronic device via a fourth session and the second instance attribute to the third electronic device via a fifth session, wherein the first instance attribute is used by the third electronic device to generate the first data object and the second instance attribute is used by the third electronic device to generate the second data object; 4. The method of claim 1, further comprising:
7. The method comprises: establishing, by the first electronic device, a collaboration connection to a third electronic device; generating, by the first electronic device, a third data object; obtaining, by the first electronic device, a fourth instance attribute of the third data object; sending, by the first electronic device, the fourth instance attribute to the third electronic device via a sixth session, wherein the fourth instance attribute is used by the third electronic device to generate the third data object; 4. The method of claim 1, further comprising:
8. The step of obtaining, by the first electronic device, a first instance attribute of a first data object and a second instance attribute of a second data object includes: obtaining, by the first electronic device, the first instance attribute of the first data object and the second instance attribute of the second data object through data interception.
4. The method of claim 1, comprising:
9. 4. The method of claim 1, wherein the first data object is associated with the first session and the second data object is associated with the second session, and the first data object is different from the second data object.
10. The method of claim 1 , wherein the first data object comprises at least one of a text data object, a picture data object, an audio data object, and a video data object.
11. 10. An electronic device, wherein the electronic device is a first electronic device, the first electronic device comprising one or more functional units, the one or more functional units being configured to perform the method of claim 1.
12. 10. An electronic device, wherein the electronic device is a first electronic device, the first electronic device comprising one or more processors and one or more memories, the one or more memories coupled to the one or more processors, the one or more memories configured to store computer program code, the computer program code including computer instructions, and the one or more processors invoke the computer instructions to enable the first electronic device to perform the method of claim 1.
13. 10. A computer-readable storage medium configured to store computer instructions, the computer instructions, when executed on a first electronic device, enabling the first electronic device to perform the method of claim 1.
Citation Information
Patent Citations
Media transfer for group communication sessions in wireless communication systems
JP2012533221A
Service Updates during Real-Time Communication and Experience Sharing Sessions
JP2016502781A
Establishing a wireless display session between a computing device and a vehicle head unit
JP2016503601A
Associating communications in collaboration sessions
US20120317296A1