WO2023179682A1 - 一种设备协同方法 - Google Patents

一种设备协同方法 Download PDF

Info

Publication number
WO2023179682A1
WO2023179682A1 PCT/CN2023/083127 CN2023083127W WO2023179682A1 WO 2023179682 A1 WO2023179682 A1 WO 2023179682A1 CN 2023083127 W CN2023083127 W CN 2023083127W WO 2023179682 A1 WO2023179682 A1 WO 2023179682A1
Authority
WO
WIPO (PCT)
Prior art keywords
electronic device
instance
data object
session
attribute
Prior art date
Application number
PCT/CN2023/083127
Other languages
English (en)
French (fr)
Inventor
龚阿世
鲍亚永
韩露
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2023179682A1 publication Critical patent/WO2023179682A1/zh

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • G06F16/275Synchronous replication
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W4/00Services specially adapted for wireless communication networks; Facilities therefor
    • H04W4/70Services for machine-to-machine communication [M2M] or machine type communication [MTC]

Definitions

  • the present application relates to the technical field of electronic equipment, and in particular, to a device collaboration method.
  • This application provides a device collaboration method, which can reduce the amount of data transmission between collaborative devices and improve the efficiency of collaborative device collaboration.
  • the present application provides a device collaboration method, which includes establishing a collaborative connection between a first electronic device and a second electronic device; the first electronic device obtains the first instance attribute of the first data object and the third attribute of the second data object. Two instance attributes; the first electronic device sends the first instance attribute to the second electronic device through the first session, and sends the second instance attribute to the second electronic device through the second session.
  • the first instance attribute is used by the second electronic device to generate the
  • the first data object and the second instance attribute are used by the second electronic device to generate the second data object.
  • the session identifier of the first session is the first session identifier.
  • the session identifier of the second session is the second session identifier.
  • the first electronic device 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 also generates the first data object and the second data object.
  • the first electronic device sends different types of data objects to the second electronic device through different sessions, and the first electronic device associates the same data object with the second electronic device.
  • the session identifier that is, the first instance on the first electronic device and the first instance on the second electronic device are both associated with the first session identifier, the second instance on the first electronic device and the second instance on the second electronic device. are associated with the second session identifier.
  • the first electronic device can monitor the attribute changes of different types of data objects, and only send the data objects with changed attributes to the second electronic device.
  • the amount of data transmission between the collaborative devices can be reduced, and the efficiency of the collaborative device collaboration can be improved. , to avoid the situation where too much data is sent, causing device coordination delays.
  • the method further includes: the first electronic device obtains the third instance attribute of the first data object; the first electronic device sends the third instance attribute to the second through the first session.
  • the electronic device, the first instance attribute and the third instance attribute are jointly used by the second electronic device to generate the first data object.
  • the first electronic device sends both the first instance and the third instance to the second electronic device through the first session, that is, the first electronic device
  • the same data object is associated with the same session identifier between the second electronic device and the second electronic device, and different types of instances of the same type of data object are not distinguished.
  • the first electronic device was the first When the attributes of the data object change, the first electronic device sends the changed first data object to the second electronic device.
  • the method further includes: the first electronic device obtains the third instance attribute of the first data object; the first electronic device sends the third instance attribute to the second instance through the third session.
  • the electronic device, the first instance attribute and the third instance attribute are jointly used by the second electronic device to generate the first data object.
  • the first electronic device sends the first instance and the third instance to the second electronic device through different sessions respectively, that is, the first electronic device With the second electronic device, the same two instances are associated with the same session identifier, and it is necessary to distinguish different types of instances under the same type of data object.
  • the first electronic device When the attributes of the first instance on the first electronic device change, the first electronic device only sends the changed attributes of the first instance to the second electronic device without sending the attributes of the third instance, which reduces the number of collaborative devices.
  • the amount of data transmitted between nodes improves collaboration efficiency.
  • the method further includes: the electronic device detects a change in the first instance attribute, The changed first instance attribute is sent to the second electronic device through the first session, and the changed first instance attribute is used by the second electronic device to update the first data object.
  • the first electronic device only sends the changed instance attributes to the second electronic device without sending the unchanged instance attributes, which reduces the amount of data transmission between the collaborating devices and improves the collaboration efficiency.
  • the first electronic device establishes a collaborative connection with the second electronic device, specifically including: the first electronic device sends a collaborative message to the second electronic device, and the collaborative message includes: The instance identifier of the first instance and the session identifier of the first session; the session identifier of the first session is associated with the first instance.
  • the first electronic device associates the first instance with the session identifier of the first session, so that 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. Session ID association.
  • the same two instances on the first electronic device and the second electronic device are associated with the same session identifier, ensuring the consistency of the attributes of the two identical instances on the first electronic device and the second electronic device, and ensuring Collaborative data consistency.
  • the method further includes: the first electronic device establishes a collaborative connection with the third electronic device; the first electronic device sends the first instance attribute to the third electronic device through the fourth session, The second instance attribute is sent to the third electronic device through the fifth session, 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.
  • the session identifier of the fourth session is the fourth session identifier
  • the session identifier of the fifth session is the fifth session identifier.
  • the first electronic device sends the first instance attribute to the third electronic device through the fourth session, and sends the second instance attribute to the third electronic device through the fifth session. It can be understood that the first electronic device transmits the first instance attribute on the first electronic device to the third electronic device.
  • One instance is associated with the fourth session identification, and the first electronic device associates the second instance on the first electronic device with the fifth session identification. Afterwards, the first electronic device sends the identification of the first instance and the fourth session identification to the third electronic device, and the first electronic device sends the identification of the second instance and the fifth session identification to the third electronic device.
  • the third electronic device associates the first instance on the third electronic device with the fourth session identifier, and the third electronic device associates the second instance on the third electronic device with the fifth session identifier, that is, the third instance on the first electronic device
  • the first instance on the first electronic device and the first instance on the third electronic device are both associated with the fourth session identifier, and the second instance on the first electronic device and the second instance on the third electronic device are both associated with the fifth session identifier.
  • three electronic devices can establish collaborative connections at the same time, and the properties of the same instance among multiple devices are also the same, ensuring the consistency of collaborative data.
  • the method further includes: the first electronic device establishes a collaborative connection with the third electronic device; the first electronic device generates a third data object; the first electronic device obtains the third data The fourth instance attribute of the object; the first electronic device sends the fourth instance attribute to the third electronic device through the sixth session, and the fourth instance attribute is used by the third electronic device to generate the third data object.
  • the session ID of the sixth session is the sixth session ID.
  • the first electronic device sends the fourth instance attribute to the third electronic device through the sixth session. It can be understood that the first electronic device associates the fourth instance on the first electronic device with the sixth session identifier. After that, the first electronic device The electronic device sends the identification of the fourth instance and the sixth session identification to the third electronic device, and the third electronic device associates the fourth instance on the third electronic device with the sixth session identification, that is, the fourth instance on the first electronic device Both the instance and the fourth instance on the third electronic device are associated with a sixth session identification.
  • the first electronic device when the first electronic device establishes collaborative connections with multiple different electronic devices, the first electronic device can simultaneously transmit different collaborative data with the multiple different electronic devices, thereby improving the functional diversity of device collaboration.
  • the first electronic device obtains the first instance attribute of the first data object and the second instance attribute of the second data object, specifically including: the first electronic device based on the data
  • the first instance attribute of the first data object and the second instance attribute of the second data object are obtained through hijacking. In this way, through data hijacking, it is possible to monitor whether the first instance attributes and second instance attributes have changed, and timely update the changed first instance attributes and/or second instance attributes to ensure data consistency between collaborative devices. sex.
  • a first data object is associated with the first session, and a second data object is associated with the 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 also 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 and the second data object are different.
  • the present application provides a collaborative method.
  • the method includes: a second electronic device establishes a collaborative connection with a first electronic device; and the second electronic device receives the third data object of the first data object sent by the first electronic device through the first session.
  • An instance attribute the second electronic device receives the second instance attribute of the second data object sent by the first electronic device through the second session; the second electronic device generates the first data object based on the first instance attribute, and the second electronic device generates the first data object based on the first instance attribute.
  • the second instance attribute generates a second data object.
  • the session identifier of the first session is the first session identifier.
  • the session identifier of the second session is the second session identifier.
  • the first electronic device 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 also generates the first data object and the second data object.
  • the second electronic device receives different types of data objects sent by the second electronic device through different sessions, and the second electronic device is associated with the same data object on the lower electronic device.
  • a session identifier that is, the first instance on the first electronic device and the first instance on the second electronic device are both associated with the first session identifier, the second instance on the first electronic device and the second instance on the second electronic device.
  • the instances are all associated with the second session ID.
  • the first electronic device can monitor the attribute changes of different types of data objects, and only send the data objects with changed attributes to the second electronic device.
  • the amount of data transmission between the collaborative devices can be reduced, and the efficiency of the collaborative device collaboration can be improved. , to avoid the situation where too much data is sent, causing device coordination delays.
  • the method further includes: the second electronic device receives the third instance attribute of the first data object sent by the first electronic device through the first session; the second electronic device based on the first Instance attributes and all The third instance attributes collectively generate the first data object.
  • the second electronic device will receive the first instance and the third instance sent by the first electronic device through the first session, that is, the first electronic device will The same data object is associated with the same session identifier between the second electronic device and the second electronic device, and different types of instances of the same type of data object are not distinguished.
  • the first electronic device sends the changed first data object to the second electronic device.
  • the method further includes: the second electronic device receives the third instance attribute of the first data object sent by the first electronic device through the third session; the second electronic device based on the first The instance attributes and the third instance attributes together generate a first data object.
  • the first data object includes two types of instances
  • the second electronic device receives the first instance and the third instance sent by the second electronic device through different sessions, that is, the first electronic device With the second electronic device, the same two instances are associated with the same session identifier, and it is necessary to distinguish different types of instances under the same type of data object.
  • the method further includes: the second electronic device passes through The first session receives the changed first instance attribute of the first data object sent by the first electronic device; the second electronic device generates the first data object based on the changed first instance attribute.
  • the first electronic device only sends the changed instance attributes to the second electronic device without sending the unchanged instance attributes, which reduces the amount of data transmission between the collaborating devices and improves the collaboration efficiency.
  • establishing a collaborative connection between the second electronic device and the first electronic device specifically includes: the second electronic device receives a collaborative message sent by the first electronic device, and the collaborative message includes the first electronic device.
  • the instance identifier of the instance attribute is associated with the session identifier of the first session
  • the session identifier of the first session is associated with the first instance attribute.
  • the first electronic device associates the first instance with the session identifier of the first session, so that 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.
  • Session ID association In this way, the same two instances on the first electronic device and the second electronic device are associated with the same session identifier, ensuring the consistency of the attributes of the two identical instances on the first electronic device and the second electronic device, and ensuring Collaborative data consistency.
  • this application provides an electronic device, which is a first electronic device.
  • the first electronic device includes one or more functional units.
  • the one or more functional units are used by the first electronic device to perform any one of the above aspects.
  • a device collaboration method is provided in the possible implementation manner.
  • the present application provides an electronic device, which is a second electronic device.
  • the second electronic device includes one or more functional units.
  • the one or more functional units are used by the second electronic device to perform any one of the above aspects. possible implementation A device collaboration method provided in .
  • the present application provides an electronic device, which is a first electronic device.
  • the first electronic device includes: one or more processors and one or more memories; wherein the one or more memories and one or more The processor is coupled, and one or more memories are used to store computer program codes.
  • the computer program codes include computer instructions.
  • the one or more processors invoke the computer instructions to cause the first electronic device to execute any of the above aspects in any possible implementation manner.
  • a device collaboration method is provided.
  • the present application provides an electronic device, which is a second electronic device.
  • the second electronic device includes: one or more processors and one or more memories; wherein the one or more memories and one or more The processor is coupled, and one or more memories are used to store computer program codes.
  • the computer program codes include computer instructions.
  • the one or more processors invoke the computer instructions to cause the second electronic device to execute any of the above aspects in any possible implementation manner.
  • a device collaboration method is provided.
  • the present application provides a computer-readable storage medium for storing computer instructions.
  • the computer instructions When the computer instructions are run on a first electronic device, the first electronic device executes any possible implementation of any of the above aspects.
  • a device collaboration method provided in .
  • the present application provides a computer-readable storage medium for storing computer instructions.
  • the computer instructions When the computer instructions are run on a second electronic device, the second electronic device executes any possible implementation of any of the above aspects.
  • a device collaboration method provided in .
  • the present application provides a computer program product.
  • the computer program product When the computer program product is run on a first electronic device, it causes the first electronic device to execute any of the above-mentioned aspects provided in any possible implementation manner.
  • a device collaboration method When the computer program product is run on a first electronic device, it causes the first electronic device to execute any of the above-mentioned aspects provided in any possible implementation manner.
  • a device collaboration method When the computer program product is run on a first electronic device, it causes the first electronic device to execute any of the above-mentioned aspects provided in any possible implementation manner.
  • the present application provides a computer program product that, when the computer program product is run on a second electronic device, causes the second electronic device to execute one of the possible implementations of any of the above aspects.
  • Device collaboration methods
  • FIG. 1 is a partial process schematic diagram of an RPC mechanism provided by an embodiment of the present application.
  • Figure 2 is a schematic architectural diagram of a system 400 provided by an embodiment of the present application.
  • Figure 3 is a schematic structural diagram of an electronic device 100 provided by an embodiment of the present application.
  • Figure 4 is a software structure block diagram of an electronic device 100 provided by an embodiment of the present application.
  • Figure 5 is a schematic diagram of the functional modules of a JS programming framework provided by an embodiment of the present application.
  • Figure 6 is a schematic diagram of interaction between an electronic device 100 and an electronic device 200 provided by an embodiment of the present application;
  • Figures 7 to 9 exemplarily illustrate the UI in which any two instances of a set of two collaborative devices are associated with the same session ID. picture;
  • Figures 10 to 12 illustrate UI diagrams in which any two instances of a set of multi-collaboration devices are associated with the same session ID
  • Figure 13 is a schematic diagram illustrating data synchronization between devices that establish collaboration provided by an embodiment of the present application
  • Figure 14 is a schematic flowchart of a device collaboration method provided by an embodiment of the present application.
  • Figures 15A-15G are a set of UI diagrams provided by this embodiment of the present application.
  • first and second are used for descriptive purposes only and shall not be understood as implying or implying relative importance or implicitly specifying the quantity of indicated technical features. Therefore, the features defined as “first” and “second” may explicitly or implicitly include one or more of the features. In the description of the embodiments of this application, unless otherwise specified, “plurality” The meaning is two or more.
  • GUI graphical user interface
  • RPC remote procedure call
  • Figure 1 exemplarily shows a partial process diagram of the RPC mechanism.
  • the RPC mechanism mainly includes the following steps:
  • the server defines and implements the AIDL interface for remote message calling.
  • the server exposes the AIDL interface to the client through the server.
  • the client establishes a long connection with the server.
  • the client binds the client, calls the client's AIDL interface, and calls the message on the client.
  • the embodiment of the present application provides a device collaboration method.
  • the method includes: through the programming framework provided by the embodiment of the present application, the electronic device 100 can redefine the getter/setter method of the data object in a data hijacking manner to obtain Distributed data objects, the electronic device 100 can detect whether the attribute values of the distributed data objects change, and then the electronic device 100 sends the distributed data to the electronic device 200; at the same time, the same two instances between the electronic device 100 and the electronic device 200 or The same data objects are associated with the same session ID, so that the data between the two identical instances of the electronic device 100 and the electronic device 200 is the same, realizing automatic synchronization of distributed data objects between electronic devices.
  • the electronic device 100 may also be called a first electronic device, and the electronic device 200 may also be called a second electronic device.
  • the programming framework provided by the embodiments of this application does not need to distinguish between the client and the server, nor does it need to maintain a long connection between electronic devices, which improves the development efficiency of application developers.
  • the electronic device 100 can monitor the instance attribute values of the distributed data object and only send the changed instance attribute values to the electronic device 200 , thereby reducing the amount of data sent and improving Improve the efficiency of equipment collaboration.
  • embodiments of the present application can achieve the effect of resource sharing among multiple electronic devices.
  • the mobile phone when it is inconvenient for users to use mobile phone navigation while riding a bicycle, the mobile phone does not have the ability to process navigation information.
  • the mobile phone and the smart watch are on the same distributed network, the mobile phone can achieve one-click navigation map information on the mobile phone. Switch to the smart watch, and the smart watch will continue to display navigation information, making it convenient for users to view navigation information while riding.
  • the mobile phone can seamlessly switch the video viewed on the mobile phone to the TV with one click, and the TV will continue to play the video and enjoy a large-screen experience.
  • a staff member can operate an office computer to display presentation files.
  • the office computer can establish a collaborative connection with the office equipment of other people around it, so that the presentation files on the office computer can be displayed around them.
  • Other staff’s office equipment improves office efficiency.
  • Figure 2 shows a schematic architectural diagram of a system 400 provided by an embodiment of the present application.
  • the system 400 may include multiple electronic devices.
  • the device types of the plurality of electronic devices may be of various types, and the embodiments of the present application do not specifically limit the specific types of the plurality of electronic devices.
  • the multiple electronic devices include mobile phones, and may also include tablet computers, desktop computers, laptop computers, handheld computers, notebook computers, smart screens, wearable devices, augmented reality (AR) devices, virtual Reality (VR) equipment, artificial intelligence (AI) equipment, cars, smart headsets, game consoles, and can also include Internet of things (IOT) equipment or smart home equipment such as smart water heaters, smart Lamps, smart air conditioners, etc.
  • IOT Internet of things
  • multiple devices in the system 400 may also include non-portable terminal devices such as laptops with touch-sensitive surfaces or touch panels, desktop computers with touch-sensitive surfaces or touch panels, and the like.
  • the multiple electronic devices can be configured with different software operating systems (operating systems, OS), including but not limited to etc. in, For Huawei’s Hongmeng system.
  • OS software operating systems
  • the multiple electronic devices can also be configured with the same software operating system, for example
  • the multiple electronic devices can establish collaborative connections through any of the following methods.
  • Method 1 The multiple electronic devices can be connected to the same network.
  • the multiple electronic devices can be connected to the same network.
  • Method 2 The multiple electronic devices can also log in to the same system account to establish a collaborative connection.
  • the system accounts logged in by the multiple electronic devices can all be "HW1234".
  • Method 3 The system accounts logged in on the multiple electronic devices can all belong to the same account group.
  • the system accounts logged in on the multiple electronic devices include "HW001", “HW002”, and “HW003”.
  • System accounts "HW001”, “HW002”, and “HW003” all belong to the account group "Huawei Home”.
  • NFC near field communication
  • BT Bluetooth
  • WLAN wireless local area networks
  • wireless fidelity point to point Wireless fidelity point to point
  • Wi -Fi P2P wireless fidelity point to point
  • IR infrared technology
  • Method 5 Multiple electronic devices can create a temporary account group by scanning the same QR code and establish a collaborative connection to achieve communication.
  • the electronic device 100 can also establish collaborative connections through other methods, which are not limited in the embodiments of the present application.
  • the system 400 may also include only two electronic devices, such as the electronic device 100 and the electronic device 200 , and the electronic device 100 and the electronic device 100 establish a collaborative connection.
  • the following embodiments of the present application take the system 400 including two electronic devices as an example to illustrate, the electronic device 100 is a mobile phone, and the electronic device 200 is a watch.
  • One or more applications are installed on the electronic device 100, and one or more applications are also installed on the electronic device 200.
  • the electronic device 100 creates a distributed data object of application 1 based on the JS programming framework provided by the embodiment of this application.
  • the electronic device 100 sends the distributed data object to the electronic device 200, and the electronic device 200 can output the distributed data object.
  • the mobile phone can seamlessly switch the map information of the navigation on the mobile phone to the smart watch with one click, and the smart watch can to continue to display navigation information, making it convenient for users to view navigation information while riding.
  • the JS programming framework When the electronic device 100 establishes a collaborative connection with the electronic device 200, the JS programming framework will create a session ID, which is associated with instance 1 of the locally created application 1. Afterwards, the electronic device 200 obtains the session ID and associates the session ID with instance 1 of application 1 on the electronic device 200 . In this way, after the distributed data object on the electronic device 100 is changed (for example, updated), the distributed data object on the electronic device 100 also changes accordingly.
  • data objects can be understood as memory data generated when the application is running (can also be called business data), and instances can be understood as the embodiment of a specific type of data object.
  • Data objects include one or more Each type of data object can include instances of one or more types.
  • Types of data objects include but are not limited to: audio data objects, text data objects, picture data objects, video data objects, etc.
  • the route information is called a picture data object, and the route information guided by the navigation application broadcast by the electronic device 100 through voice is called an audio data object.
  • the data object may be a text data object in the navigation information.
  • Word data objects can include multiple different types of instances, and the multiple different types of instances can be time instances, remaining distance instances, duration instances, etc.
  • the data object includes multiple different types of instances.
  • the electronic device may also collectively refer to the multiple different types of instances as the same instance, or may not distinguish the types of instances.
  • each type of data object includes only one instance.
  • FIG. 3 shows a schematic structural diagram of the electronic device 100.
  • 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 , mobile communication module 150, wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone interface 170D, sensor module 180, button 190, motor 191, indicator 192, camera 193, display screen 194, and Subscriber identification module (SIM) card interface 195, etc.
  • 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 , mobile communication module 150, wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone interface 170D, sensor module 180, button 190, motor 191, indicator 192, camera 193, display
  • the sensor module 180 may include a pressure sensor 180A, a gyro sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, and an ambient light sensor. 180L, bone conduction sensor 180M, etc.
  • the structure illustrated in the embodiment of the present invention does not constitute a specific limitation on the electronic device 100 .
  • the electronic device 100 may include more or fewer components than shown in the figures, or some components may be combined, some components may be separated, or some components may be arranged differently.
  • the components illustrated may be implemented in hardware, software, or a combination of software and hardware.
  • the processor 110 may include one or more processing units.
  • the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processing unit (GPU), and an image signal processor. (image signal processor, ISP), controller, video codec, digital signal processor (digital signal processor, DSP), baseband processor, and/or neural network processor (neural-network processing unit, NPU), etc.
  • application processor application processor, AP
  • modem processor graphics processing unit
  • GPU graphics processing unit
  • image signal processor image signal processor
  • ISP image signal processor
  • controller video codec
  • digital signal processor digital signal processor
  • DSP digital signal processor
  • baseband processor baseband processor
  • neural network processor neural-network processing unit
  • the controller can generate operation control signals based on the instruction operation code and timing signals to complete the control of fetching and executing instructions.
  • the processor 110 may also be provided with a memory for storing instructions and data.
  • the memory in processor 110 is cache memory. This memory may hold instructions or data that have been recently used or recycled by processor 110 . If the processor 110 needs to use the instructions or data again, it can be called directly from the memory. Repeated access is avoided and the waiting time of the processor 110 is reduced, thus improving the efficiency of the system.
  • processor 110 may include one or more interfaces.
  • Interfaces may include integrated circuit (inter-integrated circuit, I2C) interface, integrated circuit built-in audio (inter-integrated circuit sound, I2S) interface, pulse code modulation (PCM) interface, universal asynchronous receiver and transmitter (universal asynchronous receiver/transmitter (UART) interface, mobile industry processor interface (MIPI), general-purpose input/output (GPIO) interface, user identification module (subscriber) identity module, SIM) interface, and/or universal serial bus (universal serial bus, USB) interface, etc.
  • I2C integrated circuit
  • I2S integrated circuit built-in audio
  • PCM pulse code modulation
  • UART universal asynchronous receiver and transmitter
  • MIPI mobile industry processor interface
  • GPIO general-purpose input/output
  • SIM subscriber
  • universal serial bus universal serial bus
  • the I2C interface is a bidirectional synchronous serial bus, including a serial data line (SDA) and a serial clock line (derail clock line, SCL).
  • processor 110 may include multiple sets of I2C buses.
  • the processor 110 can separately couple the touch sensor 180K, charger, flash, camera 193, etc. through different I2C bus interfaces.
  • the processor 110 can be coupled to the touch sensor 180K through an I2C interface, so that the processor 110 and the touch sensor 180K communicate through the I2C bus interface to implement the touch function of the electronic device 100 .
  • the I2S interface can be used for audio communication.
  • processor 110 may include multiple sets of I2S buses.
  • the processor 110 can be coupled with the audio module 170 through the I2S bus to implement communication between the processor 110 and the audio module 170 .
  • the audio module 170 can transmit audio signals to the wireless communication module 160 through the I2S interface to implement the function of answering calls through a Bluetooth headset.
  • the PCM interface can also be used for audio communications to sample, quantize and encode analog signals.
  • the audio module 170 and the wireless communication module 160 may be coupled through a PCM bus interface.
  • the audio module 170 can also transmit audio signals to the wireless communication module 160 through the PCM interface to implement the function of answering calls through a Bluetooth headset. Both the I2S interface and the PCM interface can be used for audio communication.
  • the UART interface is a universal serial data bus used for asynchronous communication.
  • the bus can be a bidirectional communication bus. It converts the data to be transmitted between serial communication and parallel communication.
  • a UART interface is generally used to connect the processor 110 and the wireless communication module 160 .
  • the processor 110 communicates with the Bluetooth module in the wireless communication module 160 through the UART interface to implement the Bluetooth function.
  • the audio module 170 can transmit audio signals to the wireless communication module 160 through the UART interface to implement the function of playing music through a Bluetooth headset.
  • the MIPI interface can be used to connect the processor 110 with peripheral devices such as the display screen 194 and the camera 193 .
  • MIPI interfaces include camera serial interface (CSI), display serial interface (DSI), etc.
  • the processor 110 and the camera 193 communicate through the CSI interface to implement the shooting function of the electronic device 100 .
  • the processor 110 and the display screen 194 communicate through the DSI interface to implement the display function of the electronic device 100 .
  • the GPIO interface can be configured through software.
  • the GPIO interface can be configured as a control signal or as a data signal.
  • the GPIO interface can be used to connect the processor 110 with the camera 193, display screen 194, wireless communication module 160, audio module 170, sensor module 180, etc.
  • the GPIO interface can also be configured as an I2C interface, I2S interface, UART interface, MIPI interface, etc.
  • the USB interface 130 is an interface that complies with the USB standard specification, and may be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc.
  • the USB interface 130 can be used to connect a charger to charge the electronic device 100, and can also be used to transmit data between the electronic device 100 and peripheral devices. It can also be used to connect headphones to play audio through them. This interface can also be used to connect other electronic devices, such as AR devices, etc.
  • the interface connection relationships between the modules illustrated in the embodiment of the present invention are only schematic illustrations and do not constitute a structural limitation of the electronic device 100 .
  • the electronic device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
  • the charging management module 140 is used to receive charging input from the charger.
  • the charger can be a wireless charger or a wired charger.
  • the charging management module 140 may receive charging input from the wired charger through the USB interface 130 .
  • the charging management module 140 may receive wireless charging input through the wireless charging coil of the electronic device 100 . While the charging management module 140 charges the battery 142, it can also provide power to the electronic device through the power management module 141.
  • the power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110.
  • the power management module 141 receives input from the battery 142 and/or the charging management module 140, and supplies power to the processor 110, the internal memory 121, the display screen 194, the camera 193, the wireless communication module 160, and the like.
  • the power management module 141 can also be used to monitor battery capacity, battery cycle times, battery health status (leakage, impedance) and other parameters.
  • the power management module 141 may also be provided in the processor 110 .
  • the power management module 141 and the charging management module 140 may also be provided in the same device.
  • the wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.
  • Antenna 1 and Antenna 2 are used to transmit and receive electromagnetic wave signals.
  • Each antenna in electronic device 100 may be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve antenna utilization. For example: Antenna 1 can be reused as a diversity antenna for a wireless LAN. In other embodiments, antennas may be used in conjunction with tuning switches.
  • the mobile communication module 150 can provide solutions for wireless communication including 2G/3G/4G/5G applied on the electronic device 100 .
  • the mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (LNA), etc.
  • the mobile communication module 150 can receive electromagnetic waves through the antenna 1, perform filtering, amplification and other processing on the received electromagnetic waves, and transmit them to the modem processor for demodulation.
  • the mobile communication module 150 can also amplify the signal modulated by the modem processor and convert it into electromagnetic waves through the antenna 1 for radiation.
  • at least part of the functional modules of the mobile communication module 150 may be disposed in the processor 110 .
  • at least part of the functional modules of the mobile communication module 150 and at least part of the modules of the processor 110 may be provided in the same device.
  • a modem processor may include a modulator and a demodulator.
  • the modulator is used to modulate the low-frequency baseband signal to be sent into a medium-high frequency signal.
  • the demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal.
  • the demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing.
  • the application processor outputs sound signals through audio devices (not limited to speaker 170A, receiver 170B, etc.), or displays images or videos through display screen 194.
  • the modem processor may be a stand-alone device.
  • the modem processor may be independent of the processor 110 and may be provided in the same device as the mobile communication module 150 or other functional modules.
  • the wireless communication module 160 can provide applications on the electronic device 100 including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) network), Bluetooth (bluetooth, BT), and global navigation satellites. Wireless communication solutions such as global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared technology (infrared, IR), etc.
  • WLAN wireless local area networks
  • BT Bluetooth
  • GNSS global navigation satellite system
  • FM frequency modulation
  • NFC near field communication
  • IR infrared technology
  • the wireless communication module 160 may be one or more devices integrating at least one communication processing module.
  • the wireless communication module 160 receives electromagnetic waves through the antenna 2, demodulates and filters the electromagnetic wave signals, and sends the processed signals everywhere. Manager 110.
  • the wireless communication module 160 can also receive the signal to be sent from the processor 110, frequency modulate it, amplify it, and convert it into electromagnetic waves through the antenna 2 for radiation.
  • the antenna 1 of the electronic device 100 is coupled to the mobile communication module 150, and the antenna 2 is coupled to the wireless communication module 160, so that the electronic device 100 can communicate with the network and other devices through wireless communication technology.
  • the wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), broadband Code division multiple access (wideband code division multiple access, WCDMA), time-divion code division multiple access (TD-SCDMA), long term evolution (long term evolution, LTE), BT, GNSS, WLAN, NFC , FM, and/or IR technology, etc.
  • the GNSS may include global positioning system (GPS), global navigation satellite system (GLONASS), Beidou navigation satellite system (BDS), quasi-zenith satellite system (quasi) -zenith satellite system (QZSS) and/or satellite based augmentation systems (SBAS).
  • GPS global positioning system
  • GLONASS global navigation satellite system
  • BDS Beidou navigation satellite system
  • QZSS quasi-zenith satellite system
  • SBAS satellite based augmentation systems
  • the electronic device 100 implements display functions through a GPU, a display screen 194, an application processor, and the like.
  • the GPU is an image processing microprocessor and is connected to the display screen 194 and the application processor. GPUs are used to perform mathematical and geometric calculations for graphics rendering.
  • Processor 110 may include one or more GPUs that execute program instructions to generate or alter display information.
  • the display screen 194 is used to display images, videos, etc.
  • Display 194 includes a display panel.
  • the display panel can use a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active matrix organic light emitting diode or an active matrix organic light emitting diode (active-matrix organic light emitting diode).
  • LCD liquid crystal display
  • OLED organic light-emitting diode
  • AMOLED organic light-emitting diode
  • FLED flexible light-emitting diode
  • Miniled MicroLed, Micro-oLed, quantum dot light emitting diode (QLED), etc.
  • the electronic device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1.
  • the electronic device 100 can implement the shooting function through an ISP, a camera 193, a video codec, a GPU, a display screen 194, an application processor, and the like.
  • the ISP is used to process the data fed back by the camera 193. For example, when taking a photo, the shutter is opened, the light is transmitted to the camera sensor through the lens, the optical signal is converted into an electrical signal, and the camera sensor passes the electrical signal to the ISP for processing, and converts it into an image visible to the naked eye. ISP can also perform algorithm optimization on image noise and brightness. ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, the ISP may be provided in the camera 193.
  • Camera 193 is used to capture still images or video.
  • the object passes through the lens to produce an optical image that is projected onto the photosensitive element.
  • the photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor.
  • CMOS complementary metal-oxide-semiconductor
  • the photosensitive element converts the optical signal into an electrical signal, and then passes the electrical signal to the ISP to convert it into a digital image signal.
  • ISP outputs digital image signals to DSP for processing.
  • DSP converts digital image signals into standard RGB, YUV and other format image signals.
  • the electronic device 100 may include 1 or N cameras 193, where N is a positive integer greater than 1.
  • Digital signal processors are used to process digital signals. In addition to digital image signals, they can also process other digital signals. For example, when the electronic device 100 selects a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.
  • NPU is a neural network (NN) computing processor.
  • NN neural network
  • Intelligent cognitive applications of the electronic device 100 can be implemented through the NPU, such as image recognition, face recognition, speech recognition, text understanding, etc.
  • the internal memory 121 may include one or more random access memories (RAM) and one or more non-volatile memories (NVM).
  • RAM random access memories
  • NVM non-volatile memories
  • Random access memory can 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 (double data rate synchronous dynamic random access memory, DDR SDRAM, for example, the fifth generation DDR SDRAM is generally called DDR5SDRAM), etc.; non-volatile memory can include disk storage devices and flash memory (flash memory).
  • SRAM static random-access memory
  • DRAM dynamic random-access memory
  • SDRAM synchronous dynamic random-access memory
  • DDR SDRAM double data rate synchronous Dynamic random access memory
  • non-volatile memory can include disk storage devices and flash memory (flash memory).
  • Flash memory can be divided according to the operating principle to include NOR FLASH, NAND FLASH, 3D NAND FLASH, etc.
  • the storage unit potential level it can include single-level storage cells (single-level cell, SLC), multi-level storage cells (multi-level cell, MLC), third-level storage unit (triple-level cell, TLC), fourth-level storage unit (quad-level cell, QLC), etc., which can include universal flash storage (English: universal flash storage, UFS) according to storage specifications. , embedded multi media card (embedded multi media Card, eMMC), etc.
  • the random access memory can be directly read and written by the processor 110, can be used to store executable programs (such as machine instructions) of the operating system or other running programs, and can also be used to store user and application data, etc.
  • the non-volatile memory can also store executable programs and user and application program data, etc., and can be loaded into the random access memory in advance for direct reading and writing by the processor 110.
  • the external memory interface 120 can be used to connect an external non-volatile memory to expand the storage capacity of the electronic device 100 .
  • the external non-volatile memory communicates with the processor 110 through the external memory interface 120 to implement the data storage function. For example, save music, video and other files in external non-volatile memory.
  • the electronic device 100 can implement audio functions through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone interface 170D, and the application processor. Such as music playback, recording, etc.
  • the audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals. Audio module 170 may also be used to encode and decode audio signals. In some embodiments, the audio module 170 may be provided in the processor 110 , or some functional modules of the audio module 170 may be provided in the processor 110 .
  • Speaker 170A also called “speaker” is used to convert audio electrical signals into sound signals.
  • the electronic device 100 can listen to music through the speaker 170A, or listen to hands-free calls.
  • Receiver 170B also called “earpiece” is used to convert audio electrical signals into sound signals.
  • the electronic device 100 answers a call or a voice message, the voice can be heard by bringing the receiver 170B close to the human ear.
  • Microphone 170C also called “microphone” or “microphone” is used to convert sound signals into electrical signals. When making a call or sending a voice message, the user can speak close to the microphone 170C with the human mouth and input the sound signal to the microphone 170C.
  • the electronic device 100 may be provided with at least one microphone 170C. In other embodiments, the electronic device 100 may be provided with two microphones 170C, which in addition to collecting sound signals, may also implement a noise reduction function. In other embodiments, the electronic device 100 can also be provided with three, four or more microphones 170C to collect sound signals, reduce noise, identify sound sources, and implement directional recording functions, etc.
  • the headphone interface 170D is used to connect wired headphones.
  • the headphone interface 170D may be a USB interface 130, or may be a 3.5mm open mobile terminal platform (OMTP) standard interface, or a Cellular Telecommunications Industry Association of the USA (CTIA) standard interface.
  • OMTP open mobile terminal platform
  • CTIA Cellular Telecommunications Industry Association of the USA
  • the pressure sensor 180A is used to sense pressure signals and can convert the pressure signals into electrical signals.
  • pressure sensor 180A may be disposed on display screen 194 .
  • pressure sensors 180A there are many types of pressure sensors 180A, such as resistive pressure sensors, inductive pressure sensors, capacitive pressure sensors, etc.
  • a capacitive pressure sensor may include at least two parallel plates of conductive material.
  • the electronic device 100 determines the intensity of the pressure based on the change in capacitance.
  • the electronic device 100 detects the intensity of the touch operation according to the pressure sensor 180A.
  • the electronic device 100 may also calculate the touched position based on the detection signal of the pressure sensor 180A.
  • touch operations acting on the same touch location but with different touch operation intensities may correspond to different operation instructions. For example: when a touch operation with a touch operation intensity less than the first pressure threshold is applied to the short message application icon, an instruction to view the short message is executed. When a touch operation with a touch operation intensity greater than or equal to the first pressure threshold is applied to the short message application icon, an instruction to create a new short message is executed.
  • the gyro sensor 180B may be used to determine the motion posture of the electronic device 100 .
  • the angular velocity of electronic device 100 about three axes (x, y, and z axes) may be determined by gyro sensor 180B.
  • the gyro sensor 180B can be used for image stabilization. For example, when the shutter is pressed, the gyro sensor 180B detects the angle at which the electronic device 100 shakes, calculates the distance that the lens module needs to compensate based on the angle, and allows the lens to offset the shake of the electronic device 100 through reverse movement to achieve anti-shake.
  • the gyro sensor 180B can also be used for navigation and somatosensory game scenes.
  • Air pressure sensor 180C is used to measure air pressure. In some embodiments, the electronic device 100 calculates the altitude through the air pressure value measured by the air pressure sensor 180C to assist positioning and navigation.
  • Magnetic sensor 180D includes a Hall sensor.
  • the electronic device 100 may utilize the magnetic sensor 180D to detect opening and closing of the flip holster.
  • the electronic device 100 may detect the opening and closing of the flip according to the magnetic sensor 180D. Then, based on the detected opening and closing status of the leather case or the opening and closing status of the flip cover, features such as automatic unlocking of the flip cover are set.
  • the acceleration sensor 180E can detect the acceleration of the electronic device 100 in various directions (generally three axes). When the electronic device 100 is stationary, the magnitude and direction of gravity can be detected. It can also be used to identify the posture of electronic devices and be used in horizontal and vertical screen switching, pedometer and other applications.
  • Distance sensor 180F for measuring distance.
  • Electronic device 100 can measure distance via infrared or laser. In some embodiments, when shooting a scene, the electronic device 100 may utilize the distance sensor 180F to measure distance to achieve fast focusing.
  • Proximity light sensor 180G may include, for example, a light emitting diode (LED) and a light detector, such as a photodiode.
  • the light emitting diode may be an infrared light emitting diode.
  • the electronic device 100 emits infrared light outwardly through the light emitting diode.
  • Electronic device 100 uses photodiodes to detect infrared reflected light from nearby objects. When sufficient reflected light is detected, it can be determined that there is an object near the electronic device 100 . When insufficient reflected light is detected, the electronic device 100 may determine that there is no object near the electronic device 100 .
  • the electronic device 100 can use the proximity light sensor 180G to detect when the user holds the electronic device 100 close to the ear for talking, so as to automatically turn off the screen to save power.
  • the proximity light sensor 180G can also be used in holster mode, and pocket mode automatically unlocks and locks the screen.
  • the ambient light sensor 180L is used to sense ambient light brightness.
  • the electronic device 100 can adaptively adjust the brightness of the display screen 194 according to the perceived ambient light brightness.
  • the ambient light sensor 180L can also be used to automatically adjust the white balance when taking pictures.
  • the ambient light sensor 180L can also cooperate with the proximity light sensor 180G to detect whether the electronic device 100 is in the pocket to prevent accidental touching.
  • Fingerprint sensor 180H is used to collect fingerprints.
  • the electronic device 100 can use the collected fingerprint characteristics to achieve fingerprint unlocking, access to application locks, fingerprint photography, fingerprint answering of incoming calls, etc.
  • Temperature sensor 180J is used to detect temperature.
  • the electronic device 100 utilizes the temperature detected by the temperature sensor 180J to execute the temperature processing strategy. For example, when the temperature reported by the temperature sensor 180J exceeds a threshold, the electronic device 100 reduces the performance of a processor located near the temperature sensor 180J in order to reduce power consumption and implement thermal protection. In other embodiments, when the temperature is lower than another threshold, the electronic device 100 heats the battery 142 to prevent the low temperature from causing the electronic device 100 to shut down abnormally. In some other embodiments, when the temperature is lower than another threshold, the electronic device 100 performs boosting on the output voltage of the battery 142 to avoid abnormal shutdown caused by low temperature.
  • Touch sensor 180K also known as "touch device”.
  • the touch sensor 180K can be disposed on the display screen 194.
  • the touch sensor 180K and the display screen 194 form a touch screen, which is also called a "touch screen”.
  • the touch sensor 180K is used to detect a touch operation on or near the touch sensor 180K.
  • the touch sensor can pass the detected touch operation to the application processor to determine the touch event type.
  • Visual output related to the touch operation may be provided through display screen 194 .
  • the touch sensor 180K may also be disposed on the surface of the electronic device 100 at a location different from that of the display screen 194 .
  • Bone conduction sensor 180M can acquire vibration signals.
  • the bone conduction sensor 180M can acquire the vibration signal of the vibrating bone mass of the human body's vocal part.
  • the bone conduction sensor 180M can also contact the human body's pulse and receive blood pressure beating signals.
  • the bone conduction sensor 180M can also be provided in an earphone and combined into a bone conduction earphone.
  • the audio module 170 can analyze the voice signal based on the vibration signal of the vocal vibrating bone obtained by the bone conduction sensor 180M to implement the voice function.
  • the application processor can analyze the heart rate information based on the blood pressure beating signal acquired by the bone conduction sensor 180M to implement the heart rate detection function.
  • the buttons 190 include a power button, a volume button, etc.
  • Key 190 may be a mechanical key. It can also be a touch button.
  • the electronic device 100 may receive key inputs and generate key signal inputs related to user settings and function control of the electronic device 100 .
  • the motor 191 can generate vibration prompts.
  • the motor 191 can be used for vibration prompts for incoming calls and can also be used for touch vibration feedback.
  • touch operations for different applications can correspond to different vibration feedback effects.
  • the motor 191 can also respond to different vibration feedback effects for touch operations in different areas of the display screen 194 .
  • Different application scenarios such as time reminders, receiving information, alarm clocks, games, etc.
  • the touch vibration feedback effect can also be customized.
  • the SIM card interface 195 is used to connect a SIM card.
  • the SIM card can be connected to or separated from the electronic device 100 by inserting it into the SIM card interface 195 or pulling it out from the SIM card interface 195 .
  • the electronic device 100 can support 1 or N SIM card interfaces, where N is a positive integer greater than 1.
  • SIM card interface 195 can support Nano SIM card, Micro SIM card, SIM card, etc. Multiple cards can be inserted into the same SIM card interface 195 at the same time. The types of the plurality of cards may be the same or different.
  • the SIM card interface 195 is also compatible with different types of SIM cards.
  • the SIM card interface 195 is also compatible with external memory cards.
  • the electronic device 100 interacts with the network through the SIM card to implement functions such as calls and data communications.
  • the electronic device 100 employs an eSIM: embedded SIM card.
  • the eSIM card can be embedded in the electronic device 100 and cannot be separated from the electronic device 100 .
  • the software system of the electronic device 100 may adopt a layered architecture, an event-driven architecture, a microkernel architecture, a microservice architecture, or a cloud architecture.
  • This embodiment of the present invention takes the Android system with a layered architecture as an example to illustrate the software structure of the electronic device 100 .
  • FIG. 4 is a software structure block diagram of the electronic device 100 according to the embodiment of the present invention.
  • the layered architecture divides the software into several layers, and each layer has clear roles and division of labor.
  • the layers communicate through software interfaces.
  • the Android system is divided into four layers, from top to bottom: application layer, application framework layer, Android runtime and system libraries, and kernel layer.
  • the application layer can include a series of application packages.
  • the application package can include camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message and other applications.
  • the application framework layer provides an application programming interface (API) and programming framework for applications in the application layer.
  • API application programming interface
  • the application framework layer includes some predefined functions.
  • the application framework layer can include window manager, content provider, view system, phone manager, resource manager, and JS programming framework.
  • a window manager is used to manage window programs.
  • the window manager can obtain the display size, determine whether there is a status bar, lock the screen, capture the screen, etc.
  • Content providers are used to store and retrieve data and make this data accessible to applications.
  • Said data can include videos, images, audio, calls made and received, browsing history and bookmarks, phone books, etc.
  • the view system includes visual controls, such as controls that display text, controls that display pictures, etc.
  • a view system can be used to build applications.
  • the display interface can be composed of one or more views.
  • a display interface including a text message notification icon may include a view for displaying text and a view for displaying pictures.
  • the phone manager is used to provide communication functions of the electronic device 100 .
  • call status management including connected, hung up, etc.
  • the resource manager provides various resources to applications, such as localized strings, icons, pictures, layout files, video files, etc.
  • the JS programming framework can be used to redefine the getter/setter methods of the JS data object passed in by the application through JS data hijacking to obtain the JS packaging object, and then package the JS packaging object into a JS distributed data object to obtain the JS distributed data. object.
  • the JS programming framework is also used to call the distributed memory database in the system library and store the obtained JS distributed data objects in the distributed memory database.
  • the JS programming framework When the electronic device 100 establishes a collaborative connection with the electronic device 200, the JS programming framework will create a session ID, which is associated with instance 1 of the distributed data object.
  • the collaboration message carries the session ID.
  • the electronic device 200 After receiving the collaboration message, the electronic device 200 parses out the session ID carried in the collaboration message, and the electronic device 100 saves the session ID as the session ID. Afterwards, the electronic device 100 sends the instance 1 of the distributed data object to the electronic device 200. After receiving the instance 1, the electronic device 200 generates a distributed data object based on the instance 1. At the same time, the electronic device 200 associates the local instance 1 with the session ID. Instance 1 on the electronic device 100 and instance 1 on the electronic device 200 are associated with the same session ID. In this way, after the attribute value of instance 1 of the electronic device 100 changes (for example, addition, deletion, check, and modification), the attribute value of instance 1 on the electronic device 200 also changes accordingly.
  • the attribute value of instance 1 of the electronic device 100 changes (for example, addition, deletion, check, and modification)
  • the attribute value of instance 1 on the electronic device 200 also changes accordingly.
  • Android Runtime includes core libraries and virtual machines. Android Runtime is responsible for the scheduling and management of the Android system.
  • the core library contains two parts: one is the functional functions that need to be called by the Java language, and the other is the core library of Android.
  • the application layer and application framework layer run in virtual machines.
  • the virtual machine executes the java files of the application layer and application framework layer into binary files.
  • the virtual machine is used to perform object life cycle management, stack management, thread management, security and exception management, and garbage collection and other functions.
  • System libraries can include multiple functional modules. For example: surface manager (surface manager), media libraries (Media Libraries), 3D graphics processing libraries (for example: OpenGL ES), 2D graphics engines (for example: SGL), distributed memory databases, etc.
  • surface manager surface manager
  • media libraries Media Libraries
  • 3D graphics processing libraries for example: OpenGL ES
  • 2D graphics engines for example: SGL
  • distributed memory databases etc.
  • the surface manager is used to manage the display subsystem and provides the fusion of 2D and 3D layers for multiple applications.
  • the media library supports playback and recording of a variety of commonly used audio and video formats, as well as static image files, etc.
  • the media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.
  • the 3D graphics processing library is used to implement 3D graphics drawing, image rendering, composition, and layer processing.
  • 2D Graphics Engine is a drawing engine for 2D drawing.
  • the distributed memory database can provide the ability to manage distributed databases, synchronize distributed databases between electronic devices, and access (add, delete, modify, and query) distributed data objects.
  • the kernel layer is the layer between hardware and software.
  • the kernel layer contains at least display driver, camera driver, audio driver, and sensor driver.
  • the following exemplifies the workflow of the software and hardware of the electronic device 100 in conjunction with capturing the photographing scene.
  • the corresponding hardware interrupt is sent to the kernel layer.
  • the kernel layer processes touch operations into raw input events (including touch coordinates, timestamps of touch operations, and other information). Raw input events are stored at the kernel level.
  • the application framework layer obtains the original input event from the kernel layer and identifies the control corresponding to the input event. Taking the touch operation as a touch click operation and the control corresponding to the click operation as a camera application icon control as an example, the camera application calls the interface of the application framework layer to start the camera application, and then starts the camera driver by calling the kernel layer. Camera 193 captures still images or video.
  • Figure 5 exemplarily shows a schematic diagram of functional modules of a JS programming framework provided by an embodiment of the present application.
  • the functional module schematic diagram of the JS programming framework shown in Figure 5 is a functional module schematic diagram of the collaborative initiating device side.
  • 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.
  • the distributed data object creation module 401 is used to receive data objects generated by application 1, redefine the getter/setter methods of the data objects passed in by the application according to the data hijacking method, obtain the packaging object, and then use the packaging object to Wrapped as distributed data objects.
  • Data hijacking refers to using preset code functions to intercept the access or modification behavior and perform additional operations when accessing or modifying an instance attribute of a data object.
  • the distributed data object creation module 401 calls the getter method to obtain the attributes of the instance one of the data object one. value.
  • the distributed data object creation module 401 calls the setter method to add data monitoring and data hijacking to the attribute value of instance one. In this way, when the attribute value of instance one changes, the distributed data object creation module 401 can detect the change of the attribute value of instance one, and update the attribute value of instance one in time.
  • 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 operate on the distributed data object (for example, update the value of the distributed data object, etc. ).
  • the data object can be a JS (java script) data object.
  • the distributed data object creation module 401 can redefine the getter method or setter method of the JS data object according to the JS data hijacking method, and finally obtain the JS packaging object, and then wrap the JS object Package it as a distributed data object and get a JS distributed data object.
  • the following embodiments of this application take the data object as a JS data object as an example for description.
  • the following embodiments of this application may also refer to JS distributed data objects as distributed data objects.
  • the distributed data object creation module 401 is also used to generate a session ID and associate the session ID with the corresponding instance of the distributed data object.
  • the distributed data object creation module 401 calls the cross-device communication module (not shown in Figure 5) to send the session ID to the peer device (or the device that accepts collaboration). After receiving the session ID, the peer device Finally, associate the session ID with instance 1 of application 1. In this way, after instance 1 on the local device (or the device initiating collaboration) and instance 1 on the peer device are associated with the same session ID, after the attribute value of instance 1 on the electronic device 100 changes, the attribute value of the instance 1 on the electronic device 200 changes. After the attribute value of instance 1 changes, data synchronization between different devices is achieved.
  • the distributed data object creation module 401 After the distributed data object creation module 401 obtains the distributed data object, the distributed data object creation module 401 sends the distributed data objects to the distributed data object synchronization module 402 and the distributed data object monitoring module 403 respectively.
  • the distributed data object synchronization module 402 is used to save the distributed data objects in the form of key-value (key-value) into the distributed memory database.
  • Table 1 exemplarily shows the storage form of distributed data objects in a distributed database.
  • distributed data object 1 includes field 1 and field 2.
  • Field 1 is stored in a distributed content database named kv store1.
  • the attribute value of field 1 stored in kv store1 is key1.
  • Field 2 is stored in a distributed content database named kv store1.
  • 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 the distributed content database named kv store2.
  • the attribute value of field 3 stored in kv store2 is key3.
  • Field 4 is stored in the distributed content database named kv store2.
  • 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 the distributed content database named kv store n.
  • the attribute value of field 5 stored in kv store n is key5.
  • Field 6 is stored in the database named kv store n. In the distributed content database of kv store n, the attribute value of field 6 stored in kv store n is key6.
  • the distributed data object monitoring module 403 is used to monitor whether the attribute value of the distributed data object has changed. If it has changed, the distributed data object monitoring module 403 will send the changed distributed data object to the distributed data object synchronization module. 402.
  • the distributed data object synchronization module 402 is also used to receive the changed distributed data object sent by the distributed data object monitoring module 403, and save the changed distributed data object in the form of key-value (key-value) to in a distributed in-memory database.
  • the distributed data object synchronization module 402 can simultaneously save the changed distributed data object and the distributed data object before the change to the distributed memory database.
  • the distributed data object synchronization module 402 can also be Replace the distributed data object before the change with the changed distributed data object. Based on this, the distributed data object synchronization module 402 only saves the distributed data object after the change, and no longer saves the distributed data object before the change.
  • FIG. 6 exemplarily shows an interaction diagram of the cooperation between the electronic device 100 and the electronic device 200 .
  • the electronic device 100 includes an application 601, a JS programming framework 602, a communication module 603, and a distributed memory database 604.
  • the electronic device 200 includes an application 605, a JS programming framework 606, a communication module 607, and a distributed memory database 608.
  • application 601 and application 605 may use the same application, for example, they are both the same map application.
  • Application 601 and application 605 are also considered to be not the same application, but are the same type of application. For example, they can both be applications that provide navigation services, but application 601 and application 605 are not applications developed by the same developer.
  • the following embodiments of this application are described by taking application 601 and application 605 as the same application (for example, both are application 1).
  • the embodiment of the present application takes the electronic device 100 as the device that initiates collaboration and the electronic device 200 as the device that accepts collaboration as an example for description.
  • the steps of collaborative interaction between the electronic device 100 and the electronic device 200 are as follows:
  • the application 601 on the electronic device When the electronic device 100 initiates collaboration with the electronic device 200, the application 601 on the electronic device generates a data object and sends the data object to the JS programming framework 602.
  • step 1 may also be executed after the electronic device 100 receives a message sent by the electronic device 200 agreeing to establish a cooperative connection, that is, step 1 may be executed after step 4.
  • the JS programming framework 602 in the electronic device 100 is used 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.
  • the communication module 603 After the communication module 603 receives the session ID, the communication module 603 sends a collaboration message to the electronic device 200 (for example, the communication module 607 on the electronic device 200).
  • the collaboration message is used to request to establish a collaborative connection with the electronic device 200.
  • the collaboration message also carries a session ID.
  • the collaboration message may not carry the session ID, and the communication module 603 in the electronic device 100 sends the session ID to the electronic device 200 alone, such as the communication module 607 on the electronic device 200.
  • the step of the communication module 603 sending the session ID to the communication module 607 alone may be executed after the electronic device 100 receives a message sent by the electronic device 200 agreeing to establish a collaborative connection. For example, after step 4, step 8, the communication module 603 separately sends the session ID to the communication module 607.
  • the electronic device 100 may perform the step of sending the session ID to the communication module 607 only once. For example, the electronic device 100 only needs to send the session ID to the communication module 607 once.
  • the electronic device 100 can periodically perform the step of sending the session ID to the communication module 607, and the electronic device 100 periodically sends the session ID to the electronic device 200. In this way, it can be avoided that the electronic device 200 does not receive the session ID because the electronic device 100 only sends the session ID once.
  • the electronic device 200 can send a message to the electronic device 100 (for example, the communication module 603 on the electronic device 100). Message agreeing to establish a collaborative connection.
  • the communication module 603 After receiving the message from the electronic device 200 agreeing to establish a collaborative connection, the communication module 603 sends a start collaboration instruction to the JS programming framework 602.
  • the start collaboration instruction is used to inform the JS programming framework 602 of the method based on data hijacking.
  • the data object is packaged into a distributed data object, and the distributed data object is sent to the electronic device 200, so that the electronic device 100 and the electronic device 200 start to collaborate.
  • the JS programming framework 602 in the electronic device 100 is used to package the data object into a distributed data object based on data hijacking, and save the distributed data object and session ID. to distributed memory database 604.
  • the distributed memory database 604 After the distributed memory database 604 receives the distributed data object and the session ID, the distributed memory database 604 saves the distributed data object into the distributed memory database 604 in the form of key-value. In some embodiments, the distributed memory database 604 also 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, you can refer to the relevant description in step 9. , the embodiments of this application will not be described in detail here.
  • step 6 can be executed at any time after the start of step 1 and before the start of step 5.
  • the JS programming framework 602 packages the data objects generated by the application 601 into distributed data objects in advance, which can avoid the need for additional processing in the JS programming framework. After receiving the start collaboration instruction, the data objects generated by the application are packaged into distributed data objects. Based on this, the method provided by the embodiment of the present application can avoid the occurrence of collaboration delay.
  • the distributed memory database 604 After the distributed memory database 604 obtains the distributed data object, the distributed memory database 604 sends the distributed data object to the communication module 603.
  • step 7 can be executed after the JS programming framework 602 obtains the distributed data object, which can avoid the JS programming framework 602 only starting to send the distributed data object to the communication after receiving the start collaboration instruction.
  • Module 603 based on this, the method provided by the embodiment of the present application can avoid the occurrence of collaborative delay.
  • the communication module 603 sends the distributed data to the communication module 607 on the electronic device 200 .
  • Distributed data includes types of data objects and attribute values of instances of data objects.
  • step 8 can be executed immediately after step 4.
  • the electronic device 100 prepares the distributed data object in advance, and immediately sends the distributed data object to the electronic device 200 after receiving the message agreeing to establish a collaborative connection. communication module 607 on the system, in this way, the collaborative delay time can be reduced.
  • the communication module 607 After receiving the session ID, the communication module 607 sends the distributed data and session ID to the JS programming framework 606 on the electronic device 200.
  • the communication module 607 can send distributed data and session ID to the JS programming framework 606 respectively.
  • the communication module 607 can send the distributed data and session ID to the JS programming framework 606 at the same time.
  • the communication module 607 may send the session ID to the JS programming framework 606 after step 4 and before step 9.
  • the JS programming framework 606 After the JS programming framework 606 receives the distributed data, the JS programming framework 606 generates a distributed data object based on the attribute value of the instance of the data object.
  • the JS programming framework 606 After receiving the distributed data and 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, so that the session IDs associated with any two identical instances on the electronic device 100 are the same. The data between the two identical instances on the electronic device 100 and the electronic device 200 remains consistent. In this way, when the data object on instance 1 on the electronic device 100 changes, the same change occurs on instance 1 on the electronic device 200 . Data synchronization when the electronic device 100 and the electronic device 200 cooperate is maintained.
  • the JS programming framework 606 sends the distributed data object to the distributed memory database 608.
  • the distributed memory database 608 After the distributed memory database 608 receives the distributed data object, the distributed memory database 608 saves the distributed data object into the distributed memory database 608 in the form of key-value.
  • Figures 7 to 9 exemplarily show a UI diagram in which any two instances between a set of two collaborative devices are associated with the same session ID.
  • the type of data object of the distributed data sent by the electronic device 100 to the electronic device 200 can be divided into one or more types.
  • data objects of the same type may also include one or more instances of different types.
  • the electronic device 100 establishes a collaborative connection with the electronic device 200.
  • the electronic device 100 uses the data object generated by Application 1 to create a distributed data object based on the JS programming framework provided by the embodiment of this application.
  • the data type of the distributed data object may be one or more indivual.
  • the data type of the distributed data object is one (data object one)
  • the data object one has multiple instances, but the types of different instances are not distinguished.
  • a distributed data object with multiple instances of different types also has one instance.
  • the electronic device 100 creates session ID-1 through the JS programming framework, and associates session ID-1 with instance 1. Afterwards, the electronic device 100 sends the attribute value of the instance 1, the type of the data object and the session ID-1 to the electronic device 200. After receiving the type of the instance 1 and the data object, the electronic device 200 determines the value of the instance 1 based on the type of the data object. Generate data object 1, and associate instance 1 on the electronic device 200 with session ID-1.
  • 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).
  • session ID-1 session ID 1
  • the data object on the instance 2 on the electronic device 200 will also change in the same way.
  • Data synchronization when the electronic device 100 and the electronic device 200 cooperate is maintained.
  • the electronic device 100 creates multiple different session IDs through the JS programming framework, and sends multiple different session IDs, attribute values of different instances, and types of data objects to the electronic device 200 .
  • the electronic device 200 After receiving multiple different session IDs, attribute values of different instances, and types of data objects, the electronic device 200 generates data object one based on the attribute values of different instances and the types of data objects, and stores the same instance on the electronic device 100 Associated with the same session ID.
  • the electronic device 100 creates n different session IDs through the JS programming framework, associates instance 1 with session ID-1, and associates the instance 1 with session ID-1. 2 is associated with session ID-2, and instance n is associated with session ID-n. Afterwards, the electronic device 100 sends multiple different session IDs, attribute values of different instances, and types of data objects to the electronic device 200 . The electronic device 100 generates data object one based on the attribute value of instance 1, the attribute value of instance 2, and the attribute value of instance n. After that, the electronic device 200 associates instance 1 with session ID-1, associates instance 2 with session ID-2, and associates instance n with session ID-n. In this way, when there are n instance types of the same data object, the same instance on the electronic device 100 and the electronic device 200 are associated with the same session ID.
  • the attribute value of any instance on the electronic device 100 changes, the attribute value of the instance associated with the same session ID on the electronic device 200 will also change in the same way.
  • the attribute value on instance 1 on electronic device 100 changes, the attribute value on instance 1 on electronic device 200 will also change in the same way.
  • Data synchronization when the electronic device 100 and the electronic device 200 cooperate is maintained.
  • the electronic device 100 needs to create multiple different session IDs through the JS programming framework, and send multiple different session IDs, attribute values of different instances, and types of data objects to the electronic device 200. After receiving multiple different session IDs, attribute values of different instances, and types of data objects, the electronic device 200 generates a data object based on the attribute values of different instances and the types of data objects, and stores the same instance on the electronic device 100 Associated with the same session ID.
  • the electronic device 100 creates n different session IDs through the JS programming framework, associates instance 1 with session ID-1, and associates the instance 1 with session ID-1. 2 is associated with session ID-2, and instance n is associated with session ID-n. Afterwards, the electronic device 100 sends multiple different session IDs, attribute values of different instances, and types of data objects to the electronic device 200 .
  • the electronic device 200 generates data object one based on the attribute value of instance 1, the attribute value of instance 2, and the attribute value of instance n. After that, the electronic device 200 associates instance 1 with session ID-1, associates instance 2 with session ID-2, and associates instance n with session ID-n. In this way, when there are n instance types of the same data object, the same instance on the electronic device 100 and the electronic device 200 are associated with the same session ID.
  • the electronic device 100 creates m different session IDs through the JS programming framework, associates instance n+1 with session ID-n+1, and associates instance n+2 with session ID. -n+2 to associate, associate instance n+m with session ID-n+m. Afterwards, the electronic device 100 sends multiple different session IDs, attribute values of different instances, and types of data objects to the electronic device 200 .
  • the electronic device 200 generates data object two based on the attribute value of instance n+1, the attribute value of instance n+2, and the attribute value of instance n+m. After that, the electronic device 200 associates instance n+1 with session n+1, associates instance n+2 with session ID-n+2, and associates instance n+m with session ID-n+m.
  • Figures 7 to 9 exemplarily show UI diagrams in which any two instances between a set of two collaborative devices are associated with the same session ID.
  • multiple devices (more than 2 devices) can be established at the same time. Collaborative connections. When multiple devices establish collaborative connections at the same time, multiple devices can also associate the same session ID through instances between any two devices to achieve data synchronization.
  • Figures 10 to 12 illustrate UI diagrams in which any two instances of a set of multi-collaboration devices are associated with the same session ID.
  • the embodiment of this application explains the principle of how to achieve data synchronization by associating the same session ID between instances when three devices (such as electronic device 100, electronic device 200 and electronic device 300) establish a collaborative connection at the same time.
  • the electronic device 300 may also be called a third electronic device.
  • electronic device 100 is a device that initiates collaboration
  • electronic device 200 and electronic device 300 are devices that accept collaboration.
  • the electronic device 100 When the data type of the data object is 1 (data object one), and the type of the instance of the data object is also 1, the electronic device 100 creates session ID-1 through the JS programming framework, and combines session ID-1 with Instance 1 is associated. Afterwards, the electronic device 100 sends the attribute value and session ID-1 of instance 1 to the electronic device 200 and the electronic device 300 respectively.
  • the electronic device 200 After receiving the attribute value of instance 1 and session ID-1, the electronic device 200 generates data object one based on the attribute value of instance 1, and associates instance 1 with session ID-1. In this way, instance 1 on the electronic device 100 and instance 1 on the electronic device 200 are associated with the same session ID (session ID-1).
  • the electronic device 300 After receiving the attribute value of instance 1 and session ID-1, the electronic device 300 generates data object one based on the attribute value of instance 1, and associates instance 1 with session ID-1. In this way, instance 1 on the electronic device 300 and instance 1 on the electronic device 100 are associated with the same session ID (session ID-1).
  • 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.
  • electronic device 100 is a device that initiates collaboration
  • electronic device 200 and electronic device 300 are devices that accept collaboration.
  • the electronic device 100 creates multiple different session IDs through the JS programming framework, and sends multiple different session IDs and attribute values of different instances to the electronic device 200 and the electronic device 300.
  • the electronic device 200 After receiving multiple different session IDs and attribute values of different instances, the electronic device 200 generates data object one based on the attribute values of the different instances, and associates the same instance on the electronic device 200 with the same session ID.
  • the electronic device 300 After receiving multiple different session IDs and attribute values of different instances, the electronic device 300 generates data object one based on the attribute values of the different instances, and associates the same instance on the electronic device 300 with the same session ID.
  • the electronic device 100 is programmed through JS
  • the framework creates n different session IDs 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 sends multiple different session IDs and attribute values of different instances to the electronic device 200 and the electronic device 300 .
  • the electronic device 200 generates data object one based on the attribute value of instance 1, the attribute value of instance 2, and the attribute value of instance n.
  • the electronic device 200 associates instance 1 with session ID-1, instance 2 with session ID-2, and instance n with session ID-n.
  • the electronic device 300 generates data object one based on the attribute value of instance 1, the attribute value of instance 2, and the attribute value of instance n. After that, the electronic device 300 associates instance 1 with session ID-1, associates instance 2 with session ID-2, and associates instance n with session ID-n.
  • the same session ID is associated with the same instance on the electronic device 100 and the electronic device 200 and the electronic device 300 .
  • the data objects on any instance of the electronic device 100 change, the data objects on the instances associated with the same session ID on the electronic device 200 and the electronic device 300 will also change in the same way.
  • the data object on instance 1 on electronic device 100 changes, the data object on instance 1 on electronic device 200 will also change.
  • the data object on instance 1 on electronic device 300 will also change. Same changes. Data synchronization when the electronic device 100 and the electronic device 200 cooperate with the electronic device 300 is maintained.
  • the electronic device 100 when the electronic device 100 establishes collaborative connections with multiple other devices, the electronic device 100 may send different types of data objects to different collaborative devices.
  • electronic device 100 is a device that initiates collaboration
  • electronic device 200 and electronic device 300 are devices that accept collaboration.
  • the electronic device 100 creates multiple different session IDs through the JS programming framework, and sends multiple different session IDs and attribute values of different instances to the electronic device 200.
  • the electronic device 200 After receiving multiple different session IDs and attribute values of different instances, the electronic device 200 generates data object one based on the attribute values of the different instances, and associates the same instance on the electronic device 200 with the same session ID.
  • the electronic device 300 After receiving multiple different session IDs and attribute values of different instances, the electronic device 300 generates data object one based on the attribute values of the different instances, and associates the same instance on the electronic device 300 with the same session ID.
  • electronic device 100 and electronic device 300 collaborate based on data object one.
  • Electronic device 100 creates n different session IDs through the JS programming framework. And associate instance 1 with session ID-1, associate instance 2 with session ID-2, and associate instance n with session ID-n.
  • the electronic device 100 sends multiple different session IDs and attribute values of different instances to the electronic device 300 .
  • the electronic device 300 generates data object one based on the attribute value of instance 1, the attribute value of instance 2, and the attribute value of instance n.
  • the electronic device 300 associates instance 1 with session ID-1, associates instance 2 with session ID-2, and associates instance n with session ID-n.
  • electronic device 100 and electronic device 200 collaborate based on data object two.
  • Electronic device 100 creates m different session IDs through the JS programming framework. And associate instance n+1 with session ID-n+1, associate instance n+2 with session ID-n+2, and instance n+m Associate with session ID-n+m.
  • the electronic device 100 sends multiple different session IDs and attribute values of different instances to the electronic device 200 .
  • the electronic device 200 generates data object two based on the attribute value of instance n+1, the attribute value of instance n+2, and the attribute value of instance n+m.
  • the electronic device 200 associates instance n+1 with session ID-n+1, associates instance n+2 with session ID-n+2, and associates instance n+m with session ID-n+m.
  • the distributed memory database 608 sends distributed data objects to the application 605 on the electronic device 200 .
  • the application 605 After the application 605 receives the distributed data object, the application 605 will output the distributed data object, and the electronic device 200 and the electronic device 100 start to collaborate.
  • the electronic device 100 when the number of devices that establish cooperative connections at the same time is multiple (for example, three), for example, when the electronic device 100 establishes a cooperative connection with the electronic device 200, the electronic device 100 also establishes a cooperative connection with the electronic device 300.
  • the electronic device 300 interacts cooperatively with the electronic device 100
  • the electronic device 300 After the application on the electronic device 300 obtains the distributed data object sent by the electronic device 100, the electronic device 300 can output the distributed data object, and the electronic device 300 and the electronic device 100 begin to collaborate.
  • the electronic device 100, the electrical device 200 and the electronic device 300 establish a collaborative connection at the same time.
  • session identifiers such as session ID-1, session ID-2,..., session ID-n, session ID-n+1, session ID-n+2,..., session ID-n+m each are not the same, and the above session identifiers are only used to illustrate that the session identifiers associated with different instances are different.
  • the session identifiers can also be in other forms of expression, and the embodiments of this application do not limit this.
  • steps 1 to 10 can be deleted or replaced. Alternatively, the order of execution of some of the above-mentioned steps 1 to 10 can be adjusted to be executed before or after other steps, etc.
  • the execution sequence of steps 1 to 10 shown in FIG. 6 is only a schematic diagram illustrating the cooperation of the electronic device 100 and the electronic device 200 and should not be construed as a limitation.
  • the above embodiment introduces the process of how to realize collaboration between devices. After the device establishes a collaborative connection, the data object on application 1 will also change (for example, the attribute value of the instance in the data object is updated, etc.), then the attribute value of the corresponding instance on the electronic device 200 will also change, realizing the establishment of collaboration. Data synchronization between devices. Next, we will introduce the specific implementation of data synchronization between collaborative devices.
  • Figure 13 shows a schematic diagram of realizing data synchronization between devices that establish collaboration.
  • Achieving data synchronization between collaborative devices mainly includes the following steps:
  • the application 601 sends the changed data object to the JS programming framework 602.
  • the type of the data object after the change has not changed, but the attribute values of the instances of the data object have changed.
  • the attribute value of instance 1 of the data object before the change is the first value
  • the attribute value of instance 1 of the data object after the change is the second value.
  • the JS programming framework 602 packages the changed data object into a changed distributed data object based on data hijacking, and saves the changed distributed data object to the distribution in the form of key-value (key-value). in memory database 604.
  • the distributed memory database 604 corresponds the changed distributed data object to the changed distributed data object.
  • the session identification is sent to the communication module 603.
  • 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.
  • the changed distributed data includes the changed attribute values of the instance and the type of the data object.
  • the distributed memory database 604 will monitor the instance attributes of the distributed data objects and monitor whether the instance attributes of the distributed data objects have changed. If so, the distributed memory database 604 will store the changed distributed data objects and the changed The session identifier corresponding to the distributed data object is sent to the communication module 603.
  • the distributed memory database 604 sends the changed distributed data object to the communication module 603, which is used by the communication module 603 to send the changed distributed data object to the electronic device 200, so that the electronic device 200 updates the distributed data object.
  • the distributed memory database 604 sends the session identifier corresponding to the changed distributed data object to the communication module 603, for the communication module 603 to send the session identifier corresponding to the changed distributed data object to the electronic device 200, so that the electronic device 200 can Based on the received session identifier, the device 200 determines the instance identifier associated with the received session identifier on the electronic device 200 and replaces the attribute value of the instance corresponding to the instance identifier with the changed attribute value. The electronic device 200 determines the instance identifier based on the received session identifier. The changed attribute value of the instance generates the changed distributed data object.
  • step 3 can also be replaced with:
  • the distributed memory database 604 sends the changed distributed data objects and instance identifiers to the communication module 603.
  • step 4 can also be replaced with:
  • the communication module 603 sends the changed distributed data and instance identification to the communication module 607.
  • the communication module 603 sends 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 can also determine the instance on the electronic device 200 based on the instance identifier.
  • the changed attribute value of the instance generates the changed distributed data object.
  • the communication module 607 can send the changed distributed data and session ID to the JS programming framework 606 respectively.
  • the communication module 607 can send the distributed data and session ID to the JS programming framework 606 at the same time.
  • the JS programming framework 606 After the JS programming framework 606 receives the changed distributed data, the JS programming framework 606 generates the changed distributed data object based on the changed attribute values of the instance.
  • the JS programming framework 606 determines the instance identifier associated with the received session ID, and sets the attribute value of the instance corresponding to the instance identifier. Replaced with the changed attribute value, the JS programming framework 606 generates the changed distributed data object based on the changed attribute value of the instance.
  • the JS programming framework 606 sends the changed distributed data object to the distributed memory database 608.
  • the distributed memory database 608 After the distributed memory database 608 receives the changed distributed data object, the distributed memory database 608 stores the changed distributed data object locally in the form of key-value.
  • the distributed memory database 608 sends the changed distributed data object to the application 605.
  • the application 605 After the application 605 receives the changed distributed data object, the application 605 can output the changed distributed data object.
  • Figure 14 is a schematic flowchart of a device collaboration method provided by an embodiment of the present application.
  • the electronic device 100 and the electronic device 200 establish a collaborative connection.
  • the electronic device 100 and the electronic device 200 can establish a collaborative connection in any of the following ways.
  • Method 1 The electronic device 100 and the electronic device 200 are connected to the same network.
  • the electronic device 100 and the electronic device 200 can be connected to the same local area network to establish a collaborative connection.
  • Method 2 The electronic device 100 and the electronic device 200 can also log in to the same system account and establish a collaborative connection.
  • the system accounts logged in by the multiple electronic devices can all be "HW1234".
  • Method 3 The system accounts logged in on the electronic device 100 and the electronic device 200 may both belong to the same account group.
  • the system accounts logged in to the electronic device 100 and the electronic device 200 include "HW001" and "HW002".
  • System accounts "HW001” and “HW002” both belong to the account group "Huawei Home”.
  • the electronic device 100 and the electronic device 200 can use near field communication (NFC), Bluetooth (bluetooth, BT), wireless local area networks (WLAN), such as wireless fidelity point to point to point, Wi-Fi P2P), infrared technology (infrared, IR) and other methods to establish collaborative connections.
  • NFC near field communication
  • Bluetooth bluetooth, BT
  • WLAN wireless local area networks
  • Wi-Fi P2P wireless fidelity point to point to point, Wi-Fi P2P
  • infrared technology infrared, IR
  • Method 5 The electronic device 100 and the electronic device 200 can establish a temporary account group by scanning the same QR code and establish a collaborative connection to achieve communication.
  • the electronic device 100 can also establish a collaborative connection with the electronic device 200 through other methods, which are not limited in the embodiments of the present application.
  • the electronic device 100 and the electronic device 200 can also be connected and communicated in any of the above ways, and this is not limited in the embodiments of the present application.
  • the electronic device 100 acquires data object one.
  • Data object one includes instance 1, and the attribute value of instance 1 is the first value.
  • data object one may also be called the first data object
  • instance 1 may also be called the first instance
  • the attribute value of instance 1 may also be called the first instance attribute
  • the electronic device 100 starts application 1 and obtains data object one on instance 1.
  • Data object one includes instance 1, and the attribute value of instance 1 is the first value.
  • the types of data objects in application 1 can also be multiple, and each type of data object can also include multiple instance types. This is not limited in the embodiments of the present application.
  • the electronic device 100 creates distributed data objects in a data hijacking manner.
  • the electronic device 100 can monitor the instance attribute values of the distributed data objects and only send the changed instance attribute values to the electronic device 200, thereby reducing the amount of data sent and improving efficiency.
  • data object one includes instance 1 and instance 2, and the electronic device 100 can monitor the attribute values of instance 1 and instance 2.
  • the electronic device 100 detects that the attribute value of instance 2 has changed but the attribute value of instance 1 has not changed, the electronic device 100 can only send the changed attribute value of instance 2 to the electronic device 200 without sending the instance to the electronic device 100 attribute value of 1. In this way, the amount of data transmission between collaborative devices is reduced and the device collaboration efficiency is improved.
  • instance 2 may also be called a third instance, and the attribute value of instance 2 may also be called a third instance attribute.
  • the electronic device 100 obtains data object one and data object two.
  • Data object one includes instance 1 and instance 2
  • data object two includes instance 3 and instance 4.
  • the electronic device 100 can monitor changes in instance attribute values of real data object one and instance attribute values of data object two.
  • the electronic device 100 detects that the attribute value of instance 3 has changed but the attribute value of instance 1 has not changed, the electronic device 100 can only send the second data object (instance 3 and instance 4) to the electronic device 200 without the need to send the data object
  • Data objects one and two are sent to the electronic device 200 at the same time, but only the changed data objects (instance 3 and instance 4) are sent to the electronic device 200 .
  • the amount of data transmission between the cooperating devices can also be reduced.
  • data object two may also be called the second data object
  • instance 3 may also be called the second instance
  • the attribute value of instance 3 may also be called the second instance attribute
  • the electronic device 100 packages data object one into distributed data object one based on data hijacking, and obtains the attribute value of instance 1 as the first value.
  • the electronic device 100 obtains the attribute value of instance 1 based on data hijacking. In this way, through data hijacking, you can monitor whether the attribute value of instance 1 has changed, and update the changed attribute value of instance 1 in a timely manner, ensuring data consistency between collaborative devices.
  • the electronic device 100 obtains the attribute value of instance 2 based on data hijacking. In this way, through data hijacking, you can monitor whether the attribute value of instance 2 has changed, and update the changed attribute value of instance 2 in a timely manner, ensuring data consistency between collaborative devices.
  • the electronic device 100 After the electronic device 100 packages the data object 1 into a distributed data object 1 based on data hijacking, the electronic device 100 also needs to save the distributed data object 1 to the distributed database in the form of key-value. . Specifically, reference may be made to the relevant descriptions in Table 1, and the embodiments of the present application will not be described again here.
  • the electronic device 100 After the electronic device 100 creates distributed data object one, the electronic device 100 can also access the distributed data object.
  • the electronic device 100 sends the attribute value of instance 1 to the electronic device 200.
  • the electronic device 100 also obtains instance 3 of data object two, and the electronic device 100 sends the attribute value of instance 3 to the electronic device 200 .
  • the electronic device 100 sends the attribute value of instance 1 to the electronic device 200 , which may also be referred to as the electronic device 100 sending the attribute value of instance 1 to the electronic device 200 through the first session.
  • the session identifier of the first session is the first session identifier.
  • Instance 1 is associated with the session ID of the first session.
  • the electronic device 100 establishes a collaborative connection with the electronic device 200, and the electronic device 100 sends a collaborative message to the electronic device 200.
  • the collaborative message includes the instance identifier of instance 1 and the session identifier of the first session;
  • the session ID is associated with instance 1.
  • the electronic device 100 associates instance 1 with the session identifier of the first session, so that after receiving the session identifier of the first session, the electronic device 200 associates instance 1 on the electronic device 200 with the session identifier of the first session.
  • the same two instances on the electronic device 100 and the electronic device 200 are associated with the same session identifier, ensuring the consistency of the attributes of the two identical instances on the electronic device 100 and the electronic device 200 and ensuring the consistency of the collaborative data. sex.
  • the electronic device 100 sends the attribute value of Example 3 to the electronic device 200 , which may also be referred to as the electronic device 100 sending the attribute value of Example 3 to the electronic device 200 through the second session.
  • the session identifier of the second session is the second session identifier.
  • Instance 3 is associated with the session ID of the second session.
  • the electronic device 100 sends different types of instances to the electronic device 200 through different sessions.
  • the electronic device 100 associates the same session identifier with the same instance on the electronic device 200, that is, instance 1 on the electronic device 100 and the instance on the electronic device 200. 1 is associated with the first session identifier, and instance 3 on the electronic device 100 and instance 3 on the electronic device 200 are both associated with the second session identifier.
  • the electronic device 100 also obtains instance 2 of data object one, and the electronic device 100 sends the attribute value of instance 2 to the electronic device 200 through the first session.
  • the electronic device 200 generates distributed data object one based on the attribute value of instance 1 and the attribute value of instance 2. In this way, in the case where data object one includes two types of instances, the electronic device 100 sends both instance 1 and instance 2 to the electronic device 200 through the first session, that is, between the electronic device 100 and the electronic device 200,
  • the same data objects are associated with the same session ID, and instances of different types under the same type of data objects are not distinguished.
  • the electronic device 100 sends the changed data object 1 to the electronic device 200 .
  • the electronic device 100 also obtains instance 2 of data object one, and the electronic device 100 sends the attribute value of instance 2 to the electronic device 200 through the third session.
  • the electronic device 200 generates distributed data object one based on the attribute value of instance 1 and the attribute value of instance 2.
  • data object 1 includes two types of instances
  • electronic device 100 sends instance 1 and instance 2 to electronic device 200 through different sessions respectively, that is, between electronic device 100 and electronic device 200, Two identical instances are associated with the same session ID, and different types of instances under the same type of data object need to be distinguished.
  • the attributes of instance 1 on the electronic device 100 change, the electronic device 100 only sends the changed attributes of instance 1 to the electronic device 200 without sending the attribute values of instance 2, which reduces the transmission of data between collaborative devices. quantity, improving collaborative efficiency.
  • the first electronic device establishes a cooperative connection with the second electronic device and the third electronic device.
  • the first electronic device sends the first instance attribute to the third electronic device through the fourth session, and sends the second instance attribute to the third electronic device through the fifth session.
  • the first instance attribute is used by the third electronic device to generate the first data object
  • the second instance attribute is used by the third electronic device to generate a second data object.
  • the session identifier of the fourth session is the fourth session identifier
  • the session identifier of the fifth session is the fifth session identifier.
  • the fourth session ID may be session ID-1 shown in Figure 11
  • the fifth session ID may be session ID-n shown in Figure 11. For details, please refer to the relevant description in Figure 11.
  • the first electronic device sends the first instance attribute to the third electronic device through the fourth session, and sends the second instance attribute to the third electronic device through the fifth session. It can be understood that the first electronic device transmits the first instance attribute on the first electronic device to the third electronic device. One instance is associated with the fourth session identification, and the first electronic device associates the second instance on the first electronic device with the fifth session identification. Afterwards, the first electronic device sends the identification of the first instance and the fourth session identification to the third electronic device, and the first electronic device sends the identification of the second instance and the fifth session identification to the third electronic device.
  • the third electronic device associates the first instance on the third electronic device with the fourth session identifier, and the third electronic device associates the second instance on the third electronic device with the fifth session identifier, that is, the third instance on the first electronic device
  • the first instance on the first electronic device and the first instance on the third electronic device are both associated with the fourth session identifier, and the second instance on the first electronic device and the second instance on the third electronic device are both associated with the fifth session identifier.
  • three electronic devices can establish collaborative connections at the same time, and the properties of the same instance among multiple devices are also the same, ensuring the consistency of collaborative data.
  • the first electronic device establishes a cooperative connection with the second electronic device and the third electronic device.
  • the first electronic device generates a third data object; the first electronic device obtains the fourth instance attribute of the third data object; the first electronic device sends the fourth instance attribute to the third electronic device through the sixth session, and the first electronic device Four instance attributes are used by the third electronic device to generate the third data object.
  • the session ID of the sixth session is the sixth session ID.
  • the sixth session ID may be any one of session ID-n+1, session ID-n+2, ..., 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 FIG. 12 . For details, please refer to the relevant description in Figure 12.
  • the first electronic device sends the fourth instance attribute to the third electronic device through the sixth session. It can be understood that the first electronic device associates the fourth instance on the first electronic device with the sixth session identifier. After that, the first electronic device The electronic device sends the identification of the fourth instance and the sixth session identification to the third electronic device, and the third electronic device associates the fourth instance on the third electronic device with the sixth session identification, that is, the fourth instance on the first electronic device Both the instance and the fourth instance on the third electronic device are associated with a sixth session identification.
  • the first electronic device when the first electronic device establishes collaborative connections with multiple different electronic devices, the first electronic device can simultaneously transmit different collaborative data with the multiple different electronic devices, thereby improving the functional diversity of device collaboration.
  • the electronic device 200 generates distributed data object one based on the attribute value of instance 1, and outputs distributed data object one.
  • the electronic device 100 After receiving the attribute value of instance 1, the electronic device 100 generates distributed data object one based on the attribute value of instance 1, and outputs distributed data object one.
  • the electronic device 200 After the electronic device 200 generates the distributed data object one, the electronic device 200 also needs to save the distributed data object one into the distributed database in the form of key-value. Specifically, reference may be made to the relevant descriptions in Table 1, and the embodiments of the present application will not be described again here.
  • the electronic device 100 can also monitor the data collaboration status with the electronic device 200, and the electronic device 200 can also monitor the data collaboration status with the electronic device 100.
  • the data collaboration status includes data collaboration success and data collaboration failure.
  • the data collaboration may fail due to the disconnection between the electronic device 100 and the electronic device 200 , or the data collaboration may fail because the format of the distributed data object stored on the electronic device 100 is different from the format of the distributed data object stored on the electronic device 200 .
  • the name of the monitoring data collaboration failure port may change, but the principle is similar, and the embodiments of the present application do not limit this.
  • 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).
  • session identifier 1 may also be called a first session identifier, and the first session identifier is the session identifier of the first session.
  • the same two instances on the electronic device 100 and the electronic device 200 are bound to the same session identifier, and the data between the two identical instances on the electronic device 100 and the electronic device 200 remains consistent.
  • the data on the instance 1 on the electronic device 200 also changes accordingly.
  • session ID genSession ID()
  • the electronic device 100 sends a specific implementation of the interface of the session identification to the electronic device 200 .
  • the electronic device 200 parses and obtains the session identifier sent by the electronic device 200, and associates the instance 1 on the electronic device 100 with the instance 1 on the electronic device 200 with the same session identifier (session identifier 1), so that the electronic device 100 and the electronic device 200 The data between the two identical instances remains consistent.
  • the electronic device 100 detects that the attribute value of instance 1 changes from the first value to the second value.
  • the second value of instance 1 may also be referred to as the changed first instance attribute.
  • the electronic device 100 updates distributed data object 1 and obtains the attribute value of instance 1 as the second value.
  • the type of the updated distributed data object one has not changed, only the attribute values of the instances on the updated distributed data object one have changed.
  • data object one may be audio navigation information
  • the first value of the attribute value of instance 1 may be the audio content "remaining distance 5 kilometers”.
  • the second value of the instance 1 attribute value may be the audio content "remaining distance 3 kilometers”.
  • the electronic device 100 After the electronic device 100 updates the distributed data object one, the electronic device 100 also needs to save the updated distributed data object one into the distributed database in the form of key-value. Specifically, reference may be made to the relevant descriptions in Table 1, and the embodiments of the present application will not be described again here.
  • the electronic device 100 can save the distributed data object one and the updated distributed data object one to the distributed database at the same time.
  • the electronic device 100 can also save only the updated distributed data object one and delete the distributed data. Object one.
  • the electronic device 100 sends the attribute value of instance 1 and the session identifier 1 to the electronic device 200.
  • the electronic device 100 sends the attribute value of instance 1 and the session identifier 1 to the electronic device 200, which may also be referred to as the electronic device 100 sending the changed attribute value of instance 1 to the third session through the first session. 2.
  • the first electronic device only sends the changed instance attributes to the second electronic device without sending the unchanged instance attributes, which reduces the amount of data transmission between the collaborating devices and improves the collaboration efficiency.
  • the electronic device 100 sends the attribute value (second value) of instance 1 to the electronic device 200, so that the electronic device 200 updates distributed data object one based on the attribute value (second value) of instance 1.
  • the electronic device 100 sends the session identifier 1 to the electronic device 200, so that the electronic device 200 determines the instance identifier (the identifier of instance 1) associated with the session identifier 1 on the electronic device 200 based on the received session identifier 1, and sends the electronic device 200 to the electronic device 200.
  • the attribute value on instance 1 on device 200 is modified from the first value to the second value, and distributed data object one is updated based on the attribute value on instance 1.
  • the electronic device 200 modifies the attribute value of instance 1 from the first value to the second value, updates distributed data object one based on the attribute value of instance 1, and outputs the updated distributed data object one.
  • the electronic device 200 modifies the attribute value of instance 1 from the first value to the second value, updates distributed data object one based on the attribute value of instance 1, and outputs the updated distributed data object one.
  • the electronic device 200 also needs to save the updated distributed data object into the distributed database in the form of key-value. Specifically, reference may be made to the relevant descriptions in Table 1, and the embodiments of the present application will not be described again here.
  • the electronic device 200 can save distributed data object one and the updated distributed data object one to the distributed database at the same time.
  • the electronic device 200 can also save only the updated distributed data object one and delete it. Drop distributed data object one.
  • the electronic device 100 is a mobile phone
  • the electronic device 200 is a smart watch.
  • the mobile phone does not have the ability to process navigation information.
  • the mobile phone and the smart watch are on the same distributed network, the mobile phone can seamlessly switch the map information for navigation on the mobile phone with one click.
  • the smart watch will continue to display navigation information, making it convenient for users to view navigation information while riding.
  • the electronic device 100 may display a home screen interface 1301.
  • the interface 1301 displays a page with application icons placed thereon.
  • the page includes multiple application icons (for example, a weather application icon). , stock application icon, calculator application icon, settings application icon, mail application icon, music application icon, video application icon, browser application icon, map application icon 1302, etc.).
  • Page indicators are also displayed below multiple application icons to indicate the positional relationship between the currently displayed page and other pages.
  • There are multiple tray icons below the page indicator such as dialer application icon, message application icon, contact application icon, camera application icon), and the tray icon remains displayed when the page is switched.
  • the electronic device 100 may receive an input operation (such as a click) by the user on the map application icon 1302. In response to the input operation, the electronic device 100 may respond to the input operation.
  • the electronic device 100 may display as shown in FIG. 15B Map application interface 1303.
  • the electronic device 100 displays a map application interface 1303.
  • the map application interface 1303 includes a map 1304 and a search box.
  • Map 1304 displays surrounding map information of the user's current location.
  • the search box can be used to receive user input of a destination name.
  • the electronic device 100 may receive a destination name (eg, "Cheonan Cloud Valley") input by the user in the destination search box, and in response to the input operation, the electronic device 100 may display a window 1305 .
  • the window 1305 may include the distance between the current geographical location of the electronic device 100 and the destination (for example, 5.2KM), destination address information ("Guangdongzhou-Shenzhen City-Longgang District-Ban Xuegang Avenue 163 Park") and navigation controls 1306 .
  • the electronic device 100 can receive a user's input operation (such as a click) on the navigation control 1306. In response to the input operation, the electronic device 100 can start navigation and obtain the route from the current location of the electronic device 100 to the destination from the map server. information, and the interface 1307 shown in Figure 15D is displayed in full screen.
  • a user's input operation such as a click
  • the interface 1307 may display a map, a location mark 1308, a driving route 1309 from the current location of the electronic device 100 to the destination, more controls 1310, and an exit control 1311.
  • the location marker 1308 may be used to indicate the current location of the electronic device 100 on the map.
  • the more controls 1310 can be used to trigger the display of more other functional controls.
  • the exit control 1311 can be used to trigger the electronic device 100 to exit navigation.
  • the electronic device 100 sends navigation information to the electronic device 200, and the electronic device 200 displays the navigation information.
  • the electronic device 100 can send navigation information and audio information to the electronic device 200, and the electronic device 200 will display the navigation information. , and play the audio information through the audio output device.
  • the information can be "Continue to go 500 meters and enter Bell Road, there is 4.5KM left to the destination, and it will take 17 minutes.”
  • the computer program product includes one or more computer instructions.
  • the computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device.
  • the computer instructions may be stored in or transmitted from one computer-readable storage medium to another, e.g., the computer instructions may be transferred from a website, computer, server, or data center Transmission to another website, computer, server or data center through wired (such as coaxial cable, optical fiber, digital subscriber line) or wireless (such as infrared, wireless, microwave, etc.) means.
  • the computer-readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. that contains one or more available media integrated.
  • the available media may be magnetic media (eg, floppy disk, hard disk, magnetic tape), optical media (eg, DVD), or semiconductor media (eg, solid state drive (SSD)), etc.
  • the program can be stored in a computer-readable storage medium.
  • the aforementioned storage media include: ROM, random access memory (RAM), magnetic disks, optical disks and other media that can store program codes.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Computing Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer And Data Communications (AREA)

Abstract

本申请公开了一种设备协同方法,第一电子设备与第二电子设备建立协同连接;第一电子设备获取到第一数据对象的第一实例属性以及第二数据对象的第二实例属性;第一电子设备通过第一会话发送第一实例属性给第二电子设备,通过第二会话发送第二实例属性给第二电子设备。这样,使得第一电子设备与第二电子设备间相同的两个数据对象关联同一个会话标识。第一电子设备可以监测不同类型的数据对象的属性变化,仅将属性发生变化的数据对象发送至第二电子设备,这样,可以减少协同设备间数据传输量,提高了协同设备协同的效率,提高了协同设备协同的效率。

Description

一种设备协同方法
本申请要求于2022年03月24日提交中国专利局、申请号为202210297167.3、申请名称为“一种设备协同方法”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及电子设备技术领域,尤其涉及一种设备协同方法。
背景技术
随着电子设备的发展,多设备互联场景在生活中日益增强,跨设备访问、多设备协同的需求也日益迫切。
目前,多设备协同时,设备之间可以实现资源共享。但是,在设备间进行数据协同时,设备之间需要建立数据传递链路和接口,操作比较复杂。因此。如何提高设备协同的效率,是亟待解决的问题。
发明内容
本申请提供了一种设备协同方法,可以减少协同设备间数据传输量,提高了协同设备协同的效率。
第一方面,本申请提供了一种设备协同方法,包括第一电子设备与第二电子设备建立协同连接;第一电子设备获取到第一数据对象的第一实例属性以及第二数据对象的第二实例属性;第一电子设备通过第一会话发送第一实例属性给第二电子设备,通过第二会话发送第二实例属性给第二电子设备,第一实例属性用于第二电子设备生成所述第一数据对象,第二实例属性用于第二电子设备生成第二数据对象。第一会话的会话标识为第一会话标识。第二会话的会话标识为第二会话标识。在第一电子设备获取到第一数据对象的第一实例属性以及第二数据对象的第二实例属性之前,第一电子设备还生成第一数据对象和第二数据对象。通过第一方面提供的一种设备协同方法,第一电子设备将不同类型的数据对象通过不同的会话发送至第二电子设备,第一电子设备与第二电子设备上相同的数据对象关联同一个会话标识,即第一电子设备上的第一实例和第二电子设备上的第一实例均关联了第一会话标识,第一电子设备上的第二实例和第二电子设备上的第二实例均关联了第二会话标识。这样,第一电子设备可以监测不同类型的数据对象的属性变化,仅将属性发生变化的数据对象发送至第二电子设备,这样,可以减少协同设备间数据传输量,提高了协同设备协同的效率,避免了发送的数据量太多导致设备协同延迟的情况发生。
结合第一方面,在一种可能的实现方式中,方法还包括:第一电子设备获取到第一数据对象的第三实例属性;第一电子设备通过第一会话发送第三实例属性给第二电子设备,第一实例属性和第三实例属性共同用于第二电子设备生成所述第一数据对象。这样,在第一数据对象包括两种类型的实例的情况下,第一电子设备将第一实例和第三实例均通过第一会话发送至第二电子设备,也就是说,将第一电子设备和第二电子设备间,相同的数据对象间关联同一个会话标识,不区分同一类型数据对象下的不同类型的实例。当第一电子设备上的第一 数据对象的属性发生变化时,第一电子设备将发生变化后的第一数据对象发送至第二电子设备。
结合第一方面,在一种可能的实现方式中,方法还包括:第一电子设备获取到第一数据对象的第三实例属性;第一电子设备通过第三会话发送第三实例属性给第二电子设备,第一实例属性和第三实例属性共同用于第二电子设备生成第一数据对象。这样,在第一数据对象包括两种类型的实例的情况下,第一电子设备将第一实例和第三实例分别通过不同的会话发送至第二电子设备,也就是说,将第一电子设备和第二电子设备间,相同的两个实例间关联同一个会话标识,需区分同一类型数据对象下的不同类型的实例。当第一电子设备上的第一实例的属性发生变化时,第一电子设备仅将发生变化后的第一实例的属性发送至第二电子设备,不需发送第三实例属性,减少了协同设备间数据的传输量,提高了协同效率。
结合第一方面,在一种可能的实现方式中,在第一电子设备通过第一会话发送第一实例属性给第二电子设备之后,方法还包括:电子设备监测到第一实例属性有变化,将变化后的第一实例属性通过第一会话发送给第二电子设备,变化后的第一实例属性用于第二电子设备更新第一数据对象。这样,第一电子设备仅将发发生变化后的实例属性发送至第二电子设备,不需发送没有发生变化的实例属性,减少了协同设备间数据的传输量,提高了协同效率。
结合第一方面,在一种可能的实现方式中,第一电子设备与第二电子设备建立协同连接,具体包括:第一电子设备向所述第二电子设备发送协同消息,协同消息中包括有第一实例的实例标识和第一会话的会话标识;第一会话的会话标识与第一实例关联。这样,第一电子设备将第一实例与第一会话的会话标识关联,使得第二电子设备在接收到第一会话的会话标识后,将第二电子设备上的第一实例与第一会话的会话标识关联。这样,第一电子设备和第二电子设备上相同的两个实例间关联了同一个会话标识,保证了第一电子设备和第二电子设备上相同的两个实例的属性的一致性,保证了协同数据的一致性。
结合第一方面,在一种可能的实现方式中,方法还包括:第一电子设备与第三电子设备建立协同连接;第一电子设备通过第四会话发送第一实例属性给第三电子设备,通过第五会话发送第二实例属性给第三电子设备,第一实例属性用于第三电子设备生成第一数据对象,第二实例属性用于第三电子设备生成第二数据对象。
第四会话的会话标识为第四会话标识,第五会话的会话标识为第五会话标识。第一电子设备通过第四会话发送第一实例属性给第三电子设备,通过第五会话发送第二实例属性给第三电子设备,可以理解为,第一电子设备将第一电子设备上的第一实例与第四会话标识关联,第一电子设备将第一电子设备上的第二实例与第五会话标识关联。之后,第一电子设备将第一实例的标识和第四会话标识发送至第三电子设备,第一电子设备将第二实例的标识和第五会话标识发送至第三电子设备。第三电子设备将第三电子设备上的第一实例与第四会话标识关联,第三电子设备将第三电子设备上的第二实例与第五会话标识关联,即第一电子设备上的第一实例和第三电子设备上的第一实例均关联第四会话标识,第一电子设备上的第二实例和第三电子设备上的第二实例均关联第五会话标识。
这样,可以三个电子设备同时建立协同连接,且多个设备间的相同的实例的属性也一样,保证了协同数据的一致性。
结合第一方面,在一种可能的实现方式中,方法还包括:第一电子设备与第三电子设备建立协同连接;第一电子设备生成第三数据对象;第一电子设备获取到第三数据对象的第四实例属性;第一电子设备通过第六会话发送所述第四实例属性给第三电子设备,所述第四实例属性用于所述第三电子设备生成所述第三数据对象。
第六会话的会话标识为第六会话标识。第一电子设备通过第六会话发送所述第四实例属性给第三电子设备,可以理解为,第一电子设备将第一电子设备上的第四实例与第六会话标识关联,之后,第一电子设备将第四实例的标识和第六会话标识发送至第三电子设备,第三电子设备将第三电子设备上的第四实例与第六会话标识关联,即第一电子设备上的第四实例和第三电子设备上的第四实例均关联第六会话标识。
这样,第一电子设备与多个不同的电子设备建立协同连接时,第一电子设备可以与多个不同的电子设备同时传递不同的协同数据,提高了设备协同的功能多样性。
结合第一方面,在一种可能的实现方式中,第一电子设备获取到第一数据对象的第一实例属性以及述第二数据对象的第二实例属性,具体包括:第一电子设备基于数据劫持的方式获取到第一数据对象的第一实例属性以及第二数据对象的第二实例属性。这样,通过数据劫持的方式,可以监听第一实例属性和第二实例属性是否发生了变化,并及时更新变化后的第一实例属性和/或第二实例属性,保证了协同设备间的数据一致性。
结合第一方面,在一种可能的实现方式中,第一数据对象与所述第一会话关联,第二数据对象与所述第二会话关联。第一数据对象包括文字数据对象、图片数据对象、音频数据对象和视频数据对象中的至少一种。第二数据对象也包括文字数据对象、图片数据对象、音频数据对象和视频数据对象中的至少一种。第一数据对象和第二数据对象不同。
第二方面,本申请提供了一种协同方法,方法包括:第二电子设备与第一电子设备建立协同连接;第二电子设备通过第一会话接收第一电子设备发送的第一数据对象的第一实例属性,第二电子设备通过第二会话接收第一电子设备发送的第二数据对象的第二实例属性;第二电子设备基于第一实例属性生成第一数据对象,第二电子设备基于第二实例属性生成第二数据对象。第一会话的会话标识为第一会话标识。第二会话的会话标识为第二会话标识。在第一电子设备获取到第一数据对象的第一实例属性以及第二数据对象的第二实例属性之前,第一电子设备还生成第一数据对象和第二数据对象。通过第二方面提供的一种设备协同方法,第二电子设备通过不同的会话接收第二电子设备发送的不同类型的数据对象通过,第二电子设备与第低电子设备上相同的数据对象关联同一个会话标识,即第一电子设备上的第一实例和第二电子设备上的第一实例均关联了第一会话标识,第一电子设备上的第二实例和第二电子设备上的第二实例均关联了第二会话标识。这样,第一电子设备可以监测不同类型的数据对象的属性变化,仅将属性发生变化的数据对象发送至第二电子设备,这样,可以减少协同设备间数据传输量,提高了协同设备协同的效率,避免了发送的数据量太多导致设备协同延迟的情况发生。
结合第二方面,在一种可能的实现方式中,方法还包括:第二电子设备通过第一会话接收第一电子设备发送的第一数据对象的第三实例属性;第二电子设备基于第一实例属性和所 述第三实例属性共同生成第一数据对象。这样,在第一数据对象包括两种类型的实例的情况下,第二电子设备将通过第一会话接收第一电子设备发送的第一实例和第三实例,也就是说,将第一电子设备和第二电子设备间,相同的数据对象间关联同一个会话标识,不区分同一类型数据对象下的不同类型的实例。当第一电子设备上的第一数据对象的属性发生变化时,第一电子设备将发生变化后的第一数据对象发送至第二电子设备。
结合第二方面,在一种可能的实现方式中,方法还包括:第二电子设备通过第三会话接收第一电子设备发送的第一数据对象的第三实例属性;第二电子设备基于第一实例属性和所述第三实例属性共同生成第一数据对象。这样,在第一数据对象包括两种类型的实例的情况下,第二电子设备分别通过不同的会话接收第二电子设备发送的第一实例和第三实例,也就是说,将第一电子设备和第二电子设备间,相同的两个实例间关联同一个会话标识,需区分同一类型数据对象下的不同类型的实例。当第一电子设备上的第一实例的属性发生变化时,第一电子设备仅将发生变化后的第一实例的属性发送至第二电子设备,不需发送第三实例属性,减少了协同设备间数据的传输量,提高了协同效率。
结合第二方面,在一种可能的实现方式中,在第二电子设备通过第一会话接收第一电子设备发送的第一数据对象的第一实例属性后,方法还包括:第二电子设备通过第一会话接收第一电子设备发送的第一数据对象变化后的所述第一实例属性;第二电子设备基于变化后的所述第一实例属性生成第一数据对象。这样,第一电子设备仅将发发生变化后的实例属性发送至第二电子设备,不需发送没有发生变化的实例属性,减少了协同设备间数据的传输量,提高了协同效率。
结合第二方面,在一种可能的实现方式中,第二电子设备与第一电子设备建立协同连接具体包括:第二电子设备接收第一电子设备发送的协同消息,协同消息中包括有第一实例属性的实例标识和第一会话的会话标识,第一会话的会话标识与第一实例属性关联。这样,第一电子设备将第一实例与第一会话的会话标识关联,使得第二电子设备在接收到第一会话的会话标识后,将第二电子设备上的第一实例与第一会话的会话标识关联。这样,第一电子设备和第二电子设备上相同的两个实例间关联了同一个会话标识,保证了第一电子设备和第二电子设备上相同的两个实例的属性的一致性,保证了协同数据的一致性。
结合第二方面,在一种可能的实现方式中,第一数据对象与所述第一会话关联,第二数据对象与所述第二会话关联;所述第一数据对象和所述第二数据对象不同。
结合第二方面,在一种可能的实现方式中,第一数据对象包括文字数据对象、图片数据对象、音频数据对象和视频数据对象中的至少一种。
第三方面,本申请提供了一种电子设备,为第一电子设备,第一电子设备包括一个或多个功能单元,一个或多个功能单元用于第一电子设备执行上述任一方面任一可能的实现方式中提供的额一种设备协同方法。
第四方面,本申请提供了一种电子设备,为第二电子设备,第二电子设备包括一个或多个功能单元,一个或多个功能单元用于第二电子设备执行上述任一方面任一可能的实现方式 中提供的额一种设备协同方法。
第五方面,本申请提供了一种电子设备,为第一电子设备,第一电子设备包括:一个或多个处理器、一个或多个存储器;其中,一个或多个存储器与一个或多个处理器耦合,一个或多个存储器用于存储计算机程序代码,计算机程序代码包括计算机指令,一个或多个处理器调用计算机指令以使得第一电子设备执行上述任一方面任一可能的实现方式中提供的额一种设备协同方法。
第六方面,本申请提供了一种电子设备,为第二电子设备,第二电子设备包括:一个或多个处理器、一个或多个存储器;其中,一个或多个存储器与一个或多个处理器耦合,一个或多个存储器用于存储计算机程序代码,计算机程序代码包括计算机指令,一个或多个处理器调用计算机指令以使得第二电子设备执行上述任一方面任一可能的实现方式中提供的额一种设备协同方法。
第七方面,本申请提供了一种计算机可读存储介质,用于存储计算机指令,当计算机指令在第一电子设备上运行时,使得第一电子设备执行上述任一方面任一可能的实现方式中提供的额一种设备协同方法。
第八方面,本申请提供了一种计算机可读存储介质,用于存储计算机指令,当计算机指令在第二电子设备上运行时,使得第二电子设备执行上述任一方面任一可能的实现方式中提供的额一种设备协同方法。
第九方面,本申请提供了一种计算机程序产品,当所述计算机程序产品在第一电子设备上运行时,使得所述第一电子设备执行上述任一方面任一可能的实现方式中提供的额一种设备协同方法。
第十方面,本申请提供了一种计算机程序产品,当所述计算机程序产品在第二电子设备上运行时,使得第二电子设备执行上述任一方面任一可能的实现方式中提供的一种设备协同方法。
对于第二方面至第十方面的有益效果,可以参考第一方面中有益效果的相关描述,本社申请实施例在此不再赘述。
附图说明
图1为本申请实施例提供的一种RPC机制的部分过程示意图;
图2为本申请实施例提供的一种系统400的架构示意图;
图3为本申请实施例提供的一种电子设备100的结构示意图;
图4为本申请实施例提供的一种电子设备100的软件结构框图;
图5为本申请实施例提供的一种JS编程框架的功能模块示意图;
图6为本申请实施例提供的一种电子设备100和电子设备200协同的交互示意图;
图7-图9示例性示出了一组两个协同设备间的任意两个实例关联同一个session ID的UI 图;
图10-图12示例性示出了一组多协同设备间的任意两个实例关联同一个session ID的UI图;
图13为本申请实施例提供的一种实现建立协同的设备间的数据同步的示意图;
图14为本申请实施例提供的一种设备协同方法的流程示意图;
图15A-图15G为本申请实施例提供的一组UI图。
具体实施方式
下面将结合附图对本申请实施例中的技术方案进行清楚、详尽地描述。其中,在本申请实施例的描述中,除非另有说明,“/”表示或的意思,例如,A/B可以表示A或B;文本中的“和/或”仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况,另外,在本申请实施例的描述中,“多个”是指两个或多于两个。
以下,术语“第一”、“第二”仅用于描述目的,而不能理解为暗示或暗示相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括一个或者更多个该特征,在本申请实施例的描述中,除非另有说明,“多个”的含义是两个或两个以上。
本申请以下实施例中的术语“用户界面(user interface,UI)”,是应用程序或操作系统与用户之间进行交互和信息交换的介质接口,它实现信息的内部形式与用户可以接受形式之间的转换。用户界面常用的表现形式是图形用户界面(graphic user interface,GUI),是指采用图形方式显示的与计算机操作相关的用户界面。它可以是在电子设备的显示屏中显示的文本、图标、按钮、菜单、选项卡、文本框、对话框、状态栏、导航栏、Widget等可视的界面元素。
目前,电子设备之间可以通过远程过程调用(remote procedure call,RPC)机制建立数据传递链路和接口,进行数据协同。
图1示例性示出了RPC机制的部分过程示意图。
RPC机制主要包括以下步骤:
1、服务端定义并实现远程消息调用的AIDL接口。
2、服务端通过服务器向客户端公开该AIDL接口。
3、客户端与服务端建立长连接。
4、客户端绑定客户端,调用客户端的AIDL接口,调用客户端上的消息。
由上述步骤可以看出,现有的RPC机制具体实现时,客户端绑定服务端,客户端和服务端需保持一个长连接,增加了客户端的内部资源消耗。开发人员还需实现服务端的通信接口创建、客户端与服务端的绑定(也可以说是客户端与服务端通信连路的建立)以及客户端与服务端保持长连接等内部代码实现,增加了开发人员的负担。
因此,本申请实施例提供了一种设备协同方法,方法包括:通过本申请实施例提供的编程框架,电子设备100可以以数据劫持的方式将数据对象进行getter/setter方法重定义,得到 分布式数据对象,电子设备100可以检测分布式数据对象的属性值是否变化,之后电子设备100将分布式数据发送至电子设备200;同时电子设备100与电子设备200间相同的两个实例间或者相同的数据对象间关联同一个会话标识(session ID),使得电子设备100与电子设备200间相同的两个实例间数据相同,实现了电子设备间分布式数据对象的自动同步。
在一些实施例中,电子设备100也可以被称为第一电子设备,电子设备200也可以被称为第二电子设备。
通过本申请实施例提供的方法,一方面,本申请实施例提供的编程框架,无需区分客户端和服务端,也无需使得电子设备之间保持长连接,提高了应用开发者的开发效率。另一方面,以数据劫持的方式创建分布式数据对象,电子设备100可以监测分布式数据对象的实例属性值,仅将发生变化的实例属性值发送至电子设备200,减少了数据发送量,提高了设备协同的效率。再一方面,本申请实施例能够实现多电子设备间资源共享的效果。
例如,在用户骑车时不方便使用手机导航的情况下,手机也没处理导航信息的能力,当手机和智能手表处于同一分布式网络时,手机可以实现一键将手机上导航的地图信息无缝切换至智能手表上,由智能手表来继续显示导航信息,方便用户一边骑车一边查看导航信息。
又例如,手机和电视处于同一分布式网络的情况下,手机可以一键将手机上看的视频无缝切换至电视上,由电视来继续提供播放视频,享受大屏体验。
又例如,在办公室场景中,在开会时,可以由一个工作人员操作办公电脑展示演示文件,该办公电脑可以与周围其他人员的办公设备建立协同连接,使得办公电脑上的演示文件可以展示在周围其他人员的办公设备上,提高了办公效率。
接下来介绍本申请实施例提供的一种系统架构。
请参考图2,图2示出了本申请实施例提供的一种系统400的架构示意图。
该系统400中可以包括有多个电子设备。多个电子设备的设备类型可以为各种类型,本申请实施例对该多个电子设备的具体类型不作特殊限制。例如,该多个电子设备包括手机,还可以包括平板电脑、桌面型计算机、膝上型计算机、手持计算机、笔记本电脑、智慧屏、可穿戴式设备、增强现实(augmented reality,AR)设备、虚拟现实(virtual reality,VR)设备、人工智能(artificial intelligence,AI)设备、车机、智能耳机,游戏机,还可以包括物联网(internet of things,IOT)设备或智能家居设备如智能热水器、智能灯具、智能空调等等。不限于此,系统400中的多个设备还可以包括具有触敏表面或触控面板的膝上型计算机(laptop)、具有触敏表面或触控面板的台式计算机等非便携式终端设备等等。
该多个电子设备可以配置不同的软件操作系统(operatingsystem,OS),包括但不限于等等。其中,为华为的鸿蒙系统。
该多个电子设备也可以都配置相同的软件操作系统,例如可以均配置
该多个电子设备可以通过以下任意一种方式建立协同连接。
方式一:该多个电子设备可以是连入同一个网络,例如,该多个电子设备可以连入同一 个局域网,建立协同连接。
方式二:该多个电子设备还可以登录同一个系统账号,建立协同连接。例如,该多个电子设备登录的系统账号都可以为“HW1234”。
方式三:该多个电子设备上登录的系统账号可以都属于同一个账户组。例如,该多个电子设备上登录的系统账号包括有“HW001”,“HW002”,“HW003”。系统账户“HW001”,“HW002”,“HW003”同属于账户组“华为之家”。
方式四:多个电子设备可以通过近场通信(Near Field Communication,NFC)、蓝牙(bluetooth,BT)、无线局域网(wireless local area networks,WLAN)例如无线保真点对点(wireless fidelity point to point,Wi-Fi P2P)、红外技术(infrared,IR)等方式建立协同连接。
方式五:多个电子设备可以通过扫描同一个二维码建立一个临时账户组,建立协同连接实现通信。
不限于上述五种方式,电子设备100还可以通过其他的方式建立协同连接,本申请实施例对此不做限定。
此外,多个电子设备也可以结合上述任意几种方式来连接并通信,本申请实施例对此也不做限制。
在其他实施例中,系统400也可以只包括两个电子设备,例如电子设备100和电子设备200,电子设备100和电子设备100建立协同连接。本申请以下实施例以系统400包括两个电子设备为例进行说明,电子设备100为手机,电子设备200为手表。
电子设备100上安装有一个或多个应用,电子设备200上也安装有一个或多个应用。电子设备100和电子设备200建立协同连接后,电子设备100基于本申请实施例提供的JS编程框架创建应用1的分布式数据对象。之后,电子设备100将分布式数据对象发送至电子设备200,电子设备200可以输出分布式数据对象。例如在用户骑车时不方便使用手机导航的情况下,当手机和智能手表处于同一分布式网络时,手机可以实现一键将手机上导航的地图信息无缝切换至智能手表上,由智能手表来继续显示导航信息,方便用户一边骑车一边查看导航信息。
在电子设备100与电子设备200建立协同连接时,JS编程框架将创建session ID,与分本地创建的应用1的实例1相关联。之后,电子设备200获取到的session ID,并将session ID和电子设备200上的应用1的实例1相关联。这样,在电子设备100上的分布式数据对象发生变化(例如更新)之后,电子设备100上的分布式数据对象也发生相应的变化。
需要说明的是,数据对象可以理解为应用程序运行时产生的内存数据(也可以称为业务数据),实例可以理解为某一个具体类型的数据对象的具体化,数据对象包括一种或多种类型的数据对象,每一种类型的数据对象可以包括一种或多种类型的实例。数据对象的类型包括但不仅限于:音频数据对象、文字数据对象、图片数据对象、视频数据对象等。例如,电子设备100上的导航应用开启并运行时,电子设备100可以一边显示的导航应用导航的路线信息,同时通过语音播报导航应用导航的路线信息,那么可以将电子设备100显示的导航应用导航的路线信息称为图片数据对象,电子设备100通过语音播报导航应用导航的路线信息称为音频数据对象。示例性的,数据对象可以是导航信息中的文字数据对象,导航信息中的文 字数据对象又可以包括多种不同类型的实例,多种不同类型的实例可以是时间实例、剩余距离实例、时长实例等。
在一些实施例中,对于同一种类型的数据对象,该数据对象包括多种不同类型的实例,电子设备也可以将该多种不同类型的实例统称为同一个实例,也可以不在区分实例的类型,每一种类型的数据对象仅包括一个实例。
对于JS编程框架创建分布式数据对象的具体实现,将在后续实施例中详细介绍,本申请实施例在此不做赘述。
图3示出了电子设备100的结构示意图。
电子设备100可以包括处理器110,外部存储器接口120,内部存储器121,通用串行总线(universal serial bus,USB)接口130,充电管理模块140,电源管理模块141,电池142,天线1,天线2,移动通信模块150,无线通信模块160,音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,传感器模块180,按键190,马达191,指示器192,摄像头193,显示屏194,以及用户标识模块(subscriber identification module,SIM)卡接口195等。传感器模块180可以包括压力传感器180A,陀螺仪传感器180B,气压传感器180C,磁传感器180D,加速度传感器180E,距离传感器180F,接近光传感器180G,指纹传感器180H,温度传感器180J,触摸传感器180K,环境光传感器180L,骨传导传感器180M等。
可以理解的是,本发明实施例示意的结构并不构成对电子设备100的具体限定。在本申请另一些实施例中,电子设备100可以包括比图示更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。图示的部件可以以硬件,软件或软件和硬件的组合实现。
处理器110可以包括一个或多个处理单元,例如:处理器110可以包括应用处理器(application processor,AP),调制解调处理器,图形处理器(graphics processing unit,GPU),图像信号处理器(image signal processor,ISP),控制器,视频编解码器,数字信号处理器(digital signal processor,DSP),基带处理器,和/或神经网络处理器(neural-network processing unit,NPU)等。不同的处理单元可以是独立的器件,也可以集成在一个或多个处理器中。
控制器可以根据指令操作码和时序信号,产生操作控制信号,完成取指令和执行指令的控制。
处理器110中还可以设置存储器,用于存储指令和数据。在一些实施例中,处理器110中的存储器为高速缓冲存储器。该存储器可以保存处理器110刚用过或循环使用的指令或数据。如果处理器110需要再次使用该指令或数据,可从所述存储器中直接调用。避免了重复存取,减少了处理器110的等待时间,因而提高了系统的效率。
在一些实施例中,处理器110可以包括一个或多个接口。接口可以包括集成电路(inter-integrated circuit,I2C)接口,集成电路内置音频(inter-integrated circuit sound,I2S)接口,脉冲编码调制(pulse code modulation,PCM)接口,通用异步收发传输器(universal asynchronous receiver/transmitter,UART)接口,移动产业处理器接口(mobile industry processor interface,MIPI),通用输入输出(general-purpose input/output,GPIO)接口,用户标识模块(subscriber  identity module,SIM)接口,和/或通用串行总线(universal serial bus,USB)接口等。
I2C接口是一种双向同步串行总线,包括一根串行数据线(serial data line,SDA)和一根串行时钟线(derail clock line,SCL)。在一些实施例中,处理器110可以包含多组I2C总线。处理器110可以通过不同的I2C总线接口分别耦合触摸传感器180K,充电器,闪光灯,摄像头193等。例如:处理器110可以通过I2C接口耦合触摸传感器180K,使处理器110与触摸传感器180K通过I2C总线接口通信,实现电子设备100的触摸功能。
I2S接口可以用于音频通信。在一些实施例中,处理器110可以包含多组I2S总线。处理器110可以通过I2S总线与音频模块170耦合,实现处理器110与音频模块170之间的通信。在一些实施例中,音频模块170可以通过I2S接口向无线通信模块160传递音频信号,实现通过蓝牙耳机接听电话的功能。
PCM接口也可以用于音频通信,将模拟信号抽样,量化和编码。在一些实施例中,音频模块170与无线通信模块160可以通过PCM总线接口耦合。在一些实施例中,音频模块170也可以通过PCM接口向无线通信模块160传递音频信号,实现通过蓝牙耳机接听电话的功能。所述I2S接口和所述PCM接口都可以用于音频通信。
UART接口是一种通用串行数据总线,用于异步通信。该总线可以为双向通信总线。它将要传输的数据在串行通信与并行通信之间转换。在一些实施例中,UART接口通常被用于连接处理器110与无线通信模块160。例如:处理器110通过UART接口与无线通信模块160中的蓝牙模块通信,实现蓝牙功能。在一些实施例中,音频模块170可以通过UART接口向无线通信模块160传递音频信号,实现通过蓝牙耳机播放音乐的功能。
MIPI接口可以被用于连接处理器110与显示屏194,摄像头193等外围器件。MIPI接口包括摄像头串行接口(camera serial interface,CSI),显示屏串行接口(display serial interface,DSI)等。在一些实施例中,处理器110和摄像头193通过CSI接口通信,实现电子设备100的拍摄功能。处理器110和显示屏194通过DSI接口通信,实现电子设备100的显示功能。
GPIO接口可以通过软件配置。GPIO接口可以被配置为控制信号,也可被配置为数据信号。在一些实施例中,GPIO接口可以用于连接处理器110与摄像头193,显示屏194,无线通信模块160,音频模块170,传感器模块180等。GPIO接口还可以被配置为I2C接口,I2S接口,UART接口,MIPI接口等。
USB接口130是符合USB标准规范的接口,具体可以是Mini USB接口,Micro USB接口,USB Type C接口等。USB接口130可以用于连接充电器为电子设备100充电,也可以用于电子设备100与外围设备之间传输数据。也可以用于连接耳机,通过耳机播放音频。该接口还可以用于连接其他电子设备,例如AR设备等。
可以理解的是,本发明实施例示意的各模块间的接口连接关系,只是示意性说明,并不构成对电子设备100的结构限定。在本申请另一些实施例中,电子设备100也可以采用上述实施例中不同的接口连接方式,或多种接口连接方式的组合。
充电管理模块140用于从充电器接收充电输入。其中,充电器可以是无线充电器,也可以是有线充电器。在一些有线充电的实施例中,充电管理模块140可以通过USB接口130接收有线充电器的充电输入。在一些无线充电的实施例中,充电管理模块140可以通过电子设备100的无线充电线圈接收无线充电输入。充电管理模块140为电池142充电的同时,还可以通过电源管理模块141为电子设备供电。
电源管理模块141用于连接电池142,充电管理模块140与处理器110。电源管理模块141接收电池142和/或充电管理模块140的输入,为处理器110,内部存储器121,显示屏194,摄像头193,和无线通信模块160等供电。电源管理模块141还可以用于监测电池容量,电池循环次数,电池健康状态(漏电,阻抗)等参数。在其他一些实施例中,电源管理模块141也可以设置于处理器110中。在另一些实施例中,电源管理模块141和充电管理模块140也可以设置于同一个器件中。
电子设备100的无线通信功能可以通过天线1,天线2,移动通信模块150,无线通信模块160,调制解调处理器以及基带处理器等实现。
天线1和天线2用于发射和接收电磁波信号。电子设备100中的每个天线可用于覆盖单个或多个通信频带。不同的天线还可以复用,以提高天线的利用率。例如:可以将天线1复用为无线局域网的分集天线。在另外一些实施例中,天线可以和调谐开关结合使用。
移动通信模块150可以提供应用在电子设备100上的包括2G/3G/4G/5G等无线通信的解决方案。移动通信模块150可以包括至少一个滤波器,开关,功率放大器,低噪声放大器(low noise amplifier,LNA)等。移动通信模块150可以由天线1接收电磁波,并对接收的电磁波进行滤波,放大等处理,传送至调制解调处理器进行解调。移动通信模块150还可以对经调制解调处理器调制后的信号放大,经天线1转为电磁波辐射出去。在一些实施例中,移动通信模块150的至少部分功能模块可以被设置于处理器110中。在一些实施例中,移动通信模块150的至少部分功能模块可以与处理器110的至少部分模块被设置在同一个器件中。
调制解调处理器可以包括调制器和解调器。其中,调制器用于将待发送的低频基带信号调制成中高频信号。解调器用于将接收的电磁波信号解调为低频基带信号。随后解调器将解调得到的低频基带信号传送至基带处理器处理。低频基带信号经基带处理器处理后,被传递给应用处理器。应用处理器通过音频设备(不限于扬声器170A,受话器170B等)输出声音信号,或通过显示屏194显示图像或视频。在一些实施例中,调制解调处理器可以是独立的器件。在另一些实施例中,调制解调处理器可以独立于处理器110,与移动通信模块150或其他功能模块设置在同一个器件中。
无线通信模块160可以提供应用在电子设备100上的包括无线局域网(wireless local area networks,WLAN)(如无线保真(wireless fidelity,Wi-Fi)网络),蓝牙(bluetooth,BT),全球导航卫星系统(global navigation satellite system,GNSS),调频(frequency modulation,FM),近距离无线通信技术(near field communication,NFC),红外技术(infrared,IR)等无线通信的解决方案。无线通信模块160可以是集成至少一个通信处理模块的一个或多个器件。无线通信模块160经由天线2接收电磁波,将电磁波信号解调以及滤波处理,将处理后的信号发送到处 理器110。无线通信模块160还可以从处理器110接收待发送的信号,对其进行调频,放大,经天线2转为电磁波辐射出去。
在一些实施例中,电子设备100的天线1和移动通信模块150耦合,天线2和无线通信模块160耦合,使得电子设备100可以通过无线通信技术与网络以及其他设备通信。所述无线通信技术可以包括全球移动通讯系统(global system for mobile communications,GSM),通用分组无线服务(general packet radio service,GPRS),码分多址接入(code division multiple access,CDMA),宽带码分多址(wideband code division multiple access,WCDMA),时分码分多址(time-divion code divion multiple access,TD-SCDMA),长期演进(long term evolution,LTE),BT,GNSS,WLAN,NFC,FM,和/或IR技术等。所述GNSS可以包括全球卫星定位系统(global positioning system,GPS),全球导航卫星系统(global navigation satellite system,GLONASS),北斗卫星导航系统(beidou navigation satellite system,BDS),准天顶卫星系统(quasi-zenith satellite system,QZSS)和/或星基增强系统(satellite based augmentation systems,SBAS)。
电子设备100通过GPU,显示屏194,以及应用处理器等实现显示功能。GPU为图像处理的微处理器,连接显示屏194和应用处理器。GPU用于执行数学和几何计算,用于图形渲染。处理器110可包括一个或多个GPU,其执行程序指令以生成或改变显示信息。
显示屏194用于显示图像,视频等。显示屏194包括显示面板。显示面板可以采用液晶显示屏(liquid crystal display,LCD),有机发光二极管(organic light-emitting diode,OLED),有源矩阵有机发光二极体或主动矩阵有机发光二极体(active-matrix organic light emitting diode的,AMOLED),柔性发光二极管(flex light-emitting diode,FLED),Miniled,MicroLed,Micro-oLed,量子点发光二极管(quantum dot light emitting diodes,QLED)等。在一些实施例中,电子设备100可以包括1个或N个显示屏194,N为大于1的正整数。
电子设备100可以通过ISP,摄像头193,视频编解码器,GPU,显示屏194以及应用处理器等实现拍摄功能。
ISP用于处理摄像头193反馈的数据。例如,拍照时,打开快门,光线通过镜头被传递到摄像头感光元件上,光信号转换为电信号,摄像头感光元件将所述电信号传递给ISP处理,转化为肉眼可见的图像。ISP还可以对图像的噪点,亮度进行算法优化。ISP还可以对拍摄场景的曝光,色温等参数优化。在一些实施例中,ISP可以设置在摄像头193中。
摄像头193用于捕获静态图像或视频。物体通过镜头生成光学图像投射到感光元件。感光元件可以是电荷耦合器件(charge coupled device,CCD)或互补金属氧化物半导体(complementary metal-oxide-semiconductor,CMOS)光电晶体管。感光元件把光信号转换成电信号,之后将电信号传递给ISP转换成数字图像信号。ISP将数字图像信号输出到DSP加工处理。DSP将数字图像信号转换成标准的RGB,YUV等格式的图像信号。在一些实施例中,电子设备100可以包括1个或N个摄像头193,N为大于1的正整数。
数字信号处理器用于处理数字信号,除了可以处理数字图像信号,还可以处理其他数字信号。例如,当电子设备100在频点选择时,数字信号处理器用于对频点能量进行傅里叶变换等。
视频编解码器用于对数字视频压缩或解压缩。电子设备100可以支持一种或多种视频编解码器。这样,电子设备100可以播放或录制多种编码格式的视频,例如:动态图像专家组 (moving picture experts group,MPEG)1,MPEG2,MPEG3,MPEG4等。
NPU为神经网络(neural-network,NN)计算处理器,通过借鉴生物神经网络结构,例如借鉴人脑神经元之间传递模式,对输入信息快速处理,还可以不断的自学习。通过NPU可以实现电子设备100的智能认知等应用,例如:图像识别,人脸识别,语音识别,文本理解等。
内部存储器121可以包括一个或多个随机存取存储器(random access memory,RAM)和一个或多个非易失性存储器(non-volatile memory,NVM)。
随机存取存储器可以包括静态随机存储器(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,例如第五代DDR SDRAM一般称为DDR5SDRAM)等;非易失性存储器可以包括磁盘存储器件、快闪存储器(flash memory)。
快闪存储器按照运作原理划分可以包括NOR FLASH、NAND FLASH、3D NAND FLASH等,按照存储单元电位阶数划分可以包括单阶存储单元(single-level cell,SLC)、多阶存储单元(multi-level cell,MLC)、三阶储存单元(triple-level cell,TLC)、四阶储存单元(quad-level cell,QLC)等,按照存储规范划分可以包括通用闪存存储(英文:universal flash storage,UFS)、嵌入式多媒体存储卡(embedded multi media Card,eMMC)等。
随机存取存储器可以由处理器110直接进行读写,可以用于存储操作系统或其他正在运行中的程序的可执行程序(例如机器指令),还可以用于存储用户及应用程序的数据等。
非易失性存储器也可以存储可执行程序和存储用户及应用程序的数据等,可以提前加载到随机存取存储器中,用于处理器110直接进行读写。
外部存储器接口120可以用于连接外部的非易失性存储器,实现扩展电子设备100的存储能力。外部的非易失性存储器通过外部存储器接口120与处理器110通信,实现数据存储功能。例如将音乐,视频等文件保存在外部的非易失性存储器中。
电子设备100可以通过音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,以及应用处理器等实现音频功能。例如音乐播放,录音等。
音频模块170用于将数字音频信息转换成模拟音频信号输出,也用于将模拟音频输入转换为数字音频信号。音频模块170还可以用于对音频信号编码和解码。在一些实施例中,音频模块170可以设置于处理器110中,或将音频模块170的部分功能模块设置于处理器110中。
扬声器170A,也称“喇叭”,用于将音频电信号转换为声音信号。电子设备100可以通过扬声器170A收听音乐,或收听免提通话。
受话器170B,也称“听筒”,用于将音频电信号转换成声音信号。当电子设备100接听电话或语音信息时,可以通过将受话器170B靠近人耳接听语音。
麦克风170C,也称“话筒”,“传声器”,用于将声音信号转换为电信号。当拨打电话或发送语音信息时,用户可以通过人嘴靠近麦克风170C发声,将声音信号输入到麦克风170C。电子设备100可以设置至少一个麦克风170C。在另一些实施例中,电子设备100可以设置两个麦克风170C,除了采集声音信号,还可以实现降噪功能。在另一些实施例中,电子设备100还可以设置三个,四个或更多麦克风170C,实现采集声音信号,降噪,还可以识别声音来源,实现定向录音功能等。
耳机接口170D用于连接有线耳机。耳机接口170D可以是USB接口130,也可以是3.5mm的开放移动电子设备平台(open mobile terminal platform,OMTP)标准接口,美国蜂窝电信工业协会(cellular telecommunications industry association of the USA,CTIA)标准接口。
压力传感器180A用于感受压力信号,可以将压力信号转换成电信号。在一些实施例中,压力传感器180A可以设置于显示屏194。压力传感器180A的种类很多,如电阻式压力传感器,电感式压力传感器,电容式压力传感器等。电容式压力传感器可以是包括至少两个具有导电材料的平行板。当有力作用于压力传感器180A,电极之间的电容改变。电子设备100根据电容的变化确定压力的强度。当有触摸操作作用于显示屏194,电子设备100根据压力传感器180A检测所述触摸操作强度。电子设备100也可以根据压力传感器180A的检测信号计算触摸的位置。在一些实施例中,作用于相同触摸位置,但不同触摸操作强度的触摸操作,可以对应不同的操作指令。例如:当有触摸操作强度小于第一压力阈值的触摸操作作用于短消息应用图标时,执行查看短消息的指令。当有触摸操作强度大于或等于第一压力阈值的触摸操作作用于短消息应用图标时,执行新建短消息的指令。
陀螺仪传感器180B可以用于确定电子设备100的运动姿态。在一些实施例中,可以通过陀螺仪传感器180B确定电子设备100围绕三个轴(,x,y和z轴)的角速度。陀螺仪传感器180B可以用于拍摄防抖。示例性的,当按下快门,陀螺仪传感器180B检测电子设备100抖动的角度,根据角度计算出镜头模组需要补偿的距离,让镜头通过反向运动抵消电子设备100的抖动,实现防抖。陀螺仪传感器180B还可以用于导航,体感游戏场景。
气压传感器180C用于测量气压。在一些实施例中,电子设备100通过气压传感器180C测得的气压值计算海拔高度,辅助定位和导航。
磁传感器180D包括霍尔传感器。电子设备100可以利用磁传感器180D检测翻盖皮套的开合。在一些实施例中,当电子设备100是翻盖机时,电子设备100可以根据磁传感器180D检测翻盖的开合。进而根据检测到的皮套的开合状态或翻盖的开合状态,设置翻盖自动解锁等特性。
加速度传感器180E可检测电子设备100在各个方向上(一般为三轴)加速度的大小。当电子设备100静止时可检测出重力的大小及方向。还可以用于识别电子设备姿态,应用于横竖屏切换,计步器等应用。
距离传感器180F,用于测量距离。电子设备100可以通过红外或激光测量距离。在一些实施例中,拍摄场景,电子设备100可以利用距离传感器180F测距以实现快速对焦。
接近光传感器180G可以包括例如发光二极管(LED)和光检测器,例如光电二极管。发光二极管可以是红外发光二极管。电子设备100通过发光二极管向外发射红外光。电子设备100使用光电二极管检测来自附近物体的红外反射光。当检测到充分的反射光时,可以确定电子设备100附近有物体。当检测到不充分的反射光时,电子设备100可以确定电子设备100附近没有物体。电子设备100可以利用接近光传感器180G检测用户手持电子设备100贴近耳朵通话,以便自动熄灭屏幕达到省电的目的。接近光传感器180G也可用于皮套模式,口袋模式自动解锁与锁屏。
环境光传感器180L用于感知环境光亮度。电子设备100可以根据感知的环境光亮度自适应调节显示屏194亮度。环境光传感器180L也可用于拍照时自动调节白平衡。环境光传感器180L还可以与接近光传感器180G配合,检测电子设备100是否在口袋里,以防误触。
指纹传感器180H用于采集指纹。电子设备100可以利用采集的指纹特性实现指纹解锁,访问应用锁,指纹拍照,指纹接听来电等。
温度传感器180J用于检测温度。在一些实施例中,电子设备100利用温度传感器180J检测的温度,执行温度处理策略。例如,当温度传感器180J上报的温度超过阈值,电子设备100执行降低位于温度传感器180J附近的处理器的性能,以便降低功耗实施热保护。在另一些实施例中,当温度低于另一阈值时,电子设备100对电池142加热,以避免低温导致电子设备100异常关机。在其他一些实施例中,当温度低于又一阈值时,电子设备100对电池142的输出电压执行升压,以避免低温导致的异常关机。
触摸传感器180K,也称“触控器件”。触摸传感器180K可以设置于显示屏194,由触摸传感器180K与显示屏194组成触摸屏,也称“触控屏”。触摸传感器180K用于检测作用于其上或附近的触摸操作。触摸传感器可以将检测到的触摸操作传递给应用处理器,以确定触摸事件类型。可以通过显示屏194提供与触摸操作相关的视觉输出。在另一些实施例中,触摸传感器180K也可以设置于电子设备100的表面,与显示屏194所处的位置不同。
骨传导传感器180M可以获取振动信号。在一些实施例中,骨传导传感器180M可以获取人体声部振动骨块的振动信号。骨传导传感器180M也可以接触人体脉搏,接收血压跳动信号。在一些实施例中,骨传导传感器180M也可以设置于耳机中,结合成骨传导耳机。音频模块170可以基于所述骨传导传感器180M获取的声部振动骨块的振动信号,解析出语音信号,实现语音功能。应用处理器可以基于所述骨传导传感器180M获取的血压跳动信号解析心率信息,实现心率检测功能。
按键190包括开机键,音量键等。按键190可以是机械按键。也可以是触摸式按键。电子设备100可以接收按键输入,产生与电子设备100的用户设置以及功能控制有关的键信号输入。
马达191可以产生振动提示。马达191可以用于来电振动提示,也可以用于触摸振动反馈。例如,作用于不同应用(例如拍照,音频播放等)的触摸操作,可以对应不同的振动反馈效果。作用于显示屏194不同区域的触摸操作,马达191也可对应不同的振动反馈效果。不同的应用场景(例如:时间提醒,接收信息,闹钟,游戏等)也可以对应不同的振动反馈效果。触摸振动反馈效果还可以支持自定义。
指示器192可以是指示灯,可以用于指示充电状态,电量变化,也可以用于指示消息,未接来电,通知等。
SIM卡接口195用于连接SIM卡。SIM卡可以通过插入SIM卡接口195,或从SIM卡接口195拔出,实现和电子设备100的接触和分离。电子设备100可以支持1个或N个SIM卡接口,N为大于1的正整数。SIM卡接口195可以支持Nano SIM卡,Micro SIM卡,SIM卡等。同一个SIM卡接口195可以同时插入多张卡。所述多张卡的类型可以相同,也可以不同。SIM卡接口195也可以兼容不同类型的SIM卡。SIM卡接口195也可以兼容外部存储卡。电子设备100通过SIM卡和网络交互,实现通话以及数据通信等功能。在一些实施例中,电子设备100采用eSIM:嵌入式SIM卡。eSIM卡可以嵌在电子设备100中,不能和电子设备100分离。
电子设备100的软件系统可以采用分层架构,事件驱动架构,微核架构,微服务架构,或云架构。本发明实施例以分层架构的Android系统为例,示例性说明电子设备100的软件结构。
图4是本发明实施例的电子设备100的软件结构框图。
分层架构将软件分成若干个层,每一层都有清晰的角色和分工。层与层之间通过软件接口通信。在一些实施例中,将Android系统分为四层,从上至下分别为应用程序层,应用程序框架层,安卓运行时(Android runtime)和系统库,以及内核层。
应用程序层可以包括一系列应用程序包。
如图4所示,应用程序包可以包括相机,图库,日历,通话,地图,导航,WLAN,蓝牙,音乐,视频,短信息等应用程序。
应用程序框架层为应用程序层的应用程序提供应用编程接口(application programming interface,API)和编程框架。应用程序框架层包括一些预先定义的函数。
如图4所示,应用程序框架层可以包括窗口管理器,内容提供器,视图系统,电话管理器,资源管理器,JS编程框架。
窗口管理器用于管理窗口程序。窗口管理器可以获取显示屏大小,判断是否有状态栏,锁定屏幕,截取屏幕等。
内容提供器用来存放和获取数据,并使这些数据可以被应用程序访问。所述数据可以包括视频,图像,音频,拨打和接听的电话,浏览历史和书签,电话簿等。
视图系统包括可视控件,例如显示文字的控件,显示图片的控件等。视图系统可用于构建应用程序。显示界面可以由一个或多个视图组成的。例如,包括短信通知图标的显示界面,可以包括显示文字的视图以及显示图片的视图。
电话管理器用于提供电子设备100的通信功能。例如通话状态的管理(包括接通,挂断等)。
资源管理器为应用程序提供各种资源,比如本地化字符串,图标,图片,布局文件,视频文件等等。
JS编程框架可以用于通过JS数据劫持方式对应用传入的JS数据对象进行getter/setter方法重定义,得到JS包装对象,再将JS包装对象包装为JS分布式数据对象,得到JS分布式数据对象。
JS编程框架还用于调用系统库中的分布式内存数据库,将得到的JS分布式数据对象存储至分布式内存数据库中。
在电子设备100与电子设备200建立协同连接时,JS编程框架将创建session ID,与分布式数据对象的实例1相关联。
之后,在电子设备100向电子设备200发送协同消息时,协同消息中携带了session ID。
电子设备200在接收到协同消息后,解析出协同消息中携带的session ID,电子设备100将session ID保存session ID。之后,电子设备100将分布式数据对象的实例1发送至电子设备200,电子设备200在接收到实例1后,基于实例1生成分布式数据对象。同时,电子设备200将本地的实例1与session ID相关联。电子设备100上的实例1和电子设备200上的实例1关联了同一个session ID。这样,在电子设备100实例1的属性值发生变化(例如增删查改)之后,电子设备200上的实例1上的属性值也发生相应的变化。
Android Runtime包括核心库和虚拟机。Android Runtime负责安卓系统的调度和管理。
核心库包含两部分:一部分是java语言需要调用的功能函数,另一部分是安卓的核心库。
应用程序层和应用程序框架层运行在虚拟机中。虚拟机将应用程序层和应用程序框架层的java文件执行为二进制文件。虚拟机用于执行对象生命周期的管理,堆栈管理,线程管理,安全和异常的管理,以及垃圾回收等功能。
系统库可以包括多个功能模块。例如:表面管理器(surface manager),媒体库(Media Libraries),三维图形处理库(例如:OpenGL ES),2D图形引擎(例如:SGL),分布式内存数据库等。
表面管理器用于对显示子系统进行管理,并且为多个应用程序提供了2D和3D图层的融合。
媒体库支持多种常用的音频,视频格式回放和录制,以及静态图像文件等。媒体库可以支持多种音视频编码格式,例如:MPEG4,H.264,MP3,AAC,AMR,JPG,PNG等。
三维图形处理库用于实现三维图形绘图,图像渲染,合成,和图层处理等。
2D图形引擎是2D绘图的绘图引擎。
分布式内存数据库,可提供管理分布数据库的能力,电子设备间分布数据库的同步能力,分布式数据对象的访问(增删改查)能力。
内核层是硬件和软件之间的层。内核层至少包含显示驱动,摄像头驱动,音频驱动,传感器驱动。
下面结合捕获拍照场景,示例性说明电子设备100软件以及硬件的工作流程。
当触摸传感器180K接收到触摸操作,相应的硬件中断被发给内核层。内核层将触摸操作加工成原始输入事件(包括触摸坐标,触摸操作的时间戳等信息)。原始输入事件被存储在内核层。应用程序框架层从内核层获取原始输入事件,识别该输入事件所对应的控件。以该触摸操作是触摸单击操作,该单击操作所对应的控件为相机应用图标的控件为例,相机应用调用应用框架层的接口,启动相机应用,进而通过调用内核层启动摄像头驱动,通过摄像头193捕获静态图像或视频。
下面介绍本申请提供的一种JS编程框架的功能模块。
图5示例性示出了本申请实施例提供的一种JS编程框架的功能模块示意图。
图5示出的JS编程框架的功能模块示意图为协同发起设备侧的功能模块示意图。
如图5所示,JS编程框架包括分布式数据对象创建模块401、分布式数据对象同步模块402和分布式数据对象监测模块403。
需要说明的是,上述多个功能模块可以单独存在实现预设的功能,也可以任意两个或多个功能模块结合在一起实现两个或多个功能模块预设的功能,本申请实施例对此不做限定。
在一些实施例中,分布式数据对象创建模块401用于接收应用1产生的数据对象,按照数据劫持方式对应用传入的数据对象进行getter/setter方法重定义,得到包装对象,再将包装对象包装为分布式数据对象。
数据劫持是指在访问或者修改数据对象的某个实例属性时,通过预设的代码功能拦截访问或者修改的行为,进行额外的操作。示例性的,分布式数据对象创建模块401获取到数据对象一后,分布式数据对象创建模块401调用getter方法,得到数据对象一的实例一的属性 值。分布式数据对象创建模块401调用setter方法,对实例一的属性值添加数据监听和数据劫持。这样,在实例一的属性值发生变化的时候,分布式数据对象创建模块401可以监测到实例一的属性值发生变化,并及时更新实例一的属性值。
分布式数据对象创建模块401将分布式数据对象发送至应用1,应用1在得到分布式数据对象后,应用1可以对分布式数据对象进行操作(例如对分布式数据对象进行值的更新操作等)。
数据对象可以是JS(java script)数据对象,分布式数据对象创建模块401可以按照JS数据劫持的方式对JS数据对象进行getter方法或者setter方法重定义,最终得到JS包装对象,再将JS包装对象包装为分布式数据对象,得到JS分布式数据对象。本申请以下实施例以数据对象为JS数据对象为例进行说明,本申请以下实施例也可以将JS分布式数据对象称为分布式数据对象。
在一些实施例中,分布式数据对象创建模块401还用于生成session ID,并将session ID与分布式数据对象对应的实例相关联。
在一些实施例中,分布式数据对象创建模块401调用跨设备通信模块(图5未示出)将session ID发送至对端设备(或者接受协同的设备)上,对端设备在接收到session ID后,将session ID与应用1的实例1相关联。这样,本端设备(或者发起协同的设备)上的实例1和对端设备上的实例1关联了同一个session ID后,电子设备100上的实例1的属性值发生变化后,电子设备200上的实例1的属性值发生变化后,实现不同设备间的数据同步。
分布式数据对象创建模块401在得到分布式数据对象后,分布式数据对象创建模块401将分布式数据对象分别发送至分布式数据对象同步模块402和分布式数据对象监测模块403。
分布式数据对象同步模块402用于将分布式数据对象以键-值(key-value)保存的形式至分布式内存数据库中。
表1
表1示例性示出了分布式数据对象在分布式数据库中的存储形式。示例性的,分布式数据对象1包括字段1和字段2,字段1存储在名称为kv store1的分布式内容数据库中,字段1在kv store1内的存储的属性值为key1,字段2存储在名称为kv store1的分布式内容数据库中,字段2在kv store1内的存储的属性值为key2。分布式数据对象2包括字段3和字段4,字段3存储在名称为kv store2的分布式内容数据库中,字段3在kv store2内的存储的属性值为key3,字段4存储在名称为kv store2的分布式内容数据库中,字段4在kv store2内的存储的属性值为key4。分布式数据对象n包括字段5和字段6,字段5存储在名称为kv store n的分布式内容数据库中,字段5在kv store n内的存储的属性值为key5,字段6存储在名称为 kv store n的分布式内容数据库中,字段6在kv store n内的存储的属性值为key6。
分布式数据对象监测模块403用于监测分布式数据对象的属性值是否发生了变化,若发生了变化,分布式数据对象监测模块403将变化后的分布式数据对象发送至分布式数据对象同步模块402。
分布式数据对象同步模块402还用于接收分布式数据对象监测模块403发送的变化后的分布式数据对象,并将变化后的分布式数据对象以键-值(key-value)保存的形式至分布式内存数据库中。
在一些实施例中,分布式数据对象同步模块402可以是将变化后的分布式数据对象和变化之前的分布式数据对象同时保存至分布式内存数据库中,分布式数据对象同步模块402也可以是将变化后的分布式数据对象替换变化之前的分布式数据对象。基于此,分布式数据对象同步模块402仅保存变化后的分布式数据对象,不再保存变化之前的分布式数据对象。
图6示例性示出了电子设备100和电子设备200协同的交互示意图。
电子设备100上包括应用601、JS编程框架602、通信模块603和分布式内存数据库604,电子设备200上包括有应用605、JS编程框架606、通信模块607和分布式内存数据库608。
需要说明的是,应用601与应用605可以为用同一个应用,例如均为同一个地图应用。应用601与应用605也以为不是同一个应用,但是为同一种类型的应用,例如都可以是提供导航服务的应用,但是应用601与应用605不是同一个开发者开发的应用。本申请以下实施例以应用601与应用605为同一个应用(例如均为应用1)为例进行说明。
示例性的,本申请实施例以电子设备100为发起协同的设备,电子设备200为接受协同的设备为例进行说明。
电子设备100和电子设备200协同的交互的步骤如下:
1、在电子设备100向电子设备200发起协同时,电子设备上的应用601产生数据对象,并向数据对象发送至JS编程框架602。
在一些实施例中,步骤1也可以是在电子设备100接收到电子设备200发送的同意建立协同连接的消息后在执行,即步骤1可以在步骤4之后开始执行。
2、在电子设备100向电子设备200发起协同时,电子设备100中的JS编程框架602用于生成分布式数据对象和与分布式数据对象对应的实例相关联的session ID,并将session ID发送至电子设备100中的通信模块603。
3、在通信模块603接收到session ID后,通信模块603块将协同消息发送至电子设备200(例如电子设备200上的通信模块607),该协同消息用于请求与电子设备200建立协同连接。
在一些实施例中,该协同消息中还携带有session ID。
在一些实施例中,该协同消息中可以不携带session ID,电子设备100中的通信模块603单独将session ID发送至电子设备200,例如电子设备200上的通信模块607。
通信模块603单独将session ID发送至通信模块607的步骤,可以是在电子设备100接收到电子设备200发送的同意建立协同连接的消息后在执行。例如可以在步骤4之后,步骤 8之前,通信模块603单独将session ID发送至通信模块607的步骤。
在一些实施例中,电子设备100可以只执行一次将session ID发送至通信模块607的步骤。例如电子设备100只需发送一次session ID至通信模块607。
在一些实施例中,电子设备100可以周期性执行将session ID至通信模块607的步骤,电子设备100周期性的将session ID发送至电子设备200。这样,可以避免由于电子设备100仅发送一次session ID,电子设备200没收到session ID的情况发生。
4、在通信模块607接收到电子设备100发送的协同消息后,电子设备200确认与电子设备100建立协同连接,那么电子设备200可以向电子设备100(例如电子设备100上的通信模块603)发送同意建立协同连接的消息。
5、通信模块603在接收到电子设备200发送的同意建立协同连接的消息后,通信模块603向JS编程框架602发送开始协同指令,该开始协同指令用于告知JS编程框架602基于数据劫持的方式将数据对象包装为分布式数据对象,并将该分布式数据对象发送至电子设备200,以使得电子设备100与电子设备200开始协同。
6、电子设备100中的JS编程框架602在接收到开始协同指令后,JS编程框架602用于基于数据劫持的方式将数据对象包装为分布式数据对象,并将分布式数据对象和session ID保存至分布式内存数据库604。
分布式内存数据库604在接收到分布式数据对象和session ID后,分布式内存数据库604将分布式数据对象以键-值(key-value)保存的形式至分布式内存数据库604中。在一些实施例中,分布式内存数据库604还需将session ID和分布式数据对象的实例进行关联,对于如何将session ID和分布式数据对象的实例进行关联的,可以参考步骤9中的相关描述,本申请实施例在此不做赘述。
在一些实施例中,步骤6可以在步骤1开始后,步骤5开始前的任意时刻开始执行,JS编程框架602提前将应用601产生的数据对象包装为分布式数据对象,可以避免在JS编程框架在接收到开始协同指令后才开始将应用产生的数据对象包装为分布式数据对象,基于此,本申请实施例提供的方法可以避免协同延迟的情况发生。
7、在分布式内存数据库604得到分布式数据对象后,分布式内存数据库604将分布式数据对象发送至通信模块603。
在一些实施例中,步骤7可以在JS编程框架602得到分布式数据对象后的时刻开始执行,可以避免在JS编程框架602在接收到开始协同指令后,才开始将分布式数据对象发送至通信模块603,基于此,本申请实施例提供的方法可以避免协同延迟的情况发生。
8、通信模块603将分布式数据发送至电子设备200上的通信模块607。
分布式数据包括数据对象的类型、数据对象的实例的属性值。
在一些实施例中,步骤8可以在步骤4之后立刻开始执行,电子设备100提前准备好分布式数据对象,在接收到同意建立协同连接的消息后,立刻将分布式数据对象发送至电子设备200上的通信模块607,这样,可以减小协同延迟的时间。
9、通信模块607在接收到session ID后,将分布式数据和session ID发送至电子设备200上的JS编程框架606。
在一些实施例中,通信模块607可以分别将分布式数据和session ID发送至JS编程框架606。
在一些实施例中,通信模块607可以将分布式数据和session ID同时发送至JS编程框架606。
在一些实施例中,通信模块607可以在步骤4之后,步骤9之前,将session ID发送至JS编程框架606。
JS编程框架606在接收到分布式数据后,JS编程框架606基于数据对象的实例的属性值生成分布式数据对象。
JS编程框架606在接收到分布式数据和session ID后,将数据对象的实例与session ID关联。不同的实例与不同的session ID进行关联,使得电子设备100上与电子设备100上任意两个相同的实例间关联的session ID相同。电子设备100上和电子设备200上相同两个实例间的数据保持一致。这样,当电子设备100上实例1上的数据对象发生了变化之后,电子设备200上的实例1也会发生同样的变化。保持了电子设备100和电子设备200协同时的数据同步。
10、JS编程框架606将分布式数据对象发送至分布式内存数据库608。
分布式内存数据库608在接收到分布式数据对象后,分布式内存数据库608将分布式数据对象以键-值(key-value)保存的形式至分布式内存数据库608中。
具体的,图7-图9示例性示出了一组两个协同设备间的任意两个实例关联同一个session ID的UI图。
需要说明的是,电子设备100向电子设备200发送的分布式数据的数据对象的类型可以分为一个或多个。
在一些实施例中,对于同一种类型的数据对象,也可以包括一种或多种不同类型的实例。
电子设备100与电子设备200建立协同连接,电子设备100通过应用1产生的数据对象基于本申请实施例提供的JS编程框架创建分布式数据对象,该分布式数据对象的数据类型可以为一个或多个。
示例性的,如图7所示,当该分布式数据对象的数据类型为一个(数据对象一)时,数据对象一的实例也为一个。或者,该数据对象一的实例多个,但是不区分不同实例的类型,有多个不同类型实例的分布式数据对象的实例也为一个。电子设备100通过JS编程框架创建session ID-1,并将session ID-1与实例1进行关联。之后,电子设备100将实例1的属性值、数据对象的类型和session ID-1发送至电子设备200,电子设备200在接收到实例1和数据对象的类型后,基于实例1和数据对象的类型生成数据对象一,并将电子设备200上的实例1和session ID-1进行关联。这样,在该分布式数据对象的数据类型为一个的情况下,电子设备100上的实例1和电子设备200上的实例2关联了同一个session ID(session ID-1)。这样,当电子设备100上实例1上的数据对象发生了变化之后,电子设备200上实例2上的数据对象也会发生同样的变化。保持了电子设备100和电子设备200协同时的数据同步。
示例性的,如图8所示,当该分布式数据对象的数据类型为一个(数据对象一)时,数 据对象一的实例为多个,需区分有多个不同类型实例的分布式数据对象的实例。同时电子设备100通过JS编程框架创建多个不同的session ID,并将多个不同的session ID、不同实例的属性值、数据对象的类型发送至电子设备200。电子设备200在接收到多个不同的session ID、不同实例的属性值、数据对象的类型后,基于不同实例的属性值和数据对象的类型生成数据对象一,并将电子设备100上相同的实例关联同一个session ID。
示例性的,如图8所示,数据对象一的实例的类型有n个,电子设备100通过JS编程框架创建n个不同的session ID,并将实例1与session ID-1进行关联,将实例2与session ID-2进行关联,将实例n与session ID-n进行关联。之后,电子设备100将多个不同的session ID、不同实例的属性值、数据对象的类型发送至电子设备200。电子设备100基于实例1的属性值、实例2的属性值和实例n的属性值生成数据对象一。之后,电子设备200将实例1与session ID-1进行关联,将实例2与session ID-2进行关联,将实例n与session ID-n进行关联。这样,在同一个数据对象的实例类型为n个的情况下,电子设备100上与电子设备200上相同的实例关联同一个session ID。
这样,当电子设备100上任意一个实例的属性值发生了变化之后,电子设备200上关联了同一个session ID的实例的属性值也会发生同样的变化。例如,当电子设备100上实例1上的属性值发生了变化之后,电子设备200上实例1上的属性值也会发生同样的变化。保持了电子设备100和电子设备200协同时的数据同步。
示例性的,如图9所示,当该数据对象的数据类型为多个(大于等于2)时,每个类型的数据对象的实例也为多个。电子设备100需通过JS编程框架创建多个不同的session ID,并将多个不同的session ID、不同实例的属性值、数据对象的类型发送至电子设备200。电子设备200在接收到多个不同的session ID、不同实例的属性值、数据对象的类型后,基于不同实例的属性值和数据对象的类型生成数据对象一,并将电子设备100上相同的实例关联同一个session ID。
示例性的,如图9所示,数据对象一的实例的类型有n个,电子设备100通过JS编程框架创建n个不同的session ID,并将实例1与session ID-1进行关联,将实例2与session ID-2进行关联,将实例n与session ID-n进行关联。之后,电子设备100将多个不同的session ID、不同实例的属性值、数据对象的类型发送至电子设备200。电子设备200基于实例1的属性值、实例2的属性值和实例n的属性值生成数据对象一。之后,电子设备200将实例1与session ID-1进行关联,将实例2与session ID-2进行关联,将实例n与session ID-n进行关联。这样,在同一个数据对象的实例类型为n个的情况下,电子设备100上与电子设备200上相同的实例关联同一个session ID。
数据对象二的实例的类型有m个,电子设备100通过JS编程框架创建m个不同的session ID,并将实例n+1与session ID-n+1进行关联,将实例n+2与session ID-n+2进行关联,将实例n+m与session ID-n+m进行关联。之后,电子设备100将多个不同的session ID、不同实例的属性值、数据对象的类型发送至电子设备200。电子设备200基于实例n+1的属性值、实例n+2的属性值和实例n+m的属性值生成数据对象二。之后,电子设备200将实例n+1与sessionn+1进行关联,将实例n+2与session ID-n+2进行关联,将实例n+m与session ID-n+m进行关联。
这样,在数据对象的数据类型为多个的情况下,电子设备100上与电子设备200上相同的实例关联同一个session ID。保持了电子设备100和电子设备200协同时的数据同步。
图7-图9示例性示出了一组两个协同设备间的任意两个实例关联同一个session ID的UI图,在其他实施例中,可以是多个设备(大于2个设备)同时建立协同连接。多个设备同时建立协同连接时,多个设备也可以通过任意两个设备间的实例关联同一个session ID,实现数据同步。
图10-图12示例性示出了一组多协同设备间的任意两个实例关联同一个session ID的UI图。
本申请实施例以三个设备(例如电子设备100、电子设备200和电子设备300)同时建立协同连接时,如何通过实例间关联同一个session ID实现数据同步的原理进行说明。
在一些实施例中,电子设备300也可以被称为第三电子设备。
示例性的,如图10所示,电子设备100为发起协同的设备,电子设备200和电子设备300为接受协同的设备。
当该数据对象的数据类型为1个(数据对象一),且该数据对象的实例的类型也为1个时,电子设备100通过JS编程框架创建session ID-1,并将session ID-1与实例1进行关联。之后,电子设备100将实例1的属性值和session ID-1分别发送至电子设备200和电子设备300。
电子设备200在接收到实例1的属性值和session ID-1后,基于实例1的属性值生成数据对象一,并将实例1和session ID-1进行关联。这样,电子设备100上的实例1和电子设备200上的实例1联了同一个session ID(session ID-1)。
同理,电子设备300在接收到实例1的属性值和session ID-1后,基于实例1的属性值生成数据对象一,并将实例1和session ID-1进行关联。这样,电子设备300上的实例1和电子设备100上的实例1联了同一个session ID(session ID-1)。
电子设备100上的实例1、电子设备200上的实例1和电子设备300上的实例1关联了同一个session ID。
这样,当电子设备100上实例上的数据对象发生了变化之后,电子设备200和电子设备300上关联了同一个session ID的实例上的数据对象也会发生同样的变化。例如,当电子设备100上实例1上的数据对象发生了变化之后,电子设备200上实例1的数据对象也会发生同样的变化,同时,电子设备300上实例1的数据对象也会发生同样的变化。保持了电子设备100和电子设备200与电子设备300协同时的数据同步。
示例性的,如图11所示,电子设备100为发起协同的设备,电子设备200和电子设备300为接受协同的设备。
数据对象一的实例为多个,需区分有多个不同类型实例的分布式数据对象的实例。同时电子设备100通过JS编程框架创建多个不同的session ID,并将多个不同的session ID、不同实例的属性值发送至电子设备200和电子设备300。电子设备200在接收到多个不同的session ID、不同实例的属性值后,基于不同实例的属性值生成数据对象一,并将电子设备200上相同的实例关联同一个session ID。电子设备300在接收到多个不同的session ID、不同实例的属性值后,基于不同实例的属性值生成数据对象一,并将电子设备300上相同的实例关联同一个session ID。
示例性的,如图11所示,数据对象一的实例的类型有n个,电子设备100通过JS编程 框架创建n个不同的session ID,并将实例1与session ID-1进行关联,将实例2与session ID-2进行关联,将实例n与session ID-n进行关联。之后,电子设备100将多个不同的session ID、不同实例的属性值发送至电子设备200和电子设备300。电子设备200基于实例1的属性值、实例2的属性值和实例n的属性值生成数据对象一。之后,电子设备200将实例1与session ID-1进行关联,将实例2与session ID-2进行关联,将实例n与session ID-n进行关联。
同理,电子设备300基于实例1的属性值、实例2的属性值和实例n的属性值生成数据对象一。之后,电子设备300将实例1与session ID-1进行关联,将实例2与session ID-2进行关联,将实例n与session ID-n进行关联。
这样,在同一个数据对象的实例类型为n个的情况下,电子设备100上与电子设备200和电子设备300上相同的实例关联同一个session ID。这样,当电子设备100上任意一个实例上的数据对象发生了变化之后,电子设备200和电子设备300上关联了同一个session ID的实例上的数据对象也会发生同样的变化。例如,当电子设备100上实例1上的数据对象发生了变化之后,电子设备200上实例1上的数据对象也会发生同样的变化,同时,电子设备300上实例1上的数据对象也会发生同样的变化。保持了电子设备100和电子设备200与电子设备300协同时的数据同步。
需要说明的是,不仅限于同时2个或3个设备建立协同连接,还可以更多的设备同时建立协同连接,本申请实施例对于同时建立协同连接的设备数量不做限定。
在一些实施例中,电子设备100在与多个其它设备建立协同连接时,电子设备100可以向不用的协同设备发送不同类型的数据对象。
示例性的,如图12所示,电子设备100为发起协同的设备,电子设备200和电子设备300为接受协同的设备。
数据对象一的实例为多个,需区分有多个不同类型实例的分布式数据对象的实例。同时电子设备100通过JS编程框架创建多个不同的session ID,并将多个不同的session ID、不同实例的属性值发送至电子设备200。电子设备200在接收到多个不同的session ID、不同实例的属性值后,基于不同实例的属性值生成数据对象一,并将电子设备200上相同的实例关联同一个session ID。电子设备300在接收到多个不同的session ID、不同实例的属性值后,基于不同实例的属性值生成数据对象一,并将电子设备300上相同的实例关联同一个session ID。
示例性的,如图12所示,电子设备100与电子设备300基于数据对象一进行协同,数据对象一的实例的类型有n个,电子设备100通过JS编程框架创建n个不同的session ID,并将实例1与session ID-1进行关联,将实例2与session ID-2进行关联,将实例n与session ID-n进行关联。之后,电子设备100将多个不同的session ID、不同实例的属性值发送至电子设备300。电子设备300基于实例1的属性值、实例2的属性值和实例n的属性值生成数据对象一。之后,电子设备300将实例1与session ID-1进行关联,将实例2与session ID-2进行关联,将实例n与session ID-n进行关联。
示例性的,如图12所示,电子设备100与电子设备200基于数据对象二进行协同,数据对象二的实例的类型有m个,电子设备100通过JS编程框架创建m个不同的session ID,并将实例n+1与session ID-n+1进行关联,将实例n+2与session ID-n+2进行关联,将实例n+m 与session ID-n+m进行关联。之后,电子设备100将多个不同的session ID、不同实例的属性值发送至电子设备200。电子设备200基于实例n+1的属性值、实例n+2的属性值和实例n+m的属性值生成数据对象二。之后,电子设备200将实例n+1与session ID-n+1进行关联,将实例n+2与session ID-n+2进行关联,将实例n+m与session ID-n+m进行关联。
11、分布式内存数据库608将分布式数据对象发送至电子设备200上的应用605。
应用605在接收到分布式数据对象后,应用605将输出分布式数据对象,电子设备200与电子设备100开始协同。
在一些实施例中,当同时建立协同连接的设备数量为多个(例如三个)时,例如在电子设备100与电子设备200建立协同连接时,电子设备100还与电子设备300建立了协同连接。对于电子设备300如何与电子设备100进行协同交互的,可以参考图6所示的电子设备200如何与电子设备100进行协同交互的,原理类似,本申请实施例在此不做赘述。
电子设备300上的应用在得到电子设备100发送的分布式数据对象后,电子设备300可以输出分布式数据对象,电子设备300与电子设备100开始协同。电子设备100、电设备200和电子设备300同时建立了协同连接。
需要说明的是,上述会话标识,例如session ID-1、session ID-2、…、session ID-n、session ID-n+1、session ID-n+2、…、session ID-n+m各不相同,且上述会话标识仅用于说明不同的实例关联的会话标识不同,在其他实施例中,会话标识也可以是其他的表现形式,本申请实施例对此不做限定。
需要说明的是,上述步骤1至步骤10中的某些步骤可以被删除、替换。或者,上述步骤1至步骤10中某些步骤的执行顺序可以被调动至其他步骤之前或之后执行等。图6所示的步骤1至步骤10的执行顺序仅是示例性说明电子设备100和电子设备200协同的示意图,不应构成限定。
上述实施例介绍了设备间如何实现协同的过程。在设备建立协同连接后,应用1上的数据对象还会发生变化(例如数据对象中实例的属性值更新等),那么电子设备200上对应的实例的属性值也会发生变化,实现建立协同的设备间的数据同步。接下来介绍如何实现建立协同的设备间的数据同步的具体实现。
图13示出了实现建立协同的设备间的数据同步的示意图。
实现建立协同的设备间的数据同步主要包括以下步骤:
1、应用601将变化后的数据对象发送至JS编程框架602。
变化后的数据对象相对于变化之前的数据对象,数据对象的类型没变,只是数据对象的实例的属性值发生了变化。例如对于数据对象一来说,变化之前的数据对象的实例1的属性值为第一值,变化后的数据对象的实例1的属性值为第二值。
2、JS编程框架602基于数据劫持的方式将变化后的数据对象包装为变化后的分布式数据对象,并将变化后的分布式数据对象以键-值(key-value)的形式保存至分布式内存数据库604中。
3、分布式内存数据库604将变化后的分布式数据对象和变化后的分布式数据对象对应的 会话标识发送至通信模块603。
4、通信模块603将变化后的分布式数据和变化后的分布式数据对象对应的会话标识发送至通信模块607。
变化后的分布式数据包括实例变化后的属性值、数据对象的类型。
分布式内存数据库604会监听分布式数据对象的实例属性,监测分布式数据对象的实例属性是否发生了变化,若发生了变化,分布式内存数据库604将变化后的分布式数据对象和变化后的分布式数据对象对应的会话标识发送至通信模块603。
分布式内存数据库604将变化后的分布式数据对象发送至通信模块603,用于通信模块603将变化后的分布式数据对象发送至电子设备200上,以使得电子设备200更新分布式数据对象。
分布式内存数据库604将变化后的分布式数据对象对应的会话标识发送至通信模块603,用于通信模块603将变化后的分布式数据对象对应的会话标识发送至电子设备200上,以使得电子设备200基于接收到的会话标识,确定出电子设备200上与接收到的会话标识关联的实例标识,并将该实例标识对应的实例的属性值替换为变化后的属性值,电子设备200基于该实例变化后的属性值生成变化后的分布式数据对象。
在一些实施例中,上述的步骤3也可以替换为:
分布式内存数据库604将变化后的分布式数据对象和实例标识发送至通信模块603。
在一些实施例中,上述的步骤4也可以替换为:
通信模块603将变化后的分布式数据和实例标识发送至通信模块607。
通信模块603将该实例标识发送至电子设备200,电子设备200也可以基于该实例标识确定出电子设备200上的实例,并将该实例的属性值替换为变化后的属性值,电子设备200基于该实例变化后的属性值生成变化后的分布式数据对象。
5、通信模块607在接收到变化后的分布式数据后,将变化后的分布式数据和会话标识发送至电子设备200上的JS编程框架606。
在一些实施例中,通信模块607可以分别将变化后的分布式数据和会话标识(session ID)发送至JS编程框架606。
在一些实施例中,通信模块607可以将分布式数据和session ID同时发送至JS编程框架606。
JS编程框架606在接收到变化后的分布式数据后,JS编程框架606基于实例变化后的属性值生成变化后的分布式数据对象。
具体的,JS编程框架606在接收到变化后的分布式数据对象和session ID后,JS编程框架606确定出与接收到的session ID关联的实例标识,并将该实例标识对应的实例的属性值替换为变化后的属性值,JS编程框架606基于该实例变化后的属性值生成变化后的分布式数据对象。
6、JS编程框架606将变化后的分布式数据对象发送至分布式内存数据库608。
分布式内存数据库608在接收到变化后的分布式数据对象后,分布式内存数据库608将变化后的分布式数据对象以键-值(key-value)的形式保存在本地。
7、分布式内存数据库608将变化后的分布式数据对象发送至应用605。
应用605在接收到变化后的分布式数据对象后,应用605可以输出变化后的分布式数据对象。
这样,当电子设备100上的数据对象发生了变化后,电子设备200上的数据对象也会发生相应的变化,实现了设备间的数据同步。
图14示例性示出了本申请实施例提供的一种设备协同方法的流程示意图。
S1401、电子设备100与电子设备200建立协同连接。
电子设备100为发起协同的设备,电子设备200为接受协同的设备。
电子设备100与电子设备200可以通过以下任意一种方式建立协同连接。
方式一:电子设备100与电子设备200连入同一个网络,例如,电子设备100与电子设备200可以连入同一个局域网,建立协同连接。
方式二:电子设备100与电子设备200还可以登录同一个系统账号,建立协同连接。例如,该多个电子设备登录的系统账号都可以为“HW1234”。
方式三:电子设备100与电子设备200上登录的系统账号可以都属于同一个账户组。例如,电子设备100与电子设备200上登录的系统账号包括有“HW001”和“HW002”。系统账户“HW001”和“HW002”同属于账户组“华为之家”。
方式四:电子设备100与电子设备200可以通过近场通信(Near Field Communication,NFC)、蓝牙(bluetooth,BT)、无线局域网(wireless local area networks,WLAN)例如无线保真点对点(wireless fidelity point to point,Wi-Fi P2P)、红外技术(infrared,IR)等方式建立协同连接。
方式五:电子设备100与电子设备200可以通过扫描同一个二维码建立一个临时账户组,建立协同连接实现通信。
不限于上述五种方式,电子设备100还可以通过其他的方式与电子设备200建立协同连接,本申请实施例对此不做限定。
此外,电子设备100与电子设备200也可以结合上述任意几种方式来连接并通信,本申请实施例对此也不做限制。
1402、电子设备100获取到的数据对象一,数据对象一包括实例1,实例1的属性值为第一值。
在一些实施例中,数据对象一也可以被称为第一数据对象,实例1也可以被称为第一实例,实例1的属性值为第一值也可以被称为第一实例属性。
电子设备100开启应用1,并获取到实例1上的数据对象一,数据对象一包括实例1,实例1的属性值为第一值。
由前述实施例可知,应用1内的数据对象的类型也可以为多个,每一种类型的数据对象的实例类型也可以包括多个,本申请实施例在此不做限定。
电子设备100以数据劫持的方式创建分布式数据对象,电子设备100可以监测分布式数据对象的实例属性值,仅将发生变化的实例属性值发送至电子设备200,减少了数据发送量,提高了设备协同的效率。
例如数据对象一包括实例1和包括实例2,电子设备100可以监测实例1和实例2的属性值。当电子设备100监测到实例2的属性值发生变化,实例1的属性值没发生变化,电子设备100可以仅将实例2变化后的属性值发送至电子设备200,不需要向电子设备100发送实例1的属性值。这样,减少了协同设备间的数据传输量,提高了设备协同效率。
在一些实施例中,实例2也可以被称为第三实例,实例2的属性值也可以被称为第三实例属性。
在一些实施例中,电子设备100获取到的数据对象一和数据对象二,数据对象一包括实例1和实例2,数据对象二包括实例3和实例4。电子设备100可以监测实数据对象一的实例属性值的变化和数据对象二的实例属性值的。当电子设备100监测到实例3的属性值发生变化,实例1的属性值没发生变化,电子设备100可以仅将数据对象二(实例3和实例4)发送至电子设备200,不需要将数据对象一和数据对象二同时发送至电子设备200,而是仅将发生了变化的数据对象(实例3和实例4)发送至电子设备200。这样,相对于电子设备100将所有的数据对象发送至电子设备200的方式,也可以减少协同设备间的数据传输量。
在一些实施例中,数据对象二也可以被称为第二数据对象,实例3也可以被称为第二实例,实例3的属性值也可以被称为第二实例属性。
1403、电子设备100基于数据劫持的方式将数据对象一包装为分布式数据对象一,获取到实例1的属性值为第一值。
电子设备100基于数据劫持的方式获取到实例1的属性值。这样,通过数据劫持的方式,可以监听实例1的属性值是否发生了变化,并及时更新变化后的实例1的属性值,保证了协同设备间的数据一致性。
在一些实施例中,电子设备100基于数据劫持的方式获取到实例2的属性值。这样,通过数据劫持的方式,可以监听实例2的属性值是否发生了变化,并及时更新变化后的实例2的属性值,保证了协同设备间的数据一致性。
示例性的,如下示出了创建分布式数据对象的接口的具体实现。
需要说明的是,在其他实施例中,创建分布式数据对象的接口的名称可能会发生变化,但是原理类似,本申请实施例对此不做限定。
在电子设备100基于数据劫持的方式将数据对象一包装为分布式数据对象一后,电子设备100还需将分布式数据对象一以键-值(key-value)的形式保存至分布式数据库中。具体的,可以参考表1中的相关描述,本申请实施例在此不再赘述。
在电子设备100创建分布式数据对象一后,电子设备100还可以访问该分布式数据对象。
示例性的,如下示出了访问分布式数据对象的接口的具体实现。
console.info(obj.title)
需要说明的是,在其他实施例中,访问分布式数据对象的接口的名称可能会发生变化,但是原理类似,本申请实施例对此不做限定。
1404、电子设备100将实例1的属性值发送至电子设备200。
在一些实施例中,电子设备100还获取到数据对象二的实例3,电子设备100将实例3的属性值发送至电子设备200。
在一些实施例中,电子设备100将实例1的属性值发送至电子设备200,也可以称为电子设备100将实例1的属性值通过第一会话发送至电子设备200。第一会话的会话标识为第一会话标识。实例1与第一会话的会话标识关联。
在一些实施例中,电子设备100与电子设备200建立协同连接,电子设备100向电子设备200发送协同消息,协同消息中包括有实例1的实例标识和第一会话的会话标识;第一会话的会话标识与实例1关联。这样,电子设备100将实例1与第一会话的会话标识关联,使得电子设备200在接收到第一会话的会话标识后,将电子设备200上的实例1与第一会话的会话标识关联。这样,电子设备100和电子设备200上相同的两个实例间关联了同一个会话标识,保证了电子设备100和电子设备200上相同的两个实例的属性的一致性,保证了协同数据的一致性。
在一些实施例中,电子设备100将实例3的属性值发送至电子设备200,也可以称为电子设备100将实例3的属性值通过第二会话发送至电子设备200。第二会话的会话标识为第二会话标识。实例3与第二会话的会话标识关联。
电子设备100将不同类型的实例通过不同的会话发送至电子设备200,电子设备100与电子设备200上相同的实例关联同一个会话标识,即电子设备100上的实例1和电子设备200上的实例1均关联了第一会话标识,电子设备100上的实例3和电子设备200上的实例3均关联了第二会话标识。
在一些实施例中,电子设备100还获取到数据对象一的实例2,电子设备100将实例2的属性值通过第一会话发送至电子设备200。电子设备200基于实例1的属性值和实例2的属性值生成分布式数据对象一。这样,在数据对象一包括两种类型的实例的情况下,电子设备100将实例1和实例2均通过第一会话发送至电子设备200,也就是说,将电子设备100和电子设备200间,相同的数据对象间关联同一个会话标识,不区分同一类型数据对象下的不同类型的实例。当电子设备100上的数据对象1的属性发生变化时,电子设备100将发生变化后的数据对象1发送至电子设备200。
在一些实施例中,电子设备100还获取到数据对象一的实例2,电子设备100将实例2的属性值通过第三会话发送至电子设备200。电子设备200基于实例1的属性值和实例2的属性值生成分布式数据对象一。这样,在数据对象1包括两种类型的实例的情况下,电子设备100将实例1和实例2分别通过不同的会话发送至电子设备200,也就是说,将电子设备100和电子设备200间,相同的两个实例间关联同一个会话标识,需区分同一类型数据对象下的不同类型的实例。当电子设备100上的实例1的属性发生变化时,电子设备100仅将发生变化后的实例1的属性发送至电子设备200,不需发送实例2的属性值,减少了协同设备间数据的传输量,提高了协同效率。
在一些实施例中,第一电子设备与第二电子设备和第三电子设备建立协同连接。第一电子设备通过第四会话发送第一实例属性给第三电子设备,通过第五会话发送第二实例属性给第三电子设备,第一实例属性用于第三电子设备生成第一数据对象,第二实例属性用于第三电子设备生成第二数据对象。
第四会话的会话标识为第四会话标识,第五会话的会话标识为第五会话标识。第四会话标识可以是图11所示的session ID-1,第五会话标识可以是图11所示的session ID-n。具体的,可以参考图11中的相关描述。
第一电子设备通过第四会话发送第一实例属性给第三电子设备,通过第五会话发送第二实例属性给第三电子设备,可以理解为,第一电子设备将第一电子设备上的第一实例与第四会话标识关联,第一电子设备将第一电子设备上的第二实例与第五会话标识关联。之后,第一电子设备将第一实例的标识和第四会话标识发送至第三电子设备,第一电子设备将第二实例的标识和第五会话标识发送至第三电子设备。第三电子设备将第三电子设备上的第一实例与第四会话标识关联,第三电子设备将第三电子设备上的第二实例与第五会话标识关联,即第一电子设备上的第一实例和第三电子设备上的第一实例均关联第四会话标识,第一电子设备上的第二实例和第三电子设备上的第二实例均关联第五会话标识。
这样,可以三个电子设备同时建立协同连接,且多个设备间的相同的实例的属性也一样,保证了协同数据的一致性。
在一些实施例中,第一电子设备与第二电子设备和第三电子设备建立协同连接。第一电子设备生成第三数据对象;第一电子设备获取到第三数据对象的第四实例属性;第一电子设备通过第六会话发送所述第四实例属性给第三电子设备,所述第四实例属性用于所述第三电子设备生成所述第三数据对象。
第六会话的会话标识为第六会话标识。第六会话标识可以是图12所示的session ID-n+1、session ID-n+2、…、session ID-n+m中的任意一个。第四实例属性可以是图12所示的实例n+1、实例n+2、…、实例n+m中的任意一个。具体的,可以参考图12中的相关描述。
第一电子设备通过第六会话发送所述第四实例属性给第三电子设备,可以理解为,第一电子设备将第一电子设备上的第四实例与第六会话标识关联,之后,第一电子设备将第四实例的标识和第六会话标识发送至第三电子设备,第三电子设备将第三电子设备上的第四实例与第六会话标识关联,即第一电子设备上的第四实例和第三电子设备上的第四实例均关联第六会话标识。
这样,第一电子设备与多个不同的电子设备建立协同连接时,第一电子设备可以与多个不同的电子设备同时传递不同的协同数据,提高了设备协同的功能多样性。
1405、电子设备200基于实例1的属性值生成分布式数据对象一后,并输出分布式数据对象一。
电子设备100在接收到实例1的属性值后,基于实例1的属性值生成分布式数据对象一,并输出分布式数据对象一。
在电子设备200生成分布式数据对象一后,电子设备200还需将分布式数据对象一以键-值(key-value)的形式保存至分布式数据库中。具体的,可以参考表1中的相关描述,本申请实施例在此不再赘述。
电子设备100与电子设备200进行数据协同后,电子设备100还可以监测与电子设备200的数据协同状态,电子设备200也可以监测与电子设备100的数据协同状态。
数据协同状态包括数据协同成功和数据协同失败。可能由于电子设备100与电子设备200断连导致数据协同失败,或者由于电子设备100上存储的分布式数据对象的格式与电子设备200上存储的分布式数据对象的格式不同而导致数据协同失败。
示例性的,如下示出了监测数据协同失败的接口的具体实现。
obj.on(‘sync-failer’,(changedKeys:Array[string])=>{})
需要说明的是,在其他实施例中,监测数据协同失败口的名称可能会发生变化,但是原理类似,本申请实施例对此不做限定。
1406、电子设备100将电子设备100上的实例1和电子设备200上的实例1关联同一个会话标识(会话标识1)。
在一些实施例中,会话标识1也可以被称为第一会话标识,第一会话标识为第一会话的会话标识。
这样,使得电子设备100上和电子设备200上相同的两个实例绑定同一个会话标识,电子设备100上和电子设备200上相同的两个实例间的数据保持一致。
电子设备100上的实例1上的数据发生变化后,电子设备200上的实例1上的数据也发生相应的变化。
对于电子设备100和电子设备200如何将相同的两个实例关联同一个sess ion I D的具体实现,可以参考图7-图12中的具体描述,本申请实施例在此不再赘述。
示例性的,如下示出了发起协同的接口的具体实现。
session ID=genSession ID();
j.setSession ID(session ID)
电子设备100向电子设备200发送会话标识的接口的具体实现。
示例性的,如下示出了接受协同的接口的具体实现。
j.setSession ID(session ID)
电子设备200解析并得到电子设备200发送的会话标识,将电子设备100上的实例1和电子设备200上的实例1关联同一个会话标识(会话标识1),使得电子设备100上和电子设备200上相同的两个实例间的数据保持一致。
需要说明的是,在其他实施例中,发起协同的接口的名称和接受协同的接口的名称可能会发生变化,但是原理类似,本申请实施例对此不做限定。
1407、电子设备100监测到实例1的属性值由第一值变化为第二值。
在一些实施例中,实例1的第二值也可以被称为变化后的所述第一实例属性。
示例性的,如下示出了监测数据对象变化的接口的具体实现。
obj.on(‘change’,(changedKeys:Array[string])=>{})
需要说明的是,在其他实施例中,监测数据对象变化的接口的名称可能会发生变化,但是原理类似,本申请实施例对此不做限定。
1408、电子设备100更新分布式数据对象一,获取到实例1的属性值为第二值。
更新后的分布式数据对象一的类型没变,仅是更新后的分布式数据对象一上的实例的属性值发生了变化。
例如,数据对象一可以是音频导航信息,实例1属性值的第一值可以是音频内容“剩余距离5公里”。实例1属性值的第二值可以是音频内容“剩余距离3公里”。
在电子设备100更新分布式数据对象一后,电子设备100还需将更新分布式数据对象一以键-值(key-value)的形式保存至分布式数据库中。具体的,可以参考表1中的相关描述,本申请实施例在此不再赘述。
在一些实施例中,电子设备100可以将分布式数据对象一和更新分布式数据对象一同时保存至分布式数据库中,电子设备100也可以仅保存更新分布式数据对象一,删除掉分布式数据对象一。
1409、电子设备100将实例1的属性值和会话标识1发送至电子设备200。
在一些实施例中,电子设备100将实例1的属性值和会话标识1发送至电子设备200,也可以被称为,电子设备100将变化后的实例1的属性值通过第一会话发送给第二电子设备200。这样,第一电子设备仅将发发生变化后的实例属性发送至第二电子设备,不需发送没有发生变化的实例属性,减少了协同设备间数据的传输量,提高了协同效率。
电子设备100将实例1的属性值(第二值)发送至电子设备200,以使得电子设备200基于实例1的属性值(第二值)更新分布式数据对象一。
电子设备100将会话标识1发送至电子设备200,以使得电子设备200基于接收到的会话标识1,确定出电子设备200上关联了会话标识1的实例标识(实例1的标识),并将电子设备200上实例1上的属性值由第一值修改为第二值,并基于实例1上的属性值更新分布式数据对象一。
1410、电子设备200将实例1的属性值由第一值修改为第二值,并基于实例1的属性值更新分布式数据对象一,输出更新后的分布式数据对象一。
电子设备200将实例1的属性值由第一值修改为第二值,基于实例1的属性值更新分布式数据对象一,输出更新后的分布式数据对象一。
电子设备200还需将更新后的分布式数据对象一以键-值(key-value)的形式保存至分布式数据库中。具体的,可以参考表1中的相关描述,本申请实施例在此不再赘述。
在一些实施例中,电子设备200可以将分布式数据对象一和更新后的分布式数据对象一同时保存至分布式数据库中,电子设备200也可以仅保存更新后的分布式数据对象一,删除掉分布式数据对象一。
示例性的,如下示出了更新分布式数据对象的接口的具体实现。
Obj.title=“New Title”
需要说明的是,在其他实施例中,更新分布式数据对象的接口的名称可能会发生变化,但是原理类似,本申请实施例对此不做限定。
下面示例性的介绍本申请实施例提供一种设备协同方法提供的应用场景。
示例性的,电子设备100为手机,电子设备200为智能手表。在用户骑车时不方便使用手机导航的情况下,手机也没处理导航信息的能力,当手机和智能手表处于同一分布式网络时,手机可以实现一键将手机上导航的地图信息无缝切换至智能手表上,由智能手表来继续显示导航信息,方便用户一边骑车一边查看导航信息。
示例性的,如图15A所示,电子设备100上可以显示有主屏幕的界面1301,该界面1301中显示了一个放置有应用图标的页面,该页面包括多个应用图标(例如,天气应用图标、股票应用图标、计算器应用图标、设置应用图标、邮件应用图标、音乐应用图标、视频应用图标、浏览器应用图标、地图应用图标1302、等等)。多个应用图标下方还显示包括有页面指示符,以表明当前显示的页面与其他页面的位置关系。页面指示符的下方有多个托盘图标(例如拨号应用图标、信息应用图标、联系人应用图标、相机应用图标),托盘图标在页面切换时保持显示。
电子设备100可以接收到用户作用于该地图应用图标1302的输入操作(例如单击),响应于该输入操作,电子设备100可以响应于该输入操作,电子设备100可以显示如图15B所示的地图应用界面1303。
如图15B所示,电子设备100显示出地图应用界面1303。该地图应用界面1303中包括有地图1304和搜索框。地图1304上显示有用户的当前位置的周边地图信息。搜索框可以用于接收用户输入的目的地名称。
如图15C所示,电子设备100可以接收用户在目的地搜索框中输入的目的地名称(例如,“天安云谷”),响应于该输入操作,电子设备100可以显示窗口1305。该窗口1305可以包括电子设备100当前所处地理位置与目的地的距离(例如,5.2KM)、目的地地址信息(“广东省-深圳市-龙岗区-坂雪岗大道163园区”)和导航控件1306。
电子设备100可以接收用户针对该导航控件1306的输入操作(例如单击),响应于该输入操作,电子设备100可以开启导航,从地图服务器上获取电子设备100当前所处位置到目的地的路线信息,并全屏显示如图15D所示的界面1307。
如图15D所示,该界面1307上可以显示包括有地图、位置标记1308和电子设备100当前所处位置到目的地的驾驶路线1309、更多控件1310、退出控件1311。该位置标记1308可用于指示电子设备100当前在地图中的位置。该更多控件1310可用于触发显示更多其他的功能控件。该退出控件1311可用于触发电子设备100退出导航。
如图15D和图15E所示,电子设备100与电子设备200建立协同连接后,电子设备100将导航信息发送至电子设备200,电子设备200将显示导航信息。
在一些实施例中,如图15F和图15G所示,电子设备100与电子设备200建立协同连接后,电子设备100可以将导航信息和音频信息发送至电子设备200,电子设备200将显示导航信息,并通过音频输出设备播放音频信息,信息可以是“继续前行500米进入贝尔路,距离目的地剩余4.5KM,用时17分钟”。
本申请的各实施方式可以任意进行组合,以实现不同的技术效果。
在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机程序指令时,全部或部分地产生按照本申请所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线)或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。所述可用介质可以是磁性介质,(例如,软盘、硬盘、磁带)、光介质(例如,DVD)、或者半导体介质(例如固态硬盘(solid state dk,SSD))等。
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,该流程可以由计算机程序来指令相关的硬件完成,该程序可存储于计算机可读取存储介质中,该程序在执行时,可包括如上述各方法实施例的流程。而前述的存储介质包括:ROM或随机存储记忆体RAM、磁碟或者光盘等各种可存储程序代码的介质。

Claims (14)

  1. 一种设备协同方法,其特征在于,所述方法包括:
    第一电子设备与第二电子设备建立协同连接;
    所述第一电子设备获取第一数据对象的第一实例属性以及第二数据对象的第二实例属性;
    所述第一电子设备通过第一会话发送所述第一实例属性给第二电子设备,以及通过第二会话发送所述第二实例属性给所述第二电子设备;其中,所述第一实例属性用于所述第二电子设备生成所述第一数据对象,所述第二实例属性用于所述第二电子设备生成所述第二数据对象。
  2. 根据权利要求1所述的方法,其特征在于,所述方法还包括:
    所述第一电子设备获取到所述第一数据对象的第三实例属性;
    所述第一电子设备通过所述第一会话发送所述第三实例属性给所述第二电子设备,所述第一实例属性和所述第三实例属性共同用于所述第二电子设备生成所述第一数据对象。
  3. 根据权利要求1所述的方法,其特征在于,所述方法还包括:
    所述第一电子设备获取到所述第一数据对象的第三实例属性;
    所述第一电子设备通过第三会话发送所述第三实例属性给所述第二电子设备,所述第一实例属性和所述第三实例属性共同用于所述第二电子设备生成所述第一数据对象。
  4. 根据权利要求1-3任一项所述的方法,其特征在于,在所述第一电子设备通过第一会话发送所述第一实例属性给第二电子设备之后,所述方法还包括:
    所述电子设备监测到所述第一实例属性有变化,将变化后的所述第一实例属性通过所述第一会话发送给所述第二电子设备,变化后的所述第一实例属性用于所述第二电子设备更新所述第一数据对象。
  5. 根据权利要求1-4任一项所述的方法,其特征在于,所述第一电子设备与所述第二电子设备建立协同连接,具体包括:
    所述第一电子设备向所述第二电子设备发送协同消息,所述协同消息中包括有所述第一实例的实例标识和所述第一会话的会话标识;所述第一会话的会话标识与所述第一实例关联。
  6. 根据权利要求1-5任一项所述的方法,其特征在于,所述方法还包括:
    所述第一电子设备与第三电子设备建立协同连接;
    所述第一电子设备通过第四会话发送所述第一实例属性给第三电子设备,通过第五会话发送所述第二实例属性给所述第三电子设备,所述第一实例属性用于所述第三电子设备生成所述第一数据对象,所述第二实例属性用于所述第三电子设备生成所述第二数据对象。
  7. 根据权利要求1-5任一项所述的方法,其特征在于,所述方法还包括:
    所述第一电子设备与第三电子设备建立协同连接;
    所述第一电子设备生成第三数据对象;
    所述第一电子设备获取到所述第三数据对象的第四实例属性;
    所述第一电子设备通过第六会话发送所述第四实例属性给第三电子设备,所述第四实例属性用于所述第三电子设备生成所述第三数据对象。
  8. 根据权利要求1-7任一项所述的方法,其特征在于,所述第一电子设备获取到所述第一数据对象的第一实例属性以及所述第二数据对象的第二实例属性,具体包括:
    所述第一电子设备基于数据劫持的方式获取到所述第一数据对象的第一实例属性以及所述第二数据对象的第二实例属性。
  9. 根据权利要求1-8任一项所述的方法,其特征在于,第一数据对象与所述第一会话关联,第二数据对象与所述第二会话关联;所述第一数据对象和所述第二数据对象不同。
  10. 根据权利要求1-9任一项所述的方法,其特征在于,第一数据对象包括文字数据对象、图片数据对象、音频数据对象和视频数据对象中的至少一种。
  11. 一种电子设备,为第一电子设备,其特征在于,所述第一电子设备包括一个或多个功能单元,所述一个或多个功能单元用于执行上述权利要求1-10任一项所述的方法。
  12. 一种电子设备,为第一电子设备,其特征在于,所述第一电子设备包括:一个或多个处理器、一个或多个存储器;其中,所述一个或多个存储器与所述一个或多个处理器耦合,所述一个或多个存储器用于存储计算机程序代码,所述计算机程序代码包括计算机指令,所述一个或多个处理器调用所述计算机指令以使得所述第一电子设备执行上述权利要求1-10任一项所述的方法。
  13. 一种计算机可读存储介质,用于存储计算机指令,当所述计算机指令在第一电子设备上运行时,使得所述第一电子设备执行上述权利要求1-10任一项所述的方法。
  14. 一种计算机程序产品,其特征在于,当所述计算机程序产品在第一电子设备上运行时,使得所述第一电子设备执行上述权利要求1-10任一项所述的方法。
PCT/CN2023/083127 2022-03-24 2023-03-22 一种设备协同方法 WO2023179682A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210297167.3 2022-03-24
CN202210297167.3A CN116841761A (zh) 2022-03-24 2022-03-24 一种设备协同方法

Publications (1)

Publication Number Publication Date
WO2023179682A1 true WO2023179682A1 (zh) 2023-09-28

Family

ID=88100087

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/083127 WO2023179682A1 (zh) 2022-03-24 2023-03-22 一种设备协同方法

Country Status (2)

Country Link
CN (1) CN116841761A (zh)
WO (1) WO2023179682A1 (zh)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020198941A1 (en) * 2001-04-16 2002-12-26 Alexandru Gavrilescu Web site cobrowsing
US20150254222A1 (en) * 2014-03-06 2015-09-10 Xerzees Technologies Inc. Method and apparatus for cobrowsing
CN108647331A (zh) * 2012-07-19 2018-10-12 格兰斯电讯网络有限公司 协同浏览与其他形式的信息共享的集成
CN114071425A (zh) * 2020-07-29 2022-02-18 华为技术有限公司 电子设备间的协同方法、协同系统和电子设备

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020198941A1 (en) * 2001-04-16 2002-12-26 Alexandru Gavrilescu Web site cobrowsing
CN108647331A (zh) * 2012-07-19 2018-10-12 格兰斯电讯网络有限公司 协同浏览与其他形式的信息共享的集成
US20150254222A1 (en) * 2014-03-06 2015-09-10 Xerzees Technologies Inc. Method and apparatus for cobrowsing
CN114071425A (zh) * 2020-07-29 2022-02-18 华为技术有限公司 电子设备间的协同方法、协同系统和电子设备

Also Published As

Publication number Publication date
CN116841761A (zh) 2023-10-03

Similar Documents

Publication Publication Date Title
WO2021052263A1 (zh) 语音助手显示方法及装置
WO2020192714A1 (zh) 显示设备控制页面的方法、相关装置及系统
WO2021042978A1 (zh) 一种主题切换方法以及主题切换装置
US20230021994A1 (en) Cross-Device Content Projection Method and Electronic Device
WO2021159746A1 (zh) 文件共享方法、系统及相关设备
WO2020150917A1 (zh) 一种应用权限的管理方法及电子设备
CN113961157B (zh) 显示交互系统、显示方法及设备
WO2021253975A1 (zh) 应用程序的权限管理方法、装置和电子设备
WO2021052204A1 (zh) 基于通讯录的设备发现方法、音视频通信方法及电子设备
CN114125354A (zh) 一种智能音箱与电子设备协作的方法及电子设备
WO2021073337A1 (zh) 安装插件的方法、装置和存储介质
WO2023273543A1 (zh) 一种文件夹管理方法及装置
EP4228233A1 (en) Method for adding operation sequence, electronic device, and system
WO2021031862A1 (zh) 一种数据处理方法及其装置
CN115022982B (zh) 多屏协同无感接入方法、电子设备及存储介质
WO2022111529A1 (zh) 一种应用程序的调试方法及电子设备
WO2023179682A1 (zh) 一种设备协同方法
CN115017498A (zh) 小应用程序的操作方法和电子设备
WO2024041456A1 (zh) 一种应用数据保存方法及电子设备
CN113271577B (zh) 媒体数据播放系统、方法及相关装置
WO2022068578A1 (zh) 文件共享方法和电子设备
WO2023221917A1 (zh) 账户屏蔽方法、通信系统及电子设备
WO2023207890A1 (zh) 一种界面显示方法及电子设备
WO2023001208A1 (zh) 多文件同步方法及电子设备
WO2023236939A1 (zh) 应用组件交互方法及相关设备

Legal Events

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

Ref document number: 23773929

Country of ref document: EP

Kind code of ref document: A1