WO2022247390A1 - Method and apparatus for measuring device distance, electronic device, and readable storage medium - Google Patents
Method and apparatus for measuring device distance, electronic device, and readable storage medium Download PDFInfo
- Publication number
- WO2022247390A1 WO2022247390A1 PCT/CN2022/079991 CN2022079991W WO2022247390A1 WO 2022247390 A1 WO2022247390 A1 WO 2022247390A1 CN 2022079991 W CN2022079991 W CN 2022079991W WO 2022247390 A1 WO2022247390 A1 WO 2022247390A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- distance
- electronic device
- parameter
- received signal
- signal strength
- Prior art date
Links
- 238000000034 method Methods 0.000 title claims abstract description 138
- 238000004364 calculation method Methods 0.000 claims abstract description 54
- 230000004044 response Effects 0.000 claims description 5
- 230000008569 process Effects 0.000 abstract description 51
- 238000012360 testing method Methods 0.000 description 28
- 230000006870 function Effects 0.000 description 13
- 238000004891 communication Methods 0.000 description 11
- 238000010586 diagram Methods 0.000 description 11
- 230000009286 beneficial effect Effects 0.000 description 10
- 238000012545 processing Methods 0.000 description 7
- 238000007667 floating Methods 0.000 description 5
- 230000003993 interaction Effects 0.000 description 5
- 238000005259 measurement Methods 0.000 description 5
- 230000001960 triggered effect Effects 0.000 description 4
- 230000001133 acceleration Effects 0.000 description 3
- 238000013480 data collection Methods 0.000 description 3
- 230000005540 biological transmission Effects 0.000 description 2
- 230000008859 change Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 230000002238 attenuated effect Effects 0.000 description 1
- 238000012512 characterization method Methods 0.000 description 1
- 238000006243 chemical reaction Methods 0.000 description 1
- 238000004590 computer program Methods 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000000605 extraction Methods 0.000 description 1
- 230000005484 gravity Effects 0.000 description 1
- 230000009467 reduction Effects 0.000 description 1
- 238000011160 research Methods 0.000 description 1
- 238000010079 rubber tapping Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G01—MEASURING; TESTING
- G01S—RADIO DIRECTION-FINDING; RADIO NAVIGATION; DETERMINING DISTANCE OR VELOCITY BY USE OF RADIO WAVES; LOCATING OR PRESENCE-DETECTING BY USE OF THE REFLECTION OR RERADIATION OF RADIO WAVES; ANALOGOUS ARRANGEMENTS USING OTHER WAVES
- G01S11/00—Systems for determining distance or velocity not using reflection or reradiation
- G01S11/02—Systems for determining distance or velocity not using reflection or reradiation using radio waves
- G01S11/06—Systems for determining distance or velocity not using reflection or reradiation using radio waves using intensity measurements
Definitions
- the present application relates to the field of the Internet of Things, and more specifically, to a method, device, electronic device, and readable storage medium for measuring device distance.
- the Internet of Things is an information carrier based on the Internet, traditional telecommunication networks, etc., which enables all ordinary physical objects that can be independently addressed to realize interconnection.
- IoT Internet of Things
- accuracy needs to be improved in the related manner of obtaining the distance between devices.
- the present application proposes a method, device, electronic device, and readable storage medium for measuring device distance, so as to improve the above problems.
- the present application provides a method for measuring the distance of a device, which is applied to a first electronic device, and the method includes: acquiring a broadcast signal transmitted by a second electronic device; based on the broadcast signal, determining the strength of the received signal and the distance A parameter; based on the received signal strength and the distance parameter, determine the distance between the second electronic device and the first electronic device.
- the present application provides a method for measuring the distance of a device, which is applied to a first electronic device, and the method includes: receiving a received signal strength and a distance parameter sent by an intermediate device, and the received signal strength and the distance parameter are the The intermediate device obtains according to the broadcast signal transmitted by the second electronic device; and obtains the distance between the second electronic device and the intermediate device based on the received signal strength and the distance parameter.
- the present application provides a device for measuring the distance of a device, which runs on a first electronic device, and the device includes: a signal acquisition unit, configured to acquire a broadcast signal transmitted by a second electronic device; a parameter acquisition unit, configured to Determine received signal strength and distance parameters based on the broadcast signal; a distance calculation unit configured to determine a distance between the second electronic device and the first electronic device based on the received signal strength and the distance parameter .
- the present application provides a device for measuring the distance of a device, which runs on the first electronic device.
- the device includes: a parameter acquisition unit, configured to receive the received signal strength and distance parameters sent by the intermediate device, and the received signal The strength and distance parameters are obtained by the intermediate device according to the broadcast signal transmitted by the second electronic device; the distance calculation unit is configured to obtain the second electronic device and the intermediate device based on the received signal strength and the distance parameter the distance between.
- the present application provides an electronic device, including one or more processors and memory; one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the The one or more processors are executed, and the one or more programs are configured to execute the above method.
- the present application provides a computer-readable storage medium, where a program code is stored in the computer-readable storage medium, wherein the above method is executed when the program code is running.
- FIG. 1 shows a schematic diagram of an application scenario of a method for measuring device distance proposed by the present application
- FIG. 2 shows a schematic diagram of an application scenario of another method for measuring device distance proposed by the present application
- FIG. 3 shows a flow chart of a method for measuring device distance proposed by an embodiment of the present application
- Fig. 4 shows a schematic diagram of the interaction between the first electronic device, the second electronic device and the third electronic device in the embodiment of the present application
- FIG. 5 shows a flow chart of a method for measuring device distance proposed by another embodiment of the present application.
- FIG. 6 shows a flow chart of a method for measuring device distance proposed by another embodiment of the present application.
- FIG. 7 shows a flow chart of a method for measuring device distance proposed by another embodiment of the present application.
- FIG. 8 shows a flow chart of a method for measuring device distance proposed by another embodiment of the present application.
- FIG. 9 shows a schematic diagram of a manner of displaying prompt information in an embodiment of the present application.
- FIG. 10 shows a schematic diagram of another way of displaying prompt information in the embodiment of the present application.
- Fig. 11 shows a schematic diagram of another way of displaying prompt information in the embodiment of the present application.
- Fig. 12 shows a schematic diagram of the prompt information corresponding to the wireless headset in the embodiment of the present application
- FIG. 13 shows a flow chart of a method for measuring device distance proposed by another embodiment of the present application.
- FIG. 14 shows a structural block diagram of an apparatus for measuring device distance proposed by an embodiment of the present application.
- Fig. 15 shows a structural block diagram of an apparatus for measuring device distance proposed in another embodiment of the present application.
- Fig. 16 shows a structural block diagram of an apparatus for measuring device distance proposed in another embodiment of the present application.
- Fig. 17 is a storage unit for storing or carrying program codes for realizing the method for measuring device distance according to the embodiment of the present application according to the embodiment of the present application.
- FIG. 18 shows a storage unit used for storing or carrying program codes for implementing the method for measuring device distance according to an embodiment of the present application in real time in the present application.
- the Internet of Things is a network concept that extends and expands its client to any item and item for information exchange and communication on the basis of the concept of the Internet.
- IoT technology some scenarios can be configured in the IoT system.
- the controlled device may include one or more of devices such as wireless earphones, TVs, air conditioners, projectors, smart lights, smart sockets, air purifiers, and smart speakers.
- the distance between two devices needs to be calculated, so that subsequent applications can be performed based on the calculated distance.
- the inventors found that there is still a problem that the accuracy of the related method of obtaining the distance between devices needs to be improved.
- the measuring device may calculate the distance between the device under test and the measuring device in combination with the received signal strength of the broadcast signal sent by the device under test.
- the measuring device calculates the distance to different devices under test in combination with the received signal strength of the broadcast signal
- the calculation method adopted is the same.
- the same manner may include that the adopted distance calculation formulas are the same, or the parameters involved in the distance calculation formulas are the same.
- the inventor found in the research that different devices under test have different shapes or structures, so the transmitted broadcast signal has different attenuation degrees due to the different shapes or structures. This will cause even if two devices under test with different shapes or structures are actually at the same distance from the test device, but because the transmitted broadcast signal is attenuated by its own shape or structure, the measurement device will calculate the distance to the test device. The two devices will be at different distances from themselves.
- the inventor proposes a method, device, electronic device and readable storage medium for measuring device distance in the present application.
- the first electronic device (measuring device) will obtain the received signal strength of the broadcast signal sent by the second electronic device, and obtain the distance parameter corresponding to the second electronic device according to the broadcast signal, and then based on the The received signal strength and the distance parameter are used to determine the distance between the second electronic device and the first electronic device. Therefore, in the process of calculating the distance, the required distance parameter can be obtained in a targeted manner for the device (second electronic device) that needs to perform distance calculation, instead of performing distance calculation for each need. All devices adopt the same distance parameter, which is beneficial to adapt to different devices that need to perform distance calculation in the process of calculating distance, so as to improve the accuracy of distance calculation between devices.
- the scene shown in FIG. 1 includes a smart phone 100 , an electronic device 200 , and an electronic device 300 .
- the smart phone 100 can perform data interaction with the electronic device 200 and the electronic device 300 in a wireless communication manner.
- the smart phone 100 may be the first electronic device that performs ranging, and the electronic device 200 and the electronic device 300 may be the second electronic devices respectively.
- the distance between the measuring device and the device under test is obtained through the interaction between the device for distance measurement and the device under test. Furthermore, the distance between the device under test and other devices can also be measured by the measuring device.
- the electronic device 200 performs wireless communication with the smart phone 100 and the electronic device 300 respectively, while the smart phone 100 and the electronic device 300 do not perform wireless communication. Then in the scenario shown in FIG. 2 , the electronic device 200 may transmit the parameters required for calculating the distance to the smart phone 100 , and then the smart phone can calculate the distance between the electronic device 200 and the electronic device 300 .
- wireless communication may be performed based on Bluetooth
- wireless communication may be performed based on WiFi
- wireless communication may also be performed based on ZigBee.
- the smart phone 100 as the measuring device in FIG. 1 and FIG. 2 is only an exemplary example.
- the measurement device can also be other devices, for example, a tablet computer, a smart bracelet, a smart watch, and the like.
- a method for measuring device distance provided by an embodiment of the present application is applied to a first electronic device, and the method includes:
- S110 Acquire a broadcast signal transmitted by the second electronic device.
- the first electronic device can be understood as a device for performing distance calculation
- the second electronic device is a device for measuring distance.
- the first electronic device may calculate the distance of the second electronic device from itself.
- the second electronic device can transmit broadcast signals after being turned on, and the first electronic device can determine to obtain the broadcast signals transmitted by the second electronic device after receiving the broadcast signals transmitted by the second electronic device.
- S120 Determine received signal strength and distance parameters based on the broadcast signal.
- the received signal strength of the broadcast signal can be obtained, and then the received signal strength RSSI (Received Signal Strength Indication) of the broadcast signal transmitted by the second electronic device can be obtained.
- RSSI Receiveived Signal Strength Indication
- the distance parameter can be understood as a parameter for determining a rule for calculating the distance between the second electronic device and the first electronic device.
- determining a rule for calculating the distance between the second electronic device and the first electronic device may include determining a target rule from a plurality of rules for calculating the distance between the second electronic device and the first electronic device.
- the rules that can be used to calculate the distance between the first electronic device and the second electronic device include rule p1, rule p2, and rule p3, and each rule needs to use the device whose distance is measured to emit to the first electronic device. The received signal strength of the device's broadcast signal. Then, in the case where the specific rule content of each rule is different, the calculated distance between the second electronic device and the first electronic device may be different.
- the distance parameter corresponding to the electronic device can be used to characterize the corresponding rule when the device is used as a device whose distance is measured. For example, if the rule corresponding to the distance parameter of the second electronic device is the rule p2, then the subsequent first electronic device will calculate the distance based on the rule p2.
- determining the rule for calculating the distance between the second electronic device and the first electronic device may include taking the distance parameter as a parameter included in the specified rule, and the specified rule is used for calculating the distance between the second electronic device distance from the first electronic device.
- the specified rule may include multiple parameters and the manner of mutual operation among the multiple parameters.
- the formula corresponding to the specified rule may be:
- d represents the calculated distance value
- RSSI represents the received signal strength of the broadcast signal
- A represents the reference distance
- B represents the path loss factor.
- RSSI, parameter A and parameter B are absolute values corresponding to actual values.
- the obtained received signal strength RSSI is -50dbm
- the corresponding value of parameter RSSI is -50 (actual value) Take the absolute value, which is 50.
- the distance parameter may include parameter A and parameter B in the above formula.
- the parameter A and parameter B corresponding to different electronic devices may be different, then in the subsequent case where the distance between the second electronic device and the first electronic device needs to be calculated, the parameter corresponding to the second electronic device may be A and parameter B, as parameter A and parameter B in the specified rule.
- determining the rule for calculating the distance between the second electronic device and the first electronic device may include using the distance parameter as the parameter of the initial parameter in the specified rule for calibration, and the specified rule is still used for calculating the second electronic device.
- the specified rule for the distance between the second electronic device and the first electronic device and then calculate the distance between the second electronic device and the first electronic device based on the specified rule after parameter calibration.
- the specifying rule is still the formula shown above.
- the parameter A and parameter B can be understood as initial parameters, that is, the parameter A and parameter B respectively have their own initial values. The initial value of parameter B is adjusted in order to realize the calibration of parameter A and parameter B.
- the distance parameter corresponding to the second electronic device includes "a” and "b”, it can be understood as adding a to parameter A in the specified rule, and adding b to parameter B in the specified rule.
- “a” and “b” can be positive or negative.
- the attenuation of the transmitted broadcast signal is different.
- some external forms or internal structures may not attenuate broadcast signals, while some external forms or internal structures may not attenuate broadcast signals.
- the structure may cause a large attenuation to the broadcast signal, so for different electronic devices, setting the corresponding distance parameters according to its external shape or internal structure will help reduce the accuracy of the external shape or internal structure for the measured distance influences.
- the distance parameter may be a pre-configured parameter.
- the distance parameters correspondingly configured for different electronic devices may be different.
- the specific content that the distance parameter can represent can be various, so in the process of configuring the distance parameter, the distance parameter corresponding to the electronic device can be configured according to the content actually represented by the distance parameter.
- the distance parameter to determine a target rule from multiple rules to calculate the distance between devices Take the distance parameter to determine a target rule from multiple rules to calculate the distance between devices as an example. In this case, you can first obtain the actual distance between the measuring device and the device under test (the device whose distance is measured), and then use multiple rules to calculate the measurement based on the received signal strength of the broadcast signal sent by the device under test. The distance between the device and the device under test, the rule corresponding to the calculated distance and the actual distance can be used as the rule corresponding to the device under test, and the distance parameter representing the corresponding rule can be configured as the device under test The corresponding distance parameter.
- the rules for calculating the distance between the measuring device and the device under test include rule p1, rule p2 and rule p3, the actual distance between the measuring device and the device under test is 5 meters, wherein the measuring device obtains After the received signal strength of the broadcast signal transmitted by the device under test, the distance value calculated according to the received signal strength and rule p1 is 4.5 meters, and the distance value calculated according to the received signal strength and rule p2 is 4.8 meters, according to The received signal strength and the distance value calculated by rule p3 are 5.1 meters, and the distance calculated according to rule p3 is the closest to the actual distance, then rule p3 can be used as the rule corresponding to the device under test, and then the characterization rule The distance parameter of p3 is configured as the distance parameter corresponding to the device under test.
- the distance parameter is a parameter included in the specified rule for calculating the distance between devices.
- the rules used to calculate the distance between different devices are all the specified rules.
- the actual distance between devices, and each time the actual distance is changed, the measuring device will obtain the received signal strength of the broadcast signal transmitted by the current device under test, and then obtain multiple sets of actual distances and received signals as shown in the following table Correspondence of signal strength.
- the parameters in the specified rules can be calculated through the correspondence between multiple sets of actual distances and received signal strengths in the above table, and then the calculated parameters can be used as the distance parameters corresponding to the device under test. For example, consider specifying the rule as the following formula:
- the values of parameter A and parameter B in the specified rule can be calculated as the distance parameters corresponding to the device under test.
- the method of configuring the corresponding distance parameter for each electronic device is the same as the aforementioned distance parameter used to calculate the distance between devices.
- the method of specifying the parameters included in the rules is the same, that is, the distance parameters corresponding to the electronic device are configured by collecting multiple sets of corresponding relationships between actual distances and received signal strengths, so details are not repeated here.
- the distance parameter corresponding to the second electronic device can be read in S120.
- the broadcast signal transmitted by the second electronic device may be understood as a wireless signal carrying a broadcast data packet.
- the second electronic device may carry its own corresponding distance parameter in the broadcast data packet sent, so that the first electronic device can still obtain the second electronic device even if no wireless connection is established with the second electronic device.
- establishing a wireless connection may be understood as a preparatory operation before data transmission. For example, if the first electronic device needs to send video data to the second electronic device, then a wireless connection needs to be established first, and the video data transmission will not start until the wireless connection is completed.
- the second electronic device can send the broadcast data packet based on the Bluetooth BLE mode or the Wi-Fi Aware mode.
- the second electronic device may carry a corresponding distance parameter in a specific field in the broadcast data packet sent in the process of sending the broadcast data packet in the Bluetooth BLE mode.
- a broadcast packet format as shown in the following table.
- the field named Length is used to represent the length of the broadcast data packet
- the field named Type represents the connection type of the current data packet
- the field named MFG ID represents the sending of the broadcast data packet
- the field named iBeacon indicates that the current broadcast data packet is generated based on iBeacon mode
- the field named MD5 represents the MD5-based encrypted device identification carried in the broadcast data packet
- the field name is Major , Minor, and Ref are used to carry characteristic values to distinguish different data packets sent by the same device.
- the distance parameter corresponding to the second electronic device can be added at the field of length 16Byte.
- the data packet format and the name of each field shown in the above table are only exemplary, and the data packet format and field name of the broadcast data sent by the second electronic device can also be changed according to the actual data carried. .
- the first electronic device can also scan the broadcast data packet based on the Bluetooth BLE mode or the Wi-Fi Aware mode, so that after scanning the broadcast data packet sent by the second electronic device, the scanned data packet is sent from the scanned second electronic device.
- the second electronic device can also broadcast its own distance parameter in a similar manner, and correspondingly, the mobile terminal can also obtain the distance parameter of the second electronic device in a similar manner. 2. The distance parameter of the electronic device.
- S130 Determine a distance between the second electronic device and the first electronic device based on the received signal strength and the distance parameter.
- the distance between the second electronic device and the first electronic device can be obtained.
- RSSI represents the received signal strength of the broadcast signal transmitted by the second electronic device
- parameter A and parameter B are specifically parameters A and B corresponding to the second electronic device
- the calculated d represents the second electronic device The distance from the first electronic device.
- the second electronic device first configures its corresponding distance parameter, and then sends a broadcast data packet carrying the distance parameter corresponding to the second electronic device during subsequent operation. After obtaining the distance parameter of the second electronic device from the broadcast data packet sent by the second electronic device, the first electronic device may use the distance parameter to calculate the distance to the second electronic device. Similarly, for the third electronic device, the third electronic device will configure its corresponding distance parameter first, and then send a broadcast data packet carrying the distance parameter corresponding to the third electronic device during subsequent operation. After the first electronic device obtains the distance parameter of the third electronic device from the broadcast data packet sent by the third electronic device, it may use the distance parameter to calculate the distance to the third electronic device.
- This embodiment provides a method for measuring the distance of a device, so that in the process of calculating the distance, in the process of calculating the distance, the required distance parameter can be targeted for the device (second electronic device) that needs to perform distance calculation.
- the required distance parameter can be targeted for the device (second electronic device) that needs to perform distance calculation.
- the distance parameter corresponding to the device (second electronic device) that requires distance measurement will first be added to the broadcast signal sent by the second electronic device, so that the first electronic device In the process of obtaining the received signal strength of the broadcast signal transmitted by the device, the distance parameter of the second electronic device can be obtained directly from the broadcast signal, so that the first electronic device can simultaneously obtain the The received signal strength and distance parameters improve the convenience for the first electronic device to obtain the received signal strength and distance parameters.
- the received signal strength and distance parameters corresponding to the second electronic device are obtained according to the broadcast signal transmitted by the second electronic device, and then based on The received signal strength and the distance parameter determine the distance between the second electronic device and the first electronic device. Therefore, in the process of calculating the distance, the required distance parameter can be obtained in a targeted manner for the device (second electronic device) that needs to perform distance calculation, instead of performing distance calculation for each need. All devices adopt the same distance parameter, which is beneficial to adapt to different devices that need to perform distance calculation in the process of calculating distance, so as to improve the accuracy of distance calculation between devices.
- a method for measuring device distance provided by an embodiment of the present application is applied to a first electronic device, and the method includes:
- S310 Acquire a broadcast signal transmitted by the second electronic device.
- S320 Based on the broadcast signal, determine received signal strength and an identifier of the second electronic device.
- the identification is information for distinguishing the second electronic device from other electronic devices for uniqueness.
- the identification of the electronic device there may be multiple ways to implement the identification of the electronic device.
- the name of the electronic device may be used as the identifier of the electronic device, and the physical address of the electronic device may also be used as the identifier of the electronic device.
- the first electronic device may obtain the identifier of the second electronic device from a broadcast signal transmitted by the second electronic device. In this manner, the identifier of the second electronic device will be directly added to the broadcast signal transmitted by the second electronic device.
- the first electronic device may determine the identifier of the second electronic device according to the composition format of the data sent by the second electronic device.
- an electronic device may generate data to be sent through a specified protocol, and the protocol defines a composition format of the generated data.
- the first electronic device can determine the identifier corresponding to the second electronic device by identifying the composition format of the data.
- the corresponding relationship between the composition format and the identification can be established in advance, then after obtaining the composition format of the data sent by the second electronic device, the identification of the second electronic device can be obtained according to the correspondence between the composition format and the identification .
- S330 Determine a distance parameter corresponding to the identifier of the second electronic device according to the pre-established correspondence between the identifier and the distance parameter.
- the corresponding relationship between the identifier and the distance parameter in this embodiment may be established during the process of configuring the distance parameter corresponding to the device under test in the foregoing embodiment.
- the corresponding relationship can be stored in the form of the following data table.
- the mark 1 corresponds to the distance parameter 1
- the mark 2 corresponds to the distance parameter 2
- the mark 3 corresponds to the distance parameter 3
- the mark 4 corresponds to the distance parameter 4.
- the first electronic device may be stored in the first electronic device before the first electronic device leaves the factory. Then in this way, after obtaining the identifier of the second electronic device, the first electronic device can obtain the distance parameter corresponding to the identifier of the second electronic device by searching locally.
- the corresponding relationship can be stored in the cloud server after being suggested, then the first electronic device can send the identification of the second electronic device to the cloud server after obtaining the identification of the second electronic device The query instruction, and then make the cloud server query the distance parameter corresponding to the identifier of the second electronic device in response to the query instruction, and return the query distance parameter to the first electronic device.
- the correspondence between the identification and the distance parameter can also be stored in the cloud server synchronously, and can also Periodically update the corresponding relationship stored in the cloud server. And, after the cloud server finishes updating the corresponding relationship, it can also push the updated corresponding relationship to the first electronic device.
- S340 Determine a distance between the second electronic device and the first electronic device based on the received signal strength and the distance parameter.
- the first electronic device may determine which method to use to obtain the distance parameter corresponding to the second electronic device according to the current actual environment.
- the first electronic device may first detect whether the corresponding relationship between the distance parameter and the identifier has been stored in the local or cloud server, and if it detects that the corresponding relationship between the distance parameter and the identifier has been stored in the local or cloud server, then In the process of obtaining the distance parameter corresponding to the second electronic device, the distance parameter corresponding to the second electronic device is directly obtained according to the correspondence between the distance parameter and the identifier stored in the local or cloud server. Moreover, if it is determined that the distance parameter corresponding to the second electronic device is obtained according to the corresponding relationship stored in the local or cloud server, the first electronic device will not perform the extraction from the broadcast data packet sent by the second electronic device. The operation of the distance parameter in order to save resources of the first electronic device.
- the first electronic device can analyze the broadcast data packet sent by the second electronic device during the process of obtaining the distance parameter In order to get the distance parameter from it.
- the first electronic device may detect whether there is a corresponding relationship stored locally or in a cloud service in multiple stages. As a manner, the first electronic device may start to detect after being turned on, or may start to detect after detecting that a specified application program is started.
- the designated application program may be an application program used to calculate the distance between devices.
- the first electronic device may first obtain the type of the second electronic device, and then determine which method to use according to the type of the second electronic device. A distance parameter corresponding to the second electronic device is acquired.
- the electronic device can increase its own distance parameter in the broadcast data packet during the process of sending the broadcast data packet by changing the program of the electronic device to generate the broadcast data packet in advance.
- some electronic devices Changes to the procedure for producing broadcast packets may not be supported. Therefore, some electronic devices may not be able to add their own corresponding distance parameters in the broadcast data packet, then the first electronic device can record the type of electronic device that supports adding distance parameters in the broadcast data packet by storing the type list . Then, in the process of obtaining the distance parameter, the first electronic device can first obtain the type of the second electronic device, and then inquire whether the type of the second electronic device is recorded in the type list.
- the distance parameter corresponding to the second electronic device is obtained from the received broadcast data packet of the second electronic device. If there is no type of the second electronic device in the type list, the distance parameter corresponding to the second electronic device is obtained by obtaining the identification of the second electronic device and closing the correspondence between the identification and the distance parameter.
- the electronic device may also add a version number corresponding to the distance parameter in the broadcast data packet.
- the version number of the distance parameter corresponding to the identifier may also be increased.
- the distance parameter corresponding to the electronic device may be corrected, and the corrected distance parameter will be different from the previous distance parameter.
- the distance calculated based on the distance parameter corresponding to the latest version number may be the most accurate.
- the first electronic device can obtain the version number corresponding to the distance parameter obtained from the broadcast data packet sent by the second electronic device as the first version number, and the acquisition is based on the local or Then the version number corresponding to the distance parameter obtained in the cloud server is the second version number, and then the latest version number of the distance parameter corresponding to the first version number and the second version number is obtained as the target version number, and then the target version number
- the corresponding distance parameter is used as the acquired version number corresponding to the second electronic device. Furthermore, if it is determined that the first version number and the second version number are the same, then one of the aforementioned determination methods may be selected to determine how to obtain the corresponding distance parameter of the second electronic device.
- the first version number is the latest version number
- determine that the distance parameter corresponding to the first version number is the latest distance parameter, and correspondingly use the first version number as the target version number.
- determine that the second version number is the latest version number
- determine that the distance parameter corresponding to the second version number is the latest distance parameter, and correspondingly use the second version number as the target version number.
- a selection control may be configured in the first electronic device, and then the electronic device may determine which method to use to obtain the distance parameter corresponding to the second electronic device through the current state corresponding to the selection control.
- the user of the first electronic device can change the current state corresponding to the selection control by operating the selection control. For example, if the selection control includes a first state and a second state, wherein the first state corresponds to obtaining the distance parameter corresponding to the second electronic device from the broadcast data packet, and the second state corresponds to obtaining the distance parameter corresponding to the second electronic device from the local or cloud server. The distance parameter corresponding to the second electronic device is obtained from the stored correspondence.
- the first electronic device detects that the selection control is in the first state during the process of obtaining the distance parameter corresponding to the second electronic device, then after obtaining the broadcast data packet sent by the second electronic device, it will The distance parameter corresponding to the second electronic device is obtained from the packet. Detecting that the selection control is in the second state, the distance parameter corresponding to the second electronic device will be obtained based on the correspondence between the identifier and the distance parameter stored in the local or cloud server.
- This embodiment provides a method for measuring the distance of a device, so that in the process of calculating the distance, in the process of calculating the distance, the required distance parameter can be targeted for the device (second electronic device) that needs to perform distance calculation.
- the required distance parameter can be targeted for the device (second electronic device) that needs to perform distance calculation.
- the corresponding relationship between the device identifier and the distance parameter is established in advance, so that after the identifier of the second electronic device is obtained, the distance parameter of the second electronic device can be obtained according to the corresponding relationship .
- a method for measuring device distance provided by an embodiment of the present application is applied to a first electronic device, and the method includes:
- S410 Acquire a broadcast signal transmitted by the second electronic device.
- S420 Based on the broadcast signal, determine a received signal strength and a distance parameter, where the distance parameter is a parameter corresponding to a specified rule, and the specified rule is used to obtain a distance between devices according to the received signal strength of the broadcast signal.
- S430 Determine a distance between the second electronic device and the first electronic device based on the specified rule, received signal strength, and the distance parameter.
- the distance parameter being a parameter corresponding to the specified rule may be understood as the distance parameter being a parameter included in the specified rule.
- the distance parameter being a parameter included in the specified rule may be understood as the distance parameter being a parameter included in the specified rule.
- the parameters included in the formula include parameter RSSI, parameter A and parameter B, and then the distance parameter may be any one or both of parameter A and parameter B among them.
- the distance parameter being a parameter corresponding to the specified rule may be understood as the distance parameter being a parameter for calibrating the parameters included in the specified rule.
- the determining the distance between the second electronic device and the first electronic device based on the specified rule, the received signal strength and the distance parameter includes: based on the distance Parameters: Calibrate the parameters included in the specified rules to obtain calibrated parameters; determine the relationship between the second electronic device and the first electronic device based on the specified rules, the received signal strength, and the calibrated parameters distance between devices.
- the specified rule is the following formula as an example, the formula is:
- the parameters included in the formula include parameters RSSI, parameter A, and parameter B
- the calibration of the parameters included in the specified rules through the distance parameter can be understood as the calibration of the initial values of the parameters included in the specified regulations.
- both parameters A and B can have their own initial values.
- the distance parameters corresponding to the second electronic device include "a" and "b”, it can be understood as adding parameter A in the specified rule to On a, add b to the parameter B in the specified rule.
- the specified rules in the process of calculating the second electronic device and the first electronic device will be transformed into the following form:
- This embodiment provides a method for measuring the distance of a device, so that in the process of calculating the distance based on the specified rule, the distance parameter required by the specified rule can be targeted at the device that needs to perform distance calculation (the second electronic device) ) for targeted acquisition, instead of using the same distance parameter for each device that needs to calculate the distance in the case of calculating the distance based on the specified rules, which is conducive to making it possible to adapt to the distance-based process Different devices that need to perform distance calculations in order to improve the accuracy of distance calculations between devices.
- a method for measuring device distance provided by an embodiment of the present application is applied to a first electronic device, and the method includes:
- S510 Acquire a broadcast signal transmitted by the second electronic device.
- S520 Based on the broadcast signal, determine a received signal strength and a distance parameter, where the distance parameter represents a rule of a distance between corresponding selected computing devices.
- the distance parameter can be understood as a rule identifier, and after obtaining the rule identifier corresponding to the second electronic device, the corresponding rule can be obtained as the target rule according to the rule identifier.
- S540 Determine the distance between the second electronic device and the first electronic device based on the received signal strength and the target rule.
- This embodiment provides a method for measuring the distance of a device, so that in the process of calculating the distance, the target rule currently used for calculating the distance can be determined according to the distance parameter corresponding to the second electronic device, and then according to the target The distance between the second electronic device and the first electronic device is calculated by using rules and received signal strength.
- the rules for calculating the distance can be obtained in a targeted manner for the device (the second electronic device) that needs to calculate the distance, instead of using the same calculation rule for each device that needs to calculate the distance. It is beneficial to adapt to different devices that need to perform distance calculation in the process of calculating distance, so as to improve the accuracy of distance calculation between devices.
- a method for measuring device distance provided by an embodiment of the present application is applied to a first electronic device, and the method includes:
- S610 Acquire a broadcast signal transmitted by the second electronic device.
- S620 Determine received signal strength and distance parameters based on the broadcast signal.
- S630 Determine a distance between the second electronic device and the first electronic device based on the received signal strength and the distance parameter.
- S640 Detect whether the distance is greater than a distance threshold.
- the distance threshold If the distance is greater than or equal to the distance threshold, go back and re-execute the above steps to obtain the distance between the second electronic device and the first electronic device again.
- the distance between the electronic devices represents the distance between the electronic devices. If the distance between the electronic devices is larger, it means that the distance between the electronic devices is farther, and if the distance between the electronic devices is smaller, it means that the distance between the electronic devices is closer. Then, when the distance between the electronic devices is small to a certain extent, the prompt information corresponding to the second electronic device may be triggered.
- the prompt information can be used to prompt the current distance relationship between the second electronic device and the first electronic device, and can also be used to prompt the user that functions related to the second electronic device can be triggered currently.
- the distance relationship may include the distance between the second electronic device and the first electronic device. For example, as shown in FIG. 9 , in the scene shown in FIG.
- the smartphone held by the user may be the first electronic device, and the TV and air conditioner included in the scene may be the second electronic device respectively.
- the smart phone 100 can display the distance information display interface 10 , and the distance between the TV, the air conditioner and the smart phone 100 is displayed on the distance information display interface 10 .
- the distance information display interface 10 For example, “the TV is 5 meters away from you” and "the air conditioner is 7 meters away from you” displayed on the distance information display interface 10 .
- the distance between the second electronic device and the first electronic device when the distance between the second electronic device and the first electronic device is small enough to a certain extent (for example, less than the distance threshold), it may be triggered between the first electronic device and the second electronic device to communicate with the second electronic device. corresponding function.
- the second electronic device as a TV as an example
- the first electronic device may project the screen being displayed by the first electronic device to the TV.
- a floating icon 11 when the smart phone 100 as the first electronic device detects that the distance between the TV as the second electronic device and itself is less than the distance threshold, a floating icon 11 may be displayed on the screen as a prompt information. The floating icon 11 is used to remind the user that the screen of the smart phone 100 can be cast to the TV at present.
- an operation corresponding to the second electronic device is performed.
- different second electronic devices may have different functions, and the first electronic device may correspondingly perform different operations, so as to trigger the second electronic device to perform corresponding functions.
- FIG. 11 please refer to FIG. 11 again.
- the smart phone 100 detects a touch operation acting on the floating icon 11, then it will perform the screen projection operation corresponding to the TV, and then the screen will be projected. screen to the TV for playback.
- the user may be using the first electronic device to play a game.
- the game interface 20 is displayed in full screen. If the content is suspended directly on the game interface, the suspended content may cause interference to the user.
- the screen size of the game interface 20 originally displayed in full screen can be reduced, and the status bar 30 can be displayed in the vacant position after reduction.
- prompt information 31 is displayed in the status bar 30 .
- the prompt information 31 may also respond to the user's touch operation.
- the second electronic device in the embodiment of the present application may be other devices besides the television and the air conditioner described above.
- smart watches, smart bracelets, and wireless earphones can also be used.
- the wireless earphone can usually be placed in a matching earphone box.
- the smart phone 100 may display prompt information on the interface 40 .
- the prompt information in the interface 40 is used to remind the user that the earphone box matched with the wireless earphone is currently in an open state.
- a control named connection may be displayed on the interface 40 , and if a touch operation on the control named connection is detected, then the establishment of a connection between the smart phone 100 and the wireless earphone may be triggered.
- This embodiment provides a method for measuring the distance of a device, so that in the process of calculating the distance, in the process of calculating the distance, the required distance parameter can be targeted for the device (second electronic device) that needs to perform distance calculation.
- the required distance parameter can be targeted for the device (second electronic device) that needs to perform distance calculation.
- the obtained distance between the second electronic device and the first electronic device will be further compared with the distance threshold, and then when the distance is smaller than the distance threshold, display the distance between the second electronic device and the second electronic device.
- the prompt information corresponding to the electronic device may also be used to respond to a touch operation, so as to perform an operation corresponding to the second electronic device. Therefore, it is realized that the first electronic device can interact with the second electronic device more accurately.
- a method for measuring device distance provided by an embodiment of the present application is applied to a first electronic device, and the method includes:
- S710 Receive received signal strength and distance parameters sent by the intermediate device, where the received signal strength and distance parameters are acquired by the intermediate device according to the broadcast signal transmitted by the second electronic device.
- the first electronic device in this embodiment is still a device for performing distance calculation. Moreover, in this embodiment, the first electronic device may acquire the distance between the other two devices. Correspondingly, the intermediate device will detect the received signal strength of the received broadcast signal transmitted by the second electronic device, and then send the obtained received signal strength to the first electronic device.
- the first electronic device may send a data collection instruction to the intermediate device, and then the intermediate device starts to obtain the broadcast signal transmitted by the second electronic device in response to the data collection instruction, and sends the collected received signal strength to the second electronic device. an electronic device.
- the first electronic device may obtain the distance parameter corresponding to the second electronic device based on the manner in the foregoing embodiments.
- the intermediate device can obtain the distance parameter corresponding to the second electronic device based on the method in the foregoing embodiments, and then send the distance parameter together with the received signal strength to the first electronic device, so that the first electronic device The device can obtain the distance parameter and received signal strength corresponding to the second electronic device while traversing.
- the intermediate device will also send the distance parameter of the second electronic device to the first electronic device.
- S720 Acquire a distance between the second electronic device and the intermediate device based on the received signal strength and the distance parameter.
- the first electronic device After the first electronic device acquires the distance parameter and received signal strength, it can calculate the distance between the second electronic device and the intermediate device based on the manner in the foregoing embodiments. Moreover, the calculated distance can be displayed in real time. So that the user can know the distance between the second electronic device and the intermediate device in time.
- the second electronic device may be determined by the first electronic device.
- the broadcast data packet sent by the electronic device may carry its own identity, so that the electronic device that receives the broadcast data packet can determine which devices can currently receive the broadcast data packet sent by it.
- the data collection instruction sent by the first electronic device to the intermediate device may carry the identifier of the device under test, and then the intermediate device may use the device corresponding to the identifier as the second electronic device, and acquire the second electronic device. The received signal strength corresponding to the electronic device.
- the intermediate device may be various devices.
- the intermediate device may be a router, a gateway, a smart bracelet, a smart watch, or a smart phone.
- the received information corresponding to the second electronic device will be obtained according to the broadcast signal transmitted by the second electronic device.
- Signal strength and distance parameters Based on the received signal strength and the distance parameters, the distance between the second electronic device and the intermediate device is acquired. Therefore, in the process of calculating the distance, the required distance parameter can be obtained in a targeted manner for the device (second electronic device) that needs to perform distance calculation, instead of performing distance calculation for each need. All devices adopt the same distance parameter, which is beneficial to adapt to different devices that need to perform distance calculation in the process of calculating distance, so as to improve the accuracy of distance calculation between devices.
- an apparatus 800 for measuring device distance provided by an embodiment of the present application, which operates on the first electronic device, and the apparatus 800 includes:
- a signal acquiring unit 810 configured to acquire a broadcast signal transmitted by the second electronic device
- a parameter acquisition unit 820 configured to determine received signal strength and distance parameters based on the broadcast signal
- the distance calculation unit 830 is configured to determine the distance between the second electronic device and the first electronic device based on the received signal strength and the distance parameter.
- the parameter acquisition unit 820 is specifically configured to receive the broadcast data packet sent by the second electronic device; obtain and determine the received signal strength and distance parameters from the broadcast data packet. in this way.
- the parameter acquisition unit 820 is specifically configured to determine the strength of the received signal and the identity of the second electronic device based on the broadcast signal; The distance parameter corresponding to the identity of the device.
- the distance parameter is a parameter corresponding to a specified rule
- the specified rule is used to obtain the distance between devices according to the received signal strength of the broadcast signal.
- the distance calculating unit 830 is specifically configured to determine the distance between the second electronic device and the first electronic device based on the specified rule, received signal strength and the distance parameter.
- the distance parameter is a parameter included in the specified rule.
- the distance parameter is a parameter used to calibrate the parameters included in the specified rule, and the distance calculation unit 830 is specifically configured to calibrate the parameters included in the specified rule based on the distance parameter, to obtain Calibrated parameters: determining the distance between the second electronic device and the first electronic device based on the specified rule, the received signal strength, and the calibrated parameters.
- the distance parameter represents a rule of the distance between the corresponding selected computing devices.
- the distance calculation unit 830 is specifically configured to acquire a rule corresponding to the distance parameter as a target rule; determine the distance between the second electronic device and the first electronic device based on the received signal strength and the target rule distance.
- the apparatus further includes: a function triggering unit 840, configured to display prompt information corresponding to the second electronic device if the distance is less than a distance threshold. Furthermore, the function triggering unit 840 is further configured to execute an operation corresponding to the second electronic device in response to a touch operation acting on the prompt information.
- the device for measuring the distance of a device in the process of calculating the distance of the device, will obtain the received signal strength and distance parameters corresponding to the second electronic device according to the broadcast signal transmitted by the second electronic device, and then based on The received signal strength and the distance parameter determine the distance between the second electronic device and the first electronic device. Therefore, in the process of calculating the distance, the required distance parameter can be obtained in a targeted manner for the device (second electronic device) that needs to perform distance calculation, instead of performing distance calculation for each need. All devices adopt the same distance parameter, which is beneficial to adapt to different devices that need to perform distance calculation in the process of calculating distance, so as to improve the accuracy of distance calculation between devices.
- an apparatus 900 for measuring device distance provided by an embodiment of the present application, which operates on the first electronic device, and the apparatus 900 includes:
- the parameter acquisition unit 910 is configured to receive received signal strength and distance parameters sent by the intermediate device, and the received signal strength and distance parameters are acquired by the intermediate device according to the broadcast signal transmitted by the second electronic device;
- the distance calculation unit 930 is configured to acquire the distance between the second electronic device and the intermediate device based on the received signal strength and the distance parameter.
- the device for measuring the distance between devices in this embodiment, in the process of calculating the device distance between the second electronic device and the intermediate device, will obtain the corresponding reception information of the second electronic device according to the broadcast signal transmitted by the second electronic device. Signal strength and distance parameters. Based on the received signal strength and the distance parameters, the distance between the second electronic device and the intermediate device is acquired. Therefore, in the process of calculating the distance, the required distance parameter can be obtained in a targeted manner for the device (second electronic device) that needs to perform distance calculation, instead of performing distance calculation for each need. All devices adopt the same distance parameter, which is beneficial to adapt to different devices that need to perform distance calculation in the process of calculating distance, so as to improve the accuracy of distance calculation between devices.
- the method, device, electronic device, and readable storage medium provided by the present application for measuring the distance of a device will obtain the second distance according to the broadcast signal transmitted by the second electronic device in the process of calculating the distance of the device.
- the received signal strength and the distance parameter corresponding to the two electronic devices, and then based on the received signal strength and the distance parameter, the distance between the second electronic device and the first electronic device is determined. Therefore, in the process of calculating the distance, the required distance parameter can be obtained in a targeted manner for the device (second electronic device) that needs to perform distance calculation, instead of performing distance calculation for each need. All devices adopt the same distance parameter, which is beneficial to adapt to different devices that need to perform distance calculation in the process of calculating distance, so as to improve the accuracy of distance calculation between devices.
- the electronic device 1000 includes one or more (only one is shown in the figure) processors 102 , memory 104 and network module 106 coupled to each other.
- the memory 104 stores programs capable of executing the contents of the foregoing embodiments, and the processor 102 can execute the programs stored in the memory 104 .
- the processor 102 may include one or more processing cores.
- the processor 102 uses various interfaces and circuits to connect various parts of the entire electronic device 1000, and executes or executes instructions, programs, code sets, or instruction sets stored in the memory 104, and calls data stored in the memory 104 to execute Various functions of the electronic device 1000 and processing data.
- the processor 102 may adopt at least one of Digital Signal Processing (Digital Signal Processing, DSP), Field-Programmable Gate Array (Field-Programmable Gate Array, FPGA), and Programmable Logic Array (Programmable Logic Array, PLA). implemented in the form of hardware.
- DSP Digital Signal Processing
- FPGA Field-Programmable Gate Array
- PLA Programmable Logic Array
- the processor 102 may integrate one or a combination of a central processing unit (Central Processing Unit, CPU), an image processor (Graphics Processing Unit, GPU), a modem, and the like.
- CPU Central Processing Unit
- GPU Graphics Processing Unit
- the CPU mainly handles the operating system, user interface and application programs, etc.
- the GPU is used to render and draw the displayed content
- the modem is used to handle wireless communication. It can be understood that the above modem may also not be integrated into the processor 102, but implemented by a communication chip alone.
- the memory 104 may include random access memory (Random Access Memory, RAM), and may also include read-only memory (Read-Only Memory). Memory 104 may be used to store instructions, programs, codes, sets of codes, or sets of instructions.
- the memory 104 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as a touch function, a sound playback function, an image playback function, etc.) , instructions for implementing the following method embodiments, and the like.
- the device for measuring device distance in the foregoing embodiments may also be stored in the memory 104 .
- the network module 106 is used to implement information interaction between the electronic device 1000 and other devices, for example, transmitting device control instructions, manipulation request instructions, and status information acquisition instructions. However, when the electronic device 200 is specifically a different device, its corresponding network module 106 may be different.
- the sensor module 108 may include at least one sensor.
- the sensor module 108 may include, but is not limited to: a light sensor, a motion sensor, a pressure sensor, an infrared heat sensor, a distance sensor, an acceleration sensor, and other sensors.
- the pressure sensor may be a sensor for detecting pressure generated by pressing on the electronic device 1000 . That is, the pressure sensor detects pressure generated by contact or press between the user and the electronic device, eg, contact or press between the user's ear and the mobile terminal. Therefore, the pressure sensor can be used to determine whether contact or pressure occurs between the user and the electronic device 1000, and the magnitude of the pressure.
- the acceleration sensor can detect the magnitude of acceleration in various directions (generally three axes), and can detect the magnitude and direction of gravity when it is still, and can be used to identify the application of electronic equipment 1000 attitude (such as horizontal and vertical screen switching, related games, magnetometer, etc.) Attitude calibration), vibration recognition related functions (such as pedometer, tapping), etc.
- the electronic device 1000 may also be configured with other sensors such as a gyroscope, a barometer, a hygrometer, and a thermometer, which will not be repeated here.
- the electronic device 1000 is used as the smart phone 100 in the application environment shown in FIG. 1 or FIG.
- Receive and send electromagnetic waves realize the mutual conversion between electromagnetic waves and electrical signals, and communicate with communication networks or other devices.
- the radio frequency module may include various existing circuit elements for performing these functions, such as antenna, radio frequency transceiver, digital signal processor, encryption/decryption chip, Subscriber Identity Module (SIM) card, memory and so on.
- SIM Subscriber Identity Module
- the radio frequency module can perform information interaction with the base station by sending or receiving electromagnetic waves.
- FIG. 18 shows a structural block diagram of a computer-readable storage medium provided by an embodiment of the present application.
- Program codes are stored in the computer-readable medium 900, and the program codes can be invoked by a processor to execute the methods described in the foregoing method embodiments.
- the computer readable storage medium 900 may be an electronic memory such as flash memory, EEPROM (Electrically Erasable Programmable Read Only Memory), EPROM, hard disk, or ROM.
- the computer-readable storage medium 900 includes a non-transitory computer-readable storage medium (non-transitory computer-readable storage medium).
- the computer-readable storage medium 900 has a storage space for program code 910 for executing any method steps in the above methods. These program codes can be read from or written into one or more computer program products.
- Program code 910 may, for example, be compressed in a suitable form.
Landscapes
- Physics & Mathematics (AREA)
- Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Radar, Positioning & Navigation (AREA)
- Remote Sensing (AREA)
- Radar Systems Or Details Thereof (AREA)
Abstract
Disclosed in embodiments of the present application are a method and apparatus for measuring a device distance, an electronic device, and a readable storage medium. The method comprises: obtaining a broadcast signal transmitted by a second electronic device; determining received signal strength and a distance parameter on the basis of the broadcast signal; and determining a distance between the second electronic device and a first electronic device on the basis of the received signal strength and the distance parameter. In this way, in a distance calculation process, a required distance parameter can be obtained in a targeted manner for a device (the second electronic device) needing distance calculation instead of the situation that the same distance parameter is used for each device needing distance calculation, thereby facilitating adaption to different devices needing distance calculation in the distance calculation process, such that the accuracy of the distance calculation between devices is improved.
Description
相关申请的交叉引用Cross References to Related Applications
本申请要求于2021年5月26日提交的申请号为202110580797.7的中国申请的优先权,其在此出于所有目的通过引用将其全部内容并入本文。This application claims priority to Chinese Application No. 202110580797.7, filed May 26, 2021, which is hereby incorporated by reference in its entirety for all purposes.
本申请涉及物联网领域,更具体地,涉及一种测量设备距离的方法、装置、电子设备以及可读存储介质。The present application relates to the field of the Internet of Things, and more specifically, to a method, device, electronic device, and readable storage medium for measuring device distance.
物联网(Internet of Things)是一个基于互联网、传统电信网等信息承载体,让所有能够被独立寻址的普通物理对象实现互联互通的网络。在物联网系统中,通常可以包括有多个设备,在一些场景下需要获取设备之间的距离。但是,相关的获取设备之间的距离的方式还存在准确性有待提升的问题。The Internet of Things (Internet of Things) is an information carrier based on the Internet, traditional telecommunication networks, etc., which enables all ordinary physical objects that can be independently addressed to realize interconnection. In an IoT system, there are usually multiple devices, and in some scenarios it is necessary to obtain the distance between devices. However, there is still a problem that accuracy needs to be improved in the related manner of obtaining the distance between devices.
发明内容Contents of the invention
鉴于上述问题,本申请提出了一种测量设备距离的方法、装置、电子设备以及可读存储介质,以改善上述问题。In view of the above problems, the present application proposes a method, device, electronic device, and readable storage medium for measuring device distance, so as to improve the above problems.
第一方面,本申请提供了一种测量设备距离的方法,应用于第一电子设备,所述方法包括:获取第二电子设备发射的广播信号;基于所述广播信号,确定接收信号强度及距离参数;基于所述接收信号强度以及所述距离参数,确定所述第二电子设备与所述第一电子设备之间的距离。In the first aspect, the present application provides a method for measuring the distance of a device, which is applied to a first electronic device, and the method includes: acquiring a broadcast signal transmitted by a second electronic device; based on the broadcast signal, determining the strength of the received signal and the distance A parameter; based on the received signal strength and the distance parameter, determine the distance between the second electronic device and the first electronic device.
第二方面,本申请提供了一种测量设备距离的方法,应用于第一电子设备,所述方法包括:接收中间设备发送的接收信号强度以及距离参数,所述接收信号强度以及距离参数为所述中间设备根据第二电子设备发射的广播信号获取;基于所述接收信号强度以及所述距离参数,获取所述第二电子设备与所述中间设备之间的距离。In a second aspect, the present application provides a method for measuring the distance of a device, which is applied to a first electronic device, and the method includes: receiving a received signal strength and a distance parameter sent by an intermediate device, and the received signal strength and the distance parameter are the The intermediate device obtains according to the broadcast signal transmitted by the second electronic device; and obtains the distance between the second electronic device and the intermediate device based on the received signal strength and the distance parameter.
第三方面,本申请提供了一种测量设备距离的装置,运行于第一电子设备,所述装置包括:信号获取单元,用于获取第二电子设备发射的广播信号;参数获取单元,用于基于所述广播信号,确定接收信号强度及距离参数;距离计算单元,用于基于所述接收信号强度以及所述距离参数,确定所述第二电子设备与所述第一电子设备之间的距离。In a third aspect, the present application provides a device for measuring the distance of a device, which runs on a first electronic device, and the device includes: a signal acquisition unit, configured to acquire a broadcast signal transmitted by a second electronic device; a parameter acquisition unit, configured to Determine received signal strength and distance parameters based on the broadcast signal; a distance calculation unit configured to determine a distance between the second electronic device and the first electronic device based on the received signal strength and the distance parameter .
第四方面,本申请提供了一种测量设备距离的装置,运行于第一电子设备,所述装置包括:参数获取单元,用于接收中间设备发送的接收信号强度以及距离参数,所述接收信号强度以及距离参数为所述中间设备根据第二电子设备发射的广播信号获取;距离计算单元,用于基于所述接收信号强度以及所述距离参数,获取所述第二电子设备与所述中间设备之间的距离。In a fourth aspect, the present application provides a device for measuring the distance of a device, which runs on the first electronic device. The device includes: a parameter acquisition unit, configured to receive the received signal strength and distance parameters sent by the intermediate device, and the received signal The strength and distance parameters are obtained by the intermediate device according to the broadcast signal transmitted by the second electronic device; the distance calculation unit is configured to obtain the second electronic device and the intermediate device based on the received signal strength and the distance parameter the distance between.
第五方面,本申请提供了一种电子设备,包括一个或多个处理器以及存储器;一个或多个程序, 其中所述一个或多个程序被存储在所述存储器中并被配置为由所述一个或多个处理器执行,所述一个或多个程序配置用于执行上述的方法。In a fifth aspect, the present application provides an electronic device, including one or more processors and memory; one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the The one or more processors are executed, and the one or more programs are configured to execute the above method.
第六方面,本申请提供了一种计算机可读存储介质,所述计算机可读存储介质中存储有程序代码,其中,在所述程序代码运行时执行上述的方法。In a sixth aspect, the present application provides a computer-readable storage medium, where a program code is stored in the computer-readable storage medium, wherein the above method is executed when the program code is running.
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings that need to be used in the description of the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present application. For those skilled in the art, other drawings can also be obtained based on these drawings without any creative effort.
图1示出了本申请提出的一种测量设备距离的方法的应用场景的示意图;FIG. 1 shows a schematic diagram of an application scenario of a method for measuring device distance proposed by the present application;
图2示出了本申请提出的另一种测量设备距离的方法的应用场景的示意图;FIG. 2 shows a schematic diagram of an application scenario of another method for measuring device distance proposed by the present application;
图3示出了本申请实施例提出的一种测量设备距离的方法的流程图;FIG. 3 shows a flow chart of a method for measuring device distance proposed by an embodiment of the present application;
图4示出了本申请实施例中第一电子设备与第二电子设备以及第三电子设备进行交互的示意图;Fig. 4 shows a schematic diagram of the interaction between the first electronic device, the second electronic device and the third electronic device in the embodiment of the present application;
图5示出了本申请再一实施例提出的一种测量设备距离的方法的流程图;FIG. 5 shows a flow chart of a method for measuring device distance proposed by another embodiment of the present application;
图6示出了本申请又一实施例提出的一种测量设备距离的方法的流程图;FIG. 6 shows a flow chart of a method for measuring device distance proposed by another embodiment of the present application;
图7示出了本申请又一实施例提出的一种测量设备距离的方法的流程图;FIG. 7 shows a flow chart of a method for measuring device distance proposed by another embodiment of the present application;
图8示出了本申请又一实施例提出的一种测量设备距离的方法的流程图;FIG. 8 shows a flow chart of a method for measuring device distance proposed by another embodiment of the present application;
图9示出了本申请实施例中一种显示提示信息的方式的示意图;FIG. 9 shows a schematic diagram of a manner of displaying prompt information in an embodiment of the present application;
图10示出了本申请实施例中另一种显示提示信息的方式的示意图;FIG. 10 shows a schematic diagram of another way of displaying prompt information in the embodiment of the present application;
图11示出了本申请实施例中再一种显示提示信息的方式的示意图;Fig. 11 shows a schematic diagram of another way of displaying prompt information in the embodiment of the present application;
图12示出了本申请实施例中无线耳机对应的提示信息的示意图;Fig. 12 shows a schematic diagram of the prompt information corresponding to the wireless headset in the embodiment of the present application;
图13示出了本申请又一实施例提出的一种测量设备距离的方法的流程图;FIG. 13 shows a flow chart of a method for measuring device distance proposed by another embodiment of the present application;
图14示出了本申请实施例提出的一种测量设备距离的装置的结构框图;FIG. 14 shows a structural block diagram of an apparatus for measuring device distance proposed by an embodiment of the present application;
图15示出了本申请又一实施例提出的一种测量设备距离的装置的结构框图;Fig. 15 shows a structural block diagram of an apparatus for measuring device distance proposed in another embodiment of the present application;
图16示出了本申请又一实施例提出的一种测量设备距离的装置的结构框图;Fig. 16 shows a structural block diagram of an apparatus for measuring device distance proposed in another embodiment of the present application;
图17是本申请实施例的用于保存或者携带实现根据本申请实施例的测量设备距离的方法的程序代码的存储单元。Fig. 17 is a storage unit for storing or carrying program codes for realizing the method for measuring device distance according to the embodiment of the present application according to the embodiment of the present application.
图18示出了本申请实时中的用于保存或者携带实现根据本申请实施例的测量设备距离的方法的程序代码的存储单元。FIG. 18 shows a storage unit used for storing or carrying program codes for implementing the method for measuring device distance according to an embodiment of the present application in real time in the present application.
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。The following will clearly and completely describe the technical solutions in the embodiments of the application with reference to the drawings in the embodiments of the application. Apparently, the described embodiments are only some of the embodiments of the application, not all of them. Based on the embodiments in this application, all other embodiments obtained by persons of ordinary skill in the art without creative efforts fall within the protection scope of this application.
物联网是在互联网概念的基础上,将其客户端延伸和扩展到任何物品与物品之间,进行信息交换和通信的一种网络概念。随着物联网技术的发展,在物联网系统中可以配置一些场景。对于配置的场景,可以涉及到多个受控设备,而且多个受控设备之间具有一定的联动关系,能够协同工作。其中,受控设备可以包括无线耳机、电视、空调、投影仪、智能灯、智能插座、以及空气净化器、智能音箱等设备中的一个或多个。The Internet of Things is a network concept that extends and expands its client to any item and item for information exchange and communication on the basis of the concept of the Internet. With the development of IoT technology, some scenarios can be configured in the IoT system. For the configuration scenario, multiple controlled devices may be involved, and the multiple controlled devices have a certain linkage relationship and can work together. Wherein, the controlled device may include one or more of devices such as wireless earphones, TVs, air conditioners, projectors, smart lights, smart sockets, air purifiers, and smart speakers.
在一些场景下,需要计算两个设备之间的距离,以便基于所计算得到的距离来进行后续的应用。但是,发明人发现相关的获取设备之间的距离的方式还存在准确性有待提升的问题。例如,在一种 相关的方式中,测量设备可以结合待测设备所发送的广播信号的接收信号强度,来计算待测设备与测量设备之间的距离。In some scenarios, the distance between two devices needs to be calculated, so that subsequent applications can be performed based on the calculated distance. However, the inventors found that there is still a problem that the accuracy of the related method of obtaining the distance between devices needs to be improved. For example, in a related manner, the measuring device may calculate the distance between the device under test and the measuring device in combination with the received signal strength of the broadcast signal sent by the device under test.
但是,测量设备结合广播信号的接收信号强度来计算与不同待测设备之间的距离时,所采用的计算方式都是相同的。其中,方式相同可以包括所采用的距离计算公式相同,或者距离计算公式涉及的参数相同。但是,发明人在研究中发现,不同的待测设备自身形态或者结构是会有所不同的,那么所发射的广播信号因为自身形态或者结构是会有所不同而有不同的衰减程度。这种就会造成即使两个自身形态或者结构不同的待测设备,实际与测试设备的距离相同,但是因为所发射的广播信号因为自身形态或者结构的衰减程度,而造成测量设备会计算到该两个设备与自身会处于不同的距离。However, when the measuring device calculates the distance to different devices under test in combination with the received signal strength of the broadcast signal, the calculation method adopted is the same. Wherein, the same manner may include that the adopted distance calculation formulas are the same, or the parameters involved in the distance calculation formulas are the same. However, the inventor found in the research that different devices under test have different shapes or structures, so the transmitted broadcast signal has different attenuation degrees due to the different shapes or structures. This will cause even if two devices under test with different shapes or structures are actually at the same distance from the test device, but because the transmitted broadcast signal is attenuated by its own shape or structure, the measurement device will calculate the distance to the test device. The two devices will be at different distances from themselves.
因此,发明人提出了本申请中的一种测量设备距离的方法、装置、电子设备以及可读存储介质。在计算设备距离的过程中,第一电子设备(测量设备)会获取第二电子设备发送的广播信号的接收信号强度,以及根据该广播信号获取与第二电子设备对应的距离参数,再基于所述接收信号强度以及所述距离参数,确定所述第二电子设备与所述第一电子设备之间的距离。从而通过上述方式使得在计算距离的过程中,对于所需的距离参数,可以针对需要进行距离计算的设备(第二电子设备)进行针对性的获取,而不会是对每个需要进行距离计算的设备均采用相同的距离参数,有利于使得在计算距离的过程中能够适应不同的需要进行距离计算的设备,以便提升设备间距离计算的准确性。Therefore, the inventor proposes a method, device, electronic device and readable storage medium for measuring device distance in the present application. In the process of calculating the distance of the device, the first electronic device (measuring device) will obtain the received signal strength of the broadcast signal sent by the second electronic device, and obtain the distance parameter corresponding to the second electronic device according to the broadcast signal, and then based on the The received signal strength and the distance parameter are used to determine the distance between the second electronic device and the first electronic device. Therefore, in the process of calculating the distance, the required distance parameter can be obtained in a targeted manner for the device (second electronic device) that needs to perform distance calculation, instead of performing distance calculation for each need. All devices adopt the same distance parameter, which is beneficial to adapt to different devices that need to perform distance calculation in the process of calculating distance, so as to improve the accuracy of distance calculation between devices.
下面先对本申请实施例涉及的场景进行介绍。The following firstly introduces the scenarios involved in the embodiment of the present application.
如图1所示,在图1所示的场景中包括有智能手机100,电子设备200、电子设备300。其中,智能手机100可以分别与电子设备200和电子设备300之间以无线通信的方式进行数据交互。在图1所示的场景中,智能手机100可以为进行测距的第一电子设备,电子设备200和电子设备300可以分别为第二电子设备。As shown in FIG. 1 , the scene shown in FIG. 1 includes a smart phone 100 , an electronic device 200 , and an electronic device 300 . Wherein, the smart phone 100 can perform data interaction with the electronic device 200 and the electronic device 300 in a wireless communication manner. In the scenario shown in FIG. 1 , the smart phone 100 may be the first electronic device that performs ranging, and the electronic device 200 and the electronic device 300 may be the second electronic devices respectively.
其中,在图1所示的场景中,是由进行距离测量的设备和待测设备之间进行的交互,进而测量得到测量设备和待测设备之间的距离。再者,也可以由测量设备来测测待测设备与其他设备之间的距离。例如,如图2所示,在图2所示的场景中,电子设备200分别与智能手机100和电子设备300之间进行无线通信,而智能手机100与电子设备300之间没有进行无线通信。那么在图2所示的场景中,电子设备200可以将计算距离所需的参数传输给智能手机100,进而由智能手机来计算得到电子设备200与电子设备300之间的距离。Wherein, in the scenario shown in FIG. 1 , the distance between the measuring device and the device under test is obtained through the interaction between the device for distance measurement and the device under test. Furthermore, the distance between the device under test and other devices can also be measured by the measuring device. For example, as shown in FIG. 2 , in the scenario shown in FIG. 2 , the electronic device 200 performs wireless communication with the smart phone 100 and the electronic device 300 respectively, while the smart phone 100 and the electronic device 300 do not perform wireless communication. Then in the scenario shown in FIG. 2 , the electronic device 200 may transmit the parameters required for calculating the distance to the smart phone 100 , and then the smart phone can calculate the distance between the electronic device 200 and the electronic device 300 .
其中,智能手机100、电子设备200以及电子设备300之间相互进行无线通信的方式可以有多种。例如,可以基于蓝牙的方式进行无线通信,可以基于WiFi的方式进行无线通信,还可以基于ZigBee的方式进行无线通信。Among them, there may be multiple ways for the smart phone 100 , the electronic device 200 and the electronic device 300 to perform wireless communication with each other. For example, wireless communication may be performed based on Bluetooth, wireless communication may be performed based on WiFi, and wireless communication may also be performed based on ZigBee.
需要说明的是,图1和图2中作为测量设备的智能手机100只是示例性的举例。测量设备除了可以为智能手机100以外,还可以为其他的设备,例如,还可以为平板电脑,智能手环、智能手表等。It should be noted that the smart phone 100 as the measuring device in FIG. 1 and FIG. 2 is only an exemplary example. In addition to the smart phone 100, the measurement device can also be other devices, for example, a tablet computer, a smart bracelet, a smart watch, and the like.
下面将结合附图具体描述本申请的各实施例。Various embodiments of the present application will be described in detail below with reference to the accompanying drawings.
请参阅图3,本申请实施例提供的一种测量设备距离的方法,应用于第一电子设备,所述方法包括:Please refer to Fig. 3, a method for measuring device distance provided by an embodiment of the present application is applied to a first electronic device, and the method includes:
S110:获取第二电子设备发射的广播信号。S110: Acquire a broadcast signal transmitted by the second electronic device.
其中,第一电子设备可以理解为进行距离计算的设备,第二电子设备为被测量距离的设备。例如,第一电子设备可以计算第二电子设备距离自身的距离。Wherein, the first electronic device can be understood as a device for performing distance calculation, and the second electronic device is a device for measuring distance. For example, the first electronic device may calculate the distance of the second electronic device from itself.
第二电子设备可以在开机以后进行广播信号的发射,第一电子设备在接收到第二电子设备发射的广播信号后,则可以确定获取得到第二电子设备发射的广播信号。The second electronic device can transmit broadcast signals after being turned on, and the first electronic device can determine to obtain the broadcast signals transmitted by the second electronic device after receiving the broadcast signals transmitted by the second electronic device.
S120:基于所述广播信号,确定接收信号强度及距离参数。S120: Determine received signal strength and distance parameters based on the broadcast signal.
在获取得到第二电子设备发射的广播信号后,则可以对广播信号的接收信号强度进行获取,进而得到第二电子设备发射的广播信号的接收信号强度RSSI(Received Signal Strength Indication)。After obtaining the broadcast signal transmitted by the second electronic device, the received signal strength of the broadcast signal can be obtained, and then the received signal strength RSSI (Received Signal Strength Indication) of the broadcast signal transmitted by the second electronic device can be obtained.
其中,距离参数可以理解为确定用于计算第二电子设备与第一电子设备之间距离的规则的参数。Wherein, the distance parameter can be understood as a parameter for determining a rule for calculating the distance between the second electronic device and the first electronic device.
作为一种方式,确定用于计算第二电子设备与第一电子设备之间距离的规则,可以包括从多个规则中确定一个目标规则来用于计算第二电子设备与第一电子设备之间距离。示例性的,可以用于计算第一电子设备和第二电子设备之间距离的规则包括有规则p1、规则p2以及规则p3,并且每种规则均需要使用被测量距离的设备发射到第一电子设备的广播信号的接收信号强度。那么在每种规则具体的规则内容不同的情况下,所计算出来的第二电子设备和第一电子设备之间的距离可能是不同的。电子设备对应的距离参数则可以用于表征当该设备作为被测量距离的设备时所对应的规则。例如,若第二电子设备的距离参数对应的规则为规则p2,那么后续第一电子设备则会基于该规则p2来进行距离的计算。As one manner, determining a rule for calculating the distance between the second electronic device and the first electronic device may include determining a target rule from a plurality of rules for calculating the distance between the second electronic device and the first electronic device. distance. Exemplarily, the rules that can be used to calculate the distance between the first electronic device and the second electronic device include rule p1, rule p2, and rule p3, and each rule needs to use the device whose distance is measured to emit to the first electronic device. The received signal strength of the device's broadcast signal. Then, in the case where the specific rule content of each rule is different, the calculated distance between the second electronic device and the first electronic device may be different. The distance parameter corresponding to the electronic device can be used to characterize the corresponding rule when the device is used as a device whose distance is measured. For example, if the rule corresponding to the distance parameter of the second electronic device is the rule p2, then the subsequent first electronic device will calculate the distance based on the rule p2.
作为另外一种方式,确定用于计算第二电子设备与第一电子设备之间距离的规则,可以包括将距离参数作为指定规则中所包括的参数,该指定规则为用于计算第二电子设备与第一电子设备之间距离的。需 要说明的是,在指定规则中可以包括有多个参数以及多个参数之间相互运算的方式。示例性的,该指定规则对应的公式可以为:As another way, determining the rule for calculating the distance between the second electronic device and the first electronic device may include taking the distance parameter as a parameter included in the specified rule, and the specified rule is used for calculating the distance between the second electronic device distance from the first electronic device. It should be noted that the specified rule may include multiple parameters and the manner of mutual operation among the multiple parameters. Exemplarily, the formula corresponding to the specified rule may be:
其中,d表征所计算出的距离值,RSSI表征广播信号的接收信号强度,A表征参考距离,B表征路径损耗因子。其中,RSSI、参数A和参数B均为对应实际值的绝对值,例如,获取的接收信号强度RSSI为-50dbm,那么在代入到上述公式中时参数RSSI对应的值为-50(实际值)取绝对值,即50。其中,距离参数可以包括上述公式中的参数A和参数B。而对于不同的电子设备所对应的参数A和参数B可以是不同的,那么在后续需要计算第二电子设备与第一电子设备之间距离的情况下,则可以将第二电子设备对应的参数A和参数B,作为指定规则中的参数A和参数B。Wherein, d represents the calculated distance value, RSSI represents the received signal strength of the broadcast signal, A represents the reference distance, and B represents the path loss factor. Among them, RSSI, parameter A and parameter B are absolute values corresponding to actual values. For example, the obtained received signal strength RSSI is -50dbm, then when substituted into the above formula, the corresponding value of parameter RSSI is -50 (actual value) Take the absolute value, which is 50. Wherein, the distance parameter may include parameter A and parameter B in the above formula. The parameter A and parameter B corresponding to different electronic devices may be different, then in the subsequent case where the distance between the second electronic device and the first electronic device needs to be calculated, the parameter corresponding to the second electronic device may be A and parameter B, as parameter A and parameter B in the specified rule.
作为再一种方式,确定用于计算第二电子设备与第一电子设备之间距离的规则,可以包括将距离参数作为校准指定规则中的初始参数的参数,该指定规则依然为用于计算第二电子设备与第一电子设备之间距离的指定规则,进而基于进行参数校准后的指定规则来计算第二电子设备与第一电子设备之间距离。示例性的,该指定规则依然为前述示出的公式。那么其中的参数A和参数B则可以理解为初始参数,即该参数A和参数B分别对应有各自的初始值,那么在这种方式下,则电子设备对应的距离参数则会对参数A和参数B的初始值进行调整,以便实现对参数A和参数B的校准。例如,第二电子设备对应的距离参数包括“a”和“b”,则可以理解为将指定规则中的参数A加上a,将指定规则中的参数B加上b。其中,“a”和“b”可以为正值,也可以为负值。As yet another way, determining the rule for calculating the distance between the second electronic device and the first electronic device may include using the distance parameter as the parameter of the initial parameter in the specified rule for calibration, and the specified rule is still used for calculating the second electronic device. The specified rule for the distance between the second electronic device and the first electronic device, and then calculate the distance between the second electronic device and the first electronic device based on the specified rule after parameter calibration. Exemplarily, the specifying rule is still the formula shown above. Then the parameter A and parameter B can be understood as initial parameters, that is, the parameter A and parameter B respectively have their own initial values. The initial value of parameter B is adjusted in order to realize the calibration of parameter A and parameter B. For example, if the distance parameter corresponding to the second electronic device includes "a" and "b", it can be understood as adding a to parameter A in the specified rule, and adding b to parameter B in the specified rule. Among them, "a" and "b" can be positive or negative.
需要说明的是,对于不同的电子设备而言,自身的外部形态或者内部结构是有所区别的。那么对于不同的外部形态或者内部结构,对于所发射的广播信号的衰减是有所不同的,例如,有的外部形态或者内部结构可能并不会对广播信号造成衰减,而有的外部形态或者内部结构可能会对广播信号造成较大的衰减,那么对于不同的电子设备,根据其外部形态或者内部结构来设置对应的距离参数,有利于降低外部形态或者内部结构对于所测量的间距的准确性的影响。It should be noted that, for different electronic devices, their external forms or internal structures are different. Then for different external forms or internal structures, the attenuation of the transmitted broadcast signal is different. For example, some external forms or internal structures may not attenuate broadcast signals, while some external forms or internal structures may not attenuate broadcast signals. The structure may cause a large attenuation to the broadcast signal, so for different electronic devices, setting the corresponding distance parameters according to its external shape or internal structure will help reduce the accuracy of the external shape or internal structure for the measured distance influences.
在本申请实施例中,距离参数可以为预先配置的参数。并且,对于不同的电子设备所对应配置的距离参数可以不同。并且,如前述内容所示,距离参数可以表征的具体内容可以有多种,那么在配置距离参数的过程中,可以根据距离参数所实际表征的内容来配置电子设备所对应的距离参数。In this embodiment of the application, the distance parameter may be a pre-configured parameter. Moreover, the distance parameters correspondingly configured for different electronic devices may be different. Moreover, as shown in the foregoing content, the specific content that the distance parameter can represent can be various, so in the process of configuring the distance parameter, the distance parameter corresponding to the electronic device can be configured according to the content actually represented by the distance parameter.
以距离参数表征从多个规则中确定一个目标规则来计算设备之间距离为例。在这种情况下,则可以先获取得到测量设备与待测设备(被测量距离的设备)的实际距离,然后分别通过多个规则来结合待测设备发送的广播信号的接收信号强度来计算测量设备与待测设备之间的距离,则可以将对应计算出的距离与该实际距离最接近的规则作为待测设备对应的规则,并将表征该对应的规则的距离参数配置为该待测设备对应的距离参数。Take the distance parameter to determine a target rule from multiple rules to calculate the distance between devices as an example. In this case, you can first obtain the actual distance between the measuring device and the device under test (the device whose distance is measured), and then use multiple rules to calculate the measurement based on the received signal strength of the broadcast signal sent by the device under test. The distance between the device and the device under test, the rule corresponding to the calculated distance and the actual distance can be used as the rule corresponding to the device under test, and the distance parameter representing the corresponding rule can be configured as the device under test The corresponding distance parameter.
示例性的,用于计算测量设备与待测设备之间距离的规则包括有规则p1、规则p2以及规则p3,测量设备与待测设备之间的实际距离为5米,其中测量设备在获取得到待测设备发射的广播信号的接收信号强度后,根据该接收信号强度以及规则p1所计算出的距离值为4.5米,根据该接收信号强度以及规则p2所计算出的距离值为4.8米,根据该接收信号强度以及规则p3所计算出的距离值为5.1米,那么其中根据规则p3所计算出的距离与实际距离最为接近,则可以将规则p3作为待测设备对应的规则,进而将表征规则p3的距离参数配置为待测设备对应的距离参数。Exemplarily, the rules for calculating the distance between the measuring device and the device under test include rule p1, rule p2 and rule p3, the actual distance between the measuring device and the device under test is 5 meters, wherein the measuring device obtains After the received signal strength of the broadcast signal transmitted by the device under test, the distance value calculated according to the received signal strength and rule p1 is 4.5 meters, and the distance value calculated according to the received signal strength and rule p2 is 4.8 meters, according to The received signal strength and the distance value calculated by rule p3 are 5.1 meters, and the distance calculated according to rule p3 is the closest to the actual distance, then rule p3 can be used as the rule corresponding to the device under test, and then the characterization rule The distance parameter of p3 is configured as the distance parameter corresponding to the device under test.
再者,以距离参数为用于计算设备之间距离的指定规则中所包括的参数为例。在这种方式下,用于计算不同设备之间的距离的规则均为该指定规则。在配置距离参数的过程中,可以先获取得到测量设备和待测设备之间的实际距离,然后测量设备再获取得到待测设备所发射的广播信号的接收信号强度,然后改变测量设备和待测设备之间的实际距离,并且在每次进行实际距离的改变后,测量设备都会获取一次当前待测设备所发射的广播信号的接收信号强度,进而得到如下表所示的多组实际距离与接收信号强度的对应关系。Furthermore, it is taken as an example that the distance parameter is a parameter included in the specified rule for calculating the distance between devices. In this way, the rules used to calculate the distance between different devices are all the specified rules. In the process of configuring distance parameters, you can first obtain the actual distance between the measuring device and the device under test, and then obtain the received signal strength of the broadcast signal transmitted by the device under test, and then change the distance between the measuring device and the device under test. The actual distance between devices, and each time the actual distance is changed, the measuring device will obtain the received signal strength of the broadcast signal transmitted by the current device under test, and then obtain multiple sets of actual distances and received signals as shown in the following table Correspondence of signal strength.
IDID | 实际距离actual distance | 接收信号强度received signal strength |
11 | d1d1 | Q1Q1 |
22 | d2d2 | Q2Q2 |
...... … | ...... … | ...... … |
nno | dndn | QnQ |
那么通过上表中的多组实际距离与接收信号强度的对应关系则可以计算得到指定规则中的参数,进而将所计算得到的参数作为待测设备对应的距离参数。例如,以指定规则为下列公式为例:Then, the parameters in the specified rules can be calculated through the correspondence between multiple sets of actual distances and received signal strengths in the above table, and then the calculated parameters can be used as the distance parameters corresponding to the device under test. For example, consider specifying the rule as the following formula:
那么,通过上表中的多组实际距离与接收信号强度的对应关系,则可以计算得到指定规则中的参数A 和参数B的值作为待测设备对应的距离参数。Then, through the correspondence between multiple sets of actual distances and received signal strengths in the above table, the values of parameter A and parameter B in the specified rule can be calculated as the distance parameters corresponding to the device under test.
在距离参数为用于对指定规则中所包括的初始参数进行修正的参数的这种方式中,为每个电子设备配置对应的距离参数的方式,与前述距离参数为用于计算设备之间距离的指定规则中所包括的参数的方式是相同的,即均是通过采集多组实际距离与接收信号强度的对应关系,来配置电子设备对应的距离参数,因此,此处则不再赘述。In the method in which the distance parameter is a parameter used to modify the initial parameters included in the specified rule, the method of configuring the corresponding distance parameter for each electronic device is the same as the aforementioned distance parameter used to calculate the distance between devices. The method of specifying the parameters included in the rules is the same, that is, the distance parameters corresponding to the electronic device are configured by collecting multiple sets of corresponding relationships between actual distances and received signal strengths, so details are not repeated here.
那么在通过前述介绍的方式预先配置第二电子设备对应的距离参数之后,则可以在S120中读取得到第二电子设备对应的距离参数。Then, after the distance parameter corresponding to the second electronic device is pre-configured in the manner described above, the distance parameter corresponding to the second electronic device can be read in S120.
作为一种方式,第二电子设备发射的广播信号可以理解为携带有广播数据包的无线信号。其中,第二电子设备可以在发送的广播数据包中携带有自己对应的距离参数,从而使得第一电子设备即使在没有与第二电子设备之间建立无线连接的情况下依然可以获取得到第二电子设备的对应的距离参数。其中,建立无线连接可以理解为进行数据传输之前的准备操作。例如,若第一电子设备需要向第二电子设备发送视频数据,那么则需要先建立无线连接,在完成该无线连接后才会开始进行视频数据的传输。As a manner, the broadcast signal transmitted by the second electronic device may be understood as a wireless signal carrying a broadcast data packet. Wherein, the second electronic device may carry its own corresponding distance parameter in the broadcast data packet sent, so that the first electronic device can still obtain the second electronic device even if no wireless connection is established with the second electronic device. The corresponding distance parameter of the electronic device. Wherein, establishing a wireless connection may be understood as a preparatory operation before data transmission. For example, if the first electronic device needs to send video data to the second electronic device, then a wireless connection needs to be established first, and the video data transmission will not start until the wireless connection is completed.
其中,第二电子设备可以基于蓝牙BLE模式或者Wi-Fi Aware模式发送广播数据包。以蓝牙BLE模式为例,第二电子设备可以在以蓝牙BLE模式发送广播数据包的过程中,在所发送的广播数据包中的特定字段中携带对应的距离参数。如下表所示的一种广播数据包的格式。Wherein, the second electronic device can send the broadcast data packet based on the Bluetooth BLE mode or the Wi-Fi Aware mode. Taking the Bluetooth BLE mode as an example, the second electronic device may carry a corresponding distance parameter in a specific field in the broadcast data packet sent in the process of sending the broadcast data packet in the Bluetooth BLE mode. A broadcast packet format as shown in the following table.
在上表所示的广播数据包的格式中名称为Length字段用于表征广播数据包的长度,名称为Type的字段表征当前数据包的连接类型,名称为MFG ID的字段表征发送该广播数据包的蓝牙模块的生产商的ID,名称为iBeacon的字段表征当前的广播数据包为基于iBeacon模式生成,名称为MD5的字段表征广播数据包所携带的基于MD5方式加密后的设备标识,字段名称Major、Minor以及Ref均用于携带特征值,以区别同一设备发送的不同数据包。那么可以看出的是,在上表所示的广播数据包中可以在16Byte长度的字段处添加第二电子设备对应的距离参数。需要说明的是,上表所示的数据包格式以及每个字段的名称只是示例性的,第二电子设备所发送的广播数据的数据包格式以及字段名称还可以根据实际所携带的数据进行改变。In the format of the broadcast data packet shown in the above table, the field named Length is used to represent the length of the broadcast data packet, the field named Type represents the connection type of the current data packet, and the field named MFG ID represents the sending of the broadcast data packet The ID of the manufacturer of the Bluetooth module, the field named iBeacon indicates that the current broadcast data packet is generated based on iBeacon mode, the field named MD5 represents the MD5-based encrypted device identification carried in the broadcast data packet, and the field name is Major , Minor, and Ref are used to carry characteristic values to distinguish different data packets sent by the same device. Then it can be seen that, in the broadcast data packet shown in the above table, the distance parameter corresponding to the second electronic device can be added at the field of length 16Byte. It should be noted that the data packet format and the name of each field shown in the above table are only exemplary, and the data packet format and field name of the broadcast data sent by the second electronic device can also be changed according to the actual data carried. .
相应的,第一电子设备也可以基于蓝牙BLE模式或者Wi-Fi Aware模式进行广播数据包的扫描,从而在扫描到第二电子设备发送的广播数据包后,从扫描到的第二电子设备发送的广播数据包中获取所述第二电子设备的距离参数。例如,若第一电子设备以蓝牙BLE模式进行广播数据包的扫描,那么在扫描到第二电子设备同样以蓝牙BLE模式发送的广播数据包后,可以从上表所示的广播数据包的16Byte长度的字段中解析出第二电子设备的距离参数。Correspondingly, the first electronic device can also scan the broadcast data packet based on the Bluetooth BLE mode or the Wi-Fi Aware mode, so that after scanning the broadcast data packet sent by the second electronic device, the scanned data packet is sent from the scanned second electronic device. Obtain the distance parameter of the second electronic device from the broadcast data packet. For example, if the first electronic device scans the broadcast data packet in the Bluetooth BLE mode, then after scanning the broadcast data packet sent by the second electronic device in the Bluetooth BLE mode, it can read from the 16Byte broadcast data packet shown in the above table The distance parameter of the second electronic device is parsed out from the length field.
需要说明的是,若第二电子设备以Wi-Fi Aware模式发送广播数据,第二电子设备也可以以相似的方式广播自己的距离参数,相应的,移动终端也可以采用相似的方式获取到第二电子设备的距离参数。It should be noted that if the second electronic device sends broadcast data in Wi-Fi Aware mode, the second electronic device can also broadcast its own distance parameter in a similar manner, and correspondingly, the mobile terminal can also obtain the distance parameter of the second electronic device in a similar manner. 2. The distance parameter of the electronic device.
S130:基于所述接收信号强度以及所述距离参数,确定所述第二电子设备与所述第一电子设备之间的距离。S130: Determine a distance between the second electronic device and the first electronic device based on the received signal strength and the distance parameter.
那么在通过前述方式得到第二电子设备发射的广播信号的接收信号强度,和第二电子设备对应的距离参数后,则可以获取得到第二电子设备与所述第一电子设备之间的距离。以下列公式来计算距离为例:Then, after obtaining the received signal strength of the broadcast signal transmitted by the second electronic device and the distance parameter corresponding to the second electronic device through the aforementioned method, the distance between the second electronic device and the first electronic device can be obtained. Take the following formula to calculate the distance as an example:
其中,RSSI则表征第二电子设备发射的广播信号的接收信号强度,参数A和参数B则具体为第二电子设备对应的参数A和参数B,进而所计算得到的d则表征第二电子设备与所述第一电子设备之间的距离。Among them, RSSI represents the received signal strength of the broadcast signal transmitted by the second electronic device, parameter A and parameter B are specifically parameters A and B corresponding to the second electronic device, and the calculated d represents the second electronic device The distance from the first electronic device.
下面再通过一个示例对本实施例涉及的流程进行介绍。Next, an example is used to introduce the process involved in this embodiment.
如图4所示,对于第二电子设备,第二电子设备会先配置其对应的距离参数,然后会在后续的运行过程中,发送携带第二电子设备对应的距离参数的广播数据包。第一电子设备在从第二电子设备发送的广播数据包中获取得到第二电子设备的距离参数后,则可以使用该距离参数来计算与第二电子设备之间的距离。类似的,对于第三电子设备,第三电子设备会先配置其对应的距离参数,然后会在后续的运行过程中,发送携带第三电子设备对应的距离参数的广播数据包。第一电子设备在从第三电子设备发送的广播数据包中获取得到第三电子设备的距离参数后,则可以使用该距离参数来计算与第三电子设备之间的距离。As shown in FIG. 4 , for the second electronic device, the second electronic device first configures its corresponding distance parameter, and then sends a broadcast data packet carrying the distance parameter corresponding to the second electronic device during subsequent operation. After obtaining the distance parameter of the second electronic device from the broadcast data packet sent by the second electronic device, the first electronic device may use the distance parameter to calculate the distance to the second electronic device. Similarly, for the third electronic device, the third electronic device will configure its corresponding distance parameter first, and then send a broadcast data packet carrying the distance parameter corresponding to the third electronic device during subsequent operation. After the first electronic device obtains the distance parameter of the third electronic device from the broadcast data packet sent by the third electronic device, it may use the distance parameter to calculate the distance to the third electronic device.
本实施例提供的一种测量设备距离的方法,从而通过上述方式使得在计算距离的过程中,对于所需 的距离参数,可以针对需要进行距离计算的设备(第二电子设备)进行针对性的获取,而不会是对每个需要进行距离计算的设备均采用相同的距离参数,有利于使得在计算距离的过程中能够适应不同的需要进行距离计算的设备,以便提升设备间距离计算的准确性。This embodiment provides a method for measuring the distance of a device, so that in the process of calculating the distance, in the process of calculating the distance, the required distance parameter can be targeted for the device (second electronic device) that needs to perform distance calculation. Obtaining, instead of using the same distance parameter for each device that needs to calculate the distance, it is beneficial to adapt to different devices that need to calculate the distance in the process of calculating the distance, so as to improve the accuracy of the distance calculation between devices sex.
并且,在本实施例中,需要进行距离测量的设备(第二电子设备)对应的距离参数会先增加到第二电子设备所发送的广播信号中,从而使得第一电子设备在通过第二电子设备发射的广播信号获取接收信号强度的过程中,就可以直接从该广播信号中获取得到第二电子设备的距离参数,进而使得第一电子设备可以通过一次对广播信号的接收操作就可以同时得到接收信号强度和距离参数,提升了第一电子设备获取得到接收信号强度和距离参数的便利性。Moreover, in this embodiment, the distance parameter corresponding to the device (second electronic device) that requires distance measurement will first be added to the broadcast signal sent by the second electronic device, so that the first electronic device In the process of obtaining the received signal strength of the broadcast signal transmitted by the device, the distance parameter of the second electronic device can be obtained directly from the broadcast signal, so that the first electronic device can simultaneously obtain the The received signal strength and distance parameters improve the convenience for the first electronic device to obtain the received signal strength and distance parameters.
本实施例中与其他实施例相同的步骤的具体实施方式,可以参见其他实施例中的描述,本实施例中则不再赘述。For specific implementation manners of steps in this embodiment that are the same as those in other embodiments, reference may be made to the descriptions in other embodiments, and details will not be repeated in this embodiment.
本实施例提供的一种测量设备距离的方法,在计算设备距离的过程中,会根据第二电子设备发射的广播信号,来获取得到第二电子设备对应的接收信号强度以及距离参数,再基于所述接收信号强度以及所述距离参数,确定所述第二电子设备与所述第一电子设备之间的距离。从而通过上述方式使得在计算距离的过程中,对于所需的距离参数,可以针对需要进行距离计算的设备(第二电子设备)进行针对性的获取,而不会是对每个需要进行距离计算的设备均采用相同的距离参数,有利于使得在计算距离的过程中能够适应不同的需要进行距离计算的设备,以便提升设备间距离计算的准确性。In the method for measuring the distance of a device provided in this embodiment, in the process of calculating the distance of the device, the received signal strength and distance parameters corresponding to the second electronic device are obtained according to the broadcast signal transmitted by the second electronic device, and then based on The received signal strength and the distance parameter determine the distance between the second electronic device and the first electronic device. Therefore, in the process of calculating the distance, the required distance parameter can be obtained in a targeted manner for the device (second electronic device) that needs to perform distance calculation, instead of performing distance calculation for each need. All devices adopt the same distance parameter, which is beneficial to adapt to different devices that need to perform distance calculation in the process of calculating distance, so as to improve the accuracy of distance calculation between devices.
请参阅图5,本申请实施例提供的一种测量设备距离的方法,应用于第一电子设备,所述方法包括:Please refer to Fig. 5, a method for measuring device distance provided by an embodiment of the present application is applied to a first electronic device, and the method includes:
S310:获取第二电子设备发射的广播信号。S310: Acquire a broadcast signal transmitted by the second electronic device.
S320:基于所述广播信号,确定接收信号强度及第二电子设备的标识。S320: Based on the broadcast signal, determine received signal strength and an identifier of the second electronic device.
其中,标识为用于唯一性的第二电子设备与其他电子设备进行区别的信息。在本申请实施例中,可以有多种方式来实施电子设备的标识。例如,可以将电子设备的名称作为电子设备的标识,也可以将电子设备的物理地址作为电子设备的标识。Wherein, the identification is information for distinguishing the second electronic device from other electronic devices for uniqueness. In the embodiment of the present application, there may be multiple ways to implement the identification of the electronic device. For example, the name of the electronic device may be used as the identifier of the electronic device, and the physical address of the electronic device may also be used as the identifier of the electronic device.
作为一种方式,第一电子设备可以从第二电子设备发射的广播信号中来获取得到第二电子设备的标识。在这种方式中,第二电子设备的标识会直接增加到第二电子设备发射的广播信号中。As a manner, the first electronic device may obtain the identifier of the second electronic device from a broadcast signal transmitted by the second electronic device. In this manner, the identifier of the second electronic device will be directly added to the broadcast signal transmitted by the second electronic device.
作为另外一种方式,第一电子设备可以根据第二电子设备发送的数据的组成格式来确定第二电子设备的标识。需要说明的是,电子设备在通过广播信号向另外的设备发送数据的过程中,可以通过指定的协议来生成需要发送的数据,该协议则定义了所生成数据的组成格式。那么对应的,第一电子设备在接收到第二电子设备发送的数据后,则可以通过对该数据的组成格式的识别来确定出第二电子设备所对应的标识。可选的,可以预先建立组成格式与标识的对应关系,那么在获取得到第二电子设备发送的数据的组成格式后,再根据该组成格式与标识的对应关系来获取得到第二电子设备的标识。As another manner, the first electronic device may determine the identifier of the second electronic device according to the composition format of the data sent by the second electronic device. It should be noted that, in the process of sending data to another device through a broadcast signal, an electronic device may generate data to be sent through a specified protocol, and the protocol defines a composition format of the generated data. Correspondingly, after receiving the data sent by the second electronic device, the first electronic device can determine the identifier corresponding to the second electronic device by identifying the composition format of the data. Optionally, the corresponding relationship between the composition format and the identification can be established in advance, then after obtaining the composition format of the data sent by the second electronic device, the identification of the second electronic device can be obtained according to the correspondence between the composition format and the identification .
S330:根据预先建立的标识与距离参数的对应关系,确定与所述第二电子设备的标识对应的距离参数。S330: Determine a distance parameter corresponding to the identifier of the second electronic device according to the pre-established correspondence between the identifier and the distance parameter.
其中,本实施例中的标识与距离参数的对应关系,可以为前述实施例中的配置待测设备对应的距离参数的过程中进行建立的。示例性的,该对应关系可以如下数据表的方式进行存储。Wherein, the corresponding relationship between the identifier and the distance parameter in this embodiment may be established during the process of configuring the distance parameter corresponding to the device under test in the foregoing embodiment. Exemplarily, the corresponding relationship can be stored in the form of the following data table.
IDID | 标识logo | 距离参数distance parameter |
11 | 标识1Logo 1 | 距离参数1distance parameter 1 |
22 | 标识2Logo 2 | 距离参数2distance parameter 2 |
33 | 标识3Logo 3 | 距离参数3Distance parameter 3 |
44 | 标识4Logo 4 | 距离参数4Distance parameter 4 |
如上表所示,标识1与距离参数1对应,标识2与距离参数2对应,标识3与距离参数3对应,标识4与距离参数4对应。那么若获取到第二电子设备的标识为标识1,那么则可以将与标识1对应的距离参数1作为与第二电子设备对的距离参数。若获取到第二电子设备的标识为标识3,那么则可以将与标识3对应的距离参数3作为与第二电子设备对的距离参数。As shown in the above table, the mark 1 corresponds to the distance parameter 1, the mark 2 corresponds to the distance parameter 2, the mark 3 corresponds to the distance parameter 3, and the mark 4 corresponds to the distance parameter 4. Then, if the acquired identifier of the second electronic device is the identifier 1, then the distance parameter 1 corresponding to the identifier 1 may be used as the distance parameter to the second electronic device pair. If the acquired identifier of the second electronic device is the identifier 3, then the distance parameter 3 corresponding to the identifier 3 may be used as a distance parameter to the second electronic device pair.
作为一种方式,该对应关系可以在建立之后则在第一电子设备出厂前存储在第一电子设备中。那么在这种方式中,第一电子设备可以在获取得到第二电子设备的标识后,通过在本地进行查找的方式来获取得到与第二电子设备的标识对应的距离参数。作为另外一种方式,该对应关系可以在建议之后则可以存储在云服务器中,那么第一电子设备可以在获取得到第二电子设备的标识后,向该云服务器发送携带第二电子设备的标识的查询指令,进而使得云服务器响应于该查询指令而查询与第二电子设备的标识对应的距离参数,并将查询到的距离参数再返回给第一电子设备。As a manner, after the correspondence relationship is established, it may be stored in the first electronic device before the first electronic device leaves the factory. Then in this way, after obtaining the identifier of the second electronic device, the first electronic device can obtain the distance parameter corresponding to the identifier of the second electronic device by searching locally. As another way, the corresponding relationship can be stored in the cloud server after being suggested, then the first electronic device can send the identification of the second electronic device to the cloud server after obtaining the identification of the second electronic device The query instruction, and then make the cloud server query the distance parameter corresponding to the identifier of the second electronic device in response to the query instruction, and return the query distance parameter to the first electronic device.
此外,在标识与距离参数的对应关系为在第一电子设备出厂前存储在第一电子设备中的这种方式中,标识与距离参数的对应关系也可以同步存储在云服务器中,并且还可以定期的对云服务器中所述存储的对应关系进行更新。并且,云服务器在完成对对应关系的更新之后,还可以将更新后的对应关系推送给第一 电子设备。In addition, in the way that the correspondence between the identification and the distance parameter is stored in the first electronic device before the first electronic device leaves the factory, the correspondence between the identification and the distance parameter can also be stored in the cloud server synchronously, and can also Periodically update the corresponding relationship stored in the cloud server. And, after the cloud server finishes updating the corresponding relationship, it can also push the updated corresponding relationship to the first electronic device.
S340:基于所述接收信号强度以及所述距离参数,确定所述第二电子设备与所述第一电子设备之间的距离。S340: Determine a distance between the second electronic device and the first electronic device based on the received signal strength and the distance parameter.
需要说明的是,在本申请实施例中对于距离参数的获取可以有多种方式,例如,一种方式为从第二电子设备发送的广播数据包中获取到距离参数,另一种是基于预先建立的标识与距离参数之间的对应关系来获取得到距离参数。在本申请实施例中,第一电子设备可以根据当前的实际环境来确定具体采用哪种方式来获取得到第二电子设备对应的距离参数。It should be noted that in the embodiment of the present application, there are many ways to acquire the distance parameter. For example, one way is to get the distance parameter from the broadcast data packet sent by the second electronic device, and the other way is to get the distance parameter based on the The corresponding relationship between the established identification and the distance parameter is obtained to obtain the distance parameter. In this embodiment of the present application, the first electronic device may determine which method to use to obtain the distance parameter corresponding to the second electronic device according to the current actual environment.
作为一种方式,第一电子设备可以先检测本地或者云服务器中是否已经存储有距离参数与标识的对应关系,若检测到本地或者云服务器中已经存储有距离参数与标识的对应关系,则可以在获取第二电子设备对应的距离参数的过程中,直接根据本地或者云服务器中存储的距离参数与标识的对应关系来获取得到第二电子设备对应的距离参数。并且,在确定是根据本地或者云服务器中存储的对应关系来获取第二电子设备对应的距离参数的情况下,则第一电子设备则不会执行从第二电子设备发送的广播数据包中提取距离参数的操作,以便节约第一电子设备的资源。对应的,若检测到本地或者云服务器中未存储有距离参数与标识的对应关系,那么则第一电子设备则可以在获取距离参数的过程中,对第二电子设备发送的广播数据包进行解析以便从中获取出距离参数。As a method, the first electronic device may first detect whether the corresponding relationship between the distance parameter and the identifier has been stored in the local or cloud server, and if it detects that the corresponding relationship between the distance parameter and the identifier has been stored in the local or cloud server, then In the process of obtaining the distance parameter corresponding to the second electronic device, the distance parameter corresponding to the second electronic device is directly obtained according to the correspondence between the distance parameter and the identifier stored in the local or cloud server. Moreover, if it is determined that the distance parameter corresponding to the second electronic device is obtained according to the corresponding relationship stored in the local or cloud server, the first electronic device will not perform the extraction from the broadcast data packet sent by the second electronic device. The operation of the distance parameter in order to save resources of the first electronic device. Correspondingly, if it is detected that there is no correspondence between the distance parameter and the identifier stored in the local or cloud server, then the first electronic device can analyze the broadcast data packet sent by the second electronic device during the process of obtaining the distance parameter In order to get the distance parameter from it.
其中,第一电子设备可以在多个阶段对本地或者云服务中是否存储有对应关系进行检测。作为一种方式,第一电子设备可以在开机之后的就开始进行检测,也可以在检测到指定的应用程序启动之后开始检测。其中,该指定的应用程序可以为用于计算设备之间的距离的应用程序。Wherein, the first electronic device may detect whether there is a corresponding relationship stored locally or in a cloud service in multiple stages. As a manner, the first electronic device may start to detect after being turned on, or may start to detect after detecting that a specified application program is started. Wherein, the designated application program may be an application program used to calculate the distance between devices.
作为另外一种方式,第一电子设备可以在获取第二电子设备对应的距离参数的过程中,先获取第二电子设备的类型,进而根据第二电子设备的类型来确定具体采用哪种方式来获取得到第二电子设备对应的距离参数。As another way, in the process of obtaining the distance parameter corresponding to the second electronic device, the first electronic device may first obtain the type of the second electronic device, and then determine which method to use according to the type of the second electronic device. A distance parameter corresponding to the second electronic device is acquired.
需要说明的是,可以通过预先对电子设备生产广播数据包的程序进行改变,来实现使得电子设备在发送广播数据包的过程中,在广播数据包中增加自己的距离参数,然而有的电子设备可能并不支持对生产广播数据包的程序进行改变。因此,可能有的电子设备并不能在广播数据包中增加自己对应的距离参数,那么第一电子设备中可以通过存储类型名单的方式来记录支持在广播数据包中增加距离参数的电子设备的类型。那么在获取距离参数的过程中,第一电子设备可以先获取得到第二电子设备的类型,然后查询该类型名单中是否记录有第二电子设备的类型,若记录有第二电子设备的类型,则再从接收到的第二电子设备的广播数据包中获取得到第二电子设备对应的距离参数。若类型名单中没有第二电子设备的类型,则通过获取第二电子设备的标识,以及标识与距离参数的对应关闭来获取得到第二电子设备对应的距离参数。It should be noted that the electronic device can increase its own distance parameter in the broadcast data packet during the process of sending the broadcast data packet by changing the program of the electronic device to generate the broadcast data packet in advance. However, some electronic devices Changes to the procedure for producing broadcast packets may not be supported. Therefore, some electronic devices may not be able to add their own corresponding distance parameters in the broadcast data packet, then the first electronic device can record the type of electronic device that supports adding distance parameters in the broadcast data packet by storing the type list . Then, in the process of obtaining the distance parameter, the first electronic device can first obtain the type of the second electronic device, and then inquire whether the type of the second electronic device is recorded in the type list. If the type of the second electronic device is recorded, Then, the distance parameter corresponding to the second electronic device is obtained from the received broadcast data packet of the second electronic device. If there is no type of the second electronic device in the type list, the distance parameter corresponding to the second electronic device is obtained by obtaining the identification of the second electronic device and closing the correspondence between the identification and the distance parameter.
作为再一种方式,电子设备在广播数据包中增加距离参数的过程中,也可以在广播数据包中增加与距离参数对应的版本号。对应的,在建立距离参数与标识的对应关系的过程中,也可以增加标识所对应的距离参数的版本号。As yet another manner, during the process of adding the distance parameter in the broadcast data packet, the electronic device may also add a version number corresponding to the distance parameter in the broadcast data packet. Correspondingly, in the process of establishing the correspondence between the distance parameter and the identifier, the version number of the distance parameter corresponding to the identifier may also be increased.
需要说明的是,电子设备对应的距离参数可能会进行修正,那么修正后的距离参数相较于之前的距离参数是会有所不同的,那么为了区别不同版本的距离参数,则可以给每次生成的距离参数配置一个版本号。其中,对于同一个电子设备而言,基于最新的版本号所对应的距离参数所计算出的距离可能是最准确的。那么第一电子设备在获取第二电子设备对应的距离参数的过程中,可以获取从第二电子设备发送的广播数据包中获取的距离参数对应的版本号为第一版本号,获取基于本地或则云服务器中获取的距离参数对应的版本号为第二版本号,然后再获取出第一版本号和第二版本号中对应的距离参数最新的版本号作为目标版本号,进而将目标版本号对应的距离参数作为获取的与第二电子设备对应的版本号。再者,若确定第一版本号和第二版本号相同,那么则可以从前述的确定方式中任选一种方式来确定具体如何得到第二电子设备对应的距离参数。It should be noted that the distance parameter corresponding to the electronic device may be corrected, and the corrected distance parameter will be different from the previous distance parameter. In order to distinguish different versions of the distance parameter, you can give each The generated distance parameter configures a version number. Wherein, for the same electronic device, the distance calculated based on the distance parameter corresponding to the latest version number may be the most accurate. Then, in the process of acquiring the distance parameter corresponding to the second electronic device, the first electronic device can obtain the version number corresponding to the distance parameter obtained from the broadcast data packet sent by the second electronic device as the first version number, and the acquisition is based on the local or Then the version number corresponding to the distance parameter obtained in the cloud server is the second version number, and then the latest version number of the distance parameter corresponding to the first version number and the second version number is obtained as the target version number, and then the target version number The corresponding distance parameter is used as the acquired version number corresponding to the second electronic device. Furthermore, if it is determined that the first version number and the second version number are the same, then one of the aforementioned determination methods may be selected to determine how to obtain the corresponding distance parameter of the second electronic device.
例如,若确定第一版本号为最新的版本号,那么则确定第一版本号对应的距离参数为最新的距离参数,并对应的将第一版本号作为目标版本号。再例如,若确定第二版本号为最新的版本号,那么则确定第二版本号对应的距离参数为最新的距离参数,并对应的将第二版本号作为目标版本号。For example, if it is determined that the first version number is the latest version number, then determine that the distance parameter corresponding to the first version number is the latest distance parameter, and correspondingly use the first version number as the target version number. For another example, if it is determined that the second version number is the latest version number, then determine that the distance parameter corresponding to the second version number is the latest distance parameter, and correspondingly use the second version number as the target version number.
作为又一种方式,在第一电子设备中可以配置有选择控件,进而电子设备可以通过该选择控件当前所对应的状态,来确定具体采用哪种方式来获取得到第二电子设备对应的距离参数。其中,第一电子设备的用户则可以通过对该选择控件进行操作来改变该选择控件当前对应的状态。例如,若该选择控件包括有第一状态和第二状态,其中,第一状态对应于从广播数据包中获取第二电子设备对应的距离参数,第二状态则对应于从本地或者云服务器中存储的对应关系中获取得到第二电子设备对应的距离参数。那么若第一电子设备在获取第二电子设备对应的距离参数的过程中,检测到选择控件处于第一状态,那么则会在获取得到第二电子设备发送的广播数据包以后,从该广播数据包中获取得到第二电子设备对应的距离参数。检测到选择控件处于第二状态,则会基于本地或者云服 务器中存储的标识与距离参数的对应关系,来获取得到第二电子设备对应的距离参数。As yet another way, a selection control may be configured in the first electronic device, and then the electronic device may determine which method to use to obtain the distance parameter corresponding to the second electronic device through the current state corresponding to the selection control. . Wherein, the user of the first electronic device can change the current state corresponding to the selection control by operating the selection control. For example, if the selection control includes a first state and a second state, wherein the first state corresponds to obtaining the distance parameter corresponding to the second electronic device from the broadcast data packet, and the second state corresponds to obtaining the distance parameter corresponding to the second electronic device from the local or cloud server. The distance parameter corresponding to the second electronic device is obtained from the stored correspondence. Then, if the first electronic device detects that the selection control is in the first state during the process of obtaining the distance parameter corresponding to the second electronic device, then after obtaining the broadcast data packet sent by the second electronic device, it will The distance parameter corresponding to the second electronic device is obtained from the packet. Detecting that the selection control is in the second state, the distance parameter corresponding to the second electronic device will be obtained based on the correspondence between the identifier and the distance parameter stored in the local or cloud server.
本实施例中与其他实施例相同的步骤的具体实施方式,可以参见其他实施例中的描述,本实施例中则不再赘述。For specific implementation manners of steps in this embodiment that are the same as those in other embodiments, reference may be made to the descriptions in other embodiments, and details will not be repeated in this embodiment.
本实施例提供的一种测量设备距离的方法,从而通过上述方式使得在计算距离的过程中,对于所需的距离参数,可以针对需要进行距离计算的设备(第二电子设备)进行针对性的获取,而不会是对每个需要进行距离计算的设备均采用相同的距离参数,有利于使得在计算距离的过程中能够适应不同的需要进行距离计算的设备,以便提升设备间距离计算的准确性。并且,在本实施例中,会预先建立设备的标识与距离参数之间的对应关系,从而使得在获取得到第二电子设备的标识后,可以根据该对应关系来得到第二电子设备的距离参数。This embodiment provides a method for measuring the distance of a device, so that in the process of calculating the distance, in the process of calculating the distance, the required distance parameter can be targeted for the device (second electronic device) that needs to perform distance calculation. Obtaining, instead of using the same distance parameter for each device that needs to calculate the distance, it is beneficial to adapt to different devices that need to calculate the distance in the process of calculating the distance, so as to improve the accuracy of the distance calculation between devices sex. Moreover, in this embodiment, the corresponding relationship between the device identifier and the distance parameter is established in advance, so that after the identifier of the second electronic device is obtained, the distance parameter of the second electronic device can be obtained according to the corresponding relationship .
请参阅图6,本申请实施例提供的一种测量设备距离的方法,应用于第一电子设备,所述方法包括:Please refer to FIG. 6 , a method for measuring device distance provided by an embodiment of the present application is applied to a first electronic device, and the method includes:
S410:获取第二电子设备发射的广播信号。S410: Acquire a broadcast signal transmitted by the second electronic device.
S420:基于所述广播信号,确定接收信号强度及距离参数,所述距离参数为指定规则对应的参数,所述指定规则用于根据广播信号的接收信号强度得到设备之间的距离。S420: Based on the broadcast signal, determine a received signal strength and a distance parameter, where the distance parameter is a parameter corresponding to a specified rule, and the specified rule is used to obtain a distance between devices according to the received signal strength of the broadcast signal.
S430:基于所述指定规则、接收信号强度以及所述距离参数,确定所述第二电子设备与所述第一电子设备之间的距离。S430: Determine a distance between the second electronic device and the first electronic device based on the specified rule, received signal strength, and the distance parameter.
需要说明的是,在本申请实施例中指定规则对应的参数可以有多种实施方式。作为一种方式,距离参数为指定规则对应的参数可以理解为所述距离参数为所述指定规则所包括的参数。示例性的,以下列公式为为例:It should be noted that, in the embodiment of the present application, there may be multiple implementation manners for specifying the parameters corresponding to the rules. As one manner, the distance parameter being a parameter corresponding to the specified rule may be understood as the distance parameter being a parameter included in the specified rule. Exemplarily, take the following formula as an example:
该公式中包括的参数有参数RSSI、参数A以及参数B,那么则距离参数可以为其中的参数A和参数B中的任一一个或者两个参数。The parameters included in the formula include parameter RSSI, parameter A and parameter B, and then the distance parameter may be any one or both of parameter A and parameter B among them.
作为另外一种方式,距离参数为指定规则对应的参数可以理解为所述距离参数为用于对所述指定规则所包括的参数进行校准的参数。在这种方式下,所述基于所述指定规则、所述接收信号强度以及所述距离参数,确定所述第二电子设备与所述第一电子设备之间的距离,包括:基于所述距离参数对所述指定规则包括的参数进行校准,得到校准后的参数;基于所述指定规则、所述接收信号强度以及所述校准后的参数,确定所述第二电子设备与所述第一电子设备之间的距离。示例性的,还是以指定规则为下列公式为例,该公式为:As another manner, the distance parameter being a parameter corresponding to the specified rule may be understood as the distance parameter being a parameter for calibrating the parameters included in the specified rule. In this way, the determining the distance between the second electronic device and the first electronic device based on the specified rule, the received signal strength and the distance parameter includes: based on the distance Parameters: Calibrate the parameters included in the specified rules to obtain calibrated parameters; determine the relationship between the second electronic device and the first electronic device based on the specified rules, the received signal strength, and the calibrated parameters distance between devices. Exemplarily, it is still assumed that the specified rule is the following formula as an example, the formula is:
其中,该公式中包括的参数有参数RSSI、参数A以及参数B,那么通过距离参数对指定规则包括的参数进行校准,则可以理解为对指定规定包括的参数的初始值进行校准。例如,对于参数A和参数B而言,均可以对应有自己的初始值,若第二电子设备对应的距离参数包括“a”和“b”,则可以理解为将指定规则中的参数A加上a,将指定规则中的参数B加上b。那么在这种情况下,在计算第二电子设备与第一电子设备的过程中指定规则会变换为下列形式:Wherein, the parameters included in the formula include parameters RSSI, parameter A, and parameter B, then the calibration of the parameters included in the specified rules through the distance parameter can be understood as the calibration of the initial values of the parameters included in the specified regulations. For example, both parameters A and B can have their own initial values. If the distance parameters corresponding to the second electronic device include "a" and "b", it can be understood as adding parameter A in the specified rule to On a, add b to the parameter B in the specified rule. In this case, the specified rules in the process of calculating the second electronic device and the first electronic device will be transformed into the following form:
本实施例中与其他实施例相同的步骤的具体实施方式,可以参见其他实施例中的描述,本实施例中则不再赘述。For specific implementation manners of steps in this embodiment that are the same as those in other embodiments, reference may be made to the descriptions in other embodiments, and details will not be repeated in this embodiment.
本实施例提供的一种测量设备距离的方法,从而通过上述方式使得在基于指定规则计算距离的过程中,对于指定规则所需的距离参数,可以针对需要进行距离计算的设备(第二电子设备)进行针对性的获取,而不会是在基于指定规则计算距离的情况下,对每个需要进行距离计算的设备均采用相同的距离参数,从而有利于使得在基于计算距离的过程中能够适应不同的需要进行距离计算的设备,以便提升设备间距离计算的准确性。This embodiment provides a method for measuring the distance of a device, so that in the process of calculating the distance based on the specified rule, the distance parameter required by the specified rule can be targeted at the device that needs to perform distance calculation (the second electronic device) ) for targeted acquisition, instead of using the same distance parameter for each device that needs to calculate the distance in the case of calculating the distance based on the specified rules, which is conducive to making it possible to adapt to the distance-based process Different devices that need to perform distance calculations in order to improve the accuracy of distance calculations between devices.
请参阅图7,本申请实施例提供的一种测量设备距离的方法,应用于第一电子设备,所述方法包括:Please refer to FIG. 7 , a method for measuring device distance provided by an embodiment of the present application is applied to a first electronic device, and the method includes:
S510:获取第二电子设备发射的广播信号。S510: Acquire a broadcast signal transmitted by the second electronic device.
S520:基于所述广播信号,确定接收信号强度及距离参数,所述距离参数表征所对应选取的计算设备之间距离的规则。S520: Based on the broadcast signal, determine a received signal strength and a distance parameter, where the distance parameter represents a rule of a distance between corresponding selected computing devices.
S530:获取与所述距离参数对应的规则作为目标规则。S530: Obtain a rule corresponding to the distance parameter as a target rule.
在本实施例中,距离参数可以理解为规则标识,进而在得到第二电子设备对应的规则标识以后,可以根据规则标识来获取得到对应的规则作为目标规则。In this embodiment, the distance parameter can be understood as a rule identifier, and after obtaining the rule identifier corresponding to the second electronic device, the corresponding rule can be obtained as the target rule according to the rule identifier.
S540:基于所述接收信号强度以及所述目标规则,确定所述第二电子设备与所述第一电子设备之 间的距离。S540: Determine the distance between the second electronic device and the first electronic device based on the received signal strength and the target rule.
本实施例中与其他实施例相同的步骤的具体实施方式,可以参见其他实施例中的描述,本实施例中则不再赘述。For specific implementation manners of steps in this embodiment that are the same as those in other embodiments, reference may be made to the descriptions in other embodiments, and details will not be repeated in this embodiment.
本实施例提供的一种测量设备距离的方法,从而通过上述方式使得在计算距离的过程中,可以根据第二电子设备对应的距离参数,来确定当前用于计算距离的目标规则,进而根据目标规则以及接收信号强度来计算得到第二电子设备与所述第一电子设备之间的距离。从而实现对于用于计算距离的规则,可以针对需要进行距离计算的设备(第二电子设备)进行针对性的获取,而不会是对每个需要进行距离计算的设备均采用相同计算规则,有利于使得在计算距离的过程中能够适应不同的需要进行距离计算的设备,以便提升设备间距离计算的准确性。This embodiment provides a method for measuring the distance of a device, so that in the process of calculating the distance, the target rule currently used for calculating the distance can be determined according to the distance parameter corresponding to the second electronic device, and then according to the target The distance between the second electronic device and the first electronic device is calculated by using rules and received signal strength. In this way, the rules for calculating the distance can be obtained in a targeted manner for the device (the second electronic device) that needs to calculate the distance, instead of using the same calculation rule for each device that needs to calculate the distance. It is beneficial to adapt to different devices that need to perform distance calculation in the process of calculating distance, so as to improve the accuracy of distance calculation between devices.
请参阅图8,本申请实施例提供的一种测量设备距离的方法,应用于第一电子设备,所述方法包括:Please refer to FIG. 8 , a method for measuring device distance provided by an embodiment of the present application is applied to a first electronic device, and the method includes:
S610:获取第二电子设备发射的广播信号。S610: Acquire a broadcast signal transmitted by the second electronic device.
S620:基于所述广播信号,确定接收信号强度及距离参数。S620: Determine received signal strength and distance parameters based on the broadcast signal.
S630:基于所述接收信号强度以及所述距离参数,确定所述第二电子设备与所述第一电子设备之间的距离。S630: Determine a distance between the second electronic device and the first electronic device based on the received signal strength and the distance parameter.
S640:检测所述距离是否大于距离阈值。S640: Detect whether the distance is greater than a distance threshold.
若所述距离大于或者等于距离阈值,则回到则重新执行前述步骤来再次获取得到第二电子设备与所述第一电子设备之间的距离。If the distance is greater than or equal to the distance threshold, go back and re-execute the above steps to obtain the distance between the second electronic device and the first electronic device again.
S650:若所述距离小于距离阈值,显示与所述第二电子设备对应的提示信息。S650: If the distance is less than a distance threshold, display prompt information corresponding to the second electronic device.
需要说明的是,电子设备之间的距离表征的是电子设备之间的远近程度。若电子设备之间的距离越大,则表征电子设备之间间隔越远,若电子设备之间的距离越小,那么则表征电子设备之间的间隔越近。那么当电子设备之间的间隔小到一定程度的情况下,则可以触发与第二电子设备对应的提示信息。其中,该提示信息可以用于提示当前第二电子设备与第一电子设备之间的距离关系,也可以用于提示用户当前可以触发与第二电子设备有关的功能。其中,距离关系可以包括第二电子设备与第一电子设备之间的距离。例如,如图9所示,在图9所示的场景中,用户手持的智能手机可以为第一电子设备,场景中所包括的电视机和空调则可以分别为第二电子设备。那么在图示的场景中,智能手机100获取到电视和空调的距离后,则可以显示距离信息展示界面10,在该距离信息展示界面10中显示电视和空调与智能手机100之间的距离。例如,在距离信息展示界面10中所展示的“电视与你间隔5米”以及“空调与你间隔7米”。It should be noted that the distance between the electronic devices represents the distance between the electronic devices. If the distance between the electronic devices is larger, it means that the distance between the electronic devices is farther, and if the distance between the electronic devices is smaller, it means that the distance between the electronic devices is closer. Then, when the distance between the electronic devices is small to a certain extent, the prompt information corresponding to the second electronic device may be triggered. Wherein, the prompt information can be used to prompt the current distance relationship between the second electronic device and the first electronic device, and can also be used to prompt the user that functions related to the second electronic device can be triggered currently. Wherein, the distance relationship may include the distance between the second electronic device and the first electronic device. For example, as shown in FIG. 9 , in the scene shown in FIG. 9 , the smartphone held by the user may be the first electronic device, and the TV and air conditioner included in the scene may be the second electronic device respectively. Then in the illustrated scene, after the smart phone 100 obtains the distance between the TV and the air conditioner, it can display the distance information display interface 10 , and the distance between the TV, the air conditioner and the smart phone 100 is displayed on the distance information display interface 10 . For example, "the TV is 5 meters away from you" and "the air conditioner is 7 meters away from you" displayed on the distance information display interface 10 .
再者,当第二电子设备与第一电子设备之间的距离小到一定程度(例如,小于距离阈值)时,则可以在第一电子设备与第二电子设备之间触发与第二电子设备所对应的功能。以第二电子设备为电视为例,若电视与第一电子设备之间的距离小于距离阈值,那么则第一电子设备可以将第一电子设备正在显示的画面投屏到电视中。示例性的,如图10所示,当作为第一电子设备的智能手机100检测到作为第二电子设备的电视与自己的距离小于距离阈值的情况下,可以在屏幕中显示悬浮图标11作为提示信息。该悬浮图标11用于提示用户当前可以将智能手机100的画面投屏到电视中。Furthermore, when the distance between the second electronic device and the first electronic device is small enough to a certain extent (for example, less than the distance threshold), it may be triggered between the first electronic device and the second electronic device to communicate with the second electronic device. corresponding function. Taking the second electronic device as a TV as an example, if the distance between the TV and the first electronic device is less than the distance threshold, then the first electronic device may project the screen being displayed by the first electronic device to the TV. Exemplarily, as shown in FIG. 10 , when the smart phone 100 as the first electronic device detects that the distance between the TV as the second electronic device and itself is less than the distance threshold, a floating icon 11 may be displayed on the screen as a prompt information. The floating icon 11 is used to remind the user that the screen of the smart phone 100 can be cast to the TV at present.
可选的,响应作用于所述提示信息的触控操作,执行与所述第二电子设备对应的操作。需要说明的是,不同的第二电子设备可以具备不同的功能,那么第一电子设备则可以对应的执行不同的操作,以便可以触发第二电子设备执行对应的功能。示例性的,请再参阅图11,在显示悬浮图标11的情况下,若智能手机100检测到作用于悬浮图标11的触控操作,那么则会执行电视对应的投屏操作,进而将画面投屏到电视中进行播放。Optionally, in response to a touch operation acting on the prompt information, an operation corresponding to the second electronic device is performed. It should be noted that different second electronic devices may have different functions, and the first electronic device may correspondingly perform different operations, so as to trigger the second electronic device to perform corresponding functions. Exemplarily, please refer to FIG. 11 again. In the case where the floating icon 11 is displayed, if the smart phone 100 detects a touch operation acting on the floating icon 11, then it will perform the screen projection operation corresponding to the TV, and then the screen will be projected. screen to the TV for playback.
再者,对于提示信息的显示方式除了可以为图10中所示的悬浮显示外,还可以有其他的方式。例如,请参阅图11,在一些情况下,用户可能正在使用第一电子设备玩游戏,如图11的上侧图像所示,游戏界面20是全屏进行显示的,那么在玩游戏的过程中如果直接在游戏界面上悬浮显示内容,则悬浮显示的内容可能会对用户造成干扰。那么如图11的下侧图像所示,可以将原本全屏显示的游戏界面20进行画面尺寸的缩小,并且在缩小后空余的位置显示状态栏30。进而在该状态栏30中显示提示信息31。其中,该提示信息31也可以对用户的触控操作进行响应。Furthermore, besides the floating display shown in FIG. 10 , there may be other ways for displaying the prompt information. For example, please refer to FIG. 11. In some cases, the user may be using the first electronic device to play a game. As shown in the upper image of FIG. 11, the game interface 20 is displayed in full screen. If the content is suspended directly on the game interface, the suspended content may cause interference to the user. Then, as shown in the lower image of FIG. 11 , the screen size of the game interface 20 originally displayed in full screen can be reduced, and the status bar 30 can be displayed in the vacant position after reduction. Furthermore, prompt information 31 is displayed in the status bar 30 . Wherein, the prompt information 31 may also respond to the user's touch operation.
再者,在本申请实施例中的第二电子设备除了可以为前述介绍的电视和空调以外,还可以为其他的设备。例如,还可以为智能手表、智能手环以及无线耳机等。以无线耳机作为第二电子设备为例,如图12所示,无线耳机通常可以放置在匹配的耳机盒中,那么若检测到无线耳机与作为第一电子设备的智能手机100之间的距离小于距离阈值且与无线耳机匹配的耳机盒处于打开状态时,智能手机100则可以在界面40中显示提示信息。其中,界面40中的提示信息用于提示用户与无线耳机匹配的耳机盒当前处于打开状态。并且,在界面40中可以显示有名称为连接的控件,若检测有作用于该名称为连接的控件的触控操作,那么则可以触发智能手机100与无线耳机之间建立连接。Furthermore, the second electronic device in the embodiment of the present application may be other devices besides the television and the air conditioner described above. For example, smart watches, smart bracelets, and wireless earphones can also be used. Taking a wireless earphone as the second electronic device as an example, as shown in FIG. 12 , the wireless earphone can usually be placed in a matching earphone box. When the distance threshold is set and the earphone box matched with the wireless earphone is in the open state, the smart phone 100 may display prompt information on the interface 40 . Wherein, the prompt information in the interface 40 is used to remind the user that the earphone box matched with the wireless earphone is currently in an open state. Moreover, a control named connection may be displayed on the interface 40 , and if a touch operation on the control named connection is detected, then the establishment of a connection between the smart phone 100 and the wireless earphone may be triggered.
本实施例中与其他实施例相同的步骤的具体实施方式,可以参见其他实施例中的描述,本实施例中 则不再赘述。For the specific implementation of the steps in this embodiment that are the same as those in other embodiments, refer to the descriptions in other embodiments, and details will not be repeated in this embodiment.
本实施例提供的一种测量设备距离的方法,从而通过上述方式使得在计算距离的过程中,对于所需的距离参数,可以针对需要进行距离计算的设备(第二电子设备)进行针对性的获取,而不会是对每个需要进行距离计算的设备均采用相同的距离参数,有利于使得在计算距离的过程中能够适应不同的需要进行距离计算的设备,以便提升设备间距离计算的准确性。This embodiment provides a method for measuring the distance of a device, so that in the process of calculating the distance, in the process of calculating the distance, the required distance parameter can be targeted for the device (second electronic device) that needs to perform distance calculation. Obtaining, instead of using the same distance parameter for each device that needs to calculate the distance, it is beneficial to adapt to different devices that need to calculate the distance in the process of calculating the distance, so as to improve the accuracy of the distance calculation between devices sex.
并且,在本实施例中,还会进一步的将获取到的第二电子设备与第一电子设备之间的距离,与距离阈值进行比对,进而在距离小于距离阈值,显示与所述第二电子设备对应的提示信息。并且,在一种方式中,该提示信息还可以用于响应触控操作,以执行与所述第二电子设备对应的操作。从而实现了第一电子设备可以更加准确的与第二电子设备之间进行交互。Moreover, in this embodiment, the obtained distance between the second electronic device and the first electronic device will be further compared with the distance threshold, and then when the distance is smaller than the distance threshold, display the distance between the second electronic device and the second electronic device. The prompt information corresponding to the electronic device. Moreover, in a manner, the prompt information may also be used to respond to a touch operation, so as to perform an operation corresponding to the second electronic device. Therefore, it is realized that the first electronic device can interact with the second electronic device more accurately.
请参阅图13,本申请实施例提供的一种测量设备距离的方法,应用于第一电子设备,所述方法包括:Please refer to FIG. 13 , a method for measuring device distance provided by an embodiment of the present application is applied to a first electronic device, and the method includes:
S710:接收中间设备发送的接收信号强度以及距离参数,所述接收信号强度以及距离参数为所述中间设备根据第二电子设备发射的广播信号获取。S710: Receive received signal strength and distance parameters sent by the intermediate device, where the received signal strength and distance parameters are acquired by the intermediate device according to the broadcast signal transmitted by the second electronic device.
其中,本实施例中的第一电子设备依然是进行距离计算的设备。并且,在本实施例中,第一电子设备可以获取得到另外两个设备之间的距离。那么对应的,则会由中间设备来对接收到的第二电子设备发射的广播信号的接收信号强度进行检测,并将获取到的接收信号强度再发送给第一电子设备。Wherein, the first electronic device in this embodiment is still a device for performing distance calculation. Moreover, in this embodiment, the first electronic device may acquire the distance between the other two devices. Correspondingly, the intermediate device will detect the received signal strength of the received broadcast signal transmitted by the second electronic device, and then send the obtained received signal strength to the first electronic device.
作为一种方式,第一电子设备可以向中间设备发送数据采集指令,那么中间设备则响应于该数据采集指令而开始获取第二电子设备发射的广播信号,并将采集的接收信号强度发送给第一电子设备。As a way, the first electronic device may send a data collection instruction to the intermediate device, and then the intermediate device starts to obtain the broadcast signal transmitted by the second electronic device in response to the data collection instruction, and sends the collected received signal strength to the second electronic device. an electronic device.
作为一种方式,第一电子设备可以基于前述实施例中的方式来获取得到第二电子设备对应的距离参数。作为另外一种方式,可以由中间设备基于前述实施例中的方式来获取得到第二电子设备对应的距离参数,然后将距离参数与接收信号强度共同发送给第一电子设备,从而使得第一电子设备可以较为遍历的同时获取得到第二电子设备对应的距离参数以及接收信号强度。As a manner, the first electronic device may obtain the distance parameter corresponding to the second electronic device based on the manner in the foregoing embodiments. As another way, the intermediate device can obtain the distance parameter corresponding to the second electronic device based on the method in the foregoing embodiments, and then send the distance parameter together with the received signal strength to the first electronic device, so that the first electronic device The device can obtain the distance parameter and received signal strength corresponding to the second electronic device while traversing.
再者,中间设备在向第一电子设备发送第二电子设备的接收信号强度的过程中,也会将第二电子设备的距离参数发送给第一电子设备。Furthermore, during the process of sending the received signal strength of the second electronic device to the first electronic device, the intermediate device will also send the distance parameter of the second electronic device to the first electronic device.
S720:基于所述接收信号强度以及所述距离参数,获取所述第二电子设备与所述中间设备之间的距离。S720: Acquire a distance between the second electronic device and the intermediate device based on the received signal strength and the distance parameter.
第一电子设备在获取得到距离参数和接收信号强度后,则可以基于前述实施例中的方式来计算得到第二电子设备与中间设备之间的距离。并且,可以将所计算出的距离进行实时的显示。以便用于用户可以及时的了解第二电子设备与中间设备之间的距离。After the first electronic device acquires the distance parameter and received signal strength, it can calculate the distance between the second electronic device and the intermediate device based on the manner in the foregoing embodiments. Moreover, the calculated distance can be displayed in real time. So that the user can know the distance between the second electronic device and the intermediate device in time.
在本申请实施例中,第二电子设备可以为由第一电子设备进行确定。可选的,电子设备在发送的广播数据包中可以携带有自己的标识,进而使得接收到广播数据包的电子设备可以确定当前可以接收到哪些设备所发送的广播数据包。在一种方式中,第一电子设备向中间设备发送的数据采集指令中可以携带有待测设备的标识,进而中间设备可以将与该标识对应的设备作为第二电子设备,并去获取第二电子设备对应的接收信号强度。In this embodiment of the present application, the second electronic device may be determined by the first electronic device. Optionally, the broadcast data packet sent by the electronic device may carry its own identity, so that the electronic device that receives the broadcast data packet can determine which devices can currently receive the broadcast data packet sent by it. In one manner, the data collection instruction sent by the first electronic device to the intermediate device may carry the identifier of the device under test, and then the intermediate device may use the device corresponding to the identifier as the second electronic device, and acquire the second electronic device. The received signal strength corresponding to the electronic device.
需要说明的是,其中的中间设备可以为多种设备。例如,中间设备可以为路由器、网关、智能手环、智能手表或者智能手机等。It should be noted that the intermediate device may be various devices. For example, the intermediate device may be a router, a gateway, a smart bracelet, a smart watch, or a smart phone.
本实施例中与其他实施例相同的步骤的具体实施方式,可以参见其他实施例中的描述,本实施例中则不再赘述。For specific implementation manners of steps in this embodiment that are the same as those in other embodiments, reference may be made to the descriptions in other embodiments, and details will not be repeated in this embodiment.
本实施例提供的一种测量设备距离的方法,在计算第二电子设备与中间设备的设备距离的过程中,会根据第二电子设备发射的广播信号,来获取得到第二电子设备对应的接收信号强度以及距离参数,再基于所述接收信号强度以及所述距离参数,获取所述第二电子设备与所述中间设备之间的距离。从而通过上述方式使得在计算距离的过程中,对于所需的距离参数,可以针对需要进行距离计算的设备(第二电子设备)进行针对性的获取,而不会是对每个需要进行距离计算的设备均采用相同的距离参数,有利于使得在计算距离的过程中能够适应不同的需要进行距离计算的设备,以便提升设备间距离计算的准确性。In the method for measuring the distance between devices provided in this embodiment, in the process of calculating the device distance between the second electronic device and the intermediate device, the received information corresponding to the second electronic device will be obtained according to the broadcast signal transmitted by the second electronic device. Signal strength and distance parameters. Based on the received signal strength and the distance parameters, the distance between the second electronic device and the intermediate device is acquired. Therefore, in the process of calculating the distance, the required distance parameter can be obtained in a targeted manner for the device (second electronic device) that needs to perform distance calculation, instead of performing distance calculation for each need. All devices adopt the same distance parameter, which is beneficial to adapt to different devices that need to perform distance calculation in the process of calculating distance, so as to improve the accuracy of distance calculation between devices.
请参阅图14,本申请实施例提供的一种测量设备距离的装置800,运行于第一电子设备,所述装置800包括:Please refer to FIG. 14 , an apparatus 800 for measuring device distance provided by an embodiment of the present application, which operates on the first electronic device, and the apparatus 800 includes:
信号获取单元810,用于获取第二电子设备发射的广播信号;a signal acquiring unit 810, configured to acquire a broadcast signal transmitted by the second electronic device;
参数获取单元820,用于基于所述广播信号,确定接收信号强度及距离参数;A parameter acquisition unit 820, configured to determine received signal strength and distance parameters based on the broadcast signal;
距离计算单元830,用于基于所述接收信号强度以及所述距离参数,确定所述第二电子设备与所述第一电子设备之间的距离。The distance calculation unit 830 is configured to determine the distance between the second electronic device and the first electronic device based on the received signal strength and the distance parameter.
作为一种方式,参数获取单元820,具体用于接收所述第二电子设备发送的广播数据包;从所述 广播数据包中获取确定接收信号强度及距离参数。在这种方式中。As a manner, the parameter acquisition unit 820 is specifically configured to receive the broadcast data packet sent by the second electronic device; obtain and determine the received signal strength and distance parameters from the broadcast data packet. in this way.
作为一种方式,参数获取单元820,具体用于基于所述广播信号,确定接收信号强度及第二电子设备的标识;根据预先建立的标识与距离参数的对应关系,确定与所述第二电子设备的标识对应的距离参数。As a method, the parameter acquisition unit 820 is specifically configured to determine the strength of the received signal and the identity of the second electronic device based on the broadcast signal; The distance parameter corresponding to the identity of the device.
作为一种方式,所述距离参数为指定规则对应的参数,所述指定规则用于根据广播信号的接收信号强度得到设备之间的距离。距离计算单元830,具体用于基于所述指定规则、接收信号强度以及所述距离参数,确定所述第二电子设备与所述第一电子设备之间的距离。可选的,所述距离参数为所述指定规则所包括的参数。可选的,所述距离参数为用于对所述指定规则所包括的参数进行校准的参数,距离计算单元830,具体用于基于所述距离参数对所述指定规则包括的参数进行校准,得到校准后的参数;基于所述指定规则、所述接收信号强度以及所述校准后的参数,确定所述第二电子设备与所述第一电子设备之间的距离。As a manner, the distance parameter is a parameter corresponding to a specified rule, and the specified rule is used to obtain the distance between devices according to the received signal strength of the broadcast signal. The distance calculating unit 830 is specifically configured to determine the distance between the second electronic device and the first electronic device based on the specified rule, received signal strength and the distance parameter. Optionally, the distance parameter is a parameter included in the specified rule. Optionally, the distance parameter is a parameter used to calibrate the parameters included in the specified rule, and the distance calculation unit 830 is specifically configured to calibrate the parameters included in the specified rule based on the distance parameter, to obtain Calibrated parameters: determining the distance between the second electronic device and the first electronic device based on the specified rule, the received signal strength, and the calibrated parameters.
作为一种方式,所述距离参数表征所对应选取的计算设备之间距离的规则。距离计算单元830,具体用于获取与所述距离参数对应的规则作为目标规则;基于所述接收信号强度以及所述目标规则,确定所述第二电子设备与所述第一电子设备之间的距离。As a manner, the distance parameter represents a rule of the distance between the corresponding selected computing devices. The distance calculation unit 830 is specifically configured to acquire a rule corresponding to the distance parameter as a target rule; determine the distance between the second electronic device and the first electronic device based on the received signal strength and the target rule distance.
如图15所示,所述装置还包括:功能触发单元840,用于若所述距离小于距离阈值,显示与所述第二电子设备对应的提示信息。再者,功能触发单元840,还用于响应作用于所述提示信息的触控操作,执行与所述第二电子设备对应的操作。As shown in FIG. 15 , the apparatus further includes: a function triggering unit 840, configured to display prompt information corresponding to the second electronic device if the distance is less than a distance threshold. Furthermore, the function triggering unit 840 is further configured to execute an operation corresponding to the second electronic device in response to a touch operation acting on the prompt information.
本实施例提供的一种测量设备距离的装置,在计算设备距离的过程中,会根据第二电子设备发射的广播信号,来获取得到第二电子设备对应的接收信号强度以及距离参数,再基于所述接收信号强度以及所述距离参数,确定所述第二电子设备与所述第一电子设备之间的距离。从而通过上述方式使得在计算距离的过程中,对于所需的距离参数,可以针对需要进行距离计算的设备(第二电子设备)进行针对性的获取,而不会是对每个需要进行距离计算的设备均采用相同的距离参数,有利于使得在计算距离的过程中能够适应不同的需要进行距离计算的设备,以便提升设备间距离计算的准确性。The device for measuring the distance of a device provided in this embodiment, in the process of calculating the distance of the device, will obtain the received signal strength and distance parameters corresponding to the second electronic device according to the broadcast signal transmitted by the second electronic device, and then based on The received signal strength and the distance parameter determine the distance between the second electronic device and the first electronic device. Therefore, in the process of calculating the distance, the required distance parameter can be obtained in a targeted manner for the device (second electronic device) that needs to perform distance calculation, instead of performing distance calculation for each need. All devices adopt the same distance parameter, which is beneficial to adapt to different devices that need to perform distance calculation in the process of calculating distance, so as to improve the accuracy of distance calculation between devices.
请参阅图16,本申请实施例提供的一种测量设备距离的装置900,运行于第一电子设备,所述装置900包括:Please refer to Fig. 16, an apparatus 900 for measuring device distance provided by an embodiment of the present application, which operates on the first electronic device, and the apparatus 900 includes:
参数获取单元910,用于接收中间设备发送的接收信号强度以及距离参数,所述接收信号强度以及距离参数为所述中间设备根据第二电子设备发射的广播信号获取;The parameter acquisition unit 910 is configured to receive received signal strength and distance parameters sent by the intermediate device, and the received signal strength and distance parameters are acquired by the intermediate device according to the broadcast signal transmitted by the second electronic device;
距离计算单元930,用于基于所述接收信号强度以及所述距离参数,获取所述第二电子设备与所述中间设备之间的距离。The distance calculation unit 930 is configured to acquire the distance between the second electronic device and the intermediate device based on the received signal strength and the distance parameter.
本实施例提供的一种测量设备距离的装置,在计算第二电子设备与中间设备的设备距离的过程中,会根据第二电子设备发射的广播信号,来获取得到第二电子设备对应的接收信号强度以及距离参数,再基于所述接收信号强度以及所述距离参数,获取所述第二电子设备与所述中间设备之间的距离。从而通过上述方式使得在计算距离的过程中,对于所需的距离参数,可以针对需要进行距离计算的设备(第二电子设备)进行针对性的获取,而不会是对每个需要进行距离计算的设备均采用相同的距离参数,有利于使得在计算距离的过程中能够适应不同的需要进行距离计算的设备,以便提升设备间距离计算的准确性。The device for measuring the distance between devices provided in this embodiment, in the process of calculating the device distance between the second electronic device and the intermediate device, will obtain the corresponding reception information of the second electronic device according to the broadcast signal transmitted by the second electronic device. Signal strength and distance parameters. Based on the received signal strength and the distance parameters, the distance between the second electronic device and the intermediate device is acquired. Therefore, in the process of calculating the distance, the required distance parameter can be obtained in a targeted manner for the device (second electronic device) that needs to perform distance calculation, instead of performing distance calculation for each need. All devices adopt the same distance parameter, which is beneficial to adapt to different devices that need to perform distance calculation in the process of calculating distance, so as to improve the accuracy of distance calculation between devices.
需要说明的是,本申请中装置实施例与前述方法实施例是相互对应的,装置实施例中具体的原理可以参见前述方法实施例中的内容,此处不再赘述。It should be noted that the device embodiments in this application correspond to the foregoing method embodiments, and the specific principles in the device embodiments can refer to the content in the foregoing method embodiments, which will not be repeated here.
综上所述,本申请提供的一种测量设备距离的方法、装置、电子设备以及可读存储介质,在计算设备距离的过程中,会根据第二电子设备发射的广播信号,来获取得到第二电子设备对应的接收信号强度以及距离参数,再基于所述接收信号强度以及所述距离参数,确定所述第二电子设备与所述第一电子设备之间的距离。从而通过上述方式使得在计算距离的过程中,对于所需的距离参数,可以针对需要进行距离计算的设备(第二电子设备)进行针对性的获取,而不会是对每个需要进行距离计算的设备均采用相同的距离参数,有利于使得在计算距离的过程中能够适应不同的需要进行距离计算的设备,以便提升设备间距离计算的准确性。To sum up, the method, device, electronic device, and readable storage medium provided by the present application for measuring the distance of a device will obtain the second distance according to the broadcast signal transmitted by the second electronic device in the process of calculating the distance of the device. The received signal strength and the distance parameter corresponding to the two electronic devices, and then based on the received signal strength and the distance parameter, the distance between the second electronic device and the first electronic device is determined. Therefore, in the process of calculating the distance, the required distance parameter can be obtained in a targeted manner for the device (second electronic device) that needs to perform distance calculation, instead of performing distance calculation for each need. All devices adopt the same distance parameter, which is beneficial to adapt to different devices that need to perform distance calculation in the process of calculating distance, so as to improve the accuracy of distance calculation between devices.
请参阅图17,基于上述的测量设备距离的方法、装置,本申请实施例还提供的另一种可以执行前述测量设备距离的方法的电子设备1000。电子设备1000包括相互耦合的一个或多个(图中仅示出一个)处理器102、存储器104以及网络模块106。其中,该存储器104中存储有可以执行前述实施例中内容的程序,而处理器102可以执行该存储器104中存储的程序。Please refer to FIG. 17 , based on the above-mentioned method and apparatus for measuring a device distance, another electronic device 1000 that can implement the aforementioned method for measuring a device distance is provided in an embodiment of the present application. The electronic device 1000 includes one or more (only one is shown in the figure) processors 102 , memory 104 and network module 106 coupled to each other. Wherein, the memory 104 stores programs capable of executing the contents of the foregoing embodiments, and the processor 102 can execute the programs stored in the memory 104 .
其中,处理器102可以包括一个或者多个处理核。处理器102利用各种接口和线路连接整个电子设备1000内的各个部分,通过运行或执行存储在存储器104内的指令、程序、代码集或指令集,以及调用存储在存储器104内的数据,执行电子设备1000的各种功能和处理数据。可选地,处理器102可以采用数字 信号处理(Digital Signal Processing,DSP)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)、可编程逻辑阵列(Programmable Logic Array,PLA)中的至少一种硬件形式来实现。处理器102可集成中央处理器(Central Processing Unit,CPU)、图像处理器(Graphics Processing Unit,GPU)和调制解调器等中的一种或几种的组合。其中,CPU主要处理操作系统、用户界面和应用程序等;GPU用于负责显示内容的渲染和绘制;调制解调器用于处理无线通信。可以理解的是,上述调制解调器也可以不集成到处理器102中,单独通过一块通信芯片进行实现。Wherein, the processor 102 may include one or more processing cores. The processor 102 uses various interfaces and circuits to connect various parts of the entire electronic device 1000, and executes or executes instructions, programs, code sets, or instruction sets stored in the memory 104, and calls data stored in the memory 104 to execute Various functions of the electronic device 1000 and processing data. Optionally, the processor 102 may adopt at least one of Digital Signal Processing (Digital Signal Processing, DSP), Field-Programmable Gate Array (Field-Programmable Gate Array, FPGA), and Programmable Logic Array (Programmable Logic Array, PLA). implemented in the form of hardware. The processor 102 may integrate one or a combination of a central processing unit (Central Processing Unit, CPU), an image processor (Graphics Processing Unit, GPU), a modem, and the like. Among them, the CPU mainly handles the operating system, user interface and application programs, etc.; the GPU is used to render and draw the displayed content; the modem is used to handle wireless communication. It can be understood that the above modem may also not be integrated into the processor 102, but implemented by a communication chip alone.
存储器104可以包括随机存储器(Random Access Memory,RAM),也可以包括只读存储器(Read-Only Memory)。存储器104可用于存储指令、程序、代码、代码集或指令集。存储器104可包括存储程序区和存储数据区,其中,存储程序区可存储用于实现操作系统的指令、用于实现至少一个功能的指令(比如触控功能、声音播放功能、图像播放功能等)、用于实现下述各个方法实施例的指令等。存储器104中还可以存储有前述实施例中的测量设备距离的装置。The memory 104 may include random access memory (Random Access Memory, RAM), and may also include read-only memory (Read-Only Memory). Memory 104 may be used to store instructions, programs, codes, sets of codes, or sets of instructions. The memory 104 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as a touch function, a sound playback function, an image playback function, etc.) , instructions for implementing the following method embodiments, and the like. The device for measuring device distance in the foregoing embodiments may also be stored in the memory 104 .
所述网络模块106用于实现电子设备1000与其他设备之间的信息交互,例如,传输设备控制指令、操纵请求指令以及状态信息获取指令等。而当电子设备200具体为不同的设备时,其对应的网络模块106可能会有不同。The network module 106 is used to implement information interaction between the electronic device 1000 and other devices, for example, transmitting device control instructions, manipulation request instructions, and status information acquisition instructions. However, when the electronic device 200 is specifically a different device, its corresponding network module 106 may be different.
传感器模块108可以包括至少一种传感器。具体地,传感器模块108可包括但并不限于:光传感器、运动传感器、压力传感器、红外热传感器、距离传感器、加速度传感器、以及其他传感器。The sensor module 108 may include at least one sensor. Specifically, the sensor module 108 may include, but is not limited to: a light sensor, a motion sensor, a pressure sensor, an infrared heat sensor, a distance sensor, an acceleration sensor, and other sensors.
其中,压力传感器可以检测由按压在电子设备1000产生的压力的传感器。即,压力传感器检测由用户和电子设备之间的接触或按压产生的压力,例如由用户的耳朵与移动终端之间的接触或按压产生的压力。因此,压力传感器可以用来确定在用户与电子设备1000之间是否发生了接触或者按压,以及压力的大小。Wherein, the pressure sensor may be a sensor for detecting pressure generated by pressing on the electronic device 1000 . That is, the pressure sensor detects pressure generated by contact or press between the user and the electronic device, eg, contact or press between the user's ear and the mobile terminal. Therefore, the pressure sensor can be used to determine whether contact or pressure occurs between the user and the electronic device 1000, and the magnitude of the pressure.
其中,加速度传感器可检测各个方向上(一般为三轴)加速度的大小,静止时可检测出重力的大小及方向,可用于识别电子设备1000姿态的应用(比如横竖屏切换、相关游戏、磁力计姿态校准)、振动识别相关功能(比如计步器、敲击)等。另外,电子设备1000还可配置陀螺仪、气压计、湿度计、温度计等其他传感器,在此不再赘述。Among them, the acceleration sensor can detect the magnitude of acceleration in various directions (generally three axes), and can detect the magnitude and direction of gravity when it is still, and can be used to identify the application of electronic equipment 1000 attitude (such as horizontal and vertical screen switching, related games, magnetometer, etc.) Attitude calibration), vibration recognition related functions (such as pedometer, tapping), etc. In addition, the electronic device 1000 may also be configured with other sensors such as a gyroscope, a barometer, a hygrometer, and a thermometer, which will not be repeated here.
作为一种方式,若电子设备1000作为前述图1或者图2中所示的应用环境中的智能手机100,那么在这种情况下,电子设备1000的网络模块为射频模块,该射频模块用于接收以及发送电磁波,实现电磁波与电信号的相互转换,从而与通讯网络或者其他设备进行通讯。所述射频模块可包括各种现有的用于执行这些功能的电路元件,例如,天线、射频收发器、数字信号处理器、加密/解密芯片、用户身份模块(SIM)卡、存储器等等。例如,该射频模块可以通过发送或者接收的电磁波与基站进行信息交互。As a method, if the electronic device 1000 is used as the smart phone 100 in the application environment shown in FIG. 1 or FIG. Receive and send electromagnetic waves, realize the mutual conversion between electromagnetic waves and electrical signals, and communicate with communication networks or other devices. The radio frequency module may include various existing circuit elements for performing these functions, such as antenna, radio frequency transceiver, digital signal processor, encryption/decryption chip, Subscriber Identity Module (SIM) card, memory and so on. For example, the radio frequency module can perform information interaction with the base station by sending or receiving electromagnetic waves.
请参考图18,其示出了本申请实施例提供的一种计算机可读存储介质的结构框图。该计算机可读介质900中存储有程序代码,所述程序代码可被处理器调用执行上述方法实施例中所描述的方法。Please refer to FIG. 18 , which shows a structural block diagram of a computer-readable storage medium provided by an embodiment of the present application. Program codes are stored in the computer-readable medium 900, and the program codes can be invoked by a processor to execute the methods described in the foregoing method embodiments.
计算机可读存储介质900可以是诸如闪存、EEPROM(电可擦除可编程只读存储器)、EPROM、硬盘或者ROM之类的电子存储器。可选地,计算机可读存储介质900包括非易失性计算机可读介质(non-transitory computer-readable storage medium)。计算机可读存储介质900具有执行上述方法中的任何方法步骤的程序代码910的存储空间。这些程序代码可以从一个或者多个计算机程序产品中读出或者写入到这一个或者多个计算机程序产品中。程序代码910可以例如以适当形式进行压缩。The computer readable storage medium 900 may be an electronic memory such as flash memory, EEPROM (Electrically Erasable Programmable Read Only Memory), EPROM, hard disk, or ROM. Optionally, the computer-readable storage medium 900 includes a non-transitory computer-readable storage medium (non-transitory computer-readable storage medium). The computer-readable storage medium 900 has a storage space for program code 910 for executing any method steps in the above methods. These program codes can be read from or written into one or more computer program products. Program code 910 may, for example, be compressed in a suitable form.
最后应说明的是:以上实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不驱使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围。Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, but not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: it can still Modifications are made to the technical solutions described in the foregoing embodiments, or equivalent replacements are made to some of the technical features; and these modifications or replacements do not drive the essence of the corresponding technical solutions away from the spirit and scope of the technical solutions of the various embodiments of the present application.
Claims (20)
- 一种测量设备距离的方法,其特征在于,应用于第一电子设备,所述方法包括:A method for measuring device distance, characterized in that it is applied to a first electronic device, the method comprising:获取第二电子设备发射的广播信号;Obtain a broadcast signal transmitted by the second electronic device;基于所述广播信号,确定接收信号强度及距离参数;determining received signal strength and distance parameters based on the broadcast signal;基于所述接收信号强度以及所述距离参数,确定所述第二电子设备与所述第一电子设备之间的距离。Based on the received signal strength and the distance parameter, determine the distance between the second electronic device and the first electronic device.
- 根据权利要求1所述的方法,其特征在于,所述基于所述广播信号,确定接收信号强度及距离参数,包括:The method according to claim 1, wherein said determining received signal strength and distance parameters based on said broadcast signal comprises:基于所述广播信号,确定接收信号强度及第二电子设备的标识;determining a received signal strength and an identity of a second electronic device based on the broadcast signal;根据预先建立的标识与距离参数的对应关系,确定与所述第二电子设备的标识对应的距离参数。Determine the distance parameter corresponding to the identifier of the second electronic device according to the pre-established correspondence between the identifier and the distance parameter.
- 根据权利要求2所述的方法,其特征在于,所述基于所述广播信号,确定接收信号强度及第二电子设备的标识,包括:The method according to claim 2, wherein the determining the received signal strength and the identity of the second electronic device based on the broadcast signal comprises:基于所述广播信号,确定接收信号强度;determining received signal strength based on the broadcast signal;根据所述广播信号中所携带的数据的组成格式来确定第二电子设备的标识。Determine the identity of the second electronic device according to the composition format of the data carried in the broadcast signal.
- 根据权利要求1-3任一所述的方法,其特征在于,所述距离参数为指定规则对应的参数,所述指定规则用于根据广播信号的接收信号强度得到设备之间的距离;所述基于所述接收信号强度以及所述距离参数,确定所述第二电子设备与所述第一电子设备之间的距离,包括:The method according to any one of claims 1-3, wherein the distance parameter is a parameter corresponding to a specified rule, and the specified rule is used to obtain the distance between devices according to the received signal strength of the broadcast signal; the Determining the distance between the second electronic device and the first electronic device based on the received signal strength and the distance parameter includes:基于所述指定规则、接收信号强度以及所述距离参数,确定所述第二电子设备与所述第一电子设备之间的距离。The distance between the second electronic device and the first electronic device is determined based on the specified rule, received signal strength, and the distance parameter.
- 根据权利要求4所述的方法,其特征在于,所述距离参数为所述指定规则所包括的参数。The method according to claim 4, wherein the distance parameter is a parameter included in the specified rule.
- 根据权利要求4所述的方法,其特征在于,所述距离参数为用于对所述指定规则所包括的参数进行校准的参数;所述基于所述指定规则、所述接收信号强度以及所述距离参数,确定所述第二电子设备与所述第一电子设备之间的距离,包括:The method according to claim 4, wherein the distance parameter is a parameter used to calibrate the parameters included in the specified rule; the said distance parameter is based on the specified rule, the received signal strength and the The distance parameter, determining the distance between the second electronic device and the first electronic device, includes:基于所述距离参数对所述指定规则包括的参数进行校准,得到校准后的参数;Calibrate the parameters included in the specified rule based on the distance parameter to obtain the calibrated parameters;基于所述指定规则、所述接收信号强度以及所述校准后的参数,确定所述第二电子设备与所述第一电子设备之间的距离。A distance between the second electronic device and the first electronic device is determined based on the specified rule, the received signal strength, and the calibrated parameters.
- 根据权利要求4所述的方法,其特征在于,所述基于所述指定规则、接收信号强度以及所述距离参数,确定所述第二电子设备与所述第一电子设备之间的距离,包括:The method according to claim 4, wherein the determining the distance between the second electronic device and the first electronic device based on the specified rule, received signal strength and the distance parameter comprises :基于所述距离参数校准指定规则中的初始参数,得到进行参数校准后的指定规则;Calibrating the initial parameters in the designated rule based on the distance parameter to obtain the designated rule after parameter calibration;基于所述进行参数校准后的指定规则、接收信号强度以及所述距离参数,确定所述第二电子设备与所述第一电子设备之间的距离。Determine the distance between the second electronic device and the first electronic device based on the designated rule after parameter calibration, received signal strength, and the distance parameter.
- 根据权利要求1-3任一所述的方法,其特征在于,所述距离参数表征所对应选取的计算设备之间距离的规则;所述基于所述接收信号强度以及所述距离参数,确定所述第二电子设备与所述第一电子设备之间的距离,包括:The method according to any one of claims 1-3, wherein the distance parameter characterizes the rule of the distance between the corresponding selected computing devices; the determination of the distance parameter based on the received signal strength and the distance parameter The distance between the second electronic device and the first electronic device includes:获取与所述距离参数对应的规则作为目标规则;acquiring a rule corresponding to the distance parameter as a target rule;基于所述接收信号强度以及所述目标规则,确定所述第二电子设备与所述第一电子设备之间的距离。Based on the received signal strength and the target rule, the distance between the second electronic device and the first electronic device is determined.
- 根据权利要求1-3任一所述的方法,其特征在于,所述基于所述接收信号强度以及所述距离参数,确定所述第二电子设备与所述第一电子设备之间的距离之后,还包括:The method according to any one of claims 1-3, wherein after determining the distance between the second electronic device and the first electronic device based on the received signal strength and the distance parameter, ,Also includes:若所述距离小于距离阈值,显示与所述第二电子设备对应的提示信息。If the distance is less than a distance threshold, displaying prompt information corresponding to the second electronic device.
- 根据权利要求9所述的方法,其特征在于,所述若所述距离小于距离阈值,显示与所述第二电子设备对应的提示信息之后,还包括:The method according to claim 9, wherein if the distance is less than a distance threshold, after displaying the prompt information corresponding to the second electronic device, further comprising:响应作用于所述提示信息的触控操作,执行与所述第二电子设备对应的操作。In response to the touch operation acting on the prompt information, an operation corresponding to the second electronic device is performed.
- 根据权利要求4-10任一所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 4-10, wherein the method further comprises:从多个规则中确定一个规则作为用于计算第二电子设备与第一电子设备之间距离的指定规则。One rule is determined from the plurality of rules as a designated rule for calculating the distance between the second electronic device and the first electronic device.
- 根据权利要求11所述的方法,其特征在于,所述从多个规则中确定一个规则作为用于计算第二电子设备与第一电子设备之间距离的指定规则,包括:The method according to claim 11, wherein said determining a rule from a plurality of rules as a specified rule for calculating the distance between the second electronic device and the first electronic device comprises:基于所述距离参数从多个规则中确定一个规则作为用于计算第二电子设备与第一电子设备之间距离的指定规则。A rule is determined from a plurality of rules based on the distance parameter as a specified rule for calculating the distance between the second electronic device and the first electronic device.
- 根据权利要求1-12任一所述的方法,其特征在于,根据所述第二电子设备的外部形态或者内部结构确定所述距离参数。The method according to any one of claims 1-12, characterized in that the distance parameter is determined according to the external form or internal structure of the second electronic device.
- 根据权利要求1所述的方法,其特征在于,所述基于所述广播信号,确定接收信号强度及距离参数,包括:The method according to claim 1, wherein said determining received signal strength and distance parameters based on said broadcast signal comprises:基于所述广播信号,确定接收信号强度,以及从所述广播信号中获取距离参数。Based on the broadcast signal, a received signal strength is determined, and a distance parameter is obtained from the broadcast signal.
- 根据权利要求1-14任一所述的方法,其特征在于,所述获取第二电子设备发射的广播信号之前,还包括:The method according to any one of claims 1-14, wherein before acquiring the broadcast signal transmitted by the second electronic device, further comprising:以基于蓝牙BLE模式或者Wi-Fi Aware模式进行广信号的扫描。Wide signal scanning based on Bluetooth BLE mode or Wi-Fi Aware mode.
- 一种测量设备距离的方法,其特征在于,应用于第一电子设备,所述方法包括:A method for measuring device distance, characterized in that it is applied to a first electronic device, the method comprising:接收中间设备发送的接收信号强度以及距离参数,所述接收信号强度以及距离参数为所述中间设备根据第二电子设备发射的广播信号获取;receiving received signal strength and distance parameters sent by the intermediate device, where the received signal strength and distance parameters are acquired by the intermediate device according to the broadcast signal transmitted by the second electronic device;基于所述接收信号强度以及所述距离参数,获取所述第二电子设备与所述中间设备之间的距离。Acquire the distance between the second electronic device and the intermediate device based on the received signal strength and the distance parameter.
- 一种测量设备距离的装置,其特征在于,运行于第一电子设备,所述装置包括:A device for measuring device distance is characterized in that it operates on a first electronic device, and the device includes:信号获取单元,用于获取第二电子设备发射的广播信号;a signal acquisition unit, configured to acquire a broadcast signal transmitted by the second electronic device;参数获取单元,用于基于所述广播信号,确定接收信号强度及距离参数;A parameter acquisition unit, configured to determine received signal strength and distance parameters based on the broadcast signal;距离计算单元,用于基于所述接收信号强度以及所述距离参数,确定所述第二电子设备与所述第一电子设备之间的距离。A distance calculation unit, configured to determine the distance between the second electronic device and the first electronic device based on the received signal strength and the distance parameter.
- 一种测量设备距离的装置,其特征在于,运行于第一电子设备,所述装置包括:A device for measuring device distance is characterized in that it operates on a first electronic device, and the device includes:参数获取单元,用于接收中间设备发送的接收信号强度以及距离参数,所述接收信号强度以及距离参数为所述中间设备根据第二电子设备发射的广播信号获取;A parameter acquisition unit, configured to receive received signal strength and distance parameters sent by the intermediate device, where the received signal strength and distance parameters are acquired by the intermediate device according to the broadcast signal transmitted by the second electronic device;距离计算单元,用于基于所述接收信号强度以及所述距离参数,获取所述第二电子设备与所述中间设备之间的距离。A distance calculating unit, configured to acquire the distance between the second electronic device and the intermediate device based on the received signal strength and the distance parameter.
- 一种电子设备,其特征在于,包括一个或多个处理器以及存储器;An electronic device, characterized in that it includes one or more processors and memory;一个或多个程序,其中所述一个或多个程序被存储在所述存储器中并被配置为由所述一个或多个处理器执行,所述一个或多个程序配置用于执行权利要求1-15任一所述的方法。One or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs are configured to perform claim 1 -15 any of the methods described.
- 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质中存储有程序代码,其中,在所述程序代码运行时执行权利要求1-15任一所述的方法。A computer-readable storage medium, wherein a program code is stored in the computer-readable storage medium, wherein the method according to any one of claims 1-15 is executed when the program code is running.
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110580797.7A CN113325404A (en) | 2021-05-26 | 2021-05-26 | Method and device for measuring equipment distance and electronic equipment |
CN202110580797.7 | 2021-05-26 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2022247390A1 true WO2022247390A1 (en) | 2022-12-01 |
Family
ID=77421335
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2022/079991 WO2022247390A1 (en) | 2021-05-26 | 2022-03-09 | Method and apparatus for measuring device distance, electronic device, and readable storage medium |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN113325404A (en) |
WO (1) | WO2022247390A1 (en) |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113325404A (en) * | 2021-05-26 | 2021-08-31 | Oppo广东移动通信有限公司 | Method and device for measuring equipment distance and electronic equipment |
CN113783994B (en) * | 2021-09-06 | 2023-06-23 | Oppo广东移动通信有限公司 | Prompt information display method and device, electronic equipment and storage medium |
CN114286254B (en) * | 2021-12-02 | 2023-11-24 | 立讯电子科技(昆山)有限公司 | Wireless earphone, mobile phone and sound wave distance measuring method |
Citations (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20160003932A1 (en) * | 2014-07-03 | 2016-01-07 | Lexmark International, Inc. | Method and System for Estimating Error in Predicted Distance Using RSSI Signature |
CN107422298A (en) * | 2017-09-19 | 2017-12-01 | 深圳市深层互联科技有限公司 | Bluetooth ranging parameters optimization method, system, storage medium and mobile terminal |
CN107509175A (en) * | 2017-09-19 | 2017-12-22 | 深圳市深层互联科技有限公司 | Bluetooth indoor orientation method, system, storage medium and terminal |
CN107561521A (en) * | 2016-06-30 | 2018-01-09 | 大唐半导体设计有限公司 | A kind of method and apparatus of wireless distance finding |
CN107655479A (en) * | 2017-09-19 | 2018-02-02 | 深圳市深层互联科技有限公司 | Localization method, positioner, electronic equipment and computer program product based on localizer beacon |
CN109116341A (en) * | 2018-07-31 | 2019-01-01 | 北京小米移动软件有限公司 | Method for building up, distance detection method and device, the electronic equipment of range function |
CN109490826A (en) * | 2018-10-26 | 2019-03-19 | 西安电子科技大学 | A kind of ranging and location positioning method based on radio wave field strength RSSI |
WO2020164256A1 (en) * | 2019-02-13 | 2020-08-20 | 华为技术有限公司 | Wireless signal quality evaluating method, electronic device, and system |
CN111669681A (en) * | 2020-05-29 | 2020-09-15 | 歌尔科技有限公司 | Control method and device of intelligent sound equipment and storage medium |
CN111880855A (en) * | 2020-07-31 | 2020-11-03 | 宁波奥克斯电气股份有限公司 | Equipment control method and distributed voice system |
CN113325404A (en) * | 2021-05-26 | 2021-08-31 | Oppo广东移动通信有限公司 | Method and device for measuring equipment distance and electronic equipment |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
GB2459479B8 (en) * | 2008-04-23 | 2012-08-08 | Bigger Than The Wheel Ltd | Short range RF monitoring system |
CN109581307B (en) * | 2018-11-22 | 2023-03-21 | 西安八阵图电子科技有限公司 | Echo intensity Z parameter calibration method and device, computer equipment and storage medium |
CN110488311B (en) * | 2019-08-05 | 2021-08-13 | Oppo广东移动通信有限公司 | Depth distance measuring method, depth distance measuring device, storage medium and electronic equipment |
-
2021
- 2021-05-26 CN CN202110580797.7A patent/CN113325404A/en active Pending
-
2022
- 2022-03-09 WO PCT/CN2022/079991 patent/WO2022247390A1/en active Application Filing
Patent Citations (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20160003932A1 (en) * | 2014-07-03 | 2016-01-07 | Lexmark International, Inc. | Method and System for Estimating Error in Predicted Distance Using RSSI Signature |
CN107561521A (en) * | 2016-06-30 | 2018-01-09 | 大唐半导体设计有限公司 | A kind of method and apparatus of wireless distance finding |
CN107422298A (en) * | 2017-09-19 | 2017-12-01 | 深圳市深层互联科技有限公司 | Bluetooth ranging parameters optimization method, system, storage medium and mobile terminal |
CN107509175A (en) * | 2017-09-19 | 2017-12-22 | 深圳市深层互联科技有限公司 | Bluetooth indoor orientation method, system, storage medium and terminal |
CN107655479A (en) * | 2017-09-19 | 2018-02-02 | 深圳市深层互联科技有限公司 | Localization method, positioner, electronic equipment and computer program product based on localizer beacon |
CN109116341A (en) * | 2018-07-31 | 2019-01-01 | 北京小米移动软件有限公司 | Method for building up, distance detection method and device, the electronic equipment of range function |
CN109490826A (en) * | 2018-10-26 | 2019-03-19 | 西安电子科技大学 | A kind of ranging and location positioning method based on radio wave field strength RSSI |
WO2020164256A1 (en) * | 2019-02-13 | 2020-08-20 | 华为技术有限公司 | Wireless signal quality evaluating method, electronic device, and system |
CN111669681A (en) * | 2020-05-29 | 2020-09-15 | 歌尔科技有限公司 | Control method and device of intelligent sound equipment and storage medium |
CN111880855A (en) * | 2020-07-31 | 2020-11-03 | 宁波奥克斯电气股份有限公司 | Equipment control method and distributed voice system |
CN113325404A (en) * | 2021-05-26 | 2021-08-31 | Oppo广东移动通信有限公司 | Method and device for measuring equipment distance and electronic equipment |
Also Published As
Publication number | Publication date |
---|---|
CN113325404A (en) | 2021-08-31 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2022247390A1 (en) | Method and apparatus for measuring device distance, electronic device, and readable storage medium | |
AU2021269359B2 (en) | Display method and apparatus | |
US10595347B2 (en) | Systems and methods for coupling wireless devices | |
CN109905907B (en) | Network searching method and mobile terminal | |
US11026076B2 (en) | Mobile terminal, information processing method and program | |
CN112787780B (en) | SRS emission setting method, information configuration method, positioning method and related equipment | |
WO2021022981A1 (en) | Terminal interaction method and terminal | |
CN113194531B (en) | Positioning method and communication equipment | |
KR20160028321A (en) | Method for estimating a distance and electronic device thereof | |
CN107948919B (en) | Shared information processing method and mobile terminal | |
CN107621228A (en) | A kind of object measuring method, camera terminal and computer-readable recording medium | |
CN113596904B (en) | Method and equipment for transmitting aperiodic positioning report | |
US10291427B2 (en) | Device selection method and apparatus | |
CN110505279B (en) | Method and device for setting time delay | |
CN113466841B (en) | Distance measuring method, device, electronic equipment and storage medium | |
KR102686229B1 (en) | Random connection method and terminal | |
CN113286335A (en) | Frequency point switching method and device, storage medium and access point | |
WO2022262445A1 (en) | Method and apparatus for acquiring positioning information, electronic device, and storage medium | |
WO2021088816A1 (en) | Method and apparatus for measuring signal-to-interference-plus-noise ratio, device, and medium | |
CN113347710B (en) | Positioning method and related device | |
US12137381B2 (en) | Random access method and terminal | |
CN112888012B (en) | Method, apparatus, device and medium for determining measurement purpose | |
CN116258378A (en) | Map display method and device and computer readable storage medium | |
CN116232793A (en) | Equipment control method and device and network equipment | |
CN117615315A (en) | Optimization method, device, equipment, storage medium and product of wireless local area network |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 22810124 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 22810124 Country of ref document: EP Kind code of ref document: A1 |