Home Contents | # magstripe:enable | Magstripe | Core4 Lua Event System

## SYNOPSIS

1. maghandle:enable([mask])
2. maghandle:trigger([mask])
3. maghandle:disable()

## DESCRIPTION

By calling magstripe:enable(), the magstripe reader becomes active and will report new magstripe data whenever a card is read. The reader stays active until one of the other two forms is called.

The function magstripe:trigger() works similar to the first form, but the reader will read only a single card and will go inactive afterwards.

Use magstripe:disable() to deactivate an armed reader.

Whenever magnetic data is ready, the callback magstripe.magdataChanged() is called with the data that was read.

The optional mask parameter can be used to select which tracks must be read. It is an integer value, where bit 0 indicates track 1, bit 1 indicates track 2 and bit 2 indicates track 3. If the value is zero, the command disables the reader. By default, all tracks are read.

## NOTES

It is possible that a late magstripe event is reported right after magstripe:disable() was called when a card is read at the same moment.

## SEE ALSO

magstripe.magdataChanged