Created
August 26, 2013 02:31
-
-
Save Snegovikufa/6337658 to your computer and use it in GitHub Desktop.
OPC UA how to read raw history values
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void ReadRaw(bool isReadModified) | |
{ | |
ReadRawModifiedDetails details = new ReadRawModifiedDetails(); | |
details.StartTime = DateTime.MinValue; | |
details.EndTime = DateTime.MinValue; | |
details.IsReadModified = isReadModified; | |
details.NumValuesPerNode = 0; | |
details.ReturnBounds = ReturnBoundsCK.Checked; | |
if (StartTimeCK.Checked) | |
{ | |
details.StartTime = StartTimeDP.Value.ToUniversalTime(); | |
} | |
if (EndTimeCK.Checked) | |
{ | |
details.EndTime = EndTimeDP.Value.ToUniversalTime(); | |
} | |
if (MaxReturnValuesCK.Checked) | |
{ | |
details.NumValuesPerNode = (uint)MaxReturnValuesNP.Value; | |
} | |
HistoryReadValueId nodeToRead = new HistoryReadValueId(); | |
nodeToRead.NodeId = m_nodeId; | |
if (m_result != null) | |
{ | |
nodeToRead.ContinuationPoint = m_result.ContinuationPoint; | |
} | |
HistoryReadValueIdCollection nodesToRead = new HistoryReadValueIdCollection(); | |
nodesToRead.Add(nodeToRead); | |
HistoryReadResultCollection results = null; | |
DiagnosticInfoCollection diagnosticInfos = null; | |
m_session.HistoryRead( | |
null, | |
new ExtensionObject(details), | |
TimestampsToReturn.Source, | |
false, | |
nodesToRead, | |
out results, | |
out diagnosticInfos); | |
Session.ValidateResponse(results, nodesToRead); | |
Session.ValidateDiagnosticInfos(diagnosticInfos, nodesToRead); | |
if (StatusCode.IsBad(results[0].StatusCode)) | |
{ | |
throw new ServiceResultException(results[0].StatusCode); | |
} | |
m_result = results[0]; | |
ShowResults(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment