CNVGetDataFromBuffer

int CNVGetDataFromBuffer (CNVBufferedSubscriber bufferedSubscriber, CNVData *data, CNVBufferDataStatus *dataStatus);

Purpose

Gets the next buffered value of a network variable using a buffered subscriber connection.

Note Note  This function is not reliable when the system or variable engine has just started up. This function can only check if the network variable process is configured to run, and so, during system startup may return TRUE even though the network variable process is not fully available. If your program needs to check if a network variable process is available during system startup, National Instruments recommends using the CNVBrowse function to browse the network variable process.
Note Note  To avoid deadlocks, do not call this function in a network variable callback function.

Parameters

Input
Name Type Description
bufferedSubscriber CNVBufferedSubscriber The handle that identifies the network variable buffered reader connection.
Output
Name Type Description
data CNVData Handle of the network variable data. Call CNVDisposeData to dispose the handle when you are done using it. CNVGetDataFromBuffer returns zero if there is no data in the buffer.
dataStatus CNVBufferDataStatus The status of the network variable data. You can pass NULL if you do not want this information. The status can be one of the following values.

CNVNewDataThis data item is new.
CNVNoDataThe buffer is empty. For example, CNVGetDataFromBuffer returns this status when you read a variable before any value has been written to it.
CNVStaleDataThis data item is stale—it is the same data you previously read. CNVGetDataFromBuffer returns the stale data in the data parameter.
CNVDataWasLostSome data items were overwritten and lost at this point of your data sequence because the buffer capacity was not large enough to hold all the received data items. CNVGetDataFromBuffer returns this status at the point in your data sequence where the data is missing and not on the first call after the data was lost. CNVGetDataFromBuffer returns the data that overwrote the missing data in the data parameter.

Return Value

Name Type Description
status int Return value indicating whether the function was successful. One indicates that a next item was found, zero indicates that a next item was not found, and a negative number indicates that an error occurred.

You can call CNVGetErrorDescription to obtain a string that describes the error.

Additional Information

Library: Network Variable Library

Include file: cvinetv.h

LabWindows/CVI compatibility: LabWindows/CVI 8.1 and later

Examples

Refer to the following examples that use the CNVGetDataFromBuffer function:

  • networkvariable\Buffering\NVBuffering.cws

    Open example
  • networkvariable\Polling\NVPolling.cws

    Open example

WAS THIS ARTICLE HELPFUL?

Not Helpful