This asynchronous function reads the attribute values and timestamps from the history database for the specified time domain for an item.
This function is intended to be used to retrieve attributes that have changed to correlate the values of these attributes with the values of their data. For example, the recalibration of a sensor may have required the normal maximum and minimum attributes to be changed.
The results are returned via the client's ReadAttributeComplete event handler.
Visual Basic (Declaration) | |
---|---|
Public Overloads Function ReadAttribute( _ ByVal transactionID As Integer, _ ByVal startTime As OPCHDA.NET.OPCHDAtime, _ ByVal endTime As OPCHDA.NET.OPCHDAtime, _ ByVal handleServer As Integer, _ ByVal attributeIDs() As Integer, _ ByRef cancelID As Integer, _ ByRef errors As Integer() _ ) As Integer |
C# | |
---|---|
public int ReadAttribute( int transactionID, OPCHDA.NET.OPCHDAtime startTime, OPCHDA.NET.OPCHDAtime endTime, int handleServer, int[] attributeIDs, out int cancelID, out int[] errors ) |
Parameters
- transactionID
- An identifier created by the client and passed to the server in this call. The server shall return this identifier along with the results of this call.
- startTime
- The beginning of the attribute history period to br read.
- endTime
- The end of the attribute history period to be read.
- handleServer
- The server item handle for the item to be read
- attributeIDs
- The list of attribute IDs to be read
- cancelID
- OUT: Place to return a Server generated ID to be used in case the operation needs to be canceled.
- errors
- OUT: Array of HRESULTs indicating whether the corresponding dwAttributeID was valid.
Return Value
S_OK, S_FALSE, E_INVALIDHANDLE, E_INVALIDARG, E_FAILIf the only attribute values available for the item are the current values, these shall be returned and the error set to OPC_S_CURRENTVALUE. Except for the case where current values are requested (startTime = NOW, endTime = NULL), the server shall always return a beginning bounding value. Thus, if the client requests attribute values for Jan1, 1997 to October 1, 1997, the server shall return a value for the attribute on Jan 1, 1997, rather than the first value returned being the first new value for the attribute after Jan 1, 1997.
Likewise, the timestamp for that first value shall be Jan 1, 1997, regardless of when the attribute actually took that value. All other timestamps shall be for the time when the value of the attribute changed.
Note that while the client can query the server for the native datatype of an ItemID, the client cannot assume that all data sent from the server will be that datatype. The datatype of a given ItemID may have changed over the life of the Item, and thus clients should be able to handle receiving data of a different datatype than that returned from this call.
Target Platforms: Windows 7/8/10, Windows Server 2008/2012/2016, .NET 4.x