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:
parent
9f63b75c88
commit
3e8d503681
|
@ -617,7 +617,10 @@ 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
|
||||||
|
@ -629,7 +632,10 @@ 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 );
|
||||||
|
@ -651,7 +657,10 @@ 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
|
||||||
|
@ -663,7 +672,10 @@ 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 );
|
||||||
|
@ -685,7 +697,10 @@ 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
|
||||||
|
@ -697,7 +712,10 @@ 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 );
|
||||||
|
@ -719,7 +737,10 @@ 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
|
||||||
|
@ -731,7 +752,10 @@ 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 );
|
||||||
|
|
|
@ -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 );
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue