#include <cogent.h>
int DR_ApReadPoint(char* pnt_name, int* pnt_type, DR_ApValue_t* pnt_value, char** error );
The integer value 0 if the point was accessed successfully, otherwise one of the following error codes is returned:
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
int type, result;
DR_ApValue_t value;
char *error_str, *name = "Pushbutton";
result = DR_ApReadPoint (name, &type, &value, &error_str);
if (result == 0)
{
printf (" Pnt: %s ", name);
switch(type)
{
case DR_API_DOUBLE_TYPE:
printf ("(real) = %f\n", value.d);
break;
case DR_API_INT32_TYPE:
printf ("(int) = %d\n", value.i);
break;
case DR_API_INT16_TYPE:
printf ("(short) = %d\n", value.s);
break;
case DR_API_BIT_TYPE:
printf ("(bit) = %1X\n", value.s);
break;
default:
printf ("(%d) = %X\n", type, value.i);
}
}
else
printf (" Error@ListPoints:%s (%d, %s): \n",
name, result, error_str);Copyright © 1995-2006 by Cogent Real-Time Systems, Inc. All rights reserved.