agsh / onvif

ONVIF node.js implementation
http://agsh.github.io/onvif/
MIT License
693 stars 236 forks source link

Camera: Option to disable autoconnect #174

Closed sjkummer closed 3 years ago

sjkummer commented 3 years ago

This introduces a new option to disable autoconnect when creating a camera object:

* @param {boolean} [options.autoconnect=true] Set false if the camera should not connect automatically. The callback will not be executed.

Background / intent: Instantiating a camera object automatically triggers multiple Onvif requests. This puts load on the camera. If the camera has to serve multiple clients, the Onvif API may get very slow, resulting in timeouts.

It should be possible, to perform a lean connectivity check, eg. calling getSystemDateAndTime without further overhad.

However, the default behaviour remains the same before and after this change. It just introduces an additional option parameter.

coveralls commented 3 years ago

Coverage Status

Coverage increased (+0.01%) to 87.952% when pulling 57a86265adb07d853aa8eb1c2d240e2728da8fe2 on sjkummer:feature/autoconnect-option into eae46806e2f6c0ce1c46549e246ece5c355fbdb2 on agsh:master.

sjkummer commented 3 years ago

@agsh Ready for merge?

chriswiggins commented 3 years ago

Can you please add tests to this and remove the change to that other line?

sjkummer commented 3 years ago

@chriswiggins Ok, done

chriswiggins commented 3 years ago

Thanks for your contribution @sjkummer ! @agsh will release this in the next cycle.