Class: MagStripe

MagStripe()

Functions to monitor and control compatible magnetic card readers attached to the device.

QBrowser automatically sends magnetic card data to the function, specified in the settings (msrFunction). The format of the function is: function MagneticCardData(card)

Parameters: - card.tracks(array) - an array with card track data. Every track is returned as a string or null if the track was not read - card.cardholderName(string) - in case of valid financial card and correctly parsed track 1, cardholder name is stored here - card.accountNumber(string) - in case of valid financial card and correctly parsed track 1 or 2, account number is stored here - card.expirationMonth(number) - in case of valid financial card and correctly parsed track 1 or 2, expiration month is stored here - card.expirationYear(number) - in case of valid financial card and correctly parsed track 1 or 2, expiration year is stored here

In the case of encrypted card data, QBrowser will send the data to the function, specified in settings (msrEncryptedFunction). Format: EncryptedMagneticCardData(encryption, tracks, data)

Parameters: - encryption - the encryption type - tracks - number of tracks - data - the encrypted card data in hex

Constructor

new MagStripe()

Source:

Methods

(static) this.monitorStatus(readerStatus)

Helper function to monitor the status of the supported magnetic card readers. This function is used to receive realtime notifications when supported a reader becomes available.
Parameters:
Name Type Description
readerStatus function Callback function that updates the card reader status in real time. Parameters: info(object) - info.connected(boolean) - indicates if supported reader is connected - info.name(string) - reader name - info.version(string) - reader firmware version
Source:
Example
function MSStatus(info)
{
    if (info.connected)
        document.body.innerHTML+="Connected magnetic card reader <b>"+info.name+" "+info.version+"</b>, find me some cards!<br/>";
    else
        document.body.innerHTML+="Hey I want my magnetic card reader back!<br/>";
}

(static) this.setActiveHead(headIndex, successFunction, errorFunction)

Set the active head for scanner
Parameters:
Name Type Description
headIndex number Currently real head is on index 0, emulated head is on 1
successFunction function Callback function on success
errorFunction function Error function
Source:

(static) this.setEMSREncryption(encryptionIndex, successFunction, errorFunction)

Set the encryption type
Parameters:
Name Type Description
encryptionIndex number index of encryption type. Use 3 for IDTECH 3
successFunction function Callback function on success
errorFunction function Error function
Source:
Example
QBrowser.MagStripe.setEMSREncryption(2, EMSRSuccess, EMSRFailed);

(static) this.setEMSRMaskedData(boolExpiration, unmaskedDigitsAtStart, unmaskedDigitsAtEnd, successFunction, errorFunction)

Config the mask card data
Parameters:
Name Type Description
boolExpiration boolean show expiration
unmaskedDigitsAtStart number number of unmasked digits at start, max is 6
unmaskedDigitsAtEnd number number of unmasked digits at end, max is 6
successFunction function Callback function on success
errorFunction function Error function
Source:
Example
QBrowser.MagStripe.setEMSRMaskedData(true, 4, 4, EMSRSuccess, EMSRFailed);

(static) this.simulate()

Helper function to simulate magnetic card scan for testing purposes. The simulated magnetic card data is sent to the function in QBrowsers settings.
Source: