DH_FormatPoint

DH_FormatPoint — puts point data in ASCII format.

Syntax

#include <cogent.h>
int DH_FormatPoint(char*  command,
 IP_Task*  myself,
 PT_pCPOINT  ppoint,
 char*  buf,
 int  len,
 int  flags);

Arguments

command

The first word in the command string. It can't be NULL, but it can be blank.

myself

The task handle associated with this task. This should always be the return value from IP_NserveInit.

ppoint

A pointer to a Cascade DataHub point structure, which must contain at least name. All other fields in the point structure should be 0 if this is the first call on this point, because they will be filled in by this call. Subsequent calls on the same point do not require zeroing any fields. If one point structure is used with several point names, the address field must be zeroed each time a different name is used in a call to this function.

buf

The buffer to be written into.

len

The length of buf.

flags

One or none of these:

PT_FMT_ASCIIConstructs a humanly readable ASCII string (the default).
PT_FMT_BINARYEncodes data as a raw binary representation, efficient for parsing.
PT_FMT_HEXEncodes data as ASCII encoded hex. (This is not a valuable format since it is more difficult to parse and less space efficient than binary, and it is more difficult for humans to read than regular ASCII.)
PT_FMT_POINT_SECURITYTakes a security value from the point structure, not a task structure.

Returns

The length of the buffer.

Description

This function takes a point structure and creates an ASCII representation of data for the point in the buf buffer. The data is represented as a list, in this format:

(command pointname type value conf security locked seconds nanoseconds)
[Note]

The resulting buffer can be passed back to DH_ParsePointString, which would parse it back out. It infers the flag.

See Also

PT_stCPOINT, Point Structure, Storage, and Manipulation