Bluetooth communication method and device, storage medium, first Bluetooth device and second Bluetooth device

By detecting switching requests, filtering target devices and performing communication mode switching, the problems of data transmission quality, stability and efficiency in Bluetooth communication mode switching are solved, and a better user experience is achieved.

CN119835685APending Publication Date: 2025-04-15JIANGSU HUITONG GRP
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411980063.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-30
Publication Date
2025-04-15

AI Technical Summary

Technical Problem

In the scenario of Bluetooth communication mode switching, the prior art is difficult to ensure the quality, stability and efficiency of data transmission, resulting in a decrease in user experience.

Method used

By detecting the switching request, we determine the Bluetooth device that needs to be switched, calculate the available bandwidth and actual required bandwidth, filter out the target device with high priority, and perform communication mode switching to ensure that data is transmitted stably in the second mode.

Benefits of technology

It realizes the stability, quality and efficiency of data transmission during Bluetooth communication mode switching, and improves user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119835685A_ABST
    Figure CN119835685A_ABST
Patent Text Reader

Abstract

A Bluetooth communication method and apparatus, a storage medium, a first Bluetooth device, and second Bluetooth devices, the method comprising: when a switching request is detected, determining the second Bluetooth device indicated by the switching request, the switching request being used for requesting to switch a communication mode between the first Bluetooth device and each second Bluetooth device from a first mode to a second mode; determining the total available bandwidth between the first Bluetooth device and each second Bluetooth device and the sum of the actually required bandwidths in the second mode; if the latter is greater than the former, screening out a target Bluetooth device from the second Bluetooth devices; executing a communication mode switching operation; and for each target Bluetooth device, after determining that the communication mode between the first Bluetooth device and the target Bluetooth device has been successfully switched to the second mode, sending data to the target Bluetooth device based on the second mode. In a Bluetooth communication mode switching scene, the scheme helps to improve data transmission quality, stability and efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of Bluetooth communication, and in particular to a Bluetooth communication method and device, a storage medium, a first Bluetooth device, and a second Bluetooth device. Background Art

[0002] Bluetooth is a wireless communication technology standard that enables short-distance data transmission between electronic devices, thereby simplifying the data interaction process between electronic devices. With the continuous evolution of technology, Bluetooth technology has broken the limitation of traditional Bluetooth that cannot transmit synchronous streaming data one-to-many, and has achieved multiple streaming transmission, and combined with broadcast audio sharing, it can enhance the Bluetooth audio experience.

[0003] Currently, Bluetooth communication mainly includes two communication modes, namely Broadcast Isochronous Stream (BIS) mode and Connected Isochronous Stream (CIS) mode. Specifically, the BIS mode is a non-connected working mode, mainly used in broadcast audio scenarios. Its main feature is that no communication connection is established between the master Bluetooth device (for example, mobile phones, tablets and other audio source devices) and the slave Bluetooth device (for example, Bluetooth speakers, Bluetooth headphones, etc.) during data transmission, that is, the master Bluetooth device communicates with the slave Bluetooth device in a one-way manner through the BIS link, and no response mechanism is required during data transmission; the CIS mode is a connected working mode, that is, the master Bluetooth device and the slave Bluetooth device can achieve two-way communication, the master Bluetooth device transmits data to the slave Bluetooth device through the CIS link, and the slave Bluetooth device replies to confirm the data packet after receiving the data. The BIS mode is suitable for broadcasting audio to multiple devices, while the CIS mode is suitable for point-to-point or multicast transmission.

[0004] Under the same other conditions, CIS mode can provide higher sound quality and lower latency than BIS mode. Correspondingly, the former often consumes more bandwidth resources and CPU resources. In addition, when the existing Bluetooth communication solution switches between BIS mode and CIS mode, if the user is playing audio data, problems such as freezing and increased latency will occur, which will reduce the user experience. Summary of the invention

[0005] The technical problem solved by the embodiments of the present invention is how to ensure the quality, stability and efficiency of data transmission in the scenario of switching Bluetooth communication modes.

[0006] To solve the above technical problems, an embodiment of the present invention provides a Bluetooth communication method, which is applied to a first Bluetooth device, and includes the following steps: when a switching request is detected, determining one or more second Bluetooth devices indicated by the switching request, wherein the switching request is used to request that the communication mode between the first Bluetooth device and each second Bluetooth device be switched from a first mode to a second mode; determining the total available bandwidth between the first Bluetooth device and each second Bluetooth device, and the sum of the actual required bandwidths of the first Bluetooth device and each second Bluetooth device in the second mode; if the sum of the actual required bandwidths is greater than the total available bandwidth, screening out one or more target Bluetooth devices from each second Bluetooth device; performing a communication mode switching operation, wherein the communication mode switching operation is used to switch the communication mode between the first Bluetooth device and each target Bluetooth device from a first mode to a second mode; for each target Bluetooth device, after confirming that the communication mode between the first Bluetooth device and the target Bluetooth device has been successfully switched to the second mode, sending data to the target Bluetooth device based on the second mode.

[0007] Optionally, each second Bluetooth device has a priority; and screening out one or more target Bluetooth devices from each second Bluetooth device includes: screening out the target Bluetooth devices from each second Bluetooth device in order of priority of each second Bluetooth device; wherein each screened target Bluetooth device satisfies the following condition: the sum of the actual required bandwidth of each target Bluetooth device in the second mode is less than or equal to the total available bandwidth.

[0008] Optionally, the priority of each second Bluetooth device is determined in the following manner: determine the application scenario type of each second Bluetooth device, and perform weighted operations on the data transmission quality indicator and the data transmission timeliness indicator corresponding to the application scenario type to obtain the weighted index of the second Bluetooth device, wherein a combination of multiple application scenario types and the data transmission quality indicator and the data transmission timeliness indicator has a one-to-one correspondence; based on the weighted index of each second Bluetooth device, determine the priority of each second Bluetooth device; wherein, the larger the weighted index of the second Bluetooth device, the higher the priority of the second Bluetooth device.

[0009] Optionally, the first Bluetooth device is provided with a first buffer; after executing the communication mode switching operation, the method further comprises: storing the data to be sent in the first buffer; wherein, for each target Bluetooth device, the data sent to the target Bluetooth device based on the second mode is read from the first buffer.

[0010] Optionally, the switching request is triggered when any one of the following conditions is met: the number of devices communicating with the first Bluetooth device via Bluetooth is reduced; the data transmission delay between the first Bluetooth device and the second Bluetooth device is reduced; the data transmission quality requirement between the first Bluetooth device and the second Bluetooth device is increased; the CPU occupancy of the first Bluetooth device is less than the target occupancy threshold.

[0011] Optionally, the first mode is a broadcast synchronous data stream mode, and the second mode is a connected synchronous data stream mode.

[0012] An embodiment of the present invention also provides a Bluetooth communication method, applied to a second Bluetooth device, comprising: sending a switching request to a first Bluetooth device, wherein the switching request is used to request that the communication mode between the first Bluetooth device and the first Bluetooth device be switched from a first mode to a second mode; confirming that the communication mode between the first Bluetooth device and the first Bluetooth device has been successfully switched; and receiving data from the first Bluetooth device based on the second mode.

[0013] Optionally, the switching request is triggered when a condition that a quality requirement for receiving data by the second Bluetooth device from the first Bluetooth device is improved or a delay in receiving data is reduced is met.

[0014] Optionally, the data received from the first Bluetooth device is audio data, and the second Bluetooth device is provided with a second buffer for caching the audio data received from the first Bluetooth device, and the second Bluetooth device reads the audio data from the second buffer and plays it; wherein the rate at which the second Bluetooth device reads audio data from the second buffer is lower than the rate at which the audio data is received from the first Bluetooth device.

[0015] Optionally, before sending the switching request to the first Bluetooth device, the method further includes: confirming that the amount of audio data in the second buffer is greater than or equal to a target data amount threshold.

[0016] Optionally, the method also includes: if the amount of audio data in the second buffer is less than the target data amount threshold, sending a first request to the first Bluetooth device, the first request being used to instruct the first Bluetooth device to increase the data transmission rate, and sending audio data to the second Bluetooth device based on the increased data transmission rate in a first mode; receiving audio data sent based on the increased data transmission rate from the first Bluetooth device and writing it into the second buffer until it is confirmed that the amount of audio data in the second buffer is greater than or equal to the target data amount threshold.

[0017] Optionally, the target data volume threshold is determined based on the product of a rate at which the second Bluetooth device reads audio data from the second buffer and a time taken to switch the communication mode. The larger the product value, the larger the target data volume threshold.

[0018] Optionally, the first mode is a broadcast synchronous data stream mode, and the second mode is a connected synchronous data stream mode.

[0019] An embodiment of the present invention also provides a Bluetooth communication device, comprising: a detection module, used to determine one or more second Bluetooth devices indicated by the switching request when a switching request is detected, wherein the switching request is used to request that the communication mode between the first Bluetooth device and each second Bluetooth device be switched from a first mode to a second mode; a bandwidth determination module, used to determine the total available bandwidth between the first Bluetooth device and each second Bluetooth device, and the sum of the actual required bandwidths of the first Bluetooth device and each second Bluetooth device in the second mode; a Bluetooth device screening module, used to screen out one or more target Bluetooth devices from each second Bluetooth device if the sum of the actual required bandwidths is greater than the total available bandwidth; a communication mode switching module, used to perform a communication mode switching operation, wherein the communication mode switching operation is used to switch the communication mode between the first Bluetooth device and each target Bluetooth device from a first mode to a second mode; a data sending module, used to, for each target Bluetooth device, after confirming that the communication mode between the first Bluetooth device and the target Bluetooth device has been successfully switched to the second mode, send data to the target Bluetooth device based on the second mode.

[0020] An embodiment of the present invention also provides a Bluetooth communication device, including: a switching request sending module, used to send a switching request to a first Bluetooth device, the switching request is used to request to switch the communication mode between the first Bluetooth device from a first mode to a second mode; a confirmation module, used to confirm that the communication mode between the first Bluetooth device has been successfully switched; and a data receiving module, used to receive data from the first Bluetooth device based on the second mode.

[0021] An embodiment of the present invention further provides a storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned Bluetooth communication method are executed.

[0022] An embodiment of the present invention further provides a first Bluetooth device, comprising a memory and a processor, wherein the memory stores a computer program that can be run on the processor, and the processor executes the steps of the above-mentioned Bluetooth communication method when running the computer program.

[0023] An embodiment of the present invention further provides a second Bluetooth device, comprising a memory and a processor, wherein the memory stores a computer program that can be run on the processor, and the processor executes the steps of the above-mentioned Bluetooth communication method when running the computer program.

[0024] An embodiment of the present invention further provides a computer program product, including a computer program, which executes the steps of the above-mentioned Bluetooth communication method when executed by a processor.

[0025] Compared with the prior art, the technical solution of the embodiment of the present invention has the following beneficial effects:

[0026] In an embodiment of the present invention, for a first Bluetooth device, when a switching request is detected, one or more second Bluetooth devices indicated by the switching request are determined, wherein the switching request is used to request that the communication mode between the first Bluetooth device and each second Bluetooth device be switched from the first mode to the second mode; then, by comparing the total available bandwidth between the first Bluetooth device and each second Bluetooth device, and the sum of the actual required bandwidths of the first Bluetooth device and each second Bluetooth device in the second mode; if the latter is greater than the former, it means that the bandwidth currently available for the first Bluetooth device and each second Bluetooth device to perform data transmission in the second mode cannot meet the bandwidth actually required for data transmission in the second mode. In this case, by selecting some target Bluetooth devices from each second Bluetooth device requesting switching to perform communication mode switching, the data transmission stability, transmission quality and efficiency between the Bluetooth devices after the communication mode switching can be guaranteed, thereby achieving the effect expected by the user.

[0027] Furthermore, in the field of Bluetooth communications, the requirements of Bluetooth devices for data transmission quality and timeliness are closely related to the specific application scenarios in which the Bluetooth devices are located. Therefore, in an embodiment of the present invention, the priority of the second Bluetooth device is determined by combining the two core data transmission indicators corresponding to the application scenarios in which the second Bluetooth device is located (i.e., data transmission quality indicators and data transmission timeliness indicators). Compared with randomly set priorities or priority determination based only on a single indicator, this implementation scheme can achieve the priority satisfaction of the communication mode switching needs of the second Bluetooth device with high requirements for data transmission quality and timeliness in specific application scenarios, thereby improving the user experience.

[0028] Further, for the second Bluetooth device, before sending a switching request to the first Bluetooth device, if it is confirmed that the amount of audio data in the second buffer is less than the target data volume threshold (this value can characterize the amount of audio data that the second Bluetooth device needs to play during the communication mode switching), it means that after the communication mode switching operation is started, the remaining audio data in the second buffer (that is, the amount of audio data that has not yet been read and played) is not enough to meet the playback requirements during the communication mode switching, and there will be playback jams or delays. In this case, this embodiment requests the first Bluetooth device to increase the data transmission rate, and sends audio data to the second Bluetooth device based on the increased data transmission rate in the first mode, until it is confirmed that the amount of audio data in the second buffer is greater than or equal to the target data volume threshold, and then sends a switching request to the first Bluetooth device. In this way, it is helpful to achieve the smoothness and quality of audio data playback during communication mode switching, and avoid jams, delays and other problems as much as possible. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] Figure 1 is a flow chart of a Bluetooth communication method in an embodiment of the present invention;

[0030] Figure 2 is a flow chart of another Bluetooth communication method in an embodiment of the present invention;

[0031] Figure 3 is a schematic structural diagram of a Bluetooth communication device in an embodiment of the present invention;

[0032] Figure 4 It is a structural schematic diagram of a Bluetooth communication device in an embodiment of the present invention. DETAILED DESCRIPTION

[0033] In order to make the above-mentioned objects, features and beneficial effects of the present invention more obvious and understandable, specific embodiments of the present invention are described in detail below with reference to the accompanying drawings.

[0034] Reference Figure 1 , Figure 1 is a flow chart of a Bluetooth communication method in an embodiment of the present invention. The Bluetooth communication method may be executed by a first Bluetooth device;

[0035] Specifically, the method may include steps S11 to S15:

[0036] Step S11: when a switching request is detected, determining one or more second Bluetooth devices indicated by the switching request, wherein the switching request is used to request to switch a communication mode between the first Bluetooth device and each second Bluetooth device from a first mode to a second mode;

[0037] Step S12: determining a total available bandwidth between the first Bluetooth device and each second Bluetooth device, and a sum of actual required bandwidths of the first Bluetooth device and each second Bluetooth device in the second mode;

[0038] Step S13: if the sum of the actually required bandwidths is greater than the total available bandwidth, one or more target Bluetooth devices are selected from the second Bluetooth devices;

[0039] Step S14: performing a communication mode switching operation, wherein the communication mode switching operation is used to switch the communication mode between the first Bluetooth device and each target Bluetooth device from a first mode to a second mode;

[0040] Step S15: for each target Bluetooth device, after confirming that the communication mode between the first Bluetooth device and the target Bluetooth device has been successfully switched to the second mode, sending data to the target Bluetooth device based on the second mode.

[0041] Furthermore, the method further includes: if the sum of the actually required bandwidths is less than or equal to the available total bandwidth, each second Bluetooth device indicated by the switching request may be used as the target Bluetooth device.

[0042] Furthermore, the method further includes: for each second Bluetooth device other than the target Bluetooth device (referred to as a non-target Bluetooth device), continuing to send data to the non-target Bluetooth device in the first mode.

[0043] The technical solution of the present application is applicable to Bluetooth communication scenarios, and is particularly applicable to application scenarios in which a first Bluetooth device (also referred to as a master Bluetooth device) and a second Bluetooth device (also referred to as a slave Bluetooth device) in a Bluetooth communication scenario switch from a first communication mode to a second communication mode. It should be understood that a Bluetooth device can be used as both a first Bluetooth device and a second Bluetooth device. Specifically, the first Bluetooth device may be, for example, a mobile phone, a computer, a tablet computer, a smart wearable device (such as a smart watch), etc., and the second Bluetooth device may be, for example, a Bluetooth headset, a Bluetooth speaker, a mobile phone, a tablet computer, etc.

[0044] As a non-limiting embodiment, the first Bluetooth device is a sound source device that sends audio data, and the second Bluetooth device is a device that receives and plays the audio data; the first communication mode is a BIS mode, and the second communication mode is a CIS mode. In the BIS mode, data is transmitted between the first Bluetooth device and the second Bluetooth device via a BIS link, and in the CIS mode, data is transmitted between the first Bluetooth device and the second Bluetooth device via a CIS link.

[0045] In a specific implementation of step S11, the first Bluetooth device may detect whether the switching request exists in real time, or detect whether the switching request exists at intervals of a preset period.

[0046] In some non-limiting embodiments, the switching request may be triggered when any of the following conditions is met: the number of devices communicating with the first Bluetooth device via Bluetooth is reduced (often meaning that the total available bandwidth for Bluetooth communication between the first Bluetooth device and each second Bluetooth device is increased, and the second mode with lower latency and higher transmission quality can be supported); the data transmission delay between the first Bluetooth device and the second Bluetooth device is reduced (meaning that the timeliness or timeliness requirements for receiving data from the first Bluetooth device by the second Bluetooth device are increased, and it is necessary to switch the communication mode with each second Bluetooth device to the second mode with lower latency); the data transmission quality requirements between the first Bluetooth device and the second Bluetooth device are increased; the CPU occupancy rate of the first Bluetooth device is less than the target occupancy rate threshold (meaning that the available CPU resources of the first Bluetooth device for Bluetooth communication are increased, and the second mode with lower latency and higher transmission quality can be supported).

[0047] It should be pointed out that, in actual applications, the conditions for triggering the switching request are not limited to the above-mentioned conditions, and the switching request can be triggered under other appropriate conditions in combination with actual needs.

[0048] In a specific implementation, the switching request may be triggered by the second Bluetooth device, or may be triggered by the user through the first Bluetooth device or a third-party device (eg, a mobile phone).

[0049] In one application scenario, the user plays audio data through a sound source device (for example, a mobile phone), and the BIS mode is used by default to broadcast audio to multiple Bluetooth speakers. Among them, for the Bluetooth speaker placed in the living room (referred to as the target Bluetooth speaker), the user hopes to obtain higher sound quality and lower latency. Therefore, a switching request can be triggered through the sound source device or through the target Bluetooth speaker or a third-party device (the switching request may include the identification information of the target Bluetooth speaker) to request that the communication mode between the sound source device and the target Bluetooth speaker be switched from the BIS mode to the CIS mode. If the switching is successfully completed, the target Bluetooth speaker receives low-latency, high-quality audio data through the CIS mode, while other Bluetooth speakers that communicate with the sound source device through Bluetooth (for example, Bluetooth speakers placed in each room) still receive audio data through BIS.

[0050] In another application scenario, such as an outdoor party scenario, multiple Bluetooth speakers receive audio data from a sound source device through BIS and play them synchronously. When the sound quality requirements of the audio data received and played by at least a portion of the Bluetooth speakers are improved and / or the timeliness requirements of receiving the audio data are improved (i.e., the delay of receiving the data is reduced), a switching request can be triggered by the sound source device or a third-party device (the switching request can include the identification information of the at least a portion of the Bluetooth speakers) to request that the communication mode between the sound source device and the at least a portion of the Bluetooth speakers be switched from the BIS mode to the CIS mode. However, in actual applications, since the available bandwidth resources may be limited, it is necessary to select appropriate target Bluetooth speakers from the at least a portion of the Bluetooth speakers for mode switching to ensure the stability and reliability of data transmission after switching, while other Bluetooth speakers that have not been selected still receive audio data from the sound source device through the BIS mode.

[0051] In a specific implementation of step S12, the total available bandwidth between the first Bluetooth device and each second Bluetooth device, and the sum of the actual required bandwidths of the first Bluetooth device and each second Bluetooth device in the second mode are determined.

[0052] The available total bandwidth refers to the sum of the available bandwidths between the first Bluetooth device and each second Bluetooth device, wherein the available bandwidth between the first Bluetooth device and each second Bluetooth device can specifically refer to: the bandwidth that can be actually used for data transmission in the Bluetooth communication link or channel between the first Bluetooth device and the second Bluetooth device within a certain period of time, and this value depends not only on the capacity, but also on the transmission load on the link. The method for determining the available total bandwidth can adopt an existing conventional solution, which is not limited in the embodiments of the present invention.

[0053] The actual required bandwidth of the first Bluetooth device and each second Bluetooth device in the second mode may be the actual bandwidth of data transmission between the first Bluetooth device and the second Bluetooth device in the second mode monitored historically, and the actual bandwidth may be the average value, median value or maximum value of multiple data transmission bandwidths monitored within a preset time period; or, the bandwidth of data transmission between the first Bluetooth device and the second Bluetooth device in the second mode may be manually predicted or evaluated.

[0054] In a specific implementation, the actual bandwidth of data transmission between the first Bluetooth device and the second Bluetooth device in the second mode may be monitored through an interface provided by the Bluetooth protocol.

[0055] In the specific implementation of step S13, if the sum of the actually required bandwidths is greater than the total available bandwidth, it means that the bandwidth currently available for data transmission between the first Bluetooth device and each second Bluetooth device in the second mode cannot meet the bandwidth actually required for data transmission in the second mode. In this case, it is necessary to select some target Bluetooth devices from the second Bluetooth devices requesting switching to switch the communication mode, so as to ensure the data transmission stability, transmission quality and efficiency between the Bluetooth devices after the communication mode is switched, so as to achieve the effect expected by the user.

[0056] Furthermore, each second Bluetooth device has a priority; the step of selecting one or more target Bluetooth devices from each second Bluetooth device includes: selecting the target Bluetooth devices from each second Bluetooth device in the order of priority of each second Bluetooth device; wherein each selected target Bluetooth device satisfies the following condition: the sum of the actual bandwidth required by each target Bluetooth device in the second mode is less than or equal to the total available bandwidth. In this way, the second Bluetooth device with a higher priority can be selected for communication mode switching, so as to give priority to ensuring the quality and low latency of the data received by the second Bluetooth device with a higher priority.

[0057] Furthermore, the priority of each second Bluetooth device can be determined in the following manner: determine the application scenario type of each second Bluetooth device, and perform weighted operations on the data transmission quality indicator and the data transmission timeliness indicator corresponding to the application scenario type to obtain the weighted index of the second Bluetooth device, wherein a combination of multiple application scenario types and the data transmission quality indicator and the data transmission timeliness indicator has a one-to-one correspondence; based on the weighted index of each second Bluetooth device, determine the priority of each second Bluetooth device; wherein, the larger the weighted index of the second Bluetooth device, the higher the priority of the second Bluetooth device.

[0058] Among them, the larger the value of the data transmission quality index, the higher the requirements of the corresponding application scenario type for data transmission quality; the larger the data transmission timeliness index, the higher the requirements of the corresponding application scenario type for the timeliness or promptness of data transmission (that is, the smaller the data transmission delay).

[0059] In a specific implementation, the application scenarios in which the second Bluetooth device is located can be appropriately divided into types. For example, in the Bluetooth communication scenarios in subway stations or high-speed rail stations, the types of application scenarios in which different second Bluetooth devices are located can be divided into: ticket hall or waiting hall scenarios in the station, subway or high-speed rail scenarios, dispatching room scenarios, platform or waiting platform scenarios, etc. Among them, the data transmission quality indicators and data transmission timeliness indicators corresponding to the dispatching room scenarios are often higher, and the data transmission quality indicators and data transmission timeliness indicators corresponding to the subway or high-speed rail scenarios are often inferior to those of the dispatching room scenarios, and higher than those of the ticket hall or waiting hall scenarios in the station; the data transmission quality indicators corresponding to noisy environments such as the ticket hall or waiting hall in the station, and outdoor environments such as high-speed rail platforms can be relatively low.

[0060] Since in Bluetooth communication, the requirements of Bluetooth devices for data transmission quality and timeliness are closely related to the specific application scenario of the Bluetooth device, in an embodiment of the present invention, the priority of the second Bluetooth device is determined by combining the two core data transmission indicators corresponding to the application scenario of the second Bluetooth device (i.e., the data transmission quality indicator and the data transmission timeliness indicator). Compared with the randomly set priority or the priority determined based on a single indicator, this implementation scheme can achieve the priority satisfaction of the communication mode switching requirements of the second Bluetooth device with high requirements for data transmission quality and timeliness in a specific application scenario, thereby improving the user experience.

[0061] In a specific implementation of step S14, a communication mode switching operation is performed, where the communication mode switching operation is used to switch the communication mode between the first Bluetooth device and each target Bluetooth device from a first mode to a second mode.

[0062] In a specific implementation of step S15, for each target Bluetooth device, after confirming that the communication mode between the first Bluetooth device and the target Bluetooth device has been successfully switched to the second mode, data is sent to the target Bluetooth device based on the second mode.

[0063] It is understandable that in the process of executing the communication mode switching operation, since the data transmission link in the second mode (for example, the CIS link) has not yet been created, if the first Bluetooth device continues to send data to the target Bluetooth device, it may cause the data transmission error probability and packet loss probability to be greatly increased, thereby causing the second Bluetooth device to play audio data and other quality problems such as freezes.

[0064] Therefore, in an embodiment of the present invention, a first buffer can be set in the first Bluetooth device; after performing the communication mode switching operation, the method also includes: storing the data to be sent in the first buffer; wherein, for each target Bluetooth device, the data sent to the target Bluetooth device based on the second mode is read from the first buffer.

[0065] As described above, after executing the communication mode switching operation, by storing the data to be sent from the first Bluetooth device to the target Bluetooth device in the first buffer, and subsequently confirming that the communication mode between the first Bluetooth device and the target Bluetooth device has been successfully switched to the second mode, the data is read from the first buffer and sent to the target Bluetooth device based on the second mode. In this way, the problem of errors or packet loss in the data transmission of this part can be avoided, and the integrity and reliability of data transmission can be improved.

[0066] Further, the method further includes: for each target Bluetooth device, in response to the failure of the communication mode switching between the first Bluetooth device and the target Bluetooth device (i.e., failure to switch to the second mode), waiting for a preset waiting time (e.g., 1s) and repeatedly attempting the communication mode switching for the target Bluetooth device until the total number of repeated attempts reaches a first preset number. Further, a communication mode switching failure feedback signal may be sent to the user, and / or the priority of the target Bluetooth device may be reduced.

[0067] Furthermore, for the target Bluetooth device, after the total number of repeated attempts reaches a second preset number and before the first preset number is reached, the method further includes: disconnecting the Bluetooth connection between the first Bluetooth device and the target Bluetooth device, and re-establishing a new Bluetooth connection with the target Bluetooth device. This helps to improve the success rate of communication mode switching and enhance user experience.

[0068] Reference Figure 2 , Figure 2 is a flow chart of another Bluetooth communication method in an embodiment of the present invention. The method may be executed by a second Bluetooth device;

[0069] Specifically, the another Bluetooth communication method may include steps S21 to S23.

[0070] In step S21, a switching request is sent to a first Bluetooth device, where the switching request is used to request to switch the communication mode with the first Bluetooth device from a first mode to a second mode.

[0071] In a specific implementation, the switching request may be triggered when a condition that the quality requirement of the data received by the second Bluetooth device from the first Bluetooth device is improved or the delay of receiving data is reduced is met.

[0072] For example, if a user wants to improve the sound quality of audio data received by a second Bluetooth device (e.g., a Bluetooth speaker) placed in a room from a first Bluetooth device (e.g., a mobile phone), the user can trigger the switching request through a preset voice command or by clicking a preset function key on the second Bluetooth device, and then the second Bluetooth device sends the switching request to the first Bluetooth device.

[0073] Furthermore, the data received from the first Bluetooth device is audio data, and the second Bluetooth device is provided with a second buffer for caching the audio data received from the first Bluetooth device, and the second Bluetooth device reads the audio data from the second buffer and plays it; wherein the rate at which the second Bluetooth device reads the audio data from the second buffer is lower than the rate at which the audio data is received from the first Bluetooth device.

[0074] Furthermore, before sending the switching request to the first Bluetooth device, the method further includes: confirming that the amount of audio data in the second buffer is greater than or equal to a target data amount threshold.

[0075] Furthermore, if the amount of audio data in the second buffer is less than the target data amount threshold, a first request is sent to the first Bluetooth device, wherein the first request is used to instruct the first Bluetooth device to increase the data transmission rate, and send audio data to the second Bluetooth device based on the increased data transmission rate in a first mode; the audio data sent based on the increased data transmission rate is received from the first Bluetooth device and written into the second buffer until it is confirmed that the amount of audio data in the second buffer is greater than or equal to the target data amount threshold.

[0076] That is, the step of sending the switching request to the first Bluetooth device is performed after confirming that the amount of audio data in the second buffer is greater than or equal to the target data amount threshold.

[0077] In a specific implementation, the target data volume threshold is determined based on the product of the rate at which the second Bluetooth device reads audio data from the second buffer and the time taken to switch the communication mode. The larger the product value, the larger the target data volume threshold.

[0078] The rate at which the second Bluetooth device reads audio data from the second buffer may be approximately equal to the rate at which the second Bluetooth device plays audio data. The switching time of the communication mode may specifically refer to the interval between the moment t1 when the first Bluetooth device starts to perform the communication mode switching operation (i.e., the moment when the communication mode between the first Bluetooth device and the second Bluetooth device starts to switch from the first mode to the second mode) and the moment t2 when the communication mode between the first Bluetooth device and the second Bluetooth device is confirmed to have been successfully switched (i.e., the moment when the communication mode between the first Bluetooth device and the second Bluetooth device is confirmed to have been successfully switched from the first mode to the second mode) (i.e., the switching time △t=t2-t1).

[0079] In a specific implementation, the switching time may be an average value or a median value of a plurality of actual time consumption data of switching from the first mode to the second mode between the first Bluetooth device and the second Bluetooth device monitored multiple times in history.

[0080] For example, in order to further ensure the smoothness of communication mode switching and avoid audio freezes, delays and other problems during the switching process, the result of multiplying the product value by a preset coefficient can be used as the target data volume threshold, and the preset coefficient is greater than or equal to 1.

[0081] In step S22, it is confirmed that the communication mode with the first Bluetooth device has been successfully switched.

[0082] In step S23, data is received from the first Bluetooth device based on the second mode.

[0083] It can be understood that the target data volume threshold can be used to characterize the amount of audio data that the second Bluetooth device needs to play during the communication mode switching. Specifically, before sending the switching request, if it is confirmed that the amount of audio data in the second buffer is less than the target data volume threshold, it means that after the communication mode switching operation is started, the remaining audio data in the second buffer (i.e., the amount of audio data that has not yet been read and played) will not be sufficient to meet the playback requirements during the communication mode switching, and therefore playback freezes or delays will occur.

[0084] To solve the above problem, before sending a switching request to the first Bluetooth device, the embodiment of the present invention determines whether the amount of audio data in the second buffer of the second Bluetooth device is sufficient to meet the amount of audio data that the second Bluetooth device needs to play during the communication mode switching; if the judgment result is no, the first Bluetooth device is requested to increase the data transmission rate, and audio data is sent to the second Bluetooth device based on the increased data transmission rate in the first mode until it is confirmed that the amount of audio data in the second buffer is greater than or equal to the target data volume threshold, and then a switching request is sent to the first Bluetooth device. In this way, it is helpful to achieve the smoothness and quality of audio data playback during the communication mode switching, and avoid problems such as freezes and delays as much as possible.

[0085] about Figure 2 For more details of steps S21 to S23 in the illustrated embodiment, see the previous text and Figure 1 The relevant description of the illustrated embodiment will not be repeated here.

[0086] Reference Figure 3 , Figure 3 : is a schematic diagram of the structure of a Bluetooth communication device in an embodiment of the present invention. The Bluetooth communication device can be integrated into a first Bluetooth device or communicate with the first Bluetooth device, and specifically may include:

[0087] A detection module 31, configured to determine, when a switching request is detected, one or more second Bluetooth devices indicated by the switching request, wherein the switching request is used to request that a communication mode between the first Bluetooth device and each second Bluetooth device be switched from a first mode to a second mode;

[0088] a bandwidth determination module 32, configured to determine a total available bandwidth between the first Bluetooth device and each second Bluetooth device, and a sum of actual required bandwidths of the first Bluetooth device and each second Bluetooth device in the second mode;

[0089] A Bluetooth device screening module 33, configured to screen out one or more target Bluetooth devices from the second Bluetooth devices if the sum of the actually required bandwidths is greater than the available total bandwidth;

[0090] A communication mode switching module 34, configured to perform a communication mode switching operation, wherein the communication mode switching operation is configured to switch the communication mode between the first Bluetooth device and each target Bluetooth device from a first mode to a second mode;

[0091] The data sending module 35 is used for sending data to each target Bluetooth device based on the second mode after confirming that the communication mode between the first Bluetooth device and the target Bluetooth device has been successfully switched to the second mode.

[0092] For the principle, specific implementation and beneficial effects of the Bluetooth communication device, please refer to the previous article and Figure 1 The related description about the Bluetooth communication method shown is not repeated here.

[0093] Reference Figure 4 , Figure 4 : is a schematic diagram of the structure of a Bluetooth communication device in an embodiment of the present invention. The Bluetooth communication device can be integrated into a second Bluetooth device or communicate with a second Bluetooth device, and specifically may include:

[0094] A switching request sending module 41, used for sending a switching request to a first Bluetooth device, wherein the switching request is used for requesting to switch the communication mode with the first Bluetooth device from a first mode to a second mode;

[0095] A confirmation module 42, used for confirming that the communication mode with the first Bluetooth device has been successfully switched;

[0096] The data receiving module 43 is configured to receive data from the first Bluetooth device based on the second mode.

[0097] For the principle, specific implementation and beneficial effects of the Bluetooth communication device, please refer to the previous article and Figure 2The related description about the Bluetooth communication method shown is not repeated here.

[0098] The embodiment of the present invention further provides a storage medium, such as a computer-readable storage medium, on which a computer program is stored, and the computer program is executed by a processor. Figure 1 to Figure 2 The steps of the Bluetooth communication method shown in any embodiment. The computer-readable storage medium may include a non-volatile memory or a non-transitory memory, and may also include an optical disk, a mechanical hard disk, a solid-state hard disk, etc.

[0099] Specifically, in the embodiment of the present invention, the processor may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

[0100] It should also be understood that the memory in the embodiments of the present application may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of random access memory (RAM) are available, such as static RAM (SRAM), dynamic random access memory (DRAM), synchronous DRAM (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link DRAM (SLDRAM) and direct rambus RAM (DR RAM).

[0101] The embodiment of the present invention further provides a first Bluetooth device, comprising a memory and a processor, wherein the memory stores a computer program that can be run on the processor, and the processor executes the above-mentioned Figure 1 The steps of the Bluetooth communication method are shown.

[0102] The embodiment of the present invention further provides a second Bluetooth device, including a memory and a processor, wherein the memory stores a computer program that can be run on the processor, and the processor executes the above-mentioned Figure 2 The steps of the Bluetooth communication method are shown.

[0103] The embodiment of the present invention further provides a computer program product, including a computer program, wherein the computer program is executed by a processor Figure 1 to Figure 2 The steps of the Bluetooth communication method described in any embodiment.

[0104] It should be understood that the term "and / or" in this article is only a description of the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article indicates that the associated objects before and after are in an "or" relationship.

[0105] The "plurality" appearing in the embodiments of the present application refers to two or more.

[0106] The first, second, etc. descriptions appearing in the embodiments of the present application are only used for illustration and distinction of the description objects. There is no order, nor do they indicate any special limitation on the number of devices in the embodiments of the present application, and cannot constitute any limitation on the embodiments of the present application.

[0107] It should be pointed out that the serial numbers of the steps in this embodiment do not limit the execution order of the steps.

[0108] Although the present invention is disclosed as above, the present invention is not limited thereto. Any person skilled in the art can make various changes and modifications without departing from the spirit and scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the scope defined by the claims.

Claims

1. A Bluetooth communication method, characterized in that: Applicable to the first Bluetooth device, including: When a switching request is detected, determining one or more second Bluetooth devices indicated by the switching request, wherein the switching request is used to request to switch a communication mode between the first Bluetooth device and each second Bluetooth device from a first mode to a second mode; Determine a total available bandwidth between the first Bluetooth device and each second Bluetooth device, and a sum of actual required bandwidths of the first Bluetooth device and each second Bluetooth device in the second mode; If the sum of the actually required bandwidths is greater than the total available bandwidth, screening out one or more target Bluetooth devices from the second Bluetooth devices; Performing a communication mode switching operation, wherein the communication mode switching operation is used to switch the communication mode between the first Bluetooth device and each target Bluetooth device from a first mode to a second mode; For each target Bluetooth device, after confirming that the communication mode between the first Bluetooth device and the target Bluetooth device has been successfully switched to the second mode, data is sent to the target Bluetooth device based on the second mode.

2. The method according to claim 1, characterized in that Each second Bluetooth device has a priority level; The step of selecting one or more target Bluetooth devices from each second Bluetooth device includes: Filtering the target Bluetooth device from the second Bluetooth devices according to the priority order of the second Bluetooth devices; The selected target Bluetooth devices meet the following condition: the sum of the actual required bandwidths of the target Bluetooth devices in the second mode is less than or equal to the total available bandwidth.

3. The method according to claim 2, characterized in that The priority of each second Bluetooth device is determined in the following manner: Determine the application scenario type of each second Bluetooth device, and perform weighted calculation on the data transmission quality index and the data transmission timeliness index corresponding to the application scenario type to obtain a weighted index of the second Bluetooth device, wherein a combination of multiple application scenario types and the data transmission quality index and the data transmission timeliness index has a one-to-one correspondence; Determining the priority of each second Bluetooth device based on the weighted indicator of each second Bluetooth device; The larger the weighted index of the second Bluetooth device is, the higher the priority of the second Bluetooth device is.

4. The method according to claim 1, characterized in that: The first Bluetooth device is provided with a first buffer zone; After performing the communication mode switching operation, the method further includes: Storing the data to be sent in the first buffer; For each target Bluetooth device, data sent to the target Bluetooth device based on the second mode is read from the first buffer.

5. The method according to any one of claims 1 to 4, characterized in that: The switching request is triggered when any of the following conditions is met: The number of devices communicating with the first Bluetooth device via Bluetooth is reduced; The data transmission delay between the first Bluetooth device and the second Bluetooth device is reduced; The data transmission quality requirement between the first Bluetooth device and the second Bluetooth device is improved; The CPU occupancy rate of the first Bluetooth device is less than a target occupancy rate threshold.

6. The method according to claim 1, characterized in that The first mode is a broadcast synchronous data stream mode, and the second mode is a connected synchronous data stream mode.

7. A Bluetooth communication method, characterized in that: Applicable to the second Bluetooth device, including: Sending a switching request to a first Bluetooth device, wherein the switching request is used to request switching a communication mode with the first Bluetooth device from a first mode to a second mode; Confirming that the communication mode with the first Bluetooth device has been successfully switched; Data is received from the first Bluetooth device based on the second mode.

8. The method according to claim 7, characterized in that The switching request is triggered when a condition that the quality requirement of data received by the second Bluetooth device from the first Bluetooth device is improved or the delay of receiving data is reduced is met.

9. The method according to claim 7 or 8, characterized in that: The data received from the first Bluetooth device is audio data, the second Bluetooth device is provided with a second buffer for caching the audio data received from the first Bluetooth device, and the second Bluetooth device reads the audio data from the second buffer and plays the audio data; The rate at which the second Bluetooth device reads audio data from the second buffer is lower than the rate at which the second Bluetooth device receives audio data from the first Bluetooth device.

10. The method according to claim 9, characterized in that Before sending the switching request to the first Bluetooth device, the method further includes: It is confirmed that the amount of audio data in the second buffer is greater than or equal to a target data amount threshold.

11. The method according to claim 10, characterized in that The method further comprises: If the amount of audio data in the second buffer is less than the target data amount threshold, sending a first request to the first Bluetooth device, wherein the first request is used to instruct the first Bluetooth device to increase the data transmission rate, and send audio data to the second Bluetooth device based on the increased data transmission rate in a first mode; The audio data transmitted based on the increased data transmission rate is received from the first Bluetooth device and written into the second buffer until it is confirmed that the amount of audio data in the second buffer is greater than or equal to the target data amount threshold.

12. The method according to claim 10 or 11, characterized in that: The target data volume threshold is determined based on the product of the rate at which the second Bluetooth device reads audio data from the second buffer and the time taken to switch the communication mode. The larger the product value, the larger the target data volume threshold.

13. The method according to claim 7, characterized in that The first mode is a broadcast synchronous data stream mode, and the second mode is a connected synchronous data stream mode.

14. A Bluetooth communication device, characterized in that: include: a detection module, configured to determine, when a switching request is detected, one or more second Bluetooth devices indicated by the switching request, wherein the switching request is used to request that a communication mode between the first Bluetooth device and each second Bluetooth device be switched from a first mode to a second mode; a bandwidth determination module, configured to determine a total available bandwidth between the first Bluetooth device and each second Bluetooth device, and a sum of actual required bandwidths of the first Bluetooth device and each second Bluetooth device in the second mode; A Bluetooth device screening module, configured to screen out one or more target Bluetooth devices from the second Bluetooth devices if the sum of the actually required bandwidths is greater than the available total bandwidth; A communication mode switching module, used to perform a communication mode switching operation, wherein the communication mode switching operation is used to switch the communication mode between the first Bluetooth device and each target Bluetooth device from a first mode to a second mode; The data sending module is used for sending data to each target Bluetooth device based on the second mode after confirming that the communication mode between the first Bluetooth device and the target Bluetooth device has been successfully switched to the second mode.

15. A Bluetooth communication device, characterized in that: include: A switching request sending module, used for sending a switching request to a first Bluetooth device, wherein the switching request is used for requesting to switch the communication mode with the first Bluetooth device from a first mode to a second mode; A confirmation module, used for confirming that the communication mode between the first Bluetooth device and the first Bluetooth device has been successfully switched; The data receiving module is used to receive data from the first Bluetooth device based on the second mode.

16. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the Bluetooth communication method according to any one of claims 1 to 6 are executed, or the steps of the Bluetooth communication method according to any one of claims 7 to 13 are executed.

17. A first Bluetooth device, comprising a memory and a processor, wherein the memory stores a computer program that can be run on the processor, characterized in that: When the processor runs the computer program, the steps of the Bluetooth communication method according to any one of claims 1 to 6 are performed.

18. A second Bluetooth device, comprising a memory and a processor, wherein the memory stores a computer program that can be run on the processor, characterized in that: When the processor runs the computer program, the steps of the Bluetooth communication method according to any one of claims 7 to 13 are performed.

19. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the Bluetooth communication method according to any one of claims 1 to 6 are executed, or the steps of the Bluetooth communication method according to any one of claims 7 to 13 are executed.