本文整理汇总了C#中DiagnosticInfoCollection类的典型用法代码示例。如果您正苦于以下问题:C# DiagnosticInfoCollection类的具体用法?C# DiagnosticInfoCollection怎么用?C# DiagnosticInfoCollection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DiagnosticInfoCollection类属于命名空间,在下文中一共展示了DiagnosticInfoCollection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TranslateBrowsePathsToNodeIds
/// <summary>
/// Invokes the TranslateBrowsePathsToNodeIds service.
/// </summary>
/// <param name="requestHeader">The request header.</param>
/// <param name="browsePaths">The list of browse paths for which NodeIds are being requested.</param>
/// <param name="results">The list of results for the list of browse paths.</param>
/// <param name="diagnosticInfos">The diagnostic information for the results.</param>
/// <returns>
/// Returns a <see cref="ResponseHeader"/> object
/// </returns>
public override ResponseHeader TranslateBrowsePathsToNodeIds(
RequestHeader requestHeader,
BrowsePathCollection browsePaths,
out BrowsePathResultCollection results,
out DiagnosticInfoCollection diagnosticInfos)
{
results = null;
diagnosticInfos = null;
OperationContext context = ValidateRequest(requestHeader, RequestType.TranslateBrowsePathsToNodeIds);
try
{
if (browsePaths == null || browsePaths.Count == 0)
{
throw new ServiceResultException(StatusCodes.BadNothingToDo);
}
m_serverInternal.NodeManager.TranslateBrowsePathsToNodeIds(
context,
browsePaths,
out results,
out diagnosticInfos);
return CreateResponse(requestHeader, context.StringTable);
}
catch (ServiceResultException e)
{
lock (ServerInternal.DiagnosticsLock)
{
ServerInternal.ServerDiagnostics.RejectedRequestsCount++;
if (IsSecurityError(e.StatusCode))
{
ServerInternal.ServerDiagnostics.SecurityRejectedRequestsCount++;
}
}
throw TranslateException(context, e);
}
finally
{
OnRequestComplete(context);
}
}
示例2: ModifyMonitoredItems
/// <summary>
/// Modifies monitored items in a subscription.
/// </summary>
public void ModifyMonitoredItems(
OperationContext context,
TimestampsToReturn timestampsToReturn,
MonitoredItemModifyRequestCollection itemsToModify,
out MonitoredItemModifyResultCollection results,
out DiagnosticInfoCollection diagnosticInfos)
{
if (context == null) throw new ArgumentNullException("context");
if (itemsToModify == null) throw new ArgumentNullException("itemsToModify");
int count = itemsToModify.Count;
// allocate results.
bool diagnosticsExist = false;
results = new MonitoredItemModifyResultCollection(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);
List<MonitoringFilterResult> filterResults = new List<MonitoringFilterResult>(count);
double[] originalSamplingIntervals = new double[count];
bool validItems = false;
lock (m_lock)
{
// check session.
VerifySession(context);
// clear lifetime counter.
ResetLifetimeCount();
for (int ii = 0; ii < count; ii++)
{
filterResults.Add(null);
LinkedListNode<IMonitoredItem> node = null;
if (!m_monitoredItems.TryGetValue(itemsToModify[ii].MonitoredItemId, 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);
originalSamplingIntervals[ii] = monitoredItem.SamplingInterval;
errors.Add(null);
validItems = true;
// update diagnostics.
if ((context.DiagnosticsMask & DiagnosticsMasks.OperationAll) != 0)
{
diagnosticInfos.Add(null);
}
}
}
// update items.
if (validItems)
{
m_server.NodeManager.ModifyMonitoredItems(
context,
timestampsToReturn,
monitoredItems,
itemsToModify,
errors,
filterResults);
}
lock (m_lock)
{
// create results.
for (int ii = 0; ii < errors.Count; ii++)
{
ServiceResult error = errors[ii];
MonitoredItemModifyResult result = null;
if (ServiceResult.IsGood(error))
//.........这里部分代码省略.........
示例3: 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);
//.........这里部分代码省略.........
示例4: Acknowledge
/// <summary>
/// Processes acknowledgements for previously published messages.
/// </summary>
public void Acknowledge(
OperationContext context,
SubscriptionAcknowledgementCollection subscriptionAcknowledgements,
out StatusCodeCollection acknowledgeResults,
out DiagnosticInfoCollection acknowledgeDiagnosticInfos)
{
if (context == null) throw new ArgumentNullException("context");
if (subscriptionAcknowledgements == null) throw new ArgumentNullException("subscriptionAcknowledgements");
lock (m_lock)
{
bool diagnosticsExist = false;
acknowledgeResults = new StatusCodeCollection(subscriptionAcknowledgements.Count);
acknowledgeDiagnosticInfos = new DiagnosticInfoCollection(subscriptionAcknowledgements.Count);
for (int ii = 0; ii < subscriptionAcknowledgements.Count; ii++)
{
SubscriptionAcknowledgement acknowledgement = subscriptionAcknowledgements[ii];
bool found = false;
for (int jj = 0; jj < m_queuedSubscriptions.Count; jj++)
{
QueuedSubscription subscription = m_queuedSubscriptions[jj];
if (subscription.Subscription.Id == acknowledgement.SubscriptionId)
{
ServiceResult result = subscription.Subscription.Acknowledge(context, acknowledgement.SequenceNumber);
if (ServiceResult.IsGood(result))
{
acknowledgeResults.Add(StatusCodes.Good);
if ((context.DiagnosticsMask & DiagnosticsMasks.OperationAll) != 0)
{
acknowledgeDiagnosticInfos.Add(null);
}
}
else
{
acknowledgeResults.Add(result.Code);
if ((context.DiagnosticsMask & DiagnosticsMasks.OperationAll) != 0)
{
DiagnosticInfo diagnosticInfo = ServerUtils.CreateDiagnosticInfo(m_server, context, result);
acknowledgeDiagnosticInfos.Add(diagnosticInfo);
diagnosticsExist = true;
}
}
found = true;
break;
}
}
if (!found)
{
ServiceResult result = new ServiceResult(StatusCodes.BadSubscriptionIdInvalid);
acknowledgeResults.Add(result.Code);
if ((context.DiagnosticsMask & DiagnosticsMasks.OperationAll) != 0)
{
DiagnosticInfo diagnosticInfo = ServerUtils.CreateDiagnosticInfo(m_server, context, result);
acknowledgeDiagnosticInfos.Add(diagnosticInfo);
diagnosticsExist = true;
}
}
}
if (!diagnosticsExist)
{
acknowledgeDiagnosticInfos.Clear();
}
}
}
示例5: SetTriggering
/// <summary>
/// Updates the triggers for the monitored item.
/// </summary>
public void SetTriggering(
OperationContext context,
uint triggeringItemId,
UInt32Collection linksToAdd,
UInt32Collection linksToRemove,
out StatusCodeCollection addResults,
out DiagnosticInfoCollection addDiagnosticInfos,
out StatusCodeCollection removeResults,
out DiagnosticInfoCollection removeDiagnosticInfos)
{
if (context == null) throw new ArgumentNullException("context");
if (linksToAdd == null) throw new ArgumentNullException("linksToAdd");
if (linksToRemove == null) throw new ArgumentNullException("linksToRemove");
// allocate results.
bool diagnosticsExist = false;
addResults = new StatusCodeCollection();
addDiagnosticInfos = null;
removeResults = new StatusCodeCollection();
removeDiagnosticInfos = null;
if ((context.DiagnosticsMask & DiagnosticsMasks.OperationAll) != 0)
{
addDiagnosticInfos = new DiagnosticInfoCollection();
removeDiagnosticInfos = new DiagnosticInfoCollection();
}
// build list of items to modify.
lock (m_lock)
{
// check session.
VerifySession(context);
// clear lifetime counter.
ResetLifetimeCount();
// look up triggering item.
LinkedListNode<IMonitoredItem> triggerNode = null;
if (!m_monitoredItems.TryGetValue(triggeringItemId, out triggerNode))
{
throw new ServiceResultException(StatusCodes.BadMonitoredItemIdInvalid);
}
// lookup existing list.
List<ITriggeredMonitoredItem> triggeredItems = null;
if (!m_itemsToTrigger.TryGetValue(triggeringItemId, out triggeredItems))
{
m_itemsToTrigger[triggeringItemId] = triggeredItems = new List<ITriggeredMonitoredItem>();
}
// remove old links.
for (int ii = 0; ii < linksToRemove.Count; ii++)
{
removeResults.Add(StatusCodes.Good);
bool found = false;
for (int jj = 0; jj < triggeredItems.Count; jj++)
{
if (triggeredItems[jj].Id == linksToRemove[ii])
{
found = true;
triggeredItems.RemoveAt(jj);
break;
}
}
if (!found)
{
removeResults[ii] = StatusCodes.BadMonitoredItemIdInvalid;
// update diagnostics.
if ((context.DiagnosticsMask & DiagnosticsMasks.OperationAll) != 0)
{
DiagnosticInfo diagnosticInfo = ServerUtils.CreateDiagnosticInfo(m_server, context, removeResults[ii]);
diagnosticsExist = true;
removeDiagnosticInfos.Add(diagnosticInfo);
}
continue;
}
// update diagnostics.
if ((context.DiagnosticsMask & DiagnosticsMasks.OperationAll) != 0)
{
removeDiagnosticInfos.Add(null);
}
}
// add new links.
for (int ii = 0; ii < linksToAdd.Count; ii++)
{
addResults.Add(StatusCodes.Good);
LinkedListNode<IMonitoredItem> node = null;
//.........这里部分代码省略.........
示例6: Read
/// <summary>
/// Invokes the Read service.
/// </summary>
public virtual ResponseHeader Read(
RequestHeader requestHeader,
double maxAge,
TimestampsToReturn timestampsToReturn,
ReadValueIdCollection nodesToRead,
out DataValueCollection results,
out DiagnosticInfoCollection diagnosticInfos)
{
results = null;
diagnosticInfos = null;
ValidateRequest(requestHeader);
// Insert implementation.
return CreateResponse(requestHeader, StatusCodes.BadServiceUnsupported);
}
示例7: Write
/// <summary>
/// Invokes the Write service.
/// </summary>
public virtual ResponseHeader Write(
RequestHeader requestHeader,
WriteValueCollection nodesToWrite,
out StatusCodeCollection results,
out DiagnosticInfoCollection diagnosticInfos)
{
results = null;
diagnosticInfos = null;
ValidateRequest(requestHeader);
// Insert implementation.
return CreateResponse(requestHeader, StatusCodes.BadServiceUnsupported);
}
示例8: SetTriggering
/// <summary>
/// Invokes the SetTriggering service.
/// </summary>
public virtual ResponseHeader SetTriggering(
RequestHeader requestHeader,
uint subscriptionId,
uint triggeringItemId,
UInt32Collection linksToAdd,
UInt32Collection linksToRemove,
out StatusCodeCollection addResults,
out DiagnosticInfoCollection addDiagnosticInfos,
out StatusCodeCollection removeResults,
out DiagnosticInfoCollection removeDiagnosticInfos)
{
addResults = null;
addDiagnosticInfos = null;
removeResults = null;
removeDiagnosticInfos = null;
ValidateRequest(requestHeader);
// Insert implementation.
return CreateResponse(requestHeader, StatusCodes.BadServiceUnsupported);
}
示例9: Publish
/// <summary>
/// Invokes the Publish service.
/// </summary>
public virtual ResponseHeader Publish(
RequestHeader requestHeader,
SubscriptionAcknowledgementCollection subscriptionAcknowledgements,
out uint subscriptionId,
out UInt32Collection availableSequenceNumbers,
out bool moreNotifications,
out NotificationMessage notificationMessage,
out StatusCodeCollection results,
out DiagnosticInfoCollection diagnosticInfos)
{
subscriptionId = 0;
availableSequenceNumbers = null;
moreNotifications = false;
notificationMessage = null;
results = null;
diagnosticInfos = null;
ValidateRequest(requestHeader);
// Insert implementation.
return CreateResponse(requestHeader, StatusCodes.BadServiceUnsupported);
}
示例10: ModifyMonitoredItems
/// <summary>
/// Invokes the ModifyMonitoredItems service.
/// </summary>
public virtual ResponseHeader ModifyMonitoredItems(
RequestHeader requestHeader,
uint subscriptionId,
TimestampsToReturn timestampsToReturn,
MonitoredItemModifyRequestCollection itemsToModify,
out MonitoredItemModifyResultCollection results,
out DiagnosticInfoCollection diagnosticInfos)
{
results = null;
diagnosticInfos = null;
ValidateRequest(requestHeader);
// Insert implementation.
return CreateResponse(requestHeader, StatusCodes.BadServiceUnsupported);
}
示例11: 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);
}
示例12: Call
/// <summary>
/// Invokes the Call service.
/// </summary>
public virtual ResponseHeader Call(
RequestHeader requestHeader,
CallMethodRequestCollection methodsToCall,
out CallMethodResultCollection results,
out DiagnosticInfoCollection diagnosticInfos)
{
results = null;
diagnosticInfos = null;
ValidateRequest(requestHeader);
// Insert implementation.
return CreateResponse(requestHeader, StatusCodes.BadServiceUnsupported);
}
示例13: ReadDiagnosticInfoArray
/// <summary>
/// Reads an DiagnosticInfo array from the stream.
/// </summary>
public DiagnosticInfoCollection ReadDiagnosticInfoArray(string fieldName)
{
bool isNil = false;
DiagnosticInfoCollection values = new DiagnosticInfoCollection();
if (BeginField(fieldName, true, out isNil))
{
PushNamespace(Namespaces.OpcUaXsd);
while (MoveToElement("DiagnosticInfo"))
{
values.Add(ReadDiagnosticInfo("DiagnosticInfo"));
}
// check the length.
if (m_context.MaxArrayLength > 0 && m_context.MaxArrayLength < values.Count)
{
throw new ServiceResultException(StatusCodes.BadEncodingLimitsExceeded);
}
PopNamespace();
EndField(fieldName);
return values;
}
if (isNil)
{
return null;
}
return values;
}
示例14: Read
/// <summary>
/// Invokes the Read service.
/// </summary>
/// <param name="requestHeader">The request header.</param>
/// <param name="maxAge">The Maximum age of the value to be read in milliseconds.</param>
/// <param name="timestampsToReturn">The type of timestamps to be returned for the requested Variables.</param>
/// <param name="nodesToRead">The list of Nodes and their Attributes to read.</param>
/// <param name="results">The list of returned Attribute values</param>
/// <param name="diagnosticInfos">The diagnostic information for the results.</param>
/// <returns>
/// Returns a <see cref="ResponseHeader"/> object
/// </returns>
public override ResponseHeader Read(
RequestHeader requestHeader,
double maxAge,
TimestampsToReturn timestampsToReturn,
ReadValueIdCollection nodesToRead,
out DataValueCollection results,
out DiagnosticInfoCollection diagnosticInfos)
{
OperationContext context = ValidateRequest(requestHeader, RequestType.Read);
try
{
if (nodesToRead == null || nodesToRead.Count == 0)
{
throw new ServiceResultException(StatusCodes.BadNothingToDo);
}
m_serverInternal.NodeManager.Read(
context,
maxAge,
timestampsToReturn,
nodesToRead,
out results,
out diagnosticInfos);
return CreateResponse(requestHeader, context.StringTable);
}
catch (ServiceResultException e)
{
lock (ServerInternal.DiagnosticsLock)
{
ServerInternal.ServerDiagnostics.RejectedRequestsCount++;
if (IsSecurityError(e.StatusCode))
{
ServerInternal.ServerDiagnostics.SecurityRejectedRequestsCount++;
}
}
throw TranslateException(context, e);
}
finally
{
OnRequestComplete(context);
}
}
示例15: TranslateBrowsePathsToNodeIds
/// <summary>
/// Invokes the TranslateBrowsePathsToNodeIds service.
/// </summary>
public virtual ResponseHeader TranslateBrowsePathsToNodeIds(
RequestHeader requestHeader,
BrowsePathCollection browsePaths,
out BrowsePathResultCollection results,
out DiagnosticInfoCollection diagnosticInfos)
{
results = null;
diagnosticInfos = null;
ValidateRequest(requestHeader);
// Insert implementation.
return CreateResponse(requestHeader, StatusCodes.BadServiceUnsupported);
}