A kind of bluetooth headset 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 headsets and its matching method, Bluetooth chip
And storage device.
Background technique
Bluetooth technology is a kind of low cost, the technology of low-power and short-distance wireless communication, can be widely applied to earphone
On.User can exempt irritating electric wire by bluetooth headset and impede, the easily call in various ways of comfortable ground.
With popularizing for various mobile intelligent terminals (such as mobile phone, tablet computer), wireless headset also more receives an acclaim
With use.Sometimes, people can carry mobile phone or other mobile intelligent terminals, by bus, walking along the street or when rest listen to it is each
Class music or learning materials are simultaneously shared with current friend.Therefore, the wireless sharing mode of bluetooth headset be also it is a kind of very
Popular mode.
In the bluetooth headset sharing mode of the prior art, bluetooth headset is generally divided into main earphone and from earphone, principal and subordinate's earphone
Need to carry out pairing connection, in connection after carry out the data transmission of audio with it is synchronous, generally connecting is to allow main earphone by key
Into main headset mode, enter from earphone from headset mode, then main earphone goes connection from earphone, or goes to connect main ear from earphone
Machine.
As shown in Figure 1, the connection type between existing master-slave equipment is as follows: the bluetooths source of sound such as main earphone connection mobile phone is set
It is standby, it is attached, realizes and the broadcasting of main earphone synchronous music and information exchange from earphone and main earphone.However, this principal and subordinate's ear
In the matching method of machine, need to be configured earphone 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.
Summary of the invention
The embodiment of the invention provides a kind of bluetooth headset and its matching methods, Bluetooth chip and storage device, it is intended to solve
Certainly existing problem.
In embodiments of the present invention, a kind of bluetooth headset is provided comprising:
Random number generation unit, for generating random number in real time after bluetooth headset booting;
Operating mode selecting unit, for selecting the operating mode of the bluetooth headset according to the type of the random number,
The operating mode of the bluetooth headset includes main headset mode and from headset mode;
Bluetooth connection unit, within the residence time of current operating mode, using search synchronous head ID packet with outside
Portion's bluetooth equipment is attached;
The operating mode selecting unit, when being also used to residence time of current operation mode and expiring, according to described random
Several types re-starts selection to the operating mode of the bluetooth headset, until the bluetooth connection unit connects upper external indigo plant
Tooth equipment.
In embodiments of the present invention, the bluetooth headset is under main headset mode, at regular intervals to described search
Synchronous head ID packet switches over, and the search and connection of external bluetooth audiogenic device are waited using universal search synchronous head ID packet, is adopted
Search and connection from earphone are waited with customized search synchronous head ID packet.
In embodiments of the present invention, the LAP value of the universal search synchronous head ID packet is 0x9E8B33.
In embodiments of the present invention, the bluetooth headset is under headset mode, using customized search synchronous head ID packet
Removal search and the main earphone of connection.
In embodiments of the present invention, when the residence time of current operating mode is corresponding with the random number random
Between.
In embodiments of the present invention, a kind of matching method of bluetooth headset is additionally provided comprising:
Random number generates step: generating random number in real time after bluetooth headset booting;
Operating mode selects step: the operating mode of the bluetooth headset is selected according to the type of the random number, it is described
The operating mode of bluetooth headset includes main headset mode and from headset mode;
Bluetooth connection step: blue using search synchronous head ID packet and outside within the residence time of current operating mode
Tooth equipment is attached;
In the bluetooth connection step, if the bluetooth headset is connected to external bluetooth equipment, its Working mould is kept
Formula is constant;If the bluetooth headset is not connected to external bluetooth equipment when the residence time of current operation mode expires,
The operating mode selection step is then jumped to, according to the type of the random number again to the operating mode of the bluetooth headset
It is selected, until the bluetooth headset connects upper external bluetooth equipment.
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 described search synchronous head ID packet, waits external bluetooth source of sound to set using universal search synchronous head ID packet
Standby search and connection waits search and connection from earphone using customized search synchronous head ID packet.
In embodiments of the present invention, the LAP value of the universal search synchronous head ID packet is 0x9E8B33.
In embodiments of the present invention, when current operation mode is from headset mode, in the bluetooth connection step, using from
Definition search synchronous head ID packet removal search and the main earphone of connection.
In embodiments of the present invention, in the bluetooth connection step, residence time of current operating mode 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, deposits
Reservoir and interface, at least a processor, memory and the interface are connected by bus;
The memory stores computer executed instructions;
At least one described processor executes the computer executed instructions of the memory storage, so that described image is handled
Chip executes the matching method of above-mentioned bluetooth headset.
In embodiments of the present invention, a kind of storage device is additionally provided, instruction, the finger are stored on the storage device
The step of order realizes the matching method of above-mentioned bluetooth headset when being executed by processor.
Compared with prior art, using above-mentioned bluetooth headset 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
As soon as earphone connects upper external sound source equipment or connects with another earphone, the mode of two earphones is secured, from
And may be implemented to carry out automatic matching between two earphones and between earphone and external sound source equipment, it is not necessarily to manual setting, is made
It uses more convenient.
Detailed description of the invention
Fig. 1 is the schematic diagram of the bluetooth headset connection of the prior art of the present invention.
Fig. 2 is the structure chart for the bluetooth headset that the embodiment of the present invention one provides;
Fig. 3 is the work flow diagram for the bluetooth headset that the embodiment of the present invention one provides;
Fig. 4 is the flow chart of the matching method of bluetooth headset provided by Embodiment 2 of the present invention;
Fig. 5 is the structural schematic diagram for the Bluetooth chip that the embodiment of the present invention three provides.
Specific embodiment
In order to make the objectives, technical solutions, and advantages of the present invention clearer, with reference to the accompanying drawings and embodiments, right
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.
Realization of the invention is described in detail below in conjunction with specific embodiment:
Embodiment one
Fig. 2 shows the structure charts for the bluetooth headset that the embodiment of the present invention one provides, and the bluetooth headset includes random number
Generate unit 11, operating mode 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 headset booting.
Fig. 3 shows the work flow diagram of the bluetooth headset of the offer of the embodiment of the present invention one.The work of the bluetooth headset
Mode includes main headset mode and from headset mode.Under main headset mode, the bluetooth headset is used for and external sound source equipment
Carry out bluetooth connection.Under headset mode, the bluetooth headset is used to be connected to the bluetooth headset under main headset mode,
To obtain the audio data of external sound source equipment by the bluetooth headset under the main headset mode.The random number is used for
Determine that the bluetooth headset is the headset mode main in this way and can from headset mode into main headset mode or from headset mode
To have certain variation and randomness, cannot every time bluetooth headset be all main headset mode or be all from headset mode, can be each
Judge to enter main headset mode after starting according to random number still from headset mode, can thus bring it is certain it is random with
Variation.
The operating mode selecting unit 12, for selecting the work of the bluetooth headset according to the type of the random number
Mode.When random number is odd number, the operating mode of the bluetooth headset is arranged as main ear the operating mode selecting unit 12
Machine mode.Random number be even number when, the operating mode selecting unit 12 by the operating mode of the bluetooth headset be set as from
Headset mode.
The bluetooth connection unit 13, within the residence time of current operating mode, using search synchronous head ID
Packet is attached with external bluetooth equipment.If the bluetooth connection unit 13 is connected to external bluetooth equipment, keep described in
The operating mode of bluetooth headset is constant.
The operating mode selecting unit 12, when being also used to residence time of current operation mode and expiring, according to it is described with
The type of machine number re-starts selection to the operating mode of the bluetooth headset, 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
It is also possible to random time corresponding with the random number.The residence time is randomized, thus using two indigo plants
When tooth earphone, guarantee that a bluetooth headset has the slave headset mode of main headset mode and another bluetooth headset to have the overlapping time
It is matched.If not carrying out main headset mode and switching and use random residence time from headset mode at random, there is one kind
It may be that two bluetooth headset startings are all main headset modes, if all stop 1s, the two bluetooth headsets always connect not
On.
The bluetooth headset at regular intervals carries out described search synchronous head ID packet between needing under main headset mode
Switching waits the search and connection of external bluetooth audiogenic device using universal search synchronous head ID packet, same using customized search
Walk search and connection of the waiting of head ID packet from earphone.According to Bluetooth specification, the LAP (low land of the universal search synchronous head ID packet
Location part) value be 0x9E8B33.The bluetooth headset is under headset mode, using customized search synchronous head ID packet removal search
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, earphone only main in this way and can scan for and connect between earphone.
Because above-mentioned bluetooth headset has main headset mode and from earphone both of which, switched over by random number, two
A earphone is simultaneously in use, when one of earphone connects upper external sound source equipment or connects with another earphone, and two
The mode of earphone just secures, so as to realize between two earphones and carry out between earphone and external sound source equipment automatic
Pairing is not necessarily to manual setting, uses more convenient.
Embodiment two
Fig. 4 shows the matching method of bluetooth headset provided by Embodiment 2 of the present invention comprising step S1- step S3.
It is illustrated in detail below.
Step S1, random number generates step: generating random number in real time after bluetooth headset booting.
Step S2, operating mode selects step: the Working mould of the bluetooth headset is selected according to the type of the random number
Formula, the operating mode of the bluetooth headset include main headset mode and from headset mode.
Step S3, bluetooth connection step: within the residence time of current operating mode, using search synchronous head ID packet and
External bluetooth equipment is attached.
Wherein, in step S2, when random number is odd number, the operating mode of the bluetooth headset is arranged as main earphone mould
Formula.When random number is even number, set the operating mode of the bluetooth headset to from headset mode.
Wherein, in step S3, if the bluetooth headset is connected to external bluetooth equipment, its operating mode is kept not
Become;If the bluetooth headset is not connected to external bluetooth equipment when the residence time of current operation mode expires, then jump
Step S2 is gone to, the operating mode of the bluetooth headset is selected again according to the type of the random number, until described
The upper external bluetooth equipment of bluetooth headset connection.
In the present embodiment, it when current operation mode is main headset mode, in the bluetooth connection step, is spaced certain
Time switches over described search synchronous head ID packet, waits external bluetooth audiogenic device using universal search synchronous head ID packet
Search and connection wait search and connection from earphone using customized search synchronous head ID packet.The universal search synchronous head
The LAP value of ID packet is 0x9E8B33.When current operation mode is from headset mode, in the bluetooth connection step, using making by oneself
Justice search synchronous head ID packet 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
It is also possible to random time corresponding with the random number.The residence time is randomized, thus using two indigo plants
When tooth earphone, guarantee that a bluetooth headset has the slave headset mode of main headset mode and another bluetooth headset to have the overlapping time
It is matched.
Embodiment three
As shown in figure 5, the embodiment of the present invention three provides in embodiments of the present invention, a kind of Bluetooth chip is provided comprising
At least a processor 310, memory 320 and interface 330, at least a processor 310, memory 320 and the interface 330 are logical
Cross bus connection;
The memory 320 stores computer executed instructions;
At least one described processor 310 executes the computer executed instructions that the memory 320 stores, so that the figure
As processing chip executes the matching method of bluetooth headset described in embodiment two.
The embodiment of the present invention also provides a kind of storage device, and instruction is stored on the storage device, and described instruction is located
Manage the step of realizing the matching method of bluetooth headset described in embodiment two when device executes.
In conclusion being had using above-mentioned bluetooth headset and its matching method, Bluetooth chip and storage device, bluetooth headset
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
External sound source equipment or when connecting with another earphone in connection, the mode of two earphones just secures, so as to reality
Automatic matching is carried out between existing two earphones and between earphone and external sound source equipment, manual setting is not necessarily to, uses more
It is convenient
It is worth noting that, those of ordinary skill in the art will appreciate that: the step of realizing above method embodiment or portion
This can be accomplished by hardware associated with program instructions step by step, and program above-mentioned can store to be situated between in computer-readable storage
In matter, which when being executed, executes step including the steps of the foregoing method embodiments, and storage medium above-mentioned include: ROM,
The various media that can store program code such as RAM, magnetic or disk.
The foregoing is merely illustrative of the preferred embodiments of the present invention, is not intended to limit the invention, all in essence of the invention
Made any modifications, equivalent replacements, and improvements etc., should all be included in the protection scope of the present invention within mind and principle.