Bluetooth earphone connection management method and system for multi-device seamless switching
By building the device connection pool of Bluetooth headphones and the terminal priority computer system, the seamless switching of Bluetooth headphones between multiple devices is achieved, solving the problem that traditional Bluetooth headphones cannot connect to multiple devices and switch inconveniently, and improving user experience and security.
Patent Information
- Application Number
- CN202511023503.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-24
- Publication Date
- 2025-09-02
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Traditional Bluetooth headsets cannot be connected to multiple devices at the same time, and the switching process is cumbersome and time-consuming, and it cannot achieve efficient and seamless switching, which cannot meet the needs of users to frequently switch between multiple devices.
By establishing a BR/EDR link and BLE topology network of Bluetooth headsets and the master terminal, a device connection pool is built, terminal broadcast packets are collected, device information is obtained, terminal priority is calculated, and encrypted links and switching instructions are established to achieve seamless device switching.
It realizes seamless switching between Bluetooth headphones between multiple devices, improves connection management efficiency and scalability, ensures the continuity and security of audio playback, avoids switching delays and bad experiences, and protects user privacy.
Smart Images

Figure CN120583407A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a Bluetooth headset connection management method and system for seamless switching of multiple devices, belonging to the technical field of wireless communications. Background Art
[0002] Seamless multi-device Bluetooth headset connection management allows a Bluetooth headset to maintain simultaneous connections with multiple Bluetooth devices (such as mobile phones, tablets, and laptops), quickly and smoothly switching audio playback or calls between these devices without noticeable lag, interruptions, or the need for manual re-pairing. This technology significantly improves the user experience, especially when frequently switching audio between multiple devices (such as using a computer and mobile phone at work, or switching from a tablet to a mobile phone during a call on the commute). It is very convenient and efficient.
[0003] Traditional multi-device Bluetooth headset connection management methods typically rely on the "multi-connection mode" specified in the Bluetooth specification, which allows the headset to maintain simultaneous connections with up to two devices (usually one master and one slave). To switch between them, the user must manually pause or disconnect the current connection in the device's Bluetooth settings and then reconnect to the target device. This method typically only supports two simultaneous connections, failing to meet users' needs for connecting to more devices simultaneously. Furthermore, the switching process is cumbersome and time-consuming, making efficient and seamless Bluetooth headset switching impossible. Summary of the Invention
[0004] The present invention provides a Bluetooth headset connection management method and system for seamless switching of multiple devices, the main purpose of which is to improve the effect of seamless switching of multiple devices of the Bluetooth headset.
[0005] To achieve the above objectives, the present invention provides a Bluetooth headset connection management method for seamless multi-device switching, comprising: Establishing a first BR / EDR link between the Bluetooth headset and the main control terminal to establish a BLE topology network of the Bluetooth headset and the auxiliary terminal, and building a device connection pool of the Bluetooth headset based on the first BR / EDR link and the BLE topology network; Using the BLE broadcast channel of the device connection pool to collect terminal broadcast packets of the device connection pool to allocate terminal device identifiers of the device connection pool; Based on the terminal device identifier, obtaining terminal device information of the device connection pool, wherein the terminal device information includes device type, historical connection frequency, real-time signal strength, and current media playback status; Calculating the terminal priority of the device connection pool according to the terminal device information; Based on the terminal priority, the terminal to be switched in the device connection pool is determined, an encryption link and a switching instruction of the terminal to be switched are established, and the audio data packet of the terminal to be switched is transmitted to the headset ring buffer of the Bluetooth headset according to the encrypted link to obtain a buffered audio data packet, and redundant audio data of the master terminal is constructed. Based on the switching instruction, the buffered audio data packet and the redundant audio data, seamless device switching of the Bluetooth headset is performed.
[0006] Optionally, establishing a first BR / EDR link between the Bluetooth headset and the master control terminal includes: Pairing the Bluetooth headset and the main control terminal to obtain a paired headset-main control terminal; Generate a long-term link key for the paired headset-master terminal; And based on the long-term link key, establish a physical link between the paired headset and the master terminal; Performing protocol layer configuration on the paired headset-master terminal to obtain a configuration protocol layer; The physical link and the configuration protocol layer are combined to establish a first BR / EDR link between the paired headset and the master terminal.
[0007] Optionally, establishing a BLE topology network of the Bluetooth headset and the auxiliary terminal includes: Using the Bluetooth headset to correspond to the first BR / EDR link, a Bt command is sent to the Bluetooth headset to trigger the BLE broadcast scanning mode of the Bluetooth headset; Pairing the auxiliary terminal based on the BLE broadcast scanning mode to obtain a paired headset-auxiliary terminal; Define the GATT service for the headset-auxiliary terminal pairing; According to the GATT service, establish the BLE topology network of the paired headset-auxiliary terminal
[0008] Optionally, the constructing the device connection pool of the Bluetooth headset based on the first BR / EDR link and the BLE topology network includes: Registering the master control terminal corresponding to the first BR / EDR link as an anchor device in a preset connection pool to obtain a connection pool anchor device; Defining reserved resources for the connection pool anchor device, wherein the reserved resources include Bluetooth radio frequency bandwidth and a master dedicated buffer area; Based on the connection pool anchor device and the reserved resources, accessing the BLE topology network to the connection pool to obtain a connection pool topology network; The connection pool anchor device and the connection pool topology network are unified in view to obtain a device connection pool of the Bluetooth headset.
[0009] Optionally, acquiring the terminal device information of the device connection pool based on the terminal device identifier includes: According to the terminal device identifier, obtaining the terminal MD field, terminal historical connection data and terminal AVRCP command of the device connection pool; Calculating, based on the MD field, a terminal type confidence of the terminal corresponding to the device connection pool to determine the device type of the terminal corresponding to the device connection pool; Dividing the sequence weights of the terminal historical connection data; Calculating a historical connection frequency of the terminal corresponding to the device connection pool according to the sequence weight and the terminal historical connection data; Defining a terminal sampling frequency of the terminal corresponding to the device connection pool to collect the real-time signal strength of the terminal corresponding to the device connection pool; parsing the current media playback status of the terminal corresponding to the standby connection pool based on the AVRCP command; The terminal device information of the device connection pool is determined based on the device type, historical connection frequency, real-time signal strength and current media playback status.
[0010] Optionally, calculating the historical connection frequency of the terminal corresponding to the device connection pool according to the sequence weight and the terminal historical connection data includes: Determining, based on the terminal historical connection data, a connection duration and a channel quality score of the terminal corresponding to the device connection pool; The historical connection frequency of the terminal corresponding to the device connection pool is calculated using the following formula according to the connection duration, the channel quality score, and the sequence weight:
[0011] in, Indicates the historical connection frequency of the terminal corresponding to the device connection pool. Indicates the device connection pool corresponding to the terminal The sequence weight of the secondary connection, Indicates the device connection pool corresponding to the terminal The duration of the connection, Indicates the maximum duration reference, represents the weight of the connection duration, Indicates the device connection pool corresponding to the terminal The channel quality score of the secondary connection, Indicates the maximum channel quality benchmark, represents the weight of the channel quality score, represents the time decay coefficient, Indicates the timestamp of the last connection. Indicates the timestamp of the first connection.
[0012] Optionally, calculating the terminal priority of the device connection pool according to the terminal device information includes: Mapping the historical connection frequency of the terminal device information to obtain a historical behavior score of the terminal corresponding to the device connection pool; Calculating a signal quality score of the terminal corresponding to the device connection pool based on the device type and real-time signal strength of the terminal device information; Determining the audio encoding type of the device connection pool, and calculating the media status score of the terminal corresponding to the device connection pool based on the audio encoding type and the current media playback status of the terminal device information; Identifying a device intervention operation of a terminal corresponding to the device connection pool, and identifying an intervention intensity of the device intervention operation; Calculating a user intervention sentiment score of a terminal corresponding to the device connection pool based on the device intervention operation and the intervention intensity; The terminal priority of the device connection pool is calculated by combining the historical behavior score, the signal quality score, the media status score, and the user intervention emotion score.
[0013] Optionally, the establishing the encrypted link and the switching instruction of the terminal to be switched includes: Calculating a shared key of the terminal to be switched; Determining parameters required for the encrypted link of the terminal to be switched based on the shared key to establish the encrypted link of the terminal to be switched; Defining a switching instruction structure of the terminal to be switched; A switching instruction for the terminal to be switched is established based on the switching instruction structure and the encrypted link.
[0014] Optionally, transmitting the audio data packet of the terminal to be switched to the headset ring buffer of the Bluetooth headset according to the encrypted link to obtain the buffered audio data packet includes: Framing the audio data packet to obtain a framed audio data packet; Performing AES-CCM encryption on the framed audio data packet to obtain an encrypted audio data packet; Defining a transmission protocol for the encrypted audio data packet; Based on the transmission protocol and the encrypted link, the encrypted audio data packet is transmitted to the headset ring buffer of the Bluetooth headset to obtain a buffered encrypted audio data packet; The buffered encrypted audio data packet is decrypted to obtain the buffered audio data packet.
[0015] In order to solve the above problems, the present invention also provides a Bluetooth headset connection management system for seamless switching of multiple devices, the system comprising: A device connection pool construction module is used to establish a first BR / EDR link between the Bluetooth headset and the main control terminal to establish a BLE topology network of the Bluetooth headset and the auxiliary terminal, and to build a device connection pool of the Bluetooth headset based on the first BR / EDR link and the BLE topology network; A device identifier allocation module, configured to collect terminal broadcast packets of the device connection pool using the BLE broadcast channel of the device connection pool to allocate terminal device identifiers of the device connection pool; a device information acquisition module, configured to acquire terminal device information of the device connection pool based on the terminal device identifier, wherein the terminal device information includes device type, historical connection frequency, real-time signal strength, and current media playback status; A terminal priority calculation module, configured to calculate the terminal priority of the device connection pool based on the terminal device information; The device seamless switching module is used to determine the terminal to be switched in the device connection pool based on the terminal priority, establish an encrypted link and switching instruction for the terminal to be switched, transmit the audio data packet of the terminal to be switched to the headset ring buffer of the Bluetooth headset according to the encrypted link, obtain a buffered audio data packet, construct redundant audio data of the master terminal, and perform device seamless switching of the Bluetooth headset based on the switching instruction, the buffered audio data packet and the redundant audio data.
[0016] First, by building a device connection pool, the solution realizes the unified management and information collection of multiple terminals (including main terminals and auxiliary terminals) connected to the Bluetooth headset. This breaks through the limitations of traditional Bluetooth headsets that can only connect to a single device or the inconvenience of switching, allowing the headset to "sense" and record key information such as the connection status, signal strength, usage frequency and media playback of multiple devices at the same time. This centralized management lays the foundation for subsequent intelligent decision-making and greatly improves the efficiency and scalability of connection management. Secondly, the terminal priority calculation mechanism is introduced. It not only takes into account objective device information (such as signal strength and connection frequency), but also incorporates the subjective factor of user manual intervention coefficient, so that the priority judgment is more in line with the user's actual usage habits and immediate needs. This intelligent priority sorting ensures that the headset can predict more accurately It measures user intentions and prioritizes serving devices that are most likely to need interaction, avoiding connection confusion or switching delays that may occur in traditional methods. Furthermore, the most prominent advantage of this solution is that it achieves seamless switching between devices. By pre-establishing an encrypted link for the terminal to be switched, transmitting audio data to the headphone buffer and constructing redundant audio data, the system can quickly and smoothly complete the transfer of audio streams when the main terminal switches to the auxiliary terminal (or vice versa). This switching process is almost transparent to the user, and the continuity of audio playback is greatly guaranteed, effectively eliminating the adverse experiences such as freezes, interruptions or sudden changes in volume during switching, and significantly improving the smoothness of multitasking or switching between different devices. Finally, the end-to-end encrypted link ensures the security of audio data transmission, especially in a multi-device sharing environment, protecting user privacy. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 A flowchart of a method for managing Bluetooth headset connections with seamless multi-device switching provided by an embodiment of the present invention; Figure 2 A schematic diagram of a module for implementing a Bluetooth headset connection management method for seamless multi-device switching according to an embodiment of the present invention.
[0018] The purpose, features and advantages of the present invention will be further described with reference to the accompanying drawings and in conjunction with the embodiments. DETAILED DESCRIPTION
[0019] It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0020] The embodiment of the present application provides a Bluetooth headset connection management method for seamless switching of multiple devices. The execution subject of the Bluetooth headset connection management method for seamless switching of multiple devices includes but is not limited to at least one of the electronic devices such as a server, a terminal, etc. that can be configured to execute the method provided by the embodiment of the present application. In other words, the Bluetooth headset connection management method for seamless switching of multiple devices can be executed by software or hardware installed on a terminal device or a server device. The server includes but is not limited to: a single server, a server cluster, a cloud server or a cloud server cluster, etc.
[0021] Reference Figure 1 FIG. 1 is a flow chart of a method for managing a Bluetooth headset connection with seamless multi-device switching according to an embodiment of the present invention. In this embodiment, the method for managing a Bluetooth headset connection with seamless multi-device switching includes: S1. Establish a first BR / EDR link between a Bluetooth headset and a master terminal to establish a BLE topology network of the Bluetooth headset and the auxiliary terminal, and build a device connection pool of the Bluetooth headset based on the first BR / EDR link and the BLE topology network.
[0022] The present invention establishes a first BR / EDR link between the Bluetooth headset and the main control terminal to provide a basis for subsequent topology network construction.
[0023] In detail, the establishment of the first BR / EDR link between the Bluetooth headset and the master terminal includes: Pairing the Bluetooth headset and the main control terminal to obtain a paired headset-main control terminal; Generate a long-term link key for the paired headset-master terminal; And based on the long-term link key, establish a physical link between the paired headset and the master terminal; Performing protocol layer configuration on the paired headset-master terminal to obtain a configuration protocol layer; The physical link and the configuration protocol layer are combined to establish a first BR / EDR link between the paired headset and the master terminal.
[0024] Among them, the paired headset-main control terminal refers to the Bluetooth headset and the main control terminal that have successfully established an identity recognition relationship through the Bluetooth pairing process, the long-term link key refers to a string of encryption keys generated during the pairing process, and the physical link refers to the underlying communication channel actually established between the Bluetooth headset and the main control terminal through radio waves (Bluetooth radio frequency) for transmitting data. The configuration protocol layer refers to the protocol layer after specific parameter settings and function activation to support specific communication services (for example, for BR / EDR connections, it may be necessary to configure LMP parameters to support EDR high rate, configure L2CAP channels to carry audio data, configure AVDTP protocols to support audio streaming transmission, etc.). The first BR / EDR link refers to the first Bluetooth basic rate / enhanced data rate connection established from scratch.
[0025] Optionally, the Bluetooth headset and the main control terminal are paired to obtain the paired headset-main control terminal, including the Bluetooth headset broadcasting device information through the Inquiry Scan mode of BR / EDR, and the main control terminal discovers and filters the broadcast device information according to specific conditions (RSSI ≥-70dBm, supporting AAC codec and mSBC voice at the same time).
[0026] The present invention establishes a BLE topology network of the Bluetooth headset and the auxiliary terminal to achieve unified management and information collection of multiple terminals (including the main control terminal and the auxiliary terminal) connected to the Bluetooth headset.
[0027] In detail, the establishment of the BLE topology network of the Bluetooth headset and the auxiliary terminal includes: Using the Bluetooth headset to correspond to the first BR / EDR link, a Bt command is sent to the Bluetooth headset to trigger the BLE broadcast scanning mode of the Bluetooth headset; Pairing the auxiliary terminal based on the BLE broadcast scanning mode to obtain a paired headset-auxiliary terminal; Define the GATT service for the headset-auxiliary terminal pairing; According to the GATT service, a BLE topology network of the paired headset and the auxiliary terminal is established.
[0028] Among them, the Bt command refers to a specific instruction sent from the main control terminal to the Bluetooth headset through the first BR / EDR (traditional Bluetooth) connection that has been established. The BLE broadcast scan mode refers to a working state entered by the Bluetooth headset after receiving the Bt command, and starts to monitor (scan) the broadcast signals emitted by other BLE devices (especially auxiliary terminals) in the surrounding environment. The paired headset-auxiliary terminal refers to the state after the Bluetooth headset and the auxiliary terminal (such as a smart watch, tablet or other device that supports BLE) successfully establish an identity recognition relationship through the Bluetooth pairing process. The GATT service refers to the application layer protocol defined in Bluetooth Low Energy (BLE). The BLE topology network refers to the structure of how multiple auxiliary devices connect and communicate with each other.
[0029] Optionally, the pairing of the auxiliary terminal to obtain a paired headset and the auxiliary terminal may be performed by deriving the LTK of the auxiliary terminal through the link key of the first BR / EDR link.
[0030] Based on the first BR / EDR link and the BLE topology network, this invention builds a device connection pool for Bluetooth headsets, overcoming the limitations of traditional Bluetooth headsets, which can only connect to a single device or face inconvenient switching. This allows the headsets to simultaneously "sense" and record key information such as the connection status, signal strength, usage frequency, and media playback status of multiple devices. This centralized management lays the foundation for subsequent intelligent decision-making and greatly improves the efficiency and scalability of connection management.
[0031] In detail, the device connection pool of the Bluetooth headset is constructed based on the first BR / EDR link and the BLE topology network, including: Registering the master control terminal corresponding to the first BR / EDR link as an anchor device in a preset connection pool to obtain a connection pool anchor device; Defining reserved resources for the connection pool anchor device, wherein the reserved resources include Bluetooth radio frequency bandwidth and a master dedicated buffer area; Based on the connection pool anchor device and the reserved resources, accessing the BLE topology network to the connection pool to obtain a connection pool topology network; The connection pool anchor device and the connection pool topology network are unified in view to obtain a device connection pool of the Bluetooth headset.
[0032] Among them, the connection pool anchor device refers to the device designated as the basic node when building the device connection pool of the Bluetooth headset. The Bluetooth radio frequency bandwidth is the total spectrum resource available to the Bluetooth headset on the wireless radio frequency (RF) band for transmitting data. The Bluetooth radio frequency bandwidth in the present invention is 80% of the Bluetooth radio frequency bandwidth (to ensure the stability of the audio stream). The master-specific cache area refers to an independent storage space in the internal memory of the Bluetooth headset that is specifically divided for storing audio data or other types of data from the master terminal (anchor device). The master-specific cache area in the present invention has an audio data capacity of ≥200ms. The connection pool refers to a Bluetooth headset internally maintained A data structure or collection is a basic framework for recording and managing all known and paired Bluetooth terminal devices and their related information. The connection pool topology network refers to an overall network view formed by integrating all devices that have joined the connection pool (including anchor devices and auxiliary terminals accessed through the BLE topology network) and their mutual connection relationships (BR / EDR or BLE). The device connection pool refers to a complete device management set obtained by integrating all devices (including auxiliary terminals accessed through the BLE network) and their connection relationships (forming a connection pool topology network) and unifying the view (which may refer to data structure integration and state synchronization).
[0033] Optionally, the reserved resources defining the connection pool anchor device may be established in a time division multiplexing manner.
[0034] S2. Utilize the BLE broadcast channel of the device connection pool to collect terminal broadcast packets of the device connection pool to allocate terminal device identifiers of the device connection pool.
[0035] The present invention utilizes the BLE broadcast channel of the device connection pool to collect terminal broadcast packets of the device connection pool, so as to allocate terminal device identifiers of the device connection pool to provide a basis for subsequent priority analysis.
[0036] It should be explained that the BLE broadcast channel refers to a specific communication channel in the Bluetooth Low Energy (BLE) protocol used for device discovery and initial communication, the terminal broadcast packet refers to a data packet sent by each terminal device in the device connection pool (whether it is a master terminal or an auxiliary terminal) on its BLE broadcast channel, and the terminal device identifier refers to a symbol used to uniquely identify each terminal device in the device connection pool.
[0037] S3. Based on the terminal device identifier, obtain the terminal device information of the device connection pool, wherein the terminal device information includes device type, historical connection frequency, real-time signal strength and current media playback status.
[0038] The present invention obtains the terminal device information of the device connection pool based on the terminal device identifier, which can determine the current state of the terminal device and improve the accuracy of device switching.
[0039] In detail, the acquiring the terminal device information of the device connection pool based on the terminal device identifier includes: According to the terminal device identifier, obtaining the terminal MD field, terminal historical connection data and terminal AVRCP command of the device connection pool; Calculating, based on the MD field, a terminal type confidence of the terminal corresponding to the device connection pool to determine the device type of the terminal corresponding to the device connection pool; Dividing the sequence weights of the terminal historical connection data; Calculating a historical connection frequency of the terminal corresponding to the device connection pool according to the sequence weight and the terminal historical connection data; Defining a terminal sampling frequency of the terminal corresponding to the device connection pool to collect the real-time signal strength of the terminal corresponding to the device connection pool; parsing the current media playback status of the terminal corresponding to the standby connection pool based on the AVRCP command; The terminal device information of the device connection pool is determined based on the device type, historical connection frequency, real-time signal strength and current media playback status.
[0040] The terminal MD field is a custom field in the BLE advertising packet, a binary data block written by the device manufacturer, used to identify the device type, functional characteristics, etc. The terminal historical connection data is a quantitative record of past connection behaviors between a terminal and a headset in the device connection pool, including the number of connections, duration, time period, etc. The terminal AVRCP command is an audio and video remote control protocol instruction used to obtain or control the media playback status. The terminal type confidence is a calculated device type determination reliability score. The device type is a classification identifier of the terminal device, such as a smartphone, tablet, laptop, or smart TV. The sequence weight is a single weight of the historical connection record. The historical connection frequency is the weighted number of connections between the terminal and the headset per unit time (usually 7 days). The terminal sampling frequency is the dynamic sampling rate for collecting the terminal's real-time signal strength (RSSI). The real-time signal strength is the RF signal strength indicator between the terminal and the headset. The current media playback status is a bit mask encoding of the terminal's audio activity status, including playing, calling, and microphone on. The terminal device information is a complete description data structure of a terminal in the device connection pool.
[0041] Optionally, the terminal sampling frequency of the terminal corresponding to the device connection pool defined can be adaptively adjusted according to the device type and power level. For example, when the device power level is greater than 50%, the sampling frequency of the smartphone terminal is 10Hz, the tablet is 5Hz, and the TV is 1Hz; when the device power level is less than 20%, the sampling frequency of the smartphone terminal is 2Hz, the tablet is 1Hz, and the TV is 0.5Hz.
[0042] Furthermore, the calculating, based on the sequence weight and the terminal historical connection data, the historical connection frequency of the terminal corresponding to the device connection pool includes: Determining, based on the terminal historical connection data, a connection duration and a channel quality score of the terminal corresponding to the device connection pool; Calculate the historical connection frequency of the terminal corresponding to the device connection pool using the following formula based on the connection duration, the channel quality score, and the sequence weight; Furthermore, as another embodiment of the present invention, the historical connection frequency is calculated by the following formula:
[0043] in, Indicates the historical connection frequency of the terminal corresponding to the device connection pool. Indicates the device connection pool corresponding to the terminal The sequence weight of the secondary connection, Indicates the device connection pool corresponding to the terminal The duration of the connection, Indicates the maximum duration reference, represents the weight of the connection duration, Indicates the device connection pool corresponding to the terminal The channel quality score of the secondary connection, Indicates the maximum channel quality benchmark, represents the weight of the channel quality score, represents the time decay coefficient, Indicates the timestamp of the last connection. Indicates the timestamp of the first connection.
[0044] Among them, the connection duration refers to the continuous duration from establishment to disconnection of a single Bluetooth connection, the channel quality score refers to the normalized score of the comprehensive signal strength and packet loss rate, reflecting the link reliability, the maximum duration benchmark refers to the upper limit threshold used to normalize the connection duration, to avoid excessive impact of excessive connections on the calculation results, the maximum channel quality benchmark refers to the theoretical optimal value of the channel quality score, and the time decay coefficient refers to the exponential coefficient that controls the decay rate of the weight of historical connection data, and the value varies according to different time spans.
[0045] S4. Calculate the terminal priority of the device connection pool based on the terminal device information.
[0046] The present invention calculates the terminal priority of the device connection pool through the terminal device information, not only considering objective device information (such as signal strength and connection frequency), but also incorporating the subjective factor of user manual intervention coefficient, so that the priority judgment is more in line with the user's actual usage habits and immediate needs.
[0047] In detail, the calculating of the terminal priority of the device connection pool by using the terminal device information includes: Mapping the historical connection frequency of the terminal device information to obtain a historical behavior score of the terminal corresponding to the device connection pool; Calculating a signal quality score of the terminal corresponding to the device connection pool based on the device type and real-time signal strength of the terminal device information; Determining the audio encoding type of the device connection pool, and calculating the media status score of the terminal corresponding to the device connection pool based on the audio encoding type and the current media playback status of the terminal device information; Identifying a device intervention operation of a terminal corresponding to the device connection pool, and identifying an intervention intensity of the device intervention operation; Calculating a user intervention sentiment score of a terminal corresponding to the device connection pool based on the device intervention operation and the intervention intensity; The terminal priority of the device connection pool is calculated by combining the historical behavior score, the signal quality score, the media status score, and the user intervention emotion score.
[0048] The historical behavior score is a quantitative assessment of the terminal device's past connection behavior patterns. A higher score generally indicates that the device is more frequently used by the user, reflecting the user's long-term usage habits. The signal quality score is a quantitative assessment of the quality of the wireless signal currently connected to the terminal device. Stronger signal strength (closer to 0 dBm) indicates better signal quality and a more stable connection. The audio coding type is the Bluetooth audio codec currently supported or currently in use by the terminal device, such as SBC and AAC. The media status score is a quantitative assessment of the current media playback status of the terminal device. The device intervention operation is an operation actively performed by the user on the connection status or media playback through the Bluetooth headset itself or the main control terminal (such as a mobile phone). The intervention intensity is a quantitative assessment of the strength or urgency of the user's intention reflected by the "device intervention operation". The user intervention emotion score is a quantitative assessment of the user's emotion or intention reflected by the user intervention operation and its intensity. The terminal priority is a comprehensive score used to determine which terminal device should prioritize establishing or maintaining a connection.
[0049] Optionally, the media status score for the terminal corresponding to the device connection pool is calculated based on the audio encoding type and the current media playback status of the terminal device information. Dynamically adjusting the media score based on the audio encoding type can use a nonlinear function (such as an exponential function or a logarithmic function) to adjust the score to better reflect the actual impact of certain states or encoding types on the user experience. For example, a nonlinear boost can be given to the "Now Playing" state, while a nonlinear penalty can be applied to low-quality encoding.
[0050] S5. Based on the terminal priority, determine the terminal to be switched in the device connection pool, establish an encrypted link and a switching instruction for the terminal to be switched, transmit the audio data packet of the terminal to be switched to the headset ring buffer of the Bluetooth headset according to the encrypted link, obtain a buffered audio data packet, construct redundant audio data of the master terminal, and perform seamless device switching of the Bluetooth headset based on the switching instruction, the buffered audio data packet and the redundant audio data.
[0051] The present invention determines the terminal to be switched from the device connection pool based on the terminal priority, establishes an encrypted link and a switching instruction for the terminal to be switched, and ensures that the headset can more accurately predict the user's intention and prioritize services for the device most likely to interact, avoiding connection confusion or switching delays that may occur in traditional methods. The terminal to be switched is the terminal with the highest terminal priority, which will replace the current master terminal.
[0052] In detail, the step of establishing the encrypted link and the switching instruction of the terminal to be switched includes: Calculating a shared key of the terminal to be switched; Determining parameters required for the encrypted link of the terminal to be switched based on the shared key to establish the encrypted link of the terminal to be switched; Defining a switching instruction structure of the terminal to be switched; A switching instruction for the terminal to be switched is established based on the switching instruction structure and the encrypted link.
[0053] Among them, the shared key refers to the symmetric key generated by negotiation between the terminal to be switched and the current device (such as a Bluetooth headset) through a secure pairing protocol (such as LE Secure Connections or a pre-shared key PSK); the parameters required for the encrypted link refer to a set of configuration parameters required when building an encrypted communication link; the encrypted link refers to a communication channel established based on the shared key and encryption parameters to ensure data transmission security; the switching instruction structure refers to the data format that defines the switching instruction, including an instruction identifier, information about the terminal to be switched, operation parameters, a check field, etc.; the switching instruction refers to the instruction finally generated for switching the terminal to be switched and the master terminal.
[0054] Optionally, the calculation of the shared key of the terminal to be switched is usually generated by a key derivation function (such as HKDF) from input during pairing (such as a PIN code, a random number, a device address, etc.).
[0055] The present invention transmits the audio data packets of the terminal to be switched to the Bluetooth headset's ring buffer over the encrypted link. The resulting buffered audio data packets enable rapid and smooth transfer of the audio stream when switching from the primary terminal to the secondary terminal (or vice versa). This switching process is virtually transparent to the user, greatly ensuring the continuity of audio playback and effectively eliminating undesirable experiences such as lag, interruptions, or sudden volume changes during switching. This significantly improves the smoothness of multitasking or switching between different devices.
[0056] In detail, the step of transmitting the audio data packet of the terminal to be switched to the headset ring buffer of the Bluetooth headset according to the encrypted link to obtain the buffered audio data packet includes: Framing the audio data packet to obtain a framed audio data packet; Performing AES-CCM encryption on the framed audio data packet to obtain an encrypted audio data packet; Defining a transmission protocol for the encrypted audio data packet; Based on the transmission protocol and the encrypted link, the encrypted audio data packet is transmitted to the headset ring buffer of the Bluetooth headset to obtain a buffered encrypted audio data packet; The buffered encrypted audio data packet is decrypted to obtain the buffered audio data packet.
[0057] Among them, the framed audio data packet refers to dividing a continuous audio data stream into data blocks (frames) of fixed or variable length, each frame containing a complete audio sample (such as PCM data), the encrypted audio data packet refers to the ciphertext data packet generated after applying AES-CCM encryption to the framed audio data packet, the transmission protocol refers to the rules defining the transmission of encrypted audio data packets on the Bluetooth link, including data format: such as header (frame number, encryption identifier), payload (encrypted audio data), and tail (authentication tag); transmission method: such as BLE's ATT protocol and Bluetooth A2DP audio protocol, the headphone ring buffer refers to the memory area used by the headphone end to temporarily store received encrypted audio data packets, the buffered encrypted audio data refers to the encrypted audio data packet written to the headphone ring buffer, and the buffered audio data packet refers to the original audio data obtained after decrypting the buffered encrypted audio data packet.
[0058] Optionally, the AES-CCM encryption of the framed audio data packet may be implemented by using a pre-established LTK (link key) and IV (initialization vector).
[0059] Finally, the present invention constructs redundant audio data for the master control terminal and, based on the switching instruction, the buffered audio data packet, and the redundant audio data, performs seamless device switching of the Bluetooth headset, thereby ensuring the security of audio data transmission through an end-to-end encrypted link. The redundant audio data refers to a backup audio data packet pre-constructed to ensure audio continuity during the switching process.
[0060] First, by building a device connection pool, the solution realizes the unified management and information collection of multiple terminals (including main terminals and auxiliary terminals) connected to the Bluetooth headset. This breaks through the limitations of traditional Bluetooth headsets that can only connect to a single device or the inconvenience of switching, allowing the headset to "sense" and record key information such as the connection status, signal strength, usage frequency and media playback of multiple devices at the same time. This centralized management lays the foundation for subsequent intelligent decision-making and greatly improves the efficiency and scalability of connection management. Secondly, the terminal priority calculation mechanism is introduced. It not only takes into account objective device information (such as signal strength and connection frequency), but also incorporates the subjective factor of user manual intervention coefficient, so that the priority judgment is more in line with the user's actual usage habits and immediate needs. This intelligent priority sorting ensures that the headset can predict more accurately It measures user intentions and prioritizes serving devices that are most likely to need interaction, avoiding connection confusion or switching delays that may occur in traditional methods. Furthermore, the most prominent advantage of this solution is that it achieves seamless switching between devices. By pre-establishing an encrypted link for the terminal to be switched, transmitting audio data to the headphone buffer and constructing redundant audio data, the system can quickly and smoothly complete the transfer of audio streams when the main terminal switches to the auxiliary terminal (or vice versa). This switching process is almost transparent to the user, and the continuity of audio playback is greatly guaranteed, effectively eliminating the adverse experiences such as freezes, interruptions or sudden changes in volume during switching, and significantly improving the smoothness of multitasking or switching between different devices. Finally, the end-to-end encrypted link ensures the security of audio data transmission, especially in a multi-device sharing environment, protecting user privacy.
[0061] like Figure 2 FIG. 1 is a functional module diagram of a Bluetooth headset connection management system for seamless switching of multiple devices according to the present invention.
[0062] The Bluetooth headset connection management system 200 for seamless multi-device switching described in the present invention can be installed in an electronic device. Depending on the functions implemented, the Bluetooth headset connection management system for seamless multi-device switching can include a device connection pool construction module 201, a device identifier allocation module 202, a device information acquisition module 203, a terminal priority calculation module 204, and a device seamless switching module 205. The module described in the present invention can also be referred to as a unit, which refers to a series of computer program segments that can be executed by an electronic device processor and can perform fixed functions, and is stored in the memory of the electronic device.
[0063] In the embodiment of the present invention, the functions of each module / unit are as follows: The device connection pool construction module 201 is used to establish a first BR / EDR link between the Bluetooth headset and the main control terminal to establish a BLE topology network of the Bluetooth headset and the auxiliary terminal, and build a device connection pool of the Bluetooth headset based on the first BR / EDR link and the BLE topology network; The device identifier allocation module 202 is configured to collect terminal broadcast packets of the device connection pool using the BLE broadcast channel of the device connection pool to allocate terminal device identifiers of the device connection pool; The device information acquisition module 203 is configured to acquire terminal device information of the device connection pool based on the terminal device identifier, wherein the terminal device information includes device type, historical connection frequency, real-time signal strength, and current media playback status; The terminal priority calculation module 204 is used to calculate the terminal priority of the device connection pool according to the terminal device information; The device seamless switching module 205 is used to determine the terminal to be switched in the device connection pool based on the terminal priority, establish an encrypted link and switching instruction for the terminal to be switched, transmit the audio data packet of the terminal to be switched to the headset ring buffer of the Bluetooth headset according to the encrypted link, obtain a buffered audio data packet, construct redundant audio data of the master terminal, and perform device seamless switching of the Bluetooth headset based on the switching instruction, the buffered audio data packet and the redundant audio data.
[0064] In detail, the modules in the Bluetooth headset connection management system 200 for seamless multi-device switching according to the embodiment of the present invention are used in the same manner as above. Figure 1 The same technical means are used as the method for seamlessly switching Bluetooth headset connections between multiple devices described in , and can produce the same technical effects, so I will not go into details here.
[0065] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the present invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the present invention.
[0066] Finally, it should be noted that among the above-mentioned multiple embodiments, each embodiment can be combined with each other or be independent, and deleting any one of them will not affect the technical implementation of other embodiments. The above embodiments are only used to illustrate the technical solution of the present invention and are not limiting. Although the present invention is described in detail with reference to the preferred embodiments, ordinary technicians in this field should understand that the technical solution of the present invention can be modified or replaced by equivalents without departing from the spirit and scope of the technical solution of the present invention.
Claims
1. A Bluetooth headset connection management method for seamless switching of multiple devices, characterized in that: The method comprises: Establishing a first BR / EDR link between the Bluetooth headset and the main control terminal to establish a BLE topology network of the Bluetooth headset and the auxiliary terminal, and building a device connection pool of the Bluetooth headset based on the first BR / EDR link and the BLE topology network; Using the BLE broadcast channel of the device connection pool to collect terminal broadcast packets of the device connection pool to allocate terminal device identifiers of the device connection pool; Based on the terminal device identifier, obtaining terminal device information of the device connection pool, wherein the terminal device information includes device type, historical connection frequency, real-time signal strength, and current media playback status; Calculating the terminal priority of the device connection pool according to the terminal device information; Based on the terminal priority, the terminal to be switched in the device connection pool is determined, an encryption link and a switching instruction of the terminal to be switched are established, and the audio data packet of the terminal to be switched is transmitted to the headset ring buffer of the Bluetooth headset according to the encrypted link to obtain a buffered audio data packet, and redundant audio data of the master terminal is constructed. Based on the switching instruction, the buffered audio data packet and the redundant audio data, seamless device switching of the Bluetooth headset is performed.
2. The Bluetooth headset connection management method for seamless multi-device switching according to claim 1, wherein: The establishing of a first BR / EDR link between the Bluetooth headset and the master control terminal includes: Pairing the Bluetooth headset and the main control terminal to obtain a paired headset-main control terminal; Generate a long-term link key for the paired headset-master terminal; And based on the long-term link key, establish a physical link between the paired headset and the master terminal; Performing protocol layer configuration on the paired headset-master terminal to obtain a configuration protocol layer; The physical link and the configuration protocol layer are combined to establish a first BR / EDR link between the paired headset and the master terminal.
3. The Bluetooth headset connection management method for seamless multi-device switching according to claim 2, wherein: The establishing of the BLE topology network of the Bluetooth headset and the auxiliary terminal includes: Using the Bluetooth headset to correspond to the first BR / EDR link, a Bt command is sent to the Bluetooth headset to trigger the BLE broadcast scanning mode of the Bluetooth headset; Pairing the auxiliary terminal based on the BLE broadcast scanning mode to obtain a paired headset-auxiliary terminal; Define the GATT service for the headset-auxiliary terminal pairing; According to the GATT service, a BLE topology network of the paired headset and the auxiliary terminal is established.
4. The Bluetooth headset connection management method for seamless multi-device switching according to claim 3, wherein: The constructing the device connection pool of the Bluetooth headset based on the first BR / EDR link and the BLE topology network includes: Registering the master control terminal corresponding to the first BR / EDR link as an anchor device in a preset connection pool to obtain a connection pool anchor device; Defining reserved resources for the connection pool anchor device, wherein the reserved resources include Bluetooth radio frequency bandwidth and a master dedicated buffer area; Based on the connection pool anchor device and the reserved resources, accessing the BLE topology network to the connection pool to obtain a connection pool topology network; The connection pool anchor device and the connection pool topology network are unified in view to obtain a device connection pool of the Bluetooth headset.
5. The Bluetooth headset connection management method for seamless multi-device switching according to claim 4, characterized in that: The acquiring, based on the terminal device identifier, the terminal device information of the device connection pool includes: According to the terminal device identifier, obtaining the terminal MD field, terminal historical connection data and terminal AVRCP command of the device connection pool; Calculating, based on the MD field, a terminal type confidence of the terminal corresponding to the device connection pool to determine the device type of the terminal corresponding to the device connection pool; Dividing the sequence weights of the terminal historical connection data; Calculating a historical connection frequency of the terminal corresponding to the device connection pool according to the sequence weight and the terminal historical connection data; Defining a terminal sampling frequency of the terminal corresponding to the device connection pool to collect the real-time signal strength of the terminal corresponding to the device connection pool; parsing the current media playback status of the terminal corresponding to the standby connection pool based on the AVRCP command; The terminal device information of the device connection pool is determined based on the device type, historical connection frequency, real-time signal strength and current media playback status.
6. The Bluetooth headset connection management method for seamless multi-device switching according to claim 5, characterized in that: Calculating the historical connection frequency of the terminal corresponding to the device connection pool according to the sequence weight and the terminal historical connection data includes: Determining, based on the terminal historical connection data, a connection duration and a channel quality score of the terminal corresponding to the device connection pool; The historical connection frequency of the terminal corresponding to the device connection pool is calculated using the following formula according to the connection duration, the channel quality score, and the sequence weight: in, Indicates the historical connection frequency of the terminal corresponding to the device connection pool. Indicates the device connection pool corresponding to the terminal The sequence weight of the secondary connection, Indicates the device connection pool corresponding to the terminal The duration of the connection, Indicates the maximum duration reference, represents the weight of the connection duration, Indicates the device connection pool corresponding to the terminal The channel quality score of the secondary connection, Indicates the maximum channel quality benchmark, represents the weight of the channel quality score, represents the time decay coefficient, Indicates the timestamp of the last connection. Indicates the timestamp of the first connection.
7. The Bluetooth headset connection management method for seamless multi-device switching according to claim 6, characterized in that: The calculating the terminal priority of the device connection pool according to the terminal device information includes: Mapping the historical connection frequency of the terminal device information to obtain a historical behavior score of the terminal corresponding to the device connection pool; Calculating a signal quality score of the terminal corresponding to the device connection pool based on the device type and real-time signal strength of the terminal device information; Determining the audio encoding type of the device connection pool, and calculating the media status score of the terminal corresponding to the device connection pool based on the audio encoding type and the current media playback status of the terminal device information; Identifying a device intervention operation of a terminal corresponding to the device connection pool, and identifying an intervention intensity of the device intervention operation; Calculating a user intervention sentiment score of a terminal corresponding to the device connection pool based on the device intervention operation and the intervention intensity; The terminal priority of the device connection pool is calculated by combining the historical behavior score, the signal quality score, the media status score, and the user intervention emotion score.
8. The Bluetooth headset connection management method for seamless multi-device switching according to claim 7, characterized in that: The step of establishing the encrypted link and the switching instruction for the terminal to be switched includes: Calculating a shared key of the terminal to be switched; Determining parameters required for the encrypted link of the terminal to be switched based on the shared key to establish the encrypted link of the terminal to be switched; Defining a switching instruction structure of the terminal to be switched; A switching instruction for the terminal to be switched is established based on the switching instruction structure and the encrypted link.
9. The Bluetooth headset connection management method for seamless multi-device switching according to claim 8, wherein: The step of transmitting the audio data packet of the terminal to be switched to the earphone ring buffer of the Bluetooth earphone according to the encrypted link to obtain the buffered audio data packet includes: Framing the audio data packet to obtain a framed audio data packet; Performing AES-CCM encryption on the framed audio data packet to obtain an encrypted audio data packet; Defining a transmission protocol for the encrypted audio data packet; Based on the transmission protocol and the encrypted link, the encrypted audio data packet is transmitted to the headset ring buffer of the Bluetooth headset to obtain a buffered encrypted audio data packet; The buffered encrypted audio data packet is decrypted to obtain the buffered audio data packet.
10. A Bluetooth headset connection management system with seamless switching of multiple devices, characterized in that: The system comprises: A device connection pool construction module is used to establish a first BR / EDR link between the Bluetooth headset and the main control terminal to establish a BLE topology network of the Bluetooth headset and the auxiliary terminal, and to build a device connection pool of the Bluetooth headset based on the first BR / EDR link and the BLE topology network; A device identifier allocation module, configured to collect terminal broadcast packets of the device connection pool using the BLE broadcast channel of the device connection pool to allocate terminal device identifiers of the device connection pool; a device information acquisition module, configured to acquire terminal device information of the device connection pool based on the terminal device identifier, wherein the terminal device information includes device type, historical connection frequency, real-time signal strength, and current media playback status; A terminal priority calculation module, configured to calculate the terminal priority of the device connection pool based on the terminal device information; The device seamless switching module is used to determine the terminal to be switched in the device connection pool based on the terminal priority, establish an encrypted link and switching instruction for the terminal to be switched, transmit the audio data packet of the terminal to be switched to the headset ring buffer of the Bluetooth headset according to the encrypted link, obtain a buffered audio data packet, construct redundant audio data of the master terminal, and perform device seamless switching of the Bluetooth headset based on the switching instruction, the buffered audio data packet and the redundant audio data.
