ihuReadInterpolatedValue

Use the ihuReadInterpolatedValue function to return the value of a tag interpolated to a specified date and time.

Prototype

ihuReadInterpolatedValue {
  in long serverhandle,
  in int number_of_tags,
  in/out IHU_DATA_SAMPLE * pSamples,
  out ihuErrorCode * error_returns
};

Remarks

You can retrieve values for multiple tags with one call. A single sample for each requested tag is returned.

For each tag, set only the tagname and time stamp fields in IHU_DATA_SAMPLE. All other fields are set by the function. The time stamp in the first requested tag is used for all tags.

Data is returned based on the data type of the tag.

The data quality returned is either ihuOPCGood or ihuOPCBad, and the substatus is always ihuOPCNonspecific.

You must specify a time stamp in IHU_DATA_SAMPLE for the first requested tag, for example:

//you only need to populate the time stamp in the first sample
lRet = IHU_timestamp_FromParts(2003,
7,
22,
11,
0,
0,
0,
&(pSamples[0].timestamp));
lRet= ihuReadInterpolatedValue (serverhandle, // handle from connect
number_of_tags, // number of tags, one sample per tag
pSamples, // allocated by caller, value set by API
error_returns); // error code per tag

For an example, refer to the ReportLike sample program.

Returns

The ihuReadInterpolatedValue function returns errors in two ways. The function has a return code, and each tag name has an error code. Check function-level errors before you examine tag-level errors.

Both are ihuSTATUS_OK when the current value is successfully retrieved.

The ihuReadInterpolatedValue function returns errors on read timeouts or when the user is not a member of the ih Readers security group.

For example, each tag can return an error in cases where tags are not found or have no raw samples.