For the complete documentation index, see llms.txt. This page is also available as Markdown.
Page cover

Appendix B 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”)]; 

//Audio 
//[self.mtSCRALib setDeviceType:(MAGTEKAUDIOREADER)]; 
[self.mtSCRALib openDevice];

Close Device

[self.mtSCRALib closeDevice];

Get Track 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: 
        NSLog(@"TRANS_STATUS_ERROR");
        break;
        
        default:
            break;
    }
}

Get Connection Status of Reader

Diagrams

MSR Card Swipe

Note: This is broad to cover multiple devices. For devices that do not need or support a specific command, (i.e. SetMSRAlwaysOn), that portion may be omitted in the flow.

EMV Transaction (Quick Chip)

Note: This is broad to cover multiple devices. For devices that do not need or support a specific command, (i.e. SetMSRAlwaysOn), that portion may be omitted in the flow.

EMV Transaction (Full)

Note: This is broad to cover multiple devices. For devices that do not need or support a specific command, (i.e. SetMSRAlwaysOn), that portion may be omitted in the flow.

Last updated