public void SaveValueInCache(IEncodeable newValue)
{
lock (m_cache)
{
m_lastNotification = newValue;
if (m_dataCache != null)
{
MonitoredItemNotification datachange = newValue as MonitoredItemNotification;
if (datachange != null)
{
// validate the ServerTimestamp of the notification.
if (datachange.Value != null && datachange.Value.ServerTimestamp > DateTime.UtcNow)
{
Utils.Trace("Received ServerTimestamp {0} is in the future for MonitoredItemId {1}", datachange.Value.ServerTimestamp.ToLocalTime(), ClientHandle);
}
// validate SourceTimestamp of the notification.
if (datachange.Value != null && datachange.Value.SourceTimestamp > DateTime.UtcNow)
{
Utils.Trace("Received SourceTimestamp {0} is in the future for MonitoredItemId {1}", datachange.Value.ServerTimestamp.ToLocalTime(), ClientHandle);
}
if (datachange.Value != null && datachange.Value.StatusCode.Overflow)
{
Utils.Trace("Overflow bit set for data change with ServerTimestamp {0} and value {1} for MonitoredItemId {2}", datachange.Value.ServerTimestamp.ToLocalTime(), datachange.Value.Value, ClientHandle);
}
//Utils.Trace(
// "SaveValueInCache: ServerHandle={0}, Value={1}, StatusCode={2}",
// this.ClientHandle,
// datachange.Value.WrappedValue,
// datachange.Value.StatusCode);
m_dataCache.OnNotification(datachange);
}
}
if (m_eventCache != null)
{
EventFieldList eventchange = newValue as EventFieldList;
if (m_eventCache != null)
{
m_eventCache.OnNotification(eventchange);
}
}
if (m_Notification != null)
{
m_Notification(this, new MonitoredItemNotificationEventArgs(newValue));
}
}
}
#endregion