method call in NodeManagerBase

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

Moderator: uasdkcpp

Post Reply
sebastien_a
Sr. Member
Sr. Member
Posts: 12
Joined: 13 Apr 2012, 10:23

method call in NodeManagerBase

Post by sebastien_a »

Hi Unified Automation Team,

I use the Uamodeler tool to build my nodespace and your nodeset2 XML parser file that you provided to me as a beta tester (thanks to you)
I've some nodes which have a method and I try to implements this method.

I based myself on server lesson 4 to try to implements method call but without success

Instead this (in lesson 4):

class ControllerObject :
public UaObjectBase,
public MethodManager

I make this (I try to catch method call in NodeManager)

class MyNodeManager :
public NodeManagerBase,
public MethodManager

and I override the methods as in lesson 4 :

MethodManager* getMethodManager(UaMethod* pMethod) const;

// Implement MethodManager interface
virtual UaStatus beginCall(
MethodManagerCallback* pCallback,
const ServiceContext& serviceContext,
OpcUa_UInt32 callbackHandle,
MethodHandle* pMethodHandle,
const UaVariantArray& inputArguments);

But this methods are never called when I make a call in my OPCUA client....

Can you tell me if there's a way to implements method call in NodeManager instead UaObjectBase ?
Or is this technically impossible?
I can't override UaObjectBase due to the fact that all my nodes are generated by the nodeset2 XML parser.

Thanks in advance for your help.

Sébastien

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

Re:method call in NodeManagerBase

Post by Support Team »

Hello Sébastien,

it's ok to implement the NodeManage interface directly in your own NodeManager instead of an object. The missing link is just the NodeManager::getMethodHandle() implementation.
This function is called to find the MethodeManager for the given object/method pair.

The NodeManager in the GettingsStarted example is built on top of NodeMangeUaNode which has already a default implementation.
It retrieves the UaObject Pointer for the object identified by method calls objectId, then calls UaObject::getMethodManager() on that object to retrieve the MethodHandle and then invokes the real method call using the MethodManager stored in this MethodHandle.

To implement method calls directly in your NodeManager you can override NodeMange::getMethodManager() and return a MethodHandle containing a pointer to your NodeManager (this) which already implements the MethodManager interface.

Please have a look at Lesson 4, Step 3. There this connection is explained. Follow the links of NodeManager::getMethodHandle() and MethodManager to get more information about it.

I hope this helps,
The Unified Automation Team.
Best regards
Unified Automation Support Team

sebastien_a
Sr. Member
Sr. Member
Posts: 12
Joined: 13 Apr 2012, 10:23

Re:method call in NodeManagerBase

Post by sebastien_a »

Hi Unified Automation Team,

That's exactly what I was looking for.

Thanks for your precious help.

Sébastien

Post Reply