DR_ApReadControl

DR_ApReadControl — gets card control parameters.

Syntax

#include <cogent.h>
int DR_ApReadControl(int  card_id,
 int  buffer,
 unsigned short  offset,
 unsigned short  size,
 void*  status,
 char**  error);

Arguments

card_id

The ID of the card to be read for control parameters.

buffer

The ID of the target control parameter buffer (if applicable).

offset

The starting (byte) address for the specified data within the card buffer (if applicable).

size

The maximum number of bytes to be written.

status

A pointer to a card-dependent structure (at least size bytes long) that contains the control parameter information for the card.

error

The address of a string pointer. In case of error (non-zero return), the string pointer is set to the corresponding error description string. The error string is contained in a static buffer and remains valid only until the next API call. The parameter may be NULL if no error string is required.

Returns

The integer value 0 if the function was successful, otherwise one of the following error codes:

DR_API_IPC_ERRORS
DR_ERR_CARD_INVALID
DR_ERR_BLK_INVALID
DR_ERR_BLK_OFS_INVALID
DR_ERR_BLK_SIZE_INVALID
DR_ERR_CMD_INVALID

Description

This function obtains the current card control parameters. The control parameter data is dependent on the card.

Example

cif_ApParms_t	control;

if (result = DR_ApReadControl (0, 2, 0, sizeof (cif_ApParms_t),
                               &control, &error_str))
        printf ("Error@ReadControl (%d,%s)\n", result, error_str);
else
{
        printf ("Mode = %X, cycleTime = %d, Storage format = %d\n",
                control.Mode, control.CycleTime, control.Format);
}

See Also

Hilscher Fieldbus CIF Card in the Cogent C API manual.