CN116321084A - Bluetooth communication method, bluetooth communication device, electronic equipment and computer readable medium - Google Patents

Bluetooth communication method, bluetooth communication device, electronic equipment and computer readable medium Download PDF

Info

Publication number
CN116321084A
CN116321084A CN202211575036.3A CN202211575036A CN116321084A CN 116321084 A CN116321084 A CN 116321084A CN 202211575036 A CN202211575036 A CN 202211575036A CN 116321084 A CN116321084 A CN 116321084A
Authority
CN
China
Prior art keywords
state
bluetooth
connection
bluetooth connection
audio
Prior art date
Legal status (The legal status 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 status listed.)
Pending
Application number
CN202211575036.3A
Other languages
Chinese (zh)
Inventor
侯锐填
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Oppo Mobile Telecommunications Corp Ltd
Original Assignee
Guangdong Oppo Mobile Telecommunications Corp Ltd
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 Guangdong Oppo Mobile Telecommunications Corp Ltd filed Critical Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority to CN202211575036.3A priority Critical patent/CN116321084A/en
Publication of CN116321084A publication Critical patent/CN116321084A/en
Pending legal-status Critical Current

Links

Images

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

Abstract

The application discloses a Bluetooth communication method, a Bluetooth communication device, electronic equipment and a computer readable medium, and relates to the technical field of audio playing, wherein the method comprises the following steps: acquiring an audio playing state of the electronic equipment, wherein the audio playing state comprises a first state and a second state, the first state is used for representing that the electronic equipment is playing audio, and the second state is used for representing that the electronic equipment is not playing audio; and if the audio playing state is the second state, configuring the first Bluetooth connection to be in a connection maintaining state, and configuring the second Bluetooth connection to be in a connection maintaining state. Therefore, under the condition that the electronic equipment does not play audio, the first Bluetooth connection and the second Bluetooth connection can be in a connection-keeping state, so that the audio can be conveniently played by using the first Bluetooth connection or the second Bluetooth connection quickly when the electronic equipment enters an audio playing state.

Description

Bluetooth communication method, bluetooth communication device, electronic equipment and computer readable medium
Technical Field
The present disclosure relates to the field of audio playback technologies, and in particular, to a bluetooth communication method, apparatus, electronic device, and computer readable medium.
Background
With the abundance of living contents, electronic devices owned by users are increasing, and the technology of bluetooth communication is rapidly advancing. Currently, in order to facilitate the work and life of a user, a certain electronic device may be connected to an external device through bluetooth, and a communication mode of the bluetooth connection may be more than one.
Disclosure of Invention
The application provides a Bluetooth communication method, a Bluetooth communication device, an electronic device and a computer readable medium, so as to overcome the defects.
In a first aspect, an embodiment of the present application provides a bluetooth communication method, applied to an electronic device and/or a bluetooth headset, where a first bluetooth connection and a second bluetooth connection are supported between the electronic device and the bluetooth headset, and the method includes: acquiring an audio playing state of the electronic equipment, wherein the audio playing state comprises a first state and a second state, the first state is used for representing that the electronic equipment is playing audio, and the second state is used for representing that the electronic equipment is not playing audio; and if the audio playing state is the second state, configuring the first Bluetooth connection to be in a connection maintaining state, and configuring the second Bluetooth connection to be in a connection maintaining state.
In a second aspect, an embodiment of the present application further provides a bluetooth communication device, applied to an electronic device and/or a bluetooth headset, where a first bluetooth connection and a second bluetooth connection are supported between the electronic device and the bluetooth headset, where the device includes: an acquisition unit and a control unit. The electronic equipment comprises an acquisition unit, a display unit and a display unit, wherein the acquisition unit is used for acquiring an audio playing state of the electronic equipment, the audio playing state comprises a first state and a second state, the first state is used for representing that the electronic equipment is playing audio, and the second state is used for representing that the electronic equipment is not playing audio. And the control unit is used for configuring the first Bluetooth connection to be in a connection maintaining state and configuring the second Bluetooth connection to be in a connection maintaining state if the audio playing state is the second state.
In a third aspect, an embodiment of the present application further provides an electronic device, including: 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, the one or more applications configured to perform the above-described method.
In a fourth aspect, embodiments of the present application also provide a computer readable storage medium storing program code executable by a processor, the program code when executed by the processor causing the processor to perform the above method.
According to the Bluetooth communication method, the Bluetooth communication device, the Bluetooth communication electronic equipment and the Bluetooth communication computer readable medium, the first Bluetooth connection and the second Bluetooth connection are supported to be established between the electronic equipment and the Bluetooth earphone, whether the electronic equipment is in a state of playing audio or not can be determined by acquiring the audio playing state of the electronic equipment, and then if the electronic equipment is in the state of not playing audio, the first Bluetooth connection is configured to be in a connection maintaining state, and the second Bluetooth connection is configured to be in a connection maintaining state. Therefore, under the condition that the electronic equipment does not play audio, the first Bluetooth connection and the second Bluetooth connection can be in a connection-keeping state, so that the audio can be conveniently played by using the first Bluetooth connection or the second Bluetooth connection quickly when the electronic equipment enters an audio playing state.
Additional features and advantages of embodiments of the application will be set forth in the description which follows, and in part will be apparent from the description, or may be learned by practice of embodiments of the application. The objectives and other advantages of the embodiments of the application will be realized and attained by the structure particularly pointed out in the written description and claims hereof as well as the appended drawings.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the description of the embodiments will be briefly introduced below, it being obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 shows a connection schematic diagram of an electronic device and a bluetooth headset provided in an embodiment of the present application;
fig. 2 shows a schematic diagram of a bluetooth mode switching procedure;
fig. 3 shows a schematic diagram of another bluetooth mode switching procedure;
fig. 4 is a flowchart of a method of bluetooth communication according to an embodiment of the present application;
fig. 5 shows a method flowchart of a bluetooth communication method according to another embodiment of the present application;
fig. 6 is a schematic diagram of a bluetooth setting interface according to an embodiment of the present application;
fig. 7 is a schematic diagram of a bluetooth setup interface according to another embodiment of the present application;
fig. 8 is a flowchart of a method of bluetooth communication according to yet another embodiment of the present application;
fig. 9 is a schematic diagram of a bluetooth switching flow of an electronic device provided in an embodiment of the present application in a case where audio is not played;
Fig. 10 is a schematic diagram of a bluetooth switching flow of an electronic device in a case of playing audio according to an embodiment of the present application;
fig. 11 shows a block diagram of a bluetooth communication device according to an embodiment of the present application;
fig. 12 shows a block diagram of an electronic device according to an embodiment of the present application;
fig. 13 shows a storage unit for storing or carrying program codes for implementing the bluetooth communication method according to the embodiment of the application.
Detailed Description
In order to better understand the embodiments of the present application, the following description will clearly and completely describe the embodiments of the present application with reference to the accompanying drawings in the embodiments of the present application, and it is apparent that the described embodiments are only some embodiments of the present application, not all embodiments. The components of the embodiments of the present application, which are generally described and illustrated in the figures herein, may be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present application, as provided in the accompanying drawings, is not intended to limit the scope of the application, as claimed, but is merely representative of selected embodiments of the application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present application without making any inventive effort, are intended to be within the scope of the present application.
It should be noted that: like reference numerals and letters denote like items in the following figures, and thus once an item is defined in one figure, no further definition or explanation thereof is necessary in the following figures. Meanwhile, in the description of the present application, the terms "first", "second", and the like are used only to distinguish the description, and are not to be construed as indicating or implying relative importance.
The internet of things (I nternet Of Th ings, IOT) is a network concept that extends and extends its clients to any items and between items for information exchange and communication based on the "internet concept". With the development of the internet of things technology, some scenes can be configured in the internet of things system. For the configuration scene, a plurality of intelligent devices can be involved, and a certain linkage relation exists among the plurality of intelligent devices, so that the intelligent devices can work cooperatively. For example, the configured scenario may include that when one device approaches the other device, at least one of the two devices will perform a specified operation. Or when one device performs an operation, a part of data of the operation is processed by itself, and another part of data is processed by another device.
With the abundance of living contents, electronic devices owned by users are increasing, and the technology of bluetooth communication is rapidly advancing. Currently, in order to facilitate the user's work and life, a certain electronic device may be connected with an external device bluetooth so that the user can control the electronic device to transmit data to the connected device. The electronic device can be a device which is internally provided with a Bluetooth module and can establish Bluetooth connection with other Bluetooth headphones and interact data, such as a smart phone, a tablet personal computer, an electronic book, a wireless audio playing device, a display and the like, and the wireless audio playing device can comprise the Bluetooth headphones or a Bluetooth sound box and the like.
Currently, the bluetooth protocol supports a variety of bluetooth communication modes, which may include a classical bluetooth mode and a low energy audio bluetooth mode (LE Aud io). The classical bluetooth mode includes three modes, namely a Base Rate (BR), which is also called bluetooth 1.0, an enhancement rate (EDR), which is also called bluetooth 2.0, and a High Speed (HS), which is also called bluetooth 3.0. The bluetooth low energy audio mode is a bluetooth audio transmission mode operating in a Bluetooth Low Energy (BLE) mode, which employs a novel low complexity communication codec (Low Comp lexity Commun icat ion Codec, LC 3) to provide a higher sound quality and lower power consumption, which results in a greater improvement in LC3 coding efficiency and quality than the classical bluetooth audio coding SBC, which results in a greater technical advantage for LE Aud io than the classical bluetooth audio technology.
As shown in fig. 1, fig. 1 shows a schematic diagram of a connection between an electronic device and a wireless headset. The wireless earphone is composed of a binaural unit, namely a left earphone and a right earphone. The wireless earphone and the terminal can cooperatively play the audio data, for example, when the terminal plays the video picture or when playing the audio, the terminal sends the audio data to the wireless earphone and plays the audio data by the wireless earphone. As shown in fig. 1, the electronic device 100 maintains BLE connection with the first wireless headset 210 and the second wireless headset 220, respectively, and the electronic device performs data transmission and communication with the first wireless headset 210 and the second wireless headset 220 independently. The electronic device 100 may be a smart phone, a tablet computer, an electronic book, a smart wearable device, etc. capable of running an application program and having a function of playing an audio signal and a video signal. The first wireless earphone 210 and the second wireless earphone 220 form a true wireless stereo (True Wi re less Stereo, TWS) earphone, wherein the left earphone and the right earphone of the TWS earphone are independent from each other and can realize wireless separation of left and right channels without cable connection.
However, the inventors have found in research that since bluetooth communication between devices supports multiple bluetooth modes, the switching process tends to be inadequate when switching between the various modes. Specifically, as shown in fig. 2, taking a bluetooth connection between a mobile phone and a wireless headset as an example, the above-mentioned drawbacks may exist in the case of switching between the two in a plurality of bluetooth modes. In the related art, when a user opens an LE Aud io switch of a mobile phone bluetooth setting interface under the condition that a classical bluetooth connection is established between an earphone and a mobile phone terminal, the mobile phone terminal actively disconnects the classical Bluetooth (BT) connection currently connected with the earphone, initiates an LE Aud io connection request for the earphone, and completes the LE Aud io connection with the earphone after the mobile phone terminal scans LE broadcasting sent by the earphone and the mobile phone terminal scans LE broadcasting sent by the earphone and the mobile phone terminal. When the user turns off the switch of the LE Aud io, the mobile phone end firstly disconnects the current connection with the LE Aud io of the two ears, then starts to connect back to the BT of the earphone, and completes the connection of the BT, thereby realizing the function of dynamic switching between the BT and the LE Aud io.
However, for the connection shown in fig. 3, since the existing operating system needs to disconnect the existing bluetooth link before connecting the new bluetooth link by default, there are the following disadvantages: in one case, if the handset needs to switch from the classical bluetooth connection to the LE Aud io connection (also called LE Aud io bluetooth connection), the handset will first break the classical bluetooth connection with the headset. Then, a connection with the LE Aud io of the earphone end is re-initiated, and vice versa. However, the mechanism of disconnecting after disconnection has an unstable risk, such as a situation that the LE Aud io connection cannot be successfully established with the earphone after the classical bluetooth connection is disconnected, or a situation that the LE Aud io connection is not connected with the classical bluetooth connection after the connection is disconnected, so that a final mode that the earphone is disconnected with the mobile phone due to a bluetooth communication mode which is not expected to be used in connection exists, and the actual experience of a user is affected. In another case, if the current handset has sent data using a bluetooth link that has already been established, it is assumed that a classical bluetooth connection has been established between the handset and the wireless headset, and the handset plays audio data, such as music playing, telephony, etc., through the wireless headset. If the mobile phone needs to switch from the classical bluetooth connection to the LE Aud io connection, as shown in fig. 3, the mobile phone end disconnects the classical bluetooth connection and then establishes the LE Aud io connection with both ears, and then establishes a connection isochronous stream (Connected I sochronous Steam, CIS) to play the stream under the LE Aud io, and vice versa. The whole process is long in time consumption, long-time silence can occur in the switching of the Bluetooth communication mode, the situation that the earphone is soundless when the mobile phone is externally placed due to the fact that the LE Aud io is not connected can also exist, and the whole user experience is poor.
Referring to fig. 4, fig. 4 shows a bluetooth communication method provided in an embodiment of the present application, where the method is applied to a communication system, and the communication system includes an electronic device and a bluetooth headset, where the electronic device may be the foregoing smart phone, and the bluetooth headset may be the foregoing wireless headset. The method may include: s401 to S402.
S401: and acquiring the audio playing state of the electronic equipment.
It should be noted that the audio playing state of the electronic device 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. For example, the monitoring software may be disposed in the electronic device, where the audio playing state of the electronic device is set to a first state in the case where the electronic device executes the audio playing service, and where the audio playing state of the electronic device is set to a second state in the other case. The audio playing service may be all services capable of playing audio, that is, the monitoring software sets the audio playing state of the electronic device to the first state as long as the electronic device is playing audio data, and otherwise, sets the audio playing state to the second state.
As another embodiment, in the case where the electronic device performs the preset type of audio playing service, the audio playing state of the electronic device is set to the first state, and in other cases, the audio playing state of the electronic device is set to the second state. The preset type of audio playing service may be determined from all audio playing services related to audio playing supported by the electronic device, where the preset type of audio playing service has at least one of the following characteristics: the audio playing time is longer than the preset time and is triggered by the specified service function. The preset duration may be set based on experience and requirements, for example, the preset duration may be set based on all alert tones supported by the electronic device to play, for example, the preset duration may be a maximum value of play durations of all alert tones, and the alert tones may be audio with shorter play durations, such as key alert tones and/or short message alert tones. And setting the preset time length to ensure that the audio playing state of the electronic equipment is set to be a first state when the playing time length of the audio playing service executed by the electronic equipment is longer than the preset time length. It should be noted that, when the electronic device executes the audio playing service, the playing duration of the audio playing service may be determined based on the audio file requested to be played by the audio playing service, if the audio file is a prompt tone file, the audio playing duration of the audio playing service is determined to be less than or equal to the preset duration, and if the audio file is not the prompt tone file, the audio playing duration of the audio playing service is determined to be greater than the preset duration. When the audio playing service is executed by the electronic device, the duration playing time of the audio playing service is determined, when the playing time is less than or equal to the preset time, the audio playing state of the electronic device is determined to be the second state, if the duration time is determined to be longer than the preset time and the audio playing service is still executed, the audio playing state of the electronic device is determined to be the first state. In addition, the preset type of audio playing service is triggered by a specific service function, where the specific service function may trigger the electronic device to execute the audio playing service corresponding to the specific service function, and the specific service function may be a song playing function, a video playing function, a game running function, a call function, and the like, and is not limited herein specifically.
S402: and if the audio playing state is the second state, configuring the first Bluetooth connection to be in a connection maintaining state, and configuring the second Bluetooth connection to be in a connection maintaining state.
It should be noted that in some embodiments of the present application, the bluetooth connection may include a bluetooth communication link established based on a bluetooth communication protocol. In some embodiments, establishing a bluetooth connection may include establishing a bluetooth physical link; in some embodiments, establishing a bluetooth connection may include establishing a bluetooth logical link, e.g., ACL (Asychronous Connect ion Or iented); in some embodiments, establishing the Bluetooth connection may also include establishing an audio transport protocol or other data transport protocol based on the aforementioned links, such as Bluetooth Audio transport model protocol (Advanced Aud io Di str ibut ion Profi le, A2 dp) and Hands Free Protocol (HFP), among others. In some embodiments, the bluetooth connection establishment does not include establishing some audio transmission channels, for example, synchronous connection-oriented links (Synchronous Connect ion Or iented, SCO) and CIS, but establishes audio transmission channels such as SCO or CIS only when related audio services are available or under preset conditions, that is, the bluetooth connection is established without establishing an audio transmission channel immediately, but rather, establishes a corresponding audio transmission channel when service triggers are waiting for the transmission of related services. It will be appreciated that the bluetooth protocols for which different bluetooth communication modes are applicable may be different, and thus the corresponding established communication links and associated transmission protocols may differ, and may refer to the specifications of the associated bluetooth standard, and that some processes in the associated bluetooth connection may refer to the specifications of the associated bluetooth standard, and may change with changes in the associated standard. It will be appreciated that in some embodiments, disconnecting a bluetooth connection may correspond to establishing a bluetooth connection, and in some embodiments, the bluetooth connection in the two may also have different meanings. For example, establishing a bluetooth connection may be establishing a logical link such as an ACL, but disconnecting a bluetooth connection may be disconnecting a logical link and an upper layer communication protocol. In general, the upper layer protocol will be disconnected after the lower layer link is disconnected. In some embodiments, disconnecting a bluetooth connection may be understood as disconnecting all bluetooth communication links between two devices. In some embodiments, disconnecting a bluetooth connection may also be understood as disconnecting an upper layer protocol. In some embodiments, disconnecting the bluetooth connection means that no point-to-point transmission between two devices is possible based on the bluetooth link. The first bluetooth connection and the second bluetooth connection correspond to different bluetooth communication modes. Illustratively, one of the first bluetooth connection and the second bluetooth connection has a bluetooth communication mode that is a classical bluetooth mode, and the other bluetooth communication mode has a low energy audio bluetooth mode (i.e., the LE audio io mode described above). For example, the bluetooth communication mode corresponding to the first bluetooth connection is a classical bluetooth mode, in some embodiments, it may be understood that the first bluetooth connection is a classical bluetooth connection, the bluetooth communication mode corresponding to the second bluetooth connection is a low energy audio bluetooth mode, in some embodiments, it may be understood that the second bluetooth connection is a low energy audio bluetooth connection, and it may also be that the bluetooth communication mode corresponding to the first bluetooth connection is a low energy audio bluetooth mode, and the bluetooth communication mode corresponding to the second bluetooth connection is a classical bluetooth mode.
It will be appreciated that the electronic device and the bluetooth headset may be devices supporting multimode bluetooth, that is, may support different bluetooth communication modes, for example, may support classical bluetooth communication, may support LE audio io bluetooth communication, and may of course also support other bluetooth communication modes. For example, one of the bluetooth connections corresponds to a classical bluetooth connection and the other bluetooth connection corresponds to an LE Aud io bluetooth connection.
It can be appreciated that the above connection process may occur in the first connection between the electronic device and the bluetooth headset, for example, in the pairing connection between the headset and the electronic device after the headset is first opened, or in the pairing connection between the headset and the mobile phone after the headset is restored to the factory setting. The first pairing can acquire connection information of two Bluetooth connections, such as Bluetooth addresses, pairing information and the like, through the process of establishing the two Bluetooth connections, thereby facilitating subsequent Bluetooth connection.
However, although the bluetooth connection is supported between the electronic device and the bluetooth headset by two different bluetooth communication modes at the same time, for example, the first bluetooth connection and the second bluetooth connection are supported between the electronic device and the bluetooth headset at the same time, in the case of simultaneously maintaining the first bluetooth connection and the second bluetooth connection, power consumption of the electronic device and the bluetooth headset may be large, and thus, the inventor found that the current connection mode tends to be that after the first bluetooth connection and the second bluetooth connection are simultaneously established, one of the bluetooth connections tends to be disconnected and the other bluetooth connection is maintained in a connection state, but such a setting mode tends to consider only the connection state of the two bluetooth connections from the viewpoint of power consumption, and does not set the connection state of the two bluetooth connections from the actual use state of the electronic device.
Therefore, the embodiment of the application configures the connection state of the first bluetooth connection and the second bluetooth connection based on the audio playing state, wherein the connection state comprises a keep connection and a disconnect connection. Therefore, the method provided by the embodiment of the application enables the setting of the connection states of the first Bluetooth connection and the second Bluetooth connection to take the influence of the audio playing state into consideration, so that the setting of the connection states of the first Bluetooth connection and the second Bluetooth connection can be more fit with the audio playing requirement of the user on the electronic equipment.
Therefore, the embodiment of the application can consider that the electronic device sets the connection states of the first Bluetooth connection and the second Bluetooth connection in different audio playing states from the viewpoint of power consumption. For example, if the audio playing state is the second state, that is, the electronic device is not playing audio or is not executing the audio playing service of the preset type, the first bluetooth connection and the second bluetooth connection are configured to be in a connection-maintaining state, that is, the first bluetooth connection is configured to be in a connection-maintaining state, and the second bluetooth connection is configured to be in a connection-maintaining state. Since the electronic device is not playing audio or is not executing the audio playing service of the preset type, the electronic device and the bluetooth headset have no large data interaction requirement, the first bluetooth connection and the second bluetooth connection can be kept in a connection-keeping state, that is, the first bluetooth connection and the second bluetooth connection are notified to be 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, when the electronic device executes the audio playing service of the preset type, the audio playing state of the electronic device is determined to be the second state, and in this case, the audio played by the electronic device when executing the audio playing service of the non-preset type can be transmitted through one bluetooth connection of the first bluetooth connection and the second bluetooth connection, and the other unused bluetooth connection can still be kept connected. When the electronic equipment is to be switched to another Bluetooth connection for transmission, the electronic equipment is directly used as the other Bluetooth connection is in a connection maintaining state, and the reconnection is not needed. If the audio playing state is the first state, that is, the electronic device is currently playing audio or executing a preset type of audio playing service, one of the first bluetooth connection and the second bluetooth connection is configured to be in a connection state, and the other bluetooth connection is configured to be in a disconnection state, so that the amount of data transmitted between the electronic device and the bluetooth headset is considered to be relatively large when the electronic device plays audio.
Of course, in addition to the above configuration of the connection states of the first bluetooth connection and the second bluetooth connection based on the audio playing state, if the audio playing state is the second state, one bluetooth connection of the first bluetooth connection and the second bluetooth connection may be configured to be in a connection maintaining state, and the other bluetooth connection may be configured to be in a disconnection state; if the audio playing state is the first state, the first bluetooth connection and the second bluetooth connection are configured to be in a connection maintaining state, and specific embodiments are not limited herein.
The subsequent embodiments will separately describe the setting of the connection states of the first bluetooth connection and the second bluetooth connection for the audio playback state as the first state and the second state.
Referring to fig. 5, fig. 5 shows a bluetooth communication method provided in an embodiment of the present application, where the method is applied to a communication system, and the communication system includes an electronic device and a bluetooth headset, where the electronic device may be the foregoing smart phone, and the bluetooth headset may be the foregoing wireless headset. The method may include: s501 to S503.
S501: and acquiring the audio playing state of the electronic equipment.
S502: and if the audio playing state is the second state, configuring the first Bluetooth connection to be in a connection maintaining state, and configuring the second Bluetooth connection to be in a connection maintaining state.
The operations of S501 to S502 may refer to the foregoing embodiments, and are not described herein.
S503: and if the audio playing state is switched from the second state to the first state, responding to the request between the electronic equipment and the Bluetooth headset to use the first Bluetooth connection, and transmitting data between the electronic equipment and the Bluetooth headset by using the first Bluetooth connection.
In one embodiment, when the audio playing state of the electronic device is in the second state and the first bluetooth connection and the second bluetooth connection are both set in the connection maintaining state, the audio playing state of the electronic device is continuously detected, if the audio playing state of the electronic device is detected to be switched from the second state to the first state, the first bluetooth connection is used to transmit data between the electronic device and the bluetooth headset in response to a request between the electronic device and the bluetooth headset to use the first bluetooth connection. For example, the electronic device or the bluetooth headset may detect whether a designation request is received, the designation request being used to characterize a request between the electronic device and the bluetooth headset to use the first bluetooth connection. It should be noted that, the first bluetooth connection refers to a bluetooth connection that is currently requested to be used, and the bluetooth connection that is not requested to be used is a second bluetooth connection, that is, if the first bluetooth connection is a classical bluetooth connection, it means that the electronic device and the bluetooth headset request to use the classical bluetooth connection, the LE Aud io bluetooth connection is a second bluetooth connection, and similarly, if the electronic device and the bluetooth headset request to use the LE Aud io bluetooth connection, the first bluetooth connection is the LE Aud io bluetooth connection, and the second bluetooth connection is the classical bluetooth connection.
The specified request can be input by a user based on electronic equipment, can be input based on a Bluetooth headset, can be automatically triggered and generated under a preset application scene, and can be based on user operation or a specific instruction generated according to the preset application scene, wherein the preset application scene can be a game application scene, a video playing scene or other preset scenes, and the specified request is not limited. In the embodiment of the present application, taking the designating request as an example of user input, the user may input the designating request through the electronic device, or may input the designating request based on the bluetooth headset. In some embodiments, the designation request may be determined by the electronic device, and the electronic device may display a bluetooth setup interface, where the bluetooth setup interface may include switches of different bluetooth communication modes so as to turn on or off the corresponding bluetooth communication modes, and as shown in fig. 6, the bluetooth setup interface may include a first switch 601 corresponding to the first bluetooth communication mode and a second switch 602 included in the second bluetooth communication mode, where the first switch is set to be in an on state so as to request establishment of a bluetooth connection corresponding to the first bluetooth communication mode, and the second switch is set to be in an on state so as to request establishment of a bluetooth connection corresponding to the second bluetooth communication mode between the electronic device and the bluetooth headset. In addition, a specific switch 701 may be set in the bluetooth setting interface, a default bluetooth mode between the electronic device and the bluetooth headset is a first bluetooth communication mode, when the specific switch 701 is in a switch state, bluetooth connection is established between the electronic device and the bluetooth headset based on a second bluetooth communication mode, and when the specific switch 701 is in a switch-off state, bluetooth connection is established between the electronic device and the bluetooth headset based on the first bluetooth communication mode.
In some embodiments, the designation request may be determined by a bluetooth headset, which may also be similar to the electronic device if the bluetooth headset has a screen, i.e., the designation request is obtained using a bluetooth setup interface, and may be determined by other means, which may include at least one of gesture detection and voice detection, if the bluetooth headset does not have a screen or the screen does not meet the display requirements of the bluetooth headset interface.
Therefore, after the specified request is detected, 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, so that the data between the electronic device and the Bluetooth headset is transmitted by using the first Bluetooth connection under the condition that the first Bluetooth connection and the second Bluetooth connection are both connected.
Taking the bluetooth setting interface of fig. 7 as an example, assuming that the first bluetooth communication mode is the LE Aud io mode, if it is detected that the switch of the first bluetooth communication mode in the bluetooth setting interface is turned on, it indicates that the use of the LE Aud io connection is requested between the electronic device and the bluetooth headset, and if the LE Aud io connection and the classical bluetooth connection are both maintained in a connection state, the LE Aud io connection is used to transmit data between the electronic device and the bluetooth headset. If the switch of the first Bluetooth communication mode in the Bluetooth setting interface is detected to be closed, the request of using the classical Bluetooth connection between the electronic equipment and the Bluetooth earphone is indicated, and the data between the electronic equipment and the Bluetooth earphone is transmitted by using the classical Bluetooth connection under the condition that the LE Aud io connection and the classical Bluetooth connection are kept in a connection state. It can be seen that in the case where the electronic device is not playing audio, the classical bluetooth connection and the LE Aud io connection between the electronic device and the bluetooth headset can be maintained, and then, based on the state of the designated switch, whether the classical bluetooth connection or the LE Aud io connection is currently required to be used is determined.
It should be noted that, when the audio playing state of the electronic device is the first state, at this time, the first bluetooth connection and the second bluetooth connection may be simultaneously maintained between the electronic device and the bluetooth headset, for example, the audio playing 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 between the electronic device and the bluetooth headset, which is requested to be used, at this time, the first bluetooth connection and the second bluetooth connection are simultaneously maintained between the electronic device and the bluetooth headset, and then, it is determined that the request to use the first bluetooth connection between the electronic device and the bluetooth headset is detected, the connection of the first bluetooth connection is maintained and the second bluetooth connection is disconnected.
Of course, when the audio playing state of the electronic device is the first state, and at this time, the second bluetooth connection is established between the electronic device and the bluetooth headset and the second bluetooth connection is in a disconnected state, a designation request is detected, where the designation request is used to characterize that the second bluetooth connection established between the electronic device and the bluetooth headset is switched to the first bluetooth connection, that is, the designation request corresponds to a switching request. The second bluetooth connection between the electronic device and the bluetooth headset is disconnected and the first bluetooth connection is established. The first bluetooth connection may be established first after the second bluetooth connection is disconnected, or the first bluetooth connection may be established first after the second bluetooth connection is disconnected, that is, the second bluetooth connection between the electronic device and the bluetooth headset is kept connected in the process of establishing the first bluetooth connection between the electronic device and the bluetooth headset. I.e. establishing the first bluetooth connection while maintaining the second bluetooth connection; and disconnecting the second Bluetooth connection after the first Bluetooth connection is successfully established.
One of the first Bluetooth connection and the second Bluetooth connection is in a classical Bluetooth mode, and the other Bluetooth connection is in a low-power-consumption audio Bluetooth mode. The bluetooth communication mode corresponding to the second bluetooth connection is assumed to be a classical bluetooth mode, and the bluetooth communication mode corresponding to the first bluetooth connection is assumed to be a low energy audio bluetooth mode. Assume that the electronic device is a cell phone and that the bluetooth headset may be a true wireless smart (True Wi re less Stereo, TWS) headset. For example, for the classical bluetooth mode, the bluetooth headset may be in a pairing state, where the bluetooth headset is in a pairing state, where the bluetooth headset can be found by other devices, where other devices do not have a bluetooth connection established with the bluetooth headset, or where other devices do not have a bluetooth address of the bluetooth headset acquired in advance, pairing with the bluetooth headset is required, that is, by means of pairing, the bluetooth headset exchanges communication information with a device requesting connection, where the communication information includes data such as a communication address, for establishing connection, so, for a new device, the communication information can only be scanned by other devices if the bluetooth headset enters an inquiry scan (inqu ry scan), and then paired with other devices, and then bluetooth connection with other devices is completed.
In some embodiments, the earphone of the TWS earphone that establishes a classical bluetooth connection with the electronic device is a master earphone, and the method in some embodiments of the present application may be performed by the master earphone as a bluetooth earphone in the present application. In some embodiments, the TWS headset may also be used as a whole, and the classical bluetooth connection may be understood to be established between the main headset and the electronic device, and the LE Aud io bluetooth connection may be understood to be established between the two headsets of the TWS headset and the electronic device, respectively. In some embodiments, the LE Aud io bluetooth connection may also be in a listening manner, for example, the master earphone may establish a classical bluetooth connection and/or an LE Aud io bluetooth connection with the electronic device, and the slave earphone establishes the aforementioned classical bluetooth connection or LE Aud io bluetooth connection by listening.
Referring to the bluetooth setup interface shown in fig. 7, it is assumed that the first bluetooth connection is an LE Aud io connection and the second bluetooth connection is a classical bluetooth connection. Assuming that the electronic device starts playing audio, namely, the audio playing state of the electronic device is a first state, at the moment, a second Bluetooth connection is established between the electronic device and the Bluetooth headset, when the electronic device plays audio, the on-off state of a designated switch in the Bluetooth setting interface is an off state, namely, at the moment, a classical Bluetooth connection is established between the electronic device and the Bluetooth headset but no LE Aud io connection is established, data are transmitted between the electronic device and the Bluetooth headset through the classical Bluetooth connection, then, when detecting that the on-off state of the designated switch in the Bluetooth setting interface is changed to an on state, a designated request is detected, namely, when the electronic device or the Bluetooth device requests to switch the established second Bluetooth connection between the electronic device and the Bluetooth headset to the first Bluetooth connection, the electronic device or the Bluetooth device establishes the first Bluetooth connection under the condition of maintaining the second Bluetooth connection, and then, after the first Bluetooth connection is successfully established, the second Bluetooth connection is disconnected.
In this embodiment, in the case that the audio playing state of the electronic device is the first state, the first bluetooth connection between the electronic device and the bluetooth device can be established under the condition that the second bluetooth connection is 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, the second bluetooth connection can be maintained in the process of establishing the first bluetooth connection, the blocking of the second bluetooth connection when the second bluetooth connection is switched to the first bluetooth connection can be reduced, and the situation that the power consumption is overlarge and the bandwidth occupation is overlarge while the first bluetooth connection and the second bluetooth connection are simultaneously maintained can also be avoided. It should be noted that, a data transmission channel may be established based on the first bluetooth connection and the second bluetooth connection, and data may be transmitted between the electronic device and the bluetooth device through the data transmission channel, and the data transmission channel may refer to the description of the subsequent embodiments. The disconnection time of the first bluetooth connection needs to be reasonably selected according to whether the data is blocked when the bluetooth connection is switched or not under the condition that whether the data is transmitted between the electronic device and the bluetooth device through the second bluetooth connection or not. For example, if in the case of said second bluetooth connection data is not transmitted between the electronic device and the bluetooth device via the second bluetooth connection, the first bluetooth connection may be disconnected in case a first bluetooth connection is successfully established and a data transmission channel is established over said first bluetooth connection that has been established, that is to say in case said first bluetooth connection is successfully established and a data transmission channel is established over said first bluetooth connection that has been established. In this way, the data transmission channel of the first bluetooth connection can be established in advance, so that the established data transmission channel can be directly used without establishing the data transmission channel when the first bluetooth connection is used for transmitting data later. Moreover, the electronic device is currently playing audio, so that the purpose of selecting the first bluetooth connection between the electronic device and the bluetooth device is to transmit audio data to be played, and although the second bluetooth connection is not used between the electronic device and the bluetooth device to transmit data, when the first bluetooth connection is established, it can be considered that a higher probability between the electronic device and the bluetooth device will use the first bluetooth connection to transmit data, the data transmission channel can be established in advance, and after the data transmission channel is established, the second bluetooth connection is disconnected, thereby completing the operation of switching the second bluetooth connection to the first bluetooth connection.
As another embodiment, if in the case of the second bluetooth connection, data is not transmitted between the electronic device and the bluetooth device through the second bluetooth connection, that is, there may be no fear that data transmitted successively by the first bluetooth may be blocked when switching to the first bluetooth connection, the second bluetooth connection may be disconnected after the first bluetooth connection is successfully established before a data transmission channel is not established on the first bluetooth connection. That is, in the case that the second bluetooth connection does not transmit the preset data, the second bluetooth connection is disconnected after the first bluetooth connection is successfully established, that is, before the data transmission channel is not established on the first bluetooth connection after the first bluetooth connection is successfully established. That is, in the case where it is determined that the first bluetooth connection does not have to take over the second bluetooth connection for further data transmission, it is also possible to disconnect the second bluetooth connection again without waiting until it is determined that the data transmission channel is successfully established over the first bluetooth connection.
If, however, in the case of the second bluetooth connection, data is transmitted between the electronic device and the bluetooth device via the second bluetooth connection, in order to avoid interruption or jamming of the output transmission, the second bluetooth connection may be disconnected after the first bluetooth connection is successfully established, in the case of determining that the audio transmission channel of the first bluetooth connection is established.
Specifically, after the first bluetooth connection is successfully established, in a case that it is determined that an audio transmission channel of the first bluetooth connection is established, an implementation manner of disconnecting the second bluetooth connection is as follows:
if the audio playing state is the first state, a specified request is detected under the condition that a second Bluetooth connection is established between the electronic equipment and the Bluetooth equipment and preset data is transmitted by using the second Bluetooth connection, the second Bluetooth connection is continuously used for transmitting the preset data, and a first Bluetooth connection between the electronic equipment and the Bluetooth equipment is established. And under the condition that the first Bluetooth connection is successfully established and a data transmission channel is established on the established first Bluetooth connection, disconnecting the second Bluetooth connection, and then continuing to transmit preset data by using the data transmission channel on the first Bluetooth connection between the electronic equipment and the Bluetooth headset, wherein other data can be transmitted, and the method is not limited in this regard. Therefore, the audio data can be transmitted between the electronic device and the Bluetooth headset through the second Bluetooth connection, under the condition that the electronic device plays the audio through the Bluetooth headset, when the user is determined to use the first Bluetooth connection, namely, the user is determined to request to switch the second Bluetooth connection to the first Bluetooth connection, the second Bluetooth connection can be disconnected after the data transmission channel waiting for the first Bluetooth connection is established, so that the electronic device and the Bluetooth headset can continue to use the second Bluetooth connection to transmit the data in the process of establishing the data transmission channel of the first Bluetooth connection, and the situation that the data transmission channel of the first Bluetooth connection is established can be ensured when the second Bluetooth connection is disconnected, and the blocking and time consumption caused by switching are reduced. It should be noted that the data transmission channel may be the aforementioned SCO or CIS, for example, if the first bluetooth connection is a classical bluetooth connection, the data transmission channel established on the first bluetooth connection is SCO, and if the first bluetooth connection is an LE Aud io connection, the data transmission channel established on the first bluetooth connection is CIS.
Referring to fig. 8, fig. 8 shows a bluetooth communication method provided in an embodiment of the present application, where the method is applied to a communication system, and the communication system includes an electronic device and a bluetooth headset, where the electronic device may be the foregoing smart phone, and the bluetooth headset may be the foregoing wireless headset. The method may include: s801 to S806.
S801: and acquiring the audio playing state of the electronic equipment.
S802: whether the audio playing state is the first state or the second state is judged.
S803: the first Bluetooth connection is configured to be in a connection maintaining state, and the second Bluetooth connection is configured to be in a connection maintaining state.
S804: and if the audio playing state is switched from the second state to the first state, responding to the request between the electronic equipment and the Bluetooth headset to use the first Bluetooth connection, and transmitting data between the electronic equipment and the Bluetooth headset by using the first Bluetooth connection.
S805: and in response to the request between the electronic equipment and the Bluetooth headset for using the first Bluetooth connection, controlling the first Bluetooth connection to be in a connection maintaining state and controlling the second Bluetooth connection to be in a disconnection state.
S806: if the audio playing state is switched from the first state to the second state, determining that the electronic equipment is in the last time in the first state, and maintaining the Bluetooth connection in the connection state and the Bluetooth connection in the disconnection state in the first Bluetooth connection and the second Bluetooth connection.
S807: and restoring the Bluetooth connection in the disconnection state to a connection state, and continuing to maintain the Bluetooth connection in the connection state.
In the case that the audio playing state of the electronic device is the first state, the bluetooth connection between the electronic device and the bluetooth headset is switched from the second bluetooth connection to the first bluetooth connection in response to the specified request, then, the audio playing state of the electronic device is continuously detected, if the audio playing state of the electronic device is detected to be switched from the current first state to the second state, for example, if the audio playing service of the electronic device is finished, the audio playing state of the electronic device is changed to the second state, then, the first bluetooth connection and the second bluetooth connection can be set to be in a connection maintaining state. In an exemplary embodiment, in a case where the audio playing state of the electronic device is the first state, one of the first bluetooth connection and the second bluetooth connection is kept in a connected state, and the other bluetooth connection is in a disconnected state, then, after the audio playing state is switched from the first state to the second state, it is determined that the electronic device is in the first state last time, during which the bluetooth connection in the connected state and the bluetooth connection in the disconnected state are kept, that is, when it is determined that the electronic device is in the audio playing state last time, the connected bluetooth connection and the disconnected bluetooth connection are kept, then, the disconnected bluetooth connection is restored, and the connected bluetooth connection is continued to be in the connected state. For example, when the first bluetooth connection is in the first state and the second bluetooth connection is in the disconnected state last time, after the electronic device is switched to the second state, the first bluetooth connection needs to be configured to be in the connection-maintaining state and the second bluetooth connection needs to be configured to be in the connection-maintaining state, and then the second bluetooth connection is restored to be connected, and the first bluetooth connection continues to be connected.
It should be noted that, the foregoing S801 may be an audio playing state detected for the first time when the electronic device meets a detection condition, where the detection condition may be that after the electronic device is connected to the bluetooth headset for the first time, the headset is connected to a mobile phone after being restored to a factory setting, or the electronic device detects a preset request input by a user, where the preset request is used to instruct the electronic device to execute a method for setting a connection state of the first bluetooth connection and the second bluetooth connection based on the audio playing state of the electronic device. The electronic device starts to execute the operation of detecting the audio playing state of the electronic device when the electronic device is detected to meet the detection condition, so that whether the audio playing state of the electronic device is the first state or the second state can be determined, and two different branches are executed.
In addition, after detecting the audio playing state once and setting the connection state of the first bluetooth connection and the second bluetooth connection based on the audio playing state, the audio playing state of the electronic device can be further detected, so that the connection state of the first bluetooth connection and the second bluetooth connection can be timely adjusted under the condition that the audio playing state is changed. Therefore, the aforementioned configuration that the first bluetooth connection is in the connection-maintaining state and the configuration that the second bluetooth connection is in the connection-maintaining state may be performed when the audio playing state is detected as the second state for the first time, or when the audio playing state is detected to be switched from the first state to the second state. Similarly, the foregoing transmission of the data between the electronic device and the bluetooth headset using the first bluetooth connection in response to the request between the electronic device and the bluetooth headset using the first bluetooth connection may be performed when the audio playing state is detected to be the first state for the first time, or may be performed when the audio playing state is detected to be switched from the second state to the first state, which is not limited herein.
In order to avoid that in the case that the audio playing state of the electronic device is switched from the current first state to the second state, for example, when the electronic device plays songs, the electronic device does not play audio during a playing interval of two songs, however, the time of the interval is often short, if the first bluetooth connection and the second bluetooth connection are connected at this time, after a short period of time, the audio playing state of the electronic device is changed to the first state again, one bluetooth connection of the first bluetooth connection and the second bluetooth connection is controlled to be in a connection maintaining state, and the other bluetooth connection is controlled to be in a disconnection state, which may cause a certain bluetooth connection to be frequently connected and disconnected. Therefore, if the audio playing state is detected to be switched from the first state to the second state, the timing operation is started, and if the electronic equipment is continuously in the second state in the period corresponding to the timing operation, the first Bluetooth connection and the second Bluetooth connection are controlled to be in a connection maintaining state. The time period corresponding to the timing operation may be set based on the actual requirement, for example, may be 5 seconds.
As shown in fig. 9, at this time, the electronic device plays the audio through the bluetooth headset, that is, the audio playing state of the electronic device is in the second state, and it is assumed that the electronic device is a mobile phone, the bluetooth headset is a TWS headset, and the mobile phone establishes a connection with the bluetooth headset when playing the audio file, and establishes the first bluetooth connection and the second bluetooth connection simultaneously when the bluetooth connection of the mobile phone and the bluetooth headset is established for the first time. The first pairing can acquire connection information of two Bluetooth connections, such as Bluetooth addresses, pairing information and the like, through the process of establishing the two Bluetooth connections, thereby facilitating subsequent Bluetooth connection. As shown in fig. 9, in the case where the bluetooth headset enters the pairing state, the bluetooth headset may be in a page scan state in the pairing state, and in some embodiments, the pairing state may also be a case where both the page scan and the inqu ry scan are turned on, and the mobile phone sends a page packet, and the bluetooth headset scans a page request sent by the mobile phone to perform a classical bluetooth connection between the bluetooth device and the mobile phone. The mobile phone scans LE Aud io broadcast (for example, LE Adu io broadcast may be low-power consumption bluetooth broadcast for establishing LE Aud io bluetooth connection) sent by the headset, the LE Aud io broadcast may include an access address, such as a BLE address, of a low-power consumption audio bluetooth mode of the headset, then the mobile phone establishes LE Aud io connection with the headset based on the LE Aud io broadcast, for example, for a dual-mode bluetooth headset, the bluetooth headset may be further equally divided into a master headset and a slave headset based on a connection relationship with an electronic device (for example, a mobile phone) in classical bluetooth, the mobile phone scans LE Aud io broadcast sent by the master headset and LE Aud io broadcast sent by the slave headset respectively, and establishes LE Aud io connection between the mobile phone and the master headset and LE Aud io connection between the mobile phone and the slave headset respectively, for example, in the LE Aud io bluetooth mode, there may be no distinction between the master headset and the slave headset. Thus, a first bluetooth connection and a second bluetooth connection are established between the electronic device and the bluetooth headset simultaneously. Determining a state of an LE Aud io switch, which may be a switch of the aforementioned bluetooth setup interface of fig. 6 and 7, if it is detected that the LE Aud io switch is in an off state, determining that a classical bluetooth connection is requested to be used between the handset and the bluetooth headset, maintaining the classical bluetooth connection and the LE Aud io connection, and transmitting data between the handset and the bluetooth headset using the classical bluetooth connection. If the LE Aud io switch is detected to be in an on state, determining that the LE Aud io connection is required to be used between the mobile phone and the Bluetooth headset, maintaining the classical Bluetooth connection and the LE Aud io connection, and transmitting data between the mobile phone and the Bluetooth headset by using the LE Aud io connection. It can be seen that even in the case of state switching of the LE Aud io switch, since the classical bluetooth connection and the LE Aud io are always kept connected at the same time in the case of no audio play of the electronic device, only the bluetooth connection used is switched without disconnecting or reconnecting a certain bluetooth connection
As shown in fig. 10, similar to fig. 9, in the case where the electronic device is first connected to the bluetooth headset, a classical bluetooth connection and an LE Aud io connection are simultaneously established between the electronic device and the bluetooth headset. When the electronic device plays audio, that is, in a case that the audio playing state of the electronic device is the first state, it needs to be determined through which bluetooth connection between the electronic device and the bluetooth headset transmits audio data, then the state of the LE Aud io switch may be determined, if the state of the LE Aud io switch is the off state, then it is determined that the classical bluetooth connection is requested to be used between the mobile phone and the bluetooth headset, then the classical bluetooth connection may be used to transmit data between the electronic device and the bluetooth headset, for example, the classical bluetooth connection is controlled to be in a state of maintaining connection, an audio transmission channel (for example, an SCO channel) is established on the classical bluetooth connection, and after the establishment of the channel is completed, the LE Aud io connection may be disconnected after the audio data to be currently played by the electronic device is transmitted using the channel. If it is determined that the state of the LE Aud io switch is an on state, it is determined that the use of the LE Aud io connection is requested between the mobile phone and the bluetooth headset, the LE Aud io connection is established in a case where the classical bluetooth connection between the control electronic device and the bluetooth headset remains connected and in a case where audio data is transmitted using an audio transmission channel on the classical bluetooth connection, then a data transmission channel (e.g., CIS channel) is established on the LE Aud io connection, and after the establishment of the channel is completed, the classical bluetooth connection may be disconnected after audio data currently to be played by the electronic device is transmitted using the channel. Therefore, as can be seen from comparing fig. 10 and fig. 3, in the case that the electronic device is currently maintaining the second bluetooth connection, after determining the first bluetooth connection to be switched, the method provided by the embodiment of the present application establishes the first bluetooth connection first and establishes the data transmission channel on the basis of the first bluetooth connection, and after disconnecting the second bluetooth connection, the negative effect caused by the interruption of data transmission can be reduced.
Continuing to participate in fig. 10, when it is detected that the audio playing is finished, that is, when the audio playing state of the electronic device is switched from the first state to the second state, it is determined whether the electronic device is in the audio not played, that is, continuously in the second state, within 5 seconds, and if so, the classical bluetooth connection is restored, that is, the classical bluetooth connection and the LE Aud io connection are simultaneously maintained between the electronic device and the bluetooth headset.
Therefore, the embodiment of the application optimizes the scheme of switching the LE Aud io and the BT mode of the mobile phone, and optimizes specific logic for scenes without service playing and with service playing at the mobile phone end. Aiming at a non-service playing scene, the mobile phone and the earphone end always keep a BT and LE Aud io coexisting scene, so that the switching experience of a user is ensured. Aiming at the scene that the mobile phone terminal has service playing, the situation that the mobile phone audio is played outwards due to switching failure is avoided by connecting the target mode and establishing the audio transmission channel of the mode and then disconnecting the current mode, so that the reliability, stability and timeliness of switching are ensured. And meanwhile, the other link is disconnected, if BT is used, LE Aud io is disconnected, and the use of bandwidth is ensured. In addition, an anti-shake mechanism judgment for switching a business scene and a business-free playing of a mobile phone end is added (namely if the audio playing state is detected to be switched from a first state to a second state, and if the electronic equipment is continuously in the second state in a time period corresponding to a timing operation, the first Bluetooth connection and the second Bluetooth connection are controlled to be in a connection maintaining state), so that user experience is improved, and product competitiveness is enhanced.
Referring to fig. 11, a block diagram of a bluetooth communication device according to an embodiment of the present application is shown, where the device may include: an acquisition unit 1101 and a control unit 1102.
An obtaining unit 1101, configured to obtain an audio playing state of the electronic device, where the audio playing state includes a first state and a second state, 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.
And the control unit 1102 is configured to configure the first bluetooth connection in a connection maintaining state and configure the second bluetooth connection in a connection maintaining state if the audio playing state is the second state.
Further, the control unit 1102 is further configured to, if the audio playing state is switched from the second state to the first state, transmit data between the electronic device and the bluetooth headset using the first bluetooth connection in response to a request between the electronic device and the bluetooth headset for using the first bluetooth connection.
Further, the control unit 1102 is further configured to disconnect the second bluetooth connection by transmitting data between the electronic device and the bluetooth headset using the first bluetooth connection in response to a request between the electronic device and the bluetooth headset to use the first bluetooth connection.
Further, the control unit 1102 is further configured to configure the first bluetooth connection to be in a connection-maintaining state and configure the second bluetooth connection to be in a connection-maintaining state if the audio playing state is switched from the first state to the second state.
Further, the control unit 1102 is further configured to determine, if the audio playing state is switched from the first state to the second state, a bluetooth connection that maintains a connection state and a bluetooth connection that maintains a disconnection state in the first bluetooth connection and the second bluetooth connection during the period of the first state for the electronic device last time; and restoring the Bluetooth connection in the disconnection state to a connection state, and continuing to maintain the Bluetooth connection in the connection state.
Further, the control unit 1102 is further configured to start a timing operation if it is detected that the audio playing state is switched from the first state to the second state; and if the electronic equipment is continuously in the second state in the time period corresponding to the timing operation, configuring the first Bluetooth connection to be in a connection maintaining state, and configuring the second Bluetooth connection to be in a connection maintaining state.
Further, one of the first bluetooth connection and the second bluetooth connection is a classical bluetooth connection, and the other bluetooth connection is an LE Aud io bluetooth connection.
It will be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working process of the apparatus and modules described above may refer to the corresponding process in the foregoing method embodiment, which is not repeated herein.
In several embodiments provided herein, the coupling of the modules to each other may be electrical, mechanical, or other.
In addition, each functional module in each embodiment of the present application may be integrated into one processing module, or each module may exist alone physically, or two or more modules may be integrated into one module. The integrated modules may be implemented in hardware or in software functional modules.
Referring to fig. 12, a block diagram of an electronic device according to an embodiment of the present application is shown. The electronic device 100 may be a smart phone, a tablet computer, an electronic book, or the like capable of running an application program. The electronic device 100 in this application may include one or more of the following components: a processor 110, a memory 120, and one or more application programs, wherein the one or more application programs may be stored in the memory 120 and configured to be executed by the one or more processors 110, the one or more program(s) configured to perform the method as described in the foregoing method embodiments.
Processor 110 may include one or more processing cores. The processor 110 utilizes various interfaces and lines to connect various portions of the overall electronic device 100, perform various functions of the electronic device 100, and process data by executing or executing instructions, programs, code sets, or instruction sets stored in the memory 120, and invoking data stored in the memory 120. Alternatively, the processor 110 may be implemented in at least one hardware form of digital signal processing (Digita l Signa l Process ing, DSP), field programmable gate array (Fie ld-Programmab le Gate Array, FPGA), programmable logic array (Programmab le Logic Array, PLA). The processor 110 may integrate one or a combination of several of a central processing unit (Centra l Process ing Un it, CPU), an image processor (Graph ics Process i ng Un it, GPU), and a modem, etc. The CPU mainly processes an operating system, a user interface, an application program and the like; the GPU is used for being responsible for rendering and drawing of display content; the modem is used to handle wireless communications. It will be appreciated that the modem may not be integrated into the processor 110 and may be implemented solely by a single communication chip.
The Memory 120 may include a random access Memory (Random Access Memory, RAM) or a Read-only Memory (Read-only Memory). Memory 120 may be used to store instructions, programs, code, sets of codes, or sets of instructions. The memory 120 may include a stored program area and a stored data area, wherein the stored program area may store instructions for implementing an operating system, instructions for implementing at least one function (such as a touch function, a sound playing function, an image playing function, etc.), instructions for implementing the various method embodiments described below, etc. The storage data area may also store data created by the electronic device 100 in use (e.g., phonebook, audiovisual data, chat log data), and the like.
Referring to fig. 13, a block diagram of a computer readable storage medium according to an embodiment of the present application is shown. The computer readable medium 1300 has stored therein program code that can be invoked by a processor to perform the methods described in the method embodiments above.
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. Optionally, computer readable storage medium 1300 includes non-volatile computer readable media (non-trans itory computer-readab le storage med ium). The computer readable storage medium 1300 has storage space for program code 1310 that performs any of the method steps described above. The program code can be read from or written to one or more computer program products. Program code 1310 may be compressed, for example, in a suitable form.
In summary, the first bluetooth connection and the second bluetooth connection that support to establish two different bluetooth communication modes between the electronic device and the bluetooth headset can determine whether the electronic device is currently in a state of playing audio or in a state of not playing audio by acquiring the audio playing state of the electronic device, and then, based on the audio playing state of the electronic device, control the connection states of the first bluetooth connection and the second bluetooth connection. Therefore, the influence of the audio playing state can be considered in the setting of the connection states of the first Bluetooth connection and the second Bluetooth connection, so that the setting of the connection states of the first Bluetooth connection and the second Bluetooth connection can be more fit with the audio playing requirement of a user on the electronic equipment.
And optimizing specific logic aiming at scenes without service playing at the mobile phone end and with service playing. Aiming at a non-service playing scene, the mobile phone and the earphone end always keep a BT and LE Aud io coexisting scene, so that the switching experience of a user is ensured. Aiming at the scene that the mobile phone terminal has service playing, the situation that the mobile phone audio is played outwards due to switching failure is avoided by connecting the target mode and establishing the audio transmission channel of the mode and then disconnecting the current mode, so that the reliability, stability and timeliness of switching are ensured. And meanwhile, the other link is disconnected, if BT is used, LE Aud io is disconnected, and the use of bandwidth is ensured. In addition, an anti-shake mechanism judgment for switching a business scene and a business-free playing of a mobile phone end is added (namely if the audio playing state is detected to be switched from a first state to a second state, and if the electronic equipment is continuously in the second state in a time period corresponding to a timing operation, the first Bluetooth connection and the second Bluetooth connection are controlled to be in a connection maintaining state), so that user experience is improved, and product competitiveness is enhanced.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present application, and are not limiting thereof; although the present application has been described in detail with reference to the foregoing embodiments, one of ordinary skill in the art will appreciate that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not drive the essence of the corresponding technical solutions to depart from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims (10)

1. A bluetooth communication method, applied to an electronic device and/or a bluetooth headset, wherein the electronic device and the bluetooth headset support establishment of a first bluetooth connection and a second bluetooth connection, the method comprising:
acquiring an audio playing state of the electronic equipment, wherein the audio playing state comprises a first state and a second state, the first state is used for representing that the electronic equipment is playing audio, and the second state is used for representing that the electronic equipment is not playing audio;
and if the audio playing state is the second state, configuring the first Bluetooth connection to be in a connection maintaining state, and configuring the second Bluetooth connection to be in a connection maintaining state.
2. The method as recited in claim 1, further comprising:
and if the audio playing state is switched from the second state to the first state, responding to the request between the electronic equipment and the Bluetooth headset to use the first Bluetooth connection, and transmitting data between the electronic equipment and the Bluetooth headset by using the first Bluetooth connection.
3. The method of claim 2, wherein the transmitting data between the electronic device and the bluetooth headset using the first bluetooth connection in response to the request between the electronic device and the bluetooth headset using the first bluetooth connection comprises:
and responding to the request between the electronic equipment and the Bluetooth headset to use the first Bluetooth connection, transmitting data between the electronic equipment and the Bluetooth headset by using the first Bluetooth connection, and disconnecting the second Bluetooth connection.
4. The method of claim 1, wherein if the audio playing state is the second state, configuring the first bluetooth connection in the connection-maintaining state and configuring the second bluetooth connection in the connection-maintaining state comprises:
if the audio playing state is switched from the first state to the second state, the first Bluetooth connection is configured to be in a connection maintaining state, and the second Bluetooth connection is configured to be in a connection maintaining state.
5. The method of claim 4, wherein if the audio playing state is switched from the first state to the second state, configuring the first bluetooth connection in the connection-maintaining state and configuring the second bluetooth connection in the connection-maintaining state comprises:
if the audio playing state is switched from a first state to a second state, determining that the electronic equipment is in a Bluetooth connection in a connection state and a Bluetooth connection in a disconnection state in the first Bluetooth connection and the second Bluetooth connection in the period of the first state last time;
and restoring the Bluetooth connection in the disconnection state to a connection state, and continuing to maintain the Bluetooth connection in the connection state.
6. The method of claim 4, wherein if the audio playing state is switched from the first state to the second state, configuring the first bluetooth connection in the connection-maintaining state and configuring the second bluetooth connection in the connection-maintaining state comprises:
if the audio playing state is detected to be switched from the first state to the second state, starting timing operation;
and if the electronic equipment is continuously in the second state in the time period corresponding to the timing operation, configuring the first Bluetooth connection to be in a connection maintaining state, and configuring the second Bluetooth connection to be in a connection maintaining state.
7. The method according to any of claims 1-6, wherein one of the first bluetooth connection and the second bluetooth connection is a classical bluetooth connection and the other bluetooth connection is an LE Audio bluetooth connection.
8. A bluetooth communication device, characterized by being applied to an electronic apparatus and/or a bluetooth headset, between which a first bluetooth connection and a second bluetooth connection are supported, establishing two different bluetooth communication modes, the device comprising:
the electronic equipment comprises an acquisition unit, a display unit and a display unit, wherein the acquisition unit is used for acquiring an audio playing state of the electronic equipment, the audio playing state comprises a first state and a second state, the first state is used for representing that the electronic equipment is playing audio, and the second state is used for representing that the electronic equipment is not playing audio;
and the control unit is used for configuring the first Bluetooth connection to be in a connection maintaining state and configuring the second Bluetooth connection to be in a connection maintaining state if the audio playing state is the second state.
9. 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, the one or more applications configured to perform the method of any of claims 1-7.
10. A computer readable medium, characterized in that the computer readable medium stores a program code executable by a processor, which program code, when executed by the processor, causes the processor to perform the method of any of claims 1-7.
CN202211575036.3A 2022-12-08 2022-12-08 Bluetooth communication method, bluetooth communication device, electronic equipment and computer readable medium Pending CN116321084A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211575036.3A CN116321084A (en) 2022-12-08 2022-12-08 Bluetooth communication method, bluetooth communication device, electronic equipment and computer readable medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211575036.3A CN116321084A (en) 2022-12-08 2022-12-08 Bluetooth communication method, bluetooth communication device, electronic equipment and computer readable medium

Publications (1)

Publication Number Publication Date
CN116321084A true CN116321084A (en) 2023-06-23

Family

ID=86829328

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211575036.3A Pending CN116321084A (en) 2022-12-08 2022-12-08 Bluetooth communication method, bluetooth communication device, electronic equipment and computer readable medium

Country Status (1)

Country Link
CN (1) CN116321084A (en)

Similar Documents

Publication Publication Date Title
CN109445740B (en) Audio playing method and device, electronic equipment and storage medium
WO2019090726A1 (en) Method for selecting bluetooth device, terminal, and system
US11172530B2 (en) Communication establishment method and terminal
US10950238B2 (en) Bluetooth speaker base, method and system for controlling thereof
CN109379490B (en) Audio playing method and device, electronic equipment and computer readable medium
WO2020048209A1 (en) Sound effect processing method and apparatus, and electronic device and storage medium
WO2021169472A1 (en) Voice call transfer method and electronic device
WO2023087793A1 (en) Audio service processing method and apparatus, electronic device, and storage medium
CN110602683B (en) Bluetooth control method, device, mobile terminal and storage medium
CN111556439A (en) Terminal connection control method, terminal and computer storage medium
US20220286731A1 (en) Multimedia apparatus and cast method
CN113840269B (en) Multimedia data transmission method and device, electronic equipment and storage medium
WO2023231668A1 (en) Screen mirroring data processing method, electronic device, and storage medium
WO2024055738A1 (en) Method and apparatus for audio data sharing, and electronic device and storage medium
WO2023061127A1 (en) Communication method and apparatus, earphone set, and computer readable medium
WO2023045784A1 (en) Call control method and apparatus, and electronic device and computer-readable storage medium
CN116321084A (en) Bluetooth communication method, bluetooth communication device, electronic equipment and computer readable medium
CN115580944A (en) Audio device connection method and device, storage medium and device
CN114501239A (en) Master-slave switching method and device of earphone, Bluetooth earphone and storage medium
CN113709906B (en) Wireless audio system, wireless communication method and equipment
CN115022766A (en) Audio data playing method and equipment
CN114363876A (en) Connection establishing method, device, equipment, storage medium and program product
WO2024060750A1 (en) Bluetooth switching method and apparatus, bluetooth connection method and apparatus, and electronic device
CN113271385A (en) Call forwarding method
CN117692886A (en) Device connection method, device, electronic device and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination