Event stream bug? No online message for camera 0 upon app start
  • I am noticing, when I start SecuritySpy, there is no 'ONLINE' event emitted for camera #0

    With three cameras online,

    I get:
    20190804064311 0 1 ONLINE
    20190804064311 1 2 ONLINE

    I expect to see:
    20190804064311 0 0 ONLINE
    20190804064311 1 1 ONLINE
    20190804064311 2 2 ONLINE

    I know camera #0 is there because while my event monitor is running I modify the camera #0 prefs to knock it offline:

    20190804064429 10 0 CONFIGCHANGE
    20190804064429 11 0 OFFLINE
    20190804064436 13 0 ERROR 89900,-9806 Error communicating with the network device "CAM001".

    Then I restore the correct pref and now I get an ONLINE message for camera #0:

    20190804064524 19 0 CONFIGCHANGE
    20190804064526 20 0 ONLINE

    So it seems the exclusion of the ONLINE event for camera #0 only occurs when launching SecuritySpy... ?
  • I'll check this, but it's not a known issue and is unlikely to be a bug. It's probably that camera 0 is simply very quick to connect, so that the initial request for the event stream is happening after the camera has come online. How are you timing the request for the event stream with starting SecuritySpy? This is basically like a race condition, and therefore I don't think you can rely on the ONLINE messages for cameras that are opened when SecuritySpy starts.
  • Ok, your analysis is correct on the above scenario. It was a race condition scenario - event stream vs my event monitor thread once the server became available.

    So instead, I am evaluating the initial status of all cameras instead by using the 'connected' value from ++systemInfo

    This then led me down a different path, where I made it so my event monitor thread holds a reference to the serverInfo object and will tell that object to re-query the server status if a CONFIGCHANGE event is received.

    So now I have a different case and I think maybe this one is more likely a bug? (but I could be wrong!)

    Server running - monitoring event stream
    Open Preferences
    Select a camera > Setup tab
    Toggle the Status (enabled this camera) checkbox and click Apply Preferences
    Do this repeatedly.
    Result: I don't get a CONFIGCHANGE event every time

    Conversely:

    Server running - monitoring event stream
    Open Preferences
    Select a camera > Continuous Capture tab
    Change the image capture frequency value (arbitrary value change) and Apple Prefs
    Result: I always get a CONFIGCHANGE

    Also, when toggling the "Status (enable this camera)" checkbox, and applying Prefs, I do always get an ONLINE or OFFLINE event, so I am simply working around the lack of reliable CONFIGCHANGE events by also triggering the re-query on ++systeminfo if any of CONFIGCHANGE ONLINE OFFLINE events are received.

    That workaround does the job, but maybe it's worth examining why the CONFIGCHANGE event does not always publish?

    I know when a camera status is enabled/disabled, SecuritySpy has a bit of work to do, so maybe I am correct in this case that the CONFIGCHANGE event is not being published every time?
  • This is indeed a quirky little bug, related specifically to the interaction between changing that specific setting and sending out the CONFIGCHANGE event. It's now fixed in the latest beta version of SecuritySpy (currently 5.0.2b7). Please confirm.
  • Yes, it looks like you solved it in b7. Thank you!

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!