'Capture image from Honeywell Imaging Scanner

I am using a Honeywell Xenon Imaging scanner to capture both images and barcode. I have the barcodes working but am stuck trying to read an image. Using Microsoft.PointOfService, I am unable to cast the scanner as a ImageScanner, so instead am trying to send a DirectIO command to retrieve an image off the device. Using the honeywell EZConfig I can capture an image by sending the command IMGSNP0T;IMGSHP6F2P - however I can't figure out how to do this with Microsoft POS.

This is what I have now:

            string command = "IMGSNP0T;IMGSHP6F2P";
            DirectIOData response = scanner.DirectIO(0, 1024, command);
            byte[] buffer = (byte[])response.Object;
            Console.WriteLine("$: Response: " + BitConverter.ToString(buffer));

Which gives me this error:

[PosException]: Microsoft.PointOfService.PosControlException: Method DirectIO threw an exception.  Attempt was made to perform an illegal or unsupported operation with the device, or an invalid parameter value was used.
ErrorCode: Failure
ErrorCodeExtended: 0

I believe the error could be with one of the first two params of the DirectIO command, I am not sure what I am meant to pass in for them and was just guessing, here is the method:

public abstract DirectIOData DirectIO(int command, int data, object obj);


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source