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... | |
CDI-TINE API library routines.
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().
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. |
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.
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 |
CDI_EXPORT int cdiGetHardwareAlarmThreshold | ( | void | ) |
Gets the number of bus io errors which are tolerated before setting a hardware error alarm.
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.
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.
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. |
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'.
value | is the desired setting (default = FALSE). |
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.
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.
value | determines whether CDI will set TINE alarms when a bus error is discovered. (default: TRUE) |
CDI_EXPORT void cdiSetHardwareAlarmThreshold | ( | int | value | ) |
Sets the number of bus io errors which are tolerated before setting a hardware error alarm.
value | gives the number of consecutive io errors to tolerate (default: 0) |
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.
value | is the polling interval in milliseconds used to refresh information for the local history and/or local alarm systems. (default: 1000 milliseconds). |