ProSoft Technology MVI56E-LDM User Manual
Page 179

ControlLogix Platform ♦ "C" Programmable
CIP API Functions
Linux Application Development Module
Developer's Manual
ProSoft Technology, Inc.
Page 173 of 264
March 12, 2014
OCXcip_MsgResponse
Syntax
int OCXcip_MsgResponse (OCXHANDLE apihandle,
DWORD msgHandle,
BYTE serviceCode,
BYTE * msgBuf,
WORD msgSize,
BYTE returnCode,
WORD extendederr);
Parameters
apihandle
apihandle returned by previous call to OCXcip_Open
msgHandle
Handle returned in OCXCIPSERVSTRUC
serviceCode
Message service code returned in OCXCIPSERVSTRUC
msgBuf
Pointer to buffer containing data to be sent with response (NULL
if none)
msgSize
Number of bytes of data to send with response (0 if none)
returnCode
Message return code (OCX_SUCCESS if no error)
extendederr
Extended error code (0 if none)
Description
OCXcip_MsgResponse
is used by an application that needs to delay the response to
an unscheduled message received via the
service_proc
callback. The
service_proc
callback is called sequentially and overlapping calls are not
supported. If the application needs to support overlapping messages (for
example, to maximize performance when there are multiple message sources),
then the response to the message can be deferred by returning
OCX_CIP_DEFER_RESPONSE
in the
service_proc
callback. At a later time,
OCXcip_MsgResponse
can be called to complete the message. For example, the
service_proc
callback can queue the message for later processing by another
thread (or multiple threads).
Note: The
service_proc
callback must save any needed data passed to it in the
OCXCIPSERVSTRUC
structure. This data is only valid in the context of the callback.
OCXcip_MsgResponse
must be called after
OCX_CIP_DEFER_RESPONSE
is returned by
the callback. If
OCXcip_MsgResponse
is not called, communications resources will
not be freed and a memory leak will result.
If
OCXcip_MsgResponse
is not called within the message timeout, the message will
fail. The sender determines the message timeout.
msgHandle
and
serviceCode
must match the corresponding values passed to the
service_proc
callback in the
OCXCIPSERVSTRUC
structure.
Return Value
OCX_SUCCESS
Response was sent successfully