WO2023061076A1 - Bluetooth connection method and apparatus, earphone, and storage medium - Google Patents

Bluetooth connection method and apparatus, earphone, and storage medium Download PDF

Info

Publication number
WO2023061076A1
WO2023061076A1 PCT/CN2022/115861 CN2022115861W WO2023061076A1 WO 2023061076 A1 WO2023061076 A1 WO 2023061076A1 CN 2022115861 W CN2022115861 W CN 2022115861W WO 2023061076 A1 WO2023061076 A1 WO 2023061076A1
Authority
WO
WIPO (PCT)
Prior art keywords
earphone
connection
master
electronic device
target device
Prior art date
Application number
PCT/CN2022/115861
Other languages
French (fr)
Chinese (zh)
Inventor
侯锐填
Original Assignee
Oppo广东移动通信有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Oppo广东移动通信有限公司 filed Critical Oppo广东移动通信有限公司
Publication of WO2023061076A1 publication Critical patent/WO2023061076A1/en

Links

Images

Classifications

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

Definitions

  • the present application relates to the technical field of bluetooth communication, in particular to a bluetooth connection method and device, an earphone, and a storage medium.
  • an electronic device such as a smart phone, a tablet computer, a smart wearable device, etc.
  • a user can usually pair and connect the electronic device with an earphone to use the corresponding earphone function.
  • the earphone can be directly connected back to the electronic device to speed up the connection to the electronic device.
  • it has been found that when the headset needs to connect back to the electronic device, it is often prone to slow or even failure to connect back to the electronic device, so that it may not be able to successfully connect to the electronic device in the end, which greatly reduces the reliability and reliability of the headset's connection back to the electronic device. flexibility.
  • the embodiment of the present application discloses a Bluetooth connection method and device, an earphone, and a storage medium, which can improve the reliability and flexibility of connecting an earphone to an electronic device.
  • the first aspect of the embodiment of the present application discloses a Bluetooth connection method, which is applied to the first earphone in the earphone device, and the earphone device also includes a second earphone.
  • the method includes:
  • the master-slave attribute determine a first target device to be connected back to the first earphone, where the first target device includes the second earphone, or an electronic device that has established a Bluetooth connection with the first earphone;
  • the second aspect of the embodiment of the present application discloses a Bluetooth connection device, which is applied to the first earphone in the earphone device, and the earphone device also includes a second earphone, and the Bluetooth connection device includes:
  • the first determining unit is configured to determine the master-slave attribute of the first earphone when the first earphone is in the connection-back state, wherein the master-slave attribute is used to indicate that the first earphone is connected to the Master-slave relationship between the second headset;
  • the second determination unit is configured to determine a first target device to be connected back to the first earphone according to the master-slave attribute, the first target device includes the second earphone, or is established with the first earphone Electronic devices connected via Bluetooth;
  • a connection-back unit configured to perform a first connection-back operation corresponding to the first target device, so as to establish a Bluetooth connection between the first earphone and the first target device.
  • the third aspect of the embodiment of the present application discloses an earphone, including a memory and a processor, the memory stores a computer program, and when the computer program is executed by the processor, the processor realizes the implementation of the present application. For example, all or part of the steps in any Bluetooth connection method disclosed in the first aspect.
  • the fourth aspect of the embodiment of the present application discloses a computer-readable storage medium, which stores a computer program, wherein, when the computer program is executed by a processor, any Bluetooth connection method as disclosed in the first aspect of the embodiment of the present application is implemented All or some of the steps in .
  • FIG. 1 is a schematic diagram of an application scenario of the Bluetooth connection method disclosed in the embodiment of the present application
  • Fig. 2 is a schematic flow chart of a Bluetooth connection method disclosed in the embodiment of the present application.
  • FIG. 3 is a schematic flowchart of another Bluetooth connection method disclosed in the embodiment of the present application.
  • Fig. 4A is a schematic diagram of an earphone box triggering and opening operation disclosed in an embodiment of the present application
  • FIG. 4B is a schematic diagram of the triggering and closing operation of the earphone box shown in FIG. 4A;
  • FIG. 5 is a schematic flowchart of another Bluetooth connection method disclosed in the embodiment of the present application.
  • FIG. 6 is a sequence diagram of a Bluetooth connection method disclosed in an embodiment of the present application.
  • Fig. 7 is a schematic modular diagram of a bluetooth connection device disclosed in the embodiment of the present application.
  • Fig. 8 is a schematic modular diagram of an earphone disclosed in an embodiment of the present application.
  • the embodiment of the present application discloses a Bluetooth connection method and device, an earphone, and a storage medium, which can improve the reliability and flexibility of connecting an earphone to an electronic device.
  • FIG. 1 is a schematic diagram of an application scenario of the Bluetooth connection method disclosed in the embodiment of the present application.
  • the application scenario may include a headset device 10 and an electronic device 20, wherein the headset device 10 may include a first headset 11 and a second headset 12, and the first headset 11 and the second headset 12 may be arranged in pairs (e.g. left earphone and right earphone respectively).
  • the earphone device 10 When the earphone device 10 is connected to the electronic device 20 for the first time, it is usually necessary to pair the earphone device 10 with the electronic device 20 to establish a Bluetooth connection between the two.
  • the earphone device 10 can automatically establish a bluetooth connection with the electronic device 20 according to the address information of the electronic device 20 recorded when the electronic device 20 was connected last time (i.e. "connect back"), so that there is no need to re-pair the process.
  • connection back may refer to an operation in which the first electronic device attempts to reconnect with the previously paired and connected second electronic device by means of paging.
  • the first electronic device can send a page packet (a Bluetooth connection request) to the second electronic device, and the page packet can be used to connect or activate the second electronic device, so that the first electronic device can establish a connection with the second electronic device.
  • the above page packet may contain Bluetooth address information of the second electronic device, so that the second electronic device may be paged directly.
  • the earphone device 10 includes the first earphone 11 and the second earphone 12, one of which can be used as a master earphone, and the other can be used as a slave earphone.
  • the master earphone can be used for data transmission based on the bluetooth connection with the electronic device 20 established with it, and at the same time, the master earphone can also synchronize the above bluetooth connection information to the slave earphone, so that the slave earphone can monitor the master earphone Data transmission with the electronic device 20, so that the audio data synchronization between the master earphone and the slave earphone can be realized.
  • the first earphone 11 can be used as a master earphone and directly connected to the electronic device 20 ; while the second earphone 12 can be used as a slave earphone and connected to the first earphone 11 as a master earphone.
  • the master-slave relationship between the first earphone 11 and the second earphone 12 can be switched at any time according to scene changes and/or user settings, that is, the first earphone 11 can also be used as a slave earphone, and at the same time
  • the second earphone 12 is used as the main earphone.
  • the first earphone 11 and the second earphone 12 may not distinguish the master-slave relationship, that is, the electronic device 20 may establish a Bluetooth connection with the first earphone 11 and the second earphone 12 respectively at the same time.
  • the above-mentioned bluetooth connection can be realized based on the classic bluetooth protocol (such as bluetooth 4.0 and other versions formulated by the bluetooth technology alliance bluetooth SIG), and can also be based on the bluetooth low energy (bluetooth low energy, BLE) protocol (for example Bluetooth 5.0 and other versions of the protocol), which are not specifically limited in this embodiment of the present application.
  • the first earphone 11 when the first earphone 11 is in the connection back state, the first earphone 11 can first determine its own master-slave attribute, where the master-slave attribute can be used to indicate that the first earphone 11 is connected to The master-slave relationship between the second earphones 12 (that is, the first earphone 11 acts as the master earphone or the slave earphone). Further, according to the above-mentioned master-slave attribute, the first earphone 11 can determine the first target device to be connected back to, and the first target device can include the second earphone 12 mentioned above, or a device that has established a Bluetooth connection with the first earphone 11 The aforementioned electronic device 20 .
  • the first earphone 11 may perform a first connection back operation corresponding to the first target device, so that the first earphone 11 establishes a Bluetooth connection with the first target device. It can be understood that the above-mentioned first earphone 11 and the second earphone 12 can be interchanged without affecting the realization of the above-mentioned Bluetooth connection method.
  • the first earphone 11 when the first earphone 11 in the earphone device 10 is in the reconnection state and needs to be reconnected to the electronic device 20, the first earphone 11 can flexibly select different first target devices according to its master-slave attributes (may include the above-mentioned second earphone 12 or electronic device 20) to connect back, to adapt to the application scene where the first earphone 11 is located as much as possible, improve the success rate of the first earphone 11 to connect back to the first target device, and also have Helps shorten the time it takes to connect back.
  • master-slave attributes may include the above-mentioned second earphone 12 or electronic device 20
  • the first earphone 11 can indirectly or directly realize the connection back to the electronic device 20 , thereby effectively improving the reliability and flexibility of the connection between the earphone device 10 and the electronic device 20 .
  • the first earphone 11 can select the electronic device 20 as the first target device to directly realize the connection back with the electronic device 20; if the first earphone 11 is the slave earphone , then the first earphone 11 can select the second earphone 12 as the first target device, so as to first connect back to the second earphone 12 as the main earphone, and then indirectly realize the back-connection with the electronic device 20 through the second earphone 12 .
  • the above-mentioned electronic device 20 may include various devices or systems with bluetooth communication functions, such as mobile phones, smart wearable devices, vehicle-mounted terminals, tablet computers, PCs (Personal Computers, personal computers), PDAs (Personal Digital Assistants, personal digital assistant), etc., are not specifically limited in this embodiment of the application.
  • the electronic device 20 shown in FIG. 1 is a mobile phone, which is only an example and does not constitute a limitation on the type of the electronic device 20 in the embodiment of the present application.
  • the above-mentioned earphone device 20 may include various types of Bluetooth earphones, especially TWS (True Wireless Stereo, true wireless stereo) earphones.
  • FIG. 2 is a schematic flowchart of a Bluetooth connection method disclosed in an embodiment of the present application.
  • the method can be applied to the first earphone of the above-mentioned earphone device, and the earphone device can also include a second earphone.
  • the Bluetooth connection method may include the following steps:
  • the first earphone When the first earphone is in the connection-back state, determine a master-slave attribute of the first earphone, where the master-slave attribute is used to indicate a master-slave relationship between the first earphone and a second earphone.
  • the first earphone may refer to any one of the two earphones included in the above-mentioned earphone device (for example, it may be a left-ear earphone or a right-ear earphone).
  • the first earphone When the first earphone is in the connection back state, the first earphone needs to be reconnected to the electronic device with which the bluetooth connection has been established, that is, to be connected back to the electronic device.
  • the first earphone can directly connect back to the electronic device, but in other scenarios, it may not be able to directly connect back. Other headphone equipment connection, etc.
  • the first earphone in the connection-back state can be connected from the second earphone and the electronic device according to its master-slave attribute (that is, the first earphone is used as the master earphone or the slave earphone in the earphone device). , select an appropriate first target device, so as to perform the connection back operation corresponding to the first target device in the subsequent steps, and avoid specifying the electronic device for connection back in the scenario where the electronic device cannot be directly connected back, which will lead to The connection is slow or even fails.
  • the first earphone can be placed in the earphone box, and when the earphone box triggers an opening operation, the first earphone can enter a reconnection state.
  • the earphone box is opened by the user (for example, the earphone box with the cover is opened, the earphone box with the opening button is clicked on the opening button, etc.)
  • the first earphone box can be placed inside it.
  • the earphone sends the start signal, so that the first earphone is turned on, or wakes up from the dormant state, and then enters the reconnection state.
  • the first earphone when the connection between the first earphone and the electronic device is accidentally interrupted, the first earphone may also enter a reconnection state. For example, if the position of the electronic device is beyond the communication range of the first earphone, or the data transmission based on the Bluetooth connection between the electronic device and the first earphone is interfered or blocked, the first earphone can automatically enter the reconnection state , so that the electronic device can be quickly reconnected when the above-mentioned unexpected interruption is resolved.
  • the first target device may include the second earphone or an electronic device that has established a Bluetooth connection with the first earphone.
  • the application scenarios of the first earphone before and after entering the reconnection state can be correspondingly determined, and then based on the application scenarios, the adaptability Select the first target device that is easy to connect back and has a high success rate of connection back.
  • the first target device may include the above-mentioned second earphone (that is, indirectly connect back to the electronic device through the second earphone), or the above-mentioned electronic device that has established a Bluetooth connection with the first earphone (that is, directly connect back to the electronic device) .
  • the first earphone if the first earphone is originally the master earphone, and if the second earphone originally as the slave earphone is within the communication range of the electronic device, then when the first earphone is placed in the earphone box, and the earphone box triggers When the shutdown operation is performed, the first earphone can be switched as a slave earphone, and at the same time, the second earphone can be switched as a master earphone.
  • the earphone box triggers the opening operation so that the first earphone enters the reconnection state, the first earphone can determine that its master-slave attribute is a slave earphone, and then the first earphone can be determined according to this master-slave attribute.
  • the first target device to which the headset is to be connected if the first earphone is originally the master earphone, and if the second earphone originally as the slave earphone is within the communication range of the electronic device, then when the first earphone is placed in the earphone box, and the
  • the first earphone is originally the master earphone
  • the second earphone originally serving as the slave earphone is not within the communication range of the electronic device (for example, the second earphone is lost, shielded, etc.)
  • the first earphone When the earphone is placed in the earphone box, and the earphone box triggers the closing operation, the first earphone is still regarded as the master earphone and will not be switched to the slave earphone.
  • the first earphone can determine its master-slave attribute as the master earphone, and then also determine the second earphone according to the master-slave attribute.
  • the first earphone may also enter the connection back state. Since the second earphone can be switched as the master earphone at this time, based on different switching settings, the master-slave attribute of the first earphone can be regarded as either the master earphone or the slave earphone, and then the determined master-slave attribute can be Further determining the first target device to which the first earphone is to be connected back.
  • the first earphone can determine that its master-slave attribute is Slave the earphone to determine the first target device to be connected back to the first earphone according to the master-slave attribute.
  • the first earphone may perform a corresponding first connection back operation on the first target device.
  • the first target device is the above-mentioned second earphone or the electronic device
  • the first earphone can determine the address information of the first target device, and then can send a connection back request containing the above-mentioned address information to the first target device .
  • the first target device may respond to the connection back request and re-establish a Bluetooth connection with the first earphone.
  • the first earphone can directly realize the connection back with the electronic device; if the first target device is the above-mentioned second earphone, then the first earphone can first connect back to the second The second earphone, and the second earphone synchronizes the bluetooth connection information with the electronic device to the first earphone, so as to indirectly realize the connection back with the electronic device.
  • the first earphone when the first earphone in the earphone device is in the reconnection state and needs to be connected back to the electronic device, the first earphone can flexibly select different The first target device (which may include the above-mentioned second earphone or electronic device) is connected back, so as to adapt to the application scenario where the first earphone is located as much as possible, improve the success rate of the first earphone to connect back to the first target device, and shorten the The time required to connect back. No matter what kind of first target device the first earphone establishes a Bluetooth connection with, it can be indirectly or directly connected back to the electronic device, thereby effectively improving the reliability and flexibility of the connection between the earphone and the electronic device.
  • the first target device which may include the above-mentioned second earphone or electronic device
  • FIG. 3 is a schematic flowchart of another Bluetooth connection method disclosed in an embodiment of the present application. This method can be applied to the first earphone of the above-mentioned earphone device, and the earphone device can also include a second earphone. As shown in Figure 3, the Bluetooth connection method may include the following steps:
  • the earphone box can be used to place the above-mentioned first earphone and the second earphone at the same time, so as to realize functions such as charging, powering on, and waking up of the first earphone and/or the second earphone.
  • the above-mentioned earphone box may have a box cover, and the user can realize the opening operation of the earphone box by opening the cover, and realize the closing operation of the earphone box by closing the cover.
  • the above-mentioned earphone box can also have an open button, then the user can realize the open operation of the earphone box by clicking the open button, and realize the open operation of the earphone box by clicking the close button (the above-mentioned open button can be reused). close operation.
  • FIG. 4A is a schematic diagram of triggering an opening operation of an earphone box disclosed in an embodiment of the application, that is, opening a cover
  • FIG. 4B is It is a schematic diagram of triggering the closing operation of the earphone box shown in FIG. 4A , that is, closing the cover.
  • both the first earphone 11 and the second earphone 12 can be placed in the earphone box 30 .
  • the first earphone 11 can obtain the master-slave attribute of the first earphone 11, so as to select an appropriate first target device for connection back according to the master-slave attribute in subsequent steps.
  • the above-mentioned master-slave attribute of the first earphone may be obtained by the first earphone recorded in advance.
  • the first earphone box when the above-mentioned first earphone is placed in the earphone box, when the earphone box triggers a closing operation (take the earphone box with a lid as an example, that is, the earphone box is closed), the first earphone can record At this time, the master-slave property of the first headset.
  • the earphone box triggers the opening operation if the second earphone is not placed in the earphone box, the first earphone can obtain other records recorded by the first earphone when the earphone box was in the state of triggering the closing operation last time.
  • the earphone box triggers the shutdown operation, and at this time, the A earphone can record its own master-slave property.
  • the earphone A can obtain the above-mentioned master-slave attributes recorded before, and then can determine the first target device to be connected back in the subsequent steps according to the master-slave attributes.
  • the earphone box when the above-mentioned A earphone and B earphone are placed in the earphone box (that is, both ears are in the box), the earphone box triggers the closing operation, and at this time, the A earphone can also record its own master-slave attribute .
  • the A earphone box triggers the opening operation again, since the A earphone and the B earphone are placed in the earphone box, the A earphone and the B earphone can be connected back first, so that a Bluetooth connection can be established between the two.
  • the master earphone can be determined from the connected earphone A and earphone B according to the master-slave attribute recorded by earphone A; and B earphone to determine the main earphone. Further, the main earphone can be connected back to the electronic device, so that the main earphone can establish a Bluetooth connection with the electronic device.
  • the master earphone can share the corresponding connection information (such as the bluetooth address information of the electronic device, the bluetooth channel number, etc.) to the slave earphone ( That is, another earphone other than the master earphone), so that the slave earphone can monitor the transmission data between the master earphone and the electronic device.
  • connection information such as the bluetooth address information of the electronic device, the bluetooth channel number, etc.
  • the above-mentioned master-slave attribute indicates that the first earphone is the master earphone, obtain the connection information corresponding to the electronic device that has established a Bluetooth connection with the first earphone, and determine the electronic device that matches the connection information as the first earphone to be connected back If the above-mentioned master-slave attribute indicates that the first earphone is a slave earphone, determine the second earphone as the first target device to be connected back to the first earphone.
  • the first earphone after the first earphone obtains its own master-slave attribute, it can obtain the master-slave relationship between the first earphone and the second earphone from the second earphone and the electronic One of the devices is selected as the first target device to be connected back to the first earphone.
  • the first earphone can select the first target device that is easy to reconnect and has a high reconnection success rate in the current scene to perform subsequent reconnection operations, thereby improving the reliability and flexibility of the first earphone reconnection.
  • the first earphone if the above-mentioned master-slave attribute indicates that the first earphone is the master earphone, it means that the first earphone was the master earphone before the latest disconnection from the electronic device, and the second earphone originally used as the slave earphone does not It is within the communication range of the electronic device (for example, the second earphone is lost, blocked, etc.), so that when the first earphone is placed in the earphone box, and the earphone box triggers the shutdown operation, the first earphone does not have a master-slave
  • the switching of the relationship can record the master-slave attribute of the first earphone at this time as the master earphone.
  • the first earphone can obtain the connection information of the electronic device that has established a Bluetooth connection with the first earphone, and determine the electronic device that matches the connection information as The first target device to be connected back to improve the efficiency and success rate of the connection back.
  • the above connection information may include Bluetooth address information, Bluetooth channel number, etc. of the electronic device.
  • the first earphone may determine the second earphone as the first target device to be connected back, so as to further improve the efficiency and success rate of the connection back.
  • the first earphone after the first earphone determines the first target device to be connected back, it can limit the execution of the first connection back operation corresponding to the first target device within a certain period of time, so as to avoid When the connection fails, it takes too long to try to connect back to the first target device, which reduces the efficiency of the first earphone connection back. It can be understood that if the first earphone fails to successfully connect back to the first target device within the limited time period, the first earphone can try to connect back to other devices that can be connected back in subsequent steps, so as to improve the connection back as much as possible. Success rate.
  • the first earphone may send the first connection-back instruction to the first target device within a first duration (for example, 3 seconds, 5 seconds, etc.).
  • the first connection back instruction may include a connection back request, and the connection back request may include address information of the above-mentioned first target device.
  • the first target device may re-establish a Bluetooth connection with the first earphone in response to the first connection-back instruction.
  • the first earphone fails to establish a Bluetooth connection with the first target device within the first time period, perform a second reconnection operation with another device other than the first target device among the second earphone and the electronic device.
  • the first headset when the first headset fails to establish a Bluetooth connection with the first target device within the specified first time period (for example, the first target device does not respond to the above-mentioned first connection back instruction, or the first target device sends If an earphone sends a connection failure message, etc.), the first earphone may try to connect back to other devices that can be connected back.
  • the first target device is the above-mentioned electronic device.
  • the The second earphone is determined as the second target device, and a second connection back operation corresponding to the second target device (ie, the second earphone) is performed.
  • the first earphone may also send a corresponding connection-back instruction to the second earphone within a certain period of time (for example, 3 seconds, 5 seconds, etc.), so that the second earphone responds to the connection-back instruction and establishes a Bluetooth connection with the first earphone.
  • the first target device is the second earphone
  • a second connection back operation corresponding to the second target device that is, the electronic device
  • the first earphone may also send a corresponding connection-back instruction to the electronic device within a certain period of time (for example, 3 seconds, 5 seconds, etc.), so that the electronic device can respond to the connection-back instruction within the period of time, and the same as the first earphone.
  • the headset establishes a Bluetooth connection.
  • first earphone fails to establish a Bluetooth connection with the other device, perform the first connection-back operation and the second connection-back operation in turn until the target total duration is reached.
  • the first earphone if the first earphone has not successfully established a Bluetooth connection with the other device (that is, the second target device, such as the second earphone or an electronic device) within a specified period of time, the first target can be executed again.
  • the first connection back operation of the device if it still fails, the second connection back operation for the second target device can be performed again, and so on. That is to say, the first earphone can perform the above-mentioned first connection back operation and the second connection back operation in turn, so as to continuously try to connect back with the second earphone or electronic device, and increase the possibility of successful connection back of the first earphone as much as possible. sex.
  • the duration of the first earphone performing the above-mentioned first connection-back operation or the second connection-back operation may be longer than the duration of performing the second connection-back operation, or It can be shorter than the time for performing the second connection back operation, or both can be equal.
  • the total time for the first earphone to perform the above-mentioned first connection back operation and the second connection back operation in turn may also be limited, that is, the first earphone can perform the first connection back operation and the second connection back operation in turn until the target is reached.
  • the total duration (for example, 10 seconds, 15 seconds, etc.), so that the first earphone can only try a limited number of reconnection attempts for the second earphone or electronic device, so as to avoid too much time for trying to reconnect when it is really impossible to reconnect. long.
  • the first earphone can send corresponding prompt information (such as sound prompt information, light prompt information, vibration prompt information, etc.), so that the user can be reminded in time that the first earphone has failed connection back. situation, so that the user can take corresponding countermeasures against this situation, which is conducive to improving the user experience.
  • prompt information such as sound prompt information, light prompt information, vibration prompt information, etc.
  • the first earphone in the earphone device needs to connect back to the electronic device, the first earphone can flexibly select a different first target device according to its master-slave attribute. Connect back, to adapt to the application scenario where the first earphone is located as much as possible, improve the success rate of the first earphone to connect back to the first target device, and shorten the time required for the connection back, and then can indirectly or directly realize the connection with the electronic device
  • the back connection of the earphone effectively improves the reliability and flexibility of the headphone back connection electronic equipment.
  • FIG. 5 is a schematic flowchart of another Bluetooth connection method disclosed in the embodiment of the present application. This method can be applied to the first earphone of the above-mentioned earphone device, and the earphone device can also include a second earphone. As shown in Figure 5, the Bluetooth connection method may include the following steps:
  • step 502 is similar to the above-mentioned step 302 and will not be repeated here.
  • the master-slave attribute indicates that the first earphone is the master earphone, obtain the connection information of the electronic device that has established a Bluetooth connection with the first earphone, and determine the electronic device that matches the connection information as the first earphone to be connected back The first target device.
  • step 504 is similar to step 304 above. It should be noted that step 504 is only for the case where the above-mentioned master-slave attribute indicates that the first earphone is the master earphone. At this time, the first earphone can determine the above-mentioned electronic device as the first target device, and the subsequent steps are only for the first target device. Elaborate on the case of electronic equipment. For the case that the first earphone is the slave earphone, it has been described in the above step 304, and will not be repeated here.
  • step 506 is similar to the above-mentioned step 306 and will not be repeated here.
  • connection failure information includes information that the electronic device has established a Bluetooth connection with the second earphone.
  • the second connection back operation corresponding to the second earphone may be performed to Try to reconnect the second headset.
  • the reason why the first earphone fails to connect back to the electronic device may be that a connection failure message sent by the electronic device to the first earphone is received.
  • the electronic device has established a Bluetooth connection with the second earphone (for example, the first earphone was switched from the master earphone to the slave earphone when the first earphone was disconnected from the electronic device last time, and the second earphone that was originally the slave earphone was switched to the master earphone, and maintain the Bluetooth connection with the electronic device), when the electronic device receives the first connection back instruction sent by the first earphone, since the first earphone and the second earphone have the same address information, the electronic device cannot Then establish a Bluetooth connection with the first earphone, so that corresponding connection failure information can be sent to the first earphone, and the connection failure information can include information that the above-mentioned electronic device has established a Bluetooth connection with the second earphone.
  • the first earphone may send a second connection back instruction to the second earphone, so that the second earphone responds to the second connection back instruction and establishes a Bluetooth connection with the first earphone.
  • the first earphone can be used as a slave earphone to monitor the data transmission between the second earphone and the electronic device, so as to achieve communication with the electronic device. Indirect connection of the device; in some other embodiments, the first earphone can also switch the master-slave relationship with the second earphone, and reconnect directly with the electronic device as the master earphone to realize the connection back.
  • the first earphone successfully establishes a Bluetooth connection with the electronic device within the first period of time, within the second period of time, send a third connection-back instruction to the second earphone, so that the second earphone responds to the third connection-back instruction, Establish a Bluetooth connection with the first headset.
  • step 510 can be paralleled with the above-mentioned step 508, respectively representing two different situations that the first earphone successfully connects back to the electronic device within the first time period, and the first earphone is refused to connect back by the electronic device. It can be understood that step 510 may also be performed immediately after step 506 .
  • the first earphone if the first earphone successfully establishes a Bluetooth connection with the electronic device within the first time period, the first earphone can serve as the main earphone and continue to connect back to the second earphone.
  • the first earphone may send a third connection-back instruction to the second earphone within a second duration (such as 3 seconds, 5 seconds, etc.), and the second earphone may respond to the third connection-back instruction upon receiving the third connection-back instruction.
  • connection-back command establishes a Bluetooth connection with the first earphone, and serves as a slave earphone to monitor the data transmission between the first earphone and the electronic device.
  • the first earphone can stop sending the above-mentioned third connection-back command.
  • the first earphone fails to establish a Bluetooth connection with the second earphone within the second period of time, it may also stop sending the above-mentioned third connection back command to reduce power consumption and prolong battery life.
  • the first earphone in the earphone device needs to connect back to the electronic device, the first earphone can flexibly select a different first target device according to its master-slave attribute. Connect back, to adapt to the application scenario where the first earphone is located as much as possible, improve the success rate of the first earphone to connect back to the first target device, and shorten the time required for the connection back, and then can indirectly or directly realize the connection with the electronic device
  • the back connection of the earphone effectively improves the reliability and flexibility of the headphone back connection electronic equipment.
  • the first earphone can perform different follow-up reconnection operations according to whether the reconnection to the electronic device succeeds or fails, so as to flexibly realize the complete reconnection process and help improve the performance of a single earphone. Efficiency and success of connecting back electronic devices.
  • FIG. 6 is a sequence diagram of a Bluetooth connection method disclosed in the embodiment of the present application. This method can be applied to a Bluetooth communication system composed of the above-mentioned earphone device and electronic equipment, wherein the earphone device can include The first earphone and the second earphone. As shown in Figure 6, the Bluetooth connection method may include the following steps:
  • the master-slave attribute above indicates that the first earphone is the master earphone, obtain the connection information of the electronic device that has established a Bluetooth connection with the first earphone, and determine the electronic device that matches the connection information as the first earphone to be connected back to The first target device.
  • the second earphone determines the second earphone as the first target device to be connected back to the first earphone.
  • step 604A and step 604B are parallel, and the first target device that is easy to reconnect and has a high success rate of reconnection can be adaptively selected according to different situations of the master-slave attribute of the first earphone as master earphone or slave earphone.
  • the first earphone fails to establish a Bluetooth connection with the electronic device within the first time period, perform a second connection back operation corresponding to the second earphone.
  • the first earphone fails to establish a Bluetooth connection with the second earphone within the first period of time, perform a second connection back operation corresponding to the electronic device.
  • step 608A and step 608B are parallel, and the second reconnection operation after the first earphone fails to reconnect to the first target device can be performed for different situations in which the first target device is an electronic device or a second earphone, that is, to The second target device (the second earphone or the electronic device) sends a second connection-back instruction, so that the second target device responds to the second connection-back instruction and establishes a Bluetooth connection with the first earphone.
  • the reason why the first earphone fails to connect back to the electronic device may be that the connection failure information sent by the electronic device to the first earphone is received.
  • the first earphone After receiving the above connection failure information, the first earphone immediately A second connection-back instruction can be sent to the second earphone, so that the second earphone can establish a Bluetooth connection with the first earphone in response to the second connection-back instruction.
  • the first earphone successfully establishes a Bluetooth connection with the electronic device within the first time period, within the second time period, send a third connection back command to the second earphone, so that the second earphone responds to the third connection back command, Establish a Bluetooth connection with the first headset.
  • step 610 is only for the case where the first target device is an electronic device.
  • the first target device is the second earphone
  • the first earphone if it successfully connects back to the second earphone within the first time period, it can be used as a slave earphone to achieve an indirect connection with the electronic device, or switch to the second earphone
  • the master-slave relationship between them, as the master earphone, is directly connected to the electronic device to realize the connection back.
  • the first earphone in the earphone device needs to connect back to the electronic device, the first earphone can flexibly select a different first target device according to its master-slave attribute. Connect back, to adapt to the application scenario where the first earphone is located as much as possible, improve the success rate of the first earphone to connect back to the first target device, and shorten the time required for the connection back, and then can indirectly or directly realize the connection with the electronic device
  • the back connection of the earphone effectively improves the reliability and flexibility of the headphone back connection electronic equipment.
  • Fig. 7 is a schematic modular diagram of a bluetooth connection device disclosed in the embodiment of the present application, the bluetooth connection device can be applied to the first earphone of the above-mentioned earphone device, and the earphone device can also include a second earphone.
  • the Bluetooth connection device may include a first determination unit 701, a second determination unit 702, and a connection back unit 703, wherein:
  • the first determination unit 701 is configured to determine the master-slave attribute of the first earphone when the first earphone is in the connection-back state, wherein the master-slave attribute is used to indicate the master-slave attribute between the first earphone and the second earphone. From the relationship;
  • the second determination unit 702 is configured to determine the first target device to be connected back to the first earphone according to the above-mentioned master-slave attribute, and the first target device includes the above-mentioned second earphone, or an electronic device that has established a Bluetooth connection with the first earphone ;
  • the connection back unit 703 is configured to perform a first connection back operation corresponding to the first target device, so that the first earphone establishes a Bluetooth connection with the first target device.
  • the first earphone when the first earphone in the earphone device is in the reconnection state and needs to be connected back to the electronic device, the first earphone can flexibly select different The first target device (which may include the above-mentioned second earphone or electronic device) is connected back, so as to adapt to the application scenario where the first earphone is located as much as possible, improve the success rate of the first earphone to connect back to the first target device, and shorten the The time required to connect back. No matter what kind of first target device the first earphone establishes a Bluetooth connection with, it can be indirectly or directly connected back to the electronic device, thereby effectively improving the reliability and flexibility of the connection between the earphone and the electronic device.
  • the first target device which may include the above-mentioned second earphone or electronic device
  • the above-mentioned first determination unit 701 can specifically be used for when the first earphone is placed in the earphone box, when the earphone box is in the state of triggering the opening operation, if the second earphone is not placed in the In the earphone box, the master-slave attribute of the first earphone is obtained.
  • the above-mentioned first determination unit 701 may be specifically configured to obtain the master-slave attribute of the first earphone recorded when the earphone box is in a state of triggering a shutdown operation.
  • the above-mentioned second determination unit 702 may be specifically configured to:
  • the master-slave attribute indicates that the first earphone is the master earphone, obtain the connection information of the electronic device that has established a Bluetooth connection with the first earphone, and determine the electronic device that matches the connection information as the first earphone to be connected back to. a target device;
  • the second earphone is determined as the first target device to be connected back to the first earphone.
  • connection unit 703 may include a first connection subunit and a second connection subunit not shown, wherein:
  • the first connection-back subunit is configured to send a first connection-back instruction to the first target device within a first time period, so that the first target device responds to the first connection-back instruction and establishes a Bluetooth connection with the first earphone;
  • the second connection subunit is configured to communicate with the second earphone and the electronic device except the first target device in the case that the first earphone fails to establish a Bluetooth connection with the first target device within the first time period.
  • the other device performs a second connection back operation.
  • the first target terminal may include the above-mentioned electronic device, and the above-mentioned second connection-back subunit may be specifically configured to, in the case of receiving the connection failure information sent by the electronic device to the first earphone, send the The second earphone sends a second connection-back instruction, so that the second earphone responds to the second connection-back instruction and establishes a Bluetooth connection with the first earphone, wherein the connection failure information includes information that the electronic device has established a Bluetooth connection with the second earphone .
  • the above-mentioned second connection-back subunit can also be used to, after the first connection-back subunit sends the first connection-back instruction to the first target device, if the first earphone is within the first duration After successfully establishing a Bluetooth connection with the electronic device, within a second time period, a third connection-back instruction is sent to the second earphone, so that the second earphone responds to the third connection-back instruction and establishes a Bluetooth connection with the first earphone.
  • connection back unit 703 may also be configured to make the first connection subunit perform the first connection back operation in turn when the first earphone fails to establish a Bluetooth connection with the other device, And make the second connection back subunit execute the second connection back operation until the total target duration is reached.
  • the above-mentioned first determination unit 701 can also be specifically configured to, when the first earphone and the second earphone are both placed in the earphone box, when the earphone box is in the state of triggering the opening operation, then by The first earphone is connected back to the second earphone, so that the first earphone and the second earphone establish a Bluetooth connection; and, the master earphone is determined from the first earphone and the second earphone.
  • connection back unit 703 can specifically be used for the connection back between the above-mentioned main earphone and the electronic device.
  • the first earphone in the earphone device when the first earphone in the earphone device needs to connect back to the electronic device, the first earphone can flexibly select a different first target device according to its master-slave attribute. Connect back, to adapt to the application scenario where the first earphone is located as much as possible, improve the success rate of the first earphone to connect back to the first target device, and shorten the time required for the connection back, and then can indirectly or directly realize the connection with the electronic device
  • the back connection of the earphone effectively improves the reliability and flexibility of the headphone back connection electronic equipment.
  • the first earphone can perform different subsequent reconnection operations according to whether the reconnection to the electronic device succeeds or fails, so as to flexibly realize the complete reconnection process and help improve the performance of a single earphone. Efficiency and success of connecting back electronic devices.
  • FIG. 8 is a schematic modular diagram of an earphone disclosed in an embodiment of the present application.
  • the audio output device may include:
  • a memory 801 storing executable program codes
  • processor 802 coupled to the memory 801;
  • the processor 802 invokes the executable program code stored in the memory 801 to execute all or part of the steps in any Bluetooth connection method applied to the first earphone described in the above embodiments.
  • the embodiment of the present application further discloses a computer-readable storage medium, which stores a computer program for electronic data exchange, wherein the computer program enables the computer to execute any one of the audio output described in the above-mentioned embodiments. All or part of the steps in the Bluetooth connection method of the device, the first terminal device or the second terminal device.
  • the embodiment of the present application further discloses a computer program product.
  • the computer program product When the computer program product is run on a computer, the computer can execute all or part of the steps in any Bluetooth connection method described in the above embodiments.
  • ROM read-only Memory
  • RAM random access memory
  • PROM programmable read-only memory
  • EPROM Erasable Programmable Read Only Memory
  • OTPROM One-time Programmable Read-Only Memory
  • EEPROM Electronically Erasable Programmable Read-Only Memory
  • CD-ROM Compact Disc Read-Only Memory

Abstract

A Bluetooth connection method and apparatus, an earphone, and a storage medium. The method is applied to a first earphone in an earphone device; the earphone device further comprises a second earphone; and the method comprises: determining a master-slave attribute of the first earphone when the first earphone is in a reconnected state, wherein the master-slave attribute is used for representing the master-slave relationship between the first earphone and the second earphone; determining, according to the master-slave attribute, a first target device to be reconnected to the first earphone, wherein the first target device can comprise the second earphone, or an electronic device that has established a Bluetooth connection with the first earphone; and executing a first reconnection operation corresponding to the first target device, such that the first earphone establishes a Bluetooth connection with the first target device. By implementing embodiments of the present application, the reliability and flexibility of the connection between an earphone and the electronic device can be improved.

Description

蓝牙连接方法及装置、耳机、存储介质Bluetooth connection method and device, earphone, storage medium
本申请要求于2021年10月13日提交、申请号为202111190922.X、发明名称为“蓝牙连接方法及装置、耳机、存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application filed on October 13, 2021, with the application number 202111190922.X, and the title of the invention is "Bluetooth connection method and device, earphone, storage medium", the entire content of which is incorporated herein by reference Applying.
技术领域technical field
本申请涉及蓝牙通信技术领域,尤其涉及一种蓝牙连接方法及装置、耳机、存储介质。The present application relates to the technical field of bluetooth communication, in particular to a bluetooth connection method and device, an earphone, and a storage medium.
背景技术Background technique
当前,用户在使用电子设备(例如智能手机、平板电脑、智能可穿戴设备等)时,通常可以将电子设备与耳机配对连接,以使用相应的耳机功能。而在后续再次使用该耳机时,该耳机可以直接回连电子设备,以加快连接电子设备的速度。然而,在实践中发现,当耳机需要回连电子设备的时候,常常容易出现回连缓慢甚至失败的情况,以至于最终可能无法成功连接电子设备,大大降低了耳机回连电子设备的可靠性及灵活性。Currently, when using an electronic device (such as a smart phone, a tablet computer, a smart wearable device, etc.), a user can usually pair and connect the electronic device with an earphone to use the corresponding earphone function. When the earphone is used again later, the earphone can be directly connected back to the electronic device to speed up the connection to the electronic device. However, in practice, it has been found that when the headset needs to connect back to the electronic device, it is often prone to slow or even failure to connect back to the electronic device, so that it may not be able to successfully connect to the electronic device in the end, which greatly reduces the reliability and reliability of the headset's connection back to the electronic device. flexibility.
发明内容Contents of the invention
本申请实施例公开了一种蓝牙连接方法及装置、耳机、存储介质,能够提升耳机与电子设备连接的可靠性及灵活性。The embodiment of the present application discloses a Bluetooth connection method and device, an earphone, and a storage medium, which can improve the reliability and flexibility of connecting an earphone to an electronic device.
本申请实施例第一方面公开一种蓝牙连接方法,应用于耳机设备中的第一耳机,所述耳机设备还包括第二耳机,所述方法包括:The first aspect of the embodiment of the present application discloses a Bluetooth connection method, which is applied to the first earphone in the earphone device, and the earphone device also includes a second earphone. The method includes:
在所述第一耳机处于回连状态的情况下,确定所述第一耳机的主从属性,其中,所述主从属性用于表示所述第一耳机与所述第二耳机之间的主从关系;When the first earphone is in the connection back state, determine the master-slave attribute of the first earphone, where the master-slave attribute is used to indicate the master-slave property between the first earphone and the second earphone From the relationship;
根据所述主从属性,确定所述第一耳机待回连的第一目标设备,所述第一目标设备包括所述第二耳机,或与所述第一耳机建立过蓝牙连接的电子设备;According to the master-slave attribute, determine a first target device to be connected back to the first earphone, where the first target device includes the second earphone, or an electronic device that has established a Bluetooth connection with the first earphone;
执行与所述第一目标设备对应的第一回连操作,以使所述第一耳机与所述第一目标设备建立蓝牙连接。Executing a first connection back operation corresponding to the first target device, so that the first earphone establishes a Bluetooth connection with the first target device.
本申请实施例第二方面公开一种蓝牙连接装置,应用于耳机设备中的第一耳机,所述耳机设备还包括第二耳机,所述蓝牙连接装置包括:The second aspect of the embodiment of the present application discloses a Bluetooth connection device, which is applied to the first earphone in the earphone device, and the earphone device also includes a second earphone, and the Bluetooth connection device includes:
第一确定单元,用于在所述第一耳机处于回连状态的情况下,确定所述第一耳机的主从属性,其中,所述主从属性用于表示所述第一耳机与所述第二耳机之间的主从关系;The first determining unit is configured to determine the master-slave attribute of the first earphone when the first earphone is in the connection-back state, wherein the master-slave attribute is used to indicate that the first earphone is connected to the Master-slave relationship between the second headset;
第二确定单元,用于根据所述主从属性,确定所述第一耳机待回连的第一目标设备,所述第一目标设备包括所述第二耳机,或与所述第一耳机建立过蓝牙连接的电子设备;The second determination unit is configured to determine a first target device to be connected back to the first earphone according to the master-slave attribute, the first target device includes the second earphone, or is established with the first earphone Electronic devices connected via Bluetooth;
回连单元,用于执行与所述第一目标设备对应的第一回连操作,以使所述第一耳机与所述第一目标设备建立蓝牙连接。A connection-back unit, configured to perform a first connection-back operation corresponding to the first target device, so as to establish a Bluetooth connection between the first earphone and the first target device.
本申请实施例第三方面公开了一种耳机,包括存储器及处理器,所述存储器中存储有计算机程序,所述计算机程序被所述处理器执行时,使得所述处理器实现如本申请实施例第一方面公开的任意一种蓝牙连接方法中的全部或部分步骤。The third aspect of the embodiment of the present application discloses an earphone, including a memory and a processor, the memory stores a computer program, and when the computer program is executed by the processor, the processor realizes the implementation of the present application. For example, all or part of the steps in any Bluetooth connection method disclosed in the first aspect.
本申请实施例第四方面公开了一种计算机可读存储介质,其存储计算机程序,其中,所述计算机程序被处理器执行时实现如本申请实施例第一方面公开的任意一种蓝牙连接方法中的全部或部分步骤。The fourth aspect of the embodiment of the present application discloses a computer-readable storage medium, which stores a computer program, wherein, when the computer program is executed by a processor, any Bluetooth connection method as disclosed in the first aspect of the embodiment of the present application is implemented All or some of the steps in .
本申请的一个或多个实施例的细节在下面的附图和描述中提出。本申请的其它特征和有益效果将从说明书、附图以及权利要求书中体现。The details of one or more embodiments of the application are set forth in the accompanying drawings and the description below. Other features and beneficial effects of the present application will appear from the description, drawings and claims.
附图说明Description of drawings
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例中所需要使用的附图进行简单的介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其它的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present application, the accompanying drawings that need to be used in the embodiments will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present application. For Those of ordinary skill in the art can also obtain other drawings based on these drawings without making creative efforts.
图1是本申请实施例公开的蓝牙连接方法的一种应用场景示意图;FIG. 1 is a schematic diagram of an application scenario of the Bluetooth connection method disclosed in the embodiment of the present application;
图2是本申请实施例公开的一种蓝牙连接方法的流程示意图;Fig. 2 is a schematic flow chart of a Bluetooth connection method disclosed in the embodiment of the present application;
图3是本申请实施例公开的另一种蓝牙连接方法的流程示意图;FIG. 3 is a schematic flowchart of another Bluetooth connection method disclosed in the embodiment of the present application;
图4A是本申请实施例公开的一种耳机盒触发开启操作的示意图;Fig. 4A is a schematic diagram of an earphone box triggering and opening operation disclosed in an embodiment of the present application;
图4B是图4A所示的耳机盒触发关闭操作的示意图;FIG. 4B is a schematic diagram of the triggering and closing operation of the earphone box shown in FIG. 4A;
图5是本申请实施例公开的又一种蓝牙连接方法的流程示意图;FIG. 5 is a schematic flowchart of another Bluetooth connection method disclosed in the embodiment of the present application;
图6是本申请实施例公开的一种蓝牙连接方法的时序图;FIG. 6 is a sequence diagram of a Bluetooth connection method disclosed in an embodiment of the present application;
图7是本申请实施例公开的一种蓝牙连接装置的模块化示意图;Fig. 7 is a schematic modular diagram of a bluetooth connection device disclosed in the embodiment of the present application;
图8是本申请实施例公开的一种耳机的模块化示意图。Fig. 8 is a schematic modular diagram of an earphone disclosed in an embodiment of the present application.
具体实施方式Detailed ways
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整的描述,显然,所描述的实施例仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其它实施例,都属于本申请保护的范围。The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of them. Based on the embodiments in this application, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the scope of protection of this application.
需要说明的是,本申请实施例的术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、系统、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。It should be noted that the terms "comprising" and "having" and any variations thereof in the embodiments of the present application are intended to cover non-exclusive inclusion, for example, a process, method, system, product, or process that includes a series of steps or units. The apparatus is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to the process, method, product or apparatus.
本申请实施例公开了一种蓝牙连接方法及装置、耳机、存储介质,能够提升耳机与电子设备连接的可靠性及灵活性。The embodiment of the present application discloses a Bluetooth connection method and device, an earphone, and a storage medium, which can improve the reliability and flexibility of connecting an earphone to an electronic device.
以下将结合附图进行详细描述。A detailed description will be given below in conjunction with the accompanying drawings.
请参阅图1,图1是本申请实施例公开的蓝牙连接方法的一种应用场景示意图。如图1所示,该应用场景可以包括耳机设备10以及电子设备20,其中,耳机设备10可以包括第一耳机11和第二耳机12,该第一耳机11和第二耳机12可以成对设置(例如分别为左耳耳机和右耳耳机)。在该耳机设备10首次与电子设备20进行连接时,通常需要将该耳机设备10与电子设备20进行配对,以使两者之间建立蓝牙连接。在此基础上,当后续再次使用该耳机设备10时,该耳机设备10可以根据上一次连接电子设备20时所记录的该电子设备20的地址信息,自动与该电子设备20建立蓝牙连接(即“回连”),从而无需重新进行配对的过程。Please refer to FIG. 1 . FIG. 1 is a schematic diagram of an application scenario of the Bluetooth connection method disclosed in the embodiment of the present application. As shown in Figure 1, the application scenario may include a headset device 10 and an electronic device 20, wherein the headset device 10 may include a first headset 11 and a second headset 12, and the first headset 11 and the second headset 12 may be arranged in pairs (e.g. left earphone and right earphone respectively). When the earphone device 10 is connected to the electronic device 20 for the first time, it is usually necessary to pair the earphone device 10 with the electronic device 20 to establish a Bluetooth connection between the two. On this basis, when the earphone device 10 is used again subsequently, the earphone device 10 can automatically establish a bluetooth connection with the electronic device 20 according to the address information of the electronic device 20 recorded when the electronic device 20 was connected last time (i.e. "connect back"), so that there is no need to re-pair the process.
需要说明的是,回连可以指第一电子设备通过寻呼的方式尝试与之前配对且连接过的第二电子设备重新进行连接的操作。具体地,第一电子设备可以向第二电子设备发送page包(一种蓝牙连接请求),该page包可用于连接或激活该第二电子设备,以使第一电子设备可以建立与该第二电子设备之间的通信连接。其中,上述page包可以包含第二电子设备的蓝牙地址信息,从而可以直接传呼该第二电子设备。It should be noted that the connection back may refer to an operation in which the first electronic device attempts to reconnect with the previously paired and connected second electronic device by means of paging. Specifically, the first electronic device can send a page packet (a Bluetooth connection request) to the second electronic device, and the page packet can be used to connect or activate the second electronic device, so that the first electronic device can establish a connection with the second electronic device. A communication link between electronic devices. Wherein, the above page packet may contain Bluetooth address information of the second electronic device, so that the second electronic device may be paged directly.
具体地,上述耳机设备10包括的第一耳机11和第二耳机12,其中一者可以作为主耳机,另一者则可以作为从耳机。需要说明的是,主耳机可以用于与其建立蓝牙连接的电子设备20进行基于该蓝牙连接的数据传输,同时主耳机还可以将上述蓝牙连接信息同步至从耳机, 以使从耳机可以监听主耳机与电子设备20之间的数据传输,从而可以实现主耳机和从耳机之间的音频数据同步。Specifically, the earphone device 10 includes the first earphone 11 and the second earphone 12, one of which can be used as a master earphone, and the other can be used as a slave earphone. It should be noted that the master earphone can be used for data transmission based on the bluetooth connection with the electronic device 20 established with it, and at the same time, the master earphone can also synchronize the above bluetooth connection information to the slave earphone, so that the slave earphone can monitor the master earphone Data transmission with the electronic device 20, so that the audio data synchronization between the master earphone and the slave earphone can be realized.
示例性地,如图1所示,第一耳机11可以作为主耳机,与电子设备20直接连接;而第二耳机12则可以作为从耳机,与作为主耳机的第一耳机11进行连接。在实际使用耳机设备10的过程中,第一耳机11和第二耳机12之间的主从关系可以根据场景变换和/或用户设置而随时切换,即第一耳机11也可以作为从耳机,同时第二耳机12作为主耳机来使用。可选地,上述第一耳机11和第二耳机12也可以不区分主从关系,即电子设备20可以同时分别与第一耳机11和第二耳机12建立蓝牙连接。可选地,上述蓝牙连接可以是基于经典蓝牙协议(例如由蓝牙技术联盟Bluetooth SIG制定的蓝牙4.0等版本的协议)实现的,也可以基于蓝牙低功耗(Bluetooth Low Energy,BLE)协议(例如蓝牙5.0等版本的协议)实现的,本申请实施例中不作具体限定。Exemplarily, as shown in FIG. 1 , the first earphone 11 can be used as a master earphone and directly connected to the electronic device 20 ; while the second earphone 12 can be used as a slave earphone and connected to the first earphone 11 as a master earphone. In the process of actually using the earphone device 10, the master-slave relationship between the first earphone 11 and the second earphone 12 can be switched at any time according to scene changes and/or user settings, that is, the first earphone 11 can also be used as a slave earphone, and at the same time The second earphone 12 is used as the main earphone. Optionally, the first earphone 11 and the second earphone 12 may not distinguish the master-slave relationship, that is, the electronic device 20 may establish a Bluetooth connection with the first earphone 11 and the second earphone 12 respectively at the same time. Optionally, the above-mentioned bluetooth connection can be realized based on the classic bluetooth protocol (such as bluetooth 4.0 and other versions formulated by the bluetooth technology alliance bluetooth SIG), and can also be based on the bluetooth low energy (bluetooth low energy, BLE) protocol (for example Bluetooth 5.0 and other versions of the protocol), which are not specifically limited in this embodiment of the present application.
在本申请实施例中,在第一耳机11处于回连状态的情况下,该第一耳机11可以先确定其自身的主从属性,其中,主从属性可以用于表示该第一耳机11与第二耳机12之间的主从关系(即该第一耳机11作为主耳机或从耳机)。进一步地,根据上述主从属性,第一耳机11可以确定其待回连的第一目标设备,该第一目标设备可以包括上述第二耳机12,或者与该第一耳机11建立过蓝牙连接的上述电子设备20。在此基础上,第一耳机11可以执行与上述第一目标设备对应的第一回连操作,以使该第一耳机11与上述第一目标设备建立蓝牙连接。可以理解,上述第一耳机11和第二耳机12可以互换,不影响上述蓝牙连接方法的实现。In the embodiment of the present application, when the first earphone 11 is in the connection back state, the first earphone 11 can first determine its own master-slave attribute, where the master-slave attribute can be used to indicate that the first earphone 11 is connected to The master-slave relationship between the second earphones 12 (that is, the first earphone 11 acts as the master earphone or the slave earphone). Further, according to the above-mentioned master-slave attribute, the first earphone 11 can determine the first target device to be connected back to, and the first target device can include the second earphone 12 mentioned above, or a device that has established a Bluetooth connection with the first earphone 11 The aforementioned electronic device 20 . On this basis, the first earphone 11 may perform a first connection back operation corresponding to the first target device, so that the first earphone 11 establishes a Bluetooth connection with the first target device. It can be understood that the above-mentioned first earphone 11 and the second earphone 12 can be interchanged without affecting the realization of the above-mentioned Bluetooth connection method.
通过实施上述方法,当耳机设备10中的第一耳机11处于回连状态,需要回连电子设备20的时候,该第一耳机11可以根据其主从属性,灵活地选择不同的第一目标设备(可以包括上述第二耳机12或电子设备20)进行回连,以尽可能适应该第一耳机11所处的应用场景,提升该第一耳机11回连第一目标设备的成功率,同时也有助于缩短回连所需的时间。无论第一耳机11与何种第一目标设备建立蓝牙连接,均可间接或直接实现与电子设备20的回连,从而能够有效提升耳机设备10与电子设备20连接的可靠性及灵活性。示例性地,若第一耳机11为主耳机,则该第一耳机11可以选择电子设备20作为第一目标设备,以直接实现与该电子设备20的回连;若第一耳机11为从耳机,则该第一耳机11可以选择第二耳机12作为第一目标设备,以先回连作为主耳机的第二耳机12,再通过该第二耳机12间接实现与电子设备20的回连。By implementing the above method, when the first earphone 11 in the earphone device 10 is in the reconnection state and needs to be reconnected to the electronic device 20, the first earphone 11 can flexibly select different first target devices according to its master-slave attributes (may include the above-mentioned second earphone 12 or electronic device 20) to connect back, to adapt to the application scene where the first earphone 11 is located as much as possible, improve the success rate of the first earphone 11 to connect back to the first target device, and also have Helps shorten the time it takes to connect back. No matter what kind of first target device the first earphone 11 establishes a Bluetooth connection with, it can indirectly or directly realize the connection back to the electronic device 20 , thereby effectively improving the reliability and flexibility of the connection between the earphone device 10 and the electronic device 20 . For example, if the first earphone 11 is the master earphone, then the first earphone 11 can select the electronic device 20 as the first target device to directly realize the connection back with the electronic device 20; if the first earphone 11 is the slave earphone , then the first earphone 11 can select the second earphone 12 as the first target device, so as to first connect back to the second earphone 12 as the main earphone, and then indirectly realize the back-connection with the electronic device 20 through the second earphone 12 .
示例性地,上述电子设备20可以包括具备蓝牙通信功能的各类设备或系统,如手机、智能可穿戴设备、车载终端、平板电脑、PC(Personal Computer,个人电脑)、PDA(Personal Digital Assistant,个人数字助理)等,本申请实施例中不作具体限定。需要说明的是,图1所示的电子设备20为手机,这仅仅是一种示例,不构成本申请实施例中对电子设备20的设备类型的限定。示例性,上述耳机设备20可以包括各类蓝牙耳机,尤其可以包括TWS(True Wireless Stereo,真无线立体声)耳机。Exemplarily, the above-mentioned electronic device 20 may include various devices or systems with bluetooth communication functions, such as mobile phones, smart wearable devices, vehicle-mounted terminals, tablet computers, PCs (Personal Computers, personal computers), PDAs (Personal Digital Assistants, personal digital assistant), etc., are not specifically limited in this embodiment of the application. It should be noted that the electronic device 20 shown in FIG. 1 is a mobile phone, which is only an example and does not constitute a limitation on the type of the electronic device 20 in the embodiment of the present application. Exemplarily, the above-mentioned earphone device 20 may include various types of Bluetooth earphones, especially TWS (True Wireless Stereo, true wireless stereo) earphones.
请参阅图2,图2是本申请实施例公开的一种蓝牙连接方法的流程示意图,该方法可以应用于上述耳机设备的第一耳机,该耳机设备还可以包括第二耳机。如图2所示,该蓝牙连接方法可以包括以下步骤:Please refer to FIG. 2 . FIG. 2 is a schematic flowchart of a Bluetooth connection method disclosed in an embodiment of the present application. The method can be applied to the first earphone of the above-mentioned earphone device, and the earphone device can also include a second earphone. As shown in Figure 2, the Bluetooth connection method may include the following steps:
202、在第一耳机处于回连状态的情况下,确定该第一耳机的主从属性,其中,主从属性用于表示该第一耳机与第二耳机之间的主从关系。202. When the first earphone is in the connection-back state, determine a master-slave attribute of the first earphone, where the master-slave attribute is used to indicate a master-slave relationship between the first earphone and a second earphone.
在本申请实施例中,第一耳机可以表示上述耳机设备所包含的两个耳机中的任一耳机(例如,可以为左耳耳机,也可以为右耳耳机)。当第一耳机处于回连状态的情况下,该第一耳机需要与其建立过蓝牙连接的电子设备重新连接,即回连该电子设备。在一些场景中,第一耳机可以直接回连电子设备,在另一些场景中则可能无法直接回连,例如电子设备所 处的位置超出第一耳机的通信范围、电子设备已经与第二耳机或其他耳机设备连接等。为了适应不同的应用场景,处于回连状态下的第一耳机可以根据其主从属性(即该第一耳机在上述耳机设备中作为主耳机或从耳机),从上述第二耳机以及电子设备中,选择合适的第一目标设备,以便于在后续步骤中执行与该第一目标设备对应的回连操作,避免在无法直接回连电子设备的场景中仍指定该电子设备进行回连,进而导致回连缓慢甚至失败的情况出现。In the embodiment of the present application, the first earphone may refer to any one of the two earphones included in the above-mentioned earphone device (for example, it may be a left-ear earphone or a right-ear earphone). When the first earphone is in the connection back state, the first earphone needs to be reconnected to the electronic device with which the bluetooth connection has been established, that is, to be connected back to the electronic device. In some scenarios, the first earphone can directly connect back to the electronic device, but in other scenarios, it may not be able to directly connect back. Other headphone equipment connection, etc. In order to adapt to different application scenarios, the first earphone in the connection-back state can be connected from the second earphone and the electronic device according to its master-slave attribute (that is, the first earphone is used as the master earphone or the slave earphone in the earphone device). , select an appropriate first target device, so as to perform the connection back operation corresponding to the first target device in the subsequent steps, and avoid specifying the electronic device for connection back in the scenario where the electronic device cannot be directly connected back, which will lead to The connection is slow or even fails.
在一些实施例中,第一耳机可以放置在耳机盒中,当该耳机盒触发开启操作,第一耳机可以进入回连状态。示例性地,当该耳机盒被用户开启(例如具有盒盖的耳机盒被开盖、具有开启按钮的耳机盒被点击该开启按钮等)的状态下,耳机盒可以向其内部放置的第一耳机发送开启信号,以使第一耳机开机,或者从休眠状态中被唤醒,进而可以进入回连状态。In some embodiments, the first earphone can be placed in the earphone box, and when the earphone box triggers an opening operation, the first earphone can enter a reconnection state. Exemplarily, when the earphone box is opened by the user (for example, the earphone box with the cover is opened, the earphone box with the opening button is clicked on the opening button, etc.), the first earphone box can be placed inside it. The earphone sends the start signal, so that the first earphone is turned on, or wakes up from the dormant state, and then enters the reconnection state.
在另一些实施例中,当第一耳机与电子设备的连接意外中断时,该第一耳机也可以进入回连状态。示例性地,若电子设备所处的位置超出第一耳机的通信范围,或者该电子设备与第一耳机之间基于蓝牙连接的数据传输被干扰、屏蔽时,第一耳机可以自动进入回连状态,以待上述意外中断解除时可以迅速回连电子设备。In some other embodiments, when the connection between the first earphone and the electronic device is accidentally interrupted, the first earphone may also enter a reconnection state. For example, if the position of the electronic device is beyond the communication range of the first earphone, or the data transmission based on the Bluetooth connection between the electronic device and the first earphone is interfered or blocked, the first earphone can automatically enter the reconnection state , so that the electronic device can be quickly reconnected when the above-mentioned unexpected interruption is resolved.
204、根据上述主从属性,确定该第一耳机待回连的第一目标设备,该第一目标设备可以包括上述第二耳机,或与该第一耳机建立过蓝牙连接的电子设备。204. Determine a first target device to be connected back to the first earphone according to the master-slave attribute, where the first target device may include the second earphone or an electronic device that has established a Bluetooth connection with the first earphone.
在本申请实施例中,根据第一耳机与第二耳机之间的主从关系,可以对应确定该第一耳机在进入回连状态前后所处的应用场景,进而可以基于该应用场景,适应性地选择易于回连、回连成功率高的第一目标设备。示例性地,该第一目标设备可以包括上述第二耳机(即通过该第二耳机间接回连电子设备),或者与第一耳机建立过蓝牙连接的上述电子设备(即直接回连电子设备)。In the embodiment of the present application, according to the master-slave relationship between the first earphone and the second earphone, the application scenarios of the first earphone before and after entering the reconnection state can be correspondingly determined, and then based on the application scenarios, the adaptability Select the first target device that is easy to connect back and has a high success rate of connection back. Exemplarily, the first target device may include the above-mentioned second earphone (that is, indirectly connect back to the electronic device through the second earphone), or the above-mentioned electronic device that has established a Bluetooth connection with the first earphone (that is, directly connect back to the electronic device) .
在一些实施例中,若第一耳机原本为主耳机,若原本作为从耳机的第二耳机均处于电子设备的通信范围内,则当该第一耳机被放置在耳机盒中,并且耳机盒触发了关闭操作时,该第一耳机可以切换为从耳机,同时第二耳机可以切换为主耳机。在此基础上,当耳机盒触发了开启操作,以使第一耳机进入回连状态时,该第一耳机可以确定其主从属性为从耳机,进而可以根据这一主从属性确定该第一耳机待回连的第一目标设备。In some embodiments, if the first earphone is originally the master earphone, and if the second earphone originally as the slave earphone is within the communication range of the electronic device, then when the first earphone is placed in the earphone box, and the earphone box triggers When the shutdown operation is performed, the first earphone can be switched as a slave earphone, and at the same time, the second earphone can be switched as a master earphone. On this basis, when the earphone box triggers the opening operation so that the first earphone enters the reconnection state, the first earphone can determine that its master-slave attribute is a slave earphone, and then the first earphone can be determined according to this master-slave attribute. The first target device to which the headset is to be connected.
在另一些实施例中,若第一耳机原本为主耳机,若原本作为从耳机的第二耳机不处于电子设备的通信范围内(例如第二耳机丢失、被屏蔽等),则当该第一耳机被放置在耳机盒中,并且耳机盒触发了关闭操作时,该第一耳机仍被视为主耳机,而不会切换为从耳机。在此基础上,当耳机盒触发了开启操作,以使第一耳机进入回连状态时,该第一耳机可以确定其主从属性为主耳机,进而也可以根据这一主从属性确定该第一耳机待回连的第一目标设备。In some other embodiments, if the first earphone is originally the master earphone, if the second earphone originally serving as the slave earphone is not within the communication range of the electronic device (for example, the second earphone is lost, shielded, etc.), then when the first earphone When the earphone is placed in the earphone box, and the earphone box triggers the closing operation, the first earphone is still regarded as the master earphone and will not be switched to the slave earphone. On this basis, when the earphone box triggers the opening operation so that the first earphone enters the reconnection state, the first earphone can determine its master-slave attribute as the master earphone, and then also determine the second earphone according to the master-slave attribute. The first target device to which a headset is to be connected back.
可选地,当电子设备所处的位置超出第一耳机的通信范围时,该第一耳机也可以进入回连状态。由于此时第二耳机可以切换为主耳机,基于不同的切换设置,第一耳机的主从属性既可以被视为主耳机,也可以被视为从耳机,继而可以根据所确定的主从属性进一步确定该第一耳机待回连的第一目标设备。Optionally, when the position of the electronic device is beyond the communication range of the first earphone, the first earphone may also enter the connection back state. Since the second earphone can be switched as the master earphone at this time, based on different switching settings, the master-slave attribute of the first earphone can be regarded as either the master earphone or the slave earphone, and then the determined master-slave attribute can be Further determining the first target device to which the first earphone is to be connected back.
还有一些实施例中,若第一耳机原本为从耳机,则无论该第一耳机被放置在耳机盒中,还是超出电子设备的通信范围时,该第一耳机均可以确定其主从属性为从耳机,以根据该主从属性确定该第一耳机待回连的第一目标设备。In some other embodiments, if the first earphone is originally a slave earphone, no matter whether the first earphone is placed in the earphone box or exceeds the communication range of the electronic device, the first earphone can determine that its master-slave attribute is Slave the earphone to determine the first target device to be connected back to the first earphone according to the master-slave attribute.
206、执行与上述第一目标设备对应的第一回连操作,以使该第一耳机与上述第一目标设备建立蓝牙连接。206. Perform a first connection back operation corresponding to the first target device, so that the first headset establishes a Bluetooth connection with the first target device.
在本申请实施例中,第一耳机在确定出待回连的第一目标设备之后,可以针对该第一 目标设备执行相应的第一回连操作。具体地,根据第一目标设备具体为上述第二耳机或电子设备,第一耳机可以确定出该第一目标设备的地址信息,进而可以向该第一目标设备发送包含上述地址信息的回连请求。第一目标设备在接收到该回连请求后,可以响应该回连请求,重新与第一耳机建立蓝牙连接。示例性地,若第一目标设备为上述电子设备,则第一耳机可以直接实现与该电子设备的回连;若第一目标设备为上述第二耳机,则第一耳机可以先回连该第二耳机,该第二耳机再将其与电子设备的蓝牙连接信息同步至第一耳机,从而可以间接实现与电子设备的回连。In this embodiment of the application, after the first earphone determines the first target device to be connected back, it may perform a corresponding first connection back operation on the first target device. Specifically, according to the fact that the first target device is the above-mentioned second earphone or the electronic device, the first earphone can determine the address information of the first target device, and then can send a connection back request containing the above-mentioned address information to the first target device . After receiving the connection back request, the first target device may respond to the connection back request and re-establish a Bluetooth connection with the first earphone. For example, if the first target device is the above-mentioned electronic device, the first earphone can directly realize the connection back with the electronic device; if the first target device is the above-mentioned second earphone, then the first earphone can first connect back to the second The second earphone, and the second earphone synchronizes the bluetooth connection information with the electronic device to the first earphone, so as to indirectly realize the connection back with the electronic device.
可见,实施上述实施例所描述的蓝牙连接方法,当耳机设备中的第一耳机处于回连状态,需要回连电子设备的时候,该第一耳机可以根据其主从属性,灵活地选择不同的第一目标设备(可以包括上述第二耳机或电子设备)进行回连,以尽可能适应该第一耳机所处的应用场景,提升该第一耳机回连第一目标设备的成功率,同时缩短回连所需的时间。无论第一耳机与何种第一目标设备建立蓝牙连接,均可间接或直接实现与电子设备的回连,从而能够有效提升耳机与电子设备连接的可靠性及灵活性。It can be seen that, implementing the Bluetooth connection method described in the above embodiments, when the first earphone in the earphone device is in the reconnection state and needs to be connected back to the electronic device, the first earphone can flexibly select different The first target device (which may include the above-mentioned second earphone or electronic device) is connected back, so as to adapt to the application scenario where the first earphone is located as much as possible, improve the success rate of the first earphone to connect back to the first target device, and shorten the The time required to connect back. No matter what kind of first target device the first earphone establishes a Bluetooth connection with, it can be indirectly or directly connected back to the electronic device, thereby effectively improving the reliability and flexibility of the connection between the earphone and the electronic device.
请参阅图3,图3是本申请实施例公开的另一种蓝牙连接方法的流程示意图,该方法可以应用于上述耳机设备的第一耳机,该耳机设备还可以包括第二耳机。如图3所示,该蓝牙连接方法可以包括以下步骤:Please refer to FIG. 3 . FIG. 3 is a schematic flowchart of another Bluetooth connection method disclosed in an embodiment of the present application. This method can be applied to the first earphone of the above-mentioned earphone device, and the earphone device can also include a second earphone. As shown in Figure 3, the Bluetooth connection method may include the following steps:
302、在第一耳机放置在耳机盒中的情况下,当该耳机盒处于触发开启操作的状态,若第二耳机未放置在该耳机盒中,则获取第一耳机的主从属性。302. When the first earphone is placed in the earphone box, when the earphone box is in a state of triggering an opening operation, if the second earphone is not placed in the earphone box, acquire the master-slave attribute of the first earphone.
在本申请实施例中,耳机盒可以用于同时放置上述第一耳机以及第二耳机,以实现针对第一耳机和/或第二耳机的充电、开机、唤醒等功能。在一些实施例中,上述耳机盒可以具有盒盖,则用户可以通过开盖实现对该耳机盒的开启操作,通过关盖实现对该耳机盒的关闭操作。在另一些实施例中,上述耳机盒也可以具有开启按钮,则用户可以通过点击该开启按钮实现对该耳机盒的开启操作,通过点击关闭按钮(可以复用上述开启按钮)实现对该耳机盒的关闭操作。In the embodiment of the present application, the earphone box can be used to place the above-mentioned first earphone and the second earphone at the same time, so as to realize functions such as charging, powering on, and waking up of the first earphone and/or the second earphone. In some embodiments, the above-mentioned earphone box may have a box cover, and the user can realize the opening operation of the earphone box by opening the cover, and realize the closing operation of the earphone box by closing the cover. In some other embodiments, the above-mentioned earphone box can also have an open button, then the user can realize the open operation of the earphone box by clicking the open button, and realize the open operation of the earphone box by clicking the close button (the above-mentioned open button can be reused). close operation.
示例性地,以具有盒盖的耳机盒为例,请一并参阅图4A及图4B,图4A是本申请实施例公开的一种耳机盒触发开启操作,即开盖的示意图;图4B则是图4A所示的耳机盒触发关闭操作,即关盖的示意图。如图4A及图4B所示,第一耳机11和第二耳机12均可以放置在耳机盒30中。而在本申请实施例中,针对仅第一耳机11放置在耳机盒30中的情况,当该耳机盒30触发开启操作(即开盖),若第二耳机12未放置在该耳机盒30中,则第一耳机11可以获取该第一耳机11的主从属性,以用于在后续步骤中根据该主从属性选择合适的第一目标设备进行回连。Exemplarily, taking an earphone box with a box cover as an example, please refer to FIG. 4A and FIG. 4B together. FIG. 4A is a schematic diagram of triggering an opening operation of an earphone box disclosed in an embodiment of the application, that is, opening a cover; FIG. 4B is It is a schematic diagram of triggering the closing operation of the earphone box shown in FIG. 4A , that is, closing the cover. As shown in FIG. 4A and FIG. 4B , both the first earphone 11 and the second earphone 12 can be placed in the earphone box 30 . However, in the embodiment of the present application, only the first earphone 11 is placed in the earphone box 30. , then the first earphone 11 can obtain the master-slave attribute of the first earphone 11, so as to select an appropriate first target device for connection back according to the master-slave attribute in subsequent steps.
在一些实施例中,上述第一耳机的主从属性可以是由该第一耳机提前记录得到的。示例性地,在上述第一耳机放置在耳机盒中的情况下,当该耳机盒触发关闭操作(以具有盒盖的耳机盒为例,即该耳机盒被关盖),第一耳机可以记录此时该第一耳机的主从属性。在此基础上,当该耳机盒触发开启操作,若第二耳机未放置在该耳机盒中,则第一耳机可以获取耳机盒最近一次处于触发关闭操作的状态下该第一耳机所记录的其自身的主从属性。示例性地,若将第一耳机记为A耳机,第二耳机记为B耳机,则在A耳机放置在耳机盒中,而B耳机未放置在耳机盒中的情况下(即单耳入盒),耳机盒触发关闭操作,此时A耳机可以记录其自身的主从属性。在耳机盒再次触发开启操作的状态下,A耳机可以获取此前所记录的上述主从属性,进而可以根据该主从属性在后续步骤中确定出待回连的第一目标设备。In some embodiments, the above-mentioned master-slave attribute of the first earphone may be obtained by the first earphone recorded in advance. Exemplarily, when the above-mentioned first earphone is placed in the earphone box, when the earphone box triggers a closing operation (take the earphone box with a lid as an example, that is, the earphone box is closed), the first earphone can record At this time, the master-slave property of the first headset. On this basis, when the earphone box triggers the opening operation, if the second earphone is not placed in the earphone box, the first earphone can obtain other records recorded by the first earphone when the earphone box was in the state of triggering the closing operation last time. own master-slave properties. For example, if the first earphone is marked as A earphone and the second earphone is marked as B earphone, then in the case that the A earphone is placed in the earphone box, but the B earphone is not placed in the earphone box (that is, one ear into the box ), the earphone box triggers the shutdown operation, and at this time, the A earphone can record its own master-slave property. In the state where the earphone box triggers the opening operation again, the earphone A can obtain the above-mentioned master-slave attributes recorded before, and then can determine the first target device to be connected back in the subsequent steps according to the master-slave attributes.
在另一些实施例中,在上述A耳机及B耳机均放置在耳机盒中的情况下(即双耳入盒),耳机盒触发关闭操作,此时A耳机也可以记录其自身的主从属性。在耳机盒再次触发开启 操作的状态下,由于A耳机和B耳机均放置在耳机盒中,A耳机和B耳机可以先进行回连,以使两者之间建立蓝牙连接。在此基础上,可以根据A耳机所记录的主从属性,从已连接的A耳机和B耳机中确定出主耳机;也可以不考虑已记录的主从属性,重新根据预设规则在A耳机和B耳机中确定出主耳机。进一步地,可以由该主耳机与上述电子设备进行回连,以使该主耳机与电子设备建立蓝牙连接。由于A耳机和B耳机可以共享同一蓝牙地址信息,在主耳机回连上述电子设备后,主耳机可以将相应的连接信息(如电子设备的蓝牙地址信息、蓝牙信道编号等)共享至从耳机(即主耳机之外的另一耳机),以使从耳机可以监听主耳机与电子设备之间的传输数据。In some other embodiments, when the above-mentioned A earphone and B earphone are placed in the earphone box (that is, both ears are in the box), the earphone box triggers the closing operation, and at this time, the A earphone can also record its own master-slave attribute . In the state where the earphone box triggers the opening operation again, since the A earphone and the B earphone are placed in the earphone box, the A earphone and the B earphone can be connected back first, so that a Bluetooth connection can be established between the two. On this basis, the master earphone can be determined from the connected earphone A and earphone B according to the master-slave attribute recorded by earphone A; and B earphone to determine the main earphone. Further, the main earphone can be connected back to the electronic device, so that the main earphone can establish a Bluetooth connection with the electronic device. Since earphone A and earphone B can share the same bluetooth address information, after the master earphone is connected back to the above-mentioned electronic device, the master earphone can share the corresponding connection information (such as the bluetooth address information of the electronic device, the bluetooth channel number, etc.) to the slave earphone ( That is, another earphone other than the master earphone), so that the slave earphone can monitor the transmission data between the master earphone and the electronic device.
304、若上述主从属性表示第一耳机为主耳机,获取与该第一耳机建立过蓝牙连接的电子设备对应的连接信息,并将符合该连接信息的电子设备确定为第一耳机待回连的第一目标设备;若上述主从属性表示第一耳机为从耳机,将第二耳机确定为该第一耳机待回连的第一目标设备。304. If the above-mentioned master-slave attribute indicates that the first earphone is the master earphone, obtain the connection information corresponding to the electronic device that has established a Bluetooth connection with the first earphone, and determine the electronic device that matches the connection information as the first earphone to be connected back If the above-mentioned master-slave attribute indicates that the first earphone is a slave earphone, determine the second earphone as the first target device to be connected back to the first earphone.
在本申请实施例中,第一耳机在获取其自身的主从属性之后,可以根据该主从属性所表示的第一耳机与第二耳机之间的主从关系,从上述第二耳机以及电子设备中选择其中一者,作为该第一耳机待回连的第一目标设备。通过实施上述方法,第一耳机可以选择当前场景下易于回连、回连成功率高的第一目标设备来执行后续的回连操作,从而可以提升第一耳机回连的可靠性及灵活性。In this embodiment of the application, after the first earphone obtains its own master-slave attribute, it can obtain the master-slave relationship between the first earphone and the second earphone from the second earphone and the electronic One of the devices is selected as the first target device to be connected back to the first earphone. By implementing the above method, the first earphone can select the first target device that is easy to reconnect and has a high reconnection success rate in the current scene to perform subsequent reconnection operations, thereby improving the reliability and flexibility of the first earphone reconnection.
在一些实施例中,若上述主从属性表示第一耳机为主耳机,则说明该第一耳机在最近一次与电子设备断开连接之前即为主耳机,且原本作为从耳机的第二耳机不处于该电子设备的通信范围内(例如第二耳机丢失、被屏蔽等),从而当该第一耳机被放置在耳机盒中,并且耳机盒触发了关闭操作时,该第一耳机未发生主从关系的切换,可以记录此时该第一耳机的主从属性为主耳机。在此基础上,由于回连第二耳机失败的可能性更高,第一耳机可以获取与该第一耳机建立过蓝牙连接的电子设备的连接信息,并将符合该连接信息的电子设备确定为待回连的第一目标设备,以提升回连的效率和成功率。示例性地,上述连接信息,可以包括电子设备的蓝牙地址信息、蓝牙信道编号等。In some embodiments, if the above-mentioned master-slave attribute indicates that the first earphone is the master earphone, it means that the first earphone was the master earphone before the latest disconnection from the electronic device, and the second earphone originally used as the slave earphone does not It is within the communication range of the electronic device (for example, the second earphone is lost, blocked, etc.), so that when the first earphone is placed in the earphone box, and the earphone box triggers the shutdown operation, the first earphone does not have a master-slave The switching of the relationship can record the master-slave attribute of the first earphone at this time as the master earphone. On this basis, since the possibility of failure to connect back to the second earphone is higher, the first earphone can obtain the connection information of the electronic device that has established a Bluetooth connection with the first earphone, and determine the electronic device that matches the connection information as The first target device to be connected back to improve the efficiency and success rate of the connection back. Exemplarily, the above connection information may include Bluetooth address information, Bluetooth channel number, etc. of the electronic device.
在另一些实施例中,若上述主从属性表示第一耳机为从耳机,则说明在该第一耳机最近一次与电子设备断开连接之前,该第一耳机和原本作为从耳机的第二耳机均处于电子设备的通信范围内,从而当该第一耳机被放置在耳机盒中,并且耳机盒触发了关闭操作时,该第一耳机可以切换为从耳机(同时第二耳机可以切换为主耳机),此时可以记录该第一耳机的主从属性为从耳机。在此基础上,由于回连第二耳机成功的可能性更高,第一耳机可以将该第二耳机确定为待回连的第一目标设备,以进一步提升回连的效率和成功率。In some other embodiments, if the above-mentioned master-slave attribute indicates that the first earphone is a slave earphone, it means that before the first earphone was disconnected from the electronic device last time, the first earphone and the second earphone that was originally a slave earphone They are all within the communication range of the electronic device, so that when the first earphone is placed in the earphone box and the earphone box triggers the closing operation, the first earphone can be switched as the slave earphone (while the second earphone can be switched as the master earphone ), at this time, it can be recorded that the master-slave attribute of the first earphone is the slave earphone. On this basis, since the possibility of successful connection back to the second earphone is higher, the first earphone may determine the second earphone as the first target device to be connected back, so as to further improve the efficiency and success rate of the connection back.
306、在第一时长内,向第一目标设备发送第一回连指令,以使第一目标设备响应该第一回连指令,与第一耳机建立蓝牙连接。306. Within the first duration, send a first connection-back instruction to the first target device, so that the first target device responds to the first connection-back instruction to establish a Bluetooth connection with the first earphone.
在本申请实施例中,当第一耳机确定出待回连的第一目标设备之后,可以限制在一定的时长内执行与该第一目标设备对应的第一回连操作,以避免在可能回连失败的情况下尝试回连第一目标设备的时间过长,降低了第一耳机回连的效率。可以理解,若第一耳机在限定的时长内未能成功回连第一目标设备,则该第一耳机可以在后续步骤中尝试回连其他可回连的设备,以尽可能地提高回连的成功率。In the embodiment of the present application, after the first earphone determines the first target device to be connected back, it can limit the execution of the first connection back operation corresponding to the first target device within a certain period of time, so as to avoid When the connection fails, it takes too long to try to connect back to the first target device, which reduces the efficiency of the first earphone connection back. It can be understood that if the first earphone fails to successfully connect back to the first target device within the limited time period, the first earphone can try to connect back to other devices that can be connected back in subsequent steps, so as to improve the connection back as much as possible. Success rate.
具体地,第一耳机可以在第一时长(例如3秒、5秒等)内,向第一目标设备发送第一回连指令。示例性地,该第一回连指令可以包括回连请求,该回连请求可以包含上述第一目标设备的地址信息。在此基础上,当第一目标设备接收到该第一回连指令之后,可以响应该第一回连指令,重新与第一耳机建立蓝牙连接。Specifically, the first earphone may send the first connection-back instruction to the first target device within a first duration (for example, 3 seconds, 5 seconds, etc.). Exemplarily, the first connection back instruction may include a connection back request, and the connection back request may include address information of the above-mentioned first target device. On this basis, after receiving the first connection-back instruction, the first target device may re-establish a Bluetooth connection with the first earphone in response to the first connection-back instruction.
308、若第一耳机在第一时长内未成功与第一目标设备建立蓝牙连接,则与上述第二耳 机和电子设备中,除第一目标设备外的另一设备执行第二回连操作。308. If the first earphone fails to establish a Bluetooth connection with the first target device within the first time period, perform a second reconnection operation with another device other than the first target device among the second earphone and the electronic device.
在本申请实施例中,当第一耳机在规定的第一时长内未成功与第一目标设备建立蓝牙连接(例如第一目标设备未响应上述第一回连指令,或者第一目标设备向第一耳机发送了连接失败信息等),则该第一耳机可以尝试回连其他可回连的设备。In this embodiment of the present application, when the first headset fails to establish a Bluetooth connection with the first target device within the specified first time period (for example, the first target device does not respond to the above-mentioned first connection back instruction, or the first target device sends If an earphone sends a connection failure message, etc.), the first earphone may try to connect back to other devices that can be connected back.
在一些实施例中,当第一耳机的主从属性为主耳机时,第一目标设备为上述电子设备,此时若第一耳机在第一时长内未成功回连该电子设备,则可以将上述第二耳机确定为第二目标设备,并执行与该第二目标设备(即第二耳机)对应的第二回连操作。具体地,第一耳机也可以在一定时长(例如3秒、5秒等)内向第二耳机发送相应的回连指令,以使第二耳机响应该回连指令,与第一耳机建立蓝牙连接。In some embodiments, when the master-slave property of the first earphone is the master earphone, the first target device is the above-mentioned electronic device. At this time, if the first earphone fails to connect back to the electronic device within the first duration, the The second earphone is determined as the second target device, and a second connection back operation corresponding to the second target device (ie, the second earphone) is performed. Specifically, the first earphone may also send a corresponding connection-back instruction to the second earphone within a certain period of time (for example, 3 seconds, 5 seconds, etc.), so that the second earphone responds to the connection-back instruction and establishes a Bluetooth connection with the first earphone.
在另一些实施例中,当第一耳机的主从属性为从耳机时,第一目标设备为上述第二耳机,此时若第一耳机在第一时长内未成功回连该第二耳机,则可以将上述电子设备确定为第二目标设备,并执行与该第二目标设备(即电子设备)对应的第二回连操作。具体地,第一耳机也可以在一定时长(例如3秒、5秒等)内向电子设备发送相应的回连指令,以使在该时长范围内该电子设备能够响应该回连指令,与第一耳机建立蓝牙连接。In some other embodiments, when the master-slave attribute of the first earphone is the slave earphone, the first target device is the second earphone, and if the first earphone fails to connect back to the second earphone within the first duration, Then the aforementioned electronic device may be determined as the second target device, and a second connection back operation corresponding to the second target device (that is, the electronic device) is performed. Specifically, the first earphone may also send a corresponding connection-back instruction to the electronic device within a certain period of time (for example, 3 seconds, 5 seconds, etc.), so that the electronic device can respond to the connection-back instruction within the period of time, and the same as the first earphone. The headset establishes a Bluetooth connection.
310、若第一耳机未成功与上述另一设备建立蓝牙连接,则轮流执行上述第一回连操作及第二回连操作,直至达到目标总时长为止。310. If the first earphone fails to establish a Bluetooth connection with the other device, perform the first connection-back operation and the second connection-back operation in turn until the target total duration is reached.
在本申请实施例中,若第一耳机在指定时长内仍未成功与上述另一设备(即第二目标设备,例如第二耳机或电子设备)建立蓝牙连接,则可以再次执行针对第一目标设备的第一回连操作;若仍未成功,还可以再次执行针对第二目标设备的第二回连操作,以此往复。也即是说,第一耳机可以轮流执行上述第一回连操作和第二回连操作,从而不断尝试与第二耳机或电子设备进行回连,尽可能提升该第一耳机回连成功的可能性。In this embodiment of the application, if the first earphone has not successfully established a Bluetooth connection with the other device (that is, the second target device, such as the second earphone or an electronic device) within a specified period of time, the first target can be executed again. The first connection back operation of the device; if it still fails, the second connection back operation for the second target device can be performed again, and so on. That is to say, the first earphone can perform the above-mentioned first connection back operation and the second connection back operation in turn, so as to continuously try to connect back with the second earphone or electronic device, and increase the possibility of successful connection back of the first earphone as much as possible. sex.
需要说明的是,第一耳机执行上述第一回连操作或第二回连操作的时长可以分别存在限制,其中,执行第一回连操作的时长可以大于执行第二回连操作的时长,也可以小于执行第二回连操作的时长,还可以两者相等。进一步地,第一耳机轮流执行上述第一回连操作及第二回连操作的总时长也可以有限,即第一耳机可以轮流执行上述第一回连操作及第二回连操作,直至达到目标总时长(例如10秒、15秒等)为止,从而可以使得第一耳机仅针对第二耳机或电子设备尝试有限次数的回连,以避免在确实无法回连的情况下尝试回连的时间过长。可选地,在达到目标总时长后,第一耳机可以发出相应的提示信息(例如声音提示信息、灯光提示信息、震动提示信息等),从而可以及时提醒用户该第一耳机存在回连失败的情况,以使用户可以针对这一情况采取相应的应对措施,有利于提升用户的使用体验。It should be noted that there may be limitations on the duration of the first earphone performing the above-mentioned first connection-back operation or the second connection-back operation, wherein the duration of performing the first connection-back operation may be longer than the duration of performing the second connection-back operation, or It can be shorter than the time for performing the second connection back operation, or both can be equal. Further, the total time for the first earphone to perform the above-mentioned first connection back operation and the second connection back operation in turn may also be limited, that is, the first earphone can perform the first connection back operation and the second connection back operation in turn until the target is reached. The total duration (for example, 10 seconds, 15 seconds, etc.), so that the first earphone can only try a limited number of reconnection attempts for the second earphone or electronic device, so as to avoid too much time for trying to reconnect when it is really impossible to reconnect. long. Optionally, after the target total duration is reached, the first earphone can send corresponding prompt information (such as sound prompt information, light prompt information, vibration prompt information, etc.), so that the user can be reminded in time that the first earphone has failed connection back. situation, so that the user can take corresponding countermeasures against this situation, which is conducive to improving the user experience.
可见,实施上述实施例所描述的蓝牙连接方法,当耳机设备中的第一耳机需要回连电子设备的时候,该第一耳机可以根据其主从属性,灵活地选择不同的第一目标设备进行回连,以尽可能适应该第一耳机所处的应用场景,提升该第一耳机回连第一目标设备的成功率,同时缩短回连所需的时间,进而可以间接或直接实现与电子设备的回连,有效提升了耳机回连电子设备的可靠性及灵活性。此外,通过设置一定的时长来使第一耳机尝试与第二耳机或电子设备回连,有利于灵活控制第一耳机的回连过程,进一步提高回连的成功率。It can be seen that, by implementing the Bluetooth connection method described in the above embodiment, when the first earphone in the earphone device needs to connect back to the electronic device, the first earphone can flexibly select a different first target device according to its master-slave attribute. Connect back, to adapt to the application scenario where the first earphone is located as much as possible, improve the success rate of the first earphone to connect back to the first target device, and shorten the time required for the connection back, and then can indirectly or directly realize the connection with the electronic device The back connection of the earphone effectively improves the reliability and flexibility of the headphone back connection electronic equipment. In addition, by setting a certain period of time to make the first earphone try to connect back to the second earphone or the electronic device, it is beneficial to flexibly control the reconnection process of the first earphone and further improve the success rate of the reconnection.
请参阅图5,图5是本申请实施例公开的又一种蓝牙连接方法的流程示意图,该方法可以应用于上述耳机设备的第一耳机,该耳机设备还可以包括第二耳机。如图5所示,该蓝牙连接方法可以包括以下步骤:Please refer to FIG. 5 . FIG. 5 is a schematic flowchart of another Bluetooth connection method disclosed in the embodiment of the present application. This method can be applied to the first earphone of the above-mentioned earphone device, and the earphone device can also include a second earphone. As shown in Figure 5, the Bluetooth connection method may include the following steps:
502、在第一耳机放置在耳机盒中的情况下,当该耳机盒处于触发开启操作的状态,若第二耳机未放置在该耳机盒中,则获取第一耳机的主从属性。502. When the first earphone is placed in the earphone box, when the earphone box is in the state of triggering the opening operation, if the second earphone is not placed in the earphone box, acquire the master-slave attribute of the first earphone.
其中,步骤502与上述步骤302类似,此处不再赘述。Wherein, step 502 is similar to the above-mentioned step 302 and will not be repeated here.
504、若上述主从属性表示第一耳机为主耳机,获取与该第一耳机建立过蓝牙连接的电子设备的连接信息,并将符合该连接信息的电子设备确定为第一耳机待回连的第一目标设备。504. If the above-mentioned master-slave attribute indicates that the first earphone is the master earphone, obtain the connection information of the electronic device that has established a Bluetooth connection with the first earphone, and determine the electronic device that matches the connection information as the first earphone to be connected back The first target device.
其中,步骤504与上述步骤304类似。需要说明的是,步骤504仅针对上述主从属性表示第一耳机为主耳机的情况,此时第一耳机可以将上述电子设备确定为第一目标设备,后续步骤中也仅针对第一目标设备为电子设备的情形展开阐述。对于第一耳机为从耳机的情况,已在上述步骤304中阐述,此处不再赘述。Wherein, step 504 is similar to step 304 above. It should be noted that step 504 is only for the case where the above-mentioned master-slave attribute indicates that the first earphone is the master earphone. At this time, the first earphone can determine the above-mentioned electronic device as the first target device, and the subsequent steps are only for the first target device. Elaborate on the case of electronic equipment. For the case that the first earphone is the slave earphone, it has been described in the above step 304, and will not be repeated here.
506、在第一时长内,向电子设备发送第一回连指令,以使该电子设备响应该第一回连指令,与第一耳机建立蓝牙连接。506. Within the first duration, send a first connection-back instruction to the electronic device, so that the electronic device responds to the first connection-back instruction to establish a Bluetooth connection with the first earphone.
其中,步骤506与上述步骤306类似,此处不再赘述。Wherein, step 506 is similar to the above-mentioned step 306 and will not be repeated here.
508、在接收到电子设备向第一耳机发送的连接失败信息的情况下,向第二耳机发送第二回连指令,以使第二耳机响应该第二回连指令,与第一耳机建立蓝牙连接,其中,上述连接失败信息包括电子设备已与该第二耳机建立蓝牙连接的信息。508. In the case of receiving the connection failure information sent by the electronic device to the first earphone, send a second connection back instruction to the second earphone, so that the second earphone responds to the second connection back instruction and establishes Bluetooth with the first earphone connection, wherein the connection failure information includes information that the electronic device has established a Bluetooth connection with the second earphone.
在本申请实施例中,若第一耳机在第一时长(例如3秒、5秒等)内未成功与电子设备建立蓝牙连接,则可以执行与第二耳机对应的第二回连操作,以尝试回连该第二耳机。在一些实施例中,第一耳机未成功回连电子设备的原因可以是接收到电子设备向第一耳机发送的连接失败信息。示例性地,若电子设备已经与第二耳机建立蓝牙连接(例如第一耳机在最近一次与电子设备断开连接时由主耳机切换为从耳机,而原本作为从耳机的第二耳机切换为主耳机,并保持与该电子设备的蓝牙连接),则当该电子设备接收到第一耳机发送的第一回连指令时,由于第一耳机和第二耳机具有相同的地址信息,该电子设备无法再与第一耳机建立蓝牙连接,从而可以向第一耳机发送相应的连接失败信息,该连接失败信息可以包括上述电子设备已与第二耳机建立蓝牙连接的信息。In the embodiment of the present application, if the first earphone fails to establish a Bluetooth connection with the electronic device within the first duration (for example, 3 seconds, 5 seconds, etc.), the second connection back operation corresponding to the second earphone may be performed to Try to reconnect the second headset. In some embodiments, the reason why the first earphone fails to connect back to the electronic device may be that a connection failure message sent by the electronic device to the first earphone is received. Exemplarily, if the electronic device has established a Bluetooth connection with the second earphone (for example, the first earphone was switched from the master earphone to the slave earphone when the first earphone was disconnected from the electronic device last time, and the second earphone that was originally the slave earphone was switched to the master earphone, and maintain the Bluetooth connection with the electronic device), when the electronic device receives the first connection back instruction sent by the first earphone, since the first earphone and the second earphone have the same address information, the electronic device cannot Then establish a Bluetooth connection with the first earphone, so that corresponding connection failure information can be sent to the first earphone, and the connection failure information can include information that the above-mentioned electronic device has established a Bluetooth connection with the second earphone.
在接收到上述连接失败信息后,第一耳机可以向第二耳机发送第二回连指令,以使第二耳机响应该第二回连指令,与第一耳机建立蓝牙连接。通过先回连第二耳机(此时第二耳机为主耳机),在一些实施例中,第一耳机可以作为从耳机,监听第二耳机与电子设备之间的数据传输,从而实现与该电子设备的间接连接;在另一些实施例中,第一耳机也可以切换与第二耳机之间的主从关系,重新作为主耳机与电子设备直接连接,实现回连。After receiving the above connection failure information, the first earphone may send a second connection back instruction to the second earphone, so that the second earphone responds to the second connection back instruction and establishes a Bluetooth connection with the first earphone. By connecting back to the second earphone first (at this time, the second earphone is the main earphone), in some embodiments, the first earphone can be used as a slave earphone to monitor the data transmission between the second earphone and the electronic device, so as to achieve communication with the electronic device. Indirect connection of the device; in some other embodiments, the first earphone can also switch the master-slave relationship with the second earphone, and reconnect directly with the electronic device as the master earphone to realize the connection back.
510、若第一耳机在第一时长内成功与电子设备建立蓝牙连接,则在第二时长内,向第二耳机发送第三回连指令,以使第二耳机响应该第三回连指令,与第一耳机建立蓝牙连接。510. If the first earphone successfully establishes a Bluetooth connection with the electronic device within the first period of time, within the second period of time, send a third connection-back instruction to the second earphone, so that the second earphone responds to the third connection-back instruction, Establish a Bluetooth connection with the first headset.
需要说明的是,步骤510可以与上述步骤508并列,分别表示第一耳机在第一时长内成功回连电子设备,以及第一耳机被电子设备拒绝回连的两种不同情况。可以理解,该步骤510也可以紧接在步骤506后执行。It should be noted that step 510 can be paralleled with the above-mentioned step 508, respectively representing two different situations that the first earphone successfully connects back to the electronic device within the first time period, and the first earphone is refused to connect back by the electronic device. It can be understood that step 510 may also be performed immediately after step 506 .
在本申请实施例中,若第一耳机在第一时长内成功与电子设备建立蓝牙连接,则该第一耳机可以作为主耳机,继续回连第二耳机。示例性地,第一耳机回连第二耳机的时长也可以存在限制,以避免在确实无法回连第二耳机的情况下尝试回连的时间过长。具体地,第一耳机可以在第二时长(例如3秒、5秒等)内向第二耳机发送第三回连指令,第二耳机在接收到该第三回连指令时,可以响应该第三回连指令,与第一耳机建立蓝牙连接,并作为从耳机监听第一耳机与电子设备之间的数据传输,此时第一耳机可以停止发送上述第三回连指令。可选地,若第一耳机在第二时长内未成功与第二耳机建立蓝牙连接,也可以停止发送上述第三回连指令,以降低功耗,延长续航时间。In the embodiment of the present application, if the first earphone successfully establishes a Bluetooth connection with the electronic device within the first time period, the first earphone can serve as the main earphone and continue to connect back to the second earphone. Exemplarily, there may also be a limit on the time period for the first earphone to connect back to the second earphone, so as to avoid too long time for attempting to reconnect when the second earphone cannot be reconnected. Specifically, the first earphone may send a third connection-back instruction to the second earphone within a second duration (such as 3 seconds, 5 seconds, etc.), and the second earphone may respond to the third connection-back instruction upon receiving the third connection-back instruction. The connection-back command establishes a Bluetooth connection with the first earphone, and serves as a slave earphone to monitor the data transmission between the first earphone and the electronic device. At this time, the first earphone can stop sending the above-mentioned third connection-back command. Optionally, if the first earphone fails to establish a Bluetooth connection with the second earphone within the second period of time, it may also stop sending the above-mentioned third connection back command to reduce power consumption and prolong battery life.
可见,实施上述实施例所描述的蓝牙连接方法,当耳机设备中的第一耳机需要回连电子设备的时候,该第一耳机可以根据其主从属性,灵活地选择不同的第一目标设备进行回连,以尽可能适应该第一耳机所处的应用场景,提升该第一耳机回连第一目标设备的成功 率,同时缩短回连所需的时间,进而可以间接或直接实现与电子设备的回连,有效提升了耳机回连电子设备的可靠性及灵活性。此外,当第一目标设备为电子设备时,第一耳机可以针对回连该电子设备成功或失败的情况进行不同的后续回连操作,以灵活地实现完整回连过程,有助于提升单个耳机回连电子设备的效率和成功率。It can be seen that, by implementing the Bluetooth connection method described in the above embodiment, when the first earphone in the earphone device needs to connect back to the electronic device, the first earphone can flexibly select a different first target device according to its master-slave attribute. Connect back, to adapt to the application scenario where the first earphone is located as much as possible, improve the success rate of the first earphone to connect back to the first target device, and shorten the time required for the connection back, and then can indirectly or directly realize the connection with the electronic device The back connection of the earphone effectively improves the reliability and flexibility of the headphone back connection electronic equipment. In addition, when the first target device is an electronic device, the first earphone can perform different follow-up reconnection operations according to whether the reconnection to the electronic device succeeds or fails, so as to flexibly realize the complete reconnection process and help improve the performance of a single earphone. Efficiency and success of connecting back electronic devices.
请参阅图6,图6是本申请实施例公开的一种蓝牙连接方法的时序图,该方法可以应用于由上述耳机设备和电子设备所组成的蓝牙通信系统中,其中,该耳机设备可以包括第一耳机以及第二耳机。如图6所示,该蓝牙连接方法可以包括以下步骤:Please refer to FIG. 6. FIG. 6 is a sequence diagram of a Bluetooth connection method disclosed in the embodiment of the present application. This method can be applied to a Bluetooth communication system composed of the above-mentioned earphone device and electronic equipment, wherein the earphone device can include The first earphone and the second earphone. As shown in Figure 6, the Bluetooth connection method may include the following steps:
602、第一耳机在处于回连状态的情况下,确定该第一耳机的主从属性,其中,主从属性用于表示该第一耳机与第二耳机之间的主从关系。602. When the first earphone is in the connection-back state, determine the master-slave attribute of the first earphone, where the master-slave attribute is used to indicate the master-slave relationship between the first earphone and the second earphone.
604A、若上述主从属性表示第一耳机为主耳机,获取与该第一耳机建立过蓝牙连接的电子设备的连接信息,并将符合该连接信息的电子设备确定为第一耳机待回连的第一目标设备。604A. If the master-slave attribute above indicates that the first earphone is the master earphone, obtain the connection information of the electronic device that has established a Bluetooth connection with the first earphone, and determine the electronic device that matches the connection information as the first earphone to be connected back to The first target device.
604B、若上述主从属性表示第一耳机为从耳机,将第二耳机确定为该第一耳机待回连的第一目标设备。604B. If the above-mentioned master-slave attribute indicates that the first earphone is a slave earphone, determine the second earphone as the first target device to be connected back to the first earphone.
其中,上述步骤604A和步骤604B并列,可以分别针对第一耳机的主从属性为主耳机或从耳机的不同情况,适应性地选择易于回连、回连成功率高的第一目标设备。Wherein, the above-mentioned step 604A and step 604B are parallel, and the first target device that is easy to reconnect and has a high success rate of reconnection can be adaptively selected according to different situations of the master-slave attribute of the first earphone as master earphone or slave earphone.
606、在第一时长内,向第一目标设备发送第一回连指令,以使第一目标设备响应该第一回连指令,与第一耳机建立蓝牙连接。606. Within the first duration, send a first connection-back instruction to the first target device, so that the first target device responds to the first connection-back instruction to establish a Bluetooth connection with the first earphone.
608A、若第一耳机在第一时长内未成功与电子设备建立蓝牙连接,则执行与第二耳机对应的第二回连操作。608A. If the first earphone fails to establish a Bluetooth connection with the electronic device within the first time period, perform a second connection back operation corresponding to the second earphone.
608B、若第一耳机在第一时长内未成功与第二耳机建立蓝牙连接,则执行与电子设备对应的第二回连操作。608B. If the first earphone fails to establish a Bluetooth connection with the second earphone within the first period of time, perform a second connection back operation corresponding to the electronic device.
其中,上述步骤608A和步骤608B并列,可以分别针对第一目标设备为电子设备或第二耳机的不同情况,执行第一耳机未成功回连第一目标设备后的第二回连操作,即向第二目标设备(第二耳机或电子设备)发送第二回连指令,以使第二目标设备响应该第二回连指令,与第一耳机建立蓝牙连接。Among them, the above-mentioned step 608A and step 608B are parallel, and the second reconnection operation after the first earphone fails to reconnect to the first target device can be performed for different situations in which the first target device is an electronic device or a second earphone, that is, to The second target device (the second earphone or the electronic device) sends a second connection-back instruction, so that the second target device responds to the second connection-back instruction and establishes a Bluetooth connection with the first earphone.
在一些实施例中,针对步骤608A,第一耳机未成功回连电子设备的原因可以是接收到电子设备向第一耳机发送的连接失败信息,在接收到上述连接失败信息后,第一耳机即可向第二耳机发送第二回连指令,以使第二耳机响应该第二回连指令,与第一耳机建立蓝牙连接。In some embodiments, for step 608A, the reason why the first earphone fails to connect back to the electronic device may be that the connection failure information sent by the electronic device to the first earphone is received. After receiving the above connection failure information, the first earphone immediately A second connection-back instruction can be sent to the second earphone, so that the second earphone can establish a Bluetooth connection with the first earphone in response to the second connection-back instruction.
610、若第一耳机在第一时长内成功与电子设备建立蓝牙连接,则在第二时长内,向第二耳机发送第三回连指令,以使第二耳机响应该第三回连指令,与第一耳机建立蓝牙连接。610. If the first earphone successfully establishes a Bluetooth connection with the electronic device within the first time period, within the second time period, send a third connection back command to the second earphone, so that the second earphone responds to the third connection back command, Establish a Bluetooth connection with the first headset.
可以理解,步骤610仅针对第一目标设备为电子设备的情况。对于第一目标设备为第二耳机的情况,若第一耳机在第一时长内成功回连该第二耳机,则可以作为从耳机实现与该电子设备的间接连接,也可以切换与第二耳机之间的主从关系,重新作为主耳机与电子设备直接连接,实现回连。It can be understood that step 610 is only for the case where the first target device is an electronic device. For the case where the first target device is the second earphone, if the first earphone successfully connects back to the second earphone within the first time period, it can be used as a slave earphone to achieve an indirect connection with the electronic device, or switch to the second earphone The master-slave relationship between them, as the master earphone, is directly connected to the electronic device to realize the connection back.
可见,实施上述实施例所描述的蓝牙连接方法,当耳机设备中的第一耳机需要回连电子设备的时候,该第一耳机可以根据其主从属性,灵活地选择不同的第一目标设备进行回连,以尽可能适应该第一耳机所处的应用场景,提升该第一耳机回连第一目标设备的成功率,同时缩短回连所需的时间,进而可以间接或直接实现与电子设备的回连,有效提升了耳机回连电子设备的可靠性及灵活性。It can be seen that, by implementing the Bluetooth connection method described in the above embodiment, when the first earphone in the earphone device needs to connect back to the electronic device, the first earphone can flexibly select a different first target device according to its master-slave attribute. Connect back, to adapt to the application scenario where the first earphone is located as much as possible, improve the success rate of the first earphone to connect back to the first target device, and shorten the time required for the connection back, and then can indirectly or directly realize the connection with the electronic device The back connection of the earphone effectively improves the reliability and flexibility of the headphone back connection electronic equipment.
请参阅图7,图7是本申请实施例公开的一种蓝牙连接装置的模块化示意图,该蓝牙连 接装置可以应用于上述耳机设备的第一耳机,该耳机设备还可以包括第二耳机。如图7所示,该蓝牙连接装置可以包括第一确定单元701、第二确定单元702以及回连单元703,其中:Please refer to Fig. 7, Fig. 7 is a schematic modular diagram of a bluetooth connection device disclosed in the embodiment of the present application, the bluetooth connection device can be applied to the first earphone of the above-mentioned earphone device, and the earphone device can also include a second earphone. As shown in FIG. 7, the Bluetooth connection device may include a first determination unit 701, a second determination unit 702, and a connection back unit 703, wherein:
第一确定单元701,用于在第一耳机处于回连状态的情况下,确定该第一耳机的主从属性,其中,主从属性用于表示该第一耳机与第二耳机之间的主从关系;The first determination unit 701 is configured to determine the master-slave attribute of the first earphone when the first earphone is in the connection-back state, wherein the master-slave attribute is used to indicate the master-slave attribute between the first earphone and the second earphone. From the relationship;
第二确定单元702,用于根据上述主从属性,确定第一耳机待回连的第一目标设备,该第一目标设备包括上述第二耳机,或与第一耳机建立过蓝牙连接的电子设备;The second determination unit 702 is configured to determine the first target device to be connected back to the first earphone according to the above-mentioned master-slave attribute, and the first target device includes the above-mentioned second earphone, or an electronic device that has established a Bluetooth connection with the first earphone ;
回连单元703,用于执行与上述第一目标设备对应的第一回连操作,以使第一耳机与该第一目标设备建立蓝牙连接。The connection back unit 703 is configured to perform a first connection back operation corresponding to the first target device, so that the first earphone establishes a Bluetooth connection with the first target device.
可见,采用上述实施例所描述的蓝牙连接装置,当耳机设备中的第一耳机处于回连状态,需要回连电子设备的时候,该第一耳机可以根据其主从属性,灵活地选择不同的第一目标设备(可以包括上述第二耳机或电子设备)进行回连,以尽可能适应该第一耳机所处的应用场景,提升该第一耳机回连第一目标设备的成功率,同时缩短回连所需的时间。无论第一耳机与何种第一目标设备建立蓝牙连接,均可间接或直接实现与电子设备的回连,从而能够有效提升耳机与电子设备连接的可靠性及灵活性。It can be seen that, using the Bluetooth connection device described in the above embodiment, when the first earphone in the earphone device is in the reconnection state and needs to be connected back to the electronic device, the first earphone can flexibly select different The first target device (which may include the above-mentioned second earphone or electronic device) is connected back, so as to adapt to the application scenario where the first earphone is located as much as possible, improve the success rate of the first earphone to connect back to the first target device, and shorten the The time required to connect back. No matter what kind of first target device the first earphone establishes a Bluetooth connection with, it can be indirectly or directly connected back to the electronic device, thereby effectively improving the reliability and flexibility of the connection between the earphone and the electronic device.
在一种实施例中,上述第一确定单元701,具体可以用于在第一耳机放置在耳机盒中的情况下,当该耳机盒处于触发开启操作的状态,若第二耳机未放置在该耳机盒中,则获取该第一耳机的主从属性。In one embodiment, the above-mentioned first determination unit 701 can specifically be used for when the first earphone is placed in the earphone box, when the earphone box is in the state of triggering the opening operation, if the second earphone is not placed in the In the earphone box, the master-slave attribute of the first earphone is obtained.
在一种实施例中,上述第一确定单元701,具体可以用于获取当耳机盒处于触发关闭操作的状态下所记录的该第一耳机的主从属性。In an embodiment, the above-mentioned first determination unit 701 may be specifically configured to obtain the master-slave attribute of the first earphone recorded when the earphone box is in a state of triggering a shutdown operation.
在一种实施例中,上述第二确定单元702具体可以用于:In an embodiment, the above-mentioned second determination unit 702 may be specifically configured to:
若上述主从属性表示第一耳机为主耳机,获取与该第一耳机建立过蓝牙连接的电子设备的连接信息,并将符合该连接信息的电子设备确定为该第一耳机待回连的第一目标设备;If the above-mentioned master-slave attribute indicates that the first earphone is the master earphone, obtain the connection information of the electronic device that has established a Bluetooth connection with the first earphone, and determine the electronic device that matches the connection information as the first earphone to be connected back to. a target device;
若上述主从属性表示第一耳机为从耳机,将上述第二耳机确定为该第一耳机待回连的第一目标设备。If the master-slave attribute indicates that the first earphone is a slave earphone, the second earphone is determined as the first target device to be connected back to the first earphone.
在一种实施例中,上述回连单元703可以包括未图示第一回连子单元以及第二回连子单元,其中:In an embodiment, the above connection unit 703 may include a first connection subunit and a second connection subunit not shown, wherein:
第一回连子单元,用于在第一时长内,向第一目标设备发送第一回连指令,以使该第一目标设备响应第一回连指令,与第一耳机建立蓝牙连接;The first connection-back subunit is configured to send a first connection-back instruction to the first target device within a first time period, so that the first target device responds to the first connection-back instruction and establishes a Bluetooth connection with the first earphone;
第二回连子单元,用于在上述第一耳机在第一时长内未成功与第一目标设备建立蓝牙连接的情况下,与上述第二耳机和电子设备中,除第一目标设备外的另一设备执行第二回连操作。The second connection subunit is configured to communicate with the second earphone and the electronic device except the first target device in the case that the first earphone fails to establish a Bluetooth connection with the first target device within the first time period. The other device performs a second connection back operation.
可见,采用上述实施例所描述的蓝牙连接装置,通过设置一定的时长来使第一耳机尝试与第二耳机或电子设备回连,有利于灵活控制第一耳机的回连过程,进一步提高回连的成功率。It can be seen that using the Bluetooth connection device described in the above embodiment, by setting a certain period of time to make the first earphone try to connect back to the second earphone or electronic equipment, it is beneficial to flexibly control the reconnection process of the first earphone and further improve the connection back. success rate.
在一种实施例中,第一目标终端可以包括上述的电子设备,上述第二回连子单元具体可以用于在接收到该电子设备向第一耳机发送的连接失败信息的情况下,向第二耳机发送第二回连指令,以使该第二耳机响应第二回连指令,与第一耳机建立蓝牙连接,其中,上述连接失败信息包括电子设备已与该第二耳机建立蓝牙连接的信息。In an embodiment, the first target terminal may include the above-mentioned electronic device, and the above-mentioned second connection-back subunit may be specifically configured to, in the case of receiving the connection failure information sent by the electronic device to the first earphone, send the The second earphone sends a second connection-back instruction, so that the second earphone responds to the second connection-back instruction and establishes a Bluetooth connection with the first earphone, wherein the connection failure information includes information that the electronic device has established a Bluetooth connection with the second earphone .
在一种实施例中,上述第二回连子单元,还可以用于在上述第一回连子单元向第一目标设备发送第一回连指令之后,若该第一耳机在第一时长内成功与电子设备建立蓝牙连接,则在第二时长内,向第二耳机发送第三回连指令,以使该第二耳机响应第三回连指令,与第一耳机建立蓝牙连接。In an embodiment, the above-mentioned second connection-back subunit can also be used to, after the first connection-back subunit sends the first connection-back instruction to the first target device, if the first earphone is within the first duration After successfully establishing a Bluetooth connection with the electronic device, within a second time period, a third connection-back instruction is sent to the second earphone, so that the second earphone responds to the third connection-back instruction and establishes a Bluetooth connection with the first earphone.
在一种实施例中,上述回连单元703还可以用于在第一耳机未成功与上述另一设备建立 蓝牙连接的情况下,轮流使第一回连子单元执行上述第一回连操作,以及使第二回连子单元执行上述第二回连操作,直至达到目标总时长为止。In an embodiment, the connection back unit 703 may also be configured to make the first connection subunit perform the first connection back operation in turn when the first earphone fails to establish a Bluetooth connection with the other device, And make the second connection back subunit execute the second connection back operation until the total target duration is reached.
在一种实施例中,上述第一确定单元701,具体也可以用于在第一耳机及第二耳机均放置在耳机盒中的情况下,当该耳机盒处于触发开启操作的状态,则由第一耳机与第二耳机进行回连,以使该第一耳机与第二耳机建立蓝牙连接;以及,从上述第一耳机及第二耳机中,确定出主耳机。In one embodiment, the above-mentioned first determination unit 701 can also be specifically configured to, when the first earphone and the second earphone are both placed in the earphone box, when the earphone box is in the state of triggering the opening operation, then by The first earphone is connected back to the second earphone, so that the first earphone and the second earphone establish a Bluetooth connection; and, the master earphone is determined from the first earphone and the second earphone.
在此基础上,上述回连单元703,具体可以用于由上述主耳机与电子设备进行回连。On this basis, the above-mentioned connection back unit 703 can specifically be used for the connection back between the above-mentioned main earphone and the electronic device.
可见,采用上述实施例所描述的蓝牙连接装置,当耳机设备中的第一耳机需要回连电子设备的时候,该第一耳机可以根据其主从属性,灵活地选择不同的第一目标设备进行回连,以尽可能适应该第一耳机所处的应用场景,提升该第一耳机回连第一目标设备的成功率,同时缩短回连所需的时间,进而可以间接或直接实现与电子设备的回连,有效提升了耳机回连电子设备的可靠性及灵活性。此外,当第一目标设备为电子设备时,第一耳机可以针对回连该电子设备成功或失败的情况进行不同的后续回连操作,以灵活地实现完整回连过程,有助于提升单个耳机回连电子设备的效率和成功率。It can be seen that, using the Bluetooth connection device described in the above embodiment, when the first earphone in the earphone device needs to connect back to the electronic device, the first earphone can flexibly select a different first target device according to its master-slave attribute. Connect back, to adapt to the application scenario where the first earphone is located as much as possible, improve the success rate of the first earphone to connect back to the first target device, and shorten the time required for the connection back, and then can indirectly or directly realize the connection with the electronic device The back connection of the earphone effectively improves the reliability and flexibility of the headphone back connection electronic equipment. In addition, when the first target device is an electronic device, the first earphone can perform different subsequent reconnection operations according to whether the reconnection to the electronic device succeeds or fails, so as to flexibly realize the complete reconnection process and help improve the performance of a single earphone. Efficiency and success of connecting back electronic devices.
请参阅图8,图8是本申请实施例公开的一种耳机的模块化示意图。如图8所示,该音频输出设备可以包括:Please refer to FIG. 8 . FIG. 8 is a schematic modular diagram of an earphone disclosed in an embodiment of the present application. As shown in Figure 8, the audio output device may include:
存储有可执行程序代码的存储器801;A memory 801 storing executable program codes;
与存储器801耦合的处理器802;a processor 802 coupled to the memory 801;
其中,处理器802调用存储器801中存储的可执行程序代码,可以执行上述实施例所描述的任意一种应用于第一耳机的蓝牙连接方法中的全部或部分步骤。Wherein, the processor 802 invokes the executable program code stored in the memory 801 to execute all or part of the steps in any Bluetooth connection method applied to the first earphone described in the above embodiments.
此外,本申请实施例进一步公开了一种计算机可读存储介质,其存储用于电子数据交换的计算机程序,其中,该计算机程序使得计算机可以执行上述实施例所描述的任意一种应用于音频输出设备、第一终端设备或第二终端设备的蓝牙连接方法中的全部或部分步骤。In addition, the embodiment of the present application further discloses a computer-readable storage medium, which stores a computer program for electronic data exchange, wherein the computer program enables the computer to execute any one of the audio output described in the above-mentioned embodiments. All or part of the steps in the Bluetooth connection method of the device, the first terminal device or the second terminal device.
此外,本申请实施例进一步公开一种计算机程序产品,当该计算机程序产品在计算机上运行时,使得计算机可以执行上述实施例所描述的任意一种蓝牙连接方法中的全部或部分步骤。In addition, the embodiment of the present application further discloses a computer program product. When the computer program product is run on a computer, the computer can execute all or part of the steps in any Bluetooth connection method described in the above embodiments.
本领域普通技术人员可以理解上述实施例的各种方法中的全部或部分步骤是可以通过程序来指令相关的硬件来完成,该程序可以存储于一计算机可读存储介质中,存储介质包括只读存储器(Read-Only Memory,ROM)、随机存储器(Random Access Memory,RAM)、可编程只读存储器(Programmable Read-only Memory,PROM)、可擦除可编程只读存储器(Erasable Programmable Read Only Memory,EPROM)、一次可编程只读存储器(One-time Programmable Read-Only Memory,OTPROM)、电子抹除式可复写只读存储器(Electrically-Erasable Programmable Read-Only Memory,EEPROM)、只读光盘(Compact Disc Read-Only Memory,CD-ROM)或其它光盘存储器、磁盘存储器、磁带存储器、或者能够用于携带或存储数据的计算机可读的任何其它介质。Those of ordinary skill in the art can understand that all or part of the steps in the various methods of the above-mentioned embodiments can be completed by instructing related hardware through a program, and the program can be stored in a computer-readable storage medium, and the storage medium includes read-only Memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), programmable read-only memory (Programmable Read-only Memory, PROM), erasable programmable read-only memory (Erasable Programmable Read Only Memory, EPROM), One-time Programmable Read-Only Memory (OTPROM), Electronically Erasable Programmable Read-Only Memory (EEPROM), Compact Disc (Compact Disc Read-Only Memory, CD-ROM) or other optical disk storage, magnetic disk storage, tape storage, or any other computer-readable medium that can be used to carry or store data.
以上对本申请实施例公开的一种蓝牙连接方法及装置、耳机、存储介质进行了详细介绍,本文中应用了具体个例对本申请的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本申请的方法及其核心思想;同时,对于本领域的一般技术人员,依据本申请的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本申请的限制。A Bluetooth connection method and device, earphone, and storage medium disclosed in the embodiments of the present application have been described above in detail. In this paper, specific examples are used to illustrate the principles and implementation methods of the present application. The descriptions of the above embodiments are only for To help understand the method and its core idea of this application; at the same time, for those of ordinary skill in the art, according to the idea of this application, there will be changes in the specific implementation and application scope. In summary, the content of this specification It should not be construed as a limitation of the application.

Claims (22)

  1. 一种蓝牙连接方法,其特征在于,应用于耳机设备中的第一耳机,所述耳机设备还包括第二耳机,所述方法包括:A Bluetooth connection method, characterized in that it is applied to a first earphone in an earphone device, the earphone device also includes a second earphone, and the method includes:
    在所述第一耳机处于回连状态的情况下,确定所述第一耳机的主从属性,其中,所述主从属性用于表示所述第一耳机与所述第二耳机之间的主从关系;When the first earphone is in the connection back state, determine the master-slave attribute of the first earphone, where the master-slave attribute is used to indicate the master-slave property between the first earphone and the second earphone From the relationship;
    根据所述主从属性,确定所述第一耳机待回连的第一目标设备,所述第一目标设备包括所述第二耳机,或与所述第一耳机建立过蓝牙连接的电子设备;According to the master-slave attribute, determine a first target device to be connected back to the first earphone, where the first target device includes the second earphone, or an electronic device that has established a Bluetooth connection with the first earphone;
    执行与所述第一目标设备对应的第一回连操作,以使所述第一耳机与所述第一目标设备建立蓝牙连接。Executing a first connection back operation corresponding to the first target device, so that the first earphone establishes a Bluetooth connection with the first target device.
  2. 根据权利要求1所述的方法,其特征在于,所述在所述第一耳机处于回连状态的情况下,确定所述第一耳机的主从属性,包括:The method according to claim 1, wherein the determining the master-slave attribute of the first earphone when the first earphone is in the connection-back state comprises:
    在所述第一耳机放置在耳机盒中的情况下,当所述耳机盒处于触发开启操作的状态,若所述第二耳机未放置在所述耳机盒中,则获取所述第一耳机的主从属性。In the case where the first earphone is placed in the earphone box, when the earphone box is in the state of triggering the opening operation, if the second earphone is not placed in the earphone box, obtain the information of the first earphone master-slave property.
  3. 根据权利要求2所述的方法,其特征在于,所述获取所述第一耳机的主从属性,包括:The method according to claim 2, wherein the acquiring the master-slave attribute of the first earphone comprises:
    获取当所述耳机盒处于触发关闭操作的状态,且所述第二耳机未放置在所述耳机盒中的情况下所记录的所述第一耳机的主从属性。The master-slave attribute of the first earphone recorded when the earphone box is in a state of triggering a shutdown operation and the second earphone is not placed in the earphone box is acquired.
  4. 根据权利要求1至3任一项所述的方法,其特征在于,所述根据所述主从属性,确定所述第一耳机待回连的第一目标设备,包括:The method according to any one of claims 1 to 3, wherein the determining the first target device to be connected back to the first earphone according to the master-slave attribute includes:
    若所述主从属性表示所述第一耳机为从耳机,将所述第二耳机确定为所述第一耳机待回连的第一目标设备。If the master-slave attribute indicates that the first earphone is a slave earphone, determine the second earphone as the first target device to be connected back to the first earphone.
  5. 根据权利要求1至3任一项所述的方法,其特征在于,所述根据所述主从属性,确定所述第一耳机待回连的第一目标设备,包括:The method according to any one of claims 1 to 3, wherein the determining the first target device to be connected back to the first earphone according to the master-slave attribute includes:
    若所述主从属性表示所述第一耳机为主耳机,获取与所述第一耳机建立过蓝牙连接的电子设备对应的连接信息,并将符合所述连接信息的电子设备确定为所述第一耳机待回连的第一目标设备。If the master-slave attribute indicates that the first earphone is the master earphone, obtain connection information corresponding to the electronic device that has established a Bluetooth connection with the first earphone, and determine the electronic device that conforms to the connection information as the first earphone. The first target device to which a headset is to be connected back.
  6. 根据权利要求1至3任一项所述的方法,其特征在于,所述执行与所述第一目标设备对应的第一回连操作,包括:The method according to any one of claims 1 to 3, wherein the performing the first connection back operation corresponding to the first target device includes:
    在第一时长内,向所述第一目标设备发送第一回连指令,以使所述第一目标设备响应所述第一回连指令,与所述第一耳机建立蓝牙连接;Within the first duration, send a first connection-back instruction to the first target device, so that the first target device responds to the first connection-back instruction and establishes a Bluetooth connection with the first earphone;
    若所述第一耳机在所述第一时长内未成功与所述第一目标设备建立蓝牙连接,则与所述第二耳机和所述电子设备中,除所述第一目标设备外的另一设备执行第二回连操作。If the first earphone fails to establish a bluetooth connection with the first target device within the first time period, communicate with the second earphone and the electronic device except the first target device A device performs a second connection back operation.
  7. 根据权利要求6所述的方法,其特征在于,所述第一目标终端包括所述电子设备,若所述第一耳机在所述第一时长内未成功与所述第一目标设备建立蓝牙连接,则与所述第二耳机和所述电子设备中,除所述第一目标设备外的另一设备执行第二回连操作,包括:The method according to claim 6, wherein the first target terminal includes the electronic device, if the first earphone fails to establish a Bluetooth connection with the first target device within the first time period , performing a second connection back operation with another device other than the first target device among the second earphone and the electronic device, including:
    在所述第一时长内接收到所述电子设备向所述第一耳机发送的连接失败信息的情况下,向所述第二耳机发送第二回连指令,以使所述第二耳机响应所述第二回连指令,与所述第一耳机建立蓝牙连接,其中,所述连接失败信息包括所述电子设备已与所述第二耳机建立蓝牙连接的信息。In the case of receiving the connection failure information sent by the electronic device to the first earphone within the first time period, send a second connection back instruction to the second earphone, so that the second earphone responds to the The second connection-back instruction establishes a Bluetooth connection with the first earphone, wherein the connection failure information includes information that the electronic device has established a Bluetooth connection with the second earphone.
  8. 根据权利要求6所述的方法,其特征在于,所述第一目标终端包括所述电子设备,在所述在第一时长内,向所述第一目标设备发送第一回连指令之后,所述方法还包括:The method according to claim 6, wherein the first target terminal includes the electronic device, and after the first connection back instruction is sent to the first target device within the first time period, the The method also includes:
    若所述第一耳机在所述第一时长内成功与所述电子设备建立蓝牙连接,则在第二时长内,向所述第二耳机发送第三回连指令,以使所述第二耳机响应所述第三回连指令,与所 述第一耳机建立蓝牙连接。If the first earphone successfully establishes a Bluetooth connection with the electronic device within the first time period, within the second time period, send a third connection back command to the second earphone, so that the second earphone In response to the third connection-back instruction, establish a Bluetooth connection with the first earphone.
  9. 根据权利要求6所述的方法,其特征在于,在所述若所述第一耳机在所述第一时长内未成功与所述第一目标设备建立蓝牙连接,则与所述第二耳机和所述电子设备中,除所述第一目标设备外的另一设备执行第二回连操作之后,所述方法还包括:The method according to claim 6, wherein if the first earphone fails to establish a bluetooth connection with the first target device within the first duration, then communicate with the second earphone and In the electronic device, after another device other than the first target device performs the second connection back operation, the method further includes:
    若所述第一耳机未成功与所述另一设备建立蓝牙连接,则轮流执行所述第一回连操作及所述第二回连操作,直至达到目标总时长为止。If the first earphone fails to establish a Bluetooth connection with the other device, the first connection-back operation and the second connection-back operation are performed in turn until a target total duration is reached.
  10. 根据权利要求1所述的方法,其特征在于,所述在所述第一耳机处于回连状态的情况下,确定所述第一耳机的主从属性,包括:The method according to claim 1, wherein the determining the master-slave attribute of the first earphone when the first earphone is in the connection-back state comprises:
    在所述第一耳机及所述第二耳机均放置在耳机盒中的情况下,当所述耳机盒处于触发开启操作的状态,由所述第一耳机与所述第二耳机进行回连,以使所述第一耳机与所述第二耳机建立蓝牙连接;When both the first earphone and the second earphone are placed in the earphone box, when the earphone box is in the state of triggering the opening operation, the first earphone is connected back to the second earphone, making the first earphone establish a bluetooth connection with the second earphone;
    从所述第一耳机及所述第二耳机中,确定出主耳机;determining a master earphone from the first earphone and the second earphone;
    所述方法还包括:The method also includes:
    由所述主耳机与所述电子设备进行回连。The main earphone is connected back to the electronic device.
  11. 一种蓝牙连接装置,其特征在于,应用于耳机设备中的第一耳机,所述耳机设备还包括第二耳机,所述蓝牙连接装置包括:A bluetooth connection device, characterized in that it is applied to the first earphone in the earphone device, the earphone device also includes a second earphone, and the bluetooth connection device includes:
    第一确定单元,用于在所述第一耳机处于回连状态的情况下,确定所述第一耳机的主从属性,其中,所述主从属性用于表示所述第一耳机与所述第二耳机之间的主从关系;The first determining unit is configured to determine the master-slave attribute of the first earphone when the first earphone is in the connection-back state, wherein the master-slave attribute is used to indicate that the first earphone is connected to the Master-slave relationship between the second headset;
    第二确定单元,用于根据所述主从属性,确定所述第一耳机待回连的第一目标设备,所述第一目标设备包括所述第二耳机,或与所述第一耳机建立过蓝牙连接的电子设备;The second determination unit is configured to determine a first target device to be connected back to the first earphone according to the master-slave attribute, the first target device includes the second earphone, or is established with the first earphone Electronic devices connected via Bluetooth;
    回连单元,用于执行与所述第一目标设备对应的第一回连操作,以使所述第一耳机与所述第一目标设备建立蓝牙连接。A connection-back unit, configured to perform a first connection-back operation corresponding to the first target device, so as to establish a Bluetooth connection between the first earphone and the first target device.
  12. 根据权利要求11所述的蓝牙连接装置,其特征在于,所述第一确定单元在用于在所述第一耳机处于回连状态的情况下,确定所述第一耳机的主从属性时,包括:The Bluetooth connection device according to claim 11, wherein when the first determining unit is configured to determine the master-slave attribute of the first earphone when the first earphone is in the connection-back state, include:
    在所述第一耳机放置在耳机盒中的情况下,当所述耳机盒处于触发开启操作的状态,若所述第二耳机未放置在所述耳机盒中,则获取所述第一耳机的主从属性。In the case where the first earphone is placed in the earphone box, when the earphone box is in the state of triggering the opening operation, if the second earphone is not placed in the earphone box, obtain the information of the first earphone master-slave property.
  13. 根据权利要求12所述的蓝牙连接装置,其特征在于,所述第一确定单元在用于获取所述第一耳机的主从属性时,包括:The Bluetooth connection device according to claim 12, wherein when the first determination unit is used to obtain the master-slave attribute of the first earphone, it includes:
    获取当所述耳机盒处于触发关闭操作的状态,且所述第二耳机未放置在所述耳机盒中的情况下所记录的所述第一耳机的主从属性。The master-slave attribute of the first earphone recorded when the earphone box is in a state of triggering a shutdown operation and the second earphone is not placed in the earphone box is acquired.
  14. 根据权利要求11至13任一项所述的蓝牙连接装置,其特征在于,所述第二确定单元在用于根据所述主从属性,确定所述第一耳机待回连的第一目标设备时,包括:The Bluetooth connection device according to any one of claims 11 to 13, wherein the second determination unit is used to determine the first target device to be connected back to the first earphone according to the master-slave attribute , including:
    若所述主从属性表示所述第一耳机为从耳机,将所述第二耳机确定为所述第一耳机待回连的第一目标设备。If the master-slave attribute indicates that the first earphone is a slave earphone, determine the second earphone as the first target device to be connected back to the first earphone.
  15. 根据权利要求11至13任一项所述的蓝牙连接装置,其特征在于,所述第二确定单元在用于根据所述主从属性,确定所述第一耳机待回连的第一目标设备时,包括:The Bluetooth connection device according to any one of claims 11 to 13, wherein the second determination unit is used to determine the first target device to be connected back to the first earphone according to the master-slave attribute , including:
    若所述主从属性表示所述第一耳机为主耳机,获取与所述第一耳机建立过蓝牙连接的电子设备对应的连接信息,并将符合所述连接信息的电子设备确定为所述第一耳机待回连的第一目标设备。If the master-slave attribute indicates that the first earphone is the master earphone, obtain connection information corresponding to the electronic device that has established a Bluetooth connection with the first earphone, and determine the electronic device that conforms to the connection information as the first earphone. The first target device to which a headset is to be connected back.
  16. 根据权利要求11至13任一项所述的蓝牙连接装置,其特征在于,所述回连单元在用于执行与所述第一目标设备对应的第一回连操作时,包括:The Bluetooth connection device according to any one of claims 11 to 13, wherein, when the connection back unit is used to perform the first connection back operation corresponding to the first target device, it includes:
    在第一时长内,向所述第一目标设备发送第一回连指令,以使所述第一目标设备响应所述第一回连指令,与所述第一耳机建立蓝牙连接;Within the first duration, send a first connection-back instruction to the first target device, so that the first target device responds to the first connection-back instruction and establishes a Bluetooth connection with the first earphone;
    若所述第一耳机在所述第一时长内未成功与所述第一目标设备建立蓝牙连接,则与所述第二耳机和所述电子设备中,除所述第一目标设备外的另一设备执行第二回连操作。If the first earphone fails to establish a bluetooth connection with the first target device within the first time period, communicate with the second earphone and the electronic device except the first target device A device performs a second connection back operation.
  17. 根据权利要求16所述的蓝牙连接装置,其特征在于,所述第一目标终端包括所述电子设备,所述回连单元在用于若所述第一耳机在所述第一时长内未成功与所述第一目标设备建立蓝牙连接,则与所述第二耳机和所述电子设备中,除所述第一目标设备外的另一设备执行第二回连操作时,包括:The Bluetooth connection device according to claim 16, wherein the first target terminal includes the electronic device, and the connection back unit is used if the first earphone fails within the first duration Establishing a Bluetooth connection with the first target device, when performing a second connection back operation with another device other than the first target device among the second earphone and the electronic device, includes:
    在所述第一时长内接收到所述电子设备向所述第一耳机发送的连接失败信息的情况下,向所述第二耳机发送第二回连指令,以使所述第二耳机响应所述第二回连指令,与所述第一耳机建立蓝牙连接,其中,所述连接失败信息包括所述电子设备已与所述第二耳机建立蓝牙连接的信息。In the case of receiving the connection failure information sent by the electronic device to the first earphone within the first time period, send a second connection back instruction to the second earphone, so that the second earphone responds to the The second connection-back instruction establishes a Bluetooth connection with the first earphone, wherein the connection failure information includes information that the electronic device has established a Bluetooth connection with the second earphone.
  18. 根据权利要求16所述的蓝牙连接装置,其特征在于,所述第一目标终端包括所述电子设备,所述回连单元还用于在所述第一耳机在所述第一时长内成功与所述电子设备建立蓝牙连接的情况下,在第二时长内,向所述第二耳机发送第三回连指令,以使所述第二耳机响应所述第三回连指令,与所述第一耳机建立蓝牙连接。The Bluetooth connection device according to claim 16, wherein the first target terminal includes the electronic device, and the connection back unit is further configured to successfully communicate with the first earphone within the first duration When the electronic device establishes a bluetooth connection, within a second time period, send a third connection-back instruction to the second earphone, so that the second earphone responds to the third connection-back instruction and communicates with the first earphone. A headset establishes a Bluetooth connection.
  19. 根据权利要求16所述的蓝牙连接装置,其特征在于,所述回连单元还用于在所述第一耳机未成功与所述另一设备建立蓝牙连接的情况下,轮流执行所述第一回连操作及所述第二回连操作,直至达到目标总时长为止。The bluetooth connection device according to claim 16, wherein the connection back unit is further configured to execute the first The reconnection operation and the second reconnection operation are performed until the total target duration is reached.
  20. 根据权利要求11所述的蓝牙连接装置,其特征在于,所述第一确定单元在用于在所述第一耳机处于回连状态的情况下,确定所述第一耳机的主从属性时,包括:The Bluetooth connection device according to claim 11, wherein when the first determining unit is configured to determine the master-slave attribute of the first earphone when the first earphone is in the connection-back state, include:
    在所述第一耳机及所述第二耳机均放置在耳机盒中的情况下,当所述耳机盒处于触发开启操作的状态,由所述第一耳机与所述第二耳机进行回连,以使所述第一耳机与所述第二耳机建立蓝牙连接;以及,从所述第一耳机及所述第二耳机中,确定出主耳机;When both the first earphone and the second earphone are placed in the earphone box, when the earphone box is in the state of triggering the opening operation, the first earphone is connected back to the second earphone, Establishing a Bluetooth connection between the first earphone and the second earphone; and determining a master earphone from the first earphone and the second earphone;
    所述回连单元,还用于由所述主耳机与所述电子设备进行回连。The connection back unit is also used to connect back the main earphone to the electronic device.
  21. 一种耳机,其特征在于,包括存储器及处理器,所述存储器中存储有计算机程序,所述计算机程序被所述处理器执行时,使得所述处理器实现如权利要求1至10任一项所述的蓝牙连接方法。An earphone, characterized in that it includes a memory and a processor, and a computer program is stored in the memory, and when the computer program is executed by the processor, the processor realizes any one of claims 1 to 10. The Bluetooth connection method described above.
  22. 一种计算机可读存储介质,其上存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现如权利要求1至10任一项所述的蓝牙连接方法。A computer-readable storage medium, on which a computer program is stored, wherein the computer program implements the Bluetooth connection method according to any one of claims 1 to 10 when executed by a processor.
PCT/CN2022/115861 2021-10-13 2022-08-30 Bluetooth connection method and apparatus, earphone, and storage medium WO2023061076A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202111190922.XA CN115967927A (en) 2021-10-13 2021-10-13 Bluetooth connection method and device, earphone and storage medium
CN202111190922.X 2021-10-13

Publications (1)

Publication Number Publication Date
WO2023061076A1 true WO2023061076A1 (en) 2023-04-20

Family

ID=85889988

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/115861 WO2023061076A1 (en) 2021-10-13 2022-08-30 Bluetooth connection method and apparatus, earphone, and storage medium

Country Status (2)

Country Link
CN (1) CN115967927A (en)
WO (1) WO2023061076A1 (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180115747A1 (en) * 2016-10-20 2018-04-26 Plantronics, Inc. Video Headset
CN112203179A (en) * 2020-09-22 2021-01-08 歌尔科技有限公司 TWS earphone, automatic reconnection method and device thereof, and computer storage medium
CN112469010A (en) * 2019-09-06 2021-03-09 华为技术有限公司 Bluetooth connection method and related device
CN113223508A (en) * 2021-03-29 2021-08-06 深圳市芯中芯科技有限公司 Management method of dual-mode TWS Bluetooth headset

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180115747A1 (en) * 2016-10-20 2018-04-26 Plantronics, Inc. Video Headset
CN112469010A (en) * 2019-09-06 2021-03-09 华为技术有限公司 Bluetooth connection method and related device
CN112203179A (en) * 2020-09-22 2021-01-08 歌尔科技有限公司 TWS earphone, automatic reconnection method and device thereof, and computer storage medium
CN113223508A (en) * 2021-03-29 2021-08-06 深圳市芯中芯科技有限公司 Management method of dual-mode TWS Bluetooth headset

Also Published As

Publication number Publication date
CN115967927A (en) 2023-04-14

Similar Documents

Publication Publication Date Title
US11438962B2 (en) Method and apparatus for establishing single-line connection, and wireless headset and charging box
KR102228343B1 (en) Swapping roles between untethered wirelessly connected devices
US11129218B2 (en) Bluetooth communication method and terminal
US20210243831A1 (en) Method for establishing classic bluetooth connection between dual-mode bluetooth devices, and dual-mode bluetooth device
CN108718467B (en) Voice data transmission method, wireless headset and TWS headset
US20150201440A1 (en) BLUETOOTH Device Connection Method and Device
KR20160045635A (en) Electronic device using logical channels for communication
US20200413456A1 (en) Method for pairing and connecting secondary earphone with sound source device
CN115002934B (en) Audio service processing system, electronic equipment and Bluetooth headset
CN113395687A (en) Reconnection method, reconnection device, electronic equipment and storage medium
EP4210362A1 (en) Bluetooth communication system, bluetooth connection method, electronic device, and storage medium
WO2023061127A1 (en) Communication method and apparatus, earphone set, and computer readable medium
WO2019019050A1 (en) Wireless communication pairing method, wireless receiving device, and wireless transmitting device and system
WO2023036178A1 (en) Bluetooth connection method and apparatus, earphone device, and computer-readable storage medium
CN111601290B (en) Bluetooth sound box, earphone, bluetooth audio playing device, bluetooth sound box system and Bluetooth audio switching method
CN113840269B (en) Multimedia data transmission method and device, electronic equipment and storage medium
CN113965889B (en) Data processing, filtering information quantity determining and configuring method, equipment and medium
WO2021232770A1 (en) Auxiliary playback device and control method therefor, control apparatus, and readable storage medium
WO2023061076A1 (en) Bluetooth connection method and apparatus, earphone, and storage medium
WO2023093223A1 (en) Bluetooth connection method and apparatus, and bluetooth device and storage medium
CN111988695A (en) Earphone synchronization method, device, equipment and storage medium of wireless earphone
WO2022061551A1 (en) Address transmission method, bluetooth chip, bluetooth headset, and electronic device
CN113810887A (en) Bluetooth protocol connection method, device, storage medium and related equipment
WO2024082855A1 (en) Audio service processing method, electronic device, and computer storage medium
CN114866998B (en) Bluetooth connection method and Bluetooth device

Legal Events

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

Ref document number: 22880022

Country of ref document: EP

Kind code of ref document: A1