A kind of bluetooth earphone and its matching method, Bluetooth chip and storage device
Technical field
The invention belongs to blue-tooth technology field, more particularly to a kind of bluetooth earphone and its matching method, Bluetooth chip
And storage device.
Background technology
Bluetooth technology is the technology of a kind of low cost, low-power and short-distance wireless communication, can be widely applied to earphone
On.User can exempt irritating electric wire by bluetooth earphone and impede, the easily call in a variety of ways of comfortable ground.
With various mobile intelligent terminals(Such as mobile phone, tablet personal computer)Popularization, wireless headset also receives an acclaim all the more
With use.Sometimes, people can carry with mobile phone or other mobile intelligent terminals, by bus, walking along the street or listen to during rest each
Class music or learning materials are simultaneously shared with current friend.Therefore, the wireless sharing mode of bluetooth earphone be also it is a kind of very
Popular mode.
In the bluetooth earphone sharing mode of prior art, bluetooth earphone is generally divided into main earphone and from earphone, principal and subordinate's earphone
Need to carry out pairing connection, data transfer and the synchronization of audio are carried out after connection is upper, it is to allow main earphone by button typically to connect
Into main headset mode, enter from earphone from headset mode, then main earphone goes connection from earphone, or go from earphone to connect main ear
Machine.
As shown in figure 1, the connected mode between existing master-slave equipment is as follows:The bluetooth sources of sound such as main earphone connection mobile phone are set
It is standby, it is attached from earphone and main earphone, realizes and played with main earphone synchronous music and information exchange.However, this principal and subordinate's ear
Need to be configured earphone in the matching method of machine, when using every time, also, in the case where main earphone is not powered on, from
Earphone cannot be connected directly to bluetooth audiogenic device, cause inconvenient for use.
The content of the invention
The embodiments of the invention provide a kind of bluetooth earphone and its matching method, Bluetooth chip and storage device, it is intended to solves
Certainly existing the problem of.
In embodiments of the present invention there is provided a kind of bluetooth earphone, it includes:
Random number generation unit, for generating random number in real time after bluetooth earphone start;
Mode of operation selecting unit, it is described for the mode of operation of bluetooth earphone described in the type selecting according to the random number
The mode of operation of bluetooth earphone includes main headset mode and from headset mode;
Bluetooth connection unit, it is blue with outside using search synchronous head ID bags within the residence time of current mode of operation
Tooth equipment is attached;
The mode of operation selecting unit, when the residence time for being additionally operable to current operation mode expires, according to the random number
Type re-starts selection to the mode of operation of the bluetooth earphone, until the upper outside bluetooth of bluetooth connection unit connection is set
It is standby.
In embodiments of the present invention, the bluetooth earphone is under main headset mode, at regular intervals to the search
Synchronous head ID bags are switched over, and the search and connection of outside bluetooth audiogenic device are waited using universal search synchronous head ID bags, is adopted
The search and connection from earphone are waited with self-defined search synchronous head ID bags.
In embodiments of the present invention, the LAP values of the universal search synchronous head ID bags are 0x9E8B33.
In embodiments of the present invention, the bluetooth earphone searches for synchronous head ID bags under headset mode using self-defined
Removal search and the main earphone of connection.
In embodiments of the present invention, the residence time of current mode of operation for it is corresponding with the random number random when
Between.
In embodiments of the present invention, a kind of matching method of bluetooth earphone is additionally provided, it includes:
Random number produces step:Random number is generated in real time after bluetooth earphone start;
Mode of operation selects step:The mode of operation of bluetooth earphone according to the type selecting of the random number, the bluetooth
The mode of operation of earphone includes main headset mode and from headset mode;
Bluetooth connection step:Within the residence time of current mode of operation, set using search synchronous head ID bags with outside bluetooth
It is standby to be attached;
In the bluetooth connection step, if the bluetooth earphone is connected to outside bluetooth equipment, its mode of operation is kept not
Become;If when the residence time of current operation mode expires, the bluetooth earphone is not connected to outside bluetooth equipment, then jumps
The mode of operation selection step is gone to, the mode of operation according to the type of the random number again to the bluetooth earphone is carried out
Selection, until the upper outside bluetooth equipment of bluetooth earphone connection.
In embodiments of the present invention, when current operation mode is main headset mode, in the bluetooth connection step, interval one
The fixed time switches over to the search synchronous head ID bags, waits outside bluetooth source of sound to set using universal search synchronous head ID bags
Standby search and connection, the search and connection from earphone are waited using self-defined search synchronous head ID bags.
In embodiments of the present invention, the LAP values of the universal search synchronous head ID bags are 0x9E8B33.
In embodiments of the present invention, when current operation mode is main headset mode, in the bluetooth connection step, using certainly
Definition search synchronous head ID bags removal search and the main earphone of connection.
In embodiments of the present invention, in the bluetooth connection step, residence time of current mode of operation be with it is described
The corresponding random time of random number.
In embodiments of the present invention, a kind of Bluetooth chip is additionally provided, the Bluetooth chip includes an at least processor, deposited
Reservoir and interface, at least a processor, memory and the interface are connected by bus;
The memory storage computer executed instructions;
The computer executed instructions of memory storage described at least one described computing device so that described image process chip
Perform the matching method of above-mentioned bluetooth earphone.
In embodiments of the present invention, the instruction that is stored with a kind of storage device, the storage device is additionally provided, it is described to refer to
The step of order realizes the matching method of above-mentioned bluetooth earphone when being executed by processor.
Compared with prior art, using above-mentioned bluetooth earphone and its matching method, Bluetooth chip and storage device, bluetooth
Earphone has main headset mode and from earphone both of which, is switched over by random number, and two earphones are simultaneously in use, wherein
When one earphone connects upper external sound source equipment or connected with another earphone, the pattern of two earphones is just secured, from
And can realize between two earphones and carry out automatic matching between earphone and external sound source equipment, without setting manually, make
Use more convenient.
Brief description of the drawings
Fig. 1 is the schematic diagram of the bluetooth earphone connection of prior art of the present invention.
Fig. 2 is the structure chart for the bluetooth earphone that the embodiment of the present invention one is provided;
Fig. 3 is the workflow diagram for the bluetooth earphone that the embodiment of the present invention one is provided;
Fig. 4 is the flow chart of the matching method for the bluetooth earphone that the embodiment of the present invention two is provided;
Fig. 5 is the structural representation for the Bluetooth chip that the embodiment of the present invention three is provided.
Embodiment
In order to make the purpose , technical scheme and advantage of the present invention be clearer, it is right below in conjunction with drawings and Examples
The present invention is further elaborated.It should be appreciated that the specific embodiments described herein are merely illustrative of the present invention, and
It is not used in the restriction present invention.
The realization of the present invention is described in detail below in conjunction with specific embodiment:
Embodiment one
Fig. 2 shows the structure chart for the bluetooth earphone that the embodiment of the present invention one is provided, and the bluetooth earphone is produced including random number
Unit 11, mode of operation selecting unit 12 and bluetooth connection unit 13.It is described in detail separately below.
The random number generation unit 11, for generating random number in real time after bluetooth earphone start.
Fig. 3 shows the workflow diagram for the bluetooth earphone that the embodiment of the present invention one is provided.The work of the bluetooth earphone
Pattern includes main headset mode and from headset mode.Under main headset mode, the bluetooth earphone is used for and external sound source equipment
Carry out bluetooth connection.Under headset mode, the bluetooth earphone is used to be connected to the bluetooth earphone under main headset mode,
So as to obtain the voice data of external sound source equipment by the bluetooth earphone under the main headset mode.The random number is used for
It is the so main headset mode and can from headset mode into main headset mode or from headset mode to determine the bluetooth earphone
To have certain change and randomness, it is impossible to each bluetooth earphone be all main headset mode or be all from headset mode, can be each
Judge to enter main headset mode after startup according to random number still from headset mode, can thus bring it is certain it is random with
Change.
The mode of operation selecting unit 12, the work for bluetooth earphone described in the type selecting according to the random number
Pattern.When random number is odd number, the mode of operation selecting unit 12 sets the mode of operation of the bluetooth earphone for main ear
Machine pattern.Random number be even number when, the mode of operation selecting unit 12 by the mode of operation of the bluetooth earphone be set to from
Headset mode.
The bluetooth connection unit 13, within the residence time of current mode of operation, using search synchronous head ID
Bag is attached with outside bluetooth equipment.If the bluetooth connection unit 13 is connected to outside bluetooth equipment, keep described
The mode of operation of bluetooth earphone is constant.
The mode of operation selecting unit 12, when the residence time for being additionally operable to current operation mode expires, according to it is described with
The type of machine number re-starts selection to the mode of operation of the bluetooth earphone, until the bluetooth connection unit 13 connection is upper outer
Portion's bluetooth equipment.
The residence time of current operation mode can be the time of setting.Preferably, the residence time of current operation mode
Can also be the random time corresponding with the random number.The residence time carries out randomization, so that using two indigo plants
During tooth earphone, it is ensured that a bluetooth earphone has main headset mode and another bluetooth earphone to have the overlapping time from headset mode
Matched.If without main headset mode and the switching from headset mode and use random residence time is carried out at random, there is one kind
It is probably that it is all main headset mode that two bluetooth earphones, which start, and if all stopping 1s, the two bluetooth earphones always connect not
On.
The bluetooth earphone is under main headset mode, it is necessary to be carried out at regular intervals to the search synchronous head ID bags
Switching, the search and connection of outside bluetooth audiogenic device are waited using universal search synchronous head ID bags, same using self-defined search
Walk search and connection of the wait of head ID bags from earphone.According to Bluetooth specification, the LAP of the universal search synchronous head ID bags(Low land
Location part)It is worth for 0x9E8B33.The bluetooth earphone searches for synchronous head ID bag removal search under headset mode using self-defined
With the main earphone of connection.In order to realize main earphone and from the secret connection between earphone, LAP can be defined as to both sides' agreement
Good privately owned value, so only main earphone and can scan for and connect between earphone.
Because above-mentioned bluetooth earphone has main headset mode and from earphone both of which, switched over by random number, two
Individual earphone is simultaneously in use, the upper external sound source equipment of one of earphone connection or during with the connection of another earphone, two
The pattern of earphone is just secured, so as to realize between two earphones and earphone and external sound source equipment between carry out it is automatic
Pairing, without setting manually, is used more convenient.
Embodiment two
Fig. 4 shows the matching method for the bluetooth earphone that the embodiment of the present invention two is provided, and it includes step S1- steps S3.Below
It is described in detail.
Step S1, random number produce step:Random number is generated in real time after bluetooth earphone start.
Step S2, mode of operation selection step:The Working mould of bluetooth earphone according to the type selecting of the random number
Formula, the mode of operation of the bluetooth earphone includes main headset mode and from headset mode.
Step S3, bluetooth connection step:Within the residence time of current mode of operation, using search synchronous head ID bags and
Outside bluetooth equipment is attached.
Wherein, in step S2, when random number is odd number, the mode of operation of the bluetooth earphone is set as main earphone mould
Formula.When random number is even number, the mode of operation of the bluetooth earphone is set to from headset mode.
Wherein, in step S3, if the bluetooth earphone is connected to outside bluetooth equipment, its mode of operation is kept not
Become;If when the residence time of current operation mode expires, the bluetooth earphone is not connected to outside bluetooth equipment, then jumps
Step S2 is gone to, the mode of operation according to the type of the random number again to the bluetooth earphone is selected, until described
The upper outside bluetooth equipment of bluetooth earphone connection.
In the present embodiment, when current operation mode is main headset mode, in the bluetooth connection step, it is spaced necessarily
Time is switched over to the search synchronous head ID bags, and outside bluetooth audiogenic device is waited using universal search synchronous head ID bags
Search and connection, the search and connection from earphone are waited using self-defined search synchronous head ID bags.The universal search synchronous head
The LAP values of ID bags are 0x9E8B33.When current operation mode is main headset mode, in the bluetooth connection step, using making by oneself
Justice search synchronous head ID bags removal search and the main earphone of connection.
In embodiment, the residence time of current operation mode can be the time of setting.Preferably, the residence time
Can also be the random time corresponding with the random number.The residence time carries out randomization, so that using two indigo plants
During tooth earphone, it is ensured that a bluetooth earphone has main headset mode and another bluetooth earphone to have the overlapping time from headset mode
Matched.
Embodiment three
As shown in figure 5, the embodiment of the present invention three is provided in embodiments of the present invention there is provided a kind of Bluetooth chip, it is included at least
One processor 310, memory 320 and interface 330, at least a processor 310, memory 320 and the interface 330 are by total
Line is connected;
The memory 320 stores computer executed instructions;
At least one described processor 310 performs the computer executed instructions that the memory 320 is stored so that at described image
Manage the matching method that chip performs the bluetooth earphone described in embodiment two.
The embodiment of the present invention also provides the instruction that is stored with a kind of storage device, the storage device, and the instruction is located
Reason device realizes the matching method of the bluetooth earphone described in embodiment two when performing the step of.
In summary, using above-mentioned bluetooth earphone and its matching method, Bluetooth chip and storage device, bluetooth earphone has
Main headset mode and from earphone both of which, is switched over by random number, and two earphones are simultaneously in use, one of earphone
In connection external sound source equipment or with another earphone connection on when, the pattern of two earphones is just secured, so as to reality
Automatic matching is carried out between existing two earphones and between earphone and external sound source equipment, without setting manually, is used more
It is convenient
It is worth noting that, one of ordinary skill in the art will appreciate that:The step of realizing above method embodiment or part are walked
Suddenly it can be completed by the related hardware of programmed instruction, foregoing program can be stored in computer read/write memory medium
In, the program upon execution, performs the step of including above method embodiment, and foregoing storage medium includes:ROM、RAM、
Magnetic disc or CD etc. are various can be with the medium of store program codes.
The foregoing is merely illustrative of the preferred embodiments of the present invention, is not intended to limit the invention, all essences in the present invention
Any modifications, equivalent substitutions and improvements made within refreshing and principle etc., should be included in the scope of the protection.