Bug 227 - Fixed zmtrack to not use zmu but to use Shm module.
git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@1712 e3e1d417-86f3-4887-817a-d78f3d33393f
This commit is contained in:
parent
9678f5ae88
commit
812ea88252
|
@ -142,16 +142,14 @@ if ( !defined($monitor->{ShmId}) )
|
||||||
sub Suspend
|
sub Suspend
|
||||||
{
|
{
|
||||||
my $monitor = shift;
|
my $monitor = shift;
|
||||||
my $suspend_cmd = ZM_PATH_BIN."/zmu -m ".$monitor->{Id}." -u -U admin -P pc00zm";
|
zmMonitorSuspend( $monitor );
|
||||||
qx( $suspend_cmd );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sub Resume
|
sub Resume
|
||||||
{
|
{
|
||||||
my $monitor = shift;
|
my $monitor = shift;
|
||||||
sleep( $monitor->{TrackDelay} );
|
sleep( $monitor->{TrackDelay} );
|
||||||
my $resume_cmd = ZM_PATH_BIN."/zmu -m ".$monitor->{Id}." -r -U admin -P pc00zm";
|
zmMonitorResume( $monitor );
|
||||||
qx( $resume_cmd );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sub Track
|
sub Track
|
||||||
|
@ -190,24 +188,10 @@ if ( ($monitor->{ReturnLocation} >= 0) )
|
||||||
my $alarmed = undef;
|
my $alarmed = undef;
|
||||||
while( 1 )
|
while( 1 )
|
||||||
{
|
{
|
||||||
my $state;
|
if ( zmIsAlarmed( $monitor ) )
|
||||||
if ( !shmread( $monitor->{ShmId}, $state, 8, 4 ) )
|
|
||||||
{
|
{
|
||||||
print( "Can't read from shared memory: $!\n" );
|
my ( $alarm_x, $alarm_y ) = zmGetAlarmLocation( $monitor );
|
||||||
exit( -1 );
|
if ( $alarm_x >= 0 && $alarm_y >= 0 )
|
||||||
}
|
|
||||||
$state = unpack( "l", $state );
|
|
||||||
|
|
||||||
if ( $state == 2 ) # Alarmed
|
|
||||||
{
|
|
||||||
my $alarm_pos;
|
|
||||||
if ( !shmread( $monitor->{ShmId}, $alarm_pos, 48, 8 ) )
|
|
||||||
{
|
|
||||||
print( "Can't read from shared memory '$monitor->{ShmKey}/$monitor->{ShmId}': $!\n" );
|
|
||||||
next;
|
|
||||||
}
|
|
||||||
my ( $alarm_x, $alarm_y ) = unpack( "ll", $alarm_pos );
|
|
||||||
if ( $alarm_x > 0 && $alarm_y > 0 )
|
|
||||||
{
|
{
|
||||||
Debug( "Got alarm at $alarm_x, $alarm_y\n" );
|
Debug( "Got alarm at $alarm_x, $alarm_y\n" );
|
||||||
Suspend( $monitor );
|
Suspend( $monitor );
|
||||||
|
|
Loading…
Reference in New Issue