A kind of method and apparatus for connecting ears bluetooth earphoneTechnical field
The present invention relates to field of computer technology, and in particular to a kind of method and apparatus of connection ears bluetooth earphone.
Background technology
As the continuous improvement of people's living standard, development in science and technology are maked rapid progress, ears bluetooth earphone has been come intoThe life of people, has obtained the favor of consumers in general.It is main but existing ears bluetooth earphone with mobile terminal when being connectedFrom earphone, role fixes, and can only be connected by main earphone with mobile terminal, and after main earphone is connected with mobile terminal, main earphone is againWith being connected from earphone by wireless blue tooth communications protocol (True Wireless, abbreviation TWS).Due to main earphone and mobile terminalCarry out real-time Communication for Power power consumption larger, and it is smaller relative to main earphone power consumption from earphone so that the dump energy of principal and subordinate's earphoneIt is unbalanced.Once the electricity of main earphone has consumed, ears wireless headset will be unable to be communicated with mobile terminal.Can only be by masterThe mode of earphone charging, could cause ears wireless headset to continue proper communication with mobile terminal, reduce Consumer's Experience.
The content of the invention
The invention provides a kind of method and apparatus for connecting ears bluetooth earphone, to solve existing ears bluetooth earphoneMain earphone power consumption be more than from earphone, once main earphone electricity consume, ears wireless headset will be unable to and mobile terminal progressThe problem of Consumer's Experience is low caused by communication.
According to an aspect of the invention, there is provided a kind of method for connecting ears bluetooth earphone.The ears bluetooth earMachine includes the first bluetooth earphone and the second bluetooth earphone, and this method includes:
First bluetooth earphone and described the are alternately connected using the first Bluetooth address prestored and the second Bluetooth addressTwo bluetooth earphones;
First bluetooth earphone, the dump energy of second bluetooth earphone are obtained respectively;
According to the dump energy of first bluetooth earphone and the dump energy of second bluetooth earphone, principal and subordinate is determinedEarphone;
Bluetooth connection is set up using the corresponding Bluetooth address of main earphone and the main earphone determined with determining, andThe control main earphone determined connect determine from earphone.
There is provided a kind of device for connecting ears bluetooth earphone, the ears bluetooth according to another aspect of the present inventionEarphone includes the first bluetooth earphone and the second bluetooth earphone, and the device includes:
Alternating connection unit, for alternately connecting described first using the first Bluetooth address prestored and the second Bluetooth addressBluetooth earphone and second bluetooth earphone;
Electricity acquiring unit, the dump energy for obtaining first bluetooth earphone, second bluetooth earphone respectively;
Principal and subordinate's earphone determining unit, for the dump energy according to first bluetooth earphone and the second bluetooth earThe dump energy of machine, determines principal and subordinate's earphone;
Principal and subordinate's earphone connection unit, for being determined using corresponding with the main earphone determined Bluetooth address with describedMain earphone sets up bluetooth connection, and control the main earphone determined connect determine from earphone.
The beneficial effects of the invention are as follows:Technical scheme, by using the first Bluetooth address prestored and secondBluetooth address alternately connects the first bluetooth earphone and the second bluetooth earphone, it is ensured that mobile terminal can both connect the first bluetooth earMachine can also connect the second bluetooth earphone, and ensure that mobile terminal can detect the residue electricity of the first bluetooth earphone respectivelyThe dump energy of amount and the second bluetooth earphone, so that according to the surplus of the dump energy of the first bluetooth earphone and the second bluetooth earphoneRemaining electricity determines principal and subordinate's earphone, and then is set up using Bluetooth address corresponding with the main earphone determined and the main earphone determinedBluetooth connection, and control that the main earphone determined connection determines from earphone, realize the intelligence switching of principal and subordinate's earphone, reductionThe power consumption of system, has reached that mobile terminal can flexibly select the more earphones of dump energy to be attached, extends earsThe call duration time of wireless headset, improves Consumer's Experience.
Brief description of the drawings
Fig. 1 is a kind of flow chart of the method for connection ears bluetooth earphone of one embodiment of the invention;
Fig. 2 is the flow chart of the method for another connection ears bluetooth earphone of one embodiment of the invention;
Fig. 3 is a kind of structural representation of the device of connection ears bluetooth earphone of one embodiment of the invention;
Fig. 4 is the structural representation of the device of another connection ears bluetooth earphone of one embodiment of the invention;
Fig. 5 is the schematic diagram that is connected with mobile terminal signal of ears bluetooth earphone of one embodiment of the invention.
Embodiment
The present invention design concept be:Using the first Bluetooth address prestored and the second Bluetooth address, alternately connection first is blueTooth earphone and the second bluetooth earphone, obtain the first bluetooth earphone, the dump energy of the second bluetooth earphone respectively;According to the first bluetoothThe dump energy of the dump energy of earphone and the second bluetooth earphone, is dynamically determined principal and subordinate's earphone, realizes that mobile terminal can spiritThe more earphone of selection dump energy living is attached.
Embodiment one
Fig. 1 is a kind of flow chart of the method for connection ears bluetooth earphone of one embodiment of the invention, as shown in figure 1,The ears bluetooth earphone includes the first bluetooth earphone and the second bluetooth earphone;
In step s 110, alternately first bluetooth is connected using the first Bluetooth address prestored and the second Bluetooth addressEarphone and second bluetooth earphone.
In one embodiment of the invention, the first Bluetooth address matches with the first bluetooth earphone;Second bluetoothAddress matches with the second bluetooth earphone.Alternately connection is to detect the first bluetooth earphone and the second bluetooth earphone respectivelyDump energy.
In the step s 120, first bluetooth earphone, the dump energy of second bluetooth earphone are obtained respectively.
In step s 130, according to the residue of the dump energy of first bluetooth earphone and second bluetooth earphoneElectricity, determines principal and subordinate's earphone.
In step S140, built using the corresponding Bluetooth address of main earphone with determining with the main earphone determinedVertical bluetooth connection, and control the main earphone determined connect determine from earphone.
Pass through the method shown in Fig. 1, technical scheme, by using the first Bluetooth address prestored andTwo Bluetooth address alternately connect the first bluetooth earphone and the second bluetooth earphone, it is ensured that mobile terminal can both connect the first bluetoothEarphone can also connect the second bluetooth earphone, and ensure that mobile terminal can detect the residue of the first bluetooth earphone respectivelyThe dump energy of electricity and the second bluetooth earphone, so that according to the dump energy of the first bluetooth earphone and the second bluetooth earphoneDump energy determines principal and subordinate's earphone, and then uses main earphone of the Bluetooth address corresponding with the main earphone determined with determining to buildVertical bluetooth connection, and control that the main earphone determined connection determines from earphone, realize the intelligence switching of principal and subordinate's earphone, dropThe low power consumption of system, has reached that mobile terminal can flexibly select the more earphones of dump energy to be attached, and extends doubleThe call duration time of ear wireless headset, improves Consumer's Experience.
In order that the solution of the present invention becomes apparent from, explain for a specific example below.Fig. 2 is the present invention oneThe flow chart of the method for another connection ears bluetooth earphone of individual embodiment, as shown in Fig. 2
In step s 201, in one embodiment of the invention, the first bluetooth earphone and the second bluetooth earphone pass through nothingLine bluetooth communication agreement (True Wireless, TWS) carries out pairing connection;
In step S202, mobile terminal by the first Bluetooth address and the second Bluetooth address respectively with the first bluetooth earphoneAlternately connected with the second bluetooth earphone;Because Bluetooth address is matched one by one, therefore mobile terminal can pass through the first bluetoothAddress is connected with the first bluetooth earphone, can also be connected by the second Bluetooth address with the second bluetooth earphone.Prestore the first bluetoothAddress is to realize that mobile terminal connects with the first bluetooth earphone and replacing for the second bluetooth earphone with the purpose of the second Bluetooth addressConnect.
In step S203, the dump energy of the first bluetooth earphone and the second bluetooth earphone is detected respectively;
In step S204, the first electricity preset value (such as 40 milliamperes, 40mA) is set and the second electricity preset value is (for example15 milliamperes, 15mA);It should be noted that in actual applications, the span of the first electricity preset value can for [35mA,45mA];The span of second electricity preset value can be [10mA, 20mA];Judge first it is detected that bluetooth earphone it is surplusWhether remaining electricity is more than the first electricity preset value (40mA)If being judged as YES, step S205 is performed;If being judged as NO, step is performedRapid S206.
, will if the dump energy got first is more than the first electricity preset value (40mA) in step S205The bluetooth earphone determines to be main earphone, and another bluetooth earphone is defined as from earphone, builds main earphone of the mobile terminal with determiningVertical bluetooth connection, and control the main earphone determined to be connected by wireless blue tooth communications protocol from earphone.
It follows that by setting the first electricity preset value (40mA) so that as long as mobile terminal detects one of themThe dump energy of bluetooth earphone be more than the first electricity preset value (40mA), then just can at once by the bluetooth earphone determine based onEarphone, another earphone is defined as from earphone, is ensureing between mobile terminal and bluetooth earphone in the case of proper communication, to saveSRT, reduces system power dissipation.
In step S206, judge whether the dump energy of the first bluetooth earphone and the second bluetooth earphone is both less than the second electricityMeasure preset value (15mA)If being judged as YES, step S207 is performed.If being judged as NO, step S208 is performed.That is, when theThe dump energy of the dump energy of one bluetooth earphone and the second bluetooth earphone is all higher than the second electricity preset value (15mA) and is less thanDuring the first electricity preset value (40mA), step S208 is performed.
In step S207, when the dump energy and the dump energy of second bluetooth earphone of first bluetooth earphoneDuring respectively less than the second electricity preset value (15mA), using the prompt message that word or voice are single or are combined, toUser, which sends, needs the information to charging bluetooth earphone.
As can be seen here, by setting the first electricity preset value so that as long as mobile terminal detects one of bluetooth earThe dump energy of machine is more than the first electricity preset value, then just the bluetooth earphone can be determined into be main earphone at once, anotherEarphone is defined as from earphone, in the case where ensureing mobile terminal with bluetooth earphone proper communication, has saved SRT,Reduce system power dissipation.The purpose for setting the second electricity preset value is, prevents remaining when mobile terminal and two bluetooth earphonesIn the case that remaining electricity is all especially small, cause mobile terminal can not proper communication with bluetooth earphone.Second electricity preset value is setAfterwards, as long as the dump energy for detecting two bluetooth earphones is respectively less than the second electricity preset value, then word or voice can be usedPrompt message that is single or being combined, being sent to user needs the information to charging bluetooth earphone, and artificial by user is matched somebody with somebodyClose and cause mobile terminal and bluetooth earphone proper communication.
In step S208, judge whether the dump energy of the first bluetooth earphone is more than the residue electricity of the second bluetooth earphoneAmountIf being judged as YES, step S209 is performed;If being judged as NO, step S210 is performed;
, will if the dump energy of the first bluetooth earphone is more than the dump energy of the second bluetooth earphone in step S209First bluetooth earphone determines to be main earphone, and the second bluetooth earphone is defined as from earphone, makes mobile terminal and the main earphone determinedBluetooth connection is set up, and the main earphone determined described in control is connected from earphone by wireless blue tooth communications protocol.
, will if the dump energy of the second bluetooth earphone is more than the dump energy of the first bluetooth earphone in step S210Second bluetooth earphone determines to be main earphone, and the first bluetooth earphone is defined as from earphone, makes mobile terminal and the main earphone determinedBluetooth connection is set up, and the main earphone determined described in control is connected from earphone by wireless blue tooth communications protocol.
In step S211, the dump energy of main earphone is monitored.That is, in step S205, step S209 and stepS210 is determined after principal and subordinate's earphone respectively, and the dump energy of main earphone is obtained every Fixed Time Interval (such as 6 minutes, 6min),It should be noted that in actual applications, the span of the Fixed Time Interval can be [5min, 10min].
In step S212, judge whether the dump energy of main earphone is less than the second electricity preset value (15mA)If judgingIt is yes, then performs step S213.
In step S213, when judge main earphone dump energy whether be less than the second electricity preset value (15mA), thenUsing with determining from the connection of earphone corresponding Bluetooth address from earphone, and obtain the dump energy from earphone.
In step S214, judge whether be less than the second electricity preset value (15mA) from the dump energy of earphoneIf judgingIt is yes, then performs step S210, that is to say, that after principal and subordinate's earphone is determined, continues that the electricity of principal and subordinate's earphone is continued to monitor,When electricity is less than the second electricity preset value (15mA) to discovery principal and subordinate's earphone in use, word or voice list can be usedOne or the prompt message that is combined, being sent to user needs the information to charging bluetooth earphone, passes through the artificial cooperation of userSo that mobile terminal and bluetooth earphone proper communication;It is judged as NO, then performs step S215.
In step S215, during principal and subordinate's earphone use, when the residual electricity amount for monitoring main earphone is less than the second electricityPreset value (15mA), but be more than the second electricity preset value (15mA) from the dump energy of earphone, then by the principal and subordinate determined beforeEarphone carries out role transforming so that ears wireless headset can continue normally to be communicated with mobile terminal.As can be seen here, it is mainFrom earphone switch unit, interval monitors the dump energy of main earphone at predetermined time intervals in principal and subordinate's earphone course of work, works as discoveryWhen the dump energy of main earphone is less than the second preset value, continue to monitor from the dump energy of earphone, if from the dump energy of earphoneMore than the second preset value, then the principal and subordinate's earphone determined before making carries out role transforming, that is to say, that by electricity it is sufficient from earphoneConvert and re-establish Bluetooth communication for main earphone and mobile terminal and be connected, still entered between two bluetooth earphones by TWS agreementsRow communication, even if so that in ears wireless headset during the not enough power supply of bluetooth earphone, still can be with mobile terminalProper communication, solves main earphone role in the prior art and fixes, once main earphone not enough power supply, then ears wireless headset can notWith mobile terminal proper communication, it is necessary to carry out charging process to main earphone, ears wireless headset could be realized with movement eventually againThe problem of proper communication at end, the call duration time of ears wireless headset is extended, Consumer's Experience is improved.
Embodiment two
Fig. 3 is a kind of structural representation of the device of connection ears bluetooth earphone of one embodiment of the invention, such as Fig. 3 institutesShow, a kind of device 300 for connecting ears bluetooth earphone, the ears bluetooth earphone includes the first bluetooth earphone and the second bluetooth earMachine, the device 300 includes:
Alternating connection unit 310, for alternately connecting described using the first Bluetooth address prestored and the second Bluetooth addressFirst bluetooth earphone and second bluetooth earphone;
Electricity acquiring unit 320, the residue electricity for obtaining first bluetooth earphone, second bluetooth earphone respectivelyAmount;
Principal and subordinate's earphone determining unit 330, for the dump energy according to first bluetooth earphone and second indigo plantThe dump energy of tooth earphone, determines principal and subordinate's earphone;
Principal and subordinate's earphone connection unit 340, for being determined using Bluetooth address corresponding with the main earphone determined with describedThe main earphone gone out sets up bluetooth connection, and control the main earphone determined connect determine from earphone.
Technical scheme, first, by alternately connection unit 310 respectively using the first Bluetooth address for prestoring andSecond Bluetooth address alternately connects the first bluetooth earphone and the second bluetooth earphone, it is ensured that it is blue that mobile terminal can both connect firstTooth earphone can also connect the second bluetooth earphone, and ensure that mobile terminal can detect the surplus of the first bluetooth earphone respectivelyThe dump energy of remaining electricity and the second bluetooth earphone;Secondly, using electricity acquiring unit 320 obtain respectively the first bluetooth earphone,The dump energy of second bluetooth earphone;Furthermore with dump energy of the principal and subordinate's earphone determining unit 330 according to the first bluetooth earphoneAnd second the dump energy of bluetooth earphone determine principal and subordinate's earphone;Finally, used and determination using principal and subordinate's earphone connection unit 340The corresponding Bluetooth address of main earphone gone out sets up bluetooth connection with the main earphone determined, and controls the main earphone determined to connectDetermine from earphone.Technical scheme realizes the intelligence switching of principal and subordinate's earphone, reduces the power consumption of system, reachesMobile terminal can flexibly select the more earphones of dump energy to be attached, when extending the communication of ears wireless headsetBetween, improve Consumer's Experience.
Fig. 4 is the structural representation of the device of another connection ears bluetooth earphone of one embodiment of the invention, such as Fig. 4Shown, described device also includes electricity setting unit 350;
The electricity setting unit 350, for setting the first electricity preset value and the second electricity preset value, second electricityMeasure preset value and be less than the first electricity preset value;
Principal and subordinate's earphone determining unit 330, specifically for the dump energy got first is more than into the described first electricityThe bluetooth earphone for measuring preset value determines to be main earphone, and another earphone is defined as from earphone.
It follows that by setting the first electricity preset value so that as long as mobile terminal detects one of bluetooth earThe dump energy of machine is more than the first electricity preset value, then just the bluetooth earphone can be determined into be main earphone at once, anotherEarphone is defined as from earphone, in the case where ensureing mobile terminal with bluetooth earphone proper communication, has saved SRT,Reduce system power dissipation.
In one embodiment of the invention, as shown in figure 4, described device also includes prewarning unit 360;
The prewarning unit 360, for the dump energy when first bluetooth earphone and second bluetooth earphoneWhen dump energy is respectively less than the second electricity preset value, using the prompt message of word, voice or image, sent to userBluetooth earphone needs to adjust the information of charging, causes mobile terminal and bluetooth earphone proper communication by the artificial cooperation of user.
In one embodiment of the invention, principal and subordinate's earphone determining unit 330, if also particularly useful for the first bluetooth earThe dump energy of the dump energy of machine and the second bluetooth earphone is respectively less than the first electricity preset value and more than the second electricity preset value;Then judge whether the dump energy of first bluetooth earphone is more than the dump energy of second bluetooth earphone;If so, then willFirst bluetooth earphone determines to be main earphone, and second bluetooth earphone is defined as from earphone;If it is not, then blue by described secondTooth earphone determines to be main earphone, and first bluetooth earphone is defined as from earphone.
In one embodiment of the invention, as shown in figure 4, described device also includes principal and subordinate's earphone switch unit 370;
Principal and subordinate's earphone switch unit 370, obtains described for being spaced (such as 6 minutes, 6min) at predetermined time intervalsThe electricity for the main earphone determined;Whether the electricity for the main earphone determined described in judging is less than second preset value, if so,Then use with it is described determine from being determined described in the connection of earphone corresponding Bluetooth address from earphone, and obtain the determinationThe electricity from earphone gone out;Whether the electricity from earphone determined described in judging is less than second preset value, if it is not, then rightThe principal and subordinate's earphone determined before carries out role transforming.
As can be seen here, interval monitors main ear to principal and subordinate's earphone switch unit at predetermined time intervals in principal and subordinate's earphone course of workThe dump energy of machine, when the dump energy for finding main earphone is less than the second preset value, continues to monitor the dump energy from earphone,If being more than the second preset value from the dump energy of earphone, the principal and subordinate's earphone determined before order carries out role transforming, that is to say, thatSufficient the converting from earphone of electricity is re-established into Bluetooth communication with mobile terminal for main earphone to be connected, between two bluetooth earphonesStill communicated by TWS agreements, even if so that in ears wireless headset during the not enough power supply of bluetooth earphone, according toIt is old to solve main earphone role in the prior art with mobile terminal proper communication and fix, once main earphone not enough power supply, thenEars wireless headset can not be with mobile terminal proper communication, it is necessary to carry out charging process to main earphone, ears could be realized againThe problem of proper communication of wireless headset and mobile terminal, the call duration time of ears wireless headset is extended, user's body is improvedTest.
In one embodiment of the invention, Fig. 5 is the ears bluetooth earphone and mobile terminal of one embodiment of the inventionSignal connection schematic diagram, if as shown in figure 5, the first bluetooth earphone 410 be main earphone, the second bluetooth earphone 420 be from earphone,Then the first bluetooth earphone 410 is connected with the second bluetooth earphone 420 by the progress pairing of wireless blue tooth communications protocol, while first is blueCommunicated between tooth earphone 410 and mobile terminal 430 by bluetooth communication agreement (Classic BT).Mobile terminal 430 canTo be smart mobile phone, tablet personal computer, MP3, MP4 and MP5 etc..
In summary, technical scheme, is handed over by using the first Bluetooth address prestored and the second Bluetooth addressFor the first bluetooth earphone of connection and the second bluetooth earphone, it is ensured that mobile terminal, which can both connect the first bluetooth earphone, to be connectedThe second bluetooth earphone is connect, and ensure that mobile terminal can detect the dump energy and the second indigo plant of the first bluetooth earphone respectivelyThe dump energy of tooth earphone, so as to be determined according to the dump energy of the dump energy of the first bluetooth earphone and the second bluetooth earphonePrincipal and subordinate's earphone, and then bluetooth connection is set up using Bluetooth address corresponding with the main earphone determined and the main earphone determined,And control that the main earphone determined connection determines from earphone, realize the intelligence switching of principal and subordinate's earphone, reduce systemPower consumption, has reached that mobile terminal can flexibly select the more earphones of dump energy to be attached, has extended ears wireless headsetCall duration time, improve Consumer's Experience.
Presently preferred embodiments of the present invention is these are only, is not intended to limit the scope of the present invention.It is all in this hairAny modification, equivalent substitution and improvements made within bright spirit and principle etc., are all contained in protection scope of the present invention.