Communication method of mobile terminal and smart device, smart home system and electronic device
Patent Information
- Application Number
- CN202311021456.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-14
- Publication Date
- 2026-09-15
- Estimated Expiration
- 2043-08-14
AI Technical Summary
[0041] Mobile terminals are configured with corresponding device details interfaces for different smart devices. There is a correspondence between the device's MAC address and the device details interface. Thus, the device's MAC address can be obtained from the device details interface. The first LAN IP-port obtained from the device MAC address represents some network characteristics of the LAN where the smart device resides and some network characteristics of the smart device itself. Obtaining the first LAN IP-port prepares for verifying the relationship between the mobile terminal and the smart device in subsequent steps. In subsequent steps, the second LAN IP of the mobile terminal is obtained. The relationship between the first and second LAN IPs, and the result of the TCP access attempt, determines the relationship between the mobile terminal and the smart device in the network. The first and second LAN IPs indicate that they are the same or on the same LAN. If the TCP access is successful, the relevant instructions are sent to the smart device via LAN pass-through. Data transmission via LAN pass-through improves efficiency.
Smart Images

Figure CN117240643B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of smart home system technology, such as a communication method between a mobile terminal and a smart device, a smart home system, and an electronic device. Background Technology
[0002] Currently, home appliances are becoming increasingly intelligent. Multiple smart home appliances (hereinafter referred to as smart devices) can form a smart home system. In a smart home system, multiple smart devices work together to create the environment required for a specific living scenario. Furthermore, smart devices can be controlled via mobile terminals such as smartphones and remote controls. For example, mobile terminals can display a device details interface, which includes the smart device's own operating parameters and / or relevant parameters that the smart device can detect. For instance, the device details interface for a smart air conditioner can display the air conditioner's operating mode, set temperature, and ambient temperature.
[0003] In the process of implementing the embodiments of this application, at least the following problems were found in the related technology:
[0004] Mobile terminals and smart devices communicate through servers, which results in low communication efficiency.
[0005] It should be noted that the information disclosed in the background section above is only used to enhance the understanding of the background of this application, and therefore may include information that does not constitute prior art known to those skilled in the art. Summary of the Invention
[0006] To provide a basic understanding of some aspects of the disclosed embodiments, a brief summary is given below. This summary is not intended as a general commentary, nor is it intended to identify key / important components or describe the scope of protection of these embodiments, but rather as a prelude to the detailed description that follows.
[0007] This application provides a communication method between a mobile terminal and a smart device, a smart home system, and an electronic device to improve the communication efficiency between the mobile terminal and the smart device.
[0008] In some embodiments, a communication method between a mobile terminal and a smart device is applied to the mobile terminal, and the communication method includes:
[0009] Generate relevant instructions corresponding to the access request on the device details page;
[0010] Based on the mapping between physical address (Media Access Control Address, MAC address) and Internet Protocol (IP) port, the first LAN IP-port corresponding to the device's MAC address is obtained; the device MAC address corresponds to the device details interface; the mapping between MAC address and LAN IP-port is cached by the server on the mobile terminal when the mobile terminal first accesses the device details interface; the first LAN is the LAN where the smart device is located, and the port in the first LAN IP-port can be accessed by the Transmission Control Protocol (TCP);
[0011] Obtain the IP address of the second local area network where the mobile terminal is located;
[0012] When the first LAN IP address in the second LAN IP address and the first LAN IP address-port are the same or both are on the same LAN, an attempt is made to access the port in the first LAN IP address-port via TCP.
[0013] If the access result is successful, the relevant instructions are sent to the smart device via local area network pass-through.
[0014] Optionally, if the first LAN IP-port cannot be successfully obtained, the attribute protocol is parsed to obtain the LAN IP-port. The attribute protocol allows the smart device to expose data externally in the form of attributes. A key-value pair is constructed using the device MAC address as the key and the LAN IP-port as the value. The key-value pair is cached locally on the mobile terminal. Specifically, after the smart device is configured with the network, it sets the port that other network devices in the LAN can access and obtains the IP address of the first LAN it is located on, and sends the first LAN IP-port as part of the attribute protocol to the server. When the mobile terminal accesses the device details interface for the first time, the device MAC address corresponding to the device details interface and the first LAN IP-port corresponding to the device MAC address are cached locally on the mobile terminal.
[0015] Optionally, before obtaining the first local area network IP-port corresponding to the device MAC address, the communication method between the mobile terminal and the smart device further includes: determining whether the device MAC address and its corresponding first local area network IP-port have been cached; if so, obtaining the first local area network IP-port corresponding to the device MAC address; otherwise, parsing the attribute protocol to obtain the local area network IP-port therein.
[0016] Optionally, during the network configuration process of the smart device, the smart device is guided to perform network configuration; by accessing the device details interface to confirm that the smart device has been successfully configured, the device MAC address corresponding to the device details interface and the first local area network IP-port corresponding to the device MAC address are cached locally on the mobile terminal.
[0017] Optionally, the first LAN IP and the second LAN IP are both in the same LAN, including: the first LAN IP and the second LAN IP are in the same network segment.
[0018] Optionally, the communication method between the mobile terminal and the smart device also includes: in the case of access failure, sending relevant instructions to the server, and then the server forwarding the relevant instructions to the smart device.
[0019] In some embodiments, the communication method between the mobile terminal and the smart device is applied to the smart device, and the communication method includes:
[0020] Obtain relevant instructions through the established communication path;
[0021] Among them, the relevant instructions are the instructions generated by the mobile terminal on the device details interface that correspond to the access request;
[0022] The communication path is determined in the following way:
[0023] The mobile terminal obtains the first LAN IP-port corresponding to the device MAC address based on the mapping between the Media Access Control (MAC) address and the Internet Protocol (IP) port of the LAN. The device MAC address corresponds to the device details interface. The mapping between the MAC address and the LAN IP-port is cached by the server on the mobile terminal when it first accesses the device details interface. The first LAN is the LAN where the smart device is located, and the port in the first LAN IP-port can be accessed by TCP.
[0024] The mobile terminal obtains its own second local area network IP address;
[0025] When the IP address of the second LAN is the same as the IP address of the first LAN in the IP-port, the mobile terminal attempts to access the port in the IP-port of the first LAN via TCP; if the access is successful, the LAN pass-through method is used as the communication path.
[0026] In some embodiments, the communication method between the mobile terminal and the smart device is applied to a server, and the communication method includes:
[0027] When a mobile terminal first accesses the device details page, the mapping between MAC address and local area network IP-port is cached on the mobile terminal.
[0028] The device's MAC address corresponds to the device details page.
[0029] The mapping between MAC addresses and local area network (LAN) IP-ports enables mobile terminals to obtain the first LAN IP-port corresponding to the device's MAC address; the first LAN is the LAN where the smart device is located, and the port in the first LAN IP-port can be accessed by TCP.
[0030] The mobile terminal then obtains its own second local area network IP address.
[0031] When the first LAN IP in the second LAN IP and the first LAN IP-port are the same or both are on the same LAN, the mobile terminal attempts to access the port in the first LAN IP-port via TCP.
[0032] If the access result is successful, the mobile terminal sends the relevant instructions to the smart device via local area network pass-through; the relevant instructions are those generated by the mobile terminal on the device details interface that correspond to the access request.
[0033] In some embodiments, a smart home system includes a mobile terminal, a server, and smart devices;
[0034] The mobile terminal generates relevant instructions corresponding to the access request on the device details interface;
[0035] The mobile terminal obtains the first local area network (LAN) IP-port corresponding to the device's MAC address based on the mapping between MAC address and LAN IP-port. The device's MAC address corresponds to the device details interface. The mapping between MAC address and LAN IP-port is cached by the server on the mobile terminal when it first accesses the device details interface. The first LAN is the LAN where the smart device is located, and the port in the first LAN IP-port can be accessed by TCP.
[0036] The mobile terminal obtains its own second local area network IP address;
[0037] When the first LAN IP in the second LAN IP and the first LAN IP-port are the same or both are on the same LAN, the mobile terminal attempts to access the port in the first LAN IP-port via TCP.
[0038] If the access result is successful, the mobile terminal sends the relevant instructions to the smart device via local area network pass-through.
[0039] In some embodiments, the electronic device includes a processor and a memory storing program instructions, the processor being configured to execute the communication method between a mobile terminal and a smart device provided in the foregoing embodiments when executing the program instructions.
[0040] The communication method between the mobile terminal and the smart device, the smart home system, and the electronic device provided in this application can achieve the following technical effects:
[0041] Mobile terminals are configured with corresponding device details interfaces for different smart devices. There is a correspondence between the device's MAC address and the device details interface. Thus, the device's MAC address can be obtained from the device details interface. The first LAN IP-port obtained from the device MAC address represents some network characteristics of the LAN where the smart device resides and some network characteristics of the smart device itself. Obtaining the first LAN IP-port prepares for verifying the relationship between the mobile terminal and the smart device in subsequent steps. In subsequent steps, the second LAN IP of the mobile terminal is obtained. The relationship between the first and second LAN IPs, and the result of the TCP access attempt, determines the relationship between the mobile terminal and the smart device in the network. The first and second LAN IPs indicate that they are the same or on the same LAN. If the TCP access is successful, the relevant instructions are sent to the smart device via LAN pass-through. Data transmission via LAN pass-through improves efficiency.
[0042] Furthermore, in the process of determining the relationship between the mobile terminal and the smart device in the network, the mobile terminal attempts to access the port in the IP-port of the first local area network via TCP. Its purpose is to further confirm that the mobile terminal and the smart device are on the same local area network.
[0043] The initial determination of whether two LANs are identical or located on the same LAN using the first and second LAN IP addresses is highly efficient, requiring almost no network data transmission and unaffected by network bandwidth or latency. In contrast, attempting to access the port in the second LAN IP-port sequence via TCP is affected by network bandwidth and latency, resulting in a longer and less predictable access time. Therefore, determining whether the first and second LAN IP addresses are identical or on the same LAN before attempting to access the smart device via TCP reduces the overall number of TCP access attempts. This also reduces the time between generating relevant commands on the device details screen and determining whether to send the commands via LAN pass-through, thus improving the transmission efficiency of relevant commands.
[0044] The above general description and the description below are exemplary and illustrative only and are not intended to limit this application. Attached Figure Description
[0045] One or more embodiments are illustrated by way of example with reference to the accompanying drawings. These illustrative descriptions and drawings do not constitute a limitation on the embodiments. Elements having the same reference numerals in the drawings are considered similar elements, and wherein:
[0046] Figures 1a to 1c This is a schematic diagram illustrating the implementation environment of a communication method between a mobile terminal and a smart device provided in an embodiment of this application;
[0047] Figure 2 This is a flowchart illustrating a communication method between a mobile terminal and a smart device provided in an embodiment of this application;
[0048] Figure 3 This is a flowchart illustrating a communication method between a mobile terminal and a smart device provided in an embodiment of this application.
[0049] Figure 4 This is a flowchart illustrating a communication method between a mobile terminal and a smart device provided in an embodiment of this application.
[0050] Figure 5 This is a flowchart illustrating a communication method between a mobile terminal and a smart device provided in an embodiment of this application;
[0051] Figure 6 This is a flowchart illustrating a communication method between a mobile terminal and a smart device provided in an embodiment of this application;
[0052] Figure 7 This is a schematic diagram illustrating the steps performed by each device in a smart home system according to an embodiment of this application.
[0053] Figure 8 This is a schematic diagram of an electronic device provided in an embodiment of this application. Detailed Implementation
[0054] To provide a more detailed understanding of the features and technical content of the embodiments of this application, the implementation of the embodiments of this application will be described in detail below with reference to the accompanying drawings. The accompanying drawings are for illustrative purposes only and are not intended to limit the embodiments of this application. In the following technical description, for ease of explanation, several details are used to provide a full understanding of the disclosed embodiments. However, one or more embodiments may still be implemented without these details. In other cases, well-known structures and devices may be simplified in their depiction to simplify the drawings.
[0055] The terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate for the embodiments of this application described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion.
[0056] Unless otherwise stated, the term "multiple" means two or more.
[0057] In this embodiment, the character " / " indicates that the objects before and after it are in an "or" relationship. For example, A / B means: A or B.
[0058] The term "and / or" describes an association between objects, indicating that three relationships can exist. For example, A and / or B means: A or B, or A and B.
[0059] Figures 1a to 1c This is a schematic diagram illustrating an implementation scenario of the communication method between a mobile terminal and a smart device provided in this application.
[0060] like Figures 1a to 1c As shown, mobile terminal 11 is connected to server 13, and smart device 12 is connected to server 13.
[0061] Figure 1a The scenario shown is a schematic diagram of the communication link between mobile terminal 11 and smart device 12 when they are not on the same local area network;
[0062] Figure 1b The scenario shown is a schematic diagram of the communication link between mobile terminal 11 and smart device 12 on the same local area network;
[0063] Figure 1c The scenario shown is a schematic diagram of the communication link between mobile terminal 11 and smart device 12 on the same local area network.
[0064] The mobile terminal 11 in this application embodiment can be a smartphone, tablet computer, ultra-mobile personal computer (UMPC), netbook, personal digital assistant (PDA), or other terminal device, but is not limited to these.
[0065] The smart device 12 in this application embodiment can be a mobile phone, computer, camera, television, telephone, washing machine, air conditioner, refrigerator, access control device, probe, sensor, detector, light, electric curtain, electric window, fire sprinkler system, alarm device and other smart products.
[0066] In this embodiment, server 13 can be a single server, a server cluster consisting of several servers, or a cloud computing service center. This server is used to assign accounts and passwords, generate tokens, and verify the validity of the tokens.
[0067] Figure 2 This is a schematic flowchart illustrating a communication method between a mobile terminal and a smart device according to an embodiment of this application. The communication method is applied to a mobile terminal, and the method is described exemplarily.
[0068] Combination Figure 2 As shown, the communication methods between mobile terminals and smart devices include:
[0069] S201. Generate relevant instructions corresponding to the access request on the device details interface.
[0070] Access requirements include, but are not limited to, control requirements and read requirements.
[0071] Based on the device details interface, relevant instructions corresponding to access requirements can be generated, such as control instructions for controlling smart devices and read instructions for reading relevant data from smart devices.
[0072] The device details interface can be configured with virtual buttons that can be triggered by the user, generating corresponding commands based on the triggering of the virtual buttons; alternatively, the device details interface can be configured with a display panel that displays the operating parameters of the smart device or the environmental parameters detected by the smart device, generating read commands to read the parameters displayed on the display panel when the device details interface is invoked.
[0073] S202. Based on the mapping relationship between MAC address and local area network IP-port, obtain the first local area network IP-port corresponding to the device MAC address.
[0074] The device's MAC address corresponds to the device details page. The mapping between the MAC address and the local area network (LAN) IP-port is cached by the server when the mobile terminal first accesses the device details page. The LAN IP-port refers to the corresponding LAN IP address and the port of the smart device within that LAN. The first LAN is the LAN where the smart device resides; the port in the first LAN's IP-port mapping can be accessed via TCP.
[0075] For example, after a smart device is configured with a network, it sets the port that other network devices in the local area network can access and obtains the IP address of the first local area network it is located in. It then sends the first local area network IP address and port as part of the attribute protocol to the server. When a mobile terminal accesses the device details interface for the first time, the mobile terminal caches the device MAC address corresponding to the device details interface and the first local area network IP address and port corresponding to the device MAC address to the mobile terminal's local storage.
[0076] The ability of a port to be accessed by TCP means that devices within a local area network can access smart devices via the port based on the TCP protocol.
[0077] The mapping between MAC addresses and local area network IP-ports is stored locally on the mobile terminal as key-value pairs, for example, in the storage space of the application (APP) used to control smart devices.
[0078] After obtaining the device MAC address corresponding to the device details page, you can obtain the first local area network IP-port by querying the device MAC address.
[0079] S203. Obtain the IP address of the second local area network where the mobile terminal is located.
[0080] S204. When the IP address of the second LAN and the IP address of the first LAN are the same or are on the same LAN, attempt to access the port in the IP address of the first LAN via TCP.
[0081] The first LAN IP address and the second LAN IP address are both in the same LAN, which can include the first LAN IP address and the second LAN IP address being in the same network segment.
[0082] S205. If the access result is successful, send the relevant instructions to the smart device via local area network pass-through.
[0083] For example, upon receiving a response from the smart device, the access is confirmed as successful.
[0084] Mobile terminals are configured with corresponding device details interfaces for different smart devices. There is a correspondence between the device's MAC address and the device details interface. Thus, the device's MAC address can be obtained from the device details interface. The first LAN IP-port obtained from the device MAC address represents some network characteristics of the LAN where the smart device resides and some network characteristics of the smart device itself. Obtaining the first LAN IP-port prepares for verifying the relationship between the mobile terminal and the smart device in subsequent steps. In subsequent steps, the second LAN IP of the mobile terminal is obtained. The relationship between the first and second LAN IPs, and the result of the TCP access attempt, determines the relationship between the mobile terminal and the smart device in the network. The first and second LAN IPs indicate that they are the same or on the same LAN. If the TCP access is successful, the relevant instructions are sent to the smart device via LAN pass-through. Data transmission via LAN pass-through improves efficiency.
[0085] Furthermore, in the process of determining the relationship between the mobile terminal and the smart device in the network, the mobile terminal attempts to access the port in the IP-port of the first local area network via TCP. Its purpose is to further confirm that the mobile terminal and the smart device are on the same local area network.
[0086] The initial determination of whether two LANs are identical or located on the same LAN using the first and second LAN IP addresses is highly efficient, requiring almost no network data transmission and unaffected by network bandwidth or latency. In contrast, attempting to access the port in the second LAN IP-port sequence via TCP is affected by network bandwidth and latency, resulting in a longer and less predictable access time. Therefore, determining whether the first and second LAN IP addresses are identical or on the same LAN before attempting to access the smart device via TCP reduces the overall number of TCP access attempts. This also reduces the time between generating relevant commands on the device details screen and determining whether to send the commands via LAN pass-through, thus improving the transmission efficiency of relevant commands.
[0087] Optionally, if the first LAN IP-port cannot be successfully obtained, the attribute protocol is parsed to obtain the LAN IP-port; a key-value pair is constructed using the device MAC address as the key and the LAN IP-port as the value; and the key-value pair is cached locally on the mobile terminal.
[0088] Among them, the attribute protocol allows smart devices to expose data in the form of attributes;
[0089] After the smart device is configured with the network, it sets the port that other network devices in the local area network can access, obtains the IP address of the first local area network it is located in, and sends the first local area network IP address and port as part of the attribute protocol to the server.
[0090] When a mobile terminal accesses the device details page for the first time, the device MAC address corresponding to the device details page and the first local area network IP-port corresponding to the device MAC address are cached locally on the mobile terminal.
[0091] As part of the attribute protocol, if the device MAC address and the corresponding first LAN IP-port are not successfully cached locally on the mobile terminal when it first accesses the device details page, the first LAN IP-port corresponding to the device MAC address is obtained by parsing the attribute protocol. There is no need to obtain the relevant data from the server again and cache it through other caching mechanisms.
[0092] Figure 3 This is a schematic flowchart illustrating a communication method between a mobile terminal and a smart device provided in an embodiment of this application. The communication method is applied to a mobile terminal, and the method is described exemplarily.
[0093] Combination Figure 3 As shown, the communication methods between mobile terminals and smart devices include:
[0094] S301. Generate relevant instructions corresponding to the access request on the device details interface.
[0095] S302. Determine whether the device MAC address and its corresponding first LAN IP-port have been cached: if yes, proceed to S303; otherwise, proceed to S307.
[0096] Optionally, during the network configuration process of smart devices, the smart devices are guided to perform network configuration; by accessing the device details interface to confirm that the smart device has been successfully configured, the device MAC address corresponding to the device details interface and the first local area network IP-port corresponding to the device MAC address are cached locally on the mobile terminal. This allows the mobile terminal to cache the device MAC address and its corresponding first local area network IP-port in a timely manner.
[0097] S303. Based on the mapping relationship between physical address (MAC address) and local area network (LAN) Internet Protocol (IP) port, obtain the first LAN IP port corresponding to the device's MAC address.
[0098] S304. Obtain the IP address of the second local area network where the mobile terminal is located.
[0099] S305. When the IP address of the second LAN and the IP address of the first LAN are the same or are on the same LAN, attempt to access the port in the IP address of the first LAN via TCP.
[0100] S306. If the access result is successful, send the relevant instructions to the smart device via local area network pass-through.
[0101] S307. Parse the attribute protocol to obtain the local area network IP-port.
[0102] The attribute protocol allows smart devices to expose data in the form of attributes.
[0103] S308. Construct key-value pairs using the device MAC address as the key and the local area network IP address and port as the value.
[0104] S309. Cache the key-value pairs locally on the mobile terminal.
[0105] Figure 4 This is a schematic flowchart illustrating a communication method between a mobile terminal and a smart device provided in an embodiment of this application. The communication method is applied to a mobile terminal, and the method is described exemplarily.
[0106] Combination Figure 4 As shown, the communication methods between mobile terminals and smart devices include:
[0107] S401. Generate relevant instructions corresponding to the access request on the device details interface.
[0108] S402. Based on the mapping relationship between physical address (MAC address) and local area network (LAN) Internet Protocol (IP) port, obtain the first LAN IP port corresponding to the device's MAC address.
[0109] The device MAC address corresponds to the device details interface; the correspondence between the MAC address and the local area network IP-port is cached by the server when the mobile terminal first accesses the device details interface; the first local area network is the local area network where the smart device is located, and the port in the first local area network IP-port can be accessed by TCP.
[0110] S403. Obtain the IP address of the second local area network where the mobile terminal is located.
[0111] S404. When the IP address of the second LAN and the IP address of the first LAN are the same or on the same LAN, attempt to access the port in the IP address of the first LAN via TCP.
[0112] S405. If the access result is successful, send the relevant instructions to the smart device via local area network pass-through.
[0113] S406. If the access result is an access failure, the relevant instructions are sent to the server, and then the server forwards the relevant instructions to the smart device.
[0114] For example, if no response is received from the smart device, the access is confirmed as failed.
[0115] Figure 5 This is a schematic flowchart illustrating a communication method between a mobile terminal and a smart device according to an embodiment of this application. The communication method is applied to a smart device, and the method is described exemplarily.
[0116] Combination Figure 5 As shown, the communication methods between mobile terminals and smart devices include:
[0117] S501: Obtain relevant instructions through the established communication path.
[0118] Among them, the relevant instructions are the instructions generated by the mobile terminal on the device details interface that correspond to the access request;
[0119] The communication path is determined in the following way:
[0120] The mobile terminal obtains the first LAN IP-port corresponding to the device MAC address based on the mapping between the Media Access Control (MAC) address and the Internet Protocol (IP) port of the LAN. The device MAC address corresponds to the device details interface. The mapping between the MAC address and the LAN IP-port is cached by the server on the mobile terminal when it first accesses the device details interface. The first LAN is the LAN where the smart device is located, and the port in the first LAN IP-port can be accessed by TCP.
[0121] The mobile terminal obtains its own second local area network IP address;
[0122] When the IP address of the second LAN is the same as the IP address of the first LAN in the IP-port, the mobile terminal attempts to access the port in the IP-port of the first LAN via TCP; if the access is successful, the LAN pass-through method is used as the communication path.
[0123] Optionally, during the network configuration process of smart devices, the network configuration is guided by a mobile terminal.
[0124] Optionally, after the smart device is configured with the network, the port that other network devices in the local area network can access is set, and the IP address of the device itself in the first local area network is obtained. The IP address and port of the first local area network are then sent to the server as part of the attribute protocol.
[0125] Optionally, if the access result is an access failure, the smart device receives relevant instructions sent by the server.
[0126] Figure 6 This is a schematic flowchart illustrating a communication method between a mobile terminal and a smart device according to an embodiment of this application. The communication method is applied to a smart device, and the method is described exemplarily.
[0127] Combination Figure 6 As shown, the communication methods between mobile terminals and smart devices include:
[0128] S601. When a mobile terminal accesses the device details interface for the first time, cache the mapping between the MAC address and the local area network IP-port in the mobile terminal.
[0129] The device's MAC address corresponds to the device details page.
[0130] The mapping between MAC addresses and local area network (LAN) IP-ports enables mobile terminals to obtain the first LAN IP-port corresponding to the device's MAC address; the first LAN is the LAN where the smart device is located, and the port in the first LAN IP-port can be accessed by TCP.
[0131] The mobile terminal then obtains its own second local area network IP address.
[0132] When the first LAN IP in the second LAN IP and the first LAN IP-port are the same or both are on the same LAN, the mobile terminal attempts to access the port in the first LAN IP-port via TCP.
[0133] If the access result is successful, the mobile terminal sends the relevant instructions to the smart device via local area network pass-through; the relevant instructions are those generated by the mobile terminal on the device details interface that correspond to the access request.
[0134] Optionally, if the access result is an access failure, the relevant instructions sent by the mobile device are received and sent to the smart device.
[0135] Optionally, after the smart device is configured to use the network, the device MAC address and the first local area network IP-port corresponding to the device MAC address are received from the smart device, and the first local area network IP-port corresponding to the device MAC address is cached in the mobile terminal.
[0136] Figure 7 This is a schematic diagram illustrating the steps performed by various devices in a smart home system provided in this application embodiment. The smart home system includes a mobile terminal, a server, and smart devices.
[0137] S701. The mobile terminal generates relevant instructions corresponding to the access request on the device details interface.
[0138] S702. The mobile terminal obtains the first local area network IP-port corresponding to the device MAC address based on the mapping relationship between MAC address and local area network IP-port.
[0139] The device MAC address corresponds to the device details interface; the correspondence between the MAC address and the local area network IP-port is cached by the server when the mobile terminal first accesses the device details interface; the first local area network is the local area network where the smart device is located, and the port in the first local area network IP-port can be accessed by TCP.
[0140] S703: The mobile terminal obtains the IP address of its own second local area network.
[0141] S704. When the IP address of the second LAN and the IP address of the first LAN are the same or on the same LAN, the mobile terminal attempts to access the port in the IP address of the first LAN via TCP.
[0142] S705. If the access result is successful, the mobile terminal sends the relevant instructions to the smart device via local area network pass-through.
[0143] In some embodiments, the electronic device includes a processor and a memory storing program instructions, the processor being configured to execute the communication method between the mobile terminal and the smart device provided in the foregoing embodiments when executing the program instructions.
[0144] Examples of electronic devices in the embodiments of this application may include, but are not limited to, mobile devices, personal digital assistants, mobile computing devices, smartphones, cellular phones, mobile phones, one-way pagers, two-way pagers, messaging communication devices, computers, personal computers (PCs), desktop computers, laptop computers, notebook computers, handheld computers, servers, server arrays or server farms, web servers, network servers, Internet servers, workstations, minicomputers, mainframe computers, supercomputers, network devices, web devices, distributed computing systems, multiprocessor systems, processor-based systems, consumer electronics, programmable consumer electronics, televisions, digital televisions, set-top boxes, wireless access points, base stations, subscriber stations, mobile subscriber centers, radio network controllers, routers, hubs, gateways, bridges, switches, machines, or combinations thereof.
[0145] Figure 8 This is a schematic diagram of an electronic device provided in an embodiment of this application. (In conjunction with...) Figure 8 As shown, the electronic device includes:
[0146] The processor 81 and memory 82 may also include a communication interface 83 and a bus 84. The processor 81, communication interface 83, and memory 82 can communicate with each other via the bus 84. The communication interface 83 can be used for information transmission. The processor 81 can call logical instructions in the memory 82 to execute the communication method between the mobile terminal and the smart device provided in the foregoing embodiments.
[0147] Furthermore, the logic instructions in the aforementioned memory 82 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium.
[0148] The memory 82, as a computer-readable storage medium, can be used to store software programs and computer-executable programs, such as program instructions / modules corresponding to the methods in the embodiments of this application. The processor 81 executes functional applications and data processing by running the software programs, instructions, and modules stored in the memory 82, thereby implementing the methods in the above-described method embodiments.
[0149] The memory 82 may include a program storage area and a data storage area. The program storage area may store the operating system and application programs required for at least one function; the data storage area may store data created based on the use of the terminal device. Furthermore, the memory 82 may include high-speed random access memory and may also include non-volatile memory.
[0150] This application provides a computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions are configured as follows:
[0151] Generate relevant instructions corresponding to the access request on the device details page;
[0152] Based on the mapping between physical MAC addresses and Internet Protocol (IP) ports, the first LAN IP-port corresponding to the device's MAC address is obtained; the device MAC address corresponds to the device details interface; the mapping between MAC addresses and LAN IP-ports is cached by the server on the mobile terminal when the mobile terminal first accesses the device details interface; the first LAN is the LAN where the smart device is located, and the port in the first LAN IP-port can be accessed by TCP;
[0153] Obtain the IP address of the second local area network where the mobile terminal is located;
[0154] When the first LAN IP address in the second LAN IP address and the first LAN IP address-port are the same or both are on the same LAN, an attempt is made to access the port in the first LAN IP address-port via TCP.
[0155] If the access result is successful, the relevant instructions are sent to the smart device via local area network pass-through.
[0156] This application provides a computer program product, which includes a computer program stored on a computer-readable storage medium. The computer program includes program instructions, which, when executed by a computer, cause the computer to perform the following steps:
[0157] Generate relevant instructions corresponding to the access request on the device details page;
[0158] Based on the mapping between physical MAC addresses and Internet Protocol (IP) ports, the first LAN IP-port corresponding to the device's MAC address is obtained; the device MAC address corresponds to the device details interface; the mapping between MAC addresses and LAN IP-ports is cached by the server on the mobile terminal when the mobile terminal first accesses the device details interface; the first LAN is the LAN where the smart device is located, and the port in the first LAN IP-port can be accessed by TCP;
[0159] Obtain the IP address of the second local area network where the mobile terminal is located;
[0160] When the first LAN IP address in the second LAN IP address and the first LAN IP address-port are the same or both are on the same LAN, an attempt is made to access the port in the first LAN IP address-port via TCP.
[0161] If the access result is successful, the relevant instructions are sent to the smart device via local area network pass-through.
[0162] The aforementioned computer-readable storage medium may be a transient computer-readable storage medium or a non-transitory computer-readable storage medium.
[0163] The technical solutions of this application embodiment can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes one or more instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods in this application embodiment. The aforementioned storage medium can be a non-transitory storage medium, including: USB flash drive, portable hard drive, read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk, and other media capable of storing program code; it can also be a transient storage medium.
[0164] The foregoing description and accompanying drawings fully illustrate embodiments of this application to enable those skilled in the art to practice them. Other embodiments may include structural, logical, electrical, procedural, and other changes. The embodiments represent only possible variations. Individual components and functions are optional unless explicitly required, and the order of operations may vary. Parts and features of some embodiments may be included in or replace parts and features of other embodiments. Moreover, the terminology used in this application is for describing embodiments only and is not intended to limit the claims. As used in the description of embodiments and claims, the singular forms “a,” “an,” and “the” are intended to equally include the plural forms unless the context clearly indicates otherwise. Additionally, when used in this application, the terms “comprise” and its variations “comprises” and / or “comprising” refer to the presence of stated features, integrals, steps, operations, elements, and / or components, but do not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components, and / or groups thereof. Unless otherwise specified, an element defined by the phrase "comprising a..." does not exclude the presence of other identical elements in the process, method, or apparatus that includes that element. In this document, each embodiment may focus on describing the differences from other embodiments, and similar or identical parts between embodiments can be referred to mutually. For methods, products, etc., disclosed in the embodiments, if they correspond to the method section disclosed in the embodiments, then the relevant parts can be referred to the description of the method section.
[0165] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the embodiments of this application. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0166] The methods and products (including but not limited to devices and equipment) disclosed in the embodiments herein can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For instance, the division of units may be merely 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 system, or some features may be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces, and the indirect coupling or communication connection of devices or units may be electrical, mechanical, or other forms. Units described as separate components may or may not be physically separate, and components shown as units may or may not be physical units. They may be located in one place or distributed across multiple network units. Some or all of the units can be selected to implement this embodiment according to actual needs. Furthermore, the functional units in the embodiments of this application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0167] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code, which contains one or more executable instructions for implementing a specified logical function. In some alternative implementations, the functions marked in the blocks may occur in a different order than those shown in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. Each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
Claims
1. A communication method between a mobile terminal and a smart device, characterized in that, Applied to mobile terminals, the communication method includes: Generate relevant instructions corresponding to the access request on the device details page; Based on the mapping between physical MAC addresses and Internet Protocol (IP) ports, the first LAN IP-port corresponding to the device's MAC address is obtained; the device MAC address corresponds to the device details interface; the mapping between MAC addresses and LAN IP-ports is cached by the server on the mobile terminal when the mobile terminal first accesses the device details interface; the first LAN is the LAN where the smart device is located, and the port in the first LAN IP-port can be accessed by the Transmission Control Protocol (TCP); Obtain the IP address of the second local area network where the mobile terminal is located; When the first LAN IP address in the second LAN IP address and the first LAN IP address-port are the same or both are on the same LAN, an attempt is made to access the port in the first LAN IP address-port via TCP. If the access result is successful, the relevant instructions are sent to the smart device via local area network pass-through.
2. The communication method according to claim 1, characterized in that, Also includes: If the first LAN IP-port cannot be obtained successfully, the attribute protocol is parsed to obtain the LAN IP-port. The attribute protocol allows smart devices to expose data in the form of attributes; Construct key-value pairs using the device's MAC address as the key and the local area network IP address and port as the value; Cache key-value pairs locally on the mobile device; Among them, after the smart device is configured, it sets the port that other network devices in the local area network can access, obtains the IP address of the first local area network it is located in, and sends the first local area network IP address and port as part of the attribute protocol to the server. When a mobile terminal accesses the device details page for the first time, the device MAC address corresponding to the device details page and the first local area network IP-port corresponding to the device MAC address are cached locally on the mobile terminal.
3. The communication method according to claim 2, characterized in that, Before obtaining the first LAN IP-port corresponding to the device's MAC address, the process also includes: Determine whether the device's MAC address and its corresponding first LAN IP-port have been cached. If so, obtain the first local area network IP-port corresponding to the device's MAC address; Otherwise, parse the attribute protocol to obtain the local area network IP-port.
4. The communication method according to claim 2, characterized in that, During the network configuration process of smart devices, guide the smart devices to perform network configuration; Access the device details interface to confirm that the smart device has been successfully configured to the network, and cache the device MAC address and the first local area network IP-port corresponding to the device MAC address to the mobile terminal.
5. The communication method according to claim 1, characterized in that, Both the first LAN IP address and the second LAN IP address are on the same LAN, including: The first LAN IP address and the second LAN IP address are on the same network segment.
6. The communication method according to any one of claims 1 to 5, characterized in that, Also includes: If the access fails, the relevant instructions are sent to the server, which then forwards the instructions to the smart device.
7. A communication method between a mobile terminal and a smart device, characterized in that, The communication method, applied to smart devices, includes: Obtain relevant instructions through the established communication path; Among them, the relevant instructions are the instructions generated by the mobile terminal on the device details interface that correspond to the access request; The communication path is determined in the following way: The mobile terminal obtains the first LAN IP-port corresponding to the device MAC address based on the mapping between the Media Access Control (MAC) address and the Internet Protocol (IP) port of the LAN. The device MAC address corresponds to the device details interface. The mapping between the MAC address and the LAN IP-port is cached by the server on the mobile terminal when it first accesses the device details interface. The first LAN is the LAN where the smart device is located, and the port in the first LAN IP-port can be accessed by TCP. The mobile terminal obtains its own second local area network IP address; When the IP address of the second LAN is the same as the IP address of the first LAN in the IP-port, the mobile terminal attempts to access the port in the IP-port of the first LAN via TCP; if the access is successful, the LAN pass-through method is used as the communication path.
8. A communication method between a mobile terminal and a smart device, characterized in that, Applied to a server, the communication method includes: When a mobile terminal first accesses the device details page, the mapping between MAC address and local area network IP-port is cached on the mobile terminal. The device's MAC address corresponds to the device details page. The mapping between MAC addresses and local area network (LAN) IP-ports enables mobile terminals to obtain the first LAN IP-port corresponding to the device's MAC address; the first LAN is the LAN where the smart device is located, and the port in the first LAN IP-port can be accessed by TCP. The mobile terminal then obtains its own second local area network IP address. When the first LAN IP in the second LAN IP and the first LAN IP-port are the same or both are on the same LAN, the mobile terminal attempts to access the port in the first LAN IP-port via TCP. If the access result is successful, the mobile terminal sends the relevant instructions to the smart device via local area network pass-through; the relevant instructions are those generated by the mobile terminal on the device details interface that correspond to the access request.
9. A smart home system, characterized in that, Including mobile terminals, servers, and smart devices; The mobile terminal generates relevant instructions corresponding to the access request on the device details interface; The mobile terminal obtains the first local area network IP-port corresponding to the device's MAC address based on the mapping relationship between MAC address and local area network IP-port; The device's MAC address corresponds to the device details page; The mapping between MAC address and local area network IP-port is cached by the server when the mobile terminal first accesses the device details interface; the first local area network is the local area network where the smart device is located, and the port in the first local area network IP-port can be accessed by TCP; The mobile terminal obtains its own second local area network IP address; When the first LAN IP in the second LAN IP and the first LAN IP-port are the same or both are on the same LAN, the mobile terminal attempts to access the port in the first LAN IP-port via TCP. If the access result is successful, the mobile terminal sends the relevant instructions to the smart device via local area network pass-through.
10. An electronic device comprising a processor and a memory storing program instructions, characterized in that, The processor is configured to execute the communication method between a mobile terminal and a smart device as described in any one of claims 1 to 8 when executing the program instructions.
Citation Information
Patent Citations
Method and device for binding server MAC address with uplink port
CN101127681A
Control method and system of smart home device, storage medium and computer device
CN107707439A
