Main Page | Features | Central Services | csv-Files | Types | Transfer | Access | API-C | API-VB/ActiveX | API-Java | Examples | Downloads

cdiTineLib.c File Reference

CDI-TINE API library routines. More...


Functions

CDI_EXPORT int cdiAttachLinkEx (char *devName, char *devProperty, DTYPE *dout, DTYPE *din, short access, int pollingRate, void(*callback)(int, int), int mode, UINT32 callbackID)
 Initiates an asynchronous CDI link.
CDI_EXPORT int cdiExecLinkEx (char *devName, char *devProperty, DTYPE *dout, DTYPE *din, short access, UINT16 timeout)
 Directly executes a synchronous CDI link.
CDI_EXPORT int cdiInitialize (void)
 initializes CDI
CDI_EXPORT int cdiRegisterDevice (char *devName, int devNumber, char *lngName, char *devDesc, int cdiLine, int cdiIndex, int *cdiAddress, int cdiAddressLength, int *devParameters)
 Registers a CDI device.
CDI_EXPORT int cdiSetExportName (char *expName)
 Sets the exported TINE device server name to the value given.
CDI_EXPORT void cdiSetGenerateAlarms (int value)
 Determines whether or not CDI will generate bus error alarms.
CDI_EXPORT void SetDefaultQueryPollingInterval (int value)
 Sets the default polling interval for local queries.


Detailed Description

CDI-TINE API library routines.


Function Documentation

CDI_EXPORT int cdiAttachLinkEx ( char *  devName,
char *  devProperty,
DTYPE *  dout,
DTYPE *  din,
short  access,
int  pollingRate,
void(*)(int, int)  callback,
int  mode,
UINT32  callbackID 
)

Initiates an asynchronous CDI link.

Asynchronous data data acquisition. cdiAttachLinkEx() returns immediately with a positive link index if the call is properly formed and the targeted device exists. Otherwise, a call to AttachLink() returns a negative completion code which can be interpreted with GetLastLinkError().

Parameters:
devName is the CDI device name (as registered either via the CDI database or via API call cdiRegisterDevice(). This can also be a 'group' of CDI devices in the form of 'device1','device2','device3',... (comma separated) or 'device1' - 'device100' (range specified).
devProperty is a CDI bus action property (e.g. "SEND", "RECV", "SEND.RECV.ATOM", "RECV.CLBR", etc.)
dout is a pointer to the output data set, that is, the data set to be returned from the hardware. The structure element ‘dout->data’ should be a pointer to a pre-allocated data buffer, which is to receive the returned data. If dout is a NULL pointer, it is assumed that no data are to be returned. Furthermore, the buffer must be large enough to hold the returned data.
din is a pointer to the input data set, that is, the data set to be sent to the hardware. If din is a NULL pointer, it is assumed that no data are to be sent to the server
access is the data access mode. This can be any combination of access codes ORed together (CA_READ, CA_WRITE. etc.).
pollingRate is the hardware polling interval in milliseconds.
callback is a caller supplied funtion to be called by CDI when the data acquisition has occurred. It must have the prototype 'void fcn(int id, int cc)', where 'id' will give the CDI link identifier and 'cc' will give the current completion code.
mode is the requested acquistion mode. This can be CM_SINGLE (a single asychronous acquisition) or also CM_DATACHANGE or CM_TIMER and can carry other acquistion/notification specifications such as CM_SEEKPATTERN or CM_NODUPLICATES, etc.
callbackID is a caller supplied id to be returned in the supplied callback function.
Returns:
0 if successful, otherwise a TINE completion code which can be interpreted by a call to GetLastLinkError().
See also:
cdiExecLinkEx, DTYPE

CDI_EXPORT int cdiExecLinkEx ( char *  devName,
char *  devProperty,
DTYPE *  dout,
DTYPE *  din,
short  access,
UINT16  timeout 
)

Directly executes a synchronous CDI link.

Synchronous data acquisition. cdiExecLinkEx() does not complete until the data transfer has completed or a timeout has ensued.

Parameters:
devName is the CDI device name (as registered either via the CDI database or via API call cdiRegisterDevice(). This can also be a 'group' of CDI devices in the form of 'device1','device2','device3',... (comma separated) or 'device1' - 'device100' (range specified).
devProperty is a CDI bus action property (e.g. "SEND", "RECV", "SEND.RECV.ATOM", "RECV.CLBR", etc.)
dout is a pointer to the output data set, that is, the data set to be returned from the hardware. The structure element ‘dout->data’ should be a pointer to a pre-allocated data buffer, which is to receive the returned data. If dout is a NULL pointer, it is assumed that no data are to be returned. Furthermore, the buffer must be large enough to hold the returned data.
din is a pointer to the input data set, that is, the data set to be sent to the hardware. If din is a NULL pointer, it is assumed that no data are to be sent to the server
access is the data access mode. This can be any combination of access codes ORed together (CA_READ, CA_WRITE. etc.).
timeout the timeout period in milliseconds for the call to complete. When it is known a priori that a call takes a long time to complete than you can set this value accordingly
Returns:
0 if successful, otherwise a TINE completion code which can be interpreted by a call to GetLastLinkError().
See also:
cdiAttachLinkEx, DTYPE

CDI_EXPORT int cdiInitialize ( void   ) 

initializes CDI

When statically linking to the CDI library, this routine must be called so as to initialize the CDI subsystem and read the local manifest and database files. Dynamically linked libraries will automatically call this routine during the prolog phase which the library is brought into memory.

Returns:
0 upon success

CDI_EXPORT int cdiRegisterDevice ( char *  devName,
int  devNumber,
char *  addrMap,
char *  devDesc,
int  cdiLine,
int  cdiIndex,
int *  addrBase,
int  addrLen,
int *  addrParam 
)

Registers a CDI device.

Normally one registers all CDI devices via the CDI database 'cdiaddr.csv'. However, one can also register hardware devices via this API call.

Parameters:
devName is the CDI device name to assign to the hardware address specified.
devNumber is the general CDI device number to assign to the hardware address specified.
addrMap is an address mapping name to assign to the hardware address specified. This is most useful for busses which deal with memory mapping (such as PLCs).
devDesc is a description of the device being registered.
cdiLine is the local hardware bus line on which to issue hardware telegrams.
cdiIndex is the hardware index on the CDI line specified (i.e. the device number on the line given).
addrBase is an array of up to 16 integer values defining the address registers. Most busses take integer address values. If not, the the addrMap parameter can be used to specify the address.
addrLen gives the number of integer values being passed in the addrBase (the size of the integer array).
addrParam is an array of up to 16 integer values defining additional register parameters used to define the device.
Returns:
0 if successful, otherwise a TINE completion code which can be interpreted by a call to GetLastLinkError().

CDI_EXPORT int cdiSetExportName ( char *  expName  ) 

Sets the exported TINE device server name to the value given.

If CDI initializes a TINE hardware server, it will exort itself under the name given.

Parameters:
expName is the desired export name of the CDI hardware server. (default: <fecname>.CDI)

CDI_EXPORT void cdiSetGenerateAlarms ( int  value  ) 

Determines whether or not CDI will generate bus error alarms.

If CDI calls to ExecLink() (or cdiExecLinkEx()) or AttachLink() (or cdiAttachLinkEx()) determine a bus error during the hardware access, a TINE alarm will be set if the value given here is TRUE, otherwise not.

Parameters:
value determines whether CDI will set TINE alarms when a bus error is discovered. (default: TRUE)

CDI_EXPORT void SetDefaultQueryPollingInterval ( int  value  ) 

Sets the default polling interval for local queries.

The local history subsystem and/or the local alarm server subsystem may or may not access CDI devices depending on the local server setup configuration. If CDI devices are accessed in this way, the internal polling interval for these kinds of access can be determined via this call.

Parameters:
value is the polling interval in milliseconds used to refresh information for the local history and/or local alarm systems. (default: 1000 milliseconds).


Generated on Fri Feb 27 09:21:05 2009 for CDI API by  doxygen 1.5.8