Device discovery method and apparatus, devices, and storage medium
Device discovery methods, a first device, and a non-transitory computer-readable storage medium are provided. The method is performed by the first device and includes: interacting with a second device by means of n management frames, at least one of the n management frames including a customized field, and n being a positive integer; and acquiring device information of the second device based on a customized field in a first management frame. The first management frame is a management frame transmitted by the second device to the first device among the at least one of the n management frames.
1 . A device discovery method, performed by a first device, the method comprising:
interacting with a second device by means of n management frames, at least one of the n management frames comprising a customized field, and n being a positive integer; and
acquiring device information of the second device based on the customized field in a first management frame, the first management frame being a management frame transmitted by the second device among the at least one of the n management frames;
wherein the customized field comprises at least one information element, and a first information element in the at least one information element comprises:
a tag number subfield configured to identify the customized field;
a data subfield configured to describe content information of layer two information; and
a data type subfield configured to identify a type of the layer two information.
2 . The method according to claim 1 , wherein the first information element in the at least one information element further comprises at least one of:
a length subfield configured to identify a length of the first information element; and
an organizationally unique identifier subfield configured to identify a format standard corresponding to the first information element.
3 . The method according to claim 2 , wherein the interacting with the second device by means of the n management frames comprises:
broadcasting a second management frame, layer two information carried in the second management frame being a device discovery request, and a type of the second management frame comprising: an action frame or a probe frame; and
receiving the first management frame transmitted by the second device in response to the second management frame, layer two information carried in the first management frame being a device discovery response, and a type of the first management frame comprising: the action frame or the probe frame.
4 . The method according to claim 3 , wherein,
a value of a data type subfield corresponding to the device discovery request is a first value, and a data subfield corresponding to the device discovery request carries device information of the first device; and
a value of a data type subfield corresponding to the device discovery response is a second value, and a data subfield corresponding to the device discovery response carries the device information of the second device.
5 . The method according to claim 4 , wherein the device information of the first device comprises:
first capability information configured to describe a provisioning capability of or a password synchronization capability of the first device.
6 . The method according to claim 4 , wherein the device information of the second device comprises at least one of:
second capability information configured to describe a provisioning capability of or a Pairwise Master Key (PMK) network connection capability of the second device;
state information configured to describe a provisioning state of the second device;
product identification information configured to describe a model of the second device or a vendor to which the second device belongs;
vendor data information configured to describe data customized by the vendor to which the second device belongs; and
a random number configured to generate a shared key to encrypt networking information in a provisioning process.
7 . The method according to claim 2 , wherein the interacting with the second device by means of the n management frames comprises:
receiving the first management frame broadcasted by the second device, layer two information carried in the first management frame being a device discovery response, and a type of the first management frame being a beacon frame.
8 . The method according to claim 7 , wherein a value of a data type subfield corresponding to the device discovery response is a second value, and a data subfield corresponding to the device discovery response carries the device information of the second device.
9 . The method according to claim 1 , further comprising:
displaying device discovery prompt information configured to prompt discovery of the second device,
wherein the displaying device discovery prompt information comprises:
acquiring a signal strength of the second device; and
displaying, in response to the signal strength satisfying a prompt condition, the device discovery prompt information.
10 . The method according to claim 1 , further comprising:
acquiring application scenario analysis information of the first device, the application scenario analysis information comprising at least one of geographical location information of the first device and hotspot scanning information of the first device;
determining an application scenario corresponding to the first device based on the application scenario analysis information; and
triggering, in response to the application scenario being a home-returning scenario, to enter a device discovery state.
11 . A non-transitory computer-readable storage medium, storing a computer program therein, wherein the computer program, when loaded and executed by a processor, implements the device discovery method according to claim 1 .
12 . A device discovery method, performed by a second device, the method comprising:
interacting with a first device by means of n management frames, at least one of the n management frames comprising a customized field, and n being a positive integer;
wherein the at least one of the n management frames comprises: a first management frame transmitted by the second device, and a customized field in the first management frame is configured to carry device information of the second device;
wherein the customized field comprises at least one information element, and a first information element in the at least one information element comprises:
a tag number subfield configured to identify the customized field;
a data subfield configured to describe content information of layer two information; and
a data type subfield configured to identify a type of the layer two information.
13 . The method according to claim 12 , wherein the first information element in the at least one information element further comprises at least one of:
a length subfield configured to identify a length of the first information element; and
an organizationally unique identifier subfield configured to identify a format standard corresponding to the first information element.
14 . The method according to claim 13 , wherein the interacting with the first device by means of the n management frames comprises:
receiving a second management frame broadcasted by the first device, layer two information carried in the second management frame being a device discovery request, and a type of the second management frame comprising: an action frame or a probe frame; and
transmitting, in response to the second management frame, the first management frame to the first device, layer two information carried in the first management frame being a device discovery response, and a type of the first management frame comprising: the action frame or the probe frame.
15 . The method according to claim 14 , wherein,
a value of a data type subfield corresponding to the device discovery request is a first value, and a data subfield corresponding to the device discovery request carries device information of the first device; and
a value of a data type subfield corresponding to the device discovery response is a second value, and a data subfield corresponding to the device discovery response carries the device information of the second device.
16 . The method according to claim 15 , wherein the device information of the first device comprises:
first capability information configured to describe a provisioning capability of or a password synchronization capability of the first device.
17 . The method according to claim 15 , wherein the device information of the second device comprises at least one of:
second capability information configured to describe a provisioning capability of or a Pairwise Master Key (PMK) network connection capability of the second device;
state information configured to describe a provisioning state of the second device;
product identification information configured to describe a model of the second device or a vendor to which the second device belongs;
vendor data information configured to describe data customized by the vendor to which the second device belongs; and
a random number configured to generate a shared key to encrypt networking information in a provisioning process.
18 . The method according to claim 13 , wherein the interacting with the first device by means of the n management frames comprises:
broadcasting the first management frame, layer two information carried in the first management frame being a device discovery response, and a type of the first management frame being a beacon frame.
19 . The method according to claim 18 , wherein a value of a data type subfield corresponding to a device discovery response is a second value, and a data subfield corresponding to the device discovery response carries the device information of the second device.
20 . A first device, comprising:
a transceiver configured to interact with a second device by means of n management frames, at least one of the n management frames comprising a customized field, and n being a positive integer; and
a processor configured to acquire device information of the second device based on the customized field in a first management frame, the first management frame being a management frame transmitted by the second device among the at least one of the n management frames;
wherein the customized field comprises at least one information element, and a first information element in the at least one information element comprises:
a tag number subfield configured to identify the customized field;
a data subfield configured to describe content information of layer two information; and
a data type subfield configured to identify a type of the layer two information.