Skip to content

Return of TimeStamps when reading a tag from Client! #96

@SmackyPappelroy

Description

@SmackyPappelroy

In the ReadEvent method you don't return any time stamps:

public ReadEvent<T> Read<T>(string tag)
        {
            var nodesToRead = BuildReadValueIdCollection(tag, Attributes.Value);
            DataValueCollection results;
            DiagnosticInfoCollection diag;
            _session.Read(
                requestHeader: null,
                maxAge: 0,
                timestampsToReturn: TimestampsToReturn.Neither,
                nodesToRead: nodesToRead,
                results: out results,
                diagnosticInfos: out diag);
            var val = results[0];

            var readEvent = new ReadEvent<T>();
            readEvent.Value = (T)val.Value;
            readEvent.SourceTimestamp = val.SourceTimestamp;
            readEvent.ServerTimestamp = val.ServerTimestamp;
            if (StatusCode.IsGood(val.StatusCode)) readEvent.Quality = Quality.Good;
            if (StatusCode.IsBad(val.StatusCode)) readEvent.Quality = Quality.Bad;
            return readEvent;
        }

Can you change the code to:

 public ReadEvent<T> Read<T>(string tag)
  {
      var nodesToRead = BuildReadValueIdCollection(tag, Attributes.Value);
      DataValueCollection results;
      DiagnosticInfoCollection diag;
      _session.Read(
          requestHeader: null,
          maxAge: 0,
          timestampsToReturn: TimestampsToReturn.Both,
          nodesToRead: nodesToRead,
          results: out results,
          diagnosticInfos: out diag);
      var val = results[0];

      var readEvent = new ReadEvent<T>();
      readEvent.Value = (T)val.Value;
      readEvent.SourceTimestamp = val.SourceTimestamp;
      readEvent.ServerTimestamp = val.ServerTimestamp;
      if (StatusCode.IsGood(val.StatusCode)) readEvent.Quality = Quality.Good;
      if (StatusCode.IsBad(val.StatusCode)) readEvent.Quality = Quality.Bad;
      return readEvent;
  }

So it returns the timestamps!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions