Override class member built-in type methods

Questions regarding the use of the C++ SDK for Server or Client development or integration into customer products ...

Moderator: uasdkcpp

Post Reply
alccetinkaya
Jr. Member
Jr. Member
Posts: 4
Joined: 13 Sep 2023, 10:06

Override class member built-in type methods

Post by alccetinkaya »

Hello,

I have an object type with the built-in NonExclusiveLevelAlarmType type as a member. This type has Acknowledge, Enable, Disable etc. methods. I want to override its methods to apply my business logic. Since it's a class member, I couldn't find a way to override it. My question is, how is it possible to override built-in type methods in general?

Additionally, I'm using UaModuler to create objects. When I look at the NodeId namespace index of NonExclusiveLevelAlarmType members, variables are 2 (my node manager's index), but methods are 0. Is that correct?

Thanks

User avatar
Support Team
Hero Member
Hero Member
Posts: 3072
Joined: 18 Mar 2011, 15:09

Re: Override class member built-in type methods

Post by Support Team »

Hi,

You can implement your business logic in the NodeManagerBase by overriding the method OnAcknowledge. The ServerGetting started tutorial shows an example for that in lesson 6.
see https://documentation.unified-automation.com/uasdkcpp/1.8.3/html/L3GettingStartedLesson06.html#L4GettingStartedLesson06_Step05

The same way you can overrride the methods Enable, Disable etc.
In OPC UA it is allowed to call a method using the Method NodeId of the Type (instead of the Method NodeId of the instance). For the ConditionTypes the generated code just creates a reference to the Acknowledge method on the type, instead of creating an additional method node for each condition instance. So yes, that is correct.
Best regards
Unified Automation Support Team

Utkrist
Hero Member
Hero Member
Posts: 22
Joined: 15 May 2023, 09:50

Re: Override class member built-in type methods

Post by Utkrist »

Hi,

I have a follow up question to this. For Instance, here is the signature of the method I want to override.

Code: Select all

  virtual UaStatus GetLatestResult(
        const ServiceContext& serviceContext,
        OpcUa_Int32 ResourceTimeout,
        OpcUa_UInt32& ResultHandle,
      OpcUaTi::ResultDataType& Result,
        OpcUa_Int32& Error);
I am also using UaModeler to import multiple Xml files, therefore there are multiple namespaces in the address space. I tried overriding this method on the NodeManagerBase of the final namespace (as shown by UaExpert),but I do not get the desired result. I also thought any business logic should be implemented on the NodeManager, which inherits from NodeManagerBase. Is this not true?

Post Reply