Summary of the invention
Embodiment of the present invention technical problem to be solved is, a kind of Bluetooth connecting method and device are provided, whether keep to realizing determining that bluetooth is connected by the checking of authorization key between terminal with wearable device, thus realize with between wearable device more easily bluetooth is connected, and then lifting terminal property easy to use while ensure that communication security.
Embodiments provide a kind of Bluetooth connecting method, the method comprises:
When terminal receives link order, set up and be connected with the bluetooth of target wearable device;
Described terminal sends handshake request message to described target wearable device, to make described target wearable device generate and export authorization key, and sends handshake response message to described terminal;
Described terminal receives the described handshake response message that described target wearable device sends;
Described terminal sends verification command to described target wearable device, and described verification command comprises described authorization key, to make described target wearable device verify described authorization key, and sends the result to described terminal;
Described terminal receives the result that described target wearable device sends, and determines whether to keep being connected with the bluetooth of described target wearable device.
Optionally, described when terminal receives link order, foundation also comprises before being connected with the bluetooth of target wearable device:
At least one wearable device that the bluetooth set up around described terminal searching connects;
Described terminal, according to the selection instruction of user, selects described target wearable device at least one wearable device described.
Optionally, described terminal receives the result that described target wearable device sends, and determines whether to keep being connected with the bluetooth of described target wearable device, comprising:
If described the result is for being proved to be successful, then described terminal keeps being connected with the bluetooth of described target wearable device;
If described the result is authentication failed, then described terminal disconnects and being connected with the bluetooth of described target wearable device.
The embodiment of the present invention additionally provides a kind of Bluetooth connecting method, and the method comprises:
The handshake request message that target wearable device receiving terminal sends;
Described target wearable device generates and exports authorization key;
Described target wearable device sends handshake response message to described terminal, sends verification command to described target wearable device to make described terminal;
Described target wearable device receives the verification command that described terminal sends, and described verification command comprises described authorization key;
Described target wearable device is verified described authorization key, and sends the result to described terminal, determines whether to keep being connected with the bluetooth of described target wearable device to make described terminal.
Optionally, described target wearable device generates and exports authorization key and comprises: described target wearable device stochastic generation authorization key also shows on screen.
Correspondingly, the embodiment of the present invention additionally provides a kind of bluetooth and connects terminal, and this terminal comprises:
Connection establishment module, for when receiving link order, setting up and being connected with the bluetooth of target wearable device;
Request sending module, for sending handshake request message to described target wearable device, to make described target wearable device generate and export authorization key, and sends handshake response message to terminal;
Response receiver module, for receiving the described handshake response message that described target wearable device sends;
Checking sending module, for sending verification command to described target wearable device, described verification command comprises described authorization key, to make described target wearable device verify described authorization key, and sends the result to described terminal;
The result module, for receiving the result that described target wearable device sends, determines whether to keep being connected with the bluetooth of described target wearable device.
Optionally, described terminal also comprises:
Search module, at least one wearable device that the bluetooth set up for searching for surrounding connects;
Select module, for the selection instruction according to user, at least one wearable device described, select described target wearable device.
Optionally, described the result module comprises:
Holding unit, if for described the result for being proved to be successful, then keeps being connected with the bluetooth of described target wearable device;
Interrupt location, if be authentication failed for described the result, then disconnect and being connected with the bluetooth of described target wearable device.
Correspondingly, the embodiment of the present invention additionally provides a kind of bluetooth and connects terminal, and this terminal comprises:
Request receiving module, for the handshake request message that receiving terminal sends;
Cipher key module, for generating and exporting authorization key;
Response sending module, for sending handshake response message to described terminal, sends verification command to target wearable device to make described terminal;
Checking receiver module, for receiving the verification command that described terminal sends, described verification command comprises described authorization key;
Authentication module, for verifying described authorization key, and sends the result to described terminal, determines whether to keep being connected with the bluetooth of described target wearable device to make described terminal.
Optionally, described cipher key module for: stochastic generation authorization key also shows on screen.
The embodiment of the present invention is when terminal receives link order, set up and be connected with the bluetooth of target wearable device, terminal sends handshake request message to target wearable device, generate to make target wearable device and export authorization key, and send handshake response message to described terminal, terminal sends verification command to target wearable device, verification command comprises described authorization key, to make target wearable device, authorization key is verified, and send the result to terminal, terminal can determine whether to keep being connected with the bluetooth of described target wearable device, achieve and determine that bluetooth is connected by the checking of authorization key between terminal with wearable device and whether keep, thus realize with between wearable device more easily bluetooth be connected, and then communication security is ensure that while the property easy to use promoting terminal.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, be clearly and completely described the technical scheme in the embodiment of the present invention, obviously, described embodiment is only the present invention's part embodiment, instead of whole embodiments.Based on the embodiment in the present invention, those of ordinary skill in the art, not making the every other embodiment obtained under creative work prerequisite, belong to the scope of protection of the invention.
Fig. 1 is the schematic flow sheet of a kind of Bluetooth connecting method in the embodiment of the present invention, this method flow process can connect terminal by bluetooth and implement, it can be user terminal or the software program operating in user terminal that described bluetooth connects terminal, described user terminal can comprise mobile phone, notebook computer, panel computer, vehicle-mounted computer, POS (PointOfSales, point of sale) machine etc.Described method at least comprises as shown in the figure:
Step S101, when terminal receives link order, sets up and is connected with the bluetooth of target wearable device.
Concrete, link order can be the order that user inputs in terminal, such as sliding trace, click, double-click or long by connection icon, press default connection button, rock operations such as terminal etc., also can be the link order that terminal is sent to terminal by other apparatus remotes, such as send infrared signal by Infrared remote controller to terminal, make terminal set up bluetooth with target wearable device and be connected.
In the present embodiment, when terminal receives link order, just can pass through the Bluetooth address of the target wearable device got in advance, set up bluetooth with target wearable device and be connected.It should be noted that, bluetooth now connects just preliminary foundation, but can't transmit data, if need the transmission carrying out data further, so also needs to perform following steps further.
Optionally, before step S101, the method also comprises:
At least one wearable device that the bluetooth set up around described terminal searching connects.
Concrete, terminal after the bluetooth equipment search instruction receiving user's input, can open bluetooth discovery function, and the wearable device can setting up bluetooth connection to surrounding is searched for.In concrete enforcement, wearable device, when bluetooth module is opened, periodically can send Bluetooth signal, and terminal can by receiving this Bluetooth signal to search for the wearable device of surrounding.
In the present embodiment, Bluetooth address and the Bluetooth identification of each wearable device can be comprised in Bluetooth signal, terminal, when searching for the wearable device can setting up bluetooth connection, just can get Bluetooth address and the Bluetooth identification of wearable device corresponding to each Bluetooth signal received.
Described terminal, according to the selection instruction of user, selects described target wearable device at least one wearable device described.
Concrete, terminal is after the Bluetooth address getting wearable device and Bluetooth identification, user can be shown to check, when user determines the wearable device needing to connect in the Bluetooth identification and Bluetooth address of at least one wearable device, just can send selection instruction to terminal, after terminal receives this selection instruction, just can select the target wearable device corresponding with selection instruction at least one wearable device.
Such as, the wearable device that the Bluetooth identification got is respectively A, B, C by terminal is presented in terminal screen and checks for user, user can click B using the wearable device selecting Bluetooth identification to be B as the wearable device needing to set up bluetooth connection, then bluetooth just can be designated as the wearable device of B as target wearable device by terminal, obtains the Bluetooth address of its correspondence.
It should be noted that, selection instruction can be the order that user inputs in terminal, such as sliding trace, click, double-click or long by Bluetooth identification, press the operations such as default selection key, do not do concrete restriction here.
Step S102, described terminal sends handshake request message to described target wearable device, to make described target wearable device generate and export authorization key, and sends handshake response message to described terminal.
Concrete, terminal, can to target wearable device transmission handshake request message setting up after bluetooth is connected with target wearable device, to ask to carry out data interaction with target wearable device.In concrete enforcement, terminal can send handshake request message according to the Bluetooth address of target wearable device to target wearable device, after target wearable device receives this handshake request message, can authorization key be generated, and further in the enterprising line output display of the screen of target wearable device.Meanwhile, target wearable device sends handshake response message to terminal, to illustrate that target wearable device has generated and exported authorization key, responds the handshake request message that terminal sends.
It should be noted that, the method that target wearable device generates authorization key can be random, also can generate according to preset rules, such as, can preset an authorization key and generate formula etc., not do concrete restriction here.Further, the form of authorization key also can be multiple, can be the combination of numbers of default figure place, also can be the combination of letter, numeral, character three, can also be slip gesture etc., also not do concrete restriction here.
Step S103, described terminal receives the described handshake response message that described target wearable device sends.
Concrete, terminal receives target wearable device and is generating and after the handshake response message sent after exporting authorization key, can generate prompting message prompting user and input authorization key, after detecting that user has inputted, obtain the authorization key that user inputs.
In the present embodiment, the authorization key of user's input completes after checking authorization key that the screen of target wearable device shows, that is, handshake request process in the present embodiment is in order to whether verification terminal and wearable device are belong to same user or be in very close space, such user just can input in the terminal after seeing the authorization key that target wearable device shows, otherwise understands input error or be input as sky.
Illustrate, if terminal and target wearable device belong to same user or be in very close space, then user can see that the authorization key that target wearable device generates is 123, and then by the input of this authorization key in the information of terminal; If user and target wearable device do not belong to same user or are not in very close space, then user cannot see that the authorization key that target wearable device generates is 123, and then just cannot be inputted in the information of terminal by this authorization key accurately.
Step S104, described terminal sends verification command to described target wearable device, and described verification command comprises described authorization key, to make described target wearable device verify described authorization key, and sends the result to described terminal.
Concrete, terminal is after the authorization key getting user's input, can send verification command to target wearable device, this verification command can carry the authorization key of user's input, verifies to make the authorization key of target wearable device to user's input of carrying in verification command.
In concrete enforcement, target wearable device is after the verification command receiving terminal transmission, the authorization key generated before the authorization key of user's input and target wearable device can be compared, whether both checkings mate or unanimously, if comparing result is consistent or coupling, illustrates and be proved to be successful, if comparison result is inconsistent or do not mate, then authentication error.It should be noted that, comparison here unanimously refers to the authorization key of the forms such as numeral, character, letter, and comparison coupling refers to the authorization key of the form such as sliding trace, fingerprint.Finally, target wearable device can obtain the result, and the result is sent to terminal.
Step S105, described terminal receives the result that described target wearable device sends, and determines whether to keep being connected with the bluetooth of described target wearable device.
Concrete, after terminal receives the result of target wearable device transmission, if the result is for being proved to be successful, then terminal can carry out transfer of data with target wearable device, or terminal keeps and the bluetooth connection status of target wearable device, or terminal is later without the need to verifying etc. in the pre-connection with wearable device; If the result is authentication error, then terminal can again send handshake request message to target wearable device and again verifies, or interrupts being connected with the bluetooth of target wearable device.
In the present embodiment, terminal can determine whether to keep being connected with the bluetooth of target wearable device according to the result.
Optionally, step S105 can comprise:
If described the result is for being proved to be successful, then described terminal keeps being connected with the bluetooth of described target wearable device.
Concrete, if the result that the target wearable device that terminal receives sends is for being proved to be successful, illustrate that the user authorization key inputted and the authorization key that target wearable device generates to mate or consistent, then can keep being connected with the bluetooth of target wearable device, namely can carry out Bluetooth data transfer etc.
If described the result is authentication failed, then described terminal disconnects and being connected with the bluetooth of described target wearable device.
Concrete, if the result that the target wearable device that terminal receives sends is authentication error, illustrate that authorization key that user inputs does not mate with the authorization key that target wearable device generates or inconsistent, then can disconnect and being connected with the bluetooth of target wearable device, namely no longer have bluetooth annexation with target wearable device.
The embodiment of the present invention is when terminal receives link order, set up and be connected with the bluetooth of target wearable device, terminal sends handshake request message to target wearable device, generate to make target wearable device and export authorization key, and send handshake response message to described terminal, terminal sends verification command to target wearable device, verification command comprises described authorization key, to make target wearable device, authorization key is verified, and send the result to terminal, terminal can determine whether to keep being connected with the bluetooth of described target wearable device, achieve and determine that bluetooth is connected by the checking of authorization key between terminal with wearable device and whether keep, thus realize with between wearable device more easily bluetooth be connected, and then communication security is ensure that while the property easy to use promoting terminal.
Fig. 2 is the schematic flow sheet of Bluetooth connecting method in another embodiment of the present invention, and described method at least comprises as shown in the figure:
Step S201, the handshake request message that target wearable device receiving terminal sends.
Concrete, handshake request message is transmission when carrying out data interaction of terminal request and target wearable device, after target wearable device receives the handshake request message of terminal transmission, can carry out the step of verification operation by trigger target wearable device to terminal.
Step S202, described target wearable device generates and exports authorization key.
Concrete, after target wearable device receives this handshake request message, can authorization key be generated, and show on the screen of target wearable device further.
It should be noted that, the method that target wearable device generates authorization key can be random, also can generate according to preset rules, such as, can preset an authorization key and generate formula etc., not do concrete restriction here.Further, the form of authorization key also can be multiple, can be the combination of numbers of default figure place, also can be the combination of letter, numeral, character three, can also be slip gesture etc., also not do concrete restriction here.
Step S203, described target wearable device sends handshake response message to described terminal, sends verification command to described target wearable device to make described terminal.
Concrete, target wearable device is generating and after exporting authorization key, can send handshake response message to terminal, and to make terminal can to target wearable device transmission verification command, wherein verification command can carry the authorization key that user inputs in terminal.Verification command is used for the verification operation of the authorization key of authorization key that trigger target wearable device sends terminal and wearable device oneself generation.
In the present embodiment, after terminal receives the handshake response message of target wearable device transmission, prompting message prompting user can be generated and input authorization key, after detecting that user has inputted, obtain the authorization key of user's input.The authorization key of user's input completes after checking authorization key that the screen of target wearable device shows, that is, handshake request process in the present embodiment is in order to whether verification terminal and wearable device are belong to same user or be in very close space, such user just can input in the terminal after seeing the authorization key that target wearable device shows, otherwise understands input error or be input as sky.
Illustrate, if terminal and target wearable device belong to same user or be in very close space, then user can see that the authorization key that target wearable device generates is 123, and then by the input of this authorization key in the information of terminal; If user and target wearable device do not belong to same user or are not in very close space, then user cannot see that the authorization key that target wearable device generates is 123, and then just cannot be inputted in the information of terminal by this authorization key accurately.
Step S204, described target wearable device receives the verification command that described terminal sends, and described verification command comprises described authorization key.
Concrete, the verification command that in target wearable device receiving step S203, terminal sends, and obtain the authorization key in verification command.
Step S205, described target wearable device is verified described authorization key, and sends the result to described terminal, determines whether to keep being connected with the bluetooth of described target wearable device to make described terminal.
Concrete, target wearable device is after the verification command receiving terminal transmission, the authorization key generated before the authorization key of user's input and target wearable device can be compared, whether both checkings mate or unanimously, if comparing result is consistent or coupling, illustrates and be proved to be successful, if comparison result is inconsistent or do not mate, then authentication error.It should be noted that, comparison here unanimously refers to the authorization key of the forms such as numeral, character, letter, and comparison coupling refers to the authorization key of the form such as sliding trace, fingerprint.Finally, target wearable device can obtain the result, and the result is sent to terminal.
In the present embodiment, after terminal receives the result of target wearable device transmission, if the result is for being proved to be successful, then terminal can carry out transfer of data with target wearable device, or terminal keeps and the bluetooth connection status of target wearable device, or terminal is later without the need to verifying etc. in the pre-connection with wearable device; If the result is authentication error, then terminal can again send handshake request message to target wearable device and again verifies, or interrupts being connected with the bluetooth of target wearable device.
The handshake request message that the embodiment of the present invention is sent by target wearable device receiving terminal, generate and export authorization key, then handshake response message is sent to terminal, verification command is sent to target wearable device to make terminal, the verification command that target wearable device receiving terminal sends, verification command comprises authorization key, target wearable device is verified authorization key, and send the result to terminal, determine whether to make terminal to keep being connected with the bluetooth of target wearable device, achieve and determine that bluetooth is connected by the checking of authorization key between terminal with wearable device and whether keep, thus realize with between wearable device more easily bluetooth be connected, and then communication security is ensure that while the property easy to use promoting terminal.
Fig. 3 is the interaction diagrams of a kind of Bluetooth connecting method in the embodiment of the present invention, and the method comprises:
Step S301, when terminal receives link order, sets up and is connected with the bluetooth of target wearable device.
Concrete, link order can be the order that user inputs in terminal, such as sliding trace, click, double-click or long by connection icon, press default connection button, rock operations such as terminal etc., also can be the link order that terminal is sent to terminal by other apparatus remotes, such as send infrared signal by Infrared remote controller to terminal, make terminal set up bluetooth with target wearable device and be connected.
In the present embodiment, when terminal receives link order, just can pass through the Bluetooth address of the target wearable device got in advance, set up bluetooth with target wearable device and be connected.It should be noted that, bluetooth now connects just preliminary foundation, but can't transmit data, if need the transmission carrying out data further, so also needs to perform following steps further.
Step S302, described terminal sends handshake request message to described target wearable device.
Concrete, terminal, can to target wearable device transmission handshake request message setting up after bluetooth is connected with target wearable device, to ask to carry out data interaction with target wearable device.In concrete enforcement, terminal can send handshake request message according to the Bluetooth address of target wearable device to target wearable device.
Step S303, described target wearable device generates and exports authorization key.
Concrete, concrete, after target wearable device receives this handshake request message, can authorization key be generated, and show on the screen of target wearable device further.
It should be noted that, the method that target wearable device generates authorization key can be random, also can generate according to preset rules, such as, can preset an authorization key and generate formula etc., not do concrete restriction here.Further, the form of authorization key also can be multiple, can be the combination of numbers of default figure place, also can be the combination of letter, numeral, character three, can also be slip gesture etc., also not do concrete restriction here.
Step S304, described target wearable device sends handshake response message to described terminal.
Concrete, target wearable device is generating and after exporting authorization key, can send handshake response message to terminal.
Step S305, described terminal sends verification command to described target wearable device, and described verification command comprises described authorization key.
Concrete, terminal receives target wearable device and is generating and after the handshake response message sent after exporting authorization key, can generate prompting message prompting user and input authorization key, after detecting that user has inputted, obtain the authorization key that user inputs.Terminal is after the authorization key getting user's input, and can send verification command to target wearable device, this verification command can carry the authorization key of user's input.
In the present embodiment, the authorization key of user's input completes after checking authorization key that the screen of target wearable device shows, that is, handshake request process in the present embodiment is in order to whether verification terminal and wearable device are belong to same user or be in very close space, such user just can input in the terminal after seeing the authorization key that target wearable device shows, otherwise understands input error or be input as sky.
Step S306, described target wearable device is verified described authorization key, and sends the result to described terminal.
Concrete, target wearable device is after the verification command receiving terminal transmission, the authorization key generated before the authorization key of user's input and target wearable device can be compared, whether both checkings mate or unanimously, if comparing result is consistent or coupling, illustrates and be proved to be successful, if comparison result is inconsistent or do not mate, then authentication error.It should be noted that, comparison here unanimously refers to the authorization key of the forms such as numeral, character, letter, and comparison coupling refers to the authorization key of the form such as sliding trace, fingerprint.Finally, target wearable device can obtain the result, and the result is sent to terminal.
Step S307, described terminal determines whether to keep being connected with the bluetooth of described target wearable device.
Concrete, after terminal receives the result of target wearable device transmission, if the result is for being proved to be successful, then terminal can keep being connected with the bluetooth of target wearable device; If the result is authentication error, then terminal can interrupt being connected with the bluetooth of target wearable device.
The embodiment of the present invention is when terminal receives link order, set up and be connected with the bluetooth of target wearable device, terminal sends handshake request message to target wearable device, generate to make target wearable device and export authorization key, and send handshake response message to described terminal, terminal sends verification command to target wearable device, verification command comprises described authorization key, to make target wearable device, authorization key is verified, and send the result to terminal, terminal can determine whether to keep being connected with the bluetooth of described target wearable device, achieve and determine that bluetooth is connected by the checking of authorization key between terminal with wearable device and whether keep, thus realize with between wearable device more easily bluetooth be connected, and then communication security is ensure that while the property easy to use promoting terminal.
Fig. 4 is the composition structure chart that in the embodiment of the present invention, a kind of bluetooth connects terminal, and this terminal comprises: connection establishment module 410, request sending module 420, response receiver module 430, checking sending module 440 and the result module 450, wherein:
Connection establishment module 410, for when receiving link order, setting up and being connected with the bluetooth of target wearable device.
Request sending module 420, for sending handshake request message to described target wearable device, to make described target wearable device generate and export authorization key, and sends handshake response message to terminal.
Response receiver module 430, for receiving the described handshake response message that described target wearable device sends.
Checking sending module 440, for sending verification command to described target wearable device, described verification command comprises described authorization key, to make described target wearable device verify described authorization key, and sends the result to described terminal.
The result module 450, for receiving the result that described target wearable device sends, determines whether to keep being connected with the bluetooth of described target wearable device.
In one embodiment, the result module 450 comprises: holding unit 451 and interrupt location 452, as shown in Figure 5, wherein:
Holding unit 451, if for described the result for being proved to be successful, then keeps being connected with the bluetooth of described target wearable device.
Interrupt location 452, if be authentication failed for described the result, then disconnect and being connected with the bluetooth of described target wearable device.
In one embodiment, this terminal also comprises:
Search module 460, at least one wearable device that the bluetooth set up for searching for surrounding connects.
Select module 470, for the selection instruction according to user, at least one wearable device described, select described target wearable device.
The embodiment of the present invention is when terminal receives link order, set up and be connected with the bluetooth of target wearable device, terminal sends handshake request message to target wearable device, generate to make target wearable device and export authorization key, and send handshake response message to described terminal, terminal sends verification command to target wearable device, verification command comprises described authorization key, to make target wearable device, authorization key is verified, and send the result to terminal, terminal can determine whether to keep being connected with the bluetooth of described target wearable device, achieve and determine that bluetooth is connected by the checking of authorization key between terminal with wearable device and whether keep, thus realize with between wearable device more easily bluetooth be connected, and then communication security is ensure that while the property easy to use promoting terminal.
Fig. 6 is the composition structure chart that in the embodiment of the present invention, a kind of bluetooth connects terminal, and this terminal comprises: request receiving module 610, cipher key module 620, response sending module 630, checking receiver module 640 and authentication module 650, wherein:
Request receiving module 610, for the handshake request message that receiving terminal sends.
Cipher key module 620, for generating and exporting authorization key.
In one embodiment, cipher key module 620 for: stochastic generation authorization key also shows on screen.
Response sending module 630, for sending handshake response message to described terminal, sends verification command to target wearable device to make described terminal.
Checking receiver module 640, for receiving the verification command that described terminal sends, described verification command comprises described authorization key.
Authentication module 650, for verifying described authorization key, and sends the result to described terminal, determines whether to keep being connected with the bluetooth of described target wearable device to make described terminal.
The handshake request message that the embodiment of the present invention is sent by target wearable device receiving terminal, generate and export authorization key, then handshake response message is sent to terminal, verification command is sent to target wearable device to make terminal, the verification command that target wearable device receiving terminal sends, verification command comprises authorization key, target wearable device is verified authorization key, and send the result to terminal, determine whether to make terminal to keep being connected with the bluetooth of target wearable device, achieve and determine that bluetooth is connected by the checking of authorization key between terminal with wearable device and whether keep, thus realize with between wearable device more easily bluetooth be connected, and then communication security is ensure that while the property easy to use promoting terminal.
One of ordinary skill in the art will appreciate that all or part of flow process realized in above-described embodiment method, that the hardware that can carry out instruction relevant by computer program has come, described program can be stored in a computer read/write memory medium, this program, when performing, can comprise the flow process of the embodiment as above-mentioned each side method.Wherein, described storage medium can be magnetic disc, CD, read-only store-memory body (Read-OnlyMemory, ROM) or random store-memory body (RandomAccessMemory, RAM) etc.
Above disclosedly be only present pre-ferred embodiments, certainly can not limit the interest field of the present invention with this, therefore according to the equivalent variations that the claims in the present invention are done, still belong to the scope that the present invention is contained.