Closed Hexagon closed 10 years ago
And tdClose as well then I guess or how is that solved today?
Correct! That's not handled at all today
I've read somewhere, can't find where now, that tdInit() only should be called once. So I guess that there should be an function that checks a boolean that is indicating if the Tellstick is initialized or not, and that function should be called in each of the "command functions".
Not sure when/where we should call tdClose(), I guess you normally never "shut down" node app.
Yeah that's a problem, we need to decide if we wan't to leave the tdInit call to the user, via telldus.tdInit(callback) or if we want to make logic in the js-wrapper that run tdInit on the first call and never again. The latter version is imho the cleanest option, and the first option is the most "library-agnostic".
I'm all for running it automatically in the wrapper.
I agree.
Agreed :) I'll add the core c++ stuff later, after that you'll be able to call telldus.tdInit(callback); (and close, if needed)
Untested as i dont have access to my tellstick right now. Short documentation in commit description, did not change telldus.js to avoid merge conflicts.
I have now tested, using my own changes to telldus.cc and .js, with and without tdInit/tdClose and I really can't make out any difference... Anyone got anything.
I know nothing, seems like some people use init and close to successfully restart the library on failures. Telldus documentation says that tdInit "initializes the library", so i guess the best bet is to run it for compability with future versions.
tdInit is now called on module load. tdClose on process exit. Don't know if it's the best way of doing it but it seems to work.
That should be entirely fine, great :+1:
This should be a separate function