CN106301488B - A kind of Bluetooth adapter and its working method - Google Patents
A kind of Bluetooth adapter and its working method Download PDFInfo
- Publication number
- CN106301488B CN106301488B CN201610864548.XA CN201610864548A CN106301488B CN 106301488 B CN106301488 B CN 106301488B CN 201610864548 A CN201610864548 A CN 201610864548A CN 106301488 B CN106301488 B CN 106301488B
- Authority
- CN
- China
- Prior art keywords
- bluetooth
- usb
- protocol
- response
- data
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 47
- 230000004044 response Effects 0.000 claims abstract description 539
- 238000005538 encapsulation Methods 0.000 claims description 269
- 230000005540 biological transmission Effects 0.000 claims description 94
- 241001062009 Indigofera Species 0.000 claims description 17
- 230000008520 organization Effects 0.000 claims description 17
- 238000001514 detection method Methods 0.000 claims description 14
- 230000000977 initiatory effect Effects 0.000 claims description 11
- 238000012360 testing method Methods 0.000 claims description 8
- 230000001960 triggered effect Effects 0.000 claims 1
- 230000000694 effects Effects 0.000 description 26
- 230000002093 peripheral effect Effects 0.000 description 8
- 238000004891 communication Methods 0.000 description 4
- 230000006978 adaptation Effects 0.000 description 2
- 230000017702 response to host Effects 0.000 description 2
- 238000012795 verification Methods 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000002592 echocardiography Methods 0.000 description 1
- 230000005611 electricity Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 230000032258 transport Effects 0.000 description 1
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04B—TRANSMISSION
- H04B5/00—Near-field transmission systems, e.g. inductive or capacitive transmission systems
- H04B5/40—Near-field transmission systems, e.g. inductive or capacitive transmission systems characterised by components specially adapted for near-field transmission
- H04B5/48—Transceivers
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W4/00—Services specially adapted for wireless communication networks; Facilities therefor
- H04W4/80—Services using short range communication, e.g. near-field communication [NFC], radio-frequency identification [RFID] or low energy communication
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Mobile Radio Communication Systems (AREA)
Abstract
The invention discloses a kind of Bluetooth adapter and its working method, the method includes:Bluetooth adapter searches for the bluetooth security equipment to match with default device identification and establishes connection with it;Bluetooth adapter states the usb protocol mark of itself to host computer;Bluetooth adapter receives the USB command from host computer;Bluetooth adapter is according to the protocol type and USB command tissue Bluetooth commands of bluetooth security equipment;Bluetooth adapter sends Bluetooth commands to bluetooth security equipment;Bluetooth adapter receives the bluetooth response from bluetooth security equipment;Bluetooth adapter identifies the usb protocol tissue USB response to match according to bluetooth response and with usb protocol;USB response is returned to host computer by Bluetooth adapter, and the Bluetooth adapter and host computer for so that bluetooth security equipment is provided through the invention are communicated.
Description
Technical field
The present invention relates to Bluetooth communication field more particularly to a kind of Bluetooth adapter and its working methods.
Background technique
With the continuous progress of science and technology, bluetooth security equipment can be communicated by Bluetooth channels and mobile terminal.But
In the prior art, bluetooth security equipment can not be communicated directly with host computer (such as the end PC).
Summary of the invention
Present invention solves the technical problem that:The present invention provides a kind of Bluetooth adapter and its working methods, pacify bluetooth
The Bluetooth adapter and host computer that full equipment can provide through the invention are communicated.
The present invention provides a kind of working methods of Bluetooth adapter, including:
Step s1:The bluetooth security equipment that Bluetooth adapter search matches with default device identification simultaneously connects with its foundation
It connects;
Step s2:The Bluetooth adapter states the usb protocol mark of itself to host computer;
Step s3:The Bluetooth adapter receives the USB command from the host computer;
Step s4:The Bluetooth adapter is according to the protocol type and the USB command tissue of the bluetooth security equipment
Bluetooth commands;
Step s5:The Bluetooth adapter sends Bluetooth commands to the bluetooth security equipment;
Step s6:The Bluetooth adapter receives the bluetooth response from the bluetooth security equipment;
Step s7:The Bluetooth adapter is assisted according to the bluetooth response and the USB to match with usb protocol mark
Discuss tissue USB response;
Step s8:The USB response is returned to the host computer by the Bluetooth adapter.
The present invention also provides a kind of working method of Bluetooth adapter, the Bluetooth adapter includes control chip, indigo plant
Tooth chip and USB module;The method includes:
Step y1:The control chip sends poll instruction to the Bluetooth chip, and the Bluetooth chip receives poll
After instruction, searches for the bluetooth security equipment to match with default device identification and establish a connection, to the control chip
Return to poll repeat-back;
Step y2:The control chip initiation USB module states to host computer the USB of itself by the USB module
Protocol-identifier;
Step y3:The control chip receives the USB command from host computer by the USB module;
Step y4:The control chip is according to the protocol type and the second preset protocol of the bluetooth security equipment to described
USB command is packaged, and obtains instruction encapsulation of data;
Step y5:Described instruction encapsulation of data is sent to the Bluetooth chip by the control chip;
Step y6:The Bluetooth chip obtains Bluetooth commands from described instruction encapsulation of data;
Step y7:The Bluetooth chip sends Bluetooth commands to bluetooth security equipment;It receives and is set from the bluetooth security
Standby bluetooth response;
Step y8:The Bluetooth chip encapsulates the bluetooth response according to the second preset protocol, obtains response encapsulation of data;
Step y9:The Bluetooth chip sends the response encapsulation of data to the control chip;
Step y10:What the control chip matched according to the response encapsulation of data and with usb protocol mark
Usb protocol tissue USB response;
Step y11:The USB response is returned to the host computer by the USB module by the control chip.
The present invention provides a kind of Bluetooth adapter, including:First search module, the first link block, the first statement mould
Block, the first tissue module, the first sending module, the first receiving module, the second receiving module, minor microstructure module and second send
Module;
First search module, for searching for the bluetooth security equipment to match with default device identification;
First link block connects for searching the bluetooth security equipment that plain block search arrives with described first and establishing
It connects;
First declaration module, for after first link block and the bluetooth security equipment establish connection,
The usb protocol mark of itself is stated to host computer;
First receiving module, for receiving the USB command from the host computer;
The first tissue module, for the protocol type and first receiving module according to the bluetooth security equipment
The USB command tissue Bluetooth commands received;
First sending module, for sending Bluetooth commands to the bluetooth security equipment;
Second receiving module, for receiving the bluetooth response from the bluetooth security equipment;
The minor microstructure module, the bluetooth response for being received according to second receiving module and with it is described
Usb protocol identifies the usb protocol tissue USB response to match;
Second sending module, for the USB response to be returned to the host computer.
The present invention also provides a kind of Bluetooth adapter, including:Control chip, Bluetooth chip and USB module;
The control chip includes:First transmission unit, the first initialization unit, the first receiving unit, the first tissue list
Member, the second transmission unit, minor microstructure unit and third transmission unit
First transmission unit, for sending poll instruction to the Bluetooth chip;
First initialization unit, for receiving the poll from the Bluetooth chip when first receiving unit
After repeat-back, USB module is initialized, states that the usb protocol of itself identifies to host computer by the USB module;
First receiving unit, for receiving the poll repeat-back from the Bluetooth chip;Pass through the USB mould
Block receives the USB command from host computer;Receive the response encapsulation of data from the Bluetooth chip;
The first tissue unit, for the protocol type and the second preset protocol according to the bluetooth security equipment to institute
It states USB command to be packaged, obtains instruction encapsulation of data;
Second transmission unit, for described instruction encapsulation of data to be sent to the Bluetooth chip;
The minor microstructure unit, for according to from the Bluetooth chip the response encapsulation of data and with it is described
Usb protocol identifies the usb protocol tissue USB response to match;
The third transmission unit, for the USB response to be returned to the host computer by the USB module;
The Bluetooth chip includes:Second receiving unit, the first search unit, the first connection unit, the 4th transmission unit,
Third receiving unit, second acquisition unit, the 5th transmission unit, the 4th receiving unit, third organizational unit and the 6th send single
Member;
Second receiving unit, for receiving the poll instruction from control chip;
First search unit, for searching for and default after second receiving unit receives poll instruction
The bluetooth security equipment that device identification matches;
First connection unit, for establishing connection with the bluetooth security equipment,
4th transmission unit, for returning to poll repeat-back to the control chip;
Third receiving unit, for receiving the instruction encapsulation of data from the control chip;
The second acquisition unit, for obtaining Bluetooth commands from described instruction encapsulation of data;
5th transmission unit, for sending the Bluetooth commands that second acquisition unit is got to bluetooth security equipment;
4th receiving unit, for receiving the bluetooth response from the bluetooth security equipment;
The third organizational unit, for encapsulating the bluetooth that the 4th receiving unit receives according to the second preset protocol
Response obtains response encapsulation of data;
6th transmission unit sends the response encapsulation of data to the control chip.
Beneficial effects of the present invention are:The present invention provides a kind of Bluetooth adapter and its working method, Bluetooth adapter
The USB command for meeting USB specification from host computer is converted, the Bluetooth commands that bluetooth security equipment can identify are obtained
Afterwards, Bluetooth commands are sent to bluetooth security equipment, the bluetooth response that bluetooth security equipment returns is reconverted into upper function
The USB response for meeting USB specification enough identified, and the USB response for meeting USB specification is returned into host computer, finally make bluetooth
The Bluetooth adapter and host computer that safety equipment can provide through the invention are communicated.
Detailed description of the invention
Fig. 1 is a kind of working method for Bluetooth adapter that the embodiment of the present invention 1 provides;
Fig. 2 is a kind of working method for Bluetooth adapter that the embodiment of the present invention 2 provides;
Fig. 2-1 is the refined flow chart for the step 107 that the embodiment of the present invention 2 provides;
Fig. 2-2 is the refined flow chart for the step 110 that the embodiment of the present invention 2 provides;
Fig. 3 is a kind of flow chart of the working method for Bluetooth adapter that the embodiment of the present invention 3 provides;
Fig. 3-1 is the refined flow chart for the step 207 that the embodiment of the present invention 3 provides;
Fig. 3-2 is the refined flow chart for the step 210 that the embodiment of the present invention 3 provides;
Fig. 4 and Fig. 5 is the specific flow chart of the working method for the Bluetooth adapter that the embodiment of the present invention 4 provides;
Fig. 6 is a kind of flow chart of the working method for Bluetooth adapter that the embodiment of the present invention 5 provides;
Fig. 6-1 is the refined flow chart for the step 507 that the embodiment of the present invention 5 provides;
Fig. 6-2 is the refined flow chart for the step 508 that the embodiment of the present invention 5 provides;
Fig. 7 is a kind of structure chart for Bluetooth adapter that the embodiment of the present invention 6 provides;
Fig. 8 is a kind of structure chart for Bluetooth adapter that the embodiment of the present invention 7 provides.
Specific implementation method
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete
Site preparation description, it is clear that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.It is based on
Embodiment in the present invention, it is obtained by those of ordinary skill in the art without making creative efforts every other
Embodiment shall fall within the protection scope of the present invention.
Embodiment 1
A kind of working method of Bluetooth adapter is present embodiments provided, as shown in Figure 1, specifically including:
Step s1:The bluetooth security equipment that Bluetooth adapter search matches with default device identification simultaneously connects with its foundation
It connects;
Step s2:Bluetooth adapter states the usb protocol mark of itself to host computer;
Step s3:Bluetooth adapter receives the USB command from host computer;
Step s4:Bluetooth adapter is according to the protocol type and USB command tissue Bluetooth commands of bluetooth security equipment;
Step s5:Bluetooth adapter sends Bluetooth commands to bluetooth security equipment;
Step s6:Bluetooth adapter receives the bluetooth response from bluetooth security equipment;
Step s7:Bluetooth adapter is answered according to bluetooth response and the usb protocol tissue USB to match with usb protocol mark
It answers;
Step s8:USB response is returned to host computer by Bluetooth adapter.
In the present embodiment, host computer be can be, but not limited to as PC.
In the present embodiment, after step s1, can also include:Bluetooth adapter is from the broadcast message of bluetooth security equipment
Obtain the first protocol-identifier of bluetooth security equipment;Correspondingly, step s4 is specially:Bluetooth adapter is set according to bluetooth security
The standby corresponding protocol type of the first protocol-identifier and USB command tissue Bluetooth commands.
In the present embodiment, step s4 can be specially:Bluetooth adapter obtains the effective instruction data in USB command, root
According to the protocol type and effective instruction data organization Bluetooth commands of bluetooth security equipment;Correspondingly, step s7 is specially:Bluetooth is suitable
Orchestration obtains the effective response data in bluetooth response, includes effective according to the usb protocol tissue to match with usb protocol mark
The USB response of reply data.
In the present embodiment, the effective instruction data in USB command are specially the APDU in USB command
(ApplicationProtocolDataUnit, Application Protocol Data Unit).
In the present embodiment, after step s1, can also include before step s4:Bluetooth adapter is from bluetooth security equipment
The first protocol-identifier of bluetooth security equipment is obtained in broadcast message;Correspondingly, after step s3, further include:Bluetooth adapter
Judge that usb protocol identifies whether to match with the first protocol-identifier;
When usb protocol mark matches with the first protocol-identifier, following steps are executed:
Step r1:Bluetooth adapter sends USB command to bluetooth security equipment;
Step r2:Bluetooth adapter receives the USB response from bluetooth security equipment;
Step r3:USB response is returned to host computer by Bluetooth adapter;
When usb protocol mark is mismatched with the first protocol-identifier, following steps are executed:
Step t1:Bluetooth adapter obtains the effective instruction data in USB command, according to the protocol class of bluetooth security equipment
Type and effective instruction data organization Bluetooth commands;
Step t2:Bluetooth adapter sends Bluetooth commands to bluetooth security equipment;
Step t3:Bluetooth adapter receives the bluetooth response from bluetooth security equipment;
Step t4:Bluetooth adapter obtains the effective response data in bluetooth response, matches according to usb protocol mark
Usb protocol tissue include imitate reply data USB response;
Step t4 is specially:Bluetooth adapter obtains effective in bluetooth response according to the protocol type of bluetooth security equipment
Reply data includes the USB response for imitating reply data according to the usb protocol tissue to match with usb protocol mark;
Step t5:USB response is returned to host computer by Bluetooth adapter.
In the present embodiment, after step s1, further include before step s2:Broadcast of the Bluetooth adapter from bluetooth security equipment
The first protocol-identifier of bluetooth security equipment is obtained in information;Correspondingly, step s2 is specially:Bluetooth adapter by itself
Usb protocol mark is set as the first protocol-identifier, states that the usb protocol of itself is identified as the first protocol-identifier to host computer;Phase
Ying Di, step s4 are specially:Bluetooth adapter is using USB command as Bluetooth commands;Step s7 is specially:Bluetooth adapter will be blue
Tooth response is as USB response.
In the present embodiment, the protocol type of bluetooth security equipment can also be that Bluetooth adapter itself is preset;
When the protocol type of preset bluetooth security equipment is matched with the usb protocol of Bluetooth adapter itself mark:Step
Suddenly s4 is specially:Bluetooth adapter is using USB command as Bluetooth commands;Step s7 is specially:Bluetooth adapter is by bluetooth response
As USB response;
When the usb protocol of the protocol type of preset bluetooth security equipment and Bluetooth adapter itself, which identifies, to be mismatched:
Step s4 is specially:Bluetooth adapter obtains the effective instruction data in USB command, according to the protocol type of bluetooth security equipment
With effective instruction data organization Bluetooth commands;Step s7 is specially:Bluetooth adapter obtains the effective response number in bluetooth response
According to including the USB response for imitating reply data according to the usb protocol tissue that matches of usb protocol mark.
In the present embodiment, step s3 is specially:The USB command to be received from host computer such as Bluetooth adapter, when pre-
If after receiving the USB command from host computer in the time, executing step s4;When being not received by within a preset time from upper
It after the USB command of position machine, detects whether to have disconnected with bluetooth security equipment, if it is, Bluetooth adapter resets, return
Step s1;Otherwise, it continues waiting for receiving the USB command from host computer;After step s8, return step s3 continues waiting for receiving
USB command from host computer.
In the present embodiment, further include after step s1:Bluetooth adapter detects whether to have disconnected company with bluetooth security equipment
It connects, if it is, Bluetooth adapter resets, return step s1;Otherwise, it continues to test and whether with bluetooth security equipment has disconnected company
It connects.
In the present embodiment, Bluetooth adapter resets, specially:Bluetooth chip in Bluetooth adapter resets, and controls chip
It resets.After Bluetooth adapter resets, host computer detects Bluetooth adapter on usb bus and upper by the hub of itself
Position machine disconnects.
In the present embodiment, usb protocol is specially CCID protocol or SCSI protocol or HID protocol or other agreements.
The present embodiment additionally provides a kind of working method of Bluetooth adapter, wherein Bluetooth adapter include control chip,
Bluetooth chip and USB module;The method includes:
Step y1:It controls chip and sends poll instruction to Bluetooth chip, after Bluetooth chip receives poll instruction, search
The bluetooth security equipment that matches with default device identification simultaneously establishes a connection, and returns to poll repeat-back to control chip;
Step y2:Chip initiation USB module is controlled, the usb protocol mark of itself is stated to host computer by USB module
Know;
Step y3:It controls chip and the USB command from host computer is received by USB module;
Step y4:Chip is controlled to carry out USB command according to the protocol type and the second preset protocol of bluetooth security equipment
Encapsulation obtains instruction encapsulation of data;
Step y5:Control chip will instruct encapsulation of data to be sent to Bluetooth chip;
Step y6:Bluetooth chip obtains Bluetooth commands from instruction encapsulation of data;
Step y7:Bluetooth chip sends Bluetooth commands to bluetooth security equipment;Receive the bluetooth from bluetooth security equipment
Response;
Step y8:Bluetooth chip encapsulates bluetooth response according to the second preset protocol, obtains response encapsulation of data;
Step y9:Bluetooth chip sends response encapsulation of data to control chip;
Step y10:Control chip identifies the usb protocol tissue USB to match according to response encapsulation of data and with usb protocol
Response;
Step y11:It controls chip and USB response is returned to by host computer by USB module.
Further, after step y1, further include:It controls chip and sends acquisition bluetooth security device identification to Bluetooth chip
Instruction;Bluetooth chip returns to the response of the first protocol-identifier including bluetooth security equipment to control chip;Correspondingly, step y4
Specially:Chip is controlled according to protocol type corresponding with the first protocol-identifier of bluetooth security equipment and the second preset protocol pair
USB command is packaged, and obtains instruction encapsulation of data.
Further, step y4 is specially:The effective instruction data in chip acquisition USB command are controlled, are pacified according to bluetooth
The protocol type of full equipment and the second preset protocol are packaged effective instruction data, obtain instruction encapsulation of data;Step y10
Specially:Control chip response encapsulation of data is unsealed, obtain bluetooth response in effective response data, according to USB
The usb protocol tissue that protocol-identifier matches includes the USB response for imitating reply data.
Further, step y4 is specially:The effective instruction data in chip acquisition USB command are controlled, are pacified according to bluetooth
The protocol type of full equipment is packaged effective instruction data, obtains the first encapsulation of data;According to the second preset protocol to
One encapsulation of data is packaged, and obtains instruction encapsulation of data;Step y6 is specially:Bluetooth chip is obtained from instruction encapsulation of data
First encapsulation of data, using the first encapsulation of data as Bluetooth commands.
Further, step y10 is specially:Control chip unseals response encapsulation of data, obtains bluetooth response, root
The effective response data in bluetooth response are obtained according to the protocol type of bluetooth security equipment, are matched according to usb protocol mark
Usb protocol tissue include imitate reply data USB response.
Further, after step y1, further include before step y4:It controls chip and sends acquisition bluetooth to Bluetooth chip
Safety equipment mark instruction;Bluetooth chip returns to the response of the first protocol-identifier including bluetooth security equipment to control chip;
Correspondingly, after step y3, further include:Control chip judges that usb protocol identifies whether to match with the first protocol-identifier, when
When usb protocol mark matches with the first protocol-identifier, following steps are executed:
Step m1:Control chip is packaged USB command according to the second preset protocol, obtains instruction encapsulation of data;
Step m2:Control chip will instruct encapsulation of data to be sent to Bluetooth chip;
Step m3:Bluetooth chip unseals instruction encapsulation of data, obtains USB command;
Step m4:Bluetooth chip sends USB command to bluetooth security equipment;The USB from bluetooth security equipment is received to answer
It answers;
Step m5:Bluetooth chip encapsulates USB response according to the second preset protocol, obtains response encapsulation of data;
Step m6:Bluetooth chip sends response encapsulation of data to control chip;
Step m7:Control chip unseals response encapsulation of data, obtains USB response;
Step m8:It controls chip and USB response is returned to by host computer by USB module;
When usb protocol mark is mismatched with the first protocol-identifier, step y4 is executed.
Further, after step y1, further include before step y2:It controls chip and sends acquisition bluetooth peace to Bluetooth chip
Full device identification instruction;Bluetooth chip returns to the response of the first protocol-identifier including bluetooth security equipment to control chip;
Step y2 is specially:Chip initiation USB module is controlled, sets the first agreement for the usb protocol mark of itself
Mark states to host computer the first protocol-identifier of itself by USB module;
Step y4 is specially:Control chip is packaged USB command according to the second preset protocol, obtains instruction encapsulation number
According to;
Step y6 is specially:Bluetooth chip unseals instruction encapsulation of data, obtains USB command;
Step y7 is specially:Bluetooth chip sends bluetooth to bluetooth security equipment and refers to using USB command as Bluetooth commands
It enables;Receive the bluetooth response from bluetooth security equipment;
Step y10 is specially:Control chip obtains bluetooth response from response encapsulation of data, using bluetooth response as USB
Response.
Further, the protocol type of bluetooth security equipment can also be preset for Bluetooth adapter;
When the protocol type of preset bluetooth security equipment is matched with usb protocol mark:
Step y4 is specially:Control chip is packaged USB command according to the second preset protocol, obtains instruction encapsulation number
According to;Step y6 is specially:Bluetooth chip obtains USB command, using USB command as Bluetooth commands from instruction encapsulation of data;Step
Suddenly y10 is specially:Control chip obtains bluetooth response from response encapsulation of data, using bluetooth response as USB response;
When the protocol type of preset bluetooth security equipment and usb protocol mark mismatch:
Step y4 is specially:The effective instruction data in chip acquisition USB command are controlled, according to the association of bluetooth security equipment
View type and the second preset protocol are packaged effective instruction data, obtain instruction encapsulation of data;Step y10 is specially:Control
Coremaking piece unseals response encapsulation of data, obtains the effective response data in bluetooth response, identifies phase according to usb protocol
Matched usb protocol tissue includes the USB response for imitating reply data.
Further, step y3 is specially:The USB commands to be received from host computer such as chip are controlled, when default
In receive the USB command from host computer after, execute step y4;When being not received by within a preset time from host computer
USB command after, judge whether to receive from the Bluetooth chip and information that has disconnected of bluetooth security equipment, if
It is then to reset Bluetooth chip, resets control chip, return step y1;Otherwise, it continues waiting for receiving the USB from host computer and refer to
It enables;After step y11, return step y3.
Further, further include after step y1:Control chip judges whether to receive from Bluetooth chip and bluetooth
The information that safety equipment has disconnected resets control chip, return step y1 if it is, resetting Bluetooth chip;Otherwise,
Continue to determine whether to receive information from Bluetooth chip and that bluetooth security equipment has disconnected.
The working method of Bluetooth adapter provided in this embodiment, Bluetooth adapter are establishing connection with bluetooth security equipment
Later, report the usb protocol mark of itself to the end PC, Bluetooth adapter is suitable can be identified as HID device or CCID equipment or
Scsi device or other USB devices enhance the adaptability and application of Bluetooth adapter.When Bluetooth adapter has received
After the USB command for meeting USB specification from the end PC, the USB command for meeting USB specification is converted, bluetooth security is obtained
After the Bluetooth commands that equipment can identify, Bluetooth commands are sent to bluetooth security equipment, the indigo plant that bluetooth security equipment is returned
Tooth response is reconverted into the USB response for meeting USB specification that the end PC can identify, and the USB response for meeting USB specification is returned
The end PC is given, the Bluetooth adapter and the end PC for so that bluetooth security equipment is provided through the invention are communicated.
Embodiment 2
A kind of working method of Bluetooth adapter is present embodiments provided, as shown in Fig. 2, specifically including:
Step 101:Bluetooth adapter powers on;
Step 102:Bluetooth adapter initialization;
In the present embodiment, Bluetooth adapter initialization is specially:Bluetooth adapter initialization control chip and Bluetooth chip.
Step 103:The bluetooth security equipment that Bluetooth adapter search matches with default device identification simultaneously connects with its foundation
It connects;
Specifically, Bluetooth adapter askes instruction by control chipset driving wheel, sends poll instruction to Bluetooth chip, receives
Poll repeat-back from Bluetooth chip.After Bluetooth chip receives poll instruction, search and default device identification phase
Matched bluetooth security equipment simultaneously establishes a connection, and returns to poll repeat-back to control chip.
Wherein, Bluetooth adapter askes instruction by control chipset driving wheel, specially:Bluetooth adapter passes through control chip
It is instructed according to the second preset protocol tissue poll.In the present embodiment, include in poll instruction:Instruct start byte, command identification,
Data length, data field and the check bit of data field.
For example, the instruction banner word that Bluetooth adapter is instructed " 0x5A " and " 0xA5 " as poll by controlling chip
Section is arranged in the first byte and the second byte of poll instruction, the command identification that " 0x02 " is instructed as poll, and setting exists
Poll instruction third byte on, will " 0x00 " and " 0x00 " as poll instruct in data field data length, set respectively
It sets on the nybble and the 5th byte of poll instruction, the check value " XOR " that poll is instructed, poll instruction is set most
In the latter byte (check bit), obtained poll instruction is specially:" 02 00 00 XOR of 5A A5 " is sent to Bluetooth chip
Poll instructs " 02 00 00 XOR of 5A A5 ";Etc. the poll repeat-back to be received from Bluetooth chip.
In the present embodiment, presetting device identification is preset device identification, wherein device identification includes:Bluetooth equipment
UUID (Universally Unique Identifier, Universally Unique Identifier), the MAC Address of bluetooth equipment and bluetooth are set
At least one of standby device name.Wherein, the UUID of bluetooth equipment is the service unique identification information that bluetooth equipment is supported,
The MAC Address of bluetooth equipment or the device name of bluetooth equipment are the unique identification information of bluetooth equipment.
In the present embodiment, bluetooth security equipment be can be, but not limited to as blue-tooth intelligence key devices and Bluetooth intelligent card etc..
Step 104:Bluetooth adapter judges whether to establish connection with bluetooth security equipment, if so, thening follow the steps
105;Otherwise, return step 104;
Specifically, after Bluetooth adapter receives the poll repeat-back from Bluetooth chip by controlling chip, root
Judge whether to establish connection with bluetooth security equipment according to poll repeat-back, if so, thening follow the steps 105;Otherwise, step is returned
Rapid 104;
More specifically, after Bluetooth adapter receives the poll repeat-back from Bluetooth chip by control chip,
Poll repeat-back is parsed according to the second preset protocol, obtains the connection result mark in the data field in poll repeat-back,
Judge whether to establish connection with bluetooth security equipment according to connection result mark, if connection result is identified as success flag
" 00 " then establishes connection with bluetooth security equipment;Otherwise, connection failure.
For example, if Bluetooth adapter by control chip receive from Bluetooth chip poll repeat-back be " A5
02 00 01 00 XOR of 5A ", obtain the 5th byte after, the data in byte before the last byte, and by its
As the connection result mark in the data field in poll repeat-back, then " 00 " is identified according to connection result and determine to pacify with bluetooth
Full equipment establishes connection;If Bluetooth adapter is " A5 by controlling chip to receive the poll repeat-back from Bluetooth chip
02 00 01 01 XOR of 5A ", obtain the 5th byte after, the data in byte before the last byte, and by its
As the connection result mark in the data field in poll repeat-back, then " 01 " is identified according to connection result and determine no and indigo plant
Tooth safety equipment establishes connection.
Step 105:Bluetooth adapter states the usb protocol mark of itself to host computer;
Specifically, Bluetooth adapter passes through the control chip initiation USB module of itself, states itself to host computer
Usb protocol mark.
In the present embodiment, host computer be can be, but not limited to as PC;Usb protocol mark be specially CCID protocol mark or
HID protocol mark or SCSI protocol mark.In the present embodiment, usb protocol is identified so that SCSI protocol identifies as an example.
Step 106:The USB command to be received from host computer such as Bluetooth adapter comes when receiving within a preset time
From after the USB command of host computer, step 107 is executed;When being not received by the USB command from host computer within a preset time
Afterwards, it detects whether to have disconnected with bluetooth security equipment, if it is, Bluetooth adapter resets, return step 102;Otherwise,
Return step 106;
Preferably, preset time is 3 seconds.
In the present embodiment, Bluetooth adapter resets, specially:Bluetooth chip in Bluetooth adapter resets, and controls chip
It resets.After Bluetooth adapter resets, host computer detects Bluetooth adapter on usb bus and upper by the hub of itself
Position machine disconnects.
Step 107:Bluetooth adapter parses USB command, obtains the effective instruction data in USB command, is pacified according to bluetooth
The protocol type and effective instruction data organization Bluetooth commands of full equipment;
In the present embodiment, the effective instruction data in USB command are specially the APDU in USB command
(ApplicationProtocolDataUnit, Application Protocol Data Unit).
In the present embodiment, USB command is by taking SCSI command as an example;The type protocol of bluetooth security equipment can be bluetooth adaptation
What device and bluetooth security equipment consulted in advance, it can be by taking CCID protocol as an example.
Specifically, Bluetooth adapter parses USB command according to the usb protocol to match with usb protocol mark, obtains USB
Effective instruction data in instruction add the first protocol header and command description mark before effective instruction data, pre- according to first
If checking algorithm carries out operation to the data for including the first protocol header, command description mark and effective instruction data, first is obtained
Check value adds the first check value after valid data, obtains including the first protocol header, command description mark, effective instruction number
According to the Bluetooth commands with the first check value.
For example, Bluetooth adapter parses SCSI command according to SCSI protocol
" 5553424358aad6d60500000000000aff455041535300000055000000 0000000047474b80 ", will
The data in preceding 31 bytes in SCSI command obtain in the 13rd byte in command control word as command control word
Data " 00 " determine that current SCSI command is upper according to the data " 00 " in the 13rd byte in the command control word got
Position machine sends the instruction of effective instruction data, obtains the data " 05 " in the 9th byte of command control word, and as
The length of effective instruction data in SCSI command, obtains the data of 5 byte lengths after command control word, and is made
For the effective instruction data in SCSI command, the effective instruction data for obtaining SCSI command are " 00 47 47 4b 80 ", are being had
CCID protocol head " 6F,070,000 00,000,400 0000 " and command description mark " 00 " are added before imitating director data, including
Data " the 6F070000 00000400 of CCID protocol head, command description mark and effective instruction data
0000000047474b80 ", according to EDC checking algorithm to including that CCID protocol head and effective instruction data carry out operation and obtain the
One check value " A7 ", adds the first check value after valid data, obtain include CCID protocol head, command description mark, effectively
The Bluetooth commands " 00,000,400 00000000 0047474b80A7 of 6F070000 " of director data and the first check value.
It should be noted that further including being returned to host computer after Bluetooth adapter receives the SCSI command from host computer
It echoes and answers control word, for example, when Bluetooth adapter receives the SCSI command from host computer
After " 5553424358aad6d60500000000000aff455041535300000055000000 0000000047474b80 ",
To host computer returning response control word " 5553425358aad6d60000000000 ".
Step 108:Bluetooth adapter sends Bluetooth commands to bluetooth security equipment;
Specifically, Bluetooth adapter sends Bluetooth commands to bluetooth security equipment by Bluetooth chip.
Step 109:Bluetooth adapter receives the bluetooth response from bluetooth security equipment;
Specifically, Bluetooth adapter receives the bluetooth response from bluetooth security equipment by Bluetooth chip.
Step 110:Bluetooth adapter parse bluetooth response, obtain bluetooth response in effective response data, according to USB
The usb protocol tissue that protocol-identifier matches includes the USB response for imitating reply data;
Specifically, Bluetooth adapter obtains the effective response number in bluetooth response according to the protocol type of bluetooth security equipment
According to according to the USB response for the usb protocol tissue that matches of usb protocol mark including the effective response data.
More specifically, Bluetooth adapter parses bluetooth response according to the protocol type of bluetooth security equipment, and bluetooth is answered
Data after the first protocol header answered obtain in bluetooth response in the data field of bluetooth response as bluetooth reply data domain
Effective response data, include the USB response for imitating reply data according to the usb protocol tissue that matches of usb protocol mark.
For example, Bluetooth adapter parses bluetooth response according to the protocol type of bluetooth security equipment
“80830000000106000000006AF61B6E94C5CE5871D54D31F9456F9BA397DE422AC11D75
DD95A8FE2895D234CF80D2F1436A91E94CAB11F0A577461BC384F7E9B8DFBC19CB8055F8B43E8
A23B1DCF2FE1BAC129FB85889161DC5176BE28F3CE62E9ED1BDE1FCB190DD1CBD3417EEB06D1C
BE52CC5D490E9B47A8C5AECE485C9B746F50544C008A7CDC106D0F90 00 66 ", will be in bluetooth response
Data " 80,830,000 000106000000 " in preceding ten bytes are as the CCID protocol head in bluetooth response, by cross
Data after section are as the data field in bluetooth response, using the first character section in the data field in bluetooth response as bluetooth
Command description in response identifies, and the last byte in data field obtains the number in bluetooth response as third check value
The data in all bytes after the command description mark in domain, before third check value
“6AF61B6E94C5CE5871D54D31F9456F9BA397DE422AC11D75DD95A8FE2895D234CF80D2F1436A
91E94CAB11F0A577461BC384F7E9B8DFBC19CB8055F8B43E8A23B1DCF2FE1BAC129FB85889161
DC5176BE28F3CE62E9ED1BDE1FCB190DD1CBD3417EEB06D1CBE52CC5D490E9B47A8C5AECE485C
9B746F50544C008A7CDC106D0F9000 ", and as effective response data, include according to SCSI protocol tissue
Imitate the USB response " 6AF61B6E94C5CE5871D54D31F9456F9BA397DE422AC11D75DD95A8FE 2 of reply data
895D234CF80D2F1436A91E94CAB11F0A577461BC384F7E9B8DFBC19CB8055F8B43E8A23B1DCF2
FE1BAC129FB85889161DC5176BE28F3CE62E9ED1BDE1FC
B190DD1CBD3417EEB06D1CBE52CC5D490E9B47A8C5AECE485C9B746F50544C008A7CDC106D0F9
000 55 53 42 53f8 58 df da 00 00 00 00 00”。
It should be noted that according to SCSI protocol tissue include imitate reply data USB response be specially:According to SCSI
Agreement organizations include the USB response for imitating reply data and response control word.More specifically:According to SCSI protocol effective
Response control word is added after reply data, obtains including the USB response for imitating reply data and response control word.
For example, according to SCSI protocol in effective response data
“6AF61B6E94C5CE5871D54D31F9456F9BA397DE422AC11D75DD95A8FE2895D234CF80D2F1436A
91E94CAB11F0A577461BC384F7E9B8DFBC19CB8055F8B43E8A23B1DCF2FE1BAC129FB85889161
DC5176BE28F3CE62E9ED1BDE1FCB190DD1CBD3417EEB06D1CBE52CC5D490E9B47A8C5AECE485C
9B746F50544C008A7CDC106D0F9000 " adds response control word " 55 53 42 53f8,58 df da 00 00 afterwards
00 00 00 ", obtain include imitate reply data and response control word USB response be:
“6AF61B6E94C5CE5871D54D31F9456F9BA397DE422AC11D75DD95A8FE2895D234CF80D2F1436A
91E94CAB11F0A577461BC384F7E9B8DFBC19CB8055F8B43E8A23B1DCF2FE1BAC129FB85889161
DC5176BE28F3CE62E9ED1BDE1FCB190DD1CBD3417EEB06D1CBE52CC5D490E9B47A8C5AECE485C
9B746F50544C008A7CDC106D0F9000”。
Step 111:USB response is returned to host computer, return step 106 by Bluetooth adapter;
It is when USB response is specially SCSI response, i.e., blue when usb protocol is identified as SCSI protocol mark in the present embodiment
Before USB response is returned to host computer by tooth adapter, further include:Receive the return USB response instruction from host computer.
In the present embodiment, step 107 can be specifically included as shown in Fig. 2-1:
Step 1071:It controls chip and parses USB command, the effective instruction data in USB command are obtained, according to bluetooth security
The protocol type of equipment and the second preset protocol are packaged effective instruction data;
Specifically, control chip obtains the effective instruction data in USB command, according to the protocol type of bluetooth security equipment
Effective instruction data are packaged, the first encapsulation of data is obtained;The first encapsulation of data is sealed according to the second preset protocol
Dress obtains instruction encapsulation of data;
More specifically, control chip parses USB command according to the usb protocol to match with usb protocol mark, obtains
Effective instruction data in USB command add the first protocol header and command description mark, according to first before effective instruction data
Default checking algorithm carries out operation to the data for including the first protocol header, command description mark and effective instruction data, obtains the
One check value adds the first check value after effective instruction data, obtain include the first protocol header, command description mark, have
Imitate the first encapsulation of data of director data and the first check value;The second preset protocol head is added before the first encapsulation of data, according to
Second default checking algorithm carries out operation to the data for including the first encapsulation of data and the second preset protocol head, obtains the second verification
Value, the second check value is added after the first encapsulation of data, is obtained according to the first protocol header and the second preset protocol head to effective
Director data be packaged after instruction encapsulation of data.
For example, control chip parses SCSI command according to SCSI protocol, the effective instruction data for obtaining SCSI command are " 00
47 47 4b 80 " add CCID protocol head " 6F,070,000 00,000,400 000000 " before effective instruction data and order are retouched
Mark " 00 " is stated, obtaining includes CCID protocol head, command description identifies and the data " 6F070000 of effective instruction data
00000400 0000000047474b80 ", according to EDC checking algorithm to include CCID protocol head and effective instruction data into
Row operation obtains the first check value " A7 ", obtains the first encapsulation of data " 6F,070,000 00,000,400 00000000
0047474b80 A7";The second preset protocol head " 5A A5 04 0013 " is added before the first encapsulation of data, obtains including first
Data " the 5A A50400136F070000 00,000,400 00000000 of encapsulation of data and the second preset protocol head
0047474b80 A7 " transports the data for including the first encapsulation of data and the second preset protocol head according to LRC checking algorithm
It calculates, obtains the second check value " 00 ", the second check value is added after the first encapsulation of data, obtain according to the first protocol header and the
Two preset protocol heads effective instruction data are packaged after instruction encapsulation of data " 04 00 13 6F 07 00 00 of 5A A5
00 00 04 00 00 00 00 00 00 47 47 4b 80 A7 00”。
Step 1072:Control chip by according to the protocol type of bluetooth security equipment and the second preset protocol to effective instruction
Data be packaged after data, be sent to Bluetooth chip;
Specifically, control chip will instruct encapsulation of data to be sent to Bluetooth chip.
Step 1073:Bluetooth chip is from the protocol type and the second preset protocol according to bluetooth security equipment to effective instruction
Data be packaged after data in, obtain Bluetooth commands;
Specifically, Bluetooth chip obtains the first encapsulation of data from instruction encapsulation of data, and first encapsulation of data is made
For Bluetooth commands.
More specifically, Bluetooth chip unseals instruction encapsulation of data according to the second preset protocol, encapsulates from instruction
The first encapsulation of data is obtained in data, using the first encapsulation of data as Bluetooth commands.
For example, Bluetooth chip unseals instruction encapsulation of data, obtained data are " 0013 6F070000 of 5AA504
00000400 00000000 004,747,4b8,0A7 00 ", after obtaining the second preset protocol head, before the second check value
Data in all bytes, the data that will acquire " 00,000,400 00000000 0047474b80 A7 of 6F070000 " conduct
First encapsulation of data, using the first encapsulation of data as Bluetooth commands.
Correspondingly, step 110 can be specifically included as shown in Fig. 2-2:
Step 1101:Bluetooth chip encapsulates bluetooth response according to the second preset protocol;
Specifically, Bluetooth chip adds the second preset protocol head before bluetooth response, presets checking algorithm according to third
Operation is carried out to the data for including the second preset protocol head and bluetooth response, the 4th check value is obtained, adds after bluetooth response
Add the 4th check value, the bluetooth response after being encapsulated, using the bluetooth response after encapsulation as response encapsulation of data.
For example, Bluetooth chip is in bluetooth response " 80830000000106000000006AF61B6E94C5CE5871D54D
31F9456F9BA397DE422AC11D75DD95A8FE2895D234CF80D2F1436A91E94CAB11F0A577461BC38
4F7E9B8DFBC19CB8055F8B43E8A23B1DCF2FE1BAC129FB85889161DC5176BE28F3CE62E9ED1BD
E1FCB190DD1CBD3417EEB06D1CBE52CC5D490E9B47A8C5AECE485C9B746F50544C008A7CDC106
It before D0F9000 66 ", adds the second preset protocol head " 04 00 8F of A5 5A ", according to LRC checking algorithm to including second
Preset protocol head and the data of bluetooth response carry out operation, obtain the 4th check value " 00 ", and the 4th is added after bluetooth response
Check value obtains the bluetooth response after encapsulating according to the second preset protocol head
“A55A04008F80830000000106000000006AF61B6E94C5CE5871D54D31F9456F9BA397DE422AC1
1D75DD95A8FE2895D234CF80D2F1436A91E94CAB11F0A577461BC384F7E9B8DFBC19CB8055F8B
43E8A23B1DCF2FE1BAC129FB85889161DC5176BE28F3CE62E9ED1BDE1FCB190DD1CBD3417EEB0
6D1CBE52CC5D490E9B47A8C5AECE485C9B746F50544C008A7CDC106D 0F9,000 66 00 " will be encapsulated
Bluetooth response afterwards is as response encapsulation of data.
Step 1102:Bluetooth chip is sent to control chip according to the bluetooth response after the encapsulation of the second preset protocol;
Specifically, Bluetooth chip sends response encapsulation of data to control chip.
Step 1103:Chip is controlled to according to the bluetooth response after the encapsulation of the second preset protocol, is unsealed, obtains bluetooth
Effective response data in response include effect reply data according to the usb protocol tissue to match with usb protocol mark
USB response.
Specifically, control chip is to according to the bluetooth response after the encapsulation of the second preset protocol, i.e., to response encapsulation of data, into
Row deblocking, obtains bluetooth response, obtains the effective response data in bluetooth response, root according to the protocol type of bluetooth security equipment
It include the USB response for imitating reply data according to the usb protocol tissue to match with usb protocol mark.
More specifically, control chip encapsulates number to response to according to the bluetooth response after the encapsulation of the second preset protocol
According to being unsealed, using all data after the first protocol header as the data field in bluetooth response, obtain having in data field
Reply data is imitated, includes the USB response for imitating reply data according to the usb protocol tissue to match with usb protocol mark.
For example, control chip is to according to the bluetooth response after the encapsulation of the second preset protocol
“A55A04008F80830000000106000000006AF61B6E94C5CE5871D54D31F9456F9BA397DE422AC1
1D75DD95A8FE2895D234CF80D2F1436A91E94CAB11F0A577461BC384F7E9B8DFBC19CB8055F8B
43E8A23B1DCF2FE1BAC129FB85889161DC5176BE28F3CE62E9ED1BDE1FCB190DD1CBD3417EEB0
6D1CBE52CC5D490E9B47A8C5AECE485C9B746F50544C008A7CDC106D 0F9,000 66 00 " is solved
Envelope, after obtaining CCID protocol head, the data in all bytes before third check value, the data that will acquire
“6AF61B6E94C5CE5871D54D31F9456F9BA397DE422AC11D75DD95A8FE2895D234CF80D2F1436A
91E94CAB11F0A577461BC384F7E9B8DFBC19CB8055F8B43E8A23B1DCF2FE1BAC129FB85889161
DC5176BE28F3CE62E9ED1BDE1FCB190DD1CBD3417EEB06D1CBE52CC5D490E9B47A8C5AECE485C
9B746F50544C008A7CDC106D0F9000 " is as the effective response data in bluetooth response, according to SCSI protocol tissue
It include the SCSI response " 6AF61B6E94C5CE5871D54D31F9456F9BA397DE422AC11D75DD for imitating reply data
95A8FE2895D234CF80D2F1436A91E94CAB11F0A577461BC384F7E9B8DFBC19CB8055F8B43E8A2
3B1DCF2FE1BAC129FB85889161DC5176BE28F3CE62E9ED1BDE1FCB190DD1CBD3417EEB06D1CBE
52CC5D490E9B47A8C5AECE485C9B746F50544C008A7CDC106D0F900055534253f858dfda00000
00000”。
It should be noted that according to SCSI protocol tissue include imitate reply data USB response be specially:According to SCSI
Agreement organizations include the USB response for imitating reply data and response control word.More specifically:According to SCSI protocol effective
Response control word is added after reply data, obtains including the USB response for imitating reply data and response control word.
For example, according to SCSI protocol in effective response data
“6AF61B6E94C5CE5871D54D31F9456F9BA397DE422AC11D75DD95A8FE2895D234CF80D2F1436A
91E94CAB11F0A577461BC384F7E9B8DFBC19CB8055F8B43E8A23B1DCF2FE1BAC129FB85889161
DC5176BE28F3CE62E9ED1BDE1FCB190DD1CBD3417EEB06D1CBE52CC5D490E9B47A8C5AECE485C
9B746F50544C008A7CDC106D0F9000 " adds response control word " 55534253f858dfda0000000000 " afterwards,
Obtain include imitate reply data and response control word USB response be:
“6AF61B6E94C5CE5871D54D31F9456F9BA397DE422AC11D75DD95A8FE2895D234CF80D2F1436A
91E94CAB11F0A577461BC384F7E9B8DFBC19CB8055F8B43E8A23B1DCF2FE1BAC129FB85889161
DC5176BE28F3CE62E9ED1BDE1FCB190DD1CBD3417EEB06D1CBE52CC5D490E9B47A8C5AECE485C
9B746F50544C008A7CDC106D0F9000”。
In the present embodiment, the protocol type phase of the data format and bluetooth security equipment of Bluetooth commands and bluetooth response
Match, the data format for controlling the communication between chip and Bluetooth chip matches with the second preset protocol, wherein bluetooth security is set
Standby protocol type is that Bluetooth adapter and bluetooth security equipment consult in advance, and the second preset protocol is control chip and indigo plant
It is consulted in advance between tooth chip.It can be, but not limited between Bluetooth chip and control chip through UART (Universal
Asynchronous Receiver/Transmitter, universal asynchronous receiving-transmitting transmitter)/SPI (Serial Peripheral
Interface, Serial Peripheral Interface (SPI))/I2C (Inter-Integrated Circuit, internal integrated circuit) bus etc. is a variety of
Mode transmits data.
It should be noted that in the present invention, when the protocol type of bluetooth security equipment is preset for Bluetooth adapter, with bluetooth
The usb protocol usb protocol that matches of mark of adapter and the first agreement can be different agreement or identical agreement, such as
In the present embodiment, usb protocol is SCSI protocol, and the protocol type of bluetooth security equipment is CCID protocol.
It should be noted that in the present embodiment, the protocol type of bluetooth security equipment can also be Bluetooth adapter according to
It is got in the broadcast message of bluetooth security equipment, specifically, after step 104, can also include:Bluetooth adapter is from indigo plant
The first protocol-identifier of bluetooth security equipment is obtained in the broadcast message of tooth safety equipment;Correspondingly, according to bluetooth in step 107
The protocol type and effective instruction data organization Bluetooth commands of safety equipment, specially:According to first with bluetooth security equipment
The corresponding protocol type of protocol-identifier and USB command tissue Bluetooth commands.
In the present embodiment, when Bluetooth adapter after step 104, before step 107, from the broadcast of bluetooth security equipment
After the first protocol-identifier for obtaining bluetooth security equipment in information, after step 106, can also include:Bluetooth adapter is sentenced
Disconnected usb protocol identifies whether to match with the first protocol-identifier of bluetooth security equipment, if not, thening follow the steps 107;If
It is to then follow the steps a1;
Step a1:Bluetooth adapter sends USB command to bluetooth security equipment;
Step a2:Bluetooth adapter receives the USB response from bluetooth security equipment;
Step a3:USB response is returned to host computer by Bluetooth adapter.
In the present embodiment, when Bluetooth adapter after step 104, before step 105, from the broadcast of bluetooth security equipment
After the first protocol-identifier for obtaining bluetooth security equipment in information, step 107 may be replaced with step b1:Bluetooth adapter
Using USB command as Bluetooth commands, step 108 is executed;Step 110 may be replaced with step c1:Bluetooth adapter will be blue
Tooth response executes step 111 as USB response.
In the present embodiment, after step 104, can also include:Bluetooth adapter is detected whether with bluetooth security equipment
It disconnects, if it is, Bluetooth adapter resets, return step 102;Otherwise, continue to test whether with bluetooth security equipment
It has disconnected.Correspondingly, it in step 106 after being not received by the USB command from host computer within a preset time, returns
Step 106.
Embodiment 3
A kind of working method of Bluetooth adapter is present embodiments provided, as shown in figure 3, specifically including:
Step 201:Bluetooth adapter powers on;
Step 202:Bluetooth adapter initialization;
In the present embodiment, Bluetooth adapter initialization is specially:Bluetooth adapter initialization control chip and Bluetooth chip.
Step 203:The bluetooth security equipment that Bluetooth adapter search matches with default device identification simultaneously connects with its foundation
It connects;
Specifically, Bluetooth adapter askes instruction by control chipset driving wheel, sends poll instruction to Bluetooth chip, receives
Poll repeat-back from Bluetooth chip.After Bluetooth chip receives poll instruction, search and default device identification phase
Matched bluetooth security equipment simultaneously establishes a connection, and returns to poll repeat-back to control chip.
Wherein, Bluetooth adapter askes instruction by control chipset driving wheel, specially:Bluetooth adapter passes through control chip
It is instructed according to the second preset protocol tissue poll.In the present embodiment, include in poll instruction:Instruct start byte, command identification,
Data length, data field and the check bit of data field.
For example, the instruction banner word that Bluetooth adapter is instructed " 0x5A " and " 0xA5 " as poll by controlling chip
Section is arranged in the first byte and the second byte of poll instruction, the command identification that " 0x02 " is instructed as poll, and setting exists
Poll instruction third byte on, will " 0x00 " and " 0x00 " as poll instruct in data field data length, set respectively
It sets on the nybble and the 5th byte of poll instruction, the check value " XOR " that poll is instructed, poll instruction is set most
In the latter byte (check bit), obtained poll instruction is specially:" 02 00 00 XOR of 5A A5 " is sent to Bluetooth chip
Poll instructs " 02 00 00 XOR of 5A A5 ";Etc. the poll repeat-back to be received from Bluetooth chip.
In the present embodiment, presetting device identification is preset device identification, wherein device identification includes:Bluetooth equipment
UUID (Universally Unique Identifier, Universally Unique Identifier), the MAC Address of bluetooth equipment and bluetooth are set
At least one of standby device name.Wherein, the UUID of bluetooth equipment is the service unique identification information that bluetooth equipment is supported,
The MAC Address of bluetooth equipment or the device name of bluetooth equipment are the unique identification information of bluetooth equipment.
In the present embodiment, bluetooth security equipment be can be, but not limited to as blue-tooth intelligence key devices and Bluetooth intelligent card etc..
Step 204:Bluetooth adapter judges whether to establish connection with bluetooth security equipment, if so, thening follow the steps
205;Otherwise, return step 204;
Specifically, after Bluetooth adapter receives the poll repeat-back from Bluetooth chip by controlling chip, root
Judge whether to establish connection with bluetooth security equipment according to poll repeat-back, if so, thening follow the steps 205;Otherwise, step is returned
Rapid 204;
More specifically, after Bluetooth adapter receives the poll repeat-back from Bluetooth chip by control chip,
Poll repeat-back is parsed according to the second preset protocol, obtains the connection result mark in the data field in poll repeat-back,
Judge whether to establish connection with bluetooth security equipment according to connection result mark, if connection result is identified as success flag,
Connection is established with bluetooth security equipment;Otherwise, connection failure.
For example, if Bluetooth adapter by control chip receive from Bluetooth chip poll repeat-back be " A5
02 00 01 00 XOR of 5A ", obtain the 5th byte after, the data in byte before the last byte, and by its
As the connection result mark in the data field in poll repeat-back, then " 00 " is identified according to connection result and determine to pacify with bluetooth
Full equipment establishes connection;If Bluetooth adapter is " A5 by controlling chip to receive the poll repeat-back from Bluetooth chip
02 00 01 01 XOR of 5A ", obtain the 5th byte after, the data in byte before the last byte, and by its
As the connection result mark in the data field in poll repeat-back, then " 01 " is identified according to connection result and determine no and indigo plant
Tooth safety equipment establishes connection.
Step 205:Bluetooth adapter states the usb protocol mark of itself to host computer;
Specifically, Bluetooth adapter passes through the control chip initiation USB module of itself, states itself to host computer
Usb protocol mark.
In the present embodiment, host computer be can be, but not limited to as PC;Usb protocol mark be specially CCID protocol mark or
HID protocol mark or SCSI protocol mark.In the present embodiment, usb protocol is identified so that HID protocol identifies as an example.
Step 206:The USB command to be received from host computer such as Bluetooth adapter comes when receiving within a preset time
From after the USB command of host computer, step 207 is executed;When being not received by the USB command from host computer within a preset time
Afterwards, it detects whether to have disconnected with bluetooth security equipment, if it is, Bluetooth adapter resets, return step 202;Otherwise,
Return step 206;
Preferably, preset time is 3 seconds.
In the present embodiment, Bluetooth adapter resets, specially:Bluetooth chip in Bluetooth adapter resets, and controls chip
It resets.After Bluetooth adapter resets, host computer detects Bluetooth adapter on usb bus and upper by the hub of itself
Position machine disconnects.
Step 207:Bluetooth adapter parses USB command, obtains the effective instruction data in USB command, is pacified according to bluetooth
The protocol type and effective instruction data organization Bluetooth commands of full equipment;
In the present embodiment, the effective instruction data in USB command are specially the APDU in USB command.
In the present embodiment, USB command is by taking HID is instructed as an example;The protocol type of bluetooth security equipment can be adapted to for bluetooth
What device and bluetooth security equipment consulted in advance, it can be by taking CCID protocol as an example.
Specifically, Bluetooth adapter parses USB command according to the usb protocol to match with usb protocol mark, obtains USB
Effective instruction data in instruction add the first protocol header and command description mark before effective instruction data, pre- according to first
If checking algorithm carries out operation to the data for including the first protocol header, command description mark and effective instruction data, first is obtained
Check value adds the first check value after valid data, obtains including the first protocol header, command description mark, effective instruction number
According to the Bluetooth commands with the first check value.
For example, Bluetooth adapter, which parses HID according to HID protocol, instructs " 00 05 00 00 00 05 00 47 47 4b
80cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc
cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc
Cc cc ", the HID protocol head " 00 05 00 00 00 that the data in the first six byte of HID instruction are instructed as HID
05 ", the data length by the first two byte " 00 05 " of HID protocol head as the HID effective instruction data instructed assists HID
Offset of the data " 00 00 " as current packet data transmission data packet in the third and fourth byte of head is discussed, by HID protocol head
The the 5th and the 6th byte on data length of the data " 00 05 " as current packet transmission, HID is obtained according to HID protocol head
The data of 5 byte lengths after protocol header, and as the effective instruction data of HID instruction, obtain having for HID instruction
Imitating director data is " 00 47 47 4b 80 ", and HID protocol head " 6F,070,000 00000400 is added before effective instruction data
0000 " identifies " 00 " with command description, and obtaining includes CCID protocol head, command description identifies and the data of effective instruction data
" 00000400 0000000047474b80 of 6F070000 ", according to EDC checking algorithm to including CCID protocol head and effectively finger
It enables the carry out operation of data obtain the first check value " A7 ", the first check value is added after valid data, obtain including CCID association
Discuss the Bluetooth commands " 6F,070,000 00000400 of head, command description mark, effective instruction data and the first check value
00000000 0047474b80 A7”。
Step 208:Bluetooth adapter sends Bluetooth commands to bluetooth security equipment;
Specifically, Bluetooth adapter sends Bluetooth commands to bluetooth security equipment by Bluetooth chip.
Step 209:Bluetooth adapter receives the bluetooth response from bluetooth security equipment;
Specifically, Bluetooth adapter receives the bluetooth response from bluetooth security equipment by Bluetooth chip.
Step 210:Bluetooth adapter parse bluetooth response, obtain bluetooth response in effective response data, according to USB
The usb protocol tissue that protocol-identifier matches includes the USB response for imitating reply data;
Specifically, Bluetooth adapter obtains the effective response number in bluetooth response according to the protocol type of bluetooth security equipment
According to including the USB response for imitating reply data according to the usb protocol tissue that matches of usb protocol mark.
More specifically, Bluetooth adapter parses bluetooth response according to the protocol type of bluetooth security equipment, and bluetooth is answered
Data after the first protocol header answered obtain in bluetooth response in the data field of bluetooth response as bluetooth reply data domain
Effective response data, include the USB response for imitating reply data according to the usb protocol tissue that matches of usb protocol mark.
For example, Bluetooth adapter parses bluetooth response according to the protocol type of bluetooth security equipment
“80830000000106000000006AF61B6E94C5CE5871D54D31F9456F9BA397DE422AC11D75DD95A8
FE2895D234CF80D2F1436A91E94CAB11F0A577461BC384F7E9B8DFBC19CB8055F8B43E8A23B1D
CF2FE1BAC129FB85889161DC5176BE28F3CE62E9ED1BDE1FCB190DD1CBD3417EEB06D1CBE52CC
5D490E9B47A8C5AECE485C9B746F50544C008A7CDC106D0F9000 66 ", by preceding ten in bluetooth response
Data " 80,830,000 000106000000 " in byte are as the CCID protocol head in bluetooth response, after crossed joint
Data as the data field in bluetooth response, using the first character section in the data field in bluetooth response as in bluetooth response
Command description mark, the last byte in data field is used as third check value, in the data field in acquisition bluetooth response
Command description mark after, the data in all bytes before third check value
“6AF61B6E94C5CE5871D54D31F9456F9BA397DE422AC11D75DD95A8FE2895D234CF80D2F1436A
91E94CAB11F0A577461BC384F7E9B8DFBC19CB8055F8B43E8A23B1DCF2FE1BAC129FB85889161
DC5176BE28F3CE62E9ED1BDE1FCB190DD1CBD3417EEB06D1CBE52CC5D490E9B47A8C5AECE485C
9B746F50544C008A7CDC106D0F9000 ", and as effective response data, include according to HID protocol tissue
Imitate the USB response of reply data.
Wherein, it is specially according to the USB response that HID protocol tissue includes effect reply data:According to HID protocol tissue packet
Include the USB response of HID protocol head and effective response data.
More specifically, it can also judge whether needs according to HID protocol, preset subpackage length and effective response data
Subpackage is surrounded by effect reply data if it is, being divided into effective response data according to preset subpackage length more, is often being surrounded by effect
Corresponding HID protocol head is added before reply data, obtains including the more packet USB responses for imitating reply data;Otherwise, tissue includes
The USB response of HID protocol head and effective response data.
For example, according to according to HID protocol, preset subpackage length " 40 " and effective response data
“6AF61B6E94C5CE5871D54D31F9456F9BA397DE422AC11D75DD95A8FE2895D234CF80D2F1436A
91E94CAB11F0A577461BC384F7E9B8DFBC19CB8055F8B43E8A23B1DCF2FE1BAC129FB85889161
DC5176BE28F3CE62E9ED1BDE1FCB190DD1CBD3417EEB06D1CBE52CC5D490E9B47A8C5AECE485C
9B746F50544C008A7CDC106D0F9000 ", judgement need USB response being divided into three guarantees, and first obtained is surrounded by effect
Answer evidence is 6AF61B6E94C5CE5871D54D31F9456F9BA397DE422AC11D75DD95A8FE 2895D234CF80D
2F1436A91E94CAB11F0A577461BC384F7E9B8DFBC19CB80;Second, which is surrounded by effect reply data, is:
55F8B43E8A23B1DCF2FE1BAC129FB85889161DC5176BE28F3CE62E9ED1BD
E1FCB190DD1CBD3417EEB06D1CBE52CC5D490E9B47A8C5AECE485C9B;Third is surrounded by effect reply data
For:00820074000e746F50544C008A7CDC106D0F9000, and added accordingly before being often surrounded by effect reply data
HID protocol head, obtain include first be surrounded by effect reply data first packet USB response be:
00820000003a6AF61B6E94C5CE5871D54D31F9456F9BA397DE422AC11D75DD95A8FE2895D234C
F80D2F1436A91E94CAB11F0A577461BC384F7E9B8DFBC19CB80;
Obtain include second be surrounded by effect reply data second packet USB response be:
0082003a003a55F8B43E8A23B1DCF2FE1BAC129FB85889161DC5176BE28F3CE62E9ED1BDE1FCB
190DD1CBD3417EEB06D1CBE52CC5D490E9B47A8C5AECE485C9B;
Obtain include third be surrounded by effect reply data third packet USB response be:
00820074000e746F50544C008A7CDC106D0F9000ccccccccccccccccccccccccccccccccccccc
ccccccccccccccccccccccccccccccccccccccccccccccccccc。
Step 211:USB response is returned to host computer, return step 206 by Bluetooth adapter;
In the present embodiment, step 207 can specifically include as shown in figure 3-1:
Step 2071:It controls chip and parses USB command, the effective instruction data in USB command are obtained, according to bluetooth security
The protocol type of equipment and the second preset protocol are packaged effective instruction data;
Specifically, control chip obtains the effective instruction data in USB command, according to the protocol type of bluetooth security equipment
Effective instruction data are packaged, the first encapsulation of data is obtained;The first encapsulation of data is sealed according to the second preset protocol
Dress obtains instruction encapsulation of data;
More specifically, control chip parses USB command according to the usb protocol to match with usb protocol mark, obtains
Effective instruction data in USB command add the first protocol header and command description mark, according to first before effective instruction data
Default checking algorithm carries out operation to the data for including the first protocol header, command description mark and effective instruction data, obtains the
One check value adds the first check value after effective instruction data, obtain include the first protocol header, command description mark, have
Imitate the first encapsulation of data of director data and the first check value;The second preset protocol head is added before the first encapsulation of data, according to
Second default checking algorithm carries out operation to the data for including the first encapsulation of data and the second preset protocol head, obtains the second verification
Value, the second check value is added after the first encapsulation of data, is obtained according to the first protocol header and the second preset protocol head to effective
Director data be packaged after instruction encapsulation of data.
For example, control chip parses HID instruction according to HID protocol
“0005000000050047474b80cccccccccccccccccccccccccccccccccccccccccccccccccccccc
Cccccccccccccccccccccccccccccccccccccccccccccccccccc ", will be in the first six byte of HID instruction
The HID protocol head that is instructed as HID of data " 00 05 00 00 00 05 ", by the first two byte " 00 of HID protocol head
05 " the data length as the effective instruction data of HID instruction, by the data " 00 in the third and fourth byte of HID protocol head
00 " the offset as current packet data transmission data packet, by the data " 00 05 " in the 5th and the 6th byte of HID protocol head
As the data length of current packet transmission, the data of 5 byte lengths after HID protocol head are obtained according to HID protocol head, and
As the effective instruction data of HID instruction, the effective instruction data for obtaining HID instruction are " 00 47 47 4b 80 ",
CCID protocol head " 6F,070,000 00,000,400 000000 " and command description mark " 00 " are added before effective instruction data, are obtained
Data " 6F,070,000 00000400 including CCID protocol head, command description mark and effective instruction data
0000000047474b80 " obtains the carry out operation for including CCID protocol head and effective instruction data according to EDC checking algorithm
First check value " A7 " obtains the first encapsulation of data " 00,000,400 00000000 0047474b80 A7 of 6F070000 ";?
The second preset protocol head " 5A A5 04 0013 " is added before first encapsulation of data, obtains including that the first encapsulation of data and second are pre-
If the data " 00,000,400 00000000 0047474b80 A7 of 5A A50400136F070000 " of protocol header, according to the school LRC
Checking method carries out operation to the data for including the first encapsulation of data and the second preset protocol head, obtains the second check value " 00 ",
The second check value is added after first encapsulation of data, is obtained according to the first protocol header and the second preset protocol head to effective instruction number
According to instruction encapsulation of data " 04 00 13 6F 07 00 00 00 00 04 00 00 00 00 00 of 5A A5 after being packaged
00 47 47 4b 80 A7 00”。
Step 2072:Control chip by according to the protocol type of bluetooth security equipment and the second preset protocol to effective instruction
Data be packaged after data, be sent to Bluetooth chip;
Specifically, control chip will instruct encapsulation of data to be sent to Bluetooth chip;
Step 2073:Bluetooth chip is from the protocol type and the second preset protocol according to bluetooth security equipment to effective instruction
Data be packaged after data in, obtain Bluetooth commands;
Specifically, Bluetooth chip obtains the first encapsulation of data from instruction encapsulation of data, and first encapsulation of data is made
For Bluetooth commands.
More specifically, Bluetooth chip unseals instruction encapsulation of data according to the second preset protocol, encapsulates from instruction
The first encapsulation of data is obtained in data, using the first encapsulation of data as Bluetooth commands.
For example, Bluetooth chip unseals instruction encapsulation of data, obtained data are " 0013 6F070000 of 5AA504
00000400 00000000 0047474b80 A7 00 ", after obtaining the second preset protocol head, before the second check value
Data in all bytes, the data that will acquire " 00,000,400 00000000 0047474b80 A7 of 6F070000 " conduct
First encapsulation of data, using the first encapsulation of data as Bluetooth commands.
Correspondingly, step 210 can specifically include as shown in figure 3-2:
Step 2101:Bluetooth chip encapsulates bluetooth response according to the second preset protocol;
Specifically, Bluetooth chip adds the second preset protocol head before bluetooth response, presets checking algorithm according to third
Operation is carried out to the data for including the second preset protocol head and bluetooth response, the 4th check value is obtained, adds after bluetooth response
Add the 4th check value, the bluetooth response after being encapsulated, using the bluetooth response after encapsulation as response encapsulation of data.
For example, Bluetooth chip is in bluetooth response " 80830000000106000000006AF61B6E94C5CE5871D54D
31F9456F9BA397DE422AC11D75DD95A8FE2895D234CF80D2F1436A91E94CAB11F0A577461BC38
4F7E9B8DFBC19CB8055F8B43E8A23B1DCF2FE1BAC129FB85889161DC5176BE28F3CE62E9ED1BD
E1FCB190DD1CBD3417EEB06D1CBE52CC5D490E9B47A8C5AECE485C9B746F50544C008A7CDC106
It before D0F9000 66 ", adds the second preset protocol head " 04 00 8F of A5 5A ", according to LRC checking algorithm to including second
Preset protocol head and the data of bluetooth response carry out operation, obtain the 4th check value " 00 ", and the 4th is added after bluetooth response
Check value obtains the bluetooth response after encapsulating according to the second preset protocol head
“A55A04008F80830000000106000000006AF61B6E94C5CE5871D54D31F9456F9BA397DE422AC1
1D75DD95A8FE2895D234CF80D2F1436A91E94CAB11F0A577461BC384F7E9B8DFBC19CB8055F8B
43E8A23B1DCF2FE1BAC129FB85889161DC5176BE28F3CE62E9ED1BDE1FCB190DD1CBD3417EEB0
6D1CBE52CC5D490E9B47A8C5AECE485C9B746F50544C008A7CDC106D 0F9,000 66 00 " will be encapsulated
Bluetooth response afterwards is as response encapsulation of data.
Step 2102:Bluetooth chip is sent to control chip according to the bluetooth response after the encapsulation of the second preset protocol;
Specifically, Bluetooth chip sends response encapsulation of data to control chip.
Step 2103:Chip is controlled to according to the bluetooth response after the encapsulation of the second preset protocol, is unsealed, obtains bluetooth
Effective response data in response include effect reply data according to the usb protocol tissue to match with usb protocol mark
USB response.
Specifically, control chip is to according to the bluetooth response after the encapsulation of the second preset protocol, i.e., to response encapsulation of data, into
Row deblocking, obtains bluetooth response, obtains the effective response data in bluetooth response, root according to the protocol type of bluetooth security equipment
It include the USB response for imitating reply data according to the usb protocol tissue to match with usb protocol mark.
More specifically, control chip encapsulates number to response to according to the bluetooth response after the encapsulation of the second preset protocol
According to being unsealed, using all data after the first protocol header as the data field in bluetooth response, obtain having in data field
Reply data is imitated, includes the USB response for imitating reply data according to the usb protocol tissue to match with usb protocol mark.
For example, control chip is to according to the bluetooth response after the encapsulation of the second preset protocol
“A55A04008F8083000000010600000000
6AF61B6E94C5CE5871D54D31F9456F9BA397DE422AC11D75DD95A8FE2895D234CF80D2F1436A9
1E94CAB11F0A577461BC384F7E9B8DFBC19CB8055F8B43E8A23B1DCF2FE1BAC129FB85889161D
C5176BE28F3CE62E9ED1BDE1FCB190DD1CBD3417EEB06D1CBE52CC5D490E9B47A8C5AECE485C9
B746F50544C008A7CDC106D0F9000 66 00 " is unsealed, obtain CCID protocol head after, third check value it
Data in preceding all bytes, the data that will acquire
“6AF61B6E94C5CE5871D54D31F9456F9BA397DE422AC11D75DD95A8FE2895D234CF80D2F1436A
91E94CAB11F0A577461BC384F7E9B8DFBC19CB8055F8B43E8A23B1DCF2FE1BAC129FB85889161
DC5176BE28F3CE62E9ED1BDE1FCB190DD1CBD3417EEB06D1CBE52CC5D490E9B47A8C5AECE485C
9B746F50544C008A7CDC106D0F9000 " is as the effective response data in bluetooth response, according to HID protocol tissue packet
Include the HID response of effective response data.
Wherein, it is specially according to the USB response that HID protocol tissue includes effect reply data:According to HID protocol tissue packet
Include the USB response of HID protocol head and effective response data.
More specifically, it can also judge whether needs according to HID protocol, preset subpackage length and effective response data
Subpackage is surrounded by effect reply data if it is, being divided into effective response data according to preset subpackage length more, is often being surrounded by effect
Corresponding HID protocol head is added before reply data, obtains including the more packet USB responses for imitating reply data;Otherwise, tissue includes
The USB response of HID protocol head and effective response data.
For example, according to according to HID protocol, preset subpackage length and effective response data
“6AF61B6E94C5CE5871D54D31F9456F9BA397DE422AC11D75DD95A8FE2895D234CF80D2F1436A
91E94CAB11F0A577461BC384F7E9B8DFBC19CB8055F8B43E8A23B1DCF2FE1BAC129FB85889161
DC5176BE28F3CE62E9ED1BDE1FC
B190DD1CBD3417EEB06D1CBE52CC5D490E9B47A8C5AECE485C9B746F50544C008A7CDC106D0F9
000 ", judge to need by USB response be divided into three guarantees, first obtained is surrounded by effect reply data and is:
6AF61B6E94C5CE5871D54D31F9456F9BA397DE422AC11D75DD95A8FE2895D234CF80D2F1436A9
1E94CAB11F0A577461BC384F7E9B8DFBC19CB80;Second, which is surrounded by effect reply data, is:
55F8B43E8A23B1DCF2FE1BAC129FB85889161DC5176BE28F3CE62E9ED1BDE1FCB190DD1CBD341
7EEB06D1CBE52CC5D490E9B47A8C5AECE485C9B;Third is surrounded by effect reply data:
00820074000e746F50544C008A7CDC106D0F9000, and corresponding HID is added before being often surrounded by effect reply data
Protocol header, obtain include first be surrounded by effect reply data first packet USB response be:
00820000003a6AF61B6E94C5CE5871D54D31F9456F9BA397DE422AC11D75DD95A8FE2895D234C
F80D2F1436A91E94CAB11F0A577461BC384F7E9B8DFBC19CB80;
Obtain include second be surrounded by effect reply data second packet USB response be:
0082003a003a55F8B43E8A23B1DCF2FE1BAC129FB85889161DC5176BE28F3CE62E9ED1BDE1FCB
190DD1CBD3417EEB06D1CBE52CC5D490E9B47A8C5AECE485C9B;
Obtain include third be surrounded by effect reply data third packet USB response be
00820074000e746F50544C008A7CDC106D0F9000ccccccccccccccccccccccccccccccccccccc
ccccccccccccccccccccccccccccccccccccccccccccccccccc。
In the present embodiment, the protocol type phase of the data format and bluetooth security equipment of Bluetooth commands and bluetooth response
Match, the data format for controlling the communication between chip and Bluetooth chip matches with the second preset protocol, wherein bluetooth security is set
Standby protocol type can be Bluetooth adapter and bluetooth security equipment consults in advance, and the second preset protocol is control chip
It is consulted in advance between Bluetooth chip.It can be, but not limited to pass through UART between Bluetooth chip and control chip
(Universal Asynchronous Receiver/Transmitter, universal asynchronous receiving-transmitting transmitter)/SPI (Serial
Peripheral Interface, Serial Peripheral Interface (SPI)) (Inter-Integrated Circuit, is internally integrated electricity to/I2C
Road) the various mode transmissions data such as bus.
It should be noted that in the present invention, when the protocol type of bluetooth security equipment is preset for Bluetooth adapter, with bluetooth
The usb protocol mark usb protocol to match of adapter and the protocol type of bluetooth security equipment can for different agreement or
The identical agreement of person, in the present embodiment, usb protocol is HID protocol, and the protocol type of bluetooth security equipment is CCID association
View.
It should be noted that in the present embodiment, the protocol type of bluetooth security equipment can also be Bluetooth adapter according to
It is got in the broadcast message of bluetooth security equipment, specifically, after step 204, can also include:Bluetooth adapter is from indigo plant
The first protocol-identifier of bluetooth security equipment is obtained in the broadcast message of tooth safety equipment;Correspondingly, bluetooth is adapted in step 207
Device is according to the protocol type and effective instruction data organization Bluetooth commands of bluetooth security equipment, specially:According to bluetooth security
The corresponding protocol type of the first protocol-identifier and USB command tissue Bluetooth commands of equipment.
In the present embodiment, when Bluetooth adapter after step 204, before step 207, from the broadcast of bluetooth security equipment
After the first protocol-identifier for obtaining bluetooth security equipment in information, after step 206, can also include:Bluetooth adapter is sentenced
Disconnected usb protocol identifies whether to match with the first protocol-identifier of bluetooth security equipment, if not, thening follow the steps 207;If
It is to then follow the steps d1;
Step d1:Bluetooth adapter sends USB command to bluetooth security equipment;
Step d2:Bluetooth adapter receives the USB response from bluetooth security equipment;
Step d3:USB response is returned to host computer by Bluetooth adapter.
In the present embodiment, when Bluetooth adapter after step 204, before step 205, from from the wide of bluetooth security equipment
After broadcasting the first protocol-identifier for obtaining bluetooth security equipment in information, step 207 may be replaced with step e1:Bluetooth adaptation
Device executes step 208 using USB command as Bluetooth commands;Step 210 may be replaced with step f1:Bluetooth adapter will
Bluetooth response executes step 211 as USB response.
In the present embodiment, after step 204, can also include:Bluetooth adapter is detected whether with bluetooth security equipment
It disconnects, if it is, Bluetooth adapter resets, return step 202;Otherwise, continue to test whether with bluetooth security equipment
It has disconnected.Correspondingly, it in step 206 after being not received by the USB command from host computer within a preset time, returns
Step 206.
Embodiment 4
A kind of working method of Bluetooth adapter is present embodiments provided, is suitable for including Bluetooth adapter, bluetooth security
The system of equipment and host computer, as shown in figure 4, including:
Step 301:Bluetooth adapter powers on;
Step 302:Bluetooth adapter initialization;
Step 303:The bluetooth security equipment that Bluetooth adapter search matches with default device identification simultaneously connects with its foundation
It connects;
Step 304:Bluetooth adapter judges whether to establish connection with bluetooth security equipment, if so, thening follow the steps
305;Otherwise, return step 304;
Step 305:Bluetooth adapter states the usb protocol mark of itself to host computer;
Step 306:Host computer sends USB command to Bluetooth adapter;
Step 307:Bluetooth adapter parses USB command, obtains the effective instruction data in USB command, is pacified according to bluetooth
The protocol type and effective instruction data organization Bluetooth commands of full equipment;
Specifically, Bluetooth adapter parses USB command according to the usb protocol to match with usb protocol mark, obtains USB
Effective instruction data in instruction, according to the protocol type of bluetooth security equipment and effective instruction data organization Bluetooth commands.
In the present embodiment, the effective instruction data in USB command are specially the APDU in USB command.
Step 308:Bluetooth adapter sends Bluetooth commands to bluetooth security equipment;
Step 309:Bluetooth security equipment parses Bluetooth commands, organizes bluetooth response corresponding with Bluetooth commands;
Specifically, bluetooth security equipment parses Bluetooth commands according to the protocol type of bluetooth security equipment, is pacified according to bluetooth
The protocol type tissue bluetooth response corresponding with Bluetooth commands of full equipment.
Step 310:Bluetooth security equipment sends bluetooth response to Bluetooth adapter;
Step 311:Bluetooth adapter parse bluetooth response, obtain bluetooth response in effective response data, according to USB
The usb protocol tissue that protocol-identifier matches includes the USB response for imitating reply data;
Specifically, bluetooth security equipment parses bluetooth response according to the protocol type of bluetooth security equipment, obtains bluetooth and answers
Effective response data in answering, according to the usb protocol and effective response data organization USB response to match with usb protocol mark.
Step 312:Bluetooth adapter sends USB response to host computer.
It should be noted that in the present invention, when the protocol type of bluetooth security equipment is preset for Bluetooth adapter, with bluetooth
The usb protocol mark usb protocol to match of adapter and the protocol type of bluetooth security equipment can for different agreement or
The identical agreement of person.
It should be noted that in the present embodiment, the protocol type of bluetooth security equipment can also be Bluetooth adapter according to
It is got in the broadcast message of bluetooth security equipment, specifically, after step 304, can also include:Bluetooth adapter is from indigo plant
The first protocol-identifier of bluetooth security equipment is obtained in the broadcast message of tooth safety equipment;Correspondingly, bluetooth is adapted in step 307
Device is according to the protocol type and effective instruction data organization Bluetooth commands of bluetooth security equipment, specially:Bluetooth adapter according to
Protocol type corresponding with the first protocol-identifier of bluetooth security equipment and USB command tissue Bluetooth commands.
In the present embodiment, when Bluetooth adapter after the step 304, before step 307, from the broadcast of bluetooth security equipment
After the first protocol-identifier for obtaining bluetooth security equipment in information, after step 306, can also include:Bluetooth adapter is sentenced
Disconnected usb protocol identifies whether to match with the first protocol-identifier of bluetooth security equipment, if not, thening follow the steps 307;If
It is to then follow the steps g1;
Step g1:Bluetooth adapter sends USB command to bluetooth security equipment;
Step g2:Bluetooth adapter receives the USB response from bluetooth security equipment;
Step g3:USB response is returned to host computer by Bluetooth adapter.
In the present embodiment, when Bluetooth adapter after the step 304, before step 305, from from the wide of bluetooth security equipment
After broadcasting the first protocol-identifier for obtaining bluetooth security equipment in information, step 307 may be replaced with step:Bluetooth adapter
Using USB command as Bluetooth commands;Step 310 may be replaced with step:Bluetooth adapter is answered using bluetooth response as USB
It answers.
In the present embodiment, after step 304, can also include:Bluetooth adapter is detected whether with bluetooth security equipment
It disconnects, if it is, Bluetooth adapter resets, return step 302;Otherwise, continue to test whether with bluetooth security equipment
It has disconnected.
In the present embodiment, a kind of working method of Bluetooth adapter is additionally provided, is suitable for including Bluetooth adapter, bluetooth
The system of safety equipment and host computer, wherein Bluetooth adapter includes control chip and Bluetooth chip, specifically as shown in figure 5, working as
After Bluetooth adapter powers on, including:
Step 401:Control chip initiation, Bluetooth chip initialization;
Step 402:It controls chip and sends poll instruction to Bluetooth chip;
In the present embodiment, after control chip sends poll instruction to Bluetooth chip, control chip etc. is to be received to come from bluetooth
The poll repeat-back of chip.
Specifically, control chip is instructed according to the second preset protocol tissue poll, sends poll instruction to Bluetooth chip, to
Receive the poll repeat-back from Bluetooth chip.
Step 403:Bluetooth chip is searched for the bluetooth security equipment to match with default device identification and is established a connection;
Step 404:Bluetooth chip returns to poll repeat-back to control chip;
Specifically, control chip returns to poll to Bluetooth chip and refers to according to the second preset protocol tissue poll repeat-back
Enable response.
Step 405:Chip is controlled to be judged whether to establish connection with bluetooth security equipment according to poll repeat-back, if
It is to then follow the steps 406;Otherwise, it continues waiting for receiving the poll repeat-back from Bluetooth chip, comes from bluetooth when receiving
After the poll repeat-back of chip, return step 405;
Specifically, after control chip receives the poll repeat-back from Bluetooth chip, according to the second preset protocol solution
Poll repeat-back is analysed, the connection result mark in the data field in poll repeat-back is obtained, is sentenced according to connection result mark
It is disconnected whether with bluetooth security equipment to establish connection, if connection result is identified as success flag " 00 ", and bluetooth security equipment
Establish connection;Otherwise, connection failure.
Step 406:Chip initiation USB module is controlled, the usb protocol mark of itself is stated to host computer;
Step 407:Host computer sends USB command to control chip;
Step 408:It controls chip and parses USB command, the effective instruction data in USB command are obtained, according to bluetooth security
The protocol type of equipment and the second preset protocol are packaged effective instruction data;
Specifically, control chip parses USB command according to the usb protocol to match with usb protocol mark, obtains USB and refers to
Effective instruction data in order carry out effective instruction data according to the protocol type of bluetooth security equipment and the second preset protocol
Encapsulation obtains instruction encapsulation of data.
More specifically, control chip parses USB command according to the usb protocol to match with usb protocol mark, obtains
Effective instruction data in USB command are packaged effective instruction data according to the protocol type of bluetooth security equipment, obtain
First encapsulation of data;The first encapsulation of data is packaged according to the second preset protocol, obtains instruction encapsulation of data;
Step 409:Control chip by according to the protocol type of bluetooth security equipment and the second preset protocol to effective instruction
Data be packaged after data, be sent to Bluetooth chip;
Specifically, control chip will instruct encapsulation of data to be sent to Bluetooth chip;
Step 410:Bluetooth chip is from the protocol type and the second preset protocol according to bluetooth security equipment to effective instruction
Data be packaged after data in, obtain Bluetooth commands;
Specifically, Bluetooth chip obtains the first encapsulation of data from instruction encapsulation of data, using the first encapsulation of data as indigo plant
Tooth instruction.
More specifically, Bluetooth chip unseals instruction encapsulation of data according to the second preset protocol, encapsulates from instruction
The first encapsulation of data is obtained in data, using the first encapsulation of data as Bluetooth commands.
Step 411:Bluetooth chip sends Bluetooth commands to bluetooth security equipment;
Step 412:Bluetooth security equipment parses Bluetooth commands, organizes bluetooth response corresponding with Bluetooth commands;
Specifically, bluetooth security equipment parses Bluetooth commands according to the protocol type of bluetooth security equipment, is pacified according to bluetooth
The protocol type tissue bluetooth response corresponding with Bluetooth commands of full equipment.
Step 413:Bluetooth security equipment sends bluetooth response to Bluetooth chip;
Step 414:Bluetooth chip encapsulates bluetooth response according to the second preset protocol;
Specifically, Bluetooth chip encapsulates bluetooth response according to the second preset protocol, obtains response encapsulation of data;
Step 415:Bluetooth chip is sent to control chip according to the bluetooth response after the encapsulation of the second preset protocol;
Specifically, Bluetooth chip sends response encapsulation of data to control chip;
Step 416:Chip is controlled to according to the bluetooth response after the encapsulation of the second preset protocol, is unsealed, obtains bluetooth
Effective response data in response include effect reply data according to the usb protocol tissue to match with usb protocol mark
USB response;
Specifically, control chip is unsealed to according to the bluetooth response after the encapsulation of the second preset protocol, i.e., seals to response
Dress data are unsealed, and the effective response data in bluetooth response are obtained, and identify the usb protocol to match according to usb protocol
Tissue includes the USB response for imitating reply data.
Step 417:It controls chip and sends USB response to host computer.
In the present embodiment, it can be, but not limited between Bluetooth chip and control chip through UART (Universal
Asynchronous Receiver/Transmitter, universal asynchronous receiving-transmitting transmitter)/SPI (Serial Peripheral
Interface, Serial Peripheral Interface (SPI))/I2C (Inter-Integrated Circuit, internal integrated circuit) bus etc. is a variety of
Mode transmits data.
It should be noted that the protocol type of bluetooth security equipment can be Bluetooth adapter and bluetooth security equipment is assisted in advance
Quotient is good, consults in advance between the second preset protocol control chip and Bluetooth chip.
It should be noted that the protocol type of bluetooth security equipment can also be control chip according to indigo plant in the present embodiment
What the broadcast message of tooth safety equipment was got, specifically, after step 402, further include:Chip is controlled to send to Bluetooth chip
Obtain bluetooth security device identification instruction;Bluetooth chip returns to the first protocol-identifier including bluetooth security equipment to control chip
Response;
Correspondingly, chip is controlled in step 408 according to the protocol type of bluetooth security equipment and the second preset protocol to having
Effect director data is packaged specially:Chip is controlled according to protocol class corresponding with the first protocol-identifier of bluetooth security equipment
Type and the second preset protocol are packaged effective instruction data.
In the present embodiment, when controlling chip after step 405, before step 408, further include:Chip is controlled to bluetooth
Chip, which is sent, obtains bluetooth security device identification instruction;It includes the first of bluetooth security equipment that Bluetooth chip is returned to control chip
After the response of protocol-identifier, after step 406, can also include:Control chip judges that usb protocol identifies whether and the first association
Sensible matching of assessing a bid for tender executes following steps when usb protocol mark matches with the first protocol-identifier:
Step m1:Control chip is packaged USB command according to the second preset protocol, obtains instruction encapsulation of data;
Step m2:Control chip will instruct encapsulation of data to be sent to Bluetooth chip;
Specifically, control chip is sent to Bluetooth chip for according to the USB command after the encapsulation of the second preset protocol;
Step m3:Bluetooth chip unseals instruction encapsulation of data, obtains USB command;
Specifically, Bluetooth chip unseals the USB command after encapsulation according to the second preset protocol, obtains USB command;
I.e. Bluetooth chip unseals instruction encapsulation of data according to the second preset protocol, obtains USB command.
Step m4:Bluetooth chip sends USB command to bluetooth security equipment;The USB from bluetooth security equipment is received to answer
It answers;
Step m5:Bluetooth chip encapsulates USB response according to the second preset protocol, obtains response encapsulation of data;
Step m6:Bluetooth chip sends response encapsulation of data to control chip;
Specifically, Bluetooth chip is sent to control chip according to the USB response after the encapsulation of the second preset protocol;
Step m7:Control chip unseals response encapsulation of data, obtains USB response;
Specifically, control chip is carried out according to the second preset protocol to according to the USB response after the encapsulation of the second preset protocol
Deblocking, obtains USB response;That is control chip unseals response encapsulation of data according to the second preset protocol, obtains USB and answers
It answers.
Step m8:It controls chip and USB response is returned to by host computer by USB module;
When usb protocol mark is mismatched with the first protocol-identifier, step 408 is executed.
In the present embodiment, when controlling chip after step 402, before step 406, further include:Chip is controlled to bluetooth
Chip, which is sent, obtains bluetooth security device identification instruction;It includes the first of bluetooth security equipment that Bluetooth chip is returned to control chip
After the response of protocol-identifier, step 406 is specially:Chip initiation USB module is controlled, the usb protocol of itself is identified into setting
For the first protocol-identifier, the first protocol-identifier of itself is stated to host computer by USB module;
Step 408 is replaced by:Control chip is packaged USB command according to the second preset protocol, obtains instruction envelope
Fill data;
Step 409 is replaced by:Chip is controlled by according to the USB command after the encapsulation of the second preset protocol, i.e., is sealed instruction
Data are filled, Bluetooth chip is sent to;
Step 410 is replaced by:Bluetooth chip unseals the USB command after encapsulation according to the second preset protocol, obtains
To USB command, step 411 is executed;I.e. step 410 is replaced by:Bluetooth chip encapsulates number to instruction according to the second preset protocol
According to being unsealed, USB command is obtained, executes step 411;
Step 416 is replaced by:Control chip obtains bluetooth from according to the bluetooth response after the encapsulation of the second preset protocol
Response, using bluetooth response as USB response.That is, step 416 is replaced by:Control chip obtains indigo plant from response encapsulation of data
Tooth response, using bluetooth response as USB response.
In the present embodiment, after step 406, before step 408, the USB to be received from host computer such as control chip refers to
It enables, after receiving the USB command from host computer within a preset time, executes step 408;When not connecing within a preset time
After receiving the USB command from host computer, judges whether to receive from Bluetooth chip and bluetooth security equipment and disconnected company
The information connect resets control chip, return step 401 if it is, resetting Bluetooth chip;Otherwise, it continues waiting for receiving and come from
The USB command of host computer;
After step 417, control chip returns to waiting for receiving the USB command from host computer.
In the present embodiment, after step 405, further include:Control chip judges whether to receive the sum from Bluetooth chip
The information that bluetooth security equipment has disconnected resets control chip, return step 401 if it is, resetting Bluetooth chip;
Otherwise, continue to determine whether to receive information from Bluetooth chip and that bluetooth security equipment has disconnected.
Embodiment 5
A kind of working method of Bluetooth adapter is present embodiments provided, as shown in fig. 6, specifically including:
Step 501:Bluetooth adapter powers on;
Step 502:Bluetooth adapter initialization;
In the present embodiment, Bluetooth adapter initialization control chip and Bluetooth chip.
Step 503:The bluetooth security equipment that Bluetooth adapter search matches with default device identification simultaneously connects with its foundation
It connects;
Specifically, Bluetooth adapter askes instruction by control chipset driving wheel, sends poll instruction to Bluetooth chip, receives
Poll repeat-back from Bluetooth chip.After Bluetooth chip receives poll instruction, search and default device identification phase
Matched bluetooth security equipment simultaneously establishes a connection, and returns to poll repeat-back to control chip.
Wherein, Bluetooth adapter askes instruction by control chipset driving wheel, specially:Bluetooth adapter passes through control chip
It is instructed according to the second preset protocol tissue poll.In the present embodiment, include in poll instruction:Instruct start byte, command identification,
Data length, data field and the check bit of data field.
For example, the instruction banner word that Bluetooth adapter is instructed " 0x5A " and " 0xA5 " as poll by controlling chip
Section is arranged in the first byte and the second byte of poll instruction, the command identification that " 0x02 " is instructed as poll, and setting exists
Poll instruction third byte on, will " 0x00 " and " 0x00 " as poll instruct in data field data length, set respectively
It sets on the nybble and the 5th byte of poll instruction, the check value " XOR " that poll is instructed, poll instruction is set most
In the latter byte (check bit), obtained poll instruction is specially:" 02 00 00 XOR of 5A A5 " is sent to Bluetooth chip
Poll instructs " 02 00 00 XOR of 5A A5 ";Etc. the poll repeat-back to be received from Bluetooth chip.
In the present embodiment, presetting device identification is preset device identification, wherein device identification includes:Bluetooth equipment
UUID (Universally Unique Identifier, Universally Unique Identifier), the MAC Address of bluetooth equipment and bluetooth are set
At least one of standby device name.Wherein, the UUID of bluetooth equipment is the service unique identification information that bluetooth equipment is supported,
The MAC Address of bluetooth equipment or the device name of bluetooth equipment are the unique identification information of bluetooth equipment.
In the present embodiment, bluetooth security equipment be can be, but not limited to as blue-tooth intelligence key devices and Bluetooth intelligent card etc..
Step 504:Bluetooth adapter judges whether to establish connection with bluetooth security equipment, if so, thening follow the steps
505;Otherwise, return step 504;
Specifically, after Bluetooth adapter receives the poll repeat-back from Bluetooth chip by controlling chip, root
Judge whether to establish connection with bluetooth security equipment according to poll repeat-back, if so, thening follow the steps 505;Otherwise, step is returned
Rapid 504;
More specifically, after Bluetooth adapter receives the poll repeat-back from Bluetooth chip by control chip,
Poll repeat-back is parsed according to the second preset protocol, obtains the connection result mark in the data field in poll repeat-back,
Judge whether to establish connection with bluetooth security equipment according to connection result mark, if connection result is identified as success flag,
Connection is established with bluetooth security equipment;Otherwise, connection failure.
For example, if Bluetooth adapter by control chip receive from Bluetooth chip poll repeat-back be " A5
02 00 01 00 XOR of 5A ", obtain the 5th byte after, the data in byte before the last byte, and by its
As the connection result mark in the data field in poll repeat-back, then " 00 " is identified according to connection result and determine to pacify with bluetooth
Full equipment establishes connection;If Bluetooth adapter is " A5 by controlling chip to receive the poll repeat-back from Bluetooth chip
02 00 01 01 XOR of 5A ", obtain the 5th byte after, the data in byte before the last byte, and by its
As the connection result mark in the data field in poll repeat-back, then " 01 " is identified according to connection result and determine no and indigo plant
Tooth safety equipment establishes connection.
Step 505:Bluetooth adapter states the CCID protocol mark of itself to host computer;
Specifically, Bluetooth adapter passes through the control chip initiation USB module of itself, states itself to host computer
CCID protocol mark.
Step 506:The CCID instruction to be received from host computer such as Bluetooth adapter, comes when receiving within a preset time
From after the CCID instruction of host computer, step 507 is executed;It is instructed when being not received by the CCID from host computer within a preset time
Afterwards, it detects whether to have disconnected with bluetooth security equipment, if it is, Bluetooth adapter resets, return step 502;Otherwise,
Return step 506;
Preferably, preset time is 3 seconds.
In the present embodiment, Bluetooth adapter resets, specially:Bluetooth chip in Bluetooth adapter resets, and controls chip
It resets.After Bluetooth adapter resets, host computer detects Bluetooth adapter on usb bus and upper by the hub of itself
Position machine disconnects.
Step 507:Bluetooth adapter sends CCID instruction to bluetooth security equipment;
Specifically, Bluetooth adapter sends CCID instruction to bluetooth security equipment by Bluetooth chip.
For example, Bluetooth adapter, which sends CCID to bluetooth security equipment by Bluetooth chip, instructs " 6F070000
00000400 00000000 0047474b80A7”。
Step 508:Bluetooth adapter receives the CCID response from bluetooth security equipment;
Specifically, Bluetooth adapter receives the CCID response from bluetooth security equipment by Bluetooth chip.
For example, Bluetooth adapter is by CCID response of the Bluetooth chip reception from bluetooth security equipment
“80830000000106000000006AF61B6E94C5CE5871D54D31F9456F9BA397DE422AC11D75DD95A8
FE2895D234CF80D2F1436A91E94CAB11F0A577461BC384F7E9B8DFBC19CB8055F8B43E8A23B1D
CF2FE1BAC129FB85889161DC5176BE28F3CE62E9ED1BDE1FCB190DD1CBD3417EEB06D1CBE52CC
5D490E9B47A8C5AECE485C9B746F50544C008A7CDC106D0F9000 66”。
Step 509:CCID response is returned to host computer, return step 506 by Bluetooth adapter;
In the present embodiment, step 507 can be as in Figure 6-1, specifically includes:
Step 5071:Control chip is packaged CCID instruction according to the second preset protocol;
Specifically, control chip instructs the second preset protocol head of addition in CCID, according to the second default checking algorithm to packet
The data for including CCID instruction and the second preset protocol head carry out operation, obtain the second check value, add the after CCID instruction
Two check values, the CCID instruction after being encapsulated, by the CCID instruction after encapsulation as instruction encapsulation of data.
For example, control chip adds before CCID instructs " 00,000,400 00000000 0047474b80 A7 of 6F070000 "
Add the second preset protocol head " 5A A5 04 0013 ", obtain include CCID instruction and the second preset protocol head data " 5A
00,000,400 00000000 0047474b80 A7 " of A50400136F070000, refers to according to LRC checking algorithm to including CCID
It enables and the data of the second preset protocol head carries out operation, obtain the second check value " 00 ", add the second school after CCID instruction
Value is tested, the CCID after encapsulating according to the second preset protocol head is obtained and instructs " 04 00 13 6F 07 00 00 00 00 of 5A A5
04 00 00 00 00 00 00 47 47 4b 80 A7 00”。
Step 5072:Controlling chip will instruct according to the CCID after the encapsulation of the second preset protocol, be sent to Bluetooth chip;
Step 5073:Bluetooth chip unseals the CCID instruction after encapsulation according to the second preset protocol, obtains CCID
Instruction;
Specifically, Bluetooth chip unseals the CCID instruction after encapsulation to according to the second preset protocol, from according to the
Two preset protocols carry out in the data that solution is honored as a queen the CCID instruction after encapsulation, obtain CCID instruction.
For example, Bluetooth chip unseals the data after being packaged according to the second preset protocol to effective instruction data
Obtained data are " 0013 6F070000 of 5AA504,00,000,400 00000000 0047474b80 A7 00 ", obtain the
After two preset protocol heads, data in all bytes before the second check value, the data " 6F070000 that will acquire
00000400 00000000 0047474b80 A7 " are instructed as CCID.
Step 5074:Bluetooth chip sends CCID instruction to bluetooth security equipment.
Correspondingly, step 508 can specifically include as in fig. 6-2:
Step 5081:Bluetooth chip encapsulates CCID response according to the second preset protocol;
Specifically, Bluetooth chip adds the second preset protocol head before CCID response, presets checking algorithm according to third
Operation is carried out to the data for including the second preset protocol head and CCID response, the 4th check value is obtained, adds after CCID response
Add the 4th check value, the CCID response after being encapsulated, using the CCID response after encapsulation as response encapsulation of data.
For example, Bluetooth chip is in CCID response " 80830000000106000000006AF61B6E94C5CE5871D54D
31F9456F9BA397DE422AC11D75DD95A8FE2895D234CF80D2F1436A91E94CAB11F0A577461BC38
4F7E9B8DFBC19CB8055F8B43E8A23B1DCF2FE1BAC129FB85889161DC5176BE28F3CE62E9ED1BD
E1FCB190DD1CBD3417EEB06D1CBE52CC5D490E9B47A8C5AECE485C9B746F50544C008A7CDC106
It before D0F9000 66 ", adds the second preset protocol head " 04 00 8F of A5 5A ", according to LRC checking algorithm to including second
Preset protocol head and the data of CCID response carry out operation, obtain the 4th check value " 00 ", and the 4th is added after CCID response
Check value obtains the CCID response after encapsulating according to the second preset protocol head
“A55A04008F80830000000106000000006AF61B6E94C5CE5871D54D31F9456F9BA397DE422AC1
1D75DD95A8FE2895D234CF80D2F1436A91E94CAB11F0A577461BC384F7E9B8DFBC19CB8055F8B
43E8A23B1DCF2FE1BAC129FB85889161DC5176BE28F3CE62E9ED1BDE1FCB190DD1CBD3417EEB0
6D1CBE52CC5D490E9B47A8C5AECE485C9B746F50544C008A7CDC106D 0F9,000 66 00 " will be encapsulated
CCID response afterwards is as response encapsulation of data.
Step 5082:Bluetooth chip is sent to control chip according to the CCID response after the encapsulation of the second preset protocol;
Step 5083:Chip is controlled to according to the CCID response after the encapsulation of the second preset protocol, is unsealed, obtains CCID
Response.
Specifically, control chip is unsealed to according to the CCID response after the encapsulation of the second preset protocol, second is preset
After protocol header, all data before the 4th check value are as CCID response.
For example, control chip is to according to the CCID response after the encapsulation of the second preset protocol
“A55A04008F80830000000106000000006AF61B6E94C5CE5871D54D31F9456F9BA397DE422AC1
1D75DD95A8FE2895D234CF80D2F1436A91E94CAB11F0A577461BC384F7E9B8DFBC19CB8055F8B
43E8A23B1DCF2FE1BAC129FB85889161DC5176BE28F3CE62E9ED1BDE1FCB190DD1CBD3417EEB0
6D1CBE52CC5D490E9B47A8C5AECE485C9B746F50544C008A7CDC106D 0F9,000 66 00 ", is solved
Envelope, after obtaining the second preset protocol head, the data in all bytes before the 4th check value, the data that will acquire
“8F80830000000106000000006AF61B6E94C5CE5871D54D31F9456F9BA397DE422AC11D75DD95
A8FE2895D234CF80D2F1436A91E94CAB11F0A577461BC384F7E9B8DFBC19CB8055F8B43E8A23B
1DCF2FE1BAC129FB85889161DC5176BE28F3CE62E9ED1BDE1FCB190DD1CBD3417EEB06D1CBE52
CC5D490E9B47A8C5AECE485C9B746F50544C008A7CDC106D0F9000 66 " is used as CCID response.
In the present embodiment, the data format and the second preset protocol phase of the communication between chip and Bluetooth chip are controlled
Match, wherein consulted in advance between the second preset protocol control chip and Bluetooth chip.Bluetooth chip and control chip it
Between can be, but not limited to through UART (Universal Asynchronous Receiver/Transmitter, universal asynchronous receipts
Send out transmitter)/SPI (Serial Peripheral Interface, Serial Peripheral Interface (SPI))/I2C (Inter-Integrated
Circuit, internal integrated circuit) the various mode transmissions data such as bus.
In the present embodiment, after step 504, can also include:Bluetooth adapter is detected whether with bluetooth security equipment
It disconnects, if it is, Bluetooth adapter resets, return step 502;Otherwise, continue to test whether with bluetooth security equipment
It has disconnected.Correspondingly, it in step 506 after being not received by the USB command from host computer within a preset time, returns
Step 506.
Embodiment 6
A kind of Bluetooth adapter is present embodiments provided, as shown in fig. 7, comprises:First search module 01, first connects mould
Block 02, the first declaration module 03, the first tissue module 04, the first sending module 05, the first receiving module 06, the second receiving module
07, minor microstructure module 08 and the second sending module 09;
First search module 01, for searching for the bluetooth security equipment to match with default device identification;
First link block 02 establishes connection for searching the bluetooth security equipment that plain module 01 searches with first;
First declaration module 03, for after the first link block 02 establishes connection with bluetooth security equipment, to host computer
State the usb protocol mark of itself;
First receiving module 06, for receiving the USB command from host computer;
The first tissue module 04 is received for the protocol type and the first receiving module 06 according to bluetooth security equipment
USB command tissue Bluetooth commands;
First sending module 05, for sending Bluetooth commands to bluetooth security equipment;
Second receiving module 07, for receiving the bluetooth response from bluetooth security equipment;
Minor microstructure module 08, bluetooth response for being received according to the second receiving module 07 and identifies with usb protocol
The usb protocol tissue USB response to match;
Second sending module 09, for USB response to be returned to host computer.
In the present embodiment, usb protocol is specially CCID protocol or SCSI protocol or HID protocol or other agreements.
In the present embodiment, Bluetooth adapter can also include the first acquisition module;
First obtains module, for after the first link block 02 and bluetooth security equipment establish connection, from bluetooth security
The first protocol-identifier of bluetooth security equipment is obtained in the broadcast message of equipment;
Correspondingly, the first tissue module 04, specifically for according to corresponding with the first protocol-identifier of bluetooth security equipment
Protocol type and USB command tissue Bluetooth commands.
In the present embodiment, the first tissue module 04, specifically for obtaining the effective instruction data in USB command, according to indigo plant
The protocol type and effective instruction data organization Bluetooth commands of tooth safety equipment;
Minor microstructure module 08 is identified specifically for obtaining the effective response data in bluetooth response according to usb protocol
The usb protocol tissue to match includes the USB response for imitating reply data.
Further, Bluetooth adapter can also include second obtain module, first judgment module, third sending module,
Third receiving module and the 4th sending module;
Second obtains module, for after the first link block 02 establishes connection with bluetooth security equipment, the first tissue mould
Before block 04 organizes Bluetooth commands, the first Protocol Standard of bluetooth security equipment is obtained from the broadcast message of bluetooth security equipment
Know;
First judgment module judges USB after for receiving the USB command from host computer when the first receiving module 06
Whether protocol-identifier matches with the first protocol-identifier;
Third sending module, for sending USB command to bluetooth security equipment after first judgment module is judged as YES;
Third receiving module, for receiving the USB response from bluetooth security equipment;
4th sending module, for USB response to be returned to host computer;
Correspondingly, the first tissue module 04, specifically for obtaining in USB command after first judgment module is judged as NO
Effective instruction data, according to the protocol type of bluetooth security equipment and effective instruction data organization Bluetooth commands;
Minor microstructure module 08 is identified specifically for obtaining the effective response data in bluetooth response according to usb protocol
The usb protocol tissue to match includes the USB response for imitating reply data.
In the present embodiment, minor microstructure module 08 can be specifically included:First acquisition unit and the first tissue unit;
First acquisition unit, for obtaining the effective response number in bluetooth response according to the protocol type of bluetooth security equipment
According to;
The first tissue unit, for including effect reply data according to the usb protocol tissue to match with usb protocol mark
USB response.
In the present embodiment, Bluetooth adapter can also include:Third obtains module;
Third obtains module, for after the first link block 02 establishes connection with bluetooth security equipment, first to state mould
Before block 03 states the usb protocol mark of itself to host computer, bluetooth security is obtained from the broadcast message of bluetooth security equipment
First protocol-identifier of equipment;
First declaration module 03, specifically for setting the first protocol-identifier for the usb protocol mark of itself, to host computer
State the first protocol-identifier of itself;
The first tissue module 04 is specifically used for using USB command as Bluetooth commands;
Minor microstructure module 08 is specifically used for using bluetooth response as USB response.
In the present embodiment, the protocol type of bluetooth security equipment can be preset for Bluetooth adapter;
Correspondingly:The first tissue module 04, specifically for protocol type and the usb protocol mark when bluetooth security equipment
Timing, using USB command as Bluetooth commands;When the protocol type of bluetooth security equipment and usb protocol mark mismatch, obtain
Effective instruction data in USB command, according to the protocol type of bluetooth security equipment and effective instruction data organization Bluetooth commands;
Minor microstructure module 08, specifically for inciting somebody to action when the protocol type of bluetooth security equipment is matched with usb protocol mark
Bluetooth response is as USB response;When the protocol type of bluetooth security equipment and usb protocol mark mismatch, obtains bluetooth and answer
Effective response data in answering include the USB for imitating reply data according to the usb protocol tissue to match with usb protocol mark
Response.
In this implementation, Bluetooth adapter can also include first detection module and the first reseting module;
First receiving module 06, specifically for stating that the usb protocol of itself identifies to host computer when the first declaration module 03
Afterwards, the USB command to be received from host computer is waited;After first detection module is detected as no, wait to be received from host computer
USB command;And after USB response is returned to host computer by the second sending module 09, the USB to be received from host computer is waited to refer to
It enables;
The first tissue module 04, specifically for being received within a preset time when the first receiving module 06 from host computer
After USB command, according to the protocol type of bluetooth security equipment and USB command tissue Bluetooth commands;
First detection module, for being not received by within a preset time when the first receiving module 06 from host computer
After USB command, detect whether to have disconnected with bluetooth security equipment;
First reseting module, for resetting after first detection module, which is detected as, is;
First search module 01 is also used to after the first reseting module resets, what search matched with default device identification
Bluetooth security equipment.
In the present embodiment, Bluetooth adapter can also include:Second detection module and the second reseting module;
Second detection module, for after link block establishes connection with bluetooth security equipment and for working as testing result
After no, continue to test and whether disconnected with the bluetooth security equipment;, detect whether to have disconnected with bluetooth security equipment
Connection;
Second reseting module, for resetting after the second detection module is detected as being;
First search module 01 is also used to after the second reseting module resets, what search matched with default device identification
Bluetooth security equipment.
In the present embodiment, usb protocol is specially CCID protocol or SCSI protocol or HID protocol or other agreements.This implementation
The Bluetooth adapter that example provides reports the usb protocol mark of itself to the end PC after establishing connection with bluetooth security equipment, blue
Tooth adapter is suitable can be identified as HID device or CCID equipment or scsi device or other USB devices by the end PC, enhance indigo plant
The adaptability and application of tooth adapter.When Bluetooth adapter has received the USB command for meeting USB specification from the end PC
Afterwards, the USB command for meeting USB specification is converted, after obtaining the Bluetooth commands that bluetooth security equipment can identify, by bluetooth
Instruction is sent to bluetooth security equipment, meets what the bluetooth response that bluetooth security equipment returns was reconverted into that the end PC can identify
The USB response of USB specification, and the USB response for meeting USB specification is returned into the end PC, so that bluetooth security equipment is led to
Bluetooth adapter and PC provided by the invention end is crossed to be communicated.
Embodiment 7
A kind of Bluetooth adapter is present embodiments provided, as shown in figure 8, including:Control chip, Bluetooth chip and USB mould
Block;
Controlling chip includes:First transmission unit 601, the first initialization unit 602,603, first groups of the first receiving unit
Knit unit 604, the second transmission unit 605, minor microstructure unit 606 and third transmission unit 607;
First transmission unit 601, for sending poll instruction to Bluetooth chip;
First initialization unit 602, for being answered when the first receiving unit 603 receives the instruction of the poll from Bluetooth chip
After answering, USB module is initialized, states that the usb protocol of itself identifies to host computer by USB module;
In the present embodiment, usb protocol is specially CCID protocol or SCSI protocol or HID protocol or other agreements.
First receiving unit 603, for receiving the poll repeat-back from Bluetooth chip;By USB module reception come
From the USB command of host computer;Receive the response encapsulation of data from Bluetooth chip;
The first tissue unit 604, for the protocol type and the second preset protocol according to bluetooth security equipment to USB command
It is packaged, obtains instruction encapsulation of data;
Second transmission unit 605, for that encapsulation of data will be instructed to be sent to Bluetooth chip;
Minor microstructure unit 606, for identifying phase according to the response encapsulation of data from Bluetooth chip and with usb protocol
The usb protocol tissue USB response matched;
Third transmission unit 607, for USB response to be returned to host computer by USB module;
Bluetooth chip includes:Second receiving unit 701, the first search unit 702, the first connection unit the 703, the 4th are sent
Unit 704, third receiving unit 705, second acquisition unit 706, the 5th transmission unit 707, the 4th receiving unit 708, third
Organizational unit 709 and the 6th transmission unit 710;
Second receiving unit 701, for receiving the poll instruction from control chip;
First search unit 702, for searching for and setting after the second receiving unit 701 receives poll instruction
The bluetooth security equipment that standby mark matches;
First connection unit 703, for establishing connection with bluetooth security equipment,
4th transmission unit 704, for returning to poll repeat-back to control chip;
Third receiving unit 705, for receiving the instruction encapsulation of data from control chip;
Second acquisition unit 706, for obtaining bluetooth from the instruction encapsulation of data that third receiving unit 705 receives
Instruction;
5th transmission unit 707 refers to for sending the bluetooth that second acquisition unit 706 is got to bluetooth security equipment
It enables;
4th receiving unit 708, for receiving the bluetooth response from bluetooth security equipment;
Third organizational unit 709 is answered for encapsulating the bluetooth that the 4th receiving unit 708 receives according to the second preset protocol
It answers, obtains response encapsulation of data;
6th transmission unit 710 sends the response encapsulation of data that third organizational unit 709 is organized to control chip.
In the present embodiment, control chip further includes the 7th transmission unit;Bluetooth chip further includes the 8th transmission unit;
7th transmission unit returns to poll instruction to control chip for the 4th transmission unit 704 when Bluetooth chip and answers
After answering, is sent to Bluetooth chip and obtain bluetooth security device identification instruction;
8th transmission unit, for returning to the response of the first protocol-identifier including bluetooth security equipment to control chip;
Correspondingly, the first tissue unit 604, specifically for according to corresponding with the first protocol-identifier of bluetooth security equipment
Protocol type and the second preset protocol are packaged USB command, obtain instruction encapsulation of data.
In the present embodiment, the first tissue unit 604 can be specifically used for obtaining the effective instruction data in USB command, root
Effective instruction data are packaged according to the protocol type and the second preset protocol of bluetooth security equipment, obtain instruction encapsulation number
According to;
Minor microstructure unit 606 can be specifically used for unsealing the response encapsulation of data from Bluetooth chip, obtain
Effective response data in bluetooth response include effect reply data according to the usb protocol tissue to match with usb protocol mark
USB response.
In the present embodiment, the first tissue unit 604 can also be specifically used for obtaining the effective instruction data in USB command,
Effective instruction data are packaged according to the protocol type of bluetooth security equipment, obtain the first encapsulation of data;It is pre- according to second
If agreement is packaged the first encapsulation of data, instruction encapsulation of data is obtained;Second acquisition unit 706, can be specifically used for from
The first encapsulation of data is obtained in instruction encapsulation of data, using the first encapsulation of data as Bluetooth commands.
In the present embodiment, minor microstructure unit 606 can also be specifically used for unsealing response encapsulation of data, obtain
Bluetooth response, according to the protocol type of bluetooth security equipment obtain bluetooth response in effective response data, according to usb protocol
Identifying the usb protocol tissue to match includes the USB response for imitating reply data.
Further, control chip further includes the 9th transmission unit, the first judging unit, the first encapsulation unit, the tenth
One transmission unit, the second deblocking unit and the 14th transmission unit;Bluetooth chip further includes the tenth transmission unit, the first deblocking list
Member, the second encapsulation unit, the 12nd transmission unit, the 5th receiving unit and the 13rd transmission unit;
9th transmission unit returns to poll instruction to control chip for the 4th transmission unit 704 when Bluetooth chip and answers
After answering, before the first tissue unit 604 is packaged USB command, is sent to Bluetooth chip and obtain bluetooth security device identification
Instruction;
Tenth transmission unit, for returning to the response of the first protocol-identifier including bluetooth security equipment to control chip;
First judging unit, for receiving the USB command from host computer by USB module when the first receiving unit 603
Afterwards, judge that usb protocol identifies whether to match with the first protocol-identifier;After the first judging unit is determined as no, triggering first
Organizational unit 604;
Correspondingly, the first tissue unit 604 is specifically used for obtaining the effective instruction data in USB command, is pacified according to bluetooth
The protocol type of full equipment is packaged effective instruction data, obtains the first encapsulation of data;According to the second preset protocol to
One encapsulation of data is packaged, and obtains instruction encapsulation of data;Or specifically for obtaining the effective instruction data in USB command,
Effective instruction data are packaged according to the protocol type of bluetooth security equipment and the second preset protocol, obtain instruction encapsulation number
According to.
First encapsulation unit, for after the first judging unit is judged to being, according to the second preset protocol to USB command into
Row encapsulation obtains instruction encapsulation of data;
11st transmission unit, for that encapsulation of data will be instructed to be sent to Bluetooth chip;
First deblocking unit obtains USB command for unsealing to instruction encapsulation of data;
12nd transmission unit, for sending USB command to bluetooth security equipment;
5th receiving unit, for receiving the USB response from bluetooth security equipment;
Second encapsulation unit obtains response encapsulation of data for encapsulating USB response according to the second preset protocol;
13rd transmission unit, for sending response encapsulation of data to control chip;
Second deblocking unit obtains USB response for unsealing to response encapsulation of data;
14th transmission unit, for USB response to be returned to host computer by USB module.
In the present embodiment, control chip can also include the 15th transmission unit;Bluetooth chip can also include the 16th
Transmission unit;
15th transmission unit returns to poll instruction to control chip for the 4th transmission unit 704 when Bluetooth chip
After response, before the first initialization unit 602 states the usb protocol mark of itself by USB module to host computer, to bluetooth core
Piece, which is sent, obtains bluetooth security device identification instruction;
16th transmission unit, for returning to answering for the first protocol-identifier including bluetooth security equipment to control chip
It answers;
First initialization unit 602 is specifically used for initialization USB module, sets first for the usb protocol mark of itself
Protocol-identifier states to host computer the first protocol-identifier of itself by USB module;
The first tissue unit 604 obtains instruction envelope specifically for being packaged according to the second preset protocol to USB command
Fill data;
Second acquisition unit 706 obtains the USB command specifically for unsealing to instruction encapsulation of data;
5th transmission unit 707 is specifically used for sending bluetooth to bluetooth security equipment using USB command as Bluetooth commands
Instruction;
Minor microstructure unit 606, be specifically used for from response encapsulation of data obtain bluetooth response, using bluetooth response as
USB response.
In the present embodiment, the protocol type of bluetooth security equipment is preset;
The first tissue unit 604, when specifically for being matched when the protocol type of bluetooth security equipment and usb protocol mark,
USB command is packaged according to the second preset protocol, obtains instruction encapsulation of data;When bluetooth security equipment protocol type with
When usb protocol mark mismatches, obtain the effective instruction data in USB command, according to the protocol type of bluetooth security equipment and
Second preset protocol is packaged effective instruction data, obtains instruction encapsulation of data;
Second acquisition unit 706, when specifically for being matched when the protocol type of bluetooth security equipment and usb protocol mark,
From instruction encapsulation of data, USB command is obtained, using USB command as Bluetooth commands;When bluetooth security equipment protocol type with
When usb protocol mark mismatches, from instruction encapsulation of data, Bluetooth commands are obtained;
Minor microstructure unit 606, when specifically for being matched when the protocol type of bluetooth security equipment and usb protocol mark,
Bluetooth response is obtained from response encapsulation of data, using bluetooth response as USB response;When bluetooth security equipment protocol type with
When usb protocol mark mismatches, response encapsulation of data is unsealed, obtains the effective response data in bluetooth response, according to
The usb protocol tissue to match with usb protocol mark includes the USB response for imitating reply data.
In the present embodiment, control chip can also include second judgment unit and the first reset unit;First receiving unit
603 include the first receiving subelement, the second receiving subelement and third receiving subelement;
First receiving subelement, for stating that the usb protocol of itself identifies to host computer when the first initialization unit 602
Afterwards, the USB command to be received from host computer is waited;After second judgment unit is judged as NO, wait to be received from host computer
USB command;And after USB response is returned to host computer by third transmission unit 607, the USB to be received from host computer is waited
Instruction;
Second receiving subelement, for receiving the poll repeat-back from Bluetooth chip;
Third receiving subelement, for receiving the response encapsulation of data from Bluetooth chip;
The first tissue unit 604, specifically for being received within a preset time when the first receiving unit 603 from host computer
USB command after, USB command is packaged according to the protocol type of bluetooth security equipment and the second preset protocol;
Second judgment unit, for being not received by within a preset time when the first receiving unit 603 from host computer
After USB command, judge whether to receive information from Bluetooth chip and that bluetooth security equipment has disconnected;
First reset unit resets control chip for resetting Bluetooth chip after second judgment unit is judged as YES;
First transmission unit 601 is also used to reset Bluetooth chip when the first reset unit, after resetting control chip, Xiang Lan
Tooth chip sends poll instruction.
In the present embodiment, control chip can also include:Third judging unit and the second reset unit;
Third judging unit, for after the 4th transmission unit 704 returns to poll repeat-back to control chip and certainly
After body is judged as NO, judge whether to receive information from Bluetooth chip and that bluetooth security equipment has disconnected;
Second reset unit resets control chip for resetting Bluetooth chip after third judging unit is judged as YES;
First transmission unit 601 is also used to reset Bluetooth chip when the second reset unit, after resetting control chip, Xiang Lan
Tooth chip sends poll instruction.
The foregoing is only a preferred embodiment of the present invention, but scope of protection of the present invention is not limited thereto,
Anyone skilled in the art is in technical scope disclosed by the invention, and any changes or substitutions that can be easily thought of,
It should be covered by the protection scope of the present invention.Therefore, protection scope of the present invention should be with scope of protection of the claims
Subject to.
Claims (38)
1. a kind of working method of Bluetooth adapter, which is characterized in that including:
Step s1:Bluetooth adapter searches for the bluetooth security equipment to match with default device identification and establishes connection with it;
Step s2:The Bluetooth adapter states the usb protocol mark of itself to host computer;
Step s3:The Bluetooth adapter receives the USB command from the host computer;
Step s4:Protocol type and the USB command tissue bluetooth of the Bluetooth adapter according to the bluetooth security equipment
Instruction;
Step s5:The Bluetooth adapter sends Bluetooth commands to the bluetooth security equipment;
Step s6:The Bluetooth adapter receives the bluetooth response from the bluetooth security equipment;
Step s7:The Bluetooth adapter identifies the usb protocol group to match according to the bluetooth response and with the usb protocol
Knit USB response;
Step s8:The USB response is returned to the host computer by the Bluetooth adapter;
Further include after the step s1:The Bluetooth adapter detects whether to have disconnected with the bluetooth security equipment,
If it is, the Bluetooth adapter resets, return step s1;Otherwise, continue to test whether with the bluetooth security equipment
It disconnects.
2. the method according to claim 1, wherein further including after the step s1:The Bluetooth adapter
The first protocol-identifier of the bluetooth security equipment is obtained from the broadcast message of the bluetooth security equipment;
The step s4 is specially:The Bluetooth adapter is according to corresponding with the first protocol-identifier of the bluetooth security equipment
Protocol type and the USB command tissue Bluetooth commands.
3. the method according to claim 1, wherein the step s4 is specially:The Bluetooth adapter obtains
Effective instruction data in the USB command, according to the protocol type of the bluetooth security equipment and the effective instruction data
Organize Bluetooth commands;
The step s7 is specially:The Bluetooth adapter obtains the effective response data in the bluetooth response, according to institute
State the USB response that the usb protocol tissue that usb protocol mark matches includes the effective response data.
4. according to the method described in claim 3, it is characterized in that, before the step s4, also being wrapped after the step s1
It includes:The Bluetooth adapter obtains the first agreement of the bluetooth security equipment from the broadcast message of the bluetooth security equipment
Mark;
After the step s3, further include:The Bluetooth adapter judges that the usb protocol identifies whether and first agreement
Mark matches;
When usb protocol mark matches with first protocol-identifier, following steps are executed:
Step r1:The Bluetooth adapter sends the USB command to the bluetooth security equipment;
Step r2:The Bluetooth adapter receives the USB response from the bluetooth security equipment;
Step r3:The USB response is returned to host computer by the Bluetooth adapter;
When usb protocol mark is mismatched with first protocol-identifier, the step s4 is executed.
5. according to the method described in claim 3, it is characterized in that, the Bluetooth adapter obtains having in the bluetooth response
Imitating reply data is specially:The Bluetooth adapter obtains the bluetooth response according to the protocol type of the bluetooth security equipment
In effective response data.
6. the method according to claim 1, wherein further including before the step s2 after the step s1:
The Bluetooth adapter obtains the first Protocol Standard of the bluetooth security equipment from the broadcast message of the bluetooth security equipment
Know;
The step s2 is specially:The usb protocol mark of itself is set the first protocol-identifier by the Bluetooth adapter, upwards
Position machine states the first protocol-identifier of itself;
The step s4 is specially:The Bluetooth adapter is using the USB command as Bluetooth commands;
The step s7 is specially:The Bluetooth adapter is using the bluetooth response as USB response.
7. the method according to claim 1, wherein the protocol type of the bluetooth security equipment is preset;
When the protocol type of the bluetooth security equipment is matched with usb protocol mark:
The step s4 is specially:The Bluetooth adapter is using the USB command as Bluetooth commands;
The step s7 is specially:The Bluetooth adapter is using the bluetooth response as USB response;
When the protocol type of the bluetooth security equipment and usb protocol mark mismatch:
The step s4 is specially:The Bluetooth adapter obtains the effective instruction data in the USB command, according to the indigo plant
The protocol type of tooth safety equipment and the effective instruction data organization Bluetooth commands;
The step s7 is specially:The Bluetooth adapter obtains the effective response data in the bluetooth response, according to institute
State the USB response that the usb protocol tissue that usb protocol mark matches includes the effective response data.
8. the method according to claim 1, wherein the step s3 is specially:The Bluetooth adapter waits
The USB command from the host computer is received to hold after being received within a preset time from the USB command of the host computer
Row step s4;After being not received by within a preset time from the USB command of the host computer, detect whether and the bluetooth
Safety equipment has disconnected, if it is, the Bluetooth adapter resets, return step s1;Otherwise, it continues waiting for receiving
From the USB command of the host computer;
After the step s8, the step s3 is returned.
9. the method according to claim 1, wherein the usb protocol is specially CCID protocol or SCSI protocol
Or HID protocol.
10. a kind of Bluetooth adapter, which is characterized in that including:First search module, the first link block, the first declaration module,
The first tissue module, the first sending module, the first receiving module, the second receiving module, minor microstructure module and second send mould
Block;
First search module, for searching for the bluetooth security equipment to match with default device identification;
First link block, for described first search plain block search to the bluetooth security equipment establish connection;
First declaration module, for after first link block and the bluetooth security equipment establish connection, upwards
Position machine states the usb protocol mark of itself;
First receiving module, for receiving the USB command from the host computer;
The first tissue module, for according to the protocol type of the bluetooth security equipment and first receiving module reception
The USB command tissue Bluetooth commands arrived;
First sending module, for sending Bluetooth commands to the bluetooth security equipment;
Second receiving module, for receiving the bluetooth response from the bluetooth security equipment;
The minor microstructure module, the bluetooth response for being received according to second receiving module and with the USB
The usb protocol tissue USB response that protocol-identifier matches;
Second sending module, for the USB response to be returned to the host computer;
It further include the second detection module and the second reseting module;
Second detection module, for after the link block establishes connection with the bluetooth security equipment and when itself
After detecting that the Bluetooth adapter is not disconnected with the bluetooth security equipment, detect whether to set with the bluetooth security
It is standby to have disconnected;
Second reseting module, for resetting after second detection module is detected as being;
First search module is also used to after second reseting module resets, and search matches with default device identification
Bluetooth security equipment.
11. Bluetooth adapter according to claim 10, which is characterized in that further include the first acquisition module;
Described first obtains module, for after first link block and the bluetooth security equipment establish connection, from institute
State the first protocol-identifier that the bluetooth security equipment is obtained in the broadcast message of bluetooth security equipment;
The first tissue module, specifically for according to protocol class corresponding with the first protocol-identifier of the bluetooth security equipment
Type and the USB command tissue Bluetooth commands.
12. Bluetooth adapter according to claim 10, which is characterized in that the first tissue module, specifically for obtaining
The effective instruction data in the USB command are taken, according to the protocol type of the bluetooth security equipment and the effective instruction number
According to tissue Bluetooth commands;
Minor microstructure module, specifically for obtaining the effective response data in the bluetooth response, according to the usb protocol mark
Sensible matched usb protocol tissue includes the USB response of the effective response data.
13. Bluetooth adapter according to claim 12, which is characterized in that further include the second acquisition module, the first judgement
Module, third sending module, third receiving module and the 4th sending module;
Described second obtains module, for after the link block and the bluetooth security equipment establish connection, described first
Before molded tissue block tissue Bluetooth commands, the bluetooth security equipment is obtained from the broadcast message of the bluetooth security equipment
First protocol-identifier;
The first judgment module, for sentencing after first receiving module is received from the USB command of the host computer
The usb protocol that breaks identifies whether to match with first protocol-identifier;
The third sending module, for being sent to the bluetooth security equipment after first judgment module is judged as YES
The USB command;
The third receiving module, for receiving the USB response from the bluetooth security equipment;
4th sending module, for the USB response to be returned to host computer;
The first tissue module, specifically for obtaining in the USB command after first judgment module is judged as NO
Effective instruction data, according to the protocol type of the bluetooth security equipment and the effective instruction data organization Bluetooth commands.
14. Bluetooth adapter according to claim 12, which is characterized in that the minor microstructure module includes the first acquisition
Unit and the first tissue unit;
The first acquisition unit, for obtaining having in the bluetooth response according to the protocol type of the bluetooth security equipment
Imitate reply data;
The first tissue unit, for including described effective according to the usb protocol tissue to match with usb protocol mark
The USB response of reply data.
15. Bluetooth adapter according to claim 10, which is characterized in that further include:Third obtains module;
The third obtains module, described for after first link block establishes connection with the bluetooth security equipment
Before first declaration module states the usb protocol mark of itself to host computer, from the broadcast message of the bluetooth security equipment
Obtain the first protocol-identifier of the bluetooth security equipment;
First declaration module, specifically for setting the first protocol-identifier for the usb protocol mark of itself, to host computer sound
Itself bright the first protocol-identifier;
The first tissue module is specifically used for using the USB command as Bluetooth commands;
The minor microstructure module is specifically used for using the bluetooth response as USB response.
16. Bluetooth adapter according to claim 10, which is characterized in that the protocol type of the bluetooth security equipment is
It is preset;
The first tissue module, specifically for when the protocol type of the bluetooth security equipment and usb protocol mark
Timing, using the USB command as Bluetooth commands;When the protocol type of the bluetooth security equipment and the usb protocol identify
When mismatch, the effective instruction data in the USB command are obtained, according to the protocol type of the bluetooth security equipment and described
Effective instruction data organization Bluetooth commands;
The minor microstructure module, specifically for when the protocol type of the bluetooth security equipment and usb protocol mark
Timing, using the bluetooth response as USB response;When the protocol type of the bluetooth security equipment and the usb protocol identify
When mismatch, the effective response data in the bluetooth response are obtained, are assisted according to the USB to match with usb protocol mark
View tissue includes the USB response of the effective response data.
17. Bluetooth adapter according to claim 10, which is characterized in that further include that first detection module and first reset
Module;
First receiving module, specifically for stating that the usb protocol of itself identifies to host computer when first declaration module
Afterwards, the USB command to be received from the host computer is waited;After the first detection module is detected as no, to be received come from is waited
The USB command of the host computer;And after the USB response is returned to the host computer by second sending module, etc.
USB command to be received from the host computer;
The first tissue module, specifically for being received within a preset time when first receiving module from described upper
After the USB command of machine, according to the protocol type of the bluetooth security equipment and the USB command tissue Bluetooth commands;
The first detection module, for being not received by within a preset time when first receiving module from described upper
After the USB command of machine, detect whether to have disconnected with the bluetooth security equipment;
First reseting module, for resetting after the first detection module is detected as being;
First search module is also used to after first reseting module resets, and search matches with default device identification
Bluetooth security equipment.
18. Bluetooth adapter according to claim 10, which is characterized in that the usb protocol be specially CCID protocol or
SCSI protocol or HID protocol.
19. a kind of working method of Bluetooth adapter, which is characterized in that the Bluetooth adapter includes control chip, bluetooth core
Piece and USB module;The method includes:
Step y1:The control chip sends poll instruction to the Bluetooth chip, and the Bluetooth chip receives poll instruction
Later, it searches for the bluetooth security equipment to match with default device identification and establishes a connection, returned to the control chip
Poll repeat-back;
Step y2:The control chip initiation USB module states to host computer the usb protocol of itself by the USB module
Mark;
Step y3:The control chip receives the USB command from host computer by the USB module;
Step y4:The control chip is according to the protocol type and the second preset protocol of the bluetooth security equipment to the USB
Instruction is packaged, and obtains instruction encapsulation of data;
Step y5:Described instruction encapsulation of data is sent to the Bluetooth chip by the control chip;
Step y6:The Bluetooth chip obtains Bluetooth commands from described instruction encapsulation of data;
Step y7:The Bluetooth chip sends Bluetooth commands to bluetooth security equipment;It receives from the bluetooth security equipment
Bluetooth response;
Step y8:The Bluetooth chip encapsulates the bluetooth response according to the second preset protocol, obtains response encapsulation of data;
Step y9:The Bluetooth chip sends the response encapsulation of data to the control chip;
Step y10:The control chip is assisted according to the response encapsulation of data and the USB to match with usb protocol mark
Discuss tissue USB response;
Step y11:The USB response is returned to the host computer by the USB module by the control chip;
Further include after the step y1:The control chip judges whether to receive from the Bluetooth chip the and described indigo plant
The information that tooth safety equipment has disconnected resets control chip, return step y1 if it is, resetting Bluetooth chip;It is no
Then, it continues to determine whether to receive the information that from the Bluetooth chip the and described bluetooth security equipment has disconnected.
20. according to the method for claim 19, which is characterized in that after the step y1, further include:The control chip
It is sent to the Bluetooth chip and obtains bluetooth security device identification instruction;The Bluetooth chip is returned to the control chip
The response of first protocol-identifier of the bluetooth security equipment;
The step y4 is specially:The control chip is according to association corresponding with the first protocol-identifier of the bluetooth security equipment
View type and the second preset protocol are packaged the USB command, obtain described instruction encapsulation of data.
21. according to the method for claim 19, which is characterized in that the step y4 is specially:The control chip obtains
Effective instruction data in the USB command, according to the protocol type of the bluetooth security equipment and the second preset protocol to institute
It states effective instruction data to be packaged, obtains instruction encapsulation of data;
The step y10 is specially:The control chip unseals the response encapsulation of data, obtains the response encapsulation
Effective response data in data include the effective response according to the usb protocol tissue to match with usb protocol mark
The USB response of data.
22. according to the method for claim 19, which is characterized in that the step y4 is specially:The control chip obtains
Effective instruction data in the USB command, according to the protocol type of the bluetooth security equipment to the effective instruction data
It is packaged, obtains the first encapsulation of data;First encapsulation of data is packaged according to second preset protocol, is obtained
Instruct encapsulation of data;
The step y6 is specially:The Bluetooth chip obtains the first encapsulation of data from described instruction encapsulation of data, will be described
First encapsulation of data is as Bluetooth commands.
23. according to the method for claim 19, which is characterized in that the step y10 is specially:The control chip is to institute
It states response encapsulation of data to be unsealed, obtains the bluetooth response, institute is obtained according to the protocol type of the bluetooth security equipment
The effective response data in bluetooth response are stated, are had according to the usb protocol tissue to match with usb protocol mark including described
Imitate the USB response of reply data.
24. according to method described in claim 21 or 22 or 23, which is characterized in that after the step y1, the step y4
Further include before:The control chip is sent to the Bluetooth chip obtains bluetooth security device identification instruction;The bluetooth core
Piece returns to the response of the first protocol-identifier including the bluetooth security equipment to the control chip;
After the step y3, further include:The control chip judges that the usb protocol identifies whether and first Protocol Standard
Sensible matching executes following steps when usb protocol mark matches with first protocol-identifier:
Step m1:The control chip is packaged the USB command according to the second preset protocol, obtains instruction encapsulation number
According to;
Step m2:Described instruction encapsulation of data is sent to Bluetooth chip by the control chip;
Step m3:The Bluetooth chip unseals described instruction encapsulation of data, obtains the USB command;
Step m4:The Bluetooth chip sends the USB command to the bluetooth security equipment;It receives and comes from the bluetooth security
The USB response of equipment;
Step m5:The Bluetooth chip encapsulates the USB response according to the second preset protocol, obtains response encapsulation of data;
Step m6:The Bluetooth chip sends the response encapsulation of data to the control chip;
Step m7:The control chip unseals the response encapsulation of data, obtains the USB response;
Step m8:The USB response is returned to the host computer by the USB module by the control chip;
When usb protocol mark is mismatched with first protocol-identifier, step y4 is executed.
25. according to the method for claim 19, which is characterized in that after the step y1, also wrapped before the step y2
It includes:The control chip is sent to the Bluetooth chip obtains bluetooth security device identification instruction;The Bluetooth chip is to described
Control the response that chip returns to the first protocol-identifier including the bluetooth security equipment;
The step y2 is specially:The control chip initiation USB module sets first for the usb protocol mark of itself
Protocol-identifier states to host computer the first protocol-identifier of itself by the USB module;
The step y4 is specially:The control chip is packaged the USB command according to the second preset protocol, is referred to
Enable encapsulation of data;
The step y6 is specially:The Bluetooth chip unseals described instruction encapsulation of data to obtain the USB command;
The step y7 is specially:The Bluetooth chip is using the USB command as Bluetooth commands, to the bluetooth security equipment
Send the Bluetooth commands;Receive the bluetooth response from the bluetooth security equipment;
The step y10 is specially:The control chip obtains the bluetooth response from the response encapsulation of data, will be described
Bluetooth response is as USB response.
26. according to the method for claim 19, which is characterized in that the protocol type of the bluetooth security equipment is default
's;
When the protocol type of the bluetooth security equipment is matched with usb protocol mark:
The step y4 is specially:The control chip is packaged the USB command according to the second preset protocol, is referred to
Enable encapsulation of data;
The step y6 is specially:The Bluetooth chip obtains USB command from described instruction encapsulation of data, and the USB is referred to
It enables and is used as Bluetooth commands;
The step y10 is specially:The control chip obtains the bluetooth response from the response encapsulation of data, will be described
Bluetooth response is as USB response;
When the protocol type of the bluetooth security equipment and usb protocol mark mismatch:
The step y4 is specially:The control chip obtains the effective instruction data in the USB command, according to the bluetooth
The protocol type of safety equipment and the second preset protocol are packaged the effective instruction data, obtain instruction encapsulation of data;
The step y10 is specially:The control chip unseals the response encapsulation of data, obtains the bluetooth response
In effective response data, include the effective response data according to the usb protocol tissue that matches of usb protocol mark
USB response.
27. according to the method for claim 19, which is characterized in that the step y3 is specially:The control chip waits
The USB command from the host computer is received to hold after being received within a preset time from the USB command of the host computer
Row step y4;After being not received by within a preset time from the USB command of the host computer, judges whether to receive and come from
The information that the Bluetooth chip the and described bluetooth security equipment has disconnected, if it is, the reset Bluetooth chip, multiple
Position control chip, return step y1;Otherwise, it continues waiting for receiving the USB command from the host computer;
After the step y11, return step y3.
28. according to the method for claim 19, which is characterized in that the usb protocol is specially CCID protocol or SCSI association
View or HID protocol.
29. a kind of Bluetooth adapter, which is characterized in that including:Control chip, Bluetooth chip and USB module;
The control chip includes:First transmission unit, the first initialization unit, the first receiving unit, the first tissue unit,
Two transmission units, minor microstructure unit and third transmission unit
First transmission unit, for sending poll instruction to the Bluetooth chip;
First initialization unit, for receiving the instruction of the poll from the Bluetooth chip when first receiving unit
After response, USB module is initialized, states that the usb protocol of itself identifies to host computer by the USB module;
First receiving unit, for receiving the poll repeat-back from the Bluetooth chip;It is connect by the USB module
Receive the USB command from host computer;Receive the response encapsulation of data from the Bluetooth chip;
The first tissue unit, for the protocol type and the second preset protocol according to the bluetooth security equipment to described
USB command is packaged, and obtains instruction encapsulation of data;
Second transmission unit, for described instruction encapsulation of data to be sent to the Bluetooth chip;
The minor microstructure unit, for being assisted according to the response encapsulation of data from the Bluetooth chip and with the USB
It assesses a bid for tender sensible matched usb protocol tissue USB response;
The third transmission unit, for the USB response to be returned to the host computer by the USB module;
The Bluetooth chip includes:Second receiving unit, the first search unit, the first connection unit, the 4th transmission unit, third
Receiving unit, second acquisition unit, the 5th transmission unit, the 4th receiving unit, third organizational unit and the 6th transmission unit;
Second receiving unit, for receiving the poll instruction from control chip;
First search unit, for searching for and default equipment after second receiving unit receives poll instruction
Identify the bluetooth security equipment to match;
First connection unit, for establishing connection with the bluetooth security equipment,
4th transmission unit, for returning to poll repeat-back to the control chip;
Third receiving unit, for receiving the instruction encapsulation of data from the control chip;
The second acquisition unit, for obtaining Bluetooth commands from described instruction encapsulation of data;
5th transmission unit, for sending the Bluetooth commands that second acquisition unit is got to bluetooth security equipment;
4th receiving unit, for receiving the bluetooth response from the bluetooth security equipment;
The third organizational unit is answered for encapsulating the bluetooth that the 4th receiving unit receives according to the second preset protocol
It answers, obtains response encapsulation of data;
6th transmission unit sends the response encapsulation of data to the control chip;
The control chip further includes:Third judging unit and the second reset unit;
The third judging unit, for when the 4th transmission unit to the control chip return poll repeat-back after with
And itself judge after being not received by the information that from the Bluetooth chip the and described bluetooth security equipment has disconnected,
Judge whether to receive the information that from the Bluetooth chip the and described bluetooth security equipment has disconnected;
Second reset unit resets institute for after the third judging unit is judged as YES, resetting the Bluetooth chip
State control chip;
First transmission unit is also used to reset the Bluetooth chip when second reset unit, resets the control core
After piece, poll instruction is sent to the Bluetooth chip.
30. Bluetooth adapter according to claim 29, which is characterized in that the control chip further includes that the 7th transmission is single
Member;The Bluetooth chip further includes the 8th transmission unit;
7th transmission unit, for the 4th transmission unit when the Bluetooth chip to the control chip Returning wheel
After asking repeat-back, is sent to the Bluetooth chip and obtain bluetooth security device identification instruction;
8th transmission unit, for returning to the first protocol-identifier including the bluetooth security equipment to the control chip
Response;
The first tissue unit, specifically for according to protocol class corresponding with the first protocol-identifier of the bluetooth security equipment
Type and the second preset protocol are packaged the USB command, obtain described instruction encapsulation of data.
31. Bluetooth adapter according to claim 29, which is characterized in that the first tissue unit, specifically for obtaining
The effective instruction data in the USB command are taken, according to the protocol type and the second preset protocol pair of the bluetooth security equipment
The effective instruction data are packaged, and obtain instruction encapsulation of data;
The minor microstructure unit is obtained specifically for unsealing to the response encapsulation of data from the Bluetooth chip
The effective response data in the bluetooth response are taken, include institute according to the usb protocol tissue to match with usb protocol mark
State the USB response of effective response data.
32. Bluetooth adapter according to claim 29, which is characterized in that the first tissue unit, specifically for obtaining
The effective instruction data in the USB command are taken, according to the protocol type of the bluetooth security equipment to the effective instruction number
According to being packaged, the first encapsulation of data is obtained;First encapsulation of data is packaged according to second preset protocol, is obtained
To instruction encapsulation of data;
The second acquisition unit, specifically for obtaining the first encapsulation of data from described instruction encapsulation of data, by described first
Encapsulation of data is as Bluetooth commands.
33. Bluetooth adapter according to claim 29, which is characterized in that the minor microstructure unit, be specifically used for pair
The response encapsulation of data is unsealed, and the bluetooth response is obtained, and is obtained according to the protocol type of the bluetooth security equipment
Effective response data in the bluetooth response include described according to the usb protocol tissue to match with usb protocol mark
The USB response of effective response data.
34. according to Bluetooth adapter described in claim 31 or 32 or 33, which is characterized in that the control chip further includes
Nine transmission units, the first judging unit, the first encapsulation unit, the 11st transmission unit, the second deblocking unit and the 14th are sent
Unit;The Bluetooth chip further include the tenth transmission unit, first deblocking unit, the second encapsulation unit, the 12nd transmission unit,
5th receiving unit and the 13rd transmission unit;
9th transmission unit, for the 4th transmission unit when the Bluetooth chip to the control chip Returning wheel
After asking repeat-back, before the first tissue unit is packaged the USB command, sends and obtain to the Bluetooth chip
Bluetooth security device identification instruction;
Tenth transmission unit, for returning to the first protocol-identifier including the bluetooth security equipment to the control chip
Response;
First judging unit, for receiving the USB from host computer by the USB module when first receiving unit
After instruction, judge that the usb protocol identifies whether to match with first protocol-identifier;When first judging unit determines
After no, the first tissue unit is triggered;
First encapsulation unit, for after first judging unit is judged to being, according to the second preset protocol to described
USB command is packaged, and obtains instruction encapsulation of data;
11st transmission unit, for described instruction encapsulation of data to be sent to Bluetooth chip;
The first deblocking unit obtains the USB command for unsealing to described instruction encapsulation of data;
12nd transmission unit, for sending the USB command to the bluetooth security equipment;
5th receiving unit, for receiving the USB response from the bluetooth security equipment;
Second encapsulation unit obtains response encapsulation of data for encapsulating the USB response according to the second preset protocol;
13rd transmission unit, for sending the response encapsulation of data to the control chip;
The second deblocking unit obtains the USB response for unsealing to the response encapsulation of data;
14th transmission unit, for the USB response to be returned to the host computer by the USB module.
35. Bluetooth adapter according to claim 29, which is characterized in that the control chip further includes the 15th transmission
Unit;The Bluetooth chip further includes the 16th transmission unit;
15th transmission unit is returned for the 4th transmission unit when the Bluetooth chip to the control chip
After poll repeat-back, first initialization unit states that the usb protocol of itself identifies to host computer by the USB module
Before, it is sent to the Bluetooth chip and obtains bluetooth security device identification instruction;
16th transmission unit, for returning to the first Protocol Standard including the bluetooth security equipment to the control chip
The response of knowledge;
First initialization unit is specifically used for initialization USB module, sets the first association for the usb protocol mark of itself
It assesses a bid for tender knowledge, the first protocol-identifier of itself is stated to host computer by the USB module;
The first tissue unit obtains instruction envelope specifically for being packaged according to the second preset protocol to the USB command
Fill data;
The second acquisition unit obtains the USB command specifically for unsealing to described instruction encapsulation of data;
5th transmission unit is specifically used for sending using the USB command as Bluetooth commands to the bluetooth security equipment
The Bluetooth commands;
The minor microstructure unit, specifically for obtaining the bluetooth response from the response encapsulation of data, by the bluetooth
Response is as USB response.
36. Bluetooth adapter according to claim 29, which is characterized in that the protocol type of the bluetooth security equipment is
It is preset;
The first tissue unit, specifically for when the protocol type of the bluetooth security equipment and usb protocol mark
Timing is packaged the USB command according to the second preset protocol, obtains instruction encapsulation of data;When the bluetooth security is set
When standby protocol type and usb protocol mark mismatch, the effective instruction data in the USB command are obtained, according to institute
The protocol type and the second preset protocol for stating bluetooth security equipment are packaged the effective instruction data, obtain instruction encapsulation
Data;
The second acquisition unit, specifically for when the protocol type of the bluetooth security equipment and usb protocol mark
Timing obtains USB command, using the USB command as Bluetooth commands from described instruction encapsulation of data;When the bluetooth is pacified
When the protocol type and usb protocol mark of full equipment mismatch, from described instruction encapsulation of data, Bluetooth commands are obtained;
The minor microstructure unit, specifically for when the protocol type of the bluetooth security equipment and usb protocol mark
Timing obtains the bluetooth response from the response encapsulation of data, using the bluetooth response as USB response;When the indigo plant
When the protocol type of tooth safety equipment and usb protocol mark mismatch, the response encapsulation of data is unsealed, is obtained
Effective response data in the bluetooth response include described according to the usb protocol tissue to match with usb protocol mark
The USB response of effective response data.
37. Bluetooth adapter according to claim 29, which is characterized in that the control chip further includes the second judgement list
Member and the first reset unit;First receiving unit includes that the first receiving subelement, the second receiving subelement and third receive
Subelement;
First receiving subelement, for stating that the usb protocol of itself identifies to host computer when first initialization unit
Afterwards, the USB command to be received from the host computer is waited;After the second judgment unit is judged as NO, to be received come from is waited
The USB command of the host computer;And after the USB response is returned to the host computer by the third transmission unit, etc.
USB command to be received from the host computer;
Second receiving subelement, for receiving the poll repeat-back from the Bluetooth chip;
The third receiving subelement, for receiving the response encapsulation of data from the Bluetooth chip;
The first tissue unit, specifically for being received within a preset time when first receiving unit from described upper
After the USB command of machine, the USB command is sealed according to the protocol type of the bluetooth security equipment and the second preset protocol
Dress;
The second judgment unit, for being not received by within a preset time when first receiving unit from described upper
After the USB command of machine, judge whether to receive what from the Bluetooth chip the and described bluetooth security equipment had disconnected
Information;
First reset unit resets institute for after the second judgment unit is judged as YES, resetting the Bluetooth chip
State control chip.
38. Bluetooth adapter according to claim 29, which is characterized in that the usb protocol be specially CCID protocol or
SCSI protocol or HID protocol.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610864548.XA CN106301488B (en) | 2016-09-29 | 2016-09-29 | A kind of Bluetooth adapter and its working method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610864548.XA CN106301488B (en) | 2016-09-29 | 2016-09-29 | A kind of Bluetooth adapter and its working method |
Publications (2)
Publication Number | Publication Date |
---|---|
CN106301488A CN106301488A (en) | 2017-01-04 |
CN106301488B true CN106301488B (en) | 2018-11-20 |
Family
ID=57715455
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610864548.XA Active CN106301488B (en) | 2016-09-29 | 2016-09-29 | A kind of Bluetooth adapter and its working method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN106301488B (en) |
Families Citing this family (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107135476B (en) * | 2017-06-27 | 2018-12-11 | 飞天诚信科技股份有限公司 | A kind of Bluetooth adapter and its working method |
CN109428658A (en) * | 2017-08-29 | 2019-03-05 | 深圳市美好创亿医疗科技有限公司 | Bluetooth equipment Performance Test System and test method |
CN107885674B (en) * | 2017-10-18 | 2020-05-29 | 北京明华联盟科技有限公司 | Bluetooth device simulator, working method thereof and Bluetooth device operating system |
CN112770307A (en) * | 2020-12-31 | 2021-05-07 | 重庆百瑞互联电子技术有限公司 | Multi-mode Bluetooth adapter and working method thereof |
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104346722A (en) * | 2014-10-27 | 2015-02-11 | 飞天诚信科技股份有限公司 | Mobile payment terminal supporting Bluetooth communication and work method of mobile payment terminal |
Family Cites Families (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
AU2003300880A1 (en) * | 2002-12-12 | 2004-07-09 | Flexiworld Technologies, Inc. | Wireless communication between computing devices |
US20130031392A1 (en) * | 2011-07-29 | 2013-01-31 | Mclane William J | Usb device side wake-up for power conservation and management |
CN105005540B (en) * | 2015-05-22 | 2018-01-05 | 飞天诚信科技股份有限公司 | A kind of CCID equipment and its method of work with blue tooth interface |
CN105162498B (en) * | 2015-09-28 | 2018-09-25 | 飞天诚信科技股份有限公司 | Bluetooth adapter and its communication means |
CN205608729U (en) * | 2016-04-19 | 2016-09-28 | 飞天诚信科技股份有限公司 | Integral type bluetooth key |
-
2016
- 2016-09-29 CN CN201610864548.XA patent/CN106301488B/en active Active
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104346722A (en) * | 2014-10-27 | 2015-02-11 | 飞天诚信科技股份有限公司 | Mobile payment terminal supporting Bluetooth communication and work method of mobile payment terminal |
Also Published As
Publication number | Publication date |
---|---|
CN106301488A (en) | 2017-01-04 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN106301488B (en) | A kind of Bluetooth adapter and its working method | |
US9459604B2 (en) | Methods and system for joining a smart energy device to a zigbee network | |
US20050076150A1 (en) | Home network system and method for operating the same | |
CN106130770B (en) | Established using the simple connection of mixing networking of agent equipment | |
CN208158154U (en) | Fast charge line and fast charging system | |
CN104781750A (en) | Balloon-based positioning system and method | |
KR20040104305A (en) | Converting apparatus of home network system | |
CN105099844B (en) | Media releasing method, media data acquisition methods and media issuing system | |
CN101843079A (en) | Communicating a selection of a potential configuration | |
CN101252584B (en) | Authentication method, system and equipment for bidirectional forwarding detection protocol conversation | |
CN108200559A (en) | A kind of method and bluetooth equipment that bluetooth equipment function is represented by broadcast data | |
CN109768596B (en) | Electric quantity display method, earphone charging device and earphone | |
CN104980215A (en) | System and method for achieving WiFi configuration of intelligent equipment based on optical signal transmission | |
CN108616582A (en) | Pairing method, device and system of internal machine and wire controller | |
CN107943529A (en) | Equipment pairing method and device, readable storage medium and interactive intelligent equipment | |
CN106251609B (en) | Intelligent robot, networking method thereof, network sharing method and device | |
CN110167192A (en) | Bluetooth connection management method and device, electronic equipment and non-transient storage media | |
CN105933428A (en) | Method and device for communicating with apple terminal | |
US8266348B2 (en) | System and method of communicating with portable devices | |
CN101977244A (en) | Control method, device and system | |
CN110891260A (en) | Bluetooth connection method, equipment, terminal, system and storage medium | |
WO2021203759A1 (en) | Electroencephalogram acquisition system based on bluetooth separated architecture | |
CN105137777B (en) | Matching method and contrast means for wireless intelligent house equipment | |
WO2008093164A3 (en) | Communication system and method | |
CN106850003A (en) | A kind of system and method for detecting low-power consumption bluetooth proper communication |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |