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

JavaScript interface for commissioning #276

Open
dakhnod opened this issue May 7, 2024 · 1 comment
Open

JavaScript interface for commissioning #276

dakhnod opened this issue May 7, 2024 · 1 comment

Comments

@dakhnod
Copy link

dakhnod commented May 7, 2024

I am creating a nodeJS application that is supposed to help with device commissioning.
From that application, I want to be able to interface with the device commissioning process.

Unfortunately, the commissioning-cli does not provide any realistic way of interfacing with JavaScript code.

The SWIG interface file doesn't work, since it has a strong dependency on Java. Also, SWIG cannot handle std::shared_ptr.

Some solutions I have in mind are:

  • update the SWIG process to work for JS
  • open up the coap protocol to allow for alternative clients
  • provide an API for a commissioning-daemon (REST, ...)

Is there any clever Idea I am missing?

@wgtdkp
Copy link
Member

wgtdkp commented May 7, 2024

The CLI isn't a stable API, so it may not be a good idea to depend on that if you are targeting productions.

I think it's simpler and less code to use the library directly rather than building a client-server mode with a CLI daemon. I would suggest

  1. first try https://www.swig.org/Doc4.2/SWIGDocumentation.html#Javascript to see if it can fulfill your requirements
  2. If there are problems with SWIG and can't be workaround, try writing a node.js addon for the commissioner? https://nodejs.org/api/addons.html

Also, SWIG cannot handle std::shared_ptr

Do you mean SWIG_javascript doesn't support translating std::shared_ptr? I think it's used in only two places in commissioner.hpp and you can ignore those methods and create replacements with node.js addon?

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