Skip to content

Reference

OpcEvent Members

Represents a snapshot of a 'Opc.UaFx.OpcEventNode'.

Reference

OpcEvent Members ​

Type
OpcEvent
Namespace
Opc.UaFx
Assembly
Opc.UaFx.Advanced.dll
Package
Opc.UaFx.Advanced v2.59.0
Also in
Opc.UaFx.Client

Constructors ​

OpcEvent ​

since v2.8

Initializes a new instance of the OpcEvent class using the dataStore specified.

csharp
public OpcEvent(IOpcReadOnlyNodeDataStore dataStore)
vbnet
Public Sub New(dataStore As IOpcReadOnlyNodeDataStore)

Parameters

NameTypeDescription
dataStoreIOpcReadOnlyNodeDataStoreThe IOpcReadOnlyNodeDataStore of the 'Opc.UaFx.OpcEventNode' to represent.

Exceptions

ExceptionCondition
ArgumentNullExceptionThe dataStore is a null reference (Nothing in Visual Basic).

Properties ​

DataStore ​

protected

Gets the IOpcReadOnlyNodeDataStore which contains the data of the OpcEvent instance.

csharp
protected IOpcReadOnlyNodeDataStore DataStore { get; }
vbnet
Protected ReadOnly Property DataStore As IOpcReadOnlyNodeDataStore

Property value

IOpcReadOnlyNodeDataStore

An instance implementing the IOpcReadOnlyNodeDataStore interface containing the event data represented by this OpcEvent instance.

EventId ​

Gets a value generated by the server to uniquely identify a particular event notification.

csharp
public ByteString EventId { get; }
vbnet
Public ReadOnly Property EventId As ByteString

Property value

ByteString

The identifier of the OpcEvent. For more information see 'Opc.UaFx.OpcEventNode.EventId'.

EventType ​

Gets the type of event.

csharp
public OpcEventType EventType { get; }
vbnet
Public ReadOnly Property EventType As OpcEventType

Property value

OpcEventType

One of the members defined by the OpcEventType enumeration indicating the type of the event represented by the OpcEvent. In case of custom event types the value Event.

EventTypeId ​

Gets node identifier which describes the specific type of event.

csharp
public OpcNodeId EventTypeId { get; }
vbnet
Public ReadOnly Property EventTypeId As OpcNodeId

Property value

OpcNodeId

The node identifier of the event type. For more information see 'Opc.UaFx.OpcEventNode.EventTypeId'.

Message ​

Gets a value which defines a human-readable and localizable text description of the event.

csharp
public OpcText Message { get; }
vbnet
Public ReadOnly Property Message As OpcText

Property value

OpcText

The message of the OpcEvent. For more information see 'Opc.UaFx.OpcEventNode.Message'.

NodeId ​

Gets the identifier of the node from which this event data snapshot has been created.

csharp
public OpcNodeId NodeId { get; }
vbnet
Public ReadOnly Property NodeId As OpcNodeId

Property value

OpcNodeId

The OpcNodeId of the node this snapshot originates.

ReceiveTime ​

Gets the time the OPC UA server received the event from the underlying device of another server.

csharp
public DateTime ReceiveTime { get; }
vbnet
Public ReadOnly Property ReceiveTime As Date

Property value

DateTime

The time the server received the OpcEvent. For more information see 'Opc.UaFx.OpcEventNode.ReceiveTime'.

Severity ​

Gets an indication of the urgency of the event.

csharp
public OpcEventSeverity Severity { get; }
vbnet
Public ReadOnly Property Severity As OpcEventSeverity

Property value

OpcEventSeverity

The severity of the OpcEvent. For more information see 'Opc.UaFx.OpcEventNode.Severity'.

SourceName ​

Gets a description of the source of the event.

csharp
public string SourceName { get; }
vbnet
Public ReadOnly Property SourceName As String

Property value

String

The description of the source of the OpcEvent. For more information see 'Opc.UaFx.OpcEventNode.SourceName'.

SourceNodeId ​

Gets the node identifier which identifies the node that the event originated from.

csharp
public OpcNodeId SourceNodeId { get; }
vbnet
Public ReadOnly Property SourceNodeId As OpcNodeId

Property value

OpcNodeId

The node identifier of the node the OpcEvent originates from. For more information see 'Opc.UaFx.OpcEventNode.SourceNodeId'.

Time ​

Gets the time the event occurred.

csharp
public DateTime Time { get; }
vbnet
Public ReadOnly Property Time As Date

Property value

DateTime

The time the OpcEvent occurred. For more information see 'Opc.UaFx.OpcEventNode.Time'.

Methods ​

Create ​

static · since v2.54

Creates a new OpcEvent instance following the parameters specified.

csharp
public static OpcEvent Create(
    OpcContext context,
    OpcEventFilter filter,
    IEnumerable<object> data)
vbnet
Public Shared Function Create(
    context As OpcContext,
    filter As OpcEventFilter,
    data As IEnumerable(Of Object)) As OpcEvent

Parameters

NameTypeDescription
contextOpcContextThe OpcContext to which the new OpcEvent belongs to.
filterOpcEventFilterThe OpcEventFilter whose SelectClause defines the order of the data.
dataIEnumerable<Object>A sequence of object values in the same order as the select-clause operands of the filter. Pass null for fields that are not available.

Returns

OpcEvent

A new instance of the event type or of one of its (custom) derivates using the data specified.

Exceptions

ExceptionCondition
ArgumentNullExceptionThe context, filter or data is a null reference (Nothing in Visual Basic).

GetValue ​

protected · since v2.19

Retrieves the value of the event field named by the memberName, e.g. to implement a property of a custom event type.

csharp
protected T GetValue<T>(string memberName = "")
vbnet
Protected Function GetValue(Of T)(memberName As String = "") As T

Type parameters

NameDescription
TThe type of the value.

Parameters

NameTypeDescription
memberNameStringThe name of the field. By default the name of the calling member. Optional, default "".

Returns

T

The value of the field as an instance of T.

Remarks

A memberName without a namespace is resolved in the namespace of the event type which declares the member, unless the EventTypeId belongs to the default namespace.

RegisterType ​

static · 2 overloads · since v2.8

OverloadDescription
RegisterType<T>()static · since v2.8Registers the type defined by T as the OpcEvent type to create in case there an event instance is to be created for the type definition identified by the OpcEventTypeAttribute defined on the T specified.
RegisterType<T>(OpcNodeId)static · since v2.8Registers the type defined by T as the OpcEvent type to create in case there an event instance is to be created for the type definition identified by the eventTypeId specified.

Exceptions (all overloads)

ExceptionCondition
ArgumentExceptionThe type T does not define the OpcEventTypeAttribute or a public accessible constructor accepting an instance of the IOpcReadOnlyNodeDataStore interface or any event type specific attribute offers invalid information about the event type to associate with the Type.

RegisterType<T>() ​

static · since v2.8

Registers the type defined by T as the OpcEvent type to create in case there an event instance is to be created for the type definition identified by the OpcEventTypeAttribute defined on the T specified.

csharp
public static void RegisterType<T>() where T : OpcEvent
vbnet
Public Shared Sub RegisterType(Of T As OpcEvent)()

Type parameters

NameDescription
TThe OpcEvent type to use in case there an event for the event definition equals to event type identifier defined using the OpcEventTypeAttribute is to be created. The type needs to provide a public accessible constructor accepting an instance of the IOpcReadOnlyNodeDataStore interface and needs to be a subclass of the OpcEvent class.

RegisterType<T>(OpcNodeId) ​

static · since v2.8

Registers the type defined by T as the OpcEvent type to create in case there an event instance is to be created for the type definition identified by the eventTypeId specified.

csharp
public static void RegisterType<T>(OpcNodeId eventTypeId) where T : OpcEvent
vbnet
Public Shared Sub RegisterType(Of T As OpcEvent)(eventTypeId As OpcNodeId)

Type parameters

NameDescription
TThe OpcEvent type to use in case there an event for the event definition equals to eventTypeId is to be created. The type needs to provide a public accessible constructor accepting an instance of the IOpcReadOnlyNodeDataStore interface and needs to be a subclass of the OpcEvent class.

Parameters

NameTypeDescription
eventTypeIdOpcNodeIdThe identifier of the type definition for which the T is to be used to create an event instance.

Exceptions

ExceptionCondition
ArgumentNullExceptionThe eventTypeId is a null reference (Nothing in Visual Basic).

Remarks

It is not possible to register the same or a different event type for the eventTypeId specified as long there is already an event type registered for the type definition specified by eventTypeId.

RegisterTypes ​

static · 3 overloads · since v2.8

OverloadDescription
RegisterTypes(Assembly)static · since v2.8Registers all non-abstract types in the assembly specified which defines the OpcEventTypeAttribute and inherit from OpcEvent.
RegisterTypes(IEnumerable<Type>)static · since v2.8Registers the eventTypes specified as the OpcEvent type to create in case there an event instance is to be created for one of the type definitions identified by the OpcEventTypeAttribute used on one of the eventTypes specified.
RegisterTypes(Type, params Type[])static · since v2.8Registers the eventType and the further specified eventTypes as the OpcEvent types to create in case there an event instance is to be created for one of the type definitions identified by the OpcEventTypeAttribute used on the eventType or on one of the eventTypes specified.

Exceptions (all overloads)

ExceptionCondition
ArgumentExceptionA Type does not define the OpcEventTypeAttribute or a public accessible constructor accepting an instance of the IOpcReadOnlyNodeDataStore interface or any event type specific attribute offers invalid information about the event type to associate with the Type.

RegisterTypes(Assembly) ​

static · since v2.8

Registers all non-abstract types in the assembly specified which defines the OpcEventTypeAttribute and inherit from OpcEvent.

csharp
public static void RegisterTypes(Assembly assembly)
vbnet
Public Shared Sub RegisterTypes(assembly As Assembly)

Parameters

NameTypeDescription
assemblyAssemblyThe Assembly its types are inspected for subclasses of the OpcEvent class which in addition using the OpcEventTypeAttribute.

Exceptions

ExceptionCondition
ArgumentNullExceptionThe assembly is a null reference (Nothing in Visual Basic).

Remarks

The Type instances to register need to define the OpcEventTypeAttribute and a public accessible constructor accepting an instance of the IOpcReadOnlyNodeDataStore interface. Additionally the Type needs to be a subclass of the OpcEvent class.

RegisterTypes(IEnumerable<Type>) ​

static · since v2.8

Registers the eventTypes specified as the OpcEvent type to create in case there an event instance is to be created for one of the type definitions identified by the OpcEventTypeAttribute used on one of the eventTypes specified.

csharp
public static void RegisterTypes(IEnumerable<Type> eventTypes)
vbnet
Public Shared Sub RegisterTypes(eventTypes As IEnumerable(Of Type))

Parameters

NameTypeDescription
eventTypesIEnumerable<Type>A sequence of Type instances representing subclasses of OpcEvent to use in case there an event for the event definition equals to the event type identifier defined using the OpcEventTypeAttribute is to be created.

Exceptions

ExceptionCondition
ArgumentNullExceptionThe eventTypes is a null reference (Nothing in Visual Basic).

Remarks

Any null reference (Nothing in Visual Basic) in eventTypes is ignored.

RegisterTypes(Type, params Type[]) ​

static · since v2.8

Registers the eventType and the further specified eventTypes as the OpcEvent types to create in case there an event instance is to be created for one of the type definitions identified by the OpcEventTypeAttribute used on the eventType or on one of the eventTypes specified.

csharp
public static void RegisterTypes(Type eventType, params Type[] eventTypes)
vbnet
Public Shared Sub RegisterTypes(
    eventType As Type,
    ParamArray eventTypes As Type())

Parameters

NameTypeDescription
eventTypeTypeThe Type instance representing a subclass of the OpcEvent to use in case there an event for the event definition equals to the event type identifier defined using the OpcEventTypeAttribute is to be created.
eventTypesparams Type[]An array of additional Type instances representing subclasses of OpcEvent to use in case there an event for the event definition equals to the event type identifier defined using the OpcEventTypeAttribute is to be created.

Exceptions

ExceptionCondition
ArgumentNullExceptionThe eventType or eventTypes is a null reference (Nothing in Visual Basic).

UnregisterType ​

static · 2 overloads · since v2.8

OverloadDescription
UnregisterType<T>()static · since v2.8Unregisters the previously registered (see RegisterType) type defined by T as the OpcEvent type to not longer create for the type definition identified by the OpcEventTypeAttribute defined on the T specified.
UnregisterType<T>(OpcNodeId)static · since v2.8Unregisters the previously registered (see RegisterType) type defined by T as the OpcEvent type to not longer create for the type definition identified by the eventTypeId specified.

UnregisterType<T>() ​

static · since v2.8

Unregisters the previously registered (see RegisterType) type defined by T as the OpcEvent type to not longer create for the type definition identified by the OpcEventTypeAttribute defined on the T specified.

csharp
public static void UnregisterType<T>() where T : OpcEvent
vbnet
Public Shared Sub UnregisterType(Of T As OpcEvent)()

Type parameters

NameDescription
TThe OpcEvent type to unregister for the event definition equals to the event type identifier defined using the OpcEventTypeAttribute.

UnregisterType<T>(OpcNodeId) ​

static · since v2.8

Unregisters the previously registered (see RegisterType) type defined by T as the OpcEvent type to not longer create for the type definition identified by the eventTypeId specified.

csharp
public static void UnregisterType<T>(OpcNodeId eventTypeId) where T : OpcEvent
vbnet
Public Shared Sub UnregisterType(Of T As OpcEvent)(eventTypeId As OpcNodeId)

Type parameters

NameDescription
TThe OpcEvent type to unregister for the event definition equals to eventTypeId. The type needs to be a subclass of the OpcEvent class.

Parameters

NameTypeDescription
eventTypeIdOpcNodeIdThe identifier of the type definition for which the T is to be unregistered.

Exceptions

ExceptionCondition
ArgumentNullExceptionThe eventTypeId is a null reference (Nothing in Visual Basic).

UnregisterTypes ​

static · 3 overloads · since v2.8

OverloadDescription
UnregisterTypes(Assembly)static · since v2.8Unregisters all previously registered types (see RegisterTypes) in the assembly specified.
UnregisterTypes(IEnumerable<Type>)static · since v2.8Unregisters the previously registered (see RegisterTypes) eventTypes specified.
UnregisterTypes(Type, params Type[])static · since v2.8Unregisters the previously registered eventType and the further specified eventTypes (see RegisterTypes).

UnregisterTypes(Assembly) ​

static · since v2.8

Unregisters all previously registered types (see RegisterTypes) in the assembly specified.

csharp
public static void UnregisterTypes(Assembly assembly)
vbnet
Public Shared Sub UnregisterTypes(assembly As Assembly)

Parameters

NameTypeDescription
assemblyAssemblyThe Assembly its types are inspected for subclasses of the OpcEvent class which in addition using the OpcEventTypeAttribute.

Exceptions

ExceptionCondition
ArgumentNullExceptionThe assembly is a null reference (Nothing in Visual Basic).

UnregisterTypes(IEnumerable<Type>) ​

static · since v2.8

Unregisters the previously registered (see RegisterTypes) eventTypes specified.

csharp
public static void UnregisterTypes(IEnumerable<Type> eventTypes)
vbnet
Public Shared Sub UnregisterTypes(eventTypes As IEnumerable(Of Type))

Parameters

NameTypeDescription
eventTypesIEnumerable<Type>A sequence of OpcEvent types to unregister for the event definitions equals to the event type identifiers defined using the OpcEventTypeAttribute.

Exceptions

ExceptionCondition
ArgumentNullExceptionThe eventTypes is a null reference (Nothing in Visual Basic).

UnregisterTypes(Type, params Type[]) ​

static · since v2.8

Unregisters the previously registered eventType and the further specified eventTypes (see RegisterTypes).

csharp
public static void UnregisterTypes(Type eventType, params Type[] eventTypes)
vbnet
Public Shared Sub UnregisterTypes(
    eventType As Type,
    ParamArray eventTypes As Type())

Parameters

NameTypeDescription
eventTypeTypeThe OpcEvent type to unregister for the event definition equals to the event type identifier defined using the OpcEventTypeAttribute.
eventTypesparams Type[]An array of additional OpcEvent types to unregister for the event definitions equals to the event type identifiers defined using the OpcEventTypeAttribute.

Exceptions

ExceptionCondition
ArgumentNullExceptionThe eventType or eventTypes is a null reference (Nothing in Visual Basic).

Events ​

TypeResolve ​

static · since v2.8

Occurs when the resolution of an event type fails. Use this event to manually provide the Type to use for a specific event type definition identifier.

csharp
public static event OpcTypeResolveEventHandler TypeResolve
vbnet
Public Shared Event TypeResolve As OpcTypeResolveEventHandler

Event type

OpcTypeResolveEventHandler