WO2024119947A1 - 蓝牙通信方法、装置、电子设备及计算机可读介质 - Google Patents

蓝牙通信方法、装置、电子设备及计算机可读介质 Download PDF

Info

Publication number
WO2024119947A1
WO2024119947A1 PCT/CN2023/118872 CN2023118872W WO2024119947A1 WO 2024119947 A1 WO2024119947 A1 WO 2024119947A1 CN 2023118872 W CN2023118872 W CN 2023118872W WO 2024119947 A1 WO2024119947 A1 WO 2024119947A1
Authority
WO
WIPO (PCT)
Prior art keywords
state
bluetooth
bluetooth connection
electronic device
connection
Prior art date
Application number
PCT/CN2023/118872
Other languages
English (en)
French (fr)
Inventor
侯锐填
Original Assignee
Oppo广东移动通信有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Oppo广东移动通信有限公司 filed Critical Oppo广东移动通信有限公司
Publication of WO2024119947A1 publication Critical patent/WO2024119947A1/zh

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W4/00Services specially adapted for wireless communication networks; Facilities therefor
    • H04W4/80Services using short range communication, e.g. near-field communication [NFC], radio-frequency identification [RFID] or low energy communication
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W76/00Connection management
    • H04W76/10Connection setup
    • H04W76/14Direct-mode setup
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/70Reducing energy consumption in communication networks in wireless communication networks

Definitions

  • the present application relates to the field of audio playback technology, and more specifically, to a Bluetooth communication method, device, electronic device and computer-readable medium.
  • an electronic device can be connected to an external device via Bluetooth, and there may be more than one communication mode of Bluetooth connection.
  • the present application proposes a Bluetooth communication method, device, electronic device and computer-readable medium to improve the above-mentioned defects.
  • an embodiment of the present application provides a Bluetooth communication method, which is 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, and the method comprises: obtaining an audio playback status of the electronic device, wherein the audio playback status comprises a first status and a second status, wherein the first status is used to represent that the electronic device is playing audio, and the second status is used to represent that the electronic device is not playing audio; if the audio playback status is the second status, configuring the first Bluetooth connection to be in a state of maintaining connection, and configuring the second Bluetooth connection to be in a state of maintaining connection.
  • an embodiment of the present application further provides a Bluetooth communication device, which is 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, and the device includes: an acquisition unit and a control unit.
  • the acquisition unit is used to acquire the audio playback status of the electronic device, wherein the audio playback status includes a first state and a second state, wherein the first state is used to indicate that the electronic device is playing audio, and the second state is used to indicate that the electronic device is not playing audio.
  • the control unit is used to configure the first Bluetooth connection to be in a state of maintaining connection if the audio playback status is the second state, and to configure the second Bluetooth connection to be in a state of maintaining connection.
  • an embodiment of the present application also provides an electronic device, comprising: one or more processors; a 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, and the one or more applications are configured to execute the above method.
  • an embodiment of the present application further provides a computer-readable storage medium, wherein the readable storage medium stores a program code executable by a processor, and when the program code is executed by the processor, the processor executes the above method.
  • FIG1 is a schematic diagram showing a connection between an electronic device and a Bluetooth headset provided in an embodiment of the present application
  • FIG2 is a schematic diagram showing a Bluetooth mode switching process
  • FIG3 is a schematic diagram showing another Bluetooth mode switching process
  • FIG4 shows a method flow chart of a Bluetooth communication method provided by an embodiment of the present application
  • FIG5 shows a method flow chart of a Bluetooth communication method provided by another embodiment of the present application.
  • FIG6 shows a schematic diagram of a Bluetooth setting interface provided by an embodiment of the present application.
  • FIG7 shows a schematic diagram of a Bluetooth setting interface provided by another embodiment of the present application.
  • FIG8 shows a method flow chart of a Bluetooth communication method provided by another embodiment of the present application.
  • FIG9 is a schematic diagram showing a Bluetooth switching process of an electronic device provided in an embodiment of the present application when no audio is played;
  • FIG10 is a schematic diagram showing a Bluetooth switching process of an electronic device when playing audio provided by an embodiment of the present application
  • FIG11 shows a module block diagram of a Bluetooth communication device provided in an embodiment of the present application.
  • FIG12 shows a structural block diagram of an electronic device provided in an embodiment of the present application.
  • FIG. 13 shows a storage unit for storing or carrying a program code for implementing a Bluetooth communication method according to an embodiment of the present application.
  • the Internet of Things is a network concept that extends and expands the user end of the "Internet concept" to any object to exchange information and communicate.
  • IOT Internet of Things
  • the configured scenarios may involve multiple smart devices, and multiple smart devices have a certain linkage relationship and can work together.
  • the configured scenarios may include that when one device is close to another device, at least one of the two devices will perform a specified operation. Or when a device performs an operation, part of the operation The device processes part of the data by itself and sends the other part to another device for processing.
  • an electronic device can be connected to an external device via Bluetooth so that the user can control the electronic device to send data to the connected device.
  • the electronic device can be a smart phone, tablet computer, e-book, wireless audio player, display, etc., which has a Bluetooth module inside and can establish a Bluetooth connection with other Bluetooth headsets and exchange data.
  • the wireless audio player can include a Bluetooth headset or a Bluetooth speaker, etc.
  • the Bluetooth protocol supports multiple Bluetooth communication modes, which may include classic Bluetooth mode and low-power audio Bluetooth mode (LE Audio).
  • the classic Bluetooth mode includes three modes: basic rate (BR), enhanced rate (EDR) and high speed (HS).
  • Basic rate (BR) is also called Bluetooth 1.0
  • enhanced rate (EDR) can also be called Bluetooth 2.0
  • high speed (HS) can also be called Bluetooth 3.0.
  • Low-power audio Bluetooth mode is a Bluetooth audio transmission mode working in low-power Bluetooth (BLE) mode.
  • the low-power audio Bluetooth mode will adopt a new low-complexity communication codec (Low Complexity Communication Codec, LC3) to provide higher sound quality and lower power consumption.
  • LC3 Low Complexity Communication Codec
  • FIG. 1 shows a schematic diagram of the connection between an electronic device and a wireless headset.
  • the wireless headset is a dual headset group, that is, it includes a left headset and a right headset.
  • the wireless headset and the terminal can cooperate with each other to play audio data. For example, when the terminal plays a video or plays audio, the terminal sends the audio data to the wireless headset, which is played by the wireless headset.
  • the electronic device 100 maintains a BLE connection with the first wireless headset 210 and the second wireless headset 220 respectively, and the electronic device independently transmits and communicates data with the first wireless headset 210 and the second wireless headset 220.
  • the electronic device 100 can be a device such as a smart phone, a tablet computer, an e-book, a smart wearable device, etc. that can run applications and has the function of playing audio signals and video signals.
  • the first wireless headset 210 and the second wireless headset 220 constitute a True Wireless Stereo (TWS) headset, wherein the left and right earphones of the TWS headset are independent of each other and do not need to be connected by a cable, so that the left and right channels can be wirelessly separated.
  • TWS True Wireless Stereo
  • the headset and the mobile phone will eventually be in a disconnected mode due to the inability to connect to the desired Bluetooth communication mode, affecting the actual user experience.
  • the mobile phone has established a classic Bluetooth connection with the wireless headset, and the mobile phone plays audio data through the wireless headset, such as music playback, phone calls, etc. If the mobile phone needs to switch from the classic Bluetooth connection to the LE Audio connection, as shown in FIG3, the mobile phone disconnects the classic Bluetooth connection and then establishes an LE Audio connection with both ears, and then establishes a connection and other time flows. (Connected Isochronous Steam, CIS) for LE Audio streaming, and vice versa.
  • the whole process is not only time-consuming, but also there will be a long period of silence when switching Bluetooth communication modes.
  • FIG 4 shows a Bluetooth communication method provided by an embodiment of the present application.
  • the method is applied to a communication system, and the communication system includes an electronic device and a Bluetooth headset.
  • the electronic device can be the aforementioned smart phone, and the Bluetooth headset can be the aforementioned wireless headset.
  • the execution subject of the method can be an electronic device, a Bluetooth headset, or an electronic device and a Bluetooth headset interactively executed, which is not limited here. Then the method may include: S401 to S402.
  • S401 Acquire the audio playing status of the electronic device.
  • the audio playback state of the electronic device includes a first state and a second state, the first state is used to characterize that the electronic device is playing audio, and the second state is used to characterize that the electronic device is not playing audio.
  • monitoring software may be provided in the electronic device, and when the electronic device performs an audio playback service, the audio playback state of the electronic device is set to the first state, and in other cases, the audio playback state of the electronic device is set to the second state.
  • the audio playback service can be all services that can play audio, that is, as long as the electronic device is playing audio data, the monitoring software sets the audio playback state of the electronic device to the first state, otherwise, it is set to the second state.
  • the audio playback state of the electronic device when the electronic device executes a preset type of audio playback service, the audio playback state of the electronic device is set to the first state, and in other cases, the audio playback state of the electronic device is set to the second state.
  • the preset type of audio playback service can be determined from all audio playback-related audio playback services supported by the electronic device, and the preset type of audio playback service has at least one of the following characteristics: the audio playback duration is greater than the preset duration and is triggered by a specified service function.
  • the preset duration can be set based on experience and demand, for example, the preset duration can be set based on all prompt tones supported by the electronic device for playback, for example, it can be the maximum value of the playback duration of all prompt tones, and the prompt tone can be a key prompt tone and/or a short text message prompt tone and other audio with a shorter playback duration.
  • the preset duration when it is determined that the playback duration of the audio playback service executed by the electronic device is greater than the preset duration, it is determined that the audio playback state of the electronic device is set to the first state.
  • the playback duration of the audio playback service can be set based on the audio file requested to be played by the audio playback service. If the audio file is a prompt tone file, the audio playback duration of the audio playback service is determined to be less than or equal to the preset duration. If the audio file is not a prompt tone file, the audio playback duration of the audio playback service is determined to be greater than the preset duration. It can also be that when the electronic device performs an audio playback service, the continuous playback duration of the audio playback service is determined. When the playback duration is less than or equal to the preset duration, the audio playback state of the electronic device is determined to be the second state.
  • the audio playback state of the electronic device is determined to be the first state.
  • the preset type of audio playback service is triggered by a specified service function, and the specified service function can trigger the electronic device to perform the audio playback service corresponding to the specified service function.
  • the specified service function can be a song playback function, a video playback function, a game running function, and a call function, etc., which are not specifically limited here.
  • the Bluetooth connection may include a Bluetooth communication link established based on the Bluetooth communication protocol.
  • 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 (Asychronous Connection Oriented); in some embodiments, establishing a Bluetooth connection may also include establishing an audio transmission protocol or other data transmission protocols based on the aforementioned link, such as the Bluetooth audio transmission model agreement (Advanced Audio Distribution Profile, A2dp) and the hands-free protocol (Hands-free Profile, HFP), etc.
  • A2dp Advanced Audio Distribution Profile
  • HFP hands-free protocol
  • the completion of the Bluetooth connection establishment does not include the establishment of certain audio transmission channels, for example, synchronous connection-oriented Link (Synchronous Connection Oriented, SCO) and CIS, etc., but only when there is a related audio business or under preset conditions will the audio transmission channel such as SCO or CIS be established, that is, when establishing a Bluetooth connection, the audio transmission channel will not be established immediately, but the corresponding audio transmission channel will be established when there is a business trigger to transmit the related business.
  • SCO synchronous connection-oriented Link
  • CIS CIS
  • disconnecting the Bluetooth connection can correspond to establishing a Bluetooth connection, and in some embodiments, the Bluetooth connections in the two can also have different meanings. For example, establishing a Bluetooth connection can be to establish a logical link such as ACL, but disconnecting the Bluetooth connection may be to disconnect the logical link and the upper layer communication protocol. Generally speaking, the upper layer protocol will also be disconnected after the bottom link is disconnected. In some embodiments, disconnecting the Bluetooth connection can be understood as disconnecting all Bluetooth communication links between two devices. In some embodiments, disconnecting the Bluetooth connection can also be understood as disconnecting the upper layer protocol.
  • disconnecting the Bluetooth connection means that point-to-point transmission cannot be performed between two devices based on the Bluetooth link.
  • the first Bluetooth connection and the second Bluetooth connection correspond to different Bluetooth communication modes.
  • the Bluetooth communication mode of one of the first Bluetooth connection and the second Bluetooth connection is the classic Bluetooth mode
  • the Bluetooth communication mode of the other is the low-power audio Bluetooth mode (i.e., the aforementioned LE Audio mode).
  • the Bluetooth communication mode corresponding to the first Bluetooth connection is the classic Bluetooth mode.
  • the first Bluetooth connection is the classic Bluetooth connection
  • the Bluetooth communication mode corresponding to the second Bluetooth connection is the low-power audio Bluetooth mode.
  • the second Bluetooth connection is the low-power audio Bluetooth connection.
  • the Bluetooth communication mode corresponding to the first Bluetooth connection is the low-power audio Bluetooth mode
  • the Bluetooth communication mode corresponding to the second Bluetooth connection is the classic Bluetooth mode.
  • the electronic device and the Bluetooth headset can be a device that supports multi-mode Bluetooth, that is, it can support different Bluetooth communication modes, such as classic Bluetooth communication, LE Audio Bluetooth communication, and of course other Bluetooth communication modes.
  • Bluetooth communication modes such as classic Bluetooth communication, LE Audio Bluetooth communication, and of course other Bluetooth communication modes.
  • one of the Bluetooth connections corresponds to the classic Bluetooth connection
  • the other Bluetooth connection corresponds to the LE Audio Bluetooth connection.
  • connection process can occur in the first connection between the electronic device and the Bluetooth headset, such as the pairing connection between the headset and the electronic device after the headset is opened for the first time, or the pairing connection between the headset and the mobile phone after the headset is restored to factory settings.
  • the first pairing can obtain the connection information of the two Bluetooth connections, such as the Bluetooth address, pairing information, etc., by establishing two Bluetooth connections, so as to facilitate subsequent Bluetooth connections.
  • the electronic device and the Bluetooth headset support establishing a Bluetooth connection through two different Bluetooth communication modes at the same time, for example, the electronic device and the Bluetooth headset support establishing a first Bluetooth connection and a second Bluetooth connection at the same time, when maintaining the first Bluetooth connection and the second Bluetooth connection at the same time, the power consumption of the electronic device and the Bluetooth headset may be relatively large. Therefore, the inventor found in the research that the current connection method often disconnects one of the Bluetooth connections and keeps the other Bluetooth connection in a connected state 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, but does not set the connection status of the two Bluetooth connections based on the actual usage status of the electronic device.
  • the embodiment of the present application configures the connection status of the first Bluetooth connection and the second Bluetooth connection based on the audio playback status, wherein the connection status includes maintaining connection and disconnecting. Therefore, the method provided in the embodiment of the present application enables the setting of the connection status of the first Bluetooth connection and the second Bluetooth connection to take into account the influence of the audio playback status, thereby enabling the setting of the connection status of the first Bluetooth connection and the second Bluetooth connection to better meet the user's audio playback needs for the electronic device.
  • the embodiments of the present application can consider the setting of the connection status of the first Bluetooth connection and the second Bluetooth connection of the electronic device in different audio playback states from the perspective of power consumption. For example, if the audio playback state is the second state, that is, the electronic device is not currently playing audio or performing a preset type of audio playback service, the first Bluetooth connection and the second Bluetooth connection are configured to remain connected, that is, the first Bluetooth connection is configured to remain connected, and the second Bluetooth connection is configured to remain connected.
  • the electronic device Since the electronic device is not playing audio or performing a preset type of audio playback service, In the case of a playback service, there is no large data interaction demand between the electronic device and the Bluetooth headset, so the first Bluetooth connection and the second Bluetooth connection can be kept in a state of keeping connected, that is, the first Bluetooth connection and the second Bluetooth connection are kept, so that the electronic device and the Bluetooth headset can use the first Bluetooth connection and the second Bluetooth connection to transmit data at will. For example, as mentioned above, when the electronic device performs a preset type of audio playback service, it is determined that the audio playback state of the electronic device is the second state.
  • the audio played by the electronic device when performing a non-preset type of audio playback service can be transmitted through any one of the first Bluetooth connection and the second Bluetooth connection, and the other unused Bluetooth connection remains connected.
  • the electronic device is to switch to another Bluetooth connection for transmission, since the other Bluetooth connection is in a state of keeping connected, it can be used directly without reconnecting.
  • the audio playback state is the first state, that is, 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 state of keeping connected, and the other Bluetooth connection is in a state of disconnecting, so as to take into account that when the electronic device is playing audio, the amount of data transmitted between the electronic device and the Bluetooth headset is relatively large.
  • connection status of the first Bluetooth connection and the second Bluetooth connection based on the audio playback status as mentioned above, it can also be that if the audio playback status is the second state, one of the first Bluetooth connection and the second Bluetooth connection is configured to be in a maintained connection state, and the other Bluetooth connection is in a disconnected state; if the audio playback status is the first state, both the first Bluetooth connection and the second Bluetooth connection are configured to be in a maintained connection state.
  • the specific implementation method is not limited here.
  • the subsequent embodiments will separately describe the settings of the connection states of the first Bluetooth connection and the second Bluetooth connection for the audio playback state being the first state and the second state.
  • FIG. 5 shows a Bluetooth communication method provided by an embodiment of the present application.
  • the method is applied to a communication system, and the communication system includes an electronic device and a Bluetooth headset.
  • the electronic device can be the aforementioned smart phone, and the Bluetooth headset can be the aforementioned wireless headset.
  • the execution subject of the method can be an electronic device, a Bluetooth headset, or an electronic device and a Bluetooth headset interactively executed, which is not limited here. Then the method can include: S501 to S503.
  • S501 Acquire the audio playing status of the electronic device.
  • the audio playback state of the electronic device is continuously detected. If it is detected that the audio playback state of the electronic device is switched 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, the first Bluetooth connection is used to transmit data between the electronic device and the Bluetooth headset.
  • the electronic device or the Bluetooth headset can detect whether a specified request is received, and the specified request is used to characterize a request to use the first Bluetooth connection between the electronic device and the Bluetooth headset.
  • the first Bluetooth connection refers to the Bluetooth connection currently requested for use, and the Bluetooth connection that is not requested for use is the second Bluetooth connection. That is, if the first Bluetooth connection is a classic Bluetooth connection, it means that the electronic device and the Bluetooth headset request to use the 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 the LE Audio Bluetooth connection, the first Bluetooth connection is the LE Audio Bluetooth connection, and the second Bluetooth connection is the classic Bluetooth connection.
  • the specified request may be input by a user based on an electronic device, may be input based on a Bluetooth headset, or may be input in a
  • the specified request is automatically triggered and generated under the preset application scenario.
  • the specified request can be a specific instruction generated based on user operation or according to the preset application scenario, wherein the preset application scenario can be a game application scenario, a video playback scenario or other preset scenario, which is not limited to this.
  • the user taking the specified request as user input as an example, the user can input the specified request based on the electronic device, or based on the Bluetooth headset input.
  • the specified request can be determined by the electronic device, and the electronic device can display a Bluetooth setting interface, which can include switches for different Bluetooth communication modes to turn on or off the corresponding Bluetooth communication mode.
  • the Bluetooth setting interface can include a first switch 601 corresponding to the first Bluetooth communication mode and a second switch 602 included in the second Bluetooth communication mode. The first switch is set to be in an on state, thereby requesting to establish a Bluetooth connection corresponding to the first Bluetooth communication mode, and the second switch is set to be in an on state, thereby requesting to establish a Bluetooth connection corresponding to the second Bluetooth communication mode between the electronic device and the Bluetooth headset.
  • a designated switch 701 may be set in the Bluetooth setting interface, and the default Bluetooth mode between the electronic device and the Bluetooth headset is the first Bluetooth communication mode.
  • the designated switch 701 is in the switched state, a Bluetooth connection is established between the electronic device and the Bluetooth headset based on the second Bluetooth communication mode.
  • a Bluetooth connection is established between the electronic device and the Bluetooth headset based on the first Bluetooth communication mode.
  • the specified request can be determined by a Bluetooth headset. If the Bluetooth headset has a screen, the Bluetooth headset can also be similar to an electronic device, that is, the Bluetooth setting interface is used to obtain the specified request. 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 methods, and the other methods can include at least one of gesture detection and voice detection.
  • 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 used 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.
  • the first Bluetooth communication mode is the LE Audio mode
  • the switch of the first Bluetooth communication mode in the Bluetooth setting interface is turned on
  • the LE Audio connection and the classic Bluetooth connection are both in the state of maintaining the connection
  • the LE Audio connection is used to transmit the data between the electronic device and the Bluetooth headset.
  • the switch of the first Bluetooth communication mode in the Bluetooth setting interface is turned off, it means that the electronic device and the Bluetooth headset request to use the classic Bluetooth connection, and the LE Audio connection and the classic Bluetooth connection are both in the state of maintaining the connection, and the classic Bluetooth connection is used to transmit the data between the electronic device and the Bluetooth headset.
  • the classic Bluetooth connection and the LE Audio connection between the electronic device and the Bluetooth headset can be maintained, and then, based on the state of the specified switch, it is determined whether the classic Bluetooth connection or the LE Audio connection is currently required. Since the LE Audio connection and the classic Bluetooth connection are both in the state of maintaining the connection, when switching different Bluetooth connections, it is not necessary to disconnect the unused Bluetooth connection, nor is it necessary to re-establish the connection of a Bluetooth connection.
  • the first Bluetooth connection and the second Bluetooth connection may be maintained between the electronic device and the Bluetooth headset at the same time.
  • the audio playback state of the electronic device is switched from the second state to the first state, and the electronic device has not yet determined the Bluetooth communication mode requested to be used between the electronic device and the Bluetooth headset.
  • the first Bluetooth connection and the second Bluetooth connection are maintained between the electronic device and the Bluetooth headset at the same time. Then, if it is determined that the 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.
  • the audio playback state is switched 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, the first Bluetooth connection is used to transmit data between the electronic device and the Bluetooth headset, and the second Bluetooth connection is disconnected.
  • the specified Request the designated request is used to characterize the use of the second Bluetooth connection between the electronic device and the Bluetooth headset to transmit data, that is, the designated request is equivalent to a switching request, that is, switching the first Bluetooth connection to the second Bluetooth connection.
  • the first Bluetooth connection between the electronic device and the Bluetooth headset is disconnected and a second Bluetooth connection is established, so as to transmit data through the second Bluetooth connection.
  • the first Bluetooth connection may be disconnected first and then the second Bluetooth connection may be established, or the second Bluetooth connection may be established first and then the first Bluetooth connection may be disconnected, that is, in the process of establishing the second Bluetooth connection between the electronic device and the Bluetooth headset, the first Bluetooth connection between the electronic device and the Bluetooth headset remains connected. That is, while maintaining the first Bluetooth connection, the second Bluetooth connection is established; after the second Bluetooth connection is successfully established, the first Bluetooth connection is disconnected.
  • the Bluetooth communication mode of one of the first Bluetooth connection and the second Bluetooth connection is the classic Bluetooth mode
  • the Bluetooth communication mode of the other is the low-power audio Bluetooth mode.
  • the Bluetooth communication mode corresponding to the second Bluetooth connection is the classic Bluetooth mode
  • the Bluetooth communication mode corresponding to the first Bluetooth connection is the low-power audio Bluetooth mode.
  • the electronic device is a mobile phone
  • the Bluetooth headset can be a True Wireless Stereo (TWS) headset.
  • TWS True Wireless Stereo
  • the Bluetooth headset can be in a pairing state.
  • the Bluetooth headset can be discovered by other devices.
  • Bluetooth headset When other devices have not established a Bluetooth connection with the Bluetooth headset, or when other devices have not pre-acquired the Bluetooth address of the Bluetooth headset, they need to pair with the Bluetooth headset, that is, through pairing, the Bluetooth headset exchanges communication information with the device requesting the connection, and the communication information includes the communication address and other data for establishing the connection. Therefore, for a new device, only when the Bluetooth headset enters the inquiry scan can it be scanned by other devices, and then paired with other devices, and then complete the Bluetooth connection with other devices.
  • the earphone in the TWS earphone that establishes a classic Bluetooth connection with the electronic device is the main earphone, and the main earphone can be used as the Bluetooth earphone in this application to execute the methods in some embodiments of the present application.
  • the TWS earphone can also be regarded as a whole, and the classic Bluetooth connection can be understood as being established between the main earphone and the electronic device, and the LE Audio Bluetooth connection can be understood as being established by the two earphones of the TWS earphone with the electronic device respectively.
  • the LE Audio Bluetooth connection can also be connected by monitoring.
  • the main earphone can establish a classic Bluetooth connection and/or an LE Audio Bluetooth connection with the electronic device, and the slave earphone establishes the aforementioned classic Bluetooth connection or LE Audio Bluetooth connection by monitoring.
  • the first Bluetooth connection is an LE Audio connection and the second Bluetooth connection is a classic Bluetooth connection.
  • the electronic device starts to play audio, that is, the audio playback state of the electronic device is in the first state
  • a second Bluetooth connection has been established between the electronic device and the Bluetooth headset
  • the switch state of the designated switch in the Bluetooth setting interface is in the off state, that is, at this time, a classic Bluetooth connection has been established between the electronic device and the Bluetooth headset but no LE Audio connection has been established, and data is transmitted between the electronic device and the Bluetooth headset via the classic Bluetooth connection.
  • a specified request is detected, that is, a request to switch the second Bluetooth connection established between the electronic device and the Bluetooth headset to the first Bluetooth connection, then the electronic device or the Bluetooth device will establish the first Bluetooth connection while maintaining the second Bluetooth connection, and then, after the first Bluetooth connection is successfully established, the second Bluetooth connection is disconnected.
  • the audio playback state of the electronic device when the audio playback state of the electronic device is in the first state, it is possible to establish a first Bluetooth connection between the electronic device and the Bluetooth device when a second Bluetooth connection has been established between the electronic device and the Bluetooth device. After the first Bluetooth connection is successfully established, the second Bluetooth connection is disconnected. That is to say, the second Bluetooth connection can be maintained during the process of establishing the first Bluetooth connection, which can reduce the jamming when the second Bluetooth connection switches to the first Bluetooth connection, and can also avoid excessive power consumption and excessive bandwidth occupancy when the first Bluetooth connection and the second Bluetooth connection are maintained at the same time. It should be noted that a data transmission channel can be established on the basis of the first Bluetooth connection and the second Bluetooth connection, and data can be transmitted between the electronic device and the Bluetooth device through the data transmission channel.
  • the data transmission channel can refer to the description of the subsequent embodiments.
  • the first Bluetooth connection can be disconnected when the first Bluetooth connection is successfully established and a data transmission channel is established on the established first Bluetooth connection. That is to say, when 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.
  • the electronic device is currently playing audio, so 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.
  • the second Bluetooth connection is not used to transmit data between the electronic device and the Bluetooth device, when the first Bluetooth connection is established, it can be considered that there is a high probability that the electronic device and the Bluetooth device will use the first Bluetooth connection to transmit data, so the data transmission channel can be established in advance, and the second Bluetooth connection can be disconnected after the data transmission channel is established, thereby completing the operation of switching the second Bluetooth connection to the first Bluetooth connection.
  • the second Bluetooth connection can be disconnected after the first Bluetooth connection is successfully established and before a data transmission channel is established on the first Bluetooth connection. That is, in the case where the second Bluetooth connection does not transmit preset data, the implementation method of disconnecting the second Bluetooth connection after the first Bluetooth connection is successfully established is to disconnect the second Bluetooth connection after the first Bluetooth connection is successfully established and before a data transmission channel is established on the first Bluetooth connection. That is, in the case where it is determined that the first Bluetooth connection does not need to take over the second Bluetooth connection to continue transmitting data, it is not necessary to wait until it is determined that a data transmission channel is successfully established on the first Bluetooth connection before disconnecting the second Bluetooth connection.
  • 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 determined to be established.
  • the implementation method of disconnecting the second Bluetooth connection is:
  • the audio playback state is the first state
  • a second Bluetooth connection has been established between the electronic device and the Bluetooth device and the preset data is transmitted using the second Bluetooth connection
  • a specified request is detected
  • the preset data is continued to be transmitted using the second Bluetooth connection
  • the first Bluetooth connection between the electronic device and the Bluetooth device is established.
  • the second Bluetooth connection is disconnected, and then the preset data is continued to be transmitted using the data transmission channel on the first Bluetooth connection between the electronic device and the Bluetooth headset.
  • other data can also be transmitted, which is not limited here. Therefore, audio data can be transmitted between the electronic device and the Bluetooth headset through the second Bluetooth connection to enable the electronic device to play audio through the Bluetooth headset.
  • the second Bluetooth connection can be disconnected after the data transmission channel of the first Bluetooth connection is established. This ensures that during the establishment of the data transmission channel of the first Bluetooth connection, the electronic device and the Bluetooth headset can continue to use the second Bluetooth connection to transmit data, and when the second Bluetooth connection is disconnected, it can be ensured that the data transmission channel of the first Bluetooth connection has been established, thereby reducing the jamming and time consumption caused by the switch.
  • the data transmission channel can be the aforementioned SCO or CIS. 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.
  • FIG8 shows a Bluetooth communication method provided in an embodiment of the present application.
  • the method is applied to a communication system, wherein the communication system includes an electronic device and a Bluetooth headset.
  • the electronic device may be the aforementioned smart phone, and the Bluetooth headset may be the aforementioned
  • the execution subject of the method may be an electronic device, a Bluetooth headset, or an electronic device and a Bluetooth headset interactively executing, which is not limited here.
  • the method may include: S801 to S806.
  • S801 Acquire the audio playing status of the electronic device.
  • S802 Determine whether the audio playback state is the first state or the second state.
  • S803 Configure the first Bluetooth connection to be in a state of maintaining connection, and configure the second Bluetooth connection to be in a state of maintaining connection.
  • 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 maintained connection state and the second Bluetooth connection to be in a disconnected state.
  • S806 If the audio playback state is switched from the first state to the second state, determine the Bluetooth connection that remained connected and the Bluetooth connection that remained disconnected in the first Bluetooth connection and the second Bluetooth connection during the last time when the electronic device was in the first state.
  • S807 Restoring the disconnected Bluetooth connection to a connected state, and maintaining the connected Bluetooth connection in a connected state.
  • the Bluetooth connection between the electronic device and the Bluetooth headset is switched from the second Bluetooth connection to the first Bluetooth connection, and then the audio playback state of the electronic device is continuously detected. If it is detected that the audio playback state of the electronic device is switched from the current first state to the second state, for example, the audio playback service of the electronic device ends, the audio playback state of the electronic device changes to the second state, and then the first Bluetooth connection and the second Bluetooth connection can be set to be in a state of maintaining connection. Exemplarily, 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 remains in a connected state, and the other Bluetooth connection is in a disconnected state.
  • the Bluetooth connection that remains in a connected state and the Bluetooth connection that remains in a disconnected state in the first Bluetooth connection and the second Bluetooth connection are determined during the last time when the electronic device was in the first state. That is, when it is determined that the last time the electronic device was playing audio, the Bluetooth connection that remains connected and the Bluetooth connection that remains disconnected are maintained, and then the Bluetooth connection that remains disconnected is restored to a connected state, and the Bluetooth connection that remains connected continues to be in a state of maintaining connection. For example, when the first Bluetooth connection was in the first state the last time, it remained connected and the second Bluetooth connection remained disconnected. After the electronic device switches to the second state, it is necessary to configure the first Bluetooth connection to remain connected and the second Bluetooth connection to remain connected.
  • the implementation method may be to restore the second Bluetooth connection and keep the first Bluetooth connection connected.
  • the aforementioned S801 can be the audio playback state detected for the first time when the electronic device meets the detection conditions, wherein the detection conditions can be after the aforementioned electronic device is connected to the Bluetooth headset for the first time, or it can be the pairing connection with the mobile phone after the headset is restored to factory settings, or it can be that the electronic device detects a preset request input by the user, and the preset request is used to instruct the electronic device to execute the method for setting the connection state of the first Bluetooth connection and the second Bluetooth connection based on the audio playback state of the electronic device mentioned in this application.
  • the electronic device detects that the electronic device meets the detection conditions, it starts to execute the operation of detecting the audio playback state of the electronic device, and then it can determine whether the audio playback state of the electronic device is the first state or the second state, thereby executing two different branches.
  • the audio playback state of the electronic device can continue to be detected, so that when the audio playback state changes, the connection state of the first Bluetooth connection and the second Bluetooth connection can be adjusted in time. Therefore, the aforementioned configuration of the first Bluetooth connection being in a state of maintaining connection, and the configuration of the second Bluetooth connection being in a state of maintaining connection can be performed when the audio playback state is first detected to be the second state, or when it is detected that the audio playback state switches from the first state to the second state.
  • the aforementioned response to the request between the electronic device and the Bluetooth headset to use the first Bluetooth connection, using the first Bluetooth connection to transmit data between the electronic device and the Bluetooth headset, and disconnecting the second Bluetooth connection can be performed when the audio playback state is first detected to be the first state, or when it is detected that the audio playback state switches from the second state to the first state, which is not limited here.
  • the time when the electronic device is in the second state is relatively short. For example, when the electronic device is playing a song, the electronic device does not play audio during the playback interval between two songs. However, the time of this interval is often relatively short. If both the first Bluetooth connection and the second Bluetooth connection are connected at this time, then after a relatively short period of time, the audio playback state of the electronic device changes to the first state again. Once again, one of the first Bluetooth connection and the second Bluetooth connection is controlled to remain connected, and the other Bluetooth connection is controlled to be disconnected, which will cause a Bluetooth connection to be frequently connected and disconnected.
  • the time period corresponding to the timing operation can be set based on actual needs, for example, it can be 5 seconds.
  • the electronic device plays audio through the Bluetooth headset, that is, the audio playback state of the electronic device is in the second state.
  • the electronic device is a mobile phone and the Bluetooth headset is a TWS headset
  • the mobile phone establishes a connection with the Bluetooth headset when playing an audio file.
  • the Bluetooth connection between the mobile phone and the Bluetooth headset is established for the first time
  • the first Bluetooth connection and the second Bluetooth connection will be established at the same time. It can be understood that the above connection process can occur in the first connection between the electronic device and the Bluetooth headset, such as the pairing connection between the headset and the electronic device after the headset is opened for the first time, or the pairing connection between the headset and the mobile phone after the headset is restored to factory settings.
  • the first pairing can obtain the connection information of the two Bluetooth connections through the process of establishing two Bluetooth connections, such as the Bluetooth address, pairing information, etc., so as to facilitate subsequent Bluetooth connections.
  • the Bluetooth headset when the Bluetooth headset enters the pairing state, the Bluetooth headset can be in the page scan state in the pairing state.
  • the pairing state can also be the case where both page scan and inquiry scan are turned on.
  • the mobile phone sends a page packet, and the Bluetooth headset scans the page request sent by the mobile phone to perform a classic Bluetooth connection between the Bluetooth device and the mobile phone.
  • the mobile phone scans the LE Audio broadcast sent by the headset (for example, the LE Aduio broadcast can be a low-power Bluetooth broadcast for establishing an LE Audio Bluetooth connection).
  • the LE Audio broadcast can include the access address of the low-power audio Bluetooth mode of the headset, such as the BLE address. Then, the mobile phone establishes an LE Audio connection with the headset based on the LE Audio broadcast. For example, for a dual-mode Bluetooth headset, the Bluetooth headset can also be divided into a master headset and a slave headset based on the connection relationship with the electronic device (such as a mobile phone) in classic Bluetooth. The mobile phone scans the LE Audio broadcast sent by the master headset and the LE Audio broadcast sent by the slave headset, and respectively establishes an LE Audio connection between the mobile phone and the master headset and an LE Audio connection between the mobile phone and the slave headset. For example, there may be no distinction between the master headset and the slave headset in the LE Audio Bluetooth mode.
  • a first Bluetooth connection and a second Bluetooth connection are established between the electronic device and the Bluetooth headset at the same time.
  • Determine the state of the LE Audio switch which can be the switch of the Bluetooth setting interface in Figures 6 and 7 above. If it is detected that the LE Audio switch is in the off state, it is determined that the mobile phone and the Bluetooth headset request to use the classic Bluetooth connection, then the classic Bluetooth connection and the LE Audio connection are maintained, and the classic Bluetooth connection is used to transmit data between the mobile phone and the Bluetooth headset. If it is detected that the LE Audio switch is turned on, it is determined that the mobile phone and the Bluetooth headset request to use the LE Audio connection, then the classic Bluetooth connection and the LE Audio connection are maintained, and the LE Audio connection is used to transmit data between the mobile phone and the Bluetooth headset.
  • a classic Bluetooth connection and an LE Audio connection are simultaneously established between the electronic device and the Bluetooth headset.
  • the electronic device plays audio, that is, when the audio playback state of the electronic device is in the first state, it is necessary to determine which Bluetooth connection is used to transmit audio data between the electronic device and the Bluetooth headset, and then the state of the LE Audio switch can be determined. If the state of the LE Audio switch is off, it is determined that the mobile phone and the Bluetooth headset request to use the classic Bluetooth connection, and then the classic Bluetooth connection can be used to transmit data between the electronic device and the Bluetooth headset.
  • the classic Bluetooth connection is controlled to be in a state of maintaining connection, and an audio transmission channel (for example, a SCO channel) is established on the classic Bluetooth connection.
  • an audio transmission channel for example, a SCO channel
  • the LE Audio connection can be disconnected after the audio data currently to be played by the electronic device is transmitted using the channel. If it is determined that the state of the LE Audio switch is on, it is determined that the mobile phone and the Bluetooth headset request to use the LE Audio connection, then the LE Audio connection is established while controlling the classic Bluetooth connection between the electronic device and the Bluetooth headset to remain connected and using the audio transmission channel on the classic Bluetooth connection to transmit audio data, and then a data transmission channel (for example, a CIS channel) is established on the LE Audio connection.
  • a data transmission channel for example, a CIS channel
  • the classic Bluetooth connection can be disconnected after the channel is used to transmit the audio data currently to be played by the electronic device. Therefore, by comparing Figure 10 with Figure 3, it can be seen that the method provided in the embodiment of the present application can, when the electronic device is currently maintaining a second Bluetooth connection, first establish a first Bluetooth connection and establish a data transmission channel based on the first Bluetooth connection after determining the first Bluetooth connection to be switched, and then disconnect the second Bluetooth connection, which can reduce the negative impact of data transmission interruption.
  • the embodiment of the present application optimizes the solution for switching between LE Audio and BT modes on the mobile phone, and optimizes specific logic for the scenarios of no business playback and business playback on the mobile phone.
  • the mobile phone and the headset always maintain the scenario of BT and LE Audio coexisting, so as to ensure the user's switching experience.
  • the scenario of business playback on the mobile phone by first connecting to the target mode and establishing the audio transmission channel of the mode and then disconnecting the current mode, the situation of switching failure and external audio of the mobile phone is avoided, thereby ensuring the reliability, stability and timeliness of the switching. At the same time, another link is disconnected. If BT is used, LE Audio is disconnected to ensure the use of bandwidth.
  • an anti-shake mechanism judgment is added for switching between business scenarios and no business playback on the mobile phone (that is, if it is detected that the audio playback state is switched from the first state to the second state, and if the electronic device is continuously in the second state within the time period corresponding to the timing operation, the first Bluetooth connection and the second Bluetooth connection are controlled to remain connected), so as to improve the user experience and enhance the competitiveness of the product.
  • FIG. 11 shows a structural block diagram of a Bluetooth communication device provided in an embodiment of the present application.
  • the device may include: an acquisition unit 1101 and a control unit 1102 .
  • the acquisition unit 1101 is used to acquire the audio playing state of the electronic device, where the audio playing state includes a first state and a second state, where the first state is used to indicate that the electronic device is playing audio, and the second state is used to indicate that the electronic device is not playing audio.
  • the control unit 1102 is configured to configure the first Bluetooth connection to be in a state of maintaining connection, and configure the second Bluetooth connection to be in a state of maintaining connection, if the audio playing state is the second state.
  • control unit 1102 is further configured to, in response to a request between the electronic device and the Bluetooth headset to use the first Bluetooth connection, transmit the audio playback state of the electronic device and the Bluetooth headset using the first Bluetooth connection if the audio playback state is switched from the second state to the first state. Data between Bluetooth headsets.
  • control unit 1102 is further configured to respond to a request between the electronic device and the Bluetooth headset to use the first Bluetooth connection, use the first Bluetooth connection to transmit data between the electronic device and the Bluetooth headset, and disconnect the second Bluetooth connection.
  • control unit 1102 is further configured to configure the first Bluetooth connection to be in a state of maintaining connection, and configure the second Bluetooth connection to be in a state of maintaining connection if the audio playback state is switched from the first state to the second state.
  • control unit 1102 is also used to determine the Bluetooth connection that remained connected and the Bluetooth connection that remained disconnected in the first Bluetooth connection and the second Bluetooth connection during the last time the electronic device was in the first state if the audio playback state is switched from a first state to a second state; restore the Bluetooth connection that remained disconnected to a connected state, and continue the Bluetooth connection that remained connected to remain connected.
  • control unit 1102 is also used to start a timing operation if it is detected that the audio playback state is switched from a first state to a second state; if the electronic device is continuously in the second state within a time period corresponding to the timing operation, configure the first Bluetooth connection to remain connected, and configure the second Bluetooth connection to remain connected.
  • one of the first Bluetooth connection and the second Bluetooth connection is a classic Bluetooth connection
  • the other Bluetooth connection is an LE Audio Bluetooth connection.
  • the coupling between modules may be electrical, mechanical or other forms of coupling.
  • each functional module in each embodiment of the present application can be integrated into a processing module, or each module can exist physically separately, or two or more modules can be integrated into one module.
  • the above integrated modules can be implemented in the form of hardware or software functional modules.
  • the electronic device 100 can be an electronic device such as a smart phone, a tablet computer, an e-book, etc. that can run applications.
  • the electronic device 100 in the present application may include one or more of the following components: a processor 110, a memory 120, and one or more applications, wherein one or more applications may be stored in the memory 120 and configured to be executed by one or more processors 110, and one or more programs are configured to execute the method described in the aforementioned method embodiment.
  • the processor 110 may include one or more processing cores.
  • the processor 110 uses various interfaces and lines to connect various parts of the entire electronic device 100, and executes various functions and processes data of the electronic device 100 by running or executing instructions, programs, code sets or instruction sets stored in the memory 120, and calling data stored in the memory 120.
  • the processor 110 can be implemented in at least one hardware form of digital signal processing (DSP), field-programmable gate array (FPGA), and programmable logic array (PLA).
  • DSP digital signal processing
  • FPGA field-programmable gate array
  • PDA programmable logic array
  • the processor 110 can integrate one or a combination of a central processing unit (CPU), a graphics processing unit (GPU), and a modem.
  • the CPU mainly processes the operating system, user interface, and application programs; the GPU is responsible for rendering and drawing display content; and the modem is used to process wireless communications. It is understandable that the above-mentioned modem may not be integrated into the processor 110, but may be implemented separately through a communication chip.
  • the memory 120 may include a random access memory (RAM) or a read-only memory (ROM).
  • the memory 120 may be used to store instructions, programs, codes, code sets or instruction sets.
  • the memory 120 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the following various method embodiments, etc.
  • the data storage area may also store data created by the electronic device 100 during use (such as a phone book, audio and video data, chat record data) etc.
  • FIG. 13 shows a block diagram of a computer-readable storage medium provided in an embodiment of the present application.
  • the computer-readable medium 1300 stores program codes, which can be called by a processor to execute the method described in the above method embodiment.
  • the computer-readable storage medium 1300 may be an electronic memory such as a flash memory, an EEPROM (electrically erasable programmable read-only memory), an EPROM, a hard disk, or a ROM.
  • the computer-readable storage medium 1300 includes a non-transitory computer-readable storage medium.
  • the computer-readable storage medium 1300 has storage space for program code 1310 for executing any method steps in the above method. These program codes may be read from or written to one or more computer program products.
  • the program code 1310 may be compressed, for example, in a suitable form.
  • the electronic device and the Bluetooth headset support establishing a first Bluetooth connection and a second Bluetooth connection of two different Bluetooth communication modes.
  • the audio playback status of the electronic device it is possible to determine whether the electronic device is currently in a state of playing audio or in a state of not playing audio. 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 setting of the connection status of the first Bluetooth connection and the second Bluetooth connection can take into account the influence of the audio playback status, so that the setting of the connection status of the first Bluetooth connection and the second Bluetooth connection can better meet the user's audio playback needs for the electronic device.
  • Optimize specific logic for scenarios with and without business playback on the mobile phone For scenarios with and without business playback, the mobile phone and headset always maintain the coexistence of BT and LE Audio to ensure the user's switching experience. For scenarios with and without business playback on the mobile phone, first connect to the target mode and establish the audio transmission channel of the mode before disconnecting the current mode to avoid switching failures and external playback of the mobile phone audio, thereby ensuring the reliability, stability and timeliness of the switching. At the same time, disconnect another link, such as disconnecting LE Audio when using BT, to ensure bandwidth usage.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Mobile Radio Communication Systems (AREA)
  • Telephone Function (AREA)

Abstract

本申请公开了一种蓝牙通信方法、装置、电子设备及计算机可读介质,涉及音频播放技术领域,方法包括:获取所述电子设备的音频播放状态,所述音频播放状态包括第一状态和第二状态,所述第一状态用于表征所述电子设备正在播放音频,所述第二状态用于表征所述电子设备未在播放音频;若所述音频播放状态为第二状态,配置所述第一蓝牙连接处于保持连接的状态,且配置所述第二蓝牙连接处于保持连接的状态。因此,在电子设备未播放音频的情况下,可以使第一蓝牙连接和第二蓝牙连接均处于保持连接的状态,方便在电子设备进入音频播放状态的时候,能够快速使用第一蓝牙连接或第二蓝牙连接播放音频。

Description

蓝牙通信方法、装置、电子设备及计算机可读介质
相关申请的交叉引用
本申请要求于2022年12月8日提交的申请号为CN 202211575036.3的中国申请的优先权,其在此出于所有目的通过引用将其全部内容并入本文。
技术领域
本申请涉及音频播放技术领域,更具体地,涉及一种蓝牙通信方法、装置、电子设备及计算机可读介质。
背景技术
随着人们生活内容的丰富,用户拥有的电子设备也越来越多,蓝牙通信的技术也跟着快速进步。目前,为了方便用户工作和生活,某个电子设备可以与外部设备蓝牙连接,蓝牙连接的通信模式可能不止一种。
发明内容
本申请提出了一种蓝牙通信方法、装置、电子设备及计算机可读介质,以改善上述缺陷。
第一方面,本申请实施例提供了一种蓝牙通信方法,应用于电子设备和/或蓝牙耳机,所述电子设备和所述蓝牙耳机之间支持建立第一蓝牙连接和第二蓝牙连接,所述方法包括:获取所述电子设备的音频播放状态,所述音频播放状态包括第一状态和第二状态,所述第一状态用于表征所述电子设备正在播放音频,所述第二状态用于表征所述电子设备未在播放音频;若所述音频播放状态为第二状态,配置所述第一蓝牙连接处于保持连接的状态,且配置所述第二蓝牙连接处于保持连接的状态。
第二方面,本申请实施例还提供了一种蓝牙通信装置,应用于电子设备和/或蓝牙耳机,所述电子设备和所述蓝牙耳机之间支持建立第一蓝牙连接和第二蓝牙连接,所述装置包括:获取单元和控制单元。获取单元,用于获取所述电子设备的音频播放状态,所述音频播放状态包括第一状态和第二状态,所述第一状态用于表征所述电子设备正在播放音频,所述第二状态用于表征所述电子设备未在播放音频。控制单元,用于若所述音频播放状态为第二状态,配置所述第一蓝牙连接处于保持连接的状态,且配置所述第二蓝牙连接处于保持连接的状态。
第三方面,本申请实施例还提供了一种电子设备,包括:一个或多个处理器;存储器;一个或多个应用程序,其中所述一个或多个应用程序被存储在所述存储器中并被配置为由所述一个或多个处理器执行,所述一个或多个应用程序配置用于执行上述方法。
第四方面,本申请实施例还提供了一种计算机可读介质,所述可读存储介质存储有处理器可执行的程序代码,所述程序代码被所述处理器执行时使所述处理器执行上述方法。
附图说明
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1示出了本申请实施例提供的电子设备和蓝牙耳机的连接示意图;
图2示出了一种蓝牙模式切换流程的示意图;
图3示出了另一种蓝牙模式切换流程的示意图;
图4示出了本申请一实施例提供的蓝牙通信方法的方法流程图;
图5示出了本申请另一实施例提供的蓝牙通信方法的方法流程图;
图6示出了本申请一实施例提供的蓝牙设置界面的示意图;
图7示出了本申请另一实施例提供的蓝牙设置界面的示意图;
图8示出了本申请又一实施例提供的蓝牙通信方法的方法流程图;
图9示出了本申请一实施例提供的电子设备在未播放音频的情况下的蓝牙切换流程示意图;
图10示出了本申请一实施例提供的电子设备在播放音频的情况下的蓝牙切换流程示意图;
图11示出了本申请一实施例提供的蓝牙通信装置的模块框图;
图12示出了本申请实施例提供的电子设备的结构框图;
图13示出了本申请实施例的用于保存或者携带实现根据本申请实施例的蓝牙通信方法的程序代码的存储单元。
具体实施方式
为了使本技术领域的人员更好地理解本申请方案,下面将结合本申请实施例中附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。通常在此处附图中描述和示出的本申请实施例的组件可以以各种不同的配置来布置和设计。因此,以下对在附图中提供的本申请的实施例的详细描述并非旨在限制要求保护的本申请的范围,而是仅仅表示本申请的选定实施例。基于本申请的实施例,本领域技术人员在没有做出创造性劳动的前提下所获得的所有其他实施例,都属于本申请保护的范围。
应注意到:相似的标号和字母在下面的附图中表示类似项,因此,一旦某一项在一个附图中被定义,则在随后的附图中不需要对其进行进一步定义和解释。同时,在本申请的描述中,术语“第一”、“第二”等仅用于区分描述,而不能理解为指示或暗示相对重要性。
物联网(Internet Of Things,IOT)是在“互联网概念”的基础上,将其用户端延伸和扩展到任何物品与物品之间,进行信息交换和通信的一种网络概念。随着物联网技术的发展,在物联网系统中可以配置一些场景。对于配置的场景,可以涉及到多个智能设备,而且多个智能设备之间具有一定的联动关系,能够协同工作。例如,所配置的场景可以包括,当一个设备靠近另一个设备的时候,两个设备中的至少一个会执行指定操作。或者一个设备在执行某个操作的时候,该操作的一部 分数据自己处理,另一部分数据交由另一个设备处理。
随着人们生活内容的丰富,用户拥有的电子设备也越来越多,蓝牙通信的技术也跟着快速进步。目前,为了方便用户工作和生活,某个电子设备可以与外部设备蓝牙连接,以便用户能够控制该电子设备向所连接的设备发送数据。该电子设备可以是智能手机、平板电脑、电子书、无线音频播放设备、显示器等内部设置有蓝牙模块且能够与其他蓝牙耳机建立蓝牙连接并交互数据的设备,该无线音频播放设备可以包括蓝牙耳机或蓝牙音箱等。
目前,蓝牙协议支持多种蓝牙通信模式,该多种蓝牙通信模式可以包括经典蓝牙模式和低功耗音频蓝牙模式(LE Audio)。其中,经典蓝牙模式包括基础速率(BR)、增强速率(EDR)以及高速(HS)三个模式,基础速率(BR)也称为蓝牙1.0,增强速率(EDR)也可以称为蓝牙2.0,高速(HS)也可以称为蓝牙3.0。低功耗音频蓝牙模式是工作于低功耗蓝牙(BLE)模式下的蓝牙音频传输模式,低功耗音频蓝牙模式将采用全新的低复杂性通信编解码器(Low Complexity Communication Codec,LC3),以提供实现更高的音质和更低的功耗,相较于经典蓝牙音频编码SBC,LC3编码效率和质量都有了较大的提高,这使得LE Audio比经典蓝牙音频技术拥有更大的技术优势。
如图1所示,图1示出了电子设备与无线耳机的连接示意图。该无线耳机被双耳机组,即包括左耳机和右耳机。无线耳机和终端之间可以互相协作播放音频数据,例如,在终端播放视频画面的时候或者在播放音频的时候,终端将音频数据发送至无线耳机,由无线耳机播放。如图1所示,电子设备100分别与第一无线耳机210和第二无线耳机220保持BLE连接,电子设备与第一无线耳机210和第二无线耳机220独立进行数据传输和通信。该电子设备100可以是智能手机、平板电脑、电子书、智能穿戴设备等能够运行应用程序、并且具有音频信号和视频信号播放的功能的设备。第一无线耳机210和第二无线耳机220构成真无线立体声(True Wireless Stereo,TWS)耳机,其中,TWS耳机的左右两只耳机相互独立、无需线缆相连,即可实现左右声道的无线分离。
然而,发明人在研究中发现,由于设备之间的蓝牙通信支持多种蓝牙模式,那么在各种模式之间切换的时候,切换过程往往不够合理。具体地,如图2所示,以手机和无线耳机之间的蓝牙连接为例,说明二者之间在多种蓝牙模式切换的情况下,可能存在上述缺陷。相关技术中,在耳机与手机端建立经典蓝牙连接的情况下,当用户打开手机蓝牙设置界面的LE Audio开关时,手机端会先将当前与耳机连接的经典蓝牙(BT)连接主动断掉,同时发起对耳机的LE Audio连接请求,手机端扫描到耳机双耳发送的LE广播后,完成与耳机之间的LE Audio连接。当用户关闭LE Audio的开关,手机端会先将当前与双耳的LE Audio连接断开,随即开始回连耳机的BT,完成BT的连线,以此实现BT与LE Audio之间动态切换的功能。
然而,针对图3所示的连接方式,由于目前的操作系统默认是在连接新的蓝牙链路之前需要断开已经存在的蓝牙链路,所以,这就存在以下缺点:一种情况,如果手机需要从经典蓝牙连接切换为LE Audio连接(也可以称为LE Audio蓝牙连接),手机会先主动断掉与耳机的经典蓝牙连接。然后,再发起与耳机端的LE Audio的连接,反之亦然。但这种断掉后再去连的机制存在不稳定的风险,如经典蓝牙连接断开后会出现无法成功与耳机之间建立LE Audio连接的情况,或者,断开LE Audio的连接后连接不上经典蓝牙连接的情况,这样会存在因连接不上期望使用的蓝牙通信模式而导致最终耳机与手机处于断开的模式,影响用户的实际体验。另一种情况,若当前手机已使用已经建立连接的蓝牙链路发送数据,假设,手机已经与无线耳机之间建立经典蓝牙连接,并且手机通过无线耳机播放音频数据,如音乐播放,电话等。如果手机需要从经典蓝牙连接切换为LE Audio连接,如图3所示,手机端断开经典蓝牙连接后再去与双耳建立LE Audio连接,随后再建立连接等时流 (Connected Isochronous Steam,CIS)进行LE Audio下的流播放,反之亦然。整个过程不仅耗时较长,蓝牙通信模式的切换会出现长时间无声而且还可能存在因连接不上LE Audio而导致手机外放耳机无声的情况,整个用户体验都较差。
请参阅图4,图4示出了本申请实施例提供的一种蓝牙通信方法,该方法应用于通信系统,所述通信系统包括电子设备和蓝牙耳机,该电子设备可以是前述的智能手机,该蓝牙耳机可以是前述的无线耳机,另外,该方法的执行主体可以是电子设备,也可以是蓝牙耳机,还可以是电子设备和蓝牙耳机交互执行,具体在此不做限定。则该方法可以包括:S401至S402。
S401:获取所述电子设备的音频播放状态。
需要说明的是,电子设备的音频播放状态包括第一状态和第二状态,该第一状态用于表征电子设备正在播放音频,第二状态用于表征所述电子设备未在播放音频。示例性地,该电子设备内可以设置有监测软件,在电子设备执行音频播放业务的情况下,将该电子设备的音频播放状态设置为第一状态,其他情况下,将该电子设备的音频播放状态设置为第二状态。其中,该音频播放业务可以是所有的能够播放音频的业务,也就是说,该电子设备只要在播放音频数据,监测软件就将电子设备的音频播放状态设置为第一状态,否则,就设置为第二状态。
作为另一种实施方式,在电子设备执行预设类型的音频播放业务的情况下,将该电子设备的音频播放状态设置为第一状态,其他情况下,将该电子设备的音频播放状态设置为第二状态。其中,该预设类型的音频播放业务可以是从电子设备所支持的所有音频播放相关的音频播放业务中确定的,该预设类型的音频播放业务具有如下至少一个特点:音频播放时长大于预设时长和由指定业务功能触发。其中,该预设时长可以是基于经验和需求设定的,例如,该预设时长可以是基于电子设备支持播放的所有提示音而设定,例如,可以是所有提示音的播放时长的最大值,该提示音可以是按键提示音和/或短信提示音等播放时长较短的音频。通过设置该预设时长,使得在确定电子设备执行的音频播放业务的播放时长大于预设时长的时候,确定该电子设备的音频播放状态设置为第一状态。需要说明的是,电子设备在执行音频播放业务的时候,确定该音频播放业务的播放时长可以是基于该音频播放业务请求播放的音频文件而设定,如果该音频文件是提示音文件,则确定该音频播放业务的音频播放时长小于或等于预设时长,如果该音频文件不是提示音文件,则确定该音频播放业务的音频播放时长大于预设时长。还可以是,在电子设备执行音频播放业务的时候,确定该音频播放业务的持续播放时长,在该播放时长小于或等于预设时长的时候,确定该电子设备的音频播放状态为第二状态,则确定该持续时长大于预设时长且仍然在执行音频播放业务,则确定该电子设备的音频播放状态为第一状态。另外,预设类型的音频播放业务由指定业务功能触发,该指定业务功能可以触发电子设备执行该指定业务功能对应的音频播放业务,该指定业务功能可以是歌曲播放功能、视频播放功能、游戏运行功能和通话功能等,具体地在此不做限定。
S402:若所述音频播放状态为第二状态,配置所述第一蓝牙连接处于保持连接的状态,且配置所述第二蓝牙连接处于保持连接的状态。
需要说明的是,本申请的一些实施例中,蓝牙连接可以包括基于蓝牙通信协议建立的蓝牙通信链路。在一些实施例中,建立蓝牙连接可以包括建立蓝牙物理链路;在一些实施例中,建立蓝牙连接可以包括建立蓝牙逻辑链路,例如ACL(Asychronous Connection Oriented);在一些实施例中,建立蓝牙连接也可以包括在前述链路的基础上建立音频传输协议或其他的数据传输协议,例如蓝牙音频传输模型协定(Advanced Audio Distribution Profile,A2dp)和免提协议(Hands-free Profile,HFP)等。在一些实施例中,蓝牙连接建立完成不包括建立某些音频传输通道,例如,同步面向连接 链路(Synchronous Connection Oriented,SCO)和CIS等,而是有相关音频业务时或预设条件下才建立SCO或CIS等音频传输通道,也就是说,建立蓝牙连接时不会立马建立音频传输通道,而是等待有业务触发时才建立相应的音频传输通道以进行相关业务的传输。可以理解的,不同的蓝牙通信模式适用的蓝牙协议可能不同,因此对应建立的通信链路和相关传输协议可能会存在差异,可以参考相关蓝牙标准的规定,相关蓝牙连接中一些过程也可以参考相关蓝牙标准的规定,也可以随相关标准的变化发生改变。可以理解的,在一些实施例中,断开蓝牙连接可以与建立蓝牙连接相对应,在一些实施例中,二者中的蓝牙连接也可以有不同的含义。例如,建立蓝牙连接可以是建立ACL等逻辑链路,但是断开蓝牙连接可能是断开逻辑链路和上层通信协议。一般来说,断开底层链路后上层协议也会断开。在一些实施例中,断开蓝牙连接可以理解为断开两个设备之间的所有蓝牙通信链路。在一些实施例中,断开蓝牙连接也可以理解为断开上层协议。在一些实施例中,断开蓝牙连接意味着两个设备之间不能基于蓝牙链路进行点对点的传输。所述第一蓝牙连接和所述第二蓝牙连接对应不同的蓝牙通信模式。示例性地,第一蓝牙连接和第二蓝牙连接其中之一的蓝牙通信模式为经典蓝牙模式,另一个的蓝牙通信模式为低功耗音频蓝牙模式(即前述的LE Audio模式)。例如,第一蓝牙连接对应的蓝牙通信模式为经典蓝牙模式,在一些实施例中,可以理解为第一蓝牙连接为经典蓝牙连接,第二蓝牙连接对应的蓝牙通信模式为低功耗音频蓝牙模式,在一些实施例中,可以理解为第二蓝牙连接为低功耗音频蓝牙连接,还可以是,第一蓝牙连接对应的蓝牙通信模式为低功耗音频蓝牙模式,第二蓝牙连接对应的蓝牙通信模式为经典蓝牙模式。
可以理解的,电子设备和蓝牙耳机可以是支持多模蓝牙的设备,也就是说可以支持不同蓝牙通信模式,例如可以支持经典蓝牙通信,也可以支持LE Audio蓝牙通信,当然还可以是其他蓝牙通信方式。示例的,其中的一条蓝牙连接对应经典蓝牙连接,另一条蓝牙连接对应LE Audio蓝牙连接。
可以理解的,上述连接过程可以发生在电子设备与蓝牙耳机的首次连接中,例如耳机首次开盖后与电子设备的配对连接中,也可以是耳机恢复出厂设置后与手机的配对连接中。首次配对通过建立两条蓝牙连接的过程可以获取到两条蓝牙连接的连接信息,例如蓝牙地址、配对信息等,从而方便后续进行蓝牙连接。
然而,虽然电子设备与蓝牙耳机之间支持同时通过两种不同的蓝牙通信模式建立蓝牙连接,例如,电子设备和蓝牙耳机之间支持同时建立第一蓝牙连接和第二蓝牙连接,但是,同时保持第一蓝牙连接和第二蓝牙连接的情况下,电子设备和蓝牙耳机的功耗可能消耗较大,因此,发明人在研究中发现目前的连接方式往往是在同时建立第一蓝牙连接和第二蓝牙连接之后,往往会断开其中一个蓝牙连接而保持另一个蓝牙连接处于连接状态,但是这样的设置方式往往仅仅从功耗的角度考虑两个蓝牙连接的连接状态,而未从电子设备的实际使用状态来设置两个蓝牙连接的连接状态。
因此,本申请实施例基于音频播放状态,配置所述第一蓝牙连接和所述第二蓝牙连接的连接状态,其中,连接状态包括保持连接和断开连接。因此,本申请实施例提供的方法使得第一蓝牙连接和第二蓝牙连接的连接状态的设置能够考虑到音频播放状态的影响,从而使得该第一蓝牙连接和第二蓝牙连接的连接状态的设置更能够贴合用户对电子设备的音频播放需求。
因此,本申请实施例可以从功耗的角度去考虑电子设备在不同的音频播放状态下,设置第一蓝牙连接和所述第二蓝牙连接的连接状态。示例性地,若所述音频播放状态为第二状态,也就是说,电子设备当前未在播放音频或未在执行预设类型的音频播放业务的情况下,配置所述第一蓝牙连接和所述第二蓝牙连接均处于保持连接的状态,即配置所述第一蓝牙连接处于保持连接的状态,且配置所述第二蓝牙连接处于保持连接的状态。由于电子设备未在播放音频或未在执行预设类型的音频 播放业务的情况下,电子设备和蓝牙耳机之间并没有大的数据交互需求,则可以保持第一蓝牙连接和第二蓝牙连接均处于保持连接的状态,即保持第一蓝牙连接和第二蓝牙连接,从而方便电子设备与蓝牙耳机之间随意使用第一蓝牙连接和第二蓝牙连接传输数据,例如,如前所述,在电子设备执行预设类型的音频播放业务的时候,确定电子设备的音频播放状态为第二状态,则在此情况下,电子设备执行非预设类型的音频播放业务时所播放的音频就可以通过该第一蓝牙连接和第二蓝牙连接中的任意一个蓝牙连接传输,并且,另一个未使用的蓝牙连接依然保持连接。而当电子设备要切换为另一个蓝牙连接传输的时候,由于另一蓝牙连接处于保持连接的状态,则直接使用即可,不需要重新连接。若所述音频播放状态为第一状态,也就是说,电子设备当前在播放音频或在执行预设类型的音频播放业务的情况下,配置所述第一蓝牙连接和所述第二蓝牙连接中的一个蓝牙连接处于保持连接状态,另一个蓝牙连接处于断开连接的状态,从而考虑到电子设备在播放音频的时候,电子设备和蓝牙耳机之间传输的数据量比较大。
当然,除了上述的基于所述音频播放状态配置所述第一蓝牙连接和所述第二蓝牙连接的连接状态之外,还可以是,若所述音频播放状态为第二状态,配置所述第一蓝牙连接和所述第二蓝牙连接中的一个蓝牙连接处于保持连接状态,另一个蓝牙连接处于断开连接的状态;若所述音频播放状态为第一状态,配置所述第一蓝牙连接和所述第二蓝牙连接均处于保持连接的状态,具体的实施方式在此不做限定。
后续实施例将针对音频播放状态为第一状态和第二状态分开描述对第一蓝牙连接和第二蓝牙连接的连接状态的设置。
请参阅图5,图5示出了本申请实施例提供的一种蓝牙通信方法,该方法应用于通信系统,所述通信系统包括电子设备和蓝牙耳机,该电子设备可以是前述的智能手机,该蓝牙耳机可以是前述的无线耳机,另外,该方法的执行主体可以是电子设备,也可以是蓝牙耳机,还可以是电子设备和蓝牙耳机交互执行,具体在此不做限定。则该方法可以包括:S501至S503。
S501:获取所述电子设备的音频播放状态。
S502:若所述音频播放状态为第二状态,配置所述第一蓝牙连接处于保持连接的状态,且配置所述第二蓝牙连接处于保持连接的状态。
其中,S501至S502的操作可以参考前述实施例,在此不再赘述。
S503:若所述音频播放状态由第二状态切换为第一状态,响应于所述电子设备和蓝牙耳机之间请求使用所述第一蓝牙连接,使用所述第一蓝牙连接传输所述电子设备和蓝牙耳机之间的数据。
作为一种实施方式,在电子设备的音频播放状态处于第二状态的情况下,且在设置第一蓝牙连接和第二蓝牙连接均处于保持连接的状态下,继续检测电子设备的音频播放状态,若检测到电子设备的音频播放状态由第二状态切换为第一状态,响应于所述电子设备和蓝牙耳机之间请求使用所述第一蓝牙连接,使用所述第一蓝牙连接传输所述电子设备和蓝牙耳机之间的数据。示例性地,该电子设备或蓝牙耳机可以检测是否接收到指定请求,该指定请求用于表征电子设备和蓝牙耳机之间请求使用第一蓝牙连接。需要说明的是,该第一蓝牙连接是指当前请求使用的蓝牙连接,未请求使用的蓝牙连接为第二蓝牙连接,也就是说,如果第一蓝牙连接为经典蓝牙连接,则表示电子设备和蓝牙耳机之间请求使用经典蓝牙连接,则LE Audio蓝牙连接为第二蓝牙连接,同理,如果电子设备和蓝牙耳机之间请求使用LE Audio蓝牙连接,则第一蓝牙连接为LE Audio蓝牙连接,第二蓝牙连接为经典蓝牙连接。
该指定请求可以是用户基于电子设备输入的,也可以是基于蓝牙耳机输入的,还可以是在处于 预设应用场景之下自动触发生成的,该指定请求可以是基于用户操作或者根据预设应用场景生成的特定指令,其中,该预设应用场景可以是游戏应用场景、视频播放场景或其他预设场景,对此不作限定。于本申请实施例中,以该指定请求为用户输入为例,用户可以基于通过电子设备输入指定请求,也可以是基于蓝牙耳机输入指定请求。在一些实施例中,可以由电子设备来确定指定请求,电子设备可以显示蓝牙设置界面,该蓝牙设置界面可以包括不同的蓝牙通信模式的开关,以便打开或关闭对应的蓝牙通信模式,如图6所示,该蓝牙设置界面可以包括第一蓝牙通信模式对应的第一开关601和第二蓝牙通信模式包括的第二开关602,设置第一开关处于开启状态,从而请求建立该第一蓝牙通信模式对应的蓝牙连接,设置第二开关处于开启状态,从而请求建立所述电子设备与所述蓝牙耳机之间的第二蓝牙通信模式对应的蓝牙连接。另外,也可以是在该蓝牙设置界面内设置一个指定开关701,电子设备与蓝牙耳机之间的默认蓝牙模式为第一蓝牙通信模式,在该指定开关701处于开关状态的时候,电子设备与所述蓝牙耳机之间基于第二蓝牙通信模式建立蓝牙连接,在该指定开关701处于关闭状态的时候,电子设备与所述蓝牙耳机之间基于第一蓝牙通信模式建立蓝牙连接。
在一些实施例中,可以由蓝牙耳机来确定指定请求,则如果该蓝牙耳机具有屏幕,那么蓝牙耳机也可以与电子设备相似,即采用蓝牙设置界面获取指定请求,如果该蓝牙耳机不具有屏幕或者屏幕不满足该蓝牙耳机界面的显示需求,则可以通过其他的方式确定指定请求,该其他的方式可以包括手势检测和语音检测的至少一种。
因此,在检测到指定请求之后,确定该指定请求对应的蓝牙通信模式,将该请求建立的蓝牙通信模式的蓝牙连接作为第一蓝牙连接,则在保持第一蓝牙连接和第二蓝牙连接都连接的情况下,使用第一蓝牙连接传输电子设备和蓝牙耳机之间的数据。
以上述图7的蓝牙设置界面为例,假设第一蓝牙通信模式为LE Audio模式,若检测到该蓝牙设置界面内的第一蓝牙通信模式的开关被打开,则表示该电子设备和蓝牙耳机之间请求使用LE Audio连接,则在保持LE Audio连接和经典蓝牙连接都处于保持连接状态的情况下,使用该LE Audio连接传输电子设备和蓝牙耳机之间的数据。如果检测到该蓝牙设置界面内的第一蓝牙通信模式的开关被关闭,则表示该电子设备和蓝牙耳机之间请求使用经典蓝牙连接,则在保持LE Audio连接和经典蓝牙连接都处于保持连接状态的情况下,使用该经典蓝牙连接传输电子设备和蓝牙耳机之间的数据。可以看出,在电子设备未播放音频的情况下,可以保持电子设备和蓝牙耳机之间的经典蓝牙连接和LE Audio连接,然后,基于该指定开关的状态确定当前需要使用的是经典蓝牙连接还是LE Audio连接,由于LE Audio连接和经典蓝牙连接都处于保持连接状态,所以在切换不同的蓝牙连接的时候,不需要将未使用的蓝牙连接断开,也不需要重新建立某个蓝牙连接的连接。
需要说明的是,在电子设备的音频播放状态为第一状态的时候,此时电子设备和蓝牙耳机之间可能同时保持第一蓝牙连接和第二蓝牙连接,例如,电子设备的音频播放状态由第二状态切换为第一状态,且电子设备还未确定电子设备和蓝牙耳机之间请求使用的蓝牙通信模式,此时,电子设备和蓝牙耳机之间同时保持第一蓝牙连接和第二蓝牙连接,然后,确定检测到电子设备和蓝牙耳机之间请求使用所述第一蓝牙连接,则保持第一蓝牙连接的连接并且将第二蓝牙连接断开。
作为一种实施方式,若所述音频播放状态由第二状态切换为第一状态,响应于所述电子设备和蓝牙耳机之间请求使用所述第一蓝牙连接,使用所述第一蓝牙连接传输所述电子设备和蓝牙耳机之间的数据,且断开所述第二蓝牙连接。此时,在电子设备的音频播放状态为第一状态的时候,电子设备和蓝牙耳机之间已建立第一蓝牙连接,保持第二蓝牙连接处于断开连接的状态,则检测到指定 请求,该指定请求用于表征使用电子设备和蓝牙耳机之间的第二蓝牙连接传输数据,即该指定请求相当于切换请求,即将第一蓝牙连接切换为第二蓝牙连接。则将电子设备和蓝牙耳机之间的第一蓝牙连接断开且建立第二蓝牙连接,从而通过第二蓝牙连接传输数据。示例性地,可以是先将第一蓝牙连接断开再建立第二蓝牙连接,也可以是,先建立第二蓝牙连接,再将第一蓝牙连接断开,也就是说,在建立电子设备与蓝牙耳机之间的第二蓝牙连接的过程中,电子设备与蓝牙耳机之间的第一蓝牙连接保持连接。即在保持所述第一蓝牙连接的情况下,建立所述第二蓝牙连接;在所述第二蓝牙连接成功建立之后,断开所述第一蓝牙连接。
第一蓝牙连接和第二蓝牙连接其中之一的蓝牙通信模式为经典蓝牙模式,另一个的蓝牙通信模式为低功耗音频蓝牙模式。假设第二蓝牙连接对应的蓝牙通信模式为经典蓝牙模式,第一蓝牙连接对应的蓝牙通信模式为低功耗音频蓝牙模式。假设电子设备是手机,且该蓝牙耳机可以是真无线智能(True Wireless Stereo,TWS)耳机。示例的,针对经典蓝牙模式,蓝牙耳机可处于配对状态,在蓝牙耳机处于配对状态的情况下,蓝牙耳机能够被其他设备发现,其他设备在未与蓝牙耳机曾建立蓝牙连接的情况下,或者其他设备未预先获取蓝牙耳机的蓝牙地址的情况下,需要与蓝牙耳机配对,即通过配对的方式,蓝牙耳机与请求连接的设备之间交换通信信息,该通信信息包括通信地址等用于建立连接的数据,所以,对于新设备,只有在蓝牙耳机进入查询扫描(inquiry scan)的情况下,才能够被其他设备扫描到,进而与其他设备配对,进而完成与其他设备的蓝牙连接。
在一些实施例中,TWS耳机中与电子设备建立经典蓝牙连接的耳机为主耳机,可以由主耳机作为本申请中的蓝牙耳机执行本申请一些实施例中的方法。在一些实施例中,也可以将TWS耳机作为一个整体,经典蓝牙连接可以理解由主耳机与电子设备之间建立,LE Audio蓝牙连接可以理解由TWS耳机的两个耳机分别与电子设备建立。在一些实施例中,LE Audio蓝牙连接也可以采用监听的方式,例如主耳机可与电子设备建立经典蓝牙连接和/或LE Audio蓝牙连接,从耳机通过监听的方式建立前述经典蓝牙连接或LE Audio蓝牙连接。
参考上述的图7所示的蓝牙设置界面,假设第一蓝牙连接为LE Audio连接,第二蓝牙连接为经典蓝牙连接。假设电子设备开始播放音频,即电子设备的音频播放状态为第一状态,此时电子设备和蓝牙耳机之间已建立第二蓝牙连接,电子设备播放音频的时候,该蓝牙设置界面内的指定开关的开关状态为关闭状态,即此时电子设备和蓝牙耳机之间已经建立经典蓝牙连接而未建立LE Audio连接,电子设备和蓝牙耳机之间通过经典蓝牙连接传输数据,然后,检测到该蓝牙设置界面内的指定开关的开关状态变更为开启状态,则检测到指定请求,即请求将所述电子设备和蓝牙耳机之间已建立的第二蓝牙连接切换为第一蓝牙连接,则电子设备或蓝牙设备会在保持所述第二蓝牙连接的情况下,建立所述第一蓝牙连接,然后,在所述第一蓝牙连接成功建立之后,断开所述第二蓝牙连接。
本申请实施例中,在电子设备的音频播放状态为第一状态的情况下,能够在所述电子设备与所述蓝牙设备之间已建立第二蓝牙连接的情况下,建立所述电子设备与所述蓝牙设备之间的第一蓝牙连接,在所述第一蓝牙连接成功建立之后,再将所述第二蓝牙连接断开,也就是说,可以在建立第一蓝牙连接的过程中,保持第二蓝牙连接,能够降低第二蓝牙连接切换至第一蓝牙连接时的卡顿,也能够避免同时保持第一蓝牙连接和第二蓝牙连接的情况下,功耗过大且带宽占用过大。需要说明的是,在第一蓝牙连接和第二蓝牙连接的基础上可以建立数据传输通道,电子设备与蓝牙设备之间可以通过该数据传输通道传输数据,该数据传输通道可以参考后续实施例的说明。则针对电子设备与蓝牙设备之间是否在通过第二蓝牙连接传输数据的情况下,需要考虑该数据在蓝牙连接切换的时候是否会造成卡顿,而合理的选择第一蓝牙连接的断开时机。示例性地,如果在所述第二蓝牙连接 的情况下,电子设备和蓝牙设备之间未通过该第二蓝牙连接传输数据,则可以在第一蓝牙连接成功建立且在已建立的所述第一蓝牙连接上建立数据传输通道的情况下,将第一蓝牙连接断开,也就是说,在所述第一蓝牙连接成功建立,且在已建立的所述第一蓝牙连接上建立数据传输通道的情况下,将第二蓝牙连接断开。如此,不仅能够提前将第一蓝牙连接的数据传输通道建立,以便在后续使用第一蓝牙连接传输数据的时候,不必再建立该数据传输通道而可以直接使用已建立的数据传输通道。而且,电子设备当前在播放音频,所以,电子设备与蓝牙设备之间选择第一蓝牙连接的目的是为了传输待播放的音频数据,则虽然电子设备和蓝牙设备之间未使用第二蓝牙连接传输数据,则当第一蓝牙连接建立完成的时候,可以认为电子设备和蓝牙设备之间的有较高的概率会使用第一蓝牙连接传输数据,则可以提前将该数据传输通道建立,并且在该数据传输通道建立完成后将第二蓝牙连接断开,由此,就完成第二蓝牙连接切换至第一蓝牙连接的操作。
作为另一种实施方式,如果在所述第二蓝牙连接的情况下,电子设备和蓝牙设备之间未通过该第二蓝牙连接传输数据,也就是说,在切换至第一蓝牙连接的时候,可以不担心会导致第一蓝牙接连传输的数据卡顿,那么,可以在所述第一蓝牙连接成功建立之后,所述第一蓝牙连接上未建立数据传输通道之前,将第二蓝牙连接断开。即,在所述第二蓝牙连接未传输预设数据的情况下,在所述第一蓝牙连接成功建立之后将所述第二蓝牙连接断开的实施方式为,在所述第一蓝牙连接成功建立之后,所述第一蓝牙连接上未建立数据传输通道之前,将第二蓝牙连接断开。也就是说,在确定第一蓝牙连接不必接替第二蓝牙连接继续传输数据的情况下,那么也可以不必等到确定在第一蓝牙连接上成功建立数据传输通道的情况下,再将第二蓝牙连接断开。
而如果在所述第二蓝牙连接的情况下,电子设备和蓝牙设备之间通过该第二蓝牙连接传输数据,则为了避免输出传输的中断或卡顿,可以在所述第一蓝牙连接成功建立之后,在确定所述第一蓝牙连接的音频传输通道建立的情况下,断开所述第二蓝牙连接。
具体地,在所述第一蓝牙连接成功建立之后,在确定所述第一蓝牙连接的音频传输通道建立的情况下,断开所述第二蓝牙连接的实施方式为:
若所述音频播放状态为第一状态,在所述电子设备与所述蓝牙设备之间已建立第二蓝牙连接且使用第二蓝牙连接传输预设数据的情况下,检测到指定请求,继续使用第二蓝牙连接传输所述预设数据,建立所述电子设备与所述蓝牙设备之间的第一蓝牙连接。在第一蓝牙连接成功建立,且在已建立的第一蓝牙连接上建立数据传输通道的情况下,将第二蓝牙连接断开,然后,使用电子设备和蓝牙耳机之间使用第一蓝牙连接上的数据传输通道继续传输预设数据,当然也可以传输其他的数据,在此不做限定。因此,能够在电子设备和蓝牙耳机之间通过第二蓝牙连接传输音频数据,以实现电子设备通过蓝牙耳机播放音频的情况下,在确定用户需要使用第一蓝牙连接,即确定电子设备和蓝牙耳机之间请求将第二蓝牙连接切换为第一蓝牙连接的情况下,可以在等到第一蓝牙连接的数据传输通道建立完毕之后,再将第二蓝牙连接断开,从而可以保证在第一蓝牙连接的数据传输通道的建立过程中,电子设备和蓝牙耳机之间还能够继续使用第二蓝牙连接传输数据,并且在断开第二蓝牙连接的时候,已经可以确保第一蓝牙连接的数据传输通道已经建立完成,减少切换造成的卡顿和耗时。需要说明的是,该数据传输通道可以是前述的SCO或CIS,例如,如果第一蓝牙连接为经典蓝牙连接,则在第一蓝牙连接上建立的数据传输通道为SCO,如果第一蓝牙连接为LE Audio连接,则在第一蓝牙连接上建立的数据传输通道为CIS。
请参阅图8,图8示出了本申请实施例提供的一种蓝牙通信方法,该方法应用于通信系统,所述通信系统包括电子设备和蓝牙耳机,该电子设备可以是前述的智能手机,该蓝牙耳机可以是前述 的无线耳机,另外,该方法的执行主体可以是电子设备,也可以是蓝牙耳机,还可以是电子设备和蓝牙耳机交互执行,具体在此不做限定。则该方法可以包括:S801至S806。
S801:获取所述电子设备的音频播放状态。
S802:判断音频播放状态为第一状态还是第二状态。
若所述音频播放状态是第二状态,则执行S803,若所述音频播放状态是第一状态,则执行S805。
S803:配置所述第一蓝牙连接处于保持连接的状态,且配置所述第二蓝牙连接处于保持连接的状态。
S804:若所述音频播放状态由第二状态切换为第一状态,响应于所述电子设备和蓝牙耳机之间请求使用所述第一蓝牙连接,使用所述第一蓝牙连接传输所述电子设备和蓝牙耳机之间的数据。
S805:响应于所述电子设备和蓝牙耳机之间请求使用所述第一蓝牙连接,控制所述第一蓝牙连接处于保持连接的状态及所述第二蓝牙连接处于断开连接的状态。
S806:若所述音频播放状态由第一状态切换为第二状态,确定所述电子设备最近一次在第一状态的期间,在所述第一蓝牙连接和第二蓝牙连接中保持连接状态的蓝牙连接以及保持断开状态的蓝牙连接。
S807:将所述保持断开状态的蓝牙连接恢复连接状态,且将保持连接状态的蓝牙连接继续处于保持连接的状态。
在电子设备的音频播放状态为第一状态的情况下,响应指定请求将电子设备和蓝牙耳机之间的蓝牙连接由第二蓝牙连接切换为第一蓝牙连接,然后,继续检测电子设备的音频播放状态,如果检测到电子设备的音频播放状态由当前的第一状态切换为第二状态,例如,电子设备的音频播放业务结束,则电子设备的音频播放状态变为第二状态,则可以设置第一蓝牙连接和所述第二蓝牙连接均处于保持连接的状态。示例性地,在电子设备的音频播放状态为第一状态的情况下,第一蓝牙连接和第二蓝牙连接中的一个蓝牙连接保持连接状态,另一个蓝牙连接处于断开状态,则在音频播放状态由第一状态切换为第二状态之后,确定电子设备最近一次在第一状态的期间,在所述第一蓝牙连接和第二蓝牙连接中保持连接状态的蓝牙连接以及保持断开状态的蓝牙连接,也就是说,在确定电子设备最近一次在播放音频的时候,保持连接的蓝牙连接以及保持断开的蓝牙连接,然后,将所述保持断开状态的蓝牙连接恢复连接状态,且将保持连接状态的蓝牙连接继续处于保持连接的状态。例如,最近一次处于第一状态的情况下,第一蓝牙连接保持连接状态,第二蓝牙连接保持断开状态,则在电子设备且切换到第二状态之后,需要配置所述第一蓝牙连接处于保持连接的状态,且配置所述第二蓝牙连接处于保持连接的状态,则实施方式可以是,将第二蓝牙连接恢复连接,将第一蓝牙连接继续保持连接。
需要说明的是,前述的S801可以是本次在电子设备满足检测条件下,首次检测到的音频播放状态,其中,检测条件可以是前述的电子设备与蓝牙耳机的首次连接之后,还可以是耳机恢复出厂设置后与手机的配对连接中,还可以是,电子设备检测到用户输入的预设请求,该预设请求用于指示电子设备执行本申请所提及的基于电子设备的音频播放状态设置第一蓝牙连接和第二蓝牙连接的连接状态的方法。则电子设备在检测到电子设备满足检测条件下,开始执行检测电子设备的音频播放状态的操作,进而能够确定电子设备的音频播放状态是第一状态还是第二状态,从而执行两个不同的分支。
另外,在检测到一次音频播放状态并基于该音频播放状态设置了第一蓝牙连接和第二蓝牙连接 的连接状态之后,还可以继续检测电子设备的音频播放状态,从而在音频播放状态发生改变的情况下,能够及时调整第一蓝牙连接和第二蓝牙连接的连接状态。所以,前述的配置所述第一蓝牙连接处于保持连接的状态,且配置所述第二蓝牙连接处于保持连接的状态,可以是在首次检测到音频播放状态是第二状态的情况下执行的,也可以是在检测到音频播放状态从第一状态切换为第二状态的情况下执行的。同理,前述的响应于所述电子设备和蓝牙耳机之间请求使用所述第一蓝牙连接,使用所述第一蓝牙连接传输所述电子设备和蓝牙耳机之间的数据,断开所述第二蓝牙连接,可以是在首次检测到音频播放状态是第一状态的情况下执行的,也可以是在检测到音频播放状态从第二状态切换为第一状态的情况下执行的,在此不做限定。
作为一种实施方式,为了避免电子设备的音频播放状态由当前的第一状态切换为第二状态的情况下,电子设备处于第二状态的时间较短,例如,电子设备在播放歌曲的时候,两首歌曲的播放间隔期间,电子设备未播放音频,但是,该间隔的时间往往较短,如果此时将第一蓝牙连接和所述第二蓝牙连接均连接,则在较短的时长之后,电子设备的音频播放状态又变为第一状态,再次控制所述第一蓝牙连接和所述第二蓝牙连接中的一个蓝牙连接处于保持连接状态,另一个蓝牙连接处于断开连接的状态,则会导致某个蓝牙连接被频繁的连接和断开。因此,若检测到所述音频播放状态由第一状态切换为第二状态,开启定时操作,若在定时操作对应的时间段内,所述电子设备持续处于第二状态,控制所述第一蓝牙连接和所述第二蓝牙连接均处于保持连接的状态。其中,定时操作对应的时间段可以基于实际需求而设定,例如,可以是5秒。
如图9所示,此时,电子设备通过蓝牙耳机播放音频,即电子设备的音频播放状态处于第二状态,假设电子设备为手机,蓝牙耳机为TWS耳机,手机在为播放音频文件的情况下,与蓝牙耳机建立连接,在本次首次建立手机和蓝牙耳机的蓝牙连接的情况下,会同时建立第一蓝牙连接和第二蓝牙连接,可以理解的,上述连接过程可以发生在电子设备与蓝牙耳机的首次连接中,例如耳机首次开盖后与电子设备的配对连接中,也可以是耳机恢复出厂设置后与手机的配对连接中。首次配对通过建立两条蓝牙连接的过程可以获取到两条蓝牙连接的连接信息,例如蓝牙地址、配对信息等,从而方便后续进行蓝牙连接。如图9所示,在蓝牙耳机进入配对状态的情况下,蓝牙耳机在配对状态下可以处于page scan状态,在一些实施例中,配对状态也可以是page scan和inquiry scan都开启的情况,手机发送page包,蓝牙耳机扫描到手机发送的page请求以进行蓝牙设备和手机之间的经典蓝牙连接。手机扫描耳机发送的LE Audio广播(示例的,LE Aduio广播可以是用于建立LE Audio蓝牙连接的低功耗蓝牙广播),该LE Audio广播内可以包括耳机的低功耗音频蓝牙模式的接入地址,如BLE地址,然后,手机基于该LE Audio广播与耳机建立LE Audio连接,示例的,对于双模蓝牙耳机,该蓝牙耳机还可以基于经典蓝牙中与电子设备(例如手机)的连接关系等分为主耳机和从耳机,手机分别扫描得到主耳机发送的LE Audio广播以及从耳机发送的LE Audio广播,并分别建立手机与主耳机之间的LE Audio连接以及手机与从耳机之间的LE Audio连接,示例的,在LE Audio蓝牙模式下可以没有主耳机和从耳机的区分。因此,电子设备和蓝牙耳机之间同时建立第一蓝牙连接和第二蓝牙连接。确定LE Audio开关的状态,该LE Audio开关可以是前述的图6和图7中的蓝牙设置界面的开关,如果检测到该LE Audio开关处于关闭状态,则确定手机和蓝牙耳机之间请求使用经典蓝牙连接,则保持经典蓝牙连接和LE Audio连接,并且使用经典蓝牙连接在手机和蓝牙耳机之间传输数据。如果检测到该LE Audio开关处于打开状态,则确定手机和蓝牙耳机之间请求使用LE Audio连接,则保持经典蓝牙连接和LE Audio连接,并且使用LE Audio连接在手机和蓝牙耳机之间传输数据。可以看出,即使在LE Audio开关的状态切换的情况下,由于 在电子设备处于无音频播放的情况下,始终保持经典蓝牙连接和LE Audio同时连接,所以,只是对使用的蓝牙连接做了切换,而不需要将某个蓝牙连接断开或重新连接
如图10所示,与图9相似,在电子设备与蓝牙耳机首次连接的情况下,电子设备和蓝牙耳机之间同时建立经典蓝牙连接和LE Audio连接。当电子设备播放音频的时候,即电子设备的音频播放状态为第一状态的情况下,需要确定电子设备和蓝牙耳机之间通过哪种蓝牙连接传输音频数据,则可以确定LE Audio开关的状态,如果LE Audio开关的状态为关闭状态,则确定手机和蓝牙耳机之间请求使用经典蓝牙连接,那么,可以使用经典蓝牙连接在电子设备和蓝牙耳机之间传输数据,例如,控制经典蓝牙连接处于保持连接的状态,在经典蓝牙连接上建立音频传输通道(例如,SCO通道),在该通道建立完成之后,可以是在使用该通道传输电子设备当前待播放的音频数据之后,将LE Audio连接断开。如果确定LE Audio开关的状态为打开状态,则确定手机和蓝牙耳机之间请求使用LE Audio连接,则在控制电子设备和蓝牙耳机之间的经典蓝牙连接保持连接的情况下以及使用该经典蓝牙连接上的音频传输通道传输音频数据的情况下,建立该LE Audio连接,然后,在该LE Audio连接上建立数据传输通道(例如,CIS通道),在该通道建立完成之后,可以是在使用该通道传输电子设备当前待播放的音频数据之后,将经典蓝牙连接断开。因此,将图10和图3对比,可以看出,本申请实施例提供的方法,能够在电子设备当前在保持第二蓝牙连接的情况下,在确定要切换的第一蓝牙连接之后,先建立第一蓝牙连接并且在第一蓝牙连接的基础上建立数据传输通道之后,在将第二蓝牙连接断开,能够降低数据传输的中断带来的负面影响。
继续参与图10,当检测到音频播放结束的时候,即电子设备的音频播放状态由第一状态切换为第二状态的情况下,确定在5秒内,电子设备是否处于未播放音频,即持续处于第二状态,如果是,则恢复经典蓝牙连接,即此时电子设备和蓝牙耳机之间同时保持经典蓝牙连接和LE Audio连接。
因此,本申请实施例针对手机切换LE Audio与BT模式的方案做了优化,针对手机端无业务播放以及有业务播放的场景进行特定逻辑的优化。针对无业务播放场景,手机和耳机端始终保持BT和LE Audio共存的场景,以此保证用户的切换体验。针对手机端有业务播放的场景,通过先连上目标模式且建立该模式的音频传输通道后再断掉当前模式的方式,避免出现切换失败而出现手机音频外放的情况,保证切换的可靠性和稳定性,时效性。同时断掉另外一条链路,如使用BT则断掉LE Audio,保证带宽的使用。另外增加一个手机端有业务场景和无业务播放切换的防抖机制判断(即若检测到所述音频播放状态由第一状态切换为第二状态,且若在定时操作对应的时间段内,所述电子设备持续处于第二状态,控制所述第一蓝牙连接和所述第二蓝牙连接均处于保持连接的状态),以此提升用户体验,增强产品竞争力。
请参阅图11,其示出了本申请实施例提供的一种蓝牙通信装置的结构框图,该装置可以包括:获取单元1101和控制单元1102。
获取单元1101,用于获取所述电子设备的音频播放状态,所述音频播放状态包括第一状态和第二状态,所述第一状态用于表征所述电子设备正在播放音频,所述第二状态用于表征所述电子设备未在播放音频。
控制单元1102,用于若所述音频播放状态为第二状态,配置所述第一蓝牙连接处于保持连接的状态,且配置所述第二蓝牙连接处于保持连接的状态。
进一步的,控制单元1102还用于若所述音频播放状态由第二状态切换为第一状态,响应于所述电子设备和蓝牙耳机之间请求使用所述第一蓝牙连接,使用所述第一蓝牙连接传输所述电子设备和 蓝牙耳机之间的数据。
进一步的,控制单元1102还用于响应于所述电子设备和蓝牙耳机之间请求使用所述第一蓝牙连接,使用所述第一蓝牙连接传输所述电子设备和蓝牙耳机之间的数据,断开所述第二蓝牙连接。
进一步的,控制单元1102还用于若所述音频播放状态由第一状态切换为第二状态,配置所述第一蓝牙连接处于保持连接的状态,且配置所述第二蓝牙连接处于保持连接的状态。
进一步的,控制单元1102还用于若所述音频播放状态由第一状态切换为第二状态,确定所述电子设备最近一次在所述第一状态的期间,在所述第一蓝牙连接和第二蓝牙连接中保持连接状态的蓝牙连接以及保持断开状态的蓝牙连接;将所述保持断开状态的蓝牙连接恢复连接状态,且将保持连接状态的蓝牙连接继续处于保持连接的状态。
进一步的,控制单元1102还用于若检测到所述音频播放状态由第一状态切换为第二状态,开启定时操作;若在定时操作对应的时间段内,所述电子设备持续处于第二状态,配置所述第一蓝牙连接处于保持连接的状态,且配置所述第二蓝牙连接处于保持连接的状态。
进一步的,所述第一蓝牙连接和所述第二蓝牙连接中的一个蓝牙连接为经典蓝牙连接,另一个蓝牙连接为LE Audio蓝牙连接。
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述装置和模块的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。
在本申请所提供的几个实施例中,模块相互之间的耦合可以是电性,机械或其它形式的耦合。
另外,在本申请各个实施例中的各功能模块可以集成在一个处理模块中,也可以是各个模块单独物理存在,也可以两个或两个以上模块集成在一个模块中。上述集成的模块既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。
请参考图12,其示出了本申请实施例提供的一种电子设备的结构框图。该电子设备100可以是智能手机、平板电脑、电子书等能够运行应用程序的电子设备。本申请中的电子设备100可以包括一个或多个如下部件:处理器110、存储器120、以及一个或多个应用程序,其中一个或多个应用程序可以被存储在存储器120中并被配置为由一个或多个处理器110执行,一个或多个程序配置用于执行如前述方法实施例所描述的方法。
处理器110可以包括一个或者多个处理核。处理器110利用各种接口和线路连接整个电子设备100内的各个部分,通过运行或执行存储在存储器120内的指令、程序、代码集或指令集,以及调用存储在存储器120内的数据,执行电子设备100的各种功能和处理数据。可选地,处理器110可以采用数字信号处理(Digital Signal Processing,DSP)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)、可编程逻辑阵列(Programmable Logic Array,PLA)中的至少一种硬件形式来实现。处理器110可集成中央处理器(Central Processing Unit,CPU)、图像处理器(Graphics Processing Unit,GPU)和调制解调器等中的一种或几种的组合。其中,CPU主要处理操作系统、用户界面和应用程序等;GPU用于负责显示内容的渲染和绘制;调制解调器用于处理无线通信。可以理解的是,上述调制解调器也可以不集成到处理器110中,单独通过一块通信芯片进行实现。
存储器120可以包括随机存储器(Random Access Memory,RAM),也可以包括只读存储器(Read-Only Memory)。存储器120可用于存储指令、程序、代码、代码集或指令集。存储器120可包括存储程序区和存储数据区,其中,存储程序区可存储用于实现操作系统的指令、用于实现至少一个功能的指令(比如触控功能、声音播放功能、图像播放功能等)、用于实现下述各个方法实施例的指令等。存储数据区还可以存储电子设备100在使用中所创建的数据(比如电话本、音视频数据、 聊天记录数据)等。
请参考图13,其示出了本申请实施例提供的一种计算机可读存储介质的结构框图。该计算机可读介质1300中存储有程序代码,所述程序代码可被处理器调用执行上述方法实施例中所描述的方法。
计算机可读存储介质1300可以是诸如闪存、EEPROM(电可擦除可编程只读存储器)、EPROM、硬盘或者ROM之类的电子存储器。可选地,计算机可读存储介质1300包括非易失性计算机可读介质(non-transitory computer-readable storage medium)。计算机可读存储介质1300具有执行上述方法中的任何方法步骤的程序代码1310的存储空间。这些程序代码可以从一个或者多个计算机程序产品中读出或者写入到这一个或者多个计算机程序产品中。程序代码1310可以例如以适当形式进行压缩。
综上所述,电子设备和所述蓝牙耳机之间支持建立两种不同的蓝牙通信模式的第一蓝牙连接和第二蓝牙连接,通过获取电子设备的音频播放状态,能够确定电子设备当前是处于正在播放音频的状态还是处于未在播放音频的状态,然后,基于该电子设备的音频播放状态,控制所述第一蓝牙连接和所述第二蓝牙连接的连接状态。因此,使得第一蓝牙连接和第二蓝牙连接的连接状态的设置能够考虑到音频播放状态的影响,从而使得该第一蓝牙连接和第二蓝牙连接的连接状态的设置更能够贴合用户对电子设备的音频播放需求。
针对手机端无业务播放以及有业务播放的场景进行特定逻辑的优化。针对无业务播放场景,手机和耳机端始终保持BT和LE Audio共存的场景,以此保证用户的切换体验。针对手机端有业务播放的场景,通过先连上目标模式且建立该模式的音频传输通道后再断掉当前模式的方式,避免出现切换失败而出现手机音频外放的情况,保证切换的可靠性和稳定性,时效性。同时断掉另外一条链路,如使用BT则断掉LE Audio,保证带宽的使用。另外增加一个手机端有业务场景和无业务播放切换的防抖机制判断(即若检测到所述音频播放状态由第一状态切换为第二状态,且若在定时操作对应的时间段内,所述电子设备持续处于第二状态,控制所述第一蓝牙连接和所述第二蓝牙连接均处于保持连接的状态),以此提升用户体验,增强产品竞争力。
最后应说明的是:以上实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不驱使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围。

Claims (20)

  1. 一种蓝牙通信方法,其特征在于,应用于电子设备和/或蓝牙耳机,所述电子设备和所述蓝牙耳机之间支持建立第一蓝牙连接和第二蓝牙连接,所述方法包括:
    获取所述电子设备的音频播放状态,所述音频播放状态包括第一状态和第二状态,所述第一状态用于表征所述电子设备正在播放音频,所述第二状态用于表征所述电子设备未在播放音频;
    若所述音频播放状态为第二状态,配置所述第一蓝牙连接处于保持连接的状态,且配置所述第二蓝牙连接处于保持连接的状态。
  2. 根据权利要求1所述的方法,其特征在于,还包括:
    若所述音频播放状态由第二状态切换为第一状态,响应于所述电子设备和蓝牙耳机之间请求使用所述第一蓝牙连接,使用所述第一蓝牙连接传输所述电子设备和蓝牙耳机之间的数据。
  3. 根据权利要求2所述的方法,其特征在于,所述响应于所述电子设备和蓝牙耳机之间请求使用所述第一蓝牙连接,使用所述第一蓝牙连接传输所述电子设备和蓝牙耳机之间的数据,包括:
    响应于所述电子设备和蓝牙耳机之间请求使用所述第一蓝牙连接,使用所述第一蓝牙连接传输所述电子设备和蓝牙耳机之间的数据,断开所述第二蓝牙连接。
  4. 根据权利要求3所述的方法,其特征在于,响应于所述电子设备和蓝牙耳机之间请求使用所述第一蓝牙连接,使用所述第一蓝牙连接传输所述电子设备和蓝牙耳机之间的数据,断开所述第二蓝牙连接之后,还包括:
    在电子设备的音频播放状态为第一状态的情况下,使用所述第一蓝牙连接传输所述电子设备和蓝牙耳机之间的数据,且保持第二蓝牙连接处于断开连接的状态;
    若检测到切换请求,建立所述第二蓝牙连接;
    使用所述第二蓝牙连接传输所述电子设备和蓝牙耳机之间的数据。
  5. 根据权利要求4所述的方法,其特征在于,所述若检测到切换请求,建立所述第二蓝牙连接,包括:
    若检测到切换请求,断开所述第一蓝牙连接之后,建立所述第二蓝牙连接。
  6. 根据权利要求4所述的方法,其特征在于,所述若检测到切换请求,建立所述第二蓝牙连接,包括:
    若检测到切换请求,在保持所述第一蓝牙连接处于连接状态的情况下,建立所述第二蓝牙连接;
    在成功建立所述第二蓝牙连接之后,将所述第一蓝牙连接断开。
  7. 根据权利要求2所述的方法,其特征在于,所述若所述音频播放状态由第二状态切换为第一状态,响应于所述电子设备和蓝牙耳机之间请求使用所述第一蓝牙连接,使用所述第一蓝牙连接传输所述电子设备和蓝牙耳机之间的数据,包括:
    若所述音频播放状态由第二状态切换为第一状态,在保持第一蓝牙连接和第二蓝牙连接都连接的情况下,使用第一蓝牙连接传输电子设备和蓝牙耳机之间的数据。
  8. 根据权利要求1所述的方法,其特征在于,所述若所述音频播放状态为第二状态,配置所述第一蓝牙连接处于保持连接的状态,且配置所述第二蓝牙连接处于保持连接的状态,包括:
    若所述音频播放状态由第一状态切换为第二状态,配置所述第一蓝牙连接处于保持连接的状态,且配置所述第二蓝牙连接处于保持连接的状态。
  9. 根据权利要求8所述的方法,其特征在于,所述若所述音频播放状态由第一状态切换为第二状态,配置所述第一蓝牙连接处于保持连接的状态,且配置所述第二蓝牙连接处于保持连接的状态, 包括:
    若所述音频播放状态由第一状态切换为第二状态,确定所述电子设备最近一次在所述第一状态的期间,在所述第一蓝牙连接和第二蓝牙连接中保持连接状态的蓝牙连接以及保持断开状态的蓝牙连接;
    将所述保持断开状态的蓝牙连接恢复连接状态,且将保持连接状态的蓝牙连接继续处于保持连接的状态。
  10. 根据权利要求8所述的方法,其特征在于,所述若所述音频播放状态由第一状态切换为第二状态,配置所述第一蓝牙连接处于保持连接的状态,且配置所述第二蓝牙连接处于保持连接的状态,包括:
    若检测到所述音频播放状态由第一状态切换为第二状态,开启定时操作;
    若在定时操作对应的时间段内,所述电子设备持续处于第二状态,配置所述第一蓝牙连接处于保持连接的状态,且配置所述第二蓝牙连接处于保持连接的状态。
  11. 根据权利要求1-10任一项所述的方法,其特征在于,获取所述电子设备的音频播放状态,包括:
    若检测到电子设备执行预设类型的音频播放业务,将电子设备的音频播放状态设置为第一状态;
    若未检测到电子设备执行预设类型的音频播放业务,将电子设备的音频播放状态设置为第二状态。
  12. 根据权利要求11所述的方法,其特征在于,所述预设类型的音频播放业务为音频播放时长大于预设时长和/或由指定业务功能触发。
  13. 根据权利要求12所述的方法,其特征在于,预设类型的音频播放业务的音频播放时长大于预设时长,其中,所述预设时长为预先基于电子设备支持播放的提示音而设定的。
  14. 根据权利要求13所述的方法,其特征在于,所述预设时长为电子设备支持播放的所有提示音的播放时长的最大值。
  15. 根据权利要求11所述的方法,其特征在于,若未检测到电子设备执行预设类型的音频播放业务,将电子设备的音频播放状态设置为第二状态,包括:
    若检测到电子设备执行非预设类型的音频播放业务,将电子设备的音频播放状态设置为第二状态。
  16. 根据权利要求15所述的方法,其特征在于,所述若所述音频播放状态为第二状态,配置所述第一蓝牙连接处于保持连接的状态,且配置所述第二蓝牙连接处于保持连接的状态,包括:
    若所述音频播放状态为第二状态,配置所述第一蓝牙连接处于保持连接的状态,且配置所述第二蓝牙连接处于保持连接的状态;
    通过所述第一蓝牙连接和第二蓝牙连接中的任意一个蓝牙连接,传输所述非预设类型的音频播放业务对应的音频数据。
  17. 根据权利要求1-16任一项所述的方法,其特征在于,所述第一蓝牙连接和所述第二蓝牙连接中的一个蓝牙连接为经典蓝牙连接,另一个蓝牙连接为LE Audio蓝牙连接。
  18. 一种蓝牙通信装置,其特征在于,应用于电子设备和/或蓝牙耳机,所述电子设备和所述蓝牙耳机之间支持建立两种不同的蓝牙通信模式的第一蓝牙连接和第二蓝牙连接,所述装置包括:
    获取单元,用于获取所述电子设备的音频播放状态,所述音频播放状态包括第一状态和第二状态,所述第一状态用于表征所述电子设备正在播放音频,所述第二状态用于表征所述电子设备未在 播放音频;
    控制单元,用于若所述音频播放状态为第二状态,配置所述第一蓝牙连接处于保持连接的状态,且配置所述第二蓝牙连接处于保持连接的状态。
  19. 一种电子设备,其特征在于,包括:
    一个或多个处理器;
    存储器;
    一个或多个应用程序,其中所述一个或多个应用程序被存储在所述存储器中并被配置为由所述一个或多个处理器执行,所述一个或多个应用程序配置用于执行如权利要求1-17任一项所述的方法。
  20. 一种计算机可读介质,其特征在于,所述计算机可读介质存储有处理器可执行的程序代码,所述程序代码被所述处理器执行时使所述处理器执行权利要求1-17任一项所述方法。
PCT/CN2023/118872 2022-12-08 2023-09-14 蓝牙通信方法、装置、电子设备及计算机可读介质 WO2024119947A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202211575036.3 2022-12-08
CN202211575036.3A CN116321084A (zh) 2022-12-08 2022-12-08 蓝牙通信方法、装置、电子设备及计算机可读介质

Publications (1)

Publication Number Publication Date
WO2024119947A1 true WO2024119947A1 (zh) 2024-06-13

Family

ID=86829328

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/118872 WO2024119947A1 (zh) 2022-12-08 2023-09-14 蓝牙通信方法、装置、电子设备及计算机可读介质

Country Status (2)

Country Link
CN (1) CN116321084A (zh)
WO (1) WO2024119947A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116321084A (zh) * 2022-12-08 2023-06-23 Oppo广东移动通信有限公司 蓝牙通信方法、装置、电子设备及计算机可读介质

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180103499A1 (en) * 2016-10-06 2018-04-12 Htc Corporation Control method for bluetooth communication and bluetooth low energy communication
US20190306905A1 (en) * 2018-03-30 2019-10-03 Shenzhen Grandsun Electronic Co., Ltd. Bluetooth connection method, device and smart terminal
CN110572803A (zh) * 2019-07-25 2019-12-13 华为技术有限公司 蓝牙切换方法及蓝牙设备
CN112925501A (zh) * 2021-01-26 2021-06-08 努比亚技术有限公司 音频播放控制方法、装置、系统及计算机可读存储介质
CN114816313A (zh) * 2021-01-29 2022-07-29 北京轩辕联科技有限公司 基于车载蓝牙耳机的音频播放方法、装置及电子设备
CN115022773A (zh) * 2022-07-04 2022-09-06 深圳创维-Rgb电子有限公司 蓝牙设备音频控制方法、装置、设备及存储介质
CN116321084A (zh) * 2022-12-08 2023-06-23 Oppo广东移动通信有限公司 蓝牙通信方法、装置、电子设备及计算机可读介质

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180103499A1 (en) * 2016-10-06 2018-04-12 Htc Corporation Control method for bluetooth communication and bluetooth low energy communication
US20190306905A1 (en) * 2018-03-30 2019-10-03 Shenzhen Grandsun Electronic Co., Ltd. Bluetooth connection method, device and smart terminal
CN110572803A (zh) * 2019-07-25 2019-12-13 华为技术有限公司 蓝牙切换方法及蓝牙设备
CN112925501A (zh) * 2021-01-26 2021-06-08 努比亚技术有限公司 音频播放控制方法、装置、系统及计算机可读存储介质
CN114816313A (zh) * 2021-01-29 2022-07-29 北京轩辕联科技有限公司 基于车载蓝牙耳机的音频播放方法、装置及电子设备
CN115022773A (zh) * 2022-07-04 2022-09-06 深圳创维-Rgb电子有限公司 蓝牙设备音频控制方法、装置、设备及存储介质
CN116321084A (zh) * 2022-12-08 2023-06-23 Oppo广东移动通信有限公司 蓝牙通信方法、装置、电子设备及计算机可读介质

Also Published As

Publication number Publication date
CN116321084A (zh) 2023-06-23

Similar Documents

Publication Publication Date Title
WO2018032455A1 (zh) 一种蓝牙通信的方法及终端
WO2020063761A1 (en) Data transmitting method and system
WO2020132839A1 (zh) 应用于tws耳机单双耳切换的音频数据传输方法及设备
WO2023087793A1 (zh) 音频业务处理方法、装置、电子设备及存储介质
CN113766477A (zh) 设备连接方法、装置、电子设备及计算机可读介质
WO2024119947A1 (zh) 蓝牙通信方法、装置、电子设备及计算机可读介质
WO2020063069A1 (zh) 音频播放方法、装置、电子设备及计算机可读介质
EP4104459A1 (en) Switching between multiple earbud architectures
WO2020151003A1 (zh) 一种建立蓝牙数据通道的方法及装置
WO2021239032A1 (zh) 蓝牙协议连接方法、装置、存储介质及相关设备
WO2022228569A1 (zh) 蓝牙设备控制传输的方法和装置、电子设备
WO2023061127A1 (zh) 通信方法、装置、耳机组及计算机可读介质
CN115314865A (zh) 音频处理方法、装置、电子设备及计算机可读介质
CN110602683B (zh) 蓝牙控制方法、装置、移动终端及存储介质
CN113840269B (zh) 一种多媒体数据传输方法、装置、电子设备和存储介质
WO2024060777A1 (zh) 蓝牙切换方法、装置、蓝牙设备及计算机可读介质
WO2024055738A1 (zh) 音频数据的共享方法、装置、电子设备以及存储介质
CN115175149A (zh) 设备添加方法、装置、蓝牙芯片及设备
WO2023045784A1 (zh) 通话控制方法、装置、电子设备及计算机可读存储介质
WO2022252928A1 (zh) 投屏方法、装置、无线终端、投屏设备及存储介质
WO2024060750A1 (zh) 蓝牙切换方法和装置、蓝牙连接方法和装置及电子设备
CN114885261A (zh) 耳机组件、无线音频播放系统及其通信方法
CN114363876A (zh) 连接建立方法、装置、设备、存储介质及程序产品
WO2024087219A1 (zh) 音频数据的传输方法、装置、芯片、设备及存储介质
WO2024066648A1 (zh) 设备的控制方法、装置、蓝牙耳机以及存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 23899530

Country of ref document: EP

Kind code of ref document: A1