#include <cogent.h>
int DR_ApReadPoint(
char* pnt_name, int* pnt_type, DR_ApValue_t* pnt_value, char** error )
;
A string containing the name of the required point.
A pointer to an integer to return the point type code. This is needed to access the pnt_value. The list of defined driver data point types is described in the Overview section of the Device Driver for Hilscher Fieldbus Cards manual. This parameter can be NULL if the type of point is already known.
A pointer to the memory area to receive the point value. pnt_value is a union of the different types, and pnt_type is used to access the data.
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.
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-2010 by Cogent Real-Time Systems, Inc. All rights reserved.