beautypg.com

Remarks, St be specified in the dwoutbuffersize, Dwresponselen – MagTek MAGTEK User Manual

Page 61

background image

Section 5. Application Programmable Interface


55

dwOutBufferSize

Size of Output Buffer. The MCP driver needs to know the length (in bytes) of the callers Output Buffer
(pointed to by lpOutBuffer) to avoid overrunning the buffer in the event that the response from the device
exceeds the length of the Output Buffer.

The caller should always allocate an Output Buffer (pointed to by lpOutBuffer) and set this member to the
length of the buffer with the expectation that data could be returned.

dwResponseLen

Length of data (in bytes) contained in the output buffer pointed to by lpOutBuffer. This value is returned
upon the completion of a function call to indicate the length of the response contained in the output
buffer. If the value is zero, there is no data associated with the response.

dwContext

Device Enumeration Context. When enumerating MCP devices with the McpEnum function, this member
is used to indicate whether to restart the enumeration or continue with the next device. Set this value to
zero initially to indicate restart enumeration with the first device. This value should be left alone on
subsequent calls to McpEnum until the function returns indicating there are no more devices.

dwTimeout

Notification Wait Timeout. Used by the McpWait function to inform the MCP driver how long to wait for
a notification event to occur before returning from the function. There is also a flag in the
dwOperAttribute member which can be used to discard any and all notifications prior to processing the
McpWait function.

Value Meaning

-1

Return with the next buffered notification or wait indefinitely for the next
notification to arrive if there are no notification buffered.

=0

Return immediately with the next buffered notification or an error if no
notifications are currently buffered. Do not wait for a notification to arrive if
no notifications are queued.

>0

Return with the next buffered notification or wait the specified number of
milliseconds for the next notification to arrive. Return with an error if no
notifications arrive within the allotted time.

Remarks

The MCPBUS is used as an input parameter to many of the MCP API functions. The MCP driver
modifies only those members explicitedly defined by the individual functions. For example, the API will
not modify the lpOutBuffer or dwOutBufferSize members (the buffer that lpOutBuffer points to will of
course be modified); therefore, the caller may set these values once and not need to reset them prior to
invoking subsequent MCP API functions. The only structure members modified by an MCP API function
are those explicitly identified as output parameters.