DR_ApDescribePnt

DR_ApDescribePnt — gives a description of a point.

Syntax

#include <cogent.h>
int DR_ApDescribePnt(char*  pnt_name,
 int*  pnt_type,
 int*  enabled,
 int*  readable,
 int*  writeable,
 char*  address,
 int  addr_len,
 char**  error);

Arguments

pnt_name

A string containing the name of the required point.

pnt_type

If not NULL and the point is defined, then the type of the point is returned here. The following point types are defined (see dr_api.h):

* DR_API_DOUBLE_TYPE
* DR_API_INT16_TYPE
* DR_API_BIT_TYPE
enabled

If not NULL and the point is defined, then the status of the point is returned here, 1 if enabled, 0 if disabled.

readable

If not NULL and the point is defined, then 1 is returned if the point is configured as readable.

writeable

If not NULL and the point is defined, then 1 is returned if the point is configured as writeable.

address

If not NULL, the address of a string to be set to the point's address string, as specified during the configuration.

addr_len

The maximum length of the address string. Although addressing requirements vary with the type of driver and point, 16 characters is usually sufficient.

error

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 point was accessed successfully, otherwise one of the following error codes:

DR_ERR_PNT_NOT_FOUND
DR_ERR_PNT_NOT_ENABLED
DR_ERR_PNT_NOT_READABLE
DR_ERR_PNT_TYPE_NO_REP
DR_API_STATUS_ERRORS 
DR_API_IPC_ERRORS

Description

This function gets a description of the named point.

Example

int         enabled, readable, writeable, type;
char        *name = "counter";
char        address[16];
char        *error_str;

if result = DR_ApDescribePoint (name, &type, &enabled,
                                &readable, &writeable,
                                address, sizeof(address), &error_str))
{
        printf ("     Error@DescribePoint (%d, %s)\n",
                result, error_str);
}
else
{
        printf ("     Point %s: type %d, %s%s, addr: %s\n",
                test_pnt, type, (readable?"R":""),
                (writeable?"W":""), address);
}