ZSDK_API  1.5.1049
 All Classes Functions Enumerations Enumerator Properties Pages
<MagCardReader> Protocol Referenceabstract

Provides access to the magnetic card reader, for printers equipped with one. More...

#import <MagCardReader.h>

Instance Methods

(NSArray *) - read:error:
 Activates the printer's magnetic card reader, if present, and waits for timeoutMS milliseconds for a card to be swiped.
 

Detailed Description

Provides access to the magnetic card reader, for printers equipped with one.

Note
Only mobile Zebra printers are available with built-in readers.
#import "TcpPrinterConnection.h"
#import <UIKit/UIKit.h>
#import "ZebraPrinter.h"
#import "ZebraPrinterFactory.h"
TcpPrinterConnection *zebraPrinterConnection = [[TcpPrinterConnection alloc] initWithAddress:@"192.168.1.100" andWithPort:6101];
BOOL success = [zebraPrinterConnection open];
NSError *error = nil;
id<ZebraPrinter,NSObject> printer = [ZebraPrinterFactory getInstance:zebraPrinterConnection error:&error];
NSArray *tracks = [[printer getMagCardReader] read:1000 error:&error];
[zebraPrinterConnection close];
if (error != nil || printer == nil || success == NO) {
UIAlertView *errorAlert = [[UIAlertView alloc] initWithTitle:@"Error" message:[error localizedDescription] delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil];
[errorAlert show];
[errorAlert release];
} else {
NSLog(@"Track 1: %@", [tracks objectAtIndex:0]);
NSLog(@"Track 2: %@", [tracks objectAtIndex:1]);
NSLog(@"Track 3: %@", [tracks objectAtIndex:2]);
}
[zebraPrinterConnection release];

Method Documentation

- (NSArray*) read: (NSInteger)  timeoutMS
error: (NSError **)  error 

Activates the printer's magnetic card reader, if present, and waits for timeoutMS milliseconds for a card to be swiped.

If the printer does not have a reader the call will timeout.

Parameters
timeoutMSThe amount of time in milliseconds to enable the reader and wait for a card to be swiped.
errorWill be set to the error that occured.
Returns
An array of three strings corresponding to the tracks of the card. If a track could not be read that string will be empty.

The documentation for this protocol was generated from the following file: