Summary of the invention
In view of the above problems, the present invention provides a kind of device pairing method and system, with conveniently, accurately and reliably
Realize the pairing connection between terminal device.
The present invention provides a kind of device pairing methods, comprising:
First terminal equipment detect the first terminal equipment socket whether the plug inserted with second terminal equipment;
If the plug inserted with the second terminal equipment, the first terminal equipment is inserted by the socket with described
The pairing transmission channel formed between head, Xiang Suoshu second terminal equipment send unpaired message, include described in the unpaired message
The identification information of first terminal equipment;
The second terminal equipment is according to the identification information of the first terminal equipment, using wireless transmission method to described
First terminal equipment sends pairing request, includes the identification information of the second terminal equipment in the pairing request;
The first terminal equipment sends pairing response to the second terminal equipment using the wireless transmission method, complete
At the pairing with the second terminal equipment.
The present invention provides a kind of device pairing systems, comprising: first terminal equipment and second terminal equipment;
Include: first processor in the first terminal equipment, and connect respectively with the first processor socket,
First wireless transceiver and first memory include detection circuit in the socket;
It include: second processor in the second terminal equipment, and the plug being connect respectively with the second processor
With the second wireless transceiver;
The detection circuit for whether detecting the socket inserted with the plug, and is being detected inserted with described
When plug, Xiang Suoshu first processor sends trigger signal;
The first processor, for passing through shape between the socket and the plug after receiving the trigger signal
At pairing transmission channel, it includes the first terminal in the unpaired message that Xiang Suoshu second processor, which sends unpaired message,
The identification information of equipment;
The second processor, for after receiving the unpaired message, according to the mark of the first terminal equipment
Information controls second wireless transceiver to the first terminal equipment and sends pairing request, includes in the pairing request
The identification information of the second terminal equipment;
First wireless transceiver, for receiving the pairing request, and under the control of the first processor, to
The second terminal equipment sends pairing response, completes the pairing with the second terminal equipment;
The first memory, for storing the unpaired message.
Device pairing method and system provided by the invention, when first terminal equipment detects its socket inserted with second eventually
When the plug of end equipment, the pairing process flow of first terminal equipment and second terminal equipment room is triggered.Specifically, firstly,
First terminal equipment is connect with the plug of second terminal equipment by its socket and is formed by pairing transmission channel, to second terminal
Equipment sends the unpaired message comprising its device identification;Secondly, second terminal equipment passes through nothing after receiving the unpaired message
Line transmission mode sends pairing request to first terminal equipment;It is matched finally, first terminal equipment is sent to second terminal equipment
Response, to complete pairing connection between the two.In the present solution, being based on above-mentioned insert action, enable to second terminal equipment quasi-
Really determine its needs pairing connection is first terminal equipment, so that pairing connection between the two is accurate and reliable, and user is only
Need to carry out above-mentioned insertion operation, it is simple to operate.
Specific embodiment
Fig. 1 is the flow chart of present device matching method embodiment one, as shown in Figure 1, this method comprises the following steps:
Whether step 101, first terminal equipment detect the socket of the first terminal equipment inserted with second terminal equipment
Plug, if the plug inserted with the second terminal equipment, thens follow the steps 102, otherwise terminates.
In the present embodiment, for example, above-mentioned first terminal equipment is such as tablet computer, above-mentioned second terminal equipment ratio
For example bluetooth keyboard.Certainly, above-mentioned first terminal equipment and second terminal equipment are not limited to the citing, such as first terminal equipment
It can also be mobile phone, PC machine, TV etc., above-mentioned second terminal equipment can also be blue-tooth printer, bluetooth headset etc..
It is worth noting that can not only be provided with plug in above-mentioned first terminal equipment and second terminal equipment, but also setting
There is socket, by taking first terminal equipment as an example, when the socket of the plug of second terminal equipment insertion first terminal equipment, triggering the
One terminal device executes the device pairing method in the present embodiment, opposite, if it is the plug insertion the of first terminal equipment
The socket of two terminal devices then triggers second terminal equipment and executes device pairing method in the present embodiment.
In the present embodiment, at pairing that first terminal equipment and second terminal equipment room are triggered based on above-mentioned insert action
Reason process.
For concrete example, it is assumed that be provided with a plug on above-mentioned bluetooth keyboard, be matched with and be arranged on tablet computer
One socket.User passes through the pairing triggered between the two in the socket on the plug insertion tablet computer by the bluetooth keyboard and connects
Process.
Wherein, the socket may include any socket in following socket:
Receiver J-Horner, USB jack, HDMI socket, MHL socket, lighting socket.
Correspondingly, the plug includes and any plug in the following plug of socket cooperation:
Headset plug, USB plug, HDMI plug, MHL plug, lighting plug.
That is, the type matching of plug and socket.
Step 102, first terminal equipment pass through the pairing transmission channel that is formed between the socket and the plug, Xiang Suoshu
Second terminal equipment sends unpaired message, includes the identification information of the first terminal equipment in the unpaired message.
In the present embodiment, when the socket of the plug of second terminal equipment insertion first terminal equipment, first terminal equipment
The insertion is based on second terminal equipment to connect, forms electrical connection access between the two, which is known as matching transmission channel.
First terminal equipment is sent to the by the unpaired message that the pairing transmission channel will carry equipment of itself mark
Two terminal devices.With it is above-mentioned for example, tablet computer by carry equipment of itself mark unpaired message be sent to bluetooth key
Disk.
Wherein, the identification information of above-mentioned first terminal equipment is such as the MAC Address of first terminal equipment.
It optionally, can also include key information, the service discovery letter of such as first terminal equipment in the unpaired message
Breath.The service discovery information can be a kind of customized service discovery information, for example can be instruction second terminal equipment and open
Move the instruction message of some application.
Step 103, second terminal equipment according to the identification information of the first terminal equipment, using wireless transmission method to
The first terminal equipment sends pairing request, includes the identification information of the second terminal equipment in the pairing request.
Step 104, first terminal equipment send pairing to the second terminal equipment using the wireless transmission method and ring
It answers, completes the pairing with the second terminal equipment.
After second terminal equipment receives the unpaired message of first terminal equipment transmission, it is different from above by wired
Pairing transmission channel transmission first terminal equipment unpaired message, second terminal equipment using by the way of being wirelessly transferred to first
Terminal device sends pairing request.The wireless transmission method includes any one of following transmission mode: bluetooth, it is infrared,
ZigBee、WiFi。
It wherein, can also include such as matching in above-mentioned pairing request other than including the mark of second terminal equipment
Request mark for reporting to the first terminal equipment pairing request is used for requesting to establish pairing with it to connect, Yi Jishang
The key information etc. stated, for being authenticated to second terminal equipment.
After first terminal equipment receives the pairing request, also by corresponding wireless transmission method to second terminal equipment
Pairing response is sent, is connected and is established with the pairing of completion between the two.
In the present embodiment, when first terminal equipment detects plug of its socket inserted with second terminal equipment, triggering
The pairing process flow of first terminal equipment and second terminal equipment room.Specifically, firstly, first terminal equipment is inserted by it
Mouth is connect with the plug of second terminal equipment is formed by pairing transmission channel, and sending to second terminal equipment includes its equipment mark
The unpaired message of knowledge;Secondly, second terminal equipment is after receiving the unpaired message, by wireless transmission method to first terminal
Equipment sends pairing request;Finally, first terminal equipment sends pairing response to second terminal equipment, with completion matching between the two
To connection.Through the above scheme, it is based on above-mentioned insert action, enables to second terminal equipment to accurately determine it and needs to match
Connection is first terminal equipment, so that pairing connection between the two is accurate and reliable, and user only needs to carry out above-mentioned insertion behaviour
Work, it is simple to operate.
Fig. 2 is the flow chart of present device matching method embodiment two, as shown in Fig. 2, before above-mentioned steps 103,
It can also include the following steps:
Step 201, second terminal equipment carry out format check to the identification information of the first terminal equipment, if verification is logical
It crosses, thens follow the steps 202, otherwise feedback error prompts.
Optionally, can also include:
Step 202, second terminal equipment store the unpaired message.
Optionally, after step 103, can also include:
Step 203, first terminal equipment store the identification information of the second terminal equipment.
In the present embodiment, second terminal equipment is sent by above-mentioned pairing transmission channel receiving first terminal equipment
The identification information for carrying first terminal equipment unpaired message after, also need to carry out the identification information of the first terminal equipment
Format check.For example, MAC Address is 48 bits, if the MAC Address for the first terminal equipment that second terminal equipment receives is not
It is 48, then second terminal equipment can consider the problems such as packet loss, error of transmission has occurred in the pairing transmission channel, verify obstructed
It crosses.If verification does not pass through, second terminal equipment can be transmitted through to first terminal equipment feedback error by above-mentioned pairing
Prompt, so that first terminal equipment can retransmit unpaired message again.
In the present embodiment, by the verification to unpaired message, the reliability of pairing connection ensure that, so as to the process of matching
It goes on smoothly.
Fig. 3 is the structural schematic diagram of present device pair system embodiment one, as shown in figure 3, the system includes: first
Terminal device 1 and second terminal equipment 2.
Wherein, include: first processor 11 in first terminal equipment 1, and connect respectively with first processor 11 slotting
Mouthful the 12, first wireless transceiver 13 and first memory 14 include detection circuit 121 in socket 12.
Include: second processor 21 in second terminal equipment 2, and the plug 22 that is connect respectively with second processor 21 and
Second wireless transceiver 23;
The detection circuit 121 for whether detecting the socket 12 inserted with the plug 22, and is detecting insertion
When having the plug 22, Xiang Suoshu first processor 11 sends trigger signal.
Wherein, which, which such as can be, is arranged in the prior art in the sockets such as receiver J-Horner, USB jack
For detecting whether the detection circuit for having external device (ED) to be inserted into, specific circuit composition repeat no more.
The first processor 11, for passing through the socket 12 and the plug after receiving the trigger signal
The pairing transmission channel formed between 22, Xiang Suoshu second processor 21 send unpaired message, include described in the unpaired message
The identification information of first terminal equipment 1.
The second processor 21, for after receiving the unpaired message, according to the mark of the first terminal equipment 1
Know information, controls second wireless transceiver 23 to the first terminal equipment 1 and send pairing request, in the pairing request
Identification information including the second terminal equipment 2.
First wireless transceiver 13, for receiving the pairing request, and in the control of the first processor 11
Under, Xiang Suoshu second terminal equipment 2 sends pairing response, completes the pairing with the second terminal equipment 2.
The first memory 14, for storing the unpaired message.
Wherein, the socket 12 includes any socket in following socket:
Receiver J-Horner, USB jack, HDMI socket, MHL socket, lighting socket;
Correspondingly, the plug 22 includes and any plug in the following plug of the socket 12 cooperation:
Headset plug, USB plug, HDMI plug, MHL plug, lighting plug.
Wherein, the wireless transmission method packet that first wireless transceiver 13, second wireless transceiver 23 are supported
It includes following any:
Bluetooth, infrared, ZigBee, WiFi.
The present embodiment system can be used for executing the technical solution of embodiment of the method shown in Fig. 1, realization principle and technology
Effect is similar, and details are not described herein again.
Fig. 4 is the structural schematic diagram of present device pair system embodiment two, as shown in figure 4, embodiment shown in Fig. 3
On the basis of, it include checking circuit 211 in the second processor 21;
The checking circuit 211 carries out format check for the identification information to the first terminal equipment 1.
In the second terminal equipment 2 further include: the second memory 24 being connect with the second processor 21, described
Two memories 24, for storing the unpaired message.
The present embodiment system can be used for executing the technical solution of embodiment of the method shown in Fig. 2, realization principle and technology
Effect is similar, and details are not described herein again.
Those of ordinary skill in the art will appreciate that: realize that all or part of the steps of above method embodiment can pass through
The relevant hardware of program instruction is completed, and program above-mentioned can be stored in a computer readable storage medium, the program
When being executed, step including the steps of the foregoing method embodiments is executed;And storage medium above-mentioned includes: ROM, RAM, magnetic disk or light
The various media that can store program code such as disk.
Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention., rather than its limitations;To the greatest extent
Pipe present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that: its according to
So be possible to modify the technical solutions described in the foregoing embodiments, or to some or all of the technical features into
Row equivalent replacement;And these are modified or replaceed, various embodiments of the present invention technology that it does not separate the essence of the corresponding technical solution
The range of scheme.