
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








Last updated

