Bluetooth connection method, device and medium
By acquiring the Bluetooth signal and identity of external devices and combining the dual conditions of dynamic signal strength threshold, a Bluetooth connection is directly established, solving the problems of long connection time, high power consumption, and high false trigger rate in existing technologies, and achieving a fast and low-power Bluetooth connection experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- GREAT WALL MOTOR CO LTD
- Filing Date
- 2026-05-26
- Publication Date
- 2026-07-03
Smart Images

Figure CN122340641A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of intelligent connected technology, and in particular to a Bluetooth connection method, device and medium. Background Technology
[0002] With the continuous development of smart terminal technology, Bluetooth connectivity between devices has become a frequent daily need for users, and their expectations for fast connection and low power consumption are constantly increasing. Therefore, there is a need to provide a Bluetooth automatic connection solution that can both shorten connection time and reduce power consumption to meet users' needs for convenient and efficient connectivity.
[0003] In related technologies, when devices automatically connect via Bluetooth, such as when a car infotainment system connects to a user's mobile phone, a Bluetooth Low Energy (BLE) connection phase is typically used to exchange keys or authentication information before a classic Bluetooth connection can be established. This process has become the industry standard. Because key exchange and authentication involve multiple bidirectional communications and response waiting periods, these steps are executed sequentially and accumulate, resulting in a significantly longer overall connection establishment time. Simultaneously, the Bluetooth module needs to operate continuously during this period and cannot enter a sleep state, leading to higher power consumption. Furthermore, after a BLE connection is established, it is typically based on a fixed signal strength threshold, resulting in a higher false trigger rate.
[0004] Given the aforementioned shortcomings, existing Bluetooth automatic connection solutions suffer from long connection times, high power consumption, and high false trigger rates, making it difficult for users to obtain a fast, low-power, and accurate Bluetooth connection experience. Summary of the Invention
[0005] This application provides a Bluetooth connection method, device, and medium to solve the problems of long connection time, high power consumption, and high false trigger rate in existing Bluetooth automatic connection schemes, which makes it difficult for users to obtain a fast, low-power, and accurate Bluetooth connection experience.
[0006] In a first aspect, embodiments of this application provide a Bluetooth connection method, including: Acquire Bluetooth signals broadcast by external devices; Based on the Bluetooth signal, the device identification and signal strength of the external device are obtained; Based on the device identification, it is determined whether the external device meets the first preset connection condition, and based on the signal strength, it is determined whether the external device meets the second preset connection condition; wherein, the first preset connection condition is set according to the pre-stored device Bluetooth connection record, and the second preset connection condition is set according to the dynamic signal strength threshold corresponding to the external device, and the dynamic signal strength threshold is determined based on the preset base signal strength threshold, the device Bluetooth connection record, and the current environmental interference situation; If the external device meets both the first and second preset connection conditions, a preset Bluetooth connection request is sent to the external device to directly establish a Bluetooth connection with it.
[0007] Based on the above technical content, this application embodiment first obtains the Bluetooth signal broadcast by the external device to obtain the device identity and signal strength of the external device, thereby determining the identity of the external device and its current signal status; then, based on the device identity, it determines whether the external device meets the first preset connection condition set according to the pre-stored device Bluetooth connection record, and simultaneously, based on the signal strength, it determines whether the external device meets the second preset connection condition. The dynamic signal strength threshold corresponding to the second preset connection condition is jointly determined by the preset basic signal strength threshold, the device Bluetooth connection record, and the current environmental interference, so that the judgment standard of signal strength is adaptively adjusted according to the device's historical connection status and environmental changes, significantly reducing the false trigger rate; when both conditions are met, a preset Bluetooth connection request is directly sent to the external device to establish a Bluetooth connection, without going through the low-power Bluetooth connection stage, thereby effectively shortening the connection establishment time, reducing the continuous working power consumption of the Bluetooth module, and providing users with a fast, low-power, and accurate Bluetooth automatic connection experience.
[0008] In one possible implementation, the device Bluetooth connection record includes a historical list of paired devices and historical connection quality information for each paired device, and the current environmental interference situation includes the current environmental interference level. Before determining whether the external device meets the second preset connection condition based on the signal strength, the method further includes: Based on the device identification, the corresponding historical connection success rate is obtained from the connection quality history information, and the current environmental interference level is obtained based on the number of surrounding Bluetooth devices and channel occupancy status. Based on the basic signal strength threshold, the historical connection success rate, and the current environmental interference level, a dynamic signal strength threshold corresponding to the external device is determined, and the second preset connection condition is determined according to the dynamic signal strength threshold; wherein, the dynamic signal strength threshold is positively correlated with the basic signal strength threshold and the historical connection success rate, and negatively correlated with the current environmental interference level.
[0009] Based on the above technical content, this application embodiment obtains the corresponding historical connection success rate from the historical connection quality information according to the device identification, and obtains the current environmental interference level according to the number of surrounding Bluetooth devices and channel occupancy status, thereby quantifying the historical connection reliability of the device and the noise level of the current wireless environment; then, using a basic signal strength threshold as a benchmark, it is positively adjusted based on the historical connection success rate, so that devices with higher historical connection success rates correspond to higher dynamic signal strength thresholds, ensuring that connections are triggered only when the signal is sufficiently reliable, and conversely, the dynamic signal strength threshold is lower, to provide more connection opportunities and avoid missed connections; at the same time, it is negatively adjusted based on the current environmental interference level, so that the dynamic signal strength threshold is lower when the environmental interference is stronger, to avoid missing valid connection requests due to environmental noise, and conversely, the dynamic signal strength threshold is higher, to reduce false triggers; thus, the signal strength judgment standard adapts to the device's past connection quality performance and real-time environmental conditions, thereby balancing connection sensitivity and accuracy and effectively reducing the false trigger rate.
[0010] In one possible implementation, determining the dynamic signal strength threshold corresponding to the external device based on the basic signal strength threshold, the historical connection success rate, and the current environmental interference level includes: Based on the historical connection success rate and a preset first weighting coefficient, a first signal strength threshold correction value is determined, and based on the current environmental interference level and a preset second weighting coefficient, a second signal strength threshold correction value is determined. The difference between the sum of the basic signal strength threshold and the first signal strength threshold correction value, and the second signal strength threshold correction value, is taken as the dynamic signal strength threshold.
[0011] Based on the above technical content, this application embodiment determines a first signal strength threshold correction value based on historical connection success rate and a preset first weighting coefficient, and determines a second signal strength threshold correction value based on current environmental interference level and a preset second weighting coefficient. Then, the second signal strength threshold correction value is subtracted from the sum of the basic signal strength threshold and the first signal strength threshold correction value to obtain the dynamic signal strength threshold. Thus, the first weighting coefficient controls the positive influence of historical connection success rate on the dynamic signal strength threshold, and the second weighting coefficient controls the negative influence of current environmental interference level on the dynamic signal strength threshold. Each weighting coefficient adjusts the correction magnitude of its corresponding factor. Finally, through the correlation calculation between the basic signal strength threshold and the two correction values, the signal strength judgment standard is quantitatively adjusted according to the device's past connection quality performance and real-time environmental conditions, improving the flexibility and controllability of dynamic signal strength threshold adjustment.
[0012] In one possible implementation, after sending the preset Bluetooth connection request to the external device, the method further includes: Get the connection result of this Bluetooth connection; Based on the connection result conversion, determine the connection success rate correction value; The historical connection success rate is updated using the connection success rate correction value to obtain the updated historical connection success rate. Based on the updated historical connection success rate, update the historical connection quality information of the external device in the device's Bluetooth connection record.
[0013] Based on the above technical content, this embodiment of the application, after sending a preset Bluetooth connection request to an external device, first obtains the connection result of the current Bluetooth connection, providing a true and accurate basis for subsequent correction of the historical connection success rate. Then, based on the connection result conversion, a connection success rate correction value is determined, transforming the connection result into a correction parameter that can be used for calculation. Subsequently, the historical connection success rate is updated using the connection success rate correction value, resulting in an updated historical connection success rate, thereby adjusting the historical connection success rate according to the actual connection situation. Finally, based on the updated historical connection success rate, the connection quality history information of the external device in the device's Bluetooth connection record is updated, ensuring that the historical connection quality information remains consistent with the actual connection situation. In this way, the historical connection quality information can continuously synchronize with the latest actual connection situation, providing an accurate data source for dynamic signal strength threshold calculation, thereby improving the accuracy of the judgment of the second preset connection condition, effectively reducing connection failures caused by judgment deviations, and preventing unqualified external devices from being mistakenly triggered to connect, achieving self-optimization of connection quality, and thus improving the user experience.
[0014] In one possible implementation, there are multiple external devices that satisfy the first preset connection condition and the second preset connection condition; the device Bluetooth connection record includes a history list of paired devices and the most recent connection time of each paired device; the first preset connection condition includes that the device identity of the external device matches the identity of the device in the history list of paired devices; and the second preset connection condition includes that the signal strength of the external device is greater than the corresponding dynamic signal strength threshold. Before sending the preset Bluetooth connection request to the external device, the method further includes: According to a preset priority rule, a target device is selected from multiple external devices; wherein, the priority rule is determined based on the signal strength of each external device, the most recent connection time of each external device, and the device type of each external device; the most recent connection time of each external device is obtained from the most recent connection time of each paired device in the device's Bluetooth connection record; Sending a preset Bluetooth connection request to an external device includes: Send the preset Bluetooth connection request to the target device.
[0015] Based on the above technical content, this application embodiment, when multiple external devices meet both the first and second preset connection conditions, first selects a target device from among the multiple external devices according to a preset priority rule, and then sends a preset Bluetooth connection request to the selected target device. The priority rule uses the signal strength, the most recent connection time, and the device type of each external device as a comprehensive judgment basis. Signal strength reflects the current connection and communication quality of the external device, the most recent connection time reflects the user's historical usage habits of the external device, and the device type distinguishes the connection usage priority of different devices. The combination of these multi-dimensional information makes the selection results of the target device more closely match the actual usage scenario and user preferences. This allows for the determination of a unique connection target even when multiple devices simultaneously meet the corresponding connection conditions, avoiding multi-device connection conflicts, misconnections, and erroneous connections. This makes the Bluetooth connection process more orderly, stable, and efficient, thereby improving the user experience.
[0016] In one possible implementation, selecting a target device from multiple external devices according to a preset priority rule includes: The external devices are sorted from highest to lowest signal strength to obtain a first sequence; In the first sequence, if the signal strength difference between two adjacent external devices is less than a preset difference, the relative order between these two external devices is adjusted from near to far according to the most recent connection time of each external device to obtain the second sequence; In the second sequence, if the time difference between the most recent connections of two adjacent external devices is less than a preset duration, the relative order between these two external devices is adjusted according to the device type sorting rules of each external device to obtain the third sequence. The device that is first in the third sequence is identified as the target device.
[0017] Based on the above technical content, this application embodiment first sorts the signal strength of each external device from high to low to obtain a first sequence, which can prioritize the selection of external devices with better current connection communication quality; then, for adjacent devices in the first sequence whose signal strength difference is less than a preset difference, the relative order is adjusted from near to far according to the most recent connection time to obtain a second sequence, which can further optimize the sorting according to the user's recent usage habits; subsequently, for adjacent devices in the second sequence whose most recent connection time difference is less than a preset duration, the relative order is adjusted according to the device type sorting rules to obtain a third sequence, which can complete the final accurate sorting based on device usage attributes; finally, the device at the top of the third sequence is determined as the target device. Through the above-mentioned progressive and layered filtering sorting method, the selection process of the target device can be orderly and reasonable, avoiding confusion and deviation when sorting multiple devices, thereby achieving accurate determination of the target device in multi-device scenarios, ensuring that Bluetooth connection prioritizes the target device with better signal, earlier usage time, and more matching device type, thereby improving the rationality of the connection process and optimizing the user's Bluetooth connection experience.
[0018] In one possible implementation, after sending the preset Bluetooth connection request to the external device, the method further includes: If establishing a Bluetooth connection directly with the external device fails, obtain the reason for the failure; Based on the cause of failure, determine the corresponding failure handling operation and execute the failure handling operation.
[0019] Based on the above technical content, after sending a preset Bluetooth connection request to an external device, if a Bluetooth connection fails to be successfully established with the external device after initiating the Bluetooth connection request, the failure reason corresponding to this connection process is obtained. Then, based on the obtained failure reason, and matching exclusive failure handling operations according to different failure reasons, differentiated and targeted handling can be carried out for various connection anomaly scenarios, avoiding the inefficiency and blindness caused by using a single fixed handling method, thereby improving the handling efficiency of Bluetooth connection failure, ensuring that the Bluetooth connection process can proceed smoothly, and further improving the user experience.
[0020] In one possible implementation, the reasons for failure include connection timeout, authentication error, signal loss, and instantaneous rate of change of signal strength exceeding a preset rate of change threshold; The step of determining the corresponding failure handling operation based on the failure reason includes: If the failure reason is connection timeout, the corresponding failure handling operation is determined as follows: start a reconnection waiting window of a preset duration, stop responding to the Bluetooth signal broadcast by the external device within the reconnection waiting window, and resume responding to the Bluetooth signal broadcast by the external device after the reconnection waiting window ends; If the failure reason is an authentication error, the corresponding failure handling operation is determined as follows: determine whether the error type corresponding to the authentication error is a pairing key failure; if the error type is a pairing key failure, then automatically initiate a re-pairing process; If the reason for failure is signal loss, the corresponding failure handling operation is determined to be: automatically initiate a re-pairing process; If the failure is due to the instantaneous change rate of signal strength exceeding a preset change rate threshold, a preset waiting period is initiated, during which no response is made to the Bluetooth signal broadcast by the external device. After the waiting period, if the number of consecutive connection failures of the external device reaches a preset number threshold, a preset cooling-off period is initiated, during which scanning of the Bluetooth signal broadcast by the external device is stopped.
[0021] Based on the above technical content, this application embodiment classifies various failure reasons such as connection timeout, authentication error, signal loss, and instantaneous change rate of signal strength exceeding a preset change rate threshold, and configures dedicated failure handling operations for different failure reasons. When the failure reason is connection timeout, a reconnection wait window of preset duration is set. During the reconnection wait window, the response to Bluetooth signals broadcast by external devices is stopped. After the wait window ends, signal response is resumed, which can avoid resource redundancy caused by frequent responses in a short period of time. When the failure reason is authentication error, it is further determined whether the error type is due to pairing key failure. If the key fails, a re-pairing process is automatically initiated, which can specifically solve the connection obstacles caused by key failure. When the failure reason is signal loss, a re-pairing process is automatically initiated directly to quickly attempt to restore the Bluetooth connection link. When the failure reason is that the instantaneous change rate of signal strength exceeds a preset change rate threshold, a wait period of preset duration is first opened and the response to Bluetooth signals is paused. If the number of consecutive connection failures reaches a preset threshold after the wait period, a preset cooling-off period is started and scanning for Bluetooth signals broadcast by external devices is stopped, which can avoid invalid connection attempts caused by drastic signal fluctuations. This enables refined and tiered handling of connection anomalies, reduces meaningless repetitive scanning and connection actions, saves device operating resources, and avoids the burden of frequent abnormal connections on the Bluetooth system, thereby effectively improving the Bluetooth connection experience.
[0022] In a second aspect, embodiments of this application provide an electronic device, including a memory and a processor, wherein the memory stores a computer program that can run on the processor, and the processor executes the computer program to implement the Bluetooth connection method as described in any of the first aspects.
[0023] Thirdly, embodiments of this application provide a computer-readable storage medium storing a computer program that, when executed by a processor, implements the Bluetooth connection method as described in any of the first aspects.
[0024] It is understood that the beneficial effects of the second and third aspects mentioned above can be found in the relevant descriptions in the first aspect mentioned above, and will not be repeated here.
[0025] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this specification. Attached Figure Description
[0026] To more clearly illustrate the technical solutions in the embodiments of this application, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0027] Figure 1 This is a schematic diagram of an application scenario provided by an embodiment of this application; Figure 2 This is a schematic flowchart of a Bluetooth connection method provided in an embodiment of this application; Figure 3 This is a flowchart illustrating a Bluetooth connection method provided in another embodiment of this application; Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0028] The present application will be described more clearly below with reference to specific embodiments. These embodiments will help those skilled in the art to further understand the function of the present application, but do not limit the present application in any way. It should be noted that those skilled in the art can make several modifications and improvements without departing from the concept of the present application. These all fall within the protection scope of the present application.
[0029] It should be understood that, when used in this application specification and the appended claims, the term "comprising" indicates the presence of the described features, integrals, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or a collection thereof.
[0030] It should also be understood that the term “and / or” as used in this application specification and the appended claims means any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.
[0031] In the description of this application and the appended claims, the terms "first," "second," "third," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.
[0032] References to "one embodiment" or "some embodiments" as described in this specification mean that one or more embodiments of this application include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.
[0033] Furthermore, the term "multiple" mentioned in the embodiments of this application should be interpreted as two or more.
[0034] First, the terms used in the embodiments of this application will be explained: Bluetooth Low Energy (BLE) refers to the low-power broadcast and short-connection communication mode in Bluetooth technology. It typically requires two-way authentication, key exchange, and protocol handshake to trigger the subsequent classic Bluetooth connection. It is a prerequisite for the automatic connection of traditional in-vehicle Bluetooth.
[0035] Classic Bluetooth: refers to the standard Bluetooth mode used for long-term connection and full-service communication in Bluetooth technology. It supports complete in-vehicle Bluetooth functions such as Bluetooth audio transmission, calls, multimedia playback, and large data volume interaction. It is the final carrier connection for the actual use of Bluetooth between the vehicle and external devices.
[0036] Bluetooth connection: In this application, it can refer to classic Bluetooth connection, that is, the formal business communication link established between the vehicle Bluetooth device and the external device based on the classic Bluetooth protocol. Unlike the prior art, the Bluetooth connection of this application skips the pre-processing such as low power Bluetooth connection, key exchange, and protocol handshake. After the first preset connection condition and the second preset connection condition are met, it is directly initiated and established to realize functions such as Bluetooth calling, audio playback, and data interaction.
[0037] The applicant's research revealed that in related technologies, when in-vehicle Bluetooth automatically connects to external devices, it typically involves exchanging keys or authentication information during a low-power Bluetooth connection phase before establishing a classic Bluetooth connection. This results in a significantly longer overall connection establishment time. Simultaneously, the Bluetooth module needs to operate continuously during this period and cannot enter a sleep state, leading to high power consumption. Furthermore, using a fixed signal strength threshold as the connection trigger condition results in a high false trigger rate. This is because wireless signal propagation is significantly affected by the environment, and the strength of the Bluetooth signal from the same external device reaching the receiver varies considerably in different scenarios. In open environments such as spacious parking lots, signal attenuation is slower, and even if the external device is far from the vehicle, the signal strength measured by the receiver may still be high, making it easy to be mistakenly identified as a connectable device and trigger a connection under a fixed threshold. Conversely, in enclosed scenarios with complex structures and numerous obstructions, signal attenuation accelerates, and even if the external device is inside the vehicle, the signal strength measured by the receiver may be low, making it difficult to reach the trigger condition under a fixed threshold and thus preventing a connection. This method of judging whether something is close enough in all scenarios using a single numerical value is difficult to adapt to the complex and ever-changing wireless propagation environment in actual use. It is easy to accidentally touch distant devices when the signal conditions are good, and miss connecting to nearby devices when the signal conditions are poor, resulting in a high false trigger rate.
[0038] Several improvements have been attempted in related technologies. For example, some technologies use Bluetooth signal strength combined with relative angle to calculate relative distance and establish a Bluetooth connection by determining whether the device is located inside the vehicle through a distance threshold. Other technologies compare device information such as Bluetooth device type, Media Access Control (MAC) address, and signal strength in parallel to filter out target Bluetooth devices before performing pairing. However, these solutions still have significant limitations: the former relies on angle and distance positioning, resulting in complex overall logic and limited scenario adaptability; the latter only focuses on device selection and cannot flexibly adjust the connection strategy according to the actual connection status and environmental changes, so the overall connection stability and accuracy still need improvement. Therefore, it is clear that existing Bluetooth automatic connection solutions still suffer from cumbersome connection processes and limited scenario adaptability, failing to provide users with an efficient, low-power, and accurate Bluetooth connection experience. Thus, it is necessary to consider a new Bluetooth connection method.
[0039] Based on this, the applicant considered the following: if conditional judgments could be made based on device identification, and then based on signal strength combined with dynamic judgment criteria, and the results of both judgments could be combined as the final triggering basis, directly establishing a Bluetooth connection when both conditions are met, the inherent process limitations of existing solutions could be overcome, while improving the accuracy of connection triggering and environmental adaptability. This leads to the following technical concept: First, the Bluetooth signal broadcast by the external device is acquired, and the device identification and signal strength are obtained for subsequent dual conditional judgments, providing basic information for rapid connection. Then, a first-level conditional judgment is made based on the device identification to confirm whether the device is trustworthy, ensuring connection security and legitimacy. A second-level conditional judgment is made based on signal strength and a dynamic signal strength threshold. The dynamic signal strength threshold is determined by combining the basic signal strength threshold, historical relevant information, and current environmental interference, allowing the signal strength judgment criteria to adaptively adjust, balancing connection sensitivity and anti-accidental touch capability. When the external device simultaneously meets both conditions, a preset Bluetooth connection request is directly sent to the external device to establish a Bluetooth connection, eliminating redundant steps such as low-power Bluetooth pre-interaction and protocol handshake in traditional solutions, thereby shortening connection time and reducing power consumption.
[0040] First refer to Figure 1 , Figure 1 The schematic diagram illustrates an application scenario provided according to an embodiment of this application. The devices involved in the application scenario include an in-vehicle Bluetooth device 100, a vehicle controller 101, and an external device 102.
[0041] Among them, the vehicle-mounted Bluetooth device 100 is a communication hardware module on the vehicle responsible for transmitting and receiving Bluetooth signals. The vehicle-mounted Bluetooth device 100 includes a Bluetooth module, which is used to scan, listen to and parse the Bluetooth signals broadcast by the external device 102, extract the device identification and signal strength information from them, and upload them to the vehicle controller 101; at the same time, it receives the control commands issued by the vehicle controller 101, initiates a preset Bluetooth connection request to the external device 102, and completes the physical establishment of the Bluetooth link and communication interaction.
[0042] The vehicle controller 101 is the core control and decision-making unit of the vehicle. It is connected to the vehicle Bluetooth device 100 and is used to receive the device identification and signal strength information reported by the vehicle Bluetooth device 100. It performs logical judgment according to the Bluetooth connection method of this application, namely: determining whether the first preset connection condition is met based on the device identification, determining whether the second preset connection condition is met based on the signal strength and dynamic signal strength threshold, and issuing a connection command to the vehicle Bluetooth device 100 when both conditions are met, so as to realize the direct establishment of Bluetooth connection with the external device 102.
[0043] External device 102 is a user-side mobile terminal that supports Bluetooth broadcasting, including smartphones, tablets, smartwatches, head-mounted devices, etc., used to continuously broadcast Bluetooth signals to enable the vehicle Bluetooth device 100 to scan and identify it, and establish a Bluetooth connection with the vehicle after receiving a preset Bluetooth connection request, thereby realizing functions such as Bluetooth calls, audio playback, and data interaction.
[0044] The aforementioned devices work together to form the complete Bluetooth automatic connection system of this application: the in-vehicle Bluetooth device 100 is responsible for Bluetooth signal acquisition and connection execution, the vehicle controller 101 is responsible for core logic judgment and decision-making, and the external device 102 provides Bluetooth broadcasting and acts as the connected terminal. The three work together to achieve fast, low-power and accurate Bluetooth automatic connection, providing users with a better Bluetooth user experience.
[0045] The following is combined Figure 1 The application scenarios described below are illustrated with reference to the accompanying drawings, which illustrate the Bluetooth connection method provided according to exemplary embodiments of this application. It should be noted that the above application scenarios are shown only to facilitate understanding of the spirit and principles of this application, and the embodiments of this application are not limited in any way. Rather, the embodiments of this application can be applied to any applicable scenario.
[0046] It should be noted that the embodiments of this application can be applied to vehicles, where the vehicle can be a server or a host computer, meaning the Bluetooth connection method provided by the exemplary embodiments of this application can be executed on the server or the host computer of the vehicle. The Bluetooth connection method provided by the exemplary embodiments of this application can be executed on the same device or on different devices.
[0047] refer to Figure 2 , Figure 2 This is a schematic flowchart illustrating a Bluetooth connection method provided in an embodiment of this application. Figure 2 As shown, the method in the embodiments of this application may include: S201. Obtain the Bluetooth signal broadcast by the external device.
[0048] Here, Bluetooth signal refers to a wireless signal transmitted by an external device that can be scanned and received by surrounding Bluetooth devices. For example, the Bluetooth signal can be a Bluetooth Low Energy broadcast signal, that is, a broadcast data packet periodically transmitted by an external device in Bluetooth Low Energy mode, which carries information such as the device identification of the external device; or it can be a wireless signal transmitted by a classic Bluetooth device for being discovered by other devices. This application does not limit the specific type of Bluetooth signal broadcast by the external device.
[0049] Here, after Bluetooth is enabled, the system continuously monitors the Bluetooth broadcast channel in the surrounding environment by cyclically scanning. When an external device enters the Bluetooth monitoring range and is broadcasting a Bluetooth signal, the Bluetooth signal broadcast by the external device can be captured during the scanning window and sent to the subsequent processing flow. This provides raw data for extracting device identification and signal strength in subsequent steps, enabling the Bluetooth connection process to automatically discover surrounding external devices without manual operation by the user.
[0050] S202. Obtain the device identification and signal strength of the external device based on the Bluetooth signal.
[0051] The device identity identifier refers to the identification information that can uniquely distinguish the external device from other Bluetooth devices. For example, the device identity identifier can be the media access control address of the external device, which is globally unique and can be used to accurately identify and locate a specific device in Bluetooth communication, or it can be other identification information such as the device name that can be used to identify the device.
[0052] Signal strength refers to the numerical value of the received Bluetooth signal broadcast by the external device. It characterizes the strength of the wireless signal between the external device and the receiver. A higher signal strength value indicates that the external device is closer or the signal propagation path is smoother, while a lower signal strength value indicates that the distance is greater or there is an obstruction. For example, signal strength is usually expressed as a Received Signal Strength Indication (RSSI) value, measured in decibels per milliwatt (dBm). This value is generally negative; the closer the value is to zero, the stronger the signal, and the farther the value is from zero, the weaker the signal. For instance, when the external device is close to the receiver, the RSSI value is approximately -30dBm to -40dBm. When the external device is in a normal usage position inside a vehicle, the RSSI value is typically between -55dBm and -70dBm. When the external device is far away or there are obstacles, the RSSI value may attenuate to below -80dBm. Obtaining this RSSI value can provide a reference for subsequently determining whether the external device is within a suitable range for establishing a connection.
[0053] Here, the received Bluetooth signal can be parsed. For example, the media access control address of the external device can be extracted from a specified field of the broadcast data packet as its device identity, and the signal strength value corresponding to the broadcast data packet can be read from the vehicle's Bluetooth receiver module as its signal strength. Then, the device identity is used to determine the first preset connection condition, and the signal strength is used to determine the second preset connection condition. This provides two core parameters for dual-condition judgment, so that the connection decision is based on the identifiable device identity and the quantifiable signal state.
[0054] S203. Based on the device identification, determine whether the external device meets the first preset connection condition, and based on the signal strength, determine whether the external device meets the second preset connection condition; wherein, the first preset connection condition is set according to the pre-stored device Bluetooth connection record, and the second preset connection condition is set according to the dynamic signal strength threshold corresponding to the external device, and the dynamic signal strength threshold is determined based on the preset basic signal strength threshold, the device Bluetooth connection record, and the current environmental interference.
[0055] The pre-stored device Bluetooth connection record refers to the historical Bluetooth connection information of external devices that are stored in advance. For example, the device Bluetooth connection record may include a list of paired devices in history and the connection quality history information of each paired device. The list of paired devices in history records the device identity and corresponding pairing key of each external device that has established a Bluetooth connection. The connection quality history information records the connection performance data such as the historical connection success rate of each paired device.
[0056] Here, the first preset connection condition is used to determine whether an external device is qualified to connect. Specifically, it is used to identify whether the external device has historical pairing information. For example, if the device identity of the external device matches the corresponding information in the pre-stored device Bluetooth connection record, it is determined that the first preset connection condition is met, thereby confirming that the external device has a historical pairing relationship. If the second preset connection condition is also met, a preset Bluetooth connection request can be initiated directly based on the existing pairing information without having to go through the low-power Bluetooth connection stage to re-exchange the key. If the first preset connection condition is not met, the subsequent connection process is not triggered.
[0057] The dynamic signal strength threshold is a dynamically changing threshold value used to compare and judge the signal strength with that of external devices. This threshold is calculated and determined in real time based on the historical connection performance of the external device and the current environmental conditions. Its core function is to measure whether the current Bluetooth signal meets the minimum standard for a reliable connection. Specifically, this threshold is adaptively adjusted based on factors such as the past Bluetooth connection quality between the external device and the vehicle (i.e., historical connection performance) and the degree of Bluetooth signal interference in the current environment, rather than using a fixed value. This ensures that signal quality can be accurately judged in different scenarios. It avoids situations where the threshold is set too high, resulting in a signal that meets the standard but fails to trigger a connection, or where the threshold is set too low, causing false connection triggers or signal instability, thereby ensuring connection reliability. For example, in practical applications, the dynamic signal strength threshold can be understood as a signal qualification line that changes with the historical connection performance of the external device and the current environmental conditions. When the current signal strength of the external device is greater than the threshold, it means that the signal conditions between the external device and the local end are reliable enough, and it is determined that the second preset connection condition is met, and then an attempt is made to establish a connection. When the signal strength is less than or equal to the threshold, it means that the signal conditions do not yet meet the requirements for a reliable connection, and the connection is not triggered for the time being, thus effectively avoiding invalid connection attempts when the signal conditions are poor.
[0058] Here, the second preset connection condition is used to determine whether the Bluetooth signal quality of the external device meets the requirements for a stable connection. Specifically, it is determined by comparing the actual signal strength of the external device with a dynamic signal strength threshold in real time. For example, the currently calculated dynamic signal strength threshold is retrieved first, and then the signal strength of the Bluetooth signal is obtained and compared. If the signal strength of the external device is greater than the dynamic signal strength threshold, it is determined that the external device meets the second preset connection condition, indicating that the Bluetooth signal quality is good and has the basis for a stable connection, which can support the smooth operation of the Bluetooth connection. If the signal strength of the external device is less than or equal to the dynamic signal strength threshold, it is determined that the second preset connection condition is not met. In this case, the subsequent connection process is not triggered to avoid connection interruption, communication lag, and other problems caused by poor signal quality, ensuring that each connection has sufficient signal protection.
[0059] The current environmental interference situation refers to the interference status of the current wireless environment. For example, the current environmental interference situation can be comprehensively determined by scanning the number of surrounding Bluetooth devices and channel occupancy, and is expressed in the form of environmental interference level. The higher the environmental interference level, the noisier the current wireless environment, the more devices communicating via Bluetooth simultaneously, the more congested the channels, the greater the interference experienced by the Bluetooth signals broadcast by external devices during transmission, and the less stable the signal quality obtained by the receiving end. Conversely, the lower the environmental interference level, the cleaner the current wireless environment, the fewer surrounding Bluetooth devices, the higher the channel idleness, the relatively smooth signal transmission path, and the more stable the signal quality obtained by the receiving end.
[0060] The preset baseline signal strength threshold refers to a pre-defined signal strength benchmark value, which serves as the basis for calculating the dynamic signal strength threshold. The dynamic signal strength threshold is built upon this preset baseline threshold. It is adjusted positively based on the historical connection status of external devices reflected in the device's Bluetooth connection records, and negatively based on the current wireless environment conditions reflected by environmental interference. Both adjustments work together to allow the dynamic signal strength threshold to adapt to the historical connection performance of external devices and the current wireless environment. This enables dynamic adjustment of the signal strength judgment standard in the second preset connection condition determination. This ensures that external devices can be screened using a signal strength judgment standard that matches the current situation under different historical connection performances and environmental interference conditions. For example, it can flexibly determine a suitable signal strength requirement based on each device's historical connection reliability and the strength of current wireless interference. This allows the signal strength judgment standard to flexibly differentiate based on past connection performance and adjust in a timely manner according to the degree of environmental interference, effectively reducing false triggering rates while maintaining connection sensitivity and accuracy.
[0061] Here, the system first matches the device's identity with pre-stored Bluetooth connection records to determine if the external device meets the first preset connection condition, thus confirming whether the external device has historical pairing information. Then, it compares the signal strength with a dynamic signal strength threshold to determine if the external device meets the second preset connection condition, thus confirming whether the current signal status of the external device is sufficiently reliable. The dynamic signal strength threshold is calculated in real time before each judgment based on a preset base signal strength threshold, the device's Bluetooth connection records, and the current environmental interference, so that the signal strength judgment standard is dynamically adjusted accordingly. Thus, in the dual-condition judgment stage, the system not only verifies the credibility of the device identity but also takes into account the sensitivity and accuracy of the signal judgment.
[0062] S204. If the external device meets the first preset connection condition and the second preset connection condition, a preset Bluetooth connection request is sent to the external device to directly establish a Bluetooth connection with the external device.
[0063] The preset Bluetooth connection request refers to a request initiated by an external device to establish a Bluetooth connection, and the specific type of this request is not limited. For example, the preset Bluetooth connection request can be a classic Bluetooth connection request or other types of Bluetooth connection requests, depending on the Bluetooth connection methods supported by both the local device and the external device, and the actual application scenario. In this application, the preset Bluetooth connection request is sent out after both the first and second preset connection conditions are met. Since the first preset connection condition confirms that the external device has a historical pairing relationship, regardless of the specific type of Bluetooth connection request used, a connection can be directly initiated based on the existing pairing information between the two parties without needing a separate key exchange stage before initiation.
[0064] Here, once both the first and second preset connection conditions are met, a preset Bluetooth connection request is sent to the external device to establish a Bluetooth connection. The satisfaction of the first preset connection condition confirms that the external device has a historical pairing relationship, allowing the preset Bluetooth connection request to be initiated directly based on existing pairing information. The satisfaction of the second preset connection condition confirms that the external device's current signal strength is sufficiently reliable to support a stable connection. These two conditions together constitute a dual prerequisite for sending the preset Bluetooth connection request: the former ensures connection security, eliminating the need for the local device to re-exchange keys and perform authentication with the external device during the low-power Bluetooth connection phase; the latter ensures connection reliability, preventing invalid connections from being initiated under poor signal conditions.
[0065] Based on this, after a preset Bluetooth connection request is sent, both parties can directly complete authentication and establish a Bluetooth connection based on existing pairing information. This eliminates the need for the traditional method of establishing a low-power Bluetooth connection first for two-way authentication and key exchange, effectively shortening the connection establishment time. Furthermore, since the Bluetooth module does not need to continuously operate during this stage to complete multiple two-way communications and wait for responses, its continuous power consumption is effectively reduced, achieving fast and low-power automatic Bluetooth connection. Simultaneously, because the dynamic signal strength threshold used for the second preset connection condition is not fixed but dynamically determined based on the external device's historical connection performance and current environmental interference, the signal strength judgment standard can adaptively adjust accordingly. This balances connection sensitivity and accuracy when determining whether to initiate a connection, effectively reducing the false trigger rate caused by a mismatch between the signal strength judgment standard and the actual situation, ensuring both fast and accurate connection.
[0066] In this embodiment, the Bluetooth signal broadcast by the external device is first acquired, and the device identification and signal strength of the external device are obtained based on the Bluetooth signal. After determining that the external device meets the first preset connection condition based on the device identification and the second preset connection condition based on the signal strength, a preset Bluetooth connection request is sent to the external device to directly establish a Bluetooth connection. In this way, by directly establishing a Bluetooth connection after both conditions are met, the Bluetooth connection establishment time is effectively shortened, and the power consumption generated by the continuous operation of the Bluetooth module is reduced. At the same time, the dynamic signal strength threshold corresponding to the second preset connection condition combines the device's Bluetooth connection record with the current environmental interference, so that the judgment standard of signal strength is adaptively adjusted accordingly, thereby significantly reducing the false trigger rate and providing users with a fast, low-power and accurate Bluetooth automatic connection experience.
[0067] in addition, Figure 3 A flowchart illustrating a Bluetooth connection method provided in another embodiment of this application is shown below. Figure 3 As shown, the method includes: S301, Obtain Bluetooth signals broadcast by external devices.
[0068] For the implementation of S301, please refer to [link / reference]. Figure 2 The relevant descriptions in the embodiments will not be repeated here.
[0069] S302. Obtain the device identification and signal strength of the external device based on the Bluetooth signal.
[0070] For the implementation of S302, please refer to [link / reference]. Figure 2 The relevant descriptions in the embodiments will not be repeated here.
[0071] S303. Based on the device identification, determine whether the external device meets the first preset connection conditions; the first preset connection conditions are set according to the pre-stored device Bluetooth connection records; the device Bluetooth connection records include a historical list of paired devices and historical connection quality information of each paired device.
[0072] In some embodiments, the first preset connection condition includes matching the device identity of the external device with the identity of a device in the paired device history list.
[0073] For example, the paired device history list is equivalent to a historical connection list that records the identity and pairing key of each external device that has successfully established a Bluetooth connection with this device. After obtaining the device identity of an external device, the device identity is compared with the device identity recorded in the paired device history list one by one. If the device identity exists in the list, it is determined that the external device meets the first preset connection condition, indicating that the external device has previously successfully paired with this device and belongs to a device with an established trust relationship; otherwise, if the device identity is not in the list, it means that the external device has never paired with this device or the pairing information has been cleared. In this case, the first preset connection condition is not met, and the subsequent connection process is not triggered.
[0074] Therefore, by judging the first preset connection condition, the device identity can be screened before the signal strength is judged, and external devices that do not meet the conditions can be excluded, thus avoiding invalid processing of unfamiliar devices. At the same time, after confirming that the external device has a historical pairing relationship, when sending a preset Bluetooth connection request, the connection can be initiated directly based on the existing pairing information without having to re-exchange keys. This provides a premise of identity trust for the rapid execution of the overall connection process and also helps to reduce erroneous connections caused by unclear device identities.
[0075] S304. Based on the device identification, obtain the corresponding historical connection success rate from the historical connection quality information, and obtain the current environmental interference level based on the number of surrounding Bluetooth devices and channel occupancy status.
[0076] Connection quality history information refers to a data set used to record and reflect the historical Bluetooth connection communication quality between paired devices and the local device. This information can reflect the connection quality from multiple dimensions. For example, it can include the number of successful and failed connections between the device and the local device in history, and the historical connection success rate calculated accordingly; it can also include recorded data that reflects the stability of the communication link, such as the average signal strength, signal fluctuation amplitude, number of connection disconnections, and connection establishment time in each previous connection process.
[0077] Historical connection success rate refers to the percentage of successful connections based on historical connection results between paired devices and the local device. It is an important reference indicator for measuring the historical reliability of Bluetooth connections between the device and the local device. A higher historical connection success rate indicates that the device's past connections with the local device have been more stable and reliable; a lower historical connection success rate indicates that the device's past connections with the local device have been less stable, possibly due to compatibility issues or poor communication environments.
[0078] Channel occupancy status indicates the current occupancy of a wireless channel, reflecting the congestion level of the channel within the Bluetooth operating frequency band. For example, channel occupancy status can be measured using metrics such as channel occupancy rate. Channel occupancy rate refers to the proportion of time within a certain detection period during which the signal energy on the channel exceeds a preset threshold. A higher channel occupancy rate indicates more ongoing Bluetooth communication on the current channel, a busier channel, fewer available time slots for signal transmission between the local device and external devices, and a higher probability of collisions between Bluetooth signals broadcast by external devices and other signals during transmission. This leads to a decrease in signal quality received by the receiver and increased difficulty in establishing a connection. Conversely, a lower channel occupancy rate indicates less ongoing Bluetooth communication on the current channel, a less busy channel, less interference on the signal transmission path between the local device and external devices, and a clearer and more stable signal received by the receiver.
[0079] The current environmental interference level refers to the interference intensity classification based on the number of surrounding Bluetooth devices and channel occupancy status, used to characterize the noise level of the current wireless environment. For example, the interference level can be divided into multiple levels such as low interference, low-medium interference, medium-high interference, and high interference. The higher the current environmental interference level, the more Bluetooth devices are around, the more congested the channels are, the greater the interference experienced by the Bluetooth signals broadcast by external devices, and the more unstable the signal transmission. Conversely, the lower the current environmental interference level, the fewer Bluetooth devices are around, the more idle the channels are, the less interference experienced by the Bluetooth signals broadcast by external devices during transmission, the smoother the signal transmission, and the more reliable the signal quality obtained by the receiving end.
[0080] For example, the current environmental interference level can be assessed by simultaneously considering two indicators: the number of surrounding Bluetooth devices and the current channel occupancy rate. The assessment is based on a comprehensive evaluation of the numerical ranges of these two indicators. For instance, the interference level can be divided into four levels: when fewer than 5 surrounding Bluetooth devices are detected and the channel occupancy rate is below 20%, the current wireless environment is relatively clean and is assessed as a low interference level; when the number of surrounding Bluetooth devices is between 5 and 15, or the channel occupancy rate is between 20% and 40%, the current wireless environment is somewhat congested and is assessed as a low-to-medium interference level; when the number of surrounding Bluetooth devices is between 15 and 30, or the channel occupancy rate is between 40% and 60%, the current interference level is assessed as a medium-to-high interference level; and when the number of surrounding low-power Bluetooth devices exceeds 30, or the channel occupancy rate exceeds 60%, the current wireless environment is very congested and is assessed as a high interference level.
[0081] In addition, during the evaluation, if the number of nearby Bluetooth Low Energy devices and channel occupancy rate fall into the numerical ranges corresponding to different interference levels, the higher interference level should be taken as the final evaluation result, following the principle of choosing the higher value. This is because if either indicator reflects a high degree of interference, it means that the current wireless environment is not ideal. Here, each interference level can correspond to a preset level quantization value. For example, the quantization value for low interference level is 0, for medium-low interference level it is 1, for medium-high interference level it is 2, and for high interference level it is 3. This quantization value can be directly used for subsequent calculation of dynamic signal strength threshold, allowing the threshold to be adjusted accordingly with changes in interference level: the higher the interference level, the lower the threshold, and the more lenient the signal strength judgment standard, to avoid missing valid connection requests due to environmental noise; the lower the interference level, the higher the threshold, and the more stringent the signal strength judgment standard, to reduce false triggering.
[0082] S305. Based on the basic signal strength threshold, historical connection success rate and current environmental interference level, determine the dynamic signal strength threshold corresponding to the external device, and determine the second preset connection condition according to the dynamic signal strength threshold; wherein, the dynamic signal strength threshold is positively correlated with the basic signal strength threshold and historical connection success rate, and negatively correlated with the current environmental interference level.
[0083] Here, the basic signal strength threshold is used as a reference value. The historical connection success rate is used to apply positive adjustment to it, and the current environmental interference level is used to apply negative adjustment to it. Together, the dynamic signal strength threshold applicable to the external device is calculated. Then, the dynamic signal strength threshold is used as the judgment threshold for signal strength to determine the second preset connection condition.
[0084] It should be noted that the design of a dynamic signal strength threshold that is positively correlated with historical connection success rate and negatively correlated with the current environmental interference level reflects the degree of trust in different devices and adaptive adjustment to different levels of environmental interference. For devices with a high historical connection success rate, their connection records with the local end are good, indicating that they are trustworthy devices. In this case, the dynamic signal strength threshold is increased accordingly, and the signal strength judgment standard is more stringent. Connection is only triggered when the signal between the device and the local end is indeed strong enough, indicating that the user has clearly approached and intends to connect. This avoids unnecessary connection interference caused by the user's brief passage or temporary approach, achieving precise triggering. For devices with a low historical connection success rate, their connection records with the local end are unstable, and the connection quality may be poor due to signal fluctuations or compatibility issues. In this case, the dynamic signal strength threshold is decreased accordingly, and the signal strength judgment standard is more lenient. This relaxes the signal requirements for these devices, prioritizing the establishment of connections and avoiding missing connection opportunities due to occasional signal fluctuations.
[0085] Meanwhile, regarding environmental interference adjustment, the dynamic signal strength threshold is lowered and the signal strength judgment standard is more lenient when environmental interference is stronger. This lowers the threshold requirement for signal strength in high-interference environments, ensuring that the local device can still effectively capture connection requests from external devices and avoid missing valid connections due to environmental noise. Conversely, the dynamic signal strength threshold is higher and the signal strength judgment standard is more stringent when environmental interference is weaker. This raises the signal strength threshold required to trigger a connection in low-interference environments, reducing false triggers. Therefore, the dynamic signal strength threshold can adaptively adjust based on the device's own trust level and the current environmental interference conditions, achieving a balance between connection sensitivity and accuracy, effectively reducing the false trigger rate.
[0086] In some embodiments, S305 specifically includes the following steps: Step 1: Determine the first signal strength threshold correction value based on the historical connection success rate and the preset first weighting coefficient, and determine the second signal strength threshold correction value based on the current environmental interference level and the preset second weighting coefficient.
[0087] The preset first weighting coefficient is a parameter used to control the influence of historical connection success rate on the dynamic signal strength threshold. The preset second weighting coefficient is a parameter used to control the influence of current environmental interference level on the dynamic signal strength threshold. By using the first and second weighting coefficients, the historical connection success rate and the current environmental interference level can be weighted separately, allowing the adjustment range of these two factors on the dynamic signal strength threshold to be independently quantified and controlled. Therefore, when calculating the dynamic signal strength threshold, the respective influence ratios of historical connection performance and current environmental interference can be flexibly adjusted according to the needs of the actual application scenario.
[0088] The first signal strength threshold correction value refers to the correction amount obtained by weighting the historical connection success rate with the first weighting coefficient, which is used to positively adjust the basic signal strength threshold. The magnitude of this correction value reflects the positive influence of the historical connection success rate on the dynamic signal strength threshold.
[0089] The second signal strength threshold correction value refers to the correction amount obtained by weighting the current environmental interference level with the second weighting coefficient, which is used to reverse adjust the basic signal strength threshold. The magnitude of this correction value reflects the magnitude of the reverse influence of the current environmental interference level on the dynamic signal strength threshold.
[0090] Here, a first signal strength threshold correction value is determined based on the historical connection success rate and a preset first weighting coefficient, transforming the device's historical connection performance into a quantifiable positive adjustment quantity. For example, the higher the historical connection success rate and the larger the first weighting coefficient, the larger the correction value, and the greater the positive increase in the basic signal strength threshold. Simultaneously, a second signal strength threshold correction value is determined based on the current environmental interference level and a preset second weighting coefficient, transforming the current environmental interference level into a quantifiable negative adjustment quantity. For example, the higher the current environmental interference level and the larger the second weighting coefficient, the larger the correction value, and the greater the negative decrease in the basic signal strength threshold. Subsequently, by performing corresponding calculations with the two correction values and the basic signal strength threshold, a dynamic signal strength threshold that dynamically changes with the device's historical connection performance and the current environmental interference situation can be obtained.
[0091] Step 2: Subtract the second signal strength threshold from the sum of the basic signal strength threshold and the first signal strength threshold correction value, and use the difference as the dynamic signal strength threshold.
[0092] Here, by using a base signal strength threshold as the starting point, a first signal strength threshold correction value, obtained by weighting historical connection success rates with a first weighting coefficient, is added. This increases the dynamic signal strength threshold for devices with good historical connection performance, while the threshold for devices with poor historical connection performance increases less or remains unchanged, thus achieving differentiated signal requirements for devices with different levels of trust. Then, a second signal strength threshold correction value, obtained by weighting the current environmental interference level with a second weighting coefficient, is subtracted. This causes the dynamic signal strength threshold to decrease in high-interference environments and decrease less or remain unchanged in low-interference environments, thus achieving adaptive adjustment to different levels of environmental interference. Accordingly, the positive adjustment effect of historical connection success rates and the negative adjustment effect of current environmental interference levels can be applied simultaneously and independently to the base signal strength threshold, ultimately resulting in a dynamic signal strength threshold that changes synergistically with device trust levels and environmental interference conditions. This provides a signal strength judgment threshold that matches the current actual situation for subsequent judgments of the second preset connection conditions.
[0093] In some embodiments, the formula for calculating the dynamic signal strength threshold is as follows:
[0094] in, Indicates the dynamic signal strength threshold. Indicates the basic signal strength threshold. Indicates the historical connection success rate. Indicates the current level of environmental interference. This represents the first weighting coefficient. This represents the second weighting coefficient. This represents the first signal strength threshold correction value. This represents the second signal strength threshold correction value.
[0095] Here, the basic signal strength threshold is... As the starting point for calculation, add the historical connection success rate With the first weighting coefficient The first signal strength threshold correction value obtained by multiplication is then subtracted from the current environmental interference level. With the second weighting coefficient The second signal strength threshold correction value obtained by multiplication is finally the dynamic signal strength threshold. For example, the basic signal strength threshold... Available in -75dBm to -65dBm ranges, serving as a signal strength benchmark suitable for general environments; historical connection success rate. These are values ranging from 0 to 1. For example, a device's historical connection success rate of 0.92 means that the device succeeded in 92 out of the last 100 connection attempts; current environmental interference level. The value can be 0, 1, 2, or 3, corresponding to four levels: low interference, low-medium interference, medium-high interference, and high interference, respectively. For example, a value of 1 is used when the current environment is assessed as low-medium interference; the first weighting coefficient. The value can be between 8 and 12, for example, a value of 10, used to control the positive impact of historical connection success rate on the dynamic signal strength threshold; the second weighting coefficient The value can be between 3 and 7. For example, a value of 5 is used to control the magnitude of the reverse influence of the current environmental interference level on the dynamic signal strength threshold.
[0096] It's easy to understand that the range of values for the first and second weighting coefficients can be determined through experimental testing and by considering the magnitude relationship of the parameters in the formula. Since the historical connection success rate is a decimal between 0 and 1, if the first weighting coefficient is too small, the dynamic signal strength threshold correction for external devices with high and low historical connection success rates will be almost identical, making it difficult to differentiate the signal strength requirements for the two types of external devices. If the value is too large, the dynamic signal strength threshold for external devices with low historical connection success rates will be significantly increased, making it almost impossible to meet the connection conditions and resulting in lost connection opportunities. Similarly, since the current environmental interference level is an integer between 0 and 3, if the second weighting coefficient is too small, the dynamic signal strength threshold will not respond sensitively to changes in environmental interference; if the value is too large, the dynamic signal strength threshold will drop too much in high-interference environments, potentially introducing more false triggers. After conducting extensive connection tests on various types of external devices under different interference environments, using connection success rate and false trigger rate as evaluation indicators, and combining the above magnitude analysis, the optimal range of the first weight coefficient was determined to be 8 to 12, and the optimal range of the second weight coefficient was determined to be 3 to 7. Within this range, the dynamic signal strength threshold can achieve a better balance between the device trust mechanism and environmental adaptability.
[0097] Regarding device trust levels, historical connection success rate reflects the reliability of past connections between external devices and the local device. For trusted devices with high historical connection success rates, the positive correlation design results in a larger correction value for the first signal strength threshold, a correspondingly higher dynamic signal strength threshold, and a more stringent signal strength judgment standard. For example, when the basic signal strength threshold is -70dBm and the first weighting coefficient is 10, a device with a historical connection success rate of 0.9 corresponds to a dynamic signal strength threshold of -61dBm. This device requires a signal strength exceeding -61dBm to trigger a connection. This means that for this trusted device, the system will wait until its signal is indeed strong enough to indicate that the user has truly approached and has a clear intention to connect before establishing a connection, avoiding accidental connections when the user briefly passes by in scenarios such as at the entrance of a residential area or in an elevator, thus achieving accurate triggering. Conversely, for devices with low historical connection success rates, their connection performance is less stable, the dynamic signal strength threshold is correspondingly lower, and the signal strength judgment standard is more lenient. For example, a device with a historical connection success rate of only 0.3 under the same conditions corresponds to a dynamic signal strength threshold of approximately -67dBm. A connection can be triggered as long as the signal strength exceeds -67dBm, thus giving these devices more opportunities to connect and avoiding the need for users to manually connect after getting on the vehicle, achieving a forgiving triggering mechanism. In summary, for devices with good connection quality, it's necessary to wait until they are truly close before connecting to ensure accurate user experience; for devices with poor connection quality, the signal strength requirement should be appropriately lowered, prioritizing connection establishment to avoid missed connections.
[0098] Regarding environmental interference levels, the current environmental interference level reflects the noise level of the wireless environment. The negative correlation design means that in high-interference environments, the second signal strength threshold correction value is larger, the dynamic signal strength threshold is correspondingly lower, and the signal strength judgment standard is more lenient. This lowers the threshold requirement for signal strength, ensuring that the local device can still effectively capture connection requests from external devices in noisy environments, avoiding missing genuine connection needs. In low-interference environments, the dynamic signal strength threshold is correspondingly higher, and the signal strength judgment standard is more stringent, reducing false triggers. Furthermore, the first weighting coefficient... The second weighting coefficient is used to control the impact of historical connection success rate on dynamic signal strength threshold. A larger value indicates a greater emphasis on the trust level of external devices, and a more pronounced distinction between trusted and untrusted devices. This factor controls the impact of the current environmental interference level on the dynamic signal strength threshold. A larger value indicates a greater emphasis on environmental adaptability, resulting in a larger adjustment range for the dynamic signal strength threshold as environmental interference changes. The two weighting coefficients work together to achieve a balance between device trust mechanisms and environmental adaptability, effectively reducing false triggering rates while maintaining connection sensitivity and accuracy.
[0099] S306. Based on signal strength, determine whether the external device meets the second preset connection conditions; the second preset connection conditions are set according to the dynamic signal strength threshold corresponding to the external device.
[0100] In some embodiments, the second preset connection condition includes the signal strength of the external device being greater than the corresponding dynamic signal strength threshold.
[0101] For example, during the judgment, the signal strength of the currently acquired external device is compared with the dynamic signal strength threshold corresponding to that external device: if the signal strength is greater than the dynamic signal strength threshold, it is determined that the second preset connection condition is met, indicating that the current signal conditions have met the requirements for a reliable connection; if the signal strength is less than or equal to the dynamic signal strength threshold, it is determined that the second preset connection condition is not met, indicating that the current signal conditions are not sufficient to support a stable connection. Since the dynamic signal strength threshold is dynamically calculated based on the device's historical connection success rate and the current environmental interference level, the threshold may differ for different devices or even for the same device in different environments. Therefore, this judgment process does not use a fixed threshold to measure all situations, but rather makes a personalized judgment based on the actual situation of each device at the current moment, thus taking into account both the sensitivity and accuracy of the connection.
[0102] In some embodiments, there are multiple external devices that meet the first preset connection condition and the second preset connection condition; the device Bluetooth connection record includes a history list of paired devices and the most recent connection time of each paired device; before sending the preset Bluetooth connection request to the external device in subsequent S307, the following steps are also included: Based on preset priority rules, a target device is selected from multiple external devices.
[0103] The priority rules are determined based on the signal strength of each external device, the most recent connection time of each external device, and the device type of each external device; the most recent connection time of each external device is obtained from the most recent connection time of each paired device in the device's Bluetooth connection record.
[0104] The paired device history list refers to a list of information used to record the identity and pairing information of each external device that has successfully established a Bluetooth connection with this device. The most recent connection time for each paired device refers to the time point recorded when each paired device in the paired device history list most recently successfully established a Bluetooth connection with this device; for example, if the most recent time for an external device to successfully establish a Bluetooth connection with this device is recorded as 10:30 on a certain date, then the most recent connection time for that external device is that time point.
[0105] Here, when multiple external devices simultaneously meet the first and second preset connection conditions, these devices are first sorted and filtered according to preset priority rules to determine a target device, and then a preset Bluetooth connection request is sent to that target device. The priority rules comprehensively consider three dimensions of information for each external device: signal strength, most recent connection time, and device type. Signal strength reflects the device's current communication quality, the most recent connection time reflects the user's usage habits, and device type distinguishes the usage priorities of different devices. By combining and comprehensively sorting multi-dimensional information, the selected target device is more closely matched to the current actual usage scenario and user preferences. This ensures that a unique connection target is determined in scenarios where multiple devices can connect simultaneously, avoiding connection conflicts and misconnections between multiple devices, thereby improving the rationality and stability of Bluetooth connections.
[0106] In some embodiments, the foregoing step of selecting a target device from multiple external devices according to a preset priority rule includes the following steps: Step 1: Sort the multiple external devices from highest to lowest signal strength to obtain the first sequence.
[0107] The first sequence refers to the device order obtained by initially arranging them in descending order of signal strength. The higher the signal strength of an external device, the earlier it is in the sequence, indicating that the wireless communication conditions between it and the local end are better.
[0108] Here, signal strength is used as the primary ranking criterion to prioritize external devices with better current communication conditions. Signal strength reflects the quality of the wireless signal between the external device and the local device; a stronger signal means a more stable communication link. Using it as the primary ranking indicator allows for the selection of the device with the best current communication quality from multiple external devices that meet the criteria, facilitating further refined ranking in subsequent steps.
[0109] Step 2: In the first sequence, if the signal strength difference between two adjacent external devices is less than a preset difference, then the relative order between these two external devices is adjusted from near to far according to the most recent connection time of each external device to obtain the second sequence.
[0110] The second sequence refers to the device sequence obtained by locally adjusting the order of adjacent devices with similar signal strengths based on the proximity of their most recent connection times, building upon the first sequence. Devices with more recent connection times are ranked higher in this local adjustment, indicating a higher probability of being used by the user in the near future. It's important to note that adjusting the relative order from closest to furthest means that in the first sequence, when the signal strength difference between two adjacent external devices is less than a preset difference, the device with the more recent connection time is moved to the front, and the device with the more recent connection time is moved to the back; it does not involve reordering all devices in the first sequence. Specifically, when there are multiple pairs of adjacent devices in the first sequence, only those with signal strength differences less than the preset difference will trigger a comparison of their most recent connection times and a possible order swap, while adjacent devices with sufficiently large signal strength differences will retain their original relative positions in the first sequence. This method of local adjustment ensures that signal strength remains the primary sorting criterion and plays a dominant role in the overall sequence. The most recent connection moment is only adjusted when the signal strength is insufficient to effectively distinguish the connections, thereby achieving an orderly connection of multi-dimensional sorting. The relative order adjustment in subsequent steps can also be understood with reference to this content, and will not be elaborated further.
[0111] Here, by introducing the most recent connection time as a second-level sorting criterion, we can finely distinguish adjacent devices with insignificant signal strength differences. When the signal strength difference between two devices is small, it means that their current wireless communication conditions are difficult to distinguish. In this case, referring to the most recent connection time, an indicator that reflects user habits, we prioritize devices that have recently been connected, making the sorting results more in line with the user's actual usage preferences and avoiding discrepancies between the sorting results and the user's expectations due to minor fluctuations in signal strength.
[0112] Step 3: In the second sequence, if the time difference between the most recent connections of two adjacent external devices is less than the preset duration, then the relative order between these two external devices is adjusted according to the device type sorting rules of each external device to obtain the third sequence.
[0113] The device type sorting rule refers to the pre-defined priority order based on different device types. For example, this sorting rule could be set so that mobile phones have a higher priority than tablets, and tablets have a higher priority than headphones, sorting the devices according to their importance and frequency of use in daily life. The third sequence refers to the final device sequence obtained by adjusting the local order of adjacent devices with similar most recent connection times based on the device type sorting rule, building upon the second sequence.
[0114] Here, a device type sorting rule is introduced as the third level of sorting to finally distinguish devices that are difficult to differentiate in the first two levels of sorting. When the signal strength and most recent connection time of two devices are relatively similar, it indicates that they are at a comparable level in terms of communication conditions and user habits. In this case, sorting according to the priority order corresponding to the device type can complete the final selection based on the functional attributes of the devices themselves and the primary and secondary relationships in the user's daily usage scenarios, making the filtering results more in line with the user's actual connection needs.
[0115] Step 4: Identify the device that is first in the third sequence as the target device.
[0116] Here, the device ranked first in the third sequence after a three-level progressive sorting is identified as the target device, thus completing the selection of the unique connection object in a multi-device scenario. This progressive and refined sorting method weighs signal strength, user habits, and device type sequentially, ensuring an orderly selection process for the target device. This avoids random selection or chaotic sorting during multi-device connection competition, guaranteeing that Bluetooth connection prioritizes devices with better current communication quality, more recent user usage, and device types that better meet the scenario's needs. This improves the rationality of automatic Bluetooth connection and user experience in multi-device scenarios.
[0117] In some embodiments, S307 subsequently sends a preset Bluetooth connection request to an external device, including: Send a preset Bluetooth connection request to the target device.
[0118] Here, after selecting the target device from multiple external devices that meet the aforementioned conditions using preset priority rules, subsequent preset Bluetooth connection requests are sent specifically to that target device, rather than being broadcast to all external devices that meet the conditions or attempted one by one. Therefore, in multi-device scenarios, preset Bluetooth connection requests can be precisely focused on the device with the highest overall priority, avoiding conflicts and resource waste that may result from simultaneously initiating connections to multiple external devices, making the Bluetooth connection process more orderly and efficient.
[0119] S307. If the external device meets the first preset connection condition and the second preset connection condition, a preset Bluetooth connection request is sent to the external device to directly establish a Bluetooth connection with the external device.
[0120] For the implementation details of S307, please refer to [link / reference]. Figure 2 The relevant descriptions in the embodiments will not be repeated here.
[0121] In some embodiments, after sending a preset Bluetooth connection request to an external device, the following steps are also included: Step 1: If establishing a Bluetooth connection with an external device fails, obtain the reason for the failure.
[0122] Here, when a Bluetooth connection fails to be established after sending a preset Bluetooth connection request to an external device, the cause of the failure should be promptly obtained. Connection failure can be caused by various factors, such as connection timeout, authentication error, signal loss, or sudden and drastic fluctuations in signal strength. Different types of failure require different solutions. Therefore, obtaining the cause of failure provides a clear basis for subsequent processing, thus avoiding blindly retrying or taking inappropriate measures without knowing the reason.
[0123] Step 2: Based on the cause of failure, determine the corresponding failure handling operation and execute the failure handling operation.
[0124] Here, based on the obtained failure reason, a corresponding processing method is selected from a variety of preset failure handling operations and executed. In this way, differentiated processing strategies are pre-configured for different types of connection failures. This categorized approach ensures that different connection anomalies are handled in a targeted manner, avoiding inefficient or ineffective retries that might result from using a single, fixed processing method. This improves recovery efficiency after connection failure, reduces unnecessary resource consumption, and ensures a smooth Bluetooth connection process.
[0125] In some embodiments, the aforementioned failure reasons include connection timeout, authentication error, signal loss, and the instantaneous rate of change of signal strength exceeding a preset rate of change threshold; based on the failure reason, the corresponding failure handling operation is determined, including the following steps: Step 1: If the failure reason is connection timeout, the corresponding failure handling operation is determined as follows: start a reconnection waiting window of a preset duration, stop responding to Bluetooth signals broadcast by external devices within the reconnection waiting window, and resume responding to Bluetooth signals broadcast by external devices after the reconnection waiting window ends.
[0126] Connection timeout refers to a failure type in which the connection process terminates due to waiting timeout after the local device sends a preset Bluetooth connection request to the external device but fails to receive a response from the external device or fails to establish a classic Bluetooth connection link within a preset time limit.
[0127] The reconnection wait window is a preset time window that is activated after a connection timeout occurs. During this window, the response to Bluetooth signals from the same external device will be actively paused to avoid repeatedly attempting to connect to the same device in a short period of time.
[0128] Here, by initiating a reconnection waiting window of a preset duration after a connection timeout occurs, the response to the Bluetooth signal broadcast by the external device is temporarily suspended during this window. This prevents the local end from immediately initiating a reconnection upon the reappearance of the device in a short period of time, thereby avoiding resource waste caused by repeated connection attempts when the signal strength is unstable and insufficient to support the complete connection process. After the reconnection waiting window ends, the normal response to the Bluetooth signal broadcast by the external device is resumed. That is, the local end re-includes the Bluetooth signal of the external device in the normal scanning and processing range, and no longer filters or ignores it. At this time, if the Bluetooth signal of the external device is scanned again, the first preset connection condition and the second preset connection condition can be re-executed based on the signal. When both conditions are met, a preset Bluetooth connection request is sent to the external device again.
[0129] Step 2: If the failure reason is an authentication error, the corresponding failure handling operation is determined as follows: determine whether the error type corresponding to the authentication error is a pairing key failure; if the error type is a pairing key failure, then automatically initiate the re-pairing process.
[0130] An authentication error refers to a failure where, after the local device sends a preset Bluetooth connection request to an external device, the connection is rejected because the authentication information stored by both parties is inconsistent or mismatched when the external device verifies the authentication information included in the request. In this application's solution, the first preset connection condition confirms that the external device exists in the paired device history list, meaning that the device has previously successfully paired with the local device. Therefore, when sending the preset Bluetooth connection request, the local device carries the authentication information negotiated and saved during pairing to attempt to establish a connection directly. However, the authentication process during Bluetooth connection establishment not only needs to confirm whether the device identities match but also needs to verify the pairing key negotiated by both parties to ensure communication security. For example, the authentication information may include device identification, pairing key, and other key data used by both parties to mutually verify identities and ensure communication security when establishing a Bluetooth connection. An authentication error may be triggered when one or more of these authentication information are inconsistent between the two parties. Pairing key invalidation is a common type of authentication error, which means that one or both of the pairing keys previously negotiated and stored by both parties are no longer valid. This can be caused by external devices clearing pairing records, replacing Bluetooth chips, or system updates resulting in key loss, thus making it impossible to complete normal key verification.
[0131] Here, after an authentication error occurs, the system first determines whether the specific error type indicates an invalid pairing key. If the pairing key is confirmed to be invalid, a re-pairing process is automatically initiated. This involves re-pairing the external device to generate a new pairing key and replace the invalid one. This approach directly addresses the root cause of the problem by updating the key information to restore the trust relationship between devices, eliminating the need for users to manually delete pairing records and re-pair, thus improving the efficiency of connection failure recovery.
[0132] Step 3: If the failure is due to signal loss, the corresponding failure handling operation is determined to be: automatically initiate the re-pairing process.
[0133] Signal loss refers to a failure type in which the Bluetooth signal of an external device suddenly weakens to a level that the local end cannot receive normally during or after the Bluetooth connection is established, causing the ongoing connection process to terminate due to the interruption of the wireless link.
[0134] Here, when the signal is lost, a re-pairing process is automatically initiated to re-establish the Bluetooth connection link between the local device and the external device. Since signal loss often stems from a momentary change in the wireless environment between the external device and the local device, re-pairing allows both parties to quickly re-establish the connection after the wireless conditions are restored, avoiding the additional resource consumption caused by waiting timeouts or repeated connection attempts.
[0135] Step 4: If the failure is due to the instantaneous change rate of signal strength exceeding the preset change rate threshold, a waiting period of preset duration will be initiated. During the waiting period, no response will be made to the Bluetooth signals broadcast by the external device. After the waiting period, if the number of consecutive connection failures of the external device reaches the preset number threshold, a preset cooling-off period will be initiated. During the cooling-off period, scanning for Bluetooth signals broadcast by the external device will be stopped.
[0136] The preset rate of change threshold is a preset threshold value used to measure whether the change in Bluetooth signal strength between the external device and the local device exceeds the normal range within a unit of time. The preset number threshold is a preset limit value used to measure whether the cumulative number of connection failures of the external device has reached the preset limit value that requires pausing scanning.
[0137] Here, when the instantaneous rate of change of the signal strength of the external device exceeds a preset rate of change threshold, it indicates that the signal of the external device may be experiencing severe fluctuations. At this time, a preset waiting period is initiated, during which the response to the Bluetooth signal broadcast by the external device is suspended, giving the signal fluctuations a buffer time to recover and stabilize. If the fluctuations are caused by a brief user movement or a sudden change in the environment, normal judgment can be restored after the waiting period ends. If the cumulative number of consecutive connection failures of the external device reaches a preset threshold after the waiting period ends and in subsequent connection attempts, it indicates that the external device may have a persistent connection problem. Then, a preset cooling-off period is initiated, during which scanning of the Bluetooth signal of the external device is stopped, so as to completely avoid repeatedly triggering invalid connection processes during the period when the external device cannot connect normally, thus saving system resources.
[0138] After the preset cooling-off period expires, the system will automatically resume normal scanning of the Bluetooth signal broadcast to the external device. If the signal strength and device identification of the external device meet the first and second preset connection conditions again, the connection attempt can be initiated again. The connection will not be permanently rejected because it has entered the cooling-off period. If the number of consecutive connection failures of the external device accumulates to the preset blacklist threshold in subsequent use, it can be added to the blacklist and will no longer attempt to connect automatically. The user must manually delete the pairing record to restore the blacklist.
[0139] S308. Obtain the connection result of this Bluetooth connection.
[0140] The connection result indicates the status information of whether a Bluetooth connection was successfully established after sending a preset Bluetooth connection request to an external device, including whether the connection was successful or failed. Here, by sending a preset Bluetooth connection request to an external device and completing the connection attempt, the final status of this connection attempt can be obtained from the local Bluetooth module, and this status can be recorded as the connection result of this Bluetooth connection, providing a basis for updating the historical connection success rate.
[0141] S309. Based on the connection result conversion, determine the connection success rate correction value.
[0142] The connection result conversion refers to transforming the status information of a successful or failed connection into a quantifiable value that can be used for numerical calculations. For example, a successful connection can be represented by "1", indicating that the connection has been established normally, and the external device and the local device have completed link key verification and established a formal business communication link through the Bluetooth protocol; a failed connection can be represented by "0", indicating that the connection failed to be established, possibly due to connection timeout, authentication error, signal loss, or other reasons that caused the connection process to be interrupted.
[0143] The connection success rate correction value refers to a quantitative value determined based on the current connection result and used to correct the historical connection success rate. Here, the status information of the current connection result is converted into a standardized numerical form to determine the adjustment amount used to correct the historical connection success rate. The magnitude of this adjustment is directly related to the success or failure of the current connection, allowing the actual result of each connection to be quantitatively incorporated into the subsequent update calculation of the historical connection success rate, thus providing an accurate input basis for the dynamic adjustment of the historical connection success rate.
[0144] S310. Use the connection success rate correction value to update the historical connection success rate and obtain the updated historical connection success rate.
[0145] The updated historical connection success rate refers to the historical connection success rate obtained after incorporating the current connection result into the calculation. Compared with the previous value, this value can more accurately reflect the connection performance of the external device up to the current moment.
[0146] In some embodiments, the updated historical connection success rate is calculated using the following formula:
[0147] in, This indicates the updated historical connection success rate. This indicates the historical connection success rate before the update. This indicates the connection result of this Bluetooth connection. This represents the smoothing factor.
[0148] In this embodiment, the exponentially weighted moving average method can be used to update the historical connection success rate. Specifically, this formula uses the historical connection success rate before the update. Connection results of this Bluetooth connection Perform a weighted summation to obtain the updated historical connection success rate. Among them, the smoothing factor The proportion of historical connection success rates before the update that are retained after the update is used to control the weight of the current connection result. In the formula This is the connection success rate correction value, representing the actual correction magnitude that the current connection result makes to the historical connection success rate. When the current connection is successful... The value is 1, and the connection success rate correction value is... Historically, the success rate of connections increases accordingly; when a connection fails, When the value is 0, the connection success rate correction value is 0, and the historical connection success rate decreases accordingly. Through this index-weighted moving average update method, the historical connection success rate can retain a long-term memory of past connection performance with a high weight, while also incorporating the latest results of the current connection with a low weight. This avoids drastic fluctuations caused by a single success or failure, thus continuously and smoothly tracking the changing trend of the external device's connection quality, providing a more accurate basis for subsequent calculations of dynamic signal strength thresholds.
[0149] For example, smoothing factor The value of can be determined through experimental testing. The value of this parameter affects the historical connection success rate and the response speed to new data. If... If the value is too small, the historical connection success rate becomes overly dependent on the current connection result. Each successful or failed connection will cause significant fluctuations in the historical connection success rate, failing to reliably reflect the long-term connection quality of the device. If the value is too large, the historical connection success rate will be too slow to respond to new data; even if the device connection quality has changed significantly, the historical connection success rate will not be updated in a timely manner. After testing a large number of external devices in different connection scenarios, the following decision was made after comprehensive consideration. The value ranges from 0.7 to 0.9. Within this range, the historical connection success rate can retain a stable memory of past connection performance while responding promptly to recent changes in connection results, thus achieving a good balance between smoothness and sensitivity.
[0150] S311. Based on the updated historical connection success rate, update the historical connection quality information of external devices in the device's Bluetooth connection record.
[0151] Here, by updating the historical connection success rate calculated in the aforementioned steps to the device's Bluetooth connection record, replacing the original connection quality history information of the external device, the connection quality data stored in the device's Bluetooth connection record is kept consistent with the actual connection performance of the external device up to the current moment. This update operation ensures that the result of each Bluetooth connection can be recorded and fed back in a timely manner, providing accurate and reliable data for calculating the dynamic signal strength threshold during the next connection. This forms a continuously self-optimizing closed-loop mechanism, allowing the signal strength judgment standard to be dynamically adjusted as the actual connection performance of the device changes, thereby continuously improving the accuracy and rationality of connection judgment.
[0152] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0153] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. For example... Figure 4 As shown, the electronic device 600 of this embodiment includes a memory 620 and a processor 610. The memory 620 stores a computer program 621 that can run on the processor 610. When the processor 610 executes the computer program 621, it implements the steps in any of the above-described method embodiments.
[0154] For example, computer program 621 may be divided into one or more modules / units, one or more of which are stored in memory 620 and executed by processor 610 to complete this application. The one or more modules / units may be a series of computer program instruction segments capable of performing a specific function, which describe the execution process of computer program 621 in electronic device 600.
[0155] The processor 610 can be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor.
[0156] The memory 620 can be an internal storage unit of the vehicle, such as a hard drive or memory, or an external storage device, such as a plug-in hard drive, smart media card (SMC), secure digital (SD) card, flash card, etc. The memory 620 can also include both internal and external storage devices. The memory 620 is used to store computer programs and other programs and data required by the vehicle. The memory 620 can also be used to temporarily store data that has been output or will be output.
[0157] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps in any of the above method embodiments. In the above embodiments, the descriptions of each embodiment have different focuses; parts not described in detail or in a particular embodiment can be referred to in the relevant descriptions of other embodiments.
[0158] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0159] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0160] If the integrated components / units are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include: any entity or device capable of carrying the computer program code, recording media, USB flash drives, portable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc.
[0161] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. 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 spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.
Claims
1. A Bluetooth connection method, characterized by, include: Acquire Bluetooth signals broadcast by external devices; Based on the Bluetooth signal, the device identification and signal strength of the external device are obtained; Based on the device identification, it is determined whether the external device meets the first preset connection condition, and based on the signal strength, it is determined whether the external device meets the second preset connection condition; wherein, the first preset connection condition is set according to the pre-stored device Bluetooth connection record, and the second preset connection condition is set according to the dynamic signal strength threshold corresponding to the external device, and the dynamic signal strength threshold is determined based on the preset base signal strength threshold, the device Bluetooth connection record, and the current environmental interference situation; If the external device meets both the first and second preset connection conditions, a preset Bluetooth connection request is sent to the external device to directly establish a Bluetooth connection with it.
2. The Bluetooth connection method according to claim 1, wherein, The device Bluetooth connection record includes a historical list of paired devices and historical connection quality information for each paired device. The current environmental interference status includes the current environmental interference level. Before determining whether the external device meets the second preset connection condition based on the signal strength, the method further includes: Based on the device identification, the corresponding historical connection success rate is obtained from the connection quality history information, and the current environmental interference level is obtained based on the number of surrounding Bluetooth devices and channel occupancy status. Based on the basic signal strength threshold, the historical connection success rate, and the current environmental interference level, a dynamic signal strength threshold corresponding to the external device is determined, and the second preset connection condition is determined according to the dynamic signal strength threshold; wherein, the dynamic signal strength threshold is positively correlated with the basic signal strength threshold and the historical connection success rate, and negatively correlated with the current environmental interference level.
3. The Bluetooth connection method according to claim 2, wherein, The process of determining the dynamic signal strength threshold corresponding to the external device based on the basic signal strength threshold, the historical connection success rate, and the current environmental interference level includes: Based on the historical connection success rate and a preset first weighting coefficient, a first signal strength threshold correction value is determined, and based on the current environmental interference level and a preset second weighting coefficient, a second signal strength threshold correction value is determined. The difference between the sum of the basic signal strength threshold and the first signal strength threshold correction value, and the second signal strength threshold correction value, is taken as the dynamic signal strength threshold.
4. The Bluetooth connection method according to claim 2, wherein, After sending the preset Bluetooth connection request to the external device, the method further includes: Get the connection result of this Bluetooth connection; Based on the connection result conversion, determine the connection success rate correction value; The historical connection success rate is updated using the connection success rate correction value to obtain the updated historical connection success rate. Based on the updated historical connection success rate, update the historical connection quality information of the external device in the device's Bluetooth connection record.
5. The Bluetooth connection method according to any one of claims 1 to 4, characterized by, There are multiple external devices that meet the first preset connection condition and the second preset connection condition; the device Bluetooth connection record includes a paired device history list and the most recent connection time of each paired device; the first preset connection condition includes that the device identity of the external device matches the device identity in the paired device history list; the second preset connection condition includes that the signal strength of the external device is greater than the corresponding dynamic signal strength threshold. Before sending the preset Bluetooth connection request to the external device, the method further includes: According to a preset priority rule, a target device is selected from multiple external devices; wherein, the priority rule is determined based on the signal strength of each external device, the most recent connection time of each external device, and the device type of each external device; the most recent connection time of each external device is obtained from the most recent connection time of each paired device in the device's Bluetooth connection record; Sending a preset Bluetooth connection request to an external device includes: Send the preset Bluetooth connection request to the target device.
6. The Bluetooth connection method according to claim 5, wherein, The step of selecting a target device from multiple external devices according to a preset priority rule includes: The external devices are sorted from highest to lowest signal strength to obtain a first sequence; In the first sequence, if the signal strength difference between two adjacent external devices is less than a preset difference, the relative order between these two external devices is adjusted from near to far according to the most recent connection time of each external device to obtain the second sequence; In the second sequence, if the time difference between the most recent connections of two adjacent external devices is less than a preset duration, the relative order between these two external devices is adjusted according to the device type sorting rules of each external device to obtain the third sequence. The device that is first in the third sequence is identified as the target device.
7. The Bluetooth connection method according to any one of claims 1 to 4, characterized in that, After sending the preset Bluetooth connection request to the external device, the method further includes: If establishing a Bluetooth connection directly with the external device fails, obtain the reason for the failure; Based on the cause of failure, determine the corresponding failure handling operation and execute the failure handling operation.
8. The Bluetooth connection method according to claim 7, characterized in that, The reasons for failure include connection timeout, authentication error, signal loss, and signal strength instantaneous change rate exceeding a preset change rate threshold; The step of determining the corresponding failure handling operation based on the failure reason includes: If the failure reason is connection timeout, the corresponding failure handling operation is determined as follows: start a reconnection waiting window of a preset duration, stop responding to the Bluetooth signal broadcast by the external device within the reconnection waiting window, and resume responding to the Bluetooth signal broadcast by the external device after the reconnection waiting window ends; If the failure reason is an authentication error, the corresponding failure handling operation is determined as follows: determine whether the error type corresponding to the authentication error is a pairing key failure; if the error type is a pairing key failure, then automatically initiate a re-pairing process; If the reason for the failure is signal loss, the corresponding failure handling operation is determined to be: automatically initiate a re-pairing process; If the failure is due to the instantaneous change rate of signal strength exceeding a preset change rate threshold, a preset waiting period is initiated, during which no response is made to the Bluetooth signal broadcast by the external device. After the waiting period, if the number of consecutive connection failures of the external device reaches a preset number threshold, a preset cooling-off period is initiated, during which scanning of the Bluetooth signal broadcast by the external device is stopped.
9. An electronic device comprising a memory and a processor, wherein the memory stores a computer program executable on the processor, characterized in that, When the processor executes the computer program, it implements the Bluetooth connection method as described in any one of claims 1 to 8.
10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the Bluetooth connection method as described in any one of claims 1 to 8.