Add Zones() to Monitor

This commit is contained in:
Isaac Connor 2021-04-29 14:49:39 -04:00
parent 69098ccdcb
commit e32771c255
1 changed files with 8 additions and 0 deletions

View File

@ -35,6 +35,7 @@ require ZoneMinder::Storage;
require ZoneMinder::Server;
require ZoneMinder::Memory;
require ZoneMinder::Monitor_Status;
require ZoneMinder::Zone;
#our @ISA = qw(Exporter ZoneMinder::Base);
use parent qw(ZoneMinder::Object);
@ -226,6 +227,13 @@ sub Storage {
return new ZoneMinder::Storage( $_[0]{StorageId} );
} # end sub Storage
sub Zones {
if (! exists $_[0]{Zones}) {
$_[0]{Zones} = [ $_[0]{Id} ? ZoneMinder::Zone->find(MonitorId=>$_[0]{Id}) : () ];
}
return wantarray ? @{$_[0]{Zones}} : $_[0]{Zones};
}
sub control {
my $monitor = shift;
my $command = shift;