Replace uses of Function

This commit is contained in:
Isaac Connor 2022-02-03 12:38:26 -05:00
parent f40279b745
commit caebef3103
1 changed files with 8 additions and 6 deletions

View File

@ -52,7 +52,9 @@ $serial = $primary_key = 'Id';
ServerId ServerId
StorageId StorageId
Type Type
Function Capturing
Analysing
Recording
Enabled Enabled
LinkedMonitors LinkedMonitors
Triggers Triggers
@ -307,9 +309,9 @@ sub disconnect {
sub suspendMotionDetection { sub suspendMotionDetection {
my $self = shift; my $self = shift;
return 0 if ! ZoneMinder::Memory::zmMemVerify($self); return 0 if ! ZoneMinder::Memory::zmMemVerify($self);
return if $$self{Function} eq 'Nodect' or $$self{Function} eq 'Monitor' or $$self{Function} eq 'None'; return if $$self{Capturing} eq 'None' or $$self{Analysing} eq 'None';
my $count = 50; my $count = 50;
while ($count and ZoneMinder::Memory::zmMemRead($self, 'shared_data:active', 1)) { while ($count and ZoneMinder::Memory::zmMemRead($self, 'shared_data:analysing', 1)) {
ZoneMinder::Logger::Debug(1, 'Suspending motion detection'); ZoneMinder::Logger::Debug(1, 'Suspending motion detection');
ZoneMinder::Memory::zmMonitorSuspend($self); ZoneMinder::Memory::zmMonitorSuspend($self);
usleep(100000); usleep(100000);
@ -319,16 +321,16 @@ sub suspendMotionDetection {
ZoneMinder::Logger::Error('Unable to suspend motion detection after 5 seconds.'); ZoneMinder::Logger::Error('Unable to suspend motion detection after 5 seconds.');
ZoneMinder::Memory::zmMemInvalidate($self); # Close our file handle to the zmc process we are about to end ZoneMinder::Memory::zmMemInvalidate($self); # Close our file handle to the zmc process we are about to end
} else { } else {
ZoneMinder::Logger::Debug(1, 'shared_data:active='.ZoneMinder::Memory::zmMemRead($self, 'shared_data:active', 1)); ZoneMinder::Logger::Debug(1, 'shared_data:analysing='.ZoneMinder::Memory::zmMemRead($self, 'shared_data:analysing', 1));
} }
} }
sub resumeMotionDetection { sub resumeMotionDetection {
my $self = shift; my $self = shift;
return 0 if ! ZoneMinder::Memory::zmMemVerify($self); return 0 if ! ZoneMinder::Memory::zmMemVerify($self);
return if $$self{Function} eq 'Nodect' or $$self{Function} eq 'Monitor' or $$self{Function} eq 'None'; return if $$self{Capturing} eq 'None' or $$self{Analysing} eq 'None';
my $count = 50; my $count = 50;
while ($count and !ZoneMinder::Memory::zmMemRead($self, 'shared_data:active', 1)) { while ($count and !ZoneMinder::Memory::zmMemRead($self, 'shared_data:analysing', 1)) {
ZoneMinder::Logger::Debug(1, 'Resuming motion detection'); ZoneMinder::Logger::Debug(1, 'Resuming motion detection');
ZoneMinder::Memory::zmMonitorResume($self); ZoneMinder::Memory::zmMonitorResume($self);
usleep(100000); usleep(100000);