IDTech Windows SDK Guide  3.2.4.393
API reference for Visual Studio .Net
Using SDK on iOS with Xamarin

The IDTech SDK can be use on iOS platform when coding with Xamarin in Visual Studio.

Android/IOS sample code can be found here:
https://atlassian.idtechproducts.com/confluence/download/attachments/30479625/Xamarin_Demo_Source_Code.zip?api=v2

Once you have established your Xamarin project (either Universal or iOS only), right-click on your project and select "Manage NuGet Packages..."

Browse for "Xamarin.IDTech.iOSBinding". Once located, install latest version for your project. This library has a dependency for our IDTechSDK_STD and our comm layer library Xamarin.IDTech.iOSCommLib. Those additional two libraries will automatically be installed along with the Xamarin.IDTech.iOSBinding library.

In your iOS project, you will have a Info.plist file. This file must be modified accoding to what devices you are planning on using.

If you are planning on using VP3300, VP3310, VP3320, VP330, or any device that uses BLE, you must enter two key entries in your .plist. The keys are "NSBluetoothAlwaysUsageDescription" and "NSBluetoothPeripheralUsageDescription", and must contant a string, such as "Captures Payment Information".

<key>NSBluetoothAlwaysUsageDescription</key>
<string>Captures Payment Information</string>
<key>NSBluetoothPeripheralUsageDescription</key>
<string>Captures Payment Information</string>

If you are planning on using any IDTech device that interfaces with the Microphone, you must enter a key entry in your .plist. Thy key is "NSMicrophoneUsageDescription" and must contain a string, , such as "Captures Payment Information".

<key>NSMicrophoneUsageDescription</key>
<string>Captures Payment Information</string>

If you are planning on using the BTMag and/or iMag, you must add the key "UISupportedExternalAccessoryProtocols", and list the associated protocol strings for those devices in that key's array.

<key>UISupportedExternalAccessoryProtocols</key>
<array>
<string>com.idtechproducts.reader</string>
<string>com.idtechproducts.BTMag</string>
</array>

In your application code. add references to the IDTech libraries you imported using NuGet

using IDTechSDK;
using iOSBinding;

Then set up the rest of your code as if it is the standard Window .Net project using our IDTechSDK_STD. You define the message callback and make command calls to the IDTechSDK

Communicating with iOS Devices

There are three groups of devices that can be used on iOS: Bluetooth Low Energy, Audio Jack, and External Accessory

Bluetooth Low Energy.
This includes the VP3300, and NEOII devices, such as VP3310, VP3320, VP3350, and VP3600.

You connect to a BLE device using the following method:

IDT_Device.startBLEScan(IDT_DEVICE_Types type, string name);

The first parameter is the device type. This can have one of three possible values: IDT_DEVICE_Types.IDT_DEVICE_VP3300 - VP3300, VP8300 IDT_DEVICE_Types.IDT_DEVICE_NEO2 - VP3600, VP3320, VP3350 (VP6800 BLE is currently not supported) IDT_DEVICE_Types.IDT_DEVICE_NONE - scan for name when no name provided

The second parameter is the device name that you would like to connect to.

If you don't specify a name (and set device type to IDT_DEVICE_Types.IDT_DEVICE_NONE), the SDK will scan the area and return a list of all found names. You can then use one of those names to attempt to connect to that device. When the SDK finishes scanning the area (2-3 seconds), it will return a callback DeviceState.BTListReady. You can then execute IDT_Device.getBLEDeviceList() to retrieve the list of device names found in the vicinity.

case DeviceState.BTListReady:
List<string> btDevices = null;
btDevices = IDT_Device.getBLEDeviceList();
displayBLEDevices(btDevices);
break;
Audio Jack.
For Audio Jack, you first need to tell the SDK which device it need to configure the audio drivers for, and then monitor the Headphone Jack plug/unplug events, and when a plug event happens, send a command to connect to the audio jack reader.

Here are the available devices to configure the SDK for the correct model audio jack product

IDT_Device.startAudioJack(IDT_DEVICE_Types.IDT_DEVICE_VP3300);
IDT_Device.startAudioJack(IDT_DEVICE_Types.IDT_DEVICE_UNIPAYI_V);
IDT_Device.startAudioJack(IDT_DEVICE_Types.IDT_DEVICE_UNIPAY);
IDT_Device.startAudioJack(IDT_DEVICE_Types.IDT_DEVICE_UNIMAG);
IDT_Device.startAudioJack(IDT_DEVICE_Types.IDT_DEVICE_UNIMAG_PRO);

Then when a plug insertion event is detected, you power up the device:

case DeviceState.PlugInserted:
appendMessageToResults("Plug Inserted");
IDT_Device.connectToAudioReader();
//When using audio jack devices, notification of a device insertion will appear here
break;
External Accessory.
This includes the BTMag and iMag. For External Accessory, you just need to link the binding library to the SDK with a single call (depending on device):
//BTMag:
IDTechBinding.SharedController.setDeviceType(IDT_DEVICE_Types.IDT_DEVICE_BTMAG, DEVICE_INTERFACE_Types.DEVICE_INTERFACE_SERIAL);
//iMag:
IDTechBinding.SharedController.setDeviceType(IDT_DEVICE_Types.IDT_DEVICE_IMAG, DEVICE_INTERFACE_Types.DEVICE_INTERFACE_SERIAL);
Additional Callbacks.
There are some additional DeviceState callback event on applicable to iOS.

There is a DeviceMessage callback. These are device message returned from various audio jack products. Messages such as "POWERING UNIPAY" and "PLEASE SWIPE"

case DeviceState.DeviceMessage:
//When iOS SDK needs to send out SDK messages, it will appear here
if (data != null)
{
string message = Encoding.UTF8.GetString(data, 0, data.Length);
appendMessageToResults(message);
}

The UniPay may have ICC messages

case DeviceState.UniPayICC:
appendMessageToResults("UniPay ICC Event: " + data[0].ToString("x2"));
//When using UniPay, device notifications (card inserted, card removed) will appear here
break;