20
Core Implementation: WinForms
if
(rt == RETURN_CODE.RETURN_CODE_DO_SUCCESS)
{
tbOutput.AppendText(
"Firmware Ver: "
+ firmwareV
"
\
r
\
n"
);
}
else
{
tbOutput.AppendText(
"Get Firmware Fail Error Code: "
+
"0x"
+ String.Format(
"{0:X}"
, (ushort)rt) +
": "
+
.errorCode.getErrorString(rt) +
"
\
r
\
n"
);
}
}
private
void
btnStartEMVTransaction_Click(
object
sender, EventArgs e)
{
byte[] additionalTags =
new
byte[] { 0x8E, 0x5A };
RETURN_CODE rt = IDT_KioskIII.SharedController.ctls_startTransaction(1.00, 0, 2,0, 30, additionalTags);
if
(rt == RETURN_CODE.RETURN_CODE_DO_SUCCESS)
{
tbOutput.AppendText(
"Start CTLS Successful
\
r
\
n"
);
}
else
{
tbOutput.AppendText(
"Start CTLS failed Error Code: "
+
"0x"
+ String.Format(
"{0:X}"
, (ushort)rt) +
": "
+
.errorCode.getErrorString(rt) +
"
\
r
\
n"
);
}
}
private
void
btnCancelEMVTransaction_Click(
object
sender, EventArgs e)
{
RETURN_CODE rt = IDT_KioskIII.SharedController.ctls_cancelTransaction();
if
(rt == RETURN_CODE.RETURN_CODE_DO_SUCCESS)
{
tbOutput.AppendText(
"Cancel Transaction Successful
\
r
\
n"
);
"Cancel Transaction Successful"
);
}
else
{
tbOutput.AppendText(
"Cancel Transaction failed Error Code: "
+
"0x"
+ String.Format(
"{0:X}"
, (
ushort)rt) +
": "
+
.errorCode.getErrorString(rt) +
"
\
r
\
n"
);
"Cancel Transaction failed Error Code: "
+
"0x"
+ String.
Format(
"{0:X}"
, (ushort)rt));
}
}
6.6.5
Step 5: Configure callback to receive important SDK data (messages,log info and transaction results)
private
void
.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
SetOutputText(
"Callback:ToConnect
\
n"
);
break
;
case
DeviceState.DefaultDeviceTypeChange:
//The SDK is changing the default device to IDT_DEVICE_TYPES type
SetOutputText(
"Callback:DefaultDeviceTypeChange
\
n"
);
break
;
case
DeviceState.Connected:
//A connection has been made to IDT_DEVICE_TYPES type
SetOutputText(
"Callback:Connected
\
n"
);
break
;
case
DeviceState.Disconnected:
//A disconnection has occured with IDT_DEVICE_TYPES type
SetOutputText(
"Callback:Disconnected
\
n"
);
break
;
case
DeviceState.ConnectionFailed:
//A connection attempt has failed for IDT_DEVICE_TYPES type
SetOutputText(
"Callback:ConnectionFailed
\
n"
);
break
;
case
DeviceState.TransactionData:
//Transaction data is beign returned in IDTTransactionData cardData
SetOutputText(
"Callback:TransactionData
\
n"
);
displayCardData(cardData);
break
;
case
DeviceState.DataReceived:
//Low-level data received
for IDT_DEVICE_TYPES type
SetOutputTextLog(
" IN: "
+ Common.getHexStringFromBytes(data));
break
;
case
DeviceState.DataSent:
//Low-level data sent
for IDT_DEVICE_TYPES type
SetOutputTextLog(
" OUT: "
+ Common.getHexStringFromBytes(data));
#80136501-001 IDTech Windows SDK Guide for Kiosk III/IV