Magtek MAGTEK User Manual Page 63

  • Download
  • Add to my manuals
  • Print
  • Page
    / 80
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 62
Section 5. Application Programmable Interface
57
McpOpen
This function is used to open the communication channel and establish communications with an
MCP device. Use McpClose to close the channel.
DWORD McpOpen( LPSTR lpDeviceName, PHANDLE hpDevice );
Parameters
lpDeviceName
Pointer to a null terminated string which specifies the logical device name of the MCP device to
which communications is to be established. This name could be a hard coded device name, a
name obtained from the registry, or other configuration data, or more likely, a name returned
from the McpEnum function.
hpDevice
Pointer to storage area to receive the open handle to the specified device (communications
resource). This handle is used on subsequent calls to functions requiring communications with
the MCP device. If the function fails, the value of hpDevice is not modified.
Return Value
The returned value indicates the outcome of the open function.
Value Meaning
MCP_ST_OK Success. The channel has been established.
MCP_ST_NOT_FOUND Unknown device or device not found
MCP_ST_ACCESS_DENI
ED
Device is already open
MCP_ST_BAD_ACCESS lpDeviceName or hpDevice parameter is an invalid pointer
MCP_ST_FAILED Other error
Remarks
The host application uses McpOpen to open a handle to a communications resource.
If the specified resource is currently being used, this function fails. Any thread of the process can
use the handle returned by McpOpen to identify the resource in any of the functions that access
the resource.
Some devices automatically synchronize to communication parameters used by the host. For
example, some serial devices automatically synchronize to the baud rate the host is using. This
synchronization occurs during the call to McpOpen. Once a device is synchronized, it will not
Page view 62
1 2 ... 58 59 60 61 62 63 64 65 66 67 68 ... 79 80

Comments to this Manuals

No comments