From 33cb9ab66f97c8a39e643caf02573f9295095b06 Mon Sep 17 00:00:00 2001 From: stan Date: Sun, 15 Jan 2006 17:39:18 +0000 Subject: [PATCH] Bug 13 - Added prototype signal loss detection code into remote monitors. git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@1824 e3e1d417-86f3-4887-817a-d78f3d33393f --- src/zm_monitor.cpp | 5 +++-- src/zm_remote_camera.cpp | 6 ++---- src/zmc.cpp | 10 ++++++++-- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/zm_monitor.cpp b/src/zm_monitor.cpp index f86f98398..3716948bc 100644 --- a/src/zm_monitor.cpp +++ b/src/zm_monitor.cpp @@ -178,7 +178,7 @@ void Monitor::Setup() shared_data->size = sizeof(SharedData); shared_data->valid = true; shared_data->active = enabled; - shared_data->signal = true; + shared_data->signal = false; shared_data->state = IDLE; shared_data->last_write_index = image_buffer_count; shared_data->last_read_index = image_buffer_count; @@ -826,7 +826,7 @@ bool Monitor::Analyse() if ( !signal ) text = "Signal Lost"; else - text = "Signal Regained"; + text = "Signal Reacquired"; Warning(( text )); if ( event ) { @@ -1953,6 +1953,7 @@ int Monitor::PostCapture() } return( 0 ); } + shared_data->signal = false; return( -1 ); } diff --git a/src/zm_remote_camera.cpp b/src/zm_remote_camera.cpp index f5228d406..f8724b72c 100644 --- a/src/zm_remote_camera.cpp +++ b/src/zm_remote_camera.cpp @@ -309,8 +309,6 @@ int RemoteCamera::GetResponse() if ( status_code < 200 || status_code > 299 ) { Error(( "Invalid response status %d: %s", status_code, status_mesg )); - if ( status_code >= 400 ) - exit( -1 ); return( -1 ); } Debug( 3, ( "Got status '%d' (%s), http version %s", status_code, status_mesg, http_version )); @@ -356,7 +354,7 @@ int RemoteCamera::GetResponse() if ( !content_boundary[0] ) { Error(( "No content boundary found in header '%s'", header )); - exit( -1 ); + return( -1 ); } mode = MULTI_JPEG; state = SUBHEADER; @@ -752,7 +750,7 @@ int RemoteCamera::GetResponse() if ( !content_boundary ) { Error(( "No content boundary found in header '%s'", content_type_header )); - exit( -1 ); + return( -1 ); } mode = MULTI_JPEG; state = SUBHEADER; diff --git a/src/zmc.cpp b/src/zmc.cpp index 766fc34db..12d347479 100644 --- a/src/zmc.cpp +++ b/src/zmc.cpp @@ -201,7 +201,10 @@ int main( int argc, char *argv[] ) sigaddset( &block_set, SIGUSR2 ); if ( device[0] && n_monitors == 1 ) { - monitors[0]->PreCapture(); + if ( monitors[0]->PreCapture() < 0 ) + { + exit( -1 ); + } } long *capture_delays = new long[n_monitors]; @@ -252,7 +255,10 @@ int main( int argc, char *argv[] ) } if ( next_delays[i] <= min_delay || next_delays[i] <= 0 ) { - monitors[i]->PreCapture(); + if ( monitors[i]->PreCapture() < 0 ) + { + exit( -1 ); + } monitors[i]->PostCapture(); if ( next_delays[i] > 0 )