Method, electronic device and conversion device for searching for a smart device
By listening to UDP ports and converting them to mDNS services, the problem of inconsistent UDP data formats in cross-vendor or cross-platform smart device searches is solved, enabling efficient smart device discovery and improving search success rate and data security.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-30
- Publication Date
- 2026-03-17
AI Technical Summary
In cross-vendor or cross-platform smart device search scenarios, the inconsistent UDP data formats between terminal devices and smart devices result in a low search success rate.
By listening to UDP ports, the device information of smart devices is decoded and converted into mDNS service. Terminal devices can directly obtain the information of smart devices through mDNS service, realizing cross-platform search and discovery.
It improves the success rate of smart device search in cross-vendor or cross-platform scenarios, and the data transmission process is not limited by manufacturers or platforms, thus improving data security and reliability.
Smart Images

Figure CN115987939B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of smart homes, and more specifically, to a method, storage medium, electronic device, and conversion device for searching smart devices. Background Technology
[0002] With the development of IoT technology, more and more smart devices are entering homes. Users often need to search for and control these smart devices through mobile phones and other terminal devices. Currently, the most widely used method for searching smart devices is UDP (User Datagram Protocol) broadcasting. Under the UDP protocol, smart devices and terminal devices define corresponding sending and receiving ports. After receiving a request on a fixed port, the smart device reports its information to the terminal device, allowing the terminal device to scan for all smart devices within its local area network. This search process is susceptible to communication interference from other devices, resulting in low data security and reliability.
[0003] A method for searching for smart devices is disclosed in related technologies, including: Step 1, the smart device listens to a fixed UDP IP address and communication port; Step 2, the terminal device sends a device search command to the fixed UDP address and UDP communication port; Step 3, when the smart device receives the device search command sent by the terminal device using UDP unicast, it uses a public key to decrypt it using TEA, then extracts the IP address and UDP communication port of the terminal device, and replies with a UDP unicast data packet to the terminal device; Step 4, when the terminal device receives the UDP unicast data packet replied by the smart device, it extracts the information of the smart device from the UDP unicast data packet and begins job communication with the smart device.
[0004] In the process of implementing the embodiments of this disclosure, at least the following problems have been found in the related art:
[0005] While improving data security and reliability during smart device search, the search process requires that the data formats sent and received by the terminal device and the smart device be completely consistent. However, UDP data format is proprietary, and different manufacturers or platforms often support different UDP data formats. This results in a lower success rate for terminal devices searching for smart devices in cross-vendor or cross-platform smart device search scenarios.
[0006] 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 prior art that does not constitute prior art known to those skilled in the art. Summary of the Invention
[0007] 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.
[0008] This disclosure provides a method, storage medium, electronic device, and conversion device for searching smart devices, to improve the success rate of smart device searches in cross-vendor or cross-platform smart device search scenarios.
[0009] In some embodiments, the method includes: listening to a UDP port; obtaining device information of one or more smart devices based on the listened messages; determining the mDNS service of the smart device based on the device information; and multicasting the mDNS service of the smart device for querying by terminal devices.
[0010] Optionally, determining the mDNS service of the smart device based on the device information includes: querying the device information in the mDNS service list; if the device information exists in the mDNS service list, then retrieving the mDNS service of the smart device upon receiving a query instruction sent by the terminal device; if the device information does not exist in the mDNS service list, then registering the mDNS service based on the device information.
[0011] Optionally, querying the device information in the mDNS service list includes: querying the MAC address of the smart device in the mDNS service list; or, using the MAC address in the device information as identification information to determine the service name of the smart device, and querying the service name of the smart device in the mDNS service list.
[0012] Optionally, registering the mDNS service based on the device information includes: registering an mDNS service name based on the device information; and saving the device information as service parameters associated with the mDNS service name.
[0013] Optionally, saving the device information as a service parameter associated with the mDNS service name includes: recording the device information in the form of key-value pairs as a service parameter of the smart device.
[0014] Optionally, after registering the mDNS service name based on the device information, the method further includes: adding the mDNS service name to the mDNS service list.
[0015] Optionally, the method further includes: obtaining the online status of each smart device in the mDNS service list; and deleting the offline smart device from the mDNS service list if the smart device is offline.
[0016] In some embodiments, the storage medium includes a stored program, wherein the program executes the methods described above when it runs.
[0017] In some embodiments, the electronic device includes a memory and a processor, wherein the memory stores a computer program and the processor is configured to perform the methods described above through the computer program.
[0018] In some embodiments, the conversion device includes: a conversion device body; and the aforementioned electronic device, which is mounted on the conversion device body.
[0019] The method, storage medium, electronic device, and conversion device for searching smart devices provided in this disclosure can achieve the following technical effects:
[0020] By listening on UDP ports to obtain information on supported UDP data formats, device information for smart devices that support UDP is identified. Based on this device information, the corresponding mDNS service for the smart device is determined, and this service is multicast to the mDNS port. Thus, when a terminal device searches for a smart device, it can directly obtain the device information through the smart device's mDNS service, achieving device discovery. The mDNS service's sending and receiving process is not limited by manufacturer or platform; therefore, even when the smart device supports UDP format and the smart device and terminal device belong to different manufacturers or platforms, device discovery can still be achieved through the mDNS service. This effectively improves the success rate of smart device searches in cross-vendor or cross-platform smart device search scenarios.
[0021] The above general description and the description below are exemplary and illustrative only and are not intended to limit this application. Attached Figure Description
[0022] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0023] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0024] Figure 1 This is a schematic diagram of the hardware environment for a method for searching smart devices provided in an embodiment of this disclosure;
[0025] Figure 2This is a schematic diagram of a method for searching smart devices provided in an embodiment of this disclosure;
[0026] Figure 3 This is a schematic diagram of another method for searching smart devices provided in an embodiment of this disclosure;
[0027] Figure 4 This is a schematic diagram of another method for searching smart devices provided in an embodiment of this disclosure;
[0028] Figure 5 This is a schematic diagram of another method for searching smart devices provided in an embodiment of this disclosure;
[0029] Figure 6 This is a schematic diagram of a device for searching smart devices provided in an embodiment of this disclosure;
[0030] Figure 7 This is a schematic diagram of a conversion device provided in an embodiment of this disclosure. Detailed Implementation
[0031] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.
[0032] It should be noted that the terms "first," "second," etc., 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 so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0033] With the development of IoT technology, more and more smart devices are entering homes. Users can control these smart devices via smartphones, personal computers, and other terminal devices, largely eliminating spatial limitations. Before actually controlling them, users often need to search for these smart devices using their smartphones, personal computers, or other terminal devices.
[0034] Currently, the most widely used method for searching smart devices is based on UDP (User Datagram Protocol) broadcasting. Under the UDP protocol, smart devices and terminal devices define corresponding sending and receiving ports. After receiving a request on a fixed port, the smart device reports its information to the terminal device, allowing the terminal device to scan for all smart devices within its local area network. This search process is susceptible to communication interference from other devices, resulting in low data security and reliability.
[0035] To improve data security and reliability, a method for searching for smart devices is disclosed in related technologies, including: Step 1, the smart device listens to a fixed UDP IP address and communication port; Step 2, the terminal device sends a device search command to the fixed UDP address and UDP communication port; Step 3, when the smart device receives the device search command sent by the terminal device using UDP unicast, it uses a public key to decrypt it using TEA, then extracts the IP address and UDP communication port of the terminal device, and replies with a UDP unicast data packet to the terminal device; Step 4, when the terminal device receives the UDP unicast data packet replied by the smart device, it extracts the information of the smart device from the UDP unicast data packet and begins job communication with the smart device.
[0036] While related technologies have improved data security and reliability during smart device search to some extent, the search process requires that the data formats sent and received by the terminal device and the smart device be completely consistent. However, UDP data format is proprietary, and different manufacturers or platforms often support different UDP data formats. Therefore, if the smart device and the terminal device support different UDP data formats, the terminal device cannot perform a smart device search. This results in a low success rate for terminal devices searching for smart devices in cross-vendor or cross-platform smart device search scenarios.
[0037] To improve the success rate of terminal devices searching for smart devices in cross-vendor or cross-platform smart device search scenarios, this application provides a method, storage medium, electronic device, and conversion device for searching smart devices.
[0038] Figure 1 This is a schematic diagram of the hardware environment for a method of searching for smart devices provided in an embodiment of this disclosure. (In conjunction with...) Figure 1 As shown, the hardware environment includes a smart device 10, a conversion device 20, and a terminal device 30. The smart device 10 may be a single device or multiple devices.
[0039] The smart device 10 and the conversion device 20 communicate via the UDP protocol, supporting the same UDP data format. The conversion device 20 and the terminal device 30 communicate based on the mDNS (multicast DNS) protocol.
[0040] Among them, the terminal device is the user terminal, which can be a mobile phone, personal computer, or other device capable of inputting control information. Users control the smart devices and conversion devices through the terminal device. The smart device is a home appliance that communicates with the terminal device to transmit data or execute control commands initiated by the terminal device, including but not limited to smart air conditioners, smart refrigerators, smart robot vacuum cleaners, and smart cooking appliances.
[0041] The conversion device is also a home appliance that communicates with the terminal device to transmit data or execute control commands sent by the terminal device, such as a smart air conditioner, smart refrigerator, smart robot vacuum cleaner, and smart cooking equipment. In this case, the main difference between the conversion device and the aforementioned smart devices is that it can communicate based on both UDP and mDNS protocols. In other embodiments, the conversion device may also be a stand-alone data processing device without actual home appliance functions.
[0042] Specifically, the conversion device includes at least two functional modules: a decoding module and a packet conversion module. The decoding module decodes received UDP broadcast messages to obtain the device information of the smart device. The packet conversion module converts the decoded device information into mDNS service, thus achieving format conversion.
[0043] Optionally, the conversion device also includes a management module capable of managing the generated mDNS services. Specifically, the management module manages the mDNS services through an mDNS service list. When a new smart device comes online, the mDNS service corresponding to the new smart device is added to the mDNS service list. When a smart device in the mDNS service list goes offline, the mDNS service corresponding to the offline smart device is removed from the mDNS service list.
[0044] Combination Figure 2 As shown, this disclosure provides a method for searching smart devices, including:
[0045] S201, the conversion device listens on the UDP port.
[0046] S202, the conversion device obtains device information of one or more smart devices based on the messages it listens to.
[0047] The conversion device decodes the monitored UDP broadcast messages according to the data format specified by the manufacturer, thereby obtaining the device information of the smart device.
[0048] S203, The conversion device determines the mDNS service for the smart device based on the device information.
[0049] S204, Convert the mDNS service of the multicast smart device for terminal devices to query.
[0050] The mDNS service of the multicast intelligent device here refers to the conversion device multicasting the mDNS service to a specific mDNS port. Optionally, the specific mDNS port is port 5353 in the local area network.
[0051] The method for searching smart devices provided in this disclosure listens to a UDP port to obtain information supporting the UDP data format, thereby identifying device information for smart devices that support the UDP format. Based on this device information, the corresponding mDNS service for the smart device is determined, and the mDNS service for the smart device is multicast to the mDNS port. In this way, when searching for smart devices, the terminal device can directly obtain the device information of the smart device through the smart device's mDNS service, thus achieving the search and discovery of the smart device. mDNS is a standard protocol, and the data transmission and reception process is not limited by manufacturer or platform. Therefore, terminal devices from different manufacturers or different platforms can receive the mDNS service containing the device information of the smart device sent by the conversion device, thereby enabling the terminal device to search and discover both the smart device and the conversion device. It is evident that in cross-manufacturer or cross-platform smart device search scenarios, the method for searching smart devices provided in this disclosure effectively improves the search success rate.
[0052] Optionally, the device information includes the device's MAC (Media Access Control) address. Each MAC address corresponds uniquely to a smart device; therefore, a unique smart device can be identified based on its MAC address, enabling the search and discovery of smart devices.
[0053] Optionally, the device information may also include the device product number, device software version, and other information. This allows the device information to provide a more detailed representation of the actual condition of the smart device.
[0054] Combination Figure 3 As shown, this disclosure provides another method for searching smart devices, including:
[0055] S301, the conversion device listens on a UDP port.
[0056] S302, the conversion device obtains device information of one or more smart devices based on the messages it listens to.
[0057] S303, the conversion device queries the mDNS service list for device information.
[0058] S304. If device information exists in the mDNS service list, the conversion device will retrieve the smart device's mDNS service upon receiving a query command from the terminal device.
[0059] If the smart device's information already exists in the mDNS service list, it means the smart device has already registered for the mDNS service. The mDNS service information for the smart device can be obtained by directly retrieving historical information, thus enabling the search and discovery of the smart device. In this case, mDNS service registration is not required.
[0060] S305, if the device information is not found in the mDNS service list, the conversion device will register the mDNS service based on the device information.
[0061] S306, Convert the mDNS service of the multicast smart device for the terminal device to query.
[0062] The method for searching smart devices provided in this disclosure involves a conversion device listening on a UDP port to obtain information about devices supporting the UDP data format, thereby identifying device information for smart devices that support UDP. Based on this device information, the corresponding mDNS service for the smart device is determined, and the mDNS service for the smart device is multicast to the mDNS port. In this way, when searching for smart devices, the terminal device can directly obtain the device information of the smart device through its mDNS service, thus achieving device discovery. The sending and receiving process of the mDNS service is not limited by manufacturer or platform; therefore, even when the smart device supports the UDP format and the smart device and terminal device belong to different manufacturers or platforms, device discovery can still be achieved through the mDNS service. This effectively improves the success rate of smart device searches in cross-manufacturer or cross-platform smart device search scenarios.
[0063] Furthermore, when a smart device comes online, the system checks its existing mDNS service list to see if the device already exists. If it does, it means the smart device has previously registered for the mDNS service, and a simple call is all it takes to determine its device information and complete the search for the device. This approach, where service registration is only performed if the smart device has not previously registered for the mDNS service, simplifies the logic and avoids program redundancy.
[0064] Optionally, the conversion device queries the mDNS service list for device information, including: using the MAC address from the device information as identification information to determine the service name of the smart device, and then querying the mDNS service list for that smart device's service name. This naming method, using the MAC address as identification information, ensures a one-to-one correspondence between the service name and the smart device, thus accurately determining whether the smart device already exists in the mDNS service list. Furthermore, querying the smart device based solely on the name eliminates the need to retrieve more device information, simplifying the query process.
[0065] Optionally, the conversion device uses the MAC address from the device information as identification information to determine the service name of the smart device, including: determining "MAC._transfer._udp.local" as the mDNS service name of the smart device. Here, MAC refers to the MAC address of the smart device. In this way, using the MAC address from the device information as identification information ensures the identification of a unique corresponding smart device, while also facilitating querying by terminal devices by using a unified naming format.
[0066] Optionally, the conversion device queries device information in the mDNS service list, including: the conversion device queries the mDNS service list for the MAC address of the smart device. Since there is a one-to-one correspondence between the MAC address and the smart device, querying by MAC address can accurately determine whether the smart device already exists in the mDNS service list.
[0067] Optionally, the conversion device registers an mDNS service device based on the device information, which includes: registering an mDNS service name based on the device information and saving the device information as service parameters associated with the mDNS service name. In this way, the device information of the smart device can be directly determined based on the mDNS service name, enabling the search and discovery of smart devices.
[0068] Here, device information can be saved as a TXT text file. When the amount of device information to be saved is small, the TXT text format is a convenient way to store the data. In other embodiments, data can also be stored through a database, written to memory, or other methods. The specific storage method can be selected based on the amount of data to be saved.
[0069] Optionally, the conversion device saves device information as service parameters associated with the mDNS service name, including recording device information in key-value pairs as service parameters for the smart device. Recording device information in key-value pairs means that one "key" corresponds to one "value" in the device information. For example, the device product number of a smart device corresponds to the record "0001", and the device software version corresponds to the record "1.0.0". This allows for simple and accurate recording of various device information for the smart device.
[0070] Optionally, after the conversion device registers the mDNS service based on the device information, it also includes adding the mDNS service name to the mDNS service list. This adds newly registered smart devices to the mDNS service list, enabling automatic updates to the mDNS service list. During subsequent smart device searches, the mDNS service list can be used to determine whether the current smart device has already completed mDNS service registration, avoiding duplicate registration of the same smart device's mDNS service. Furthermore, it allows for direct retrieval of device information even if registration is complete, thus simplifying the process.
[0071] Optionally, the method for searching smart devices further includes: converting the device to obtain the online status of each smart device in the mDNS service list. If a smart device is offline, it is removed from the mDNS service list. This achieves real-time updates to the mDNS service list, allowing the identification of smart devices that are currently online.
[0072] Optionally, the conversion device obtains the online status of each smart device in the mDNS service list, including: the conversion device determines the online status of a smart device based on its online announcement or offline notification. Upon receiving an offline notification from a smart device, the conversion device determines that the smart device is offline.
[0073] Combination Figure 4 As shown, this disclosure provides another method for searching smart devices, including:
[0074] S401, the conversion device monitors the UDP port.
[0075] S402, the conversion device obtains device information of one or more smart devices based on the messages it listens to.
[0076] S403, the conversion device uses the MAC address in the device information as identification information to determine the service name of the smart device.
[0077] S404, the conversion device obtains the online status of each smart device in the mDNS service.
[0078] S405, when a smart device is offline, the conversion device removes the offline smart device from the mDNS service list.
[0079] S406, the conversion device checks whether the service name exists in the mDNS service list.
[0080] If it exists, in step S407, the conversion device keeps the DNS service list unchanged and, upon receiving a query command from the terminal device, retrieves the mDNS service of the smart device.
[0081] If it does not exist, S408, the conversion device registers the mDNS service name according to the device information and saves the device information as service parameters associated with the mDNS service name.
[0082] S409, the conversion device adds the mDNS service name to the mDNS service list.
[0083] S410 converts the mDNS service of the multicast smart device for use by terminal devices.
[0084] Corresponding to the method described above, the conversion device can be divided into three functional modules: a decoding module, a data packet conversion module, and a management module. The decoding module is responsible for decoding the received UDP data packets to obtain the device information of the smart device. The data packet conversion module is responsible for determining whether the smart device already exists in the existing mDNS service list based on the decoded device information. If the smart device is not in the mDNS service list, it registers the mDNS service based on the decoded device information, completing the data conversion from UDP to mDNS. The management module is responsible for managing the mDNS service list. It adds newly registered mDNS services to the list and removes offline smart devices from the list, achieving automatic updates to the mDNS service list. This facilitates the next round of format conversion when new smart devices come online.
[0085] The method for searching smart devices provided in this disclosure involves a conversion device listening on a UDP port to obtain information about devices supporting the UDP data format, thereby identifying device information for smart devices that support UDP. The MAC address in the device information is used as an identifier to determine the mDNS service name. Then, the system checks whether the service name already exists in the mDNS service list to determine if the currently online smart device has registered for the mDNS service. If it has already registered for the mDNS service, the system retrieves the smart device's mDNS service upon receiving a query command from the terminal device, without needing to re-register. If the currently online smart device has not registered for the mDNS service, the system registers the service name based on the device information and stores the device information under that service name. The system multicasts the smart device's mDNS service to the mDNS port for the terminal device to query. Thus, when searching for smart devices, the terminal device can directly obtain the device information of the smart device through its mDNS service, thereby achieving device discovery. The mDNS service transmission and reception process is not limited by manufacturer or platform; therefore, even when the smart device supports the UDP format and the smart device and terminal device belong to different manufacturers or platforms, device discovery can still be achieved through the mDNS service. In cross-vendor or cross-platform smart device search scenarios, it effectively improves the success rate of smart device searches.
[0086] During this process, the online status of smart devices in the mDNS service list is detected, and the mDNS service corresponding to the offline smart device is deleted in a timely manner when the device is offline, so as to realize the real-time update of the mDNS service list and enable the terminal device to search for the currently online smart devices.
[0087] Combination Figure 5 As shown, this disclosure provides another method for searching smart devices, including:
[0088] S501, the conversion device monitors the UDP port.
[0089] S502, Smart Device Network Access.
[0090] S503, Smart Device Broadcast Data Packet.
[0091] The data packets here are in UDP format, including online announcements. The conversion device can obtain the device information of the smart device based on the data announcements. Correspondingly, the smart device broadcasts data packets to UDP data ports within the local area network.
[0092] S504, the conversion device obtains device information of one or more smart devices based on the messages it listens to.
[0093] S505, the conversion device determines the mDNS service for the smart device based on the device information.
[0094] S506, mDNS service for multicast smart devices in the conversion equipment.
[0095] S507, the terminal device sends a query command.
[0096] S508, the conversion device responds to the query command and sends device information to the terminal device.
[0097] The method for searching smart devices provided in this disclosure involves a conversion device listening on a UDP port to obtain information about devices supporting the UDP data format, thereby identifying device information for smart devices that support UDP. Based on this device information, the corresponding mDNS service for the smart device is determined, and the mDNS service for the smart device is multicast to the mDNS port. In this way, when searching for smart devices, the terminal device can directly obtain the device information of the smart device through its mDNS service, thus achieving device discovery. The sending and receiving process of the mDNS service is not limited by manufacturer or platform; therefore, even when the smart device supports the UDP format and the smart device and terminal device belong to different manufacturers or platforms, device discovery can still be achieved through the mDNS service. This effectively improves the success rate of smart device searches in cross-manufacturer or cross-platform smart device search scenarios.
[0098] Optionally, the query command sent by the terminal device is adapted to the registered mDNS service. For example, if the mDNS service name is "MAC._transfer._udp.local", the query command queries the mDNS service of type "transfer._udp.local".
[0099] Optionally, the conversion device sending device information to the terminal device includes: the conversion device sending device information recorded in TXT text format to the terminal device.
[0100] Combination Figure 6 As shown, this embodiment of the disclosure provides an electronic device 200, including a processor 61 and a memory 62. Optionally, the electronic device may further include a communication interface 63 and a bus 64. The processor 61, communication interface 63, and memory 62 can communicate with each other via the bus 64. The communication interface 63 can be used for information transmission. The processor 61 can invoke logical instructions in the memory 62 to execute the method for searching for smart devices described in the above embodiment.
[0101] Furthermore, the logical instructions in the aforementioned memory 62 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium.
[0102] The memory 62, 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 disclosure. The processor 61 executes functional applications and data processing by running the program instructions / modules stored in the memory 62, thereby implementing the method for searching for smart devices described in the above embodiments.
[0103] The memory 62 may include a program storage area and a data storage area. The program storage area may store the operating system and applications 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 62 may include high-speed random access memory and may also include non-volatile memory.
[0104] Combination Figure 7 As shown, this disclosure provides a conversion device 100, including a conversion device body and the aforementioned electronic device 200. The electronic device 200 is installed in the conversion device 100 body. The installation relationship described herein is not limited to placement within the product, but also includes installation connections with other components of the product, including but not limited to physical connections, electrical connections, or signal transmission connections. Those skilled in the art will understand that the electronic device 200 can be adapted to feasible product bodies to achieve other feasible embodiments.
[0105] This disclosure provides a computer-readable storage medium storing computer-executable instructions configured to perform the above-described method for searching smart devices.
[0106] The aforementioned computer-readable storage medium may be a transient computer-readable storage medium or a non-transitory computer-readable storage medium.
[0107] The technical solutions of this disclosure 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 method described in this disclosure. The aforementioned storage medium can be a non-transitory storage medium, including: a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, and other media capable of storing program code; it can also be a transient storage medium.
[0108] The foregoing description and accompanying drawings fully illustrate embodiments of this disclosure 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 operation 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. Similarly, the term “and / or” as used in this application means including one or more of the associated listed items and all possible combinations thereof. Additionally, when used in this application, the term "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. Without further limitations, an element defined by the phrase "comprises a..." does not exclude the presence of other identical elements in the process, method, or apparatus that includes said element. In this document, each embodiment may focus on 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, the relevant parts can be referred to the description of the method section.
[0109] 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 disclosure. 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.
[0110] 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 coupling or direct coupling or communication connection between the shown or discussed units may be through some interfaces, and the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the units may be selected to implement this embodiment according to actual needs. Furthermore, the functional units in the embodiments of this disclosure 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.
[0111] 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 disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing 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 that 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. In the descriptions corresponding to the flowcharts and block diagrams in the accompanying drawings, the operations or steps corresponding to different blocks may also occur in a different order than disclosed in the description, and sometimes there is no specific order between different operations or steps. For example, two consecutive operations or steps may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. Each block in a block diagram and / or flowchart, and combinations of blocks in a block diagram and / or flowchart, can 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.
[0112] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.
Claims
1. A method for searching for a smart device, the method comprising: The method comprises: listening to a UDP port to obtain one or more smart devices broadcasting UDP format messages; obtaining device information of the one or more smart devices according to the listened messages; determining mDNS services of the smart devices according to the device information; multicasting the mDNS services of the smart devices for terminal devices to query.
2. The method of claim 1, wherein, The determining of the mDNS services of the smart devices according to the device information comprises: inquiring the device information in an mDNS service list; if the device information exists in the mDNS service list, calling the mDNS services of the smart devices upon receiving a query instruction sent by a terminal device; if the device information does not exist in the mDNS service list, registering mDNS services according to the device information.
3. The method of claim 2, wherein, The inquiring of the device information in the mDNS service list comprises: taking a MAC address in the device information as identification information to determine a service name of the smart device and inquire the service name of the smart device in the mDNS service list.
4. The method of claim 2, wherein, The registering of the mDNS services according to the device information comprises: registering an mDNS service name according to the device information; saving the device information as service parameters associated with the mDNS service name.
5. The method of claim 4, wherein, The saving of the device information as service parameters associated with the mDNS service name comprises: recording the device information in the form of key-value pairs as the service parameters of the smart device.
6. The method of claim 4, wherein, After the registering of the mDNS service name according to the device information, the method further comprises: adding the mDNS service name to the mDNS service list.
7. The method according to any one of claims 1 to 6, characterized in that, The method further comprises: obtaining online states of each smart device in the mDNS service list; deleting an offline smart device from the mDNS service list in the case that the smart device is offline.
8. A computer readable storage medium, characterized in that, The computer readable storage medium comprises a stored program, wherein the program is executed to perform the method of any one of claims 1 to 7. 9.An electronic device comprising a memory and a processor, the electronic device characterized by, The memory stores a computer program, and the processor is configured to execute the method of any one of claims 1 to 7 through the computer program.
10. A conversion device, characterized by The electronic device comprises: a conversion device body; and the electronic device of claim 9 is installed in the conversion device body.
Citation Information
Patent Citations
Method and device for updating service state of mDNS gateway
CN111131452A
System, method and device for realizing automatic discovery and automatic test for production line instrument equipment, processor and storage medium thereof
CN114567666A
Method and apparatus for performing discovery using MDNS in wireless communication system
US20180176856A1
Wide area service discovery for internet of things
US20180191666A1