CN-122001854-A - Device discovery method and electronic device
Abstract
The application provides a device discovery method and electronic equipment, wherein the device discovery method can be applied to first equipment, the first equipment and second equipment are located in a first network, the device discovery method comprises the steps of receiving a first broadcast message through the first network, wherein the first broadcast message comprises first identification information of the second equipment, and sending a first response message to the second equipment through the first network when the first message is received through a wireless network and second identification information included in the first message is matched with the first identification information. The device discovery method of the application can discover the close-range devices in the same network more conveniently and rapidly aiming at the scene of connecting a plurality of devices in the same network, and is beneficial to improving the discovery efficiency of the close-range devices.
Inventors
- WANG HUA
Assignees
- 华为终端有限公司
Dates
- Publication Date
- 20260508
- Application Date
- 20241106
Claims (20)
- 1. A device discovery method, applied to a first device, the first device and a second device being in a first network, comprising: receiving a first broadcast message through the first network, wherein the first broadcast message comprises first identification information of the second equipment; and when a first message is received through a wireless network and second identification information included in the first message is matched with the first identification information, sending a first response message to the second device through the first network, wherein the first response message is a response to the first broadcast message.
- 2. The method according to claim 1, wherein the method further comprises: and ignoring the first broadcast message when the first message is not received through the wireless network.
- 3. The method according to claim 1 or 2, wherein prior to the receiving the first message over the wireless network, the method further comprises: And sending a second message through the wireless network, wherein the second message is used for discovering devices surrounding the first device.
- 4. The method according to claim 1 or 2, wherein the receiving the first message via the wireless network comprises: A first broadcast message is received over the wireless network, the first broadcast message including the second identification information.
- 5. The method according to any one of claims 1 to 4, wherein the first identification information includes an access point AP name of the second device under Wi-Fi, and wherein if the first identification information matches the second identification information, sending a first response message to the second device through the first network includes: And when the second identification information comprises the AP name, sending the first response message to the second equipment through the first network.
- 6. The method according to any one of claims 1 to 5, wherein the first broadcast message further comprises indication information for indicating that a wireless network function is turned on; before the receiving the first message via the wireless network, the method further comprises: And responding to the received first broadcast message, and starting the wireless network function according to the indication information when the first equipment does not start the wireless network function.
- 7. The method of claim 6, wherein said turning on said wireless network function when said first device does not turn on said wireless network function comprises: And when the first equipment does not start the wireless network function and the indication information is used for indicating to start the Wi-Fi function corresponding to the second equipment, starting the station STA function of Wi-Fi.
- 8. The method according to any one of claims 1 to 7, further comprising: Receiving a first message sent by the second device through the first network, wherein the first message is used for requesting to establish connection with the first device; and sending a second response message to the second device through the first network, wherein the second response message is a response to the first message.
- 9. A device discovery method, wherein the device discovery method is applied to a second device, the first device and the second device being in a first network, comprising: A first broadcast message is sent through the first network and a first message is sent through a wireless network, wherein the first broadcast message comprises first identification information of the second device, the first message comprises second identification information of the second device, and the first identification information is matched with the second identification information; And receiving a first response message sent by the first device through the first network, wherein the first response message is a response to the first broadcast message.
- 10. The method of claim 9, wherein prior to the sending the first message over the wireless network, the method further comprises: And receiving a second message sent by the first device through the wireless network, wherein the second message is used for discovering devices around the first device.
- 11. The method of claim 9, wherein the sending the first message over the wireless network comprises: and sending a first broadcast message through the wireless network, wherein the first broadcast message comprises the second identification information.
- 12. The method according to any of claims 9 to 11, wherein the first broadcast message further comprises indication information for indicating that a wireless network function is turned on.
- 13. The method according to any one of claims 9 to 12, further comprising: sending a first message to the first device through the first network, wherein the first message is used for requesting to establish connection with the first device; And receiving the first equipment through the first network and sending a second response message, wherein the second response message is a response to the first message.
- 14. A device discovery method, wherein the device discovery method is applied to a second device, the second device and a first device being in a first network, the method comprising: Transmitting a second broadcast message over the wireless network; Receiving, over the wireless network, a first response message including address information of the first device in the first network, wherein the first response message is a response to the second broadcast message; And when the address information of the first device is included in the device address list stored by the second device, displaying the identification information of the first device.
- 15. The device discovery method of claim 14, further comprising: And sending a first message to the first equipment through the first network, wherein the first message is used for requesting to establish connection with the first equipment.
- 16. The device discovery method of claim 15, further comprising: And receiving a second response message sent by the first device through the first network, wherein the second response message is a response to the first message.
- 17. An electronic device, the electronic device comprising: One or more processors; One or more memories; and one or more programs, wherein the one or more programs are stored in the one or more memories, the one or more programs comprising instructions, which when executed by the one or more processors, cause the electronic device to perform the device discovery method of any of claims 1-16.
- 18. A readable storage medium, characterized in that a program or an instruction is stored in the readable storage medium, which when executed, implements the device discovery method according to any one of claims 1 to 16.
- 19. A chip comprising circuitry for performing the device discovery method of any one of claims 1 to 16.
- 20. A program product having a program or instructions stored therein which, when executed, implements the device discovery method of any one of claims 1 to 16.
Description
Device discovery method and electronic device Technical Field The present application relates to the technical field of electronic devices, and in particular, to a device discovery method and an electronic device. Background Currently, the internet application is expanding from the consumption field to the production field, and is deeply fused with the economic fields of the entities such as industry, energy and the like. The new generation industrial network takes' equipment networking and network interconnection (internet protocol, IP) as key characteristics, and each equipment can be accessed into the industrial network through an Ethernet or wireless fidelity (WIRELESS FIDELITY, wi-Fi) network, so that the new generation industrial network has the capabilities of fully sensing data deeply, transmitting interactive data in real time and deploying artificial intelligence (ARTIFICIAL INTELLIGENCE, AI) computing power as required. In an actual industrial application scenario, a scenario that data collection or service cooperation needs to be performed between 2 short-distance devices through a network often occurs, for example, a machine tool a needs to perform service cooperation with a machine tool B beside the machine tool a. Although all of the 2 machine tools are connected to the network through an ethernet network or Wi-Fi, the service cooperation of the two requires one party to discover the other, i.e. the device discovery. With the increasing production scale, the number of devices connected in the same network is increasing, and how to implement high-efficiency devices in a large number of devices has been found to be a problem to be solved urgently. Disclosure of Invention The application provides a device discovery method and electronic equipment, which can discover the short-distance devices in the same network more conveniently and rapidly aiming at the scene of connecting a plurality of devices in the same network, and are beneficial to improving the discovery efficiency of the short-distance devices in the same network. In a first aspect, the application provides a device discovery method, which can be applied to a first device, wherein the first device and a second device are located in a first network, and the device discovery method comprises the steps of receiving a first broadcast message through the first network, wherein the first broadcast message comprises first identification information of the second device, and sending a first response message to the second device through the first network when the first message is received through a wireless network and second identification information included in the first message is matched with the first identification information, wherein the first response message is a response to the first broadcast message. Based on the technical scheme, after the first device receives the first broadcast message through the first network, the first response message can be replied only when the first message is received and the second identification information included in the first message is matched with the first identification information, but the first response message is not replied for all broadcast messages, so that the discovery device is initiated to distinguish the short-distance device from the long-distance device, and the device discovery efficiency is improved. In some possible implementations, when a first message is received over the wireless network and the second identification information included in the first message matches the first identification information, sending a first response message over the first network to the second device includes sending the first response message over the first network to the second device when the first message is received over the wireless network and the second identification information included in the first message is the same as the first identification information. With reference to the first aspect, in certain implementation manners of the first aspect, the method further includes ignoring the first broadcast message when the first message is not received through the wireless network. With reference to the first aspect, in certain implementations of the first aspect, before receiving the first message over the wireless network, the method further includes sending a second message over the wireless network, the second message for discovering devices surrounding the first device. Based on the technical scheme, the first device can actively search the surrounding devices to acquire the second identification information of the surrounding devices, and can selectively send the first response message by judging whether the second identification information is matched with the first identification information in the first broadcast message, so that the distance of the surrounding devices can be further differentiated. With reference to the first aspect, in certain implementations of the first aspec