IDTech Windows SDK Guide  3.2.4.393
API reference for Visual Studio .Net
Connecting to IDTech Devices

IDTech devices connects through USB, Serial Interface (COM), or IP depending on hardware capabilities.

IDTechSDK version 2.1.x.x is a multi-device SDK. I can maintain and execute commands simultaneously on multiple connected USB, RS-232 and IP devices.

All callbacks from the SDK are received in the MessageCallback function

private void MessageCallBack(IDTechSDK.IDT_DEVICE_Types type, DeviceState state, byte[] data,
IDTTransactionData cardData, EMV_Callback emvCallback, RETURN_CODE transactionResultCode, string ident)

When a device connects, a callback will fire with DeviceState.Connected. This call back will contain the string "ident". That string is a unique identifier for the device that was detected. I will be in the following form:

DEVICE_TYPE: Connection-ID

DEVICE_TYPE = Device, example VP3300 Connection= USB, COM, or IP ID =

  • USB will be the device serial number,
  • COM will be the COM port #
  • IP will be the IP Address and Port

Examples:

  • VP3300:37T4972819
  • KioskIII:COM-9
  • VP6800:10.12.34.98:1442

Every API command has an optional parameter "ident". By putting the device identifier in this field, this will direct that command directly to that device, regardless of what the default device is for the SDK. Without that identifier, the command will go to whatever is the last device the SDK sent default commands to.

After executing setDeviceType, any commands with providing an ident will be directed to that device.

At any time, you can get a complete listing of all the devices conneced, listed by the ident, by executing the following:

List<string> ulist = Profile.getAllConnections();

You set the SDK default device that will be used for all commands, unless it is overrided by providing the ident with the command:

IDT_Device.setDeviceType(ident);

Connect with USB:

IDTech devices use USB-HID (Human Interface Device), or USB-KB format and does not need any vendor-specific drivers. Simply by plugging into an available USB port makes it available for SDK connectivity. To enable detection of USB devices, you need to execute the SDK command to monitor for the plugging/unplugging of devices:

IDT_Device.startUSBMonitoring();

There is also a command to exit the thread monitoring for the USB activity, which should be executed at the termination of your application

IDT_Device.stopUSBMonitoring();

Connect with Serial Interface (COM)

Most IDTech devices can connect via Serial Interface. The default serial port settings for most devices are as follows:

  • Speed: 115,200
  • Bits: 8
  • Stop Bit: 1
  • Parity: None

To inform the SDK you are using the Serial Interface , you would execute the following command during program initialization to establish a connection by passing the correct COM port number and device type you would like to connect to.

IDT_DEVICE_Types type = IDT_DEVICE_Types.IDT_DEVICE_MINISMARTII;
int COMPORT = 1;
bool isConnected = false;
isConnected = IDT_NEO2.useSerialPort(COMPORT, type);

If you changed the baud rate of your device other than the factory default baud rate, you must also pass that to connect to it

IDT_DEVICE_Types type = IDT_DEVICE_Types.IDT_DEVICE_MINISMARTII;
int COMPORT = 1;
int BAUD = 9600
bool isConnected = false;
isConnected = IDT_NEO2.useSerialPort(COMPORT, type, BAUD);

You can check the return value to see if it found a valid COM port. If it did find the valid port, you can then tell the SDK to use that device

if (isConnected) IDT_Device.setDeviceType(type, DEVICE_INTERFACE_Types.DEVICE_INTERFACE_SERIAL);

Connect with TCP/IP

Some IDTech devices can connect via a network connection.

To inform the SDK you are using the IP interface of a NEO2 device, you would execute the following command during program initialization to establish a connection by passing the correct address. In the following example, we are connecting to a device as IP address 10.0.1.1. We need to specify the IP address, and if the device has TLS security

bool hasTLS = false;
IDT_NEO2.ip_connectToSocket("10.0.1.1", hasTLS)

There can be multiple IP connected devices to a single SDK instance. Each one is initially connected and registered with ip_connectToSocket.

To get a listing of all registered devices the SDK has access to, a listing of all the strings passed to ip_connectToSocket can be retrieved by the following

List<string> devices = IDT_NEO2.ip_getSocketList();

To switch between devices listed in ip_getSocketList():

IDT_NEO2.ip_switchToSocket("10.0.1.1");

NOTE: the string passed to ip_switchToSocket must match the complete gateway string as originally defined, and reported by ip_getSocketList.'

Automatically Accept Incoming TLS Secure Connections

When using a device that has TLS, you can instruct the SDK to automatically accept incoming connections from any device that it can establish a secure channel with. You use function monitorNetworkForDevices(enable, Optional:port), where enable = true will start monitoring, enable = false will stop monitoring, and the SSL port, which will default to 1443 if no value is parameter

IDT_Device.monitorNetworkForDevices(enable, port);
  • enable TRUE = connect to all incoming TLS connections
  • port Default = 1443. Only provide if another port is desired

Using Alternate TLS Certificates

The SDK contains a default TLS certificate used for IP secure communication. In cases where the device has been updated with another certificate not embedded in the SDK, before the SDK uses it's default certificate, it will scan the location where IDTechSDK.dll is located at to see if the file "tls_cert.cer" exists. If that file exists, it will use that certificate instead.

If IDTech provides you with an updated TLS certificate, please be sure to include that certificate in your project at the same locations as IDTechSDK.dll