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

Examples #28

Closed
denglerchr opened this issue Jun 18, 2024 · 6 comments
Closed

Examples #28

denglerchr opened this issue Jun 18, 2024 · 6 comments

Comments

@denglerchr
Copy link

Hello,

I am looking to use OPC UA servers and clients in Julia (currently using https://github.com/FreeOpcUa/opcua-asyncio , but performance is really not great). Currently the resources for how to use it are too scarce for me to understand how to build simple things. Maybe creating an example folder and showing how to build basic components, like server with some nodes, would help users like me?
While the Python implementation is slow, it is quite ok in this regards: https://github.com/FreeOpcUa/opcua-asyncio/blob/master/examples/ . Maybe the server-minimal.py would be a nice starting point?

Best regards,
Christian Dengler

@thomvet
Copy link
Collaborator

thomvet commented Jun 20, 2024

Does https://martinkosch.github.io/Open62541.jl/dev/tutorials/combined_variables/ help you in this regard? That tutorial shows how to add variable nodes to a basic server and reading/writing from them.

Or maybe asking differently: what other nodes/functionality do you need to add/use? I am sure that an appropriate example can be added to the docs. I would just need to know more about what you are trying to do 😃

@denglerchr
Copy link
Author

denglerchr commented Jun 20, 2024

Hello,
For example:

  • defining the port
  • creating an object node
  • enabling user/password authentication
  • creation of a new namespace
    I fail for example just defining the port and adding a new namespace

@thomvet
Copy link
Collaborator

thomvet commented Jun 25, 2024

Sorry for the delay here. I hope to manage to summarize how to do these things tonight (european time) soon.

@thomvet
Copy link
Collaborator

thomvet commented Jul 11, 2024

Update: I am working on a PR that updates the package to the new release of open62541 and my plan is to incorporate some examples answering your points in that PR. Until the PR is merged - which may take a few more days - I am providing some pointers here:

  • defining the port

Instead of (J)UA_ServerConfig_setDefault(config) use (J)UA_ServerConfig_setMinimal(config, portNumber, certificate), certificate is optional, set it to C_NULL if not needed. So, you can for example do:

server = JUA_Server()
config = JUA_ServerConfig(server)
JUA_ServerConfig_setMinimal(config, 10000, C_NULL)
JUA_Server_runUntilInterrupt(server)

Now a server with a very basic configuration will run on port 10000.

  • creating an object node

The following code segment from the Open62541.jl tests should be helpful for this:
https://github.com/martinkosch/Open62541.jl/blob/main/test/server_add_nodes_highlevelinterface.jl#L156-L187

  • enabling user/password authentication

Here is a working example of this (again from the test suite):
https://github.com/martinkosch/Open62541.jl/blob/main/test/username_password_login_accesscontrol.jl

Please, let me know if you are still stuck on this. As I said at the start, I'll try to get some of the test examples converted into tutorial-style things, but it will take some time.

@thomvet thomvet mentioned this issue Jul 11, 2024
9 tasks
@denglerchr
Copy link
Author

Thanks for the reply. I am not stuck on it anymore, no.
But I see that the UI is kept on a low abstraction level. Is there any plans for a higher level interface that are more in a Julia style, e.g., using keyword arguments, type dispatch and so on, instead of sticking close to the C functions?

@thomvet
Copy link
Collaborator

thomvet commented Jul 11, 2024

Yes, the idea is that there is a more comprehensive higher level interface getting established over time. Right now, there are only a few bits and pieces of this implemented, but the low level interface is essentially a complete mapping of the C library.

For example the JUA_Server_addNode functionality uses type dispatch. Attribute generation is also more Julia style convenient (see JUA_VariableAttributes and UA_VariableAttributes_generate).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants