Method and apparatus for determining communication distance, device, and storage medium

By monitoring the timing of level changes in target devices within Wi-Fi communication equipment, the transmission timing of target frames is determined, solving the problem of timeout retransmission of the ACK Timeout parameter in long-distance scenarios. This achieves high-precision communication distance calculation, is applicable to all CPE devices, and improves data transmission performance.

WO2025223552A1PCT designated stage Publication Date: 2025-10-30RUIJIE NETWORKS CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2025/091248
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2024-04-26
Filing Date
2025-04-25
Publication Date
2025-10-30

AI Technical Summary

Technical Problem

In existing Wi-Fi signal transmission technologies, the ACK Timeout parameter is mainly designed for short-range scenarios, which leads to frequent timeouts and retransmissions of data packets in long-range scenarios. There is a lack of accurate methods for determining communication distance, especially when the chip does not support SDK ranging functions, resulting in large errors in timestamp acquisition and affecting distance accuracy.

Method used

By monitoring the timing of level changes in target devices within the communication equipment, the transmission time of the target frame is determined, and the target time interval is calculated, thereby improving the accuracy of the time interval and thus enhancing the precision of the communication distance. This method is applicable to all CPE devices and does not rely on the chip SDK ranging function.

Benefits of technology

It enables high-precision determination of communication distance in long-distance scenarios, avoids timestamp acquisition errors, is applicable to various communication devices, and improves data transmission performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2025091248_30102025_PF_FP_ABST
    Figure CN2025091248_30102025_PF_FP_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a method and apparatus for determining a communication distance, a device, and a storage medium. The method comprises: in response to acquiring at least two moments of change in the level of a target device in a first communication device, determining a target time interval, the target time interval being used for indicating a time interval between the first communication device sending a first target frame to a second communication device and the first communication device sending a second target frame to the second communication device; and, on the basis of a first preset time interval and the target time interval, determining a communication distance between the first communication device and the second communication device, the first preset time interval being used for indicating a time interval between the first communication device sending the first target frame and the first communication device sending the second target frame when the first communication device is separated from the second communication device by a preset distance.
Need to check novelty before this filing date? Find Prior Art

Description

Methods, apparatus, equipment and storage media for determining communication distance

[0001] Cross-references to related applications

[0002] This application claims priority to Chinese Patent Application No. 202410516333.3, filed on April 26, 2024, with the State Intellectual Property Office of the People's Republic of China, entitled "A method, apparatus and electronic device for determining communication distance", the entire contents of which are incorporated herein by reference. Technical Field

[0003] This application relates to the field of communication technology, and in particular to a method, apparatus, device and storage medium for determining communication distance. Background Technology

[0004] In Wi-Fi (Wireless Fidelity) signal transmission, if an ACK (Acknowledgment) is not received within a specified time period after a data packet is sent, it is considered an ACK Timeout. This frame acknowledgment mechanism is used by the sending end to promptly detect abnormal data packet transmission and perform timeout retransmission. The specified time period for determining the ACK Timeout is determined by the ACK Timeout parameter set at the factory by the Wi-Fi chip in the device. Since the ACK Timeout was originally designed for short-range scenarios (e.g., indoors), it generally requires a relatively short response time (i.e., the aforementioned specified time). Summary of the Invention

[0005] Exemplary embodiments of this application provide a method, apparatus, and electronic device for determining communication distance.

[0006] In a first aspect, embodiments of this application provide a method for determining communication distance, including:

[0007] In response to acquiring at least two changes in the voltage level of a target device in a first communication device, a target time interval is determined, wherein the target time interval is used to indicate the time interval between the first communication device sending a first target frame to a second communication device and sending a second target frame to the second communication device, the at least two changes in the voltage level of the target device are respectively used to indicate the times when the first target frame and the second target frame are sent from the first communication device, and the second target frame is a data frame sent by the first communication device after processing a first target response frame corresponding to the first target frame; and

[0008] Based on a first preset time interval and the target time interval, the communication distance between the first communication device and the second communication device is determined, wherein the first preset time interval is used to indicate the time interval between when the first communication device sends the first target frame and when it sends the second target frame when it is separated from the second communication device by a preset distance.

[0009] Since the target device only goes high when the Wi-Fi frame is sent from the communication device, this embodiment of the application determines the timing of the change in the target device's level to accurately determine the first moment of sending the first target frame and the second moment of sending the second target frame. This improves the accuracy of the target time interval between the first and second moments, thereby effectively improving the accuracy of the communication distance. It avoids the problem of inaccurately determining the communication distance caused by the timestamp indicating the Wi-Fi frame transmission time being inconsistent with the actual transmission time of the Wi-Fi frame due to delay.

[0010] In one embodiment, the first preset time interval includes at least the time required for the second communication device, which is separated from the first communication device by the preset distance, to process the first target frame, send the first target response frame, and for the first communication device to process the first target response frame.

[0011] In one embodiment, the preset distance is set such that the first communication device and the second communication device are in a close-range scenario.

[0012] In one embodiment, the communication distance is determined based on the following formula:

[0013] Where D is the communication distance, Δt is the target time interval, ΔT includes at least the first preset time interval, and C is the electromagnetic wave propagation speed.

[0014] In one embodiment, Δt is the time interval between the moment when the first communication device ends sending the first target frame and the moment when it begins sending the second target frame;

[0015] Then ΔT is the time interval between the moment when the first communication device, which is separated from the second communication device by the preset distance, ends sending the first target frame and the moment when it starts sending the second target frame.

[0016] In one embodiment, Δt is the time interval between the moment when the first communication device starts sending the first target frame and the moment when the second target frame starts sending the second target frame;

[0017] Then ΔT is the time interval between the moment when the first communication device, which is separated from the second communication device by the preset distance, starts sending the first target frame and the moment when the second target frame starts sending the second target frame.

[0018] In one embodiment, Δt is the time interval between the moment when the first communication device starts sending the first target frame and the moment when it stops sending the second target frame;

[0019] Then ΔT is the time interval between the moment when the first communication device, which is separated from the second communication device by the preset distance, starts sending the first target frame and the moment when it stops sending the second target frame.

[0020] In one embodiment, Δt is the time interval between the moment when the first communication device ends sending the first target frame and the moment when it ends sending the second target frame;

[0021] Then ΔT is the time interval between the moment when the first communication device, which is separated from the second communication device by the preset distance, ends sending the first target frame and the moment when it ends sending the second target frame.

[0022] In one embodiment, before determining the target time interval in response to acquiring at least two change moments of the target device level in the first communication device, the method further includes: determining the occurrence moments of at least two target signals as the at least two change moments, wherein each of the at least two target signals is a signal triggered based on the level change of the target device under a preset communication system.

[0023] In one embodiment, the target device is a power amplifier (PA), the target signal is an interrupt signal, and the preset communication mechanism is a general purpose input / output (GPIO).

[0024] In one embodiment, the target device is connected to the processor via a pin, and before determining the occurrence times of the at least two target signals as the at least two change times, the determination of the target time interval in response to acquiring the at least two change times of the target device's level in the first communication device further includes: transmitting the level of the target device to the processor via the pin; and determining the occurrence times of the at least two target signals, wherein each of the at least two target signals is triggered when the level of the target device received by the processor changes.

[0025] In one embodiment, the at least two change times include a first time and a second time. Determining the target time interval in response to acquiring the level of the target device in the first communication device at the at least two change times includes: determining the first time and the second time based on the occurrence times of the at least two target signals, wherein the first time is the time when the first communication device sends the first target frame, and the second time is the time when the first communication device sends the second target frame; and determining the target time interval based on the first time and the second time.

[0026] In one embodiment, before determining the first time point and the second time point based on the occurrence times of the at least two target signals, the method further includes:

[0027] The occurrence time of the at least two target signals is determined based on the change in the level when the at least two target signals are triggered twice consecutively.

[0028] In one embodiment, the at least two target signals include a first target signal and a second target signal, the occurrence times of the at least two target signals include a first occurrence time corresponding to the first target signal and a second occurrence time corresponding to the second target signal, and the change states include a first change state corresponding to the first target signal and a second change state corresponding to the second target signal.

[0029] Determining the occurrence time of the at least two target signals based on the change in the level when the at least two target signals are triggered twice consecutively includes:

[0030] The time of change of the first change state of the first target signal is taken as the first occurrence time, wherein the first change state is one of the first rising edge or the first falling edge of the level; and

[0031] The change time of the second change state of the second target signal is taken as the second occurrence time, wherein the second change state is one of the second rising edge or the second falling edge of the level;

[0032] Wherein, the first rising edge and the first falling edge correspond to the first target frame, and the second rising edge and the second falling edge correspond to the second target frame.

[0033] In one embodiment, the first change state is the first falling edge, and the second change state is the second rising edge.

[0034] In one embodiment, the first moment is the moment when the first communication device ends the transmission of the first target frame, and the second moment is the moment when the first communication device begins the transmission of the second target frame;

[0035] The step of determining the target time interval in response to the moment when the level change of the target device in the first communication device is detected includes:

[0036] The moment when the level drops is determined to be the first moment;

[0037] In response to the first moment, the level shows a first rising edge, and the moment when the first rising edge appears is determined as the second moment;

[0038] The target time interval is determined based on the first candidate interval between the first time point and the second time point.

[0039] In one embodiment, determining the target time interval based on the first time moment and the second time moment includes:

[0040] The time interval between the first time point and the second time point is determined as the first candidate interval; and

[0041] In response to the first candidate interval being greater than or equal to the first preset time interval, the first candidate interval is determined to be the target time interval.

[0042] In one embodiment, after determining the time interval between the first time moment and the second time moment as the first candidate interval, the method further includes: in response to the first candidate interval being less than the first preset time interval, reacquiring at least two change moments of the level of the target device as the first time moment and the second time moment.

[0043] This embodiment can avoid the situation where the error of the first candidate interval is too large due to the delay caused by CPU busyness (i.e., the time when the level of the target device changes is different from the actual determined time of change) by comparing the first candidate interval with the first preset time interval, so as to affect the accuracy of the communication distance.

[0044] In one embodiment, before determining the target time interval in response to at least two changes in the level of the target device in the first communication device, the method further includes:

[0045] Obtain the third rising edge and the third falling edge of the voltage level of the target device corresponding to the first WiFi frame;

[0046] Obtain a first time interval between the change time of the third rising edge and the change time of the third falling edge; and determine the first WiFi frame as the first target frame in response to the first time interval being within a second preset time interval.

[0047] In one embodiment, before determining the target time interval in response to at least two changes in the level of the target device in the first communication device, the method further includes:

[0048] Obtain the fourth rising edge and the fourth falling edge of the level corresponding to the target device in the second WiFi frame;

[0049] Obtain a second time interval between the change time of the fourth rising edge and the change time of the fourth falling edge; and determine the second WiFi frame as the second target frame in response to the second time interval being within the range of a third preset time interval.

[0050] In one embodiment, the first communication device does not transmit other Wi-Fi frames between the transmission time of the first target frame and the transmission time of the second target frame.

[0051] In one embodiment, the first target frame and the second target frame are Wi-Fi frames transmitted under the combined action of a physical carrier sensing mechanism and a virtual carrier sensing mechanism.

[0052] In one embodiment, the first target frame is a control frame or a data frame, and the second target frame is a data frame.

[0053] In one embodiment, determining the time at which the level exhibits a falling edge as the first time includes:

[0054] In response to the rising edge of the level, the moment when the rising edge of the level occurs is determined as the first candidate moment;

[0055] In response to the occurrence of the first falling edge of the level after the first candidate time, the time of the occurrence of the first falling edge after the first candidate time is determined as the second candidate time;

[0056] In response to the interval between the first candidate time and the second candidate time falling within a first numerical range corresponding to a second preset time interval, the second candidate time is determined to be the first time; wherein, the second preset time interval is used to indicate the time required for the first communication device to send the first target frame.

[0057] This embodiment helps to promptly detect situations where the first device sends other Wi-Fi frames that are not the first target frame, thus avoiding the mistaken identification of these other Wi-Fi frames as the first target frame and preventing large errors in the target time interval caused by the communication distance, thereby further improving the accuracy of the communication distance.

[0058] In one embodiment, the response occurs after the first time point, and determining the time of the occurrence of the first rising edge as the second time point includes:

[0059] In response to the first moment, the level shows a first rising edge, and the moment when the first rising edge occurs after the first moment is determined as the third candidate moment;

[0060] In response to the first falling edge of the level after the third candidate time, the time when the first falling edge occurs after the third candidate time is determined as the fourth candidate time;

[0061] In response to the interval between the third candidate time and the fourth candidate time falling within a second numerical range corresponding to a third preset time interval, the third candidate time is determined to be the second time; wherein, the third preset time interval is used to indicate the time required for the first communication device to send the second target frame.

[0062] This embodiment helps to promptly detect situations where the Wi-Fi frame sent by the first transmitting device after sending the first target frame is not the second target frame, thus avoiding the problem of large target time interval errors caused by mistakenly identifying the non-second target frame as the second target frame, thereby further improving the accuracy of communication distance.

[0063] Secondly, embodiments of this application provide an apparatus for determining communication distance, comprising:

[0064] An interval unit is used to determine a target time interval in response to the time of obtaining the change in the level of the target device in the first communication device; wherein, the target time interval is used to indicate the time interval between the first communication device sending a first target frame to the second communication device and sending a second target frame, and the time of the change in the level of the target device is used to indicate the time when the target frame is sent from the first communication device;

[0065] A distance unit is used to determine the communication distance based on a first preset time interval and the target time interval; wherein, the first preset time interval is used to indicate the time interval between the transmission of the first target frame and the transmission of the second target frame by a first communication device located at a preset distance from the second communication device.

[0066] The second target frame is a data frame sent by the first communication device after it has processed the first target response frame corresponding to the first target frame.

[0067] In one embodiment, the first preset time interval includes at least the time required for the second communication device, which is separated from the first communication device by the preset distance, to process the first target frame, send the first target response frame, and for the first communication device to process the first target response frame.

[0068] In one embodiment, the distance unit is specifically used to calculate:

[0069] Where D is the communication distance, Δt is the target time interval, ΔT includes at least the first preset time interval, and C is the electromagnetic wave propagation speed.

[0070] In one embodiment, the interval unit is specifically used to determine the time when the target signal appears as the change time; wherein, the target signal is a signal triggered in real time based on the level change of the target device under a preset communication system.

[0071] In one embodiment, the target device is a power amplifier (PA); the timing of the change in the PA's level is determined based on an interrupt signal of a preset communication system.

[0072] In one embodiment, the interval unit is specifically used to determine a first time and a second time based on a target signal; wherein, the target signal is a signal triggered in real time based on the level change of the target device under a preset communication system, the first time is the time when the first communication device sends the first target frame, and the second time is the time when the first communication device sends the second target frame; the target time interval is determined based on the first time and the second time.

[0073] In one embodiment, the interval unit is specifically used to determine the level change of the target device in response to the target signal; and to determine the first time moment and the second time moment based on the state of the level change when the target signal occurs at least twice consecutively.

[0074] In one embodiment, the first time is the time when the first communication device ends the transmission of the first target frame, and the second time is the time when the first communication device begins the transmission of the second target frame; then the interval unit is further configured to determine the time when the level has a falling edge as the first time; in response to the first time, the level has a first rising edge, and the time when the first rising edge occurs is determined to be the second time; and the target time interval is determined based on a first candidate interval between the first time and the second time.

[0075] In one embodiment, the interval unit is further configured to determine the first candidate interval as the target time interval in response to the first candidate interval being greater than or equal to the first preset time interval.

[0076] In one embodiment, the apparatus further includes an acquisition unit, which is specifically configured to determine to reacquire the first time moment and the second time moment in response to the first candidate interval being less than the first preset time interval.

[0077] In one embodiment, the interval unit is further configured to: determine the time when the rising edge of the level occurs as a first candidate time in response to the rising edge of the level; determine the time when the first falling edge occurs after the first candidate time as a second candidate time in response to the first falling edge of the level occurring after the first candidate time; and determine the second candidate time as the first time in response to the interval between the first candidate time and the second candidate time falling within a first numerical range corresponding to a second preset time interval; wherein the second preset time interval is used to indicate the time required for the first communication device to send the first target frame.

[0078] In one embodiment, the interval unit is further configured to, in response to the occurrence of a first rising edge of the level after the first time moment, determine the time when the first rising edge occurs after the first time moment as a third candidate time moment; in response to the occurrence of a first falling edge of the level after the third candidate time moment, determine the time when the first falling edge occurs after the third candidate time moment as a fourth candidate time moment; and in response to the interval between the third candidate time moment and the fourth candidate time moment belonging to a second numerical range corresponding to a third preset time interval, determine the third candidate time moment as the second time moment; wherein, the third preset time interval is used to indicate the time required for the first communication device to send the second target frame.

[0079] Thirdly, embodiments of this application provide a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor.

[0080] When the processor executes the computer program, it implements the steps of the method described in the first aspect and any possible implementation.

[0081] Fourthly, embodiments of this application provide a computer storage medium on which a computer program is stored.

[0082] When the computer program is executed by a processor, it implements the steps of the method described in the first aspect and any possible implementation.

[0083] Fifthly, embodiments of this application provide a computer program product, including a computer program.

[0084] When the computer program is executed by a processor, it implements the steps of the method described in the first aspect and any possible implementation.

[0085] Other features and advantages of this application will be set forth in the following description and will be apparent in part from the description or may be learned by practicing the application. The purposes and other advantages of this application may be realized and obtained by means of the structures particularly pointed out in the written description, claims, and drawings. It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not intended to limit this disclosure. Attached Figure Description

[0086] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of this application. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.

[0087] Figure 1 is a schematic diagram of the interaction between CPE and AP when using FTM frame ranging;

[0088] Figure 2 is a schematic diagram of message interaction between a first communication device and a second communication device according to an embodiment of this application;

[0089] Figure 3 is a flowchart illustrating a method for determining communication distance according to an embodiment of this application;

[0090] Figure 4A is a schematic diagram of the interaction process between the first communication device and the second communication device when determining the communication distance according to an embodiment of this application;

[0091] Figure 4B is a schematic diagram of the interaction process between a first communication device and a second communication device in a close-range scenario provided by an embodiment of this application;

[0092] Figure 5 is a flowchart illustrating a method for determining a target time interval according to an embodiment of this application;

[0093] Figure 6 is a schematic diagram of a device for determining communication distance provided in an embodiment of this application;

[0094] Figure 7 is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation

[0095] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application. Unless otherwise specified, the embodiments and features in the embodiments of this application can be arbitrarily combined with each other. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than that shown here.

[0096] The terms "first" and "second" in the specification, claims, and accompanying drawings of this application are used to distinguish different objects, not to describe a specific order. Furthermore, the term "comprising" and any variations thereof are intended to cover non-exclusive protection. For example, a process, method, system, product, or device that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or devices. The term "multiple" in this application can mean at least two, for example, two, three, or more, and the embodiments of this application do not impose limitations.

[0097] To facilitate understanding of the technical solutions provided in the embodiments of this application, the design concept of the embodiments of this application will be introduced first below.

[0098] As mentioned earlier, since the transmission time of the data packet or response itself exceeds the response time specified by the aforementioned ACK Timeout parameter, the ACK Timeout parameter used for indoor scenarios or the specified time period of the aforementioned default ACK Timeout is no longer applicable to long-distance scenarios.

[0099] To meet long-distance transmission requirements and improve user experience, the ACK Timeout between the AP (Access Point) and CPE (Customer Premise Equipment) can be reset by measuring the distance between them. This avoids the problem of data packets always timing out and retransmitting in long-distance scenarios due to ACK Timeout parameters that only apply to short-distance scenarios. Currently, the distance is calculated based on RTT (Round Trip Time), using FTM (Fine Timing Measurement) to record time, and combining this with the speed of electromagnetic wave propagation to calculate the distance between the CPE and AP.

[0100] Please refer to Figure 1 for details. In the FTM mechanism, the CPE first records the transmission timestamp T1 and then sends the first ranging frame (i.e., FTM1) to the AP. After receiving FTM1, the AP records the reception time T2. Then, after parsing FTM1, the AP replies with ACK1 to the CPE and records the reply time T3. Next, after receiving the transmitted ACK1, the CPE records the reception timestamp T4. Then, the CPE sends the second ranging frame (i.e., FTM2) containing T1 and T4 to the AP, so that the AP can calculate the distance based on the following formula (1) after receiving FTM2: D=(C×t rtt )÷2=C×[(T4-T1)-(T3-T2)]÷2; (1)

[0101] Where D is the distance between CPE and AP, and C is the electromagnetic wave propagation speed: 299792458m / s.

[0102] However, the above solution relies on the ranging function of the SDK (Software Development Kit) in the Wi-Fi chip, so this solution is actually only applicable to devices with the aforementioned ranging function set in the SDK of some chips.

[0103] For communication devices whose SDKs are not supported by most chips, the timestamp for sending the ranging frame needs to be obtained at the upper software layer. In this case, the upper software layer typically constructs the ranging frame first and obtains the timestamp as the timestamp node for sending the ranging frame. However, since the ranging frame needs to travel from the upper software layer to the lower hardware layer before it can be actually sent, the aforementioned timestamp is not the actual time when the ranging frame is sent. Furthermore, after obtaining the timestamp, environmental interference, such as the device's air interface resources being occupied, can prevent the ranging frame from being sent immediately at the lower layer. Therefore, a significant error occurs between the timestamp obtained by the upper software layer and the actual sending time of the ranging frame, and this error is uncontrollable and irregular. Therefore, there is currently a lack of a universal and accurate method for determining the distance between remote communication devices.

[0104] This application provides a method for determining communication distance, which provides a general high-precision method for determining communication distance, avoiding the problem of inaccurate communication distance determination caused by the lack of corresponding ranging function support in the chip SDK of current Wi-Fi communication devices.

[0105] In this embodiment, by determining the timing of the level change of the target device in the first communication device, the transmission timing of the two target frames (the first target frame and the second target frame) successively transmitted by the first communication device is determined, thereby accurately determining the target time interval and effectively improving the accuracy of the communication distance determined based on the round-trip delay.

[0106] Because the target device maintains a high voltage level during the transmission of Wi-Fi frames from the communication device, and conversely, maintains a low voltage level when no Wi-Fi frames are transmitted, this method uses the change in the target device's voltage level as the time when the first communication device transmits the target frame. By accurately determining the start and end times of transmission for the first and second target frames, the accuracy of the target time interval is effectively improved, thus enhancing the precision of the communication distance. This avoids the latency caused by the time it takes for the Wi-Fi frames used for ranging to travel from the upper software layer to the lower layer after obtaining the timestamp, and the low distance accuracy caused by the Wi-Fi frames not being transmitted in time after reaching the lower layer.

[0107] Furthermore, since this method only requires monitoring changes in the level of the target device, it does not need to rely on the ranging function of the chip's underlying SDK in the first communication device. Therefore, the method provided in this application also has the advantage of being applicable to all CPEs.

[0108] First, it should be noted that when the distance between communication devices is approximately 300 meters, a Wi-Fi frame takes about 1 microsecond to travel through the air. Therefore, the methods provided in some embodiments of this application are applicable when the distance between the first and second communication devices is greater than or equal to 300 meters. When the distance between the first and second communication devices is around 5 kilometers, or even greater than 5 kilometers, the methods provided in some embodiments of this application significantly improve the data transmission performance between the first and second communication devices.

[0109] For ease of understanding, the following examples illustrate the application scenarios to which the technical solutions of the embodiments of this application can be applied.

[0110] In one possible embodiment, the first target frame is an RTS (Request To Send) frame, and the second target frame is a Data frame. Since RTS frames are only sent to avoid collisions with large data packets when the data packets are large, Data frames that meet the RTS frame threshold requirements can be pre-constructed to satisfy the RTS frame transmission requirements.

[0111] When the first communication device sends the Data frame, as shown in Figure 2, it will first send an RTS frame, and then the second communication device will send a first target response frame corresponding to the RTS frame: a CTS (Clear To Send) frame. After receiving and parsing the CTS frame, the first communication device will send the Data frame.

[0112] The RTS frame and the Data frame are Wi-Fi frames sent successively by the first communication device. That is, the first communication device does not send any other Wi-Fi frames between the aforementioned RTS frame and the aforementioned Data frame.

[0113] In one possible embodiment, the first target frame and the second target frame can be two consecutive Data frames sent by the first communication device. For example, in a scenario where multiple data frames are sent consecutively in an increased TXOP (Transmission Opportunity) mechanism.

[0114] It should be noted that Scenario 1 and Scenario 2 described above are for illustrative purposes only and are not intended to limit the scope of this application. In specific implementation, the technical solutions provided by the embodiments of this application can be flexibly applied according to actual needs.

[0115] The technical solution of this application will be described in detail below with reference to the accompanying drawings and specific embodiments. Please refer to Figure 3. This application proposes a method for determining communication distance, so as to provide a high-precision and universal method for determining communication distance that does not depend on SDK ranging function. The method specifically includes steps 301 and 302.

[0116] Step 301: In response to the moment when the level of the target device in the first communication device changes, determine the target time interval.

[0117] The target time interval is used to indicate the time interval between the first target frame sent by the first communication device to the second communication device and the second target frame sent.

[0118] Specifically, the change in the voltage level of the target device is used to indicate the time when the target frame is sent from the first communication device. This target device may include, but is not limited to, a power amplifier (PA) or other components directly connected to the PA.

[0119] The method provided in this application embodiment can be applied to a first communication device, a second communication device, or other devices or chips with computing capabilities.

[0120] Step 302: Determine the communication distance based on the target time interval. Step 302 will be described in detail below.

[0121] In some embodiments, when steps 301 and 302 of the method are applied to communication devices other than the first communication device, the timing of the level change of the target device can be directly obtained through the first communication device.

[0122] In some embodiments, when steps 301 and 302 of the method are applied to a first communication device, the change time can be obtained by, for example, a CPU chip connected to a pin of the target device.

[0123] Taking a CPU chip as an example, once it determines the change time of the target device, it can send / transmit the change time to the second communication device, other communication devices, or the module / device in the first communication device that executes the method provided in this application embodiment, to which the method is applied.

[0124] When the CPU chip determines the timing of a change in the target device's level, it can trigger the target signal through a signal transmitted via a pin connected to the target device. Since this target signal is pre-registered with the CPU, when the target device experiences a level change (i.e., from high to low, or from low to high), the target device's level is transmitted to the CPU via the pin, triggering the pre-registered target signal. If the target signal is used as a GPIO interrupt, a GPIO interrupt is pre-registered in the CPU. When the target device experiences a level change, this change triggers a GPIO hardware interrupt in the CPU, causing the CPU to respond to the interrupt signal in real time as follows: obtain the current timestamp as the time of the change, and determine the level change state of the target device based on the level transmitted via the aforementioned pin. This level change state includes rising and falling edges.

[0125] When the first communication device begins sending a Wi-Fi frame, the voltage level of the target device changes from low to high. During the transmission of this Wi-Fi frame, the high voltage level continuously passes through the target device, meaning the target device's voltage level remains high. When the first communication device finishes transmitting the Wi-Fi frame, the target device's voltage level changes from high to low.

[0126] Therefore, the timing of the change in the target device's voltage level can be determined by the target signal. That is, when the target device's voltage level changes, the target signal appears. When the target signal appears, the current time is obtained as the aforementioned change time.

[0127] In some embodiments, the moment when the target signal appears can be determined as the moment when the voltage level of the target device changes. This target signal is a signal triggered in real time based on the voltage level change of the target device under a preset communication scheme.

[0128] In some embodiments, the target signal may be triggered by a target pin output signal connected to the target device.

[0129] The target signal mentioned above can be an interrupt signal or other types of signals triggered in real time based on a preset communication mechanism. Taking GPIO (General-purpose Input / Output) as an example, the target signal can be a hardware interrupt triggered by GPIO.

[0130] This communication system includes, but is not limited to, GPIO (General-purpose Input / Output), CAN (Control Area Network), IIC (Inter-Integrated Circuit), UART (Universal Asynchronous Receiver / Transmitter), and SPI (Serial Peripheral Interface).

[0131] Corresponding to the aforementioned communication systems, target signals may include, but are not limited to, GPIO (General-purpose Input / Output) interrupt signals, CAN (Control Area Network) interrupt signals, IIC (Inter-Integrated Circuit) interrupt signals, UART (Universal Asynchronous Receiver / Transmitter) interrupt signals, and SPI (Serial Peripheral Interface) interrupt signals.

[0132] Taking the target device as PA and the target signal as a hard interrupt triggered by GPIO as an example: the timing of the PA level change can be determined based on the GPIO interrupt signal.

[0133] Furthermore, the first communication device does not send any other frames after sending the first target frame and before sending the second target frame. The first target frame and the second target frame can be Wi-Fi frames sent under the combined action of a physical carrier sensing mechanism and a virtual carrier sensing mechanism.

[0134] The aforementioned first target frame and second target frame can be Wi-Fi frames of known length, successively sent from the first communication device to the second communication device. Specifically, the first target frame can be a control frame and / or data frame continuously sent from the first communication device to the second communication device. The second target frame can be a data frame sent by the first communication device following the first target frame.

[0135] For example, the first target frame is an RTS frame, and the second target frame is a Data frame that exceeds the threshold requirement of an RTS frame.

[0136] Alternatively, both the first target frame and the second target frame can be Data frames that exceed the RTS frame threshold requirement.

[0137] Alternatively, the first target frame and the second target frame can be data frames of any length.

[0138] Both the first and second communication devices mentioned above can be long-distance communication devices. For example, a network bridge can be such a long-distance communication device.

[0139] Furthermore, the time when the first communication device sends the first target frame to the second communication device is recorded as the first time, and the time when the first communication device sends the second target frame to the second communication device is recorded as the second time.

[0140] The second moment is after the first moment, and the time length between the first moment and the second moment is the target time interval.

[0141] Specifically, the first moment can be the moment when the first communication device begins to send the first target frame to the second communication device.

[0142] Alternatively, the first moment could be the moment when the first communication device finishes sending the first target frame.

[0143] Accordingly, the second moment can be the moment when the first communication device begins to send the second target frame to the second communication device.

[0144] Alternatively, the second moment can also be the moment when the first communication device finishes transmitting the second target frame. The determination of the target time interval includes, but is not limited to, the following examples:

[0145] For example, the first moment could be a second candidate moment when the first communication device ends the transmission of the first target frame. The second moment could be a third candidate moment when the first communication device begins the transmission of the second target frame. Referring to Figure 4A, the target time interval is the interval between the second candidate moment t2 when the first communication device ends the transmission of the first target frame and the third candidate moment t5 when it begins the transmission of the second target frame. In this case, the target time interval is the sum of Δt2, Δt3, Δt4, and Δt5.

[0146] For example, the first moment is the first candidate moment when the first communication device starts sending the first target frame, and the second moment is the third candidate moment when the first communication device starts sending the second target frame. Referring again to Figure 4A, the target time interval can be the interval between the first candidate moment t1 when the first communication device starts sending the first target frame and the third candidate moment t5 when it starts sending the second target frame. Therefore, the aforementioned target time interval can be the sum of Δt1, Δt2, Δt3, Δt4, and Δt5.

[0147] For example, the first moment is the first candidate moment when the first communication device starts sending the first target frame, and the second moment is the fourth candidate moment when the first communication device ends sending the second target frame. Referring again to Figure 4A, the target time interval can be the interval between the first candidate moment t1 when the first communication device ends sending the first target frame and the fourth candidate moment t6 when it ends sending the second target frame. Therefore, the aforementioned target time interval can be the sum of Δt1, Δt2, Δt3, Δt4, Δt5, Δt6.

[0148] For example, the first moment is the second candidate moment when the first communication device ends the transmission of the first target frame, and the second moment is the fourth candidate moment when the first communication device ends the transmission of the second target frame. Referring again to Figure 4A, the target time interval can be the interval between the second candidate moment t2 when the first communication device ends the transmission of the first target frame and the fourth candidate moment t6 when it ends the transmission of the second target frame. Therefore, the aforementioned target time interval can be the sum of Δt2, Δt3, Δt4, Δt5, Δt6.

[0149] Furthermore, when determining the target time interval: firstly, based on the target signal, determine the first and second moments. Then, based on the first and second moments, determine the target time interval.

[0150] The target signal can be a signal triggered in real time based on the level change of the target device under a preset communication system. Taking GPIO interrupt as an example again, the interrupt is triggered in real time based on GPIO, that is, a hardware interrupt is triggered based on GPIO, resulting in the first and second time points.

[0151] Specifically, in response to the occurrence of a GPIO interrupt signal (i.e., the target signal), a change in the voltage level of the target device is determined. Then, the state of this voltage level change is determined. Finally, the first and second time points can be determined based on the state of the voltage level change at least twice consecutively when the target signal occurs. The state of the voltage level change of the target device includes rising edges and falling edges.

[0152] Taking the target device as PA and the CPU in the first device determining the time of change as an example, this paper explains the reasons for obtaining the first and second times based on the aforementioned real-time interrupt triggered by GPIO.

[0153] When the PA level changes, this level is transmitted to the CPU via the target pin connected to the PA, triggering a hardware interrupt in the CPU. This determines the moment the hardware interrupt is triggered as the moment the PA level changes. Therefore, in the first communication device, the CPU determines the moment of the level change based on the target signal triggered by the level signal of the target pin connected to the PA.

[0154] The target pin could be, for example, a GPIO interrupt pin. When the PA level changes, since the PA level is transmitted to the CPU via the GPIO interrupt pin, a GPIO interrupt is triggered on the CPU in real time. The CPU's response to this GPIO interrupt involves the following steps: based on the PA level transmitted by the GPIO pin, determining whether the level change at the time of the GPIO interrupt is a rising edge or a falling edge; and determining the current moment as the corresponding candidate moment. This change state is used to determine whether the candidate moment is the corresponding first or second moment.

[0155] In order to determine the first and second moments, when the level of the target device changes, the change state of the level of the target device can be determined to determine whether the candidate moment when the target device changes is the first or the second moment.

[0156] Specifically, firstly, in response to the occurrence of the interrupt signal, it is determined that the level of the target device has changed.

[0157] Then, the first time point and the second time point are determined based on the state of the level change when the interrupt signal occurs at least twice consecutively.

[0158] Furthermore, after determining the first and second moments, the target time interval can then be determined based on the first and second moments.

[0159] When the first moment is the first candidate moment t1 when the first communication device starts sending the first target frame, it can be determined that the first communication device starts sending the first target frame when the level of the target device changes and the change state is a rising edge. Then, the first candidate moment t1 when the change state is a rising edge is the first moment.

[0160] When the first moment is the second candidate moment t2 when the first communication device ends the transmission of the first target frame, the first moment can be determined when the target device's voltage level changes for the first time after the rising edge, and this first change is a falling edge. The second candidate moment t2 with this falling edge change is then considered the first moment. The following example illustrates how to determine the first moment and the second moment, as well as the target time interval, based on the voltage level changes at least twice when the interrupt signal occurs, using the first moment as the second candidate moment t2 when the transmission of the first target frame ends and the second moment as the third candidate moment t5 when the transmission of the second target frame begins. Please refer to Figure 5.

[0161] Step 501: Determine the moment when the falling edge of the voltage level change occurs as the first moment.

[0162] In some embodiments, after the first communication device determines that the first target frame has been sent, it determines that the level of the target device has changed based on the interrupt signal.

[0163] Then, in response to the change in level state as a falling edge, the moment when the change in level state is a falling edge can be directly determined as the first moment.

[0164] In one embodiment, to avoid mistaking other Wi-Fi frames transmitted by the first communication device for the first target frame, in some embodiments, the duration of the high level can be determined first by the timing of the level change. Then, by determining whether this duration falls within a predetermined time interval, it can be determined whether the first Wi-Fi frame causing the falling edge of the level is the first target frame. If so, the candidate moment when the PA level is at its falling edge is determined as the first moment.

[0165] Based on two consecutive interrupt signals and the corresponding voltage level changes of the target device during those interruptions, it is determined whether the voltage level remained high during the time interval between the two interruptions. This determines whether a transmission of the first Wi-Fi frame occurred between the two interruption signals. Then, by judging whether the length of the first Wi-Fi frame meets the target length, it is determined whether the first Wi-Fi frame is the first target frame. This target length corresponds to a second preset time interval.

[0166] Specifically, after determining that the transmission of the first target frame has begun, the first communication device begins transmitting the first Wi-Fi frame when the voltage level changes to a rising edge (i.e., a rising edge appears). The moment when this rising edge appears is then designated as the first candidate moment. Subsequently, in response to the first candidate moment, the voltage level of the target device changes to a falling edge (i.e., the first falling edge appears). This determines that the transmission of the first Wi-Fi frame has ended. The moment when the first falling edge appears after the first candidate moment is then designated as the second candidate moment. Thus, the duration of the high voltage level, i.e., the time interval between the first and second candidate moments (refer to Δt1 in Figure 4A), can be determined as the duration of transmitting the first Wi-Fi frame.

[0167] Next, in response to the time interval between the first candidate time and the second candidate time falling within the first numerical range corresponding to the second preset time interval, the aforementioned first Wi-Fi frame is determined to be the first target frame. Otherwise, step 301 is re-executed to redetermine the target time interval.

[0168] When the time interval between the first candidate time and the second candidate time (refer to Δt1 in Figure 4A) is within the first numerical range corresponding to the second preset time interval, the first candidate time can be determined as the time when the first target frame is started to be sent, and the second candidate time is the first time when the first target frame is ended to be sent.

[0169] The second preset time interval (refer to △T1 in Figure 4B) is the time required for the first communication device to send the first target frame to the second communication device. The first numerical range is the error-allowed time interval corresponding to the first target frame, set based on the second preset time interval.

[0170] Step 502: In response to the first moment, the level shows the first rising edge, and the moment of the first rising edge after the first moment is determined to be the aforementioned second moment.

[0171] In some embodiments, after the first communication device finishes transmitting the first target frame, i.e., after the first moment, it continues to determine, based on the interrupt signal, that a change in the target device's voltage level has occurred. Then, in response to the first change in the target device's voltage level, and the first change being a rising edge, it can be directly determined that the first communication device will begin transmitting the second target frame after transmitting the first target frame.

[0172] In one embodiment, to avoid the problem of inaccurately determining the communication distance in step 302 due to the actual transmission of a second Wi-Fi frame other than the second target frame after the first communication device sends the first target frame under special circumstances, some embodiments may continue to determine the duration of the high-level signal after the second Wi-Fi frame is started by observing the change in the target device's voltage level. Based on the comparison between this duration and a second numerical range corresponding to a third preset time interval, if the duration falls within the second numerical range, the second Wi-Fi frame can be determined to be the second target frame. Otherwise, step 301 is re-executed to re-acquire the first and second moments, thereby re-determining the target time interval.

[0173] The third preset time interval is a predetermined time required for the first communication device to send the second target frame to the second communication device. The second numerical range is an error-allowed time interval corresponding to the second target frame, set based on the third preset time interval.

[0174] Specifically, in response to the first moment, if the target device's voltage level shows a first rising edge after the first moment, and it is determined that the first communication device has started sending the second Wi-Fi frame, then the moment when the first rising edge appears after the first moment is determined as the third candidate moment.

[0175] Then, in response to the third candidate time, the level changes for the first time, and the state of this first change is a falling edge (i.e., the first falling edge appears at the third candidate time). The time when the first falling edge appears after the third candidate time is determined as the fourth candidate time.

[0176] As can be seen, during the time interval between the third and fourth candidate moments (refer to Δt6 in Figure 4A), the target device maintains a high level. Therefore, the duration of this high level is the length of time required to transmit the second Wi-Fi frame.

[0177] The third preset time interval (refer to △T6 in Figure 4B) is the predetermined time required for the first communication device to send the second target frame to the second communication device. Therefore, in response to the interval between the third candidate time and the fourth candidate time (refer to △t6 in Figure 4A) falling within the second numerical range corresponding to the third preset time interval (refer to △T6 in Figure 4B), the second Wi-Fi frame is determined to be the second target frame, and the third candidate time is the second time at which the transmission of the second target frame begins.

[0178] Step 503: Determine the target time interval based on the first candidate interval between the first time and the second time.

[0179] In some embodiments, the first candidate interval can be directly used as the target time interval.

[0180] In some embodiments, the timing of the target device's voltage level change needs to be confirmed by the CPU. Specifically, the CPU obtains the current timestamp as the change time based on the target signal caused by the voltage level change under a preset communication system. However, in some special scenarios, when the CPU is busy or the target signal has a low priority, the CPU's determination of the change time based on the target signal may be delayed, causing the determined change time to lag behind the actual change time. For example, the CPU might obtain the timestamp later than the GPIO interrupt triggered by the target device's voltage level change.

[0181] Therefore, a large time delay will lead to a significant error in the target time interval. Furthermore, when the precision of the PA level change timing (especially the first and second moments) is at the microsecond level, nanosecond-level errors are inevitable. For example, if the actual level change timing is 56.8 microseconds, but the change timing precision is in microseconds, the determined actual change timing will be 56 microseconds, resulting in a significant error of 0.8 microseconds. To avoid errors caused by time delays similar to those described above, in some embodiments, the relative magnitude relationship between the first candidate interval between the first and second moments and the first preset time interval can be determined. This allows for timely detection of situations where the first candidate interval between the first and second moments is less than the first preset time interval due to the aforementioned significant error, thus preventing high errors in the target time interval caused by errors in the first and second moments. Specifically, in response to the first candidate interval being greater than or equal to the first preset time interval, the first candidate interval is determined as the target time interval.

[0182] Otherwise, in response to the first candidate interval being less than the first preset time interval, it can be determined that a situation similar to the aforementioned large delay has occurred, and the large delay causes the first candidate interval to be less than the actual time interval between the first target frame and the second target frame in the current transmission scenario. Therefore, it can be determined to re-execute step 301 to re-determine the first moment and the second moment, and re-determine the target time interval, so as to promptly identify the first candidate interval with excessive error and avoid the problem of reduced accuracy of the target time interval caused by using it as the target time interval.

[0183] To further improve the accuracy of the target time interval, the aforementioned first target frame and second target frame can be sent multiple times to determine multiple target time intervals, and the target time interval with the highest repetition rate among the multiple target time intervals can be determined as the final target time interval used to determine the communication distance.

[0184] Furthermore, the aforementioned preset time intervals are empirical values ​​obtained from tests conducted on the first and second communication devices in close-range scenarios. In this preset distance scenario (especially the close-range scenario), the first and second communication devices can be adjacent, with a distance of approximately 1 meter between them. Therefore, when the first and second communication devices interact, the transmission time of their respective information (Wi-Fi frames) in the air is close to 0, but not zero. Please refer to Figure 4B, where the air flight time of the first target frame ΔT2≈0, and the air flight time of the response frame ΔT4≈0.

[0185] The following detailed explanation of the determination of each preset time interval is based on the example of the first target frame being an RTS frame: To ensure that the first communication device sends RTS frames and Data frames sequentially, a Data frame (i.e., the second target frame) larger than the RTS frame transmission threshold can be pre-constructed. Thus, in order to send the aforementioned Data frame (i.e., the second target frame), the first communication device will first send the RTS frame. At time T1, the target device level in the first communication device changes from low to high, indicating that the first communication device has started sending the RTS frame (i.e., the first target frame), as shown in Figure 4B. The duration of this high level is the length of time for sending the RTS frame (i.e., the first target frame), and the first moment T2 when the high level changes to low is the moment when the RTS transmission ends. This yields the aforementioned second preset time interval ΔT1.

[0186] Next, after the first communication device receives the response frame, it begins to send a Data frame (i.e., the second target frame). At this time, the level of the target device changes, and when the change is a rising edge, the time interval between the second time T5 and the first time T2 is the first preset time interval.

[0187] Please continue to refer to Figure 4B. The first preset time interval is the total time (△T3+△T5) of the second communication device processing the RTS frame and sending the CTS frame (i.e., the acknowledgment frame) to the first communication device, plus the time (△T5) of the first communication device processing the CTS frame.

[0188] Subsequently, the level of the target device in the first communication device changes again, and the change state is a falling edge, which indicates that the first communication device has ended the transmission of the aforementioned pre-constructed Data frame. The duration of this high level is the third preset time interval △T6.

[0189] The aforementioned high-level duration, namely the second preset time interval △T1 and the third preset time interval △T6, can be determined by the interrupt signal triggered in real time under the aforementioned preset communication system, or by directly determining the level change state of the target device under the preset distance scenario using a logic analyzer, and then determining the change time to obtain the second preset time interval △T1 and the third preset time interval △T6.

[0190] It should be noted that since the second preset time interval △T1 and the third preset time interval △T6 correspond to the lengths of the first target frame and the second target frame, excluding the case where the measurement results are different due to measurement conditions, the aforementioned second preset time interval △T1 and the third preset time interval △T6 are the same as △t1 and △t6 in Figure 4A, respectively.

[0191] Step 302: Determine the communication distance based on the first preset time interval and the target time interval.

[0192] The first preset time interval is used to indicate the time interval between the first communication device, which is separated from the second communication device by a preset distance, sending the first target frame and sending the second target frame.

[0193] The second target frame is the data frame sent by the first communication device after it has processed the first target response frame corresponding to the first target frame.

[0194] For example, when the first target frame is an RTS frame, the first communication device will only send the second target frame after processing the CTS frame if the first target response frame is a CTS frame corresponding to the RTS frame.

[0195] In other words, the response frame sent by the second communication device to the first communication device is a response to the first target frame. For example, the first target frame can be an RTS (Request To Send) frame. In this case, the first target response frame is the CTS (Clear To Send) frame corresponding to the RTS frame, that is, the CTS frame that the second communication device responds to after sending the RTS frame, and the target address is the first communication device's CTS frame.

[0196] For example, the first target frame could be a Data frame. In this case, the first target response frame of the second communication device to the Data frame is an ACK frame used by the second general-purpose device to respond to the aforementioned Data frame whose target address is the first communication device.

[0197] Furthermore, the first preset time interval includes at least the time required for the second communication device to process the first target frame, for the second communication device to send the first target response frame to the first communication device, and for the first communication device to process the received first target response frame. Here, the time for the first communication device to process the first target response frame includes at least the time required to read the target address in the received response frame to determine whether the received response frame is the first target response frame.

[0198] The first preset time interval may also include the time for the second communication device to generate / construct the first target frame based on the first target frame, and the propagation time (i.e., flight time) of the first target frame and the response frame in the air under a preset distance scenario. Figure 4B is an interactive schematic diagram of the first communication device successively sending the first target frame and the second target frame to the second communication device in a close-range scenario according to an embodiment of this application. The meaning of the close-range scenario is that the distance between the first communication device and the second communication device is a preset distance, and the value of the preset distance is small, so that when the first communication device and the second communication device interact, the flight time of their respective target frames in the air is less than 1 microsecond and close to 0. Referring to Figure 4B, the first preset time interval also includes ΔT2 and ΔT4, which are approximately equal to 0.

[0199] Furthermore, the communication distance can be determined by the following formula:

[0200] Where D is the communication distance, Δt is the target time interval, ΔT is the first preset time interval, and C is the electromagnetic wave propagation speed; then C = 299792458 m / s.

[0201] The calculation methods for the aforementioned target time interval Δt and the first preset time interval ΔT actually differ depending on whether the first and second moments are specifically the start or end moments of sending the corresponding target frame. Two cases are provided below:

[0202] In some embodiments, referring to Figures 4A and 4B, when the target time interval is the sum of Δt2, Δt3, Δt4, and Δt5, the communication distance can be determined by the difference between the target time interval and the first preset time interval. Specifically, it can be calculated based on the following formula (2):

[0203] Where (t5-t2) is the target time interval Δt, and (T5-T2) is the first preset time interval ΔT.

[0204] That is, t5 is the second time point and t2 is the first time point; T5 is the time when the first communication device, in the aforementioned close-range scenario, starts sending the second target frame after sending the first target frame; T2 is the time when the first communication device, in the aforementioned close-range scenario, ends sending the second target frame.

[0205] In some embodiments, please continue to refer to Figures 4A and 4B. When the target time interval is the sum of Δt1, Δt2, Δt3, Δt4, and Δt5, the communication distance can be determined based on the difference between the target time interval and the first preset time interval and the second preset time interval. Specifically, it can be calculated based on the following formula (3):

[0206] Where C = 299792458m / s, indicating the propagation speed of electromagnetic waves, (t5-t1) is the target time interval Δt, [(T5-T2)+(T2-T1)] is ΔT, (T5-T2) is the first preset time interval, and (T2-T1) is the second preset time interval.

[0207] Based on the same inventive concept, this application provides an apparatus for determining communication distance, which corresponds to the method for determining communication distance shown in FIG3 above. Specific implementation details of this apparatus can be found in the description of the aforementioned method embodiments; repeated details will not be repeated. Referring to FIG6, the apparatus includes:

[0208] The interval unit 601 is used to determine the target time interval in response to the time when the level of the target device in the first communication device changes.

[0209] The target time interval is used to indicate the time interval between the first communication device sending the first target frame to the second communication device and the sending of the second target frame.

[0210] The change in the voltage level of the target device is used to indicate the time when the target frame is sent from the first communication device.

[0211] The target device is a power amplifier (PA);

[0212] The timing of the PA level change is determined based on the interrupt signal of the preset communication system.

[0213] The interval unit 601 is specifically used for:

[0214] The moment when the target signal appears is defined as the change moment; wherein, the target signal is a signal triggered in real time based on the level change of the target device under a preset communication system.

[0215] The interval unit 601 is specifically used for:

[0216] Based on the target signal, a first time point and a second time point are determined; wherein, the target signal is a signal triggered in real time based on the level change of the target device under a preset communication system, the first time point is the time when the first communication device sends the first target frame, and the second time point is the time when the first communication device sends the second target frame;

[0217] The target time interval is determined based on the first time point and the second time point.

[0218] The interval unit 601 is specifically used for:

[0219] In response to the target signal, it is determined that the level of the target device has changed; based on the state of the level change when the target signal occurs at least twice consecutively, the first time moment and the second time moment are determined.

[0220] The first time is the time when the first communication device ends sending the first target frame, and the second time is the time when the first communication device begins sending the second target frame; then the interval unit 601 is further used for

[0221] The moment when the level drops is determined to be the first moment; in response to the first moment, the level has a first rising edge, and the moment when the first rising edge occurs is determined to be the second moment; the target time interval is determined based on a first candidate interval between the first moment and the second moment.

[0222] The interval unit 601 is also used for:

[0223] In response to the first candidate interval being greater than or equal to the first preset time interval, the first candidate interval is determined to be the target time interval.

[0224] The device further includes an acquisition unit, which is specifically configured to determine to reacquire the first time moment and the second time moment in response to the first candidate interval being less than the first preset time interval.

[0225] The interval unit 601 is also used for:

[0226] In response to the occurrence of a rising edge in the voltage level, the moment when the rising edge occurs is determined as a first candidate moment; in response to the occurrence of a first falling edge in the voltage level after the first candidate moment, the moment when the first falling edge occurs after the first candidate moment is determined as a second candidate moment; in response to the interval between the first candidate moment and the second candidate moment falling within a first numerical range corresponding to a second preset time interval, the second candidate moment is determined as the first moment; wherein, the second preset time interval is used to indicate the time required for the first communication device to send the first target frame.

[0227] The interval unit 601 is also used for:

[0228] In response to the occurrence of a first rising edge of the voltage level after the first moment, the moment when the first rising edge occurs after the first moment is determined as the third candidate moment; in response to the occurrence of a first falling edge of the voltage level after the third candidate moment, the moment when the first falling edge occurs after the third candidate moment is determined as the fourth candidate moment; in response to the interval between the third candidate moment and the fourth candidate moment falling within a second numerical range corresponding to a third preset time interval, the third candidate moment is determined as the second moment; wherein, the third preset time interval is used to indicate the time required for the first communication device to send the second target frame.

[0229] Distance unit 602 is used to determine the communication distance based on a first preset time interval and the target time interval; wherein, the first preset time interval is used to indicate the time interval between the first communication device, which is separated from the second communication device by a preset distance, sending the first target frame and sending the second target frame.

[0230] The second target frame is a data frame sent by the first communication device after it has processed the first target response frame corresponding to the first target frame.

[0231] The first preset time interval includes at least the time required for the second communication device, which is separated from the first communication device by the preset distance, to process the first target frame, reply to the first target response frame, and for the first communication device to process the first target response frame.

[0232] The distance unit is specifically used for calculation:

[0233] Where D is the communication distance, Δt is the target time interval, ΔT includes at least the first preset time interval, and C is the electromagnetic wave propagation speed.

[0234] Referring to Figure 7, based on the same technical concept, this application also provides a computer device. In one embodiment, the computer device, as shown in the figure, may include a memory 701, a communication module 703, and one or more processors 702.

[0235] The memory 701 is used to store computer programs executed by the processor 702. The memory 701 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, and the data storage area may store various operation instruction sets, etc.

[0236] Memory 701 may be volatile memory, such as random-access memory (RAM); memory 701 may also be non-volatile memory, such as read-only memory, flash memory, hard disk drive (HDD), or solid-state drive (SSD); or memory 701 may be any other medium capable of carrying or storing desired program code in the form of instructions or data structures and accessible by a computer, but is not limited thereto. Memory 701 may be a combination of the above-described memories.

[0237] The processor 702 may include one or more central processing units (CPUs) or digital processing units, etc. The processor 702 is used to implement the aforementioned method for determining the communication distance when it invokes a computer program stored in the memory 701.

[0238] The communication module 703 is used to communicate with terminal equipment, site equipment or other network equipment.

[0239] This application embodiment does not limit the specific connection medium between the memory 701, communication module 703, and processor 702. In Figure 7, the memory 701 and processor 702 are connected via a bus 704, which is depicted as a thick line. The connection methods between other components are merely illustrative and not intended to be limiting. The bus 704 can be an address bus, data bus, control bus, etc. For ease of description, only one thick line is used in Figure 7, but this does not imply that there is only one bus or one type of bus.

[0240] The memory 701 stores a computer storage medium containing computer-executable instructions for implementing the method for determining communication distance according to the embodiments of this application. The processor 702 is used to execute the method for determining communication distance described in the above embodiments.

[0241] Based on the same inventive concept, embodiments of this application also provide a computer storage medium storing a computer program. When the computer program instructions are executed on a computer, the computer processor performs the steps of the method for determining communication distance according to various embodiments of this application described above.

[0242] In some possible implementations, various aspects of the method for determining communication distance provided in this application can also be implemented as a program product comprising program code that, when run on a computer device, causes the computer device to perform the steps in the method for determining communication distance according to various exemplary embodiments of this application described above. For example, the computer device may perform the steps of the various embodiments.

[0243] The program product may employ any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples (a non-exhaustive list) of readable storage media include: electrical connections having one or more wires, portable disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0244] The program product of the embodiments of this application may employ a portable compact disc read-only memory (CD-ROM) and include program code, and may run on a computing device. However, the program product of this application is not limited thereto. In this application, the readable storage medium may be any tangible medium that contains or stores a program that may be used by or in conjunction with a command execution system, apparatus, or device.

[0245] A readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, carrying readable program code. This propagated data signal may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable signal medium may also be any readable medium other than a readable storage medium, capable of sending, propagating, or transmitting a program for use by or in conjunction with a command execution system, apparatus, or device.

[0246] The program code contained on the readable medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, RF, etc., or any suitable combination thereof.

[0247] Program code for performing the operations of this application can be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Java and C++, as well as conventional procedural programming languages ​​such as C or similar languages. The program code can execute entirely on the user's computing device, partially on the user's device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).

[0248] It should be noted that although several units or sub-units of the device have been mentioned in the detailed description above, this division is merely exemplary and not mandatory. In fact, according to embodiments of this application, the features and functions of two or more units described above can be embodied in one unit. Conversely, the features and functions of one unit described above can be further divided and embodied by multiple units.

[0249] Furthermore, although the operations of the method of this application are described in a specific order in the accompanying drawings, this does not require or imply that these operations must be performed in that specific order, or that all the operations shown must be performed to achieve the desired result. Additionally or alternatively, certain steps may be omitted, multiple steps may be combined into one step, and / or one step may be broken down into multiple steps.

[0250] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0251] Although preferred embodiments of this application have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of this application.

[0252] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.

Claims

1. A method for determining communication distance, comprising: In response to acquiring at least two changes in the voltage level of a target device in a first communication device, a target time interval is determined, wherein the target time interval is used to indicate the time interval between the first communication device sending a first target frame to a second communication device and sending a second target frame to the second communication device, the at least two changes in the voltage level of the target device are respectively used to indicate the times when the first target frame and the second target frame are sent from the first communication device, and the second target frame is a data frame sent by the first communication device after processing a first target response frame corresponding to the first target frame; and Based on a first preset time interval and the target time interval, the communication distance between the first communication device and the second communication device is determined, wherein the first preset time interval is used to indicate the time interval between when the first communication device sends the first target frame and when it sends the second target frame when it is separated from the second communication device by a preset distance.

2. The method as described in claim 1, wherein, The first preset time interval is greater than or equal to the sum of the time required for the second communication device, which is separated from the first communication device by the preset distance, to process the first target frame, send the first target response frame, and for the first communication device to process the first target response frame.

3. The method as described in claim 1 or 2, wherein, The preset distance is set so that the first communication device and the second communication device are in a close-range scenario.

4. The method as described in any one of claims 1 to 3, wherein, Before determining the target time interval in response to at least two changes in the level of the target device in the first communication device, the method further includes: The occurrence times of at least two target signals are determined as the at least two change times, wherein each of the at least two target signals is a signal triggered by a level change of the target device under a preset communication system.

5. The method of claim 4, wherein, The target device includes a power amplifier (PA), the target signal is an interrupt signal, and the preset communication mechanism is a general purpose input / output (GPIO).

6. The method as described in claim 4 or 5, wherein, The target device is connected to the processor via pins, and Before determining the occurrence times of the at least two target signals as the at least two change times, the step of determining the target time interval in response to acquiring the at least two change times of the level of the target device in the first communication device further includes: The voltage level of the target device is transmitted to the processor via the pin; and The occurrence times of the at least two target signals are determined, wherein each of the at least two target signals is triggered when the level of the target device received by the processor changes.

7. The method as described in any one of claims 4 to 6, wherein, The at least two change moments include a first moment and a second moment. Determining the target time interval in response to acquiring the level of the target device in the first communication device at the at least two change moments includes: Based on the occurrence times of the at least two target signals, the first time and the second time are determined respectively, wherein the first time is the time when the first communication device sends the first target frame, and the second time is the time when the first communication device sends the second target frame; and The target time interval is determined based on the first time point and the second time point.

8. The method of claim 7, wherein, Before determining the first time and the second time based on the occurrence times of the at least two target signals, the method further includes: The occurrence time of the at least two target signals is determined based on the change in the level when the at least two target signals are triggered twice consecutively.

9. The method of claim 8, wherein, The at least two target signals include a first target signal and a second target signal. The occurrence times of the at least two target signals include a first occurrence time corresponding to the first target signal and a second occurrence time corresponding to the second target signal. The change states include a first change state corresponding to the first target signal and a second change state corresponding to the second target signal. Determining the occurrence time of the at least two target signals based on the change in the level when the at least two target signals are triggered twice consecutively includes: The time of change of the first change state of the first target signal is taken as the first occurrence time, wherein the first change state is one of the first rising edge or the first falling edge of the level; and The change time of the second change state of the second target signal is taken as the second occurrence time, wherein the second change state is one of the second rising edge or the second falling edge of the level; Wherein, the first rising edge and the first falling edge correspond to the first target frame, and the second rising edge and the second falling edge correspond to the second target frame.

10. The method of claim 9, wherein, The first change state is the first falling edge, and the second change state is the second rising edge.

11. The method as claimed in any one of claims 6 to 10, wherein, Determining the target time interval based on the first time moment and the second time moment includes: The time interval between the first time point and the second time point is determined as the first candidate interval; and In response to the first candidate interval being greater than or equal to the first preset time interval, the first candidate interval is determined to be the target time interval.

12. The method as claimed in any one of claims 6 to 11, wherein, After determining the time interval between the first time point and the second time point as the first candidate interval, the method further includes: In response to the first candidate interval being less than the first preset time interval, at least two change moments of the level of the target device are reacquired as the first moment and the second moment.

13. The method as claimed in any one of claims 1 to 12, wherein, Before determining the target time interval in response to at least two changes in the level of the target device in the first communication device, the method further includes: Obtain the third rising edge and the third falling edge of the voltage level of the target device corresponding to the first WiFi frame; Obtain the first time interval between the change time of the third rising edge and the change time of the third falling edge; and In response to the first time interval being within the range of the second preset time interval, the first WiFi frame is determined to be the first target frame.

14. The method as claimed in any one of claims 1 to 13, wherein, Before determining the target time interval in response to at least two changes in the level of the target device in the first communication device, the method further includes: Obtain the fourth rising edge and the fourth falling edge of the level corresponding to the target device in the second WiFi frame; Obtain the second time interval between the change time of the fourth rising edge and the change time of the fourth falling edge; and In response to the second time interval being within the range of the third preset time interval, the second WiFi frame is determined to be the second target frame.

15. The method as claimed in any one of claims 1 to 14, wherein, The first communication device does not send other Wi-Fi frames between the time the first target frame is sent and the time the second target frame is sent.

16. The method as claimed in any one of claims 1 to 15, wherein, The first target frame and the second target frame are Wi-Fi frames transmitted under the combined action of the physical carrier sensing mechanism and the virtual carrier sensing mechanism.

17. The method as claimed in any one of claims 1 to 16, wherein, The first target frame is a control frame or a data frame, and the second target frame is a data frame.

18. An apparatus for determining communication distance, comprising: An interval unit is configured to determine a target time interval in response to at least two changes in the voltage level of a target device in a first communication device. The target time interval indicates the time interval between the first communication device sending a first target frame to a second communication device and sending a second target frame to the second communication device. The at least two changes in the voltage level of the target device indicate the times when the first target frame and the second target frame are emitted from the first communication device, respectively. The second target frame is a data frame sent by the first communication device after processing a first target response frame corresponding to the first target frame. A distance unit is used to determine the communication distance between the first communication device and the second communication device based on a first preset time interval and the target time interval, wherein the first preset time interval is used to indicate the time interval between the first communication device sending the first target frame when it is separated from the second communication device by a preset distance and sending the second target frame.

19. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 17.

20. A computer storage medium having a computer program stored thereon, wherein, When executed by a processor, the computer program implements the steps of the method according to any one of claims 1 to 17.

Citation Information

Patent Citations

  • Method of determining distance between first device and second device

    CN115236652A

  • Determining distances

    US20180172812A1

  • Time Measurement-Based Positioning Method, Related Device, and System

    US20190195996A1

  • Distance difference determination method, data frame transmission method, and related product

    WO2022057454A1

  • Measurement method and measurement apparatus

    WO2024077496A1