Nothing Special   »   [go: up one dir, main page]

CN108288008B - Card activation method and device - Google Patents

Card activation method and device Download PDF

Info

Publication number
CN108288008B
CN108288008B CN201810130108.0A CN201810130108A CN108288008B CN 108288008 B CN108288008 B CN 108288008B CN 201810130108 A CN201810130108 A CN 201810130108A CN 108288008 B CN108288008 B CN 108288008B
Authority
CN
China
Prior art keywords
card
submodule
command
module
sending
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
Application number
CN201810130108.0A
Other languages
Chinese (zh)
Other versions
CN108288008A (en
Inventor
陆舟
于华章
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Feitian Technologies Co Ltd
Original Assignee
Feitian Technologies Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Feitian Technologies Co Ltd filed Critical Feitian Technologies Co Ltd
Priority to CN201810130108.0A priority Critical patent/CN108288008B/en
Publication of CN108288008A publication Critical patent/CN108288008A/en
Application granted granted Critical
Publication of CN108288008B publication Critical patent/CN108288008B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K7/00Methods or arrangements for sensing record carriers, e.g. for reading patterns
    • G06K7/10Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation
    • G06K7/10009Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation sensing by radiation using wavelengths larger than 0.1 mm, e.g. radio-waves or microwaves
    • G06K7/10019Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation sensing by radiation using wavelengths larger than 0.1 mm, e.g. radio-waves or microwaves resolving collision on the communication channels between simultaneously or concurrently interrogated record carriers.
    • G06K7/10079Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation sensing by radiation using wavelengths larger than 0.1 mm, e.g. radio-waves or microwaves resolving collision on the communication channels between simultaneously or concurrently interrogated record carriers. the collision being resolved in the spatial domain, e.g. temporary shields for blindfolding the interrogator in specific directions

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Health & Medical Sciences (AREA)
  • Toxicology (AREA)
  • General Health & Medical Sciences (AREA)
  • Electromagnetism (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Artificial Intelligence (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Credit Cards Or The Like (AREA)
  • Mobile Radio Communication Systems (AREA)

Abstract

The invention relates to the field of communication, in particular to a method and a device for activating a card, wherein the method comprises the following steps: the card reader sends a card searching command; when card searching response is received, judging whether the work field is provided with a plurality of cards according to the card searching response, if so, setting the multi-card flag bit, otherwise, resetting the multi-card flag bit, continuing anti-collision operation to select the card, numbering the selected card, and storing the card number; activating the selected card according to the card number, judging whether a multi-card flag bit is set after activation is successful, if so, continuing to send a card searching instruction, otherwise, successfully activating the multi-card; by the card activation method and device, the card reader can activate a plurality of cards in a card swiping area, so that the performance of the card reader is improved, and the user experience is improved.

Description

Card activation method and device
Technical Field
The present invention relates to the field of communications, and in particular, to a method and an apparatus for activating a card.
Background
Near Field Communication (NFC), also called near Field communication, is a short-range high-frequency wireless communication technology, which allows data exchange between electronic devices in a non-contact manner.
With the widespread use of NFC cards, everyone may have many NFC cards, such as bank cards, bus cards, access cards, meal cards, and the like, at the same time. When a card is swiped, the card reader can only activate one card, and when a plurality of cards are placed in a card swiping area at the same time, the problem that the card reader cannot identify the cards or identifies the cards wrongly occurs; making the user experience poor in some situations where NFC communication is used.
Disclosure of Invention
In order to solve the above technical problem, the present invention provides a method and an apparatus for activating a card, wherein the method for activating a card includes:
step S1, the card reader sends a card searching command;
step S2, the card reader receives the card searching response, whether the work field is a plurality of cards is judged according to the card searching response, if yes, the multi-card flag bit is set, step S3 is executed, and if not, the multi-card flag bit is reset, and step S3 is executed;
step S3, the card reader performs anti-collision operation to select a card, numbers the selected card, and stores the card number;
step S4, the card reader executes activation operation to the selected card according to the card number, and executes step S5 when the activation is successful;
and step S5, the card reader judges whether the flag bit of the multi-card is set, if so, the step S1 is returned, otherwise, the multi-card activation is successful, and the operation is finished.
A card-activated device, comprising:
the sending module is used for sending a card searching command;
a receiving module for receiving the card-searching response
The first judgment module is used for judging whether the workplace is a plurality of cards according to the card searching response received by the receiving module;
the setting module is used for setting the multi-card flag position when the first judgment module judges that the work field contains a plurality of cards;
the reset module is used for resetting the multi-card flag bit when the first judgment module judges that the plurality of cards are not in the workplace;
the numbering module is used for selecting the cards through anti-collision operation, numbering the selected cards and storing the card numbers;
the activation module is used for executing activation operation on the selected card according to the card number stored by the number module;
the second judging module is used for judging whether the flag bit of the multi-card is set after the activation module successfully activates the card, and triggering the sending module when the flag bit of the multi-card is set; and when the flag bit of the multi-card is judged to be reset, the multi-card is successfully activated, and the method is ended.
The invention has the beneficial effects that: the invention provides a card activation method and device, and a card reader can activate a plurality of cards in a card swiping area through the card activation method and device, so that the performance of the card reader is improved, and the user experience is improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to these drawings without creative efforts.
Fig. 1 is a flowchart of a method for activating a card according to embodiment 1 of the present invention;
fig. 2 to fig. 3 are flowcharts of a method for activating a card according to embodiment 2 of the present invention;
fig. 4 is a block diagram of an apparatus for activating a card according to embodiment 3 of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Example 1
The embodiment provides a card activation method, as shown in fig. 1, including:
a1, starting the card reader, initializing a radio frequency chip of the card reader, and setting an initial value of a card number; when a card information acquisition command sent by the upper computer is received, executing the step A2;
specifically, the card reader sets the initial value of the card number to 0;
step A2, the card reader starts a work field to send a card searching command, whether a card searching response is received is judged, if yes, the step A3 is executed, and if not, the step A2 is continuously executed;
specifically, the card searching command sent by the card reader is 26;
it should be noted that, when the card receives a card searching command, the state of the card is converted from an idle state to a preparation state;
step A3, the card reader judges whether the work field is a plurality of cards according to the received card searching response, if yes, the flag bit of the plurality of cards is set, step A4 is executed, otherwise, the flag bit of the plurality of cards is reset, and step A4 is executed;
specifically, the card reader detects whether bit frame collision exists in returned card searching response, if yes, a plurality of cards are judged in the working field, and if not, only one card is judged in the working field;
more specifically, the card reader judges whether the first bit to the fifth bit in the returned card searching response are 1, if so, the card reader judges that a plurality of cards exist in the working field, and otherwise, the card reader judges that only one card exists in the working field.
Step A4, the card reader sends a selection command;
the selection command sent by the card reader comprises a selection code and a preset number of valid bits;
it should be noted that the length of the selected code is one byte;
in this embodiment, the selection code is 93; note that, the card id, i.e., the card UID (english name: Unique identifier) in the present embodiment is composed of 4 UID bytes:
the number of valid bits is used to represent the length of the entire command; the number of significant bits is one byte in length; the upper four bits of the number of significant bits are the byte count; the lower four bits are the bit count;
in this embodiment, the number of valid bits preset in the selection command is specifically 20; 20 indicates that the length of the select command sent by the reader is 2 bytes.
Step a4 specifically, the card reader organizes a selection command according to the selection code 93 and the number 20 of the preset valid bits, and the selection command is 9320 specifically;
a5, the card reader receives the card UID returned by the card in the work field, detects whether the card UID conflicts, if yes, the step A6 is executed, otherwise, the selected card UID is determined, and the step A8 is executed;
the cards UID returned by the received cards in this embodiment are specifically 01020304 and 02020304;
step A6, the card reader detects the first position where the conflict occurs, determines the valid bit according to the first position where the conflict occurs, and sends an anti-conflict command containing the valid bit;
the anti-collision command specifically includes a selection code, a number of valid bits, and a valid bit;
it should be noted that, in this embodiment, the card reader selects the card UID whose first collision bit is 1 by default when a collision occurs;
in this embodiment, the card reader detects the obtained cards UID 01020304 and 02020304 to obtain that the first position where a collision occurs is the 1 st bit of the 1 st byte, and calculates the number of valid bits to be 21 according to the valid bit determined by the first position where a collision occurs to be 1; the anti-collision command, specifically 93211, is organized according to the selection code 93, the number of significant bits 21 and the significant bit 1.
It should be noted that, the number of significant bits is calculated as the sum of the length of the selection code, the length of the number of significant bits, and the length of the significant bits; in this embodiment, the length of the selection code 93 is 1 byte, the length of the number of significant bits is 1 byte, the length of the significant bits is 1 bit, and the sum of the length of the selection code, the length of the number of significant bits, and the length of the significant bits is 2 bytes and 1 bit, so that the number of significant bits is 21.
Step A7, the card reader receives data returned by the card whose UID is matched with the valid bit in the work field, whether further conflict occurs is detected, if yes, the step A6 is returned, otherwise, the selected card UID is determined, and the step A8 is executed;
the card returns the remaining cards UID except the first conflict position, and specifically, the card reader detects whether further conflict occurs according to the returned remaining cards UID;
for example, the remaining cards UID returned by the card is 00000000203; when the card reader detects that no further collision occurs, determining that the UID of the selected card is 010203;
the working state of the card whose UID is matched with the valid bit in the work field is continuously kept in the preparation state, and the working state of the card whose UID is not matched with the valid bit in the work field is converted into the idle state from the preparation state; furthermore, the card in the work field whose UID is not matched with the valid bit does not respond to the command of the anti-collision stage sent by the card reader; such as a select command, an anti-collision command, a card selection command, and a card activation command.
Step A8, the card reader sends a card selection command containing the selected card UID;
the card selection command sent by the card reader specifically comprises: selecting a code, the number of valid bits, the selected card UID and a check value;
in this embodiment, the card reader sequentially splices the selection code 93, the number of significant bits 70, the selected card UID 01020304, and the check value BCC to obtain a card selection command, specifically 937001020304 BCC;
note that the check value BCC is an exclusive or value of 4 bytes of data before the check value, that is, an exclusive or value of the selected card UID 01020304.
Step A9, the card reader receives a card selection confirmation response returned by the card in the workplace, whether the UID of the card is complete is judged according to the card selection confirmation response, if so, the step A10 is executed, and if not, error reporting is finished;
specifically, the card reader receives a card selection confirmation response returned by the card, acquires a third bit of a low-order end of the card selection confirmation response, judges whether the third bit of the low-order end is 1, judges whether the UID of the card is incomplete if the third bit of the low-order end is 1, and judges whether the UID of the card is complete if the third bit of the low-order end is 1;
for example, when the card selection confirmation response received by the card reader is 00, the card UID is determined to be complete, and when the card selection confirmation response received by the card reader is 04, the card UID is determined to be incomplete;
in this embodiment, the card-selection confirmation response received by the card reader is 04, the card UID is determined to be incomplete, and error reporting is completed;
step A10, the card reader updates the card number in an incremental mode and sends a card activation command containing the updated card number;
it should be noted that the card reader selects the card whose card UID is 01020304, and only the card is in the preparation state in the work field;
the card activation command sent by the card reader is specifically 0E 01;
step A11, the card reader receives response data returned by the card, and judges whether the activation is successful according to the response data, if so, the step A12 is executed, otherwise, the step A2 is returned;
note that the operation state of the card whose card UID is 01020304 is changed from the ready state to the active state.
And step A12, the card reader judges whether the flag bit of the multi-card is set, if so, the step A2 is returned, otherwise, the multi-card activation is successful, and the operation is finished.
Specifically, the card reader judges whether the multi-card zone bit is 1, if so, the multi-card zone bit is set, otherwise, the multi-card zone bit is reset.
Preferably, in step A3, when the multi-card identification position is set, step a4 is executed; when the multi-card flag bit is reset, executing the step B1;
step B1, the card reader sends a selection command;
step B2, the card reader receives the UID returned by the card in the work field; and sending a card selection command including the UID;
and step B3, the card reader receives a card selection confirmation response returned by the card in the workplace, judges whether the UID of the card is complete or not according to the card selection confirmation response, if so, executes the step A10, and otherwise, error reporting is finished.
Preferably, after the multi-card activation, the method further comprises: the card reader acquires the card information of the corresponding card according to the card number stored by the card reader, and sends the acquired card information to the upper computer.
Optionally, step a2 is preceded by: the upper computer sends a card information acquisition command to the card reader; when the card reader receives the command of acquiring the card information, executing the step A2;
the card reader acquires the card information of the card corresponding to the card reader according to the card number stored by the card reader, and sends the acquired card information to the upper computer, and the card reader specifically comprises:
step C1, the card reader obtains a card number which is not obtained from all the card numbers stored by the card reader as a current card number, organizes a card reading command according to the current card number and sends the card reading command to the card;
step C2, the card reader receives card information returned by the card and sends the card information to the upper computer;
step C3: the upper computer receives the card information sent by the card reader and continuously sends a card information acquisition command to the card reader;
c4, the card reader judges whether there is any card number which is not obtained, if yes, the step C1 is returned, otherwise, the card information obtaining failure response is returned to the upper computer, and the process is ended
Further, step C3 specifically includes: and C4 is executed by the upper computer to judge whether the received card information is legal card information, if so, the authentication is successful, and if not, the authentication is failed, the card information is continuously acquired from the card reader.
Optionally, step a2 is preceded by: the upper computer sends a card information acquisition command to the card reader; when the card reader receives the card information acquisition command, executing the step A2;
the card reader obtains the card information of the card corresponding to the card reader according to the card number stored by the card reader, and the card reader specifically comprises:
step D1, the card reader obtains a card number which is not obtained from all the card numbers stored by the card reader as a current card number, organizes a card reading command according to the current card number and sends the card reading command to the card;
d2, the card reader receives card information returned by the card;
and D3, judging whether the card reader has the card number which is not acquired, if so, returning to the step D1, and if not, returning all the received card information to the upper computer.
Further, in step D3, after the card reader returns all the received card information to the upper computer, the method further includes: and the upper computer judges whether legal card information exists in all the received card information, if so, the authentication is successful, and the authentication is finished, otherwise, the authentication is failed, and the authentication is finished.
Preferably, step a2 is preceded by: the upper computer sends a card number acquiring command to the card reader; when the card reader receives the acquire card number command, step a2 is performed.
Correspondingly, after the multi-card activation succeeds, the method further comprises the following steps: and the card reader sends all card numbers stored by the card reader to the upper computer.
Furthermore, after the card reader sends the card number that self keeps to the host computer, still include: the card reader waits for receiving a card information acquisition instruction sent by the upper computer; and when the card information containing the card number sent by the upper computer is received, the card information of the corresponding card is obtained according to the card number in the card reading command, and the obtained card information is sent to the upper computer.
More specifically, after the card serial number that the card reader was saved self was sent the host computer, specifically included:
step E1, the upper computer acquires a card number which is not acquired from the received card numbers as a current card number, organizes an acquisition card information command according to the current card number, and sends the acquisition card information command to the card reader;
step E2, the card reader forwards the command of obtaining the card information to the card; step E3 is executed when the card information returned by the card is received;
e3, the card reader forwards the card information to an upper computer;
and E4, the upper computer receives the card information returned by the card reader and judges whether the card numbers which are not acquired exist in the received card numbers, if yes, the step E1 is returned, and if not, the step E1 is ended.
Preferably, step E4 further includes: the upper computer receives the card information forwarded by the card reader, judges whether the card information is legal or not, if so, the authentication is successful, and then the authentication is finished; otherwise, step E4 is performed.
Preferably, after the card information is acquired according to the card number, the method further includes: the card reader binds the card number and the card information corresponding to the card number to obtain binding information, and returns the binding information to the upper computer.
Specifically, after card information is acquired according to a card number, the method specifically includes:
step F1, the upper computer selects a card needing to be operated according to the card information in the received binding information, obtains a card number bound with the selected card according to the card information of the selected card, and organizes an operation instruction containing the obtained card number; sending an operation instruction to the card reader;
step F2, the card reader forwards the received operation instruction to the card; and after response data returned by the card are received, forwarding the response data to the upper computer.
Preferably, after the multi-card activation, the method further comprises: and the card reader acquires the card information of the corresponding card according to the card number stored by the card reader.
Step a2 is preceded by: when the card reader receives an external trigger signal, executing the step A2;
the card reader obtains the card information of the card corresponding to the card reader according to the card number stored by the card reader, and the card reader specifically comprises:
g1, the card reader acquires a card number which is not acquired from all card numbers stored by the card reader as a current card number, organizes a card reading command according to the current card number and sends the card reading command to the card;
g2, the card reader receives card information returned by the card;
and G3, judging whether the card reader has the card number which is not acquired, if so, returning to the step G1, and if not, ending.
Further, step G2 specifically includes: and the card reader judges whether the received card information is legal card information, if so, the authentication is successful, and the authentication is finished, otherwise, the authentication is failed, and the authentication is finished.
Example 2
The embodiment provides a card activation method, as shown in fig. 2 and 3, including:
step 101, a card reader initializes a radio frequency chip of the card reader and sets an initial value of a card number;
specifically, the card reader sets the initial value of the card number to 0;
102, the card reader starts a work field to send a card searching command, whether a card searching response is received is judged, if yes, step 103 is executed, and if not, step 102 is continuously executed;
specifically, the card reader sends a card searching command to be 26;
it should be noted that, when the card receives a card searching command, the state of the card is converted from an idle state to a preparation state;
step 103, the card reader judges whether the work field is provided with a plurality of cards according to the received card searching response, if so, the flag bit of the plurality of cards is set, step 104 is executed, otherwise, the flag bit of the plurality of cards is reset, and step 104 is executed;
specifically, the card reader detects whether bit frame collision exists in returned card searching response, if yes, a plurality of cards are judged in the working field, and if not, only one card is judged in the working field;
more specifically, the card reader judges whether the first bit to the fifth bit in the card searching response returned by the card are 1, if so, the card reader judges that a plurality of cards exist in the working field, and otherwise, the card reader judges that only one card exists in the working field.
104, the card reader sends a primary selection command;
the primary selection command sent by the card reader comprises a first selection code and a preset number of valid bits;
it should be noted that the length of the selected code is one byte;
in this embodiment, three levels of serial levels are set in the card reader:
the first selection code is 93; the primary selection command containing the first selection code indicates that the serial level selected by the card reader is 1, and the serial level 1 is used for performing anti-collision operation on the primary card UID of the card;
the second selection code is 95, the secondary selection command containing the second selection code indicates that the serial level selected by the card reader is 2, and the serial level 2 is used for performing anti-collision operation on the secondary card UID of the card;
the third selection code is 97, and a three-level selection command containing the third selection code indicates that the serial level selected by the card reader is 3; the tandem level 3 is used for performing an anti-collision operation on the tertiary card UID of the card.
It should be noted that the card UID is composed of 4, 7, or 10 UID bytes:
when the card UID consists of 4 UID bytes, the maximum serial level supported by the card is 1, and the primary card UID is the 1 st to 4 th bytes of the card UID;
when the card UID consists of 7 UID bytes, the maximum serial level supported by the card is 2, wherein the primary card UID is the serial identifier and the 1 st to 3 rd bytes of the card UID, and the secondary card UID is the 4 th to 7 th bytes of the card UID;
when the card UID is composed of 10 UID bytes, the maximum serial level supported by the card is 3, wherein the primary card UID is 1 st to 3 rd bytes of the serial identification and the card UID, the secondary card UID is 4 th to 6 th bytes of the serial identification and the card UID, and the tertiary card UID is 7 th to 10 th bytes of the card UID.
The number of valid bits is used to represent the length of the entire command; the number of significant bits is one byte in length; the upper four bits of the number of significant bits are the byte count; the lower four bits are the bit count;
in this embodiment, the number of valid bits preset in the primary selection command is specifically 20; 20 indicates that the primary select command sent by the reader is 2 bytes in length.
Step 104, specifically, the card reader organizes a primary selection command according to the first selection code 93 and the number 20 of the preset valid bits, and the primary selection command is 9320 specifically;
105, receiving a primary card UID returned by the card in the work field by the card reader, detecting whether the primary card UID of the card conflicts, if so, executing step 106, otherwise, determining the selected primary card UID, and executing step 108;
the primary cards UID returned by the received cards in this embodiment are specifically 88010203 and 88020203;
it should be noted that 88 in the primary card UID returned by the card is a serial mark;
step 106, the card reader detects the first position where the conflict occurs, determines the valid bit according to the first position where the conflict occurs, and sends a primary anti-conflict command containing the valid bit;
the first-level anti-collision command specifically comprises a first selection code, a number of valid bits and a valid bit;
it should be noted that, in this embodiment, the card reader selects the card UID whose first collision bit is 1 by default when a collision occurs;
in this embodiment, the card reader detects the first position where a collision occurs obtained by the obtained primary cards UID 88010203 and 88020203 and is the 1 st bit of the 2 nd byte, and calculates the number of the effective bits to be 31 according to the effective bit determined by the first position where the collision occurs being 1; a primary anti-collision command, specifically 9331881, is organized according to a first selection code 93, a number of significant bits 31 and a significant bit 881.
It should be noted that, the number of significant bits is calculated as the sum of the length of the first selection code, the length of the number of significant bits, and the length of the significant bits; in this embodiment, the length of the first selection code 93 is 1 byte, the length of the number of significant bits is 1 byte, the length of the significant bits is 1 byte 1 bit, and the sum of the length of the first selection code, the length of the number of significant bits, and the length of the significant bits is 3 bytes 1 bit, so that the number of significant bits is 31.
Step 107, the card reader receives data returned by the primary card UID in the work field and the card with the matched effective bit, whether further conflict occurs is detected, if yes, the step 106 is returned, otherwise, the selected primary card UID is determined, and the step 108 is executed;
the card returns the remaining primary card UID except the first conflict position, and specifically, the card reader detects whether further conflict occurs according to the returned remaining primary card UID;
for example, the remaining primary card UID returned by the card is 00000000203; when the card reader detects that no further conflict occurs, determining that the UID of the selected primary card is 88010203;
the working state of the card with the primary card UID matched with the effective bit in the work field is continuously kept in a preparation state, and the working state of the card with the primary card UID not matched with the effective bit in the work field is converted into an idle state from the preparation state; furthermore, the card in the work field, of which the primary card UID is not matched with the valid bit, does not respond to the command of the anti-collision stage sent by the card reader; such as a select command, an anti-collision command, a card selection command, and a card activation command.
Step 108, the card reader sends a primary card selection command containing the selected primary card UID;
the first-level card selection command sent by the card reader specifically comprises the following steps: the method comprises the steps of firstly, selecting a code, the number of valid bits, a selected primary card UID and a check value;
in this embodiment, the card reader sequentially splices the first selection code 93, the number of significant bits 70, the selected primary card UID 88010203, and the check value BCC to obtain a primary card selection command, specifically 937088010203 BCC;
note that the check value BCC is an exclusive or value of 4 bytes of data before the check value, that is, an exclusive or value of the selected primary card UID 88010203.
Step 109, the card reader receives a card selection confirmation response returned by the card in the workplace, judges whether the UID of the card is complete or not according to the card selection confirmation response, if so, executes step 122, otherwise, executes step 110;
specifically, the card reader receives a card selection confirmation response returned by the card, acquires a third bit of a low-order end of the card selection confirmation response, judges whether the third bit of the low-order end is 1, judges whether the UID of the card is incomplete if the third bit of the low-order end is 1, and judges whether the UID of the card is complete if the third bit of the low-order end is 1;
for example, when the card selection confirmation response received by the card reader is 00, the card UID is determined to be complete, and when the card selection confirmation response received by the card reader is 04, the card UID is determined to be incomplete;
in this embodiment, the card reader determines that the card UID is incomplete and executes step 110 if the card selection confirmation response received by the card reader is 04;
step 110, the card reader sends a secondary selection command;
the secondary selection command sent by the card reader comprises a second selection code and a preset number of valid bits; specifically, the card reader sequentially splices the second selection code 95 and the number 20 of preset valid bits to obtain a secondary selection command 9520;
step 111, the card reader receives a secondary card UID returned by the card in the workplace, whether the secondary card UID conflicts or not is detected, if yes, step 112 is executed, otherwise, the selected secondary card UID is determined, and step 114 is executed;
secondary cards UID (user identification) specifically 88040506 and 88080506 returned by the cards in the work field received by the card reader;
it should be noted that 88 in the secondary card UID returned by the card is a serial mark;
step 112, the card reader detects the first position where the conflict occurs, determines the valid bit according to the first position where the conflict occurs, and sends a secondary anti-collision command containing the valid bit;
the secondary anti-collision command specifically comprises a second selection code, a number of significant bits and a significant bit;
in this embodiment, the card reader detects the obtained secondary cards UID 88040506 and 88080506 to obtain that the first position where a collision occurs is the 3 rd bit of the 2 nd byte, the valid bit determined according to the first position where a collision occurs is 88100, and the number of the valid bits is calculated to be 33; the second level anti-collision command, specifically 953388100, is organized according to the second selection code 95, the number of significant bits 33 and the significant bits 88100.
In this embodiment, the length of the second selection code 95 is 1 byte, the length of the number of significant bits is 1 byte, the length of the significant bits is 1 byte, and 3 bits, and the sum of the length of the first selection code, the length of the number of significant bits, and the length of the significant bits is 3 bytes, and 3 bits, so that the number of significant bits is 33.
Step 113, the card reader receives data returned by the secondary card UID in the work field and the card with the matched effective bit, whether further conflict occurs is detected, if yes, the step 112 is returned, and if not, the selected secondary card UID is determined, and the step 114 is executed;
the card returns the remaining secondary card UID except the first conflict position, and specifically, the card reader detects whether further conflict occurs according to the returned remaining secondary card UID;
for example, the remaining secondary card UID returned by the card is 000000506; when the card reader detects that no further conflict occurs, determining that the UID of the selected primary card is 88040506;
the working state of the card with the secondary card UID matched with the effective bit in the work field is continuously kept in a preparation state, and the working state of the card with the secondary card UID not matched with the effective bit in the work field is converted into an idle state from the preparation state; furthermore, the cards in the work field whose secondary cards UID are not matched with the valid bit do not respond to the anti-collision stage command sent by the card reader; such as a select command, an anti-collision command, a card selection command, and a card activation command.
Step 114, the card reader sends a secondary card selection command containing the selected secondary card UID;
the secondary card selection command sent by the card reader specifically comprises: the second selection code, the number of the valid bits, the selected secondary card UID and the check value;
in this embodiment, the card reader sequentially splices the second selection code 95, the number of significant bits 70, the selected secondary card UID 88040506, and the check value BCC to obtain a primary card selection command, specifically 957088040506 BCC;
note that the check value BCC is an exclusive or value of the selected secondary card UID 88040506.
Step 115, the card reader receives a card selection confirmation response returned by the card in the workplace, whether the UID of the card is complete or not is judged according to the card selection confirmation response, if so, the step 112 is executed, and if not, the step 116 is executed;
specifically, the card reader receives a card selection confirmation response returned by the card, acquires a third bit of a low-order end of the card selection confirmation response, judges whether the third bit of the low-order end is 1, judges whether the UID of the card is incomplete if the third bit of the low-order end is 1, and judges whether the UID of the card is complete if the third bit of the low-order end is 1;
in this embodiment, the card reader receives a card selection confirmation response of 04, and determines that the card UID is incomplete, and executes step 116;
step 116, the card reader sends a three-level selection command;
the three-level selection command sent by the card reader comprises a third selection code and a preset number of valid bits; specifically, the card reader sequentially splices the third selection code 97 and the number 20 of preset valid bits to obtain a secondary selection command 9720;
step 117, the card reader receives the three-level card UID returned by the card in the work field, whether the three-level card UID conflicts is detected, if yes, step 118 is executed, otherwise, the selected three-level card UID is determined, and step 120 is executed;
the card reader receives three-level cards UID returned by the cards in the work field, specifically 0708090A and 0F 08090A;
step 118, the card reader detects the first position where the collision occurs, determines the valid bit according to the first position where the collision occurs, and sends a three-level anti-collision command containing the valid bit;
the three-level anti-collision command specifically comprises a third selection code, a number of valid bits and a valid bit;
in this embodiment, the card reader detects the obtained three-level cards UID 0708090A and 0F 08090A to obtain that the first position where a collision occurs is bit 4 of byte 1, the valid bit determined according to the first position where a collision occurs is 1111, and the number of the valid bits is calculated to be 24; the three-level anti-collision command, specifically 97241111, is organized according to the third selection code 97, the number of significant bits 24 and the significant bits 1111.
In this embodiment, the length of the third selection code 97 is 1 byte, the length of the number of significant bits is 1 byte, the length of the significant bits is 4 bits, and the sum of the length of the first selection code, the length of the number of significant bits, and the length of the significant bits is 2 bytes and 4 bits, so that the number of significant bits is 24.
119, the card reader receives data returned by the cards with the matching of the UID of the three-level cards in the work field and the valid bits, detects whether further conflict occurs, if so, returns to the step 118, otherwise, determines the UID of the selected three-level card, and executes the step 120;
the card returns the remaining tertiary cards UID except the first conflict position, and specifically, the card reader detects whether further conflict occurs according to the returned remaining tertiary cards UID;
for example, the remaining tertiary card UID returned by the card is 000008090 a; when the card reader detects that no further conflict occurs, the UID of the selected primary card is determined to be 0F 08090A;
the working state of the card with the matching three-level card UID and the valid bit in the working field is continuously kept in the preparation state, and the working state of the card with the unmatching three-level card UID and the valid bit in the working field is converted into the idle state from the preparation state; furthermore, cards in the work field, of which the UID and the valid bit are not matched, no longer respond to the anti-collision command sent by the card reader; such as a select command, an anti-collision command, a card selection command, and a card activation command.
Step 120, the card reader sends a tertiary card selection command containing the selected tertiary card UID;
the three-level card selection command sent by the card reader specifically comprises the following steps: a third selection code, the number of the valid bits, the UID of the selected tertiary card and a check value;
in the embodiment, the card reader sequentially splices a primary card selection command, specifically 95700F 08090A BCC, according to a third selection code 97, the number of significant bits 70, a selected secondary card UID 0F 08090A and a check value BCC;
note that the check value BCC is an exclusive or value of the selected tertiary card UID 0F 08090A.
Step 121, the card reader receives a card selection confirmation response returned by the card in the workplace, whether the UID of the card is complete or not is judged according to the card selection confirmation response, if so, step 122 is executed, and if not, error reporting is finished;
specifically, the card reader receives a card selection confirmation response returned by the card, acquires a third bit of a low-order end of the card selection confirmation response, judges whether the third bit of the low-order end is 1, judges whether the UID of the card is incomplete if the third bit of the low-order end is 1, and judges whether the UID of the card is complete if the third bit of the low-order end is 1;
in this embodiment, the card reader determines that the card UID is complete and executes step 122, if the card selection confirmation response received by the card reader is 00;
step 122, the card reader updates the card number in an incremental manner and sends a card activation command containing the updated card number;
note that the card reader selects a card whose card UID is 0102030405060F 0708090 a, and only the card is in a ready state in the work field;
the card activation command sent by the card reader is specifically 0E 01;
step 123, the card reader receives response data returned by the card, and judges whether activation is successful or not according to the response data, if so, step 124 is executed, otherwise, step 102 is returned;
note that the operation state of the card with the card UID of 0102030405060F 0708090 a is changed from the ready state to the activated state.
Step 124, the card reader judges whether the flag bit of the multi-card is set, if so, the step 102 is returned, otherwise, the activation of the multi-card is successful, and the process is finished;
specifically, the card reader judges whether the multi-card zone bit is 1, if so, the multi-card zone bit is set, otherwise, the multi-card zone bit is reset.
Preferably, in step 103, step 104 is executed when the multi-card flag bit is set, and step 201 is executed when the multi-card flag bit is reset;
step 201, a card reader sends a primary selection command;
202, receiving a primary card UID returned by the card in the work field by the card reader; and sending a primary card selection command containing a primary card UID;
step 203, the card reader receives a card selection confirmation response returned by the card in the workplace, judges whether the UID of the card is complete or not according to the card selection confirmation response, if so, executes step 122, otherwise, executes step 204;
step 204, sending a secondary selection command by the card reader;
step 205, the card reader receives a secondary card UID returned by the card in the workplace; and sending a secondary card selection command containing a secondary card UID;
step 206, the card reader receives a card selection confirmation response returned by the card in the workplace, judges whether the UID of the card is complete or not according to the card selection confirmation response, if so, executes step 122, otherwise, executes step 207;
step 207, a three-level selection command sent by the card reader;
step 208, the card reader receives a three-level card UID returned by the card in the workplace; and sending a tertiary card selection command containing a tertiary card UID;
and step 209, the card reader receives a card selection confirmation response returned by the card in the workplace, judges whether the UID of the card is complete or not according to the card selection confirmation response, if so, executes step 122, and otherwise, error reporting is finished.
Example 3
The present embodiment provides a card activation apparatus, as shown in fig. 4, including:
the sending module 11 is used for sending a card searching command;
a receiving module 12 for receiving the card-searching response
The first judging module 13 is configured to judge whether the workplace is a plurality of cards according to the card searching response received by the receiving module 12;
the setting module 14 is used for setting the flag bit of the multiple cards when the first judging module 13 judges that the work field contains multiple cards;
the resetting module 15 is used for resetting the multi-card flag bit when the first judging module 13 judges that the number of the cards in the workplace is not multiple;
specifically, the first determining module 13 is specifically configured to detect whether a bit frame collision exists in the card searching response received by the receiving module 12;
correspondingly, the setting module 14 is configured to set the multi-card flag bit when the first determining module 13 determines that there is a bit frame collision;
and the resetting module 15 is used for resetting the multi-card flag bit when the first judging module 13 judges that no bit frame conflicts exist.
The numbering module 16 is used for selecting the cards through anti-collision operation, numbering the selected cards and storing the card numbers;
an activation module 17, configured to perform an activation operation on the selected card according to the card number stored in the number module 16;
the second judging module 18 is used for judging whether the multi-card flag bit is set after the activation module 17 successfully activates the card, and triggering the sending module 11 when the multi-card flag bit is set; and when the flag bit of the multi-card is judged to be reset, the multi-card is successfully activated, and the method is ended.
Specifically, the numbering module 16 includes:
the first sending submodule is used for sending a selection command to the cards in the workplace;
the first receiving submodule is used for receiving a card identifier returned by a card in a workplace;
the first detection submodule is used for detecting whether the card identification received by the first receiving submodule conflicts or not;
the determining submodule is used for determining the selected card identification when the first detection submodule judges that the card identifications have no conflict;
the first sending submodule is also used for detecting the first position of sending conflict when the first detection submodule judges that the card identifications conflict, determining the valid bit according to the first position where the conflict occurs and sending an anti-conflict command containing the valid bit;
the first receiving submodule is also used for receiving data returned by the card with the card identification matched with the effective bit in the workplace;
the second detection submodule is used for detecting whether further conflict occurs according to the data returned by the card received by the first receiving submodule;
the first sending submodule is also used for detecting the position of the first sending conflict when the second detecting submodule judges that further conflict occurs, determining a valid bit according to the first position where the conflict occurs and sending an anti-conflict command containing the valid bit;
the determining submodule is also used for determining the selected card identification when the second detection submodule judges that no further conflict occurs;
the first sending submodule is also used for sending a card selection command containing the card identification determined by the determining submodule;
the first receiving submodule is also used for receiving card selection confirmation responses returned by the cards in the workplace;
the first judgment submodule is also used for judging whether the card identification is complete according to the card selection confirmation response received by the first receiving submodule;
the numbering submodule is used for numbering the card corresponding to the selected card identification and storing the card number when the first judging submodule judges that the card identification is complete;
and the error reporting submodule is used for finishing error reporting when the first judging submodule judges that the card identification is incomplete.
Preferably, the numbering module 16 further includes: a second sending submodule; a second receiving submodule and a second judging submodule;
the first sending submodule is specifically used for sending a selection command when the first judging module 13 judges that a plurality of cards exist in the work field;
the second sending submodule is used for sending a selection command when the first judging module 13 judges that a plurality of cards do not exist in the work field;
the second receiving submodule is used for receiving the card identification returned by the card in the workplace;
the second sending submodule is also used for sending the card selection command of the card identifier received by the second receiving submodule;
the second receiving submodule is also used for receiving card selection confirmation responses returned by the cards in the workplace;
the second judgment submodule is also used for judging whether the card identification is complete according to the card selection confirmation response received by the second receiving submodule;
the numbering submodule is used for numbering the card corresponding to the selected card identification and storing the card number when the second judging submodule judges that the card identification is complete;
and the error reporting submodule is used for finishing error reporting when the second judgment submodule judges that the card identification is incomplete.
Specifically, the activation module 17 includes:
the third sending submodule is used for sending a card activation command containing a card number;
the third receiving submodule is used for receiving response data of the card activation command;
the third judging submodule is used for judging whether the selected card is successfully activated or not according to the response data received by the third receiving submodule;
the second judging module 18 is used for judging whether the flag bit of the multi-card is set or not after the third judging sub-module judges that the selected card is successfully activated, and when the flag bit of the multi-card is judged to be reset, the multi-card activation is successful and the operation is finished;
the sending module 11 is further configured to send a card searching command after the third determining sub-module determines that the selected card is not successfully activated.
Preferably, the apparatus further comprises: a first acquisition module;
the first obtaining module is used for obtaining the card information of the corresponding card according to the card number stored in the first obtaining module after the second judging module 18 judges that the activation of the multiple cards is successful; and sending the card information to an upper computer.
Specifically, the first obtaining module is specifically configured to, after the second determining module 18 determines that the activation of the multiple cards is successful, obtain card information of the card corresponding to the first obtaining module according to the card number stored in the first obtaining module, bind the card number and the card information corresponding to the card number to obtain binding information, and return the binding information to the upper computer.
Optionally, the receiving module 12 is further configured to receive a card information obtaining command sent by the upper computer;
the sending module 11 is specifically configured to send a card searching command when the receiving module 12 receives the card information obtaining command;
the first obtaining module specifically includes:
the first organization command submodule is used for acquiring a card number which is not acquired from all the card numbers stored in the second judgment module 18 as a current card number after the second judgment module 18 judges that the multi-card activation is successful, and organizing the card reading command according to the current card number;
the fourth sending submodule is used for sending the card reading command organized by the first organization command submodule to the card;
the fourth receiving submodule is used for receiving card information returned by the card;
the fourth sending submodule is also used for sending the card information returned by the card received by the fourth receiving submodule to the upper computer;
the fourth judgment submodule is used for judging whether card numbers which are not acquired exist when the first receiving submodule receives the card information acquisition command;
the first organization command submodule is used for acquiring a card number which is not acquired from all the card numbers stored in the fourth judgment module to serve as a current card number when the fourth judgment module judges that the card number which is not acquired exists, and organizing the card reading command according to the current card number;
and the fourth sending submodule is also used for returning a failure response of obtaining the card information to the upper computer when the fourth judging module judges that no card number which is not obtained exists, and ending.
Optionally, the receiving module 12 is further configured to receive a card information obtaining command sent by the upper computer;
the sending module 11 is specifically configured to send a card searching command when the receiving module 12 receives the card information obtaining command;
the first obtaining module specifically includes:
the second organization command submodule is used for acquiring a card number which is not acquired from all the card numbers stored in the second judgment module 18 as a current card number after the second judgment module 18 judges that the multi-card activation is successful, and organizing the card reading command according to the current card number;
the fifth sending submodule is used for sending the card reading command organized by the second organization command submodule to the card;
the fifth receiving submodule is used for receiving card information returned by the card;
a fifth judgment submodule for judging whether there is any card number that has not been acquired;
the second organization command submodule is also used for acquiring a card number which is not acquired from all the card numbers stored in the fifth judgment submodule to serve as the current card number when the fifth judgment submodule judges that the card number which is not acquired still exists, and organizing the card reading command according to the current card number;
the fifth sending module 11 is further configured to send all the card information received by the fifth receiving submodule to the upper computer when the fifth judging submodule judges that there is no card number that is not obtained.
Preferably, the sending module 11 is further configured to send all card numbers stored by the sending module to the upper computer after the second determining module 18 determines that the activation of the multiple cards is successful.
Furthermore, the receiving module 12 is further configured to receive a card number obtaining command sent by the upper computer;
the sending module 11 is specifically configured to send a card searching command when the receiving module 12 receives the card number obtaining command.
In more detail, the apparatus further comprises: a second acquisition module;
the receiving module 12 is further configured to receive a card information obtaining command including a card number sent by the upper computer;
the second obtaining module is configured to obtain card information of a card corresponding to the second obtaining module according to the card number in the obtained card information received by the receiving module 12; and sending the acquired card information to an upper computer.
Specifically, the second obtaining module specifically includes:
the sixth receiving submodule is used for receiving a card information acquisition command which contains a card number and is sent by the upper computer;
the sixth sending submodule is used for sending the card information acquisition command received by the sixth receiving submodule to the card;
the sixth receiving submodule is also used for receiving card information sent by the card;
and the sixth sending module 11 is further configured to send the card information received by the sixth receiving submodule to the upper computer.
Further, the second obtaining module is specifically configured to obtain the card information of the card corresponding to the second obtaining module according to the card number in the obtained card information received by the receiving module 12; and binding the card numbers and the card information corresponding to the card numbers to obtain binding information, and returning the binding information to the upper computer.
Correspondingly, the receiving module 12 is further configured to receive an operation instruction containing a card number sent by the upper computer;
the sending module 11 is further configured to send the operation instruction to the card;
the receiving module 12 is further configured to receive response data returned by the card;
the sending module 11 is further configured to send the response data received by the receiving module 12 to the upper computer.
Preferably, the apparatus further comprises: and the third obtaining module is configured to, after the second determining module 18 determines that the activation of the multiple cards is successful, obtain card information of the card corresponding to the second determining module according to the card number stored in the third obtaining module.
Furthermore, the sending module 11 is specifically configured to send a card searching command when receiving an external trigger signal;
specifically, the third obtaining module includes:
the third organization command submodule is used for acquiring a card number which is not acquired from all the card numbers stored in the third organization command submodule to be used as the current card number and organizing the card reading command according to the current card number;
the seventh sending submodule is used for sending the card reading command generated by the third organization submodule to the card;
the seventh receiving submodule is used for receiving the card information sent by the card;
a sixth judgment submodule for judging whether there is any card number that has not been acquired;
and the third organization command module is also used for acquiring a card number which is not acquired from all the card numbers stored by the sixth judgment sub-module when the sixth judgment sub-module judges that the card number which is not acquired exists, and organizing the card reading command according to the current card number.
Preferably, the third obtaining module further includes: and the seventh judging submodule is used for judging whether the card information received by the seventh receiving submodule is legal card information, if so, the authentication is successful, and the authentication is finished, and if not, the authentication is failed, and the authentication is finished.
The above description is only a preferred embodiment of the present invention, but the scope of the present invention is not limited thereto, and any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope of the present invention are included in the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (36)

1. A method of card activation, comprising:
step S1, the card reader sends a card searching command;
step S2, the card reader receives the card searching response, whether the work field is a plurality of cards is judged according to the card searching response, if yes, a multi-card flag bit is set, step S3 is executed, and if not, the multi-card flag bit is reset, and step S3 is executed;
step S3, the card reader performs anti-collision operation to select a card, numbers the selected card, and stores the card number;
step S4, the card reader executes activation operation to the selected card according to the card number, and executes step S5 after the activation is successful;
step S5, the card reader judges whether the flag bit of the multi-card is set, if so, the step S1 is returned, otherwise, the activation of the multi-card is successful, and the process is finished;
the step S3 specifically includes:
a1, the card reader sends a selection command;
step A2, the card reader receives a card identifier returned by a card in a work field, whether the card identifier conflicts or not is detected, and if yes, the step A3 is executed; otherwise, determining the selected card identification, and executing the step A5;
step A3, the card reader detects the first position where the conflict occurs, determines the valid bit according to the first position where the conflict occurs, and sends an anti-conflict command containing the valid bit;
step A4, the card reader receives data returned by the cards with the card identifications matched with the valid bits in the work field, whether further conflict occurs is detected, and if yes, the step A3 is returned; otherwise, determining the selected card identification, and executing the step A5;
step A5, the card reader sends a card selection command containing the selected card identification;
step A6, the card reader receives a card selection confirmation response returned by the card in the workplace, judges whether the card identification is complete according to the card selection confirmation response, numbers the card corresponding to the selected card identification if the card identification is complete, stores the card number, and executes step S4; otherwise, error reporting is finished.
2. The method according to claim 1, wherein step S2 is specifically: the card reader receives a card searching response returned by a card in a work field, whether bit frame collision exists in the card searching response is detected, if yes, a multi-card flag bit is set, and the step S3 is executed; otherwise, the multi-card flag is reset, and step S3 is executed.
3. The method of claim 1, wherein in step S2, when the card reader determines that there are a plurality of cards in the worksite, step a1 is performed; when the card reader judges that a plurality of cards do not exist in the workplace, executing the step B1;
step B1, the card reader sends a selection command;
step B2, the card reader receives a card identification returned by the card in the work field; and sending a card selection command containing the card identification;
step B3, the card reader receives a card selection confirmation response returned by the card in the workplace, judges whether the card identification is complete according to the card selection confirmation response, numbers the card corresponding to the card identification if the card identification is complete, stores the card number, and executes step S4; otherwise, error reporting is finished.
4. The method according to claim 1, wherein the step S4 specifically includes: the card reader sends a card activation command containing the card number; after receiving the response data, judging whether the selected card is successfully activated according to the response data, if so, executing step S5; otherwise, the process returns to step S1.
5. The method according to claim 1, wherein in step S5, after the multi-card activation is successful, the method further comprises: the card reader acquires the card information of the corresponding card according to the card number stored by the card reader, and sends the acquired card information to the upper computer.
6. The method of claim 5, wherein the step S1 is preceded by: the upper computer sends a card information acquisition command to the card reader; when the card reader receives the card information acquisition command, executing step S1;
the card reader acquires card information of a card corresponding to the card reader according to a card number stored by the card reader, and the card reader specifically comprises:
step C1, the card reader obtains a card number which is not obtained from all card numbers stored by the card reader as a current card number, organizes a card reading command according to the current card number and sends the card reading command to a card;
step C2, the card reader receives card information returned by the card and sends the card information to the upper computer;
step C3: the upper computer receives the card information sent by the card reader and continuously sends a card information acquisition command to the card reader;
and C4, the card reader judges whether the card number which is not acquired exists, if so, the step C1 is returned, otherwise, a failure response of acquiring the card information is returned to the upper computer, and the operation is finished.
7. The method according to claim 6, wherein the step C3 is specifically: and the upper computer judges whether the received card information is legal card information, if so, the authentication is successful, and if not, the authentication is failed, the upper computer continues to acquire the card information from the card reader, and the step C4 is executed.
8. The method of claim 5, wherein the step S1 is preceded by: the upper computer sends a card information acquisition command to the card reader; when the card reader receives the card information acquisition command, executing step S1;
the card reader acquires card information of a card corresponding to the card reader according to a card number stored by the card reader, and the card reader specifically comprises:
step D1, the card reader obtains a card number which is not obtained from all card numbers stored by the card reader as a current card number, organizes a card reading command according to the current card number and sends the card reading command to a card;
step D2, the card reader receives card information returned by the card;
and D3, the card reader judges whether the card numbers which are not acquired exist, if so, the step D1 is returned, and if not, all the received card information is returned to the upper computer.
9. The method according to claim 8, wherein when step D3, the card reader returning all the received card information to the upper computer further comprises: and the upper computer judges whether legal card information exists in all the received card information, if so, the authentication is successful, and the authentication is finished, otherwise, the authentication is failed, and the authentication is finished.
10. The method according to claim 1, wherein in step S5, after the multi-card activation is successful, the method further comprises: and the card reader sends all card numbers stored by the card reader to the upper computer.
11. The method of claim 10, wherein the step S1 is preceded by: the upper computer sends a card number acquiring command to the card reader; when the card reader receives the acquire card number command, step S1 is executed.
12. The method of claim 10, wherein after the card reader sends the card number stored in the card reader to the upper computer, the method further comprises: the card reader waits for receiving a card information acquisition command sent by the upper computer; when a card information acquisition command containing a card number sent by the upper computer is received, card information of a card corresponding to the card information acquisition command is acquired according to the card number in the card information acquisition command, and the acquired card information is sent to the upper computer.
13. The method according to claim 12, wherein after the card reader sends the card number stored in the card reader to the upper computer, the method specifically comprises the following steps:
step E1, the upper computer acquires a card number which is not acquired from the received card numbers as a current card number, organizes a card information acquisition command according to the current card number, and sends the card information acquisition command to the card reader;
step E2, the card reader forwards the command of obtaining the card information to the card; step E3 is executed when the card information returned by the card is received;
e3, the card reader forwards the card information to an upper computer;
and E4, the upper computer receives the card information returned by the card reader, judges whether the card numbers which are not acquired exist in the received card numbers, if yes, returns to the step E1, and otherwise, ends.
14. The method as claimed in claim 13, wherein the step E4 further comprises: the upper computer receives the card information forwarded by the card reader, judges whether the card information is legal or not, if so, the authentication is successful, and then the authentication is finished; otherwise, step E4 is performed.
15. The method according to claim 5 or 12, wherein after acquiring the card information according to the card number, further comprising: the card reader binds the card number and the card information corresponding to the card number to obtain binding information, and returns the binding information to the upper computer.
16. The method according to claim 15, wherein after obtaining the card information according to the card number, the method specifically includes:
step F1, the upper computer selects a card needing to be operated according to the card information in the received binding information, obtains the card number bound with the selected card according to the card information of the selected card, and organizes an operation instruction containing the obtained card number; sending an operation instruction to the card reader;
step F2, the card reader forwards the received operation instruction to a card; and after response data returned by the card are received, forwarding the response data to the upper computer.
17. The method according to claim 1, wherein in step S5, after the multi-card activation is successful, the method further comprises: and the card reader acquires the card information of the corresponding card according to the card number stored by the card reader.
18. The method of claim 1, wherein the step S1 is preceded by: when the card reader receives the external trigger signal, executing step S1;
the card reader acquires card information of a card corresponding to the card reader according to a card number stored by the card reader, and the card reader specifically comprises:
g1, the card reader acquires a card number which is not acquired from all card numbers stored by the card reader as a current card number, organizes a card reading command according to the current card number, and sends the card reading command to a card;
g2, the card reader receives card information returned by the card;
and G3, judging whether the card reader has the card number which is not acquired, if so, returning to the step G1, and if not, ending.
19. The method according to claim 18, wherein step G2 is specifically: and the card reader judges whether the received card information is legal card information, if so, the authentication is successful, and the authentication is finished, otherwise, the authentication is failed, and the authentication is finished.
20. A card activation apparatus, comprising:
the sending module is used for sending a card searching command;
the receiving module is used for receiving a first judging module for responding to card searching and judging whether the workplace is a plurality of cards or not according to the card searching response received by the receiving module;
the setting module is used for setting the flag bit of the multiple cards when the first judgment module judges that the work field contains the multiple cards;
the resetting module is used for resetting the multi-card flag bit when the first judging module judges that the number of the cards in the workplace is not multiple;
the numbering module is used for selecting the cards through anti-collision operation, numbering the selected cards and storing the card numbers;
the activation module is used for executing activation operation on the selected card according to the card number stored by the number module;
the second judging module is used for judging whether the flag bit of the multi-card is set after the activation module successfully activates the card, and triggering the sending module when the flag bit of the multi-card is set; when the flag bit of the multi-card is judged to be reset, the multi-card is successfully activated, and the method is finished;
wherein the numbering module comprises:
the first sending submodule is used for sending a selection command to the cards in the workplace;
the first receiving submodule is used for receiving a card identifier returned by a card in a workplace;
the first detection submodule is used for detecting whether the card identification received by the first receiving submodule conflicts or not;
the determining submodule is used for determining the selected card identification when the first detection submodule judges that the card identifications do not conflict;
the first sending submodule is also used for detecting a first position where the conflict occurs when the first detection submodule judges that the card identification conflicts, determining a valid bit according to the first position where the conflict occurs, and sending an anti-conflict command containing the valid bit;
the first receiving submodule is also used for receiving data returned by the card with the card identification matched with the effective bit in the workplace;
the second detection submodule is used for detecting whether further conflict occurs according to the data returned by the card received by the first receiving submodule;
the first sending submodule is also used for detecting the position of the first sending conflict when the second detecting submodule judges that further conflict occurs, determining a valid bit according to the first position where the conflict occurs and sending an anti-conflict command containing the valid bit;
the determining submodule is further used for determining the selected card identification when the second detecting submodule judges that no further conflict occurs;
the first sending submodule is further configured to send a card selection command including the card identifier determined by the determining submodule;
the first receiving submodule is also used for receiving card selection confirmation responses returned by the cards in the workplace;
the first judgment submodule is also used for judging whether the card identification is complete according to the card selection confirmation response received by the first receiving submodule;
the numbering submodule is used for numbering the card corresponding to the selected card identification and storing the card number when the first judging submodule judges that the card identification is complete;
and the error reporting submodule is used for finishing error reporting when the first judgment submodule judges that the card identification is incomplete.
21. The apparatus according to claim 20, wherein the first determining module is specifically configured to detect whether there is a bit frame collision in the card-searching response received by the receiving module;
the setting module is used for setting the flag bit of the multi-card when the first judging module judges that the bit frame conflicts;
and the resetting module is used for resetting the flag bit of the multi-card when the first judging module judges that no bit frame conflicts.
22. The apparatus of claim 21, wherein the numbering module further comprises: the first sending submodule, the first receiving submodule and the first judging submodule;
the first sending submodule is specifically used for sending a selection command when the first judging module judges that a plurality of cards exist in the work field;
the second sending submodule is used for sending a selection command when the first judging module judges that the plurality of cards do not exist in the work field;
the second receiving submodule is used for receiving a card identifier returned by the card in the workplace;
the second sending submodule is further configured to send a card selection command including the card identifier received by the second receiving submodule;
the second receiving submodule is also used for receiving card selection confirmation responses returned by the cards in the workplace;
the second judging submodule is further configured to judge whether the card identifier is complete according to the card selection confirmation response received by the second receiving submodule;
the numbering submodule is used for numbering the card corresponding to the selected card identification and storing the card number when the second judging submodule judges that the card identification is complete;
and the error reporting submodule is used for finishing error reporting when the second judgment submodule judges that the card identification is incomplete.
23. The apparatus of claim 20, wherein the activation module comprises: the third sending submodule is used for sending a card activation command containing the card number;
the third receiving submodule is used for receiving response data of the card activation command;
the third judging submodule is used for judging whether the selected card is successfully activated or not according to the response data received by the third receiving submodule;
the second judgment module is used for judging whether the multi-card flag bit is set or not after the third judgment submodule judges that the selected card is successfully activated, and finishing the multi-card activation when the third judgment submodule judges that the multi-card flag bit is reset;
the sending module is further configured to send a card searching command after the third determining sub-module determines that the selected card is not successfully activated.
24. The apparatus of claim 20, further comprising: a first acquisition module;
the first obtaining module is used for obtaining the card information of the corresponding card according to the card number stored by the first obtaining module after the second judging module judges that the activation of the multiple cards is successful; and sending the card information to an upper computer.
25. The apparatus according to claim 20, wherein the first obtaining module is specifically configured to, after the second determining module determines that the activation of the multiple cards is successful, obtain card information of a card corresponding to the first obtaining module according to a card number stored in the first obtaining module, bind the card number and the card information corresponding to the first obtaining module to obtain binding information, and return the binding information to the upper computer.
26. The apparatus according to claim 24, wherein the receiving module is further configured to receive a command for obtaining card information sent by the upper computer;
the sending module is specifically used for sending a card searching command when the receiving module receives the card information obtaining command;
the first obtaining module specifically includes:
the first organization command submodule is used for acquiring a card number which is not acquired from all card numbers stored by the second judgment module as a current card number after the second judgment module judges that the activation of the multiple cards is successful, and organizing the card reading command according to the current card number;
the fourth sending submodule is used for sending the card reading command organized by the first organization command submodule to the card; the fourth receiving submodule is used for receiving card information returned by the card;
the fourth sending submodule is also used for sending the card information returned by the card received by the fourth receiving submodule to the upper computer;
the fourth judgment submodule is used for judging whether the card numbers which are not acquired exist or not when the receiving module receives the card information acquisition command;
the first organization command submodule is further used for acquiring a card number which is not acquired from all the card numbers stored in the fourth judgment submodule to serve as a current card number when the fourth judgment submodule judges that the card number which is not acquired still exists, and organizing the card reading command according to the current card number;
and the fourth sending submodule is also used for returning a failure response of obtaining the card information to the upper computer when the fourth judging submodule judges that no card number which is not obtained exists, and ending.
27. The apparatus according to claim 24, wherein the receiving module is further configured to receive a command for obtaining card information sent by the upper computer;
the sending module is specifically used for sending a card searching command when the receiving module receives the card information obtaining command;
the first obtaining module specifically includes:
the second organization command submodule is used for acquiring a card number which is not acquired from all the card numbers stored in the second organization command submodule as a current card number after the second judgment module judges that the multi-card activation is successful, and organizing the card reading command according to the current card number;
the fifth sending submodule is used for sending the card reading command organized by the second organization command submodule to a card;
the fifth receiving submodule is used for receiving card information returned by the card;
a fifth judgment submodule for judging whether there is any card number that has not been acquired;
the second organization command submodule is further configured to, when the fifth judgment submodule judges that there are card numbers that have not been acquired, acquire one card number that has not been acquired from all the card numbers stored in the second organization command submodule and use the card number as a current card number, and organize the card reading command according to the current card number;
and the fifth sending submodule is also used for sending all the card information received by the fifth receiving submodule to the upper computer when the fifth judging submodule judges that no card number which is not obtained exists.
28. The apparatus according to claim 20, wherein the sending module is further configured to send all card numbers stored by the sending module to the upper computer after the second determining module determines that the activation of the multiple cards is successful.
29. The apparatus according to claim 28, wherein the receiving module is further configured to receive a command for obtaining a card number sent by the upper computer;
the sending module is specifically configured to send a card searching command when the receiving module receives the card number obtaining command.
30. The apparatus of claim 28, further comprising: a second acquisition module;
the receiving module is also used for receiving a card information acquisition command which contains a card number and is sent by the upper computer;
the second obtaining module is used for obtaining the card information of the corresponding card according to the card number in the obtained card information received by the receiving module; and sending the acquired card information to an upper computer.
31. The apparatus of claim 30, wherein the second obtaining module specifically comprises:
the sixth receiving submodule is used for receiving a card information acquisition command which contains a card number and is sent by the upper computer;
the sixth sending submodule is used for sending the card information acquisition command received by the sixth receiving submodule to a card;
the sixth receiving submodule is also used for receiving card information sent by the card;
and the sixth sending submodule is also used for sending the card information received by the sixth receiving submodule to an upper computer.
32. The apparatus according to claim 30, wherein the second obtaining module is specifically configured to obtain the card information of the corresponding card according to the card number in the obtained card information received by the receiving module; and binding the card numbers and the card information corresponding to the card numbers to obtain binding information, and returning the binding information to the upper computer.
33. The device according to claim 25 or 32, wherein the receiving module is further configured to receive an operation instruction containing a card number sent by the upper computer;
the sending module is further used for sending the operation instruction to a card;
the receiving module is also used for receiving response data returned by the card;
and the sending module is also used for sending the response data received by the receiving module to an upper computer.
34. The apparatus of claim 20, further comprising: and the third acquisition module is used for acquiring the card information of the corresponding card according to the card number stored by the third acquisition module after the second judgment module judges that the activation of the multiple cards is successful.
35. The apparatus according to claim 20, wherein the sending module is specifically configured to send a card-seeking command when receiving an external trigger signal;
the third acquisition module includes:
the third organization command submodule is used for acquiring a card number which is not acquired from all the card numbers stored in the third organization command submodule to be used as the current card number and organizing the card reading command according to the current card number;
the seventh sending submodule is used for sending the card reading command generated by the third organization command submodule to a card;
the seventh receiving submodule is used for receiving the card information sent by the card;
a sixth judgment submodule for judging whether there is any card number that has not been acquired;
the third organization command submodule is further configured to, when the sixth judgment submodule judges that there is still a card number that has not been acquired, acquire one card number that has not been acquired from all card numbers stored in the sixth judgment submodule and use the acquired card number as a current card number, and organize the card reading command according to the current card number.
36. The apparatus of claim 35, wherein the third obtaining module further comprises:
and the seventh judging submodule is used for judging whether the card information received by the seventh receiving submodule is legal card information, if so, the authentication is successful, and the authentication is finished, and if not, the authentication is failed, and the authentication is finished.
CN201810130108.0A 2018-02-08 2018-02-08 Card activation method and device Active CN108288008B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810130108.0A CN108288008B (en) 2018-02-08 2018-02-08 Card activation method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810130108.0A CN108288008B (en) 2018-02-08 2018-02-08 Card activation method and device

Publications (2)

Publication Number Publication Date
CN108288008A CN108288008A (en) 2018-07-17
CN108288008B true CN108288008B (en) 2021-12-28

Family

ID=62832747

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810130108.0A Active CN108288008B (en) 2018-02-08 2018-02-08 Card activation method and device

Country Status (1)

Country Link
CN (1) CN108288008B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110245532A (en) * 2019-06-06 2019-09-17 北京聚利科技股份有限公司 Card-reading system and method
CN110807502B (en) * 2019-10-31 2024-04-09 天星数科科技有限公司 NFC intelligent card configuration method and device
CN112989851A (en) * 2021-02-08 2021-06-18 维沃移动通信有限公司 NFC card activation method and device and electronic equipment
CN113312934B (en) * 2021-05-26 2023-04-25 维沃移动通信有限公司 NFC analog card selection method and device, electronic equipment and storage medium
CN115442780A (en) * 2021-06-04 2022-12-06 华为技术有限公司 Data interaction method and device based on NFC

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101023434A (en) * 2004-07-15 2007-08-22 万事达卡国际股份有限公司 Collision detection and avoidance scheme for contactless card payment systems
CN101201906A (en) * 2007-12-21 2008-06-18 合肥工大高科信息技术有限责任公司 Electronic label for personnel and self-organized network method thereof
CN103632115A (en) * 2013-11-01 2014-03-12 福建鑫诺通讯技术有限公司 Method for realizing multichannel data collection for card
CN106326797A (en) * 2016-08-19 2017-01-11 飞天诚信科技股份有限公司 Non-contact type card and working method
CN106407860A (en) * 2016-08-31 2017-02-15 广州地理研究所 Multi-card identification anti-collision method and device
CN106934310A (en) * 2017-02-24 2017-07-07 飞天诚信科技股份有限公司 The method and card reader of a kind of testing smart card

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH08123919A (en) * 1994-10-28 1996-05-17 Mitsubishi Electric Corp Noncontact ic card system and communication method thereof
CN102215050B (en) * 2010-04-02 2014-03-19 国民技术股份有限公司 Detection method for radio-frequency SIM (Subscriber Identity Module) card collision with low-frequency magnetic communication

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101023434A (en) * 2004-07-15 2007-08-22 万事达卡国际股份有限公司 Collision detection and avoidance scheme for contactless card payment systems
CN101201906A (en) * 2007-12-21 2008-06-18 合肥工大高科信息技术有限责任公司 Electronic label for personnel and self-organized network method thereof
CN103632115A (en) * 2013-11-01 2014-03-12 福建鑫诺通讯技术有限公司 Method for realizing multichannel data collection for card
CN106326797A (en) * 2016-08-19 2017-01-11 飞天诚信科技股份有限公司 Non-contact type card and working method
CN106407860A (en) * 2016-08-31 2017-02-15 广州地理研究所 Multi-card identification anti-collision method and device
CN106934310A (en) * 2017-02-24 2017-07-07 飞天诚信科技股份有限公司 The method and card reader of a kind of testing smart card

Also Published As

Publication number Publication date
CN108288008A (en) 2018-07-17

Similar Documents

Publication Publication Date Title
CN108288008B (en) Card activation method and device
US11334862B2 (en) Terminal transaction method, and terminal
CN113361293A (en) Card swiping method, card controller, electronic device and storage medium
US20140229372A1 (en) Smart card having multiple payment instruments
CN106488539A (en) The processing method of WiFi resource and system in terminal
CN102929565A (en) Method, device and chip for reading boot loader based on system on chip (SoC)
JP6516133B2 (en) Communication device and communication system
CN112926710A (en) NFC analog card switching method, mobile terminal and computer readable storage medium
CN106529954A (en) Mobile terminal based payment method and mobile terminal
US7152799B2 (en) Contactless IC card
EP2793201A1 (en) Safety information transfer system, device and method based on extended parameter set
US20160065716A1 (en) Method and Device for Displaying and Processing Application Name of Multimode Card of Mobile Terminal
CN101630373B (en) Method and device for realizing multiple applications of smart card
CN112511974A (en) NFC card selection method and device and electronic equipment
CN104572135A (en) Command processing method, command processing device and terminal
EP2717193B1 (en) IC card, portable electronic device, and reader/ writer
CN108021957B (en) Anti-collision method and system, readable storage medium and card reading device
US9010649B2 (en) IC card, portable electronic device, and reader/writer
JP6194714B2 (en) Universal IC card and security attribute verification method
CN109684888B (en) Method for communicating with smart card and card reader
CN110008059B (en) Data updating method and device for nonvolatile storage medium and storage medium
CN110334550B (en) Smart card and method for protecting privacy data thereof
JP2005182128A (en) Portable information storage medium and its program
CN115118527B (en) Bidirectional authentication method for ultrahigh frequency module and PDA and related equipment
CN113408500B (en) Fingerprint card and working method thereof, electronic equipment and computer readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
OL01 Intention to license declared
OL01 Intention to license declared