logger_return_data
status.i4.v = logger_return_data(request_reply.s.r)
This routine returns logged data from a specific lumberjack.
request_reply request and reply data
(structure of type LOGGER_DATA)
typedef struct LOGGER_DATA
{
short tc_or_status;
short num_devices;
short num_points;
short min_delta_time;
unsigned int start_time;
unsigned int stop_time;
unsigned int first_time;
char device_names[5][LOGGER_SHORT_DEVICE_NAME_LEN];
unsigned int data[1];
} LOGGER_DATA;
Since a time retrieval window may result in the return of thousands of
points, repetitive calls to logger_return_data are made to return all
the data. The user initializes the "request_reply" structure once to
begin the retrieval and thereafter provides the structure as a seed to
continue the retrieval. The request typecode should have a value of
LOGGER_REQUEST_DATA, the number of devices may be 1-5, the total
structure size should not exceed ACNET_PACKET_SIZE bytes, and the start
and stop times are specified in the form of the C language time()
routine (seconds since January 1, 1970). The caller will be returned
the number of found points and alternating timestamp and data
beginning at "data". If the returned count is less than requested, the
structure may be reused without modification to collect another
portion of data within the specified time window. The user should note
that the timestamps have a resolution of one second though the
datalogger is capable of logging data as fast as 15 times per second.
This implies that duplicate timestamps may be returned. If the user
has specified more than one device for retrieval, the logger assumes
that only time correlated values are of interest. The logger discards
any data point whose timestamp/data does not exist for all devices.
If a single device is requested, the returned data consists of
repeating integer timestamps and floating point readings beginning at
the address of "->data[0]". Likewise, if multiple devices are
requested, the returned data consists of repeating unsigned integer
timestamps and an array of floating point values. The best example
of how to use this routine is found in the source code for the
Lumberjack plotter application (D44). The field "min_delta_time"
is the number of seconds of minimum time separation between points.
This should normally be zero. The archiver uses this field to
compress data returns.
This function returns ACNET status values as follows:
OK success
LJ_INVLEN invalid number of points requested
LJ_INVTC invalid type code
LJ_MEMFAIL dynamic memory allocation failure
ACNET_xxx error in communicating with Lumberjack
This function requires the following include files:
cnsparam_h, cns_data_structs_h, clib_h, acnet_errors_h
Related functions:
logger_get_device_c, logger_get_device_by_name_c,
logger_get_device_list_c, logger_setnode, logger_return_names,
logger_check_alive, logger_restart_lists, logger_shutdown,
logger_find_device_c
C/C++ usage:
int status;
LOGGER_DATA request_reply;
status = logger_return_data(&request_reply);