/// <summary> /// Queues the value to the monitored item. /// </summary> /// <param name="context">The context.</param> /// <param name="request">The request.</param> /// <param name="monitoredItem">The monitored item.</param> private void QueueValue(ServerSystemContext context, HdaReadRequest request, MonitoredItem monitoredItem) { NodeHandle handle = monitoredItem.ManagerHandle as NodeHandle; if (handle == null) { return; } ReadValueId nodeToRead = monitoredItem.GetReadValueId(); DataValue value = new DataValue(); ServiceResult error = null; HdaItemState item = handle.Node as HdaItemState; HdaAttributeState attribute = handle.Node as HdaAttributeState; if (item != null) { error = request.GetResult(context, item, nodeToRead, value, monitoredItem.DiagnosticsMasks); } else if (attribute != null) { error = request.GetResult(context, attribute, nodeToRead, value, monitoredItem.DiagnosticsMasks); } value.ServerTimestamp = DateTime.UtcNow; if (value.StatusCode != StatusCodes.BadNotFound) { monitoredItem.QueueValue(value, error); } }
/// <summary> /// Queues the value to the monitored item. /// </summary> /// <param name="context">The context.</param> /// <param name="request">The request.</param> /// <param name="initialUpdate">if set to <c>true</c> [initial update].</param> public void QueueValues(ServerSystemContext context, HdaReadRequest request, bool initialUpdate) { for (int ii = 0; ii < m_monitoredItems.Count; ii++) { QueueValue(context, request, m_monitoredItems[ii]); } if (!initialUpdate) { IncrementSampleTime(); } }