From 76252c4831a84c83c612031d9a15a6d083fda015 Mon Sep 17 00:00:00 2001 From: stan Date: Mon, 21 Nov 2005 12:18:36 +0000 Subject: [PATCH] Bug 209 - Optional prevent ongoing alarms from keeping events open. git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@1608 e3e1d417-86f3-4887-817a-d78f3d33393f --- src/zm_monitor.cpp | 23 +++++++++++++++-------- zmconfig.pl.in | 8 ++++++++ 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/src/zm_monitor.cpp b/src/zm_monitor.cpp index 0b9a964a1..5631db834 100644 --- a/src/zm_monitor.cpp +++ b/src/zm_monitor.cpp @@ -689,21 +689,28 @@ bool Monitor::Analyse() { if ( event ) { - if ( state == IDLE || state == TAPE ) + int section_mod = timestamp->tv_sec%section_length; + if ( section_mod < last_section_mod ) { - int section_mod = timestamp->tv_sec%section_length; - if ( section_mod < last_section_mod ) + if ( state == IDLE || state == TAPE || config.force_close_events ) { - Info(( "Ended event" )); + if ( state == IDLE || state == TAPE ) + { + Info(( "Ended event" )); + } + else + { + Info(( "Force closed event" )); + } gettimeofday( &(event->EndTime()), &dummy_tz ); delete event; event = 0; last_section_mod = 0; } - else - { - last_section_mod = section_mod; - } + } + else + { + last_section_mod = section_mod; } } if ( !event ) diff --git a/zmconfig.pl.in b/zmconfig.pl.in index 91d1ee96c..26ad56fde 100755 --- a/zmconfig.pl.in +++ b/zmconfig.pl.in @@ -1108,6 +1108,14 @@ my @options = type => { db_type=>'string', hint=>'asc|desc', pattern=>qr|^([ad])|i, format=>q( $1 =~ /^a/i ? 'asc' : 'desc' ) }, category => 'system', }, + { + name => "ZM_FORCE_CLOSE_EVENTS", + default => "no", + description => "Whether events are closed at section ends.", + help => "When a monitor is running in a continuous recording moe (Record or Mocord) events are usually closed after a fixed period of time (the section length). However in Mocord mode it is possible that motion detection may occur near the end of a section and ordinarily this will prevent the event being closed until the motion has ceased. Switching this option on will force the event closed at the specified time regardless of any motion activity.", + type => $types{boolean}, + category => 'system', + }, { name => "ZM_CHECK_FOR_UPDATES", default => "yes",