Ranging method and related apparatus

CN123009907APending Publication Date: 2026-10-30HUAWEI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510551490.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-28
Publication Date
2026-10-30

AI Technical Summary

Technical Problem

但是,目前的测距方案若想要达到较高的测距精度往往则需要很高的功耗,或者若想要达到较低功耗往往则存在测距精度较低的问题,无法达到功耗和测距精度的平衡

Benefits of technology

[0084]应当理解的是,本申请中对技术特征、技术方案、有益效果或类似语言的描述并不是暗示在任意的单个实现方式中可以实现所有的特点和优点。相反,可以理解的是对于特征或有益效果的描述意味着在至少一个实现方式中包括特定的技术特征、技术方案或有益效果。因此,本申请中对于技术特征、技术方案或有益效果的描述并不一定是指相同的实现方式。进而,还可以任何适当的方式组合本申请中所描述的技术特征、技术方案和有益效果。本领域技术人员将会理解,无需特定实现方式的一个或多个特定的技术特征、技术方案或有益效果即可实现本申请。在其他实现方式中,还可在没有体现所有实现方式的特定实现方式中识别出额外的技术特征和有益效果。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123009907A_ABST
    Figure CN123009907A_ABST
Patent Text Reader

Abstract

The application discloses a ranging method and related device, the method comprises the following steps: a first device uses a first ranging method to obtain a first distance between the first device and a second device; when the first distance is greater than or equal to a preset distance, the first device uses the first ranging method of a first ranging frequency to obtain a relative position between the first device and the second device; when the first distance is less than the preset distance, the first device uses the first ranging method of a second ranging frequency to obtain the relative position between the first device and the second device, wherein the first ranging frequency is less than the second ranging frequency. In this way, the ranging frequency can be dynamically adjusted according to the distance, so as to balance the ranging accuracy and the device power consumption, and achieve a better overall effect.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of communication technology, and in particular to a ranging method and related apparatus. Background Technology

[0002] Currently, contactless control technology has received widespread attention. A common scenario is that when a user brings device A near device B, device B can measure the distance between them and execute the corresponding control operation based on the measured distance. This allows the user to control device B without contact or active operation. Contactless control technology can also include vehicle-wide contactless control. For example, device A is a mobile phone or other terminal, and device B is a vehicle. Device A can be equipped with a digital car key. When the user brings the terminal close to the vehicle at a certain distance, the vehicle can automatically unlock; when the user moves away from the vehicle at a certain distance, the vehicle can automatically lock. However, current ranging solutions often require high power consumption to achieve high ranging accuracy, or low ranging accuracy to achieve low power consumption, making it impossible to achieve a balance between power consumption and ranging accuracy. Summary of the Invention

[0003] This application discloses a ranging method and related apparatus that can achieve a ranging process with high ranging accuracy and low power consumption, and the availability of sensorless control based on such a ranging process is high.

[0004] In a first aspect, this application provides a ranging method, the method comprising: a first device using a first ranging method to obtain a first distance between a first device and a second device; when the first distance is greater than or equal to a preset distance, the first device using a first ranging method with a first ranging frequency to obtain a relative position between the first device and the second device; when the first distance is less than the preset distance, the first device using a first ranging method with a second ranging frequency to obtain a relative position between the first device and the second device, wherein the first ranging frequency is less than the second ranging frequency.

[0005] In some examples, the first ranging method is channel sensing (CS) ranging.

[0006] In some examples, when the first device and the second device use the first ranging method to perform ranging, the first device and the second device interact with signals through multiple channels in different frequency bands, and the first device or the second device achieves distance measurement by analyzing the phase difference or carrier phase change of the signal on multiple frequency points and multiple channels.

[0007] In the above method, during the distance measurement process using the first ranging method, if the distance between the first and second devices is large, a smaller first ranging frequency can be used; conversely, if the distance is small, a larger second ranging frequency can be used. Understandably, in scenarios where the distance between the first and second devices is large, the distance will not decrease significantly in a short time, and the real-time requirements for the ranging results are lower. Therefore, a smaller first ranging frequency can meet the needs of scenarios with large distances. In scenarios where the distance between the first and second devices is small, the distance may decrease significantly in a short time, potentially leading to the devices getting very close. In such cases, the real-time requirements for the ranging results are higher, and a larger second ranging frequency can provide higher accuracy, effectively meeting the needs of scenarios with smaller distances. Furthermore, using a smaller first ranging frequency results in lower power consumption for both the first and second devices, while using a larger second ranging frequency results in higher power consumption. Therefore, the above method can dynamically adjust the execution frequency of the ranging process according to the distance between the first device and the second device, so that the ranging accuracy meets the requirements of the real-time scenario and the power consumption is not always high, thereby effectively balancing the device power consumption and ranging accuracy, and achieving a better overall effect.

[0008] In one possible implementation, the first device includes multiple ranging nodes, and any two of these ranging nodes are located at different positions on the first device. The first ranging method described above is a method of ranging through multiple ranging nodes.

[0009] In the above method, the first device can achieve multi-node fusion ranging through multiple ranging nodes in different locations, avoiding the situation where the ranging result is inaccurate due to environmental and other factors when ranging is achieved through a ranging node in a single location, and further improving the ranging accuracy.

[0010] In one possible implementation, the first ranging method includes: the first device obtains multiple relative positions between the multiple ranging nodes and the second device through multiple ranging nodes, and determines the relative position between the first device and the second device based on the multiple relative positions, wherein one of the multiple relative positions is the relative position between the first device and the second device obtained by one of the multiple ranging nodes.

[0011] In the above method, the first device can achieve multi-node fusion ranging through multiple ranging nodes in different locations. Therefore, when the second device approaches the first device from different directions, the first device can achieve fast and accurate ranging through multiple ranging nodes in different locations, which can effectively deal with behaviors such as users walking around the vehicle.

[0012] Furthermore, since the ranging device 200 performs ranging through the master node and multiple slave nodes together, the electronic device 100 can achieve fast and accurate ranging when it approaches the ranging device 200 from different directions, which can effectively cope with behaviors such as users walking around the vehicle.

[0013] In one possible implementation, the aforementioned plurality of ranging nodes include a master node and N slave nodes (e.g., the N slave nodes are located at different positions on the first device), where N is a positive integer greater than 1; the aforementioned first ranging method includes: the first device acquiring the signal strength of the second device through the N slave nodes respectively, obtaining N signal strengths (e.g., Received Signal Strength Indicator (RSSI)), wherein one of the N slave nodes is used to acquire the signal strength of one second device; the first device determining M slave nodes from the N slave nodes based on the N signal strengths, wherein the M signal strengths acquired by the M slave nodes are all greater than the signal strengths acquired by the slave nodes other than the M slave nodes among the N slave nodes, where M is a positive integer less than N; the first device acquiring a first relative position between the master node and the second device through the master node; the first device acquiring a second relative position between the M slave nodes and the second device through the M slave nodes respectively, obtaining M second relative positions, wherein one of the M slave nodes is used to acquire a second relative position between one and the second device; the first device determining the relative position between the first device and the second device based on the first relative position and the M second relative positions.

[0014] In some examples, the above method further includes: the first device establishing a first communication connection with the second device, for example, the first communication connection being used to implement the first ranging method described above; the signal strength of a second device obtained from a node can be the signal strength of the first communication connection obtained from the node.

[0015] In the above method, the first device can determine the M slave nodes whose signal strength from the received signal from the second device ranks in the top M positions from among N slave nodes, and perform multi-node fusion ranging using the master node and these M slave nodes. That is, the first device does not simply use all or some of the slave nodes and the master node to achieve multi-node fusion ranging, but rather uses a small number of slave nodes with stronger signal strength (i.e., more accurate ranging) and the master node to achieve multi-node fusion ranging, thus further improving ranging accuracy and reducing device power consumption. Furthermore, the M slave nodes determined by the first device may be different each time it uses the first ranging method; that is, the first device can dynamically switch slave nodes for ranging. In this way, even if the second device approaches the first device from different directions, the first device can achieve fast and accurate ranging using the real-time determined M slave nodes, effectively handling behaviors such as users circling around vehicles.

[0016] In one possible implementation, the relative position between the first device and the second device obtained by the first device using the first ranging method is the fourth relative position; the method further includes: the first device selects to perform a control operation on the first device according to the fourth relative position. For example, the first device can determine the relative size of the fourth relative position and the relative position value preset by the first device to trigger the execution of the control operation, and then determine whether to perform a control operation on the first device and what type of control operation to perform based on the determination result.

[0017] In some examples, the first device is a vehicle or in-vehicle device, and the control operation performed on the first device according to the fourth relative position includes one or more of the following: unlocking, locking, outputting preset lights, opening the trunk, closing the trunk, adjusting the seat, controlling the air conditioning, playing music, and turning off the music.

[0018] In one possible implementation, the relative position between the first device and the second device obtained by the first device using the first ranging method is the fourth relative position; the method further includes: the first device sending the fourth relative position to the second device, the fourth relative position being used by the second device to select to perform a control operation on the second device.

[0019] In some examples, the second device is a vehicle or in-vehicle device, and the control operation performed on the second device according to the fourth relative position includes one or more of the following: unlocking, locking, outputting preset lights, opening the trunk, closing the trunk, adjusting the seat, controlling the air conditioning, playing music, and turning off the music.

[0020] In the above method, after the first device obtains the fourth relative position between the first device and the second device using a first ranging method with high accuracy and low power consumption, the fourth relative position can be used by the first device to perform control operations or by the second device to perform control operations. This allows the more suitable first device (such as a first device with multiple ranging nodes located at different locations or a first device selected by the user) to perform ranging, and then the device with the need can select to perform control operations based on the ranging results, thus expanding the application scenarios.

[0021] In one possible implementation, the method further includes: before the first device uses the first ranging method to obtain the first distance between the first device and the second device, the first device establishes a first communication connection with the second device, the first communication connection being used to implement the first ranging method.

[0022] In some examples, the first communication connection is a short-range connection. Therefore, the method described above, in which the first device and the second device use the first ranging method for ranging, is implemented in a short-range connection scenario. Understandably, in a short-range connection scenario, the time the first device and the second device spend within and outside a preset distance when they are close together is generally about the same, unlike in a long-range connection scenario where the time the first device and the second device spend within a preset distance is generally much shorter than the time they spend outside a preset distance. Therefore, in a short-range connection scenario, dynamically adjusting the execution frequency of the ranging process based on the distance between the first device and the second device is more in line with expectations in balancing power consumption and ranging accuracy, achieving a ranging process with high ranging accuracy and low power consumption.

[0023] In one possible implementation, after the first device and the second device establish a first communication connection, the method further includes: the first device sending a first request to the second device, the first request being used to request to obtain a first port number of the second device, and then the first device receiving the first port number sent by the second device; the first device performing application layer authentication with the second device based on the second port number of the first device and the first port number of the second device; the first device using a first ranging method to obtain a first distance between the first device and the second device includes: if the application layer authentication is successful, the first device using the first ranging method to obtain the first distance between the first device and the second device; wherein the second port number is preset by the second device (e.g., stored before the first device and the second device establish a first communication connection); or, the method further includes: before the first device and the second device establish a first communication connection, the first device sending a first broadcast data packet to the second device, the first broadcast data packet carrying the second port number, for example, the first broadcast data packet being used to establish a first communication connection.

[0024] In the above method, the second device can pre-configure the second port number of the first device, or the first device can send the second port number to the second device via a first broadcast data packet, without the second device needing to obtain multiple port numbers (including the second port number) of the first device from the first device. In this way, after the first device obtains a specific first port number from the second device, both devices can complete application-layer authentication based on that first port number, and then proceed with the ranging process after successful application-layer authentication. This is unlike the previous method where the second device had to obtain multiple port numbers (including the second port number) of the first device before application-layer authentication and ranging could proceed. Therefore, this significantly accelerates the application-layer authentication process for both devices, thus greatly speeding up the initiation / triggering of the ranging process. This allows for timely ranging, even in situations where the distance between the first and second devices is very close when establishing their first communication connection, necessitating rapid ranging. It avoids the "standing still" experience that sometimes occurs when slow ranging initiation prevents timely control operations based on the ranging results, further improving the user experience.

[0025] In one possible implementation, after the first device and the second device establish a first communication connection, the method further includes: the first device sending a first request to the second device, the first request being used to request to obtain a first port number of the second device, and then the first device receiving the first port number sent by the second device; the first device receiving a second request sent by the second device, the second request being used to request to obtain a second port number of the first device, and then the first device sending the second port number to the second device; the first device performing application layer authentication with the second device based on the second port number of the first device and the first port number of the second device; the first device receiving a third request sent by the second device, the third request being used to request to obtain one or more port numbers of the first device, the one or more port numbers not including the second port number, and then the first device sending one or more port numbers to the second device; wherein the sending of one or more port numbers by the first device to the second device and the completion of application layer authentication with the second device are performed simultaneously, or the sending of one or more port numbers by the first device to the second device is performed after the completion of application layer authentication with the second device; the first device using a first ranging method to obtain a first distance between the first device and the second device includes: if the application layer authentication is successful, the first device using the first ranging method to obtain the first distance between the first device and the second device.

[0026] In the above method, the second device can first obtain a specific second port number from the first device, and then obtain other port numbers from the first device. In this way, after the first device obtains a specific first port number from the second device, and the second device obtains a specific second port number from the first device, the first and second devices can complete application-layer authentication based on the first port number, and then proceed with the ranging process after successful application-layer authentication. The second device obtaining other port numbers from the first device can occur during application-layer authentication or after it is completed. This is not the case where the second device obtains multiple port numbers (including the second port number) from the first device before the first and second devices can perform application-layer authentication and proceed with the ranging process. Therefore, it greatly accelerates the application layer authentication process for both the first and second devices, thereby significantly speeding up the initiation / triggering of the ranging process. This allows the first and second devices to perform ranging in a timely manner, even when they are very close when establishing their first communication connection and thus require rapid ranging. This avoids the "standing still" or other negative user experience caused by slow ranging initiation, which prevents timely control operations from being performed on the first or second device based on the ranging results. This further enhances the user experience.

[0027] In one possible implementation, the method further includes: after the first device and the second device establish a first communication connection, the first device and the second device complete application layer authentication; wherein the first device uses a first ranging method to obtain a first distance between the first device and the second device and the first device and the second device complete application layer authentication are performed simultaneously; or, the first device uses the first ranging method to obtain a first distance between the first device and the second device before the first device and the second device complete application layer authentication.

[0028] In some examples, after the first device and the second device complete application layer authentication, when the first device uses the first ranging method to obtain the relative position between the first device and the second device, if the application layer authentication is successful, the first device continues to use the first ranging method to obtain the relative position between the first device and the second device; if the application layer authentication fails, the first device cancels the use of the first ranging method to obtain the relative position between the first device and the second device.

[0029] In some examples, after the first device and the second device complete application layer authentication, and after the first device uses the first ranging method to obtain the fourth relative position between the first device and the second device (e.g., the first device uses the first ranging method to obtain the first distance between the first device and the second device), if the application layer authentication is successful, the first device selects to perform a control operation on the first device based on the fourth relative position, or sends the fourth relative position to the second device so that the second device selects to perform a control operation on the second device based on the fourth relative position. If the application layer authentication fails, the first device does not select to perform a control operation on the first device based on the fourth relative position, or does not send the fourth relative position to the second device.

[0030] In the above method, after the first device establishes a first communication connection with the second device, it initiates a ranging process between the two devices. Furthermore, after establishing the first communication connection, both devices perform application-layer authentication. Therefore, the order in which the ranging process and application-layer authentication are performed is not limited. This eliminates the need to wait for the port acquisition and application-layer authentication processes before starting the ranging process, significantly accelerating the initiation / triggering of the ranging process. This allows the first and second devices to perform ranging promptly, even when they are very close when establishing the first communication connection, thus avoiding the "standing still" experience that can occur when slow ranging initiation prevents timely control operations based on the ranging results. This further improves the user experience.

[0031] In one possible implementation, the above method further includes: the first device sending a first data packet to the second device, the first data packet carrying the type and value of K ranging information, where K is a positive integer, and the K ranging information are obtained by the first device when using a first ranging method to obtain the relative position between the first device and the second device.

[0032] In some examples, the relative position between the first device and the second device obtained by the first device using the first ranging method is referred to as the fourth relative position. The K ranging information items include one or more of the following: the distance in the fourth relative position (which can be understood as the final ranging distance), the relative orientation in the fourth relative position (which can be understood as the final ranging orientation), the original ranging value obtained by the first device when using the first ranging method to obtain the fourth relative position between the first device and the second device (e.g., original ranging distance, original RSSI), the filtered ranging value obtained after filtering the original ranging value (e.g., obtained after filtering the original ranging distance, obtained after filtering the original RSSI), the relative position value preset by the first device for triggering the execution of control operations, the algorithm feature value obtained by the first device when using the algorithm to obtain the fourth relative position, and the ranging feature value used for dimension measurement.

[0033] In the above method, the first device can send the ranging information obtained during the ranging process to the second device. In this way, as long as the first device and the second device are connected, the first device can record the ranging information through the second device. The first device can send the type and value of the ranging information to the second device, so that the second device can know the specific information of this ranging information normally, effectively dealing with the situation where the first device cannot store the ranging information normally.

[0034] In one possible implementation, the format of the first data packet includes a header and a body. The body of the first data packet includes K Type Length Values ​​(TLVs), each of the K TLVs corresponding to K ranging information. One of the K TLVs includes a Type field, a Length field, and a Value field. The Type field of one of the K TLVs indicates the type of the ranging information corresponding to one of the K ranging information. The Length field of one of the K TLVs indicates the length of the ranging information corresponding to one of the K ranging information. The Length field of one of the K TLVs indicates the value of the ranging information corresponding to one of the K ranging information.

[0035] In one possible implementation, the aforementioned K ranging information points are used by the second device to display a first interface, which indicates the relative position between the first and second devices. This allows the user to intuitively obtain the relative position between the first and second devices through the first interface displayed on the second device, improving the user experience.

[0036] In one possible implementation, the aforementioned K ranging information points are used by the second device to send K ranging information points to the cloud server. In this way, even if the first device cannot store the ranging information normally, the maintenance personnel of the first device can still obtain the ranging information through the cloud server, thereby performing some problem localization and maintenance.

[0037] Secondly, this application provides another ranging method applied to a first device, the first device including a master node and N slave nodes, wherein any two of the N slave nodes and the master node are located differently on the first device, and N is a positive integer greater than 1; the method includes: obtaining the signal strength of the second device through the N slave nodes respectively, obtaining N signal strengths, wherein one of the N slave nodes is used to obtain the signal strength of one second device; determining M slave nodes from the N slave nodes based on the N signal strengths, wherein the M signal strengths obtained by the M slave nodes are all greater than the signal strengths obtained by the slave nodes other than the M slave nodes, and M is a positive integer less than N; obtaining a first relative position between the master node and the second device through the master node; obtaining a second relative position between the M slave nodes and the second device through the M slave nodes respectively, obtaining M second relative positions, wherein one of the M slave nodes is used to obtain a second relative position between one and the second device; and determining a third relative position between the first device and the second device based on the first relative position and the M second relative positions.

[0038] In the above method, the first device can determine the M slave nodes whose signal strength from the second device is ranked in the top M positions from among N slave nodes, and perform multi-node fusion ranging using the master node and these M slave nodes. That is, the first device does not simply use all or some of the slave nodes and the master node to achieve multi-node fusion ranging, but rather uses a small number of slave nodes with strong signal strength (i.e., more accurate ranging) and the master node to achieve multi-node fusion ranging, thus ensuring high ranging accuracy and low power consumption. Furthermore, the M slave nodes determined by the first device may be different each time ranging is performed; that is, the first device can dynamically switch slave nodes for ranging. In this way, even if the second device approaches the first device from different directions, the first device can achieve fast and accurate ranging using the real-time determined M slave nodes, effectively handling behaviors such as users circling around vehicles.

[0039] In one possible implementation, the method further includes: establishing a first communication connection between the first device and the second device; the signal strength of the second device obtained by a slave node can be the signal strength of the first communication connection obtained by that slave node. In this way, the N slave nodes of the first device can obtain the signal strength of the second device independently, without the second device actively sending signals to each of the N slave nodes of the first device, significantly reducing transmission resources and device power consumption.

[0040] In one possible implementation, after determining the third relative position between the first device and the second device based on the first relative position and M second relative positions, the method further includes: when the distance in the third relative position is greater than or equal to a preset distance, the first device determines to use a first ranging frequency to obtain the relative position between the first device and the second device; when the distance in the third relative position is less than the preset distance, the first device determines to use a second ranging frequency to obtain the relative position between the first device and the second device, wherein the first ranging frequency is less than the second ranging frequency.

[0041] In the above method, the execution frequency of the ranging process (i.e., the ranging frequency) can be dynamically adjusted according to the distance between the first device and the second device. When the distance is far, the ranging frequency is low, so the ranging accuracy is low and the device power consumption is low. When the distance is close, the ranging frequency is high, so the ranging accuracy is high and the device power consumption is high. This ensures that the ranging accuracy meets the requirements of the real-time scenario, and the power consumption is not always high. This further balances the device power consumption and ranging accuracy, achieving a better overall effect.

[0042] In one possible implementation, after establishing the first communication connection with the second device, the method further includes: the first device sending a first request to the second device, the first request being used to request the acquisition of the first port number of the second device, and then the first device receiving the first port number sent by the second device; the first device performing application layer authentication with the second device based on the second port number of the first device and the first port number of the second device; the above-mentioned acquisition of the signal strength of the second device through N slave nodes respectively includes: if the above-mentioned application layer authentication is successful, the first device acquiring the signal strength of the second device through N slave nodes respectively; wherein, the second port number is preset by the second device; or, the method further includes: before establishing the first communication connection with the second device, the first device sending a first broadcast data packet to the second device, the first broadcast data packet carrying the second port number, for example, the first broadcast data packet being used to establish the first communication connection.

[0043] In the above method, the second device can obtain the second port number of the first device in advance. Thus, after the first device obtains a specific first port number from the second device, both devices can complete application-layer authentication based on that first port number, and then proceed with the ranging process after successful application-layer authentication. This is unlike the previous method where the second device obtains multiple port numbers (including the second port number) from the first device before they can perform application-layer authentication and ranging. Therefore, this significantly accelerates the application-layer authentication process for both devices, greatly speeding up the initiation / triggering of the ranging process. This allows for timely ranging, even in situations where the first and second devices are very close when establishing their initial communication connection and require rapid ranging. It avoids the "standing still" experience that can result from slow ranging initiation, which can lead to delays in control operations based on the ranging results, further improving the user experience.

[0044] In one possible implementation, after establishing a first communication connection with the second device, the method further includes: the first device sending a first request to the second device, the first request being for requesting to obtain a first port number of the second device, and then the first device receiving the first port number sent by the second device; the first device receiving a second request sent by the second device, the second request being for requesting to obtain a second port number of the first device, and then the first device sending the second port number to the second device; the first device performing application layer authentication with the second device based on the second port number of the first device and the first port number of the second device; the first device receiving a third request sent by the second device, the third request being for requesting to obtain one or more port numbers of the first device, the one or more port numbers not including the second port number, and then the first device sending one or more port numbers to the second device; wherein, the sending of one or more port numbers by the first device to the second device and the completion of application layer authentication with the second device are performed simultaneously, or the sending of one or more port numbers by the first device to the second device is performed after the completion of application layer authentication with the second device; the acquisition of the signal strength of the second device through N slave nodes includes: if the application layer authentication is successful, the first device acquiring the signal strength of the second device through N slave nodes.

[0045] In the above method, after the first device obtains a specific first port number from the second device, and the second device obtains a specific second port number from the first device, the first and second devices can complete application-layer authentication based on the first port number. After successful application-layer authentication, the ranging process can begin. The second device can obtain other port numbers from the first device during application-layer authentication or after the application-layer authentication is complete. Instead of requiring the second device to obtain multiple port numbers (including the second port number) from the first device before application-layer authentication and ranging can begin, this method significantly accelerates the application-layer authentication process, thus greatly speeding up the initiation / triggering of the ranging process. This allows the first and second devices to perform ranging promptly, even in situations where the distance between them is very close when establishing the initial communication connection, thus requiring rapid ranging. This avoids the "standing still" experience experienced by users when slow ranging initiation prevents timely control operations based on the ranging results, further improving the user experience.

[0046] In one possible implementation, the method further includes: after establishing a first communication connection with the second device, the first device and the second device complete application layer authentication; wherein the acquisition of the signal strength of the second device through N slave nodes is performed simultaneously with the completion of application layer authentication by the first device and the second device; or, the acquisition of the signal strength of the second device through N slave nodes is performed before the completion of application layer authentication by the first device and the second device.

[0047] In the above method, the order in which the first and second devices perform ranging and application layer authentication is not limited. This eliminates the need to wait for the port acquisition and application layer authentication processes to be completed before starting the ranging process, greatly speeding up the initiation / triggering of the ranging process. This allows the first and second devices to perform ranging in a timely manner. It is also well applicable even when the first and second devices are very close when establishing the first communication connection and therefore need to perform ranging quickly. This avoids the user's "standing still" experience caused by slow ranging initiation, which may prevent timely control operations on the first or second device based on the ranging results. This further improves the user experience.

[0048] In one possible implementation, the method further includes: the first device sending a first data packet to the second device, the first data packet carrying the type and value of K ranging information, where K is a positive integer, and the K ranging information is obtained by the first device when acquiring the third relative position between the first device and the second device.

[0049] In one possible implementation, the method further includes: the first device selecting to perform a control operation on the first device based on a third relative position; or, the first device sending a third relative position to the second device, the third relative position being used by the second device to select to perform a control operation on the second device.

[0050] Thirdly, this application provides another ranging method, including: a second device establishing a first communication connection with a first device; the second device completing application layer authentication with the first device based on a first port number of the second device and a second port number of the first device; wherein the second port number is obtained before the second device establishes the first communication connection with the first device; and when the application layer authentication is successful, the second device and the first device perform a ranging process, which is used to determine the relative position between the first device and the second device.

[0051] In some examples, after the second device establishes a first communication connection with the first device, and before the first device completes application layer authentication based on the second device's first port number and the first device's second port number, the method further includes: the second device receiving a first request sent by the first device, the first request being used to request to obtain the second device's first port number, and then the second device sending the first port number to the first device.

[0052] In the above method, the second device can obtain the second port number of the first device in advance. Thus, after the first device obtains a specific first port number from the second device, both devices can complete application-layer authentication based on that first port number, and then proceed with the ranging process after successful application-layer authentication. This is unlike the previous method where the second device obtains multiple port numbers (including the second port number) from the first device before they can perform application-layer authentication and ranging. Therefore, this significantly accelerates the application-layer authentication process for both devices, greatly speeding up the initiation / triggering of the ranging process. This allows for timely ranging, even in situations where the distance between the first and second devices is very close when establishing their initial communication connection, thus avoiding the "standing still" experience that can occur when slow ranging initiation prevents timely control operations based on the ranging results. This improves the user experience.

[0053] In one possible implementation, the second port number is preset by the second device before the second device establishes the first communication connection with the first device. In another possible implementation, the method further includes: before the second device establishes the first communication connection with the first device, the second device receives a first broadcast data packet sent by the first device, the first broadcast data packet carrying the second port number.

[0054] In the above methods, there are various ways for the second device to obtain the second port number in advance, and the application scenarios are more extensive.

[0055] In one possible implementation, the first device includes a master node and N slave nodes, where any two nodes among the master node and the N slave nodes are in different positions on the first device, and N is a positive integer greater than 1. The ranging process between the second device and the first device includes: the second device and the master node of the first device measuring distance to obtain a first relative position between the master node and the second device; the second device and M slave nodes of the first device measuring distance to obtain M second relative positions between the M slave nodes and the second device; wherein M is a positive integer less than N, the first relative position and the M second relative positions are used by the first device to determine a third relative position between the first device and the second device, and the M slave nodes are determined by the first device from the N slave nodes based on N signal strengths (e.g., Received Signal Strength Indication (RSSI)). The N signal strengths are the signal strengths of the second device obtained by the N slave nodes, and the M signal strengths obtained by the M slave nodes are all greater than the signal strengths obtained by the slave nodes other than the M slave nodes.

[0056] In the above method, the distance measurement between the first and second devices can be achieved through multi-node fusion ranging using the master node and M slave nodes of the first device. The M slave nodes are the slave nodes with the highest signal strength among the N slave nodes. In other words, the ranging process is not simply implemented using all or some of the slave nodes and the master node, but rather using a small number of slave nodes and the master node with stronger signal strength, i.e., more accurate ranging, ensuring high ranging accuracy and low device power consumption. Furthermore, the M slave nodes determined in each ranging process may be different, meaning the slave nodes can be dynamically switched for ranging. Thus, even if the second device approaches the first device from different directions, the first device can achieve fast and accurate ranging using the real-time determined M slave nodes, effectively handling situations such as users circling around vehicles.

[0057] In one possible implementation, the ranging process between the second device and the first device includes: when the distance between the first device and the second device is greater than or equal to a preset distance, the second device and the first device use a first ranging frequency to perform the ranging process; when the distance between the first device and the second device is less than the preset distance, the second device and the first device use a second ranging frequency to perform the ranging process, wherein the first ranging frequency is less than the second ranging frequency.

[0058] In the above method, the execution frequency of the ranging process (i.e., the ranging frequency) can be dynamically adjusted according to the distance between the first device and the second device. When the distance is far, the ranging frequency is low, so the ranging accuracy is low and the device power consumption is low. When the distance is close, the ranging frequency is high, so the ranging accuracy is high and the device power consumption is high. This ensures that the ranging accuracy meets the requirements of the real-time scenario, and the power consumption is not always high, thereby balancing the device power consumption and ranging accuracy and achieving a better overall effect.

[0059] In one possible implementation, after the ranging process between the second device and the first device, the method further includes: the second device receiving a first data packet sent by the first device, the first data packet carrying the type and value of K ranging information, where K is a positive integer, and the K ranging information are obtained by the ranging process between the second device and the first device.

[0060] In one possible implementation, after the ranging process between the second device and the first device, the method further includes: the second device receiving the relative position obtained by the ranging process from the first device, and selecting to perform a control operation on the second device based on the relative position.

[0061] Fourthly, this application provides yet another ranging method, comprising: a second device establishing a first communication connection; the second device receiving a first request sent by the first device, the first request being for requesting to obtain a first port number of the second device, and then the second device sending the first port number to the first device; the second device sending a second request to the first device, the second request being for requesting to obtain a second port number of the first device, and then the second device receiving the second port number sent by the first device; the second device performing application layer authentication with the first device based on the second port number of the first device and the first port number of the second device; the second device sending a third request to the first device, the third request being for requesting to obtain one or more port numbers of the first device, the one or more port numbers not including the second port number, and then the second device receiving the one or more port numbers sent by the first device; and, if the above application layer authentication is successful, the second device and the first device performing a ranging process, the ranging process being used to determine the relative position between the first device and the second device.

[0062] In the above method, the second device can first obtain a specific second port number from the first device, and then obtain other port numbers from the first device. After the first device obtains a specific first port number from the second device, and the second device obtains a specific second port number from the first device, the first and second devices can complete application-layer authentication based on the first port number. The ranging process can then proceed after successful application-layer authentication. The second device can obtain other port numbers from the first device during application-layer authentication or after application-layer authentication is complete. This significantly speeds up the application-layer authentication process, greatly accelerating the initiation / triggering of the ranging process. This allows the first and second devices to perform ranging promptly, even when they are very close when establishing their initial communication connection and require rapid ranging. It avoids the "standing still" experience experienced by users when slow ranging initiation prevents timely control operations based on the ranging results, thus improving the user experience.

[0063] In one possible implementation, the first device includes a master node and N slave nodes, where any two nodes among the master node and the N slave nodes are in different positions on the first device, and N is a positive integer greater than 1. The ranging process between the second device and the first device includes: the second device and the master node of the first device measuring distance to obtain a first relative position between the master node and the second device; the second device and M slave nodes of the first device measuring distance to obtain M second relative positions between the M slave nodes and the second device; wherein M is a positive integer less than N, the first relative position and the M second relative positions are used by the first device to determine a third relative position between the first device and the second device, and the M slave nodes are determined by the first device from the N slave nodes based on N signal strengths (e.g., Received Signal Strength Indication (RSSI)). The N signal strengths are the signal strengths of the second device obtained by the N slave nodes, and the M signal strengths obtained by the M slave nodes are all greater than the signal strengths obtained by the slave nodes other than the M slave nodes.

[0064] In the above method, the distance measurement between the first and second devices can be achieved through multi-node fusion ranging using the master node and M slave nodes of the first device. The M slave nodes are the slave nodes with the highest signal strength among the N slave nodes. In other words, the ranging process is not simply implemented using all or some of the slave nodes and the master node, but rather using a small number of slave nodes and the master node with stronger signal strength, i.e., more accurate ranging, ensuring high ranging accuracy and low device power consumption. Furthermore, the M slave nodes determined in each ranging process may be different, meaning the slave nodes can be dynamically switched for ranging. Thus, even if the second device approaches the first device from different directions, the first device can achieve fast and accurate ranging using the real-time determined M slave nodes, effectively handling situations such as users circling around vehicles.

[0065] In one possible implementation, the ranging process between the second device and the first device includes: when the distance between the first device and the second device is greater than or equal to a preset distance, the second device and the first device use a first ranging frequency to perform the ranging process; when the distance between the first device and the second device is less than the preset distance, the second device and the first device use a second ranging frequency to perform the ranging process, wherein the first ranging frequency is less than the second ranging frequency.

[0066] In the above method, the execution frequency of the ranging process (i.e., the ranging frequency) can be dynamically adjusted according to the distance between the first device and the second device. When the distance is far, the ranging frequency is low, so the ranging accuracy is low and the device power consumption is low. When the distance is close, the ranging frequency is high, so the ranging accuracy is high and the device power consumption is high. This ensures that the ranging accuracy meets the requirements of the real-time scenario, and the power consumption is not always high, thereby balancing the device power consumption and ranging accuracy and achieving a better overall effect.

[0067] In one possible implementation, after the ranging process between the second device and the first device, the method further includes: the second device receiving a first data packet sent by the first device, the first data packet carrying the type and value of K ranging information, where K is a positive integer, and the K ranging information are obtained by the ranging process between the second device and the first device.

[0068] In one possible implementation, after the ranging process between the second device and the first device, the method further includes: the second device receiving the relative position obtained by the ranging process from the first device, and selecting to perform a control operation on the second device based on the relative position.

[0069] Fifthly, this application provides yet another ranging method, comprising: establishing a first communication connection between a first device and a second device; performing a ranging process between the first device and the second device, wherein the first device and the second device complete application layer authentication, and the ranging process is used to determine the relative position between the first device and the second device; wherein the ranging process performed by the first device and the second device and the application layer authentication performed by the first device and the second device are executed simultaneously; or, the ranging process performed by the first device and the second device is executed before the application layer authentication is completed by the first device and the second device.

[0070] In some examples, after the first device and the second device complete the application layer authentication, when the first device and the second device perform the ranging process, if the application layer authentication is successful, the first device continues to perform the ranging process with the second device; if the application layer authentication fails, the first device cancels the ranging process with the second device.

[0071] In some examples, after the first and second devices complete application layer authentication and after the first and second devices perform the ranging process, if the application layer authentication is successful, the first device selects to perform a control operation on itself based on the relative position obtained from the ranging process, or sends the relative position to the second device so that the second device performs a control operation on itself based on the relative position. If the application layer authentication fails, the first device does not select to perform a control operation on itself based on the relative position obtained from the ranging process, or does not send the relative position to the second device.

[0072] In the above method, after the first device establishes a first communication connection with the second device, it initiates a ranging process between the two devices. Furthermore, after establishing the first communication connection, both devices perform application-layer authentication. Therefore, the order in which the first and second devices perform the ranging process and the application-layer authentication is not limited. This eliminates the need to wait for the port acquisition and application-layer authentication processes before starting the ranging process, significantly accelerating the initiation / triggering of the ranging process. This allows the first and second devices to perform ranging promptly, even when they are very close when establishing the first communication connection, thus avoiding the "standing still" experience that can occur when slow ranging initiation prevents timely control operations based on the ranging results. This improves the user experience.

[0073] In one possible implementation, the first device includes a master node and N slave nodes, where any two nodes among the master node and the N slave nodes are in different positions on the first device, and N is a positive integer greater than 1. The ranging process between the first device and the second device includes: the first device acquiring the signal strength of the second device through the N slave nodes to obtain N signal strengths (e.g., Received Signal Strength Indication (RSSI)), wherein one of the N slave nodes is used to acquire the signal strength of one second device; the first device determining M slave nodes from the N slave nodes based on the N signal strengths, wherein the M signal strengths acquired by the M slave nodes are all greater than the signal strengths acquired by the slave nodes other than the M slave nodes, and M is a positive integer less than N; the first device acquiring a first relative position between the master node and the second device through the master node; the first device acquiring a second relative position between the M slave nodes and the second device through the M slave nodes to obtain M second relative positions, wherein one of the M slave nodes is used to acquire a second relative position between one and the second device; and the first device determining a third relative position between the first device and the second device based on the first relative position and the M second relative positions.

[0074] In the above method, the first device can determine the M slave nodes whose signal strength from the received signal from the second device ranks in the top M positions from among N slave nodes, and perform multi-node fusion ranging using the master node and these M slave nodes. That is, the first device does not simply use all or some of the slave nodes and the master node to achieve multi-node fusion ranging, but rather uses a small number of slave nodes with stronger signal strength (i.e., more accurate ranging) and the master node to achieve multi-node fusion ranging, thus further improving ranging accuracy and reducing device power consumption. Furthermore, the M slave nodes determined by the first device may be different each time it uses the first ranging method; that is, the first device can dynamically switch slave nodes for ranging. In this way, even if the second device approaches the first device from different directions, the first device can achieve fast and accurate ranging using the real-time determined M slave nodes, effectively handling behaviors such as users circling around vehicles.

[0075] In one possible implementation, the ranging process between the first device and the second device includes: the first device using a first ranging method to obtain a first distance between the first device and the second device; when the first distance is greater than or equal to a preset distance, the first device using a first ranging frequency to obtain the relative position between the first device and the second device; when the first distance is less than the preset distance, the first device using a first ranging frequency to obtain the relative position between the first device and the second device, wherein the first ranging frequency is less than the second ranging frequency. For example, the first ranging method is Channel Sensing (CS) ranging.

[0076] In the above method, the execution frequency of the ranging process (i.e., the ranging frequency) can be dynamically adjusted according to the distance between the first device and the second device. When the distance is far, the ranging frequency is low, so the ranging accuracy is low and the device power consumption is low. When the distance is close, the ranging frequency is high, so the ranging accuracy is high and the device power consumption is high. This ensures that the ranging accuracy meets the requirements of the real-time scenario, and the power consumption is not always high. This further balances the device power consumption and ranging accuracy, achieving a better overall effect.

[0077] In one possible implementation, after the first device and the second device perform the ranging process, the method further includes: the first device sending a first data packet to the second device, the first data packet carrying the type and value of K ranging information, where K is a positive integer, and the K ranging information are obtained when the first device and the second device perform the ranging process.

[0078] In one possible implementation, after the ranging process of the first device and the second device, the method further includes: the first device performing a control operation on the first device based on the relative position obtained by the ranging process; or, the first device sending the relative position obtained by the ranging process to the second device, the relative position being used by the second device to select to perform a control operation on the second device.

[0079] In a sixth aspect, this application provides an electronic device, including a transceiver, a processor, and a memory; the memory is used to store a computer program, and the processor calls the computer program to execute the ranging method provided by the first to fifth aspects and any implementation thereof.

[0080] In a seventh aspect, this application provides a computer storage medium including a computer program, which, when executed by a processor, is used to implement the first to fifth aspects and the ranging method provided by any of the implementations of the first to fifth aspects.

[0081] Eighthly, this application provides a computer program product, including a computer program that, when run on a processor, implements the first to fifth aspects and the ranging method provided by any of the implementations of the first to fifth aspects.

[0082] Ninthly, this application provides a chip system including a processing circuit and an interface circuit. The interface circuit is used to receive code instructions and transmit them to the processing circuit. The processing circuit is used to execute the code instructions to perform the ranging method provided by the first to fifth aspects and any implementation of the first to fifth aspects.

[0083] In a tenth aspect, this application provides an electronic device that includes methods or apparatus for performing any aspect or embodiment of this application. The aforementioned electronic device is, for example, a chip.

[0084] It should be understood that the descriptions of technical features, technical solutions, beneficial effects, or similar language in this application do not imply that all features and advantages can be achieved in any single implementation. Rather, it is understood that the description of a feature or beneficial effect means that a specific technical feature, technical solution, or beneficial effect is included in at least one implementation. Therefore, the descriptions of technical features, technical solutions, or beneficial effects in this application do not necessarily refer to the same implementation. Furthermore, the technical features, technical solutions, and beneficial effects described in this application can be combined in any suitable manner. Those skilled in the art will understand that this application can be implemented without one or more specific technical features, technical solutions, or beneficial effects of a particular implementation. In other implementations, additional technical features and beneficial effects may be identified in specific implementations that do not embody all implementations. Attached Figure Description

[0085] The following describes the accompanying drawings used in this application.

[0086] Figure 1 This is a schematic diagram of the architecture of a communication system provided in this application;

[0087] Figure 2 This is a schematic diagram of the hardware structure of a ranging device provided in this application;

[0088] Figure 3 This is a schematic diagram of the hardware structure of an electronic device provided in this application;

[0089] Figure 4 This is a schematic diagram of the software architecture of a ranging device provided in this application;

[0090] Figure 5 This is a flowchart illustrating a distance measurement method provided in this application;

[0091] Figure 6 This is a flowchart illustrating yet another distance measurement method provided in this application;

[0092] Figure 7 This is a flowchart illustrating yet another distance measurement method provided in this application;

[0093] Figure 8 This is a flowchart illustrating yet another distance measurement method provided in this application;

[0094] Figure 9 This is a flowchart illustrating yet another distance measurement method provided in this application;

[0095] Figure 10 This is a flowchart illustrating yet another distance measurement method provided in this application;

[0096] Figure 11 This is a schematic diagram of a first interface provided in this application;

[0097] Figure 12 This is a flowchart illustrating another distance measurement method provided in this application. Detailed Implementation

[0098] The technical solutions in the embodiments of this application will now be described with reference to the accompanying drawings. The terminology used in the implementation section of this application is only for explaining specific embodiments of this application and is not intended to limit this application.

[0099] In the description of the embodiments of this application, unless otherwise stated, " / " means "or". For example, A / B can mean A or B. The "and / or" in the text is merely a description of the relationship between related objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist simultaneously, and B exists alone. In addition, in the description of the embodiments of this application, "multiple" means two or more.

[0100] Hereinafter, the terms "first" and "second" are used for descriptive purposes only and should not be construed as implying or suggesting relative importance or implicitly indicating the number of indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature, and in the description of the embodiments of this application, unless otherwise stated, "multiple" means two or more.

[0101] The term "user interface (UI)" used in the following embodiments of this application refers to the medium interface through which an application or operating system interacts and exchanges information with the user. It realizes the conversion between the internal form of information and the form that the user can accept. The user interface is source code written in a specific computer language such as Java or Extensible Markup Language (XML). The interface source code is parsed and rendered on the electronic device, ultimately presenting content that the user can recognize. A common form of user interface is the graphical user interface (GUI), which refers to a user interface related to computer operation displayed graphically. It can be visible interface elements such as text, icons, buttons, menus, tabs, text boxes, dialog boxes, status bars, navigation bars, and widgets displayed on the screen of an electronic device.

[0102] Figure 1This is a schematic diagram of the architecture of a communication system 10 provided in an embodiment of this application.

[0103] like Figure 1 As shown, the communication system 10 may include an electronic device 100 and a ranging device 200. The ranging device 200 may be a device that supports acquiring the relative position (referred to as ranging) with other devices and can perform control operations. The electronic device 100 may be a device associated with the ranging device 200; for example, the electronic device 100 may be equipped with a digital key for the ranging device 200, or the electronic device 100 may be a device that has previously been connected to the ranging device 200, or the electronic device 100 may be a device logged into the same account or a related account as the ranging device 200, etc.

[0104] For example, the electronic device 100 / ranging device 200 can be a mobile phone, tablet computer, handheld computer, desktop computer, laptop computer, ultra-mobile personal computer (UMPC), netbook, personal digital assistant (PDA), smart home device such as smart TV, smart screen, and smart speaker, extended reality (XR) device such as augmented reality (AR), virtual reality (VR), and mixed reality (MR), vehicle or in-vehicle device, smart manufacturing equipment, and smart city device, etc. This application embodiment does not impose special restrictions on the specific types of the electronic device 100 and the ranging device 200. For example, the electronic device 100 can be a mobile terminal such as a mobile phone or tablet computer, and the ranging device 200 can be a device capable of performing control operations, such as a smart home device, vehicle or in-vehicle device, smart manufacturing equipment, and smart city device.

[0105] Figure 1 Taking a mobile phone as an example, and a vehicle or in-vehicle device as an example, the distance measuring device 200 can perform control operations such as, but not limited to: unlocking, locking, outputting specific lights (such as welcome lights for greeting users), opening / closing the trunk, adjusting seats, controlling the air conditioning, playing / turning off music, etc.

[0106] In one possible implementation, the ranging device 200 can acquire the relative position between the ranging device 200 and the electronic device 100 (which can be simply referred to as ranging). The relative position obtained by ranging (also referred to as the ranging result) may include distance and / or relative orientation. The ranging device 200 can select to execute corresponding control operations based on the acquired relative position. For example, as... Figure 1 As shown, different distances centered on the ranging device 200 can be defined as different regions. Taking three regions as an example, they include: region 1 centered on the ranging device 200 with a radius of distance 1; region 2 centered on the ranging device 200 with a radius of distance 2; and region 3 centered on the ranging device 200 with a radius of distance 3. Distance 1 is greater than distance 2, and distance 2 is greater than distance 3. For example, when the ranging device 200 is in the locked state, if the distance between the ranging device 200 and the electronic device 100 is less than or equal to distance 1 (i.e., the electronic device 100 is located within region 1), the ranging device 200 can output a welcome light. If the distance between the ranging device 200 and the electronic device 100 is less than or equal to distance 3 (i.e., the electronic device 100 is located within region 3), the ranging device 200 can unlock. When the ranging device 200 is in the unlocked state, if the distance between the ranging device 200 and the electronic device 100 is greater than or equal to distance 2 (i.e., the electronic device 100 is outside region 2), the ranging device 200 can lock. For example, distance 1 is 10 meters, distance 2 is 8 meters, and distance 3 is 3 meters.

[0107] In one possible implementation, the electronic device 100 and the ranging device 200 can establish a communication connection via wireless communication technology. The ranging device 200 can communicate with the electronic device 100 through this communication connection to realize the ranging process. In some examples, the electronic device 100 and the ranging device 200 can establish a communication connection via short-range wireless communication technology. The communication connection established via short-range wireless communication technology can be simply referred to as a short-range connection, and the ranging process can be implemented based on short-range wireless communication technology. Short-range wireless communication technology can include technologies supporting short-range wireless communication. Short-range wireless communication involves the transmission of information between communicating parties via radio waves over a short distance (e.g., within 100 meters). This includes, but is not limited to, Bluetooth technology, wireless local area networks (WLANs) (such as Wireless Fidelity (Wi-Fi), Near Field Communication (NFC), Wi-Fi Aware technology, ultra-wideband (UWB), infrared, general short-range communication technologies, and short-range wireless communication technologies specified by the SparkLink Alliance (which can be simply referred to as SparkLink communication technologies, including SparkLink Low Energy (SLE) and SparkLink Basic (SLB)). For example, the ranging process implemented based on short-range wireless communication technology is a received signal strength indication. Ranging based on signal strength (RSSI) indication (e.g., Bluetooth or StarSignal RSSI ranging) can determine relative position based on the measured RSSI strength of the received signal. However, the ranging process can also be channel sounding (CS) ranging (e.g., Bluetooth or StarSignal CS ranging). CS ranging can be implemented based on carrier phase ranging mechanisms and multi-frequency analysis, thus calculating distance by analyzing the phase information of the radio frequency signal at multiple frequencies and channel characteristics (rather than relying solely on time-of-flight or RSSI). CS ranging based on multi-frequency phase differences can eliminate multipath interference by utilizing the phase differences of multiple frequencies, and its accuracy can be improved through precise clock synchronization and signal processing, resulting in high ranging accuracy.

[0108] In other examples, wireless communication technologies may also include cellular communication technologies, WLAN, satellite, etc. Cellular communication technologies may include, but are not limited to, second-generation (2G), third-generation (3G), fourth-generation (4G), fifth-generation (5G), and sixth-generation (6G) mobile communication technologies.

[0109] In one possible implementation, the ranging device 200 may include one or more ranging nodes, which can be used by the ranging device 200 to measure distances. Optionally, these one or more ranging nodes may include a master node and at least one slave node. These one or more ranging nodes may be distributed at different locations on the ranging device 200. For example... Figure 1 As shown, the ranging device 200 is a vehicle 200. The vehicle 200 may include a master node and multiple slave nodes. The master node may be located inside the cabin of the vehicle 200, and the multiple slave nodes may be located around the vehicle 200. Optionally, the master node may be located at the center console location inside the cabin of the vehicle 200. One or more slave nodes may be distributed at the front of the vehicle 200, one or more slave nodes may be distributed at the rear of the vehicle 200, and one or more slave nodes may be distributed in the middle area of ​​the vehicle 200 (such as the area around the windows and doors).

[0110] The ranging device 200 and electronic device 100 described above are for illustrative purposes only and should not be construed as limiting. In other examples, the ranging device 200 may only support ranging but not perform control operations. The ranging device 200 can measure the distance to obtain the relative position between the ranging device 200 and the electronic device 100, and send this relative position to other devices, which can then select the control operation to perform based on the relative position. These other devices may be integrated / coupled with the ranging device 200, or they may be devices located close to the ranging device 200.

[0111] Figure 2 This is a schematic diagram of the hardware structure of a ranging device 200 provided in an embodiment of this application.

[0112] As one possible product form, the ranging device 200 shown in the embodiments of this application can be implemented using a general bus architecture.

[0113] like Figure 2As shown, the ranging device 200 may include a processor 201, a transceiver 202, and a memory 203. The processor 201 can be connected to and communicate with the transceiver 202. The processor 201 can also be connected to and communicate with the memory 203. For example, the processor 201, transceiver 202, and memory 203 can be connected via a bus or other means. The memory 203 is an optional module.

[0114] The processor 201 can be a general-purpose processor or a special-purpose processor, such as a central processing unit (CPU). The processor 201 can be used to run the relevant program code of the ranging device 200 in the ranging method provided in the embodiments of this application to perform the execution steps.

[0115] The transceiver 202, also known as a transceiver unit, transceiver, or transceiver circuit, is used to implement transceiver functions. The transceiver 202 may include a receiver and a transmitter. The receiver, also known as a receiver circuit, is used to implement receiving functions, such as the receiving function in short-range wireless communication technology. The transmitter, also known as a transmitter or transmitting circuit, is used to implement transmitting functions, such as the transmitting function in short-range wireless communication technology. In one possible implementation, the ranging device 200 may also include an antenna and / or radio frequency unit (not shown in the figure), for example, an antenna for short-range wireless communication technology. The antenna and / or radio frequency unit may be located inside the ranging device 200 or separate from it; that is, the antenna and / or radio frequency unit may be deployed remotely or in a distributed manner.

[0116] The memory 203 may include volatile memory, such as random access memory (RAM); the memory may also include non-volatile memory, such as read-only memory (ROM), flash memory, hard disk drive (HDD), or solid state disk (SSD). The memory 203 may also include combinations of the above types of memory. The memory 203 can be used to store a set of program code so that the processor 201 can call the program code stored in the memory 203 to implement the steps performed by the ranging device 200 in the ranging method provided in this application embodiment. In this application embodiment, the memory 203 may also be a storage array, etc.

[0117] In one possible implementation, the ranging device 200 may include one or more ranging nodes, which can be used by the ranging device 200 to measure distances. These one or more ranging nodes may include a master node and N slave nodes, where N is a positive integer. Taking N greater than 1 as an example, the N slave nodes may include slave node 1 to slave node N.

[0118] like Figure 2 As shown, one or more ranging nodes can be located within transceiver 202. The type of ranging node within transceiver 202 can be a communication module. Optionally, the type of ranging node within transceiver 202 can be a communication module using short-range wireless communication technology, such as a Bluetooth communication module, Wi-Fi communication module, NFC module, Starlight communication module, UWB communication module, etc. This type of ranging node can achieve ranging through short-range wireless communication technology, such as RSSI ranging, CS ranging, etc.

[0119] In addition to the types of ranging nodes described above, in other examples, the types of ranging nodes may include, but are not limited to, cameras, sensors, Global Navigation Satellite System (GNSS), etc. Sensors include, but are not limited to, radar, ultrasonic sensors, inertial measurement units (IMUs), etc.

[0120] In this embodiment, a ranging node of the ranging device 200 can be of one type or multiple types. Different ranging nodes of the ranging device 200 can be of the same type or different types. For example, Figure 2 The distance measuring device 200 shown is Figure 1 The ranging device 200 shown (i.e., vehicle 200) may include a Bluetooth / Starlight communication module and a UWB communication module as its master node, and some of the slave nodes of the vehicle 200 may include a Bluetooth / Starlight communication module and a UWB communication module. Some slave nodes may be Bluetooth / Starlight communication modules and some slave nodes may be UWB communication modules.

[0121] In one possible implementation, the ranging device 200 may include circuitry that performs the transmit / receive / communication functions executed by the ranging device 200 in this embodiment. The processor 201 and transceiver 202 of the ranging device 200 can be implemented on integrated circuits (ICs), analog ICs, radio frequency integrated circuits (RFICs), mixed-signal ICs, application-specific integrated circuits (ASICs), printed circuit boards (PCBs), electronic devices, etc. The processor and transceiver can also be manufactured using various IC process technologies, such as complementary metal oxide semiconductors (CMOS), n-metal-oxide-semiconductor (NMOS), positive-channel metal oxide semiconductors (PMOS), bipolar junction transistors (BJTs), bipolar CMOS (BiCMOS), silicon germanium (SiGe), gallium arsenide (GaAs), etc.

[0122] The scope of the ranging device 200 described in the embodiments of this application is not limited thereto, and the structure of the ranging device 200 may vary. Figure 2 The ranging device 200 can be a standalone device or part of a larger device. For example, the ranging device 200 can be:

[0123] (1) A standalone integrated circuit IC, or chip, or chip system or subsystem; (2) A collection of one or more ICs, optionally including storage components for storing data or computer programs; (3) ASIC; (4) A module that can be embedded in other devices; (5) Receiver, terminal, smart terminal, cellular phone, wireless device, handheld device, mobile unit, vehicle device, network device, cloud device, artificial intelligence device, etc.; (6) Others, etc.

[0124] Figure 3 This is a schematic diagram of the hardware structure of an electronic device 100 provided in an embodiment of this application.

[0125] As one possible product form, the electronic device 100 shown in the embodiments of this application can be implemented by a general bus architecture.

[0126] like Figure 3As shown, the electronic device 100 may include a processor 101, a transceiver 102, a memory 103, and a display screen 104. The processor 101 can be connected to and communicate with the transceiver 102. The processor 101 can be connected to and communicate with the memory 103. The processor 101 can be connected to and communicate with the display screen 104. For example, the processor 101, transceiver 102, memory 103, and display screen 104 can be connected via a bus or other means. The memory 103 is an optional module. The display screen 104 is an optional module.

[0127] Processor 101 can be a general-purpose processor or a dedicated processor, such as a central processing unit (CPU). In one possible implementation, processor 101 may include one or more processing units, such as one or more of the following: application processor (AP), microcontroller unit (MCU), modem processor, graphics processing unit (GPU), image signal processor (ISP), controller, video codec, digital signal processor (DSP), baseband processor, and / or neural network processing unit (NPU). Different processing units can be independent devices or integrated into one or more processors. Processor 101 can be used to run the relevant program code for the steps performed by electronic device 100 in the ranging method provided in this application embodiment.

[0128] The transceiver 102, also known as a transceiver unit, transceiver, or transceiver circuit, is used to implement transceiver functions. The transceiver 102 may include a receiver and a transmitter. The receiver, also known as a receiver circuit, is used to implement receiving functions, such as the receiving function in short-range wireless communication technology. The transmitter, also known as a transmitter or transmitting circuit, is used to implement transmitting functions, such as the transmitting function in short-range wireless communication technology. In one possible implementation, the electronic device 100 may further include an antenna and / or radio frequency unit (not shown in the figure), for example, an antenna for short-range wireless communication technology. The antenna and / or radio frequency unit may be located inside the electronic device 100 or separate from it; that is, the antenna and / or radio frequency unit may be remotely or distributedly deployed.

[0129] The memory 103 may include volatile memory, such as random access memory (RAM); the memory may also include non-volatile memory, such as read-only memory (ROM), flash memory, hard disk drive (HDD), or solid state disk (SSD). The memory 103 may also include combinations of the above types of memory. The memory 103 can be used to store a set of program code so that the processor 101 can call the program code stored in the memory 103 to implement the steps performed by the electronic device 100 in the ranging method provided in this application embodiment. In this application embodiment, the memory 103 may also be a storage array, etc.

[0130] The display screen 104 can be used to display images, videos, etc. The display screen 104 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a miniature LED, a microLED, a quantum dot light-emitting diode (QLED), etc. The electronic device 100 may include one or more display screens 104.

[0131] In one possible implementation, if the ranging node of the ranging device 200 is located within the transceiver 202 of the ranging device 200, the electronic device 100 can communicate with the ranging node of the ranging device 200 through the transceiver 102, so that the ranging node of the ranging device 200 determines the relative position between the ranging node and the electronic device 100 according to the communication process. This relative position can be used by the ranging device 200 to determine the relative position between the ranging device 200 and the electronic device 100.

[0132] In one possible implementation, electronic device 100 can receive the relative position between ranging device 200 and electronic device 100 sent by ranging device 200 via transceiver 102, and send the relative position to cloud server via transceiver 102. Cloud server can store the relative position for later use.

[0133] In one possible implementation, the electronic device 100 can receive the relative position between the ranging device 200 and the electronic device 100 sent by the ranging device 200 via the transceiver 102, and display a user interface indicating the relative position via the display screen 104. This allows the user carrying the electronic device 100 to intuitively see the relative position between the electronic device 100 and the ranging device 200, thus improving the user experience.

[0134] In one possible implementation, the electronic device 100 may include circuitry that performs the transmit / receive / communication functions executed by the electronic device 100 in this embodiment. The processor 101 and transceiver 102 of the electronic device 100 can be implemented on integrated circuits (ICs), analog ICs, radio frequency integrated circuits (RFICs), mixed-signal ICs, application-specific integrated circuits (ASICs), printed circuit boards (PCBs), electronic devices, etc. The processor and transceiver can also be manufactured using various IC process technologies, such as complementary metal oxide semiconductors (CMOS), n-metal-oxide-semiconductor (NMOS), positive-channel metal oxide semiconductors (PMOS), bipolar junction transistors (BJTs), bipolar CMOS (BiCMOS), silicon germanium (SiGe), gallium arsenide (GaAs), etc.

[0135] The scope of the electronic device 100 described in this application is not limited thereto, and the structure of the electronic device 100 may vary. Figure 2 The limitations apply. Electronic device 100 can be a standalone device or part of a larger device. For example, electronic device 100 can be:

[0136] (1) A standalone integrated circuit IC, or chip, or chip system or subsystem; (2) A collection of one or more ICs, optionally including storage components for storing data or computer programs; (3) ASIC; (4) A module that can be embedded in other devices; (5) Receiver, terminal, smart terminal, cellular phone, wireless device, handheld device, mobile unit, vehicle device, network device, cloud device, artificial intelligence device, etc.; (6) Others, etc.

[0137] Figure 4 This is a schematic diagram of the software architecture of a ranging device 200 provided in an embodiment of this application.

[0138] like Figure 4 As shown, the ranging device 200 may include an application layer and a communication protocol stack. In one possible implementation, the application layer may be on top of the communication protocol stack. In another possible implementation, the application layer and the communication protocol stack may communicate through a software interface.

[0139] The application layer can include applications (APPs). For example, if the ranging device 200 is a vehicle 200, the application layer of the vehicle 200 can include, but is not limited to, digital keys, function adjustments, and navigation. The digital key can include a digital car key. For a vehicle 200 equipped with a digital key APP, the electronic device 100 can remotely perform unlocking and / or locking functions on the vehicle 200 through the configured digital car key. The function adjustment APP can be used to provide adjustable functions for modules such as seats, air conditioning, and windows of the vehicle 200. The navigation APP can be used to provide navigation functions for the vehicle 200. In one possible implementation, the applications can include system APPs and extended APPs / third-party APPs.

[0140] The communication protocol stack can be used by the ranging device 200 to communicate with other devices. The communication protocol stack can include protocol stacks for one or more communication functions supported by the ranging device 200. For example, the communication protocol stack of the ranging device 200 can include a Bluetooth protocol stack, a StarFlash protocol stack, and a UWB protocol stack. The Bluetooth protocol stack can be used to implement Bluetooth communication functions, the StarFlash protocol stack can be used to implement StarFlash communication functions, and the UWB protocol stack can be used to implement UWB communication functions.

[0141] In one possible implementation, the application of the ranging device 200 can establish a connection and communication with the electronic device 100 through a communication protocol stack, thereby obtaining the relative position between the ranging device 200 and the electronic device 100.

[0142] Software architecture of electronic device 100 and Figure 4The software architectures shown are similar. It can be understood that the application programs included in the application layer of electronic device 100 and the application programs included in the application layer of ranging device 200 may be different. The communication functions supported by electronic device 100 and the communication functions supported by ranging device 200 may be all the same, partially different, or all different. Therefore, the communication protocol stack of electronic device 100 and the communication protocol stack of ranging device 200 may be all the same, partially different, or all different.

[0143] The software architecture of the ranging device 200 and the electronic device 100 described above are for illustrative purposes only and should not be construed as limiting.

[0144] Current ranging solutions often require high power consumption to achieve high ranging accuracy, or low ranging accuracy to achieve low power consumption, making it impossible to strike a balance between power consumption and ranging accuracy. This explanation will use a ranging solution employing the highly accurate CS ranging technology as an example, and will focus on a ranging device 200. Figure 1 The vehicle 200 shown is used as an example, which includes one master node and multiple slave nodes.

[0145] In one ranging scheme 1, vehicle 200 can activate a master node and multiple slave nodes, and perform CS ranging with electronic device 100 through the master node and multiple slave nodes. The master node can be located inside the cabin of vehicle 200, and multiple slave nodes can be located around vehicle 200. There is generally only a single layer of plastic shell between the slave nodes and electronic device 100, giving slave node ranging an advantage of almost no obstruction. This ranging scheme, which effectively utilizes all ranging nodes located in different positions, has high accuracy. However, vehicle 200 needs to activate all ranging nodes for CS ranging, and electronic device 100 also needs to perform CS ranging signal interaction with all ranging nodes, resulting in high power consumption for both electronic device 100 and vehicle 200. Furthermore, it consumes a large amount of air interface resources, affecting other services of electronic device 100 and vehicle 200.

[0146] In another ranging scheme 2, vehicle 200 can first activate the master node to perform CS ranging with electronic device 100. When it is determined that the distance between vehicle 200 and electronic device 100 is small, vehicle 200 then activates multiple slave nodes and performs CS ranging with electronic device 100 together through multiple slave nodes. However, the master node is generally located inside the cabin of vehicle 200, and vehicle 200 may have coatings (such as window coatings), which may cause the distance obtained by vehicle 200 through CS ranging with electronic device 100 via master node to be closer / farther than the actual distance, and the ranging is very slow. In other words, although ranging scheme 2 has lower device power consumption and smaller air interface occupation compared to ranging scheme 1, the ranging accuracy is lower.

[0147] This application provides a ranging method as shown in Embodiment 1 below, and this application also provides a ranging method as shown in Embodiment 2 below. The ranging methods provided by this application can achieve a balance between power consumption and ranging accuracy, thereby improving the availability of the ranging function.

[0148] In Example 1, the ranging device 200 may include a master node and N slave nodes, where N is a positive integer greater than 1. Optionally, any two ranging nodes among the N slave nodes and the master node may be located at different positions on the ranging device 200. For example, the master node may be located inside the ranging device, and the N slave nodes may be located around the perimeter of the ranging device 200. Different slave nodes may be located at different positions around the perimeter of the ranging device 200. For specific implementation details, please refer to [link to implementation details]. Figure 1 The ranging device 200 shown is illustrated. The ranging method shown in Embodiment 1 may include, but is not limited to, the following steps: The ranging device 200 acquires the signal strength of the electronic device 100 through N slave nodes, obtaining N signal strengths (e.g., RSSI), wherein one of the N slave nodes is used to acquire the signal strength of one electronic device 100; The ranging device 200 determines M slave nodes from the N slave nodes based on the N signal strengths, wherein the M signal strengths acquired by the M slave nodes are all greater than the signal strengths acquired by the slave nodes other than the M slave nodes among the N slave nodes, and M is a positive integer less than N; The ranging device... The ranging device 200 obtains the first relative position between the master node and the electronic device 100 using the first ranging method through the master node, and the ranging device 200 obtains the second relative position between itself and the electronic device 100 through M slave nodes using the first ranging method respectively, resulting in M ​​second relative positions. Among them, one of the M slave nodes is used to obtain one second relative position between itself and the electronic device. For example, the first ranging method is CS ranging. The ranging device 200 determines the third relative position between itself and the electronic device 100 based on the first relative position and the M second relative positions.

[0149] In one possible implementation, the ranging method shown in Embodiment 1 may further include: establishing a first communication connection (e.g., a short-range connection) between the ranging device 200 and the electronic device 100. The signal strength of an electronic device 100 obtained by any of the slave nodes can be the signal strength of the first communication connection obtained by that slave node. In this way, without the electronic device 100 actively sending signals to each of the N slave nodes of the ranging device 200, the N slave nodes of the ranging device 200 can obtain the signal strength of the electronic device 100 respectively, greatly reducing transmission resources and device power consumption.

[0150] In the method shown in Embodiment 1, the N slave nodes are positioned differently on the ranging device 200. Therefore, the signal strength values ​​received by the N slave nodes from the second device may also be different. Generally, the higher the signal strength obtained by a slave node, the closer the distance between the slave node and the electronic device 100. The ranging device 200 can determine the M slave nodes with the highest signal strength from the N slave nodes and perform ranging through the master node and these M slave nodes. In this way, high-precision and low-power multi-node fusion ranging can be achieved by using a small number of slave nodes and the master node with relatively accurate ranging. Furthermore, the M slave nodes used for each ranging can be the same or different, that is, the ranging device 200 can dynamically switch slave nodes for ranging. In this way, fast and accurate ranging can be achieved when the electronic device 100 approaches the ranging device 200 from different directions, which can well cope with behaviors such as users walking around a vehicle.

[0151] Compared to the above ranging scheme 1, while ensuring ranging accuracy, it eliminates the need for the ranging device 200 to activate all slave nodes, and also eliminates the need for signal interaction between the electronic device 100 and all slave nodes of the ranging device 200 for ranging, thus reducing the power consumption of the ranging device 200 and the electronic device 100, and also reducing air interface occupancy. Compared to the above ranging scheme 2, by using the master node and M slave nodes for ranging together, it can still improve ranging accuracy while ensuring lower power consumption and taking advantage of the almost unobstructed nature of the slave nodes.

[0152] The following is through Figure 5 The ranging method shown in Example 1 is illustrated by way of example.

[0153] Figure 5 This is a flowchart illustrating a ranging method provided in an embodiment of this application. Figure 5 The method shown can be applied to Figure 1 The communication system 10 shown. Figure 5 The distance measuring device 200 shown can be Figure 2 The distance measuring device 200 shown. Figure 5 The distance measuring device 200 shown can be Figure 4 The distance measuring device 200 shown. Figure 5 The electronic device 100 shown may be Figure 3 The electronic device 100 shown.

[0154] Figure 5 The following explanation will be based on a ranging device 200 that includes a master node and two slave nodes (i.e., N=2) and M=1. Figure 5 The explanation will be based on the example of the first communication connection being the first satellite flash connection.

[0155] Figure 5 The method shown may include, but is not limited to, the following steps:

[0156] S101. The ranging device 200 sends a star flash broadcast.

[0157] In one possible implementation, the ranging device 200 can periodically transmit a starlight broadcast signal. However, it is not limited to this; the ranging device 200 can also continuously transmit the starlight broadcast signal. This application embodiment does not limit the manner in which the ranging device 200 transmits the starlight broadcast signal.

[0158] S102. Electronic device 100 scans the star flash broadcast sent by ranging device 200.

[0159] In one possible implementation, when the electronic device 100 has its star flash scanning function enabled, it can approach the ranging device 200 and scan for the star flash broadcast sent by the ranging device 200.

[0160] S103. Electronic device 100 establishes a first star flash connection with ranging device 200.

[0161] In one possible implementation, after the electronic device 100 scans the star flash broadcast sent by the ranging device 200, it can interact with the ranging device 200 to establish a first star flash connection. Optionally, after establishing the first star flash connection with the ranging device 200, the electronic device 100 can perform an authentication process.

[0162] In one possible implementation, the ranging device 200 can establish a first satellite connection with the electronic device 100 through a master node. This first satellite connection can be used not only for the master node to acquire the relative position between itself and the electronic device 100, but also for other ranging nodes in the ranging device 200 (excluding the master node) to acquire the relative position between themselves and the electronic device 100. Therefore, this first satellite connection can be used to implement S109 and S110 below.

[0163] Not limited to this, in another possible implementation, the ranging device 200 can also establish a first satellite connection with the electronic device 100 through any slave node. This first satellite connection can be used not only to obtain the relative position between the slave node and the electronic device 100, but also to obtain the relative position between other ranging nodes in the ranging device 200 (excluding the slave node) and the electronic device 100. Therefore, when the first satellite connection is established by slave node 1 or slave node 2, the first satellite connection can be used to implement S109 and S110 below.

[0164] In another possible implementation, the ranging device 200 can also establish star-flash connections with the electronic device 100 through multiple ranging nodes. Each star-flash connection established by a ranging node can be used to acquire the relative position between the ranging node and the electronic device 100. Therefore, S109 below can be implemented based on a star-flash connection established by the master node, and S110 below can be implemented based on a star-flash connection established by the slave node 2. This application does not limit the specific method by which the ranging device 200 and the electronic device 100 establish a communication connection.

[0165] In one possible implementation, the ranging device 200 may determine to perform ranging after establishing a first satellite connection with the electronic device 100 and after the authentication between the electronic device 100 and the ranging device 200 has been successful. Not limited to this, in another possible implementation, the ranging device 200 may also determine to perform ranging after establishing a first satellite connection with the electronic device 100 and before the authentication process. The ranging described above may be, for example, multi-node fusion ranging, and specific implementation examples can be found in S105-S112.

[0166] S104. The master node of the ranging device 200 wakes up the slave node of the ranging device 200.

[0167] S104 is an optional step.

[0168] In one possible implementation, the master node of the ranging device 200 can be in a wake-up state by default, while slave nodes 1 and 2 can be in a sleep state by default. When the ranging device 200 determines to perform multi-node fusion ranging (e.g., after S103), it can wake up slave nodes 1 and 2 through the master node (i.e., execute S104) to enable slave nodes 1 and 2 to participate in multi-node fusion ranging (e.g., execute at least one of S105-S112). This allows slave nodes to sleep when not in operation and wake up when in operation, reducing the power consumption of the ranging device 200.

[0169] In another possible implementation, both the master node and slave node of the ranging device 200 can be in a wake-up state by default. When the ranging device 200 determines to perform multi-node fusion ranging (e.g., after S103), the master node and slave node can directly participate in the multi-node fusion ranging (e.g., execute at least one of S105-S112). In this case, S104 can be omitted.

[0170] S105. The slave node 1 of the ranging device 200 obtains the signal strength 1 of the first star flash connection and reports the signal strength 1 to the master node.

[0171] S106. The slave node 2 of the ranging device 200 obtains the signal strength 2 of the first star flash connection and reports the signal strength 2 to the master node.

[0172] For example, the signal strength mentioned above could be RSSI.

[0173] In one possible implementation, prior to S105 and S106, the ranging device 200 can instruct slave nodes 1 and 2, via the master node, to acquire the signal strength of the first satellite flash connection between the ranging device 200 and the electronic device 100. For example, in S104, the master node sends an instruction message to slave nodes 1 and 2, which is used to wake up slave nodes 1 and 2 and to instruct them to acquire the signal strength of the first satellite flash connection between the ranging device 200 and the electronic device 100.

[0174] In one possible implementation, the positions of slave node 1 and slave node 2 on the ranging device 200 are different. Accordingly, the relative position between slave node 1 and electronic device 100 is different from the relative position between slave node 2 and electronic device 100. Therefore, the signal strength 1 of the first satellite flash connection monitored by slave node 1 and the signal strength 2 of the first satellite flash connection monitored by slave node 2 can be different.

[0175] In one possible implementation, slave node 1 of ranging device 200 can acquire the signal strength 1 of one or more first satellite flare connections within time window 1 and report it to the master node. Slave node 2 of ranging device 200 can acquire the signal strength 2 of one or more first satellite flare connections within the aforementioned time window 1 and report it to the master node. That is, the master node can receive one or more signal strengths of the first satellite flare connections reported by slave node 1 and slave node 2 respectively within time window 1.

[0176] The execution order of S105 and S106 is not limited.

[0177] S107. When signal strength 2 is greater than signal strength 1, the master node of the ranging device 200 determines slave node 2 of slave node 1 and slave node 2 as the target slave node.

[0178] In one possible implementation, after the master node of the ranging device 200 receives a signal strength 1 reported by slave node 1 and a signal strength 2 reported by slave node 2 (i.e. after S105 and S106), it can compare the magnitudes of signal strength 1 and signal strength 2. Figure 5S107 is explained using the example of signal strength 2 being greater than signal strength 1. Therefore, the master node of the ranging device 200 can determine the slave node 2 with the greater signal strength from slave node 1 and slave node 2 of the ranging device 200. Slave node 2 is the determined target slave node for ranging. It is understandable that the greater the signal strength of the first satellite flash connection obtained by the slave node, the closer the distance between the slave node and the electronic device 100. Therefore, when signal strength 2 is greater than signal strength 1, the distance between slave node 2 and the electronic device 100 is less than the distance between slave node 1 and the electronic device 100. A slave node with a shorter distance will have higher accuracy in subsequent multi-node fusion ranging.

[0179] Not limited to this, in another possible implementation, the master node can receive multiple signal strengths 1 reported by slave node 1, and also receive multiple signal strengths 2 reported by slave node 2. The master node can use processing method 1 to process the multiple signal strengths 1 to obtain signal strength 3, and can also use processing method 1 to process the multiple signal strengths 2 to obtain signal strength 4. For example, processing method 1 can be averaging, minimizing, maximizing, medianing, mode, weighted averaging, or variance taking, etc. The master node can compare the magnitudes of signal strength 3 and signal strength 4. When signal strength 4 is greater than signal strength 3, the master node can determine slave node 2 with the greater signal strength from slave nodes 1 and 2 of the ranging device 200 as the target slave node.

[0180] In another possible implementation, the master node can receive multiple signal strengths of 1 reported by slave node 1, but only one signal strength of 2 reported by slave node 2. The master node can process the multiple signal strengths of 1 using processing method 1 to obtain signal strength 3. The master node can compare the magnitudes of signal strength 3 and signal strength 2. When signal strength 2 is greater than signal strength 3, the master node can determine slave node 2 with the greater signal strength from slave nodes 1 and 2 of the ranging device 200 as the target slave node. This application embodiment does not limit the specific method for determining the target slave node 2.

[0181] S108. The master node of the ranging device 200 indicates that ranging should be started from node 2.

[0182] In one possible implementation, after the master node of the ranging device 200 determines the target slave node (i.e., slave node 2) for ranging (i.e., after S107), it can instruct slave node 2 to initiate ranging. Optionally, the master node can instruct slave node 2 to perform ranging using a first ranging method. Optionally, the master node can instruct slave node 2 to obtain the relative position with electronic device 100.

[0183] S109. The master node of the ranging device 200 uses a first ranging method to obtain the first relative position between the master node and the electronic device 100.

[0184] In one possible implementation, when the ranging device 200 determines that multi-node fusion ranging is to be performed (e.g., after S103), it can obtain the first relative position between the master node and the electronic device 100 through the master node using a first ranging method. Optionally, the first ranging method can be a ranging method implemented through signal interaction between devices. Optionally, the first ranging method can be a ranging method implemented through signal interaction based on the first satellite stroboscopic connection established in S103, for example, the first ranging method is CS ranging.

[0185] S110. The slave node 2 of the ranging device 200 uses a first ranging method to obtain the second relative position between the slave node 2 and the electronic device 100.

[0186] S111. The slave node 2 of the ranging device 200 reports the second relative position to the master node.

[0187] In one possible implementation, when the ranging device 200 determines to perform multi-node fusion ranging (e.g., after S103), it can not only perform ranging through the master node (i.e., execute S109), but also obtain the second relative position between the slave node 2 and the electronic device 100 using the first ranging method through the determined target slave node (i.e., slave node 2). After obtaining the second relative position, the slave node 2 can report the second relative position to the master node.

[0188] In one possible implementation, after the slave node 2 of the ranging device 200 receives the instruction from the master node (i.e., after S108), the slave node 2 can perform ranging, i.e., execute S110.

[0189] In one possible implementation, the order in which the master node of the ranging device 200 performs ranging and triggers the determination of the target slave node is not limited. Therefore, the execution order of any step in S109 and S105-S108 is not limited.

[0190] In one possible implementation, the order in which the master node of the ranging device 200 performs ranging and the slave node 2 performs ranging is not limited. Therefore, the execution order of any step in S109 and S110-S111 is not limited.

[0191] S112. The master node of the ranging device 200 determines the third relative position between the electronic device 100 and the ranging device 200 based on the first relative position and the second relative position.

[0192] In one possible implementation, the ranging device 200 can combine the first relative position obtained from the master node and the second relative position obtained from node 2 to determine a third relative position between the electronic device 100 and the ranging device 200. That is, the third relative position is the ranging result obtained by multi-node fusion ranging. The relative position in the embodiments of this application may include distance and / or relative orientation.

[0193] In one possible implementation, the third relative position determined by the ranging device 200 can be used by the ranging device 200 to select and execute a control operation. For example, the ranging device 200... Figure 5 In the steps shown, the device is in a locked state. After the ranging device 200 executes S112, it can determine whether to perform an unlocking operation on the ranging device 200 based on the third relative position. When the distance in the third relative position is less than or equal to the preset unlocking distance, for example, when it is located in the locked state... Figure 1 When the distance in the third relative position is greater than the preset unlocking distance, for example, when it is located in area 3, the ranging device 200 can perform the unlocking operation. Figure 1 When outside of area 3 shown, the ranging device 200 can determine that it will not perform the unlocking operation and will remain in the locked state.

[0194] Understandably, Figure 5 S105-S112 constitute one ranging process. In specific implementations, the relative positions of the ranging device 200 and the electronic device 100 may change over time. The ranging device 200 can perform multiple ranging processes, i.e., real-time ranging. Optionally, the ranging device 200 can determine whether to execute a control operation and, if so, which control operation to execute, based on the obtained real-time ranging results. The target slave node determined by the ranging device 200 in each ranging process can be different; that is, the ranging device 200 can dynamically use different slave nodes. For example, when the electronic device 100 approaches the ranging device 200 from different directions, the ranging device 200 can determine the slave node in the corresponding direction as the target slave node to perform ranging, while slave nodes in other directions may not participate in the ranging.

[0195] Figure 5The operations performed by the ranging node of the ranging device 200 shown are for illustrative purposes only. In other examples, at least one of S101, S103, S107, and S112 may not be performed by the master node. For example, S101 and / or S103 may be performed by a slave node or other module, and S107 and / or S112 may be performed by the processor of the ranging device 200 or other modules such as slave nodes. In other examples, in S105 and S106, slave node 1 can obtain the signal strengths of multiple first satellite flash connections and process these multiple signal strengths using processing method 1 to obtain signal strength 1. Slave node 1 can report the processed signal strength 1 to the master node. Similarly, the signal strength 2 reported by slave node 2 to the master node can also be obtained by slave node 2 processing the signal strengths of multiple first satellite flash connections obtained by slave node 2 using processing method 1. This application embodiment does not limit this.

[0196] exist Figure 5 In the method shown, the ranging device 200 can first determine the target slave node with a higher signal strength through signal strength ranging (e.g., RSSI ranging), and then obtain the ranging result (i.e., the third relative position) by using a first ranging method (e.g., CS ranging) between the master node and the target slave node. Therefore, the ranging method used by the ranging device 200 combines signal strength ranging (e.g., RSSI ranging) and the first ranging method (e.g., CS ranging), and the ranging device 200 combines the master node and the target slave node to perform ranging together, thereby achieving multi-node fusion ranging with high accuracy and low power consumption, achieving a better overall effect.

[0197] Not limited to the description of Embodiment 1 above, in other examples, after the ranging device 200 in Embodiment 1 determines M slave nodes from the N slave nodes based on the N signal strengths obtained from the N slave nodes, it can obtain the second relative position between the M slave nodes and the electronic device 100 using the first ranging method, thus obtaining M second relative positions. Then, the relative position between the ranging device 200 and the electronic device 100 is directly obtained based on the M second relative positions. The ranging device 200 may not need to use a master node for ranging.

[0198] Example 2 provides a ranging method, which may include, but is not limited to, the following steps: a ranging device 200 uses a first ranging method to obtain a first distance between the ranging device 200 and the electronic device 100; when the first distance is greater than or equal to a preset distance, the ranging device 200 uses a first ranging method with a first ranging frequency to obtain the relative position between the ranging device 200 and the electronic device 100; when the first distance is less than the preset distance, the ranging device 200 uses a first ranging method with a second ranging frequency to obtain the relative position between the ranging device 200 and the electronic device 100, wherein the first ranging frequency is less than the second ranging frequency. The first ranging method may be a ranging method implemented through signal interaction between devices, such as CS ranging. The first ranging method shown in Example 1 and the first ranging method shown in Example 2 may be the same or different.

[0199] In one possible implementation, the ranging device 200 includes multiple ranging nodes. Optionally, any two ranging nodes may be located at different positions on the ranging device 200. See [link to specific example] for details. Figure 1 The ranging device 200 is shown. The acquisition of the first distance and the acquisition of the relative position between the ranging device 200 and the electronic device 100 using a first or second ranging frequency can be achieved through multiple ranging nodes; that is, any single ranging process can be implemented through multiple ranging nodes. In some examples, the ranging device 200 can implement a single ranging process using all ranging nodes (i.e., one master node and N slave nodes). In other examples, the ranging device 200 can implement a single ranging process using some ranging nodes (i.e., one or more ranging nodes), for example, by using the ranging method shown in Embodiment 1 (in which case a single ranging process is implemented using one master node and M slave nodes).

[0200] In the method shown in Embodiment 2, when the distance between the ranging device 200 and the electronic device 100 is large, a lower ranging frequency can be used; when the distance between the ranging device 200 and the electronic device 100 is small, a higher ranging frequency can be used. Specifically, in the scenario of a large distance, the ranging device 200 and the electronic device 100 will not quickly approach each other, and the real-time requirement for the control operation selected by the ranging device 200 based on the ranging result is lower. Therefore, a lower ranging frequency is well-suited for scenarios with large distances. In the scenario of a small distance, the ranging device 200 and the electronic device 100 may quickly approach each other, and the real-time requirement for the control operation selected by the ranging device 200 based on the ranging result is higher. Therefore, a higher ranging frequency can provide higher accuracy and is well-suited for scenarios with small distances. Furthermore, in the scenario of a large distance, the frequency of interaction of ranging signals between the ranging device 200 and the electronic device 100 is low, thus the power consumption of the ranging device 200 and the electronic device 100 is low. In scenarios with shorter distances, the ranging device 200 and the electronic device 100 interact with ranging signals more frequently, resulting in higher power consumption for both. For example, if the ranging device 200 is a vehicle and the electronic device 100 is a terminal, the ranging device 200 hardly needs to perform vehicle control operations when the distance between the electronic device 100 and the ranging device 200 is greater than 10 meters. However, when the distance between the electronic device 100 and the ranging device 200 is less than or equal to 10 meters, the ranging device 200 may need to perform different vehicle control operations at distances of approximately 8 meters, 5 meters, and 3 meters. The method shown in Example 2 dynamically adjusts the frequency of the ranging signal according to the distance, thereby balancing device power consumption and ranging accuracy to achieve a better overall effect.

[0201] The following is through Figure 6 The ranging method shown in Embodiment 2 is illustrated by example.

[0202] Figure 6 This is a flowchart illustrating another ranging method provided in the embodiments of this application. Figure 6 The method shown can be applied to Figure 1 The communication system 10 shown. Figure 6 The distance measuring device 200 shown can be Figure 2 The distance measuring device 200 shown. Figure 6 The distance measuring device 200 shown can be Figure 4 The distance measuring device 200 shown. Figure 6 The electronic device 100 shown may be Figure 3 The electronic device 100 shown.

[0203] Figure 6 The following explanation will be based on a ranging device 200 that includes three ranging nodes (one master node and two slave nodes). Figure 6Taking the first communication connection established between the electronic device 100 and the ranging device 200 before ranging as an example, the first ranging method can be a ranging method based on signal interaction of the first communication connection.

[0204] Figure 6 The method shown may include, but is not limited to, the following steps:

[0205] S201. The ranging device 200 sends a star flash broadcast.

[0206] S202. Electronic device 100 scans the star flash broadcast sent by ranging device 200.

[0207] S203. Electronic device 100 establishes a first star flash connection with ranging device 200.

[0208] S204. The master node of the ranging device 200 wakes up the slave node of the ranging device 200.

[0209] Figure 6 S201-S204 and Figure 5 Similar to S101-S104, see details below. Figure 5 Explanation of S101-S104.

[0210] S205. The master node of the ranging device 200 uses the first ranging method to obtain the relative position 1 between the master node and the electronic device 100.

[0211] S206. The slave node 1 of the ranging device 200 uses a first ranging method to obtain the relative position 2 between the slave node 1 and the electronic device 100.

[0212] S207. The slave node 2 of the ranging device 200 uses a first ranging method to obtain the relative position 3 between the slave node 2 and the electronic device 100.

[0213] S208. The slave node 1 of the ranging device 200 reports the relative position 2 to the master node.

[0214] S209. The slave node 2 of the ranging device 200 reports the relative position 3 to the master node.

[0215] S210. The master node of the ranging device 200 determines a fourth relative position between the electronic device 100 and the ranging device 200 based on relative position 1, relative position 2 and relative position 3, the fourth relative position including the first distance.

[0216] S205-S210 can be a ranging process implemented by the ranging device 200 through the master node, slave node 1, and slave node 2. This ranging process is a multi-node fusion ranging process, and the ranging result of this process is a fourth relative position. The fourth relative position includes the first distance, and optionally, the relative orientation between the electronic device 100 and the ranging device 200. After obtaining the fourth relative position (including the first distance), the ranging device 200 can determine whether the first distance is greater than or equal to a preset distance, and determine the ranging frequency to be used based on the determination result. In case A, when the first distance is greater than or equal to the preset distance, the ranging device 200 can determine to use the first ranging frequency for ranging, as shown in S211-S212. In case B, when the first distance is less than the preset distance, the ranging device 200 can determine to use the second ranging frequency for ranging, as shown in S213-S214. The second ranging frequency is greater than the first ranging frequency.

[0217] S211. When the first distance is greater than or equal to the preset distance, the master node of the ranging device 200 determines to use the first ranging frequency.

[0218] S212. The master node, slave node 1 and slave node 2 of the ranging device 200 use the first ranging frequency to obtain the relative position between the electronic device 100 and the ranging device 200.

[0219] In one possible implementation, the master node, slave node 1, and slave node 2 of the ranging device 200 may perform one or more ranging processes using a first ranging method with a first ranging frequency. The implementation of any one ranging process is similar to that shown in S205-S210, and will not be described again.

[0220] S213. When the first distance is less than the preset distance, the master node of the ranging device 200 determines to use the second ranging frequency, which is greater than the first ranging frequency.

[0221] S214. The master node, slave node 1 and slave node 2 of the ranging device 200 use the second ranging frequency to obtain the relative position between the electronic device 100 and the ranging device 200.

[0222] In one possible implementation, the master node, slave node 1, and slave node 2 of the ranging device 200 may perform one or more ranging processes using a first ranging method with a second ranging frequency. The implementation of any one ranging process is similar to that shown in S205-S210, and will not be described again.

[0223] In Example 2, the ranging frequency = 1 / ranging period, where the ranging period is the time interval between two consecutive ranging processes performed by the ranging device 200. Figure 6This explanation will take multi-node fusion ranging as an example. Therefore, Figure 6 The ranging frequency shown is the frequency at which multiple ranging nodes of the ranging device 200 perform multi-node fusion ranging. Figure 6 The ranging period shown is the time interval between two adjacent multi-node fusion ranging measurements performed by multiple ranging nodes of the ranging device 200. Figure 6 In S211-S212, the first ranging frequency = 1 / first ranging period. In S212, when the master node, slave node 1, and slave node 2 of the ranging device 200 perform multiple ranging measurements using the first ranging frequency, the time interval between two adjacent ranging measurements can be the first ranging period. Figure 6 In steps S213-S214, the second ranging frequency = 1 / second ranging period. In step S214, when the master node, slave node 1, and slave node 2 of the ranging device 200 perform multiple ranging operations using the second ranging frequency, the time interval between two adjacent ranging operations can be the second ranging period. The second ranging period is shorter than the first ranging period.

[0224] For example, the first ranging frequency is 0.5 Hz, the first ranging period is 2 seconds, the second ranging frequency is 2 Hz, and the second ranging period is 0.5 seconds. When the first distance between the electronic device 100 and the ranging device 200 is greater than or equal to a preset distance, the ranging device 200 can perform a ranging measurement every 2 seconds. When the first distance between the electronic device 100 and the ranging device 200 is less than the preset distance, the ranging device 200 can perform a ranging measurement every 0.5 seconds.

[0225] In one possible implementation, the ranging device 200 may include an application layer and a communication protocol stack. The application layer can be used to initiate the ranging process and determine the ranging frequency. In embodiment 2, the application layer of the ranging device 200 can determine whether a first distance is greater than or equal to a preset distance, and determine the ranging frequency to be used based on the determination result. The communication protocol stack can be used to perform one or more ranging measurements according to a specific ranging frequency indicated by the application layer. During each ranging measurement, the carrier frequency of the ranging signal can remain unchanged. For example, if the ranging signal is a Bluetooth signal, the carrier frequency of the ranging signal remains at Bluetooth 2.4 GHz when the communication protocol stack performs each ranging measurement at a first ranging frequency (e.g., 0.5 Hz) and a second ranging frequency (e.g., 2 Hz).

[0226] In one possible implementation, Figure 6The ranging result obtained from any of the ranging processes shown (e.g., the fourth relative position obtained in S210, the relative position obtained from any of the ranging processes in S212, and the relative position obtained from any of the ranging processes in S214) can be used by the ranging device 200 to select and execute control operations. For example, the ranging device 200 in... Figure 6 Before S210, the ranging device 200 was in a locked state. After S210 is executed, it can determine whether to perform an unlocking operation on the ranging device 200 based on the fourth relative position. When the first distance in the fourth relative position is less than or equal to the preset unlocking distance, for example, when it is located at... Figure 1 When the distance between the two locations is within area 3 as shown, the ranging device 200 can perform an unlocking operation. This is possible when the first distance in the fourth relative position is greater than a preset unlocking distance, for example, when located within... Figure 1 When outside of area 3 shown, the ranging device 200 can determine that it will not perform the unlocking operation and will remain in the locked state.

[0227] Understandably, Figure 6 This example only illustrates one process for determining the ranging frequency. In a real implementation, the relative positions of the ranging device 200 and the electronic device 100 may change over time. The ranging device 200 can perform multiple ranging processes, i.e., real-time ranging, and determine whether to use the first or second ranging frequency based on the obtained real-time ranging results. The following will illustrate... Figure 6 Taking an example, assuming that after S210, S211-S212 as shown in case A are executed, in S212, the master node, slave node 1, and slave node 2 of the ranging device 200 can use the second ranging frequency to perform one or more ranging processes. For each ranging result obtained from the ranging process, the ranging device 200 can determine whether the distance in the ranging result is greater than or equal to a preset distance, and decide whether to switch the ranging frequency based on the determination result. When the determination result is yes, the first ranging frequency can be used, as in the specific example similar to case A. When the determination result is no, the second ranging frequency can be switched to use, as in the specific example similar to case B. Therefore, the ranging device 200 can dynamically switch the ranging frequency used according to the real-time distance between the ranging device 200 and the electronic device 100. For example, when the electronic device 100 gradually approaches the ranging device 200 from a distance, the ranging device 200 can first use the first ranging frequency to perform ranging (at which time the frequency of obtaining the ranging result is slower), and then use the second ranging frequency to perform ranging (at which time the frequency of obtaining the ranging result is faster).

[0228] The above explanation uses the example of the ranging device 200 determining whether to switch the ranging frequency based on the ranging results obtained from each ranging process. In another possible implementation, after determining the ranging frequency, the ranging device 200 can also perform multiple ranging processes within time window 2 according to the determined ranging frequency, and then determine whether to switch the ranging frequency based on the ranging result obtained from the most recent ranging process among these multiple ranging processes. For example, when the ranging device 200 determines to perform ranging (e.g., after S103), it can first use the default ranging frequency (e.g., a smaller first ranging frequency) to perform multiple ranging processes within time window 2. The ranging device 200 can then obtain the ranging result obtained from the most recent ranging process among these multiple ranging processes. Then, the ranging device 200 can determine whether the distance in the ranging result is greater than or equal to a preset distance, and determine whether to use the first ranging frequency or the second ranging frequency subsequently based on the determination result.

[0229] Figure 6 The following example illustrates a single ranging process implemented using all ranging nodes. In other examples, a single ranging process can also be implemented using the ranging method shown in Example 1. Therefore, a single ranging process can be implemented using one master node and M slave nodes. In this case, Figure 6 S205-S210 shown can be replaced with Figure 5 The expressions shown are similar to S105-S112. Figure 6 The implementation of any one of the ranging processes in S212 and S214 shown and Figure 5 The implementations of S105-S112 shown are similar.

[0230] exist Figure 6 In the method shown, the ranging device 200 can achieve multi-node fusion ranging through master and slave nodes. Furthermore, the ranging device 200 can dynamically switch the ranging frequency used based on the real-time distance between the ranging device 200 and the electronic device 100. A lower ranging frequency is used when the distance is greater, resulting in lower power consumption while maintaining the required ranging accuracy and real-time performance for the current scenario. A higher ranging frequency is used when the distance is less, providing higher ranging accuracy and real-time performance, thus achieving a good balance between power consumption and ranging accuracy. Moreover, since ranging is performed jointly by the master node and multiple slave nodes of the ranging device 200, fast and accurate ranging can be achieved even when the electronic device 100 approaches the ranging device 200 from different directions, effectively handling behaviors such as users circling around vehicles.

[0231] In some embodiments of this application, the ranging device 200 can initiate ranging after establishing a communication connection with the electronic device 100 and the authentication performed with the electronic device 100 is successful. The authentication performed between the ranging device 200 and the electronic device 100 may include protocol stack authentication and / or application layer authentication. The following exemplifies several implementation processes for the ranging device 200 to initiate ranging (which can be understood as...). Figure 5 S103 and Figure 6 (Specific implementation example of S203).

[0232] Example 3 provides a ranging method, which may include, but is not limited to, the following steps: an electronic device 100 establishes a first communication connection with a ranging device 200 and completes protocol stack authentication; after establishing the first communication connection and completing protocol stack authentication, the electronic device 100 obtains one or more services of the ranging device 200 (including the second port number of the second service); after obtaining one or more services of the ranging device 200, the electronic device 100 binds the first port number of the first service of the electronic device 100, the second port number of the ranging device 200, and the first communication address of the ranging device 200; based on the bound first port number, second port number, and first communication address, the electronic device 100 completes application layer authentication with the ranging device 200; when both protocol stack authentication and application layer authentication are successful, the electronic device 100 and the ranging device 200 perform a ranging process to determine the relative position between the ranging device 200 and the electronic device 100. After establishing the first communication connection and completing the protocol stack authentication, the ranging device 200 obtains the first port number of the first service of the electronic device 100 from the electronic device 100, and the ranging device 200 completes application layer authentication with the electronic device 100 based on the obtained first port number.

[0233] The following is through Figure 7 The ranging method shown in Embodiment 3 is illustrated by way of example.

[0234] Figure 7 This is a flowchart illustrating another ranging method provided in the embodiments of this application. Figure 7 The method shown can be applied to Figure 1 The communication system 10 shown. Figure 7 The distance measuring device 200 shown can be Figure 2 The distance measuring device 200 shown. Figure 7 The distance measuring device 200 shown can be Figure 4 The distance measuring device 200 shown. Figure 7 The electronic device 100 shown may be Figure 3 The electronic device 100 shown.

[0235] Figure 7 The following is an example of an electronic device 100 including a first application and a StarScan protocol stack, and a ranging device 200 including a second application and a StarScan protocol stack. Figure 7 The explanation will be based on the example of the first communication connection being the first satellite flash connection.

[0236] Figure 7 The method shown may include, but is not limited to, the following steps:

[0237] S301. The StarScan protocol stack of electronic device 100 creates the first service of electronic device 100, corresponding to the first port number.

[0238] In one possible implementation, after the StarScan protocol stack of electronic device 100 starts, it can create a first service of electronic device 100. The port number of the first service is the first port number. Optionally, the port numbers of other services of electronic device 100 are different from the first port number of the first service. In some examples, after the StarScan protocol stack of electronic device 100 starts, it can create the first service of electronic device 100 by default. In other examples, after the StarScan protocol stack of electronic device 100 starts, and the first application of electronic device 100 starts, the StarScan protocol stack can create the first service under the instruction of the first application.

[0239] In one possible implementation, the first port number of the first service can be pre-set. In another possible implementation, the first port number of the first service can also be assigned in real time. For example, after the StarShine protocol stack of electronic device 100 starts and the first application of electronic device 100 starts, the first application sends the universally unique identifier (UUID) of the first service to the StarShine protocol stack, and the StarShine protocol stack assigns the first port number to the first service based on the UUID of the first service.

[0240] S302. The StarScan protocol stack of ranging device 200 creates a second service for ranging device 200, corresponding to the second port number.

[0241] S302 is similar to S301; for details, please refer to the description of S301.

[0242] S303. The star flash protocol stack of the ranging device 200 sends a star flash broadcast to the star flash protocol stack of the electronic device 100.

[0243] Figure 7 S303 and Figure 5 Similar to S101, see details. Figure 5 Explanation of S101.

[0244] S304. The first application of electronic device 100 scans the star flash broadcast sent by ranging device 200 through the star flash protocol stack.

[0245] S305. The first application of electronic device 100 indicates to the star flash protocol stack of electronic device 100 and the ranging device 200 to perform pairing connection.

[0246] S306. The star flash protocol stack of electronic device 100 and the star flash protocol stack of ranging device 200 establish a first star flash connection.

[0247] S307. The StarScan protocol stack of electronic device 100 and the StarScan protocol stack of ranging device 200 complete the pairing and authentication of StarScan.

[0248] In one possible implementation, after the first application of electronic device 100 scans the StarScan broadcast sent by ranging device 200 through the StarScan protocol stack, it can instruct the StarScan protocol stack to establish a connection with ranging device 200. Upon this instruction, electronic device 100 can establish a first StarScan connection through the StarScan protocol stack and the StarScan protocol stack of ranging device 200, and then complete pairing and authentication with the StarScan protocol stack of ranging device 200. The first StarScan connection shown in S306 can be understood as a protocol stack / link layer connection, and the authentication shown in S307 can be understood as a protocol stack / link layer authentication. Therefore, S306 and S307 can be simply referred to as protocol stack / link layer connection authentication. Figure 7 The authentication process of the protocol stack shown in S307 will be used as an example to illustrate the process.

[0249] S308. The StarScan protocol stack of the ranging device 200 requests the first service of the electronic device 100 from the StarScan protocol stack of the electronic device 100.

[0250] S309. The StarScan protocol stack of the ranging device 200 sends the first service information (including the first port number) of the electronic device 100 to the StarScan protocol stack of the electronic device 100.

[0251] In one possible implementation, once the protocol stack connection authentication between electronic device 100 and ranging device 200 is completed (i.e., after S306-S307), ranging device 200 can obtain the first service from electronic device 100, and thus S308-S309 can be executed.

[0252] In one possible implementation, the first service can be a Bluetooth serial port service over Bluetooth (SSAP), which can be a serial communication service based on Bluetooth / StarScan serial port profile (SPP). The ranging device 200 and the electronic device 100 can interact based on the SSAP reading implementation process, enabling the ranging device 200 to obtain information about the specified first service from the electronic device 100. This first service information includes the first port number of the first service.

[0253] S310. The Star Flash protocol stack of the ranging device 200 notifies the second application of the ranging device 200 that it has successfully obtained the port number of the electronic device 100.

[0254] S311. The star-flash protocol stack of the ranging device 200 is bound to the first port number of the electronic device 100, the second port number of the ranging device 200, and the communication address of the electronic device 100.

[0255] In one possible implementation, when the second application of the ranging device 200 receives a notification from the StarScan protocol stack that the port number of the electronic device 100 has been successfully acquired, it can instruct the StarScan protocol stack to initiate a port connection. Under the instruction of the second application, the StarScan protocol stack of the ranging device 200 can bind the first port number of the electronic device 100, the second port number of the ranging device 200, and the communication address of the electronic device 100 based on the communication address of the electronic device 100 obtained in S306 and the first port number of the electronic device 100 obtained in S309. The communication address of the electronic device 100 is the communication address used by the electronic device 100 when establishing the first StarScan connection with the ranging device 200. This binding relationship can be referred to as the binding relationship of the port connection established by the ranging device 200 and the electronic device 100. The communication address of the electronic device 100 in this binding relationship can be used, for example, as the destination address when the ranging device 200 communicates based on the port connection, i.e., the destination address when the ranging device 200 sends application layer data to the electronic device 100.

[0256] The binding relationship established by the ranging device 200 between the electronic device 100 and the port connection of the ranging device 200 can be used to transmit application layer data. The application layer data may include application layer authentication instructions; therefore, the binding relationship established by the ranging device 200 can be used to implement application layer authentication between the ranging device 200 and the electronic device 100.

[0257] Understandably, after S311, the second application of the ranging device 200 can transmit application layer data to the first application of the electronic device 100 based on the binding relationship established by the ranging device 200 in S311. However, after S311 and before S316 below, although the ranging device 200 has established a binding relationship for transmitting application layer data, the electronic device 100 has not established a binding relationship for transmitting application layer data. That is, the electronic device 100 has not bound its first port number, the second port number of the ranging device 200, and the first communication address of the ranging device 200 (i.e., S316 below has not been executed). Therefore, even if the electronic device 100 receives an application layer data request sent by the ranging device 200, it cannot determine whether the application layer data request was sent by the ranging device 200 through the second port number, nor can it determine whether the application layer data request was sent by the ranging device 200 for the first port number of the electronic device 100, and it cannot send an application layer data response from the first port number of the electronic device 100 to the second port number of the ranging device 200. Therefore, after S311 and before S316, the second application of the ranging device 200 fails to transmit application layer data with the first application of the electronic device 100.

[0258] S312. The StarScan protocol stack of electronic device 100 requests the StarScan protocol stack of ranging device 200 to obtain the service of ranging device 200.

[0259] S313. The StarScan protocol stack of the ranging device 200 sends information about multiple services of the ranging device 200 (including the second port number of the second service) to the StarScan protocol stack of the electronic device 100.

[0260] In one possible implementation, once the protocol stack connection authentication between the electronic device 100 and the ranging device 200 is completed (i.e., after S306-S307), the electronic device 100 can obtain multiple services from the ranging device 200, and thus S312-S313 can be executed.

[0261] In one possible implementation, the multiple services of the ranging device 200 may be SSAP. The ranging device 200 and the electronic device 100 may interact based on the SSAP reading implementation process, so that the electronic device 100 can obtain information about the multiple services of the ranging device 200 from the ranging device 200. This information includes information about a second service, which includes a second port number of the second service.

[0262] In one possible implementation, during S312-S313, the electronic device 100 can, based on the current scenario, first obtain higher-priority services from the ranging device 200, and then obtain lower-priority services from the ranging device 200. User needs can differ in different scenarios, and users with different needs can use services with different priorities.

[0263] S314. The StarSignal protocol stack of electronic device 100 notifies the first application of electronic device 100 that the pairing connection is complete.

[0264] In one possible implementation, after the StarScan protocol stack of electronic device 100 obtains multiple services from ranging device 200, it can notify the first application that the pairing connection is complete. This pairing connection completion can be understood as the pairing connection completion at the application layer.

[0265] S315. The first application of electronic device 100 instructs the StarSpark protocol stack of electronic device 100 to initiate a port connection.

[0266] S316. The StarScan protocol stack of electronic device 100 is bound to the first port number of electronic device 100, the second port number of ranging device 200, and the first communication address of ranging device 200.

[0267] In one possible implementation, when the first application of electronic device 100 receives a notification from the StarScan protocol stack indicating that the pairing connection is complete, it can instruct the StarScan protocol stack to initiate a port connection. Under the instruction of the first application, the StarScan protocol stack of electronic device 100 can bind the first port number of electronic device 100, the second port number of ranging device 200, and the first communication address of ranging device 200 based on the first communication address of ranging device 200 obtained in S306 and the second port number of ranging device 200 obtained in S313. The first communication address is the communication address used by ranging device 200 when establishing the first StarScan connection with electronic device 100. This binding relationship can be referred to as the binding relationship of the port connection established by electronic device 100 and ranging device 200. The first communication address of ranging device 200 in this binding relationship serves, for example, as the destination address when electronic device 100 communicates based on the port connection, i.e., the destination address when electronic device 100 sends application layer data to ranging device 200.

[0268] The binding relationship established by the electronic device 100 and the ranging device 200 through the port connection can be used to transmit application layer data. The application layer data may include application layer authentication instructions. Therefore, the binding relationship established by the electronic device 100 can be used to implement application layer authentication between the ranging device 200 and the electronic device 100. For specific examples, please refer to S317-S318.

[0269] S317. The second application of the ranging device 200 sends an application layer authentication request to the first application of the electronic device 100 for the first port number of the electronic device 100.

[0270] S318. The first application of the electronic device 100 sends an application layer authentication response to the second application of the ranging device 200 for the second port number of the ranging device 200.

[0271] In one possible implementation, after electronic device 100 executes S316 and ranging device 200 executes S311, since electronic device 100 has established the binding relationship for transmitting application layer data as shown in S316 and ranging device 200 has established the binding relationship for transmitting application layer data as shown in S311, ranging device 200 can send an application layer authentication request to the first port number of electronic device 100 through the second port number (i.e., execute S317). Electronic device 100 can also normally recognize the application layer authentication request sent by ranging device 200, and in response to the application layer authentication request, electronic device 100 can send an application layer authentication response to the second port number of ranging device 200 through the first port number (i.e., execute S318). S317 and S318 can be referred to as the application layer authentication process.

[0272] S319. When the application layer authentication is successful, the second application of the ranging device 200 instructs the ranging device 200's Star Flash protocol stack to perform ranging.

[0273] S320. The ranging device 200 and the electronic device 100 perform ranging using their respective star-flash protocol stacks.

[0274] In one possible implementation, when the application layer authentication shown in S317-S318 is successful, the ranging device 200 can perform distance measurement with the electronic device 100. In another possible implementation, when the application layer authentication shown in S317-S318 is unsuccessful, the ranging device 200 may not initiate distance measurement.

[0275] In one possible implementation, the ranging device 200 can acquire the relative position between the ranging device 200 and the electronic device 100 based on the ranging process shown in S320. The acquired relative position between the ranging device 200 and the electronic device 100 can be used by the ranging device 200 to select and execute control operations. For example, the ranging device 200 in... Figure 7 Previously, S320 was in a locked state. After the ranging device 200 executes S320, it can determine whether to perform an unlocking operation and / or output welcome lights based on the relative position obtained by S320. When the distance in the relative position is less than or equal to the preset welcome light distance, for example, when... Figure 1 When within area 1 as shown, the ranging device 200 can output a welcome light. This occurs when the distance between the relative positions is less than or equal to a preset unlocking distance (less than the welcome light distance), for example, when located in... Figure 1 When within area 3 shown, the ranging device 200 can perform an unlocking operation.

[0276] Not limited to Figure 7 In some examples, S319-S320, when the application layer authentication is successful, the StarScan protocol stack of the ranging device 200 can directly perform ranging with the StarScan protocol stack of the electronic device 100 without the instruction of the second application program. In this case, S319 is an optional step.

[0277] In one possible implementation, an example of the ranging process shown in S320 can be found in the ranging method shown in Embodiment 1. Therefore, Figure 7 The process shown and Figure 5 The process shown can be matched, where, Figure 7 S303-S304 can correspond to Figure 5 S101-S102, Figure 7 S305-S319 can be corresponding Figure 5 S103, Figure 7 The S320 is compatible Figure 5 S104-S112.

[0278] In another possible implementation, an example of the ranging process shown in S320 can be found in the ranging method shown in Embodiment 2. Therefore, Figure 7 The process shown and Figure 6 The process shown can be matched, where, Figure 7 S303-S304 can correspond to Figure 6 S201-S202, Figure 7 S305-S319 can be corresponding Figure 6 S203, Figure 7 The S320 is compatible Figure 6 S204-S214.

[0279] In one possible implementation, Figure 7 After the connection authentication of the protocol stack shown in S306-S307 is completed, the order in which electronic device 100 obtains services from ranging device 200 and the order in which ranging device 200 obtains services from electronic device 100 are not limited. Therefore, Figure 7 S308-S311 and Figure 7 The execution order of S312-S313 is not limited. However, it is understandable that the ranging device 200 generally obtains a specified first service from the electronic device 100, but the electronic device 100 obtains multiple services (such as all services) from the ranging device 200. Therefore, the speed at which the ranging device 200 obtains services from the electronic device 100 is generally faster than the speed at which the electronic device 100 obtains services from the ranging device 200. For example, the execution order of S308 and S312 is not limited, but S309 will be completed before S313, and S310-S311 after S309 may also be completed before S313.

[0280] exist Figure 7 In the method shown, for security reasons, the ranging device 200 initiates ranging to the electronic device 100, which requires the protocol stack connection authentication between the electronic device 100 and the ranging device 200 to be completed (i.e., it requires...). Figure 7 S306-S307 execution complete), and application layer certification of electronic device 100 and ranging device 200 is required (i.e., it requires...). Figure 7 (S317-S318 are executed). The application layer authentication process relies on the binding relationship established by the electronic device 100 for transmitting application layer data (i.e.,...). Figure 7 The binding relationship shown in S316), and the binding relationship established by the ranging device 200 for transmitting application layer data (i.e., requiring...). Figure 7 The binding relationship shown in S311). Establishing the binding relationship shown in S311 requires that the ranging device 200 has obtained the first port number of the electronic device 100 (i.e., it requires...). Figure 7 After S309 is completed, the establishment of the binding relationship shown in S316 requires that the electronic device 100 has obtained the second port number of the ranging device 200 (i.e., it requires...). Figure 7 (S313 execution completed). Understandably, the ranging device 200 typically obtains a specific first service from the electronic device 100, but the electronic device 100 obtains multiple services (such as all services) from the ranging device 200. For example, if the electronic device 100 is a mobile terminal and the ranging device 200 is a vehicle, then the speed at which the ranging device 200 obtains services from the electronic device 100 is generally faster than the speed at which the electronic device 100 obtains services from the ranging device 200. Figure 7 S309 completes execution before S313. Although S309 completes earlier and the ranging device 200 is ready earlier (S311 completes earlier), S313 completes later, so the electronic device 100 is ready later (S316 completes later, and the time required for the electronic device 100 to initiate the port connection shown in S305 to S315 is very long). This results in the application layer authentication between the electronic device 100 and the ranging device 200 being performed later (S317-S318 are performed later), so the ranging operation that can only be initiated after the application layer authentication is completed is performed later (S319-S320 are performed later). Therefore, the distance measurement initiated by the ranging device 200 and the electronic device 100 first involves the establishment of a first communication connection, protocol stack authentication, and application layer authentication. The application layer authentication takes a long time to complete, resulting in a slow distance measurement initiated by the ranging device 200 and a poor user experience. This is especially true in situations where a user carrying an electronic device 100 is already very close to the ranging device 200 and needs to perform distance measurement quickly (such as when a user carrying a mobile phone is very close to a vehicle when exiting an elevator). The slow distance measurement initiated by the ranging device 200 makes it impossible to execute control operations in a timely manner, resulting in a poor user experience such as being "stuck" in the station.

[0281] Example 4 provides a ranging method, which may include, but is not limited to, the following steps: An electronic device 100 establishes a first communication connection with a ranging device 200 and completes protocol stack authentication; after establishing the first communication connection and completing protocol stack authentication, the electronic device 100 binds its first port number, the second port number of the ranging device 200, and the first communication address of the ranging device 200; the electronic device 100 completes application layer authentication with the ranging device 200 based on the bound first port number, second port number, and first communication address; if both protocol stack authentication and application layer authentication are successful, the electronic device 100 and the ranging device 200 perform a ranging process to determine the relative position between them. Specifically, after establishing the first communication connection and completing protocol stack authentication, the ranging device 200 obtains the first port number of the electronic device 100's first service from the electronic device 100, and the ranging device 200 completes application layer authentication with the electronic device 100 based on the obtained first port number.

[0282] In one scenario, the second port number of the ranging device 200 is obtained by the electronic device 100 before the establishment of the first communication connection and the completion of protocol stack authentication. For example, the electronic device 100 has a pre-set second port number, or the electronic device 100 receives a broadcast data packet sent by the ranging device 200 before the establishment of the first communication connection and the completion of protocol stack authentication, and the broadcast data packet carries the second port number.

[0283] In another scenario (2), after establishing the first communication connection and completing protocol stack authentication, and before binding the first port number of electronic device 100, the second port number of ranging device 200, and the first communication address of ranging device 200, electronic device 100 obtains the second service (including the second port number) of ranging device 200 from ranging device 200. Furthermore, after binding the first port number of electronic device 100, the second port number of ranging device 200, and the first communication address of ranging device 200, electronic device 100 obtains other services of ranging device 200 from ranging device 200; or, during the binding of the first port number of electronic device 100, the second port number of ranging device 200, and the first communication address of ranging device 200, electronic device 100 simultaneously obtains other services of ranging device 200 from ranging device 200. The other services of ranging device 200 are at least one service other than the second service among the multiple services of ranging device 200.

[0284] The following is through Figure 8 The ranging method shown in Example 4 is illustrated by way of example. Figure 8 The following explanation will be based on the example of the second port number being preset in electronic device 100.

[0285] Figure 8 This is a flowchart illustrating another ranging method provided in the embodiments of this application. Figure 8 The method shown can be applied to Figure 1 The communication system 10 shown. Figure 8 The distance measuring device 200 shown can be Figure 2 The distance measuring device 200 shown. Figure 8 The distance measuring device 200 shown can be Figure 4 The distance measuring device 200 shown. Figure 8 The electronic device 100 shown may be Figure 3 The electronic device 100 shown.

[0286] Figure 8 The following is an example of an electronic device 100 including a first application and a StarScan protocol stack, and a ranging device 200 including a second application and a StarScan protocol stack. Figure 8 The explanation will be based on the example of the first communication connection being the first satellite flash connection.

[0287] Figure 8 The method shown may include, but is not limited to, the following steps:

[0288] S401. The StarScan protocol stack of electronic device 100 creates the first service of electronic device 100, corresponding to the first port number.

[0289] S402. The StarScan protocol stack of ranging device 200 creates a second service for ranging device 200, corresponding to the second port number.

[0290] S403. The star flash protocol stack of the ranging device 200 sends a star flash broadcast to the star flash protocol stack of the electronic device 100.

[0291] S404. The first application of electronic device 100 scans the star flash broadcast sent by ranging device 200 through the star flash protocol stack.

[0292] S405. The first application of electronic device 100 instructs the electronic device 100's Star Flash protocol stack and the ranging device 200 to establish a pairing connection.

[0293] S406. The StarScan protocol stack of electronic device 100 and the StarScan protocol stack of ranging device 200 establish a first StarScan connection.

[0294] S407. The StarScan protocol stack of electronic device 100 and the StarScan protocol stack of ranging device 200 complete the pairing and authentication of StarScan.

[0295] Figure 8 S401-S407 and Figure 7 Similar to S301-S307, see details below. Figure 7 The descriptions of S301-S307, where S406 and S407 can be simply referred to as protocol stack / link layer connection authentication. Figure 8 The authentication process of the protocol stack shown in S407 will be used as an example to illustrate the process.

[0296] S408. The Star Flash protocol stack of electronic device 100 notifies the first application of electronic device 100 that the protocol stack connection authentication is complete.

[0297] S409. The first application of electronic device 100 instructs the StarSpark protocol stack of electronic device 100 to initiate a port connection.

[0298] In one possible implementation, when the protocol stack connection authentication between the electronic device 100 and the ranging device 200 is completed (i.e., after S406-S407), the Star Flash protocol stack of the electronic device 100 can directly notify the first application so that the first application can instruct the Star Flash protocol stack of the electronic device 100 to initiate a port connection.

[0299] S410. When the electronic device 100 has a second port number of the ranging device 200 pre-configured, the StarScan protocol stack of the electronic device 100 binds the first port number of the electronic device 100, the second port number of the ranging device 200, and the first communication address of the ranging device 200.

[0300] In one possible implementation, the second port number of the second service of the ranging device 200 can be a fixed port number, such as 0xA000 for services like smart car selection, wallet service, and short-distance service. The electronic device 100 can pre-store the second port number of the second service of the ranging device 200.

[0301] In one possible implementation, when the StarSignal protocol stack of electronic device 100 receives an instruction from the first application to initiate a port connection, it can bind the first port number of electronic device 100, the second port number of ranging device 200, and the first communication address of ranging device 200 based on the first communication address of ranging device 200 obtained in S406 and the preset second port number of ranging device 200. The first communication address is the communication address used by ranging device 200 when establishing the first StarSignal connection with electronic device 100. This binding relationship can be referred to as the port connection binding relationship established by electronic device 100 and ranging device 200. The first communication address of ranging device 200 in this binding relationship serves, for example, as the destination address when electronic device 100 communicates based on the port connection, i.e., the destination address when electronic device 100 sends application layer data to ranging device 200. This port connection binding relationship established by electronic device 100 and ranging device 200 can be used to transmit application layer data. Application layer data may include application layer authentication instructions. Therefore, the binding relationship established by the electronic device 100 can be used to realize application layer authentication between the ranging device 200 and the electronic device 100. For specific examples, please refer to S415-S416.

[0302] S411. The StarScan protocol stack of the ranging device 200 requests the first service of the electronic device 100 from the StarScan protocol stack of the electronic device 100.

[0303] S412. The StarScan protocol stack of the ranging device 200 sends the first service information (including the first port number) of the electronic device 100 to the StarScan protocol stack of the electronic device 100.

[0304] S413. The Star Flash protocol stack of the ranging device 200 notifies the second application of the ranging device 200 that it has successfully acquired the port number of the electronic device 100.

[0305] S414. The star-flash protocol stack of the ranging device 200 is bound to the first port number of the electronic device 100, the second port number of the ranging device 200, and the communication address of the electronic device 100.

[0306] In one possible implementation, after the protocol stack connection authentication between electronic device 100 and ranging device 200 is completed (i.e., after S406-S407), ranging device 200 can obtain the first service from electronic device 100, and therefore S411-S412 can be executed. Example illustrations of S411-S412 can be found in [reference needed]. Figure 7 The following describes steps S308-S309. When the second application of the ranging device 200 receives a notification from the StarScan protocol stack that the port number of the electronic device 100 has been successfully acquired, it can instruct the StarScan protocol stack to initiate a port connection. Under the instruction of the second application, the StarScan protocol stack of the ranging device 200 can bind the first port number of the electronic device 100, the second port number of the ranging device 200, and the communication address of the electronic device 100 based on the communication address of the electronic device 100 obtained in S406 and the first port number of the electronic device 100 obtained in S412. The communication address of the electronic device 100 is the communication address used by the electronic device 100 when the ranging device 200 and the electronic device 100 establish the first StarScan connection. The aforementioned binding relationship can be referred to as the binding relationship between the electronic device 100 and the port connection established by the ranging device 200. The communication address of the electronic device 100 in this binding relationship can be used as the destination address when the ranging device 200 communicates based on the port connection, that is, the destination address when the ranging device 200 sends application layer data to the electronic device 100.

[0307] The binding relationship established by the ranging device 200 between the electronic device 100 and the port connection of the ranging device 200 can be used to transmit application layer data. The application layer data may include application layer authentication instructions. Therefore, the binding relationship established by the ranging device 200 can be used to implement application layer authentication between the ranging device 200 and the electronic device 100. For specific examples, please refer to S415-S416.

[0308] The execution order of S408-S410 and S411-S414 is not limited. For example, they can be executed simultaneously to achieve progress synchronization between electronic device 100 and ranging device 200, thereby accelerating the completion of application layer authentication shown in S415-S416.

[0309] S415. The second application of the ranging device 200 sends an application layer authentication request to the first application of the electronic device 100 for the first port number of the electronic device 100.

[0310] S416. The first application of the electronic device 100 sends an application layer authentication response to the second application of the ranging device 200 for the second port number of the ranging device 200.

[0311] In one possible implementation, after electronic device 100 executes S410 and ranging device 200 executes S414, since electronic device 100 has already established the binding relationship shown in S410 for transmitting application layer data, and ranging device 200 has also established the binding relationship shown in S414 for transmitting application layer data, ranging device 200 can send an application layer authentication request to the first port number of electronic device 100 through the second port number (i.e., execute S415). Electronic device 100 can also normally recognize the application layer authentication request sent by ranging device 200, and in response to the application layer authentication request, electronic device 100 can send an application layer authentication response to the second port number of ranging device 200 through the first port number (i.e., execute S416). S415 and S416 can be referred to as the application layer authentication process.

[0312] S417. When the application layer authentication is successful, the second application of the ranging device 200 instructs the ranging device 200's Star Flash protocol stack to perform ranging.

[0313] S418. The ranging device 200's star flash protocol stack and the electronic device 100's star flash protocol stack perform ranging.

[0314] Figure 8 S417-S418 and Figure 7 Similar to S319-S320, see details. Figure 7 Description of S319-S320.

[0315] In one possible implementation, an example of the ranging process shown in S418 can be found in the ranging method shown in Embodiment 1. Therefore, Figure 8 The process shown and Figure 5 The process shown can be matched, where, Figure 8 S403-S404 can correspond to Figure 5 S101-S102, Figure 8 S405-S417 can be corresponding Figure 5 S103, Figure 8 The S418 can be compatible Figure 5 S104-S112.

[0316] In another possible implementation, an example of the ranging process shown in S418 can be found in the ranging method shown in Embodiment 2. Therefore, Figure 8 The process shown and Figure 6 The process shown can be matched, where, Figure 8 S403-S404 can correspond to Figure 6 S201-S202, Figure 8 S405-S417 can be corresponding Figure 6 S203, Figure 8 The S418 can be compatible Figure 6 S204-S214.

[0317] S419. The StarScan protocol stack of electronic device 100 requests the StarScan protocol stack of ranging device 200 to obtain the service of ranging device 200.

[0318] S420. The StarScan protocol stack of the ranging device 200 sends information about multiple services of the ranging device 200 (including the second port number of the second service) to the StarScan protocol stack of the electronic device 100.

[0319] In one possible implementation, once the protocol stack connection authentication between electronic device 100 and ranging device 200 is completed (i.e., after S406-S407), electronic device 100 can obtain multiple services from ranging device 200, thus S419-S420 can be executed. Example descriptions of S419-S420 can be found in [reference needed]. Figure 7 Explanation of S312-S313.

[0320] S421. The StarSignal protocol stack of electronic device 100 notifies the first application of electronic device 100 that the pairing connection is complete.

[0321] In one possible implementation, after the StarScan protocol stack of electronic device 100 obtains multiple services from ranging device 200, it can notify the first application that the pairing connection is complete. This pairing connection completion can be understood as the pairing connection completion at the application layer.

[0322] in, Figure 8 The implementation order of S408-S418 and S419-S421 is not limited; for example, they can be executed simultaneously. However, it is understandable that the ranging device 200 typically obtains a specified first service from the electronic device 100, while the electronic device 100 obtains multiple services (such as all services) from the ranging device 200. Therefore, the speed at which the ranging device 200 obtains services from the electronic device 100 is generally faster than the speed at which the electronic device 100 obtains services from the ranging device 200, and the electronic device 100 establishes the binding relationship shown in S410 very quickly. Therefore, Figure 8 S408-S416 will complete execution before S420.

[0323] exist Figure 8In the method shown, the electronic device 100 can preset the second port number of the ranging device 200, and the electronic device 100 can send a corresponding notification to the first application through the StarSpark protocol stack after the protocol stack connection authentication is completed (i.e., after S406-S407) (i.e., execute S408). In this way, the StarSpark protocol stack can immediately establish a binding relationship for transmitting application layer data in S410 after the protocol stack connection authentication is completed, thereby performing application layer authentication. Compared to Figure 7 In the method shown, the electronic device 100 obtains multiple services from the ranging device 200 before establishing a binding relationship and performing application layer authentication. Figure 8 In the method shown, electronic device 100 establishes a binding relationship and performs application layer authentication after the protocol stack connection authentication is completed. The execution of S410 and S415-S416 does not depend on the completion of S420, which greatly speeds up the process of electronic device 100 establishing a binding relationship. For example, Figure 7 The time required for the electronic device 100 shown in S305 to S315 to initiate the port (e.g., 3.3 seconds) is greater than Figure 8 The time required for the electronic device 100 to initiate a port connection, as shown in S405-S409, is reduced by 2 (e.g., 1.5 seconds), and the latency of initiating a port connection is halved. This speeds up the completion of application layer authentication, thereby speeding up the initiation of ranging by the ranging device 200. This allows the ranging device 200 to measure distances and execute control operations in a timely manner, avoiding poor user experience such as users being "forced to stand still," and effectively improving the user experience.

[0324] In Example 4, Figure 8 The following explanation uses an electronic device 100 pre-configured with the second port number of the ranging device 200 as an example. In another possible implementation, before the electronic device 100 and the ranging device 200 establish a first communication connection and complete protocol stack authentication, the electronic device 100 can receive a broadcast data packet sent by the ranging device 200. This broadcast data packet carries the second port number, and the electronic device 100 can obtain the second port number of the ranging device 200 based on this broadcast data packet. A specific process example is provided below. Figure 8 Similarly, the implementation process is illustrated below. Figure 8 The differences in the illustrated processes. In this implementation, Figure 8 The star-bomb broadcast in S403 can carry the second port number of the second service of the ranging device 200. Figure 8 In S404, when the first application of electronic device 100 scans the star flash broadcast sent by ranging device 200 through the star flash protocol stack, it can obtain the second port number carried by the star flash broadcast. Figure 8 In the S410, electronic device 100 can bind a first port number, a second port number, and a first communication address based on a second port number obtained from the Starlight Broadcast. Optionally, Figure 8 The star-bomb broadcast in S403 can carry not only information about the second service of the ranging device 200, but also information about other services besides the second service among the multiple services of the ranging device 200. The electronic device 100 can obtain the information of these other services based on the broadcast data packet. Therefore, the electronic device 100 does not need to obtain services from the ranging device 200, and can therefore not perform any operations. Figure 8 S419-S420 and S421 can be executed after S411-S412. This implementation can achieve... Figure 8 The method shown improves the speed at which the ranging device 200 initiates ranging, thereby effectively enhancing the user experience.

[0325] In another possible implementation, when electronic device 100 obtains services from ranging device 200, it can first obtain the second service (including the second port number) of ranging device 200, and then subsequently obtain the other services from the multiple services of ranging device 200 besides the second service. After the protocol stack connection authentication is completed and the second port number is obtained, electronic device 100 establishes a binding relationship for transmitting application layer data, without waiting for electronic device 100 to obtain all the multiple services of ranging device 200. A specific process example is provided below. Figure 8 Similarly, the implementation process is illustrated below. Figure 8 The differences in the illustrated processes. In this implementation, Figure 8After S406-S407 are completed, the following can be executed: The StarScan protocol stack of electronic device 100 requests the StarScan protocol stack of ranging device 200 to obtain the second service of ranging device 200. The StarScan protocol stack of ranging device 200 sends the information of the second service of ranging device 200 (including the second port number) to the StarScan protocol stack of electronic device 100. After receiving the information of the second service of ranging device 200, the StarScan protocol stack of electronic device 100 can execute S408. Then, when executing S410, electronic device 100 can bind the first port number, the second port number, and the first communication address based on the second port number obtained above. In S419-S420, electronic device 100 can obtain other services of ranging device 200 from ranging device 200. At this time, the execution order of S419-S420 and S408-S418 is not limited, but generally, ranging device 200 has many other services, so S408-S416 will be completed before S420. This implementation allows electronic device 100 to obtain only the specified second service from ranging device 200 before establishing a binding relationship, without needing to obtain multiple services from ranging device 200. This significantly speeds up the process of establishing a binding relationship and effectively reduces the latency of initiating a port connection. This accelerates the application layer authentication process, thereby speeding up the ranging device 200's initiation of ranging. This allows the ranging device 200 to measure distances and execute control operations promptly, avoiding poor user experiences such as users feeling "stuck" or "forced to stand still," and effectively improving the user experience.

[0326] Not limited to the descriptions of Embodiments 3 and 4, in other examples, the descriptions of electronic device 100 and ranging device 200 can be interchanged. Electronic device 100 obtains a specific service from ranging device 200, and ranging device 200 obtains multiple services from electronic device 100. Compared to Embodiment 3, in Embodiment 4, ranging device 200 pre-establishes a binding relationship for transmitting application layer data. The specific implementation is similar and will not be described again.

[0327] In embodiments 3 and 4 above, the ranging device 200 and the electronic device 100 perform ranging after completing protocol stack authentication and application layer authentication. However, this is not a limitation. In other embodiments, the ranging device 200 and the electronic device 100 may perform ranging immediately after completing protocol stack authentication, and perform application layer authentication simultaneously with ranging, or perform application layer authentication after ranging. After application layer authentication is completed, the ranging device 200 can choose whether to respond to the ranging result and / or whether to continue ranging based on the authentication result of the application layer authentication. A specific example can be found in embodiment 5 below.

[0328] Example 5 provides a ranging method, which may include, but is not limited to, the following steps: a ranging device 200 establishes a first communication connection with an electronic device 100 and completes protocol stack authentication; after establishing the first communication connection and completing protocol stack authentication, the ranging device 200 and the electronic device 100 perform a ranging process, and the ranging device 200 and the electronic device 100 perform application layer authentication, the ranging process being used to determine the relative position between the ranging device 200 and the electronic device 100; wherein the ranging process and the application layer authentication are performed simultaneously, or the ranging process is performed before the application layer authentication.

[0329] The following is through Figure 9 The ranging method shown in Example 5 is illustrated by way of example.

[0330] Figure 9 This is a flowchart illustrating another ranging method provided in the embodiments of this application. Figure 9 The method shown can be applied to Figure 1 The communication system 10 shown. Figure 9 The distance measuring device 200 shown can be Figure 2 The distance measuring device 200 shown. Figure 9 The distance measuring device 200 shown can be Figure 4 The distance measuring device 200 shown. Figure 9 The electronic device 100 shown may be Figure 3 The electronic device 100 shown.

[0331] Figure 9 The following is an example of an electronic device 100 including a first application and a StarScan protocol stack, and a ranging device 200 including a second application and a StarScan protocol stack. Figure 9 The explanation will be based on the example of the first communication connection being the first satellite flash connection.

[0332] Figure 9 The method shown may include, but is not limited to, the following steps:

[0333] S501. The StarScan protocol stack of electronic device 100 creates the first service of electronic device 100, corresponding to the first port number.

[0334] S502. The StarScan protocol stack of ranging device 200 creates a second service for ranging device 200, corresponding to the second port number.

[0335] S503. The star flash protocol stack of the ranging device 200 sends a star flash broadcast to the star flash protocol stack of the electronic device 100.

[0336] S504. The first application of electronic device 100 scans the star flash broadcast sent by ranging device 200 through the star flash protocol stack.

[0337] S505. The first application of electronic device 100 instructs the star flash protocol stack of electronic device 100 to perform pairing connection with ranging device 200.

[0338] S506. The star flash protocol stack of electronic device 100 and the star flash protocol stack of ranging device 200 establish a first star flash connection.

[0339] S507. The StarScan protocol stack of electronic device 100 and the StarScan protocol stack of ranging device 200 complete the pairing and authentication of StarScan.

[0340] Figure 9 S501-S507 and Figure 7 Similar to S301-S307, see details below. Figure 7 The descriptions of S301-S307, where S506 and S507 can be simply referred to as protocol stack / link layer connection authentication. Figure 9 The authentication process of the protocol stack shown in S507 is illustrated as an example of successful authentication.

[0341] S508. The starlight protocol stack of the ranging device 200 notifies the second application of the ranging device 200 that the protocol stack connection authentication is complete.

[0342] S509. The second application program of the ranging device 200 instructs the ranging device 200's Star Flash protocol stack to perform ranging.

[0343] S510. The ranging device 200's star flash protocol stack and the electronic device 100's star flash protocol stack perform ranging.

[0344] In one possible implementation, when the protocol stack connection authentication between electronic device 100 and ranging device 200 is completed (i.e., after S506-S507), the star-flash protocol stack of ranging device 200 can directly notify the second application, so that the second application can instruct the star-flash protocol stack of electronic device 100 to perform ranging. In S510, under the instruction of the second application, the star-flash protocol stack of ranging device 200 can perform ranging with the star-flash protocol stack of electronic device 100 and obtain the relative position between ranging device 200 and electronic device 100 (i.e., ranging result). The ranging device 200 can determine whether to respond to the ranging result after the application layer authentication is completed, as detailed in S522 below.

[0345] Not limited to Figure 9In the example of S509-S510, in some other examples, after the protocol stack connection authentication is completed (i.e. after S506-S507), the star flash protocol stack of the ranging device 200 can directly perform ranging with the star flash protocol stack of the electronic device 100 (i.e., execute S510) without the need for instructions from a second application program. In this case, S509 is an optional step, and S508 can also be an optional step.

[0346] In one possible implementation, an example of the ranging process shown in S510 can be found in the ranging method shown in Embodiment 1. Therefore, Figure 9 The process shown and Figure 5 The process shown can be matched, where, Figure 9 S503-S504 can be corresponding Figure 5 S101-S102, Figure 9 S505-S509 can be corresponding Figure 5 S103, Figure 9 The S510 can be compatible Figure 5 S104-S112.

[0347] In another possible implementation, an example of the ranging process shown in S510 can be found in the ranging method shown in Embodiment 2. Therefore, Figure 9 The process shown and Figure 6 The process shown can be matched, where, Figure 9 S503-S504 can be corresponding Figure 6 S201-S202, Figure 9 S505-S509 can be corresponding Figure 6 S203, Figure 9 The S510 can be compatible Figure 6 S204-S214.

[0348] S511. The StarScan protocol stack of the ranging device 200 requests the first service of the electronic device 100 from the StarScan protocol stack of the electronic device 100.

[0349] S512. The StarScan protocol stack of the ranging device 200 sends the first service information (including the first port number) of the electronic device 100 to the StarScan protocol stack of the electronic device 100.

[0350] S513. The Star Flash protocol stack of the ranging device 200 notifies the second application of the ranging device 200 that it has successfully obtained the port number of the electronic device 100.

[0351] S514. The star-flash protocol stack of the ranging device 200 is bound to the first port number of the electronic device 100, the second port number of the ranging device 200, and the communication address of the electronic device 100.

[0352] S515. The StarScan protocol stack of electronic device 100 requests the StarScan protocol stack of ranging device 200 to obtain the service of ranging device 200.

[0353] S516. The StarScan protocol stack of the ranging device 200 sends information about multiple services of the ranging device 200 (including the second port number of the second service) to the StarScan protocol stack of the electronic device 100.

[0354] S517. The StarScan protocol stack of electronic device 100 notifies the first application of electronic device 100 that the pairing connection is complete.

[0355] S518. The first application of electronic device 100 instructs the StarScan protocol stack of electronic device 100 to initiate a port connection.

[0356] S519. The StarScan protocol stack of electronic device 100 is bound to the first port number of electronic device 100, the second port number of ranging device 200, and the first communication address of ranging device 200.

[0357] S520. The second application of the ranging device 200 sends an application layer authentication request to the first application of the electronic device 100 for the first port number of the electronic device 100.

[0358] S521. The first application of the electronic device 100 sends an application layer authentication response to the second application of the ranging device 200 for the second port number of the ranging device 200.

[0359] Figure 9 S511-S521 and Figure 7 Similar to S308-S318, see details below. Figure 7 Description of S308-S318.

[0360] In one possible implementation, Figure 9 After the connection authentication of the protocol stack shown in S506-S507 is completed, the order in which the ranging device 200 initiates ranging and the application layer connection authentication between the ranging device 200 and the electronic device 100 is not limited. Therefore, Figure 9 S508-S510 and Figure 9 The implementation order of S511-S521 is not limited. Figure 9S511-S517 can be considered the application layer connection process, S518-S519 can be understood as the application layer authentication preparation process, and S520-S521 is the application layer authentication execution process. However, it is understandable that application layer connection authentication requires service reading from both the electronic device 100 and the ranging device 200. Therefore, the ranging device 200 initiates ranging faster than the application layer connection authentication completes; that is, S510 completes before S517, and S510 completes before S520-S521.

[0361] S522. When the application layer authentication is successful, the second application program of the ranging device 200 responds with the ranging result; when the application layer authentication fails, it does not respond with the ranging result.

[0362] In one possible implementation, the electronic device 100 and the ranging device 200 can perform one or more ranging measurements. When the application layer authentication shown in S520-S521 is successful, the ranging device 200 and the electronic device 100 can continue the ranging shown in S510 even if the ranging shown in S510 is not completed, and subsequent ranging measurements can be performed. When the application layer authentication shown in S520-S521 is unsuccessful, the ranging device 200 and the electronic device 100 can terminate the ranging shown in S510 even if the ranging shown in S510 is not completed, and no further ranging measurements will be performed. Optionally, the ranging device 200 can directly disconnect the first satellite flash connection with the electronic device 100.

[0363] In one possible implementation, after the ranging device 200 completes the ranging process shown in S510, it can determine the ranging result to trigger the execution of control operation 1 based on the obtained ranging result. When the application layer authentication shown in S520-S521 is successful, the ranging device 200 can determine to respond to the above ranging result, that is, to execute control operation 1. When the application layer authentication shown in S520-S521 is unsuccessful, the ranging device 200 can determine not to respond to the ranging result, that is, not to execute control operation 1. For example, the ranging device 200 in... Figure 9Before step S522, the ranging device 200 is in a locked state. It executes the ranging process shown in S510 and obtains the relative position (including distance) between itself and the electronic device 100. Assuming this distance is less than or equal to a preset unlocking distance, the ranging device 200 determines that the ranging result obtained in S510 is used to trigger the unlocking operation. The ranging device 200 performs application layer authentication as shown in S520-S521 and obtains the authentication result. When the application layer authentication is successful, the ranging device 200 can execute the unlocking operation corresponding to the ranging result obtained in S510. When the application layer authentication fails, the ranging device 200 can choose not to execute the unlocking operation and remain in a locked state. Optionally, the ranging device 200 can directly disconnect the first starlight connection with the electronic device 100.

[0364] In another possible implementation, after the ranging device 200 completes the ranging process shown in S510, it can determine that the ranging result is not used to trigger any control operation based on the obtained ranging result. Therefore, in S522, the control operation can be not executed by default.

[0365] exist Figure 9 In the method shown, the ranging device 200 can initiate ranging with the electronic device 100 (i.e., execute S508-S510) after the protocol stack connection authentication is completed (i.e., after S506-S507). Compared to Figure 7 In the method shown, the ranging device 200 initiates ranging only after completing application layer connection authentication. Figure 9 In the method shown, the ranging device 200 initiates ranging as soon as the protocol stack connection is completed, without waiting for the electronic device 100 and the ranging device 200 to read each other's services and complete application layer authentication. This greatly speeds up the ranging device 200's ranging initiation. After application layer authentication is complete, the ranging device 200 can choose whether to respond to the obtained or upcoming ranging result based on the authentication result. This achieves the effect of "measuring first, and responding directly to the ranging result after successful application layer authentication," allowing the ranging device 200 to measure distance and execute control operations promptly. This avoids poor user experience, such as users being "forced to stand still," effectively improving the user experience.

[0366] Not limited to the descriptions of Embodiments 3 and 5, in other examples, the descriptions of electronic device 100 and ranging device 200 can be interchanged. Electronic device 100 obtains a specific service from ranging device 200, and ranging device 200 obtains multiple services from electronic device 100. Compared to Embodiment 3, in Embodiment 5, electronic device 100 initiates ranging with ranging device 200 earlier, after protocol stack connection authentication is completed. The specific implementation is similar and will not be described again.

[0367] Not limited to embodiments 3-5 above, in other embodiments, the electronic device 100 may not obtain services from the ranging device 200, and / or the ranging device 200 may not obtain services from the electronic device 100. For example, when the electronic device 100 does not obtain services from the ranging device 200, the electronic device 100 may have a second port number of the second service of the ranging device 200 pre-configured, or obtain the second port number through a broadcast data packet sent by the ranging device 200, etc. For example, when the ranging device 200 does not obtain services from the electronic device 100, the ranging device 200 may have a first port number of the first service of the electronic device 100 pre-configured, etc. The following uses embodiment 3 as an example. Figure 7 The implementation process of this embodiment is illustrated by way of example. For example, the ranging device 200 and the electronic device 100 can perform... Figure 7 S301-S307, then the ranging device 200 can execute S311, and the electronic device 100 can directly execute S314-S316. Next, the ranging device 200 and the electronic device 100 can execute S317-S318, and finally execute S319-S320. Other steps can be omitted.

[0368] Example 6 provides a ranging method, which may include, but is not limited to, the following steps: a ranging device 200 performs a ranging process with an electronic device 100 and acquires one or more ranging information; the ranging device 200 sends a first data packet to the electronic device 100, the first data packet carrying the one or more ranging information. For example, the electronic device 100 displays a user interface based on the one or more ranging information, and / or the electronic device 100 sends the one or more ranging information to a cloud server 300.

[0369] In the method shown in Embodiment 6, the ranging device 200 can send the ranging information obtained during the ranging process with the electronic device 100 to the electronic device 100. This way, even if the ranging device 200 is unable to store the ranging information, it can still record the ranging information through the communicable electronic device 100, preventing information loss. For example, the ranging device 200 is a vehicle, and the electronic device 100 is a mobile terminal. If the ranging device 200 is in a locked state, and authentication between the ranging device 200 and the electronic device 100 fails, causing the ranging device 200 to not perform the unlocking operation based on the ranging result, resulting in the user being "forced to stand still," the ranging device 200's chip storage capacity is limited, and most modules of the ranging device 200 are not woken up before unlocking, preventing it from storing the ranging information obtained during the ranging process. In this case, the ranging device 200 can send the ranging information to the communicable electronic device 100 for recording.

[0370] The following is through Figure 10 The ranging method shown in Example 6 is illustrated by way of example.

[0371] Figure 10 This is a flowchart illustrating another ranging method provided in the embodiments of this application. Figure 10 The method shown can be applied to Figure 1 The communication system 10 shown. Figure 10 The method shown can also be applied to communication systems including electronic device 100, ranging device 200 and cloud server 300. Figure 10 The distance measuring device 200 shown can be Figure 2 The distance measuring device 200 shown. Figure 10 The distance measuring device 200 shown can be Figure 4 The distance measuring device 200 shown. Figure 10 The electronic device 100 shown may be Figure 3 The electronic device 100 shown.

[0372] In one possible implementation, Figure 10 The cloud server 300 shown can be an application server corresponding to the application of the electronic device 100, such as an application server corresponding to a wallet application or a digital key application. In another possible implementation, Figure 10 The cloud server 300 shown can also be the server corresponding to the ranging device 200. For example, if the ranging device 200 is a vehicle, the cloud server 300 is the vehicle's cloud server. This application embodiment does not limit the type of cloud server 300.

[0373] Figure 10 The method shown may include, but is not limited to, the following steps:

[0374] S601. The electronic device 100 and the ranging device 200 perform distance measurement, wherein the ranging device 200 obtains one or more distance measurement information.

[0375] In one possible implementation, the ranging device 200 and the electronic device 100 can perform distance measurement via a first communication method (e.g., short-range communication), and the ranging device 200 can obtain one or more distance measurement information. Examples of distance measurement implementations can be found in embodiments 1 to 5 above. Figure 10 The S601 can be corresponding Figure 5 The process shown, or the corresponding Figure 6 The process shown, or the corresponding Figure 7 The process shown, or the corresponding Figure 8 The process shown (e.g.) Figure 8 (S401-S418), or the corresponding Figure 9 The process shown (e.g.) Figure 9(S501-S510).

[0376] Among them, a ranging information may be, but is not limited to, any of the following: the distance between electronic device 100 and ranging device 200 in the ranging result (which may be referred to as the final ranging distance), the relative orientation between electronic device 100 and ranging device 200 in the ranging result (which may be referred to as the final ranging orientation), the original ranging value obtained by ranging device 200 during the ranging process (such as the original ranging distance / original RSSI), the filtered ranging value obtained by ranging device 200 after filtering the original ranging value (such as the filtered ranging distance / filtered RSSI), the area positioning result (i.e., the relative position value set by ranging device 200 to trigger the execution of control operation, taking the distance value set by ranging device 200 to execute control operation as an example), the algorithm feature value obtained by ranging device 200 when using the algorithm to obtain the ranging result, and the ranging feature value used for dimensional measurement (for example, the intermediate value involved when ranging device 200 obtains the ranging result).

[0377] S602. The ranging device 200 sends a first data packet to the electronic device 100, the first data packet carrying one or more ranging information.

[0378] In one possible implementation, the ranging device 200 can send a first data packet to the electronic device 100 via a second communication method. The second communication method may be the same as or different from the first communication method.

[0379] In one possible implementation, the first data packet carries K range information items, where K is a positive integer. The first data packet carries K range information items, including: K type indication information items and K values ​​for the K range information items, wherein one of the type indication information items indicates the type of one of the K range information items, and one of the K values ​​is the value of one of the K range information items. Optionally, the first data packet may also carry K lengths for the K range information items, wherein one of the K lengths is the length of one of the K range information items.

[0380] In one possible implementation, the first data packet may include a header, a body, and optionally a checksum. The checksum can be used to verify whether the first data packet has changed during data transmission. For example, the checksum is the checksum of the header and body, and can be checked using a cyclic redundancy check (CRC) 16 (e.g., in CCITT mode, with an initial value of 0xFFFF). The checksum length is, for example, 2 bytes.

[0381] In one possible implementation, the body of the first data packet may include K type-length-value (TLVs), which can be referred to as the payload in the body. Each of the K TLVs corresponds to one of the K ranging information pieces, and one of the K TLVs represents one of the ranging information pieces. A TLV may include one or more of the following: Type, Length, and Value. Specifically, the Type field in a TLV of the first data packet indicates the type of the corresponding ranging information piece, the Value field in a TLV of the first data packet indicates the value of the corresponding ranging information piece, and the Length field in a TLV of the first data packet indicates the length of the corresponding ranging information piece (i.e., the length of the Value field). Table 1 below illustrates some examples of the Type field in TLVs and the types of ranging information they indicate.

[0382] Table 1

[0383]

[0384]

[0385] In one possible implementation, the header of the first data packet may include, but is not limited to, one or more of the following fields: start of frame (SOF), length, protocol control field, and frame sequence number (FSN). In some examples, the header of the first data packet may include at least the FSN. The fields in the header of the first data packet described above are illustrated in Table 2 below.

[0386] Table 2

[0387]

[0388] In one possible implementation, the Control field in the header of the first data packet may include 8 bits, namely bits 0 to 7, each bit can be 0 or 1. The value of at least one bit in the Control field can indicate a different meaning. The bits in the Control field are illustrated in Table 3 below.

[0389] Table 3

[0390]

[0391] This application uses a Request packet as an example to illustrate the embodiments. For instance, bit 4 in the Control field of the first data packet is set to 1.

[0392] In some examples, the ranging device 200 can encrypt the Body in the first data packet. The ranging device 200 can transmit the plaintext Body to its security chip, where the security chip encrypts the plaintext Body, for example using AES128CBC encryption, with the encryption key being the session key and the initial IV being the session IV. The padding method is ALG_AES_CBC_ISO9797_M2. In this case, the encryption indicator bit in the Control field of the first data packet can indicate that the Body is encrypted, with a value of, for example, 1. In other examples, the ranging device 200 may not encrypt the Body in the first data packet, but instead directly send the first data packet containing the plaintext Body to the peer device. In this case, the encryption indicator bit in the Control field of the first data packet can indicate that the Body is not encrypted, with a value of, for example, 0.

[0393] In some examples, the first data packet is a Request packet. When the response indicator bit in the Control of the first data packet indicates that the response mechanism is synchronous (e.g., a value of 0), the device receiving the first data packet can return a Response packet to the ranging device 200, and this Response packet must carry relevant parameters of the execution result. For example, the device receiving the first data packet needs to return a Response packet to the ranging device 200 within a preset time (e.g., within 1 second), and the ranging device 200 can preset the number of retries to send the first data packet (e.g., 3 times). When the response indicator bit in the Control of the first data packet indicates that the response mechanism is asynchronous (e.g., a value of 1), the device receiving the first data packet can synchronously return a Response packet to the ranging device 200. For example, this Response packet indicates that the first data packet has been received, and the device receiving the first data packet can send a notification message to the ranging device 200 after executing according to the first data packet to notify the ranging device 200 of the execution result. Understandably, when the response indicator bit in the control of the first data packet indicates that the device receiving the first data packet can respond to the first data packet (e.g., the value is 0), the response indicator bit in the control of the first data packet is effective; when the response indicator bit in the control of the first data packet indicates that the device receiving the first data packet does not respond to the first data packet (e.g., the value is 1), the response indicator bit in the control of the first data packet is not effective.

[0394] In some examples, based on the examples shown in Table 2-3 above, in S602, the header value of the first data packet sent by the ranging device 200 to the electronic device 100 is as follows: SOF is 0x5A, Length is a variable, bits 6-7 of Control are empty, bit 5 is 1 (indicating that the electronic device 100 does not reply to the first data packet), bit 4 is 1 (indicating that the first data packet is a Request packet), bit 3 is 0 (indicating that the body of the first data packet is not encrypted), bit 2 is 0 (when bit 5 is 0, it indicates that the response mechanism is a synchronous response; when bit 5 is 1, bit 2 is ineffective), bits 1-bit 0 are 00 (indicating that the first data packet is a complete data packet), and FSN is 00 (indicating that the first data packet is a complete data packet).

[0395] In one possible implementation, the body of the first data packet may include not only the aforementioned payload (i.e., K TLVs), but also a message identity (MessageID), and optionally, a command identity (CommandID). The MessageID may indicate the command type of the first data packet, for example, it may be 1 byte long and have a value in the range [1, 255]. The CommandID may supplement the MessageID, indicating the specific command of the first data packet, for example, it may be 1 byte long and have a value in the range [1, 255]. Table 4 illustrates the MessageID example, and Table 5 illustrates the CommandID example.

[0396] Table 4

[0397]

[0398] Table 5

[0399]

[0400]

[0401] In some examples, based on the examples shown in Tables 1-3 above, in S602, the Body value of the first data packet sent by the ranging device 200 to the electronic device 100 is as follows: MessageID is 0x03 (indicating that the instruction type of the first data packet is a notification type), CommandID is 0x02 (indicating that the first data packet is used by the ranging device 200 to notify the electronic device 100 of the status information of the ranging device 200, which is the content of the Payload), and Payload (i.e., K TLVs). Any one of the TLVs in the Payload (i.e., K TLVs) can be found in Table 1.

[0402] The field names, field lengths, field values, and descriptions shown in Tables 1-5 above are for illustrative purposes only and should not be construed as limiting information.

[0403] S603. Electronic device 100 sends a second data packet to ranging device 200.

[0404] S603 is an optional step.

[0405] In one possible implementation, when the first data packet indicates that the electronic device 100 receiving the first data packet does not respond to the first data packet, for example, when the response indication bit 5 of the Control section in the header of the first data packet is 1, then the electronic device 100 may not execute S603. When the first data packet indicates that the electronic device 100 receiving the first data packet responds to the first data packet, for example, when the response indication bit 5 of the Control section in the header of the first data packet is 0, then the electronic device 100 may execute S603.

[0406] In another possible implementation, the first data packet is a Request packet, and the electronic device 100 can, by default, return a Response packet after receiving the Request packet. Therefore, after receiving the first data packet belonging to the Request packet sent by the ranging device 200, the electronic device 100 can send a second data packet belonging to the Response packet to the ranging device 200, i.e., execute S603. Optionally, after sending the Request packet to the electronic device 100, the ranging device 200 can wait for a preset time to receive the corresponding Response packet.

[0407] In one possible implementation, electronic device 100 may respond to the first data packet by sending a second data packet to ranging device 200 via a second communication method.

[0408] In one possible implementation, the second data packet may indicate to the ranging device 200 that the electronic device 100 has received the K ranging information carried by the first data packet. Optionally, the second data packet may indicate the type of the K ranging information; for example, the second data packet may carry K type indication information for the K ranging information, where one of the type indication information indicates the type of one of the K ranging information.

[0409] In one possible implementation, the second data packet may include a Header, a Body, optional fields, and a checksum, with a structure similar to that of the first data packet. The Body of the second data packet may also include K TLVs, with a one-to-one correspondence between the TLVs in the first / Request packet and the TLVs in the second / Response packet. Specifically, the Type in TLV1 of the first / Request packet corresponds to the Type in TLV2 (corresponding to TLV1) of the second / Response packet, but their Length and Value differ. For example, the Value in TLV2 of the second / Response packet may be empty. However, in another possible implementation, the Body of the second data packet may be empty.

[0410] In one possible implementation, Figure 10 The first data packet shown is used by the ranging device 200 to send one or more ranging information obtained from ranging to the electronic device 100. Therefore, the first data packet is used to transmit data rather than control commands. Control commands can also be transmitted between the ranging device 200 and the electronic device 100. Figure 10 The method shown may further include: the electronic device 100 sending a first control command to the ranging device 200; optionally, the ranging device 200, in response to the first control command, sending a second control command to the electronic device 100. For example, the transmission of the first and second control commands is performed before S602.

[0411] The first control instruction can be used to configure the method by which the ranging device 200 reports ranging information to the electronic device 100. The data structure of the first control instruction is similar to that of the first data packet. The body of the first control instruction can include P TLVs (P is a positive integer), one of which can be used to configure a method by which the ranging device 200 reports ranging information to the electronic device 100. For example, one TLV can be used to configure the type of ranging information to be reported, and another TLV can be used to configure the frequency of reporting the ranging information.

[0412] For example, the Header of the first control command has the following values: SOF is 0x5A, Length is a variable, bits 6-7 of Control are empty, bit 5 is 0 (not restricting whether the ranging device 200 replies to the first control command), bit 4 is 1 (indicating that the first control command is a Request packet), bit 3 is 0 (indicating that the Body of the first control command is not encrypted), bit 2 is 0 (indicating that if the ranging device 200 replies to the first control command, the response mechanism is a synchronous response), and FSN is 00 (indicating that the first control command is a complete data packet).

[0413] For example, the Body of the first control command has the following values: MessageID is 0x02 (indicating the first control command is a Command), CommandID is 0x24 (indicating the first control command is used to configure the method by which the ranging device 200 reports ranging information to the electronic device 100), and Payload. The Payload may include TLV3 and / or TLV4. The Type of TLV3 is 0x01, the Length of TLV3 is 0x01, and the Value of TLV3 includes 8 bits, each bit indicating a type of ranging information. Therefore, TLV3 is used to configure the type of ranging information reported by the ranging device 200 to the electronic device 100. Any bit in the Value of TLV3 that is 1 indicates that the ranging information indicated by that bit is being reported, and a bit that is 0 indicates that the ranging information indicated by that bit is not being reported. The eight bits in the Value of TLV3 can respectively indicate: the final distance between electronic device 100 and ranging device 200 in the ranging result; the original ranging value obtained by ranging device 200 during the ranging process (such as the original ranging distance and / or the original RSSI); the filtered ranging value obtained by ranging device 200 after filtering the original ranging value (such as the filtered ranging distance and / or the filtered RSSI); the final ranging orientation between electronic device 100 and ranging device 200 in the ranging result; the area positioning result (i.e., the distance value set by ranging device 200 for executing control operations); the algorithm feature value obtained by ranging device 200 when using the algorithm to obtain the ranging result; and the ranging feature value used for maintenance monitoring (such as the maintenance monitoring log reported via MSG / CMD0XFFFF). The Type of TLV4 is 0x02, the Length of TLV3 is 0x02, and the Value of TLV3 is the frequency at which the ranging device 200 configured by the electronic device 100 reports ranging information (the unit is, for example, milliseconds, and the minimum value is, for example, 500 milliseconds). Therefore, TLV4 is used to configure the frequency at which the ranging device 200 reports ranging information to the electronic device 100.

[0414] The second control command can indicate to the electronic device 100 that the ranging device 200 has received the first control command, and optionally indicate the execution result of the operation performed by the ranging device 200 according to the first control command. The data structure of the second control command is similar to that of the first data packet. Optionally, the body of the second control command can also include P TLVs, and the TLVs in the first control command / Request packet and the second control command / Response packet can correspond one-to-one. The Type in TLV5 of the first control command / Request packet and the Type in TLV6 (corresponding to TLV5) of the second data packet / Response packet are the same, but the Length and Value are different. For example, the Value in TLV6 of the second data packet / Response packet is a Status value, which can indicate the execution result of the operation performed by the ranging device 200 according to the first control command.

[0415] The above example illustrates the use of the ranging device 200 sending a data packet for data transmission to the electronic device 100, and the electronic device 100 sending a control command to the ranging device 200. In other examples, the ranging device 200 may also send a control command to the electronic device 100, and / or the electronic device 100 may also send a data packet to the ranging device 200. This application does not limit this aspect.

[0416] S604. Electronic device 100 sends one or more ranging information to cloud server 300.

[0417] S604 is an optional step.

[0418] In one possible implementation, after receiving the first data packet sent by the ranging device 200 and acquiring the K ranging information items carried in the first data packet, the electronic device 100 can send one or more ranging information items to the cloud server 300. These one or more ranging information items can be some or all of the K ranging information items carried in the first data packet. The electronic device 100 can send the type, value, optional parameters, and length of these one or more ranging information items to the cloud server 300.

[0419] S605. Electronic device 100 displays a first interface according to a first data packet, the first interface indicating the relative position between electronic device 100 and ranging device 200.

[0420] S605 is an optional step.

[0421] In one possible implementation, after receiving a first data packet sent by the ranging device 200 and acquiring the K ranging information carried in the first data packet, the electronic device 100 can display a first interface based on the K ranging information. The K ranging information may include: the final ranging distance between the electronic device 100 and the ranging device 200 in the ranging result, and / or, the final ranging orientation between the electronic device 100 and the ranging device 200 in the ranging result. Based on this K ranging information, the electronic device 100 can display indicator 1 of the electronic device 100 and indicator 2 of the ranging device 200 on the first interface, and the electronic device 100 can display the distance between indicator 1 and indicator 2 as the aforementioned final ranging distance, and / or, the relative orientation between indicator 1 and indicator 2 as the aforementioned final ranging orientation.

[0422] Not limited to this, the electronic device 100 can also display corresponding content on the first interface based on other ranging information besides the final ranging distance and final ranging azimuth from the K ranging information. For example, these K ranging information can also include the area positioning result (i.e., the distance value set by the ranging device 200 for executing the control operation). The electronic device 100 can display a preview area on the first interface, the center of which can be the indicator 2 of the ranging device 200, and the distance between the edge of the preview area and the center of the preview area (i.e., the indicator 2 of the ranging device 200) can be the aforementioned area positioning result.

[0423] For example, Figure 11 An exemplary schematic diagram of a first interface is shown. Figure 11 The following explanation uses a vehicle as an example, with the ranging device 200 as an example. Figure 11As shown, the electronic device 100 can display a first interface 1100. Optionally, the first interface 1100 may include a title "Digital Car Key," indicating that the first interface 1100 is a user interface for digital car key functions. The first interface 1100 may include an indicator 1101 of the electronic device 100 (e.g., an icon of a mobile phone), an indicator 1102 of the ranging device 200 (e.g., an icon of a vehicle), a name 1103 of the ranging device 200 (e.g., "Vehicle A"), a status 1104 of the ranging device 200 (e.g., "Vehicle is locked"), and a ranging result 1105. The ranging result 1105 may include the final ranging distance and final ranging azimuth between the electronic device 100 and the ranging device 200. For example, the ranging result 1105 may include "Current distance: 12 meters, Current azimuth: 30 degrees," indicating that the final ranging distance between the electronic device 100 and the ranging device 200 is 12 meters, and the electronic device 100 is located at a 30-degree angle to the ranging device 200. The azimuth angle can be the angle of clockwise rotation with the reference line shown by the indicator 1102 of the ranging device 200 at 0 degrees. Optionally, the first interface 1100 may also display multiple areas where the ranging device 200 triggers different control operations. The following explanation uses a circular area as an example, but the actual shape is not limited. For example, the first interface 1100 may include three circular areas: area 1106, area 1107, and area 1108. These three areas can be centered on the indicator 1102 of the ranging device 200, and their radii can be different. The system includes three zones: Zone 1106, designated as the "10-meter welcome zone," with a radius of 10 meters. Zone 1106 allows the rangefinder 200, when locked, to emit welcome lights when the distance between it and the electronic device 100 is less than or equal to 10 meters (i.e., the electronic device 100 is within zone 1106). Zone 1107, designated as the "8-meter locked zone," with a radius of 8 meters, allows the rangefinder 200, when unlocked, to perform a locking operation when the distance between it and the electronic device 100 is greater than or equal to 8 meters (i.e., the electronic device 100 is outside zone 1107). Zone 1108, designated as the "3-meter unlock zone," with a radius of 3 meters, allows the rangefinder 200, when locked, to perform an unlocking operation when the distance between it and the electronic device 100 is less than or equal to 3 meters (i.e., the electronic device 100 is within zone 1108). Optionally, the first interface 1100 may also include trigger controls for the user to actively perform control operations on the ranging device 200, such as a vehicle unlocking control 1109A for controlling the ranging device 200 to perform unlocking operations, and a vehicle locking control 1109B for controlling the ranging device 200 to perform locking operations.

[0424] exist Figure 10In the method shown, the ranging device 200 can send the ranging information obtained from the ranging measurement to the electronic device 100. Thus, as long as the ranging device 200 is connected to the electronic device 100, it can record the ranging information through the electronic device 100. The electronic device 100 can send the received ranging information to the cloud server 300. Even if the ranging device 200 fails to store the ranging information, the maintenance personnel of the ranging device 200 can still obtain the ranging information through the cloud server 300. For example, the ranging device 200 is a vehicle, and the electronic device 100 is a mobile terminal. If the ranging device 200 is in a locked state, and the authentication between the ranging device 200 and the electronic device 100 fails, causing the ranging device 200 not to perform the unlocking operation based on the ranging result, resulting in the user being "forced to stand still," the ranging device 200, due to its limited chip storage capacity and the fact that most modules of the ranging device 200 are not woken up before unlocking, cannot store the ranging information obtained during the ranging process, nor can it send the ranging information to the cloud server 300. Figure 10 The ranging device 200 can send the ranging information to a communicable electronic device 100, which then uploads it to a cloud server 300. Subsequent maintenance personnel can obtain this ranging information from the cloud server 300 and locate the problem, avoiding difficulties in pinpointing the cause of the problem due to a lack of data analysis. This method can be used with ranging devices 200 of various types and manufacturers, making it applicable in a wide range of scenarios. Furthermore, the electronic device 100 can display a first interface based on the received ranging information. This first interface can display the ranging results, allowing users to intuitively understand the relative position between the ranging device 200 and the electronic device 100 through the displayed content.

[0425] Figure 10 The operation performed by the electronic device 100 after receiving the first ranging information is only an example. In other examples, the electronic device 100 may also store the first ranging information and send it to the ranging device 200 when the ranging device 200 requests to obtain the first ranging information. This application embodiment does not limit this.

[0426] The above embodiments illustrate the use of the ranging device 200 acquiring the relative position between the electronic device 100 and the ranging device 200 as an example. In other embodiments, the electronic device 100 may acquire the relative position between itself and the ranging device 200 (for example, the electronic device 100 may execute the ranging method shown in Embodiment 1 or Embodiment 2), and then the electronic device 100 sends the acquired relative position to the ranging device 200. The ranging device 200 can then select to perform a control operation based on the received relative position. The electronic device 100 may also perform a corresponding operation based on the acquired relative position, such as, but not limited to, one or more of the following: selecting to perform a control operation on the electronic device 100, executing... Figure 10 S604, or execution Figure 10 Examples include S605. The embodiments of this application do not limit the entity performing the ranging method.

[0427] It is understood that at least two of the above embodiments 1 to 6 can be implemented by combining them. Several combinations are illustrated below, but should not be construed as limiting.

[0428] Any of the following implementation methods can be applied to a communication system including a first device and a second device. In one case, the first device is the ranging device 200 shown in the above embodiment, and the second device is the electronic device 100 shown in the above embodiment. In another case, the first device is the electronic device 100 shown in the above embodiment, and the second device is the ranging device 200 shown in the above embodiment.

[0429] Figure 12 This is a flowchart illustrating another ranging method provided in the embodiments of this application. Figure 12 The method shown may include, but is not limited to, the following steps:

[0430] S701. The first device establishes a first communication connection with the second device.

[0431] S701 is an optional step.

[0432] In one possible implementation, the first communication connection can be a short-range connection established through a short-range wireless communication technology, such as, but not limited to, Bluetooth, Starlink, WLAN, NFC, or UWB.

[0433] In one possible implementation, the first device and the second device can establish a first communication connection and complete protocol stack authentication; see the following example for details. Figure 7 S306-S307, Figure 8 S406-S407, Figure 9 S506-S507.

[0434] In one possible implementation, the first communication connection can be used to implement the first ranging method, that is, it can be used to perform any of the ranging operations shown in S702 and S703.

[0435] In one possible implementation, the first device includes multiple ranging nodes. When the first device establishes a first communication connection with the second device, it can do so through one or more ranging nodes. For any given ranging node, if it has already established a first communication connection with the second device, it can obtain its relative position to the second device through its own established first communication connection. If it has not established a first communication connection with the second device, it has already obtained its relative position to the second device through first communication connections established by other ranging nodes. For specific examples, please refer to [link to example description]. Figure 5 Explanation of S103.

[0436] S702. The first device uses a first ranging method to obtain a first distance between the first device and the second device.

[0437] S703. When the first distance is greater than or equal to the preset distance, the first device uses the first ranging frequency and the first ranging method to obtain the relative position between the first device and the second device; when the first distance is less than the preset distance, the first device uses the second ranging frequency and the first ranging method to obtain the relative position between the first device and the second device, wherein the first ranging frequency is less than the second ranging frequency, and the first ranging method is channel sounding (CS) ranging.

[0438] Figure 12 The method shown can be the ranging method described in Embodiment 2 above. CS ranging technology is a precision ranging technique based on wireless channel characteristic analysis, primarily achieving distance measurement by analyzing the phase difference or carrier phase change of the signal at multiple frequency points. CS ranging technology can achieve dynamic ranging capabilities from meter-level to millimeter-level by jointly optimizing in the time and frequency domains through multi-frequency point phase difference and carrier phase mechanisms.

[0439] In one possible implementation, the first device includes multiple ranging nodes, wherein any two ranging nodes are located at different positions on the first device. For example, the first device is... Figure 1 The distance measuring device 200 shown or Figure 2 The ranging device 200 shown, or the first device, is Figure 3The electronic device 100 shown (where the transceiver 102 of the electronic device 100 may include multiple ranging nodes). The first ranging method described above can be a CS ranging method through multiple ranging nodes. Therefore, S702 and S703 can be ranging implemented by the first device through multiple ranging nodes.

[0440] In one possible implementation, the first ranging method described above is a CS ranging method using multiple ranging nodes. The first ranging method may include (can be understood as the process by which the first device obtains the relative position / distance between the first device and the second device using the first ranging method): the first device uses CS ranging through multiple ranging nodes to obtain multiple relative positions between the multiple ranging nodes and the second device, and determines the relative position between the first device and the second device based on the multiple relative positions, wherein one of the multiple relative positions is the relative position between the first device and the second device obtained by one of the multiple ranging nodes using CS ranging. For a specific implementation example, see [link to implementation example]. Figure 6 S205-S210.

[0441] For example, Figure 12 The process shown can correspond to the process in Implementation Example 2. Figure 6 The process shown is as follows, where, Figure 12 The S701 can be compatible Figure 6 S201-S203, Figure 12 The S702 can be compatible Figure 6 S204-S210, Figure 12 The statement in S703, "When the first distance is greater than or equal to the preset distance, the first device uses a first ranging method with a first ranging frequency to obtain the relative position between the first device and the second device," can be interpreted as... Figure 6 S211-S212, Figure 12 The statement in S703, "When the first distance is less than the preset distance, the first device uses the first ranging method with the second ranging frequency to obtain the relative position between the first device and the second device," can be interpreted as... Figure 6 S213-S214.

[0442] In one possible implementation, the first ranging method described above is a CS ranging method using multiple ranging nodes. These multiple ranging nodes include a master node and N slave nodes, where N is a positive integer greater than 1. The aforementioned first ranging method may include (which can be understood as the process by which the first device obtains the relative position / distance between the first device and the second device through the first ranging method): the first device obtains the signal strength of the second device through N slave nodes respectively, obtaining N signal strengths (e.g., RSSI), wherein one of the N slave nodes is used to obtain the signal strength of one second device, and one of the N signal strengths is the signal strength of the second device received by one of the N slave nodes; the first device determines M slave nodes from the N slave nodes based on the N signal strengths, wherein the M signal strengths obtained by the M slave nodes are all greater than the signal strengths obtained by the slave nodes other than the M slave nodes, and M is a positive integer less than N; the first device obtains the first relative position between the master node and the second device through the master node; the first device obtains the second relative position between the M slave nodes and the second device through the M slave nodes respectively, obtaining M second relative positions, wherein one of the M slave nodes is used to obtain one second relative position between the first device and the second device; and a third relative position between the first device and the second device is determined based on the first relative position and the M second relative positions. The first ranging method described above can be found in the ranging method shown in Example 1. Therefore, Figure 12 The process shown can be combined with at least the above-described embodiments 1 and 2.

[0443] For example, the first ranging method in S702 is the first ranging method implemented by the master node and N slave nodes as described above. Therefore, the distance in the third relative position is the first distance.

[0444] For example, in S703, the first ranging method with the first ranging frequency is the first ranging method implemented by the master node and N slave nodes as described above. Therefore, the third relative position is the relative position between the first device and the second device obtained by the first device in S703 using the first ranging method with the first ranging frequency. Alternatively, in S703, the first ranging method with the second ranging frequency is the first ranging method implemented by the master node and N slave nodes as described above. Therefore, the third relative position is the relative position between the first device and the second device obtained by the first device in S703 using the first ranging method with the second ranging frequency.

[0445] For example, Figure 12 The process shown can be similar to that in Example 2. Figure 6 The process shown and in Example 1 Figure 5 The process shown is as follows, where, Figure 12 The S701 can be compatible Figure 6 S201-S203, Figure 12 The S702 can be compatible Figure 5 S104-S112, Figure 12 The statement in S703, "When the first distance is greater than or equal to the preset distance, the first device uses a first ranging method with a first ranging frequency to obtain the relative position between the first device and the second device," can be interpreted as... Figure 6 S211-S212, Figure 12 The statement in S703, "When the first distance is less than the preset distance, the first device uses the first ranging method with the second ranging frequency to obtain the relative position between the first device and the second device," can be interpreted as... Figure 6 S213-S214, Figure 6 Any distance measurement process in S212 and S214 and Figure 5 Similar to S104-S112.

[0446] In one possible implementation, Figure 12 After S701 and before S702, Figure 12 The method shown may further include: a first device sending a first request to a second device, the first request being used to request to obtain a first port number of the second device, and then the first device receiving the first port number sent by the second device; the first device performing application layer authentication with the second device based on the second port number of the first device and the first port number of the second device. Figure 12 Specifically, S702 can be defined as follows: When the application layer authentication is successful, the first device uses a first ranging method to obtain a first distance between the first device and the second device. The second port number is the number of the second device in... Figure 12 The S701 was previously obtained. In one case, the second port number is preset / pre-stored by the second device. In another case, in Figure 12 Before the S701, Figure 12 The method shown may further include: the first device sending a first broadcast data packet to the second device, the first broadcast data packet carrying a second port number, so that the second device can obtain the second port number of the first device based on the first broadcast data packet. In this case, the first device starts up. Figure 12 The implementation example of the ranging (i.e., performing S702-S702) shown can be found in Case 1 of the ranging method shown in Embodiment 4. Embodiment 4 is described using the ranging device 200 as the first device and the electronic device 100 as the second device. Therefore, Figure 12 The process shown can be combined with at least the above embodiments 2 and 4.

[0447] For example, Figure 12 The process shown can be similar to that in Example 2. Figure 6 The process shown and in Example 4 Figure 8The process is shown below. Among them, Figure 12 The S701 could execute before Figure 8 S403-S404 (corresponding) Figure 6 (S201-S202). Figure 12 The S701 can be compatible Figure 8 S405-S407. The above. Figure 12 The processes added after S701 and before S702 can be corresponding to... Figure 8 S408-S417, wherein the above Figure 12 In the new process, the first device sends a first request to the second device. Figure 8 The S411 mentioned above Figure 12 In the new process, the first device receives the first port number sent by the second device. Figure 8 The S412 mentioned above Figure 12 In the new process, the application layer authentication is completed on the second device. Figure 8 S415-S416. Figure 12 S702-S703 can be corresponding Figure 8 The S418 (also corresponding) Figure 6 (S204-S214).

[0448] In one possible implementation, Figure 12 After S701 and before S702, Figure 12 The method shown may further include: a first device sending a first request to a second device, the first request being used to request to obtain a first port number of the second device, and then the first device receiving the first port number sent by the second device; the first device receiving a second request sent by the second device, the second request being used to request to obtain a second port number of the first device, and then the first device sending the second port number to the second device; the first device performing application layer authentication with the second device based on the second port number of the first device and the first port number of the second device. Figure 12 Specifically, S702 can be defined as follows: If the application layer authentication is successful, the first device uses a first ranging method to obtain a first distance between the first device and the second device. Figure 12 Following S701 shown, Figure 12The method may further include: after the first device sends the second port number to the second device, the first device receives a third request from the second device, the third request being used to request one or more port numbers of the first device, excluding the second port number, and then the first device sends the one or more port numbers to the second device. Wherein, the sending of the one or more port numbers by the first device to the second device and the completion of application-layer authentication by the second device are performed simultaneously, or the sending of the one or more port numbers by the first device to the second device is performed after the completion of application-layer authentication by the second device. In this case, the first device starts... Figure 12 The implementation example of the ranging (i.e., performing S702-S702) shown can be found in Case 2 of the ranging method shown in Embodiment 4. Embodiment 4 is described using the ranging device 200 as the first device and the electronic device 100 as the second device. Therefore, Figure 12 The process shown can be combined with at least the above embodiments 2 and 4.

[0449] For example, Figure 12 The process shown can be similar to that in Example 2. Figure 6 The process shown and in Example 4 Figure 8 The process is shown below. Among them, Figure 12 The S701 could execute before Figure 8 S403-S404 (corresponding) Figure 6 (S201-S202). Figure 12 The S701 can be compatible Figure 8 S405-S407. The above. Figure 12 The process added after S701 and before S702, where "the first device sends a first request to the second device, the first request being used to request the first port number of the second device, and then the first device receives the first port number sent by the second device," can be in... Figure 8 S407 is followed by S411-S412, and S413-S414 can be executed after S411-S412. The above... Figure 12 The process added after S701 and before S702, where "the first device receives a second request sent by the second device, the second request being used to request the second port number of the first device, and then the first device sends the second port number to the second device," can be in... Figure 8 Following S407, for example: the StarScan protocol stack of electronic device 100 requests the StarScan protocol stack of ranging device 200 to obtain the second service of ranging device 200; the StarScan protocol stack of ranging device 200 sends the information of the second service of ranging device 200 (including the second port number) to the StarScan protocol stack of electronic device 100; and after this, electronic device 100 can execute S408-S410. Figure 12The process added after S701 and before S702, which involves "the first device completing application layer authentication with the second device based on the second port number of the first device and the first port number of the second device," can be interpreted as follows: Figure 8 S415-S416. Figure 12 S702-S703 can be corresponding Figure 8 S417-S418 (also corresponding) Figure 6 (S204-S214). The above. Figure 12 The process added after S701 can be in Figure 8 S415-S416 can be executed simultaneously, or they can be... Figure 8 The following actions are executed after S415-S416: For example, the StarScan protocol stack of electronic device 100 requests the StarScan protocol stack of ranging device 200 to obtain other services of ranging device 200, and the StarScan protocol stack of ranging device 200 sends information about other services of ranging device 200 to the StarScan protocol stack of electronic device 100.

[0450] In one possible implementation, Figure 12 After the S701, Figure 12 The method shown may further include: a first device and a second device performing application layer authentication. Wherein, Figure 12 The S702 and the aforementioned first and second devices complete application layer authentication simultaneously, or... Figure 12 S702 is executed before the first and second devices complete application layer authentication. Optionally, after the first device establishes a first communication connection with the second device and completes protocol stack authentication (i.e., after S701), the first device initiates ranging between the second device and can simultaneously perform a service acquisition process and complete application layer authentication after the service acquisition process. In this case, the first device starts... Figure 12 The implementation example of the ranging (i.e., performing S702-S702) shown can be found in the ranging method shown in Embodiment 5, which uses the ranging device 200 as the first device and the electronic device 100 as the second device for illustration. Therefore, Figure 12 The process shown can be combined with at least the above-described embodiments 2 and 5.

[0451] For example, Figure 12 The process shown can be similar to that in Example 2. Figure 6 The process shown and in Example 5 Figure 9 The process is shown below. Among them, Figure 12 The S701 could execute before Figure 9 S503-S504 (corresponding) Figure 6 (S201-S202). Figure 12 The S701 can be compatible Figure 9S505-S507. In Figure 9 After S507, the first device can initiate distance measurement between the second device, that is, perform... Figure 9 Then you can execute S508-S509. Figure 12 S702-S703 (corresponding) Figure 9 The S510 also corresponds to Figure 6 (S204-S214). In Figure 9 Following the S507, the first and second devices perform the service acquisition process, and complete application layer authentication after the service acquisition process, i.e., execute... Figure 9 S511-S521. Among them, Figure 9 S508-S510 and Figure 9 The execution order of S511-S521 is not limited.

[0452] Not limited to the above implementation, in another possible implementation, the first device starts. Figure 12 The implementation example of the ranging (i.e., performing S702-S702) shown can also be found in the ranging method shown in Example 3. Therefore, Figure 12 The process shown can be combined with at least Embodiment 2 and Embodiment 3 described above. Figure 12 The process shown can be similar to that in Example 2. Figure 6 The process shown and in Example 3 Figure 7 The process shown is similar to the one described above and will not be repeated here.

[0453] In one possible implementation, Figure 12 The method shown may further include: after the first device obtains a fourth relative position between the first device and the second device using a first ranging method, the first device selects to perform a control operation based on the fourth relative position. That is, the first device can determine whether to perform a control operation and which type of control operation to perform based on the fourth relative position. For example, the first device is a ranging device 200, which is a vehicle or in-vehicle device. The control operation selected by the vehicle or in-vehicle device based on the fourth relative position includes, but is not limited to, one or more of the following: unlocking, locking, outputting preset lights, opening the trunk, closing the trunk, adjusting the seat, controlling the air conditioning, playing music, and turning off music. An example of the vehicle or in-vehicle device selecting to perform a control operation based on the fourth relative position can be found in [link to relevant documentation]. Figure 1 , Figure 5 S112, Figure 6 S214, Figure 7 Instructions for selecting and performing control operations in the S320 ranging device 200.

[0454] Not limited to this, in another possible implementation, after the first device obtains the fourth relative position between the first device and the second device using the first ranging method, the first device sends the fourth relative position to the second device. The fourth relative position is used by the second device to select whether to perform a control operation on the second device. Therefore, the second device can determine whether to perform a control operation on the second device and which type of control operation to perform based on the fourth relative position. For example, the second device is a ranging device 200, which is a vehicle or vehicle-mounted device. An example of a vehicle or vehicle-mounted device selecting to perform a control operation on the vehicle or vehicle-mounted device based on the fourth relative position is similar to the example described above.

[0455] In one possible implementation, Figure 12 The method shown may further include: after the first device obtains a fourth relative position between the first device and the second device using a first ranging method, the first device sends a first data packet to the second device, for example, performing... Figure 10 In step S602, the first data packet carries the type and value of K ranging information items, where K is a positive integer. The K ranging information items are obtained by the first device when using the first ranging method to obtain the fourth relative position between the first device and the second device. Optionally, the format of the first data packet includes a header and a body. The body of the first data packet includes K type length value (TLV) entries, each corresponding to one of the K ranging information items. One of the K TLV entries includes a Type field, a Length field, and a Value field. The Type field of one of the K TLV entries indicates the type of the corresponding ranging information item among the K ranging information items. The Length field of one of the K TLV entries indicates the length of the corresponding ranging information item among the K ranging information items. The Length field of one of the K TLV entries indicates the value of the corresponding ranging information item among the K ranging information items. The above implementation process can be referred to the ranging method shown in Embodiment 6. Detailed examples of the first data packet and ranging information can be found in [reference needed]. Figure 10 S601-S602. Therefore, Figure 12 The process shown can be combined with at least the above-described embodiments 2 and 6.

[0456] In one possible implementation, the aforementioned K ranging information can be used by the second device to display a first interface, which indicates a fourth relative position between the first and second devices. For example, after receiving the first data packet, the second device executes... Figure 10 For an example of the first interface of the S605, please refer to [link / reference]. Figure 11 .

[0457] In one possible implementation, the aforementioned K ranging information pieces can be used by the second device to send K ranging information pieces to the cloud server. For example, after receiving the first data packet, the second device executes... Figure 10 S604.

[0458] Wherein, the fourth relative position between the first device and the second device obtained by the first device using the first ranging method can be any relative position obtained by the first device using the first ranging method, for example, it can be Figure 11 The result obtained by executing S702 (where the fourth relative position includes the first distance), for example, could also be Figure 11 The S703 statement, "The first device uses a first ranging method with a first ranging frequency to obtain the relative position between the first device and the second device," is executed, or it could be... Figure 11 The relative position is obtained by executing "the first device uses the first ranging method with the second ranging frequency to obtain the relative position between the first device and the second device" in S703. For example, it can also be obtained by the first ranging method implemented by the master node and N slave nodes (in this case, the fourth relative position is the third relative position).

[0459] Figure 12 Taking CS ranging as the first ranging method as an example, in specific implementation, the first ranging method can also be other ranging technologies, and this application embodiment does not limit this.

[0460] Not limited to Figure 12 In another implementation, the first device includes a master node and N slave nodes, where any two slave nodes and the master node are located differently on the first device, and N is a positive integer greater than 1. Another ranging method provided in this application may include, but is not limited to, the following steps: the first device establishes a first communication connection with the second device (details and...). Figure 12 (Similar to S701); The signal strength of the second device is obtained through N slave nodes, resulting in N signal strengths. One of the N slave nodes is used to obtain the signal strength of one second device, and one of the N signal strengths is the signal strength of the second device received by one of the N slave nodes. Based on the N signal strengths, M slave nodes are determined from the N slave nodes, where the M signal strengths obtained by the M slave nodes are all greater than the signal strengths obtained by the slave nodes other than the M slave nodes, and M is a positive integer less than N. The first relative position between the master node and the second device is obtained through the master node. The second relative positions between the M slave nodes and the second device are obtained through the M slave nodes, resulting in M ​​second relative positions. One of the M slave nodes is used to obtain one second relative position between the master node and the second device. The third relative position between the first device and the second device is determined based on the first relative position and the M second relative positions. The ranging method provided in this implementation can be the ranging method shown in Embodiment 1 above.

[0461] In one possible implementation, after the first device obtains a third relative position by executing the above ranging method, it can determine whether the distance in the third relative position is greater than or equal to a preset distance. If the determination result is yes, then the first ranging frequency is used to execute the above ranging method to obtain the relative position between the first device and the second device. If the determination result is no, then the second ranging frequency is used to execute the above ranging method to obtain the relative position between the first device and the second device. The first ranging frequency is less than the second ranging frequency. Therefore, this implementation can at least combine with Embodiments 1 and 2 described above.

[0462] In one possible implementation, an example of the first device initiating the ranging method described above (i.e., performing the acquisition of the signal strength of the second device and subsequent steps through N slave nodes) can be found in the ranging method shown in Embodiment 3. Embodiment 3 is illustrated using the first device as the ranging device 200 and the second device as the electronic device 100 as an example. Therefore, this implementation can combine at least Embodiment 1 and Embodiment 3 described above. Exemplarily, in the above ranging method, the first device and the second device establish a first communication connection (corresponding to...) Figure 7 After S303-S307), the first device obtains the signal strength (corresponding to) of the second device through N slave nodes respectively. Figure 7 Before S320, it can be executed Figure 7 S308-S319.

[0463] In one possible implementation, an example of the first device initiating the ranging method described above (i.e., performing the acquisition of the signal strength of the second device and subsequent steps through N slave nodes) can be found in the ranging method shown in Embodiment 4. Embodiment 4 is illustrated using the first device as the ranging device 200 and the second device as the electronic device 100 as an example. Therefore, this implementation can at least combine Embodiment 1 and Embodiment 4 described above. Exemplarily, in the above ranging method, the first device and the second device establish a first communication connection (corresponding to...) Figure 8 After S403-S407), the first device obtains the signal strength (corresponding to) of the second device through N slave nodes respectively. Figure 8 Before S418, it can be executed Figure 8 S408-S417.

[0464] In one possible implementation, an example of the first device initiating the ranging method described above (i.e., performing the acquisition of the signal strength of the second device and subsequent steps through N slave nodes) can be found in the ranging method shown in Embodiment 5. Embodiment 5 is illustrated using the first device as the ranging device 200 and the second device as the electronic device 100 as an example. Therefore, this implementation can combine at least Embodiment 1 and Embodiment 5 described above. Exemplarily, in the above ranging method, the first device and the second device establish a first communication connection (corresponding to...) Figure 9 After S503-S507), the first device obtains the signal strength (corresponding to) of the second device through N slave nodes respectively. Figure 9 Prior to S510, it could be executed Figure 9 S508-S509.

[0465] In one possible implementation, after the first device executes the above ranging method, it can send a first data packet to the second device, for example, by executing... Figure 10 In S602, the ranging information carried by the first data packet is obtained when the above ranging method is executed. For a specific implementation example, please refer to the ranging method shown in Embodiment 6.

[0466] In one possible implementation, after the first device executes the above-described ranging method, the first device can select to perform a control operation based on the third relative position. In another possible implementation, after the first device executes the above-described ranging method, the first device sends the third relative position to the second device, and the second device can select to perform a control operation based on the third relative position.

[0467] Not limited to Figure 12 In another implementation of the method shown, the ranging method provided in this application embodiment may include, but is not limited to, the following steps: a second device establishes a first communication connection with a first device; the second device completes application layer authentication with the first device based on the first port number of the second device and the second port number of the first device; if the application layer authentication is successful, the second device and the first device perform a ranging process to determine the relative position between the first device and the second device. The second port number is obtained before the second device establishes the first communication connection with the first device. In some examples, the second port number is preset / pre-stored by the second device before the establishment of the first communication connection; in other examples, the second port number is carried in a first broadcast data packet received by the second device, which is received by the second device from the first device before the establishment of the first communication connection. The ranging method provided in this implementation can be Case 1 of the ranging method shown in Embodiment 4 above.

[0468] In one possible implementation, the above ranging process is implemented as the ranging method shown in Example 1. For example, the implementation process of the above ranging process is as follows: Figure 5 S104-S112. Therefore, this implementation can at least combine the above-described embodiments 1 and 4.

[0469] In one possible implementation, the above ranging process is implemented as the ranging method shown in Example 2. For example, the implementation process of the above ranging process is as follows: Figure 6 S204-S214. Therefore, this implementation can at least combine with the above-described embodiments 2 and 4.

[0470] In one possible implementation, after the second device and the first device perform the ranging process, the second device receives the first data packet sent by the first device, for example, by executing... Figure 10 In step S602, the ranging information carried by the first data packet is obtained when the above ranging process is executed. For a specific implementation example, please refer to the ranging method shown in Example 6.

[0471] In one possible implementation, after the second device and the first device perform the ranging process, the first device can select to perform a control operation based on the relative position obtained from the ranging process. In another possible implementation, after the second device and the first device perform the ranging process, the second device receives the relative position obtained from the ranging process sent by the first device, and the second device can select to perform a control operation based on the relative position.

[0472] Not limited to Figure 12In another implementation of the illustrated method, the ranging method provided in this application embodiment may include, but is not limited to, the following steps: A second device establishes a first communication connection with a first device; the second device receives a first request sent by the first device, the first request being used to request the acquisition of a first port number of the second device, and then the second device sends the first port number to the first device; the second device sends a second request to the first device, the second request being used to request the acquisition of a second port number of the first device, and then the second device receives the second port number sent by the first device; the second device completes application layer authentication with the first device based on the second port number of the first device and the first port number of the second device; the second device sends a second request to the first device... The system prepares to send a third request, which requests one or more port numbers of the first device, excluding the second port number. The second device then receives these port numbers from the first device. If the application layer authentication is successful, the second and first devices perform a ranging process to determine their relative position. The second device receiving these port numbers from the first device is performed simultaneously with the application layer authentication process, or it is performed after the application layer authentication process. This implementation provides a ranging method that can be case 2 of the ranging method shown in Embodiment 4.

[0473] In one possible implementation, the above ranging process is implemented as the ranging method shown in Example 1. For example, the implementation process of the above ranging process is as follows: Figure 5 S104-S112. Therefore, this implementation can at least combine the above-described embodiments 1 and 4.

[0474] In one possible implementation, the above ranging process is implemented as the ranging method shown in Example 2. For example, the implementation process of the above ranging process is as follows: Figure 6 S204-S214. Therefore, this implementation can at least combine with the above-described embodiments 2 and 4.

[0475] In one possible implementation, after the second device and the first device perform the ranging process, the second device receives the first data packet sent by the first device, for example, by executing... Figure 10 In step S602, the ranging information carried by the first data packet is obtained when the above ranging process is executed. For a specific implementation example, please refer to the ranging method shown in Example 6.

[0476] In one possible implementation, after the second device and the first device perform the ranging process, the first device can select to perform a control operation based on the relative position obtained from the ranging process. In another possible implementation, after the second device and the first device perform the ranging process, the second device receives the relative position obtained from the ranging process sent by the first device, and the second device can select to perform a control operation based on the relative position.

[0477] Not limited to Figure 12 In another implementation of the method shown, the ranging method provided in this application embodiment may include, but is not limited to, the following steps: a first device and a second device establish a first communication connection; the first device and the second device perform a ranging process; the first device and the second device complete application layer authentication; the ranging process is used to determine the relative position between the first device and the second device; wherein the ranging process performed by the first device and the second device and the application layer authentication performed by the first device and the second device are executed simultaneously, or the ranging process performed by the first device and the second device is executed before the application layer authentication is completed. For example, after the first device and the second device establish the first communication connection, the first device initiates the ranging process between the first device and the second device, and simultaneously performs a service acquisition process and completes application layer authentication after the service acquisition process. Therefore, the execution order of the ranging process and the service acquisition process is not limited, nor is the execution order of the ranging process and the application layer authentication. The ranging method provided in this implementation can be the ranging method shown in Embodiment 5 above.

[0478] In one possible implementation, the above ranging process is implemented as the ranging method shown in Example 1. For example, the implementation process of the above ranging process is as follows: Figure 5 S104-S112. Therefore, this implementation can at least combine the above-described embodiments 1 and 5.

[0479] In one possible implementation, the above ranging process is implemented as the ranging method shown in Example 2. For example, the implementation process of the above ranging process is as follows: Figure 6 S204-S214. Therefore, this implementation can at least combine with the above-described embodiments 2 and 5.

[0480] In one possible implementation, after the second device and the first device perform the ranging process, the first device sends a first data packet to the second device, for example, by executing... Figure 10 In step S602, the ranging information carried by the first data packet is obtained when the above ranging process is executed. For a specific implementation example, please refer to the ranging method shown in Example 6.

[0481] In one possible implementation, after the first and second devices perform the ranging process, the first device can select to perform a control operation based on the relative position obtained from the ranging process. In another possible implementation, after the first and second devices perform the ranging process, the first device sends the relative position obtained from the ranging process to the second device, and the second device can select to perform a control operation based on the relative position.

[0482] This application uses the ranging result to achieve contactless control as an example for illustration. In specific implementation, it can also be used to achieve other functions, such as data transmission, remote control, screen projection, and sensing of surrounding devices (such as smart vehicles, smart terminal devices, smart home devices, and smart manufacturing equipment). This application does not limit this.

[0483] This application also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, can implement the steps performed by the electronic device 100 in the above-described method embodiments.

[0484] This application also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, can implement the steps performed by the ranging device 200 in the above-described method embodiments.

[0485] This application also provides a computer program product, including a computing program, which, when run on a computer, enables the computer to perform the steps executed by the electronic device 100 in the above-described method embodiments.

[0486] This application also provides a computer program product, including a computing program, which, when run on a computer, enables the computer to perform the steps executed by the ranging device 200 in the above-described method embodiments.

[0487] This application also provides a chip system, which includes a processing circuit interface circuit. The interface circuit receives code instructions and transmits them to the processing circuit. The processing circuit executes the code instructions to enable the chip system to perform the steps executed by the electronic device 100 in any method embodiment of this application. The chip system can be a single chip or a chip module composed of multiple chips.

[0488] This application also provides a chip system, which includes a processing circuit interface circuit. The interface circuit receives code instructions and transmits them to the processing circuit. The processing circuit executes the code instructions to enable the chip system to perform the steps executed by the ranging device 200 in any method embodiment of this application. The chip system can be a single chip or a chip module composed of multiple chips.

[0489] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit it. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.

Claims

1. A distance measurement method, characterized in that, The method includes: The first device uses a first ranging method to obtain a first distance between the first device and the second device; When the first distance is greater than or equal to the preset distance, the first device uses the first ranging method at the first ranging frequency to obtain the relative position between the first device and the second device. When the first distance is less than the preset distance, the first device uses the first ranging method at the second ranging frequency to obtain the relative position between the first device and the second device, wherein the first ranging frequency is less than the second ranging frequency.

2. The method as described in claim 1, characterized in that, The first device includes multiple ranging nodes, and any two ranging nodes are located at different positions on the first device. The first ranging method is to measure distances through the multiple ranging nodes.

3. The method as described in claim 2, characterized in that, The first ranging method includes: The first device acquires multiple relative positions between the multiple ranging nodes and the second device through the multiple ranging nodes, and determines the relative position between the first device and the second device based on the multiple relative positions, wherein one of the multiple relative positions is the relative position between the second device and one of the ranging nodes.

4. The method as described in claim 2, characterized in that, The plurality of ranging nodes includes a master node and N slave nodes, where N is a positive integer greater than 1; the first ranging method includes: The first device obtains the signal strength of the second device through the N slave nodes respectively, resulting in N signal strengths, wherein one of the N slave nodes is used to obtain the signal strength of one of the second devices; The first device determines M slave nodes from the N slave nodes based on the N signal strengths, wherein the M signal strengths obtained by the M slave nodes are all greater than the signal strengths obtained by the slave nodes other than the M slave nodes among the N slave nodes, and M is a positive integer less than N; The first device obtains the first relative position between the master node and the second device through the master node; The first device obtains the second relative position between the M slave nodes and the second device through the M slave nodes respectively, and obtains M second relative positions, wherein one of the M slave nodes is used to obtain one second relative position between itself and the second device; The first device determines the relative position between the first device and the second device based on the first relative position and the M second relative positions.

5. The method according to any one of claims 1-4, characterized in that, The relative position between the first device and the second device obtained by the first device using the first ranging method is the fourth relative position; the method further includes: the first device selecting to perform a control operation on the first device based on the fourth relative position; or... The relative position between the first device and the second device obtained by the first device using the first ranging method is the fourth relative position; the method further includes: the first device sending the fourth relative position to the second device, the fourth relative position being used by the second device to select to perform a control operation on the second device.

6. The method according to any one of claims 1-5, characterized in that, The method further includes: Before the first device uses the first ranging method to obtain the first distance between the first device and the second device, the first device establishes a first communication connection with the second device, and the first communication connection is used to implement the first ranging method.

7. The method as described in claim 6, characterized in that, After the first device and the second device establish a first communication connection, the method further includes: The first device sends a first request to the second device, the first request being used to request to obtain the first port number of the second device, and the first device receives the first port number sent by the second device; The first device performs application layer authentication with the second device based on the second port number of the first device and the first port number of the second device; The first device uses a first ranging method to obtain a first distance between the first device and the second device, including: If the application layer authentication is successful, the first device uses the first ranging method to obtain the first distance between the first device and the second device. Wherein, the second port number is preset by the second device; or, The method further includes: before the first device establishes a first communication connection with the second device, the first device sends a first broadcast data packet to the second device, the first broadcast data packet carrying the second port number.

8. The method as described in claim 6, characterized in that, After the first device and the second device establish a first communication connection, the method further includes: The first device sends a first request to the second device, the first request being used to request to obtain the first port number of the second device, and the first device receives the first port number sent by the second device; The first device receives a second request sent by the second device, the second request being used to request to obtain the second port number of the first device, and the first device sends the second port number to the second device; The first device performs application layer authentication with the second device based on the second port number of the first device and the first port number of the second device; The first device receives a third request sent by the second device, the third request being used to request to obtain one or more port numbers of the first device, the one or more port numbers not including the second port number, and the first device sends the one or more port numbers to the second device; Wherein, the sending of the one or more port numbers by the first device to the second device and the completion of application layer authentication with the second device are performed simultaneously, or the sending of the one or more port numbers by the first device to the second device is performed after the completion of application layer authentication with the second device; The first device uses a first ranging method to obtain a first distance between the first device and the second device, including: If the application layer authentication is successful, the first device uses the first ranging method to obtain the first distance between the first device and the second device.

9. The method as described in claim 6, characterized in that, The method further includes: After the first device and the second device establish a first communication connection, the first device and the second device complete application layer authentication; wherein, The first device uses a first ranging method to obtain a first distance between the first device and the second device, and the first device and the second device complete application layer authentication simultaneously; or, The first device uses a first ranging method to obtain a first distance between the first device and the second device before the first device and the second device complete application layer authentication.

10. The method according to any one of claims 1-9, characterized in that, The method further includes: The first device sends a first data packet to the second device. The first data packet carries the type and value of K ranging information, where K is a positive integer. The K ranging information are obtained by the first device when it uses the first ranging method to obtain the relative position between the first device and the second device.

11. The method as described in claim 10, characterized in that, The format of the first data packet includes a header and a body. The body of the first data packet includes K Type Length Values ​​(TLVs), each of which corresponds to one of the K ranging information. Each of the K TLVs includes a Type field, a Length field, and a Value field. The Type field of one of the K TLVs indicates the type of the ranging information corresponding to one of the K ranging information. The Length field of one of the K TLVs indicates the length of the ranging information corresponding to one of the K ranging information. The Length field of one of the K TLVs indicates the value of the ranging information corresponding to one of the K ranging information.

12. The method as described in claim 10 or 11, characterized in that, The K ranging information points are used by the second device to display a first interface, the first interface indicating the relative position between the first device and the second device; and / or The K ranging information is used by the second device to send the K ranging information to the cloud server.

13. The method according to any one of claims 1-12, characterized in that, The first device is a vehicle or in-vehicle equipment, and the relative position between the first device and the second device obtained by the first ranging method is the fourth relative position; the method further includes: selecting to perform a control operation on the first device based on the fourth relative position; or... The second device is a vehicle or vehicle-mounted device, and the relative position between the first device and the second device obtained by the first device using the first ranging method is the fourth relative position; the method further includes: the first device sending the fourth relative position to the second device, the fourth relative position being used by the second device to select to perform a control operation on the second device; The control operations include one or more of the following: unlocking, locking, outputting preset lights, opening the trunk, closing the trunk, adjusting the seat, controlling the air conditioning, playing music, and turning off the music.

14. A first device, characterized in that, The method includes a transceiver, a processor, and a memory, the memory being used to store a computer program, and the processor calling the computer program to perform the steps of the method as described in any one of claims 1-13.

15. A computer storage medium, characterized in that, The computer storage medium stores a computer program, which, when executed by a processor, implements the method as described in claims 1-13.

16. A computer program product, characterized in that, When the computer program product is run on a processor, it is used to implement the method as described in claims 1-13.

17. A chip system, characterized in that, It includes a processing circuit and an interface circuit, wherein the interface circuit is used to receive code instructions and transmit them to the processing circuit, and the processing circuit is used to execute the code instructions to perform the method as described in claims 1-13.