Owner's manual

23
SECTION 3. CODE EXAMPLES
Open Device:
self.mtSCRALib = [[MTSCRA alloc] init];
[self.mtSCRALib
listenForEvents:(TRANS_EVENT_OK|TRANS_EVENT_START|TRANS_EVENT_ERROR)];
//iDynamo
[self.mtSCRALib setDeviceType:(MAGTEKIDYNAMO)];
[self.mtSCRALib setDeviceProtocolString:(“com.magtek.idynamo”)];
[self.mtSCRALib setDeviceType:(MAGTEKIDYNAMO)];
//Audio
//[self.mtSCRALib setDeviceType:(MAGTEKAUDIOREADER)];
[self.mtSCRALib openDevice];
Close Device:
[self.mtSCRALib closeDevice];
Get Tracks Data From Reader:
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(trackDataReady:) name:@"trackDataReadyNotification"
object:nil];
- (void)trackDataReady:(NSNotification *)notification
{
NSNumber *status = [[notification userInfo]
valueForKey:@"status"];
[self performSelectorOnMainThread:@selector(onDataEvent:)
withObject:status waitUntilDone:YES];
}
- (void)onDataEvent:(id)status
{
//[self clearLabels];
switch ([status intValue]) {
case TRANS_STATUS_OK:
NSLog(@"TRANS_STATUS_OK");
break;
case TRANS_STATUS_ERROR: