public ValueChanged ( ISystemContext context ) : void | ||
context | ISystemContext | |
Résultat | void |
public void ValueChanged(ISystemContext context)
{
DataValue value = new DataValue();
ServiceResult error = m_source.Node.ReadAttribute(context, m_attributeId, NumericRange.Empty, null, value);
if (ServiceResult.IsBad(error))
{
value = new DataValue(error.StatusCode);
}
value.ServerTimestamp = DateTime.UtcNow;
QueueValue(value, error);
}
#endregion
/// <summary> /// Handles change events raised by the node. /// </summary> /// <param name="context">The system context.</param> /// <param name="state">The node that raised the event.</param> /// <param name="masks">What caused the event to be raised</param> public void OnNodeChange(ISystemContext context, NodeState state, NodeStateChangeMasks masks) { if (m_monitoredItems != null) { for (int ii = 0; ii < m_monitoredItems.Count; ii++) { DataChangeMonitoredItem monitoredItem = m_monitoredItems[ii]; // check if the node has been deleted. if ((masks & NodeStateChangeMasks.Deleted) != 0) { monitoredItem.QueueValue(null, StatusCodes.BadNodeIdUnknown); continue; } if (monitoredItem.AttributeId == Attributes.Value) { if ((masks & NodeStateChangeMasks.Value) != 0) { monitoredItem.ValueChanged(context); } } else { if ((masks & NodeStateChangeMasks.NonValue) != 0) { monitoredItem.ValueChanged(context); } } } } }