CN110619247A - Method for improving decoding compatibility of magnetic stripe card reader - Google Patents

Method for improving decoding compatibility of magnetic stripe card reader Download PDF

Info

Publication number
CN110619247A
CN110619247A CN201910873663.7A CN201910873663A CN110619247A CN 110619247 A CN110619247 A CN 110619247A CN 201910873663 A CN201910873663 A CN 201910873663A CN 110619247 A CN110619247 A CN 110619247A
Authority
CN
China
Prior art keywords
signal
bit
card reader
value
average energy
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.)
Granted
Application number
CN201910873663.7A
Other languages
Chinese (zh)
Other versions
CN110619247B (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.)
ZHAOXUN HENGDA MICROELECTRONICS TECHNOLOGY (BEIJING) Co Ltd
Original Assignee
ZHAOXUN HENGDA MICROELECTRONICS TECHNOLOGY (BEIJING) 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 ZHAOXUN HENGDA MICROELECTRONICS TECHNOLOGY (BEIJING) Co Ltd filed Critical ZHAOXUN HENGDA MICROELECTRONICS TECHNOLOGY (BEIJING) Co Ltd
Priority to CN201910873663.7A priority Critical patent/CN110619247B/en
Publication of CN110619247A publication Critical patent/CN110619247A/en
Application granted granted Critical
Publication of CN110619247B publication Critical patent/CN110619247B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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/0008General problems related to the reading of electronic memory record carriers, independent of its reading method, e.g. power transfer
    • 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/08Methods or arrangements for sensing record carriers, e.g. for reading patterns by means detecting the change of an electrostatic or magnetic field, e.g. by detecting change of capacitance between electrodes
    • G06K7/082Methods or arrangements for sensing record carriers, e.g. for reading patterns by means detecting the change of an electrostatic or magnetic field, e.g. by detecting change of capacitance between electrodes using inductive or magnetic sensors
    • G06K7/083Methods or arrangements for sensing record carriers, e.g. for reading patterns by means detecting the change of an electrostatic or magnetic field, e.g. by detecting change of capacitance between electrodes using inductive or magnetic sensors inductive
    • G06K7/084Methods or arrangements for sensing record carriers, e.g. for reading patterns by means detecting the change of an electrostatic or magnetic field, e.g. by detecting change of capacitance between electrodes using inductive or magnetic sensors inductive sensing magnetic material by relative movement detecting flux changes without altering its magnetised state

Abstract

The embodiment of the invention relates to a method for improving decoding compatibility of a magnetic stripe card reader, which is characterized by comprising the following steps: initializing an invalid signal counter, a decoding state, the average energy of a front bit signal and the magnetic stripe data after decoding; acquiring non-standard signal upper limit and signal average energy smoothing factor; acquiring a first frame preamble synchronous signal and a first frame data signal; generating a starting bit signal energy; generating a front bit signal amplitude difference, and resetting the average energy of the front bit signal; extracting a second bit data signal; judging the noise signal to generate a first signal judgment result; generating second bit signal energy when the first signal judgment result is an effective signal; judging the effective signal to generate a second signal judgment result; when the second signal judgment result is an effective signal, effective signal decoding is carried out; continuing to extract the third bit data signal until the end bit; and when the value of the decoding state is 0, the card reader sends the successfully decoded state information and the decoded magnetic stripe data to the upper computer.

Description

Method for improving decoding compatibility of magnetic stripe card reader
Technical Field
The invention relates to the technical field of magnetic stripe card decoding, in particular to a method for improving decoding compatibility of a magnetic stripe card reader.
Background
Magnetic stripe cards store data through magnetic media on magnetic tracks. The stored data format is stored in a magnetic stripe storage encoding format F2F encoding format. The read/write operation of the magnetic stripe card is to perform relative motion in a magnetic force field so as to convert magnetic medium information into electronic information through magnetoelectric conversion and transmit the electronic information to an upper computer for the next operation or to store the electronic information sent by the upper computer in the magnetic medium through electromagnetic conversion according to an F2F encoding mode. In practical application, if the magnetic medium is locally damaged, the magnetic strip is worn or the magnetic head signal is interfered by noise when in operation, the integrity of the card swiping signal is deformed and influenced, so that decoding errors are caused, the card swiping time is prolonged, even the wrong swiping rate is increased, and the transaction efficiency and the user experience are influenced.
Disclosure of Invention
The present invention aims to provide a method for improving the decoding compatibility of a magnetic stripe card reader, aiming at the technical defects. The method of the invention is used to make noise judgment according to the average bit signal energy of the data frame and the amplitude difference of the adjacent bit signals, so as to increase the acceptance of effective but deformed signals; the function that the compatibility can be adjusted is added to the card reader by accumulating invalid signals and setting the upper limit of non-standard signals as the boundary of the compatibility. Therefore, the method can be compatible with non-standard signals to the greatest extent, improve the compatibility of decoding under severe conditions, and can also actively allocate the compatibility adaptive capacity of the equipment.
In order to achieve the above object, the present invention provides a method for improving decoding compatibility of a magnetic stripe card reader, comprising:
step 1, initializing a value of an invalid signal counter to be 0, initializing a value of a decoding state to be 0, initializing a value of bit signal average energy before initialization to be 0, and initializing a value of magnetic stripe data after decoding to be null;
step 2, the card reader acquires a non-standard signal upper limit and a signal average energy smoothing factor from a system area;
step 3, the card reader obtains a first frame preamble synchronous signal and a first frame data signal of the magnetic stripe data through the relative motion of the magnetic head and the magnetic stripe;
step 4, the card reader sums all signal peaks in the first frame preamble synchronous signal to generate a peak sum according to the first frame preamble synchronous signal, and performs peak sum average calculation on the peak sum according to the peak sum of the first frame preamble synchronous signal to generate initial bit signal energy;
step 5, the card reader extracts a first bit data signal according to the first frame data signal, calculates the amplitude difference of the first bit data signal to generate a front bit signal amplitude difference, extracts the maximum peak value of the first bit data signal to generate a first bit signal average energy, and resets the front bit signal average energy according to the first bit signal average energy;
step 6, the card reader extracts a second bit data signal according to the first frame data signal;
step 7, the card reader judges the noise signal according to the amplitude difference of the second bit data signal and the previous bit signal to generate a first signal judgment result;
step 8, the card reader judges the first signal judgment result, and when the first signal judgment result is a valid signal, the step 9 is carried out, and when the first signal judgment result is a noise signal, the value of the invalid signal counter is added by 1, and the step 12 is carried out;
step 9, the card reader extracts the maximum peak value of the second bit data signal according to the second bit data signal to generate second bit signal energy;
step 10, the card reader carries out effective signal judgment operation according to the initial bit signal energy, the previous bit signal average energy and the second bit signal energy to generate a second signal judgment result;
step 11, the card reader judges the second signal judgment result, and when the second signal judgment result is a valid signal, the step 13 is carried out, and when the second signal judgment result is an invalid signal, the value of the invalid signal counter is added by 1, and the step 12 is carried out;
step 12, the card reader judges whether the value of the invalid signal counter is greater than the value of the non-standard signal upper limit, if the value of the invalid signal counter is greater than the value of the non-standard signal upper limit, the value of the decoding state is set to be 1, and the step 15 is carried out, and if the value of the invalid signal counter is less than or equal to the value of the non-standard signal upper limit, the step 14 is carried out;
step 13, the card reader performs effective signal decoding operation according to the second bit data signal to generate a second bit value, and performs bit adding operation on the decoded magnetic stripe data according to the second bit value;
step 14, the card reader extracts a third bit data signal according to the first frame data signal, and performs the noise signal judgment, effective signal judgment and effective signal decoding on the third bit data signal until an end bit data signal of the first frame data signal is extracted and the noise signal judgment, effective signal judgment and effective signal decoding are completed on the end bit data signal;
and step 15, the card reader judges whether the value of the decoding state is 0, and when the value of the decoding state is 0, the card reader sends decoding success state information and the decoded magnetic stripe data to an upper computer.
Further, the method further comprises:
and when the value of the decoding state is 1, the card reader sends decoding failure state information to an upper computer.
Further, the card reader initializes the value of the invalid signal counter to 0, and before, the method further includes:
and the card reader sets and stores a non-standard signal upper limit, a signal average energy smoothing factor, a starting bit signal energy threshold proportion and a noise signal amplitude difference lower limit in the system area.
Further, the card reader performs a noise signal determination operation according to the second bit data signal and the amplitude difference of the previous bit signal to generate a first signal determination result, and the method specifically includes:
the card reader carries out standard magnetic stripe encoding format judgment operation on the second bit data signal according to the second bit data signal to generate a first judgment result;
when the first judgment result is successful, the card reader performs signal amplitude judgment operation on the second bit data signal according to the amplitude difference between the second bit data signal and the previous bit signal to generate a second judgment result;
and when the second judgment result is successful, the card reader sets the value of the first signal judgment result as an effective signal.
Preferably, the card reader performs a signal amplitude judgment operation on the second bit data signal according to the amplitude difference between the second bit data signal and the previous bit signal, and generates a second judgment result, which specifically includes:
the card reader acquires the lower limit of the amplitude difference of the noise signal from the system area;
the card reader calculates the signal amplitude difference of the second bit data signal according to the second bit data signal to generate the current bit signal amplitude difference;
the card reader subtracts the absolute value of the difference of the amplitude difference of the current bit signal and the amplitude difference of the previous bit signal to generate a first signal amplitude difference;
when the value of the first signal amplitude difference is smaller than or equal to the value of the lower limit of the noise signal amplitude difference, the card reader sets the value of the second judgment result as successful and resets the previous bit signal amplitude difference according to the current bit signal amplitude difference.
Further preferably, the method further comprises:
and when the value of the first signal amplitude difference is larger than the value of the lower limit of the noise signal amplitude difference, the card reader exits the signal amplitude judgment operation process and sets the value of the second judgment result as failure.
Preferably, the method further comprises:
when the first judgment result is failure, the card reader exits the noise signal judgment operation process and sets the value of the first signal judgment result as a noise signal;
and when the second judgment result is failure, the card reader exits the noise signal judgment operation process and sets the value of the first signal judgment result as a noise signal.
Further, the card reader performs an effective signal judgment operation according to the initial bit signal energy, the previous bit signal average energy, and the second bit signal energy to generate a second signal judgment result, which specifically includes:
the card reader obtains the signal average energy smoothing factor and the initial bit signal energy threshold proportion from the system area;
the card reader generates a first signal energy threshold according to the product of the initial bit signal energy and the initial bit signal energy threshold ratio;
the card reader calculates the average energy of the current signal according to the second bit signal energy, the average energy of the previous bit signal and a signal average energy smoothing factor to generate the average energy of the second bit signal, and resets the average energy of the previous bit signal according to the average energy of the second bit signal;
and when the average energy value of the second bit signal is greater than or equal to the energy threshold value of the first signal, the card reader sets the value of the second signal judgment result as an effective signal.
Preferably, the card reader calculates the current signal average energy according to the second bit signal energy, the previous bit signal average energy, and the signal average energy smoothing factor to generate the second bit signal average energy, and resets the previous bit signal average energy according to the second bit signal average energy, specifically including:
the card reader calculates according to the second bit signal energy, the previous bit signal average energy and the signal average energy smoothing factor and according to a formula (1-alpha) x Pave + alpha x Pcur to generate second bit signal average energy, wherein alpha is the signal average energy smoothing factor, Pave is the previous bit signal average energy and Pcur is the second bit signal energy;
the card reader resets the average energy of the previous bit signal according to the average energy of the second bit signal, and specifically, the card reader resets the average energy of the previous bit signal to the average energy of the second bit signal.
Preferably, the method further comprises:
and when the value of the average energy of the second bit signal is smaller than the value of the first signal energy threshold, the card reader exits the effective signal judgment operation processing and sets the value of the second signal judgment result as an invalid signal.
The invention provides a method for improving decoding compatibility of a magnetic stripe card reader, which comprises two effective signal judgment methods: the effective signal identification method takes the signal average energy of continuous signals and the amplitude difference of adjacent bit signals as judgment basis.
For the former: firstly, generating initial bit signal energy according to a first frame preamble synchronous signal, generating a first signal energy threshold by the product of the ratio of the value and the initial bit signal energy threshold, and taking the first signal energy threshold as a final condition for effective signal judgment. And secondly, the card reader acquires the first bit data signal, generates first bit signal energy and assigns the first bit signal energy as the average energy of the previous bit signal. And then, the card reader acquires a second bit data signal and generates second bit signal energy, generates second bit signal average energy according to the previous bit signal average energy, the signal average energy smoothing factor and the second bit signal energy in a calculation mode of the signal average energy, and resets the previous bit signal average energy to the second bit signal average energy. The card reader compares the average energy of the second bit signal with the first signal energy threshold, and if the average energy of the second bit signal is smaller than the first signal energy threshold, the card reader is regarded as an invalid signal; otherwise, the signal energy greater than or equal to the first signal energy threshold is regarded as a valid signal.
For the latter, the decision rule includes two: whether the waveform of the second bit data signal meets the requirement of the encoding format of the magnetic stripe card encoding F2F is judged, if yes, the signal is continuously compared, otherwise, the signal is noise; and subtracting the amplitude difference of the second bit data signal from the amplitude difference of the previous bit signal, taking an absolute value of the obtained difference, judging whether the absolute value exceeds a preset noise signal amplitude difference lower limit, if not, the second bit data signal is an effective signal, otherwise, the second bit data signal is noise. After the card reader judges the second bit data signal according to two discrimination modes of signal average energy and adjacent signal amplitude difference, if the second bit data signal is judged to be an invalid signal, the card reader does not directly quit the decoding process but adds 1 to an invalid signal counter for maximum compatibility consideration, and the card reader should quit the operation until the invalid signal counter is larger than the non-standard signal upper limit, which indicates that the magnetic strip card magnetic medium environment is too severe. The judgment modes from the third bit to the last bit are consistent with the judgment flow of the second bit. Therefore, the method of the invention not only has sufficient means for judging the effective signal, but also can improve the decoding compatibility to the severe signal environment by setting the signal average energy and the invalid signal counter.
Drawings
Fig. 1 is a schematic diagram of a method for improving decoding compatibility of a magnetic stripe card reader according to an embodiment of the present invention.
Fig. 2 is a schematic diagram of a method for improving decoding compatibility of a magnetic stripe card reader according to a second embodiment of the present invention.
Fig. 3 is a schematic diagram of a data signal in a magnetic stripe card encoding format F2F according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer, the present invention will be described in further detail with reference to the accompanying drawings, and it is apparent that the described embodiments are only a part of the embodiments of the present invention, 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.
In an embodiment of the present invention, as shown in fig. 1, which is a schematic diagram of a method for improving decoding compatibility of a magnetic stripe card reader provided in the embodiment of the present invention, the method includes the following steps:
step 1, initializing the value of an invalid signal counter to be 0 by the card reader, initializing the value of a decoding state to be 0, initializing the value of bit signal average energy before initialization to be 0, and initializing the value of magnetic stripe data after decoding to be null.
And 2, the card reader acquires the non-standard signal upper limit and the signal average energy smoothing factor from the system area.
And 3, acquiring a first frame preamble synchronous signal and a first frame data signal of the magnetic stripe data by the card reader through the relative motion of the magnetic head and the magnetic stripe.
Here, the encoding format of the magnetic stripe card storage medium is implemented in accordance with the magnetic stripe card F2F encoding format. According to the F2F encoding format, each of the valid information data stored on the magnetic strips is preceded by a segment of synchronization signal data. The purpose is to make the magnetic head ready for signal synchronization and digital signal conversion by reading the synchronous signal data. In the embodiment of the invention, the energy average calculation is carried out on the segment of the synchronous signal to generate the energy of the start bit signal.
And 4, the card reader sums all signal peaks in the first frame preamble synchronous signal to generate a peak sum according to the first frame preamble synchronous signal, and performs peak sum average calculation on the peak sum according to the peak sum of the first frame preamble synchronous signal to generate initial bit signal energy.
Here, all peaks appearing in the synchronization signal are extracted first, and the peaks are superimposed to generate a peak sum. And then extracting the total number of peaks in the synchronous signal, dividing the total number of the peaks by the total number of the peaks to perform average calculation, and obtaining the data which is the energy of the initial bit signal. This starting bit signal energy will be one of the important decision parameters for the subsequent valid signal.
Taking fig. 3 as an example of a data signal diagram of the magnetic stripe card encoding format F2F provided by the embodiment of the present invention, assuming that there are 4 leading zero-value bit data signals in the leading synchronization signal of the first frame, the peak sum is the peak sum in 4 bits, i.e., the peak value sum is the signal peak value P11+ the signal peak value P12+ the signal peak value P13+ the signal peak value P14, the total number of the peak values is 4, and the value of the energy of the starting bit signal is (the signal peak value P11+ the signal peak value P12+ the signal peak value P13+ the signal peak value P14)/4.
And 5, the card reader extracts a first bit data signal according to the first frame data signal, calculates the signal amplitude difference of the first bit data signal to generate a front bit signal amplitude difference, extracts the maximum peak value of the first bit data signal to generate first bit signal average energy, and resets the front bit signal average energy according to the first bit signal average energy.
Here, the signal amplitude difference calculation is performed on the first bit data signal to generate a previous bit signal amplitude difference, specifically, a maximum peak value and a minimum peak value of the first bit data signal are extracted, and the minimum peak value is subtracted from the maximum peak value to obtain a difference, which is the previous bit signal amplitude difference;
taking fig. 3 as an example of a schematic diagram of a data signal in the magnetic stripe card encoding format F2F according to the embodiment of the present invention, the amplitude difference of the bit signal of the first bit data signal, that is, the amplitude difference of the bit signal at the previous place, is specifically an amplitude difference a 1;
extracting the maximum peak value of the first bit data signal to generate first bit signal average energy, specifically, setting the value of the first bit signal average energy as the maximum peak value of the first bit data signal;
taking fig. 3 as an example of a schematic diagram of a data signal in the magnetic stripe card encoding format F2F according to an embodiment of the present invention, the maximum peak value of the first bit data signal is specifically the signal peak value P21, that is, the average energy of the first bit signal is specifically the signal peak value P21.
And 6, the card reader extracts a second bit data signal according to the first frame data signal.
And 7, the card reader judges the noise signal according to the amplitude difference of the second bit data signal and the previous bit signal to generate a first signal judgment result.
Here, the values of the first signal determination result include: both valid and noise signals. If the signal waveform of the second bit data signal does not conform to the encoding format of the magnetic stripe card F2F, the value of the first signal judgment result is a noise signal; and if the absolute value of the difference value between the signal amplitude difference of the second bit data signal and the signal amplitude difference of the previous bit data signal is greater than the lower limit of the noise signal amplitude difference, the value of the first signal judgment result is a noise signal.
Here, taking the schematic diagram of the data signal in the magnetic stripe card encoding format F2F provided in fig. 3 as an example, the amplitude difference of the previous bit signal is specifically an amplitude difference a1, and the signal amplitude difference of the second bit data signal is specifically an amplitude difference a 2. If the amplitude difference A2-the amplitude difference A1| > the lower limit of the amplitude difference of the noise signal, the current signal amplitude difference deviates from the range of the effective signal amplitude difference, namely the current bit signal is judged as the noise signal. Otherwise, the current signal amplitude difference does not deviate from the effective signal amplitude difference range, and the signal amplitude difference of the previous bit is reset according to the amplitude difference A2.
And 8, judging the first signal judgment result by the card reader, turning to the step 9 when the first signal judgment result is an effective signal, adding 1 to the value of the invalid signal counter when the first signal judgment result is a noise signal, and turning to the step 12.
Here, when the current bit data signal is found to be substantially a noise signal, the statistics are performed by the invalid signal counter. The invalid signal counter is used for counting invalid signals when a number of bit signals in a current data frame signal exceeds a non-standard signal upper limit set by a system, and when the number of the invalid signals exceeds the non-standard signal upper limit set by the system, the invalid signals in the current data frame signal are excessive, namely the environment of a magnetic medium on a read magnetic stripe is too poor or interference signals in the reading environment of a magnetic head are excessive, in this case, time is saved, misreading is avoided, and the card reader can definitely quit the current reading and decoding process and send error early warning information to an upper computer.
And 9, the card reader extracts the maximum peak value of the second bit data signal according to the second bit data signal to generate second bit signal energy.
Taking fig. 3 as an example of a schematic diagram of a data signal with an encoding format of the magnetic stripe card F2F according to an embodiment of the present invention, the energy of the second bit signal is specifically the signal peak P22.
Step 10, the card reader carries out effective signal judgment operation according to the initial bit signal energy, the previous bit signal average energy and the second bit signal energy to generate a second signal judgment result,
the method specifically comprises the following steps: step 101, a card reader acquires a signal average energy smoothing factor and an initial bit signal energy threshold proportion from a system area;
102, generating a first signal energy threshold by the card reader according to the product of the initial bit signal energy and the initial bit signal energy threshold ratio;
103, the card reader calculates the average energy of the current signal according to the second bit signal energy, the average energy of the previous bit signal and the smoothing factor of the average energy of the signal to generate the average energy of the second bit signal, resets the average energy of the previous bit signal according to the average energy of the second bit signal,
the method specifically comprises the following steps: step 1031, the card reader calculates according to the formula (1- α) x Pave + α x Pcur and the signal average energy smoothing factor and the second bit signal energy, the previous bit signal average energy and the signal average energy smoothing factor to generate the second bit signal average energy, wherein α is the signal average energy smoothing factor, Pave is the previous bit signal average energy, and Pcur is the second bit signal energy;
taking fig. 3 as an example of a schematic diagram of a data signal in a magnetic stripe card encoding format F2F according to an embodiment of the present invention, where Pcur is specifically a signal peak value P22, and Pave is specifically a signal peak value P21, the average energy of the second bit signal is specifically (1- α) × signal peak value P21+ α × signal peak value P22, and after the calculation of the average energy of the second bit signal is finished, the average energy of the previous bit signal, that is, the value of Pave is changed to the average energy of the second bit signal.
Here, there is a special processing procedure for Pave calculation, because there is no so-called previous bit signal average energy for the first bit signal data, so that at the time of the first bit, the first bit signal average energy is identical to the first bit signal energy, and from the second bit until the last bit, the current bit signal energy is different from the current bit signal average energy. The specific relationship is shown in the following table.
Watch 1
Step 1032, the card reader resets the average energy of the previous bit signal according to the average energy of the second bit signal, specifically, the card reader resets the average energy of the previous bit signal to the average energy of the second bit signal:
and step 104, when the value of the average energy of the second bit signal is greater than or equal to the value of the first signal energy threshold, the card reader sets the value of the second signal judgment result as an effective signal.
Here, the values of the second signal determination result include: an active signal or an inactive signal.
And 11, judging the second signal judgment result by the card reader, turning to step 13 when the second signal judgment result is a valid signal, adding 1 to the value of the invalid signal counter when the second signal judgment result is an invalid signal, and turning to step 12.
And step 12, the card reader judges whether the value of the invalid signal counter is greater than the value of the non-standard signal upper limit, if the value of the invalid signal counter is greater than the value of the non-standard signal upper limit, the value of the decoding state is set to be 1, the step 15 is carried out, and if the value of the invalid signal counter is less than or equal to the value of the non-standard signal upper limit, the step 14 is carried out.
Here, if the card reader sets the value of the decoding state to 1, the identification is made when the number of invalid signals exceeds the non-standard signal upper limit set by the system.
And step 13, the card reader performs effective signal decoding operation according to the second bit data signal to generate a second bit value, and performs bit adding operation on the decoded magnetic stripe data according to the second bit value.
And step 14, the card reader extracts the third bit data signal according to the first frame data signal and performs noise signal judgment, effective signal judgment and effective signal decoding on the third bit data signal until the end bit data signal of the first frame data signal is extracted and completes the noise signal judgment, the effective signal judgment and the effective signal decoding on the end bit data signal.
And step 15, the card reader judges whether the value of the decoding state is 0, and when the value of the decoding state is 0, the card reader sends decoding success state information and decoded magnetic stripe data to the upper computer.
In the second embodiment of the present invention, as shown in fig. 2, which is a schematic diagram of a method for improving decoding compatibility of a magnetic stripe card reader provided in the second embodiment of the present invention, the method includes the following steps:
step 21, the card reader initializes the value of the invalid signal counter to 0, initializes the value of the decoding state to 0, initializes the value of the average energy of the bit signal before initialization to 0, and initializes the value of the magnetic stripe data after decoding to null.
And step 22, the card reader acquires the non-standard signal upper limit and the signal average energy smoothing factor from the system area.
And step 23, the card reader acquires a first frame preamble synchronous signal and a first frame data signal of the magnetic stripe data through the relative motion of the magnetic head and the magnetic stripe.
Here, the encoding format of the magnetic stripe card storage medium is implemented in accordance with the magnetic stripe card F2F encoding format. According to the F2F encoding format, each of the valid information data stored on the magnetic strips is preceded by a segment of synchronization signal data. The purpose is to make the magnetic head ready for signal synchronization and digital signal conversion by reading the synchronous signal data. In the embodiment of the invention, the energy average calculation is carried out on the segment of the synchronous signal to generate the energy of the start bit signal.
And 24, the card reader sums all signal peaks in the first frame preamble synchronous signal to generate a peak sum according to the first frame preamble synchronous signal, and performs peak sum average calculation on the peak sum according to the peak sum of the first frame preamble synchronous signal to generate the starting bit signal energy.
Here, all peaks appearing in the synchronization signal are extracted first, and the peaks are superimposed to generate a peak sum. And then extracting the total number of peaks in the synchronous signal, dividing the total number of the peaks by the total number of the peaks to perform average calculation, and obtaining the data which is the energy of the initial bit signal. This starting bit signal energy will be one of the important decision parameters for the subsequent valid signal.
And 25, the card reader extracts a first bit data signal according to the first frame data signal, calculates the signal amplitude difference of the first bit data signal to generate a front bit signal amplitude difference, extracts the maximum peak value of the first bit data signal to generate first bit signal average energy, and resets the front bit signal average energy according to the first bit signal average energy.
Here, the signal amplitude difference calculation is performed on the first bit data signal to generate a previous bit signal amplitude difference, specifically, a maximum peak value and a minimum peak value of the first bit data signal are extracted, and the minimum peak value is subtracted from the maximum peak value to obtain a difference, which is the previous bit signal amplitude difference;
the maximum peak value of the first bit data signal is extracted to generate the average energy of the first bit signal, specifically, the average energy of the first bit signal is set to the maximum peak value of the first bit data signal.
The card reader extracts a second bit data signal from the first frame data signal, step 26.
Step 27, the card reader performs noise signal judgment operation according to the amplitude difference between the second bit data signal and the previous bit signal to generate a first signal judgment result,
the method specifically comprises the following steps: step 271, the card reader performs standard magnetic stripe encoding format judgment operation on the second bit data signal according to the second bit data signal to generate a first judgment result;
step 272, the card reader judges whether the first judgment result is successful, if the first judgment result is failed, the card reader exits the noise signal judgment operation flow and sets the value of the first signal judgment result as the noise signal, and the step goes to step 28; if the first judgment result is successful, the card reader carries out signal amplitude judgment operation on the second bit data signal according to the amplitude difference between the second bit data signal and the previous bit signal to generate a second judgment result,
the method specifically comprises the following steps: 2721, acquiring a noise signal amplitude difference lower limit from a system area by a card reader;
2722, calculating the signal amplitude difference of the second bit data signal by the card reader according to the second bit data signal to generate the current bit signal amplitude difference;
2723, the card reader subtracts the difference of the amplitude difference of the previous bit signal from the amplitude difference of the current bit signal to obtain an absolute value, and generates a first signal amplitude difference;
step 2724, the card reader judges whether the value of the first signal amplitude difference is greater than the value of the lower limit of the noise signal amplitude difference, if the value of the first signal amplitude difference is less than or equal to the value of the lower limit of the noise signal amplitude difference, the step 2725 is carried out, and if the value of the first signal amplitude difference is greater than the value of the lower limit of the noise signal amplitude difference, the step 2726 is carried out;
2725, setting the value of the second judgment result to be successful by the card reader, resetting the amplitude difference of the previous bit signal according to the amplitude difference of the current bit signal, and turning to the step 273 after the resetting is successful;
2726, the card reader exits the signal amplitude judgment operation process and sets the value of the second judgment result as failure;
step 273, the card reader judges whether the result of the second judgment result is successful, if the second judgment result is successful, the card reader sets the value of the first signal judgment result as an effective signal, and the step 28 is switched to; if the second determination result is failure, the card reader exits the noise signal determination operation procedure and sets the value of the first signal determination result as the noise signal, and goes to step 28.
Here, the values of the first signal determination result include: both valid and noise signals. If the signal waveform of the second bit data signal does not conform to the encoding format of the magnetic stripe card F2F, the value of the first signal judgment result is a noise signal; and if the absolute value of the difference value between the signal amplitude difference of the second bit data signal and the signal amplitude difference of the previous bit data signal is greater than the lower limit of the noise signal amplitude difference, the value of the first signal judgment result is a noise signal.
In step 28, the card reader determines the first signal determination result, and proceeds to step 29 when the first signal determination result is a valid signal, and increments the value of the invalid signal counter by 1 when the first signal determination result is a noise signal and proceeds to step 32.
Here, when the current bit data signal is found to be substantially a noise signal, the statistics are performed by the invalid signal counter. The invalid signal counter is used for counting invalid signals when a number of bit signals in a current data frame signal exceeds a non-standard signal upper limit set by a system, and when the number of the invalid signals exceeds the non-standard signal upper limit set by the system, the invalid signals in the current data frame signal are excessive, namely the environment of a magnetic medium on a read magnetic stripe is too poor or interference signals in the reading environment of a magnetic head are excessive, in this case, time is saved, misreading is avoided, and the card reader can definitely quit the current reading and decoding process and send error early warning information to an upper computer.
And 29, the card reader extracts the maximum peak value of the second bit data signal according to the second bit data signal to generate second bit signal energy.
Step 30, the card reader carries out effective signal judgment operation according to the initial bit signal energy, the previous bit signal average energy and the second bit signal energy to generate a second signal judgment result,
the method specifically comprises the following steps: step 301, a card reader obtains a signal average energy smoothing factor and an initial bit signal energy threshold proportion from a system area;
step 302, the card reader generates a first signal energy threshold according to the product of the initial bit signal energy and the initial bit signal energy threshold ratio;
step 303, the card reader calculates the average energy of the current signal according to the second bit signal energy, the average energy of the previous bit signal, and the smoothing factor of the average energy of the signal to generate the average energy of the second bit signal, and resets the average energy of the previous bit signal according to the average energy of the second bit signal,
the method specifically comprises the following steps: step 3031, the card reader calculates to generate the second bit signal average energy according to the formula (1- α) x Pave + α x Pcur according to the second bit signal energy, the previous bit signal average energy and the signal average energy smoothing factor, wherein α is the signal average energy smoothing factor, Pave is the previous bit signal average energy, and Pcur is the second bit signal energy;
3032, the card reader resets the average energy of the previous bit signal according to the average energy of the second bit signal, specifically, the card reader resets the average energy of the previous bit signal to the average energy of the second bit signal;
and step 304, when the value of the average energy of the second bit signal is greater than or equal to the value of the first signal energy threshold, the card reader sets the value of the second signal judgment result as an effective signal.
Here, the values of the second signal determination result include: an active signal or an inactive signal.
In step 31, the card reader determines the second signal determination result, and proceeds to step 33 when the second signal determination result is a valid signal, and increments the value of the invalid signal counter by 1 when the second signal determination result is an invalid signal, and proceeds to step 32.
In step 32, the card reader determines whether the value of the invalid signal counter is greater than the value of the non-standard signal upper limit, if the value of the invalid signal counter is greater than the value of the non-standard signal upper limit, the value of the decoding state is set to 1, and the process goes to step 35, and if the value of the invalid signal counter is less than or equal to the value of the non-standard signal upper limit, the process goes to step 34.
Here, if the card reader sets the value of the decoding state to 1, the identification is made when the number of invalid signals exceeds the non-standard signal upper limit set by the system.
And step 33, the card reader performs effective signal decoding operation according to the second bit data signal to generate a second bit value, and performs bit adding operation on the decoded magnetic stripe data according to the second bit value.
And step 34, the card reader extracts the third bit data signal according to the first frame data signal and performs noise signal judgment, effective signal judgment and effective signal decoding on the third bit data signal until the end bit data signal of the first frame data signal is extracted and completes the noise signal judgment, the effective signal judgment and the effective signal decoding on the end bit data signal.
And step 35, the card reader judges whether the value of the decoding state is 0, and when the value of the decoding state is 0, the card reader sends decoding success state information and decoded magnetic stripe data to the upper computer.
The invention provides a method for improving decoding compatibility of a magnetic stripe card reader, which comprises two effective signal judgment methods: the effective signal identification method takes the signal average energy of continuous signals and the amplitude difference of adjacent bit signals as judgment basis.
For the former: firstly, generating initial bit signal energy according to a first frame preamble synchronous signal, generating a first signal energy threshold by the product of the ratio of the value and the initial bit signal energy threshold, and taking the first signal energy threshold as a final condition for effective signal judgment. And secondly, the card reader acquires the first bit data signal, generates first bit signal energy and assigns the first bit signal energy as the average energy of the previous bit signal. And then, the card reader acquires a second bit data signal and generates second bit signal energy, generates second bit signal average energy according to the previous bit signal average energy, the signal average energy smoothing factor and the second bit signal energy in a calculation mode of the signal average energy, and resets the previous bit signal average energy to the second bit signal average energy. The card reader compares the average energy of the second bit signal with the first signal energy threshold, and if the average energy of the second bit signal is smaller than the first signal energy threshold, the card reader is regarded as an invalid signal; otherwise, the signal energy greater than or equal to the first signal energy threshold is regarded as a valid signal.
For the latter, the decision rule includes two: whether the waveform of the second bit data signal meets the requirement of the encoding format of the magnetic stripe card encoding F2F is judged, if yes, the signal is continuously compared, otherwise, the signal is noise; and subtracting the amplitude difference of the second bit data signal from the amplitude difference of the previous bit signal, taking an absolute value of the obtained difference, judging whether the absolute value exceeds a preset noise signal amplitude difference lower limit, if not, the second bit data signal is an effective signal, otherwise, the second bit data signal is noise. After the card reader judges the second bit data signal according to two discrimination modes of signal average energy and adjacent signal amplitude difference, if the second bit data signal is judged to be an invalid signal, the card reader does not directly quit the decoding process but adds 1 to an invalid signal counter for maximum compatibility consideration, and the card reader should quit the operation until the invalid signal counter is larger than the non-standard signal upper limit, which indicates that the magnetic strip card magnetic medium environment is too severe. The judgment modes from the third bit to the last bit are consistent with the judgment flow of the second bit. Therefore, the method of the invention not only has sufficient means for judging the effective signal, but also can improve the decoding compatibility to the severe signal environment by setting the signal average energy and the invalid signal counter.
Those of skill would further appreciate that the various illustrative components and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied in hardware, a software module executed by a processor, or a combination of the two. A software module may reside in Random Access Memory (RAM), memory, Read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
The above-mentioned embodiments are intended to illustrate the objects, technical solutions and advantages of the present invention in further detail, and it should be understood that the above-mentioned embodiments are merely exemplary embodiments of the present invention, and are not intended to limit the scope of the present invention, and any modifications, equivalent substitutions, improvements and the like made within the spirit and principle of the present invention should be included in the scope of the present invention.

Claims (10)

1. A method for improving decoding compatibility of a magnetic stripe card reader, said method comprising:
step 1, initializing a value of an invalid signal counter to be 0, initializing a value of a decoding state to be 0, initializing a value of bit signal average energy before initialization to be 0, and initializing a value of magnetic stripe data after decoding to be null;
step 2, the card reader acquires a non-standard signal upper limit and a signal average energy smoothing factor from a system area;
step 3, the card reader obtains a first frame preamble synchronous signal and a first frame data signal of the magnetic stripe data through the relative motion of the magnetic head and the magnetic stripe;
step 4, the card reader sums all signal peaks in the first frame preamble synchronous signal to generate a peak sum according to the first frame preamble synchronous signal, and performs peak sum average calculation on the peak sum according to the peak sum of the first frame preamble synchronous signal to generate initial bit signal energy;
step 5, the card reader extracts a first bit data signal according to the first frame data signal, calculates the amplitude difference of the first bit data signal to generate a front bit signal amplitude difference, extracts the maximum peak value of the first bit data signal to generate a first bit signal average energy, and resets the front bit signal average energy according to the first bit signal average energy;
step 6, the card reader extracts a second bit data signal according to the first frame data signal;
step 7, the card reader judges the noise signal according to the amplitude difference of the second bit data signal and the previous bit signal to generate a first signal judgment result;
step 8, the card reader judges the first signal judgment result, and when the first signal judgment result is a valid signal, the step 9 is carried out, and when the first signal judgment result is a noise signal, the value of the invalid signal counter is added by 1, and the step 12 is carried out;
step 9, the card reader extracts the maximum peak value of the second bit data signal according to the second bit data signal to generate second bit signal energy;
step 10, the card reader carries out effective signal judgment operation according to the initial bit signal energy, the previous bit signal average energy and the second bit signal energy to generate a second signal judgment result;
step 11, the card reader judges the second signal judgment result, and when the second signal judgment result is a valid signal, the step 13 is carried out, and when the second signal judgment result is an invalid signal, the value of the invalid signal counter is added by 1, and the step 12 is carried out;
step 12, the card reader judges whether the value of the invalid signal counter is greater than the value of the non-standard signal upper limit, if the value of the invalid signal counter is greater than the value of the non-standard signal upper limit, the value of the decoding state is set to be 1, and the step 15 is carried out, and if the value of the invalid signal counter is less than or equal to the value of the non-standard signal upper limit, the step 14 is carried out;
step 13, the card reader performs effective signal decoding operation according to the second bit data signal to generate a second bit value, and performs bit adding operation on the decoded magnetic stripe data according to the second bit value;
step 14, the card reader extracts a third bit data signal according to the first frame data signal, and performs the noise signal judgment, effective signal judgment and effective signal decoding on the third bit data signal until an end bit data signal of the first frame data signal is extracted and the noise signal judgment, effective signal judgment and effective signal decoding are completed on the end bit data signal;
and step 15, the card reader judges whether the value of the decoding state is 0, and when the value of the decoding state is 0, the card reader sends decoding success state information and the decoded magnetic stripe data to an upper computer.
2. The method of claim 1, further comprising:
and when the value of the decoding state is 1, the card reader sends decoding failure state information to an upper computer.
3. The method of claim 1, wherein the reader initializes the invalid signal counter to a value of 0, and further comprising:
and the card reader sets and stores a non-standard signal upper limit, a signal average energy smoothing factor, a starting bit signal energy threshold proportion and a noise signal amplitude difference lower limit in the system area.
4. The method according to claim 3, wherein the card reader performs a noise signal determination operation according to the amplitude difference between the second bit data signal and the previous bit signal to generate a first signal determination result, specifically comprising:
the card reader carries out standard magnetic stripe encoding format judgment operation on the second bit data signal according to the second bit data signal to generate a first judgment result;
when the first judgment result is successful, the card reader performs signal amplitude judgment operation on the second bit data signal according to the amplitude difference between the second bit data signal and the previous bit signal to generate a second judgment result;
and when the second judgment result is successful, the card reader sets the value of the first signal judgment result as an effective signal.
5. The method according to claim 4, wherein the card reader performs a signal amplitude judgment operation on the second bit data signal according to the amplitude difference between the second bit data signal and a previous bit signal to generate a second judgment result, specifically comprising:
the card reader acquires the lower limit of the amplitude difference of the noise signal from the system area;
the card reader calculates the signal amplitude difference of the second bit data signal according to the second bit data signal to generate the current bit signal amplitude difference;
the card reader subtracts the absolute value of the difference of the amplitude difference of the current bit signal and the amplitude difference of the previous bit signal to generate a first signal amplitude difference;
when the value of the first signal amplitude difference is smaller than or equal to the value of the lower limit of the noise signal amplitude difference, the card reader sets the value of the second judgment result as successful and resets the previous bit signal amplitude difference according to the current bit signal amplitude difference.
6. The method of claim 5, further comprising:
and when the value of the first signal amplitude difference is larger than the value of the lower limit of the noise signal amplitude difference, the card reader exits the signal amplitude judgment operation process and sets the value of the second judgment result as failure.
7. The method of claim 4, further comprising:
when the first judgment result is failure, the card reader exits the noise signal judgment operation process and sets the value of the first signal judgment result as a noise signal;
and when the second judgment result is failure, the card reader exits the noise signal judgment operation process and sets the value of the first signal judgment result as a noise signal.
8. The method according to claim 3, wherein the card reader performs an effective signal determination operation according to the starting bit signal energy, the previous bit signal average energy, and the second bit signal energy to generate a second signal determination result, specifically comprising:
the card reader obtains the signal average energy smoothing factor and the initial bit signal energy threshold proportion from the system area;
the card reader generates a first signal energy threshold according to the product of the initial bit signal energy and the initial bit signal energy threshold ratio;
the card reader calculates the average energy of the current signal according to the second bit signal energy, the average energy of the previous bit signal and a signal average energy smoothing factor to generate the average energy of the second bit signal, and resets the average energy of the previous bit signal according to the average energy of the second bit signal;
and when the average energy value of the second bit signal is greater than or equal to the energy threshold value of the first signal, the card reader sets the value of the second signal judgment result as an effective signal.
9. The method according to claim 8, wherein the card reader performs current signal average energy calculation according to the second bit signal energy, previous bit signal average energy, and signal average energy smoothing factor to generate second bit signal average energy, and resets the previous bit signal average energy according to the second bit signal average energy, specifically comprising:
the card reader calculates according to the second bit signal energy, the previous bit signal average energy and the signal average energy smoothing factor and according to a formula (1-alpha) x Pave + alpha x Pcur to generate second bit signal average energy, wherein alpha is the signal average energy smoothing factor, Pave is the previous bit signal average energy and Pcur is the second bit signal energy;
the card reader resets the average energy of the previous bit signal according to the average energy of the second bit signal, and specifically, the card reader resets the average energy of the previous bit signal to the average energy of the second bit signal.
10. The method of claim 8, further comprising:
and when the value of the average energy of the second bit signal is smaller than the value of the first signal energy threshold, the card reader exits the effective signal judgment operation processing and sets the value of the second signal judgment result as an invalid signal.
CN201910873663.7A 2019-09-12 2019-09-12 Method for improving decoding compatibility of magnetic stripe card reader Active CN110619247B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910873663.7A CN110619247B (en) 2019-09-12 2019-09-12 Method for improving decoding compatibility of magnetic stripe card reader

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910873663.7A CN110619247B (en) 2019-09-12 2019-09-12 Method for improving decoding compatibility of magnetic stripe card reader

Publications (2)

Publication Number Publication Date
CN110619247A true CN110619247A (en) 2019-12-27
CN110619247B CN110619247B (en) 2022-11-22

Family

ID=68923014

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910873663.7A Active CN110619247B (en) 2019-09-12 2019-09-12 Method for improving decoding compatibility of magnetic stripe card reader

Country Status (1)

Country Link
CN (1) CN110619247B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6607136B1 (en) * 1998-09-16 2003-08-19 Beepcard Inc. Physical presence digital authentication system
CN105391659A (en) * 2014-09-05 2016-03-09 上海华虹集成电路有限责任公司 Circuit for decoding high-speed type A signal sent by card
CN108734036A (en) * 2018-05-18 2018-11-02 深圳市中科汉天下电子有限公司 A kind of coding/decoding method and device of magnetic stripe card

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6607136B1 (en) * 1998-09-16 2003-08-19 Beepcard Inc. Physical presence digital authentication system
CN105391659A (en) * 2014-09-05 2016-03-09 上海华虹集成电路有限责任公司 Circuit for decoding high-speed type A signal sent by card
CN108734036A (en) * 2018-05-18 2018-11-02 深圳市中科汉天下电子有限公司 A kind of coding/decoding method and device of magnetic stripe card

Also Published As

Publication number Publication date
CN110619247B (en) 2022-11-22

Similar Documents

Publication Publication Date Title
EP1185950B1 (en) Magnetic stripe reader
WO2017181772A1 (en) Speech detection method and apparatus, and storage medium
CN109919160B (en) Verification code identification method, device, terminal and storage medium
KR20160026496A (en) Method and apparatus for authenticating user using ecg signal
Kelkboom et al. Binary biometrics: An analytic framework to estimate the performance curves under gaussian assumption
KR20160024600A (en) Method and apparatus for authenticating user using ecg signal
KR20180072290A (en) Method for generating electrocardiogram for identifying a person and method for identifying a person using the electrocardiogram
CN110619247B (en) Method for improving decoding compatibility of magnetic stripe card reader
CN110659528B (en) Anti-interference decoding method for magnetic stripe card reader
CN108345816A (en) A kind of Quick Response Code extracting method and system in the case where uneven illumination is even
JP4947216B2 (en) Image processing apparatus and image processing method
US8264332B2 (en) Apparatus and method for demodulating subcarrier tag signal in RFID reader
CN112395895A (en) Magnetic stripe software decoding method and device and computer readable storage medium
CN103106379A (en) Non-contact type integrated circuit (IC) card number collecting method with robustness feature
CN110633588B (en) Noise identification method for magnetic stripe card reader
CN108242978A (en) Interpretation method, device, spectrum detector and storage medium
KR102248352B1 (en) Method and device for removing objects in video
CN105956553B (en) Unlocking method and mobile terminal
CN110649941B (en) Method for recognizing noise by non-contact card reader
CN110647776B (en) Magnetic stripe card decoding method
CN107809310B (en) Information detection method and device based on grouping variance and receiving equipment
CN110688867B (en) Method for synchronizing information of magnetic stripe card reader
CN109902519B (en) Magnetic stripe decoding method, system and related device
CN108242979A (en) Interpretation method, device, spectrum detector and storage medium
JP6898171B2 (en) Magnetic recording medium reading method, reading device and program

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
CB02 Change of applicant information

Address after: 100080, Beijing, Suzhou Street, Haidian District No. 20, building 2, on the north side of the four floor

Applicant after: Zhaoxun Hengda Technology Co.,Ltd.

Address before: 100080, Beijing, Suzhou Street, Haidian District No. 20, building 2, on the north side of the four floor

Applicant before: MEGAHUNT MICROELECTRONIC TECH. (BEIJING) Co.,Ltd.

CB02 Change of applicant information
GR01 Patent grant
GR01 Patent grant