Difference between revisions of "Creating an OPC UA event filter in COM"

From OPC Labs Knowledge Base
Jump to navigation Jump to search
Line 8: Line 8:
 
* Overloaded (or any parameterized) constructors of '''EasyUAMonitoredItemArguments''' are not available under COM, and the parameters inside this objects need to be set one by one.
 
* Overloaded (or any parameterized) constructors of '''EasyUAMonitoredItemArguments''' are not available under COM, and the parameters inside this objects need to be set one by one.
 
* There is no '''UAEventFilterBuilder''' in COM, and the tree for the Where clause needs to be constructed using '''UAContentFilterElement''' and various operators and operands.
 
* There is no '''UAEventFilterBuilder''' in COM, and the tree for the Where clause needs to be constructed using '''UAContentFilterElement''' and various operators and operands.
 +
* Useful static members describing common attributes operands, residing in '''UABaseEventObject.Operands''', are not available under COM. Each such attribute operand need to be constructed in COM from scratch, and the qualified names contained in it usually obtained using an instance of the '''BrowsePathParser''' object.
 +
* No implicit conversion exists from '''UASimpleAttributeOperand''' to '''UAAttributeField''' in COM; this can be work around by assigning the attribute operand to the '''Operand''' property of a newly created '''UAAttributeField'''.
 +
 +
  
 
Note: This article has been written for/with in-the-works QuickOPC version 2016.2 (5.41), but it should apply equally to the current version 5.40.
 
Note: This article has been written for/with in-the-works QuickOPC version 2016.2 (5.41), but it should apply equally to the current version 5.40.

Revision as of 12:03, 27 September 2016


QuickOPC provides many useful "shortcuts" for creating OPC UA event filters on the .NET platform. It is also possible to create OPC UA event filters on the COM platform, but due to the missing "goodies", the resulting code is longer. This article describes how to create OPC UA event filters on the COM platform, explains the traps and pitfalls, and provides an example. The example happens to be written in Free Pascal (Lazarus), but the same operations will have to be performed in other COM-based tool or language.

The parts that have to be expressed on the COM platform verbatim, as opposed to the .NET, are primarily:

  • IEasyUAClient.SubscribeEvent overloads with various combinations of arguments are missing. Only an overload with no event filter exists under COM. Anything more complicated needs to go through IEasyUAClient.SubscribeMultipleMonitoredItems, passing in an array of EasyUAMonitoredItemArguments.
  • Overloaded (or any parameterized) constructors of EasyUAMonitoredItemArguments are not available under COM, and the parameters inside this objects need to be set one by one.
  • There is no UAEventFilterBuilder in COM, and the tree for the Where clause needs to be constructed using UAContentFilterElement and various operators and operands.
  • Useful static members describing common attributes operands, residing in UABaseEventObject.Operands, are not available under COM. Each such attribute operand need to be constructed in COM from scratch, and the qualified names contained in it usually obtained using an instance of the BrowsePathParser object.
  • No implicit conversion exists from UASimpleAttributeOperand to UAAttributeField in COM; this can be work around by assigning the attribute operand to the Operand property of a newly created UAAttributeField.


Note: This article has been written for/with in-the-works QuickOPC version 2016.2 (5.41), but it should apply equally to the current version 5.40.