本文整理汇总了C#中Opc.Ua.Server.ServerSystemContext类的典型用法代码示例。如果您正苦于以下问题:C# ServerSystemContext类的具体用法?C# ServerSystemContext怎么用?C# ServerSystemContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ServerSystemContext类属于Opc.Ua.Server命名空间,在下文中一共展示了ServerSystemContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SelectClient
/// <summary>
/// Selects the DA COM client to use for the current context.
/// </summary>
/// <param name="context">The context.</param>
/// <returns>A DA COM client instance.</returns>
public ComDaClient SelectClient(ServerSystemContext context)
{
// This method can be used to select different COM server instances
// depending on the user credentials or locales used by the the session.
// For now all it does is return the default instance.
return DefaultClient;
}
示例2: ComAeSubscriptionClient
/// <summary>
/// Initializes a new instance of the <see cref="ComAeSubscriptionClient"/> class.
/// </summary>
/// <param name="context">The context.</param>
/// <param name="configuration">The configuration.</param>
/// <param name="cache">The cache for known types.</param>
/// <param name="namespaceIndex">The namespace index for the event types.</param>
/// <param name="manager">The manager.</param>
/// <param name="monitoredItem">The monitored item.</param>
public ComAeSubscriptionClient(
ServerSystemContext context,
ComAeClientConfiguration configuration,
AeTypeCache cache,
ushort namespaceIndex,
ComAeClientManager manager,
MonitoredItem monitoredItem)
{
m_defaultContext = context;
m_separators = configuration.SeperatorChars;
m_cache = cache;
m_namespaceIndex = namespaceIndex;
m_manager = manager;
m_refreshComplete = new ManualResetEvent(false);
m_monitoredItems = new List<MonitoredItem>();
m_monitoredItems.Add(monitoredItem);
m_qualifiedName = null;
m_isSource = false;
NodeHandle handle = monitoredItem.ManagerHandle as NodeHandle;
AeAreaState area = handle.Node as AeAreaState;
if (area != null)
{
m_qualifiedName = area.QualifiedName;
m_isSource = false;
}
else
{
AeSourceState source = handle.Node as AeSourceState;
if (source != null)
{
m_qualifiedName = source.QualifiedName;
m_isSource = true;
}
}
}
示例3: GetMappingNode
/// <summary>
/// Returns the node for the event type mapping identified by the node id.
/// </summary>
public AeEventTypeMappingState GetMappingNode(ServerSystemContext context, NodeId nodeId)
{
BaseObjectTypeState objectType = null;
if (!EventTypeNodes.TryGetValue(nodeId, out objectType))
{
return null;
}
AeEventTypeMappingState mappingNode = objectType as AeEventTypeMappingState;
if (mappingNode == null)
{
return null;
}
if (context.TypeTable.FindSubTypes(mappingNode.NodeId).Count == 0)
{
return null;
}
return mappingNode;
}
示例4: Initialize
/// <summary>
/// Initializes the manager by creating the default instance.
/// </summary>
public void Initialize(
ServerSystemContext context,
ComClientConfiguration configuration,
ComServerStatusState statusNode,
object statusNodeLock,
WaitCallback reconnectCallback)
{
m_defaultSystemContext = context;
m_configuration = configuration;
m_statusNode = statusNode;
m_statusNodeLock = statusNodeLock;
m_statusUpdateInterval = m_configuration.MaxReconnectWait;
m_reconnectCallback = reconnectCallback;
// limit status updates to once per 10 seconds.
if (m_statusUpdateInterval < 10000)
{
m_statusUpdateInterval = 10000;
}
StartStatusTimer(OnStatusTimerExpired);
}
示例5: ValidateNode
/// <summary>
/// Verifies that the specified node exists.
/// </summary>
protected override NodeState ValidateNode(
ServerSystemContext context,
NodeHandle handle,
IDictionary<NodeId, NodeState> cache)
{
// not valid if no root.
if (handle == null)
{
return null;
}
// check if previously validated.
if (handle.Validated)
{
return handle.Node;
}
// TBD
return null;
}
示例6: ServerInternalData
/// <summary>
/// Initializes the datastore with the server configuration.
/// </summary>
/// <param name="serverDescription">The server description.</param>
/// <param name="configuration">The configuration.</param>
/// <param name="messageContext">The message context.</param>
/// <param name="certificateValidator">The certificate validator.</param>
/// <param name="instanceCertificate">The instance certificate.</param>
public ServerInternalData(
ServerProperties serverDescription,
ApplicationConfiguration configuration,
ServiceMessageContext messageContext,
CertificateValidator certificateValidator,
X509Certificate2 instanceCertificate)
{
m_serverDescription = serverDescription;
m_configuration = configuration;
m_messageContext = messageContext;
m_endpointAddresses = new List<Uri>();
foreach (string baseAddresses in m_configuration.ServerConfiguration.BaseAddresses)
{
Uri url = Utils.ParseUri(baseAddresses);
if (url != null)
{
m_endpointAddresses.Add(url);
}
}
m_namespaceUris = m_messageContext.NamespaceUris;
m_factory = m_messageContext.Factory;
m_serverUris = new StringTable();
m_typeTree = new TypeTable(m_namespaceUris);
#if LEGACY_CORENODEMANAGER
m_typeSources = new TypeSourceTable();
#endif
// add the server uri to the server table.
m_serverUris.Append(m_configuration.ApplicationUri);
// create the default system context.
m_defaultSystemContext = new ServerSystemContext(this);
}
示例7: CreateNode
/// <summary>
/// Creates a new instance and assigns unique identifiers to all children.
/// </summary>
/// <param name="context">The operation context.</param>
/// <param name="parentId">An optional parent identifier.</param>
/// <param name="referenceTypeId">The reference type from the parent.</param>
/// <param name="browseName">The browse name.</param>
/// <param name="instance">The instance to create.</param>
/// <returns>The new node id.</returns>
public NodeId CreateNode(
ServerSystemContext context,
NodeId parentId,
NodeId referenceTypeId,
QualifiedName browseName,
BaseInstanceState instance)
{
ServerSystemContext contextToUse = (ServerSystemContext)m_systemContext.Copy(context);
lock (Lock)
{
instance.ReferenceTypeId = referenceTypeId;
NodeState parent = null;
if (parentId != null)
{
if (!PredefinedNodes.TryGetValue(parentId, out parent))
{
throw ServiceResultException.Create(
StatusCodes.BadNodeIdUnknown,
"Cannot find parent with id: {0}",
parentId);
}
parent.AddChild(instance);
}
instance.Create(contextToUse, null, browseName, null, true);
AddPredefinedNode(contextToUse, instance);
return instance.NodeId;
}
}
示例8: ValidateNode
/// <summary>
/// Verifies that the specified node exists.
/// </summary>
protected override NodeState ValidateNode(
ServerSystemContext context,
Opc.Ua.Server.NodeHandle handle,
IDictionary<NodeId, NodeState> cache)
{
// not valid if no root.
if (handle == null)
{
return null;
}
// check if previously validated.
if (handle.Validated)
{
return handle.Node;
}
// lookup in operation cache.
NodeState target = FindNodeInCache(context, handle, cache);
if (target == null)
{
// TBD
return null;
}
return ValidationComplete(context, handle, target, cache);
}
示例9: IsReferenceInView
/// <summary>
/// Checks if the reference is in the view.
/// </summary>
protected override bool IsReferenceInView(ServerSystemContext context, ContinuationPoint continuationPoint, IReference reference)
{
if (continuationPoint.View != null)
{
// guard against absolute node ids.
if (reference.TargetId.IsAbsolute)
{
return true;
}
// find the node.
NodeState node = FindPredefinedNode((NodeId)reference.TargetId, typeof(NodeState));
if (node != null)
{
return IsNodeInView(context, continuationPoint, node);
}
}
return true;
}
示例10: SaveContinuationPoint
/// <summary>
/// Saves a history continuation point.
/// </summary>
private byte[] SaveContinuationPoint(
ServerSystemContext context,
HdaHistoryReadRequest request)
{
Session session = context.OperationContext.Session;
if (session == null)
{
return null;
}
Guid id = Guid.NewGuid();
session.SaveHistoryContinuationPoint(id, request);
request.ContinuationPoint = id.ToByteArray();
return request.ContinuationPoint;
}
示例11: LoadContinuationPoint
/// <summary>
/// Loads a history continuation point.
/// </summary>
private HdaHistoryReadRequest LoadContinuationPoint(
ServerSystemContext context,
byte[] continuationPoint)
{
Session session = context.OperationContext.Session;
if (session == null)
{
return null;
}
HdaHistoryReadRequest request = session.RestoreHistoryContinuationPoint(continuationPoint) as HdaHistoryReadRequest;
if (request == null)
{
return null;
}
return request;
}
示例12: OnSetMonitoringModeComplete
/// <summary>
/// Called when a batch of monitored items has their monitoring mode changed.
/// </summary>
protected override void OnSetMonitoringModeComplete(ServerSystemContext context, IList<IMonitoredItem> monitoredItems)
{
OnModifyMonitoredItemsComplete(context, monitoredItems);
}
示例13: OnDeleteMonitoredItemsComplete
/// <summary>
/// Called when a batch of monitored items has been deleted.
/// </summary>
protected override void OnDeleteMonitoredItemsComplete(ServerSystemContext context, IList<IMonitoredItem> monitoredItems)
{
ComHdaClientManager system = (ComHdaClientManager)this.SystemContext.SystemHandle;
ComHdaClient client = (ComHdaClient)system.SelectClient(context, false);
// sort monitored items by the locale id used to create them.
Dictionary<int, List<IMonitoredItem>> monitoredItemsByLocaleId = new Dictionary<int, List<IMonitoredItem>>();
for (int ii = 0; ii < monitoredItems.Count; ii++)
{
// look up the manager that was previously used to create the monitor item.
HdaSubscribeRequestManager manager = null;
if (!m_monitoredItems.TryGetValue(monitoredItems[ii].Id, out manager))
{
manager = m_subscriptionManagers[client.LocaleId];
}
// add monitored item to a list of items for the locale of the manager.
List<IMonitoredItem> subset = null;
if (!monitoredItemsByLocaleId.TryGetValue(manager.LocaleId, out subset))
{
monitoredItemsByLocaleId[manager.LocaleId] = subset = new List<IMonitoredItem>();
}
subset.Add(monitoredItems[ii]);
}
// delete the items.
foreach (KeyValuePair<int, List<IMonitoredItem>> entry in monitoredItemsByLocaleId)
{
HdaSubscribeRequestManager manager = null;
if (m_subscriptionManagers.TryGetValue(entry.Key, out manager))
{
manager.DeleteItems(context, entry.Value);
}
}
}
示例14: OnCreateMonitoredItemsComplete
/// <summary>
/// Called when a batch of monitored items has been created.
/// </summary>
protected override void OnCreateMonitoredItemsComplete(ServerSystemContext context, IList<IMonitoredItem> monitoredItems)
{
ComHdaClientManager system = (ComHdaClientManager)this.SystemContext.SystemHandle;
ComHdaClient client = (ComHdaClient)system.SelectClient(context, false);
// use locale for session to find a subscription manager.
HdaSubscribeRequestManager manager = null;
if (!m_subscriptionManagers.TryGetValue(client.LocaleId, out manager))
{
m_subscriptionManagers[client.LocaleId] = manager = new HdaSubscribeRequestManager(context, client.LocaleId, m_configuration);
}
manager.CreateItems(context, monitoredItems);
for (int ii = 0; ii < monitoredItems.Count; ii++)
{
m_monitoredItems[monitoredItems[ii].Id] = manager;
}
}
示例15: FindType
/// <summary>
/// Returns the type identified by the category id and condition name.
/// </summary>
public AeEventTypeState FindType(ServerSystemContext context, NodeId nodeId)
{
if (NodeId.IsNull(nodeId))
{
return null;
}
BaseObjectTypeState eventType = null;
if (!EventTypeNodes.TryGetValue(nodeId, out eventType))
{
return null;
}
return eventType as AeEventTypeState;
}