Is the Nx Cloud up? Visit our Status Page for the current health and performance of the Nx Cloud.

Status Page

How To Run Some Code When Plugin Is Enabled For a Camera or Disabled For One

Answered

Comments

3 comments

  • Anton Babinov
    • Network Optix team

    Hello Usama,

     

    server handles enabling/disabling analytics engine on camera outside of plugin's scope. Because of that, distinguishing server restart and disable/enable from the plugin settings is tricky, and it might overcomplicate things. Could you please describe why it is important for you not to execute your HTTP request upon server restart? Perhaps, we'll be able to find a different solution for your task.

     

    >So I'm guessing I'd have to implement some method in engine.cpp?

    You can add HTTP call in the DeviceAgent constructor and destructor functions in deviceagent.cpp. However, as I mentioned, it won't be possible to ignore server restart from there.

    1
  • Permanently deleted user

    Hey Anton Babinov

    I'm basically trying to add/delete entries corresponding to the cameras on the remote server.

    So, yes, sending a create request on DeviceAgent constructor is fine since I can just check on the remote server whether the camera already exists or not, and not re-add it.

    But, sending a delete request in the DeviceAgent destructor could mean deleting cameras on the remote server unintentionally. The destructor will always be called when the DeviceAgent worker is about to go out of memory, like on server restart. Not just when it is disabled.



    0
  • Anton Babinov
    • Network Optix team

    >But, sending a delete request in the DeviceAgent destructor could mean deleting cameras on the remote >server unintentionally. The destructor will always be called when the DeviceAgent worker is about to go out >of memory, like on server restart. Not just when it is disabled.

    I suggest marking camera as offline without deleting it from the remote system. I think it would be the most simple solution for your case.

    0

Please sign in to leave a comment.