本文整理汇总了C#中UInt32Collection类的典型用法代码示例。如果您正苦于以下问题:C# UInt32Collection类的具体用法?C# UInt32Collection怎么用?C# UInt32Collection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UInt32Collection类属于命名空间,在下文中一共展示了UInt32Collection类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: BeginSetPublishingMode
/// <summary>
/// Begins an asynchronous invocation of the SetPublishingMode service.
/// </summary>
public IAsyncResult BeginSetPublishingMode(
RequestHeader requestHeader,
bool publishingEnabled,
UInt32Collection subscriptionIds,
AsyncCallback callback,
object asyncState)
{
SetPublishingModeRequest request = new SetPublishingModeRequest();
request.RequestHeader = requestHeader;
request.PublishingEnabled = publishingEnabled;
request.SubscriptionIds = subscriptionIds;
UpdateRequestHeader(request, requestHeader == null, "SetPublishingMode");
if (UseTransportChannel)
{
return TransportChannel.BeginSendRequest(request, callback, asyncState);
}
return InnerChannel.BeginSetPublishingMode(new SetPublishingModeMessage(request), callback, asyncState);
}
开发者ID:zryska,项目名称:UA-.NET,代码行数:25,代码来源:Opc.Ua.Client.cs
示例2: 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);
//.........这里部分代码省略.........
开发者ID:OPCFoundation,项目名称:UA-.NET,代码行数:101,代码来源:Subscription.cs
示例3: Publish
/// <summary>
/// Returns all available notifications.
/// </summary>
public NotificationMessage Publish(
OperationContext context,
out UInt32Collection availableSequenceNumbers,
out bool moreNotifications)
{
if (context == null) throw new ArgumentNullException("context");
NotificationMessage message = null;
lock (m_lock)
{
moreNotifications = false;
availableSequenceNumbers = null;
// check if expired.
if (m_expired)
{
return null;
}
try
{
// update diagnostics.
lock (m_diagnostics)
{
m_diagnostics.PublishRequestCount++;
}
message = InnerPublish(context, out availableSequenceNumbers, out moreNotifications);
lock (m_diagnostics)
{
m_diagnostics.UnacknowledgedMessageCount = (uint)availableSequenceNumbers.Count;
}
}
finally
{
// clear counters on success.
if (message != null)
{
// TraceState(Utils.Format("PUBLISH #{0}", message.SequenceNumber));
ResetKeepaliveCount();
m_waitingForPublish = moreNotifications;
ResetLifetimeCount();
}
}
}
return message;
}
开发者ID:OPCFoundation,项目名称:UA-.NET,代码行数:53,代码来源:Subscription.cs
示例4: 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);
}
开发者ID:OPCFoundation,项目名称:Misc-Tools,代码行数:26,代码来源:Opc.Ua.ServerBase.cs
示例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;
//.........这里部分代码省略.........
开发者ID:OPCFoundation,项目名称:UA-.NET,代码行数:101,代码来源:Subscription.cs
示例6: SetMonitoringMode
/// <summary>
/// Invokes the SetMonitoringMode service.
/// </summary>
/// <param name="requestHeader">The request header.</param>
/// <param name="subscriptionId">The subscription id.</param>
/// <param name="monitoringMode">The monitoring mode to be set for the MonitoredItems.</param>
/// <param name="monitoredItemIds">The list of MonitoredItems to modify.</param>
/// <param name="results">The list of results for the MonitoredItems to modify.</param>
/// <param name="diagnosticInfos">The diagnostic information for the results.</param>
/// <returns>
/// Returns a <see cref="ResponseHeader"/> object
/// </returns>
public override ResponseHeader SetMonitoringMode(
RequestHeader requestHeader,
uint subscriptionId,
MonitoringMode monitoringMode,
UInt32Collection monitoredItemIds,
out StatusCodeCollection results,
out DiagnosticInfoCollection diagnosticInfos)
{
OperationContext context = ValidateRequest(requestHeader, RequestType.SetMonitoringMode);
try
{
if (monitoredItemIds == null || monitoredItemIds.Count == 0)
{
throw new ServiceResultException(StatusCodes.BadNothingToDo);
}
ServerInternal.SubscriptionManager.SetMonitoringMode(
context,
subscriptionId,
monitoringMode,
monitoredItemIds,
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);
}
}
开发者ID:yuriik83,项目名称:UA-.UWP-Universal-Windows-Platform,代码行数:58,代码来源:StandardServer.cs
示例7: 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);
}
开发者ID:OPCFoundation,项目名称:Misc-Tools,代码行数:20,代码来源:Opc.Ua.ServerBase.cs
示例8: Read
} // Read
public static unsafe uint Read(this NativeReader reader, uint offset, out UInt32Collection values)
{
values = new UInt32Collection(reader, offset);
uint count;
offset = reader.DecodeUnsigned(offset, out count);
offset = checked(offset + count * sizeof(UInt32));
return offset;
} // Read
开发者ID:tijoytom,项目名称:corert,代码行数:10,代码来源:MdBinaryReaderGen.cs
示例9: DeleteMonitoredItems
/// <summary>
/// Deletes the monitored items.
/// </summary>
private bool DeleteMonitoredItems(
Subscription subscription,
List<MonitoredItem> monitoredItems)
{
try
{
RequestHeader requestHeader = new RequestHeader();
requestHeader.ReturnDiagnostics = 0;
UInt32Collection monitoredItemIds = new UInt32Collection();
for (int ii = 0; ii < monitoredItems.Count; ii++)
{
monitoredItemIds.Add(monitoredItems[ii].MonitoredItemId);
}
StatusCodeCollection results;
DiagnosticInfoCollection diagnosticInfos;
Session.DeleteMonitoredItems(
requestHeader,
subscription.SubscriptionId,
monitoredItemIds,
out results,
out diagnosticInfos);
ClientBase.ValidateResponse(results, monitoredItemIds);
ClientBase.ValidateDiagnosticInfos(diagnosticInfos, monitoredItemIds);
if (diagnosticInfos != null && diagnosticInfos.Count > 0)
{
Log("Returned non-empty DiagnosticInfos array during DeleteMonitoredItems.");
return false;
}
bool success = true;
for (int ii = 0; ii < monitoredItems.Count; ii++)
{
if (StatusCode.IsBad(results[ii]))
{
Log(
"Delete monitored item failed for Node '{0}', NodeId = {1}, AttributeId = {2}, StatusCode = {3}",
monitoredItems[ii].Node,
monitoredItems[ii].Node.NodeId,
Attributes.GetBrowseName(monitoredItems[ii].AttributeId),
results[ii]);
success = false;
continue;
}
}
return success;
}
catch (Exception e)
{
Log(e, "DeleteMonitoredItems Failed.");
return false;
}
}
开发者ID:OPCFoundation,项目名称:UA-.NET,代码行数:64,代码来源:SubscribeTest.cs
示例10: BeginDeleteSubscriptions
/// <summary>
/// Begins an asynchronous invocation of the DeleteSubscriptions service.
/// </summary>
public IAsyncResult BeginDeleteSubscriptions(
RequestHeader requestHeader,
UInt32Collection subscriptionIds,
AsyncCallback callback,
object asyncState)
{
DeleteSubscriptionsRequest request = new DeleteSubscriptionsRequest();
request.RequestHeader = requestHeader;
request.SubscriptionIds = subscriptionIds;
UpdateRequestHeader(request, requestHeader == null, "DeleteSubscriptions");
if (UseTransportChannel)
{
return TransportChannel.BeginSendRequest(request, callback, asyncState);
}
return InnerChannel.BeginDeleteSubscriptions(new DeleteSubscriptionsMessage(request), callback, asyncState);
}
开发者ID:zryska,项目名称:UA-.NET,代码行数:23,代码来源:Opc.Ua.Client.cs
示例11: ReadUInt32Array
/// <summary>
/// Reads a uint array from the stream.
/// </summary>
public UInt32Collection ReadUInt32Array(string fieldName)
{
int length = ReadArrayLength();
if (length == -1)
{
return null;
}
UInt32Collection values = new UInt32Collection(length);
for (int ii = 0; ii < length; ii++)
{
values.Add(ReadUInt32(null));
}
return values;
}
开发者ID:OPCFoundation,项目名称:Misc-Tools,代码行数:21,代码来源:BinaryDecoder.cs
示例12: DeleteSubscriptions
/// <summary>
/// Invokes the DeleteSubscriptions service.
/// </summary>
public virtual ResponseHeader DeleteSubscriptions(
RequestHeader requestHeader,
UInt32Collection subscriptionIds,
out StatusCodeCollection results,
out DiagnosticInfoCollection diagnosticInfos)
{
DeleteSubscriptionsRequest request = new DeleteSubscriptionsRequest();
DeleteSubscriptionsResponse response = null;
request.RequestHeader = requestHeader;
request.SubscriptionIds = subscriptionIds;
UpdateRequestHeader(request, requestHeader == null, "DeleteSubscriptions");
try
{
if (UseTransportChannel)
{
IServiceResponse genericResponse = TransportChannel.SendRequest(request);
if (genericResponse == null)
{
throw new ServiceResultException(StatusCodes.BadUnknownResponse);
}
ValidateResponse(genericResponse.ResponseHeader);
response = (DeleteSubscriptionsResponse)genericResponse;
}
else
{
DeleteSubscriptionsResponseMessage responseMessage = InnerChannel.DeleteSubscriptions(new DeleteSubscriptionsMessage(request));
if (responseMessage == null || responseMessage.DeleteSubscriptionsResponse == null)
{
throw new ServiceResultException(StatusCodes.BadUnknownResponse);
}
response = responseMessage.DeleteSubscriptionsResponse;
ValidateResponse(response.ResponseHeader);
}
results = response.Results;
diagnosticInfos = response.DiagnosticInfos;
}
finally
{
RequestCompleted(request, response, "DeleteSubscriptions");
}
return response.ResponseHeader;
}
开发者ID:zryska,项目名称:UA-.NET,代码行数:54,代码来源:Opc.Ua.Client.cs
示例13: EndPublish
/// <summary>
/// Finishes an asynchronous invocation of the Publish service.
/// </summary>
public ResponseHeader EndPublish(
IAsyncResult result,
out uint subscriptionId,
out UInt32Collection availableSequenceNumbers,
out bool moreNotifications,
out NotificationMessage notificationMessage,
out StatusCodeCollection results,
out DiagnosticInfoCollection diagnosticInfos)
{
PublishResponse response = null;
try
{
if (UseTransportChannel)
{
IServiceResponse genericResponse = TransportChannel.EndSendRequest(result);
if (genericResponse == null)
{
throw new ServiceResultException(StatusCodes.BadUnknownResponse);
}
ValidateResponse(genericResponse.ResponseHeader);
response = (PublishResponse)genericResponse;
}
else
{
PublishResponseMessage responseMessage = InnerChannel.EndPublish(result);
if (responseMessage == null || responseMessage.PublishResponse == null)
{
throw new ServiceResultException(StatusCodes.BadUnknownResponse);
}
response = responseMessage.PublishResponse;
ValidateResponse(response.ResponseHeader);
}
subscriptionId = response.SubscriptionId;
availableSequenceNumbers = response.AvailableSequenceNumbers;
moreNotifications = response.MoreNotifications;
notificationMessage = response.NotificationMessage;
results = response.Results;
diagnosticInfos = response.DiagnosticInfos;
}
finally
{
RequestCompleted(null, response, "Publish");
}
return response.ResponseHeader;
}
开发者ID:zryska,项目名称:UA-.NET,代码行数:55,代码来源:Opc.Ua.Client.cs
示例14: 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)
{
PublishRequest request = new PublishRequest();
PublishResponse response = null;
request.RequestHeader = requestHeader;
request.SubscriptionAcknowledgements = subscriptionAcknowledgements;
UpdateRequestHeader(request, requestHeader == null, "Publish");
try
{
if (UseTransportChannel)
{
IServiceResponse genericResponse = TransportChannel.SendRequest(request);
if (genericResponse == null)
{
throw new ServiceResultException(StatusCodes.BadUnknownResponse);
}
ValidateResponse(genericResponse.ResponseHeader);
response = (PublishResponse)genericResponse;
}
else
{
PublishResponseMessage responseMessage = InnerChannel.Publish(new PublishMessage(request));
if (responseMessage == null || responseMessage.PublishResponse == null)
{
throw new ServiceResultException(StatusCodes.BadUnknownResponse);
}
response = responseMessage.PublishResponse;
ValidateResponse(response.ResponseHeader);
}
subscriptionId = response.SubscriptionId;
availableSequenceNumbers = response.AvailableSequenceNumbers;
moreNotifications = response.MoreNotifications;
notificationMessage = response.NotificationMessage;
results = response.Results;
diagnosticInfos = response.DiagnosticInfos;
}
finally
{
RequestCompleted(request, response, "Publish");
}
return response.ResponseHeader;
}
开发者ID:zryska,项目名称:UA-.NET,代码行数:62,代码来源:Opc.Ua.Client.cs
示例15: Publish
/// <summary>
/// Invokes the Publish service.
/// </summary>
/// <param name="requestHeader">The request header.</param>
/// <param name="subscriptionAcknowledgements">The list of acknowledgements for one or more Subscriptions.</param>
/// <param name="subscriptionId">The subscription identifier.</param>
/// <param name="availableSequenceNumbers">The available sequence numbers.</param>
/// <param name="moreNotifications">If set to <c>true</c> the number of Notifications that were ready to be sent could not be sent in a single response.</param>
/// <param name="notificationMessage">The NotificationMessage that contains the list of Notifications.</param>
/// <param name="results">The list of results for the acknowledgements.</param>
/// <param name="diagnosticInfos">The diagnostic information for the results.</param>
/// <returns>
/// Returns a <see cref="ResponseHeader"/> object
/// </returns>
public override ResponseHeader Publish(
RequestHeader requestHeader,
SubscriptionAcknowledgementCollection subscriptionAcknowledgements,
out uint subscriptionId,
out UInt32Collection availableSequenceNumbers,
out bool moreNotifications,
out NotificationMessage notificationMessage,
out StatusCodeCollection results,
out DiagnosticInfoCollection diagnosticInfos)
{
OperationContext context = ValidateRequest(requestHeader, RequestType.Publish);
try
{
/*
// check if there is an odd delay.
if (DateTime.UtcNow > requestHeader.Timestamp.AddMilliseconds(100))
{
Utils.Trace(
"WARNING. Unexpected delay receiving Publish request. Time={0:hh:mm:ss.fff}, ReceiveTime={1:hh:mm:ss.fff}",
DateTime.UtcNow,
requestHeader.Timestamp);
}
*/
Utils.Trace("PUBLISH #{0} RECIEVED. TIME={1:hh:hh:ss.fff}", requestHeader.RequestHandle, requestHeader.Timestamp);
notificationMessage = ServerInternal.SubscriptionManager.Publish(
context,
subscriptionAcknowledgements,
null,
out subscriptionId,
out availableSequenceNumbers,
out moreNotifications,
out results,
out diagnosticInfos);
/*
if (notificationMessage != null)
{
Utils.Trace(
"PublishResponse: SubId={0} SeqNo={1}, PublishTime={2:mm:ss.fff}, Time={3:mm:ss.fff}",
subscriptionId,
notificationMessage.SequenceNumber,
notificationMessage.PublishTime,
DateTime.UtcNow);
}
*/
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);
}
}
开发者ID:yuriik83,项目名称:UA-.UWP-Universal-Windows-Platform,代码行数:84,代码来源:StandardServer.cs
示例16: DeleteSubscriptions
/// <summary>
/// Deletes all of the active subscriptions.
/// </summary>
private bool DeleteSubscriptions()
{
try
{
UInt32Collection subscriptionIds = new UInt32Collection();
lock (m_subscriptions)
{
for (int ii = 0; ii < m_subscriptions.Count; ii++)
{
Subscription subscription = m_subscriptions[ii];
lock (subscription)
{
subscriptionIds.Add(subscription.SubscriptionId);
subscription.Deleted = true;
}
}
}
RequestHeader requestHeader = new RequestHeader();
requestHeader.ReturnDiagnostics = 0;
StatusCodeCollection results;
DiagnosticInfoCollection diagnosticInfos;
ResponseHeader responseHeader = Session.DeleteSubscriptions(
requestHeader,
subscriptionIds,
out results,
out diagnosticInfos);
ClientBase.ValidateResponse(results, subscriptionIds);
ClientBase.ValidateDiagnosticInfos(diagnosticInfos, subscriptionIds);
if (diagnosticInfos != null && diagnosticInfos.Count > 0)
{
Log("Returned non-empty DiagnosticInfos array during DeleteSubscriptions.");
return false;
}
bool success = true;
lock (m_subscriptions)
{
for (int ii = 0; ii < m_subscriptions.Count; ii++)
{
if (StatusCode.IsBad(results[ii]))
{
Log(
"Unexpected error deleting subscription {0}. StatusCode = {1}",
subscriptionIds[ii],
subscriptionIds);
success = false;
}
Subscription subscription = m_subscriptions[ii];
lock (subscription)
{
subscription.States[subscription.States.Count - 1].End = responseHeader.Timestamp;
}
}
}
// let the queue empty.
Thread.Sleep(1000);
return success;
}
catch (Exception e)
{
Log(e, "DeleteSubscriptions Failed.");
return false;
}
}
开发者ID:OPCFoundation,项目名称:UA-.NET,代码行数:80,代码来源:SubscribeTest.cs
示例17: SetTriggering
/// <summary>
/// Invokes the SetTriggering service.
/// </summary>
/// <param name="requestHeader">The request header.</param>
/// <param name="subscriptionId">The subscription id.</param>
/// <param name="triggeringItemId">The id for the MonitoredItem used as the triggering item.</param>
/// <param name="linksToAdd">The list of ids of the items to report that are to be added as triggering links.</param>
/// <param name="linksToRemove">The list of ids of the items to report for the triggering links to be deleted.</param>
/// <param name="addResults">The list of StatusCodes for the items to add.</param>
/// <param name="addDiagnosticInfos">The list of diagnostic information for the links to add.</param>
/// <param name="removeResults">The list of StatusCodes for the items to delete.</param>
/// <param name="removeDiagnosticInfos">The list of diagnostic information for the links to delete.</param>
/// <returns>
/// Returns a <see cref="ResponseHeader"/> object
/// </returns>
public override 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;
OperationContext context = ValidateRequest(requestHeader, RequestType.SetTriggering);
try
{
if ((linksToAdd == null || linksToAdd.Count == 0) && (linksToRemove == null || linksToRemove.Count == 0))
{
throw new ServiceResultException(StatusCodes.BadNothingToDo);
}
ServerInternal.SubscriptionManager.SetTriggering(
context,
subscriptionId,
triggeringItemId,
linksToAdd,
linksToRemove,
out addResults,
out addDiagnosticInfos,
out removeResults,
out removeDiagnosticInfos);
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);
}
}
开发者ID:yuriik83,项目名称:UA-.UWP-Universal-Windows-Platform,代码行数:72,代码来源:StandardServer.cs
示例18: SetPublishingEnabled
/// <summary>
/// Sets the publishing enable state for the subscriptions.
/// </summary>
private bool SetPublishingEnabled(bool enabled)
{
try
{
UInt32Collection subscriptionIds = new UInt32Collection();
lock (m_subscriptions)
{
for (int ii = 0; ii < m_subscriptions.Count; ii++)
{
subscriptionIds.Add(m_subscriptions[ii].SubscriptionId);
m_subscriptions[ii].PublishingEnabled = enabled;
}
}
RequestHeader requestHeader = new RequestHeader();
requestHeader.ReturnDiagnostics = 0;
StatusCodeCollection results;
DiagnosticInfoCollection diagnosticInfos;
Session.SetPublishingMode(
requestHeader,
enabled,
subscriptionIds,
out results,
out diagnosticInfos);
ClientBase.ValidateResponse(results, subscriptionIds);
ClientBase.ValidateDiagnosticInfos(diagnosticInfos, subscriptionIds);
if (diagnosticInfos != null && diagnosticInfos.Count > 0)
{
Log("Returned non-empty DiagnosticInfos array during SetPublishingMode.");
return false;
}
|
请发表评论