Appendix C - Sample Code
Dynamag, DynaMAX, and eDynamo| Secure Card Reader Authenticator | Programmer’s Reference (WCF)
Page 29
Appendix C
Sample Code
C.1
Query devices, openDevice and closeDevice.
This example shows how to use the getDeviceList function to get devices and open the first device
connected to the host.
MTSCRAWCF.MTSCRAWCF wcf = new MTSCRAWCF.MTSCRAWCF();
var devList = wcf.getDeviceList();
Console.WriteLine(devList);
var devs = devList.Split(',');
foreach (var dev in devs)
Console.WriteLine(dev);
var open = wcf.openDevice(devs[0]);
Console.WriteLine("open " + devs[0] + " -> " + open);
if (open == 0)
wcf.closeDevice();
/*
Output in Console :
USB://MagTek SCRA 1,BLEEMV://eDynamo-B306F96
USB://MagTek SCRA 1
BLEEMV://eDynamo-B306F96
open USB://MagTek SCRA 1 -> 1
*/
C.2
SendCommand to device and get response.
This example shows how to use the SendCommand function to send command to device and get device
response.
var response = wcf.sendCommand("0001");
Console.WriteLine(response);
/*
Output in Console :
*/