Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nodeset-compiler should generate function stubs for method calls #3199

Open
4 of 7 tasks
ghost opened this issue Oct 23, 2019 · 1 comment
Open
4 of 7 tasks

nodeset-compiler should generate function stubs for method calls #3199

ghost opened this issue Oct 23, 2019 · 1 comment
Labels
Component: Server Issues related to the server code Type: Enhancement Describes a feature request or addition of new functionality

Comments

@ghost
Copy link

ghost commented Oct 23, 2019

Description

I would like to see the nodeset-compiler to handle Method nodes better.
Currently the following code is generated:

static UA_StatusCode function_tf_2_finish(UA_Server *server, UA_UInt16* ns) {
#ifdef UA_ENABLE_METHODCALLS
return UA_Server_addMethodNode_finish(server, 
UA_NODEID_NUMERIC(ns[1], 7001)
, NULL, 0, NULL, 0, NULL);
#else
return UA_STATUSCODE_GOOD;
#endif /* UA_ENABLE_METHODCALLS */
}

This is missing:

  • Input arguments + size
  • Output arguments + size
  • method function-pointer

My suggestion is to parse the argument info from the .xml and use it.
For the method we could add a prototype declaration to the generated .h file. The user then can add the actual implementation to its own code, using that prototype.
The question is how to name that prototype. Perhaps based on the hierachy of the node, so in this example it would be methodCallback_Gateway_enterBootloader(.....).

This is a feature that I need, and I am willing to implement this myself and open a PR for it.
Right now I am looking for feedback:

  • Is this feature already there and I just missed it?
  • Is this a stupid idea because of $reason that I am not aware of?
  • naming of the callback method
  • Anything else I forgot?

Background Information / Reproduction Steps

./nodeset_compiler.py -e ../schema/Opc.Ua.NodeSet2.Minimal.xml -x test-function.xml foobar
With the .xml I used: test-function.xml.txt

I did not build it myself. Instead the 1.0 release was used.

Checklist

  • open62541 Version (release number or git tag):
  • Other OPC UA SDKs used (client or server): UaModeler
  • Operating system: Windows10
  • Logs (with UA_LOGLEVEL set as low as necessary) attached
  • Wireshark network dump attached
  • Self-contained code example attached
  • Critical issue: nope
@jpfr jpfr added Component: Server Issues related to the server code Type: Enhancement Describes a feature request or addition of new functionality labels Oct 24, 2019
@jpfr
Copy link
Member

jpfr commented Oct 24, 2019

Good idea!
Marked as a feature request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Server Issues related to the server code Type: Enhancement Describes a feature request or addition of new functionality
Projects
None yet
Development

No branches or pull requests

1 participant