本文整理汇总了C#中MonitoringMode类的典型用法代码示例。如果您正苦于以下问题:C# MonitoringMode类的具体用法?C# MonitoringMode怎么用?C# MonitoringMode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MonitoringMode类属于命名空间,在下文中一共展示了MonitoringMode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DataChangeMonitoredItem
/// <summary>
/// Constructs a new instance.
/// </summary>
public DataChangeMonitoredItem(
MonitoredNode source,
uint id,
uint attributeId,
NumericRange indexRange,
QualifiedName dataEncoding,
DiagnosticsMasks diagnosticsMasks,
TimestampsToReturn timestampsToReturn,
MonitoringMode monitoringMode,
uint clientHandle,
double samplingInterval,
bool alwaysReportUpdates)
{
m_source = source;
m_id = id;
m_attributeId = attributeId;
m_indexRange = indexRange;
m_dataEncoding = dataEncoding;
m_timestampsToReturn = timestampsToReturn;
m_diagnosticsMasks = diagnosticsMasks;
m_monitoringMode = monitoringMode;
m_clientHandle = clientHandle;
m_samplingInterval = samplingInterval;
m_nextSampleTime = DateTime.UtcNow.Ticks;
m_readyToPublish = false;
m_readyToTrigger = false;
m_alwaysReportUpdates = alwaysReportUpdates;
}
示例2: ShowDialog
/// <summary>
/// Displays the dialog.
/// </summary>
public bool ShowDialog(ref MonitoringMode monitoringMode)
{
MonitoringModeCB.SelectedItem = monitoringMode;
if (ShowDialog() != DialogResult.OK)
{
return false;
}
monitoringMode = (MonitoringMode)MonitoringModeCB.SelectedItem;
return true;
}
示例3: MemoryBufferMonitoredItem
/// <summary>
/// Initializes the object with its node type.
/// </summary>
public MemoryBufferMonitoredItem(
IServerInternal server,
INodeManager nodeManager,
object mangerHandle,
uint offset,
uint subscriptionId,
uint id,
Session session,
ReadValueId itemToMonitor,
DiagnosticsMasks diagnosticsMasks,
TimestampsToReturn timestampsToReturn,
MonitoringMode monitoringMode,
uint clientHandle,
MonitoringFilter originalFilter,
MonitoringFilter filterToUse,
Range range,
double samplingInterval,
uint queueSize,
bool discardOldest,
double minimumSamplingInterval)
:
base(
server,
nodeManager,
mangerHandle,
subscriptionId,
id,
session,
itemToMonitor,
diagnosticsMasks,
timestampsToReturn,
monitoringMode,
clientHandle,
originalFilter,
filterToUse,
range,
samplingInterval,
queueSize,
discardOldest,
minimumSamplingInterval)
{
m_offset = offset;
}
示例4: SetMonitoringMode
/// <summary>
/// Changes the monitoring mode for the item.
/// </summary>
void IEventMonitoredItem.SetMonitoringMode(MonitoringMode monitoringMode)
{
SetMonitoringMode(monitoringMode);
}
示例5: MonitoredItem
/// <summary>
/// Initializes the object with its node type.
/// </summary>
public MonitoredItem(
IServerInternal server,
INodeManager nodeManager,
object mangerHandle,
uint subscriptionId,
uint id,
Session session,
ReadValueId itemToMonitor,
DiagnosticsMasks diagnosticsMasks,
TimestampsToReturn timestampsToReturn,
MonitoringMode monitoringMode,
uint clientHandle,
MonitoringFilter originalFilter,
MonitoringFilter filterToUse,
Range range,
double samplingInterval,
uint queueSize,
bool discardOldest,
double sourceSamplingInterval)
{
if (itemToMonitor == null) throw new ArgumentNullException("itemToMonitor");
Initialize();
m_server = server;
m_nodeManager = nodeManager;
m_managerHandle = mangerHandle;
m_subscriptionId = subscriptionId;
m_id = id;
m_session = session;
m_nodeId = itemToMonitor.NodeId;
m_attributeId = itemToMonitor.AttributeId;
m_indexRange = itemToMonitor.IndexRange;
m_parsedIndexRange = itemToMonitor.ParsedIndexRange;
m_encoding = itemToMonitor.DataEncoding;
m_diagnosticsMasks = diagnosticsMasks;
m_timestampsToReturn = timestampsToReturn;
m_monitoringMode = monitoringMode;
m_clientHandle = clientHandle;
m_originalFilter = originalFilter;
m_filterToUse = filterToUse;
m_range = 0;
m_samplingInterval = samplingInterval;
m_queueSize = queueSize;
m_discardOldest = discardOldest;
m_sourceSamplingInterval = (int)sourceSamplingInterval;
m_calculator = null;
m_nextSamplingTime = DateTime.UtcNow.Ticks;
m_alwaysReportUpdates = false;
m_typeMask = MonitoredItemTypeMask.DataChange;
if (originalFilter is EventFilter)
{
m_typeMask = MonitoredItemTypeMask.Events;
if (itemToMonitor.NodeId == Objects.Server)
{
m_typeMask |= MonitoredItemTypeMask.AllEvents;
}
}
// create aggregate calculator.
ServerAggregateFilter aggregateFilter = filterToUse as ServerAggregateFilter;
if (filterToUse is ServerAggregateFilter)
{
m_calculator = m_server.AggregateManager.CreateCalculator(
aggregateFilter.AggregateType,
aggregateFilter.StartTime,
DateTime.MaxValue,
aggregateFilter.ProcessingInterval,
aggregateFilter.Stepped,
aggregateFilter.AggregateConfiguration);
}
if (range != null)
{
m_range = range.High - range.Low;
}
// report change to item state.
ServerUtils.ReportCreateMonitoredItem(
m_nodeId,
m_id,
m_samplingInterval,
m_queueSize,
m_discardOldest,
m_filterToUse,
m_monitoringMode);
InitializeQueue();
}
示例6: DeleteMonitoredItems
/// <summary>
/// Deletes the monitored items in a subscription.
/// </summary>
private void DeleteMonitoredItems(
OperationContext context,
UInt32Collection monitoredItemIds,
bool doNotCheckSession,
out StatusCodeCollection results,
out DiagnosticInfoCollection diagnosticInfos)
{
if (context == null) throw new ArgumentNullException("context");
if (monitoredItemIds == null) throw new ArgumentNullException("monitoredItemIds");
int count = monitoredItemIds.Count;
bool diagnosticsExist = false;
results = new StatusCodeCollection(count);
diagnosticInfos = null;
if ((context.DiagnosticsMask & DiagnosticsMasks.OperationAll) != 0)
{
diagnosticInfos = new DiagnosticInfoCollection(count);
}
// build list of items to modify.
List<IMonitoredItem> monitoredItems = new List<IMonitoredItem>(count);
List<ServiceResult> errors = new List<ServiceResult>(count);
double[] originalSamplingIntervals = new double[count];
MonitoringMode[] originalMonitoringModes = new MonitoringMode[count];
bool validItems = false;
lock (m_lock)
{
// check session.
if (!doNotCheckSession)
{
VerifySession(context);
}
// clear lifetime counter.
ResetLifetimeCount();
for (int ii = 0; ii < count; ii++)
{
LinkedListNode<IMonitoredItem> node = null;
if (!m_monitoredItems.TryGetValue(monitoredItemIds[ii], out node))
{
monitoredItems.Add(null);
errors.Add(StatusCodes.BadMonitoredItemIdInvalid);
// update diagnostics.
if ((context.DiagnosticsMask & DiagnosticsMasks.OperationAll) != 0)
{
DiagnosticInfo diagnosticInfo = ServerUtils.CreateDiagnosticInfo(m_server, context, errors[ii]);
diagnosticsExist = true;
diagnosticInfos.Add(diagnosticInfo);
}
continue;
}
IMonitoredItem monitoredItem = node.Value;
monitoredItems.Add(monitoredItem);
// remove the item from the internal lists.
m_monitoredItems.Remove(monitoredItemIds[ii]);
m_itemsToTrigger.Remove(monitoredItemIds[ii]);
//remove the links towards the deleted monitored item
List<ITriggeredMonitoredItem> triggeredItems = null;
foreach (KeyValuePair<uint, List<ITriggeredMonitoredItem>> item in m_itemsToTrigger)
{
triggeredItems = item.Value;
for (int jj = 0; jj < triggeredItems.Count; jj++)
{
if (triggeredItems[jj].Id == monitoredItemIds[ii])
{
triggeredItems.RemoveAt(jj);
break;
}
}
}
if (node.List != null)
{
node.List.Remove(node);
}
originalSamplingIntervals[ii] = monitoredItem.SamplingInterval;
originalMonitoringModes[ii] = monitoredItem.MonitoringMode;
errors.Add(null);
validItems = true;
// update diagnostics.
if ((context.DiagnosticsMask & DiagnosticsMasks.OperationAll) != 0)
{
diagnosticInfos.Add(null);
//.........这里部分代码省略.........
示例7: RemoveItemToSamplingInterval
/// <summary>
/// Removes an item from the sampling interval.
/// </summary>
private void RemoveItemToSamplingInterval(
double samplingInterval,
MonitoringMode monitoringMode)
{
// TBD
}
示例8: OnSetMonitoringMode
/// <summary>
/// Does any processing after a monitored item is created.
/// </summary>
protected virtual void OnSetMonitoringMode(
ISystemContext systemContext,
MonitoredNode monitoredNode,
DataChangeMonitoredItem monitoredItem,
MonitoringMode previousMode,
MonitoringMode currentMode)
{
// does nothing.
}
示例9: SetMonitoringMode
/// <summary>
/// Changes the monitoring mode for a set of monitored items.
/// </summary>
public virtual void SetMonitoringMode(
OperationContext context,
MonitoringMode monitoringMode,
IList<IMonitoredItem> monitoredItems,
IList<bool> processedItems,
IList<ServiceResult> errors)
{
ServerSystemContext systemContext = m_systemContext.Copy(context);
lock (Lock)
{
for (int ii = 0; ii < monitoredItems.Count; ii++)
{
// skip items that have already been processed.
if (processedItems[ii])
{
continue;
}
// update monitoring mode.
bool processed = false;
errors[ii] = SetMonitoringMode(
systemContext,
monitoredItems[ii],
monitoringMode,
out processed);
// indicate whether it was processed or not.
processedItems[ii] = processed;
}
}
}
示例10: OnMonitoringModeChanged
/// <summary>
/// Called after changing the MonitoringMode for a MonitoredItem.
/// </summary>
/// <param name="context">The context.</param>
/// <param name="handle">The handle for the node.</param>
/// <param name="monitoredItem">The monitored item.</param>
/// <param name="previousMode">The previous monitoring mode.</param>
/// <param name="monitoringMode">The current monitoring mode.</param>
protected virtual void OnMonitoringModeChanged(
ServerSystemContext context,
NodeHandle handle,
MonitoredItem monitoredItem,
MonitoringMode previousMode,
MonitoringMode monitoringMode)
{
// overridden by the sub-class.
}
示例11: SetMonitoringMode
/// <summary>
/// Changes the monitoring mode for an item.
/// </summary>
protected virtual ServiceResult SetMonitoringMode(
ServerSystemContext context,
IMonitoredItem monitoredItem,
MonitoringMode monitoringMode,
NodeHandle handle)
{
// check for valid monitored item.
MonitoredItem datachangeItem = monitoredItem as MonitoredItem;
// update monitoring mode.
MonitoringMode previousMode = datachangeItem.SetMonitoringMode(monitoringMode);
// must send the latest value after enabling a disabled item.
if (monitoringMode == MonitoringMode.Reporting && previousMode == MonitoringMode.Disabled)
{
handle.MonitoredNode.QueueValue(context, handle.Node, datachangeItem);
}
// report change.
if (previousMode != monitoringMode)
{
OnMonitoringModeChanged(
context,
handle,
datachangeItem,
previousMode,
monitoringMode);
}
return ServiceResult.Good;
}
示例12: ReportModifyMonitoredItem
/// <summary>
/// Reports a modified monitored item.
/// </summary>
public static void ReportModifyMonitoredItem(
NodeId nodeId,
uint serverHandle,
double samplingInterval,
uint queueSize,
bool discardOldest,
MonitoringFilter filter,
MonitoringMode monitoringMode)
{
if (!m_eventsEnabled)
{
return;
}
lock (m_events)
{
Event e = new Event();
e.EventType = EventType.ModifyItem;
e.NodeId = nodeId;
e.ServerHandle = serverHandle;
e.Timestamp = HiResClock.UtcNow;
e.Value = null;
e.Parameters = new MonitoringParameters();
e.Parameters.SamplingInterval = samplingInterval;
e.Parameters.QueueSize = queueSize;
e.Parameters.DiscardOldest = discardOldest;
e.Parameters.Filter = new ExtensionObject(filter);
e.MonitoringMode = monitoringMode;
m_events.Enqueue(e);
}
}
示例13: OnMonitoringModeChanged
/// <summary>
/// Called after changing the MonitoringMode for a MonitoredItem.
/// </summary>
/// <param name="context">The context.</param>
/// <param name="handle">The handle for the node.</param>
/// <param name="monitoredItem">The monitored item.</param>
/// <param name="previousMode">The previous monitoring mode.</param>
/// <param name="monitoringMode">The current monitoring mode.</param>
protected override void OnMonitoringModeChanged(
ServerSystemContext context,
NodeHandle handle,
MonitoredItem monitoredItem,
MonitoringMode previousMode,
MonitoringMode monitoringMode)
{
if (SystemScanRequired(handle.MonitoredNode, monitoredItem))
{
BaseVariableState source = handle.Node as BaseVariableState;
if (previousMode != MonitoringMode.Disabled && monitoredItem.MonitoringMode == MonitoringMode.Disabled)
{
m_system.StopMonitoringValue(monitoredItem.Id);
}
if (previousMode == MonitoringMode.Disabled && monitoredItem.MonitoringMode != MonitoringMode.Disabled)
{
m_system.StartMonitoringValue(monitoredItem.Id, monitoredItem.SamplingInterval, source);
}
}
}
示例14: OnSetMonitoringMode
/// <summary>
/// Does any processing after a monitored item is created.
/// </summary>
protected override void OnSetMonitoringMode(
ISystemContext systemContext,
MonitoredNode monitoredNode,
DataChangeMonitoredItem monitoredItem,
MonitoringMode previousMode,
MonitoringMode currentMode)
{
// nothing to do.
}
示例15: SetMonitoringMode
/// <summary>
/// Invokes the SetMonitoringMode service.
/// </summary>
public virtual ResponseHeader SetMonitoringMode(
RequestHeader requestHeader,
uint subscriptionId,
MonitoringMode monitoringMode,
UInt32Collection monitoredItemIds,
out StatusCodeCollection results,
out DiagnosticInfoCollection diagnosticInfos)
{
results = null;
diagnosticInfos = null;
ValidateRequest(requestHeader);
// Insert implementation.
return CreateResponse(requestHeader, StatusCodes.BadServiceUnsupported);
}