IDTech Windows SDK Guide  1.2.177.4
API reference for NEO2
Implement the callback functions

There are currently two callback functions defined, one for button press callback, and another universal callback for all other requirements. The universal callback uses DeviceState to determine which action to take. For IP connected devices, the last parameter is provided for instance where multiple IP connected devices may be sending data back to this callback.

private void MessageCallBack(IDTechSDK.IDT_DEVICE_Types type, DeviceState state, byte[] data, IDTTransactionData cardData, EMV_Callback emvCallback, RETURN_CODE transactionResultCode, string IP)
{
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 device timeout
SetOutputText("Callback:DeviceTimeout\n");
break;
case DeviceState.TransactionFailed:
//Transaction failed to complete
break;
case DeviceState.EMVCallback:
SetOutputText("EMV CAllback\n");
break;
case DeviceState.PINpadKeypress:
SetOutputText("PINPad Key was pressed\n");
break;
case DeviceState.PINTimeout:
SetOutputText("PINPad Timeout\n");
break;
case DeviceState.MenuTimeout:
SetOutputText("Menu Entry Timeout\n");
break;
case DeviceState.TransactionIdle:
SetOutputText("Ready For Transaction\n");
break;
case DeviceState.Signature:
SetOutputText("Signature Captured\n");
break;
case DeviceState.FirmwareUpdate:
SetOutputText("firmware update\n");
break;
case DeviceState.FileTransfer:
SetOutputText("File Transfer\n");
break;
case DeviceState.ConfigurationGroup:
SetOutputText("Config Group\n");
break;
case DeviceState.InvalidInterface:
SetOutputText("Invalid Interface\n");
break;
case DeviceState.FunctionKey:
SetOutputText("Function Key Pressed\n");
break;
case DeviceState.PINFail:
SetOutputText("PIN Fail\n");
break;
case DeviceState.SocketEstablished:
SetOutputText("Socket connection established to: " + IP + " \r\n");
break;
case DeviceState.SocketFailed:
SetOutputText("Socket connection failed to: " + IP + " \r\n");
break;
case DeviceState.ButtonEvent:
SetOutputText("Screen ID: " + screenID.ToString() + "\r\n");
SetOutputText("Button ID: " + ID.ToString() + "\r\n");
break;
default:
break;
}
}

When lcd_addButton is executed, a buttonCallback can be passed that will report all press events for that button. If buttonCallback is set to NULL, then all press events will be returned to the main callback as a DeviceState.ButtonEvent. The buttonCallback has the following signature, passing back the device type, the screen, the button ID, and the device IP address:

private void ButtonCallback(IDT_DEVICE_Types sender, uInt16 screenID, uInt16 itemID, string IP)
{
SetOutputText("BUTTON CALLBACK, IP : " + IP + "\n");
SetOutputText("Button Pressed, Screen ID: " + screenID.ToString() + "\n");
SetOutputText("Button Pressed, Button ID: " + itemID.ToString() + "\n");
}

For the universal callback, there is an OPTIONAL parameter to associate that callback with just a single IP address.

Setting button callback is established during lcd_addButton, in addition, there is another method to set the callback of any existing button.