Bug 402 - Added errors and warnings on bogus exits.

git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@2097 e3e1d417-86f3-4887-817a-d78f3d33393f
This commit is contained in:
stan 2007-04-03 09:47:08 +00:00
parent 9f63b75c88
commit 3e8d503681
3 changed files with 39 additions and 0 deletions

View File

@ -617,9 +617,12 @@ int Monitor::actionBrightness( int p_brightness )
if ( wait_loops-- ) if ( wait_loops-- )
usleep( 100000 ); usleep( 100000 );
else else
{
Warning(( "Timed out waiting to set brightness" ));
return( -1 ); return( -1 );
} }
} }
}
else else
{ {
shared_data->action |= GET_SETTINGS; shared_data->action |= GET_SETTINGS;
@ -629,9 +632,12 @@ int Monitor::actionBrightness( int p_brightness )
if ( wait_loops-- ) if ( wait_loops-- )
usleep( 100000 ); usleep( 100000 );
else else
{
Warning(( "Timed out waiting to get brightness" ));
return( -1 ); return( -1 );
} }
} }
}
return( shared_data->brightness ); return( shared_data->brightness );
} }
return( camera->Brightness( p_brightness ) ); return( camera->Brightness( p_brightness ) );
@ -651,9 +657,12 @@ int Monitor::actionContrast( int p_contrast )
if ( wait_loops-- ) if ( wait_loops-- )
usleep( 100000 ); usleep( 100000 );
else else
{
Warning(( "Timed out waiting to set contrast" ));
return( -1 ); return( -1 );
} }
} }
}
else else
{ {
shared_data->action |= GET_SETTINGS; shared_data->action |= GET_SETTINGS;
@ -663,9 +672,12 @@ int Monitor::actionContrast( int p_contrast )
if ( wait_loops-- ) if ( wait_loops-- )
usleep( 100000 ); usleep( 100000 );
else else
{
Warning(( "Timed out waiting to get contrast" ));
return( -1 ); return( -1 );
} }
} }
}
return( shared_data->contrast ); return( shared_data->contrast );
} }
return( camera->Contrast( p_contrast ) ); return( camera->Contrast( p_contrast ) );
@ -685,9 +697,12 @@ int Monitor::actionHue( int p_hue )
if ( wait_loops-- ) if ( wait_loops-- )
usleep( 100000 ); usleep( 100000 );
else else
{
Warning(( "Timed out waiting to set hue" ));
return( -1 ); return( -1 );
} }
} }
}
else else
{ {
shared_data->action |= GET_SETTINGS; shared_data->action |= GET_SETTINGS;
@ -697,9 +712,12 @@ int Monitor::actionHue( int p_hue )
if ( wait_loops-- ) if ( wait_loops-- )
usleep( 100000 ); usleep( 100000 );
else else
{
Warning(( "Timed out waiting to get hue" ));
return( -1 ); return( -1 );
} }
} }
}
return( shared_data->hue ); return( shared_data->hue );
} }
return( camera->Hue( p_hue ) ); return( camera->Hue( p_hue ) );
@ -719,9 +737,12 @@ int Monitor::actionColour( int p_colour )
if ( wait_loops-- ) if ( wait_loops-- )
usleep( 100000 ); usleep( 100000 );
else else
{
Warning(( "Timed out waiting to set colour" ));
return( -1 ); return( -1 );
} }
} }
}
else else
{ {
shared_data->action |= GET_SETTINGS; shared_data->action |= GET_SETTINGS;
@ -731,9 +752,12 @@ int Monitor::actionColour( int p_colour )
if ( wait_loops-- ) if ( wait_loops-- )
usleep( 100000 ); usleep( 100000 );
else else
{
Warning(( "Timed out waiting to get colour" ));
return( -1 ); return( -1 );
} }
} }
}
return( shared_data->colour ); return( shared_data->colour );
} }
return( camera->Colour( p_colour ) ); return( camera->Colour( p_colour ) );

View File

@ -291,6 +291,7 @@ int RemoteCamera::GetResponse()
int buffer_len = ReadData( buffer ); int buffer_len = ReadData( buffer );
if ( buffer_len < 0 ) if ( buffer_len < 0 )
{ {
Error(( "Unable to read header data" ));
return( -1 ); return( -1 );
} }
if ( !header_expr ) if ( !header_expr )
@ -473,6 +474,7 @@ int RemoteCamera::GetResponse()
int buffer_len = ReadData( buffer ); int buffer_len = ReadData( buffer );
if ( buffer_len < 0 ) if ( buffer_len < 0 )
{ {
Error(( "Unable to read content" ));
return( -1 ); return( -1 );
} }
} }
@ -485,6 +487,7 @@ int RemoteCamera::GetResponse()
int buffer_len = ReadData( buffer ); int buffer_len = ReadData( buffer );
if ( buffer_len < 0 ) if ( buffer_len < 0 )
{ {
Error(( "Unable to read content" ));
return( -1 ); return( -1 );
} }
static RegExpr *content_expr = 0; static RegExpr *content_expr = 0;
@ -619,6 +622,7 @@ int RemoteCamera::GetResponse()
int buffer_len = ReadData( buffer ); int buffer_len = ReadData( buffer );
if ( buffer_len < 0 ) if ( buffer_len < 0 )
{ {
Error(( "Unable to read header" ));
return( -1 ); return( -1 );
} }
@ -930,6 +934,7 @@ int RemoteCamera::GetResponse()
int buffer_len = ReadData( buffer ); int buffer_len = ReadData( buffer );
if ( buffer_len < 0 ) if ( buffer_len < 0 )
{ {
Error(( "Unable to read subheader" ));
return( -1 ); return( -1 );
} }
state = SUBHEADERCONT; state = SUBHEADERCONT;
@ -973,6 +978,7 @@ int RemoteCamera::GetResponse()
int buffer_len = ReadData( buffer ); int buffer_len = ReadData( buffer );
if ( buffer_len < 0 ) if ( buffer_len < 0 )
{ {
Error(( "Unable to read content" ));
return( -1 ); return( -1 );
} }
} }
@ -987,6 +993,7 @@ int RemoteCamera::GetResponse()
int buffer_size = buffer.Size(); int buffer_size = buffer.Size();
if ( buffer_len < 0 ) if ( buffer_len < 0 )
{ {
Error(( "Unable to read content" ));
return( -1 ); return( -1 );
} }
if ( buffer_len ) if ( buffer_len )
@ -1058,6 +1065,7 @@ int RemoteCamera::PreCapture()
Connect(); Connect();
if ( sd < 0 ) if ( sd < 0 )
{ {
Error(( "Unable to connect to camera" ));
return( -1 ); return( -1 );
} }
mode = SINGLE_IMAGE; mode = SINGLE_IMAGE;
@ -1067,6 +1075,7 @@ int RemoteCamera::PreCapture()
{ {
if ( SendRequest() < 0 ) if ( SendRequest() < 0 )
{ {
Error(( "Unable to send request" ));
Disconnect(); Disconnect();
return( -1 ); return( -1 );
} }
@ -1079,6 +1088,7 @@ int RemoteCamera::PostCapture( Image &image )
int content_length = GetResponse(); int content_length = GetResponse();
if ( content_length < 0 ) if ( content_length < 0 )
{ {
Error(( "Unable to get response" ));
Disconnect(); Disconnect();
return( -1 ); return( -1 );
} }
@ -1088,6 +1098,7 @@ int RemoteCamera::PostCapture( Image &image )
{ {
if ( !image.DecodeJpeg( buffer.Extract( content_length ), content_length ) ) if ( !image.DecodeJpeg( buffer.Extract( content_length ), content_length ) )
{ {
Error(( "Unable to decode jpeg" ));
Disconnect(); Disconnect();
return( -1 ); return( -1 );
} }
@ -1108,6 +1119,7 @@ int RemoteCamera::PostCapture( Image &image )
{ {
if ( !image.Unzip( buffer.Extract( content_length ), content_length ) ) if ( !image.Unzip( buffer.Extract( content_length ), content_length ) )
{ {
Error(( "Unable to unzip RGB image" ));
Disconnect(); Disconnect();
return( -1 ); return( -1 );
} }

View File

@ -194,6 +194,7 @@ int main( int argc, char *argv[] )
if ( monitors[0]->PrimeCapture() < 0 ) if ( monitors[0]->PrimeCapture() < 0 )
{ {
Error(( "Failed to prime capture of initial monitor" ));
exit( -1 ); exit( -1 );
} }
@ -244,10 +245,12 @@ int main( int argc, char *argv[] )
{ {
if ( monitors[i]->PreCapture() < 0 ) if ( monitors[i]->PreCapture() < 0 )
{ {
Error(( "Failed to pre-capture monitor %d", i ));
exit( -1 ); exit( -1 );
} }
if ( monitors[i]->PostCapture() < 0 ) if ( monitors[i]->PostCapture() < 0 )
{ {
Error(( "Failed to post-capture monitor %d", i ));
exit( -1 ); exit( -1 );
} }