beautypg.com

Section 5. application programmable interface, Typical operation – MagTek MAGTEK User Manual

Page 53

background image

47

SECTION 5. APPLICATION PROGRAMMABLE INTERFACE


The application programmable interface (API) is presented through a 32 bit, Win32 DLL
MCPAPI.DLL. This dll is installed during driver installation. The API gives a Windows
application a set of easy to use “C” style functions that it can use to communicate with the MCP
driver/device. This dll can be used by a variety of development platforms. For example, the dll
can be used by Microsoft Visual Basic 6.0 and Microsoft Visual C++.


TYPICAL OPERATION

The host application can enumerate (get the name of) the available devices using the McpEnum
function. The function returns the names of all the device Instances configured on the host
computer. The results obtained through that function can be used in the subsequent McpOpen
calls.

To establish a communication channel with the desired device, the host application must first
open the device by calling the McpOpen function. If the operation is successful, a handle is
returned which should be used as hDevice parameter on subsequent API calls.

At any time after the device has been opened, the host application can re-establish, or reset the
channel by calling McpReset. This will abort any outstanding requests and will restore the
communication channel to its initial state.

After the device has been opened, command requests can be sent to the device by calling the
McpCall function.

At some point the device could send an unsolicited notification, which can be retrieved by the
application using the McpWait function.

The application also may get the current values of the driver or device properties through
McpGet calls. For modifying the values of those properties the application can use an MCPSet
call.

When the device is no longer needed, the communication channel with a given device can be
closed by calling the McpClose function.