From 2c1a02ade6a58478736d89d4c46ebab15a7d91c6 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Wed, 18 Feb 2015 16:34:35 -0500 Subject: [PATCH] Add was_alarmed property and WasAlarmed method to Zone --- src/zm_zone.cpp | 1 + src/zm_zone.h | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/zm_zone.cpp b/src/zm_zone.cpp index 90c954d9e..e817f0908 100644 --- a/src/zm_zone.cpp +++ b/src/zm_zone.cpp @@ -51,6 +51,7 @@ void Zone::Setup( Monitor *p_monitor, int p_id, const char *p_label, ZoneType p_ Debug( 1, "Initialised zone %d/%s - %d - %dx%d - Rgb:%06x, CM:%d, MnAT:%d, MxAT:%d, MnAP:%d, MxAP:%d, FB:%dx%d, MnFP:%d, MxFP:%d, MnBS:%d, MxBS:%d, MnB:%d, MxB:%d, OF: %d, AF: %d", id, label, type, polygon.Width(), polygon.Height(), alarm_rgb, check_method, min_pixel_threshold, max_pixel_threshold, min_alarm_pixels, max_alarm_pixels, filter_box.X(), filter_box.Y(), min_filter_pixels, max_filter_pixels, min_blob_pixels, max_blob_pixels, min_blobs, max_blobs, overload_frames, extend_alarm_frames ); alarmed = false; + was_alarmed = false; pixel_diff = 0; alarm_pixels = 0; alarm_filter_pixels = 0; diff --git a/src/zm_zone.h b/src/zm_zone.h index c431f88a0..266ffc753 100644 --- a/src/zm_zone.h +++ b/src/zm_zone.h @@ -126,14 +126,16 @@ public: inline const Image *AlarmImage() const { return( image ); } inline const Polygon &GetPolygon() const { return( polygon ); } inline bool Alarmed() const { return( alarmed ); } - inline void SetAlarm() { alarmed = true; } - inline void ClearAlarm() { alarmed = false; } + inline bool WasAlarmed() const { return( was_alarmed ); } + inline void SetAlarm() { was_alarmed = alarmed; alarmed = true; } + inline void ClearAlarm() { was_alarmed = alarmed; alarmed = false; } inline Coord GetAlarmCentre() const { return( alarm_centre ); } inline unsigned int Score() const { return( score ); } inline void ResetStats() { alarmed = false; + was_alarmed = false; pixel_diff = 0; alarm_pixels = 0; alarm_filter_pixels = 0;