Remarks, Example – MagTek Excella STX99875340 User Manual

Page 41

Advertising
background image

Section 3. Excella API

31

Remarks


If the function succeeds, MICR_ST_OK is returned.
If the requested image is not found, MICR_ST_IMAGE_NOT_FOUND is returned.
If the device fails to respond to the command, the return value is MICR_ST_DEVICE_NOT_RESPONDING.
If the size of the buffer uses to store the image is not large enough, MICR_ST_NOT_ENOUGH_MEMORY is returned.


Error results from bad connection with device can be one of the following:

MICR_ST_CONNECT_REQUEST_TIMEDOUT
MICR_ST_REQUEST_TIMEDOUT
MICR_ST_DEVICE_NOT_RESPONDING
MICR_ST_ERR_INTERNET_CONNECT
MICR_ST_ERR_HTTP_OPEN_REQUEST
MICR_ST_ERR_HTTP_SEND_REQUEST
MICR_ST_USB_GET_DATA_FAILED
MICR_ST_INET_GET_DATA_FAILED

Example


#define BUFFER_LEN 512
// DocInfo is returned by the MTMICRProcessCheck()

void GetNthImages (char *Device, unsigned int nIndex, char *DocInfo)
{

char key [512];

DWORD bufferSize;

char cValue[BUFFER_LEN]="";

DWORD nValueSize;


// Get the image size from DocInfo

nValueSize = BUFFER_LEN;

MTMICRGetIndexValue (DocInfo, “ImageInfo”,”ImageSize”, nIndex, cValue, &

nValueSize);

// Convert size to integer

bufferSize = atol (cValue);


// Get the Image Id from DocInfo

nValueSize = BUFFER_LEN;

MTMICRGetIndexValue (DocInfo, “ImageInfo”,”ImageSize, nIndex, cValue, &

nValueSize);

if (bufferSize)

{

// Allocate memory for image

ImageBuffer = (char *) VirtualAlloc (NULL, bufferSize, MEM_COMMIT,

PAGE_READWRITE);


// Use function MTMICRGetDevice to get device name for variable “Device”
// Get the image from the device

MTMICRGetImage (Device, cValue, ImageBuffer, &bufferSize);

.
.

// Free the memory

VirtualFree (ImageBuffer, bufferSize, MEM_DECOMMIT);

}

}

Advertising