ProSoft Technology MVI56E-LDM User Manual
Page 99

ControlLogix Platform ♦ "C" Programmable
CIP API Functions
Linux Application Development Module
Developer's Manual
ProSoft Technology, Inc.
Page 93 of 264
March 12, 2014
service_proc
Syntax
OCXCALLBACK service_proc( OCXHANDLE objHandle, OCXCIPSERVSTRUC *sServ );
Parameters
objHandle
handle of registered object
sServ
pointer to structure of type OCXCIPSERVSTRUC
Description
service_proc
is a callback function which is passed to the CIP API in the
OCXcip_RegisterAssemblyObj
call. The CIP API calls the
service_proc
function
when an unscheduled message is received for the registered object specified by
objHandle
.
sServ
is a pointer to a structure of type
OCXCIPSERVSTRUC
. This structure is shown
below:
typedef struct tagOCXCIPSERVSTRUC
{
DWORD reg_param; // value passed via OCXcip_RegisterAssemblyObj
WORD instance; // instance number of object being accessed
BYTE serviceCode; // service being requested
WORD attribute; // attribute being accessed
BYTE **msgBuf; // pointer to pointer to message data
WORD offset; // member offset
WORD *msgSize; // pointer to size in bytes of message data
WORD *extendederr; // an extended error code if an error occurs
BYTE fromSlot; //Slot number in local rack that sent the message
DWORD msgHandle; //Handle used by OCXcip_MsgResponse
} OCXCIPSERVSTRUC;
reg_param
is the value that was passed to
OCXcip_RegisterAssemblyObj
. The
application may use this to store an index or pointer. It is not used by the CIP
API.
instance
specifies the instance of the object being accessed.
serviceCode
specifies the service being requested. attribute specifies the
attribute being accessed.
msgBuf
is a pointer to a pointer to a buffer containing the data from the message.
This pointer should be updated by the callback routine to point to the buffer
containing the message response upon return.
offset
is the offset of the member being accessed.
msgSize
points to the size in bytes of the data pointed to by
msgBuf
. The
application should update this with the size of the response data before returning.
extendederr
is a pointer to a word which can be set by the callback function to an
extended error code if the service request is refused.