Distance measurement method, device and system

By using encrypted communication and public-key private key interaction in the ranging method between master and slave stations, the problem of multiple information interactions in the prior art is solved, and the ranging efficiency and security are improved.

CN115308725BActive Publication Date: 2024-12-31BEIYUN TECHNOLOGY (HUNAN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210956216.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-10
Publication Date
2024-12-31
Estimated Expiration
2042-08-10

AI Technical Summary

Technical Problem

The distance measurement method between the existing master and slave stations requires multiple interactions of information, resulting in low ranging efficiency and lack of communication security.

Method used

By encrypting communication between the master and slaves, using public keys and private keys for information interaction, reducing the reception of slaves to the master's broadcast, reducing the amount of information interaction, and encrypting it through public keys and private keys Communication improves security.

Benefits of technology

It improves the ranging efficiency and communication security of the ranging system, reduces the amount of information interaction, and ensures the security of information transmission.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115308725B_ABST
    Figure CN115308725B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention provides a ranging method, including: receiving a master station broadcast sent by a master station, and recording a first receiving time of receiving the master station broadcast, the master station broadcast including a master station public key and a first sending time of the master station broadcast; sending a slave station reply to the master station, and recording a second sending time of sending the slave station reply, the slave station reply including the slave station public key encrypted by the master station public key; receiving the master station reply sent by the master station, the master station reply including the second receiving time of the master station receiving the slave station reply encrypted by the slave station public key; decrypting the master station reply by the slave station private key to obtain the second receiving time; calculating the distance between the master station and the slave station according to the first receiving time, the second receiving time, the first sending time and the second sending time. The present invention improves the ranging efficiency of the ranging system and improves the communication security of the ranging system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of distance measurement methods, and in particular to a distance measurement method, device and system. Background Art

[0002] In real life, many scenarios require distance measurement between two points. The distance measurement method can be calculated by the flight time of radio waves between the two points. Common distance measurement methods between points include echo ranging similar to radar and ranging methods for signal transmission and reception between master and slave stations. However, for the ranging method between master and slave stations, the master and slave stations often need to exchange information multiple times, which makes it difficult for the master station to serve multiple slave stations, and the ranging efficiency is not high. Summary of the invention

[0003] The embodiment of the present invention provides a ranging method, which aims to solve the problem that the existing ranging method between the master and the slave station requires multiple information exchanges between the master and the slave station. In the process of information exchange between the master station and the slave station, the distance between the master station and the slave station is completed through the information exchange process, and the slave station that has completed the ranging no longer receives the master station broadcast of the master station, so that the slave station that has completed the ranging does not participate in the subsequent information exchange with the master station, which reduces the amount of information exchange and improves the ranging efficiency of the ranging system. In addition, the encrypted communication of the information exchange process is realized by the master station public key, the master station private key, the slave station public key and the slave station private key, thereby improving the communication security of the ranging system.

[0004] In a first aspect, an embodiment of the present invention provides a ranging method for a ranging system, wherein the ranging system includes a master station and multiple slave stations, wherein encrypted communication is performed between the master station and the slave stations, and the ranging method includes the following steps:

[0005] Receiving a master station broadcast sent by the master station, and recording a first receiving time of the master station broadcast, wherein the master station broadcast includes a master station public key and a first sending time of the master station broadcast;

[0006] Sending a slave station reply to the master station, and recording a second sending time of sending the slave station reply, wherein the slave station reply includes the slave station public key encrypted by the master station public key;

[0007] receiving a master station reply sent by the master station, wherein the master station reply includes a second receiving time at which the master station receives the slave station reply encrypted by the slave station public key;

[0008] Decrypting the master station reply by using the slave station private key to obtain the second receiving time;

[0009] The distance between the master station and the slave station is calculated according to the first receiving time, the second receiving time, the first sending time, and the second sending time.

[0010] Optionally, after the step of receiving the master station broadcast sent by the master station and recording the first receiving time of receiving the master station broadcast, the method further includes:

[0011] Obtaining the master station public key from the master station broadcast;

[0012] The slave station public key is encrypted by the master station public key to obtain a slave station reply.

[0013] Optionally, after the step of receiving a master station reply sent by the master station, the method further includes:

[0014] Decrypting the master station reply using the slave station private key corresponding to the current slave station;

[0015] If the decryption fails, the current slave station is controlled to continue receiving state to receive the master station broadcast sent by the master station in the next round;

[0016] If the decryption is successful, the current slave station is controlled to stop receiving so as to stop receiving the master station broadcast sent by the master station in the next round.

[0017] Optionally, the step of calculating the distance between the master station and the slave station according to the first receiving time, the second receiving time, the first sending time, and the second sending time includes:

[0018] Calculate the interaction time between the master station and the slave station according to the second receiving time and the first sending time;

[0019] Calculating the data processing time of the slave station according to the second sending time and the first receiving time;

[0020] Calculating information propagation time according to the interaction time and the data processing time;

[0021] The distance between the master station and the slave station is calculated according to the information propagation time and the information propagation speed.

[0022] In a second aspect, an embodiment of the present invention further provides a ranging method for a ranging system, wherein the ranging system includes a master station and multiple slave stations, wherein encrypted communication is performed between the master station and the slave stations, and the ranging method includes the following steps:

[0023] Sending a master station broadcast to the plurality of slave stations, and recording a first sending time of sending the master station broadcast, wherein the master station broadcast includes a master station public key;

[0024] Receive a slave reply sent by the slave, and record a second receiving time of receiving the slave reply, wherein the slave reply includes a first receiving time and a second sending time encrypted by the master public key, wherein the first receiving time is the time when the slave receives the master broadcast, and the second sending time is the time when the slave sends the slave reply;

[0025] Decrypt the slave station reply by using the master station private key to obtain the first receiving time and the second sending time;

[0026] The distance between the master station and the slave station is calculated according to the first receiving time, the second receiving time, the first sending time, and the second sending time.

[0027] Optionally, the step of receiving a slave station reply sent by the slave station and recording a second receiving time at which the slave station reply is received includes:

[0028] In the ranging cycle, when the first slave station reply is received, only the first slave station reply is processed for ranging until no more slave station reply is received, and the ranging of all the slave stations in the ranging cycle is completed, wherein the slave station that has undergone ranging processing no longer receives the master station broadcast.

[0029] Optionally, the master station broadcast further includes the first sending time, the slave station reply further includes the slave station public key encrypted by the master station public key, and after the step of receiving the slave station reply sent by the slave station and recording the second receiving time of receiving the slave station reply, the method further includes:

[0030] Encrypting the second receiving time by using the slave station public key to obtain a master station reply;

[0031] The master station reply is sent to the slave station, so that the slave station decrypts the master station reply by using the slave station private key to obtain a second receiving time, and calculates the distance between the master station and the slave station based on the first receiving time, the second receiving time, the first sending time and the second sending time.

[0032] In a third aspect, an embodiment of the present invention further provides a distance measuring device, the device comprising:

[0033] A first receiving module is used to receive a master station broadcast sent by the master station, and record a first receiving time of the master station broadcast, wherein the master station broadcast includes a master station public key and a first sending time of the master station broadcast;

[0034] A first sending module is used to send a slave station reply to the master station and record a second sending time of sending the slave station reply, wherein the slave station reply includes the slave station public key encrypted by the master station public key;

[0035] A second receiving module, configured to receive a master station reply sent by the master station, wherein the master station reply includes a second receiving time at which the master station receives the slave station reply encrypted by the slave station public key;

[0036] A first decryption module, configured to decrypt the master station reply by using a slave station private key to obtain the second receiving time;

[0037] The first calculation module is used to calculate the distance between the master station and the slave station according to the first receiving time, the second receiving time, the first sending time and the second sending time.

[0038] In a fourth aspect, an embodiment of the present invention further provides a distance measuring device, the device comprising:

[0039] A second sending module is used to send a master station broadcast to the plurality of slave stations and record a first sending time of sending the master station broadcast, wherein the master station broadcast includes a master station public key;

[0040] A third receiving module is used to receive a slave station reply sent by the slave station, and record a second receiving time when the slave station reply is received, wherein the slave station reply includes a first receiving time and a second sending time encrypted by the master station public key, wherein the first receiving time is the time when the slave station receives the master station broadcast, and the second sending time is the time when the slave station sends the slave station reply;

[0041] A second decryption module, configured to decrypt the slave station reply by using the master station private key to obtain the first receiving time and the second sending time;

[0042] The second calculation module is used to calculate the distance between the master station and the slave station according to the first receiving time, the second receiving time, the first sending time and the second sending time.

[0043] In a fifth aspect, an embodiment of the present invention further provides a ranging system, the ranging system comprising a master station and a plurality of slave stations, wherein the master station communicates with the slave stations in encrypted manner;

[0044] The slave station is used to implement the steps of any one of the ranging methods provided in the embodiments of the present invention;

[0045] The master station is used to implement the steps in any one of the ranging methods provided in the embodiments of the present invention.

[0046] In an embodiment of the present invention, a master station broadcast sent by the master station is received, and a first receiving time of receiving the master station broadcast is recorded, wherein the master station broadcast includes a master station public key and a first sending time of the master station broadcast; a slave station reply is sent to the master station, and a second sending time of sending the slave station reply is recorded, wherein the slave station reply includes the slave station public key encrypted by the master station public key; a master station reply sent by the master station is received, wherein the master station reply includes a second receiving time when the master station receives the slave station reply encrypted by the slave station public key; the master station reply is decrypted by the slave station private key to obtain the second receiving time, and the master station broadcast is no longer received in the current ranging cycle; and the distance between the master station and the slave station is calculated based on the first receiving time, the second receiving time, the first sending time, and the second sending time. In the process of information exchange between the master station and the slave station, the distance between the master station and the slave station is completed through the information exchange process. The slave station that has completed the ranging no longer receives the master station broadcast of the master station, so that the slave station that has completed the ranging does not participate in the subsequent information exchange with the master station, which reduces the amount of information exchange and improves the ranging efficiency of the ranging system. In addition, the encrypted communication of the information exchange process is realized through the master station public key, the master station private key, the slave station public key and the slave station private key, which improves the communication security of the ranging system. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0048] Figure 1 is an architecture diagram of a distance measurement system provided by an embodiment of the present invention;

[0049] Figure 2 is a flow chart of a distance measurement method provided by an embodiment of the present invention;

[0050] Figure 3 is a flow chart of another ranging method provided by an embodiment of the present invention;

[0051] Figure 4is a structural schematic diagram of a distance measuring device provided by an embodiment of the present invention;

[0052] Figure 5 It is a structural schematic diagram of another distance measuring device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0053] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0054] See also Figure 1 , Figure 1 is an architecture diagram of a distance measurement system provided by an embodiment of the present invention, such as Figure 1 As shown, the ranging system includes: a master station and multiple slave stations, and encrypted communication is performed between the master station and the slave stations.

[0055] In an embodiment of the present invention, the above-mentioned master station end can be a transmitting and receiving device for wireless signals, the above-mentioned slave station end can include a transmitting and receiving device for wireless signals, the above-mentioned encrypted communication can be an encrypted communication based on an asymmetric encryption algorithm, the above-mentioned master station end and the slave station end also include a time recording device that can accurately record the signal sending time and receiving time, and the above-mentioned asymmetric encryption algorithm can include but is not limited to the ECC encryption algorithm and the RSA encryption algorithm.

[0056] Furthermore, the master station can be set at a fixed position, which can be a manually selected position. The slave station can be set at a fixed position or on a movable device, which can be a mobile phone, tablet, car, music player, etc.

[0057] In one ranging cycle, a master station can perform ranging on multiple slave stations. Specifically, the master station sends multiple rounds of master station broadcasts to the slave stations. In each round of master station broadcasts, the slave station that first replies to the slave station is ranged. The slave station that has completed ranging will no longer receive master station broadcasts in the current ranging cycle.

[0058] The master station is provided with a master station public key and a master station private key, and the slave stations are also provided with slave station public keys and slave station private keys, that is to say, each slave station corresponds to a set of slave station public keys and slave station private keys, and the slave station public key and slave station private key of each slave station are different from the slave station public key and slave station private key of other slave stations. Among them, the master station public key can be understood as an encryption method, the master station private key can be understood as a decryption method for the master station public key, the slave station public key can be understood as an encryption method, and the slave station private key can be understood as a decryption method for the slave station public key.

[0059] In a possible embodiment, the master station broadcast includes the master station public key and the first sending time of the master station broadcast. After receiving the master station broadcast, the slave station parses the master station broadcast to obtain the master station public key and the first sending time of the master station broadcast, and records the master station public key and the first sending time. After obtaining the master station public key, the slave station records the receiving time of the master station broadcast as the first receiving time, reads the slave station public key of the slave station, encrypts the slave station public key by the master station public key of the master station, obtains the slave station reply containing the encrypted slave station public key, sends the slave station reply to the master station, and records the sending time of the slave station reply as the second sending time. After receiving the first slave station reply, the master station records the receiving time of the slave station reply as the second receiving time, and decrypts the slave station reply by the master station private key to obtain the slave station public key. After the master station obtains the slave station public key, it encrypts the second receiving time with the slave station public key, obtains the master station reply containing the encrypted second receiving time, and sends the master station reply to each slave station. After receiving the master station reply, each slave station uses its own slave station private key to decrypt the master station reply. Only the slave station whose slave station private key matches the slave station public key can successfully decrypt the master station reply. The slave station that successfully decrypts the master station reply obtains the second receiving time, and the slave station can calculate the distance between the slave station and the master station through the first sending time, the first receiving time, the second sending time, and the second receiving time.

[0060] In a possible embodiment, the master station broadcast includes the master station public key. After receiving the master station broadcast, the slave station parses the master station broadcast to obtain the master station public key and records the master station public key. After obtaining the master station public key, the slave station records the reception time of the master station broadcast as the first reception time, reads the slave station public key of the slave station, encrypts the slave station public key, the first reception time and the second sending time by using the master station public key of the master station, obtains the slave station reply including the encrypted slave station public key, the first reception time and the second sending time, and sends the slave station reply to the master station at the second sending time. After receiving the first slave station reply, the master station records the reception time of the slave station reply as the second reception time, and decrypts the slave station reply by using the master station private key to obtain the slave station public key, the first reception time and the second sending time. After obtaining the slave station public key, the master station encrypts the stop receiving instruction by using the slave station public key to obtain the master station reply including the encrypted master station reply, and sends the master station reply to each slave station. After receiving the reply from the master station, each slave station uses its own slave station private key to decrypt the reply from the master station. Only the slave station whose private key matches the slave station public key can successfully decrypt the reply from the master station. The slave station that successfully decrypts the reply from the master station obtains the stop receiving instruction, so that the slave station enters the stop receiving state according to the stop receiving instruction and no longer receives the master station broadcast sent by the master station in the current ranging cycle. After the master station obtains the first receiving time, the second sending time, and the second receiving time, the distance between the slave station and the master station can be obtained through the first sending time, the first receiving time, the second sending time, and the second receiving time. Furthermore, before sending the reply from the master station to each slave station, the calculated distance between the master station and the slave station can also be added to the reply from the master station. Of course, the distance between the master station and the slave station is also encrypted by the slave station public key of the slave station.

[0061] In a possible embodiment, the master station broadcast includes the master station public key and the first sending time of the master station broadcast. After receiving the master station broadcast, the slave station parses the master station broadcast to obtain the master station public key and the first sending time of the master station broadcast, and records the master station public key and the first sending time. After obtaining the master station public key, the slave station records the receiving time of the master station broadcast as the first receiving time, reads the slave station public key of the slave station, encrypts the slave station public key, the first receiving time and the second sending time by the master station public key, obtains the slave station reply including the encrypted slave station public key, the first receiving time and the second sending time, and sends the slave station reply to the master station at the second sending time. After receiving the first slave station reply, the master station records the receiving time of the slave station reply as the second receiving time, and decrypts the slave station reply by the master station private key to obtain the slave station public key, the first receiving time and the second sending time. After the master station obtains the slave station public key, it encrypts the second receiving time with the slave station public key, obtains the master station reply containing the encrypted second receiving time, and sends the master station reply to each slave station. After each slave station receives the master station reply, it uses its own slave station private key to decrypt the master station reply. Only the slave station whose slave station private key matches the slave station public key can successfully decrypt the master station reply. The slave station that successfully decrypts the master station reply obtains the second receiving time, and the slave station can use the first sending time, the first receiving time, the second sending time, and the second receiving time to calculate the distance between the slave station and the master station. At the same time, after obtaining the first receiving time and the second sending time, the master station can also use the first sending time, the first receiving time, the second sending time, and the second receiving time to calculate the distance between the master station and the slave station.

[0062] Specifically, the interaction time between the master station and the slave station is calculated based on the second receiving time and the first sending time; the data processing time of the slave station is calculated based on the second sending time and the first receiving time; the information propagation time is calculated based on the interaction time and the data processing time; the distance between the master station and the slave station is calculated based on the information propagation time and the information propagation speed.

[0063] In a possible embodiment, the first distance from the master station to the slave station can be calculated based on the first sending time, the first receiving time and the information propagation speed broadcast by the master station, and the second distance from the slave station to the master station can be calculated based on the second sending time, the second receiving time and the information propagation speed replied by the slave station, and the average of the first distance and the second distance is used as the distance between the master station and the slave station.

[0064] The ranging system provided by the embodiment of the present invention can complete the distance between the master station and the slave station through the information interaction process during the information interaction between the master station and the slave station. The slave station that has completed the ranging no longer receives the master station broadcast of the master station, so that the slave station that has completed the ranging does not participate in the subsequent information interaction with the master station, which reduces the amount of information interaction and improves the ranging efficiency of the ranging system. In addition, the encrypted communication of the information interaction process is realized by the master station public key, the master station private key, the slave station public key and the slave station private key, thereby improving the communication security of the ranging system.

[0065] For further information, see Figure 2 , Figure 2 is a flow chart of a distance measurement method provided by an embodiment of the present invention, such as Figure 2 As shown, the ranging method is specifically used for the slave station end of the above-mentioned ranging system, and the ranging method includes the following steps:

[0066] 201. Receive a master station broadcast sent by a master station, and record a first receiving time of receiving the master station broadcast.

[0067] In the embodiment of the present invention, the master station broadcast includes the master station public key and the first sending time of the master station broadcast.

[0068] The master station public key can be an encryption method based on an asymmetric encryption algorithm. The master station private key corresponds to the master station public key. The master station private key can be a decryption method based on an asymmetric encryption algorithm. A master station can set one or more asymmetric encryption algorithms. The master station public key is used to send to the slave station so that the slave station encrypts the information to be transmitted through the master station public key, thereby improving the security of information transmission. The master station private key is used to decrypt the encrypted information to obtain the specific information content. It should be noted that the master station private key is not disclosed to the outside and is only stored in the master station.

[0069] Specifically, when the master station sends the master station broadcast, the first sending time can be added to the master station broadcast for sending. Since the master station broadcast does not need to be encrypted, the first sending time can be directly added to the end of the master station broadcast when the master station sends the master station broadcast.

[0070] In a possible embodiment, during the ranging period, the first sending time of the master station broadcast can be preset, and the preset first sending time and the master station public key can be packaged to obtain the master station broadcast. When the first sending time is reached, the master station broadcast sends the master station broadcast to the slave station.

[0071] After receiving the master station broadcast sent by the master station, the slave station records the first receiving time of the master station broadcast. After parsing the master station broadcast, the slave station obtains the first sending time and records it, and then obtains the first sending time and the first receiving time.

[0072] 202. Send a slave station reply to the master station, and record a second sending time of sending the slave station reply.

[0073] In the embodiment of the present invention, the reply from the slave station includes the slave station public key encrypted by the master station public key.

[0074] Specifically, after obtaining the master station public key, the slave station can encrypt the slave station public key with the master station public key to obtain the slave station reply, send the slave station reply to the master station, and record the second sending time of sending the slave station reply. At this time, the slave station obtains the first sending time, the first receiving time, and the second sending time.

[0075] 203. Receive a master station reply sent by the master station.

[0076] In the embodiment of the present invention, the master station reply includes a second receiving time at which the master station receives the slave station reply encrypted with the slave station public key.

[0077] Specifically, when the master station receives the reply from the slave station, it records the second receiving time when the reply from the slave station is received. At the same time, the master station can decrypt the reply from the slave station by using the master station private key to obtain the slave station public key, and encrypt the second receiving time by using the slave station public key to obtain the master station reply. The master station sends the master station reply to the slave station, so that the slave station can receive the master station reply sent by the master station.

[0078] 204. Decrypt the master station's reply using the slave station's private key to obtain a second receiving time.

[0079] In an embodiment of the present invention, the private key of the slave end is stored in the slave end. Since the reply of the master end is encrypted by the public key of the slave end, when the slave end receives the reply of the master end, the private key of the slave end can be retrieved to decrypt the reply of the master end. When the private key of the slave end does not match the public key of the slave end that encrypted the reply of the master end, it means that the slave end is not the slave end that the master end wants to reply to. The slave end no longer attempts to decrypt the reply of the master end, and the reply of the master end can be discarded, and enters the continuous receiving state to receive the next round of broadcasts from the master end. When the private key of the slave end matches the public key of the slave end that encrypted the reply of the master end, it means that the slave end is the slave end that the master end wants to reply to. The slave end decrypts the master end to obtain the second receiving time.

[0080] Since the reply from the master station is encrypted using the public key from the slave station, only the slave station whose private key matches the slave station public key that encrypted the reply from the master station can decrypt the reply from the master station. In other words, only the slave station whose private key matches the slave station public key that encrypted the reply from the master station can obtain the second reception time, thus ensuring the transmission security of the reply from the slave station.

[0081] 205. Calculate the distance between the master station and the slave station according to the first receiving time, the second receiving time, the first sending time, and the second sending time.

[0082] In the embodiment of the present invention, the first distance between the master station and the slave station can be calculated according to the first receiving time and the first sending time, and the first distance can be used as the distance between the master station and the slave station. The second distance between the master stations can also be calculated according to the second receiving time and the second sending time, and the second distance can be used as the distance between the master station and the slave station.

[0083] Specifically, assuming that the first sending time is t1, the first receiving time is t2, and the information propagation speed broadcast by the master station is c1, the first distance D1 can be expressed as follows:

[0084] ;

[0085] Assuming that the second sending time is t3, the second receiving time is t4, and the information propagation speed of the reply from the station is c2, the second distance D2 can be expressed as follows:

[0086] ;

[0087] Furthermore, the average value of the first distance and the second distance may be used as the distance between the master station and the slave station.

[0088] In an embodiment of the present invention, a master station broadcast sent by the master station is received, and a first receiving time of receiving the master station broadcast is recorded, wherein the master station broadcast includes a master station public key and a first sending time of the master station broadcast; a slave station reply is sent to the master station, and a second sending time of sending the slave station reply is recorded, wherein the slave station reply includes the slave station public key encrypted by the master station public key; a master station reply sent by the master station is received, wherein the master station reply includes a second receiving time when the master station receives the slave station reply encrypted by the slave station public key; the master station reply is decrypted by the slave station private key to obtain the second receiving time, and the master station broadcast is no longer received in the current ranging cycle; and the distance between the master station and the slave station is calculated based on the first receiving time, the second receiving time, the first sending time, and the second sending time. In the process of information exchange between the master station and the slave station, the distance between the master station and the slave station is completed through the information exchange process. The slave station that has completed the distance measurement no longer receives the master station broadcast of the master station, so that the slave station that has completed the distance measurement does not participate in the subsequent information exchange with the master station, which reduces the amount of information exchange and improves the distance measurement efficiency of the distance measurement system. In addition, the encrypted communication of the information exchange process is realized through the master station public key, the master station private key, the slave station public key and the slave station private key, which improves the communication security of the distance measurement system and prevents information from being tampered with.

[0089] Optionally, after the step of receiving the master station broadcast sent by the master station and recording the first receiving time of the master station broadcast, the master station public key can also be obtained from the master station broadcast; the slave station public key is encrypted by the master station public key to obtain a slave station reply.

[0090] In the embodiment of the present invention, the master station broadcast includes the master station public key. After parsing the master station broadcast, the slave station can obtain the corresponding master station public key, encrypt its own slave station public key with the master station public key, and obtain the slave station reply. In this way, the slave station public key can be encrypted and sent to the master station, which improves the transmission security of the slave station public key.

[0091] Optionally, after the step of receiving the master station reply sent by the master station, the master station reply can also be decrypted by the slave station private key corresponding to the current slave station; if the decryption fails, the current slave station is controlled to continue receiving state to receive the next round of master station broadcast sent by the master station; if the decryption is successful, the current slave station is controlled to stop receiving state to stop receiving the next round of master station broadcast sent by the master station.

[0092] In the embodiment of the present invention, after receiving the reply from the master station, each slave station uses its own private key to decrypt the reply from the master station. Only the slave station whose private key matches the public key can successfully decrypt the reply from the master station. The slave station that successfully decrypts the reply from the master station obtains the second receiving time. After receiving the second receiving time, the slave station can enter the stop receiving state and no longer receive the master station broadcast sent by the master station in the current ranging cycle. The slave station that fails to decrypt the reply from the master station continues to receive the next round of master station broadcasts. If the master station does not receive any slave station replies after sending the master station broadcast, the current ranging cycle ends. In this way, the distance between the master station and each slave station can be obtained.

[0093] Optionally, in the step of calculating the distance between the master station and the slave station according to the first receiving moment, the second receiving moment, the first sending moment and the second sending moment, the interaction time between the master station and the slave station can be calculated according to the second receiving moment and the first sending moment; the data processing time of the slave station can be calculated according to the second sending time and the first receiving moment; the information propagation time can be calculated according to the interaction time and the data processing time; and the distance between the master station and the slave station can be calculated according to the information propagation time and the information propagation speed.

[0094] In the embodiment of the present invention, the information propagation speed of the master station broadcast and the slave station reply is the same, and the information propagation speed is c. Then the distance between the master station and the slave station can also be obtained according to the following formula:

[0095] distance = [(t4-t1)-(t3-t2)]*c*0.5

[0096] Wherein, distance is the distance between the master station and the slave station, t4 is the second receiving time, t1 is the first sending time, t3 is the second sending time, and t2 is the first sending time. It can be seen that t4-t1 is the time from the master station sending the master station broadcast to receiving the slave station reply. Since the information propagation speed of the master station broadcast and the slave station reply is the same, t4-t1 can be understood as the time for information (information can be broadcast by the master station or replied by the slave station) to propagate one round trip between the master station and the slave station, that is, one interaction time between the master station and the slave station; t3-t2 is the time from the slave station receiving the master station broadcast to sending the slave station reply. t3-t2 can be understood as the time required for the slave station to respond to the master station broadcast, that is, the data processing time of the slave station. (t4-t1)-(t3-t2) means the time for information to propagate one round trip between the master station and the slave station after deducting the time required for the slave station to respond to the master station broadcast. One round trip is equal to two journeys, and one journey is the distance between the master station and the slave station.

[0097] The information propagation time is obtained by subtracting the data processing time from the interaction time. The round-trip distance of the information can be calculated by the information propagation time and the information propagation speed. Half of the round-trip distance of the information is the distance between the master station and the slave station.

[0098] It should be noted that the distance measurement method provided in the embodiment of the present invention can be applied to devices such as smart phones, computers, and servers.

[0099] For further information, see Figure 3 , Figure 3 is a flow chart of another ranging method provided by an embodiment of the present invention. Figure 3 As shown, the ranging method is specifically used for the master station end of the above-mentioned ranging system, and the ranging method includes the following steps:

[0100] 301. Send a master station broadcast to multiple slave stations, and record the first sending time of the master station broadcast.

[0101] In the embodiment of the present invention, the master station broadcast includes the master station public key.

[0102] The master station public key can be an encryption method based on an asymmetric encryption algorithm. The master station private key corresponds to the master station public key. The master station private key can be a decryption method based on an asymmetric encryption algorithm. A master station can set one or more asymmetric encryption algorithms. The master station public key is used to send to the slave station so that the slave station encrypts the information to be transmitted through the master station public key, thereby improving the security of information transmission. The master station private key is used to decrypt the encrypted information to obtain the specific information content. It should be noted that the master station private key is not disclosed to the outside and is only stored in the master station.

[0103] 302. Receive a slave station reply sent by the slave station, and record a second receiving time when the slave station reply is received.

[0104] In the embodiment of the present invention, the slave terminal reply includes a first receiving time and a second sending time after being encrypted by the master terminal public key. The first receiving time is the time when the slave terminal receives the master terminal broadcast, and the second sending time is the time when the slave terminal sends the slave terminal reply.

[0105] Specifically, the master station broadcast includes the master station public key. After receiving the master station broadcast, the slave station parses the master station broadcast to obtain the master station public key and records the master station public key. After obtaining the master station public key, the slave station records the reception time of the master station broadcast as the first reception time, reads the slave station public key of the slave station, encrypts the slave station public key, the first reception time and the second sending time by the master station public key, obtains the slave station reply including the encrypted slave station public key, the first reception time and the second sending time, and sends the slave station reply to the master station at the second sending time.

[0106] 303. Decrypt the reply from the slave station using the private key of the master station to obtain a first receiving time and a second sending time.

[0107] Specifically, after receiving the first reply from the slave, the master records the reception time of the reply from the slave as the second reception time, and decrypts the reply from the slave using the master private key to obtain the slave public key, the first reception time, and the second sending time. At this point, the master obtains the first sending time, the second sending time, the first reception time, and the second reception time.

[0108] 304. Calculate the distance between the master station and the slave station according to the first receiving time, the second receiving time, the first sending time, and the second sending time.

[0109] In the embodiment of the present invention, the first distance between the master station and the slave station can be calculated according to the first receiving time and the first sending time, and the first distance can be used as the distance between the master station and the slave station. The second distance between the master stations can also be calculated according to the second receiving time and the second sending time, and the second distance can be used as the distance between the master station and the slave station.

[0110] The interaction time between the master station and the slave station can also be calculated based on the second receiving time and the first sending time; the data processing time of the slave station can be calculated based on the second sending time and the first receiving time; the information propagation time can be calculated based on the interaction time and the data processing time; and the distance between the master station and the slave station can be calculated based on the information propagation time and the information propagation speed.

[0111] In the embodiment of the present invention, during the information interaction between the master station and the slave station, the distance between the master station and the slave station is completed through the information interaction process, and the slave station that has completed the ranging no longer receives the master station broadcast of the master station, so that the slave station that has completed the ranging does not participate in the subsequent information interaction with the master station, which reduces the amount of information interaction and improves the ranging efficiency of the ranging system. In addition, the encrypted communication of the information interaction process is realized through the master station public key, the master station private key, the slave station public key and the slave station private key, thereby improving the communication security of the ranging system.

[0112] Optionally, in the step of receiving a slave station reply sent by the slave station and recording the second receiving time when the slave station reply is received, when the first slave station reply is received in the ranging cycle, only the first slave station reply is performed ranging processing until no more slave station reply is received, completing the ranging of all slave stations in the ranging cycle, wherein the slave station that has undergone the ranging processing no longer receives the master station broadcast.

[0113] In an embodiment of the present invention, the master station only processes the first slave station reply received. This is because after the master station receives the first slave station reply, it will occupy a portion of hardware resources, thereby affecting the reception of the second slave station reply, causing a certain deviation, which will affect the slave station ranging accuracy corresponding to the second slave station reply.

[0114] Furthermore, after the master station obtains the slave station public key, it encrypts the stop receiving instruction through the slave station public key to obtain the encrypted master station reply, and sends the master station reply to each slave station. After each slave station receives the master station reply, it uses its own slave station private key to decrypt the master station reply. Only the slave station whose slave station private key matches the slave station public key can successfully decrypt the master station reply. The slave station that successfully decrypts the master station reply obtains the stop receiving instruction, so that the slave station enters the stop receiving state according to the stop receiving instruction and no longer receives the master station broadcast sent by the master station in the current ranging cycle. The slave station that fails to decrypt the master station reply continues to receive the next round of master station broadcasts. If the master station does not receive the slave station reply after sending the master station broadcast, the current ranging cycle ends, so that the distance between the master station and each slave station can be obtained.

[0115] Through the stop receiving instruction in the master station's reply, the slave station that has successfully decrypted the master station's reply stops receiving and no longer receives the master station's broadcast in the current ranging cycle, thereby reducing the number of interactions between the master station and the slave station.

[0116] Optionally, the master station broadcast also includes the first sending time, and the slave station reply also includes the slave station public key encrypted by the master station public key. After receiving the slave station reply sent by the slave station and recording the second receiving time when the slave station reply is received, the second receiving time can also be encrypted by the slave station public key to obtain the master station reply; the master station reply is sent to the slave station, so that the slave station decrypts the master station reply by the slave station private key to obtain the second receiving time, and calculates the distance between the master station and the slave station based on the first receiving time, the second receiving time, the first sending time and the second sending time.

[0117] It should be noted that the distance measurement method provided in the embodiment of the present invention can be applied to devices such as smart phones, computers, and servers.

[0118] Optional, see Figure 4 , Figure 4 is a schematic diagram of the structure of a distance measuring device provided by an embodiment of the present invention, such as Figure 4 As shown, the device comprises:

[0119] The first receiving module 401 is used to receive the master station broadcast sent by the master station, and record the first receiving time of the master station broadcast, wherein the master station broadcast includes the master station public key and the first sending time of the master station broadcast;

[0120] A first sending module 402 is used to send a slave station reply to the master station and record a second sending time of sending the slave station reply, wherein the slave station reply includes the slave station public key encrypted by the master station public key;

[0121] A second receiving module 403 is configured to receive a master station reply sent by the master station, wherein the master station reply includes a second receiving time at which the master station receives the slave station reply encrypted by the slave station public key;

[0122] A first decryption module 404, configured to decrypt the master station reply by using a slave station private key to obtain the second receiving time;

[0123] The first calculation module 405 is used to calculate the distance between the master station and the slave station according to the first receiving time, the second receiving time, the first sending time, and the second sending time.

[0124] Optionally, the device further comprises:

[0125] An acquisition module, used for acquiring the master station public key from the master station broadcast;

[0126] The first encryption module is used to encrypt the slave station public key by using the master station public key to obtain a slave station reply.

[0127] Optionally, the device further comprises:

[0128] A third decryption module, used to decrypt the master station reply by using the slave station private key corresponding to the current slave station;

[0129] A fourth receiving module, configured to control the current slave station to continue receiving state if the decryption fails, so as to receive the master station broadcast sent by the master station in the next round;

[0130] The third sending module is used to control the current slave station to stop receiving state if the decryption is successful, so as to stop receiving the master station broadcast sent by the master station in the next round, so that the slave station no longer receives the master station broadcast in the current ranging cycle.

[0131] Optionally, the first calculation module 405 includes:

[0132] A first calculation submodule, configured to calculate the interaction time between the master station and the slave station according to the second receiving time and the first sending time;

[0133] A second calculation submodule, configured to calculate the data processing time of the slave station according to the second sending time and the first receiving time;

[0134] A third calculation submodule, configured to calculate information propagation time according to the interaction time and the data processing time;

[0135] The fourth calculation submodule is used to calculate the distance between the master station and the slave station according to the information propagation time and the information propagation speed.

[0136] It should be noted that the distance measuring device provided in the embodiment of the present invention can be applied to smart phones, computers, servers and other devices that can perform business analysis at the map level.

[0137] The distance measuring device provided in the embodiment of the present invention can implement each process implemented by the distance measuring method in the above method embodiment, and can achieve the same beneficial effect. To avoid repetition, it will not be described here.

[0138] Optional, see Figure 5 , Figure 5 is a schematic diagram of the structure of another distance measuring device provided by an embodiment of the present invention, such as Figure 5 As shown, the device comprises:

[0139] The second sending module 501 is used to send a master station broadcast to the plurality of slave stations and record a first sending time of sending the master station broadcast, wherein the master station broadcast includes a master station public key;

[0140] A third receiving module 502 is used to receive a slave station reply sent by the slave station, and record a second receiving time when the slave station reply is received, wherein the slave station reply includes a first receiving time and a second sending time after being encrypted by the master station public key, wherein the first receiving time is the time when the slave station receives the master station broadcast, and the second sending time is the time when the slave station sends the slave station reply;

[0141] A second decryption module 503 is used to decrypt the slave station reply by using the master station private key to obtain the first receiving time and the second sending time;

[0142] The second calculation module 504 is used to calculate the distance between the master station and the slave station according to the first receiving time, the second receiving time, the first sending time, and the second sending time.

[0143] Optionally, the third receiving module 502 includes:

[0144] The receiving submodule is used to perform ranging processing on only the first slave station reply when receiving the first slave station reply in the ranging cycle, until no more slave station reply is received, and the ranging of all the slave stations in the ranging cycle is completed, wherein the slave station that has undergone ranging processing no longer receives the master station broadcast.

[0145] Optionally, the master station broadcast further includes the first sending time, the slave station reply further includes the slave station public key encrypted by the master station public key, and after the third receiving module 502, the device further includes:

[0146] A second encryption module, used for encrypting the second receiving time by using the public key of the slave station to obtain a reply from the master station;

[0147] The fourth decryption module is used to send the reply of the master station to the slave station, so that the slave station decrypts the reply of the master station through the slave station private key to obtain a second receiving time, and calculate the distance between the master station and the slave station according to the first receiving time, the second receiving time, the first sending time and the second sending time.

[0148] The distance measuring device provided in the embodiment of the present invention can implement each process implemented by the distance measuring method in the above method embodiment, and can achieve the same beneficial effect. To avoid repetition, it will not be described here.

[0149] An embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the various processes of the ranging method or the application-side ranging method provided in the embodiment of the present invention are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0150] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.

[0151] The above disclosure is only the preferred embodiment of the present invention, which certainly cannot be used to limit the scope of the present invention. Therefore, equivalent changes made according to the claims of the present invention are still within the scope of the present invention.

Claims

1. A distance measurement method, characterized in that: Used in a ranging system, the ranging system comprises a master station and a plurality of slave stations, the master station and the slave stations communicate with each other in encrypted form, and the ranging method comprises the following steps: Receiving a master station broadcast sent by the master station, and recording a first receiving time of the master station broadcast, wherein the master station broadcast includes a master station public key and a first sending time of the master station broadcast; After the step of receiving the master station broadcast sent by the master station and recording the first receiving time of receiving the master station broadcast, the method further includes: Obtaining the master station public key from the master station broadcast; The slave station public key is encrypted by the master station public key to obtain a slave station reply; Sending a slave station reply to the master station, and recording a second sending time of sending the slave station reply, wherein the slave station reply includes the slave station public key encrypted by the master station public key; receiving a master station reply sent by the master station, wherein the master station reply includes a second receiving time at which the master station receives the slave station reply encrypted by the slave station public key; After the step of receiving a master station reply sent by the master station, the method further includes: Decrypting the master station reply using the slave station private key corresponding to the current slave station; If the decryption fails, the current slave station is controlled to continue receiving state to receive the master station broadcast sent by the master station in the next round; If the decryption is successful, the current slave station is controlled to stop receiving state to stop receiving the master station broadcast sent by the master station in the next round, so that the slave station no longer receives the master station broadcast in the current ranging cycle; Decrypting the master station reply by using the slave station private key to obtain the second receiving time, and not receiving the master station broadcast in the current ranging cycle; Calculate the distance between the master station and the slave station according to the first receiving time, the second receiving time, the first sending time, and the second sending time; The step of calculating the distance between the master station and the slave station according to the first receiving time, the second receiving time, the first sending time, and the second sending time comprises: Calculate the interaction time between the master station and the slave station according to the second receiving time and the first sending time; Calculating the data processing time of the slave station according to the second sending time and the first receiving time; Calculating information propagation time according to the interaction time and the data processing time; The distance between the master station and the slave station is calculated according to the information propagation time and the information propagation speed.

2. A distance measurement method, characterized in that: Used in a ranging system, the ranging system comprises a master station and a plurality of slave stations, the master station and the slave stations communicate with each other in encrypted form, and the ranging method comprises the following steps: Sending a master station broadcast to the plurality of slave stations, and recording a first sending time of sending the master station broadcast, wherein the master station broadcast includes a master station public key; Receive a slave reply sent by the slave, and record a second receiving time of receiving the slave reply, wherein the slave reply includes a first receiving time and a second sending time encrypted by the master public key, wherein the first receiving time is the time when the slave receives the master broadcast, and the second sending time is the time when the slave sends the slave reply; Decrypt the slave station reply by using the master station private key to obtain the first receiving time and the second sending time; The distance between the master station and the slave station is calculated according to the first receiving time, the second receiving time, the first sending time, and the second sending time.

3. The distance measurement method according to claim 2, characterized in that: The step of receiving the slave station reply sent by the slave station and recording the second receiving time of receiving the slave station reply comprises: In the ranging cycle, when the first slave station reply is received, only the first slave station reply is processed for ranging until no more slave station reply is received, and the ranging of all the slave stations in the ranging cycle is completed, wherein the slave station that has undergone ranging processing no longer receives the master station broadcast.

4. The distance measurement method according to claim 3, characterized in that: The master station broadcast further includes the first sending time, the slave station reply further includes the slave station public key encrypted by the master station public key, and after the step of receiving the slave station reply sent by the slave station and recording the second receiving time of receiving the slave station reply, the method further includes: Encrypting the second receiving time by using the slave station public key to obtain a master station reply; The master station reply is sent to the slave station, so that the slave station decrypts the master station reply by using the slave station private key to obtain a second receiving time, and calculates the distance between the master station and the slave station based on the first receiving time, the second receiving time, the first sending time and the second sending time.

5. A distance measuring device, characterized in that: The distance measuring device comprises: A first receiving module, configured to receive a master station broadcast sent by a master station, and record a first receiving time of the master station broadcast, wherein the master station broadcast includes a master station public key and a first sending time of the master station broadcast; The first receiving module is also used for: Obtaining the master station public key from the master station broadcast; The slave station public key is encrypted by the master station public key to obtain a slave station reply; A first sending module is used to send a slave station reply to the master station and record a second sending time of sending the slave station reply, wherein the slave station reply includes the slave station public key encrypted by the master station public key; A second receiving module, configured to receive a master station reply sent by the master station, wherein the master station reply includes a second receiving time at which the master station receives the slave station reply encrypted by the slave station public key; The second receiving module is further used for: Decrypting the master station reply using the slave station private key corresponding to the current slave station; If the decryption fails, the current slave station is controlled to continue receiving state to receive the master station broadcast sent by the master station in the next round; If the decryption is successful, the current slave station is controlled to stop receiving state to stop receiving the master station broadcast sent by the master station in the next round, so that the slave station no longer receives the master station broadcast in the current ranging cycle; A first decryption module, configured to decrypt the master station reply by using a slave station private key to obtain the second receiving time; A first calculation module, configured to calculate a distance between the master station and the slave station according to the first receiving time, the second receiving time, the first sending time, and the second sending time; The specific process of the first calculation module is: Calculate the interaction time between the master station and the slave station according to the second receiving time and the first sending time; Calculating the data processing time of the slave station according to the second sending time and the first receiving time; Calculating information propagation time according to the interaction time and the data processing time; The distance between the master station and the slave station is calculated according to the information propagation time and the information propagation speed.

6. A distance measuring device, characterized in that: The distance measuring device comprises: A second sending module is used to send a master station broadcast to multiple slave stations and record a first sending time of sending the master station broadcast, wherein the master station broadcast includes a master station public key; A third receiving module is used to receive a slave station reply sent by the slave station, and record a second receiving time when the slave station reply is received, wherein the slave station reply includes a first receiving time and a second sending time encrypted by the master station public key, wherein the first receiving time is the time when the slave station receives the master station broadcast, and the second sending time is the time when the slave station sends the slave station reply; A second decryption module, configured to decrypt the slave station reply by using the master station private key to obtain the first receiving time and the second sending time; The second calculation module is used to calculate the distance between the master station and the slave station according to the first receiving time, the second receiving time, the first sending time and the second sending time.

7. A distance measurement system, characterized in that: The ranging system comprises a master station and a plurality of slave stations, wherein the master station and the slave stations communicate with each other in an encrypted manner; The slave station is used to implement the steps in the ranging method as claimed in claim 1; The master station is used to implement the steps in the ranging method as claimed in any one of claims 2 to 4.