mirror of
https://github.com/ZoneMinder/zoneminder.git
synced 2026-10-03 07:55:22 -04:00
Wire the monitor lifecycle events into zmc. Monitor::SetState() replaces the scattered shared_data->state assignments in Analyse() and connect(), publishing a state_changed event (with previous and new state id and name) whenever the analysis state actually changes. Monitor::SendStreamHealthEvent() emits the capture-fault edges and tracks the active fault for the snapshot; the snapshot is refreshed on every state or health change and after a successful prime, so a consumer connecting mid-fault learns current status. zmc's capture loop emits the six health transitions once per edge: connection failed/restored around connect(), prime_capture failed/restored around PrimeCapture(), capture_failed on pre/capture/post failure, and a single capture_resumed once the pipeline recovers. Because the stream socket survives camera reconnects, these are observable exactly when media has stopped. A small mutex guards the health fields shared between the capture thread (health events) and analysis thread (state events). Documents the EVENT frame in docs/stream_socket.rst and decodes it in tools/zm_stream_socket_dump.py. Full build and ctest pass (121 tests). refs #2875 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The latest version of these docs can be found at http://zoneminder.readthedocs.org/