IDTech iOS SDK Guide  1.1.166.045
API reference for VP3300
Sample Project Tutorial

Using Xcode 6.4, we will create a sample project that will interface with the VP3300 and will perform the following activities:

  • Auto-Connect and display connection status
  • Get Device Firmware
  • Start/Stop Transaction Request for CTLS/MSR/ICC (tap/swipe/insert)
  • Enable Bluetooth Scanning
  • Show LCD Display for EMV transaction
  • Automatically select first AID or first Language if prompted

Protocol Delegates:

  • Delegate to receive card swipes
  • Delegate to detect headphone plug changes
  • Delegate to detect device connected
  • Delegate to detect device disconnected
  • Delegate to receive EMV/CTLS tag data

Step 1: Create New Project

Create a new Single View Application in Xcode

new_project1.png
new_project2.png

Step 2: Import Frameworks

Import the necessary framework/libraries

Step 3: Design Interface

Design the User Interface by editing the iPhone storyboard file
Open your storyboard and add items to so it contains the following buttons/fields:

  • Add a label to the top that will signify connection/disconnection status.
  • Add text views to communicate data from the VP3300 and for EMV LCD display information. Remove the Editable behavior if you don't want the keyboard to pop up if you accidentally select it.
  • Add buttons to execute the following functions:
    • Get Firmware
    • Scan for BLE Device
    • Start Transaction
    • Complete ICC EMV
    • Cancel Transaction (add constraints accordingly so layout maps to intended screen size)
xib.png

Step 4: Configure Header File

In the header file, perform the following:

  • Add Import statements to utilize frameworks
  • Amend the view controller interface
  • Create an IBOutlet for the two UITextView and link it as a Referencing Outlet to the UITextView on the storyboard
  • Create an IBOutlet for the UILabel and link it as a Referencing Outlet to the UILabel on the storyboard
  • Create the 5 IBAction for the buttons, and link them to the "Touch Up Inside" event on the storyboard buttons
#import <UIKit/UIKit.h>
#import <IDTech/IDTech.h>
@interface ViewController : UIViewController<IDT_VP3300_Delegate>
{
IBOutlet UITextView *lcdTextView;
IBOutlet UITextView *logTextView;
IBOutlet UILabel *connectedLabel;
}
-(IBAction) getFirmware:(id)sender;
-(IBAction) startBLE:(id)sender;
-(IBAction) startTransaction:(id)sender;
-(IBAction) completeEMV:(id)sender;
-(IBAction) cancelTransaction:(id)sender;
@property(nonatomic, strong) UITextView *lcdTextView;
@property(nonatomic, strong) UITextView *logTextView;
@property(nonatomic, strong) UILabel *connectedLabel;
@end

Storyboard Source Code

<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12121" systemVersion="16F73" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="vXZ-lx-hvc">
<device id="retina5_5" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="ufC-wZ-h7g">
<objects>
<viewController id="vXZ-lx-hvc" customClass="ViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="jyV-Pf-zRb"/>
<viewControllerLayoutGuide type="bottom" id="2fi-mo-0CV"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="kh9-bI-dsS">
<rect key="frame" x="0.0" y="0.0" width="414" height="736"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="VP3300 Disconnected" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="eDI-cL-7k6">
<rect key="frame" x="16" y="20" width="378" height="21"/>
<constraints>
<constraint firstAttribute="height" constant="21" id="GlQ-61-SfD"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="EMV LCD DISPLAY" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="oIl-91-J9y">
<rect key="frame" x="16" y="227" width="378" height="21"/>
<constraints>
<constraint firstAttribute="height" constant="21" id="cli-EH-4sy"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" editable="NO" text="LCD DISPLAY INFO" textAlignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="XfN-t5-Cxv">
<rect key="frame" x="16" y="256" width="378" height="128"/>
<color key="backgroundColor" red="0.98823529480000005" green="0.89411765340000005" blue="0.8156862855" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="128" id="cbD-9q-LWB"/>
</constraints>
<fontDescription key="fontDescription" name="HelveticaNeue" family="Helvetica Neue" pointSize="20"/>
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
</textView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" misplaced="YES" text="" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="BNt-fB-6Ni">
<rect key="frame" x="288" y="53" width="24" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="8zA-5c-Igm">
<rect key="frame" x="20" y="53" width="374" height="26"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="26" id="qU1-ou-A1l"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<state key="normal" title="Get Firmware">
<color key="titleColor" red="0.068003949080000001" green="0.072250786509999998" blue="0.44422978940000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<connections>
<action selector="getFirmware:" destination="vXZ-lx-hvc" eventType="touchUpInside" id="ONf-1N-HDd"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="QvK-Hw-R0Z">
<rect key="frame" x="20" y="87" width="374" height="26"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="26" id="TZO-wC-gU1"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<state key="normal" title="Scan for VP3300 BLE Device">
<color key="titleColor" red="0.068003949080000001" green="0.072250786509999998" blue="0.44422978940000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<connections>
<action selector="startBLE:" destination="vXZ-lx-hvc" eventType="touchUpInside" id="gZ8-hp-pgk"/>
</connections>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="c2A-gb-32n">
<rect key="frame" x="288" y="91" width="24" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="KML-Tf-QdE">
<rect key="frame" x="20" y="121" width="374" height="26"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="26" id="vhA-Zy-E5Q"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<state key="normal" title="Start Transaction">
<color key="titleColor" red="0.068003949080000001" green="0.072250786509999998" blue="0.44422978940000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<connections>
<action selector="startTransaction:" destination="vXZ-lx-hvc" eventType="touchUpInside" id="btb-Iy-8No"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="U0Y-vt-9An">
<rect key="frame" x="20" y="189" width="374" height="26"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="26" id="UoI-vD-ShH"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<state key="normal" title="Cancel Transaction">
<color key="titleColor" red="0.068003949080000001" green="0.072250786509999998" blue="0.44422978940000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<connections>
<action selector="cancelTransaction:" destination="vXZ-lx-hvc" eventType="touchUpInside" id="rOr-8n-gJz"/>
</connections>
</button>
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" editable="NO" text="LOG INFO" translatesAutoresizingMaskIntoConstraints="NO" id="Ybs-ph-PwR">
<rect key="frame" x="16" y="421" width="378" height="295"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<fontDescription key="fontDescription" name="HelveticaNeue" family="Helvetica Neue" pointSize="14"/>
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
</textView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="LOG" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ngg-AN-FNd">
<rect key="frame" x="16" y="392" width="378" height="21"/>
<constraints>
<constraint firstAttribute="height" constant="21" id="cH1-gW-ZeD"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="IhF-UM-clE">
<rect key="frame" x="20" y="155" width="374" height="26"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="26" id="cio-IH-GQr"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<state key="normal" title="Complete ICC EMV">
<color key="titleColor" red="0.068003949080000001" green="0.072250786509999998" blue="0.44422978940000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<connections>
<action selector="completeEMV:" destination="vXZ-lx-hvc" eventType="touchUpInside" id="sBg-6w-7jS"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" red="0.93725490199999995" green="0.93725490199999995" blue="0.95686274510000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="QvK-Hw-R0Z" firstAttribute="trailing" secondItem="KML-Tf-QdE" secondAttribute="trailing" id="0cQ-wx-zHB"/>
<constraint firstItem="XfN-t5-Cxv" firstAttribute="trailing" secondItem="ngg-AN-FNd" secondAttribute="trailing" id="1bC-O7-S1P"/>
<constraint firstItem="IhF-UM-clE" firstAttribute="trailing" secondItem="U0Y-vt-9An" secondAttribute="trailing" id="3xN-DP-18G"/>
<constraint firstItem="KML-Tf-QdE" firstAttribute="top" secondItem="QvK-Hw-R0Z" secondAttribute="bottom" constant="8" symbolic="YES" id="7nF-2H-I4g"/>
<constraint firstItem="IhF-UM-clE" firstAttribute="top" secondItem="KML-Tf-QdE" secondAttribute="bottom" constant="8" symbolic="YES" id="ATt-74-bel"/>
<constraint firstItem="KML-Tf-QdE" firstAttribute="leading" secondItem="IhF-UM-clE" secondAttribute="leading" id="BWn-nl-dRE"/>
<constraint firstItem="eDI-cL-7k6" firstAttribute="leading" secondItem="kh9-bI-dsS" secondAttribute="leadingMargin" constant="-4" id="F6G-60-w5z"/>
<constraint firstItem="eDI-cL-7k6" firstAttribute="trailing" secondItem="8zA-5c-Igm" secondAttribute="trailing" id="HnZ-Fj-o8y"/>
<constraint firstItem="eDI-cL-7k6" firstAttribute="top" secondItem="jyV-Pf-zRb" secondAttribute="bottom" id="KzH-zX-FA1"/>
<constraint firstItem="8zA-5c-Igm" firstAttribute="top" secondItem="eDI-cL-7k6" secondAttribute="bottom" constant="12" id="LHm-Dm-f2p"/>
<constraint firstItem="IhF-UM-clE" firstAttribute="leading" secondItem="U0Y-vt-9An" secondAttribute="leading" id="MkL-j0-QAp"/>
<constraint firstItem="oIl-91-J9y" firstAttribute="trailing" secondItem="XfN-t5-Cxv" secondAttribute="trailing" id="Rgp-90-Rn4"/>
<constraint firstItem="8zA-5c-Igm" firstAttribute="leading" secondItem="QvK-Hw-R0Z" secondAttribute="leading" id="Rvy-qq-Fxo"/>
<constraint firstItem="XfN-t5-Cxv" firstAttribute="leading" secondItem="ngg-AN-FNd" secondAttribute="leading" id="Y1l-yb-55G"/>
<constraint firstItem="U0Y-vt-9An" firstAttribute="trailing" secondItem="oIl-91-J9y" secondAttribute="trailing" id="bAe-rc-myD"/>
<constraint firstItem="8zA-5c-Igm" firstAttribute="trailing" secondItem="QvK-Hw-R0Z" secondAttribute="trailing" id="bSV-Fd-Hzd"/>
<constraint firstItem="eDI-cL-7k6" firstAttribute="leading" secondItem="oIl-91-J9y" secondAttribute="leading" id="bu0-Jx-Q7i"/>
<constraint firstItem="8zA-5c-Igm" firstAttribute="top" secondItem="BNt-fB-6Ni" secondAttribute="top" id="cvR-tl-cV9"/>
<constraint firstItem="oIl-91-J9y" firstAttribute="leading" secondItem="XfN-t5-Cxv" secondAttribute="leading" id="d83-ov-vMy"/>
<constraint firstItem="Ybs-ph-PwR" firstAttribute="top" secondItem="ngg-AN-FNd" secondAttribute="bottom" constant="8" symbolic="YES" id="f9l-5E-xVh"/>
<constraint firstItem="U0Y-vt-9An" firstAttribute="top" secondItem="IhF-UM-clE" secondAttribute="bottom" constant="8" symbolic="YES" id="gne-Hd-cG8"/>
<constraint firstItem="Ybs-ph-PwR" firstAttribute="leading" secondItem="ngg-AN-FNd" secondAttribute="leading" id="hIx-P5-n22"/>
<constraint firstItem="XfN-t5-Cxv" firstAttribute="top" secondItem="oIl-91-J9y" secondAttribute="bottom" constant="8" symbolic="YES" id="jrl-iP-BpW"/>
<constraint firstItem="QvK-Hw-R0Z" firstAttribute="top" secondItem="8zA-5c-Igm" secondAttribute="bottom" constant="8" symbolic="YES" id="ktf-S5-As7"/>
<constraint firstItem="QvK-Hw-R0Z" firstAttribute="leading" secondItem="KML-Tf-QdE" secondAttribute="leading" id="lMh-z7-Khl"/>
<constraint firstItem="Ybs-ph-PwR" firstAttribute="trailing" secondItem="ngg-AN-FNd" secondAttribute="trailing" id="o1j-yC-m9I"/>
<constraint firstItem="oIl-91-J9y" firstAttribute="top" secondItem="U0Y-vt-9An" secondAttribute="bottom" constant="12" id="oI7-ZT-AiO"/>
<constraint firstAttribute="bottom" secondItem="Ybs-ph-PwR" secondAttribute="bottom" constant="20" symbolic="YES" id="ptU-ZW-gnV"/>
<constraint firstItem="ngg-AN-FNd" firstAttribute="top" secondItem="XfN-t5-Cxv" secondAttribute="bottom" constant="8" symbolic="YES" id="qx1-ql-cTJ"/>
<constraint firstItem="KML-Tf-QdE" firstAttribute="trailing" secondItem="IhF-UM-clE" secondAttribute="trailing" id="rSe-0N-OFU"/>
<constraint firstItem="8zA-5c-Igm" firstAttribute="leading" secondItem="kh9-bI-dsS" secondAttribute="leadingMargin" id="wwH-eG-SK5"/>
<constraint firstItem="eDI-cL-7k6" firstAttribute="trailing" secondItem="kh9-bI-dsS" secondAttribute="trailingMargin" id="xVD-uB-X1Y"/>
</constraints>
</view>
<connections>
<outlet property="connectedLabel" destination="eDI-cL-7k6" id="EYe-RB-KZq"/>
<outlet property="lcdTextView" destination="XfN-t5-Cxv" id="aN5-cG-h6Y"/>
<outlet property="logTextView" destination="Ybs-ph-PwR" id="EOn-F5-kzy"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="x5A-6p-PRh" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="24.637681159420293" y="36.684782608695656"/>
</scene>
</scenes>
</document>

Step 5: Configure Method File

In the header file, perform the following:

  • set delegate and initialize IDT_VP3300 singleton object in the viewDidLoad method.

    Reference: Call the Singleton instance of the IDT_VP3300 framework object

    - (void)viewDidLoad
    {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    [[IDT_VP3300 sharedController] setDelegate:self];
    }
  • Implement protocol delegate IDT_VP3300Delegate::deviceDisconnected() and IDT_VP3300Delegate::deviceConnected() to monitor connect/disconnect events and modify our connection label upon change. Reference: Implement optional delegate protocols
    -(void) deviceConnected{
    [connectedLabel setText:@"VP3300 CONNECTED"];
    }
    -(void) deviceDisconnected{
    [connectedLabel setText:@"VP3300 DISCONNECTED"];
    }
  • Implement protocol delegate swipeMSRData:() to receive card swipe data. Reference: Implement optional delegate protocols
    -(void) appendMessageToResults:(NSString*) message{
    [logTextView setText:[NSString stringWithFormat:@"%@\n====================\n%@",message, self.logTextView.text]];
    }
    - (void) swipeMSRData:(IDTMSRData*)cardData{
    NSLog(@"--MSR event Received, Type: %d, data: %@", cardData.event, cardData.encTrack1);
    switch (cardData.event) {
    case EVENT_MSR_CARD_DATA:
    {
    switch (cardData.captureEncodeType) {
    case CAPTURE_ENCODE_TYPE_ISOABA:
    [self appendMessageToResults:[NSString stringWithFormat:@"Encode Type: %@", @"ISO/ABA"]];
    break;
    case CAPTURE_ENCODE_TYPE_AAMVA:
    [self appendMessageToResults:[NSString stringWithFormat:@"Encode Type: %@", @"AA/MVA"]];
    break;
    case CAPTURE_ENCODE_TYPE_Other:
    [self appendMessageToResults:[NSString stringWithFormat:@"Encode Type: %@", @"Other"]];
    break;
    case CAPTURE_ENCODE_TYPE_Raw:
    [self appendMessageToResults:[NSString stringWithFormat:@"Encode Type: %@", @"Raw"]];
    break;
    case CAPTURE_ENCODE_TYPE_JIS_I:
    [self appendMessageToResults:[NSString stringWithFormat:@"Encode Type: %@", @"CAPTURE_ENCODE_TYPE_JIS_I"]];
    break;
    case CAPTURE_ENCODE_TYPE_JIS_II:
    [self appendMessageToResults:[NSString stringWithFormat:@"Encode Type: %@", @"CAPTURE_ENCODE_TYPE_JIS_II"]];
    break;
    default:
    [self appendMessageToResults:[NSString stringWithFormat:@"Encode Type: %@", @"UNKNOWN"]];
    break;
    }
    switch (cardData.captureEncryptType) {
    case CAPTURE_ENCRYPT_TYPE_AES:
    [self appendMessageToResults:[NSString stringWithFormat:@"Encrypt Type: %@", @"AES"]];
    break;
    case CAPTURE_ENCRYPT_TYPE_TDES:
    [self appendMessageToResults:[NSString stringWithFormat:@"Encrypt Type: %@", @"TDES"]];
    break;
    case CAPTURE_ENCRYPT_TYPE_NO_ENCRYPTION:
    [self appendMessageToResults:[NSString stringWithFormat:@"Encrypt Type: %@", @"NONE"]];
    break;
    default:
    [self appendMessageToResults:[NSString stringWithFormat:@"Encrypt Type: %@", @"UNKNOWN"]];
    break;
    }
    [self appendMessageToResults:[NSString stringWithFormat:@"Full card data: %@", cardData.cardData]];
    [self appendMessageToResults:[NSString stringWithFormat:@"Track 1: %@", cardData.track1]];
    [self appendMessageToResults:[NSString stringWithFormat:@"Track 2: %@", cardData.track2]];
    [self appendMessageToResults:[NSString stringWithFormat:@"Track 3: %@", cardData.track3]];
    [self appendMessageToResults:[NSString stringWithFormat:@"Length Track 1: %i", cardData.track1Length]];
    [self appendMessageToResults:[NSString stringWithFormat:@"Length Track 2: %i", cardData.track2Length]];
    [self appendMessageToResults:[NSString stringWithFormat:@"Length Track 3: %i", cardData.track3Length]];
    [self appendMessageToResults:[NSString stringWithFormat:@"Encoded Track 1: %@", cardData.encTrack1.description]];
    [self appendMessageToResults:[NSString stringWithFormat:@"Encoded Track 2: %@", cardData.encTrack2.description]];
    [self appendMessageToResults:[NSString stringWithFormat:@"Encoded Track 3: %@", cardData.encTrack3.description]];
    [self appendMessageToResults:[NSString stringWithFormat:@"Hash Track 1: %@", cardData.hashTrack1.description]];
    [self appendMessageToResults:[NSString stringWithFormat:@"Hash Track 2: %@", cardData.hashTrack2.description]];
    [self appendMessageToResults:[NSString stringWithFormat:@"Hash Track 3: %@", cardData.hashTrack3.description]];
    [self appendMessageToResults:[NSString stringWithFormat:@"KSN: %@", cardData.KSN.description]];
    [self appendMessageToResults:[NSString stringWithFormat:@"\nSessionID: %@", cardData.sessionID.description]];
    [self appendMessageToResults:[NSString stringWithFormat:@"\nReader Serial Number: %@", cardData.RSN]];
    [self appendMessageToResults:[NSString stringWithFormat:@"\nRead Status: %2X", cardData.readStatus]];
    if (cardData.unencryptedTags != nil) [self appendMessageToResults:[NSString stringWithFormat:@"Unencrytped Tags: %@", cardData.unencryptedTags.description]];
    if (cardData.encryptedTags != nil) [self appendMessageToResults:[NSString stringWithFormat:@"Encrypted Tags: %@", cardData.encryptedTags.description]];
    if (cardData.maskedTags != nil) [self appendMessageToResults:[NSString stringWithFormat:@"Masked Tags: %@", cardData.maskedTags.description]];
    NSLog(@"Track 1: %@", cardData.track1);
    NSLog(@"Track 2: %@", cardData.track2);
    NSLog(@"Track 3: %@", cardData.track3);
    NSLog(@"Encoded Track 1: %@", cardData.encTrack1.description);
    NSLog(@"Encoded Track 2: %@", cardData.encTrack2.description);
    NSLog(@"Encoded Track 3: %@", cardData.encTrack3.description);
    NSLog(@"Hash Track 1: %@", cardData.hashTrack1.description);
    NSLog(@"Hash Track 2: %@", cardData.hashTrack2.description);
    NSLog(@"Hash Track 3: %@", cardData.hashTrack3.description);
    NSLog(@"SessionID: %@", cardData.sessionID.description);
    NSLog(@"nReader Serial Number: %@", cardData.RSN);
    NSLog(@"Read Status: %2X", cardData.readStatus);
    NSLog(@"KSN: %@", cardData.KSN.description);
    return;
    }
    break;
    case EVENT_MSR_CANCEL_KEY:
    {
    [self appendMessageToResults:[NSString stringWithFormat:@"(Event) MSR Cancel Key received: %@", cardData.encTrack1]];
    return;
    }
    break;
    case EVENT_MSR_BACKSPACE_KEY:
    {
    [self appendMessageToResults:[NSString stringWithFormat:@"(Event) MSR Backspace Key received: %@", cardData.encTrack1]];
    return;
    }
    break;
    case EVENT_MSR_ENTER_KEY:
    {
    [self appendMessageToResults:[NSString stringWithFormat:@"(Event) MSR Enter Key received: %@", cardData.encTrack1]];
    return;
    }
    break;
    case EVENT_MSR_UNKNOWN:
    {
    [self appendMessageToResults:[NSString stringWithFormat:@"(Event) MSR unknown event, data: %@", cardData.encTrack1]];
    return;
    }
    break;
    case EVENT_MSR_TIMEOUT:
    {
    [self appendMessageToResults:@"(Event) MSR TIMEOUT"];
    return;
    }
    default:
    break;
    }
    }
  • Implement protocol delegate plugStatusChange:() to automatically attempt connection attempt.
    - (void) plugStatusChange:(BOOL)deviceInserted{
    if (deviceInserted) {
    [self appendMessageToResults: @"device Attached. Attempting connection"];
    [[IDT_VP3300 sharedController] device_connectToAudioReader];
    }
    else{
    [self appendMessageToResults: @"device removed."];
    }
    }
  • Implement protocol delegate emvTransactionData:() to report EMV transaction results
    - (void) emvTransactionData:(IDTEMVData*)emvData errorCode:(int)error{
    NSLog(@"EMV_RESULT_CODE_V2_response = %2X",error);
    [self appendMessageToResults:[NSString stringWithFormat:@"EMV_RESULT_CODE_V2_response = %2X",error]];
    if (emvData == nil) {
    [self appendMessageToResults:[NSString stringWithFormat:@"EMV TRANSACTION ERROR. Refer to EMV_RESULT_CODE_V2_response = 0x%2X",error]];
    return;
    }
    if (emvData.resultCodeV2 == EMV_RESULT_CODE_V2_GO_ONLINE) {
    [self appendMessageToResults:@"ONLINE REQUEST"];
    }
    if (emvData.resultCodeV2 == EMV_RESULT_CODE_V2_APPROVED || emvData.resultCodeV2 == EMV_RESULT_CODE_V2_APPROVED_OFFLINE ) {
    [self appendMessageToResults:@"APPROVED"];
    }
    if (emvData.resultCodeV2 == EMV_RESULT_CODE_V2_MSR_SUCCESS) {
    [self appendMessageToResults:@"MSR Data Captured"];
    }
    if (emvData.cardType == 0) {
    [self appendMessageToResults:@"CONTACT"];
    }
    if (emvData.cardType == 1) {
    [self appendMessageToResults:@"CONTACTLESS"];
    }
    if (emvData.unencryptedTags != nil) [self appendMessageToResults:[NSString stringWithFormat:@"Unencrytped Tags: %@", emvData.unencryptedTags.description]];
    if (emvData.encryptedTags != nil) [self appendMessageToResults:[NSString stringWithFormat:@"Encrypted Tags: %@", emvData.encryptedTags.description]];
    if (emvData.maskedTags != nil) [self appendMessageToResults:[NSString stringWithFormat:@"Masked Tags: %@", emvData.maskedTags.description]];
    }
  • Implement protocol delegate lcdDisplay:() to receive LCD messages, and automatically select 1st menu item/language when presented with choices. Normal operation would require a choice be made by card holder.
    - (void) lcdDisplay:(int)mode lines:(NSArray*)lines{
    NSMutableString* str = [NSMutableString new];
    if (lines != nil) {
    for (NSString* s in lines) {
    [str appendString:s];
    [str appendString:@"\n"];
    }
    }
    switch (mode) {
    case 0x10:
    //clear screen
    lcdTextView.text = @"";
    break;
    case 0x03:
    lcdTextView.text = str;
    break;
    case 0x01:
    case 0x02:
    case 0x08:{
    [[IDT_VP3300 sharedController] emv_callbackResponseLCD:mode selection:(unsigned char)1];;
    }
    break;
    default:
    break;
    }
    }
  • Implement the button press methods
    -(IBAction) getFirmware:(id)sender{
    NSString *result;
    logTextView.text = @"";
    RETURN_CODE rt = [[IDT_VP3300 sharedController] device_getFirmwareVersion:&result];
    if (RETURN_CODE_DO_SUCCESS == rt)
    {
    [self appendMessageToResults: [NSString stringWithFormat:@"Get FM info: %@", result]];
    }
    }
    -(IBAction) startBLE:(id)sender{
    [self appendMessageToResults: @"Turning on BLE scanning"];
    [[IDT_VP3300 sharedController] device_enableBLEDeviceSearch:nil];
    }
    -(IBAction) startTransaction:(id)sender{
    logTextView.text = @"";
    RETURN_CODE rt = [[IDT_VP3300 sharedController] device_startTransaction:1.00 amtOther:0 type:0 timeout:60 tags:nil forceOnline:false fallback:true];
    if (RETURN_CODE_DO_SUCCESS == rt)
    {
    [self appendMessageToResults: @"Start Transaction Command Accepted. Please Swipe/Insert/Tap"];
    }
    }
    -(IBAction) completeEMV:(id)sender{
    logTextView.text = @"";
    RETURN_CODE rt = [[IDT_VP3300 sharedController] emv_completeOnlineEMVTransaction:true hostResponseTags:[IDTUtility hexToData:@"8A023030"] returnTags:nil];
    if (RETURN_CODE_DO_SUCCESS == rt)
    {
    [self appendMessageToResults: @"Complete Transaction Command Accepted"];
    }
    }
    -(IBAction) cancelTransaction:(id)sender{
    logTextView.text = @"";
    RETURN_CODE rt = [[IDT_VP3300 sharedController] ctls_cancelTransaction];
    if(RETURN_CODE_DO_SUCCESS == rt){
    [self appendMessageToResults:@"CancelMSR/CTLS: OK."];
    }
    }