mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-21 01:46:08 +00:00
FB_CALLLIST: code optimizations
git-svn-id: https://svn.fhem.de/fhem/trunk@10442 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
6237e50f83
commit
c96f7e84d6
@ -32,7 +32,6 @@ use warnings;
|
|||||||
use MIME::Base64;
|
use MIME::Base64;
|
||||||
use Data::Dumper;
|
use Data::Dumper;
|
||||||
|
|
||||||
|
|
||||||
sub
|
sub
|
||||||
FB_CALLLIST_Initialize($)
|
FB_CALLLIST_Initialize($)
|
||||||
{
|
{
|
||||||
@ -63,7 +62,7 @@ FB_CALLLIST_Initialize($)
|
|||||||
$readingFnAttributes;
|
$readingFnAttributes;
|
||||||
|
|
||||||
$hash->{FW_detailFn} = "FB_CALLLIST_makeTable";
|
$hash->{FW_detailFn} = "FB_CALLLIST_makeTable";
|
||||||
$hash->{FW_summaryFn} = "FB_CALLLIST_makeTable";
|
$hash->{FW_summaryFn} = "FB_CALLLIST_makeTable";
|
||||||
$hash->{FW_atPageEnd} = 1;
|
$hash->{FW_atPageEnd} = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,20 +75,10 @@ sub FB_CALLLIST_Define($$)
|
|||||||
my $retval = undef;
|
my $retval = undef;
|
||||||
my $name = $a[0];
|
my $name = $a[0];
|
||||||
my $callmonitor = $a[2];
|
my $callmonitor = $a[2];
|
||||||
if(!defined($callmonitor))
|
|
||||||
{
|
|
||||||
return "FB_CALLLIST_define: you must specify a device name for using FB_CALLLIST";
|
|
||||||
}
|
|
||||||
|
|
||||||
if(@a != 3)
|
return "FB_CALLLIST_define: you must specify a device name for using FB_CALLLIST" if(!defined($callmonitor));
|
||||||
{
|
return "wrong define syntax: define <name> FB_CALLLIST <name>" if(@a != 3);
|
||||||
return "wrong define syntax: define <name> FB_CALLLIST <name>";
|
return "FB_CALLLIST_define: the selected device $callmonitor does not exist." unless(defined($defs{$callmonitor}));
|
||||||
}
|
|
||||||
|
|
||||||
unless(defined($defs{$callmonitor}))
|
|
||||||
{
|
|
||||||
return "FB_CALLLIST_define: the selected device $callmonitor does not exist.";
|
|
||||||
}
|
|
||||||
|
|
||||||
unless($defs{$callmonitor}->{TYPE} eq "FB_CALLMONITOR")
|
unless($defs{$callmonitor}->{TYPE} eq "FB_CALLMONITOR")
|
||||||
{
|
{
|
||||||
@ -272,7 +261,6 @@ sub FB_CALLLIST_Notify($$)
|
|||||||
my ($hash,$d) = @_;
|
my ($hash,$d) = @_;
|
||||||
|
|
||||||
return undef if(!defined($hash) or !defined($d));
|
return undef if(!defined($hash) or !defined($d));
|
||||||
return undef if(IsDisabled($hash->{NAME}));
|
|
||||||
|
|
||||||
my $name = $hash->{NAME};
|
my $name = $hash->{NAME};
|
||||||
|
|
||||||
@ -294,6 +282,7 @@ sub FB_CALLLIST_Notify($$)
|
|||||||
|
|
||||||
my $fb = $d->{NAME};
|
my $fb = $d->{NAME};
|
||||||
|
|
||||||
|
return undef if(IsDisabled($name));
|
||||||
return undef if($fb ne $hash->{FB});
|
return undef if($fb ne $hash->{FB});
|
||||||
return undef if(!grep(m/^event:/, @{$d->{CHANGED}}));
|
return undef if(!grep(m/^event:/, @{$d->{CHANGED}}));
|
||||||
|
|
||||||
@ -704,14 +693,8 @@ sub FB_CALLLIST_formatDuration($$)
|
|||||||
my $minute = ($data->{call_duration} / 60) % 60;
|
my $minute = ($data->{call_duration} / 60) % 60;
|
||||||
my $seconds = int($data->{call_duration} % 60);
|
my $seconds = int($data->{call_duration} % 60);
|
||||||
|
|
||||||
if($data->{missed_call})
|
return "-" if($data->{missed_call});
|
||||||
{
|
return sprintf("%02d:%02d:%02d", $hour, $minute, $seconds);
|
||||||
return "-";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return sprintf("%02d:%02d:%02d", $hour, $minute, $seconds);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#####################################
|
#####################################
|
||||||
|
Loading…
x
Reference in New Issue
Block a user