Bluetooth® Sample Application Programmer's Reference: Magnetic stripe processing

Bluetooth

Bluetooth® Sample Application Programmer's Reference
Magnetic stripe processing

Presentation

Functions

int magStart (void)
 start the magstripe perypheral More...
 
int magStop (void)
 stop the magstripe perypheral More...
 
int magGet (char *trk1, char *trk2, char *trk3)
 get magstripe tracks More...
 
int getCard (unsigned char *buf, const char *ctl)
 process event card input More...
 
void detectCard (void)
 detect if chip card is inserted More...
 

Function Documentation

int magStart ( void  )

start the magstripe perypheral

Open the associated channel. Start waiting the magnetic stripe card. Normally this function should be called just before magnetic card acquisition.

Returns
non-negative value if OK; negative otherwise Utilities.h Peripherals.c
int magStop ( void  )

stop the magstripe perypheral

Stop waiting the magnetic stripe card. Close the associated channel. Normally this function should be called just after magnetic card acquisition.

Returns
non-negative value if OK; negative otherwise Utilities.h Peripherals.c
int magGet ( char *  trk1,
char *  trk2,
char *  trk3 
)

get magstripe tracks

Verify whether a card is swiped; if so, copy its tracks into trk1, trk2, trk3 buffers. If a pointer trk1, trk2, or trk3 is zero, the related track data will be ignored. The size of buffers pointed by trk1, trk2, trk3 should be 128. Please use getCard function instead as it is much more stable for Telium.

Parameters
trk1(O) Buffer to capture track1, this size of the buffer should be 128
trk2(O) buffer to capture track2, this size of the buffer should be 128
trk3(O) Buffer to capture track3, this size of the buffer should be 128
Returns
  • negative if failure.
  • number of tracks read.
  • zero means that the card is not swiped. Utilities.h Peripherals.c
int getCard ( unsigned char *  buf,
const char *  ctl 
)

process event card input

Process card input. The application waits for an external event: chip card inserted or magnetic stripe card swiped or a key pressed or 30 sec timeout

The control string contains characters 'c', 'm' or 'k' to indicate what type of input is accepted.

If a chip card is inserted the ATR is saved into buf and the value �c?is returned.

If a magnetic stripe card is swiped the track1 is saved into buf+0, the track2 into buf+128 and the track3 into buf+256 and the value 'm' is returned.

If a key is pressed it is saved into buf and the value 'k' is returned Timeout of 30 seconds is set.

Please use this function for Telium instead of magGet function for mag reader interfacing as this is much stable.

Parameters
buf(I) Buffer to capture the input (character or ATR or 3 tracks)
ctl(I) control string containing 'c','k','m' to indicate what type of input is accepted
Precondition
  • buf!=0; the size of the buffer should be not less that 128*3
  • ctl!=0
Returns
  • 'k' if a key is pressed.
  • 'm' if a card is swiped.
  • 'c' if a card is inserted.
  • 0 in case of timeout.
  • negative in case of error.

Utilities.h Peripherals.c

void detectCard ( void  )

detect if chip card is inserted

Wait until the chip card is removed

Returns
N/A Utilities.h Peripherals.c

Ingenico