ProSoft Technology MVI56E-LDM User Manual
Page 100

CIP API Functions
ControlLogix Platform ♦ "C" Programmable
Developer's Manual
Linux Application Development Module
Page 94 of 264
ProSoft Technology, Inc.
March 12, 2014
fromSlot
is the slot number in the local rack from which the message was
received. If the module in this slot is a communications bridge, then it is
impossible to determine the actual originator of the message.
msgHandle
is only needed if the callback returns
OCX_CIP_DEFER_RESPONSE
. If this
code is returned, the message response is not sent until
OCXcip_MsgResponse
is
called.
Note: If the
service_proc
callback returns
OCX_CIP_DEFER_RESPONSE
, it must save
any needed data passed to it in the
OCXCIPSERVSTRUC
structure. This data is only
valid in the context of the callback. If the received message contains data, the
buffer pointed to by
msgBuf
can be accessed after the callback returns. However,
the pointer itself will not be valid.
Return Value
The
service_proc
routine must return one of the following values:
OCX_SUCCESS
message processed successfully
OCX_CIP_BAD_INSTANCE
invalid class instance
OCX_CIP_BAD_SERVICE
invalid service code
OCX_CIP_BAD_ATTR
invalid attribute
OCX_CIP_ATTR_NOT_SETTABLE
attribute is not settable
OCX_CIP_PARTIAL_DATA
data size invalid
OCX_CIP_BAD_ATTR_DATA
attribute data is invalid
OCX_CIP_FAILURE
generic failure code
OCX_CIP_DEFER_RESPONSE
defer response until OCXcip_MsgResponse is called
Example
OCXHANDLE Handle;
OCXCALLBACK service_proc ( OCXHANDLE objHandle, OCXCIPSERVSTRUC
*sServ )
{
// Select which instance is being accessed.
// The application defines how each instance is defined.
switch(sServ->instance)
{
case 1: // Instance 1
// Check serviceCode and attribute; perform
// requested service if appropriate
break;
case 2: // Instance 2
// Check serviceCode and attribute; perform
// requested service if appropriate
break;
default:
return(OCX_CIP_BAD_INSTANCE); // Invalid instance
}
}
See Also
OCXcip_RegisterAssemblyObj