The content of the invention
The embodiment of the present invention provides connection method and the device of a kind of low-power consumption bluetooth, without manually extra selection equipment
Master slave relation, connection is more convenient, simplifies the complexity of user's operation, improves user experience.
The embodiment of the present invention uses following technical scheme:
In a first aspect, the technical program provides a kind of connection method of low-power consumption bluetooth, including main equipment and slave device
Conversion;
The conversion of main equipment and slave device includes:
A. the major time slice of random-length is obtained, uses low-power consumption bluetooth agreement to scan slave device as main equipment;Determine
Do not establish and connect with slave device in the major time slice of random-length;The slave timeslice of random-length is obtained, as slave device
Bluetooth broadcast signal is sent using low-power consumption bluetooth agreement;Determine not establish with main equipment in the slave timeslice of random-length
Connection, return to step a;Alternatively,
C. the slave timeslice of random-length is obtained, uses low-power consumption bluetooth agreement to send Bluetooth broadcast letter as slave device
Number;Determine not establish with main equipment in the slave timeslice of random-length and connect;The major time slice of random-length is obtained, as
Main equipment uses low-power consumption bluetooth agreement scanning slave device;Determine not establish with slave device in the major time slice of random-length
Connection, return to step c.
Its further technical solution is the major time slice for obtaining random-length, uses low-power consumption blue as main equipment
After tooth agreement scanning slave device, further include:
It is determined as main equipment to establish after connection and interrupt with slave device, then obtains the slave timeslice of random-length, as
Slave device sends Bluetooth broadcast signal using low-power consumption bluetooth agreement;Alternatively,
It is determined as main equipment to establish after connection and interrupt with slave device, then obtains the major time slice of random-length, as
Main equipment uses low-power consumption bluetooth agreement scanning slave device.
Its further technical solution is the slave timeslice for obtaining random-length, uses low-power consumption blue as slave device
After tooth agreement sends Bluetooth broadcast signal, further include:
It is determined as slave device to establish after connection and interrupt with main equipment, then obtains the major time slice of random-length, as
Main equipment uses low-power consumption bluetooth agreement scanning slave device;Alternatively,
It is determined as slave device to establish after connection and interrupt with main equipment, then obtains the slave timeslice of random-length, as
Slave device sends Bluetooth broadcast signal using low-power consumption bluetooth agreement.
Its further technical solution is the major time slice for obtaining random-length, uses low-power consumption blue as main equipment
After tooth agreement scanning slave device, further include:
If detecting at least two slave devices, the bluetooth signal intensity of slave device is ranked up, by bluetooth signal intensity
From being attached successively to weak by force.
Its further technical solution is that the major time slice of the random-length and the slave timeslice of random-length are by public affairs
The random time piece that formula T2=((Rand () %N)+1) * T1 are obtained, wherein, when T1 is the minimum of low-power consumption bluetooth equipment switching
Between unit, N be more than 1 and less than 20 integer.
Second aspect, the technical program provide a kind of attachment device of low-power consumption bluetooth, including:
Major time slice acquiring unit, for obtaining the major time slice of random-length, low-power consumption bluetooth is used as main equipment
Agreement scans slave device;
First connection determination unit, connects for determining not establish with slave device in the major time slice of random-length;
First trigger element, for when not establishing connection with slave device in the major time slice in random-length, triggering
From timeslice acquiring unit;
From timeslice acquiring unit, for obtaining the slave timeslice of random-length, low-power consumption bluetooth is used as slave device
Agreement sends Bluetooth broadcast signal;
Second connection confirmation unit, connects for determining not establish with main equipment in the slave timeslice of random-length;
Second trigger element, for when not establishing connection with main equipment in the slave timeslice in random-length, triggering
The major time slice acquiring unit.
Its further technical solution is to further include:
First disconnecting unit, establishes after connection and interrupts for being determined as main equipment and slave device, then obtain with
The slave timeslice of captain's degree, uses low-power consumption bluetooth agreement to send Bluetooth broadcast signal as slave device;Alternatively, for determining to make
Establish after connection and interrupt with slave device for main equipment, then obtain the major time slice of random-length, low work(is used as main equipment
Consume Bluetooth protocol scanning slave device.
Its further technical solution is to further include:
Second disconnecting unit, establishes after connection and interrupts for being determined as slave device and main equipment, then obtain with
The major time slice of captain's degree, uses low-power consumption bluetooth agreement to scan slave device as main equipment;Alternatively, for being determined as from setting
It is standby to establish after connection and interrupt with main equipment, then the slave timeslice of random-length is obtained, low-power consumption bluetooth is used as slave device
Agreement sends Bluetooth broadcast signal.
Its further technical solution is to further include:
Signal strength connection unit, if for detecting at least two slave devices, by the bluetooth signal intensity of slave device into
Row sequence, by bluetooth signal intensity from being attached successively to weak by force.
Its further technical solution is random time acquiring unit, for by formula T2=((Rand () %N)+1) * T1
The major time slice of the random-length and the slave timeslice of random-length are obtained, wherein, T1 is the switching of low-power consumption bluetooth equipment
Minimum time unit, N are the integer more than 1 and less than 20.
The beneficial effect that technical solution provided in an embodiment of the present invention is brought:
In the technical program, equipment is used as main equipment and slave device by turns by way of automated randomized timeslice, keep away
Exempt from multiple equipment while be main equipment or be at the same time slave device and can not find that other side establishes connection, time leaf length is produced at random
It is raw, connection is then established when equipment is recycled in different master slave modes, connection is more convenient, simplifies answering for user's operation
Miscellaneous degree, improves user experience.
Embodiment
For make present invention solves the technical problem that, the technical solution that uses and the technique effect that reaches it is clearer, below
The technical solution of the embodiment of the present invention will be described in further detail with reference to attached drawing, it is clear that described embodiment is only
It is part of the embodiment of the present invention, instead of all the embodiments.Based on the embodiments of the present invention, those skilled in the art exist
All other embodiments obtained under the premise of creative work are not made, belong to the scope of protection of the invention.
Please refer to Fig.1, it is the side of connection method one embodiment of low-power consumption bluetooth provided in an embodiment of the present invention
Method flow chart.The low-power consumption bluetooth connection method includes:
S100, the major time slice for obtaining random-length, use low-power consumption bluetooth agreement to scan slave device as main equipment.
The major time slice of random-length is obtained by formula T2=((Rand () %N)+1) * T1, wherein, T1 is blue for low-power consumption
The minimum time unit of tooth equipment switching, N are the integer more than 1 and less than 20.In the present embodiment, N is preferably 10.
The major time slice of random-length is relatively short, but time span at least allows slave device can be by other main equipments
The time needed for connectivity request message is received, main equipment can search other slave devices required time, usually at this moment
Between on the basis of extend certain time, it is that main equipment one is to build in the state of slave device to ensure that both sides continue random the latter several times
Vertical connection.
S101, determine not establish connection with slave device in the major time slice of random-length.
There is no Bluetooth signal of the scanning to slave device in the major time slice of random-length, alternatively, the bluetooth letter scanned
Number it is less than setting value, then without connection.
S102, the slave timeslice for obtaining random-length, use low-power consumption bluetooth agreement to send Bluetooth broadcast as slave device
Signal.
The slave timeslice of random-length repeats no more as the major time slice acquisition methods of random-length.Due to random
The major time slice of the slave timeslice and random-length of length is random within the specific limits, so the length of timeslice is not solid
Definite value, equipment are converted to slave device state from master status.
S103, determine not establish connection, return to step S100 with main equipment in the slave timeslice of random-length.
Equipment, which is in slave device state, does not have main equipment to establish connection therewith, then is scanned again as main equipment, such as
This is circulated between master status and slave device state, when multiple equipment is different based on equipment or be slave device at the same time
Untill connection being established.Connection can be established automatically by generally going through 1-3 circulation.
To sum up, equipment is in master status after opened bluetooth function in the present embodiment, passes through automated randomized timeslice
Mode makes equipment be used as main equipment and slave device by turns, avoid multiple equipment and meanwhile be main equipment or be slave device at the same time and nothing
Method scanning is arrived, and time leaf length randomly generates, and connection is then established when equipment is recycled in different master slave modes, connection is more
Add conveniently, simplify the complexity of user's operation, improve user experience.
Please refer to Fig.2, it is the side of second embodiment of connection method of low-power consumption bluetooth provided in an embodiment of the present invention
Method flow chart.The difference of method is shown in the connection method of the low-power consumption bluetooth and Fig. 1, the present embodiment low-power consumption bluetooth
Connection method be first in slave device state when starting, the connection method of low-power consumption bluetooth includes:
S200, the slave timeslice for obtaining random-length, use low-power consumption bluetooth agreement to send Bluetooth broadcast as slave device
Signal.
S201, determine not establish connection with main equipment in the slave timeslice of random-length.
S202, the major time slice for obtaining random-length, use low-power consumption bluetooth agreement to scan slave device as main equipment.
S203, determine not establish connection, return to step S200 with slave device in the major time slice of random-length.
Equipment be in master status not scan arrive slave device, alternatively, the Bluetooth signal scanned be less than setting value and
Without connection, then it is scanned as slave device, is so circulated between master status and slave device state again, until
Equipment or untill can establishing connection at the same time for slave device based on when multiple equipment is different.Generally go through 1-3 circulation
It is automatic to establish connection.
Method is mutually inside the Pass with reference to shown in figure 1 for the slave timeslice of random-length and the major time slice acquisition methods of random-length
Hold, details are not described herein again.
To sum up, equipment is in slave device state after opened bluetooth function in the present embodiment, passes through automated randomized timeslice
Mode makes equipment be used as main equipment and slave device by turns, avoid multiple equipment and meanwhile be main equipment or be slave device at the same time and nothing
Method scanning is arrived, and time leaf length randomly generates, and connection is then established when equipment is recycled in different master slave modes, connection is more
Add conveniently, simplify the complexity of user's operation, improve user experience.
Please refer to Fig.3, it is the side of the 3rd embodiment of connection method of low-power consumption bluetooth provided in an embodiment of the present invention
Method flow chart.It is in the present embodiment with method difference shown in Fig. 1, the present embodiment it is found not to be upon connection to be needed to connect
Target device then handle it.
The connection method of the low-power consumption bluetooth includes:
S300, the major time slice for obtaining random-length, use low-power consumption bluetooth agreement to scan slave device as main equipment.
S301, be determined as after main equipment and slave device foundation connection and interrupt, then obtains the slave timeslice of random-length,
Low-power consumption bluetooth agreement is used to send Bluetooth broadcast signal as slave device.
When equipment is in master status, scanning is to slave device and establishes connection therewith, and at this time, random time piece stops
Only, confirm to be not required to the target device of connection by identity information after connection, which then enters slave device state.
When carrying out identity validation after establishing connection, user can be clicked on by touch-screen to be confirmed or using in advance
If action carries out body-sensing confirmation.
S302, determine not establish connection, return to step S300 with main equipment in the slave timeslice of random-length.
To sum up, equipment is in master status after opened bluetooth function in the present embodiment, passes through automated randomized timeslice
Mode makes equipment be used as main equipment and slave device by turns, establishes connection until multiple equipment is in different states, judges
The equipment of connection is not target device, then continues the circulation of random time piece, connection is more convenient, simplifies answering for user's operation
Miscellaneous degree, improves user experience, ensures the accuracy of connection.
In the present embodiment, it is preferable that equipment is when in master status, will be from if detecting at least two slave devices
The bluetooth signal intensity of equipment is ranked up, by bluetooth signal intensity from being attached successively to weak by force.When the slave device of connection
When not being target device, then disconnect and give up the Bluetooth signal of the slave device, according to bluetooth signal intensity from being carried out successively to weak by force
Connection.Ensure that aspectant user can a successful connection when exchanging information.
Please refer to Fig.4, it is the side of the 4th embodiment of connection method of low-power consumption bluetooth provided in an embodiment of the present invention
Method flow chart.It is in the present embodiment with method difference shown in Fig. 3, the present embodiment it is found not to be upon connection to be needed to connect
Target device, then into master status.
The connection method of the low-power consumption bluetooth includes:
S400, the major time slice for obtaining random-length, use low-power consumption bluetooth agreement to scan slave device as main equipment.
S401, be determined as after main equipment and slave device foundation connection and interrupt, then obtains the major time slice of random-length,
Low-power consumption bluetooth agreement is used to scan slave device as main equipment.
When equipment is in master status, scanning is to slave device and establishes connection therewith, and at this time, random time piece stops
Only, confirm to be not required to the target device of connection by identity information after connection, which then enters master status.
When carrying out identity validation after establishing connection, user can be clicked on by touch-screen to be confirmed or using in advance
If action carries out body-sensing confirmation.
S402, determine not establish connection with slave device in the major time slice of random-length.
S403, the slave timeslice for obtaining random-length, use low-power consumption bluetooth agreement to send Bluetooth broadcast as slave device
Signal.
S404, determine not establish connection, return to step S400 with main equipment in the slave timeslice of random-length.
To sum up, equipment is in master status after opened bluetooth function in the present embodiment, passes through automated randomized timeslice
Mode makes equipment be used as main equipment and slave device by turns, establishes connection until multiple equipment is in different states, judges
The equipment of connection is not target device, then continues the circulation of random time piece, connection is more convenient, simplifies answering for user's operation
Miscellaneous degree, improves user experience, ensures the accuracy of connection.
Fig. 5 is refer to, it is the side of the 5th embodiment of connection method of low-power consumption bluetooth provided in an embodiment of the present invention
Method flow chart.The present embodiment and the difference of method shown in Fig. 2 are that the present embodiment it is found not to be upon connection to be needed to connect
Target device then handle it.
S500, the slave timeslice for obtaining random-length, use low-power consumption bluetooth agreement to send Bluetooth broadcast as slave device
Signal.
S501, be determined as after slave device and main equipment foundation connection and interrupt, then obtains the major time slice of random-length,
Low-power consumption bluetooth agreement is used to scan slave device as main equipment.
Establish and connect with main equipment when equipment is in slave device state, at this time, random time piece stops, and passes through after connection
Identity information confirmation is not required to the target device of connection, which then enters master status.
When carrying out identity validation after establishing connection, user can be clicked on by touch-screen to be confirmed or using in advance
If action carries out body-sensing confirmation.
S502, determine not establish connection, return to step S500 with slave device in the major time slice of random-length.
To sum up, equipment is in slave device state after opened bluetooth function in the present embodiment, passes through automated randomized timeslice
Mode makes equipment be used as main equipment and slave device by turns, establishes connection until multiple equipment is in different states, judges
The equipment of connection is not target device, then continues the circulation of random time piece, connection is more convenient, simplifies answering for user's operation
Miscellaneous degree, improves user experience, ensures the accuracy of connection.
Fig. 6 is refer to, it is the side of the 6th embodiment of connection method of low-power consumption bluetooth provided in an embodiment of the present invention
Method flow chart.It is in the present embodiment with method difference shown in Fig. 5, the present embodiment it is found not to be upon connection to be needed to connect
Target device, then into slave device state.
S600, the slave timeslice for obtaining random-length, use low-power consumption bluetooth agreement to send Bluetooth broadcast as slave device
Signal.
S601, be determined as after slave device and main equipment foundation connection and interrupt, then obtains the slave timeslice of random-length,
Low-power consumption bluetooth agreement is used to send Bluetooth broadcast signal as slave device.
Establish and connect with main equipment when equipment is in slave device state, at this time, random time piece stops, and passes through after connection
Identity information confirmation is not required to the target device of connection, which then enters slave device state.
When carrying out identity validation after establishing connection, user can be clicked on by touch-screen to be confirmed or using in advance
If action carries out body-sensing confirmation.
S602, determine not establish connection with main equipment in the slave timeslice of random-length.
S603, the major time slice for obtaining random-length, use low-power consumption bluetooth agreement to scan slave device as main equipment.
S604, determine not establish connection, return to step S600 with slave device in the major time slice of random-length.
To sum up, equipment is in slave device state after opened bluetooth function in the present embodiment, passes through automated randomized timeslice
Mode makes equipment be used as main equipment and slave device by turns, establishes connection until multiple equipment is in different states, judges
The equipment of connection is not target device, then continues the circulation of random time piece, connection is more convenient, simplifies answering for user's operation
Miscellaneous degree, improves user experience, ensures the accuracy of connection.
Fig. 7 is refer to, it is the side of attachment device one embodiment of low-power consumption bluetooth provided in an embodiment of the present invention
Method flow chart.The attachment device of the low-power consumption bluetooth includes:
Major time slice acquiring unit 10, for obtaining the major time slice of random-length, uses low-power consumption blue as main equipment
Tooth agreement scans slave device;
First connection determination unit 20, connects for determining not establish with slave device in the major time slice of random-length
Connect;
First trigger element 30, for when not establishing connection with slave device in the major time slice in random-length, touching
Send out from timeslice acquiring unit;
From timeslice acquiring unit 40, for obtaining the slave timeslice of random-length, use low-power consumption blue as slave device
Tooth agreement sends Bluetooth broadcast signal;
Second connection confirmation unit 50, connects for determining not establish with main equipment in the slave timeslice of random-length
Connect;
Second trigger element 60, for when not establishing connection with main equipment in the slave timeslice in random-length, touching
Send out major time slice acquiring unit described.
The detailed content of device please refers to Fig.1 and Fig. 2 the methods, and details are not described herein again.
To sum up, make equipment by turns as master by way of automated randomized timeslice after opened bluetooth function in the present embodiment
Equipment and slave device, avoid multiple equipment while are main equipment or are slave device at the same time and can not scan, time leaf length
Randomly generate, connection is then established when equipment is recycled in different master slave modes, connection is more convenient, simplifies user behaviour
The complexity of work, improves user experience.
In some other embodiment, further include:
First disconnecting unit, establishes after connection and interrupts for being determined as main equipment and slave device, then obtain with
The slave timeslice of captain's degree, uses low-power consumption bluetooth agreement to send Bluetooth broadcast signal as slave device;Alternatively, for determining to make
Establish after connection and interrupt with slave device for main equipment, then obtain the major time slice of random-length, low work(is used as main equipment
Consume Bluetooth protocol scanning slave device.
Specifically, when using method shown in Fig. 3, the first disconnecting unit is used to be determined as main equipment and slave device
Establish after connection and interrupt, then obtain the slave timeslice of random-length, use low-power consumption bluetooth agreement to send indigo plant as slave device
Tooth broadcast singal.
When using method shown in Fig. 4, the first disconnecting unit is used to be determined as main equipment and establish with slave device to connect
After connecing and interrupt, then obtain the major time slice of random-length, use low-power consumption bluetooth agreement to scan slave device as main equipment.It is logical
Whether the equipment for crossing verification connection is target device, improves the accuracy of connection.
In some other embodiment, further include:
Second disconnecting unit, establishes after connection and interrupts for being determined as slave device and main equipment, then obtain with
The major time slice of captain's degree, uses low-power consumption bluetooth agreement to scan slave device as main equipment;Alternatively, for being determined as from setting
It is standby to establish after connection and interrupt with main equipment, then the slave timeslice of random-length is obtained, low-power consumption bluetooth is used as slave device
Agreement sends Bluetooth broadcast signal.
Specifically, when using method shown in Fig. 5, the second disconnecting unit is used to be determined as slave device and main equipment
Establish connection after and interrupt, then obtain random-length major time slice, as main equipment use low-power consumption bluetooth agreement scan from
Equipment.
When using method shown in Fig. 6, the second disconnecting unit is used to be determined as slave device and establish with main equipment to connect
After connecing and interrupt, then obtain the slave timeslice of random-length, use low-power consumption bluetooth agreement to send Bluetooth broadcast as slave device
Signal.Whether the equipment by verifying connection is target device, improves the accuracy of connection.
Preferably, further include:
Signal strength connection unit, if for detecting at least two slave devices, by the bluetooth signal intensity of slave device into
Row sequence, by bluetooth signal intensity from being attached successively to weak by force.By by bluetooth signal intensity from by force to it is weak successively with from
Equipment is attached, and is ensured to carry out face-to-face once to realize connection during information exchange, is improved joint efficiency.
Random time acquiring unit, for obtaining the master of the random-length by formula T2=((Rand () %N)+1) * T1
The slave timeslice of timeslice and random-length, wherein, T1 is the minimum time unit of low-power consumption bluetooth equipment switching, and N is more than 1
And the integer less than 20.The major time slice of random-length and the slave timeslice of random-length are random time piece.
Above content is only presently preferred embodiments of the present invention, for those of ordinary skill in the art, according to the present invention's
Thought, there will be changes, this specification content should not be construed as to the present invention in specific embodiments and applications
Limitation.