Device discovery method, apparatus, device, and storage medium
By adding custom fields and cell formats to the management frame, the problem of limited device information transmission is solved, enabling more efficient and accurate device discovery, applicable to more types of devices, and reducing user interference and power consumption.
Patent Information
- Application Number
- CN202110164894.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-02-05
- Publication Date
- 2025-12-09
- Estimated Expiration
- 2041-06-07
AI Technical Summary
Existing device discovery methods have limited device information transmission and do not support all devices, leading to inaccurate discovery and potential user interference, especially for devices that do not support AP functionality or have not enabled AP mode.
Custom fields are added to the management frame to transmit more device information, including custom cell formats. This supports the transmission of custom fields in action frames, probe frames, and beacon frames. Combined with distance judgment and application context awareness logic, this improves detection accuracy.
It achieves more efficient and accurate device discovery, reduces user interference, saves power, and expands the application scenarios of device discovery to be applicable to more types of devices.
Smart Images

Figure CN114885319B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present application relate to the technical field of communication, and particularly relate to a device discovery method, apparatus, device and storage medium. BACKGROUND
[0002] Device discovery refers to a process of letting a first device know the existence of a second device.
[0003] In the related art, a second device performs device discovery through an access point (AP) function. For example, the second device broadcasts a beacon frame, and the beacon frame carries a service set identifier (SSID) field. A first device learns device information of the second device through the SSID field, and thus discovers the second device. SUMMARY
[0004] Embodiments of the present application provide a device discovery method, apparatus, device and storage medium, which add a custom field in a management frame to transmit more device information, and thus achieve more efficient and more accurate device discovery. The technical solution is as follows:
[0005] In one aspect, a device discovery method is provided, which is applied to a first device, and the method includes:
[0006] interacting with a second device through n management frames, at least one of the n management frames including a custom field, n being a positive integer;
[0007] obtaining device information of the second device according to the custom field in a first management frame, the first management frame being a management frame sent by the second device in the at least one management frame.
[0008] In another aspect, a device discovery method is provided, which is applied to a second device, and the method includes:
[0009] interacting with a first device through n management frames, at least one of the n management frames including a custom field, n being a positive integer;
[0010] wherein the custom field in a first management frame of the at least one management frame is used to carry device information of the second device, and the first management frame is a management frame sent by the second device.
[0011] In another aspect, a device discovery apparatus is provided, which is applied to a first device, and the apparatus includes:
[0012] interact with a second device through n management frames, at least one of the n management frames including a custom field, n being a positive integer;
[0013] a device discovery module configured to obtain device information of the second device according to the custom field in a first management frame, the first management frame being a management frame sent by the second device among the at least one management frame.
[0014] In another aspect, an embodiment of the present application provides a device discovery apparatus applied to a second device, the apparatus comprising:
[0015] an interaction module configured to interact with a first device through n management frames, at least one of the n management frames including a custom field, n being a positive integer;
[0016] The custom field in a first management frame among the at least one management frame is configured to carry device information of the second device, the first management frame being a management frame sent by the second device.
[0017] In yet another aspect, an embodiment of the present application provides a first device, the first device comprising a processor, a memory and a transceiver;
[0018] The transceiver is configured to interact with a second device through n management frames, at least one of the n management frames including a custom field, n being a positive integer;
[0019] The processor is configured to obtain device information of the second device according to the custom field in a first management frame, the first management frame being a management frame sent by the second device among the at least one management frame.
[0020] In yet another aspect, an embodiment of the present application provides a second device, the second device comprising a processor, a memory and a transceiver;
[0021] The transceiver is configured to interact with a first device through n management frames, at least one of the n management frames including a custom field, n being a positive integer;
[0022] The custom field in a first management frame among the at least one management frame is configured to carry device information of the second device, the first management frame being a management frame sent by the second device.
[0023] In yet another aspect, an embodiment of the present application provides a computer readable storage medium, the computer readable storage medium storing a computer program, the computer program being loaded and executed by a processor to implement the device discovery method according to the above aspect.
[0024] In yet another aspect, an embodiment of the present application provides a computer program product, which comprises computer instructions stored in a computer readable storage medium. A processor of a computer device reads the computer instructions from the computer readable storage medium, and the processor executes the computer instructions to enable the computer device to perform the device discovery method in the above aspect.
[0025] The technical scheme provided by the embodiments of the present application can bring the following beneficial effects:
[0026] When the first device and the second device are performing device discovery, the first device and the second device interact through n management frames, at least one management frame of the n management frames carries a custom field, in addition to the SSID field provided in the related art, the first device can perform device discovery on the second device according to the custom field in the first management frame from the second device, which is conducive to the second device transmitting more device information to the first device through the custom field, thereby realizing more efficient and more accurate device discovery. BRIEF DESCRIPTION OF DRAWINGS
[0027] Figure 1 is a schematic diagram of an Internet of Things system provided by an example embodiment of the present application;
[0028] Figure 2 is a flowchart of a device discovery method provided by an example embodiment of the present application;
[0029] Figure 3 is a schematic diagram of the format of a first information element provided by an example embodiment of the present application;
[0030] Figure 4 is a schematic diagram of information element splicing provided by an example embodiment of the present application;
[0031] Figure 5 is a schematic diagram of the format of a first information element provided by an example embodiment of the present application;
[0032] Figure 6 is a schematic diagram of an action frame defined in a protocol;
[0033] Figure 7 is a schematic diagram of a probe frame defined in a protocol;
[0034] Figure 8 is a schematic diagram of a beacon frame defined in a protocol;
[0035] Figure 9 is a flowchart of a device discovery method provided by an example embodiment of the present application;
[0036] Figure 10 is a flowchart of a device discovery method provided by an example embodiment of the present application;
[0037] Figure 11 is a flowchart of a device discovery method provided by an example embodiment of the present application;
[0038] Figure 12 is a flowchart of a device discovery method provided by an example embodiment of the present application;
[0039] Figure 13 is a flowchart of a device discovery method provided by an example embodiment of the present application;
[0040] Figure 14 is a block diagram of a device discovery apparatus provided by an example embodiment of the present application;
[0041] Figure 15 is a block diagram of a device discovery apparatus provided by an example embodiment of the present application;
[0042] Figure 16 is a structural schematic diagram of a computer device provided by an example embodiment of the present application. DETAILED DESCRIPTION
[0043] In order to make the purpose, technical solutions and advantages of the present application clearer, the embodiments of the present application will be further described in detail below with reference to the drawings.
[0044] Reference should be made to Figure 1 which shows a schematic diagram of an Internet of Things system provided by an embodiment of the present application, which can include a first device 110 and a second device 120.
[0045] The first device 110 is an electronic device with a device discovery function, which can be a terminal such as a smart phone, a tablet computer, a portable computer, etc., or an Internet of Things device with a function of discovering other Internet of Things devices, such as a smart speaker, Figure 1 In the example, the first device 110 is a smart phone.
[0046] In some embodiments, the first device 110 implements device discovery of the second device 120 through an installed Internet of Things application. The Internet of Things application can implement device discovery of multiple second devices 120.
[0047] The second device 120 can include smart home devices, smart home appliances, smart sensors, etc. Figure 1 In the example, the second device 120 includes a smart table lamp, a smart socket, and a smart fan, and the embodiments of the present application do not limit the specific device types of the second device 120.
[0048] Optionally, the first device 110 and the second device 120 can directly interact with each other in data instructions. For example, the first device 110 and the second device 120 can interact with each other in data instructions through management frames. The management frames include, but are not limited to, a Beacon frame, an Action frame, and a Probe frame.
[0049] Optionally, the first device 110 has a network configuration capability. After discovering the second device 120 through device discovery, the first device 110 supports network configuration of the second device 120, so that the second device 120 joins the wireless local area network scanned by the first device 110.
[0050] In the related art, the second device discovers devices through an AP function. For example, the second device broadcasts a Beacon frame, the Beacon frame carries an SSID field, and the first device learns the device information of the second device through the SSID field, thereby discovering the second device.
[0051] On the one hand, according to the provisions in the standard, the maximum length of the SSID field is 32 bytes, so the transmission of the device information of the second device is very limited. In this scheme, when the second device wants to indicate more detailed device information, it will be limited.
[0052] On the other hand, this scheme cannot be used for device discovery for some second devices that do not support the AP function, or for the second devices that support the AP function but are not currently working in the AP mode, so the implementation of this scheme has limitations.
[0053] On the other hand, for the first device, as long as the first device can scan the Beacon frame broadcasted by the second device, the first device will consider that the second device has been discovered and will remind the user. Since the Beacon frame broadcasted by the second device supports transmission within a certain distance, the first device may discover the second device that does not belong to the user, such as discovering the device of a neighbor, thereby disturbing the user to a certain extent and affecting the user experience.
[0054] In the method provided by the embodiments of the present application, a custom field is added to the management frame sent by the second device, which is beneficial to the second device to transmit more device information to the first device through the custom field, and to realize more efficient and more accurate device discovery.
[0055] Meanwhile, for the first device, home scenario sensing and distance judgment logic are added. Through the home scenario sensing, the first device only starts to enter the device discovery state in the home scenario, thereby reducing the disturbance to the user and saving the power of the first device. Through the distance judgment logic, the first device does not give a prompt to the device that is too far away and may belong to other users, thereby more accurately discovering the second device that belongs to the user and improving the user experience.
[0056] In the following, the technical solutions of the present application will be described in conjunction with several exemplary embodiments.
[0057] Please refer to Figure 2 , which shows a flowchart of a device discovery method provided by an embodiment of the present application. The method can be applied in an Internet of Things system as shown in Figure 1 . The method can include the following steps:
[0058] In step 201, the first device and the second device interact through n management frames, at least one of which includes a custom field, and n is a positive integer.
[0059] A management frame is a type of frame defined in Institute of Electrical and Electronics Engineers (IEEE) 802.11, and is mainly used for managing the joining or leaving of Internet of Things devices to a wireless network. In the embodiments of the present application, the first device and the second device interact through management frames to perform device discovery, so that the first device discovers the second device. Optionally, after discovering the second device, the first device will perform network configuration on the second device, so that the second device joins the wireless network.
[0060] In the embodiments of the present application, the number n of management frames through which the first device and the second device interact for device discovery can be one or more. In one possible implementation, the interaction between the first device and the second device through n management frames includes: the first device broadcasts a second management frame, and the second device receives the second management frame; the second device sends a first management frame to the first device, and the first device receives the first management frame. In another possible implementation, the interaction between the first device and the second device through n management frames includes: the second device broadcasts a first management frame, and the first device receives the first management frame.
[0061] In the n management frames, at least one of them includes a custom field. The custom field is a field that redefines the use of a field in the management frame, and is used to implement device discovery. It can be understood that, since the data in the custom field can be customized by the device that sends the management frame carrying the custom field, the length of the custom field is not limited. Compared with the related art in which the second device can only transmit device information through the SSID field, in the embodiments of the present application, the second device can further describe the device information of the second device through the added custom field. Exemplarily, the custom field can be denoted as "Vendor Specific".
[0062] Optionally, the custom field includes at least one information element. Optionally, the length of the custom field is adjusted by changing the number of information elements in the custom field, or changing the length of the information element.
[0063] At step 202, the first device obtains the device information of the second device according to the custom field in the first management frame, which is a management frame sent by the second device in the at least one management frame.
[0064] In a possible implementation, the first device receives the first management frame broadcasted by the second device, and then obtains the device information of the second device according to the custom field in the first management frame. In another possible implementation, the first device receives the first management frame unicast sent by the second device to the first device, and then obtains the device information of the second device according to the custom field in the first management frame. In the embodiment of the present application, the first device obtains the device information of the second device, and it can be considered that the first device discovers the second device.
[0065] Optionally, the reason for triggering the second device to send the first management frame includes that the second device is powered off and then powered on, or the second device is manually triggered, and the embodiment of the present application does not limit the reason for triggering the second device to send the first management frame. Optionally, after triggering the second device to send the first management frame, the second device sends the first management frame within a preset time period. Illustratively, the preset time period is one hour. Illustratively, within one hour after the second device is powered off and then powered on, the second device is in a device discovery state and sends the first management frame.
[0066] It can be understood that, in addition to the custom field shown in the embodiment of the present application, other fields existing in the management frame can also be used for the first device to discover the second device, such as the SSID field, and the embodiment of the present application does not limit this.
[0067] In summary, the method provided in the embodiment can be used when the first device and the second device are performing device discovery. The first device and the second device interact through n management frames, at least one of the n management frames carries a custom field, and in addition to the SSID field provided in the related art, the first device can discover the second device according to the custom field in the first management frame from the second device, which is beneficial to the second device transmitting more device information to the first device through the custom field, thereby realizing more efficient and more accurate device discovery.
[0068] In the illustrative embodiment, the custom field includes at least one information element. Hereinafter, the format of the information element in the custom field is illustratively described by taking the format of a first information element as an example, and the first information element is any one of the at least one information element included in the custom field.
[0069] Figure 3 A schematic diagram showing the format of the first information element provided by one example embodiment of the present application is shown, the first information element comprising at least one of the following subfields: a tag number subfield 31, a length subfield 32, an organizationally unique identifier subfield 33, a data type subfield 34, and a data subfield 35.
[0070] By way of example, the tag number subfield 31 can be denoted as Tag Number, the length subfield 32 can be denoted as Length, the organizationally unique identifier subfield 33 can be denoted as OUI (Organizationally Unique Identifier), the data type subfield 34 can be denoted as Type, and the data subfield 35 can be denoted as DATA.
[0071] 1) the tag number subfield 31, used to identify a custom field.
[0072] In a possible implementation, different fields can correspond to different tag numbers, and the tag number subfield is used to identify that the field to which the first information element belongs is a custom field.
[0073] Optionally, the value of the tag number subfield is customizable by the vendor to which the second device belongs, such as: the tag number subfield takes the value 221. Optionally, the length of the tag number subfield is fixed, such as: the length of the tag number subfield is 1-4 bytes.
[0074] 2) the length subfield 32, used to identify the length of the first information element.
[0075] Optionally, the length of the length subfield is fixed, such as: the length of the length subfield is 1-4 bytes.
[0076] 3) the organizationally unique identifier subfield 33, used to identify the format standard to which the first information element corresponds.
[0077] In a possible implementation, different information elements can correspond to different format standards. The information element conforming to the information element format in the device discovery method shown in the embodiments of the present application should correspond to a fixed value of the organizationally unique identifier subfield 33, and the information element under the fixed value can be considered as the information element corresponding to the target format standard.
[0078] Optionally, step 202 is replaced by: the first device determines the format standard to which the first information element corresponds according to the organizationally unique identifier subfield of the first information element in the first management frame; and in response to the first information element corresponding to the target format standard, the device information of the second device is obtained from the data subfield in the first information element.
[0079] For example, the value of the organization unique identifier subfield of the information element of the target format standard is 0xFCA5D0. After receiving the first management frame, the first device confirms the value of the organization unique identifier subfield of the first information element in the first management frame. If the value is 0xFCA5D0, the first device performs the step of obtaining the device information of the second device from the data subfield in the first information element. If the value is not 0xFCA5D0, it is considered that the first information element in the first management frame does not conform to the format of the information element as shown in Figure 3 the first device does not perform the step of obtaining the device information of the second device from the data subfield in the first information element.
[0080] Optionally, the length of the organization unique identifier subfield is fixed, for example, the length of the organization unique identifier subfield is 1-4 bytes.
[0081] 4) The data type subfield 34 is used to identify the type of the two-layer message.
[0082] Optionally, the type of the two-layer message includes at least one of the following: transparent data, device discovery request, device discovery response, device network configuration request, device network configuration response, device synchronization password request, and device synchronization password response. Different values of the data type subfield can identify different types of two-layer messages. For example, refer to Table 1 as follows:
[0083] Table 1
[0084] Data type subfield Definition 0x00 Transmitted data 0x01 Device discovery request 0x02 Device discovery response 0x03 Device commissioning request 0x04 Device commissioning response 0x05 Device synchronization password request 0x06 Device synchronization password response
[0085] The device discovery request is used to request the opposite device to send the device information of the opposite device for device discovery of the opposite device. The device discovery response is used to carry the device information of the device for device discovery of the device.
[0086] For example, in the embodiment of the present application, the value of the data subfield of the first management frame sent by the second device to the first device can be 0x02, indicating that the two-layer message carried by the first management frame is a device discovery response, and the device discovery response carries the device information of the second device.
[0087] Optionally, the length of the data type subfield is fixed, for example, the length of the data type subfield is 1-4 bytes.
[0088] 5) The data subfield 35 is used to describe the content information of the two-layer message.
[0089] Optionally, the length of the data subfield is variable.
[0090] Exemplarily, in a case that the management frame is the first management frame sent by the second device, the layer-2 message is a device discovery response, and the content information includes device information of the second device. Exemplarily, in a case that the management frame is the second management frame sent by the first device, the layer-2 message is a device discovery request, and the content information includes device information of the first device.
[0091] In the embodiment of the present application, the custom field includes at least one information element. The information element in the custom field adopts the format as shown in Figure 3
[0092] In a possible implementation, when one information element cannot hold all data, multiple information elements are connected to constitute the custom field. Information elements with the same data type subfield value are sequentially spliced together as complete data for the first device to parse. Optionally, the multiple information elements can be spliced in a certain order or freely spliced, and the embodiment of the present application does not limit this.
[0093] Exemplarily, the format of the information element is shown in Figure 4 . The first information element 41 and the second information element 42 have the same data type subfield value: Type1, and the first device splices the first information element 41 and the second information element 42 together for parsing.
[0094] In a possible implementation, when the data type subfield value is 0x00, the layer-2 message is transparent data, used for transmitting data customized by a manufacturer. At this time, a vendor organization unique identifier subfield (which can be denoted as Vendor OUI) is additionally added in the first information element to identify the manufacturer. The format of the first information element is shown in Figure 5 . The first information element includes at least one of the following subfields: a tag number subfield 51, a length subfield 52, an organization unique identifier subfield 53, a data type subfield 54, a vendor organization unique identifier subfield 55, and a data subfield 56.
[0095] In summary, the method provided in the embodiment clearly defines the format of the information element in the custom field, the information element includes at least one of the following subfields: a tag number subfield, a length subfield, an organization unique identifier subfield, a data type subfield, and a data subfield, the custom field can include multiple information elements, and the present application can transmit more data by splicing the information elements to expand the expression content of the custom field.
[0096] Based on the format of the information element as shown in Figure 3 , the second device sending the first management frame has the following two cases:
[0097] I. The first management frame is a management frame sent by the second device in response to the second management frame, and the second management frame is a management frame broadcasted by the first device.
[0098] The type of the first management frame includes an action frame or a probe frame. The type of the second management frame includes an action frame or a probe frame.
[0099] The action frame is a frame defined in IEEE 802.11, in which the value of a SubType subfield is 1101. In IEEE 802.11, a schematic diagram of the action frame is shown in FIG. 1. Figure 6 As shown in FIG. 1, the mandatory fields of the action frame at least include a Frame Control field 61, a Duration field 62, a Destination Address (DA) field 63, a Source Address (SA) field 64, a Basic Service Set Identifier (BSSID) field 65, a Sequence Control field 66, a Category field 67, and a Frame Check Sequence (FCS) field 68. Figure 6
[0100] In the embodiments of the present application, the action frame includes a custom field. Based on the definition in IEEE 802.11, the format of the action frame proposed in the embodiments of the present application is shown in Table 2 below.
[0101] Table 2
[0102]
[0103]
[0104] As shown in Table 2, in the embodiments of the present application, in addition to the mandatory fields of the action frame defined in IEEE 802.11, the action frame further includes a custom field with a number of 10, and the length of the custom field is n bytes, where n is a positive integer.
[0105] The probe frame is a frame defined in IEEE 802.11, in which the value of a SubType subfield is 0100 or 0101. In IEEE 802.11, a schematic diagram of the probe frame is shown in FIG. 2. Figure 7 As shown in FIG. 2, the mandatory fields of the probe frame at least include a Frame Control field 71, a Duration field 72, a Destination Address field 73, a Source Address field 74, a Basic Service Set Identifier field 75, a Sequence Control field 76, and a Frame Check Sequence field 77. Figure 7
[0106] In the embodiments of the present application, the probe frame comprises a custom field. Based on the definition in IEEE 802.11, the format of the probe frame proposed in the embodiments of the present application is shown in Table Three as follows:
[0107] Table Three
[0108]
[0109] As shown in Table Three above, in the embodiments of the present application, in addition to the mandatory fields of the probe frame defined in IEEE 802.11, the probe frame further comprises a custom field with a number of 10, and the length of the custom field is n bytes, where n is a positive integer.
[0110] II. The first management frame is a management frame broadcasted by the second device.
[0111] The type of the first management frame is a beacon frame.
[0112] The beacon frame is a frame defined in IEEE 802.11 with the value of the subtype subfield being 1000. In IEEE 802.11, the schematic diagram of the beacon frame is shown in Figure 8 . As shown in Figure 8 , the mandatory fields of the beacon frame at least comprise: a frame control field 81, a duration field 82, a destination address field 83, a source address field 84, a basic service set identification field 85, a sequence control field 86, a timestamp field 87, a beacon interval field 88, a capability field 89, a service set identification field 810, and a frame check sequence field 811.
[0113] In the embodiments of the present application, the beacon frame comprises a custom field. Based on the definition in IEEE 802.11, the format of the beacon frame proposed in the embodiments of the present application is shown in Table Four as follows:
[0114] Table Four
[0115]
[0116]
[0117] As shown in Table Four above, in the embodiments of the present application, in addition to the mandatory fields of the beacon frame defined in IEEE 802.11, the beacon frame further comprises a custom field with a number of 11, and the length of the custom field is n bytes, where n is a positive integer.
[0118] Next, the above two cases are described exemplarily.
[0119] The first management frame is a management frame sent by the second device in response to the second management frame, and the second management frame is a management frame broadcast by the first device.
[0120] Figure 9 A flowchart of a device discovery method provided by an example embodiment of the present application is shown, which can be applied to an Internet of Things system as shown in Figure 1 The method can include the following steps:
[0121] In step 901, the first device broadcasts a second management frame, and the second layer message carried by the second management frame is a device discovery request.
[0122] The type of the second management frame includes an action frame or a probe frame.
[0123] In a possible implementation, the first device is triggered to enter a device discovery state, and the first device broadcasts the second management frame on a full channel to request device discovery.
[0124] Optionally, the first device broadcasts the second management frame in a connectable broadcast manner. The connectable broadcast means that the first device allows other devices to respond to the broadcast second management frame and establish a connection therewith.
[0125] In the embodiments of the present application, the first management frame and the second management frame adopt the same format, and the second management frame also carries a custom field. In combination with reference Figure 3 When the second management frame carries the custom field, the first device carries the device information of the first device in a data subfield in the custom field in the second management frame.
[0126] Optionally, the data type subfield corresponding to the device discovery request has a first value, and the data subfield corresponding to the device discovery request carries the device information of the first device. For example, as shown in Table 1, the value of the data type subfield in the second management frame is 0x01, indicating that the second layer message carried by the second management frame is a device discovery request, and the device information of the first device is carried.
[0127] Optionally, the device information of the first device includes first capability information for describing the network configuration capability or synchronization password capability of the first device.
[0128] For example, the encoding of the data subfield in the second management frame is shown as follows:
[0129]
[0130] In step 902, the second device receives the second management frame broadcast by the first device.
[0131] In a possible implementation, in a case where the first device sends the second management frame in full channel broadcast, the second device receives the second management frame sent by the first device on its working channel. The second device determines that the first device requests device discovery based on a two-layer message carried in the second management frame.
[0132] At step 903, in response to the second management frame, the second device sends a first management frame to the first device, and a two-layer message carried in the first management frame is a device discovery response.
[0133] The type of the first management frame includes an action frame or a probe frame.
[0134] In a possible implementation, after receiving the second management frame, the second device sends the first management frame on its working channel to respond to the second management frame.
[0135] In the embodiment of the present application, a data subfield in a self-defined field of the first management frame carries device information of the second device.
[0136] Optionally, a data type subfield corresponding to the device discovery response has a second value, and a data subfield corresponding to the device discovery response carries device information of the second device. For example, as shown in Table 1, the value of the data type subfield in the first management frame is 0x02, indicating that the first management frame is a device discovery response carrying device information of the second device.
[0137] Optionally, the device information of the second device includes at least one of the following information:
[0138] Second capability information, used to describe network connection capability of the second device or pairing network capability of the second device;
[0139] State information, used to describe the pairing network state of the second device;
[0140] Product identification information, used to describe the model or the manufacturer of the second device;
[0141] Manufacturer data information, used to describe data defined by the manufacturer of the second device;
[0142] Random number, used to generate a shared key to encrypt network information in a pairing network process.
[0143] For example, the encoding reference of the data subfield in the first management frame is shown as follows:
[0144]
[0145] Step 904, the first device receives the first management frame sent by the second device in response to the second management frame.
[0146] The type of the first management frame includes an action frame or a probe frame.
[0147] In a possible implementation, the first device receives the first management frame sent by the second device in response to the second management frame on a working channel of the second device, and the second layer message carried in the first management frame is a device discovery response.
[0148] Step 905, the first device obtains device information of the second device according to a custom field in the first management frame.
[0149] In a possible implementation, after receiving the first management frame, the first device finds the custom field in the first management frame, parses a data subfield in the custom field, and thus obtains the device information of the second device, and discovers the second device.
[0150] II. The first management frame is a management frame broadcast by the second device.
[0151] Figure 10 A flow chart of a device discovery method provided by an example embodiment of the present application is shown, which can be applied to an Internet of Things system as shown in Figure 1 The method can include the following steps:
[0152] Step 1001, the second device broadcasts a first management frame, and the second layer message carried in the first management frame is a device discovery response.
[0153] The type of the first management frame is a beacon frame.
[0154] In a possible implementation, the second device broadcasts the first management frame on a working channel thereof in a discovered state, and the second layer message carried in the first management frame is a device discovery response.
[0155] Optionally, the data type subfield corresponding to the device discovery response has a second value, and the data subfield corresponding to the device discovery response carries device information of the second device. For example, as shown in Table 1, the value of the data type subfield in the first management frame is 0x02, indicating that the first management frame is a device discovery response, and carries the device information of the second device.
[0156] Optionally, the device information of the second device includes at least one of the following information:
[0157] Second capability information, used to describe a network configuration capability or a PMK network connection capability of the second device;
[0158] State information, used to describe a network configuration state of the second device.
[0159] product identification information, used for describing a model or a manufacturer to which the second device belongs;
[0160] manufacturer data information, used for describing data defined by a manufacturer to which the second device belongs;
[0161] a random number, used for generating a shared key to encrypt networking information in a provisioning process.
[0162] For example, encoding references of data subfields in the first management frame are shown as follows:
[0163]
[0164] Step 1002, the first device receives the first management frame broadcast by the second device.
[0165] In the embodiment, the custom Layer 2 message carried in the first management frame is a device discovery response.
[0166] Step 1003, the first device obtains device information of the second device according to the custom field in the first management frame.
[0167] In a possible implementation, after receiving the first management frame, the first device finds the custom field in the first management frame, parses data subfields in the custom field, and thus learns the device information of the second device, and discovers the second device.
[0168] In conclusion, the method provided in the embodiment improves the flexibility of device discovery between the first device and the second device.
[0169] Meanwhile, in the case that the second device does not support the AP function or does not start the AP mode, the second device does not need to send the beacon frame, but interacts with the first device through the action frame or the probe frame, the action frame or the probe frame carries the custom field, and the custom field transmits information required for device discovery, thereby expanding the implementation scenario of device discovery and ensuring the effective performance of device discovery.
[0170] In the illustrative embodiment, after discovering the second device, the first device determines whether to prompt a user about the discovered second device according to the distance determination logic. In practice, the second device discovered by the first device is a device around the first device, and possibly, the second device is not a device of a user corresponding to the first device. At this time, based on the distance determination logic, the first device can avoid incorrectly displaying device discovery prompt information of a device belonging to other users on the first device.
[0171] Figure 11A flowchart of a device discovery method provided by an embodiment of the present application is shown, which can be applied to an Internet of Things system as shown in Figure 1 The method can include the following steps:
[0172] In step 1101, the first device and the second device interact through n management frames, at least one of the n management frames includes a custom field, and n is a positive integer.
[0173] The implementation of this step can refer to step 201, which will not be repeated here.
[0174] In step 1102, the first device obtains device information of the second device according to the custom field in the first management frame, and the first management frame is a management frame sent by the second device among the at least one management frame.
[0175] The implementation of this step can refer to step 202, which will not be repeated here.
[0176] In step 1103, the first device displays device discovery prompt information, and the device discovery prompt information is used to prompt to discover the second device.
[0177] In a possible implementation, the first device displays the device discovery prompt information in response to the signal strength satisfying a prompt condition.
[0178] Optionally, the first device is pre-configured with a prompt condition, and after determining the signal strength of the second device, the first device judges whether the signal strength of the second device satisfies the prompt condition. In the case of satisfying the prompt condition, the device discovery prompt information is displayed to prompt the user to discover the second device.
[0179] Optionally, the prompt condition is that the signal strength of the second device is higher than a threshold value. The stronger the signal strength, the closer the second device is to the first device, and the more likely the second device belongs to the user. The threshold value can be a system default setting or manually set. For example, the threshold value is -45db.
[0180] Optionally, since the signal strengths of different types of second devices are different when sending the first management frame, different prompt conditions can be set for different types of second devices, such as: in the case of the second device being a smart speaker, the prompt condition is a first prompt condition; in the case of the second device being a fan, the prompt condition is a second prompt condition.
[0181] Optionally, in addition to displaying the device discovery prompt information, the first device can also prompt the user to discover the second device through other forms such as voice broadcast of the device discovery prompt information, and the embodiments of the present application do not limit this.
[0182] It can be understood that if the signal strength of the second device does not satisfy the prompting condition, the first device will not display the device discovery prompting information corresponding to the second device, that is, the discovered second device is ignored.
[0183] In conclusion, the method provided in the embodiment can determine whether to display the device discovery prompting information based on the signal strength of the second device by obtaining the signal strength of the second device, prompt the user that the second device has been discovered, and more accurately perform device discovery prompting on the user in the case that the signal strength can represent the distance between the first device and the second device, so that the device that is too far away and possibly belongs to other users is not prompted.
[0184] In the illustrative embodiment, the first device supports detecting the application scenario to determine whether the user carrying the first device is in the home scenario, and triggers the device discovery on the first device side only in the home scenario. Since the first device carried by the user generally only has the permission to control the second device in the home, the first device does not need to perform device discovery in other scenarios, and the frequent and ineffective device discovery process can be avoided by judging the application scenario.
[0185] Figure 12 A flowchart of a device discovery method provided in an embodiment of the application is shown, which can be applied to an Internet of Things system as shown in Figure 1 The method can include the following steps:
[0186] In step 1201, the first device obtains application scenario analysis information of the first device.
[0187] The application scenario analysis information is reference information for analyzing the application scenario, and includes at least one of the geographic location information of the first device and the hot spot scanning information of the first device.
[0188] The application scenario is used to describe the running scenario of the first device. Optionally, the first device triggers different function states in different application scenarios. In the embodiment of the application, the application scenario includes the home scenario, and the home scenario triggers the first device to enter the device discovery state.
[0189] The home scenario refers to the scenario in which the first device reaches a preset geographic location area. The preset geographic location area is exemplarily described as the home of the user to which the first device belongs in the embodiment of the application, and can also be the company, school or other area of the user to which the first device belongs.
[0190] In step 1202, the first device determines the application scenario corresponding to the first device based on the application scenario analysis information.
[0191] In a possible implementation, the step 1202 comprises: determining, by the first device, the application scenario according to the geographic location information.
[0192] Optionally, the first device acquires the geographic location information of the first device at preset time intervals or in real time, determines the current geographic location of the first device based on the geographic location information, and compares the current geographic location of the first device with the preset geographic location region, so as to determine the application scenario corresponding to the first device.
[0193] In another possible implementation, the step 1202 comprises: determining, by the first device, the application scenario according to the hotspot scanning information.
[0194] Since one preset geographic location region generally corresponds to one or more fixed scannable hotspots, the fixed scannable hotspots are determined as preset hotspots, the first device supports indirectly determining the geographic location of the first device by acquiring the hotspot scanning information, so as to determine the application scenario corresponding to the first device.
[0195] Optionally, the first device acquires the hotspot scanning information of the first device at preset time intervals or in real time, and compares the hotspots in the hotspot scanning information with the preset hotspots, so as to determine the application scenario corresponding to the first device.
[0196] The step 1203 comprises: in response to the application scenario being the home scenario, triggering, by the first device, the first device to enter a device discovery state.
[0197] The device discovery state refers to a state in which the first device supports device discovery. In a possible implementation, the first device triggers the first device to enter the device discovery state in a case where it is detected that the current application scenario is the home scenario, so as to subsequently perform device discovery on a second device.
[0198] The step 1204 comprises: performing, by the first device, interaction with the second device through n management frames, at least one management frame in the n management frames comprising a custom field, n being a positive integer.
[0199] The implementation of the present step can refer to the step 201, and details are not described herein.
[0200] The step 1205 comprises: acquiring, by the first device, device information of the second device according to the custom field in the first management frame, the first management frame being a management frame sent by the second device in the at least one management frame.
[0201] The implementation of the present step can refer to the step 202, and details are not described herein.
[0202] To sum up, the method provided in the embodiment triggers the first device to enter the device discovery state only when the application scenario corresponding to the first device is the homecoming scenario, thereby reducing the disturbance to the user and saving the power of the first device.
[0203] In the illustrative embodiment, after the first device acquires the device information of the second device, the first device further performs the following steps:
[0204] The first device reports the device information of the second device to a software development kit (SDK) corresponding to the second device.
[0205] In a possible implementation, in the first device, there are multiple SDKs, different types of second devices belong to different SDKs, and the first device determines the SDK corresponding to the second device according to the device information of the second device, such as the product identifier (PID) of the second device, after acquiring the device information of the second device, and reports the device information of the second device to the SDK corresponding to the second device. Optionally, the SDK corresponding to the second device performs a subsequent network configuration process using the device information of the second device.
[0206] Next, the device discovery method shown in the present application is exemplarily described in combination with the following embodiments. In the present embodiment, the first device is a mobile phone, and the second device is a smart sound box. In the present embodiment, the mobile phone realizes device discovery of the smart sound box through an installed Internet of Things application (APP).
[0207] Figure 13 A flowchart of a device discovery method provided in an embodiment of the present application is shown, which can be applied to an Internet of Things system as shown in Figure 1 The method can include the following steps:
[0208] Step 1301: The Internet of Things APP detects that the application scenario is a homecoming scenario.
[0209] That is, the Internet of Things APP detects that the user holding the mobile phone is coming home.
[0210] Step 1302: The Internet of Things APP triggers the mobile phone to enter a device discovery state.
[0211] Step 1303: The smart sound box is in a device discovery state.
[0212] Optionally, the smart sound box triggers to enter the device discovery state in the case of power-off and power-on.
[0213] In this embodiment, the mobile phone and the smart speaker continue to perform step 1304 and step 1305; or, the mobile phone and the smart speaker continue to perform step 1306.
[0214] In step 1304, the mobile phone broadcasts a second management frame on each channel for device discovery request.
[0215] The type of the second management frame includes a probe frame or an action frame.
[0216] Optionally, the second management frame carries a custom field, and the format of the information element in the custom field is as shown in Table 1. Figure 3 For example, as shown in Table 1, the value of the data type subfield in the second management frame is 0x01, indicating that the second layer message carried by the second management frame is a device discovery request.
[0217] In step 1305, the smart speaker sends a first management frame on the working channel for device discovery response.
[0218] The type of the first management frame includes a probe frame or an action frame.
[0219] Optionally, the first management frame carries a custom field, and the format of the information element in the custom field is as shown in Table 1. Figure 3 For example, as shown in Table 1, the value of the data type subfield in the first management frame is 0x02, indicating that the second layer message carried by the first management frame is a device discovery response.
[0220] In step 1306, the smart speaker broadcasts a first management frame on the working channel for device discovery response.
[0221] The type of the first management frame includes a beacon frame.
[0222] Optionally, the first management frame carries a custom field, and the format of the information element in the custom field is as shown in Table 1. Figure 3 For example, as shown in Table 1, the value of the data type subfield in the first management frame is 0x02, indicating that the second layer message carried by the first management frame is a device discovery response.
[0223] In step 1307, the mobile phone reports the device information of the smart speaker.
[0224] Optionally, the mobile phone obtains the device information of the smart speaker from the first management frame. Optionally, the device information is in the custom field of the first management frame, and in other fields such as the SSID field.
[0225] In step 1308, the Internet of Things APP uploads the device information of the smart speaker to the SDK corresponding to the smart speaker.
[0226] Optionally, the Internet of Things APP determines the SDK corresponding to the smart sound box according to the PID in the device information of the smart sound box, and uploads the device information of the smart sound box to the SDK corresponding to the smart sound box.
[0227] In step 1309, the Internet of Things APP determines whether to display the device discovery prompt information based on the signal strength of the smart sound box.
[0228] For example, in the case where the signal strength of the smart sound box is higher than the threshold, the Internet of Things APP displays the device discovery prompt information based on the device information of the sound box device, prompting the user to discover the smart sound box.
[0229] It can be understood that the above method embodiments can be implemented alone or in combination, and the present application does not limit this.
[0230] The following is an apparatus embodiment of the present application, which can be used to execute the method embodiments of the present application. For details not disclosed in the apparatus embodiments of the present application, please refer to the method embodiments of the present application.
[0231] Please refer to Figure 14 which shows a block diagram of a device discovery apparatus provided by an embodiment of the present application. The apparatus has the functions of implementing the above method examples, which can be implemented by hardware or corresponding software executed by hardware. The apparatus can be implemented as a first device or a part of a first device. The apparatus 1400 can include:
[0232] An interaction module 1401 is configured to interact with a second device through n management frames, at least one of the n management frames including a custom field, and n being a positive integer.
[0233] A device discovery module 1402 is configured to obtain device information of the second device according to the custom field in a first management frame, the first management frame being a management frame sent by the second device in the at least one management frame.
[0234] In an illustrative embodiment, the custom field includes at least one information element, and a first information element in the at least one information element includes at least one of the following subfields:
[0235] A tag number subfield is configured to identify the custom field.
[0236] A length subfield is configured to identify the length of the first information element.
[0237] An organization unique identifier subfield is configured to identify the format standard corresponding to the first information element.
[0238] A data subfield is configured to describe the content information of a two-layer message.
[0239] a data type subfield, used for identifying a type of the two-layer message.
[0240] In an illustrative embodiment, the interaction module 1401 is configured to broadcast a second management frame, wherein the two-layer message carried by the second management frame is a device discovery request, and the type of the second management frame comprises an action frame or a probe frame; and receive a first management frame sent by the second device in response to the second management frame, wherein the two-layer message carried by the first management frame is a device discovery response, and the type of the first management frame comprises the action frame or the probe frame.
[0241] In an illustrative embodiment, the interaction module 1401 is configured to broadcast the second management frame on a full channel; and receive the first management frame sent by the second device in response to the second management frame on an operating channel of the second device.
[0242] In an illustrative embodiment, the device discovery request corresponds to a first value of the data type subfield, and the device discovery request carries device information of the first device in the data subfield; and the device discovery response corresponds to a second value of the data type subfield, and the device discovery response carries device information of the second device in the data subfield.
[0243] In an illustrative embodiment, the interaction module 1401 is configured to receive the first management frame broadcast by the second device, wherein the two-layer message carried by the first management frame is a device discovery response, and the type of the first management frame is a beacon frame.
[0244] In an illustrative embodiment, the interaction module 1401 is configured to receive the first management frame broadcast by the second device on an operating channel of the second device.
[0245] In an illustrative embodiment, the device discovery response corresponds to a second value of the data type subfield, and the device discovery response carries device information of the second device in the data subfield.
[0246] In an illustrative embodiment, the device information of the first device comprises first capability information used for describing a commissioning capability or a synchronization password capability of the first device.
[0247] In an illustrative embodiment, the device information of the second device comprises at least one of the following information:
[0248] second capability information used for describing a commissioning capability or a PMK network connection capability of the second device;
[0249] status information used for describing a commissioning state of the second device.
[0250] product identification information, used for describing a model or a manufacturer of the second device;
[0251] manufacturer data information, used for describing data defined by a manufacturer of the second device;
[0252] a random number, used for generating a shared key to encrypt networking information in a provisioning process.
[0253] In an illustrative embodiment, the device discovery module 1402 is configured to determine a format standard corresponding to the first information element according to the organization unique identifier subfield in the first information element in the first management frame, and obtain device information of the second device from the data subfield in the first information element in response to the first information element corresponding to a target format standard.
[0254] In an illustrative embodiment, the apparatus further includes a prompt information display module configured to display device discovery prompt information, the device discovery prompt information being used to prompt discovery of the second device.
[0255] In an illustrative embodiment, the prompt information display module is configured to obtain a signal strength of the second device, and display the device discovery prompt information in response to the signal strength satisfying a prompt condition.
[0256] In an illustrative embodiment, the apparatus further includes a device information reporting module configured to report the device information of the second device to an SDK corresponding to the second device.
[0257] In an illustrative embodiment, the apparatus further includes a scenario detection module configured to obtain application scenario analysis information of the first device, the application scenario analysis information including at least one of geographic location information of the first device and hotspot scanning information of the first device, determine an application scenario corresponding to the first device based on the application scenario analysis information, and trigger entering a device discovery state in response to the application scenario being a homecoming scenario.
[0258] Please refer to Figure 15 which shows a block diagram of a device discovery apparatus provided by an embodiment of the present application. The apparatus has functions of implementing the above method examples, which can be implemented by hardware or corresponding software executed by hardware. The apparatus can be implemented as a second device or a part of a second device. The apparatus 1500 can include:
[0259] an interaction module 1501 configured to interact with a first device through n management frames, at least one of the n management frames including a self-defined field, n being a positive integer.
[0260] The custom field in the first management frame of the at least one management frame is used to carry device information of the second device.
[0261] In an illustrative embodiment, the custom field includes at least one information element, and a first information element of the at least one information element includes at least one of the following subfields:
[0262] a tag number subfield, used to identify the custom field;
[0263] a length subfield, used to identify a length of the first information element;
[0264] an organizationally unique identifier subfield, used to identify a format standard to which the first information element corresponds;
[0265] a data subfield, used to describe content information of a layer 2 message;
[0266] a data type subfield, used to identify a type of the layer 2 message.
[0267] In an illustrative embodiment, the interaction module 1501 is configured to receive a second management frame broadcast by the first device, the layer 2 message carried by the second management frame being a device discovery request, and the type of the second management frame including an action frame or a probe frame; and in response to the second management frame, the interaction module 1501 is configured to send the first management frame to the first device, the layer 2 message carried by the first management frame being a device discovery response, and the type of the first management frame including the action frame or the probe frame.
[0268] In an illustrative embodiment, the interaction module 1501 is configured to receive, on a working channel of the second device, the second management frame broadcast by the first device; and in response to the second management frame, the interaction module 1501 is configured to send, on the working channel of the second device, the first management frame to the first device.
[0269] In an illustrative embodiment, the device discovery request corresponds to a first value of the data type subfield, and the device discovery request corresponds to the device information carried by the data subfield; and the device discovery response corresponds to a second value of the data type subfield, and the device discovery response corresponds to the device information carried by the data subfield.
[0270] In an illustrative embodiment, the interaction module 1501 is configured to broadcast the first management frame, the layer 2 message carried by the first management frame being a device discovery response, and the type of the first management frame being a beacon frame.
[0271] In an illustrative embodiment, the interaction module 1501 is configured to broadcast the first management frame on a working channel of the second device.
[0272] In an illustrative embodiment, the device discovery response corresponds to a second value of the data type subfield, and the device discovery response carries device information of the second device.
[0273] In an illustrative embodiment, the device information of the first device includes first capability information, which is used to describe a network configuration capability or a synchronization password capability of the first device.
[0274] In an illustrative embodiment, the device information of the second device includes at least one of the following information:
[0275] Second capability information, which is used to describe a network configuration capability or a PMK network connection capability of the second device;
[0276] State information, which is used to describe a network configuration state of the second device;
[0277] Product identification information, which is used to describe a model or a manufacturer of the second device;
[0278] Manufacturer data information, which is used to describe data defined by a manufacturer of the second device;
[0279] A random number, which is used to generate a shared key to encrypt network connection information in a network configuration process.
[0280] It should be noted that the apparatus provided in the above embodiments is only used as an example to divide the above functional modules, and in actual applications, the above functions can be completed by different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to complete all or part of the above described functions. In addition, the apparatus and method embodiments provided in the above embodiments belong to the same concept, and the specific implementation process is described in detail in the method embodiments, which will not be repeated here.
[0281] For reference Figure 16 which shows a structural schematic diagram of a computer device 1600 provided in an embodiment of the present application, and the computer device 1600 can include a processor 1601, a receiver 1602, a transmitter 1603, a memory 1604 and a bus 1605.
[0282] The processor 1601 includes one or more processing cores, and the processor 1601 performs various functional applications and information processing by running software programs and modules.
[0283] The receiver 1602 and the transmitter 1603 can be implemented as one communication component, which can be one communication chip.
[0284] The memory 1604 is connected to the processor 1601 through the bus 1605.
[0285] The memory 1604 can be used to store a computer program, and the processor 1601 is configured to execute the computer program to implement various steps performed by the computer device in the above method embodiments.
[0286] In addition, the memory 1604 can be implemented by any type of volatile or non-volatile storage devices or a combination thereof, including but not limited to: a magnetic or optical disk, an Electrically Erasable Programmable Read-Only Memory (EEPROM), an Erasable Programmable Read-Only Memory (EPROM), a Static Random Access Memory (SRAM), a Read-Only Memory (ROM), a magnetic storage, a flash memory, a Programmable Read-Only Memory (PROM).
[0287] In an exemplary embodiment, the computer device includes a processor, a memory and a transceiver (which can include a receiver and a transmitter, the receiver being configured to receive information, and the transmitter being configured to send information).
[0288] In a possible implementation, when the computer device is implemented as a first device,
[0289] The transceiver is configured to interact with a second device through n management frames, at least one of the n management frames includes a custom field, and n is a positive integer.
[0290] The processor is configured to obtain device information of the second device according to the custom field in a first management frame, and the first management frame is a management frame sent by the second device in the at least one management frame.
[0291] In an exemplary embodiment, the custom field includes at least one information element, and a first information element in the at least one information element includes at least one of the following subfields:
[0292] A tag number subfield is configured to identify the custom field.
[0293] a length subfield, used for identifying a length of the first information element;
[0294] a format standard subfield, used for identifying a format standard corresponding to the first information element;
[0295] a data subfield, used for describing content information of the second layer message;
[0296] a data type subfield, used for identifying a type of the second layer message.
[0297] In an illustrative embodiment, the transceiver is configured to broadcast a second management frame, the second layer message carried by the second management frame being a device discovery request, the type of the second management frame including an action frame or a probe frame; and receive the first management frame sent by the second device in response to the second management frame, the second layer message carried by the first management frame being a device discovery response, the type of the first management frame including the action frame or the probe frame.
[0298] In an illustrative embodiment, the transceiver is configured to broadcast the second management frame on a full channel; and receive the first management frame sent by the second device in response to the second management frame on an operating channel of the second device.
[0299] In an illustrative embodiment, the device discovery request corresponds to a first value of the data type subfield, and the device discovery request carries device information of the first device in the data subfield; and the device discovery response corresponds to a second value of the data type subfield, and the device discovery response carries device information of the second device in the data subfield.
[0300] In an illustrative embodiment, the transceiver is configured to receive the first management frame broadcast by the second device, the second layer message carried by the first management frame being a device discovery response, and the type of the first management frame being a beacon frame.
[0301] In an illustrative embodiment, the transceiver is configured to receive the first management frame broadcast by the second device on an operating channel of the second device.
[0302] In an illustrative embodiment, the device discovery response corresponds to a second value of the data type subfield, and the device discovery response carries device information of the second device in the data subfield.
[0303] In an illustrative embodiment, the device information of the first device includes first capability information used for describing a network configuration capability or a synchronization password capability of the first device.
[0304] In an illustrative embodiment, the device information of the second device comprises at least one of the following information:
[0305] second capability information, used for describing a provisioning capability or a PMK connection network capability of the second device;
[0306] state information, used for describing a provisioning state of the second device;
[0307] product identification information, used for describing a model or a manufacturer of the second device;
[0308] manufacturer data information, used for describing data defined by a manufacturer of the second device;
[0309] a random number, used for generating a shared key to encrypt networking information in a provisioning process.
[0310] In an illustrative embodiment, the processor is configured to determine a format standard corresponding to the first information element according to the organization unique identifier subfield in the first information element in the first management frame, and acquire device information of the second device from the data subfield in the first information element in response to the first information element corresponding to a target format standard.
[0311] In an illustrative embodiment, the processor is configured to display device discovery prompt information, the device discovery prompt information being used to prompt to discover the second device.
[0312] In an illustrative embodiment, the processor is configured to acquire a signal strength of the second device, and display the device discovery prompt information in response to the signal strength satisfying a prompt condition.
[0313] In an illustrative embodiment, the processor is configured to report the device information of the second device to an SDK corresponding to the second device.
[0314] In an illustrative embodiment, the processor is configured to acquire application scenario analysis information of the first device, the application scenario analysis information comprising at least one of geographic position information of the first device and hotspot scanning information of the first device, determine an application scenario corresponding to the first device based on the application scenario analysis information, and trigger to enter a device discovery state in response to the application scenario being a homecoming scenario.
[0315] In a possible implementation, when the computer device is implemented as the second device,
[0316] The transceiver is configured to interact with the first device through n management frames, at least one of the n management frames comprising a custom field, n being a positive integer.
[0317] The custom field in the first management frame of the at least one management frame is used to carry device information of the second device, and the first management frame is a management frame sent by the second device.
[0318] In an illustrative embodiment, the custom field includes at least one information element, and a first information element of the at least one information element includes at least one of the following subfields:
[0319] a tag number subfield, used to identify the custom field;
[0320] a length subfield, used to identify a length of the first information element;
[0321] an organizationally unique identifier subfield, used to identify a format standard to which the first information element corresponds;
[0322] a data subfield, used to describe content information of a layer 2 message;
[0323] a data type subfield, used to identify a type of the layer 2 message.
[0324] In an illustrative embodiment, the transceiver is configured to receive a second management frame broadcast by the first device, the layer 2 message carried by the second management frame is a device discovery request, and the type of the second management frame includes an action frame or a probe frame; and the transceiver is configured to send the first management frame to the first device in response to the second management frame, the layer 2 message carried by the first management frame is a device discovery response, and the type of the first management frame includes the action frame or the probe frame.
[0325] In an illustrative embodiment, the transceiver is configured to receive the second management frame broadcast by the first device on a working channel of the second device; and the transceiver is configured to send the first management frame to the first device on the working channel of the second device in response to the second management frame.
[0326] In an illustrative embodiment, the device discovery request corresponds to a first value of the data type subfield, and the device discovery request carries device information of the first device in the data subfield; and the device discovery response corresponds to a second value of the data type subfield, and the device discovery response carries device information of the second device in the data subfield.
[0327] In an illustrative embodiment, the transceiver is configured to broadcast the first management frame, the layer 2 message carried by the first management frame is a device discovery response, and the type of the first management frame is a beacon frame.
[0328] In an illustrative embodiment, the transceiver is configured to broadcast the first management frame on a working channel of the second device.
[0329] In an illustrative embodiment, the device discovery response corresponds to a second value of the data type subfield, and the device discovery response carries device information of the second device.
[0330] In an illustrative embodiment, the device information of the first device includes first capability information for describing a network configuration capability or a synchronization password capability of the first device.
[0331] In an illustrative embodiment, the device information of the second device includes at least one of the following information:
[0332] Second capability information for describing a network configuration capability or a PMK network connection capability of the second device;
[0333] State information for describing a network configuration state of the second device;
[0334] Product identification information for describing a model or a manufacturer of the second device;
[0335] Manufacturer data information for describing data defined by the manufacturer of the second device;
[0336] A random number for generating a shared key to encrypt network configuration information in a network configuration process.
[0337] In an illustrative embodiment, a computer readable storage medium is also provided, and the computer readable storage medium stores a computer program. The computer program is loaded and executed by a processor of a computer device to implement each step in the above device discovery method embodiment.
[0338] In an illustrative embodiment, a computer program product is provided, and the computer program product includes computer instructions stored in a computer readable storage medium. A processor of a computer device reads the computer instructions from the computer readable storage medium, and the processor executes the computer instructions to cause the computer device to perform the device discovery method provided in the above aspect.
[0339] The above description is merely illustrative of the application, and is not used to limit the application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the application shall be included in the protection scope of the application.
Claims
1. A device discovery method, characterized in that, Applied in a first device, the method includes: The interaction with the second device is achieved through n management frames, at least one of which includes a custom field, where n is a positive integer; Based on the organization unique identifier subfield in the first cell of the first management frame, the format standard corresponding to the first cell is determined. The first management frame is a management frame sent by the second device in the at least one management frame. In response to the first information cell corresponding to the target format standard, the device information of the second device is obtained from the data subfield in the first information cell; The custom field is used to enable device discovery. The custom field includes at least one information element, and the first information element within the at least one information element includes the following sub-fields: The length subfield is used to identify the length of the first cell; the length of the length subfield is fixed. The data subfield is used to describe the content information of the Layer 2 message; the length of the data subfield is variable. The organization unique identifier subfield is used to identify the format standard corresponding to the first information element.
2. The method according to claim 1, characterized in that, The first information element in the at least one information element further includes at least one of the following subfields: The tag number subfield is used to identify the custom field; The data type subfield is used to identify the type of the second-level message.
3. The method according to claim 2, characterized in that, The interaction with the second device via n management frames includes: Broadcast a second management frame. The second management frame carries a Layer 2 message that is a device discovery request. The type of the second management frame includes: an action frame or a probe frame. The first management frame sent by the second device in response to the second management frame is received. The second management frame carries a Layer 2 message, which is a device discovery response. The type of the first management frame includes the action frame or the probe frame.
4. The method according to claim 3, characterized in that, The broadcast second management frame includes: The second management frame is broadcast across all channels; The step of receiving the first management frame sent by the second device in response to the second management frame includes: The second device receives the first management frame sent by the second device in response to the second management frame on the second device's working channel.
5. The method according to claim 3, characterized in that, The data type subfield corresponding to the device discovery request takes the first value, and the data subfield corresponding to the device discovery request carries the device information of the first device; The data type subfield corresponding to the device discovery response takes a second value, and the data subfield corresponding to the device discovery response carries the device information of the second device.
6. The method according to claim 2, characterized in that, The interaction with the second device via n management frames includes: The first management frame broadcast by the second device is received. The first management frame carries a Layer 2 message, which is a device discovery response. The type of the first management frame is a beacon frame.
7. The method according to claim 6, characterized in that, Receiving the first management frame broadcast by the second device includes: The first management frame broadcast by the second device is received on the working channel of the second device.
8. The method according to claim 6, characterized in that, The data type subfield corresponding to the device discovery response takes a second value, and the data subfield corresponding to the device discovery response carries the device information of the second device.
9. The method according to claim 5, characterized in that, The device information of the first device includes: The first capability information is used to describe the network configuration capability or synchronization password capability of the first device.
10. The method according to claim 5, characterized in that, The device information of the second device includes at least one of the following: The second capability information is used to describe the network configuration capability or the network connection capability of the second device using the paired master key (PMK). Status information, used to describe the distribution network status of the second device; Product identification information is used to describe the model or manufacturer of the second device; Manufacturer data information, used to describe data customized by the manufacturer to which the second device belongs; Random numbers are used to generate shared keys to encrypt network information during the network configuration process.
11. The method according to any one of claims 1 to 10, characterized in that, The method further includes: The device discovery message is displayed to indicate that the second device has been discovered.
12. The method according to claim 11, characterized in that, The display device detected a notification message, including: Obtain the signal strength of the second device; In response to the signal strength meeting the prompting condition, the device discovery prompt message is displayed.
13. The method according to any one of claims 1 to 10, characterized in that, The method further includes: The device information of the second device is reported to the software development kit (SDK) corresponding to the second device.
14. The method according to any one of claims 1 to 10, characterized in that, The method further includes: Obtain application scenario analysis information of the first device, wherein the application scenario analysis information includes at least one of the geographical location information of the first device and the hotspot scanning information of the first device; Based on the application scenario analysis information, the application scenario corresponding to the first device is determined; In response to the application scenario being a homecoming scenario, the device is triggered to enter the device discovery state.
15. A device discovery method, characterized in that, When applied to a second device, the method includes: The interaction with the first device is achieved through n management frames, at least one of the n management frames including a custom field, where n is a positive integer; Wherein, the custom field in the first management frame of the at least one management frame is used to carry the device information of the second device, and the first management frame is a management frame sent by the second device; the first device is used to determine the format standard corresponding to the first information element according to the organization unique identifier subfield in the first information element of the first management frame, and in response to the first information element corresponding to the target format standard, obtain the device information of the second device from the data subfield in the first information element; The custom field is used to enable device discovery. The custom field includes at least one information element, and the first information element within the at least one information element includes the following sub-fields: The length subfield is used to identify the length of the first cell; the length of the length subfield is fixed. The data subfield is used to describe the content information of the Layer 2 message; the length of the data subfield is variable. The organization unique identifier subfield is used to identify the format standard corresponding to the first information element.
16. The method according to claim 15, characterized in that, The first information element in the at least one information element further includes at least one of the following subfields: The tag number subfield is used to identify the custom field; The data type subfield is used to identify the type of the second-level message.
17. The method according to claim 16, characterized in that, The interaction with the first device via n management frames includes: The system receives a second management frame broadcast by the first device. The second management frame carries a Layer 2 message that is a device discovery request. The type of the second management frame includes: an action frame or a probe frame. In response to the second management frame, the first management frame is sent to the first device. The second-level message carried by the first management frame is a device discovery response. The type of the first management frame includes: the action frame or the probe frame.
18. The method according to claim 17, characterized in that, The receiving of the second management frame broadcast by the first device includes: The second device receives the second management frame broadcast by the first device on its operating channel; The step of sending the first management frame to the first device in response to the second management frame includes: In response to the second management frame, the first management frame is sent to the first device via the working channel of the second device.
19. The method according to claim 17, characterized in that, The data type subfield corresponding to the device discovery request takes the first value, and the data subfield corresponding to the device discovery request carries the device information of the first device; The data type subfield corresponding to the device discovery response takes a second value, and the data subfield corresponding to the device discovery response carries the device information of the second device.
20. The method according to claim 16, characterized in that, The interaction with the first device via n management frames includes: The first management frame is broadcast. The layer 2 message carried by the first management frame is a device discovery response. The type of the first management frame is a beacon frame.
21. The method according to claim 20, characterized in that, The broadcast of the first management frame includes: The first management frame is broadcast on the working channel of the second device.
22. The method according to claim 20, characterized in that, The data type subfield corresponding to the device discovery response takes a second value, and the data subfield corresponding to the device discovery response carries the device information of the second device.
23. The method according to claim 19, characterized in that, The device information of the first device includes: The first capability information is used to describe the network configuration capability or synchronization password capability of the first device.
24. The method according to claim 19 or 22, characterized in that, The device information of the second device includes at least one of the following: The second capability information is used to describe the network configuration capability or the network connection capability of the second device using the paired master key (PMK). Status information, used to describe the distribution network status of the second device; Product identification information is used to describe the model or manufacturer of the second device; Manufacturer data information, used to describe data customized by the manufacturer to which the second device belongs; Random numbers are used to generate shared keys to encrypt network information during the network configuration process.
25. A device detection apparatus, characterized in that, Applied in a first device, the device includes: An interaction module is used to interact with a second device through n management frames, at least one of the n management frames including a custom field, where n is a positive integer; The device discovery module is configured to determine the format standard corresponding to the first information cell based on the organization unique identifier subfield in the first information cell of the first management frame, wherein the first management frame is a management frame sent by the second device in the at least one management frame; and in response to the first information cell corresponding to the target format standard, to obtain the device information of the second device from the data subfield in the first information cell. The custom field is used to enable device discovery. The custom field includes at least one information element, and the first information element within the at least one information element includes the following sub-fields: The length subfield is used to identify the length of the first cell; the length of the length subfield is fixed. The data subfield is used to describe the content information of the Layer 2 message; the length of the data subfield is variable. The organization unique identifier subfield is used to identify the format standard corresponding to the first information element.
26. A device detection apparatus, characterized in that, Applied in a second device, the device includes: An interaction module is used to interact with a first device through n management frames, at least one of the n management frames including a custom field, where n is a positive integer; Wherein, the custom field in the first management frame of the at least one management frame is used to carry the device information of the second device, and the first management frame is a management frame sent by the second device; the first device is used to determine the format standard corresponding to the first information element according to the organization unique identifier subfield in the first information element of the first management frame, and in response to the first information element corresponding to the target format standard, obtain the device information of the second device from the data subfield in the first information element; The custom field is used to enable device discovery. The custom field includes at least one information element, and the first information element within the at least one information element includes the following sub-fields: The length subfield is used to identify the length of the first cell; the length of the length subfield is fixed. The data subfield is used to describe the content information of the Layer 2 message; the length of the data subfield is variable. The organization unique identifier subfield is used to identify the format standard corresponding to the first information element.
27. A first device, characterized in that, The first device includes a processor, a memory, and a transceiver; The transceiver is used to interact with the second device via n management frames, at least one of the n management frames including a custom field, where n is a positive integer; The processor is configured to determine the format standard corresponding to the first information cell based on the organization unique identifier subfield in the first information cell of the first management frame, wherein the first management frame is a management frame sent by the second device in the at least one management frame; and in response to the first information cell corresponding to a target format standard, to obtain device information of the second device from the data subfield in the first information cell. The custom field is used to enable device discovery. The custom field includes at least one information element, and the first information element within the at least one information element includes the following sub-fields: The length subfield is used to identify the length of the first cell; the length of the length subfield is fixed. The data subfield is used to describe the content information of the Layer 2 message; the length of the data subfield is variable. The organization unique identifier subfield is used to identify the format standard corresponding to the first information element.
28. A second device, characterized in that, The second device includes a processor, a memory, and a transceiver; The transceiver is used to interact with the first device via n management frames, at least one of the n management frames including a custom field, where n is a positive integer; Wherein, the custom field in the first management frame of the at least one management frame is used to carry the device information of the second device, and the first management frame is a management frame sent by the second device; the first device is used to determine the format standard corresponding to the first information element according to the organization unique identifier subfield in the first information element of the first management frame, and in response to the first information element corresponding to the target format standard, obtain the device information of the second device from the data subfield in the first information element; The custom field is used to enable device discovery. The custom field includes at least one information element, and the first information element within the at least one information element includes the following sub-fields: The length subfield is used to identify the length of the first cell; the length of the length subfield is fixed. The data subfield is used to describe the content information of the Layer 2 message; the length of the data subfield is variable. The organization unique identifier subfield is used to identify the format standard corresponding to the first information element.
29. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, which is loaded and executed by a processor to implement the device discovery method as described in any one of claims 1 to 24.
Citation Information
Patent Citations
Terminal device and management frame sending method and receiving method
CN104426626A
Method for starting equipment finding function, server and terminal equipment
CN105873202A
Method for managing data transmission, reception, and communication of frames using wifi
CN109104744A