beautypg.com

ProSoft Technology MVI56E-LDM User Manual

Page 96

background image

CIP API Functions

ControlLogix Platform ♦ "C" Programmable

Developer's Manual

Linux Application Development Module

Page 90 of 264

ProSoft Technology, Inc.

March 12, 2014

Return Value
The

connect_proc

routine must return one of the following values if reason is

OCX_CIP_CONN_OPEN

:

Note: If reason is

OCX_CIP_CONN_OPEN_COMPLETE

or

OCX_CIP_CONN_CLOSE

, the return value

must be

OCX_SUCCESS

.

OCX_SUCCESS

connection is accepted

OCX_CIP_BAD_INSTANCE

instance is invalid

OCX_CIP_NO_RESOURCE

unable to support connection due to resource limitations

OCX_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:

OCX_CIP_EX_CONNECTION_USED

The requested connection is already in use.

OCX_CIP_EX_BAD_RPI

The requested packet interval cannot be supported.

OCX_CIP_EX_BAD_SIZE

The requested connection sizes do not match the
allowed sizes.

Example

OCXHANDLE Handle;
OCXCALLBACK connect_proc( OCXHANDLE objHandle, OCXCIPCONNSTRUCT
*sConn)
{
// Check reason for callback
switch( sConn->reason )
{
case OCX_CIP_CONN_OPEN:
// A new connection request is being made. Validate the
//parameters and determine whether to allow the connection.
//Return OCX_SUCCESS if the connection is to be established,
//or one of the extended error codes if not. See the sample
//code for more details.
return(OCX_SUCCESS);
case OCX_CIP_CONN_OPEN_COMPLETE:
// The connection has been successfully opened. If
// necessary,
// call OCXcip_WriteConnected to initialize transmit data.
return(OCX_SUCCESS);
case OCX_CIP_CONN_NULLOPEN:
// New configuration data is being passed to the open connection.
//Process the data as necessary and return success.
return(OCX_SUCCESS);
case OCX_CIP_CONN_CLOSE:
// This connection has been closed - inform the application
return(OCX_SUCCESS);
}
}