android.device
Class MagManager

java.lang.Object
  extended by android.device.MagManager

public class MagManager
extends java.lang.Object

The MagManager class is used to initialize and control the MSR card reader.

To control the MSR card reader with this class, use the following steps:

  1. You can obtain an instance of this class by calling.

    MagManager manager = new MagManager();

  2. initialize slot for the MSR card reader with open().
  3. query whether the MSR card is not swipe with checkCard().
  4. get information on all 3 strips with getAllStripInfo(byte[] ).
  5. Call close() to close the slot for MSR card reader.


Constructor Summary
MagManager()
           
 
Method Summary
 int checkCard()
          check if a card swipe action has taken place
 int close()
          Close the MSR reader
 int getAllStripInfo(byte[] info)
          Get information on all 3 strips
 int getEncryptStripInfo(int AlgMode, int keyIndex, byte[] info, byte[] cardNo, byte[] KSN)
          Get information on all 3 Encrypt strips data and plain text card NO.
 int getSingleStripInfo(int strip, byte[] info)
          Get specific strip information
 int open()
          Open the MSR reader
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MagManager

public MagManager()
Method Detail

open

public int open()
Open the MSR reader

Returns:
Open operation is successful, negative number if operation is not successful

close

public int close()
Close the MSR reader

Returns:
0 if OK. negative number if failed.

checkCard

public int checkCard()
check if a card swipe action has taken place

Returns:
0 if card swipe action has been detected, negative number if swipe action has not been detected

getAllStripInfo

public int getAllStripInfo(byte[] info)
Get information on all 3 strips

Parameters:
info - to store the information. The information is organized in TLV (tag length value) format. tag is 1 byte, with the following meaning. 01 - strip 1, 02 - strip 2, 03 - strip 3
Returns:
length of information. 0 length if not information is available.

getSingleStripInfo

public int getSingleStripInfo(int strip,
                              byte[] info)
Get specific strip information

Parameters:
strip - number, could be 1 or 2 or 3
info - to store the strip information
Returns:
eturns the length of information

getEncryptStripInfo

public int getEncryptStripInfo(int AlgMode,
                               int keyIndex,
                               byte[] info,
                               byte[] cardNo,
                               byte[] KSN)
Get information on all 3 Encrypt strips data and plain text card NO.

Parameters:
Encrypt - data DES algorithm type.1 is dupkt key
keyIndex - the DES Key index: 0 - 149
info - to store the encrypt information. The information is organized in TLV (tag length value) format. tag is 1 byte, with the following meaning. 01 - strip 1, 02 - strip 2, 03 - strip 3
cardNo - to store the plain text PAN.
KSN - to store the KSN key(10 bytes).
Returns:
length of encrypt information. 0 length if not information is available.