IDTech Windows SDK Guide  1.00.029
API reference for UniPay
Implement the Callback Function

There is a single method that will receive all callback information from the SDK. It uses DeviceState to determine which action to take.

private void MessageCallBack(IDTechSDK.IDT_DEVICE_Types type, DeviceState state, byte[] data, IDTTransactionData cardData, EMV_Callback emvCallback, RETURN_CODE transactionResultCode)
{
switch (state)
{
case DeviceState.ToConnect:
//A connection attempt is starting for IDT_DEVICE_TYPES type
break;
case DeviceState.DefaultDeviceTypeChange:
//The SDK is changing the default device to IDT_DEVICE_TYPES type
break;
case DeviceState.Connected:
//A connection has been made to IDT_DEVICE_TYPES type
break;
case DeviceState.Disconnected:
//A disconnection has occured with IDT_DEVICE_TYPES type
break;
case DeviceState.ConnectionFailed:
//A connection attempt has failed for IDT_DEVICE_TYPES type
break;
case DeviceState.TransactionData:
//Transaction data is beign returned in IDTTransactionData cardData
break;
case DeviceState.DataReceived:
//Low-level data received for IDT_DEVICE_TYPES type
break;
case DeviceState.DataSent:
//Low-level data sent for IDT_DEVICE_TYPES type
break;
case DeviceState.CommandTimeout:
//Command timeout has occurred for IDT_DEVICE_TYPES type
break;
case DeviceState.ToSwipe:
//Awaiting a swipe for IDT_DEVICE_TYPES type
break;
case DeviceState.MSRDecodeError:
//Awaiting a swipe for IDT_DEVICE_TYPES type
break;
case DeviceState.ToTap:
//Awaiting a contactless tap for IDT_DEVICE_TYPES type
break;
case DeviceState.SwipeTimeout:
//Waiting for swipe timed out
break;
case DeviceState.TransactionCancelled:
//Transaction has been cancelled
break;
case DeviceState.DeviceTimeout:
//Waiting for transaction to complete timed out
break;
case DeviceState.TransactionFailed:
//Transaction failed to complete
break;
case DeviceState.EMVCallback:
//Callback during EMV transaction retrieved from EMV_Callback emvCallback
break;
default:
break;
}
}