A device control method, a network system, an electronic device, and a storage medium
By establishing a virtual gateway in electronic devices, obtaining authorization information, and sending control commands, the problem of users being unable to control sub-devices while only sharing them is solved, enabling effective control over sub-devices and improving the user experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HONOR DEVICE CO LTD
- Filing Date
- 2024-05-09
- Publication Date
- 2026-07-31
AI Technical Summary
In existing technologies, when a user shares a sub-device only with the target account and not with the gateway device, the electronic device associated with the target account cannot control the sub-device through the gateway device, resulting in a degraded user experience.
By establishing a virtual gateway, the authorization information of the gateway is obtained, and control commands are sent to the gateway based on the virtual gateway to achieve control over the sub-devices.
Electronic devices can still effectively control sub-devices without sharing a gateway device, thus improving the user experience.
Smart Images

Figure CN120750686B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of terminal technology, and in particular to a device control method, network system, electronic device and storage medium. Background Technology
[0002] As users' demand for smart living continues to increase, the variety of smart devices on the market (such as smart curtains, smart lights, smart switches, smart air conditioners, smart printers, etc.) is also increasing, replacing traditional devices and providing convenience for users' lives. In smart scenarios, electronic devices such as mobile phones and tablets can be associated with the same account A and establish a communication connection with smart devices. In this way, smart devices can become sub-devices of electronic devices, and electronic devices can send instructions to sub-devices to control or manage one or more sub-devices.
[0003] Since the sub-devices lack network connectivity, they cannot access the server via the network. In this case, these sub-devices can be attached to a gateway device associated with the same account A, and the gateway device can then be connected to the server. This allows the electronic devices to establish a communication connection with the gateway device through the server, and control the sub-devices through the gateway device.
[0004] In related technologies, a user can share a sub-device associated with account A to account B, establishing a connection between the sub-device and account B. This allows other users to control the sub-device from electronic devices associated with account B. However, for sub-devices connected to a gateway device, if the user only shares the sub-device with account B without sharing the gateway device, electronic devices associated with account B will be unable to control the shared sub-device through the gateway device, thus degrading the user experience. Summary of the Invention
[0005] To address the aforementioned issues, this application provides a device control method, a network system, an electronic device, and a storage medium. Even when the source account only shares the sub-device with the target account but not the gateway device, the electronic device can still control the sub-device based on the first authorization information, thereby improving the user experience.
[0006] To achieve the above objectives, in a first aspect, this application provides a device control method applied to an electronic device, wherein the electronic device is associated with a target account. The method includes: obtaining a first device list, the first device list including information of a first sub-device, the first sub-device including sub-devices shared by a source account to a target account, and the first sub-device being mounted on a first gateway; initiating gateway authentication to the first gateway based on a virtual gateway to obtain first authorization information of the first gateway; and sending a control command to the first gateway based on the virtual gateway, the control command including the first authorization information, to control the first sub-device through the first gateway.
[0007] In the method provided in this application embodiment, a virtual gateway is established, and the virtual gateway includes first authorization information. Even if the source account only shares the sub-device with the target account and does not share the gateway, the electronic device can still control the sub-device based on the first authorization information, thereby improving the user experience.
[0008] In one optional implementation, gateway authentication is initiated with a first gateway based on a virtual gateway to obtain the first gateway's first authorization information. This includes: sending an authentication request message to the first gateway based on the virtual gateway; and receiving an authentication response message from the first gateway based on the virtual gateway, the authentication response message including the first authorization information. By authenticating the virtual gateway, updated first authorization information is obtained. Based on the first authorization information, the electronic device can control the first sub-device, improving the user experience.
[0009] In one optional implementation, based on a virtual gateway, control commands are sent to a first gateway, including: obtaining the online status of the first sub-device from the server; and, if the first sub-device is online, sending control commands to the first gateway based on the virtual gateway, where online status means that the first sub-device and the first gateway have established a communication connection. In other words, after establishing a virtual gateway, determining the online status of the first sub-device ensures the electronic device's control over the first sub-device, improving the user experience.
[0010] In one optional implementation, sending an authentication request message to a first gateway based on a virtual gateway includes: sending an authentication request message to a server based on the virtual gateway, so that the server forwards the authentication request message to the first gateway. The authentication request message has a preset target subject field, which includes the next-hop information of the message. Because the target subject field includes the next-hop information of the message, the electronic device can send the authentication request message based on the target subject field, ensuring that the message information is accurately sent from the server to the first gateway.
[0011] In one optional implementation, receiving an authentication response message from a first gateway, based on a virtual gateway, includes: receiving an authentication response message forwarded by a server from the first gateway, based on the virtual gateway. The authentication response message has a preset target topic field, which includes the next-hop information of the message. Because the target topic field includes the next-hop information of the message, the electronic device can send the authentication response message based on the target topic field and can accurately receive the message information sent by the first gateway.
[0012] In one optional implementation, sending a control command to the first gateway based on the virtual gateway includes: sending the control command to the server based on the virtual gateway, so that the server forwards the control command to the first gateway. The control command has a preset target topic field, which includes the next-hop information of the packet. Since the target topic field includes the next-hop information of the packet, the electronic device can send the control command based on the target topic field, ensuring control over the first sub-device and improving the user experience.
[0013] In one alternative implementation, the target topic field also includes: source device information of the message and target device information of the message.
[0014] In one optional implementation, gateway authentication is initiated to the first gateway based on the virtual gateway. This includes: if the first authorization information is not included in the first device list, initiating gateway authentication to the first gateway based on the virtual gateway. If the first authorization information is not included, the established virtual gateway is authenticated to obtain the first authorization information, facilitating subsequent control of sub-devices by electronic devices.
[0015] In one optional implementation, before initiating gateway authentication with the first gateway to obtain the first authorization information based on the virtual gateway, the method further includes: sending a first request message to the server, the first request message being used to request the first authorization information; and receiving a first response message sent by the server, the first response message including the first authorization information previously reported by the first gateway to the server. By obtaining the first authorization information from the server for authentication of the virtual gateway, it is ensured that subsequent electronic devices can control the first sub-device, thereby improving the user experience.
[0016] In one optional implementation, the method further includes: if the first device list includes the first authorization information, sending a control command to the first sub-device via the first gateway. Since the first device list includes the first authorization information, it is no longer necessary to re-acquire the first authorization information; therefore, the electronic device can directly control the first sub-device based on the existing first authorization information.
[0017] In one optional implementation, based on the virtual gateway, an authentication request message is sent to the first gateway, including: the virtual connection module of the LinkSvc connection management service sending the authentication request message to the first gateway based on the virtual gateway; and based on the virtual gateway, an authentication response message is received from the first gateway, including: the virtual connection module receiving the authentication response message based on the virtual gateway. By authenticating through the virtual gateway, after authentication is completed, the electronic device can control the first sub-device, improving the user experience.
[0018] In one optional implementation, sending a first request message to the server includes: the physical connection module of the connection management service sending the first request message to the server; the virtual connection module of the connection management service receiving a first response message sent by the server; and the virtual connection module storing the first authorization information. By authenticating the virtual gateway, after authentication is completed, the electronic device can control the first sub-device, improving the user experience.
[0019] In one optional implementation, obtaining the first device list includes: the authorization management module of the connection management service sending a second request message to the server; the authorization management module receiving a second response message from the server, the second response message including the first device list; the authorization module sending the device list to the physical connection module of the connection management service; and the physical connection module of the connection management service receiving and storing the first device list. Obtaining the first device list to acquire information about the first sub-device facilitates subsequent control of the first sub-device by electronic devices, improving the user experience.
[0020] In one optional implementation, obtaining the online status of the first sub-device includes: the virtual connection module of the connection management service sending a third request message to the server; the virtual connection module receiving a third response message from the server, the third response message including the online status of the first sub-device; and the virtual connection module reporting the online status of the first sub-device to the smart space application. After establishing the virtual gateway, determining the online status of the first sub-device ensures the control of the first sub-device by electronic devices, improving the user experience.
[0021] In one optional implementation, based on a virtual gateway, control commands are sent to the first gateway, including: when the first sub-device is online, the smart space application responds to user operation by sending control commands to the virtual connection module of the connection management service; the virtual connection module, based on the virtual gateway, sends the control commands to the first gateway. After virtual gateway authentication is established and it is determined that the first sub-device is online, the smart space application of the electronic device responds to user operation to control the first sub-device, thereby improving the user experience.
[0022] Secondly, this application provides a network system, including: an electronic device, a server, and a first gateway; the electronic device is configured to obtain a first device list from the server, the first device list including information of a first sub-device, wherein the electronic device is associated with a target account, the first sub-device includes sub-devices shared by the source account to the target account, and the first sub-device is mounted on the first gateway; the electronic device is further configured to initiate gateway authentication to the first gateway based on a virtual gateway; the first gateway is configured to send first authorization information of the first gateway to the electronic device if the gateway authentication is successful; the server is further configured to send control instructions to the first gateway based on the virtual gateway, the control instructions including the first authorization information of the first gateway, so as to control the first sub-device through the first gateway.
[0023] In the system provided in this application embodiment, when the source account is only shared with the first sub-device of the target account and not with the first gateway, the electronic device first initiates gateway authentication with the first gateway based on the virtual gateway. If the gateway authentication is successful, the electronic device sends control commands to the first gateway based on the virtual gateway, thereby realizing control over the first sub-device and improving the user experience.
[0024] Thirdly, this application also provides an electronic device, including: a display screen, a memory, and one or more processors; the display screen, the memory, and the processors are coupled; wherein the memory stores computer program code, the computer program code including computer instructions, which, when executed by the processor, cause the electronic device to perform the device control method as described in the first aspect above.
[0025] Fourthly, this application also provides a computer-readable storage medium, characterized in that it includes computer instructions that, when executed on an electronic device, cause the electronic device to perform the device control method as described in the first aspect above.
[0026] Fifthly, this application also provides a computer program product, characterized in that, when the computer program product is run on a computer, it causes the computer to execute the device control method as described in the first aspect above.
[0027] Understandably, the beneficial effects that the technical solutions provided in the third to fifth aspects above can achieve can be referred to the beneficial effects in the first aspect and any of its optional implementation methods, and will not be repeated here. Attached Figure Description
[0028] To more clearly illustrate the technical solution of this application, the drawings used in the embodiments will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0029] Figure 1 This is a schematic diagram of a control system for an electronic device provided in an embodiment of this application;
[0030] Figure 2 This is a structural block diagram of an electronic device control system provided in an embodiment of this application;
[0031] Figure 3 This is a schematic diagram of a user controlling an electronic device system using electronic device A, provided in an embodiment of this application.
[0032] Figure 4 This is a schematic diagram of a user controlling an electronic device system using electronic device B, provided in an embodiment of this application.
[0033] Figure 5 This is a schematic diagram of an electronic device provided in an embodiment of this application;
[0034] Figure 6 This is a schematic diagram of the layered architecture of a software system for an electronic device provided in an embodiment of this application;
[0035] Figure 7 This is a structural block diagram of a network system provided in an embodiment of this application;
[0036] Figure 8 This is a schematic diagram of a device control method provided in an embodiment of this application. Figure 1 ;
[0037] Figure 9 This is a schematic diagram of a device control method provided in an embodiment of this application. Figure 2 ;
[0038] Figure 10 This is a schematic diagram of a device control method provided in an embodiment of this application. Figure 3 ;
[0039] Figure 11 This is a schematic diagram of an authentication method provided in an embodiment of this application;
[0040] Figure 12 This is a schematic diagram of a device control method provided in an embodiment of this application. Figure 4 ;
[0041] Figure 13 This is a schematic diagram of a user controlling an electronic device system using a mobile phone, provided in an embodiment of this application.
[0042] Figure 14 This is a schematic diagram of a device control method provided in an embodiment of this application. Figure 5 ;
[0043] Figure 15This application provides a structural block diagram of a chip system. Detailed Implementation
[0044] The technical solutions of the embodiments of this application will be clearly described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this application. Other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are all within the protection scope of this application.
[0045] In the following description, the terms "first," "second," etc., are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature defined with "first," "second," etc., may explicitly or implicitly include one or more of that feature. In the description of this application, unless otherwise stated, "a plurality of" means two or more.
[0046] Furthermore, in this application, directional terms such as "upper," "lower," "inner," and "outer" are defined relative to the indicated placement of the components in the accompanying drawings. It should be understood that these directional terms are relative concepts, used for relative description and clarification, and can change accordingly depending on the placement of the components in the accompanying drawings.
[0047] The embodiments of this application will now be described with reference to the accompanying drawings.
[0048] Smart devices are devices with computing and networking capabilities that can be remotely monitored and operated via the internet, such as smart TVs, smart speakers, smart projectors, smart lights, smart curtains, smart printers, smart switches, and smart air conditioners.
[0049] In intelligent scenarios, electronic devices such as mobile phones and tablets can be associated with the same account A and establish a communication connection with intelligent devices. In this way, intelligent devices can become sub-devices of electronic devices, and electronic devices can send instructions to sub-devices to control or manage one or more sub-devices.
[0050] Figure 1 This is a schematic diagram of a control system for an electronic device provided in an embodiment of this application. Taking a mobile phone as an example, the control system of the electronic device includes an electronic device 10, a server 11, a gateway device 14, and a sub-device 13.
[0051] Since sub-device 13 lacks network connectivity, it cannot access the server 11 via the network. In this case, these sub-devices 13 can be attached to a gateway device 14 associated with the same account A, and the gateway device 14 can be connected to the server 11. In this way, electronic device 10 can establish a communication connection with the gateway device 14 through the server 11 and control the sub-device 13 through the gateway device 14.
[0052] The server 11 will pre-store the mutual trust relationship between the electronic device 10 and the gateway device 14. The mutual trust relationship means that the server 11 will store multiple devices under the same account. Devices associated with the same account trust each other, and the server 11 will not intercept the communication connection between the devices. The devices can establish communication connection.
[0053] Electronic device 10 and gateway device 14 are associated with the same account A. Server 11 has a mutual trust relationship between electronic device 10 and gateway device 14, and server 11 will not intercept the communication connection between electronic device 10 and gateway device 14.
[0054] For example, electronic device 10 can communicate encryptedly with sub-device 13 through gateway device 14 and server 11. Electronic device 10 can encrypt instructions and send them to gateway device 14 via server 11. Gateway device 14 decrypts the instructions, encrypts them again, and sends the re-encrypted instructions to sub-device 13. Sub-device 13 decrypts the received re-encrypted instructions to execute the instructions of electronic device 10.
[0055] In this scenario, the electronic device 10 and the gateway device 14 can be associated with the same account A. This can be achieved by both the electronic device 10 and the gateway device 14 logging into account A. Alternatively, the gateway device 14 can be bound to account A, while the electronic device 10 logs into account A.
[0056] When electronic device 10 and gateway device 14 are associated with different accounts, and there is no mutual trust relationship between electronic device 10 and gateway device 14 on server 11, server 11 will block the communication connection between electronic device 10 and gateway device 14.
[0057] The server 11 has a mutual trust relationship between the electronic device 10 and the gateway device 14. The electronic device 10 can establish a communication connection with the gateway device 14 through the server 11 and control the sub-device 13 through the gateway device 14. The above communication can be in the form of a topic field.
[0058] Referring to Table 1, taking a mobile phone as an example, in messages sent from the mobile phone to the gateway device, the format of the topic field is: / magiclink / dev / channel / ${gatewayID}. In messages sent from the gateway device to the mobile phone, the format of the topic field is: / magiclink / dev / channel / ${phoneID}.
[0059] Table 1
[0060] source topic field Electronic devices (mobile phones) to the first gateway / magiclink / dev / channel / ${gatewayID} The first gateway connects to the electronic device (mobile phone). / magiclink / dev / channel / ${phoneID} ;
[0062] For example, electronic device 10, gateway device 14, sub-device 13, and server 11 can establish a communication connection using the topic field. After establishing the communication connection, sub-device 13 sends its online status to gateway device 14, gateway device 14 reports the online status of sub-device 13 to server 11, and server 11 reports the online status of sub-device 13 to electronic device 10. When sub-device 13 is online, electronic device 10 sends control commands to server 11, server 11 sends the control commands to gateway device 14, and gateway device 14 sends the control commands to sub-device 13 to complete the control of sub-device 13 by electronic device 10. When sub-device 13 is offline, electronic device 10 cannot control sub-device 13.
[0063] Electronic device 10, gateway device 14 and server 11 establish a communication connection. Alternatively, message queue telemetry transmission protocol can be used. Gateway device 14 and sub-device 13 can directly communicate using wireless communication technology, thereby enabling control of sub-device 13.
[0064] Optionally, wireless communication technologies include, but are not limited to: wireless local area networks (WLAN), wireless fidelity (Wi-Fi) networks, Bluetooth (BT), 5th generation mobile networks (or 5th generation wireless systems, abbreviated as 5G), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc.
[0065] For example, the gateway device 14 can be an industrial control gateway, IoT gateway, smart home gateway, cloud gateway, etc., designed based on a programmable logic controller (PLC). The type and function of the gateway can be selected according to the specific purpose, and no limitation is made in this embodiment.
[0066] In summary, sub-devices have networking capabilities, allowing electronic devices and sub-devices to access the server via the network. This enables electronic devices to establish communication connections with sub-devices through the server, facilitating control and management of the sub-devices. Sub-devices do not have direct networking capabilities; however, electronic devices can be attached to a gateway device associated with the same account A. This allows electronic devices to establish communication connections with the gateway device through the server, enabling control and management of the sub-devices through the gateway device.
[0067] The following example illustrates how a sub-device, lacking the ability to directly connect to the network, cannot access the server and needs to establish a communication connection with a gateway device sharing the same account A.
[0068] Combination Figure 2 As shown, Figure 2 This is a structural block diagram of an electronic device control system provided in an embodiment of this application.
[0069] like Figure 2 As shown, the electronic device control system includes an electronic device 10, a gateway device 14, a sub-device 13, a scene cloud 15, a device cloud 16, an over-the-air (OTA) server 17, and a developer website 18. Over-the-air (OTA) technology is a remote upgrade technology, which is a technology for remotely managing electronic devices and sub-devices via mobile communication networks (2G / 3G / 4G / 5G or Wi-Fi).
[0070] It should be noted that electronic devices can be mobile phones, computers, tablets, and other electronic devices, while sub-devices can refer to smart devices such as smart TVs and smart speakers. It is understood that the number and types of smart devices in the electronic device control system can be selected according to the actual situation, and are not limited in this embodiment.
[0071] In the electronic device control system, the scene cloud 15, device cloud 16, and OTA server 17 can be different modules of the server built on the Internet platform. The server can be used to realize the communication connection between the gateway device 14 and the electronic device 10, thereby realizing the communication connection between the sub-devices mounted on the gateway device 14 and the electronic device 10.
[0072] Scene Cloud 15 provides data storage, analysis, processing, and application services for IoT applications. Scene Cloud 15 can establish a communication connection with electronic device 10, allowing electronic device 10 to upload scene editing definitions to Scene Cloud 15. These scene editing definitions include the set control scenes, thereby displaying a control interface for the sub-device to the user. Electronic device 10 responds to user operations on the control interface, controlling sub-device 13.
[0073] For example, when the sub-device 13 is a smart light, the electronic device 10 can set the smart light to be turned off or on in the control scenario.
[0074] Device Cloud 16 supports various types of IoT devices to connect to server 11. Users can conveniently manage device registration, authentication, access, and remote monitoring and control of IoT devices using Device Cloud 16. In this way, control commands issued by electronic device 10 can be transmitted to each sub-device 13 through Device Cloud 16 to achieve control and management of sub-device 13.
[0075] The OTA server 17 is a server used for remotely updating the firmware and software of IoT devices. It can provide IoT devices with remote firmware and software updates, thereby saving a lot of manpower and time costs.
[0076] As can be seen from the above explanation, in such Figure 2 In the electronic device control system shown, electronic device 10 can receive and respond to user operations, and use server 11 and gateway device 14 to control sub-device 13.
[0077] In some embodiments, the sub-device 13 can be connected to the device cloud 16 via the gateway device 14. Since the device cloud 16 can establish communication connections with the scene cloud 15 and the electronic device 10, the electronic device 10 can control the sub-device 13 through the device cloud 16 and the gateway device 14.
[0078] Specifically, sub-device 13 can report its online status to gateway device 14, which in turn reports the online status to device cloud 16. Device cloud 16 then reports the online status to electronic device 10 and scene cloud 15. In this way, users can check the online status of sub-device 13 through electronic device 10. The online status of sub-device 13 includes online and offline states. When sub-device 13 is online, electronic device 10 can control it; when sub-device 13 is offline, electronic device 10 cannot control it.
[0079] In one example, if the sub-device 13 is online, the electronic device 10 can control the sub-device 13 through the scene cloud 15, the device cloud 16, and the gateway device 14.
[0080] Furthermore, the device cloud 16 is also connected to the OTA server 17, which in turn is connected to the gateway device 14. When a developer needs to update the sub-device 13, the developer can upload the OTA version package to the developer website 18. The developer website 18 then uploads the OTA version package to the OTA server 17, which in turn sends the OTA version package to the sub-device 13 associated with the gateway device 14 via the gateway device 14. The device cloud 16 can request the OTA server 17 to check the version of the sub-device 13, and the OTA server 17 then returns the version information of the sub-device 13 to the device cloud 16.
[0081] Alternatively, when a developer needs to configure sub-device 13, the developer can upload the profile configuration file and / or the Prdld third-party device type configuration file to the developer website 18. The developer website 18 will then upload the profile configuration file and / or the Prdld third-party device type configuration file to the device cloud 16, and the device cloud 16 will then perform the configuration operation on sub-device 13.
[0082] In related technologies, for sub-devices mounted on a gateway device, the sub-device and the gateway device on which the sub-device is mounted are associated with the same account A. If a user shares the sub-device and the gateway device on which the sub-device is mounted together with account B, the electronic device associated with account B can control the shared sub-device through the gateway device. However, if the user only shares the sub-device with account B and does not share the gateway device with account B, the electronic device associated with account B will not be able to control the shared sub-device through the gateway device, thus reducing the user experience.
[0083] The following is combined Figure 3 and Figure 4 Let me explain further.
[0084] Figure 3 This is a schematic diagram of a user controlling an electronic device system using electronic device A, provided in an embodiment of this application. Figure 1 . Figure 4 This is a schematic diagram of a user controlling an electronic device system using electronic device B, provided in an embodiment of this application. Figure 2 .
[0085] In this scenario, sub-device A is associated with the same account A as electronic device A, and electronic device B is associated with account B. The following example, using a mobile phone as the electronic device, illustrates the process of a user sharing sub-device A from account A to account B.
[0086] like Figure 3 As shown, the main interface 21 of mobile phone A (as shown) Figure 3 As shown in (a), various types of application icons can be displayed, such as clock icons, calendar icons, gallery icons, memo icons, file manager icons, video icons, smart space icons, etc. The main interface of phone A can also display a status bar, which may include: one or more signal strength indicators for mobile communication signals, one or more signal strength indicators for Wi-Fi signals, battery level indicators for electronic devices, time indicators, etc.
[0087] Mobile phone A can receive and respond to the user's click operation 01 on the Smart Space icon 212, launch the Smart Space application (APP), and display as follows: Figure 3 The Smart Space APP interface 22 is shown in (b) above. The Smart Space APP interface 22 can display the number of sub-devices A that the user has added to "My Home", the cards of each sub-device A, and the other function icons.
[0088] The card for sub-device A may include at least one of the following: sub-device A's icon, name, online status, the account it belongs to, and the gateway device associated with sub-device A. The name of sub-device A can be user-defined or an original name provided by the device manufacturer; in this embodiment, the name of the smart device is not limited. The function icons in the Smart Space APP interface 22 may include, but are not limited to, home icons, store icons, smart icons, my icons, and add device icons.
[0089] Specifically, such as Figure 3 As shown in (b), the TV in the living room is online, under account A, and associated with gateway device A; the TV in the master bedroom is online, under account A, and associated with gateway device A; the TV in the second bedroom is online, under account A, and associated with gateway device A; the speaker in the master bedroom is online, under account A, and associated with gateway device A; the speaker in the living room is offline, under account A, and associated with gateway device A; the speaker in the study is offline, under account A, and associated with gateway device A; the smart projector is offline, under account A, and associated with gateway device A. For example, mobile phone A receives and responds to the user's input to the Smart Space APP interface 22 (e.g., ...). Figure 3 Long-pressing any card of sub-device A in (b) will jump to the following path: Figure 3The Smart Space APP interface 23 shown in (c) displays the cards of the sub-devices A that can be shared and the cards of the gateway devices A attached to the sub-devices A, such as card 232 of TV A in the living room, card 233 of TV A in the master bedroom, card 234 of TV A in the second bedroom, card 235 of speaker A in the study, and card 236 of gateway device A.
[0090] In the Smart Space APP interface 23, mobile phone A can respond to the user's operation on the card of sub-device A and share the sub-device A associated with account A with other accounts.
[0091] Sharing a sub-device associated with sub-device account A with other accounts can include the following two scenarios:
[0092] In the first scenario, the gateway device A associated with account A and other sub-devices A associated with account A were shared.
[0093] For example, in the smart space APP interface 23, mobile phone A receives user clicks on the following actions: 04 on the card 232 of the living room TV A, 05 on the card 233 of the master bedroom TV A, 06 on the card 234 of the second bedroom TV A, 07 on the card 236 of the gateway device A, and 03 on the completed button 231, thus redirecting to the following page. Figure 3 The Smart Space APP interface 24 is shown in (d) above. The Smart Space APP interface 24 can display the accounts that can be shared by sub-device A and / or the usernames corresponding to those accounts. For example, the Smart Space APP interface 24 can display honor123 corresponding to account B, honor121 corresponding to account C, etc.
[0094] For example, mobile phone A receives and responds to the user's input to the Smart Space APP interface 24 (e.g., ... Figure 3 In the example shown in (d), clicking the selection control 241 for account B will share sub-device A with account B. For example, mobile phone A will share TV A in the living room, TV A in the master bedroom, TV A in the second bedroom, and gateway device A with account B.
[0095] For example, mobile phone A can respond to a user's click operation 08 on the selection control 241 and send a sharing message to the server. The sharing message may include information about the shared sub-device A. After receiving the sharing message, the server can establish an association between the shared sub-device A and account B, and send the sharing message to mobile phone B associated with account B. That is, in the first case, the server can establish an association between account B and gateway device A and other sub-devices A. In the second case, the server can establish an association between account B and other sub-devices A, but will not establish an association between account B and gateway device A. Mobile phone B receives the sharing message sent by the server, obtains the information of the shared sub-device A from the sharing message, and displays the card of sub-device A and the card of sub-device B associated with account B in the Smart Space APP interface 25.
[0096] like Figure 3 As shown in (f), in the first scenario, where account A is associated with gateway device A and other sub-devices A associated with account A, since the server has already established an association between account B and gateway device A, messages sent from mobile phone B to gateway device A through the server will not be intercepted by the server. Therefore, mobile phone B can control sub-device A through the server and gateway device A. For example, the smart space APP interface 25 of mobile phone B may include a card 251 for TV A in the living room, a card 252 for TV A in the master bedroom, a card 253 for TV A in the second bedroom, a card 254 for gateway device A, and a card 255 for projector B connected to mobile phone B.
[0097] For example, mobile phone B receives and responds to the user's click operation 09 on card 252 of TV A in the master bedroom, and jumps to such... Figure 3 The control interface 26 of the TV in the master bedroom is shown in (g). The control interface 26 displays operable options for the TV in the master bedroom. These operable options may include, but are not limited to, power on / off, volume up, and volume down. The mobile phone B can respond to the user's clicks on the operable options and control the TV in the master bedroom to execute the corresponding commands. For example, when the user clicks power off, the mobile phone can control the TV in the master bedroom to turn off.
[0098] It should be noted that the card 254 of gateway device A may or may not be displayed in the Smart Space APP interface 25, and no specific limitation is made here.
[0099] In the second scenario, the gateway device A associated with account A was not shared; only other sub-devices A associated with account A were shared.
[0100] For example, mobile phone A receives and responds to the user's input to the Smart Space APP interface 22 (e.g., ... Figure 4Long-pressing any card of sub-device A in (b) will jump to the following path: Figure 4 The Smart Space APP interface 27 shown in (e) can display cards of shareable sub-devices A, such as card 232 for TV A in the living room, card 233 for TV A in the master bedroom, card 234 for TV A in the second bedroom, etc.
[0101] For example, mobile phone A receives a user's click 04 on card 232 of TV A in the living room, click 05 on card 233 of TV A in the master bedroom, click 06 on card 234 of TV A in the second bedroom, and click 03 on the complete button 231, and jumps to such... Figure 4 The Smart Space APP interface 24 shown in (d) is shown in the figure.
[0102] Mobile phone A receives and responds to the user's input on the Smart Space APP interface 24 (e.g., Figure 4 The click operation 08 of the selection control 241 for account B in (d) in the figure shares sub-device A with account B.
[0103] For example, mobile phone A can respond to a user's click operation 08 on the selection control 241 by sending a sharing message to the server. The sharing message may include information about the sub-device A being shared. After receiving the sharing message, the server can establish an association between the sub-device A being shared and account B, and send the sharing message to mobile phone B associated with account B.
[0104] Mobile phone B receives a sharing message from the server, retrieves the information of the shared sub-device A from the sharing message, and displays the card of sub-device A and the card of sub-device B associated with account B on the Smart Space APP interface 28.
[0105] like Figure 4 As shown in (h), in the second case, where only other sub-devices A associated with account A are shared, since the server does not establish an association between account B and gateway device A, the messages sent by mobile phone B to gateway device A through the server will be intercepted by the server. Therefore, mobile phone B cannot control sub-device A through the server and gateway device A.
[0106] For example, the smart space APP interface 28 of mobile phone B may include a card 271 for TV A in the living room, a card 272 for TV A in the master bedroom, a card 273 for TV A in the second bedroom, and a card 274 for projector B connected to mobile phone B.
[0107] For example, mobile phone B receives and responds to the user's click operation 19 on card 272 of TV A in the master bedroom, and then displays a "Cannot connect" token 275 on interface 28, without redirecting to the following... Figure 3 The control interface 26 of the TV in the master bedroom is shown in (g). In other words, mobile phone B cannot control sub-device A.
[0108] In summary, for sub-devices mounted on a gateway device, if a user only shares sub-device A associated with account A to account B, without sharing the gateway device associated with account A to account B, the electronic device associated with account B will be unable to control the shared sub-device through the gateway device. For example, the electronic device associated with account B cannot conduct encrypted communication with the sub-device through the gateway device associated with account A, and the server will intercept communication between the gateway device associated with account A and the electronic device associated with account B, thus degrading the user experience. To solve the above problem, this application provides a device control method. When sub-device A associated with account A is mounted on the gateway device associated with account A, if account A only shares sub-device A to account B, without sharing the gateway device A to account B, the electronic device associated with account B can still control the sub-device, improving the user experience.
[0109] The solutions provided in this application can be applied to electronic devices. For example, the electronic device may be a mobile phone, tablet computer, smartwatch, desktop computer, laptop computer, handheld computer, notebook computer, ultra-mobile personal computer (UMPC), netbook, as well as cellular phone, personal digital assistant (PDA), augmented reality (AR) / virtual reality (VR) device, including devices with BT firmware and Wi-Fi firmware. This application does not impose any special limitations on the specific form of the electronic device.
[0110] Figure 5 This is a schematic diagram of an electronic device provided in an embodiment of this application. For example, a mobile phone 500 is used as an example of the aforementioned electronic device. Figure 5 A structural diagram of mobile phone 500 is shown. Figure 5As shown, the mobile phone 500 may include a processor 510, an external memory interface 520, an internal memory 521, a mobile communication module 530, a wireless communication module 540, a charging management module 550, a power management module 560, a battery 570, antenna 1, antenna 2, a sensor module 580, buttons 591, a motor 592, an indicator 593, a display screen 594, and a subscriber identification module (SIM) card interface 595, etc. The sensor module 580 may include a pressure sensor 580A, a fingerprint sensor 580B, a temperature sensor 580C, a touch sensor 580D, etc.
[0111] It is understood that the structures illustrated in the embodiments of the present invention do not constitute a specific limitation on the electronic device. In other embodiments of this application, the electronic device may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0112] Processor 510 may include one or more processing units, such as application processors (APs), modem processors, graphics processing units (GPUs), image signal processors (ISPs), controllers, video codecs, digital signal processors (DSPs), baseband processors, and / or neural network processing units (NPUs). These different processing units may be independent devices or integrated into one or more processors.
[0113] The controller can generate operation control signals based on the instruction opcode and timing signals to complete the control of instruction fetching and execution.
[0114] The processor 510 may also include a memory for storing instructions and data. In some embodiments, the memory in the processor 510 is a cache memory. This memory can store instructions or data that the processor 510 has just used or that are used repeatedly. If the processor 510 needs to use the instruction or data again, it can directly retrieve it from the memory. This avoids repeated accesses, reduces the waiting time of the processor 510, and thus improves the efficiency of the system. In this embodiment, the processor 510 can be used to control sub-devices.
[0115] In some embodiments, the processor 510 may include one or more interfaces. Interfaces may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.
[0116] The charging management module 550 receives charging input from a charger, which can be a wireless charger or a wired charger. While charging the battery 570, the charging management module 550 can also supply power to the mobile phone 500 via the power management module 550.
[0117] The power management module 560 is used to connect to the battery 570. The power management module 560 receives input from the battery 570 and / or the charging management module 550, and supplies power to the processor 510, internal memory 521, display 594, and wireless communication module 540 (such as a Wi-Fi chip). The power management module 560 can also be used to monitor parameters such as battery capacity, battery cycle count, and battery health status (leakage current, impedance). In some other embodiments, the power management module 560 may also be located within the processor 510. In other embodiments, the power management module 560 and the charging management module 550 may also be located in the same device.
[0118] The wireless communication function of mobile phone 500 can be realized through antenna 1, antenna 2, mobile communication module 530, wireless communication module 540, modem processor and baseband processor.
[0119] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in mobile phone 500 can be used to cover one or more 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 local area network. In some other embodiments, the antennas can be used in conjunction with a tuning switch.
[0120] The mobile communication module 530 can provide solutions for wireless communication applications including 2G / 3G / 4G / 5G on the mobile phone 500. The mobile communication module 530 may include at least one filter, switch, power amplifier, low-noise amplifier (LNA), etc. The mobile communication module 530 can receive electromagnetic waves via antenna 1, and perform filtering, amplification, and other processing on the received electromagnetic waves before transmitting them to a modem processor for demodulation.
[0121] The wireless communication module 540 can provide solutions for wireless communication applications on the mobile phone 500, including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), and infrared (IR) technology.
[0122] In some embodiments, the antenna 1 of the mobile phone 500 is coupled to the mobile communication module 530, and the antenna 2 is coupled to the wireless communication module 540, so that the mobile phone 500 can communicate with the network and other devices through wireless communication technology.
[0123] The mobile phone 500 implements display functions through a GPU, a display screen 594, and an application processor. The GPU is a microprocessor for image processing, connected to the display screen 594 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 510 may include one or more GPUs, which execute program instructions to generate or modify display information.
[0124] Display screen 594 is used to display images, videos, etc. Display screen 594 includes a display panel. For example, display screen 594 can be a touchscreen. In some embodiments of this application, after a user opens different applications, the display screen can be used to display different application interfaces, which may include a speed test interface, a real-time battle game interface, or a real-time voice call interface. In embodiments of this application, display screen 594 can be used to display the control interface of a control sub-device.
[0125] The external storage interface 520 can be used to connect an external storage card, such as a Micro SD card, to expand the storage capacity of the phone 500.
[0126] Internal memory 521 can be used to store computer executable program code, which includes instructions. Internal memory 521 may include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function (such as sound playback, image playback, etc.). The data storage area may store data created during the use of mobile phone 500 (such as audio data, phonebook, etc.). Furthermore, internal memory 521 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, universal flash storage (UFS), etc. Processor 510 executes various functions of mobile phone 500 and data processing by running instructions stored in internal memory 521 and / or instructions stored in memory located in processor 510.
[0127] The sensor module 580 may include a pressure sensor 580A, a fingerprint sensor 580B, a temperature sensor 580C, a touch sensor 580D, etc.
[0128] The pressure sensor 580A is used to sense pressure signals and convert them into electrical signals. In some embodiments, the pressure sensor 580A can be disposed on the display screen 594. There are many types of pressure sensors 580A, such as resistive pressure sensors, inductive pressure sensors, and capacitive pressure sensors. A capacitive pressure sensor may include at least two parallel plates with conductive material. When force is applied to the pressure sensor 580A, the capacitance between the electrodes changes. The mobile phone 500 determines the pressure intensity based on the change in capacitance. When a touch operation is applied to the display screen 594, the mobile phone 500 detects the intensity of the touch operation based on the pressure sensor 580A. The mobile phone 500 can also calculate the touch position based on the detection signal from the pressure sensor 580A. In this embodiment, the pressure sensor senses whether the application has changed based on the user's touch operation.
[0129] The 580B fingerprint sensor is used to collect fingerprints. The phone 500 can then utilize the collected fingerprint characteristics to achieve fingerprint unlocking, app access lock, fingerprint photography, fingerprint call answering, and more.
[0130] Temperature sensor 580C is used to detect temperature. In some embodiments, mobile phone 500 uses the temperature detected by temperature sensor 580C to execute a temperature handling strategy. For example, when the temperature reported by temperature sensor 580C exceeds a threshold, mobile phone 500 reduces the performance of the processor located near temperature sensor 580C to reduce power consumption and implement thermal protection. In other embodiments, when the temperature is below another threshold, mobile phone 500 heats battery 570 to prevent abnormal shutdown of mobile phone 500 due to low temperature. In still other embodiments, when the temperature is below yet another threshold, mobile phone 500 boosts the output voltage of battery 570 to prevent abnormal shutdown caused by low temperature.
[0131] Touch sensor 580D, also known as a "touch device," can be located on display screen 594. The touch sensor 580D and display screen 594 together form a touchscreen, also known as a "touchscreen." Touch sensor 580D detects touch operations applied to or near it. The touch sensor can transmit the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through display screen 594. In other embodiments, touch sensor 580D may also be located on the surface of mobile phone 500, in a different position than display screen 594.
[0132] Keypad 591 includes a power button, volume buttons, etc. Keypad 591 can be a mechanical keypad or a touch-sensitive keypad. Mobile phone 500 can receive keypad input and generate key signal inputs related to user settings and function control of mobile phone 500.
[0133] Motor 592 can generate vibration alerts. Motor 592 can be used for incoming call vibration alerts or for touch vibration feedback. For example, different vibration feedback effects can be corresponding to touch operations applied to different applications (such as taking photos, playing audio, etc.). Motor 592 can also correspond to different vibration feedback effects for touch operations applied to different areas of the display screen 594. Different application scenarios (such as time reminders, receiving messages, alarm clocks, games, etc.) can also correspond to different vibration feedback effects. The touch vibration feedback effect can also be customized.
[0134] Indicator 593 can be an indicator light, used to indicate charging status, power changes, or messages, missed calls, notifications, etc.
[0135] The SIM card interface 595 is used to connect the SIM card. The SIM card can be inserted into or removed from the SIM card interface 595 to make contact with or separate from the mobile phone 500.
[0136] The USB 596 interface is a USB standard compliant interface, which can be a Mini USB interface, Micro USB interface, USB Type-C interface, etc. The USB 596 interface can be used to connect a charger to charge electronic devices, and can also be used for data transfer between electronic devices and peripherals. It can also be used to connect headphones for audio playback. This interface can also be used to connect other electronic devices, such as AR devices.
[0137] It is understood that the interface connection relationships between the modules illustrated in the embodiments of the present invention are merely illustrative and do not constitute a limitation on the structure of the electronic device. In other embodiments of this application, the electronic device may also employ different interface connection methods or combinations of multiple interface connection methods as described in the above embodiments.
[0138] Of course, it is understandable that the above... Figure 5 The content shown is merely an illustrative example when the electronic device is in the form of a mobile phone. If the electronic device is in the form of a tablet, handheld computer, PC, PDA, wearable device (such as a smartwatch, smart bracelet), or other similar device, the structure of the electronic device may include more advanced features. Figure 5 The fewer structures shown can also include more than Figure 5 The structures shown are not limited here.
[0139] It is understandable that the implementation of electronic device functions requires not only hardware support but also software cooperation. The software system of electronic devices can adopt a layered architecture, event-driven architecture, microkernel architecture, microservice architecture, or cloud architecture. This application's embodiment uses a layered architecture... Taking the system as an example, the software structure of the electronic device is illustrated.
[0140] Figure 6 This is a schematic diagram of the layered architecture of a software system for an electronic device provided in an embodiment of this application. The layered architecture divides the software into several layers, each with a clear role and division of labor. The layers communicate with each other through software interfaces.
[0141] In some examples, refer to Figure 6 As shown in this embodiment, the software of the electronic device is divided into five layers, from top to bottom: the application layer, the framework layer (or application framework layer), the system library and Android runtime, the HAL layer (hardware abstraction layer), and the driver layer (or kernel layer). The system library and Android runtime can also be referred to as the native framework layer or the native layer.
[0142] The application layer can include a series of applications. For example... Figure 6 As shown, the application layer can include applications (APPs) such as camera, gallery, calendar, map, WLAN, Bluetooth, music, SMS, call, and smart space.
[0143] In addition, the application layer includes the LinkSvc connection management service. LinkSvc further comprises a virtual connection module, a physical connection module, and an authorization management module. In other words, through the smart space application of electronic devices and the interaction between the LinkSvc connection management service and the server, electronic devices can achieve reliable transmission and control over sub-devices.
[0144] The framework layer provides application programming interfaces (APIs) and programming frameworks for applications in the application layer. The application framework layer includes predefined functions or services. For example, the application framework layer may include an activity manager, window manager, content provider, audio service, view system, phone manager, resource manager, notification manager, package manager, etc., but this embodiment does not impose any limitations on these.
[0145] The window manager is used to manage windowed applications. It can retrieve screen size, determine the presence of a status bar, lock the screen, and capture screenshots, among other things.
[0146] Content providers store and retrieve data, making that data accessible to applications. This data can include videos, images, audio, phone calls made and received, browsing history and bookmarks, phone books, etc.
[0147] A view system includes visual controls, such as controls for displaying text and controls for displaying images. View systems can be used to build applications. A display interface can consist of one or more views. For example, a display interface including a text notification icon can include views for displaying text and views for displaying images. In some embodiments, the view system may also include or initiate a rendering thread to perform operations such as drawing framebuffers.
[0148] A phone manager is used to provide communication functions for electronic devices. For example, a phone manager can manage the call status of a calling application (including initiation, connection, and termination).
[0149] The file explorer provides applications with various resources, such as localized strings, icons, images, layout files, video files, and more.
[0150] The notification manager allows applications to display notifications in the status bar. These notifications can be used to deliver informational messages and can disappear automatically after a short pause, requiring no user interaction. For example, the notification manager can be used to notify users of completed downloads or message alerts. The notification manager can also display notifications as icons or scrolling text in the top status bar, such as notifications from background applications, or as dialog boxes on the screen. Examples include displaying text messages in the status bar, emitting sounds, vibrating electronic devices, and flashing indicator lights.
[0151] Package Manager in Android The package manager is used to manage application packages. It allows applications to obtain detailed information about installed applications and their services, permissions, etc. The package manager is also used to manage events such as application installation, uninstallation, and upgrades.
[0152] The system library can include multiple functional modules, such as the surface manager and media libraries. The surface manager manages the display subsystem and provides 2D and 3D layer blending for multiple applications. The media libraries support playback and recording of various common audio and video formats, as well as still image files. The media libraries support multiple audio and video encoding formats, such as MPEG4, H.264, MP3, AAC, AMR, JPG, and PNG.
[0153] The Hardware Abstraction Layer (HAL) is the interface layer between the operating system kernel and the hardware circuitry, designed to abstract the hardware. It hides the platform-specific hardware interface details, providing the operating system with a virtual hardware platform that is hardware-independent and portable across multiple platforms. The HAL provides a standard interface that exposes device hardware functionality to the higher-level Java API framework (i.e., the framework layer). The HAL contains multiple library modules, each implementing an interface for a specific type of hardware component, such as: audio HAL, Bluetooth HAL, camera HAL (also known as camera HAL or camera hardware abstraction module), and sensors HAL (or i-sensor service).
[0154] The kernel layer is the layer between hardware and software. The kernel layer includes at least display drivers, camera drivers, audio drivers, sensor drivers, battery drivers, etc., but this application does not limit this. Specifically, the sensor driver can include the driver for each sensor included in the electronic device, such as an ambient light sensor driver. For example, the ambient light sensor driver can, in response to an indication or instruction from the sensor module to acquire detection data, promptly send the detection data from the ambient light sensor to the sensing module.
[0155] Figure 7 This is a structural block diagram of a network system provided in an embodiment of this application.
[0156] like Figure 7 As shown, the network system includes electronic devices, a server, a gateway device, and at least one sub-device. The sub-device is mounted on the gateway device. The gateway device and the sub-device are associated with a source account, and the electronic device is associated with a target account.
[0157] In this embodiment, the electronic device may be a mobile phone, tablet, computer, or smart wearable device, etc.
[0158] For example, an electronic device may include a smart space app to control sub-devices. The smart space app may include an application body (APP body), middleware, and a connection management service (LinkService, LinkSvc).
[0159] Middleware can include a Device Management (DM) module and a Profile module to implement the management and configuration functions of the main device. The DM module enables remote monitoring, configuration, maintenance, and management of other devices connected to the electronic device.
[0160] LinkSvc can include sub-modules such as device discovery, device connection, device networking, and device transmission, thereby enabling electronic devices to connect, communicate, or transmit data with other devices.
[0161] In addition, LinkSvc can include a device list that stores sub-devices and gateway devices. Electronic devices control sub-devices through the server and gateway devices.
[0162] For example, a gateway device may include a Link Software Development Kit (LinkSDK) module, which is capable of establishing a communication connection with the LinkSvc of an electronic device via MQTT.
[0163] Figure 8 This is a schematic diagram of a device control method provided in an embodiment of this application. Figure 1 .
[0164] like Figure 8 As shown in the embodiment of this application, the first device control method includes: S801-S820.
[0165] S801. The server receives the device sharing message sent by the first electronic device.
[0166] The device sharing message includes information about at least one first sub-device. This message is used to share at least one first sub-device with the target account. A first sub-device refers to a non-gateway sub-device associated with the source account. The first electronic device is associated with the same source account as the first sub-device.
[0167] For example, the first electronic device may have a smart space app installed. The smart space app can respond to user operations and send a device sharing message to the server. If the first sub-device being shared includes a smart desk lamp, then the device sharing message may include information about the smart desk lamp.
[0168] Table 2
[0169] Sub-device name Sub-device ID mounted gateway device Mounted gateway device ID Associated accounts First sub-device XXXXXX1 First gateway YYYYYYY1 Source account ;
[0171] Referring to Table 2, the information of the first sub-device may include the name of the first sub-device, the device ID of the first sub-device, the gateway device to which the first sub-device is attached, the gateway device ID to which the first sub-device is attached, and the account associated with the first sub-device.
[0172] S802. The server stores the information of the first sub-device in the first device list corresponding to the target account.
[0173] The server can maintain a device list corresponding to one or more accounts connected to it. Each account's device list can store information about the sub-devices associated with that account and the gateway device information. The storable sub-device information can include information about sub-devices associated with the same account and gateway device information, as well as information about sub-devices shared from other accounts.
[0174] For example, the first device list corresponding to the target account may include information about sub-devices associated with the source account and information about the gateway device, or information about sub-devices shared from other accounts to the target account.
[0175] In practice, after receiving the device sharing message sent by the first electronic device, the server can obtain the information of the first sub-device shared from the source account from the device sharing message and store the information of the first sub-device in the device list of the second account.
[0176] The device list can include device name, device ID, connected gateway device, connected gateway device ID, etc.
[0177] For example, as shown in Table 3, the first device list of the second electronic device includes a first sub-device, a second sub-device, a second gateway, a first electronic device associated with the first sub-device, a second electronic device associated with the second sub-device, a second electronic device associated with the second gateway, a first sub-device mounted gateway: the first gateway, the mounted gateway device ID: YYYYYYY1, a second sub-device mounted gateway: the second gateway, the second gateway ID: YYYYYYY2.
[0178] Table 3
[0179]
[0180] Continuing with the example above, after the server receives the device sharing message containing information about the smart desk lamp, the server stores the smart desk lamp information in the first device list corresponding to the second electronic device. Referring to Table 3, the smart desk lamp information may include XXXXX11, the first electronic device associated with the smart desk lamp, the first gateway associated with the smart desk lamp, and YYYYYY11 mounted on the smart desk lamp.
[0181] S803. The server sends a sharing success message to the second electronic device.
[0182] The successful sharing message includes the phrase "Share successful." This message informs the second electronic device that it has stored the information of the first sub-device in the first device list of the second electronic device corresponding to the target account.
[0183] In practice, after storing the information of the first sub-device in the first device list corresponding to the second electronic device, the server sends a sharing success message to the second electronic device.
[0184] S804. In response to the sharing success message, the second electronic device sends a second request message to the server.
[0185] The second request message includes the ID of the second electronic device and is used to request a first device list of the second electronic device from the server.
[0186] S805. In response to the second request message, the server sends a second response message to the second electronic device.
[0187] The second response message includes the first device list.
[0188] S806. The second electronic device stores the first device list.
[0189] The second electronic device storing the first device list can be implemented in two ways.
[0190] In one implementation, the second electronic device stores the first device list and uses the stored first list as the device list of the second electronic device.
[0191] In another implementation, the second electronic device can store information about the newly added first sub-device in order to update the first device list.
[0192] S807. The second electronic device determines that the information of the first gateway is not included in the first device list.
[0193] It's worth noting that if the first device list includes information about the first gateway, it means that the first gateway associated with the first account has been shared with the target account. If the first device list does not include information about the first gateway, it means that the first gateway associated with the source account has not been shared with the target account.
[0194] For example, the information of the first gateway may include the first gateway's authCode information, also known as the first authorization information. For a gateway device, the authCode information can be used to represent the unique identity of the gateway device. There is a one-to-one correspondence between gateway devices and authCode information; in other words, different gateway devices have different authCode information.
[0195] In other words, if the first gateway associated with the source account is shared with the target account, the second electronic device can obtain the authCode information of the first gateway from the first device list. If the first gateway associated with the source account is not shared with the target account, the second electronic device cannot obtain the authCode information of the first gateway from the first device list.
[0196] S808. The second electronic device sends a first request message to the server.
[0197] The first request message includes the ID of the first gateway. The first request message is used to obtain information about the first gateway.
[0198] S809. The server sends the first response message to the second electronic device.
[0199] The first response message includes information about the first gateway.
[0200] In some embodiments, after receiving a first request message from a second electronic device, the server obtains information about the first gateway based on the first gateway ID in the first request message, and sends a first response message including the information about the first gateway to the second electronic device. In this embodiment, the information about the first gateway may include the first gateway name, the account associated with the first gateway, the first gateway ID, the ID of the first sub-device mounted on the first gateway, and first authorization information.
[0201] In other implementations, after receiving the first request message from the second electronic device, the server obtains the information of the first gateway based on the first gateway ID in the first request message, encrypts the first authorization information in the first gateway information to obtain first encrypted authorization information, and thus obtains the updated first gateway information. Next, the server sends a first response message including the updated first gateway information to the second electronic device. In this embodiment, the updated first gateway information may include the first gateway name, the account associated with the first gateway, the first gateway ID, the ID of the first sub-device mounted on the first gateway, and the first encrypted authorization information.
[0202] S810. Based on the information from the first gateway, the second electronic device establishes a virtual gateway.
[0203] In some implementations, when the first authorization information is not encrypted, the second electronic device receives the first response message and establishes a virtual gateway based on the first gateway name, the account associated with the first gateway, the first gateway ID, the ID of the first sub-device mounted on the first gateway, and the first authorization information.
[0204] In other embodiments, when the first authorization information is encrypted, the second electronic device can first decrypt the first encrypted authorization information to obtain the first authorization information, and establish a virtual gateway based on the first gateway name, the account associated with the first gateway, the first gateway ID, the ID of the first sub-device mounted on the first gateway, and the first authorization information.
[0205] After establishing the virtual gateway, it is necessary to authenticate the second electronic device with the first gateway based on the virtual gateway.
[0206] During gateway authentication, the second electronic device needs to send interaction messages to the first gateway via the virtual gateway. However, since the second electronic device and the first gateway do not have a mutual trust relationship on the server side, if the existing topic field is used in the interaction messages between the second electronic device and the first gateway, the interaction messages will be intercepted by the server, resulting in authentication failure. To ensure that the server does not intercept the interaction messages between the second electronic device and the first gateway, this application defines a new topic field, also known as the target topic field.
[0207] The target topic field includes the next-hop information for the message. This next-hop information indicates which electronic device the message should be sent to. In addition, the target topic field also includes the source device information and the target device information. The source device information indicates the sender of the message. The target device information indicates the receiver of the message.
[0208] Specifically, the target topic field has the following format: / magiclink / dev / channel / ${nextStepId} / ${srcId} / ${dstId}. Here, magiclink is the channel connecting the electronic device and the first gateway device, dev is the channel between devices, channel is the track, and / magiclink / dev / channel / can be used to represent communication between devices. nextStepId is the next-hop information of the message, such as an intermediate device in the interaction process. srcId is the source device information of the message, and dstId is the target device information of the message.
[0209] Referring to Table 4, taking a mobile phone as an example, during the process of the gateway sending a message to the mobile phone, the nextStepId in the target topic field is updated to gatewayID, srcId is updated to phoneID, and dstId is updated to subDevID. That is, the target topic field can include: / magiclink / dev / channel / ${gatewayID} / ${phoneID} / ${subDevID}. During the process of the mobile phone sending a message to the gateway, the target topic field is / magiclink / dev / channel / ${phoneID} / ${subDevId} / ${phoneID}.
[0210] Here, gatewayID is the gateway ID of the gateway, phoneID is the ID of the electronic device, and subDevID is the ID of any sub-device.
[0211] Table 4
[0212]
[0213] In summary, authentication is performed using the target topic field. The sender is determined based on the srcId in the target topic field, and the receiver is determined based on the dstId. The server can determine which next-hop electronic device the message should be sent to based on the next-hop information in the target topic field; for example, the gateway device mentioned above is the next-hop electronic device.
[0214] Continue to combine Figure 8 In some embodiments, the second electronic device can authenticate with the first gateway based on a virtual gateway, and steps S811-S820 can be executed.
[0215] S811. Based on the virtual gateway, the second electronic device sends an authentication request message to the server.
[0216] The authentication request message may include the target topic field and the authentication request content.
[0217] For example, the target topic field in the authentication request message is in the form of: / magiclink / dev / channel / ${gatewayID} / ${phoneID} / ${subDevID}.
[0218] Among them, gatewayID is the gateway ID of the first gateway, phoneID is the ID of the second electronic device, and subDevID is the ID of the first sub-device.
[0219] S812. The server receives the authentication request message and forwards it to the first gateway.
[0220] The authentication request message may include the target topic field and the authentication request content.
[0221] In a specific implementation, the server can determine the next-hop electronic device to be sent to based on the nextStepId field in the target topic field. For example, when the server determines that the nextStepId field is used to indicate the gatewayID of the first gateway, it sends an authentication request message to the first gateway device.
[0222] S813. The first gateway responds to the authentication request message and sends an authentication response message to the server.
[0223] In one implementation, the authentication response includes a target topic field and first authorization information. In another implementation, the authentication response includes a target topic field and first encryption authorization information.
[0224] In the first implementation, after receiving and responding to the authentication request message, the first gateway sends an authentication response message, including the target topic field and the first authorization information, to the server.
[0225] In another implementation, after the first gateway receives and responds to the authentication request message, the server encrypts the first authorization information to obtain the first encrypted authorization information. The first gateway then sends an authentication response message, including the target topic field and the first encrypted authorization information, to the server.
[0226] It should be noted that the server stores information about the first gateway, which includes the first authorization information. This first authorization information stored on the server may expire and prevent authentication, so it is necessary to retrieve the first authorization information from the first gateway again.
[0227] Furthermore, the target topic field in the authentication response message takes the form: / magiclink / dev / channel / ${phoneID} / ${subDevID} / ${phoneID}. Here, the nextStepId field is updated to phoneID, srcId to subDev ID, and dstId to phoneID.
[0228] S814. The server receives the authentication response message and forwards it to the second electronic device.
[0229] Continuing with the example above, the server can determine the next-hop electronic device to which the message should be sent based on the nextStepId field in the target topic field. Following the example again, when the server determines that the nextStepId field indicates a phoneID, it sends an authentication response message including the first authorization information to the second electronic device.
[0230] S815. The second electronic device receives the authentication response message and obtains the first authorization information from the authentication response message.
[0231] The authentication response message includes first authorization information, which is used to obtain the first authorization information.
[0232] Continuing with the example above, if the authentication response message includes the first authorization information, the second electronic device obtains the first authorization information from the authentication response message.
[0233] If the authentication response message includes the first encrypted authorization information, the second electronic device obtains the first encrypted authorization information from the authentication response message, decrypts the first encrypted authorization information, and obtains the first authorization information.
[0234] S816. The second electronic device sends a third request message to the server. The third request message includes the ID of the first sub-device and is used to obtain the online status of the first sub-device.
[0235] When the first sub-device is connected to the first gateway, the first sub-device will report its online status to the first gateway. In other words, the first gateway can obtain the online status of the first sub-device. The first gateway can also report the online status of the first sub-device to the server. The online status of the first sub-device includes "online" and "offline".
[0236] For example, when the first sub-device is online, the first sub-device reports its online status as "online" to the first gateway. The first gateway receives the "online" status of the first sub-device and reports it to the server. The server receives and stores the report.
[0237] Similarly, if the first sub-device is offline, the first gateway determines its online status as "offline" and reports this status to the server, which receives and stores the information. The method for determining "offline" involves determining the connection status between the first gateway and the first sub-device. Connection status includes connected and disconnected. When the connection status is disconnected, the first sub-device is "offline." Specifically, if the first gateway sends a message to the first sub-device, and the first sub-device does not respond, then the first gateway and the first sub-device are in a disconnected state, and the first sub-device is "offline."
[0238] S817. The server sends a third response message to the second electronic device, the third response message including the online status of the first sub-device.
[0239] After receiving the third request message, the server sends a third response message to the second electronic device. Based on the third response message, the second electronic device determines the online status of the first sub-device.
[0240] When the first sub-device is "online", the second electronic device can control the first sub-device via the virtual gateway; when the first sub-device is "offline", the second electronic device cannot control the first sub-device via the virtual gateway.
[0241] S818. When the first sub-device is "online", the second electronic device sends control commands to the server based on the virtual gateway.
[0242] The control command includes a preset target topic field, first authorization information, and control content. The target topic field includes the next-hop information of the message. For example, the target topic field can be / magiclink / dev / channel / ${gatewayID} / ${phoneID} / ${subDevID}. Here, gatewayID is the ID of the first gateway, phoneID is the ID of the second electronic device, and subDevID is the ID of the first sub-device.
[0243] For example, assuming the first sub-device is a smart desk lamp, when the smart desk lamp is in an "online" state, the second electronic device responds to the user's operation and sends a control command to the server based on the virtual gateway. The control command includes ` / magiclink / dev / channel / ${gatewayID} / ${phoneID} / ${subDevID}`, the first authorization information, and the control content is "turn on the light".
[0244] S819. The server forwards the control commands to the first gateway.
[0245] The control instructions include a preset target topic field, initial authorization information, and control content.
[0246] For example, after receiving the control command, the server determines to send the control command to the first gateway based on the next-hop information in the target topic field, which is the gatewayID.
[0247] Continuing with the example above, based on the next-hop information in the target topic field, which is the gatewayID, the server can determine to forward the control command to the first gateway. Similarly, the control command includes the target topic field: / magiclink / dev / channel / ${gatewayID} / ${phoneID} / ${subDevID}, the first authorization information, and the control content is "turn on the lights".
[0248] S820. The first gateway sends control commands to the first sub-device to control the first sub-device.
[0249] The control command includes a preset target topic field, initial authorization information, and control content. The authorization information in the control command instructs the first gateway to have the right to control and manage the sub-device. If the control command includes authorization information, the first gateway has the right to control the first sub-device. If the control command does not include authorization information, the first gateway does not have the right to control the first sub-device.
[0250] The first sub-device is a smart desk lamp, with the control command being "turn on the light".
[0251] Continuing with the example above, the first gateway responds to the control command sent by the server, determines whether the control command includes the first authorization information, and if it does, parses the target topic field in the control command, determines the subDevID in the target topic field, and when the subDevID is the ID of the smart lamp, sends a command with the control content "turn on the light" to the smart lamp, and the smart lamp responds to the "turn on the light" command and executes it.
[0252] In summary, even when only sub-devices belonging to different accounts from the electronic device are shared with the electronic device, without sharing the gateway attached to the sub-devices, the electronic device can still control and manage the sub-devices based on the first authorization information included in the virtual gateway, thereby improving the user experience.
[0253] like Figure 9 As shown, Figure 9 This is a schematic diagram of a device control method provided in an embodiment of this application. Figure 2 , Figure 9 This embodiment provides a second device control method. The method includes: S901-S912.
[0254] S901. The server receives the device sharing message sent by the first electronic device.
[0255] The device sharing message includes information about the first sub-device and the first gateway. It is used to share at least one first sub-device and the first gateway with a target account. The first sub-device and the first gateway are associated with the same source account.
[0256] The information of the first sub-device can be obtained by referring to step S801, and will not be described in detail here.
[0257] As shown in Table 5, the information of a gateway device may include the gateway name, the gateway device ID, the sub-devices attached to the gateway device, and the account associated with the gateway device.
[0258] Table 5
[0259]
[0260] For example, the first electronic device may have a smart space app installed. The smart space app can respond to user operations and send a device sharing message to the server. If the first sub-device being shared includes a smart desk lamp and a first gateway, then the device sharing message may include information about the smart desk lamp and the first gateway.
[0261] Step S901 can be implemented by referring to step S801 in the above embodiment, and will not be described in detail here.
[0262] S902. The server stores the information of the first sub-device in the device list corresponding to the second account.
[0263] The server can maintain a device list corresponding to one or more accounts connected to it. Each account's device list can store information about the sub-devices associated with that account and the gateway devices. The storable sub-device information can include information about sub-devices and gateway devices associated with the same account, as well as information about sub-devices and gateway devices shared from other accounts.
[0264] For example, the first device list corresponding to the target account may include information about sub-devices associated with the source account and information about the gateway device, or information about sub-devices shared from other accounts to the target account.
[0265] In the specific implementation, after receiving the device sharing message sent by the first electronic device, the server can obtain the information of the first sub-device and the first gateway shared from the source account from the device sharing message, and store the information of the first sub-device and the first gateway in the device list of the second account.
[0266] For example, as shown in Table 6, when both the first sub-device and the first gateway are shared with account B, the first device list of the second electronic device includes information about the first sub-device, information about the second sub-device, information about the first gateway, and information about the second gateway.
[0267] Table 6
[0268]
[0269] Continuing with the example above, after the server receives the device sharing message including information about the smart lamp and the first gateway, the server stores the smart lamp information and the first gateway information in the first device list corresponding to the second electronic device. Referring to Table 6, the smart lamp information may include XXXXX11, the first electronic device associated with the smart lamp, the first gateway associated with the smart lamp, and YYYYYY11 mounted on the smart lamp. The first gateway information includes XXXXXX01, the first electronic device associated with the first gateway.
[0270] S903. The server sends a message to the second electronic device that the sharing was successful.
[0271] S904. The second electronic device sends a second request message to the server.
[0272] S905. The server receives the second request message and sends a second response message to the second electronic device.
[0273] S906. The second electronic device stores the first device list.
[0274] S907. The second electronic device determines that the first device list includes the first gateway.
[0275] Steps S902-S907 can be implemented by referring to steps S802-S807 in the above embodiment, and will not be described in detail here.
[0276] S908. The second electronic device sends a third request message to the server.
[0277] S909. The second electronic device receives a third response message sent by the server to obtain the online status of the first sub-device.
[0278] S910. When the first sub-device is online, the smart space application responds to the user's operation by sending a control command to the virtual connection module of the second electronic device.
[0279] S911. The server sends control commands to the first gateway.
[0280] S912. The first gateway sends control commands to the first sub-device to control the first sub-device.
[0281] Steps S908-S912 can be implemented by referring to steps S818-S820 in the above embodiment, and will not be described in detail here.
[0282] It should be noted that, in the embodiments, the control instructions may use a preset target topic field to control the first sub-device, or they may use a topic field for control; no specific limitation is made here.
[0283] In summary, by sharing sub-devices and gateway devices that are on different accounts with the electronic device, the electronic device can control the sub-devices through the first gateway, thereby improving the user experience.
[0284] Figure 10 This is a schematic diagram of a device control method provided in an embodiment of this application. Figure 3 .
[0285] like Figure 10 As shown in the embodiment of this application, the third device control method includes: S1001-S1022.
[0286] S1001. The server receives the device sharing message sent by the first electronic device.
[0287] S1002. The server stores the information of the first sub-device in the device list corresponding to the target account.
[0288] S1003. The server sends a message of successful sharing to the authorization management module of the second electronic device.
[0289] S1004. The authorization management module of the second electronic device sends a second request message to the server.
[0290] S1005. The authorization management module of the second electronic device receives the second response message sent by the server to obtain the first device list.
[0291] S1006. The authorization management module of the second electronic device sends the first device list to the physical connection module of the connection management service.
[0292] S1007. The physical connection module receives and stores the first list of devices.
[0293] Steps S1001-S1007 can be implemented by referring to steps S801-S806 in the above embodiment, and will not be described in detail here.
[0294] S1008. The physical connection module of the second electronic device determines that the first gateway is included in the first device list.
[0295] S1009. The physical connection module of the second electronic device sends a first request message to the server.
[0296] S1010. The virtual connection module of the second electronic device receives the first response message sent by the server to establish a virtual gateway.
[0297] Steps S1008-S1010 can be implemented by referring to steps S807-S810 in the above embodiment, and will not be described in detail here.
[0298] S1011. The virtual connection module of the second electronic device sends an authentication request message to the server based on the virtual gateway.
[0299] S1012. The server receives the authentication request message and forwards it to the first gateway.
[0300] S1013. The first gateway sends an authentication response message to the server.
[0301] S1014. The server receives the authentication response message and forwards it to the virtual connection module of the second electronic device.
[0302] S1015. The virtual connection module of the second electronic device receives authentication response messages based on a virtual gateway to complete authentication.
[0303] Steps S1011-S1015 can be implemented by referring to steps S811-S814 in the above embodiment, and will not be described in detail here.
[0304] S1016. The virtual connection module of the second electronic device sends a third request message to the server.
[0305] S1017. The virtual connection module of the second electronic device receives a third response message sent by the server to obtain the online status of the first sub-device.
[0306] S1018. The virtual connection module reports the online status of the first sub-device to the smart space application.
[0307] S1019. When the first sub-device is online, the smart space application responds to the user's operation by sending a control command to the virtual connection module of the second electronic device.
[0308] S1020. The virtual connection module of the second electronic device sends control commands to the server based on the virtual gateway.
[0309] S1021. The server receives the control command and forwards it to the first gateway.
[0310] S1022. The first gateway receives the control command and sends the control command to the first sub-device.
[0311] Steps S1016-S1022 can be implemented by referring to steps S815-S820 in the above embodiment, and will not be described in detail here.
[0312] In summary, even when only sub-devices belonging to different accounts from the electronic device are shared with the electronic device, without sharing the gateway attached to the sub-devices, the electronic device can still control the sub-devices based on the first authorization information included in the virtual gateway, thereby improving the user experience.
[0313] Figure 11 This application provides a schematic flowchart of an authentication method. The method includes steps S1101-S1112.
[0314] S1101. Based on the virtual gateway, the virtual connection module of the second electronic device sends a fourth request message to the server.
[0315] The fourth request message includes the target topic field and the fourth request content.
[0316] For example, the target topic field can be in the form of / magiclink / dev / channel / ${gatewayID} / ${phoneID} / ${subDevID}, and the request content can include a sequence number (sqe).
[0317] Here, gatewayID is the ID of the first gateway, and phoneID is the ID of the second electronic device.
[0318] It should be noted that the request content in the fourth request message is not specifically limited.
[0319] S1102. The server receives the fourth request message and forwards it to the first gateway.
[0320] The server receives the fourth request message, then determines the next-hop information in the target topic field of the fourth request message. If the next-hop information is gatewayID, the server forwards the fourth request message to the first gateway. Continuing with the example above, the server forwards the fourth request message, which includes the target topic fields / magiclink / dev / channel / ${gatewayID} / ${phoneID} / ${subDevID} and the request content as sqe, to the first gateway.
[0321] S1103. The first gateway sends a fourth response message to the server based on the fourth request message.
[0322] The fourth response message includes the target topic field and the response content.
[0323] After receiving the fourth request message, the first gateway responds to the fourth request message by sending a fourth response message to the server.
[0324] The response content may include an Acknowledgement Number (ACK), which can be used to confirm that the fourth request message was accurately received. For example, the fourth response message may include the target topic field / magiclink / dev / channel / ${phoneID} / ${subDevId} / ${phoneID} and the response content ACK.
[0325] S1104. The server receives the fourth response message and forwards it to the second electronic device.
[0326] The server receives the fourth response message and, based on the next-hop information (phoneID) in the message, forwards it to the second electronic device. The fourth response message includes a target topic field and response content.
[0327] S1105. The virtual connection module of the second electronic device sends an authentication request message to the server based on the virtual gateway.
[0328] S1106. The server receives the authentication request message and forwards it to the first gateway.
[0329] S1107. The first gateway sends an authentication response message to the server.
[0330] S1108. The server receives the authentication response message and forwards it to the virtual connection module of the second electronic device.
[0331] Steps S1105-S1108 can be implemented by referring to steps S811-S814 in the above embodiment, and will not be described in detail here.
[0332] S1109. Based on the virtual gateway, the second electronic device sends a fifth request message to the server.
[0333] The fifth request message includes the target topic field and the fifth request content.
[0334] For example, a fifth request message, including the target topic field / magiclink / dev / channel / ${gatewayID} / ${phoneID} / ${sub DevID} and the request content "successfully received", is sent to the first gateway.
[0335] S1110. The server receives the fifth request message and forwards it to the first gateway.
[0336] The server receives the fifth request message, then determines the next-hop information in the target topic field of the fifth request message. If the next-hop information is phoneID, the server forwards the fifth request message to the first gateway. Continuing with the example above, the server sends the fifth request message, which includes the target topic fields / magiclink / dev / channel / ${gatewayID} / ${phoneID} / ${subDevID] and the request content "received successfully," to the first gateway.
[0337] S1111. The first gateway sends a fifth response message to the server based on the fifth request message.
[0338] After receiving the fifth request message, the first gateway sends a fifth response message to the server. The fifth response message includes a target topic field and response content. The response content may include an "OK" confirmation, used to acknowledge that the authentication response request has been received. For example, the fifth response message may include the target topic field ` / magiclink / dev / channel / ${phoneID} / ${subDevID} / ${phoneID}` and the response content `OK`.
[0339] S1112. The server receives the fifth response message and forwards it to the second electronic device to complete the authentication.
[0340] The server receives the fifth response message and, based on the next-hop information (phoneID) in the fifth response message, forwards the fifth response to the second electronic device. The fifth response message includes a target topic field and the content of the fifth response.
[0341] In summary, the authentication process of steps S1011-S1015 described above can also adopt steps S1101-S1112 in this embodiment.
[0342] Figure 12 This is a schematic diagram of a device control method provided in this embodiment. Figure 4 ,like Figure 12 As shown, this embodiment provides a fourth device control method. This method includes steps S1201-S1214.
[0343] S1201. The server receives the device sharing message sent by the first electronic device.
[0344] S1202. The server stores the information of the first sub-device in the first device list corresponding to the target account.
[0345] S1203. The server sends a message of successful sharing to the authorization management module of the second electronic device.
[0346] S1204. The authorization management module of the second electronic device sends a second request message to the server.
[0347] S1205. The authorization management module of the second electronic device receives the second response message sent by the server to obtain the first device list.
[0348] S1206. The authorization management module of the second electronic device sends the first device list to the physical connection module of the connection management service.
[0349] S1207. The physical connection module of the second electronic device receives and stores the first device list.
[0350] S1208. The physical connection module of the second electronic device determines that the first gateway is included in the first device list.
[0351] Steps S1201-S1208 can be implemented by referring to steps S101-S107 in the above embodiment, and will not be described in detail here.
[0352] S1209. The physical connection module of the second electronic device sends a third request message to the server.
[0353] S1210. The physical connection module of the second electronic device receives a third response message sent by the server to obtain the online status of the first sub-device.
[0354] S1211. The physical connection module reports the online status of the first sub-device to the smart space application.
[0355] S1212. When the first sub-device is online, the smart space application responds to the user's operation by sending a control command to the virtual connection module of the second electronic device.
[0356] S1213. The server receives the control command and forwards it to the first gateway.
[0357] S1214. The first gateway receives the control command and sends the control command to the first sub-device.
[0358] Steps S1209-S1214 can be implemented by referring to steps S908-S910 in the above embodiment, and will not be described in detail here.
[0359] In summary, by sharing sub-devices and gateway devices connected to sub-devices under different accounts with the electronic device, the electronic device can control the sub-devices based on the first gateway, thereby improving the user experience.
[0360] The following electronic device 10 is a mobile phone. The application scenario of electronic device system control is smart home as an example. Taking a sub-device that cannot be directly connected to the server as an example, we will further introduce the control of the sub-device by the electronic device.
[0361] Figure 13 This is a schematic diagram of a user controlling an electronic device system using a mobile phone, as provided in an embodiment of this application.
[0362] Combination Figure 4 and Figure 13 As shown, the phone can receive and respond to the user's click on the Smart Space icon, launch the Smart Space application, and display the following: Figure 4 The Smart Space APP interface 22 is shown in (b) of the image.
[0363] Mobile phone A receives and responds to the user's long-press operation 02 on any card of sub-device A in the Smart Space APP interface 22, and jumps to, for example... Figure 4 The Smart Space APP interface 27 shown in (e) displays shareable sub-devices A, such as card 232 for TV A in the living room, card 233 for TV A in the master bedroom, card 234 for TV A in the second bedroom, and card 235 for speaker A in the study. Within the Smart Space APP interface 27, mobile phone A will receive and share the user-selected cards 232 (living room TV A), 233 (master bedroom TV A), and 234 (second bedroom TV A).
[0364] For example, mobile phone A receives a user's click 04 on the card 232 of TV A in the living room, 05 on the card 233 of TV A in the master bedroom, 06 on the card 234 of TV A in the second bedroom, and 03 on the "Done" button 231, and jumps to the Smart Space APP interface 24. Mobile phone A responds to the user's click 08 on the selection control 241 in the Smart Space APP interface 24, thereby sharing TV A in the living room, TV A in the master bedroom, and TV A in the second bedroom with account B.
[0365] Mobile phone A can respond to the user's click operation 08 on the selection control 241 and send a sharing message to the server. The sharing message can include information about the shared sub-device A. After receiving the sharing message, the server can establish an association between the shared sub-device A and account B, and send the sharing message to mobile phone B associated with account B. Mobile phone B receives the sharing from sub-device A, such as... Figure 13 The smart space APP interface 29 shown in (I) displays cards for multiple sub-devices A shared by electronic device A. For example, card 281 for TV A in the living room, card 282 for TV A in the master bedroom, card 283 for TV A in the second bedroom, and card 284 for projector B connected to mobile phone B.
[0366] For example, on the smart space APP interface 29, mobile phone B receives and responds to the user's click 20 on the card 282 of the TV A in the master bedroom. Based on the virtual gateway, the mobile phone jumps to, for example, Figure 13 The control interface 29 of the TV in the master bedroom is shown in (J). The TV control interface 30 in the master bedroom displays operable options for the TV. For example, when the user clicks "power off," the mobile phone can control the TV in the master bedroom to turn off.
[0367] In summary, even when only sub-devices belonging to different accounts from the electronic device are shared with the electronic device, without sharing the gateway attached to the sub-devices, the electronic device can still control the sub-devices based on the first authorization information included in the virtual gateway, thereby improving the user experience.
[0368] Figure 14 This is a schematic diagram of a device control method provided in an embodiment of this application. Figure 5 .
[0369] like Figure 14 As shown, the fifth device control method provided in this embodiment includes: S141-S143.
[0370] S141. Get the first device list.
[0371] The first device list includes information about the first sub-device, which includes sub-devices shared by the source account to the target account, and the first sub-device is mounted on the first gateway.
[0372] S142. Based on the virtual gateway, initiate gateway authentication to the first gateway to obtain the first authorization information of the first gateway.
[0373] Based on the virtual gateway, the electronic device sends an authentication request message to the first gateway; based on the virtual gateway, the electronic device receives an authentication response message from the first gateway, the authentication response message including the first authorization information.
[0374] The authentication request message and authentication response message have a preset target topic field. This target topic field includes the next-hop information, the source device information, and the target device information. Specifically, the target topic field is in the format: ` / magiclink / dev / channel / ${nextStepId} / ${srcId} / ${dstId}`. `nextStepId` is the next-hop device ID, `srcId` is the source device ID, and `dstId` is the target device ID.
[0375] S143. Based on the virtual gateway, send a control command to the first gateway, the control command including first authorization information, so as to control the first sub-device through the first gateway.
[0376] The system obtains the online status of the first sub-device from the server. If the first sub-device is online, a control command is sent to the first gateway via the virtual gateway. The first gateway then sends the control command to the first sub-device, thus completing the electronic device's control of the first sub-device. Similarly, the control command has a preset target topic field, which includes the next-hop information of the message, the source device information of the message, and the target device information of the message.
[0377] In this embodiment, the above method also includes:
[0378] Before initiating gateway authentication with the first gateway based on the virtual gateway to obtain the first authorization information of the first gateway, the electronic device sends a first request message to the server, the first request message being used to request the first authorization information; and receives a first response message sent by the server, the first response message including the first authorization information previously reported by the first gateway to the server.
[0379] Understandably, electronic devices can receive the first response message sent by the server to obtain the first authorization information, which is used to establish a virtual gateway and provide a basis for subsequent control of the first sub-device based on the virtual gateway.
[0380] This application provides an electronic device that may include a display screen (such as a touchscreen or a non-touchscreen), a memory, and one or more processors. The display screen, memory, and processors are coupled. The memory stores computer program code, which includes computer instructions. When the processor executes the computer instructions, the electronic device can perform various functions or steps performed by the electronic device in the above method embodiments. The structure of the electronic device can be referred to... Figure 5 The structure of the electronic device shown.
[0381] Figure 15 This application provides a structural block diagram of a chip system.
[0382] This application also provides a chip system, such as... Figure 15 As shown, the chip system includes at least one processor 1501 and at least one interface circuit 1502. The processor 1501 and the interface circuit 1502 are interconnected via lines. For example, the interface circuit 1502 can be used to receive signals from other devices (e.g., the memory of an electronic device). As another example, the interface circuit 1502 can be used to send signals to other devices (e.g., the processor 1501 or the touchscreen of an electronic device). Exemplarily, the interface circuit 1502 can read instructions stored in the memory and send those instructions to the processor 1501. When the instructions are executed by the processor 1501, the electronic device can perform the steps in the above embodiments. Of course, the chip system may also include other discrete components, which are not specifically limited in this application embodiment.
[0383] This application also provides a computer storage medium that includes computer instructions. When the computer instructions are executed on the electronic device, the electronic device performs various functions or steps performed by the electronic device in the above method embodiments.
[0384] This application also provides a computer program product that, when run on a computer, causes the computer to perform various functions or steps performed by the electronic device in the above method embodiments.
[0385] Through the above description of the embodiments, those skilled in the art can clearly understand that, for the sake of convenience and brevity, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0386] It is readily understood that, based on the several embodiments provided in this application, those skilled in the art can combine, split, or reorganize the embodiments of this application to obtain other embodiments, none of which exceed the protection scope of this application.
[0387] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another apparatus, or some features may be ignored or not executed. Furthermore, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0388] The units described as separate components may or may not be physically separate. A component shown as a unit can be one or more physical units; that is, it can be located in one place or distributed in multiple different locations. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0389] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0390] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solutions of the embodiments of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This software product is stored in a storage medium and includes several instructions to cause a device (which may be a microcontroller, chip, etc.) or processor to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks. It should be noted that those skilled in the art, after considering the specification and practicing the application disclosed herein, will readily conceive of other embodiments of this application. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary technical means in the art not disclosed in this application. The description and examples are to be considered exemplary only, and the true scope of this application is indicated by the claims.
[0391] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this application is limited only by the appended claims.
Claims
1. A device control method, characterized in that, Applied to an electronic device associated with a target account, the method includes: Obtain a first device list, which includes information about a first sub-device. The first sub-device includes sub-devices shared by the source account to the target account, and the first sub-device is mounted on the first gateway. Based on the virtual gateway, an authentication request message is sent to the server so that the server forwards the authentication request message to the first gateway; The first gateway receives an authentication response message returned by the server, the authentication response message being generated by the first gateway based on the authentication request message, in order to obtain the first authorization information of the first gateway; Based on the virtual gateway, a control command is sent to the server, so that the server forwards the control command to the first gateway; the control command includes the first authorization information, so as to control the first sub-device through the first gateway.
2. The equipment control method according to claim 1, characterized in that, The step of sending control commands to the server based on the virtual gateway, causing the server to forward the control commands to the first gateway, includes: Obtain the online status of the first sub-device from the server; When the first sub-device is online, a control command is sent to the first gateway based on the virtual gateway, so that the server forwards the control command to the first gateway; the first sub-device being online means that the first sub-device and the first gateway have established a communication connection.
3. The equipment control method according to claim 1, characterized in that, The authentication request message has a preset target topic field, which includes the next-hop information of the message.
4. The equipment control method according to claim 1, characterized in that, Receiving the authentication response message returned by the server includes: Based on the virtual gateway, the authentication response message forwarded by the server from the first gateway is received. The authentication response message has a preset target topic field, which includes the next-hop information of the message.
5. The equipment control method according to claim 1, characterized in that, The control command has a preset target topic field, which includes the next-hop information of the message.
6. The equipment control method according to any one of claims 3-5, characterized in that, The target topic field also includes: source device information of the message and target device information of the message.
7. The equipment control method according to claim 1, characterized in that, Also includes: If the first authorization information is not included in the first device list, an authentication request message is sent to the server based on the virtual gateway. The authentication request message is used by the server to forward the message to the first gateway. The first gateway receives an authentication response message returned by the server, which is generated by the first gateway based on the authentication request message, in order to obtain the first authorization information of the first gateway.
8. The equipment control method according to claim 1, characterized in that, Before the step of sending an authentication request message to the server based on the virtual gateway, so that the server forwards the authentication request message to the first gateway, the method further includes: Send a first request message to the server, the first request message being used to request the first authorization information; The server receives a first response message, which includes first authorization information previously reported to the server by the first gateway.
9. The equipment control method according to claim 1, characterized in that, The step of sending an authentication request message to the server based on the virtual gateway includes: The virtual connection module of the LinkSvc connection management service sends the authentication request message to the server based on the virtual gateway; The step of receiving the authentication response message from the server based on the virtual gateway includes: the virtual connection module receiving the authentication response message sent by the server based on the virtual gateway.
10. The equipment control method according to claim 8, characterized in that, Sending the first request message to the server includes: the physical connection module of the connection management service sending the first request message to the server; The virtual connection module of the connection management service receives the first response message sent by the server; The virtual connection module stores the first authorization information.
11. The equipment control method according to claim 1, characterized in that, The process of obtaining the first device list includes: The authorization management module of the connection management service sends a second request message to the server. The authorization management module receives a second response message sent by the server, the second response message including a first device list; The authorization management module sends the device list to the physical connection module of the connection management service; The physical connection module of the connection management service receives and stores the first list of devices.
12. The equipment control method according to claim 2, characterized in that, The step of obtaining the online status of the first sub-device from the server includes: The virtual connection module of the connection management service sends a third request message to the server. The virtual connection module receives a third response message sent by the server, the third response message including the online status of the first sub-device; The virtual connection module reports the online status of the first sub-device to the smart space application.
13. The equipment control method according to claim 2, characterized in that, When the first sub-device is online, sending the control command to the server based on the virtual gateway, so that the server forwards the control command to the first gateway, includes: When the first sub-device is online, the smart space application responds to user operations by sending control commands to the virtual connection module of the connection management service. The virtual connection module sends the control commands to the first gateway based on the virtual gateway.
14. A network system, characterized in that, include: Electronic devices, server, and first gateway; The electronic device is used to obtain a first device list from the server. The first device list includes information about a first sub-device. The electronic device is associated with a target account. The first sub-device includes sub-devices shared by the source account to the target account. The first sub-device is mounted on a first gateway. The electronic device is also configured to send an authentication request message to a server based on a virtual gateway, the authentication request message being forwarded by the server to a first gateway; and to receive an authentication response message returned by the server, the authentication response message being generated by the first gateway based on the authentication request message, in order to obtain first authorization information from the first gateway. The first gateway is configured to send first authorization information of the first gateway to the electronic device when the gateway authentication is successful; The server is also configured to receive control commands sent by the electronic device based on the virtual gateway, and send control commands to the first gateway. The control commands include first authorization information of the first gateway, so as to control the first sub-device through the first gateway.
15. An electronic device, characterized in that, include: processor; Memory; The memory stores one or more programs that, when executed by the processor, cause the electronic device to perform the device control method as described in any one of claims 1 to 13.
16. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, causes the processor to perform the device control method as described in any one of claims 1 to 13.
17. A computer program product, characterized in that, When the computer program product is run on a computer, it causes the computer to perform the device control method as described in any one of claims 1 to 13.