ProSoft Technology MVI69-ADM User Manual

Page 282

Advertising
background image

CIP Messaging Library Functions

MVI-ADM ♦ 'C' Programmable

Developer's Guide

'C' Programmable Application Development Module

Page 282 of 342

ProSoft Technology, Inc.

February 20, 2013

service_proc

Syntax

MVICALLBACK service_proc( MVIHANDLE objHandle, MVICIPSERVSTRUC *sServ );

Parameters

objHandle

handle of registered object

sServ

pointer to structure of type MVICIPSERVSTRUC

Description
service_proc is a callback function which is passed to the CIP API in the
MVIcip_RegisterAssemblyObj call. The CIP API calls the service_proc function
when an unscheduled message is received for the registered object specified by
objHandle.

Note that the object ID, Instance Number, is overwritten by the instance
parameter of the structure below.

sServ is a pointer to a structure of type MVICIPSERVSTRUC. This structure is
shown below:

typedef struct tagMVICIPSERVSTRUC
{
DWORD reg_param; // value passed via MVIcip_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
} MVICIPSERVSTRUC;

reg_param is the value that was passed to MVIcip_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.

Advertising