Cip object registration – ProSoft Technology MVI69-ADM User Manual

Page 272

Advertising
background image

CIP Messaging Library Functions

MVI-ADM ♦ 'C' Programmable

Developer's Guide

'C' Programmable Application Development Module

Page 272 of 342

ProSoft Technology, Inc.

February 20, 2013

10.4 CIP Object Registration

MVIcip_RegisterAssemblyObj

Syntax

int MVIcip_RegisterAssemblyObj(MVIHANDLE handle, MVIHANDLE *objHandle, DWORD
reg_param, MVICALLBACK (*connect_proc)(), MVICALLBACK (*service_proc)(),
MVICALLBACK (*rxdata_proc)() );

Parameters

handle

handle returned by previous call to MVIcip_Open

objHandle

pointer to variable of type MVIHANDLE. On successful return,
this variable will contain a value which identifies this object.

reg_param

value that will be passed back to the application as a parameter
in the connect_proc and service_proc callback functions.

connect_proc

pointer to callback function to handle connection requests

service_proc

pointer to callback function to handle service requests

rxdata_proc

pointer to callback function to receive data from an open
connection

Description
This function is used by an application to register all instances of the Assembly
Object with the CIP API. The object must be registered before a connection can
be established with it.

handle must be a valid handle returned from MVIcip_Open.

reg_param is a value that will be passed back to the application as a parameter
in the connect_proc and service_proc callback functions. The application may
use this to store an index or pointer. It is not used by the CIP API.

connect_proc is a pointer to a callback function to handle connection requests to
the registered object. This function will be called by the backplane device driver
when a Class 1 scheduled connection request for the object is received. It will
also be called when an established connection is closed.

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.

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_NOACCESS

handle does not have access

MVI_ERR_BADPARAM

connect_proc or service_proc is NULL

MVI_ERR_ALREADY_REGISTERED

object has already been registered

Advertising