Bluetooth communication methods, devices, electronic devices and computer-readable media
By managing the Bluetooth connection status based on the audio playback status, the problems of unstable and time-consuming Bluetooth communication mode switching are solved, achieving more efficient connection management and improved user experience.
Patent Information
- Application Number
- CN202211575036.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-08
- Publication Date
- 2025-12-02
- Estimated Expiration
- 2042-12-08
AI Technical Summary
The existing Bluetooth communication modes suffer from instability and long switching times, especially when switching from classic Bluetooth connection to low power audio Bluetooth connection, which may lead to connection failure or long periods of silence, affecting the user experience.
By acquiring the audio playback status of the electronic device, the connection status of the first Bluetooth connection and the second Bluetooth connection can be configured so that both remain connected when no audio is playing, and the connection mode can be switched as needed when audio is playing, reducing connection and disconnection operations.
It improves the stability and switching efficiency of Bluetooth connections, reduces connection failures and lag, and enhances the user experience.
Smart Images

Figure CN116321084B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of audio playback technology, and more specifically, to a Bluetooth communication method, apparatus, electronic device, and computer-readable medium. Background Technology
[0002] As people's lives become richer, users own more and more electronic devices, and Bluetooth communication technology is advancing rapidly. Currently, to facilitate users' work and life, an electronic device can connect to external devices via Bluetooth, and there may be more than one Bluetooth communication mode. Summary of the Invention
[0003] This application proposes a Bluetooth communication method, apparatus, electronic device, and computer-readable medium to improve the above-mentioned deficiencies.
[0004] In a first aspect, embodiments of this application provide a Bluetooth communication method applied to an electronic device and / or a Bluetooth headset, wherein the electronic device and the Bluetooth headset support establishing a first Bluetooth connection and a second Bluetooth connection. The method includes: obtaining the audio playback state of the electronic device, the audio playback state including a first state and a second state, the first state being used to indicate that the electronic device is playing audio, and the second state being used to indicate that the electronic device is not playing audio; if the audio playback state is the second state, configuring the first Bluetooth connection to be in a keep-on state, and configuring the second Bluetooth connection to be in a keep-on state.
[0005] Secondly, embodiments of this application also provide a Bluetooth communication device applied to an electronic device and / or a Bluetooth headset. The electronic device and the Bluetooth headset support establishing a first Bluetooth connection and a second Bluetooth connection. The device includes: an acquisition unit and a control unit. The acquisition unit is configured to acquire the audio playback state of the electronic device, the audio playback state including a first state and a second state, wherein the first state indicates that the electronic device is playing audio, and the second state indicates that the electronic device is not playing audio. The control unit is configured to, if the audio playback state is the second state, configure the first Bluetooth connection to be in a persistent connection state, and configure the second Bluetooth connection to be in a persistent connection state.
[0006] Thirdly, embodiments of this application also provide an electronic device, including: one or more processors; a memory; and one or more application programs, wherein the one or more application programs are stored in the memory and configured to be executed by the one or more processors, and the one or more application programs are configured to perform the methods described above.
[0007] Fourthly, embodiments of this application also provide a computer-readable medium storing processor-executable program code, which, when executed by the processor, causes the processor to perform the above-described method.
[0008] The Bluetooth communication method, apparatus, electronic device, and computer-readable medium provided in this application support establishing a first Bluetooth connection and a second Bluetooth connection between the electronic device and the Bluetooth headset. By acquiring the audio playback status of the electronic device, it is possible to determine whether the electronic device is currently playing audio or not. Then, if the electronic device is not playing audio, both the first and second Bluetooth connections are configured to remain connected. Therefore, when the electronic device is not playing audio, both the first and second Bluetooth connections can be kept connected, facilitating quick playback of audio using either the first or second Bluetooth connection when the electronic device enters audio playback mode.
[0009] Other features and advantages of the embodiments of this application will be set forth in the following description, and will be apparent in part from the description, or may be learned by practicing the embodiments of this application. The objects and other advantages of the embodiments of this application may be realized and obtained by means of the structures particularly pointed out in the written description, claims, and drawings. Attached Figure Description
[0010] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0011] Figure 1 This illustration shows a connection diagram between an electronic device and a Bluetooth headset provided in an embodiment of this application;
[0012] Figure 2 A schematic diagram of a Bluetooth mode switching process is shown;
[0013] Figure 3 A schematic diagram of another Bluetooth mode switching process is shown;
[0014] Figure 4 A flowchart of a Bluetooth communication method provided in an embodiment of this application is shown;
[0015] Figure 5 A flowchart of a Bluetooth communication method provided in another embodiment of this application is shown;
[0016] Figure 6 A schematic diagram of a Bluetooth settings interface provided in an embodiment of this application is shown;
[0017] Figure 7 A schematic diagram of a Bluetooth settings interface provided in another embodiment of this application is shown;
[0018] Figure 8 A flowchart of a Bluetooth communication method according to another embodiment of this application is shown;
[0019] Figure 9 This illustration shows a schematic diagram of the Bluetooth switching process of an electronic device when no audio is being played, according to an embodiment of this application.
[0020] Figure 10 This illustration shows a schematic diagram of the Bluetooth switching process of an electronic device playing audio in an embodiment of this application;
[0021] Figure 11 A module block diagram of a Bluetooth communication device provided in an embodiment of this application is shown;
[0022] Figure 12 A structural block diagram of the electronic device provided in an embodiment of this application is shown;
[0023] Figure 13 An embodiment of the present application shows a storage unit for storing or carrying program code that implements the Bluetooth communication method according to an embodiment of the present application. Detailed Implementation
[0024] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present application, and not all of them. The components of the embodiments of the present application described and shown in the accompanying drawings can generally be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely represents selected embodiments of the present application. All other embodiments obtained by those skilled in the art based on the embodiments of the present application without inventive effort are within the scope of protection of the present application.
[0025] It should be noted that similar reference numerals and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. Furthermore, in the description of this application, terms such as "first," "second," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.
[0026] The Internet of Things (IoT) is a network concept that extends the "Internet concept" to enable information exchange and communication between any objects. With the development of IoT technology, various scenarios can be configured within an IoT system. These scenarios can involve multiple smart devices that have interoperability and can work collaboratively. For example, a configured scenario might include at least one device performing a specified operation when it approaches another. Or, when one device performs an operation, it processes part of the data itself while delegating the rest to another device.
[0027] As people's lives become richer, users own more and more electronic devices, and Bluetooth communication technology is advancing rapidly. Currently, to facilitate users' work and life, electronic devices can connect to external devices via Bluetooth, allowing users to control the electronic device to send data to the connected device. These electronic devices can be smartphones, tablets, e-readers, wireless audio playback devices, monitors, etc., devices with built-in Bluetooth modules that can establish Bluetooth connections and exchange data with other Bluetooth headsets. The wireless audio playback device can include Bluetooth headsets or Bluetooth speakers, etc.
[0028] Currently, the Bluetooth protocol supports multiple Bluetooth communication modes, including Classic Bluetooth mode and Bluetooth Low Energy Audio (LE Audio). Classic Bluetooth mode includes three modes: Base Rate (BR), Enhanced Rate (EDR), and High Speed (HS). Base Rate (BR) is also known as Bluetooth 1.0, Enhanced Rate (EDR) as Bluetooth 2.0, and High Speed (HS) as Bluetooth 3.0. Bluetooth Low Energy Audio (LE Audio) is a Bluetooth audio transmission mode operating within Bluetooth Low Energy (BLE) mode. LE Audio employs a new Low Complexity Communication Codec (LC3) to achieve higher sound quality and lower power consumption. Compared to the classic Bluetooth audio codec SBC, LC3 offers significant improvements in both encoding efficiency and quality, giving LE Audio a greater technological advantage over Classic Bluetooth audio technology.
[0029] like Figure 1 As shown, Figure 1A schematic diagram illustrating the connection between an electronic device and wireless headphones is shown. The wireless headphones consist of a dual-earphone set, including a left and a right earphone. The wireless headphones and the terminal can cooperate to play audio data; for example, when the terminal is playing video or audio, the terminal sends audio data to the wireless headphones for playback. Figure 1 As shown, the electronic device 100 maintains a BLE connection with the first wireless earphone 210 and the second wireless earphone 220, respectively, and independently transmits and communicates data with the first wireless earphone 210 and the second wireless earphone 220. The electronic device 100 can be a smartphone, tablet, e-reader, smart wearable device, or other device capable of running applications and playing audio and video signals. The first wireless earphone 210 and the second wireless earphone 220 constitute a true wireless stereo (TWS) headset, where the left and right earphones are independent and do not require a cable connection, thus achieving wireless separation of the left and right channels.
[0030] However, the inventors discovered during their research that, because Bluetooth communication between devices supports multiple Bluetooth modes, the switching process between these modes is often not efficient. Specifically, for example... Figure 2 As shown, taking the Bluetooth connection between a mobile phone and wireless headphones as an example, this illustrates the potential defects that may exist when switching between various Bluetooth modes. In related technologies, when the headphones and mobile phone establish a classic Bluetooth connection, when the user turns on the LE Audio switch in the phone's Bluetooth settings, the mobile phone will first actively disconnect the current classic Bluetooth (BT) connection with the headphones, and simultaneously initiate a LE Audio connection request to the headphones. After scanning the LE broadcast sent by both ears of the headphones, the mobile phone completes the LE Audio connection with the headphones. When the user turns off the LE Audio switch, the mobile phone will first disconnect the current LE Audio connection with both ears, and then begin to reconnect to the headphones' BT, completing the BT connection, thereby achieving the function of dynamic switching between BT and LE Audio.
[0031] However, in response to Figure 3The connection method shown has the following drawbacks because current operating systems default to disconnecting existing Bluetooth links before connecting to a new one: Firstly, if the phone needs to switch from a classic Bluetooth connection to a LE Audio connection (also known as a LE Audio Bluetooth connection), the phone will first actively disconnect the classic Bluetooth connection with the headphones. Then, it will initiate a LE Audio connection with the headphones, and vice versa. However, this disconnect-and-reconnect mechanism carries the risk of instability. For example, after disconnecting the classic Bluetooth connection, it may fail to establish a successful LE Audio connection with the headphones, or after disconnecting the LE Audio connection, it may fail to reconnect to the classic Bluetooth connection. This could result in the headphones and phone being disconnected due to the inability to connect to the desired Bluetooth communication mode, affecting the user experience. Secondly, if the phone is already sending data using an established Bluetooth link—for example, if the phone has already established a classic Bluetooth connection with the wireless headphones and is playing audio data, such as music or making calls, through the wireless headphones—if the phone needs to switch from a classic Bluetooth connection to a LE Audio connection, such as... Figure 3 As shown, the mobile phone disconnects the classic Bluetooth connection and then establishes an LE Audio connection with both earbuds, followed by a Connected Isochronous Stream (CIS) connection for LE Audio streaming playback, and vice versa. This entire process is not only time-consuming, but the switching of Bluetooth communication modes can result in prolonged periods of silence, and there's also the possibility of the phone's external speakers and headphones being silent due to a failure to connect to LE Audio, leading to a poor overall user experience.
[0032] Please see Figure 4 , Figure 4 This application illustrates a Bluetooth communication method provided by an embodiment of the present application. The method is applied to a communication system, which includes an electronic device and a Bluetooth headset. The electronic device can be the aforementioned smartphone, and the Bluetooth headset can be the aforementioned wireless headset. Furthermore, the execution subject of this method can be the electronic device, the Bluetooth headset, or an interaction between the electronic device and the Bluetooth headset; no specific limitation is made here. The method may include steps S401 to S402.
[0033] S401: Obtain the audio playback status of the electronic device.
[0034] It should be noted that the audio playback status of an electronic device includes a first status and a second status. The first status indicates that the electronic device is playing audio, and the second status indicates that the electronic device is not playing audio. For example, the electronic device may be equipped with monitoring software that sets the audio playback status of the electronic device to the first status when the electronic device is performing an audio playback service, and sets it to the second status otherwise. The audio playback service can be any service capable of playing audio; that is, the monitoring software sets the audio playback status of the electronic device to the first status whenever the electronic device is playing audio data, and sets it to the second status otherwise.
[0035] As another implementation, when the electronic device is performing a preset type of audio playback service, its audio playback state is set to a first state; otherwise, it is set to a second state. The preset type of audio playback service can be determined from all audio playback-related services supported by the electronic device. This preset type of audio playback service has at least one of the following characteristics: the audio playback duration is greater than a preset duration and it is triggered by a specified service function. The preset duration can be set based on experience and requirements. For example, it can be set based on all the prompts supported by the electronic device, such as the maximum playback duration of all prompts, which could be short audio sounds like button prompts and / or SMS prompts. By setting this preset duration, when it is determined that the playback duration of the audio playback service performed by the electronic device is greater than the preset duration, the audio playback state of the electronic device is set to the first state. It should be noted that when an electronic device performs an audio playback service, the playback duration can be determined based on the audio file requested for playback. If the audio file is a notification tone, the playback duration is determined to be less than or equal to a preset duration; if the audio file is not a notification tone, the playback duration is determined to be greater than the preset duration. Alternatively, when the electronic device performs an audio playback service, the continuous playback duration can be determined. If the playback duration is less than or equal to the preset duration, the audio playback state of the electronic device is determined to be in a second state; if the continuous playback duration is greater than the preset duration and the audio playback service is still being performed, the audio playback state of the electronic device is determined to be in a first state. Furthermore, preset types of audio playback services are triggered by specified service functions. These specified service functions can trigger the electronic device to perform the audio playback service corresponding to that specified service function. These specified service functions can be song playback, video playback, game operation, and call functions, etc., and are not specifically limited here.
[0036] S402: If the audio playback state is the second state, configure the first Bluetooth connection to be in a keep-connected state, and configure the second Bluetooth connection to be in a keep-connected state.
[0037] It should be noted that in some embodiments of this application, the Bluetooth connection may include a Bluetooth communication link established based on the Bluetooth communication protocol. In some embodiments, establishing a Bluetooth connection may include establishing a Bluetooth physical link; in some embodiments, establishing a Bluetooth connection may include establishing a Bluetooth logical link, such as ACL (Asynchronous Connection Oriented); in some embodiments, establishing a Bluetooth connection may also include establishing an audio transmission protocol or other data transmission protocol on the basis of the aforementioned link, such as the Bluetooth Advanced Audio Distribution Protocol (A2dp) and Hands-free Protocol (HFP). In some embodiments, the completion of Bluetooth connection establishment does not include the establishment of certain audio transmission channels, such as Synchronous Connection Oriented (SCO) and CIS, but rather the establishment of SCO or CIS audio transmission channels only when there is relevant audio service or under preset conditions. That is, when establishing a Bluetooth connection, the audio transmission channel is not established immediately, but waits for a service to be triggered before establishing the corresponding audio transmission channel for the transmission of relevant services. It is understandable that different Bluetooth communication modes may use different Bluetooth protocols, thus the established communication links and related transmission protocols may differ. Refer to the relevant Bluetooth standards for guidance, and some processes in the Bluetooth connection may also change with variations in those standards. It is also understandable that in some embodiments, disconnecting a Bluetooth connection may correspond to establishing a Bluetooth connection; in others, the Bluetooth connection may have different meanings. For example, establishing a Bluetooth connection may mean establishing a logical link such as an ACL, but disconnecting a Bluetooth connection may mean disconnecting the logical link and the upper-layer communication protocol. Generally, disconnecting the lower-level link will also disconnect the upper-layer protocol. In some embodiments, disconnecting a Bluetooth connection can be understood as disconnecting all Bluetooth communication links between the two devices. In some embodiments, disconnecting a Bluetooth connection can also be understood as disconnecting the upper-layer protocol. In some embodiments, disconnecting a Bluetooth connection means that point-to-point transmission between the two devices based on the Bluetooth link is not possible. The first Bluetooth connection and the second Bluetooth connection correspond to different Bluetooth communication modes. For example, one of the first Bluetooth connection and the second Bluetooth connection uses the classic Bluetooth mode, while the other uses the low-power audio Bluetooth mode (i.e., the aforementioned LE Audio mode).For example, the Bluetooth communication mode corresponding to the first Bluetooth connection is the classic Bluetooth mode. In some embodiments, this can be understood as the first Bluetooth connection being a classic Bluetooth connection. The Bluetooth communication mode corresponding to the second Bluetooth connection is the low-power audio Bluetooth mode. In some embodiments, this can be understood as the second Bluetooth connection being a low-power audio Bluetooth connection. Alternatively, the Bluetooth communication mode corresponding to the first Bluetooth connection is the low-power audio Bluetooth mode, and the Bluetooth communication mode corresponding to the second Bluetooth connection is the classic Bluetooth mode.
[0038] Understandably, electronic devices and Bluetooth headsets can be multi-mode Bluetooth devices, meaning they can support different Bluetooth communication modes. For example, they can support classic Bluetooth communication, LE Audio Bluetooth communication, or other Bluetooth communication methods. For instance, one Bluetooth connection corresponds to a classic Bluetooth connection, and the other corresponds to a LE Audio Bluetooth connection.
[0039] Understandably, the above connection process can occur during the initial connection between an electronic device and Bluetooth headphones, such as the pairing connection between the headphones and an electronic device after the headphones are first opened, or the pairing connection between the headphones and a mobile phone after the headphones have been restored to factory settings. The initial pairing process, by establishing two Bluetooth connections, allows the acquisition of connection information for both Bluetooth connections, such as Bluetooth addresses and pairing information, thus facilitating subsequent Bluetooth connections.
[0040] However, although electronic devices and Bluetooth headsets support establishing Bluetooth connections simultaneously through two different Bluetooth communication modes, such as establishing a first Bluetooth connection and a second Bluetooth connection at the same time, the power consumption of the electronic device and Bluetooth headset may be relatively high when maintaining the first Bluetooth connection and the second Bluetooth connection simultaneously. Therefore, the inventors found in their research that the current connection method often disconnects one of the Bluetooth connections while keeping the other Bluetooth connection connected after establishing the first Bluetooth connection and the second Bluetooth connection at the same time. However, such a setting method often only considers the connection status of the two Bluetooth connections from the perspective of power consumption, and does not set the connection status of the two Bluetooth connections according to the actual usage state of the electronic device.
[0041] Therefore, this application embodiment configures the connection states of the first Bluetooth connection and the second Bluetooth connection based on the audio playback status, wherein the connection status includes maintaining a connection and disconnecting. Thus, the method provided by this application embodiment enables the setting of the connection states of the first Bluetooth connection and the second Bluetooth connection to take into account the influence of the audio playback status, thereby making the setting of the connection states of the first Bluetooth connection and the second Bluetooth connection more closely match the user's audio playback needs for the electronic device.
[0042] Therefore, this application embodiment can consider the connection status of the first Bluetooth connection and the second Bluetooth connection under different audio playback states of the electronic device from the perspective of power consumption. For example, if the audio playback state is the second state, that is, when the electronic device is not currently playing audio or performing a preset type of audio playback service, both the first Bluetooth connection and the second Bluetooth connection are configured to remain connected. That is, both the first and second Bluetooth connections are configured to remain connected. Since there is no significant data interaction requirement between the electronic device and the Bluetooth headset when the electronic device is not playing audio or performing a preset type of audio playback service, both the first and second Bluetooth connections can remain connected. This allows the electronic device and the Bluetooth headset to freely use either the first or second Bluetooth connection to transmit data. For example, as mentioned above, when the electronic device is performing a preset type of audio playback service, if the audio playback state of the electronic device is determined to be the second state, then in this case, the audio played when the electronic device is performing a non-preset type of audio playback service can be transmitted through one of the first and second Bluetooth connections, while the other unused Bluetooth connection remains connected. When the electronic device needs to switch to another Bluetooth connection for transmission, since the other Bluetooth connection is in a keep-connect state, it can be used directly without reconnecting. If the audio playback state is the first state, that is, when the electronic device is currently playing audio or performing a preset type of audio playback service, one of the first Bluetooth connection and the second Bluetooth connection is configured to be in a keep-connect state, while the other Bluetooth connection is in a disconnected state, thus taking into account that the amount of data transmitted between the electronic device and the Bluetooth headset is relatively large when the electronic device is playing audio.
[0043] Of course, in addition to configuring the connection status of the first Bluetooth connection and the second Bluetooth connection based on the audio playback status as described above, it is also possible to configure one of the first Bluetooth connection and the second Bluetooth connection to be in a keep-connected state and the other Bluetooth connection to be in a disconnected state if the audio playback status is the second state; or to configure both the first Bluetooth connection and the second Bluetooth connection to be in a keep-connected state if the audio playback status is the first state. The specific implementation method is not limited here.
[0044] Subsequent embodiments will describe the connection state settings for the first Bluetooth connection and the second Bluetooth connection separately for audio playback states of first state and second state.
[0045] Please see Figure 5 , Figure 5This application illustrates a Bluetooth communication method provided in an embodiment. The method is applied to a communication system, which includes an electronic device and a Bluetooth headset. The electronic device can be the aforementioned smartphone, and the Bluetooth headset can be the aforementioned wireless headset. Furthermore, the execution subject of this method can be the electronic device, the Bluetooth headset, or an interaction between the electronic device and the Bluetooth headset; no specific limitation is made here. The method may include steps S501 to S503.
[0046] S501: Obtain the audio playback status of the electronic device.
[0047] S502: If the audio playback state is the second state, configure the first Bluetooth connection to be in a keep-connected state, and configure the second Bluetooth connection to be in a keep-connected state.
[0048] The operations of S501 to S502 can be referred to the aforementioned embodiments, and will not be repeated here.
[0049] S503: If the audio playback state switches from the second state to the first state, in response to a request between the electronic device and the Bluetooth headset to use the first Bluetooth connection, data between the electronic device and the Bluetooth headset is transmitted using the first Bluetooth connection.
[0050] In one implementation, when the audio playback state of the electronic device is in the second state, and both the first and second Bluetooth connections are kept connected, the audio playback state of the electronic device continues to be monitored. If the audio playback state of the electronic device is detected to switch from the second state to the first state, in response to a request between the electronic device and the Bluetooth headset to use the first Bluetooth connection, data between the electronic device and the Bluetooth headset is transmitted using the first Bluetooth connection. For example, the electronic device or Bluetooth headset can detect whether a specified request has been received, which indicates a request between the electronic device and the Bluetooth headset to use the first Bluetooth connection. It should be noted that the first Bluetooth connection refers to the currently requested Bluetooth connection; unrequested Bluetooth connections are the second Bluetooth connection. That is, if the first Bluetooth connection is a classic Bluetooth connection, it indicates a request between the electronic device and the Bluetooth headset to use a classic Bluetooth connection, and the LE Audio Bluetooth connection is the second Bluetooth connection. Similarly, if the electronic device and the Bluetooth headset request to use a LE Audio Bluetooth connection, the first Bluetooth connection is the LE Audio Bluetooth connection, and the second Bluetooth connection is the classic Bluetooth connection.
[0051] The specified request can be input by the user via an electronic device, via a Bluetooth headset, or automatically triggered under a preset application scenario. The specified request can be a specific instruction based on user operation or generated according to a preset application scenario, which can be a game application scenario, a video playback scenario, or other preset scenarios, without limitation. In this embodiment, taking user input as an example, the user can input the specified request via an electronic device or via a Bluetooth headset. In some embodiments, the specified request can be determined by the electronic device, which can display a Bluetooth settings interface. This Bluetooth settings interface can include switches for different Bluetooth communication modes to turn the corresponding Bluetooth communication mode on or off, such as... Figure 6 As shown, the Bluetooth settings interface may include a first switch 601 corresponding to a first Bluetooth communication mode and a second switch 602 corresponding to a second Bluetooth communication mode. Setting the first switch to the "on" state requests the establishment of a Bluetooth connection corresponding to the first Bluetooth communication mode. Setting the second switch to the "on" state requests the establishment of a Bluetooth connection between the electronic device and the Bluetooth headset corresponding to the second Bluetooth communication mode. Alternatively, a designated switch 701 can be set within the Bluetooth settings interface. The default Bluetooth mode between the electronic device and the Bluetooth headset is the first Bluetooth communication mode. When the designated switch 701 is on, the electronic device and the Bluetooth headset establish a Bluetooth connection based on the second Bluetooth communication mode. When the designated switch 701 is off, the electronic device and the Bluetooth headset establish a Bluetooth connection based on the first Bluetooth communication mode.
[0052] In some embodiments, the specified request can be determined by the Bluetooth headset. If the Bluetooth headset has a screen, it can obtain the specified request through a Bluetooth settings interface, similar to an electronic device. If the Bluetooth headset does not have a screen or the screen does not meet the display requirements of the Bluetooth headset interface, the specified request can be determined by other means, which may include at least one of gesture detection and voice detection.
[0053] Therefore, after detecting a specified request, the Bluetooth communication mode corresponding to the specified request is determined, and the Bluetooth connection of the Bluetooth communication mode established by the request is taken as the first Bluetooth connection. Then, while keeping both the first Bluetooth connection and the second Bluetooth connection connected, the first Bluetooth connection is used to transmit data between the electronic device and the Bluetooth headset.
[0054] Based on the above Figure 7Taking the Bluetooth settings interface as an example, assuming the first Bluetooth communication mode is LE Audio mode, if the switch for the first Bluetooth communication mode in the Bluetooth settings interface is detected to be turned on, it indicates that the electronic device and the Bluetooth headset are requesting to use a LE Audio connection. Then, while keeping both the LE Audio connection and the classic Bluetooth connection in a keep-alive state, the LE Audio connection is used to transmit data between the electronic device and the Bluetooth headset. If the switch for the first Bluetooth communication mode in the Bluetooth settings interface is detected to be turned off, it indicates that the electronic device and the Bluetooth headset are requesting to use a classic Bluetooth connection. Then, while keeping both the LE Audio connection and the classic Bluetooth connection in a keep-alive state, the classic Bluetooth connection is used to transmit data between the electronic device and the Bluetooth headset. It can be seen that when the electronic device is not playing audio, both the classic Bluetooth connection and the LE Audio connection between the electronic device and the Bluetooth headset can be maintained. Then, based on the state of the specified switch, it is determined whether a classic Bluetooth connection or a LE Audio connection is currently needed. Since both the LE Audio connection and the classic Bluetooth connection are in a keep-alive state, when switching between different Bluetooth connections, it is not necessary to disconnect unused Bluetooth connections or re-establish a connection for a particular Bluetooth connection.
[0055] It should be noted that when the audio playback state of the electronic device is in the first state, the electronic device and the Bluetooth headset may maintain both the first Bluetooth connection and the second Bluetooth connection at the same time. For example, when the audio playback state of the electronic device switches from the second state to the first state, and the electronic device has not yet determined the Bluetooth communication mode requested between the electronic device and the Bluetooth headset, the electronic device and the Bluetooth headset maintain both the first Bluetooth connection and the second Bluetooth connection at the same time. Then, if it is determined that a request to use the first Bluetooth connection is detected between the electronic device and the Bluetooth headset, the first Bluetooth connection is maintained and the second Bluetooth connection is disconnected.
[0056] Alternatively, when the electronic device's audio playback state is in the first state, and a second Bluetooth connection has been established between the electronic device and the Bluetooth headset but is currently disconnected, a specified request is detected. This specified request indicates that the established second Bluetooth connection between the electronic device and the Bluetooth headset be switched to the first Bluetooth connection; that is, this specified request is equivalent to a switching request. Then, the second Bluetooth connection between the electronic device and the Bluetooth headset is disconnected, and the first Bluetooth connection is established. This can be done either by first disconnecting the second Bluetooth connection and then establishing the first Bluetooth connection, or by establishing the first Bluetooth connection first and then disconnecting the second Bluetooth connection. In other words, during the establishment of the first Bluetooth connection between the electronic device and the Bluetooth headset, the second Bluetooth connection between the electronic device and the Bluetooth headset remains connected. That is, the first Bluetooth connection is established while the second Bluetooth connection is maintained; after the first Bluetooth connection is successfully established, the second Bluetooth connection is disconnected.
[0057] One of the first and second Bluetooth connections uses Classic Bluetooth mode, while the other uses Bluetooth Low Energy (BLE) audio mode. Assume the second Bluetooth connection uses Classic Bluetooth mode and the first Bluetooth connection uses BLE audio mode. Assume the electronic device is a mobile phone, and the Bluetooth headset is a True Wireless Stereo (TWS) headset. For example, in Classic Bluetooth mode, the Bluetooth headset can be in pairing mode. When paired, the headset can be discovered by other devices. Other devices, without having previously established a Bluetooth connection with the headset or without having obtained the headset's Bluetooth address beforehand, need to pair with it. This pairing process involves the headset exchanging communication information with the requesting device, including communication addresses and other data used to establish a connection. Therefore, for a new device, the headset can only be scanned and paired by other devices when it enters an query scan, thus completing the Bluetooth connection.
[0058] In some embodiments, the earbud in the TWS earbuds that establishes a classic Bluetooth connection with the electronic device is the main earbud, which can then act as the Bluetooth earbud in this application to perform the methods in some embodiments of this application. In some embodiments, the TWS earbuds can also be considered as a whole; the classic Bluetooth connection can be understood as being established between the main earbud and the electronic device, and the LEAudio Bluetooth connection can be understood as being established by each of the two earbuds of the TWS earbuds with the electronic device. In some embodiments, the LEAudio Bluetooth connection can also be established using a monitoring method; for example, the main earbud can establish a classic Bluetooth connection and / or a LEAudio Bluetooth connection with the electronic device, and the earbuds can establish the aforementioned classic Bluetooth connection or LEAudio Bluetooth connection through monitoring.
[0059] Referring to the above Figure 7 The Bluetooth settings interface shown assumes the first Bluetooth connection is an LE Audio connection and the second Bluetooth connection is a classic Bluetooth connection. Assume the electronic device starts playing audio (audio playback state is the first state), and a second Bluetooth connection has already been established between the electronic device and the Bluetooth headset. While the electronic device is playing audio, the specified switch in the Bluetooth settings interface is in the off state, meaning a classic Bluetooth connection has been established between the electronic device and the Bluetooth headset, but not the LE Audio connection. Data is transmitted between the electronic device and the Bluetooth headset via the classic Bluetooth connection. Then, if the specified switch in the Bluetooth settings interface is detected to change to the on state, a specified request is detected to switch the established second Bluetooth connection between the electronic device and the Bluetooth headset back to the first Bluetooth connection. The electronic device or Bluetooth device will then establish the first Bluetooth connection while maintaining the second Bluetooth connection. After the first Bluetooth connection is successfully established, the second Bluetooth connection will be disconnected.
[0060] In this embodiment, when the audio playback state of the electronic device is in a first state, a first Bluetooth connection can be established between the electronic device and the Bluetooth device if a second Bluetooth connection has already been established. After the first Bluetooth connection is successfully established, the second Bluetooth connection is then disconnected. In other words, the second Bluetooth connection can be maintained while establishing the first Bluetooth connection, reducing stuttering when switching from the second Bluetooth connection to the first Bluetooth connection and avoiding excessive power consumption and bandwidth usage when simultaneously maintaining both connections. It should be noted that a data transmission channel can be established based on the first and second Bluetooth connections. Data can be transmitted between the electronic device and the Bluetooth device through this data transmission channel, which will be described in subsequent embodiments. Therefore, when considering whether data is being transmitted between the electronic device and the Bluetooth device via the second Bluetooth connection, it is necessary to consider whether the data transmission during Bluetooth connection switching will cause stuttering, and to reasonably select the timing for disconnecting the first Bluetooth connection. For example, if the electronic device and the Bluetooth device are not transmitting data through the second Bluetooth connection, the first Bluetooth connection can be disconnected once the first Bluetooth connection is successfully established and a data transmission channel is established on the established first Bluetooth connection. In other words, the second Bluetooth connection is disconnected once the first Bluetooth connection is successfully established and a data transmission channel is established on the established first Bluetooth connection. This not only allows the data transmission channel of the first Bluetooth connection to be established in advance, so that when data is transmitted using the first Bluetooth connection later, it is not necessary to re-establish the data transmission channel and the existing data transmission channel can be used directly, but also, since the electronic device is currently playing audio, the purpose of selecting the first Bluetooth connection between the electronic device and the Bluetooth device is to transmit the audio data to be played. Therefore, even though the electronic device and the Bluetooth device are not using the second Bluetooth connection to transmit data, when the first Bluetooth connection is established, it can be assumed that there is a high probability that the electronic device and the Bluetooth device will use the first Bluetooth connection to transmit data. Thus, the data transmission channel can be established in advance, and the second Bluetooth connection can be disconnected after the data transmission channel is established. This completes the operation of switching from the second Bluetooth connection to the first Bluetooth connection.
[0061] As another implementation, if, under the second Bluetooth connection, the electronic device and the Bluetooth device are not transmitting data through that second Bluetooth connection—that is, if switching to the first Bluetooth connection does not cause any data transmission interruption—then the second Bluetooth connection can be disconnected after the first Bluetooth connection is successfully established but before a data transmission channel is established on the first Bluetooth connection. In other words, if the second Bluetooth connection is not transmitting preset data, disconnecting the second Bluetooth connection after the first Bluetooth connection is successfully established means disconnecting the second Bluetooth connection after the first Bluetooth connection is successfully established but before a data transmission channel is established on the first Bluetooth connection. In other words, if it is determined that the first Bluetooth connection does not need to take over data transmission from the second Bluetooth connection, then it is not necessary to wait until a data transmission channel is successfully established on the first Bluetooth connection before disconnecting the second Bluetooth connection.
[0062] If, in the case of the second Bluetooth connection, data is transmitted between the electronic device and the Bluetooth device through the second Bluetooth connection, then to avoid interruption or stuttering of the output transmission, the second Bluetooth connection can be disconnected after the first Bluetooth connection is successfully established and the audio transmission channel of the first Bluetooth connection is confirmed to be established.
[0063] Specifically, after the first Bluetooth connection is successfully established, and given that the audio transmission channel of the first Bluetooth connection is established, the implementation method for disconnecting the second Bluetooth connection is as follows:
[0064] If the audio playback state is in the first state, and a second Bluetooth connection has been established between the electronic device and the Bluetooth device, and preset data is being transmitted using the second Bluetooth connection, a specified request is detected, and the transmission of the preset data continues using the second Bluetooth connection, establishing a first Bluetooth connection between the electronic device and the Bluetooth device. Once the first Bluetooth connection is successfully established and a data transmission channel is established on the established first Bluetooth connection, the second Bluetooth connection is disconnected. Then, the preset data continues to be transmitted between the electronic device and the Bluetooth headset using the data transmission channel on the first Bluetooth connection. Of course, other data can also be transmitted, and this is not limited here. Therefore, when audio data can be transmitted between the electronic device and the Bluetooth headset via the second Bluetooth connection to enable audio playback by the electronic device through the Bluetooth headset, if it is determined that the user needs to use the first Bluetooth connection (i.e., a request is made between the electronic device and the Bluetooth headset to switch from the second Bluetooth connection to the first Bluetooth connection), the second Bluetooth connection can be disconnected only after the data transmission channel of the first Bluetooth connection is established. This ensures that the electronic device and the Bluetooth headset can continue to transmit data using the second Bluetooth connection during the establishment of the data transmission channel of the first Bluetooth connection, and that the data transmission channel of the first Bluetooth connection has already been established when the second Bluetooth connection is disconnected, reducing stuttering and time consumption caused by switching. It should be noted that the data transmission channel can be either SCO or CIS as mentioned above. For example, if the first Bluetooth connection is a classic Bluetooth connection, the data transmission channel established on the first Bluetooth connection is SCO; if the first Bluetooth connection is an LE Audio connection, the data transmission channel established on the first Bluetooth connection is CIS.
[0065] Please see Figure 8 , Figure 8 This application illustrates a Bluetooth communication method provided in an embodiment. The method is applied to a communication system, which includes an electronic device and a Bluetooth headset. The electronic device can be the aforementioned smartphone, and the Bluetooth headset can be the aforementioned wireless headset. Furthermore, the execution subject of this method can be the electronic device, the Bluetooth headset, or an interaction between the electronic device and the Bluetooth headset; no specific limitation is made here. The method may include steps S801 to S806.
[0066] S801: Obtain the audio playback status of the electronic device.
[0067] S802: Determine whether the audio playback state is the first state or the second state.
[0068] S803: Configure the first Bluetooth connection to be in a keep-connected state, and configure the second Bluetooth connection to be in a keep-connected state.
[0069] S804: If the audio playback state switches from the second state to the first state, in response to a request between the electronic device and the Bluetooth headset to use the first Bluetooth connection, data between the electronic device and the Bluetooth headset is transmitted using the first Bluetooth connection.
[0070] S805: In response to a request between the electronic device and the Bluetooth headset to use the first Bluetooth connection, control the first Bluetooth connection to be in a kept-connected state and the second Bluetooth connection to be in a disconnected state.
[0071] S806: If the audio playback state switches from the first state to the second state, determine the Bluetooth connection that was in a connected state during the most recent period when the electronic device was in the first state and the Bluetooth connection that was in a disconnected state during the first Bluetooth connection and the second Bluetooth connection.
[0072] S807: Restore the Bluetooth connection from the disconnected state to the connected state, and keep the Bluetooth connection in the connected state in the connected state.
[0073] When the audio playback state of the electronic device is in the first state, in response to a specified request, the Bluetooth connection between the electronic device and the Bluetooth headset is switched from the second Bluetooth connection to the first Bluetooth connection. Then, the audio playback state of the electronic device continues to be monitored. If the audio playback state of the electronic device is detected to have switched from the current first state to the second state, for example, when the audio playback service of the electronic device ends, the audio playback state of the electronic device changes to the second state, and both the first Bluetooth connection and the second Bluetooth connection can be set to a keep-connected state. For example, when the audio playback state of the electronic device is in the first state, one of the first Bluetooth connection and the second Bluetooth connection is kept connected, while the other Bluetooth connection is disconnected. After the audio playback state switches from the first state to the second state, the Bluetooth connection that was kept connected and the Bluetooth connection that was kept disconnected during the most recent period when the electronic device was in the first state are determined. That is, when it is determined that the electronic device was last playing audio, the Bluetooth connection that was kept connected and the Bluetooth connection that was kept disconnected are restored to the connected state, and the Bluetooth connection that was kept connected continues to be in the keep-connected state. For example, in the most recent case where the first Bluetooth connection remained connected and the second Bluetooth connection remained disconnected, after the electronic device switches to the second state, it needs to be configured to keep both the first and second Bluetooth connections connected. One possible implementation would be to restore the second Bluetooth connection and keep the first Bluetooth connection connected.
[0074] It should be noted that the aforementioned S801 can refer to the first detected audio playback state when the electronic device meets the detection conditions. The detection conditions can be after the initial connection between the electronic device and the Bluetooth headset, or during the pairing connection between the headset and the mobile phone after a factory reset, or when the electronic device detects a preset request input by the user. This preset request instructs the electronic device to execute the method described in this application for setting the connection state of the first and second Bluetooth connections based on the audio playback state of the electronic device. Therefore, when the electronic device detects that the detection conditions are met, it begins to execute the operation of detecting the audio playback state of the electronic device, thereby determining whether the audio playback state of the electronic device is the first state or the second state, and thus executing two different branches.
[0075] Furthermore, after detecting an audio playback state and setting the connection states of the first and second Bluetooth connections based on that state, the audio playback state of the electronic device can continue to be detected. This allows for timely adjustment of the connection states of the first and second Bluetooth connections should the audio playback state change. Therefore, configuring both the first and second Bluetooth connections to maintain a connection can be performed either upon first detecting that the audio playback state is in the second state, or upon detecting that the audio playback state has switched from the first to the second state. Similarly, responding to a request from the electronic device and the Bluetooth headset to use the first Bluetooth connection, transmitting data between the two devices using the first Bluetooth connection, and disconnecting the second Bluetooth connection can be performed either upon first detecting that the audio playback state is in the first state, or upon detecting that the audio playback state has switched from the second to the first state; this is not limited here.
[0076] As one implementation method, to avoid the electronic device switching from the first state to the second state for a short period when the audio playback state is short, for example, when the electronic device is playing songs and there is a short interval between two songs, if both the first and second Bluetooth connections are connected at this time, the audio playback state of the electronic device will return to the first state after a short period of time. This would cause one of the Bluetooth connections to be kept connected while the other is disconnected, resulting in frequent connection and disconnection of that Bluetooth connection. Therefore, if a switch from the first state to the second state is detected, a timer operation is initiated. If the electronic device remains in the second state within the time period corresponding to the timer operation, both the first and second Bluetooth connections are kept connected. The time period corresponding to the timer operation can be set based on actual needs, for example, it could be 5 seconds.
[0077] like Figure 9 As shown, at this time, the electronic device is playing audio through Bluetooth headphones, meaning the electronic device's audio playback state is in the second state. Assuming the electronic device is a mobile phone and the Bluetooth headphones are TWS earbuds, the mobile phone establishes a connection with the Bluetooth headphones while playing an audio file. In this initial establishment of the Bluetooth connection between the mobile phone and the Bluetooth headphones, both a first Bluetooth connection and a second Bluetooth connection are established simultaneously. This connection process can occur during the initial connection between the electronic device and the Bluetooth headphones, such as when the headphones are first opened and paired with the electronic device, or when the headphones are restored to factory settings and paired with the mobile phone. The initial pairing process, by establishing two Bluetooth connections, allows the acquisition of connection information for both Bluetooth connections, such as Bluetooth addresses and pairing information, thus facilitating subsequent Bluetooth connections. Figure 9As shown, when the Bluetooth headset enters the pairing state, it can be in the page scan state. In some embodiments, the pairing state can also be when both page scan and inquiry scan are enabled. The mobile phone sends a page packet, and the Bluetooth headset scans the page request sent by the mobile phone to establish a classic Bluetooth connection between the Bluetooth device and the mobile phone. The mobile phone scans for LE Audio broadcasts sent by the headset (for example, the LE Audio broadcast can be a Bluetooth Low Energy broadcast used to establish a LE Audio Bluetooth connection). This LE Audio broadcast may include the headset's Bluetooth Low Energy Audio mode access address, such as a BLE address. Then, the mobile phone establishes a LE Audio connection with the headset based on this LE Audio broadcast. For example, for dual-mode Bluetooth headsets, the headset can also be divided into a master headset and a slave headset based on the connection relationship with the electronic device (e.g., a mobile phone) in classic Bluetooth. The mobile phone scans for the LE Audio broadcasts sent by the master headset and the slave headset respectively, and establishes LE Audio connections between the mobile phone and the master headset, and between the mobile phone and the slave headset respectively. For example, in LE Audio Bluetooth mode, there may be no distinction between master and slave headsets. Therefore, a first Bluetooth connection and a second Bluetooth connection are established simultaneously between the electronic device and the Bluetooth headset. The state of the LE Audio switch is determined; this LE Audio switch can be as described above. Figure 6 and Figure 7 In the Bluetooth settings interface, if the LEAudio switch is detected to be off, it indicates a request for a classic Bluetooth connection between the phone and Bluetooth headset. In this case, both the classic Bluetooth connection and the LEAudio connection are maintained, and data is transferred between the phone and headset using the classic Bluetooth connection. If the LEAudio switch is detected to be on, it indicates a request for a LEAudio connection between the phone and Bluetooth headset. In this case, both the classic Bluetooth connection and the LEAudio connection are maintained, and data is transferred between the phone and headset using the LEAudio connection. It can be seen that even when the LEAudio switch is toggled, because both the classic Bluetooth connection and the LEAudio connection are always maintained when the electronic device is not playing audio, only the Bluetooth connection being used is switched, without needing to disconnect or reconnect a particular Bluetooth connection.
[0078] like Figure 10 As shown, with Figure 9Similarly, when an electronic device and a Bluetooth headset are initially connected, both a classic Bluetooth connection and a LE Audio connection are established simultaneously. When the electronic device plays audio (i.e., in the first audio playback state), it's necessary to determine which Bluetooth connection is used to transmit audio data between the device and the headset. This can be achieved by checking the state of the LE Audio switch. If the LE Audio switch is off, it indicates a request to use the classic Bluetooth connection between the device and the headset. Data can then be transmitted between the device and the headset using the classic Bluetooth connection. For example, the classic Bluetooth connection can be kept in a persistent state, and an audio transmission channel (e.g., an SCO channel) can be established on the classic Bluetooth connection. After this channel is established, the LE Audio connection can be disconnected after transmitting the audio data currently being played by the electronic device using this channel. If the LEAudio switch is determined to be in the ON state, and a request for a LE Audio connection is confirmed between the phone and Bluetooth headset, then the LE Audio connection is established while maintaining the classic Bluetooth connection between the electronic device and the Bluetooth headset and transmitting audio data using the audio transmission channel on that classic Bluetooth connection. A data transmission channel (e.g., a CIS channel) is then established on this LE Audio connection. After this channel is established, the classic Bluetooth connection can be disconnected after transmitting the audio data currently to be played by the electronic device using that channel. Therefore, Figure 10 and Figure 3 In comparison, it can be seen that the method provided in this application embodiment can, when the electronic device is currently maintaining a second Bluetooth connection, establish a first Bluetooth connection first after determining that the first Bluetooth connection to be switched, and then establish a data transmission channel based on the first Bluetooth connection before disconnecting the second Bluetooth connection, thereby reducing the negative impact of data transmission interruption.
[0079] Continue to participate Figure 10 When the audio playback ends, i.e. when the audio playback state of the electronic device switches from the first state to the second state, it is determined whether the electronic device is in a state of no audio playback within 5 seconds, i.e., continuously in the second state. If so, the classic Bluetooth connection is restored, i.e., at this time the electronic device and the Bluetooth headset maintain both the classic Bluetooth connection and the LE Audio connection.
[0080] Therefore, this application optimizes the solution for switching between LE Audio and BT modes on a mobile phone, and optimizes specific logic for scenarios with and without service playback on the mobile phone. In the scenario with no service playback, the mobile phone and headphones always maintain the coexistence of BT and LE Audio to ensure a smooth switching experience for the user. In the scenario with service playback on the mobile phone, by first connecting to the target mode and establishing the audio transmission channel for that mode before disconnecting the current mode, the system avoids situations where the phone's audio is played aloud due to switching failure, ensuring the reliability, stability, and timeliness of the switching. Simultaneously, another link is disconnected; for example, if BT is used, LE Audio is disconnected to ensure bandwidth utilization. Furthermore, an anti-shake mechanism is added to determine the switching between scenarios with and without service playback on the mobile phone (i.e., if the audio playback state is detected to switch from the first state to the second state, and if the electronic device remains in the second state within the time period corresponding to the timed operation, both the first Bluetooth connection and the second Bluetooth connection are kept connected), thereby improving the user experience and enhancing product competitiveness.
[0081] Please see Figure 11 The diagram illustrates a structural block diagram of a Bluetooth communication device provided in an embodiment of this application. The device may include an acquisition unit 1101 and a control unit 1102.
[0082] The acquisition unit 1101 is used to acquire the audio playback status of the electronic device. The audio playback status includes a first status and a second status. The first status is used to indicate that the electronic device is playing audio, and the second status is used to indicate that the electronic device is not playing audio.
[0083] The control unit 1102 is configured to, if the audio playback state is the second state, configure the first Bluetooth connection to be in a keep-connected state and configure the second Bluetooth connection to be in a keep-connected state.
[0084] Furthermore, the control unit 1102 is also configured to, in response to a request between the electronic device and the Bluetooth headset to use the first Bluetooth connection, transmit data between the electronic device and the Bluetooth headset if the audio playback state switches from the second state to the first state.
[0085] Furthermore, the control unit 1102 is also configured to disconnect the second Bluetooth connection in response to a request between the electronic device and the Bluetooth headset to use the first Bluetooth connection to transmit data between the electronic device and the Bluetooth headset.
[0086] Furthermore, the control unit 1102 is also configured to configure the first Bluetooth connection to be in a keep-connected state and the second Bluetooth connection to be in a keep-connected state if the audio playback state switches from the first state to the second state.
[0087] Furthermore, the control unit 1102 is also configured to, if the audio playback state switches from the first state to the second state, determine the Bluetooth connection that was in a connected state during the most recent period when the electronic device was in the first state, and the Bluetooth connection that was in a disconnected state during the first Bluetooth connection; restore the Bluetooth connection in the disconnected state to a connected state, and keep the Bluetooth connection in the connected state in a connected state.
[0088] Furthermore, the control unit 1102 is also configured to start a timed operation if it detects that the audio playback state has switched from the first state to the second state; if the electronic device remains in the second state during the time period corresponding to the timed operation, configure the first Bluetooth connection to be in a keep-connected state and configure the second Bluetooth connection to be in a keep-connected state.
[0089] Furthermore, one of the first Bluetooth connection and the second Bluetooth connection is a classic Bluetooth connection, and the other Bluetooth connection is a LE Audio Bluetooth connection.
[0090] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the above-described device and module can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0091] In the several embodiments provided in this application, the coupling between modules can be electrical, mechanical, or other forms of coupling.
[0092] Furthermore, the functional modules in the various embodiments of this application can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The integrated modules described above can be implemented in hardware or as software functional modules.
[0093] Please refer to Figure 12This document illustrates a structural block diagram of an electronic device according to an embodiment of this application. The electronic device 100 can be a smartphone, tablet computer, e-reader, or other electronic device capable of running applications. The electronic device 100 in this application may include one or more of the following components: a processor 110, a memory 120, and one or more applications, wherein the one or more applications can be stored in the memory 120 and configured to be executed by one or more processors 110, and the one or more applications are configured to perform the methods described in the foregoing method embodiments.
[0094] Processor 110 may include one or more processing cores. Processor 110 connects to various parts within the electronic device 100 using various interfaces and lines, and performs various functions and processes data of the electronic device 100 by running or executing instructions, programs, code sets, or instruction sets stored in memory 120, and by calling data stored in memory 120. Optionally, processor 110 may be implemented using at least one hardware form of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), or Programmable Logic Array (PLA). Processor 110 may integrate one or more of the following: Central Processing Unit (CPU), Graphics Processing Unit (GPU), and modem. The CPU primarily handles the operating system, user interface, and applications; the GPU is responsible for rendering and drawing the displayed content; and the modem handles wireless communication. It is understood that the modem may also not be integrated into processor 110 and may be implemented separately using a communication chip.
[0095] The memory 120 may include random access memory (RAM) or read-only memory (ROM). The memory 120 can be used to store instructions, programs, code, code sets, or instruction sets. The memory 120 may include a program storage area and a data storage area. The program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as touch functionality, sound playback functionality, image playback functionality, etc.), and instructions for implementing the various method embodiments described below. The data storage area may also store data created by the electronic device 100 during use (such as phonebook data, audio and video data, chat log data, etc.).
[0096] Please refer to Figure 13 This diagram illustrates a structural block diagram of a computer-readable storage medium provided in an embodiment of this application. The computer-readable medium 1300 stores program code that can be called by a processor to execute the methods described in the above method embodiments.
[0097] The computer-readable storage medium 1300 may be an electronic memory such as flash memory, EEPROM (Electrically Erasable Programmable Read-Only Memory), EPROM, hard disk, or ROM. Optionally, the computer-readable storage medium 1300 includes a non-volatile computer-readable storage medium. The computer-readable storage medium 1300 has storage space for program code 1310 that performs any of the method steps described above. This program code can be read from or written to one or more computer program products. The program code 1310 may, for example, be compressed in a suitable form.
[0098] In summary, the electronic device and the Bluetooth headset support establishing two different Bluetooth communication modes: a first Bluetooth connection and a second Bluetooth connection. By acquiring the audio playback status of the electronic device, it can be determined whether the electronic device is currently playing audio or not. Then, based on the audio playback status of the electronic device, the connection status of the first Bluetooth connection and the second Bluetooth connection is controlled. Therefore, the connection status settings of the first Bluetooth connection and the second Bluetooth connection can take into account the influence of the audio playback status, making the connection status settings of the first Bluetooth connection and the second Bluetooth connection more closely match the user's audio playback needs of the electronic device.
[0099] Specific logic optimizations are implemented for scenarios with and without mobile playback. In scenarios with no playback, both the phone and headphones maintain a coexistence of BitTorrent and LE Audio, ensuring a smooth user switching experience. In scenarios with mobile playback, the system first connects to the target mode and establishes an audio transmission channel for that mode before disconnecting the current mode. This prevents switching failures that could result in the phone playing audio aloud, ensuring reliable, stable, and timely switching. Simultaneously, another link is disconnected; for example, if BitTorrent is used, LE Audio is disconnected to ensure bandwidth utilization. An anti-shake mechanism is added to detect switching between scenarios with and without mobile playback (i.e., if the audio playback state changes from the first state to the second state, and the electronic device remains in the second state within the corresponding time period, both the first and second Bluetooth connections are kept connected), thereby improving user experience and enhancing product competitiveness.
[0100] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.
Claims
1. A Bluetooth communication method, characterized in that, A method applicable to electronic devices and / or Bluetooth headsets, wherein the electronic device and the Bluetooth headset support establishing a first Bluetooth connection and a second Bluetooth connection, the method comprising: The audio playback status of the electronic device is obtained, and the audio playback status includes a first status and a second status. The first status is used to indicate that the electronic device is playing audio, and the second status is used to indicate that the electronic device is not playing audio. If the audio playback state is the second state, configure the first Bluetooth connection to be in a keep-connect state, and configure the second Bluetooth connection to be in a keep-connect state; If the audio playback state is the first state, configure one of the first Bluetooth connection and the second Bluetooth connection to be in a keep-connected state, and the other Bluetooth connection to be in a disconnected state.
2. The method according to claim 1, characterized in that, Also includes: If the audio playback state switches from the second state to the first state, in response to a request between the electronic device and the Bluetooth headset to use the first Bluetooth connection, data between the electronic device and the Bluetooth headset is transmitted using the first Bluetooth connection.
3. The method according to claim 2, characterized in that, The step of responding to a request between the electronic device and the Bluetooth headset to use the first Bluetooth connection, and using the first Bluetooth connection to transmit data between the electronic device and the Bluetooth headset, includes: In response to a request between the electronic device and the Bluetooth headset to use the first Bluetooth connection, data is transmitted between the electronic device and the Bluetooth headset using the first Bluetooth connection, and the second Bluetooth connection is disconnected.
4. The method according to claim 1, characterized in that, If the audio playback state is the second state, configuring the first Bluetooth connection to be in a keep-on state and configuring the second Bluetooth connection to be in a keep-on state includes: If the audio playback state switches from the first state to the second state, the first Bluetooth connection is configured to be in a keep-connected state, and the second Bluetooth connection is configured to be in a keep-connected state.
5. The method according to claim 4, characterized in that, If the audio playback state switches from the first state to the second state, configuring the first Bluetooth connection to be in a persistent connection state and configuring the second Bluetooth connection to be in a persistent connection state includes: If the audio playback state switches from the first state to the second state, determine the Bluetooth connection that was in a connected state during the most recent period when the electronic device was in the first state, and the Bluetooth connection that was in a disconnected state during the first Bluetooth connection and the second Bluetooth connection. The Bluetooth connection that was previously disconnected is restored to a connected state, and the Bluetooth connection that was previously in a connected state remains in a connected state.
6. The method according to claim 4, characterized in that, If the audio playback state switches from the first state to the second state, configuring the first Bluetooth connection to be in a persistent connection state and configuring the second Bluetooth connection to be in a persistent connection state includes: If the audio playback state is detected to switch from the first state to the second state, start the timer operation; If the electronic device remains in the second state during the time period corresponding to the timed operation, the first Bluetooth connection is configured to be in a keep-connected state, and the second Bluetooth connection is configured to be in a keep-connected state.
7. The method according to any one of claims 1-6, characterized in that, One of the first Bluetooth connection and the second Bluetooth connection is a classic Bluetooth connection, and the other Bluetooth connection is an LE Audio Bluetooth connection.
8. A Bluetooth communication device, characterized in that, A device for use with electronic devices and / or Bluetooth headsets, wherein the electronic devices and the Bluetooth headsets support establishing a first Bluetooth connection and a second Bluetooth connection with two different Bluetooth communication modes, the device comprising: The acquisition unit is used to acquire the audio playback status of the electronic device, the audio playback status including a first status and a second status, the first status being used to indicate that the electronic device is playing audio, and the second status being used to indicate that the electronic device is not playing audio; The control unit is configured to, if the audio playback state is a second state, configure the first Bluetooth connection to be in a persistent connection state and configure the second Bluetooth connection to be in a persistent connection state; if the audio playback state is a first state, configure one of the first Bluetooth connection and the second Bluetooth connection to be in a persistent connection state and the other Bluetooth connection to be in a disconnected state.
9. An electronic device, characterized in that, include: One or more processors; Memory; One or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the one or more processors, the one or more applications being configured to perform the method as described in any one of claims 1-7.
10. A computer-readable medium, characterized in that, The computer-readable medium stores processor-executable program code, which, when executed by the processor, causes the processor to perform the method according to any one of claims 1-7.
Citation Information
Patent Citations
Bluetooth switching method and Bluetooth equipment
CN110572803A
Bluetooth equipment audio control method and device, equipment and storage medium
CN115022773A