ProSoft Technology MVI69-ADM User Manual
Page 280

CIP Messaging Library Functions
MVI-ADM ♦ 'C' Programmable
Developer's Guide
'C' Programmable Application Development Module
Page 280 of 342
ProSoft Technology, Inc.
February 20, 2013
rxDataSize is the size in bytes of the data to be received on this connection.
txDataSize is the size in bytes of the data to be sent on this connection.
configData is a pointer to a buffer containing any configuration data that was sent
with the open request. configSize is the size in bytes of the configuration data.
extendederr is a pointer to a word which may be set by the callback function to
an extended error code if the connection open request is refused.
Return Value
The connect_proc routine must return one of the following values if reason is
MVI_CIP_CONN_OPEN:
Note: If reason is MVI_CIP_CONN_OPEN_COMPLETE or MVI_CIP_CONN_CLOSE, the return
value must be MVI_SUCCESS.
MVI_SUCCESS
connection is accepted
MVI_CIP_BAD_INSTANCE
instance is invalid
MVI_CIP_NO_RESOURCE
unable to support connection due to resource limitations
MVI_CIP_FAILURE
connection is rejected: extendederr may be set
Extended Error Codes
If the open request is rejected, extendederr can be set to one of the following
values:
MVI_CIP_EX_CONNECTION_USED
The requested connection is already in use.
MVI_CIP_EX_BAD_RPI
The requested packet interval cannot be supported.
MVI_CIP_EX_BAD_SIZE
The requested connection sizes do not match the
allowed sizes.
Example
MVIHANDLE Handle;
MVICALLBACK connect_proc( MVIHANDLE objHandle, MVICIPCONNSTRUCT
*sConn)
{
// Check reason for callback
switch( sConn->reason )
{
case MVI_CIP_CONN_OPEN:
// A new connection request is being made. Validate the // parameters and
determine whether to allow the // connection.
// Return MVI_SUCCESS if the connection is to be
// established,
// or one of the extended error codes if not. Refer to the sample
// code for more details.
return(MVI_SUCCESS);
case MVI_CIP_CONN_OPEN_COMPLETE:
// The connection has been successfully opened. If
// necessary,
// call MVIcip_WriteConnected to initialize transmit data.
return(MVI_SUCCESS);
case MVI_CIP_CONN_CLOSE:
// This connection has been closed - inform the application