An adaptive Bluetooth pairing method
Through the adaptive Bluetooth pairing method, dynamically calculate the pairing upper limit, solving the problems of poor user experience and low pairing efficiency caused by the device pairing upper limit in the prior art, and achieving efficient pairing of devices flexibly adapted to different resource resources.
Patent Information
- Application Number
- CN202211153272.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-21
- Publication Date
- 2025-09-02
- Estimated Expiration
- 2042-09-21
AI Technical Summary
The existing Bluetooth pairing method has poor user experience when it reaches the device pairing upper limit, and cannot flexibly adapt to the memory and storage needs of devices of different resource resources, resulting in low pairing efficiency and new users being unable to pair.
Through the adaptive Bluetooth pairing method, dynamically calculate the pairing limit, adjust according to memory and storage resources, free resources to adapt to more device pairing, optimize device management information, and ensure that new users can successfully pair.
It improves the user experience, avoids the problem of new users being unable to pair due to the upper limit of pairing, adapts to the pairing needs of different resource equipment, and improves the pairing efficiency.
Smart Images

Figure CN115915077B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of wireless communications, and in particular to an adaptive Bluetooth pairing method. Background Art
[0002] The Bluetooth devices in the BlueZ protocol stack have a maximum limit on the number of paired devices they support. When the number of paired devices reaches the limit, new device pairings cannot be accepted. The main process is as follows: Figure 3 The specific process is as follows:
[0003] (1) Loading Bluetooth device information
[0004] Load the paired device information from the storage medium to the memory;
[0005] (2) Waiting for pairing
[0006] Activate the device to be discoverable and wait for the Bluetooth device to initiate pairing operation;
[0007] (3) Pairing operation
[0008] (1) Determine whether the pairing limit has been reached
[0009] (1.1) The pairing limit is reached and the pairing failure process begins;
[0010] (1.2) If the pairing limit is not reached, continue to determine whether the pairing is successful;
[0011] (2) Pairing failure handling
[0012] After sending a failure message to the initiating pairing device, it returns to wait for pairing;
[0013] (3) Determine whether the pairing is successful
[0014] (3.1) Pairing is successful, enter the record Bluetooth device information;
[0015] (3.2) Pairing failed, return to waiting for pairing;
[0016] (4) Record Bluetooth device information
[0017] Record Bluetooth device information to memory and storage media, and return to waiting for pairing after completion.
[0018] The above-mentioned prior art realizes the required functions, but has the following disadvantages:
[0019] (1) Poor user experience, that is, when the pairing limit is reached, the user cannot pair successfully and needs to manually release the paired device before pairing can be successful;
[0020] (2) The upper limit setting is not flexible, that is, different applications and hardware resources require different upper limits.
[0021] In view of this, a communication method, device and medium for pairing Bluetooth devices are disclosed in Chinese patent CN202110955079.3. The method obtains the ID information of the client to be shared from the connected client, and sends the Bluetooth device information paired with the connected client to the client to be shared according to the ID information. The Bluetooth device information at least includes a key for communication between the client to be shared and the Bluetooth device, and the client to be shared can pair with the Bluetooth device according to the Bluetooth device information. Although this patent realizes the function of a paired client sharing a Bluetooth device with a new unpaired client, the Bluetooth formula method of this patent is relatively cumbersome, has certain restrictions on the amount of Bluetooth device information, and needs to continuously judge the number of requests issued by the client to be shared during the pairing process, resulting in low pairing efficiency and delays. At the same time, once the Bluetooth device pairing reaches the upper limit, new users cannot be paired, and the user experience is relatively poor.
[0022] Chinese patent CN202110792459.X discloses a Bluetooth communication method, multimedia device, and storage medium. After the Bluetooth device virtual node is created during the startup phase, a Bluetooth fast reconnection process is started, the Bluetooth fast reconnection process is used to read historical Bluetooth pairing information, a Bluetooth connection between the Bluetooth device virtual node and the target Bluetooth device is established, and the Bluetooth fast reconnection process is used to perform read and write operations on the Bluetooth device virtual node to read the operation information of the target Bluetooth device based on the Bluetooth connection. The operation information is sent to the operating system of the multimedia device through a virtual input device, so that during the startup phase, the multimedia device can directly pair with the Bluetooth device through the pairing information of the most recently successfully paired Bluetooth device. Although this patent can only enable the multimedia device to pair with the pairing information of the most recently successfully paired Bluetooth device during the startup phase, the multimedia device cannot achieve efficient pairing with new external Bluetooth devices during use, resulting in low pairing efficiency and delays, and a general user experience.
[0023] Chinese patent CN202010320916.0 discloses a method for pairing a display device and a Bluetooth device, wherein a controller of the display device receives an input instruction to establish a pairing instruction with a first Bluetooth device in an unpaired device, and when the MAC address type of the first Bluetooth device is Random, determines whether there is a second Bluetooth device with the same device name and device type as the first Bluetooth device in the paired device, and if there is a second Bluetooth device in the paired device, cancels the display of the second Bluetooth device, establishes pairing and connection with the first Bluetooth device, and displays the process of establishing pairing and connection with the first Bluetooth device in the Bluetooth settings interface. This patent uses the controller of the display device to first compare and determine whether the names and types of each Bluetooth device are the same, and then selectively pairs them by comparing addresses. Not only is the pairing method cumbersome, but the pairing methods are limited and not diversified enough. Once a large number of Bluetooth devices with different types, names, and addresses need to be paired, there will be problems of pairing delay and low pairing efficiency. There may also be problems of being unable to achieve pairing or pairing failure, resulting in a poor user experience.
[0024] A Bluetooth pairing connection method, device and readable storage medium are disclosed in Chinese patent CN201911272644.5. The Bluetooth pairing connection method includes obtaining information, wherein the information is provided by at least one Bluetooth device; if the information meets the preset conditions, a connection interface is output; and a Bluetooth connection is established according to a confirmation operation. When the active pairing terminal needs to connect to the surrounding Bluetooth devices, the information of the surrounding Bluetooth devices is obtained, and a Bluetooth device whose information meets the preset conditions is scanned, and a connection interface is output. There is no need to manually search for surrounding Bluetooth devices in the specified interface. Once the connection is confirmed, it can be paired with other Bluetooth devices. This patent also implements Bluetooth pairing in a screening manner by setting preset conditions. Once the number and type of Bluetooth device pairings exceed the preset conditions, the upper limit cannot be dynamically calculated based on memory and storage resources to adapt to devices with different resources, which can easily lead to the problem that new users cannot pair and use them, and the pairing success rate is greatly reduced, and the user experience is poor.
[0025] In summary, it is necessary to make further innovations to the existing technologies. Summary of the Invention
[0026] In order to address the technical problems existing in the above-mentioned background technology, the present invention proposes an adaptive Bluetooth pairing method, which has a reasonable concept and can dynamically calculate the upper limit based on memory and storage resources, adapt to devices with different resources, and avoid the problem that new users cannot pair and use when the Bluetooth device pairing reaches the upper limit, thereby improving the user experience.
[0027] To solve the above technical problems, the present invention provides an adaptive Bluetooth pairing method, which mainly includes the following steps:
[0028] (1) Loading Bluetooth device information, i.e., configuring file partitions from the storage medium, loading paired Bluetooth device information and pairing management information of paired Bluetooth devices into memory;
[0029] (2) Initialize system pairing management information;
[0030] (3) Waiting for pairing;
[0031] (4) Pairing operation
[0032] (4.1) Determine whether the pairing limit has been reached;
[0033] (4.2) Adaptive pairing upper limit based on system pairing management information;
[0034] (4.3) Determine whether the pairing is successful;
[0035] (4.4) Generate device pairing management information;
[0036] (4.5) Record Bluetooth device information;
[0037] (5) Connection operation, that is, unpaired Bluetooth devices need to be paired before they can be connected, and paired Bluetooth devices can be connected directly.
[0038] The adaptive Bluetooth pairing method, wherein: the pairing management information of the paired Bluetooth device in step (1) includes a pairing sequence number, i.e., a monotonically increasing sequence number, and a connection count, i.e., the number of successful connections of the Bluetooth device; and the system pairing management information in step (2) includes a current pairing sequence number, a current upper limit on the number of pairings, a maximum memory occupied by the currently paired Bluetooth device, and a maximum storage space occupied by the currently paired Bluetooth device.
[0039] The adaptive Bluetooth pairing method, wherein the step (2) mainly includes the following steps:
[0040] (2.1) Initialize the current pairing sequence number, that is, the current pairing sequence number is equal to 0, traverse the maximum value of the paired Bluetooth device sequence number, and the current pairing sequence number = maximum value + 1;
[0041] (2.2) Initialize the current upper limit of pairings using the configured upper limit of pairings;
[0042] (2.3) Initialize the maximum memory occupied by the currently paired Bluetooth device and the maximum storage space occupied by the currently paired Bluetooth device, that is, the maximum memory occupied by the currently paired Bluetooth device is equal to 0, and the maximum storage space occupied by the currently paired Bluetooth device is equal to 0; traverse the maximum memory occupied by the paired Bluetooth device and the maximum storage space occupied, as the maximum memory occupied by the currently paired Bluetooth device and the maximum storage space occupied by the currently paired Bluetooth device, and the units of memory and storage space are both bytes.
[0043] The adaptive Bluetooth pairing method, wherein the specific process of step (4.1) is: when the current pairing upper limit is reached, enter the adaptive pairing upper limit according to the system pairing management information; if the current pairing upper limit is not reached, continue to determine whether the pairing is successful.
[0044] The adaptive Bluetooth pairing method, wherein the specific process of step (4.2) is: when "the memory used by the Bluetooth device to be paired + the maximum memory occupied by the currently paired Bluetooth device is less than 90% of the total memory of the Bluetooth device to be paired" and "the space occupied by the configuration file partition of the Bluetooth device to be paired + the maximum storage space occupied by the currently paired Bluetooth device is less than 90% of the total space of the configuration file partition of the Bluetooth device to be paired" are both met, the current pairing upper limit is increased by 1, and the judgment of whether the pairing is successful is continued; if the current pairing upper limit cannot be increased, a paired Bluetooth device resource is released; the paired Bluetooth device with the least number of connections among all paired Bluetooth devices is traversed; when there is only one paired Bluetooth device, the record of the memory and storage medium of the currently paired Bluetooth device is released; when there are multiple paired Bluetooth devices, the record of the memory and storage medium of the paired Bluetooth device with the smallest pairing sequence number is released.
[0045] The adaptive Bluetooth pairing method, wherein the specific process of (4.4) is: generating device pairing management information and updating the current pairing sequence number, that is, the number of connections of the currently connected Bluetooth device is equal to 0, the pairing sequence number of the currently connected Bluetooth device = the current pairing sequence number, and the current pairing sequence number = the current pairing sequence number + 1.
[0046] The adaptive Bluetooth pairing method, wherein the specific process of step (4.5) is: saving the access Bluetooth device information and the device pairing management information of the Bluetooth device to the memory data structure and the configuration file partition on the storage medium; if the memory occupied by the newly accessed Bluetooth device is greater than the maximum memory occupied by the currently paired Bluetooth device, the maximum memory occupied by the currently paired Bluetooth device is updated to the memory occupied by the newly accessed Bluetooth device; if the storage space occupied by the newly accessed Bluetooth device is greater than the maximum storage space occupied by the currently paired Bluetooth device, the maximum storage space occupied by the currently paired Bluetooth device is updated to the storage space occupied by the newly accessed Bluetooth device.
[0047] The adaptive Bluetooth pairing method, wherein the specific process of step (5) is:
[0048] (5.1) Determine whether the connection is successful. If the connection is successful, enter the update pairing management information; if the connection fails, return to waiting for pairing;
[0049] (5.2) updating the device pairing management information, that is, increasing the number of connections in the device pairing management information of the connected Bluetooth device by 1, and synchronously updating the number of connections in the device pairing management information of the configuration file partition on the storage medium.
[0050] The adaptive Bluetooth pairing method, wherein the specific process of step (4.3) is: if the pairing is successful, enter the process of generating device pairing management information; if the pairing fails, return to the process of waiting for pairing.
[0051] The adaptive Bluetooth pairing method, wherein: the specific process of step (3) is: activating the Bluetooth device that receives the pairing to be in a discoverable state, and waiting for the Bluetooth device that sends the pairing to initiate the pairing operation.
[0052] By adopting the above technical solution, the present invention has the following beneficial effects:
[0053] The adaptive Bluetooth pairing method of the present invention is rationally conceived and can dynamically calculate the upper limit according to memory and storage resources to adapt to devices with different resources. At the same time, it avoids the problem that new users cannot pair and use Bluetooth devices when the pairing limit is reached. The upper limit setting is inflexible, which improves the user experience and is suitable for promotion and application. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] In order to more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the specific embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0055] Figure 1 This is a flow chart of the adaptive Bluetooth pairing method of the present invention;
[0056] Figure 2 Flowchart of step (5) of the adaptive Bluetooth pairing method of the present invention;
[0057] Figure 3 The following is a flowchart of an existing Bluetooth pairing method. DETAILED DESCRIPTION
[0058] The technical solution of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the embodiments described are only some embodiments of the present invention, not all embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.
[0059] The present invention will be further explained below with reference to specific embodiments.
[0060] like Figure 1 As shown, the adaptive Bluetooth pairing method provided in this embodiment accepts pairing of Bluetooth devices, and the main process is as follows:
[0061] (1) Load Bluetooth device information
[0062] Configure file partitions from the storage medium, and load paired Bluetooth device information and paired Bluetooth device pairing management information into the memory;
[0063] (2) Initialize system pairing management information
[0064] (2.1) Initialize the current pairing sequence number, that is, the current pairing sequence number is equal to 0, traverse the maximum value of the paired Bluetooth device sequence number, and the current pairing sequence number = maximum value + 1;
[0065] (2.2) Initialize the current upper limit of pairings using the configuration file or default values;
[0066] (2.3) Initialize the maximum memory occupied by the currently paired Bluetooth device and the maximum storage space occupied by the currently paired Bluetooth device, that is, the maximum memory occupied by the currently paired Bluetooth device is equal to 0, and the maximum storage space occupied by the currently paired Bluetooth device is equal to 0; traverse the maximum memory occupied by the paired Bluetooth device and the maximum storage space occupied, and use them as the maximum memory occupied by the currently paired Bluetooth device and the maximum storage space occupied by the currently paired Bluetooth device, and the unit of memory and storage space is bytes;
[0067] (3) Waiting for pairing
[0068] Activate the Bluetooth device that accepts pairing (that is, the Bluetooth device on which the current method is running) to a discoverable state, and wait for the Bluetooth device that sends the pairing to initiate the pairing operation;
[0069] (4) Pairing operation
[0070] (4.1) Determine whether the pairing limit has been reached, i.e., if the current pairing limit is reached, enter the adaptive pairing limit based on the system pairing management information; if the current pairing limit is not reached, continue to determine whether the pairing is successful;
[0071] (4.2) Adapt the pairing limit based on the system pairing management information, that is, when "the memory used by the Bluetooth device to be paired + the maximum memory occupied by the currently paired Bluetooth device < 90% of the total memory of the Bluetooth device to be paired" and "the space occupied by the configuration file partition of the Bluetooth device to be paired + the maximum storage space occupied by the currently paired Bluetooth device < 90% of the total space of the configuration file partition of the Bluetooth device to be paired" are both met, the current pairing limit is incremented by 1, and the judgment of whether the pairing is successful continues; if the current pairing limit cannot be increased, then release one paired Bluetooth device resource; traverse all paired Bluetooth devices to find the paired Bluetooth device with the least number of connections; if there is only one paired Bluetooth device, release the record of the memory and storage medium of the currently paired Bluetooth device; if there are multiple paired Bluetooth devices, release the record of the memory and storage medium of the paired Bluetooth device with the smallest pairing sequence number;
[0072] (4.3) Determine whether the pairing is successful, that is, if the pairing is successful, enter the process of generating device pairing management information; if the pairing fails, return to the process of waiting for pairing;
[0073] (4.4) Generate device pairing management information, that is, generate device pairing management information and update the current pairing sequence number. The number of connections of the currently connected Bluetooth device is equal to 0, the pairing sequence number of the currently connected Bluetooth device = the current pairing sequence number, and the current pairing sequence number = the current pairing sequence number + 1;
[0074] (4.5) Recording Bluetooth device information, namely: saving the connected Bluetooth device information and the device pairing management information of the Bluetooth device to the memory data structure and the configuration file partition on the storage medium; if the memory occupied by the newly connected Bluetooth device is greater than the maximum memory occupied by the currently paired Bluetooth device, the maximum memory occupied by the currently paired Bluetooth device is updated to the memory occupied by the newly connected Bluetooth device; if the storage space occupied by the newly connected Bluetooth device is greater than the maximum storage space occupied by the currently paired Bluetooth device, the maximum storage space occupied by the currently paired Bluetooth device is updated to the storage space occupied by the newly connected Bluetooth device;
[0075] (5) Connection operation
[0076] Unpaired Bluetooth devices need to be paired before they can be connected, while paired Bluetooth devices can be connected directly;
[0077] Example 1
[0078] like Figure 2 As shown, the specific process of the above step (5) is:
[0079] (5.1) Determine whether the connection is successful, that is, if the connection is successful, enter the update pairing management information; if the connection fails, return to waiting for pairing;
[0080] (5.2) updating the device pairing management information, that is, increasing the number of connections in the device pairing management information of the connected Bluetooth device by 1, and synchronously updating the number of connections in the device pairing management information of the configuration file partition on the storage medium.
[0081] Example 2
[0082] The pairing management information of the paired Bluetooth device in the above step (1) includes: a pairing sequence number, i.e., a monotonically increasing sequence number, and a connection count, i.e., the number of successful connections of the Bluetooth device.
[0083] Example 3
[0084] The system pairing management information in the above step (2) includes: the current pairing sequence number, the current upper limit of pairing number, the maximum memory occupied by the currently paired Bluetooth device and the maximum storage space occupied by the currently paired Bluetooth device.
[0085] The present invention has a reasonable concept and can dynamically calculate the upper limit according to memory and storage resources to adapt to devices with different resources. At the same time, it avoids the problem that new users cannot pair and use Bluetooth devices when the pairing limit is reached, thereby improving user experience and being suitable for promotion and application.
[0086] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the above embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. An adaptive Bluetooth pairing method, characterized in that: The main steps include: (1) Loading Bluetooth device information: configuring file partitions from the storage medium, loading paired Bluetooth device information and pairing management information of paired Bluetooth devices into the memory; The pairing management information of the paired Bluetooth device in step (1) includes a pairing sequence number and a connection count, wherein the pairing sequence number is a monotonically increasing sequence number, and the connection count is the number of successful connections of the Bluetooth device; (2) Initialize system pairing management information; The system pairing management information in step (2) includes the current pairing sequence number, the current upper limit of pairing, the maximum memory occupied by the currently paired Bluetooth device, and the maximum storage space occupied by the currently paired Bluetooth device; (3) Waiting for pairing; (4) Pairing operation (4.1) Determine whether the pairing limit has been reached; The specific process of step (4.1) is as follows: if the current upper limit of pairing is reached, proceed to step (4.2); if the current upper limit of pairing is not reached, continue to determine whether the pairing is successful; (4.2) Adaptive processing of the pairing upper limit based on the system pairing management information; The specific process of the step (4.2) is as follows: when "the memory used by the Bluetooth device to be paired + the maximum memory occupied by the currently paired Bluetooth device is less than 90% of the total memory of the Bluetooth device to be paired" and "the space occupied by the configuration file partition of the Bluetooth device to be paired + the maximum storage space occupied by the currently paired Bluetooth device is less than 90% of the total space of the configuration file partition of the Bluetooth device to be paired" are both met, the current pairing upper limit is incremented by 1, and the judgment of whether the pairing is successful is continued; if the current pairing upper limit cannot be increased, a paired Bluetooth device resource is released; the paired Bluetooth device with the least number of connections among all paired Bluetooth devices is traversed; if there is only one paired Bluetooth device, the record of the memory and storage medium of the currently paired Bluetooth device is released; if there are multiple paired Bluetooth devices, the record of the memory and storage medium of the paired Bluetooth device with the smallest pairing sequence number is released; (4.3) Determine whether the pairing is successful; The specific process of step (4.3) is as follows: if pairing is successful, enter the process of generating device pairing management information; if pairing fails, return to the process of waiting for pairing; (4.4) Generate device pairing management information; The specific process of (4.4) is as follows: generating device pairing management information and updating the current pairing sequence number: the number of connections of the currently connected Bluetooth device is equal to 0, the pairing sequence number of the currently connected Bluetooth device = the current pairing sequence number, and the current pairing sequence number = the current pairing sequence number + 1; (4.5) Record Bluetooth device information; The specific process of step (4.5) is as follows: saving the access Bluetooth device information and the device pairing management information of the Bluetooth device to the memory data structure and the configuration file partition on the storage medium; if the memory occupied by the newly accessed Bluetooth device is greater than the maximum memory occupied by the currently paired Bluetooth device, the maximum memory occupied by the currently paired Bluetooth device is updated to the memory occupied by the newly accessed Bluetooth device; if the storage space occupied by the newly accessed Bluetooth device is greater than the maximum storage space occupied by the currently paired Bluetooth device, the maximum storage space occupied by the currently paired Bluetooth device is updated to the storage space occupied by the newly accessed Bluetooth device; (5) Connection operation: Unpaired Bluetooth devices need to be paired before they can be connected, while paired Bluetooth devices can be connected directly.
2. The adaptive Bluetooth pairing method according to claim 1, wherein: The step (2) mainly includes the following steps: (2.1) Initialize the current pairing sequence number: the current pairing sequence number is equal to 0, and the maximum value of the paired Bluetooth device sequence number is traversed, and the current pairing sequence number = maximum value + 1; (2.2) Initialize the current upper limit of pairings using the configured upper limit of pairings; (2.3) Initialize the maximum memory occupied by the currently paired Bluetooth device and the maximum storage space occupied by the currently paired Bluetooth device, the maximum memory occupied by the currently paired Bluetooth device is equal to 0, the maximum storage space occupied by the currently paired Bluetooth device is equal to 0; traverse the maximum memory occupied by the paired Bluetooth device and the maximum storage space occupied, as the maximum memory occupied by the currently paired Bluetooth device and the maximum storage space occupied by the currently paired Bluetooth device, the unit of memory and storage space is bytes.
3. The adaptive Bluetooth pairing method according to claim 1, wherein: The specific process of step (5) is as follows: (5.1) Determine whether the connection is successful. If the connection is successful, enter the update pairing management information; if the connection fails, return to waiting for pairing; (5.2) Updating device pairing management information: increasing the number of connections in the device pairing management information of the connected Bluetooth device by 1, and synchronously updating the number of connections in the device pairing management information of the configuration file partition on the storage medium.
4. The adaptive Bluetooth pairing method according to claim 1, wherein: The specific process of step (3) is: activating the Bluetooth device that receives the pairing to be in a discoverable state, and waiting for the Bluetooth device that sends the pairing to initiate the pairing operation.
Citation Information
Patent Citations
Bluetooth pairing and connection methods, devices, and readable storage media
CN110972334B
Pairing methods for display devices and Bluetooth devices
CN111542031B
Bluetooth communication method, multimedia equipment and storage medium
CN113543104A
A communication method, device and medium for pairing bluetooth devices
CN113613313B
Initialization method and device of Bluetooth sound box and Bluetooth sound box
CN112948007A