Publication 1756-RM004B-EN-P - October 2000
4-8 CIP Messaging API
service_proc
is a pointer to a callback function which handles service
requests to the registered object. This function will be called by the
backplane device driver when an unscheduled message is received for
the object. See Section 4.3.4 for details.
rxdata_proc
is a pointer to a callback function which handles data
received on an open connection. If
rxdata_proc
is NULL, then the CIP
API buffers the received data and the application must retrieve the data
using the MVIcip_ReadConnected() function. If
rxdata_proc
is not
NULL, then the
rxdata_proc
callback routine must copy the received
data to a local buffer.
Return Value:
MVI_SUCCESS object was registered successfully
MVI_ERR_NOACCES S
apiHandle
does not have access
MVI_ERR_BADPARAM
connect_proc
or
service_proc
is NULL
MVI_ERR_ALREADY_REGISTEREDobject has already been registered
Example:
MVIHANDLE apiHandle;
MVIHANDLE objHandle;
MY_STRUCT mystruct;
int rc;
MVICALLBACK MyConnectProc (MVIHANDLE, MVICIPCONNSTRUC *);
MVICALLBACK MyServiceProc(MVIHANDLE, MVICIPSERVSTRUC *);
// Register all instances of the assembly object
rc = MVIcip_RegisterAssemblyObj( apiHandle, &objHandle,
(DWORD)&mystruct, MyConnectProc, MyServiceProc, NULL );
if (rc != MVI_SUCCESS) printf(“Unable to register assembly object\n”);
See Also:
MVIcip_UnregisterAssemblyObj
connect_proc
service_proc
MVIcip_RegisterAssemblyObj