Bluetooth headset automatic pairing method and device for multi-terminal switching
Through technical means such as the double-layer deep belief network and time attenuation factor, the signal interference and connection instability of Bluetooth headphones in multi-terminal switching scenarios are solved, and more stable and efficient automatic pairing and device switching are achieved, improving the user experience.
Patent Information
- Application Number
- CN202510007011.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-03
- Publication Date
- 2025-04-11
- Estimated Expiration
- 2045-01-03
AI Technical Summary
Existing Bluetooth headsets face technical challenges such as signal interference, unstable connections and device priority management in multi-terminal switching scenarios, resulting in poor user experience.
The intelligent calculation of device connection scores is used for the dual-layer deep belief network, and the device priority queue is dynamically updated with the time decay factor, and automatic pairing and device switching are realized through parallel processing of independent signal processing channels and signal quality monitoring.
It effectively reduces the probability of switching failure, improves the stability and user experience of automatic pairing of Bluetooth headsets for multi-terminal switching, and provides more personalized connection services.
Smart Images

Figure CN119402935B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of Bluetooth headsets, and in particular to a method and device for automatically pairing Bluetooth headsets for multi-terminal switching. Background Art
[0002] The demand for automatic switching between multiple terminals of Bluetooth headsets is growing. However, the traditional Bluetooth headset pairing method can usually only maintain a stable connection with a single device. When switching devices, the current connection must be manually disconnected and re-paired. This operation method is not only cumbersome, but also affects the user experience.
[0003] In multi-terminal switching scenarios, Bluetooth headsets face technical challenges such as signal interference, unstable connection, and device priority management. Since Bluetooth communication uses the 2.4GHz frequency band, it is easily interfered by WiFi signals and other Bluetooth devices, resulting in reduced connection quality; at the same time, when multiple devices request a connection at the same time, how to intelligently select the optimal connection device and maintain a stable connection has also become an urgent problem to be solved. The existing Bluetooth headset multi-terminal switching technology mainly relies on simple signal strength judgment or fixed priority strategies, and lacks intelligent adaptability to complex scenarios. This method cannot effectively handle dynamically changing communication environments, and it is difficult to automatically adjust device priorities according to user usage habits, resulting in an unsmooth switching process and affecting the overall user experience. Summary of the invention
[0004] The present invention provides a method and device for automatic pairing of Bluetooth headsets for multi-terminal switching, which effectively reduces the probability of switching failure and improves the stability of automatic pairing of Bluetooth headsets for multi-terminal switching.
[0005] In a first aspect, the present invention provides a method for automatically pairing a Bluetooth headset for multi-terminal switching, the method for automatically pairing a Bluetooth headset for multi-terminal switching comprising:
[0006] Scan the preset area of the Bluetooth headset for device information, obtain the device identification, signal strength value and device status parameters, and store them in the priority database;
[0007] Inputting the signal strength value and the device state parameter into a double-layer deep belief network to perform feature mapping calculation to obtain a device connection score;
[0008] Establishing a first device priority queue based on the device connection score, and dynamically updating and calculating the first device priority queue according to a time decay factor to obtain a second device priority queue;
[0009] Allocate the top three devices in the second device priority queue to independent signal processing channels for parallel processing, and monitor resource occupancy of each independent signal processing channel to obtain effectively connected devices;
[0010] Periodically collecting the signal quality index of the effectively connected device, calculating the difference between the signal quality index and the standard connection parameter, and generating a switching instruction when the difference value exceeds a preset threshold;
[0011] An alternative device is selected from the second device priority queue according to the switching instruction, a pre-connection channel is established with the alternative device to perform pre-connection parameter verification and device switching, and the priority database is updated.
[0012] In a second aspect, the present invention provides a Bluetooth headset automatic pairing device for multi-terminal switching, the Bluetooth headset automatic pairing device for multi-terminal switching comprising:
[0013] The scanning module is used to scan the device information in the preset area of the Bluetooth headset, obtain the device identification, signal strength value and device status parameters, and store them in the priority database;
[0014] A calculation module, used for inputting the signal strength value and the device state parameter into a double-layer deep belief network to perform feature mapping calculation to obtain a device connection score;
[0015] An updating module, configured to establish a first device priority queue based on the device connection score, and dynamically update the first device priority queue according to a time decay factor to obtain a second device priority queue;
[0016] A processing module, used to allocate the top three devices in the second device priority queue to independent signal processing channels for parallel processing, and monitor resource occupancy of each independent signal processing channel to obtain effectively connected devices;
[0017] A generating module, configured to periodically collect the signal quality index of the effectively connected device, calculate the difference between the signal quality index and the standard connection parameter, and generate a switching instruction when the difference value exceeds a preset threshold;
[0018] A switching module is used to select an alternative device from the second device priority queue according to the switching instruction, establish a pre-connection channel with the alternative device to perform pre-connection parameter verification and device switching, and update the priority database.
[0019] The third aspect of the present invention provides a Bluetooth headset automatic pairing device for multi-terminal switching, comprising: a memory and at least one processor, the memory storing instructions; the at least one processor calls the instructions in the memory to enable the Bluetooth headset automatic pairing device for multi-terminal switching to execute the above-mentioned Bluetooth headset automatic pairing method for multi-terminal switching.
[0020] A fourth aspect of the present invention provides a computer-readable storage medium, in which instructions are stored. When the computer-readable storage medium is run on a computer, the computer executes the above-mentioned method for automatic pairing of Bluetooth headsets for multi-terminal switching.
[0021] In the technical solution provided by the present invention, a double-layer deep belief network is introduced to perform feature mapping calculations, thereby realizing intelligent calculation of device connection scores, making device priority sorting more accurate and reasonable, and effectively improving the accuracy of device selection; a time decay factor is used to dynamically update the device priority queue, so that the system can automatically adjust the priority according to the frequency and time of device use, avoiding the limitations brought by fixed priority; a parallel processing mechanism for independent signal processing channels is designed, which significantly reduces the response time of device switching and improves the system operation efficiency by processing connection requests of multiple devices at the same time; a complete signal quality monitoring and device switching mechanism is established, which ensures the stability and reliability of the communication link by real-time monitoring of connection quality and comparing it with a preset threshold; through the design of a pre-connection channel, the parameters of the alternative device are verified before the formal switching, which effectively reduces the probability of switching failure and improves the stability of the system; a dynamic update mechanism of the priority database is adopted, so that the system can continuously optimize the device management strategy and provide more personalized connection services.
[0022] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention are realized and obtained by the structures particularly pointed out in the description, claims and drawings.
[0023] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Figure 1 A schematic diagram of an embodiment of a method for automatic pairing of Bluetooth headsets for multi-terminal switching in an embodiment of the present invention;
[0025] Figure 2 A schematic diagram of an embodiment of a Bluetooth headset automatic pairing device for multi-terminal switching in an embodiment of the present invention;
[0026] Figure 3 The present invention is a schematic diagram of an embodiment of a Bluetooth headset automatic pairing device for multi-terminal switching in an embodiment of the present invention. DETAILED DESCRIPTION
[0027] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0028] The terms "including" and "having" and any variations thereof mentioned in the embodiments of the present invention are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device end including a series of steps or units is not limited to the listed steps or units, but may optionally include other steps or units that are not listed, or may optionally include other steps or units that are inherent to these processes, methods, products or device ends.
[0029] To facilitate understanding of this embodiment, firstly, a method for automatically pairing a Bluetooth headset for multi-terminal switching disclosed in an embodiment of the present invention is described in detail. Figure 1 As shown, the method comprises the following steps:
[0030] 101. Scan the preset area of the Bluetooth headset for device information, obtain the device identification, signal strength value and device status parameter, and store them in the priority database;
[0031] It is understandable that the execution subject of the present invention may be a Bluetooth headset automatic pairing device for multi-terminal switching, or a terminal or a server, which is not limited here. The embodiment of the present invention is described by taking the server as the execution subject as an example.
[0032] Specifically, the scanning range of the wireless communication unit of the Bluetooth headset is set. According to the communication requirements of the device, appropriate scanning configuration parameters are set, including scanning frequency, scanning duration, scanning signal range, etc. Signals of multiple Bluetooth devices within the preset area are collected according to the scanning configuration parameters. During the signal collection process, the Bluetooth headset scans and records the original data of all connectable Bluetooth devices around, including the broadcast signal, signal strength, device information, etc. of the device. Device information is parsed for the original scan data. Effective information is extracted from the broadcast packet of each Bluetooth device, especially key information such as the device's MAC address, pairing key, and communication protocol version number. The MAC address is the unique identifier of the device, and the pairing key and communication protocol version number help to understand the compatibility and communication capabilities of the device. The signal strength value of the original scan data is calculated. In order to ensure the reliability and stability of the signal strength, the collected original data is grouped and processed. Each group of data is classified according to the time period and device distribution of the collection, and the average value and variance of the signal strength of each group of data are calculated to obtain a more representative and stable signal strength value, reduce the impact of accidental factors on the signal quality, and identify devices with poor signal stability through variance analysis. For each device ID, obtain the device's status information, including the device's current battery percentage, the last connection time, and the number of historical connections. This status information not only reflects the device's current status, but also provides information on the activity and stability of the device connection. For example, the device's battery percentage directly affects the continuity and stability of its connection, while the last connection time and the number of historical connections can reflect the device's connection frequency and usage. Combine the device ID, signal strength value, and device status parameters to form a complete data record. Filter the data records to keep only valid data. Write the filtered valid data records into the priority database. During the storage process, a unique index is established based on the device's MAC address to ensure that the specific device record can be quickly located during subsequent queries and updates. The data is sorted and stored according to the acquisition timestamp of the device data to form a device data sequence.
[0033] 102. Input the signal strength value and the device status parameter into the double-layer deep belief network to perform feature mapping calculation to obtain a device connection score;
[0034] Specifically, the signal strength value is constructed as the first feature matrix, which contains the signal strength information of the device and is used to indicate the connection quality between the device and the Bluetooth headset. The power percentage, the most recent connection time, and the number of historical connections in the device status parameters are standardized and constructed as the second feature matrix to reflect the current status and usage history of the device. The first feature matrix and the second feature matrix are concatenated to form an overall input layer data. The number of input layer neurons is set to 8 to carry the merged feature data and obtain feature input data. The feature input data is input into the first layer of the double-layer deep belief network for calculation. The first-layer deep belief network consists of 16 hidden neurons and uses the sigmoid activation function for feature extraction. The sigmoid function can capture the complex relationship between features by nonlinear mapping of the input data, so that the network can find a more accurate connection between signal strength and device status parameters. Through the calculation of this layer, the feature mapping data of the first layer is obtained. The feature mapping data obtained in the first layer is input into the second-layer deep belief network for processing. The second-layer deep belief network contains 8 hidden neurons and uses the ReLU activation function for nonlinear feature conversion. The ReLU function can effectively avoid the gradient vanishing problem and accelerate the convergence of the network during training. Through the processing of this layer, the network can capture more complex nonlinear features, thereby improving the accuracy of the device connection score. Through the processing of this layer, the second layer of feature mapping data is obtained. The second layer of feature mapping data is passed to the output layer for final processing. The output layer uses 4 neurons and uses the softmax function for normalization calculation. The softmax function can convert the output value of the network into a probability distribution to ensure that the output result has a relative weight coefficient. Through the processing of this layer, the network will output the feature weight coefficient of the device connection, reflecting the contribution of each feature to the device connection score, including signal strength weight, signal stability weight, device power weight and historical connection weight. According to these feature weight coefficients, each feature is weighted and summed, and linear mapping is performed to obtain the final device connection score.
[0035] 103. Establish a first device priority queue based on the device connection score, and dynamically update and calculate the first device priority queue according to the time decay factor to obtain a second device priority queue;
[0036] Specifically, the device connection scores are arranged in descending order, so that devices with higher scores are preferentially selected according to the connection quality of the devices. The connection scores of all devices are compared, and devices with connection scores higher than the target score are selected into the priority queue. A unique identifier is assigned to each device to ensure that it is accurately matched to each device in the subsequent priority update, forming the first device priority queue. The difference between the most recent connection time of each device and the current system time is calculated to obtain a device time difference matrix. The difference matrix is used to reflect the most recent connection status of each device and the system. The smaller the difference, the more recently the device has been connected, and the higher the connection activity of the device. In order to dynamically adjust the device priority over time, the device time difference matrix is divided into time intervals. Devices are classified according to different time differences, and different attenuation factors are assigned to devices in different time periods. Generally, the longer the device is connected, the larger the attenuation factor is, indicating that the device has a relatively low connection priority. The time attenuation factor of each device is multiplied by the original connection score to obtain the update score of each device. The update score takes into account the connection quality of the device and the activity of the device (i.e., the most recent connection time between the device and the system). Devices with higher activity will be given higher priority, while devices that have not been connected for a long time will have their priority reduced due to the influence of the decay factor. Sort the devices in descending order according to the update score to obtain the update priority sequence. Detect the communication status of the devices in the update priority sequence to obtain the current communication status of the device, including whether the device is online and whether the signal is stable. This information reflects whether the connection status of the device meets the switching requirements. Detect the communication status of the device to obtain the device status sequence. Group the update priority sequence according to the device status sequence. Divide into different groups according to their communication status. For example, devices in the "stable connection" state will be divided into one group, while devices with unstable signals or temporarily unavailable will be divided into another group. By grouping, the system can better handle the differences between devices and ensure that when selecting devices, it not only considers the device connection score and the time decay factor, but also the actual communication status of the device. The devices in each group will be sorted in descending order of the connection score, and devices with good connection quality will be given priority. The groups are merged to combine the priorities of the devices in each group to obtain the final device priority queue to form the second device priority queue.
[0037] 104. Allocate the top three devices in the second device priority queue to independent signal processing channels for parallel processing, and monitor resource occupancy of each independent signal processing channel to obtain effectively connected devices;
[0038] Specifically, the priority queue of the second device is read with priority. The top three devices are extracted from the queue, and the MAC addresses, pairing keys and communication protocol version numbers of these devices are obtained to form target device data. A unique communication thread number is assigned to each target device so that the connection process of each device can be managed independently during parallel processing. The device processing parameters include information such as the MAC address, pairing key, and communication protocol version number of the device, and three independent signal processing channels are created based on these parameters. Each of these channels is allocated with independent signal bandwidth resources and processing threads to ensure that the connection of each device is carried out in an independent resource environment to avoid resource conflicts. The connection processing of the three devices is carried out in parallel to improve processing efficiency and system response speed, and form a parallel channel group. Pairing key verification and communication protocol matching are performed on each channel in the parallel channel group to ensure that the device can pass protocol verification and key matching before connection. Pairing key verification is an important link to ensure secure connection of devices, while communication protocol matching ensures compatibility between devices and stability of data communication. Through this process, a connection handshake between devices is established to confirm whether the connection status of each channel is normal. In order to ensure the stable operation of each signal processing channel, resource occupancy monitoring is performed, including the calculation and monitoring of the CPU occupancy rate, signal bandwidth usage and memory occupancy of each independent signal processing channel. The monitoring process can timely discover and deal with the bottleneck problem of system resources to ensure the stability of device connection. Through these monitoring data, the resource data of the channel is obtained. The channel resource data is compared with the preset threshold of the system to determine whether the operation status of each signal processing channel is normal. If the resource occupancy of any channel exceeds the preset threshold, such as excessive CPU occupancy, insufficient signal bandwidth or excessive memory occupancy, the channel is resource-reclaimed and the communication thread occupied by it is released to ensure the reasonable use of system resources. For channels in normal status, the system will retain their operation to form a candidate channel set. The device signal quality indicators in the candidate channel set are sorted, and the device with the best signal quality is selected as the final connected device. Signal quality is a key indicator for judging the stability and reliability of device connection. The device with the best signal quality can ensure a more stable and efficient connection between the Bluetooth headset and the terminal. According to the signal quality of the device, the most suitable device is selected for connection to obtain an effectively connected device.
[0039] 105. Periodically collect the signal quality index of the effectively connected device, calculate the difference between the signal quality index and the standard connection parameter, and generate a switching instruction when the difference value exceeds a preset threshold;
[0040] Specifically, a signal acquisition is performed on the effectively connected device to obtain the real-time performance data of the device in the current connection state, including signal strength value, bit error rate and signal delay, reflecting the connection quality of the device. The collected data constitutes a real-time data set, which represents the current connection state of the device and reflects the communication quality between the device and the Bluetooth headset. In order to eliminate the accidental fluctuations in the collected data, the real-time data set is smoothed to reduce the short-term fluctuations caused by environmental changes or other interference factors, so that the evaluation of signal quality is more stable and reliable. After smoothing, the quality index data is obtained. The signal strength value, bit error rate and signal delay in the quality index data are compared and calculated with the standard parameters respectively. The standard parameters are the ideal connection quality values preset in the Bluetooth headset system, representing the communication performance that the device should achieve under ideal conditions. Through comparative calculation, the difference value of each parameter is obtained, that is, the degree of deviation between the actual performance of the current device and the ideal standard. The ratio coefficient is calculated according to the parameter difference value. The signal strength difference ratio is the ratio between the measured signal strength and the standard signal strength, the bit error rate difference ratio is the ratio between the measured bit error rate and the standard bit error rate, and the delay difference ratio is the ratio between the measured delay and the standard delay. Through these ratio coefficients, the degree of device performance deviation is quantified and a difference ratio matrix is formed. The difference ratio matrix is compared with the preset threshold item by item. The threshold is a critical value preset by the system for evaluating the connection quality. The difference exceeding the threshold indicates that the current connection status of the device is not ideal and will affect the stability or quality of the connection. If the difference ratio of any parameter exceeds the preset threshold, it is marked as "overlimit" in the matrix, and parameter evaluation is performed based on these overlimit marks. For the overlimit parameter items, they are classified and counted to identify the root cause of the connection quality problem. For example, unstable connection caused by factors such as low signal strength, high bit error rate or large delay. Through classification and statistics, the specific problem of the device can be judged more accurately, providing a basis for switching decisions. The abnormal parameter set is combined and packaged with the device identification information to generate switching trigger information. The device identification information is an identifier that uniquely identifies each device, ensuring that the device that needs to be switched can be accurately located in a multi-device environment. The switching trigger information not only contains the abnormal parameter set of the device, but also has a timestamp and priority tag. The timestamp is used to mark the time when the instruction is generated to ensure the timeliness of the switching instruction, while the priority tag indicates the importance or urgency of the switching instruction, helping the system to prioritize when multiple devices need to be switched. The switching trigger information is encapsulated in the instruction format to form a switching instruction.
[0041] 106. Select an alternative device from the second device priority queue according to the switching instruction, establish a pre-connection channel with the alternative device to perform pre-connection parameter verification and device switching, and update the priority database.
[0042] Specifically, the abnormal parameter type and priority tag in the switching instruction are extracted. The abnormal parameter type represents the parameter that exceeds the preset threshold during the signal quality evaluation process, and the priority tag indicates the urgency or priority of the switching instruction. By parsing the switching instruction, this information is extracted to generate the requirements of the candidate device. The candidate device requirements are matched with the device information in the second device priority queue to determine the candidate device that best meets the conditions. In this process, the devices are sorted according to their priority scores, and the device with the highest priority is selected from the second device priority queue. If the status of the device is "online", it means that the device is currently available and the connection status is good, it will be selected as the target device. Through matching, the most suitable device is selected from a large number of candidate devices for connection switching to ensure that the switched device can maintain a high connection stability. After the target device is selected, pre-connection resource allocation is performed on the data of the device. An independent pre-connection signal channel is created and corresponding pre-connection parameters are set. These parameters include signal bandwidth, communication protocol version, pairing key, etc., to ensure that the target device can smoothly perform signal detection and data exchange during the pre-connection process. Based on the set pre-connection parameters, signal detection is performed and pre-connection quality data is collected. These data help the system evaluate the performance of the device in the pre-connection stage. The pre-connection quality data is judged by the threshold to determine whether the device meets the switching conditions. If the pre-connection quality meets the requirements, the verification result will be "passed", indicating that the target device meets the switching standards and can perform subsequent switching operations. If the pre-connection verification result is passed, the system will perform the device switching operation. The system will disconnect the communication connection of the original device and adjust the signal bandwidth of the pre-connection channel to adapt to the new connection requirements. The signal bandwidth adjustment ensures that the connection after the device switching can remain stable and avoid signal bottlenecks or poor connection. Establish a formal connection and establish a stable communication channel with the Bluetooth headset as the target device as the new connection device. After the connection is successfully established, a switching status is obtained, indicating that the device switching operation has been completed. Update the score of the original connected device according to the switching status. After the switching is completed, the connection quality of the original connected device changes, and the connection score of the original device is re-evaluated to obtain a new score value. The new score value reflects the performance changes of the original device during the switching process, such as stability after disconnection or whether there is excessive resource usage. The new score value is written to the priority database to ensure that the device score is always kept up to date. As the score is updated, the reordering operation of the second device priority queue is triggered to reorder the queue according to the latest score of the device, ensuring that the device priority always reflects its true connection quality. The priority database is updated to achieve a complete device switching process.
[0043] In the embodiment of the present invention, by introducing a double-layer deep belief network for feature mapping calculation, intelligent calculation of device connection scores is realized, which makes device priority sorting more accurate and reasonable, and effectively improves the accuracy of device selection; the time decay factor is used to dynamically update the device priority queue, so that the system can automatically adjust the priority according to the frequency and time of device use, avoiding the limitations brought by fixed priority; a parallel processing mechanism for independent signal processing channels is designed, and by processing connection requests of multiple devices at the same time, the response time of device switching is significantly reduced, and the system operation efficiency is improved; a complete signal quality monitoring and device switching mechanism is established, and the stability and reliability of the communication link are ensured by real-time monitoring of connection quality and comparing it with the preset threshold; through the design of pre-connection channels, the parameters of alternative devices are verified before formal switching, which effectively reduces the probability of switching failure and improves the stability of the system; the priority database dynamic update mechanism is adopted, so that the system can continuously optimize the device management strategy and provide more personalized connection services.
[0044] In a specific embodiment, the process of executing step 101 may specifically include the following steps:
[0045] Setting a scanning range for the wireless communication unit of the Bluetooth headset to obtain scanning configuration parameters, and collecting signals from multiple Bluetooth devices within a preset area according to the scanning configuration parameters to obtain original scanning data;
[0046] Parse the device information of the original scan data, extract the MAC address, pairing key and communication protocol version number of each device, and obtain the device identification;
[0047] The original scanning data are grouped, and the signal strength average and variance are calculated for each group of data to obtain the signal strength value;
[0048] Obtain status information for each device corresponding to the device identifier, collect the current power percentage of the device, the last connection time, and the number of historical connections, and obtain device status parameters;
[0049] The device identification and the corresponding signal strength value and device status parameters are combined and packaged to generate a data record;
[0050] The data records are screened to obtain valid data records, and the valid data records are written into the priority database. A unique index is established according to the MAC address of the device, and the data is sorted and stored according to the data collection timestamp to obtain the device data sequence.
[0051] Specifically, the wireless communication unit is set to scan a range. The setting of the scanning range determines the spatial range of the Bluetooth device that the Bluetooth headset can detect, and is adjusted by setting the maximum effective distance of the scan or the scanning frequency. In this process, the wireless communication unit of the Bluetooth headset determines the scanning area by setting the scanning configuration parameters. The configuration parameters include the scanning frequency range, scanning duration, scanning interval, etc. The scanning frequency range is determined according to the Bluetooth communication protocol and generally includes the 2.4 GHz frequency band. The scanning duration and scanning interval are key factors for the Bluetooth headset to control the scanning frequency and save power. After setting these parameters, the Bluetooth headset performs signal acquisition according to these configurations and scans multiple Bluetooth devices within the preset area. In this way, the Bluetooth headset can obtain raw scanning data, including information such as the signal strength and MAC address of the device. The Bluetooth headset parses the raw scanning data for device information. From these raw data, the unique identifier of each device, the MAC address, the pairing key and the communication protocol version number are extracted. The MAC address is the unique identifier of each Bluetooth device, the pairing key is used for encrypted communication, and the communication protocol version number determines whether the devices are compatible. The raw scanning data is grouped, and the signal strength of each group of data is statistically analyzed. The signal strength values in each set of data are averaged and their variances are calculated. The set data includes multiple received signal strength values, each of which represents the actual signal strength from the Bluetooth device to the headset. The average signal strength value is calculated using the following formula:
[0052] ;
[0053] in, is the average signal strength, For the The signal strength of the acquisition is is the number of signal acquisitions. By calculating the average signal strength, the average signal strength of each device is obtained. The variance is calculated using the following formula:
[0054] ;
[0055] in, is the variance of the signal strength, For the The signal strength of the acquisition is is the average signal strength, is the number of signal acquisitions. By calculating the variance, we can understand the fluctuation of signal strength and determine whether the signal is stable. The calculation result is stored as the device signal strength value. The Bluetooth headset obtains the status information of each device. The status information includes the device's power percentage, the last connection time, and the number of historical connections. The power percentage indicates the remaining power of the device, which affects whether the device can maintain a stable connection; the last connection time indicates the time when the device was last connected to the Bluetooth headset, reflecting the activity of the device; the number of historical connections helps evaluate the connection reliability and stability of the device. The Bluetooth headset combines the device identification, signal strength value, and device status parameters to generate data records. These data records contain all the information of the Bluetooth device, including the device's unique identifier (MAC address), signal strength, device status, and other information. The data records are stored in the priority database. The data records are filtered to retain only valid data. Valid data refers to records with strong signal strength, sufficient power, and normal device status, while devices with weak signals or long-term inactivity will be filtered out. Through filtering, valid data records are obtained and written into the priority database. The priority database can help the system sort devices according to the signal quality, status, and other information of the devices, thereby determining the priority connection order of the devices. A unique index is created based on the device's MAC address, and the data is sorted and stored based on the data collection timestamp. This makes the data record of each device unique and arranged in chronological order, ensuring that the system can give priority to the most appropriate device when connecting devices. The device data sequence is obtained, in which the records of each device are arranged according to the sorting rules of the priority database.
[0056] In a specific embodiment, the process of executing step 102 may specifically include the following steps:
[0057] The signal strength value is constructed as a first feature matrix, and the power percentage, the last connection time, and the number of historical connections in the device status parameters are standardized to construct a second feature matrix;
[0058] The first feature matrix and the second feature matrix are concatenated to construct input layer data, the number of neurons in the input layer is set to 8, and feature input data is obtained;
[0059] The feature input data is input into the first layer of the double-layer deep belief network for calculation. The first layer of the deep belief network contains 16 hidden neurons and uses the sigmoid activation function for feature extraction to obtain the first layer of feature mapping data.
[0060] The first layer feature map data is input into the second layer deep belief network of the double-layer deep belief network. The second layer deep belief network contains 8 hidden neurons and uses the ReLU activation function for nonlinear feature conversion to obtain the second layer feature map data.
[0061] The second layer feature map data is processed through the output layer. The output layer uses 4 neurons and uses the softmax function for normalization calculation to obtain the feature weight coefficient;
[0062] According to the feature weight coefficient, the signal strength weight, signal stability weight, device power weight and historical connection weight are weighted summed and linearly mapped to obtain the device connection score.
[0063] Specifically, the signal strength value is used to evaluate the connection quality of the device, while the device status parameters help measure the activity and stability of the device. In order to effectively combine signal strength with device status information, the signal strength value is constructed as the first feature matrix, and the device status parameters are constructed as the second feature matrix after standardization. The signal strength value is a negative number in dBm (decibel milliwatts), representing the signal strength between the device and the Bluetooth headset. In order to ensure that the numerical range of all features is unified, the signal strength value is constructed as a matrix, where each row represents a device and the column represents the signal strength value of the device. Assuming there are N devices, the dimension of the signal strength matrix is The device status parameters (battery percentage, battery level, connection time, and historical connection times) are normalized according to their value ranges using the following formula:
[0064] ;
[0065] in, It is the original status data of the device. is the mean of the device data, is the standard deviation of the data. Through standardization, the numerical ranges of power percentage, battery power, last connection time, and historical connection times will be unified to avoid the impact of model training on the value of some features being too large or too small during calculation. After standardization, the device state parameters form the second feature matrix, and the dimension of the matrix is , where N is the number of devices, and 3 represents the three parameters of power, connection time, and historical connection times. The feature matrix (signal strength matrix and device status matrix) is concatenated to obtain the input layer data matrix. The dimension of the concatenated matrix is , containing signal strength and standardized device status information. In order to input the neural network, the number of neurons in the input layer is set to 8. The input data dimension is 4, but additional computing power and complexity are required in the neural network to extract more expressive features. The number of neurons in the input layer is appropriately increased to enhance the learning ability of the network. The feature input data is input into the two-layer deep belief network for processing. The two-layer deep belief network is an unsupervised learning algorithm used for feature learning and pattern recognition. The first layer of the two-layer deep belief network contains 16 hidden neurons, which are used to extract high-level features from the input data. At this layer, the sigmoid activation function is used for feature extraction. The expression of the Sigmoid activation function is:
[0066] ;
[0067] in, is the input of the neuron. The role of the sigmoid function is to map the linear combination of the input to a value between 0 and 1, thereby performing a nonlinear transformation on the data. In the first layer of the deep belief network, the feature input data is calculated by weighting and biasing to obtain the output value of each neuron. These output values are processed by the sigmoid activation function to obtain the feature mapping data of the first layer. The first layer feature mapping data is input to the second layer of the deep belief network for feature conversion. The second layer of the deep belief network contains 8 hidden neurons and uses the ReLU activation function for nonlinear transformation. The expression of the ReLU function is:
[0068] ;
[0069] in, is the input of the neuron. The ReLU activation function has the advantages of sparsity and accelerated training. It erases the negative value part and only retains the positive value part, so that the model can focus more on learning important features. Through this layer of processing, the second layer feature mapping data can effectively extract the nonlinear relationship in the data and help the model better learn the factors affecting the quality of device connection. The second layer feature mapping data is input to the output layer. The output layer uses 4 neurons and uses the softmax activation function for normalization calculation to obtain the weight coefficient of each feature. The Softmax function is used in multi-classification problems to convert each value output by the network into a probability distribution. The calculation formula of the Softmax function is:
[0070] ;
[0071] in, It is The output of a neuron, is the exponential sum of all neuron outputs. The function of the Softmax function is to convert the output of the neural network into the probability distribution of each category, ensuring that the sum of the output values is 1, which helps to evaluate the relative importance of each feature. The output value of the neuron in the output layer represents the weight coefficient of each feature (signal strength, signal stability, device power, number of historical connections, etc.). According to the weight coefficient of the feature, the weights of signal strength, signal stability, power, and historical connections are weighted summed and linearly mapped to obtain the final device connection score. Assume that the weight coefficients of each feature are , the calculation formula of device connection score C is:
[0072] ;
[0073] in, is the signal strength, is the signal stability, is the device power. is the number of historical connections. Through the weighted summation process, the various characteristics of each device are comprehensively considered to obtain the final device connection score.
[0074] In a specific embodiment, the process of executing step 103 may specifically include the following steps:
[0075] Arrange the device connection scores in descending order, select devices whose device connection scores are greater than the target score into a queue and assign a unique identifier to obtain a first device priority queue;
[0076] Calculate the difference between the most recent connection time of each device in the first device priority queue and the current system time to obtain a device time difference matrix;
[0077] Divide the device time difference matrix into time intervals to generate a device time decay factor, and multiply the device time decay factor by the connection score of the corresponding device in the first device priority queue to obtain an updated score;
[0078] The update scores are sorted in descending order according to the numerical values to obtain an update priority sequence, and the communication status of the devices in the update priority sequence is detected to obtain a device status sequence;
[0079] The update priority sequence is grouped based on the device state sequence to obtain a weighted priority sequence, and the devices in the weighted priority sequence are sorted in descending order within the group and merged between groups to obtain a second device priority queue.
[0080] Specifically, the device connection scores are sorted in descending order to obtain a preliminary device priority queue. The device connection score is a comprehensive evaluation of the connection quality and stability of each device, including parameters such as signal strength, device status, and historical connections. The higher the device connection score, the better its connection quality and the higher its priority, and it should be ranked at the front in the priority queue. Sort the connection scores of all devices. Assume that the device connection score is ,in Represents the device number. After arranging these scores in descending order, the devices are arranged in order of priority to obtain the first device priority queue. Calculate the difference between the device's last connection time and the current system time. The device's last connection time represents the device's activity. The longer the connection time, the lower the device's connection demand at the current moment, so a certain attenuation process is required. Suppose device The last connection time of , the current system time is , then the device The time difference is expressed as:
[0081] ;
[0082] Time Difference Matrix , describes the deviation of each device from the current time. The device time decay factor is generated based on the time difference. The time decay factor decreases as the time difference increases, reflecting the timeliness of the device connection. Assuming the decay factor Time difference The relationship is:
[0083] ;
[0084] in, is the attenuation constant, which is used to adjust the effect of time difference on the attenuation factor. This will cause the time difference to have a greater impact on the decay factor. Through this formula, the priority of the device is decayed according to the connection time, ensuring that the priority of devices that have not been connected for a long time is reduced. In order to obtain an updated device connection score, the decay factor is added to the device's original connection score. Multiply them together to get the updated score:
[0085] ;
[0086] in, Yes Equipment The update score after time decay. This step takes the time factor into account in the device priority calculation, ensuring that the priority of devices with longer connection times is appropriately lowered, thereby increasing the priority of devices with higher connection timeliness. Update score for all devices Sort in descending order to get the update priority sequence. The sorted devices are arranged in order according to their priorities. The devices with higher priorities are selected earlier. The communication status of each device in the update priority sequence is detected. The communication status of the device is evaluated by parameters such as signal strength, network delay, and bit error rate. Assume that the device The communication state is represented by a state vector Indicates that Indicates the device The signal strength, Indicates delay, Indicates the bit error rate. Based on this status information, the communication status of the device is determined. For example, a device with low signal strength, high latency, or high bit error rate is considered to be in a poor communication state. Device status sequence Helps the system evaluate the connection quality of the device. Based on the device status sequence, the update priority sequence is grouped. The grouping strategy is determined according to the communication status of the device. For example, devices with better signal strength are grouped into one group, and devices with poor signal strength are grouped into another group. Through grouping, the priority sorting is optimized so that devices with higher priority in the same group are connected first, and devices between groups are further sorted according to their status and score. For devices within each group, they are sorted in descending order according to their update score to ensure that devices with higher priority are connected first within the group. Merge between groups, and the merged sequence is the second device priority queue.
[0087] Among them, the device time difference matrix is divided into time intervals, a device time attenuation factor is generated, and the device time attenuation factor is multiplied by the connection score of the corresponding device in the first device priority queue to obtain an updated score, including: performing a first normalization process on the device time difference matrix, converting the time unit into minutes, and obtaining a first standard time matrix; performing a second normalization process on the first standard time matrix, dividing it into a first time interval, a second time interval, and a third time interval according to a first time threshold of 30 minutes and a second time threshold of 1440 minutes, and obtaining a second standard time matrix; performing a first attenuation factor calculation on the second standard time matrix, the first attenuation coefficient of the first time interval is 1.0, the second attenuation coefficient of the second time interval every 60 minutes is 0.05, and the second attenuation coefficient of the third time interval every 1440 minutes is 0.05. The third attenuation coefficient of 0 minutes is 0.2, and the first attenuation factor matrix is obtained; the first attenuation factor matrix is subjected to a first validity verification, and the first attenuation factor matrix is truncated according to the attenuation threshold 0.3 to obtain the second attenuation factor matrix; the device connection scores in the first device priority queue are subjected to a first data mapping to generate a first weight matrix, and a mapping relationship is established between the first weight matrix according to the device MAC address to obtain the second weight matrix; the second attenuation factor matrix is subjected to a first matrix multiplication operation with the second weight matrix to obtain the first scoring matrix; the first scoring matrix is subjected to a third normalization operation to map the scoring value range to the scoring interval [0,100] to obtain the second scoring matrix; the second scoring matrix is subjected to a second data mapping according to the device MAC address to establish a second mapping relationship to obtain an updated score.
[0088] In a specific embodiment, the process of executing step 104 may specifically include the following steps:
[0089] Priority reading is performed on the second device priority queue to extract the MAC addresses, pairing keys, and communication protocol version numbers of the top three devices to obtain the target device data;
[0090] Assign a unique communication thread number to each device in the target device data, obtain device processing parameters, and create three independent signal processing channels based on the device processing parameters, each channel is assigned independent signal bandwidth resources and processing threads, and a parallel channel group is obtained;
[0091] Perform pairing key verification and communication protocol matching on each channel in the parallel channel group, establish device connection handshake, and obtain channel connection status;
[0092] According to the channel connection status, the CPU occupancy rate of each independent signal processing channel is calculated, the signal bandwidth is monitored, and the memory occupancy is detected to obtain the channel resource data;
[0093] Compare the channel resource data with the system preset threshold to obtain the channel operation status;
[0094] Reclaim resources for channels whose operating status exceeds any threshold, release communication threads, retain channels with normal status, and obtain a set of candidate channels;
[0095] The devices in the candidate channel set are sorted according to the signal quality index, and the device with the best signal quality is selected for connection to obtain the effectively connected device.
[0096] Specifically, the second device priority queue is read with priority, and the top three device data are extracted from it, including the MAC address, pairing key, and communication protocol version number of each device. The sorting information of the devices in the priority queue is used to ensure that devices with higher connection scores are selected first. During the processing of device data, the relevant information of the top three devices is read and recorded. The data of these devices includes the unique identifier of the device (MAC address), the pairing key for verification, and the communication protocol version number used by the device. For each target device data, a unique communication thread number is assigned to each device. Assume that a device is selected from the priority queue. and , assign them thread numbers respectively ,and , get the device processing parameters. The device processing parameters include the pairing key of each device, the communication protocol version number, and the thread number corresponding to the device. Through these processing parameters, resources are effectively allocated to ensure that the communication channel of each device can be processed independently. Based on these processing parameters, three independent signal processing channels are created for each device. The signal processing channels are allocated independent signal bandwidth and processing threads respectively to ensure that the data stream of each device is processed on an independent channel to avoid mutual interference, thereby improving the efficiency of multi-device processing. On this basis, each independent signal processing channel performs pairing key verification and communication protocol matching. Pairing key verification is the process of confirming whether there is a secure connection between devices, while communication protocol matching ensures that devices transmit data under the same protocol version. The pairing key verification process is achieved by comparing whether the pairing keys of the communicating parties match. Assuming that the device The pairing key is ,equipment The pairing key is , then the verification method is:
[0097] ;
[0098] If they match, continue to perform communication protocol matching to ensure that the communication protocol versions of both parties are consistent. If the protocol versions are inconsistent, perform protocol conversion or reselect the appropriate device for connection. The stability of the connection between devices can be ensured through pairing key verification and protocol matching. After pairing and protocol matching, the connection handshake between devices is established, and then enter the channel connection status detection. Monitor the connection status of each signal processing channel in real time, obtain the current connection status of the channel, and determine whether the status meets the requirements for normal operation. Monitor the resource usage of each channel, mainly including CPU usage, signal bandwidth and memory usage. These resource usage data help to determine whether the channel can operate normally. Assuming the device The CPU usage of the signal processing channel is , the signal bandwidth is , the memory usage is , then the resource occupancy of the channel is expressed as a three-dimensional vector:
[0099] ;
[0100] At the same time, the resource usage data is compared according to the system's preset thresholds. Assume that the system sets its own thresholds for CPU, bandwidth, and memory allocation. , the running status of the channel is determined by the following methods:
[0101] ;
[0102] If the resource usage of a channel exceeds the system threshold, the operation status of the channel is abnormal and resource recovery is required. The channel resource usage exceeds the threshold, and the CPU usage Exceeding the threshold , the communication thread of the device is released and its resources are recycled. Through this process, the system can effectively manage the resources of the signal processing channel, avoid excessive bandwidth and computing power, and ensure the stability of system operation. Add the channels in normal state to the candidate channel set, retain the device channels in normal state, and obtain effectively connected devices. Sort the devices in the candidate channel set according to the signal quality index. The signal quality index includes multiple factors such as signal strength, bit error rate, and delay. Assuming that the device The signal quality index is ,equipment The signal quality index is , then the signal quality score The weighted average calculation is:
[0103] ;
[0104] in, are the weights of signal strength, delay and bit error rate respectively, For equipment The signal strength, delay and bit error rate of the device are calculated. This weighted method can comprehensively evaluate the signal quality of each device. The devices in the candidate channel set are sorted according to the signal quality score, and the device with the best signal quality is selected for connection.
[0105] In a specific embodiment, the process of executing step 105 may specifically include the following steps:
[0106] Perform signal acquisition on effectively connected devices, record signal strength values, bit error rates, and signal delays, and obtain real-time data sets;
[0107] Perform data smoothing on the real-time data set to obtain quality index data, and compare and calculate the signal strength value, bit error rate and signal delay in the quality index data with the standard parameters to obtain the parameter difference value;
[0108] The ratio coefficients are calculated according to the parameter difference values. The signal strength difference ratio is the ratio of the measured value to the standard value, the bit error rate difference ratio is the ratio of the measured value to the threshold value, and the delay difference ratio is the ratio of the measured value to the standard value, and a difference ratio matrix is obtained.
[0109] The difference ratio matrix is compared with the preset threshold item by item to obtain the over-limit mark, and the parameter evaluation is performed based on the over-limit mark, and the parameter items exceeding the threshold are classified and counted to obtain the abnormal parameter set;
[0110] The abnormal parameter set is combined and packaged with the device identification information to generate switching trigger information, and a timestamp and a priority tag are added to the switching trigger information, and the instruction format is encapsulated to obtain the switching instruction.
[0111] Specifically, for effectively connected devices, a signal acquisition is performed to record the signal strength value, bit error rate and signal delay, which constitute a real-time data set. Assume that the collected signal strength value is , the bit error rate is , the delay is , these values will be updated regularly within a certain period of time, so as to ensure that the system can monitor the connection quality of the device in real time. Perform data smoothing on the real-time data set to eliminate instantaneous fluctuations and extract the long-term trend of the device connection status. Commonly used smoothing methods include moving average method, weighted average method, etc. Assume that the moving average method is used to smooth the signal strength, bit error rate and delay data. For signal strength , moving average Calculated by the following formula:
[0112] ;
[0113] in, Indicates the window size, It is The signal strength value collected is and delay Perform the same smoothing process to obtain the smoothed data:
[0114] ;
[0115] The smoothed data is used as the quality indicator data for subsequent analysis. The signal strength, bit error rate and delay in the quality indicator data are compared and calculated with the standard parameters to obtain the parameter difference value. Assume that the system sets a standard value for each indicator , Threshold and standard value , the difference value is calculated according to the following formula:
[0116] ;
[0117] ;
[0118] ;
[0119] The difference in signal strength Reflects the deviation between the measured value and the standard value; bit error rate difference Reflects the deviation between the measured value and the preset threshold; delay difference This reflects the deviation between the measured delay and the standard delay. The difference value is converted into a ratio coefficient, and the signal strength difference ratio, bit error rate difference ratio and delay difference ratio are calculated respectively to obtain the difference ratio matrix:
[0120] ;
[0121] Difference ratio matrix Describes the degree of deviation of the connection quality of the device from the standard. Compare the difference ratio matrix with the preset thresholds item by item to obtain the over-limit mark. Assume that the system sets a corresponding threshold for each ratio coefficient , and , the overrun flag is generated by the following formula:
[0122] ;
[0123] ;
[0124] ;
[0125] If any of the marks is 1, it means that there is a problem with the connection quality of the device, which exceeds the preset threshold range. In this case, further parameter evaluation is performed. Through the over-limit mark, the parameter items exceeding the threshold are classified and counted to obtain the abnormal parameter set. Assume that the abnormal parameter set of the device is , these parameters indicate potential problems that exist in the device under the current connection state. Based on the abnormal parameter set and device identification information, the switching trigger information is generated. These trigger information include the unique identifier of the device (such as MAC address), the abnormal parameter set, and the current status mark. In order to ensure the timeliness of the information, a timestamp is added to the switching trigger information and a priority mark is given to it. The timestamp can mark the generation time of the information, and the priority mark indicates the urgency of the switching request. The switching trigger information is generated by the following formula, and the switching trigger information is converted into a standard instruction format through an encapsulation mechanism to obtain a switching instruction. These switching instructions are transmitted to the system control module to guide the device to connect and switch with other target devices.
[0126] In a specific embodiment, the process of executing step 106 may specifically include the following steps:
[0127] Extract the abnormal parameter type and priority mark in the switching instruction and generate the alternative equipment requirements;
[0128] Match the candidate device requirements with the device information in the second device priority queue, select the device with the highest priority and online status as the target device, and obtain the candidate device data;
[0129] Pre-connection resource allocation is performed for candidate device data, an independent pre-connection signal channel is created, and pre-connection parameters are set. At the same time, signal detection is performed based on the pre-connection parameters to obtain pre-connection quality data, and threshold determination is performed on the pre-connection quality data to obtain verification results;
[0130] Based on the verification result, the device switching operation is performed, the communication connection of the original device is disconnected, the signal bandwidth of the pre-connection channel is adjusted, a formal connection is established, and the switching status is obtained;
[0131] The score of the original connected device corresponding to the switching state is updated to obtain a new score value, and the new score value is written into the priority database, triggering a reordering operation of the second device priority queue, and completing the update of the priority database.
[0132] Specifically, when receiving a switching instruction, the system extracts the abnormal parameter type and priority tag in the instruction. These tags include information such as low device signal strength, insufficient power, unstable connection, etc. After extracting this information, the system generates alternative device requirements based on the extracted abnormal parameters and priority tags to define which devices can meet the conditions to participate in device switching. For example, assuming that the system detects that the signal strength of the currently connected device is too low, the system selects devices with high signal strength and online status from other devices as alternative devices. The generated alternative device requirements are matched with the device information in the current device pool (i.e., the second device priority queue). Each device in the device pool contains a priority score, a current connection status (such as online, offline), and other parameters. When the system matches the alternative device requirements, the device with the highest priority score and currently in the "online" state is preferred. For example, if there are 3 devices in the queue, one of which has a high priority score and is online, then the device will be selected as the target device. In this process, the system records data related to the target device to form target device data. Assuming that the priority of the target device is 0.95, the status is online, and its signal strength meets the requirements, then the device becomes the object of switching. Pre-connection resource allocation is performed on the selected target device. In order to achieve seamless device switching, an independent pre-connection signal channel is created for each target device. At this stage, pre-connection parameters are set for each device, including signal bandwidth, delay, and bit error rate. The signal quality is detected according to the pre-connection parameters to obtain pre-connection quality data. The signal quality data includes indicators such as signal strength, bit error rate, and delay, and each indicator will be compared with the preset standard value. For example, assume that the signal strength requirement is -60 dBm, the bit error rate is less than 0.01, and the delay must not exceed 100 ms. By comparing with the standard value, a verification result is calculated to determine whether the device meets the requirements. If the signal quality indicators of the device all reach or exceed the preset threshold, the device will pass the verification and prepare for formal device switching. When the verification result is passed, the system performs the device switching operation. The system disconnects the communication connection of the currently connected device and releases the resources occupied by the device. Adjust the signal bandwidth of the pre-connection channel to meet the needs of the target device and establish a formal connection. Assume that when the formal connection is made, the system adjusts the signal bandwidth of the pre-connection channel according to the bandwidth requirements of the device. For example, if the bandwidth requirement of the target device is 2 Mbps, and the bandwidth of the pre-connection channel is 1 Mbps, the system will adjust the bandwidth to meet the device requirements, thereby ensuring the stability of the device connection. After the device switch is completed, the score of the original connected device is updated, the new score value is calculated, and it is written into the priority database. After the device switch operation is completed, the system triggers the reordering operation of the second device priority queue. According to the new score of the device, the devices in the queue are reordered to ensure that the devices with higher scores and better status are given priority in the next device switch process.The system adjusts the device priority based on the new score value. For example, if the score of the original connected device drops to 0.6, and the score of the newly connected device is 0.9, the system will give priority to the new device at the next switch. The priority database is updated to ensure that the device queue is sorted according to the latest priority, making device connection and switching more intelligent and efficient.
[0133] The method also includes dynamic interference identification and frequency band adaptive adjustment of the connection environment, and the steps include: performing spectrum scanning on the current communication environment, collecting signal strength distribution data in the 2.4GHz frequency band, and obtaining a spectrum data matrix; dividing the spectrum data matrix into 40 sub-channels according to a 2MHz bandwidth, performing signal energy statistics on each sub-channel, and obtaining a channel energy distribution diagram; identifying interference sources based on the channel energy distribution diagram, extracting features of sub-channels with signal energy exceeding -60dBm, and obtaining interference feature data; performing pattern classification on the interference feature data, identifying different types of interference sources such as WiFi, microwave ovens, and other Bluetooth devices, and obtaining an interference source type table; calculating the interference degree of each sub-channel according to the interference source type table, Subchannels with interference levels exceeding 50% are marked to obtain a list of damaged channels; a channel quality assessment model is constructed based on the damaged channel list, and the signal quality scores of the remaining available channels are calculated to obtain a channel score sequence; the channel score sequence is input into the adaptive frequency band selection algorithm, and the three channels with the highest scores are selected as candidate channels to obtain a candidate channel group; the candidate channel group is alternately tested, with each channel transmitting 100 data packets, and the transmission success rate is counted to obtain channel performance data; the optimal channel is selected based on the channel performance data, a frequency band switching instruction is generated, and the current communication link is switched to the target frequency band to obtain the frequency band adjustment result; the frequency band adjustment result is recorded in the priority database as a reference for the device connection score to complete the frequency band optimization.
[0134] The above describes the Bluetooth headset automatic pairing method for multi-terminal switching in the embodiment of the present invention. The following describes the Bluetooth headset automatic pairing device for multi-terminal switching in the embodiment of the present invention. Figure 2 , an embodiment of a Bluetooth headset automatic pairing device for multi-terminal switching in an embodiment of the present invention includes:
[0135] The scanning module 201 is used to scan the device information in the preset area of the Bluetooth headset, obtain the device identification, signal strength value and device status parameter, and store them in the priority database;
[0136] A calculation module 202 is used to input the signal strength value and the device state parameter into a double-layer deep belief network to perform feature mapping calculation to obtain a device connection score;
[0137] An updating module 203 is used to establish a first device priority queue based on the device connection score, and dynamically update the first device priority queue according to the time decay factor to obtain a second device priority queue;
[0138] The processing module 204 is used to allocate the top three devices in the second device priority queue to independent signal processing channels for parallel processing, and monitor resource occupancy of each independent signal processing channel to obtain effectively connected devices;
[0139] A generating module 205 is used to periodically collect the signal quality index of the effectively connected device, calculate the difference between the signal quality index and the standard connection parameter, and generate a switching instruction when the difference value exceeds a preset threshold;
[0140] The switching module 206 is used to select a candidate device from the second device priority queue according to the switching instruction, establish a pre-connection channel with the candidate device to perform pre-connection parameter verification and device switching, and update the priority database.
[0141] Through the coordinated cooperation of the above-mentioned components and the introduction of a two-layer deep belief network for feature mapping calculation, the intelligent calculation of device connection scores is realized, making the device priority sorting more accurate and reasonable, and effectively improving the accuracy of device selection; the time decay factor is used to dynamically update the device priority queue, so that the system can automatically adjust the priority according to the frequency and time of device use, avoiding the limitations brought by fixed priority; a parallel processing mechanism for independent signal processing channels is designed, which significantly reduces the response time of device switching and improves the system operation efficiency by processing connection requests of multiple devices at the same time; a complete signal quality monitoring and device switching mechanism is established, which ensures the stability and reliability of the communication link by real-time monitoring of connection quality and comparing it with the preset threshold; through the design of pre-connection channels, the parameters of alternative devices are verified before the formal switching, which effectively reduces the probability of switching failure and improves the stability of the system; the priority database dynamic update mechanism is adopted, so that the system can continuously optimize the device management strategy and provide more personalized connection services.
[0142] above Figure 2 From the perspective of modular functional entities, the Bluetooth headset automatic pairing device for multi-terminal switching in the embodiment of the present invention is described in detail. The following describes in detail the Bluetooth headset automatic pairing device for multi-terminal switching in the embodiment of the present invention from the perspective of hardware processing.
[0143] Figure 31 is a schematic diagram of the structure of a Bluetooth headset automatic pairing device for multi-terminal switching provided by an embodiment of the present invention. The Bluetooth headset automatic pairing device 300 for multi-terminal switching may have relatively large differences due to different configurations or performances, and may include one or more processors (central processing units, CPU) 310 (for example, one or more processors) and a memory 320, and one or more storage media 330 (for example, one or more mass storage device terminals) storing application programs 333 or data 332. Among them, the memory 320 and the storage medium 330 can be short-term storage or permanent storage. The program stored in the storage medium 330 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations in the Bluetooth headset automatic pairing device 300 for multi-terminal switching. Furthermore, the processor 310 may be configured to communicate with the storage medium 330, and execute a series of instruction operations in the storage medium 330 on the Bluetooth headset automatic pairing device 300 for multi-terminal switching to implement the steps of the above-mentioned Bluetooth headset automatic pairing method for multi-terminal switching.
[0144] The Bluetooth headset automatic pairing device 300 for multi-terminal switching may also include one or more power supplies 340, one or more wired or wireless network interfaces 350, one or more input and output interfaces 360, and / or one or more operating systems 331, such as Windows Serve, Mac OS X, Unix, Linux, FreeBSD, etc. Those skilled in the art will appreciate that Figure 3 The structure of the Bluetooth headset automatic pairing device for multi-terminal switching shown does not constitute a limitation on the Bluetooth headset automatic pairing device for multi-terminal switching provided by the present invention, and may include more or fewer components than shown in the figure, or a combination of certain components, or a different arrangement of components.
[0145] The present invention also provides a computer-readable storage medium, which may be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium. Instructions are stored in the computer-readable storage medium. When the instructions are executed on a computer, the computer executes the steps of the method for automatic pairing of Bluetooth headsets for multi-terminal switching.
[0146] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described systems, systems and units can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0147] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art or the whole or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.
[0148] As described above, the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features thereof may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for automatic pairing of Bluetooth headsets for multi-terminal switching, characterized in that: The method comprises: Scan the preset area of the Bluetooth headset for device information, obtain the device identification, signal strength value and device status parameters, and store them in the priority database; Inputting the signal strength value and the device state parameter into a double-layer deep belief network to perform feature mapping calculation to obtain a device connection score; Establishing a first device priority queue based on the device connection score, and dynamically updating and calculating the first device priority queue according to a time decay factor to obtain a second device priority queue; Allocate the top three devices in the second device priority queue to independent signal processing channels for parallel processing, and monitor resource occupancy of each independent signal processing channel to obtain effectively connected devices; Periodically collecting the signal quality index of the effectively connected device, calculating the difference between the signal quality index and the standard connection parameter, and generating a switching instruction when the difference value exceeds a preset threshold; An alternative device is selected from the second device priority queue according to the switching instruction, a pre-connection channel is established with the alternative device to perform pre-connection parameter verification and device switching, and the priority database is updated.
2. The method for automatic pairing of Bluetooth headsets for multi-terminal switching according to claim 1, characterized in that: The device information scanning is performed on the preset area range of the Bluetooth headset to obtain the device identification, signal strength value and device status parameter, and store them in the priority database, including: Setting a scanning range for a wireless communication unit of the Bluetooth headset to obtain scanning configuration parameters, and collecting signals from multiple Bluetooth devices within a preset area according to the scanning configuration parameters to obtain original scanning data; Parsing the original scan data for device information, extracting the MAC address, pairing key, and communication protocol version number of each device, and obtaining a device identifier; The original scanning data are grouped, and the signal strength average value and variance are calculated for each group of data to obtain a signal strength value; Acquire status information of each device corresponding to the device identifier, collect the current power percentage of the device, the most recent connection time and the number of historical connections, and obtain device status parameters; Combining and packaging the device identification, the corresponding signal strength value, and the device status parameter to generate a data record; The data records are screened to obtain valid data records, and the valid data records are written into a priority database. A unique index is established according to the MAC address of the device, and the data is sorted and stored according to the data collection timestamp to obtain a device data sequence.
3. The method for automatic pairing of Bluetooth headsets for multi-terminal switching according to claim 2, characterized in that: The step of inputting the signal strength value and the device state parameter into a double-layer deep belief network to perform feature mapping calculation to obtain a device connection score includes: The signal strength values are constructed into a first characteristic matrix, and the power percentage, the most recent connection time, and the number of historical connections in the device status parameters are standardized to construct a second characteristic matrix; The first feature matrix and the second feature matrix are concatenated to construct input layer data, the number of neurons in the input layer is set to 8, and feature input data is obtained; Inputting the feature input data into the first layer of the double-layer deep belief network for calculation, the first layer of the deep belief network includes 16 hidden neurons, and a sigmoid activation function is used for feature extraction to obtain the first layer of feature mapping data; Inputting the first layer feature map data into the second layer deep belief network of the double-layer deep belief network, wherein the second layer deep belief network includes 8 hidden neurons and uses a ReLU activation function to perform nonlinear feature conversion to obtain the second layer feature map data; The second layer feature map data is processed through the output layer, the output layer uses 4 neurons, and the softmax function is used for normalization calculation to obtain the feature weight coefficient; The signal strength weight, signal stability weight, device power weight and historical connection weight are weighted and linearly mapped according to the feature weight coefficient to obtain a device connection score.
4. The method for automatic pairing of Bluetooth headsets for multi-terminal switching according to claim 3, characterized in that: The establishing of a first device priority queue based on the device connection score, and dynamically updating and calculating the first device priority queue according to a time decay factor to obtain a second device priority queue includes: Arrange the device connection scores in descending order, select the devices whose device connection scores are greater than the target score into a queue and assign a unique identifier to obtain a first device priority queue; Calculate the difference between the most recent connection time of each device in the first device priority queue and the current system time to obtain a device time difference matrix; Dividing the device time difference matrix into time intervals to generate a device time decay factor, and performing a product operation on the device time decay factor and the connection score of the corresponding device in the first device priority queue to obtain an updated score; Sorting the update scores in descending order according to their numerical values to obtain an update priority sequence, and performing communication status detection on devices in the update priority sequence to obtain a device status sequence; The update priority sequence is grouped based on the device status sequence to obtain a weighted priority sequence, and the devices in the weighted priority sequence are sorted in descending order within the group and merged between groups to obtain a second device priority queue.
5. The method for automatic pairing of Bluetooth headsets for multi-terminal switching according to claim 4, characterized in that: The first three devices in the second device priority queue are assigned to independent signal processing channels for parallel processing, and resource occupancy of each independent signal processing channel is monitored to obtain effectively connected devices, including: Priority reading is performed on the second device priority queue, and the MAC addresses, pairing keys, and communication protocol version numbers of the top three devices are extracted to obtain target device data; Assign a unique communication thread number to each device in the target device data to obtain device processing parameters, and create three independent signal processing channels based on the device processing parameters, each channel is assigned independent signal bandwidth resources and processing threads to obtain a parallel channel group; Perform pairing key verification and communication protocol matching on each channel in the parallel channel group, establish a device connection handshake, and obtain a channel connection status; According to the channel connection status, CPU occupancy calculation, signal bandwidth monitoring and memory occupancy detection are performed on each independent signal processing channel to obtain channel resource data; Compare the channel resource data with a preset threshold value of the system to obtain the channel operation status; Reclaim resources for channels whose operating status exceeds any threshold, release communication threads, retain channels in normal status, and obtain a set of candidate channels; The devices in the candidate channel set are sorted according to the signal quality index, and the device with the best signal quality is selected for connection to obtain an effectively connected device.
6. The method for automatic pairing of Bluetooth headsets for multi-terminal switching according to claim 5, characterized in that: The periodic collection of the signal quality indicator of the effectively connected device, and the difference calculation between the signal quality indicator and the standard connection parameter, and the generation of the switching instruction when the difference value exceeds a preset threshold, include: Performing a signal acquisition on the effectively connected device, recording the signal strength value, bit error rate and signal delay, and obtaining a real-time data set; Performing data smoothing processing on the real-time data set to obtain quality indicator data, and comparing and calculating the signal strength value, bit error rate and signal delay in the quality indicator data with standard parameters respectively to obtain parameter difference values; Calculate the ratio coefficient according to the parameter difference value, the signal strength difference ratio is the ratio of the measured value to the standard value, the bit error rate difference ratio is the ratio of the measured value to the threshold value, and the delay difference ratio is the ratio of the measured value to the standard value, and obtain a difference ratio matrix; The difference ratio matrix is compared with a preset threshold item by item to obtain an over-limit mark, and parameter evaluation is performed based on the over-limit mark, and parameter items exceeding the threshold are classified and counted to obtain an abnormal parameter set; The abnormal parameter set is combined and packaged with the device identification information to generate switching trigger information, and a timestamp and a priority tag are added to the switching trigger information, and instruction format encapsulation is performed to obtain a switching instruction.
7. The method for automatic pairing of Bluetooth headsets for multi-terminal switching according to claim 6, characterized in that: The selecting a candidate device from the second device priority queue according to the switching instruction, establishing a pre-connection channel with the candidate device to perform pre-connection parameter verification and device switching, and updating the priority database includes: Extracting the abnormal parameter type and priority mark in the switching instruction to generate a candidate device requirement; Matching the candidate device requirement with the device information in the second device priority queue, selecting the device with the highest priority and in an online state as the target device, and obtaining candidate device data; Allocate pre-connection resources for the candidate device data, create an independent pre-connection signal channel, and set pre-connection parameters. Meanwhile, perform signal detection based on the pre-connection parameters to obtain pre-connection quality data, and perform threshold determination on the pre-connection quality data to obtain a verification result. Based on the verification result, a device switching operation is performed, the communication connection of the original device is disconnected, the signal bandwidth of the pre-connection channel is adjusted, a formal connection is established, and a switching state is obtained; The score of the original connected device corresponding to the switching state is updated to obtain a new score value, and the new score value is written into the priority database, triggering a reordering operation of the second device priority queue, and completing the update of the priority database.
8. A Bluetooth headset automatic pairing device for multi-terminal switching, characterized in that: The device is used to execute the Bluetooth headset automatic pairing method for multi-terminal switching according to any one of claims 1 to 7, the device comprising: The scanning module is used to scan the device information in the preset area of the Bluetooth headset, obtain the device identification, signal strength value and device status parameters, and store them in the priority database; A calculation module, used for inputting the signal strength value and the device state parameter into a double-layer deep belief network to perform feature mapping calculation to obtain a device connection score; An updating module, configured to establish a first device priority queue based on the device connection score, and dynamically update the first device priority queue according to a time decay factor to obtain a second device priority queue; A processing module, used to allocate the top three devices in the second device priority queue to independent signal processing channels for parallel processing, and monitor resource occupancy of each independent signal processing channel to obtain effectively connected devices; A generating module, configured to periodically collect the signal quality index of the effectively connected device, calculate the difference between the signal quality index and the standard connection parameter, and generate a switching instruction when the difference value exceeds a preset threshold; A switching module is used to select an alternative device from the second device priority queue according to the switching instruction, establish a pre-connection channel with the alternative device to perform pre-connection parameter verification and device switching, and update the priority database.
9. A Bluetooth headset automatic pairing device for multi-terminal switching, characterized in that: The Bluetooth headset automatic pairing device for multi-terminal switching includes: a memory and at least one processor, wherein the memory stores instructions; The at least one processor calls the instruction in the memory so that the Bluetooth headset automatic pairing device for multi-terminal switching executes the Bluetooth headset automatic pairing method for multi-terminal switching as described in any one of claims 1-7.
10. A computer-readable storage medium having instructions stored thereon, characterized in that: When the instruction is executed by the processor, the method for automatic pairing of Bluetooth headsets for multi-terminal switching according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Switching method of master and slave earphones, master earphone, slave earphone, and Bluetooth earphone network
CN109660975A
Bluetooth transmission speed test method and system
CN118573610A