ProSoft Technology MVI56E-LDM User Manual
Page 94

CIP API Functions
ControlLogix Platform ♦ "C" Programmable
Developer's Manual
Linux Application Development Module
Page 88 of 264
ProSoft Technology, Inc.
March 12, 2014
5.4
CIP Callback Functions
Note: The functions in this section are not part of the CIP API, but must be implemented by the
application. The CIP API calls the connect_proc or service_proc functions when connection or
service requests are received for the registered object. The optional fatalfault_proc function is
called when the backplane device driver detects a fatal fault condition.
Special care must be taken when coding the callback functions, because these
functions are called directly from the backplane device driver. Callback functions
may be called at any time. Therefore, they should never call any functions that
are non-reentrant. Many 'C'-runtime library functions may be non-reentrant.
In general, the callback routines should be as short as possible. Stack size is
limited, so keep stack variables to a minimum. Do as little work as possible in
the callback.
connect_proc
Syntax
OCXCALLBACK connect_proc( OCXHANDLE objHandle, OCXCIPCONNSTRUC *sConn );
Parameters
objHandle
handle of registered object instance
sConn
pointer to structure of type OCXCIPCONNSTRUCT
Description
connect_proc
is a callback function which is passed to the CIP API in the
OCXcip_RegisterAssemblyObj
call. The CIP API calls the
connect_proc
function
when a Class 1 scheduled connection request is made for the registered object
instance specified by
objHandle
.
sConn
is a pointer to a structure of type
OCXCIPCONNSTRUCT
. this structure is shown
below:
typedef struct tagOCXCIPCONNSTRUC
{
OCXHANDLE connHandle; // unique value which identifies this connection
DWORD reg_param; // value passed via OCXcip_RegisterAssemblyObj
WORD reason; // specifies reason for callback
WORD instance; // instance specified in open
WORD producerCP; // producer connection point specified in open
WORD consumerCP; // consumer connection point specified in open
DWORD *lOTApi; // pointer to originator to target packet interval
DWORD *lTOApi; // pointer to target to originator packet interval
DWORD lODeviceSn; // Serial number of the originator
WORD iOVendorId; // Vendor Id of the originator
WORD rxDataSize; // size in bytes of receive data
WORD txDataSize; // size in bytes of transmit data
BYTE *configData; // pointer to configuration data sent in open
WORD configSize; // size of configuration data sent in open
WORD *extendederr; // an extended error code if an error occurs
} OCXCIPCONNSTRUC;