Main Page | Features | Central Services | csv-Files | Types | Transfer | Access | API-C | API-.NET | API-Java | Examples | Downloads
page generated on 22.12.2024 - 04:45
Functions
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. More...
 
CDI_EXPORT int cdiExecLinkEx (char *devName, char *devProperty, DTYPE *dout, DTYPE *din, short access, UINT16 timeout)
 Directly executes a synchronous CDI link. More...
 
CDI_EXPORT int cdiGetHardwareAlarmThreshold (void)
 Gets the number of bus io errors which are tolerated before setting a hardware error alarm. More...
 
CDI_EXPORT char * cdiGetVersionAsString (void)
 Returns the CDI library version as string.
 
CDI_EXPORT int cdiInitialize (void)
 initializes CDI More...
 
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. More...
 
CDI_EXPORT void cdiSetAllowRemoteManagement (int value)
 Turns on/off remote management. More...
 
CDI_EXPORT int cdiSetExportName (char *expName)
 Sets the exported TINE device server name to the value given. More...
 
CDI_EXPORT void cdiSetGenerateAlarms (int value)
 Determines whether or not CDI will generate bus error alarms. More...
 
CDI_EXPORT void cdiSetHardwareAlarmThreshold (int value)
 Sets the number of bus io errors which are tolerated before setting a hardware error alarm. More...
 
CDI_EXPORT BYTE * cdiVersion (void)
 Returns the CDI library version as byte array.
 
CDI_EXPORT void SetDefaultQueryPollingInterval (int value)
 Sets the default polling interval for local queries. More...
 

Detailed Description

CDI-TINE API library routines.

Function Documentation

◆ cdiAttachLinkEx()

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
devNameis 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).
devPropertyis a CDI bus action property (e.g. "SEND", "RECV", "SEND.RECV.ATOM", "RECV.CLBR", etc.)
doutis 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.
dinis 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
accessis the data access mode. This can be any combination of access codes ORed together (CA_READ, CA_WRITE. etc.).
pollingRateis the hardware polling interval in milliseconds.
callbackis 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.
modeis 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.
callbackIDis 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

◆ cdiExecLinkEx()

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
devNameis 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).
devPropertyis a CDI bus action property (e.g. "SEND", "RECV", "SEND.RECV.ATOM", "RECV.CLBR", etc.)
doutis 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.
dinis 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
accessis the data access mode. This can be any combination of access codes ORed together (CA_READ, CA_WRITE. etc.).
timeoutthe 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

◆ cdiGetHardwareAlarmThreshold()

CDI_EXPORT int cdiGetHardwareAlarmThreshold ( void  )

Gets the number of bus io errors which are tolerated before setting a hardware error alarm.

Returns
the number of consecutive io errors to tolerate (default: 0)

◆ cdiInitialize()

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

◆ cdiRegisterDevice()

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
devNameis the CDI device name to assign to the hardware address specified.
devNumberis the general CDI device number to assign to the hardware address specified.
addrMapis 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).
devDescis a description of the device being registered.
cdiLineis the local hardware bus line on which to issue hardware telegrams.
cdiIndexis the hardware index on the CDI line specified (i.e. the device number on the line given).
addrBaseis 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.
addrLengives the number of integer values being passed in the addrBase (the size of the integer array).
addrParamis 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().

◆ cdiSetAllowRemoteManagement()

CDI_EXPORT void cdiSetAllowRemoteManagement ( int  value)

Turns on/off remote management.

If remote management is turned on, then the stock properties 'SRVINIT', 'SRVEXIT', and 'SRVRESET' are allowed to re-initialize, exit, or reset the server's equiment module. Specifically, 'SRVEXIT' will issue an 'exit(code)' at the process level, where 'code' is the input given in the call to 'SRVEXIT'.

Parameters
valueis the desired setting (default = FALSE).

◆ cdiSetExportName()

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
expNameis the desired export name of the CDI hardware server. (default: <fecname>.CDI)

◆ cdiSetGenerateAlarms()

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
valuedetermines whether CDI will set TINE alarms when a bus error is discovered. (default: TRUE)

◆ cdiSetHardwareAlarmThreshold()

CDI_EXPORT void cdiSetHardwareAlarmThreshold ( int  value)

Sets the number of bus io errors which are tolerated before setting a hardware error alarm.

Parameters
valuegives the number of consecutive io errors to tolerate (default: 0)

◆ SetDefaultQueryPollingInterval()

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
valueis the polling interval in milliseconds used to refresh information for the local history and/or local alarm systems. (default: 1000 milliseconds).

Impressum   |   Imprint   |   Datenschutzerklaerung   |   Data Privacy Policy   |   Declaration of Accessibility   |   Erklaerung zur Barrierefreiheit
Generated for TINE API by  doxygen 1.5.8