Visual Basic (Usage) | ![]() |
---|---|
Dim instance As Session Dim nodesToRead As IList(Of ReadValueId) Dim maxAge As UInteger Dim timestampsToReturn As TimestampsToReturn Dim settings As RequestSettings Dim value As List(Of DataValue) value = instance.Read(nodesToRead, maxAge, timestampsToReturn, settings) |
C# | |
---|---|
public List<DataValue> Read( IList<ReadValueId> nodesToRead, uint maxAge, TimestampsToReturn timestampsToReturn, RequestSettings settings ) |
Parameters
- nodesToRead
- List of Nodes and their Attributes to read. For each entry in this list, a StatusCode is returned, and if it indicates success, the Attribute Value is also returned.
- maxAge
- Maximum age of the value to be read in milliseconds.
The age of the value is based on the difference between the ServerTimestamp and the time when the Server starts processing the request. For example if the Client specifies a maxAge of 500 milliseconds and it takes 100 milliseconds until the Server starts processing the request, the age of the returned value could be 600 milliseconds prior to the time it was requested. If the Server has one or more values of an Attribute that are within the maximum age, it can return any one of the values or it can read a new value from the data source. The number of values of an Attribute that a Server has depends on the number of MonitoredItems that are defined for the Attribute. In any case, the Client can make no assumption about which copy of the data will be returned. If the Server does not have a value that is within the maximum age, it shall attempt to read a new value from the data source. If the Server cannot meet the requested maxAge, it returns its “best effort” value rather than rejecting the request. This may occur when the time it takes the Server to process and return the new data value after it has been accessed is greater than the specified maximum age. If maxAge is set to 0, the Server shall attempt to read a new value from the data source. If maxAge is set to the max Int32 value or greater, the Server shall attempt to get a cached value. - timestampsToReturn
- An enumeration that specifies the Timestamps to be returned for each requested Variable Value Attribute.
OPC UA defines two timestamps, the source and the server timestamp. This parameter allows the client to define which timestamps the server should return with the value.
The source timestamp is only available for Value Attributes. The source timestamp is used to reflect the timestamp that was applied to a Variable value by the data source. It should indicate the last change of the value or status code. The source timestamp must be always generated by the same physical clock. This timestamp type was added for OPC UA to cover the use case to get the timestamp of the last value change which is different than the server timestamp definition.
The server timestamp is used to reflect the time that the server received a Variable value or knew it to be accurate if the changes are reported by exception and the connection to the data source is operating. This is the behavior expected by Classic OPC
Possible values are:
- TimestampsToReturn.Source
- TimestampsToReturn.Server
- TimestampsToReturn.Both - settings
- The general settings for the request. If null, the default settings from the property DefaultRequestSettings are used.
Return Value
A list with the read vakue for each node/attribute.
The Read Service is used to read one or more attributes of one or
more nodes. It allows also reading subsets or single elements of array
values and to define a valid age of values to be returned to reduce
the need for device reads. Like most other services, the read is
optimized for bulk read operations and not for reading single
Attribute values. Typically all Node Attributes are readable. For the
Value Attribute the Read rights are indicated by the AccessLevel and
UserAccessLevel Attribute of the Variable.
Target Platforms: Windows 7/8/10, Windows Server 2003/2008/2012/2015, .NET4.x