Summary of the invention
The technical problem to be solved in the present invention is to overcome the deficiency that above-mentioned prior art exists, and proposes a kind of card writing method and read-write card system, to solve the poor problem of bluetooth read-write mobility based on the Android system of the prior art.
For solving the problems of the technologies described above, the present invention proposes a kind of card writing method, and the terminal of operation Android system writes card image by the Bluetooth control card reader/writer in card, and the described method of writing card comprises: described terminal connects card reader/writer by bluetooth; Described terminal judges type of card by card reader/writer; Can described terminal obtain the card read-write state by card reader/writer and write with the judgement card; If can be described terminal sends instruction and carries out card to card reader/writer and write card image.
Preferably, terminal comprises by the step that bluetooth connects card reader/writer: described terminal sends link information by bluetooth to card reader/writer; Described terminal and bluetooth card reader/writer match; Described terminal is accepted the successful matching information of card reader/writer feedback.
Preferably, terminal judges that by card reader/writer the step of type of card comprises: described terminal sends instruction by bluetooth and to card reader/writer, the card in card reader/writer is carried out electrification reset; Described terminal is accepted the ATR information of card reader/writer feedback by bluetooth.
Preferably, can terminal obtain the card read-write state by card reader/writer and comprise with the judgement card step that write: described terminal sends instruction to card reader/writer by bluetooth, reads card mode information by card reader/writer; Described terminal is accepted the card mode information of card reader/writer feedback by bluetooth; Can described terminal judges card write.
Preferably, carry out the step that card writes to card reader/writer and comprise if can be described terminal sends instruction: described terminal sends instruction by bluetooth and carries out card to card reader/writer with the control card reader/writer and write card image; Described terminal is write the card successful information by what bluetooth was accepted card reader/writer feedback.
The present invention also provides a kind of read-write card system, and described read-write card system comprises terminal and bluetooth card reader/writer, and described terminal comprises the processor of operation Android system, described terminal be connected card reader/writer and connect by bluetooth.
Preferably, the bluetooth card reader/writer comprises: controller; The bluetooth serial ports converter, described bluetooth serial ports converter connects described controller, and described bluetooth serial ports converter is accepted instruction and is converted the signal type of controller to; Signal level converter, described signal level converter connects described controller, and the signal that described controller sends is changed; The IC-card seat, described IC-card seat connects described signal level converter, and described IC-card seat carries out read-write operation to IC-card.
Preferably, the bluetooth card reader/writer also comprises a power supply, and said power supply provides described bluetooth card reader/writer electric power.
Preferably, the bluetooth card reader/writer also comprises an electric pressure converter, and described electric pressure converter is connected between described power supply and described controller.
Preferably, power supply is 5V, and described electric pressure converter is transformed into 3.3V with supply voltage by 5V.
Compared with prior art, beneficial effect of the present invention comprises: the present invention is transmitted information between card reader/writer and Android system by bluetooth, thereby realized the wireless connections between Android system and card reader/writer, avoided the poor problem of mobility of the Mobile self-service terminal of employing of the prior art Android system.
Embodiment
In order to further illustrate principle of the present invention and structure, existing by reference to the accompanying drawings to a preferred embodiment of the present invention will be described in detail.
See also Fig. 1, the invention provides a kind of method of writing card, the terminal of the method operation Android system writes card image by the Bluetooth control card reader/writer in card, and described card writing method comprises:
Step S1: described terminal connects card reader/writer by bluetooth.
See also Fig. 2, step S1 comprises: step S11: described terminal sends link information by bluetooth to card reader/writer.
When needs used, at first the Android system sent link information to card reader/writer, and card reader/writer is ready to be connected with the Android system like this.
Step S12: described terminal and bluetooth card reader/writer match.
After card reader/writer receives link information, card reader/writer and Android system match, the effect of pairing is the correctness that guarantees connection, because connecting by bluetooth is wireless connections, when a plurality of bluetooth card reader/writer was arranged, pairing can be avoided occurring being connected on other bluetooth card reader/writer.
Step S13: described terminal is accepted the successful matching information of card reader/writer feedback.
After card reader/writer successfully matches and is connected to the Android system, feed back an information, represent the bluetooth successful connection after the Android system receives.
Step S2: described terminal judges type of card by card reader/writer.
See also Fig. 3, step S2 comprises: step S21: described terminal sends instruction by bluetooth and to card reader/writer, the card in card reader/writer is carried out electrification reset;
Electrification reset plays an initialized effect here, and the chip of card is restarted.
Step S22: described terminal is accepted the ATR information of card reader/writer feedback by bluetooth.
Can produce a series of character string (being ATR information) after the chip reset of card, to the Android system, the Android system judges the type of card to card reader/writer by ATR information with these ATR communications.
Step S3: can described terminal obtain the card read-write state by card reader/writer and write with the judgement card;
See also Fig. 4, step S3 comprises:
Step S31: described terminal sends instruction to card reader/writer by bluetooth, reads card mode information by card reader/writer.
In the chip of card, some data has represented the status information of card, and card reader/writer can read this part information.
Step S32: described terminal is accepted the card mode information of card reader/writer feedback by bluetooth.
The card mode information that the Android system receives feedback is namely known the state of card, judges then whether the storage of card is full.
Step S33: can described terminal judges card write.
Step S4: carry out card to card reader/writer and write card image if can be described terminal sends instruction.In the present embodiment, if the transmission of card instruction can not can not be write, in other embodiments, can add other response mode, such as sending prompting.
See also Fig. 5, step S4 comprises: step S41: described terminal sends instruction by bluetooth and carries out card and write card image to control card reader/writer to card reader/writer.
Step S42: described terminal is write the card successful information by what bluetooth was accepted card reader/writer feedback.
When writing when complete, card reader/writer can feed back one and write the card successful information, just can learn after the Android system has received to have write successfully.
In once writing the card process normally, step S4 need to carry out repeatedly.
The present invention also provides a kind of read-write card system, sees also Fig. 6, and described read-write card system comprises terminal 2 and bluetooth card reader/writer 1, described terminal 2 be connected card reader/writer 1 and connect by bluetooth.
Bluetooth card reader/writer 1, described bluetooth card reader/writer comprises controller 11, signal level converter 12, IC-card seat 13, bluetooth serial ports converter 14, power supply 15 and electric pressure converter 16.
Controller 11, the effect of controller 11 are other all parts of operation bluetooth card reader/writer, and process information.In the present embodiment, controller 11 is single-chip microcomputer, and concrete signal is STC89C52, and in other embodiments, the concrete model of controller 1 can change.
Signal level converter 12, described signal level converter 12 connects described controller 11, the signal that described controller 11 is sent carries out level conversion, because the level of the signal of controller 11 output is different from the level of IC-card seat, so need signal level converter 12 to change.
In the present embodiment, IC-card seat 13, described IC-card seat 13 connects described signal level converter 12, and 13 pairs of IC-cards of described IC-card seat carry out read-write operation.
Bluetooth serial ports converter 14, described bluetooth serial ports converter 14 connects described controller 11, and described bluetooth serial ports converter 14 is accepted instruction and is converted the signal type of controller 11 to.
Power supply 15, said power supply 15 provide described bluetooth card reader/writer electric power.In the present embodiment, power supply 15 is 5V, in other embodiments, can adopt the power supply of different voltages according to the difference of each accessory.In the present embodiment, power supply 15 is dry cell, and in other embodiments, power supply 15 can be other power supply type.
Electric pressure converter 16, described electric pressure converter 16 is connected between described power supply 15 and described controller 11.So the power supply that needs due to controller 11 is 3.3V, electric pressure converter 16 is converted to 3.3V with the 5V of power supply 15 inputs.
Described terminal 2 comprises the processor (not shown) of operation Android system.
The Android system of terminal 2 sends instruction by bluetooth to bluetooth card reader/writer 1, matches, checks that card mode information has write etc. function.
In sum, the present invention is transmitted information between card reader/writer and Android system by bluetooth, thereby realized the wireless connections between Android system and card reader/writer, avoided the poor problem of mobility of the Mobile self-service terminal of employing of the prior art Android system.
The above is only better possible embodiments of the present invention, and unrestricted protection scope of the present invention.Every equivalent structure or equivalent flow process conversion that utilizes instructions of the present invention and accompanying drawing content to do, or directly or indirectly be used in other relevant technical fields, all in like manner be included in scope of patent protection of the present invention.