Device discovery method, device and intranet communication system based on communication system

By sending Bluetooth broadcast messages after the smart device is connected to the router and exchanging IP addresses, the problem that devices in different network segments cannot be discovered is solved, and intranet communication across network segments is realized, and costs are reduced.

CN115474186BActive Publication Date: 2025-08-19SHENZHEN OURUIBO ELECTRONICS
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202210900321.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-28
Publication Date
2025-08-19
Estimated Expiration
2042-07-28

AI Technical Summary

Technical Problem

In the prior art, devices in different network segments cannot be discovered in the intranet, resulting in the problem of equipment being out of control when external network failures.

Method used

By sending a Bluetooth broadcast message after the first device is connected to the router, establishing a Bluetooth connection, and exchanging IP addresses with the third device through the second device, and finally establishing a TCP connection, cross-network discovery is achieved.

Benefits of technology

Even if the first device and the third device are in different network segments, intranet discovery and communication can be carried out without adding hardware equipment, which is relatively low.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115474186B_ABST
    Figure CN115474186B_ABST
Patent Text Reader

Abstract

The present invention relates to a device discovery method, device, and intranet communication system based on a communication system. The device discovery method comprises: when a first device accesses a router, sending a preset type of information, wherein the preset type of information includes: a Bluetooth broadcast message; receiving a Bluetooth connection request sent by a second device and establishing a Bluetooth connection with the second device, wherein the second device sends a Bluetooth connection request to the first device after hearing the Bluetooth broadcast message; exchanging IP addresses with a third device through the second device; and establishing a TCP connection with the third device based on the IP address of the third device. By implementing the technical solution of the present invention, intranet discovery of the first and third devices can still be performed even if the first and third devices are in different network segments.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of smart home technology, and in particular to a device discovery method, device, and intranet communication system based on a communication system. Background Art

[0002] With the development of smart homes, more and more home appliances are equipped with WiFi direct cloud connectivity, allowing users to conveniently control home appliances using apps (applications). However, this approach comes with a significant drawback: it relies heavily on external networks (broadband). If the external network fails, all devices will lose control. In contrast, the intranet (WiFi device-WiFi router) is much more stable, leading to the emergence of numerous control solutions based on intranet communication, such as Apple's HomeKit (smart home platform) and Smartthing (smart device control system). The foundation of intranet communication is device discovery.

[0003] Currently, mDNS (Multicast Domain Name System) is commonly used for device discovery, but this solution only supports device discovery within the same network segment (e.g., all devices connected to a single WiFi router). For example, in communication between IoT devices and apps, apps send specific information via WiFi multicast, and interested devices respond, enabling device discovery on the local area network. However, some large households may have multiple WiFi routers installed, and multiple household appliances may be located at different routing levels or network segments. In this case, two devices on different network segments cannot be discovered. Summary of the Invention

[0004] In order to solve the problem in the prior art that two devices in different network segments cannot be discovered, the present invention provides a device discovery method based on a communication system, a device, and an intranet communication system.

[0005] The present invention solves the technical problem by providing a device discovery method based on a communication system, which is applied to a first device in the communication system, wherein the communication system also includes a second device and a third device. The method includes:

[0006] When the first device is connected to the router, it sends preset type information, wherein the preset type information includes: Bluetooth broadcast message;

[0007] receiving a Bluetooth connection request sent by the second device and establishing a Bluetooth connection with the second device, wherein the second device sends the Bluetooth connection request to the first device after hearing the Bluetooth broadcast message;

[0008] exchanging IP addresses with the third device through the second device;

[0009] Establish a TCP connection with the third device according to the IP address of the third device.

[0010] Preferably, the exchanging IP addresses with the third device through the second device includes:

[0011] When the second device and the third device are the same device, exchanging an IP address with the second device through the Bluetooth connection; or

[0012] When the second device and the third device are not the same device, the second device sends its own IP address to the second device via the Bluetooth connection, so that the second device can send the IP address of the first device to the third device via intranet communication; and the second device receives the IP address of the third device sent by the second device via the Bluetooth connection.

[0013] Preferably, when the first device is connected to the router, sending the preset type information includes:

[0014] When the first device is connected to the router, the preset type information is automatically sent; or,

[0015] After the first device is connected to the router, it receives a trigger instruction input by a user and sends the preset type information according to the trigger instruction.

[0016] Preferably, the preset type information further includes a WiFi multicast message, and when the first device accesses the router, sending the preset type information includes:

[0017] When the first device is connected to the router, the first device sends the WiFi multicast message and the Bluetooth broadcast message alternately;

[0018] The method further includes:

[0019] When the third device and the first device are not cross-segment devices, receiving a response message sent by the third device, and obtaining the IP address of the third device according to the response message, wherein, after receiving the WiFi multicast message, the third device obtains the IP address of the first device and returns a response message to the first device;

[0020] Establish a TCP connection with the third device according to the IP address of the third device.

[0021] The present invention also provides a device discovery method based on a communication system, which is applied to a second device in the communication system, wherein the communication system further includes a first device and a third device. The method includes:

[0022] Listening to preset type information sent by the first device, wherein the first device sends the preset type information after accessing the router, and the preset type information includes: a Bluetooth broadcast message;

[0023] Sending a Bluetooth connection request to the first device and establishing a Bluetooth connection with the first device;

[0024] The IP addresses of the first device and the third device are exchanged through the Bluetooth connection, so that the first device and the third device establish a TCP connection.

[0025] Preferably, the exchanging of IP addresses of the first device and the third device through the Bluetooth connection includes:

[0026] When the second device and the third device are the same device, exchanging IP addresses with the first device through the Bluetooth connection; or

[0027] When the second device and the third device are not the same device, the IP address of the first device is received via the Bluetooth connection and sent to the third device via intranet communication; and the IP address of the third device is sent to the first device via the Bluetooth connection.

[0028] Preferably, before implementing the exchange of IP addresses of the first device and the third device through the Bluetooth connection, the method further includes:

[0029] Performing legitimacy verification on the first device;

[0030] If the first device is a legitimate device, the IP addresses of the first device and the third device are exchanged through the Bluetooth connection.

[0031] The present invention also constructs a device discovery method based on a communication system, which is applied to a third device in the communication system, wherein the intranet communication system further includes a first device and a second device. The method comprises:

[0032] Receiving the IP address of the first device sent by the second device; wherein the first device establishes a Bluetooth connection with the second device, and the first device sends its own IP address to the second device through the Bluetooth connection;

[0033] Establish a TCP connection with the first device according to the IP address of the first device.

[0034] The present invention also constructs a device, including a processor and a memory storing a computer program, wherein the processor implements the steps of the device discovery method described above when executing the computer program.

[0035] The present invention also constructs an intranet communication system, comprising:

[0036] Multiple devices described above

[0037] At least two connected routers.

[0038] By implementing the technical solution of the present invention, after the first device is connected to the router of the communication system, a Bluetooth broadcast message can be sent, so that the second device within the Bluetooth communication range can scan the Bluetooth broadcast message and then establish a Bluetooth connection with the first device. After the second device establishes a Bluetooth connection with the first device, the second device acts as a bridge between the first device and the third device (the discovery target of the first device), and can realize the IP address exchange between the first device and the third device. After the first device and the third device exchange IP addresses, a TCP connection can be established between the two. Therefore, even if the first device and the third device are in different network segments, intranet discovery of both parties can still be performed, and subsequent intranet communication can be performed. Moreover, since the technical solution of the present invention does not require the addition of any hardware devices in the communication system, the cost is relatively low. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0040] Figure 1 is a flow chart of a first embodiment of a device discovery method based on a communication system according to the present invention;

[0041] Figure 2 is a flow chart of a second embodiment of a device discovery method based on a communication system according to the present invention;

[0042] Figure 3 is a flow chart of a third embodiment of a device discovery method based on a communication system according to the present invention;

[0043] Figure 4 This is a logical structure diagram of the first embodiment of the intranet communication system of the present invention;

[0044] Figure 5 It is a logical structure diagram of the second embodiment of the intranet communication system of the present invention. DETAILED DESCRIPTION

[0045] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.

[0046] The present invention provides a device discovery method based on a communication system, such as a home intranet communication system or an intranet communication system under a specific account. The communication system includes a first device, a second device, a third device, and at least two connected routers, wherein the first device and the third device are mutually discoverable devices. The first, second, and third devices are all smart devices that support WiFi networking functionality and utilize a WiFi & BLE dual-mode chip, enabling coexistence of WiFi and BLE functions.

[0047] In one specific application, the communication system is a home intranet communication network, and the first and second devices are household appliances, such as smart lights, smart refrigerators, smart curtains, and smart door locks. The third device is a central control device for the household appliances, such as a central control panel or smart control switch. Of course, the actual number of devices may be more than three. Moreover, in this communication system, the first device is a newly added device and needs to be discovered by the third device. That is, the first device cannot communicate with other devices in the communication system based on intranet communication at this time; the second and third devices are successfully added devices. That is, the second and third devices can both communicate with other devices in the communication system based on intranet communication. Only when the first device is discovered by the third device and a communication connection is established between the two devices can the first device be controlled by the third device. In addition, the third device and the first device can be cross-segment devices. That is, the third device and the first device are connected to two cascaded routers respectively. For example, the first device is connected to a sub-router, and the third device is connected to the main router of the upper level of the sub-router; or the first device is connected to the main router, and the third device is connected to the sub-router of the main router. The second device and the first device / third device may be connected to the same router or to different routers, which is not specifically limited in the present invention.

[0048] In addition, the device discovery method in the technical solution of the present invention is used for mutual discovery of the first device and the third device. It should be understood that the two devices to be discovered are determined by the business logic of the application layer. For example, the third device is a control center device, and the first device is a video intercom door lock. If the business logic requires that the control center device can interact with visitors in front of the video intercom door lock through its own screen, speaker, and microphone, the two need to discover each other; for another example, the third device is a control panel, and the first device is a WiFi smart light. If the business logic requires that the control panel can control the WiFi smart light, the two also need to discover each other.

[0049] Figure 1 1 is a flow chart of a first embodiment of a device discovery method based on a communication system according to the present invention. The device discovery method of this embodiment is applied to a first device and specifically includes:

[0050] Step S11: After the first device is connected to the router, it sends preset type information, wherein the preset type information includes: Bluetooth broadcast message;

[0051] In this step, the first device can access a router in the communication system through user installation and configuration. For example, the user can access the router by selecting a router account and entering a password on the wireless LAN settings interface. The user can then obtain an IP address dynamically assigned based on DHCP (Dynamic Host Configuration Protocol), which is the IP address of the network segment corresponding to the router. In addition, because the first device uses a WiFi & BLE dual-mode chip, after the first device joins the router, it activates its own WiFi & BLE coexistence mode, allowing it to maintain WiFi connectivity while periodically sending preset type information containing its own device information.

[0052] In this embodiment, the preset type information includes Bluetooth broadcast information, that is, the first device periodically sends its own device information through BLE broadcast to convey a request to join the home intranet communication network to the outside world, and the Bluetooth broadcast message carries its own device identification.

[0053] Step S12: receiving a Bluetooth connection request sent by the second device and establishing a Bluetooth connection with the second device, wherein the second device sends a Bluetooth connection request to the first device after intercepting the Bluetooth broadcast message;

[0054] In this step, it should be noted that after the first device sends a Bluetooth broadcast message, all devices within its Bluetooth communication range can hear the Bluetooth broadcast message, and it is possible that multiple devices have sent Bluetooth connection requests to the first device. However, the first device can only establish a Bluetooth connection with one of the devices. The device that establishes a Bluetooth connection with the first device can be selected based on, but is not limited to, the time the Bluetooth connection request was received and the signal strength of the corresponding device.

[0055] As an implementation manner, the first device establishes a Bluetooth connection only according to the Bluetooth connection request received first. For example, the Bluetooth connection request sent by the second device is first received by the first device, so the first device establishes a Bluetooth connection with the second device.

[0056] As another embodiment, the first device may also establish a Bluetooth connection based on the Bluetooth connection request corresponding to the one with the best signal strength among the received Bluetooth connection requests. For example, among the multiple Bluetooth connection requests received within a preset time range (e.g., 500ms) after receiving the first Bluetooth connection request, the Bluetooth connection signal strength between the second device and the first device is the best, so the first device establishes a Bluetooth connection with the second device.

[0057] Step S13, exchanging IP addresses with the third device through the second device;

[0058] In this step, since the second device has been connected to the first device through Bluetooth, it can communicate with the first device through Bluetooth. At the same time, as a device that has successfully joined the communication system, the second device can also communicate with the third device through the intranet. Therefore, the second device can serve as a bridge device between the first device and the third device to realize the IP address exchange function between the first device and the third device.

[0059] Step S14: Establish a TCP connection with the third device according to the IP address of the third device.

[0060] It should be noted that according to the NAT (Network Address Translation) protocol, only devices at the lower routing level can send connection requests to devices at the upper routing level. That is, only devices at the lower routing level can send connection requests to devices at the upper routing level (as TCP servers) as TCP clients, and devices at the upper routing level cannot send connection requests to devices at the lower routing level (as TCP servers) as TCP clients.

[0061] In one embodiment, after the first device and the third device exchange IP addresses, the second device sends a TCP connection notification to the first device. The second device sends the TCP connection notification only to the first device if it determines that the first device is connected to a sub-router and the third device is connected to a main router. In other words, the first device acts as a TCP client at a lower-level routing layer, and the third device acts as a TCP server at a higher-level routing layer.

[0062] As another implementation, in addition to sending a TCP connection notification to the first device, the second device also sends a TCP connection notification to the third device. In actual applications, the second device may not know whether the first device or the third device is at the lower routing level. In other words, it cannot know whether the first device is connected to the sub-router and the third device is connected to the main router, or whether the third device is connected to the sub-router and the first device is connected to the main router. Therefore, the second device can only send TCP connection notifications to the first device and the third device at the same time. In this way, the first device and the third device will both send TCP connection requests to each other, ensuring that a TCP connection can be established between the first device and the third device regardless of whether the first device or the third device is at the lower routing level.

[0063] In another embodiment, the second device only sends a TCP connection notification to the third device, and the first device receives the TCP connection request sent by the third device. The premise for the second device to send only the TCP connection notification to the third device is that the second device determines that the third device is connected to a sub-router and the first device is connected to the main router, that is, the third device acts as a TCP client at a lower routing level and the first device acts as a TCP server at a higher routing level.

[0064] As another implementation, after the first device and the third device exchange IP addresses, they can directly send a TCP connection request from the device connected to the sub-router (one of the first and third devices) to the device connected to the main router (the other of the first and third devices) without waiting for the second device to send a TCP connection notification, thereby establishing a TCP connection between the first and third devices. This direct TCP connection establishment method assumes that both the first and third devices can determine whether they are connected to a sub-router or a main router.

[0065] Through the technical solution of this embodiment, when the first device is connected to the router of the communication system, it can send a Bluetooth broadcast message, so that the second device within the Bluetooth communication range of the first device can scan the Bluetooth broadcast message and then establish a Bluetooth connection with the first device. After the second device establishes a Bluetooth connection with the first device, the second device acts as a bridge between the first device and the third device (the discovery target of the first device) to realize the IP address exchange between the first device and the third device. After the first device and the third device exchange IP addresses, a TCP connection can be established between the two. Therefore, even if the first device and the third device are in different network segments, intranet discovery of both parties can still be carried out, and subsequent intranet communication can be carried out. Moreover, since this technical solution does not require the addition of any hardware devices in the communication system, the cost is relatively low.

[0066] Furthermore, in an optional embodiment, exchanging IP addresses with the third device through the second device in step S13 includes: when the second device and the third device are the same device, exchanging IP addresses with the second device through the Bluetooth connection. In this embodiment, the second device and the third device are the same device, that is, even if the first device and its discovery target (the third device) are in different network segments, they are close to each other, so that after the first device sends a Bluetooth broadcast message, the third device can hear the Bluetooth broadcast message and directly establish a Bluetooth connection with the first device. Then, the two devices exchange each other's IP addresses through the Bluetooth connection to establish a subsequent TCP connection.

[0067] Furthermore, in an optional embodiment, exchanging IP addresses with the third device via the second device in step S13 includes: when the second device and the third device are not the same device, the first device sending its own IP address to the second device via the Bluetooth connection, so that the second device can send the first device's IP address to the third device via intranet communication; and receiving the third device's IP address sent by the second device via the Bluetooth connection. In this embodiment, the second device and the third device are not the same device. In this case, the second device serves as a bridge device between the first and third devices, and receives its own IP address sent by the first device via the Bluetooth connection, so that the first device's IP address can be sent to the third device via intranet communication, as well as the third device's IP address sent to the first device via the Bluetooth connection.

[0068] Furthermore, in an optional embodiment, the second device may request an IP address from the third device through intranet communication only after establishing a Bluetooth connection with the first device, and then send the requested IP address of the third device to the first device through the Bluetooth connection.

[0069] In another optional embodiment, since the second device has joined the intranet communication system, the second device can pre-store the IP address of the third device. After the second device establishes a Bluetooth connection with the first device, the IP address of the third device is directly sent to the first device via the Bluetooth connection.

[0070] Furthermore, in an optional embodiment, in step S11, sending the preset type information after the first device is connected to the router includes: automatically sending the preset type information after the first device is connected to the router. In this embodiment, the sending of the preset type information is automatically triggered after the first device is connected to the router.

[0071] Furthermore, in an optional embodiment, in step S11, sending the preset type of information after the first device is connected to the router includes: receiving a trigger instruction input by the user after the first device is connected to the router, and sending the preset type of information according to the trigger instruction. In this embodiment, a physical button or a virtual button can be set on the first device. When the first device is connected to the router, the user can trigger the sending of the preset type of information by triggering the physical button or virtual button; alternatively, the user can trigger the sending of the preset type of information by issuing a corresponding instruction through a terminal app.

[0072] Furthermore, in an optional embodiment, the first device has a WiFi & BLE dual-mode chip that can realize the coexistence of WiFi and BLE functions. Therefore, the preset type information sent by the first device includes not only Bluetooth broadcast messages but also WiFi multicast messages, and the WiFi multicast messages contain its own IP address. In addition, step S11 includes:

[0073] When the first device is connected to the router, the first device sends the WiFi multicast message and the Bluetooth broadcast message alternately;

[0074] The method further includes:

[0075] When the third device and the first device are not cross-segment devices, receiving a response message sent by the third device, and obtaining the IP address of the third device according to the response message, wherein, after receiving the WiFi multicast message, the third device obtains the IP address of the first device and returns a response message to the first device;

[0076] Establish a TCP connection with the third device according to the IP address of the third device.

[0077] In this embodiment, after the first device accesses the router of the communication system, it can alternately send Bluetooth broadcast messages and WiFi multicast messages. In this way, if the third device (the discovery target of the first device) is in the same network segment as the first device, then the third device can directly respond to the WiFi multicast message, and the response message includes the IP address of the third device. Then, the first device and the third device can establish a TCP connection based on the obtained IP address of the other party.

[0078] Regarding the above embodiment, there are two points to note:

[0079] 1. If the third device and the first device are cross-segment devices, since the third device and the first device are in different network segments, when the first device sends a WiFi multicast message, the router to which the first device is connected cannot forward it to its own WAN (Wide area network interface) interface, and cannot send it to another router connected to the WAN port (the router to which the third device is connected). In this way, the third device cannot detect the WiFi multicast information. In this case, you can only use Figure 1 The method of the illustrated embodiment performs mutual discovery between the first device and the third device.

[0080] 2. If the third device is close to the first device and they are in the same network segment, then since the first device sends Bluetooth broadcast messages and WiFi multicast messages alternately, the following situation may occur: before the third device has time to respond to the WiFi multicast message, it will first exchange IP addresses with the first device through the second device. Figure 1 The method of the illustrated embodiment performs mutual discovery between the first device and the third device.

[0081] Figure 2 4 is a flow chart of a second embodiment of a device discovery method based on a communication system according to the present invention. The device discovery method of this embodiment is applied to a second device and specifically includes the following steps:

[0082] Step S21. Listening to the preset type information sent by the first device, wherein the first device sends the preset type information after accessing the router, and the preset type information includes: Bluetooth broadcast message;

[0083] Step S22. Sending a Bluetooth connection request to the first device and establishing a Bluetooth connection with the first device;

[0084] Step S23: The IP addresses of the first device and the third device are exchanged through the Bluetooth connection, so that the first device and the third device establish a TCP connection.

[0085] Through the technical solution of this embodiment, when the first device is connected to the router of the communication system, it can send a Bluetooth broadcast message, so that the second device within the Bluetooth communication range of the first device can scan the Bluetooth broadcast message and then establish a Bluetooth connection with the first device. After the second device establishes a Bluetooth connection with the first device, the second device acts as a bridge between the first device and the third device (the discovery target of the first device) to realize the IP address exchange between the first device and the third device. After the first device and the third device exchange IP addresses, a TCP connection can be established between the two. Therefore, even if the first device and the third device are in different network segments, intranet discovery of both parties can still be carried out, and subsequent intranet communication can be carried out. Moreover, since this technical solution does not require the addition of any hardware devices in the communication system, the cost is relatively low.

[0086] Furthermore, in an optional embodiment, in step S23, the exchange of IP addresses between the first device and the third device is achieved through the Bluetooth connection, including: when the second device and the third device are the same device, exchanging IP addresses with the first device through the Bluetooth connection, including: when the second device and the third device are the same device, exchanging IP addresses with the first device through the Bluetooth connection. In this embodiment, the second device and the third device are the same device, that is, even if the first device and its discovery target (the third device) are in different network segments, the distance between the two is relatively close, so that after the first device sends a Bluetooth broadcast message, the third device can hear the Bluetooth broadcast message and then directly establish a Bluetooth connection with the first device. Then, the two exchange each other's IP addresses through the Bluetooth connection.

[0087] Furthermore, in an optional embodiment, the exchange of IP addresses between the first device and the third device via the Bluetooth connection in step S23 includes: when the second device and the third device are not the same device, receiving the IP address of the first device via the Bluetooth connection and sending it to the third device via intranet communication; and sending the IP address of the third device to the first device via the Bluetooth connection. In this embodiment, the second device and the third device are not the same device. In this case, the second device serves as a bridge device between the first device and the third device, and receives its own IP address sent by the first device via the Bluetooth connection, so as to send the IP address of the first device to the third device via intranet communication, as well as the IP address of the third device sent to the first device via the Bluetooth connection.

[0088] Furthermore, in an optional embodiment, between step S22 and step S23, the following steps are further included:

[0089] Performing legitimacy verification on the first device;

[0090] If the first device is a legitimate device, the IP addresses of the first device and the third device are exchanged through the Bluetooth connection.

[0091] In this embodiment, before the second device exchanges IP addresses with the first and third devices, it must first verify the legitimacy of the first device's identity, i.e., authenticate the first device. This authentication can be performed, for example, using a digital certificate. Information exchange, i.e., the exchange of IP address information between the two parties, is performed only if the first device is legitimate, thereby improving the security of the intranet communication system.

[0092] Figure 3 4 is a flow chart of a third embodiment of a device discovery method based on a communication system according to the present invention. The device discovery method of this embodiment is applied to a third device and specifically includes the following steps:

[0093] Step S31. Receiving the IP address of the first device sent by the second device; wherein the first device establishes a Bluetooth connection with the second device, and the first device sends its own IP address to the second device via the Bluetooth connection;

[0094] Step S32: Establish a TCP connection with the first device according to the IP address of the first device.

[0095] Through the technical solution of this embodiment, when the first device is connected to the router of the communication system, it can send a Bluetooth broadcast message, so that the second device within the Bluetooth communication range of the first device can scan the Bluetooth broadcast message and then establish a Bluetooth connection with the first device. After the second device establishes a Bluetooth connection with the first device, the second device acts as a bridge between the first device and the third device (the discovery target of the first device), and can realize the IP address exchange between the first device and the third device. After the first device and the third device exchange IP addresses, a TCP connection can be established between the two. Therefore, even if the first device and the third device are in different network segments, intranet discovery of both parties can still be carried out, and subsequent intranet communication can be carried out. Moreover, since this technical solution does not require the addition of any hardware devices in the communication system, the cost is relatively low.

[0096] The present invention also constructs a device, which includes a processor and a memory, and the memory stores a computer program. When the processor executes the computer program, it implements the steps of the device discovery method described in any embodiment.

[0097] Figure 4This is a logical structure diagram of an embodiment of the intranet communication system of the present invention. The intranet communication system of this embodiment includes multiple devices (only devices 11, 12, and 13 are shown in the figure) and at least two connected routers (only routers 14 and 15 are shown in the figure). The logical structure of the devices 11, 12, and 13 can refer to the above description, and at least two routers are connected.

[0098] The following combination Figure 5 The intranet communication system in one embodiment of the present invention is used to illustrate the application process of the device discovery method of the present invention in a smart home system:

[0099] In the smart home system, the third device is the smart control hub, which is a control center that can manage and control all smart devices in the home and has WiFi and BLE communication capabilities. The first device, the second device, and the fourth device are all smart devices that can be connected to the Internet via WiFi. The communication chip used is a WiFi&BLE dual-mode chip, and the first device, the second device, and the fourth device have joined the same home intranet communication network and can communicate with each other on the intranet. The first router belongs to the home level 1 router, and the second router belongs to the home level 2 router. Moreover, it is assumed that: the smart control hub (the third device), the second device, and the fourth device have all been successfully added to the home network and can communicate with each other on the intranet. The first device is a newly added device and needs to be discovered by the smart control hub and controlled after the corresponding connection is established.

[0100] In the above application environment, since the third device is under the first router and is in a different network segment from the second router, the third device cannot discover the first device using the traditional intranet discovery protocol.

[0101] When using the device discovery method of the present invention, first, the first device can successfully join the second router through the user's installation configuration, and the assigned IP address is, for example, 192.168.2.3. At the same time, after accessing the second router, the first device will start its own WiFi & BLE coexistence mode, that is, it can send BLE broadcasts while maintaining WiFi networking, and periodically send its own device information through WiFi multicast and BLE broadcasts so that other devices can receive it, thereby adding itself to the home intranet communication network. Other devices already in the home intranet communication network (including the second device, the third device, and the fourth device) all support WiFi & BLE dual-mode coexistence, so they can turn on WiFi multicast listening and scan BLE broadcasts at the same time. Since the first device is in the 192.168.2 network segment, the WiFi multicast sent by the first device cannot be forwarded to its WAN port by the second router, and therefore cannot be sent to the first router. That is, the second device, the third device, and the fourth device cannot detect the WiFi multicast information. However, the BLE broadcast sent by the first device can be scanned by the second device because it is not very far from the second device.

[0102] After the second device scans this broadcast message via Bluetooth, it can directly establish a Bluetooth connection with the first device. Then, by authenticating the first device, it is determined whether the first device is a legitimate device, and information exchange is performed only when it is a legitimate device. The specific content of the information exchange includes: the first device gives its own IP address to the second device, and the second device gives the IP address of the first device's intelligent control center (i.e., the third device). After the IP address exchange is completed, the second device will also send the IP address of the first device to the intelligent control center (i.e., the third device) through the existing intranet network, and at the same time notify the first device and the third device to initiate a TCP connection to each other.

[0103] Once the third device establishes a TCP connection with the first device, TCP-based intranet communication and device control can be achieved.

[0104] Finally, it should be noted that the steps in the method of the embodiment of the present invention can be adjusted in sequence, combined, or deleted according to actual needs.

[0105] In addition, a person skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing the hardware related to the device through a program, and the program can be stored in a computer-readable storage medium, which may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0106] In addition, those skilled in the art will appreciate that all or part of the steps in the various methods of the above embodiments can be completed by functional modules in the device, which will not be elaborated here.

[0107] The above disclosure is only a preferred embodiment of the present invention, which certainly cannot be used to limit the scope of the rights of the present invention. Ordinary technicians in this field can understand that all or part of the processes of the above embodiments and equivalent changes made in accordance with the claims of the present invention are still within the scope of the invention.

Claims

1. A device discovery method based on a communication system, applied to a first device in the communication system, wherein the communication system further includes a second device and a third device, wherein the second device and the third device are devices that have joined the communication system and are different devices, and the first device and the third device are mutually to-be-discovered devices, characterized in that: The method includes: When the first device is connected to the router, it sends preset type information, wherein the preset type information includes: Bluetooth broadcast message; receiving multiple Bluetooth connection requests and establishing a Bluetooth connection with a second device with the best Bluetooth connection signal strength, wherein the second device sends a Bluetooth connection request to the first device after hearing the Bluetooth broadcast message; sending its own IP address to the second device via the Bluetooth connection, so that the second device can send the IP address of the first device to the third device via intranet communication; and receiving the IP address of the third device sent by the second device via the Bluetooth connection; Establish a TCP connection with the third device according to the IP address of the third device.

2. The device discovery method based on the communication system according to claim 1, characterized in that: When the first device is connected to the router, sending the preset type information includes: When the first device is connected to the router, the preset type information is automatically sent; or, After the first device is connected to the router, it receives a trigger instruction input by a user and sends the preset type information according to the trigger instruction.

3. The device discovery method based on a communication system according to any one of claims 1 to 2, characterized in that: The preset type information further includes a WiFi multicast message. When the first device accesses the router, the preset type information is sent, including: When the first device is connected to the router, the first device sends the WiFi multicast message and the Bluetooth broadcast message alternately; The method further includes: When the third device and the first device are not cross-segment devices, receiving a response message sent by the third device, and obtaining the IP address of the third device according to the response message, wherein, after receiving the WiFi multicast message, the third device obtains the IP address of the first device and returns a response message to the first device; Establish a TCP connection with the third device according to the IP address of the third device.

4. A device discovery method based on a communication system, applied to a second device in the communication system, wherein the communication system further includes a first device and a third device, the second device and the third device are devices that have joined the communication system and are not the same device, and the first device and the third device are mutually to-be-discovered devices, characterized in that: The method includes: Listening to preset type information sent by the first device, wherein the first device sends the preset type information after accessing the router, and the preset type information includes: a Bluetooth broadcast message; Sending a Bluetooth connection request to the first device and establishing a Bluetooth connection with the first device, wherein the first device receives multiple Bluetooth connection requests and establishes a Bluetooth connection with the second device with the best Bluetooth connection signal strength; The IP address of the first device is received via the Bluetooth connection and sent to the third device via intranet communication; and the IP address of the third device is sent to the first device via the Bluetooth connection so that the first device establishes a TCP connection with the third device.

5. The device discovery method based on the communication system according to claim 4, characterized in that: Before implementing the exchange of IP addresses between the first device and the third device through the Bluetooth connection, the method further includes: Performing legitimacy verification on the first device; If the first device is a legitimate device, the IP addresses of the first device and the third device are exchanged through the Bluetooth connection.

6. A device discovery method based on a communication system, applied to a third device in the communication system, wherein the communication system further comprises a first device and a second device, the second device and the third device are devices that have joined the communication system and are not the same device, and the first device and the third device are mutually to-be-discovered devices, characterized in that: The method includes: Receiving the IP address of the first device sent by the second device; wherein, after accessing the router, the first device sends preset type information, receives multiple Bluetooth connection requests, and establishes a Bluetooth connection with the second device with the best Bluetooth connection signal strength, the first device sends its own IP address to the second device through the Bluetooth connection, so that the second device can send the IP address of the first device to the third device through intranet communication; and receiving the IP address of the third device sent by the second device through the Bluetooth connection, wherein the preset type information includes: a Bluetooth broadcast message; Establish a TCP connection with the first device according to the IP address of the first device.

7. A device for use in a communication system, comprising a processor and a memory storing a computer program, characterized in that: When executing the computer program, the processor implements the steps of the device discovery method described in any one of claims 1-3, and / or implements the steps of the device discovery method described in any one of claims 4-5, and / or implements the steps of the device discovery method described in claim 6.

8. An intranet communication system, characterized in that: include: The apparatus of claim 7; At least two connected routers.

Citation Information

Patent Citations

  • System and method for automatically finding and adding devices

    CN103873301A

  • Equipment connecting method and device

    CN107613023A

  • Method for achieving wireless screen transmission by autonomous networking among multiple devices, screen transmission end and receiving end

    CN111954162A

  • Screen projection method and system

    CN113225714A

  • Method and apparatus for fast communication of information during bluetooth discovery phase

    US20160269979A1