OPC Historian .NET Server Toolkit Reference
ReadAttribute(Int32,DateTime,DateTime,Int32,Int32[],Int32,Int32[]) Method

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.
The beginning of the history period to be read.
The end of the history period to be read.
The list of server item handles for the items to be read.
The list of attribute IDs to be read.
Place to return a Server generated ID to be used in case the operation needs to be canceled.
Array of HRESULTs indicating whether the corresponding server handle was valid.
Asynchronous ReadAttribute.
This method reads the attribute values and timestamps from the history database for the specified time domain for an item. If the current values for the attributes are desired, endTime is MinValue time. This method 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 IOPCHDA_DataCallback::OnReadAttributeComplete method. If the only attribute values available for the item are the current values, these shall be returned and errors set to OPC_S_CURRENTVALUE. Except for the case where current values are requested (endTime = MinValue), 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.
Syntax
'Usage
 
Dim instance As IAppPlugin
Dim transactionID As Integer
Dim startTime As Date
Dim endTime As Date
Dim serverHandle As Integer
Dim attributeIDs() As Integer
Dim cancelID As Integer
Dim errors As Integer()
Dim value As Integer
 
value = instance.ReadAttribute(transactionID, startTime, endTime, serverHandle, attributeIDs, cancelID, errors)
int ReadAttribute( 
   int transactionID,
   DateTime startTime,
   DateTime endTime,
   int serverHandle,
   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 history period to be read.
endTime
The end of the history period to be read.
serverHandle
The list of server item handles for the items to be read.
attributeIDs
The list of attribute IDs to be read.
cancelID
Place to return a Server generated ID to be used in case the operation needs to be canceled.
errors
Array of HRESULTs indicating whether the corresponding server handle was valid.

Return Value

HRESULTS success/error code.
Remarks
The requests are queued and handled by a thread. The sample implementation has on handling thread. To improve performance it may be necessary in some servers to have multiple handling threads.
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

IAppPlugin Interface
IAppPlugin Members
Overload List

 

 


Copyright © 2004-2019 Advosol Inc. All rights reserved

Send Feedback