2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-22 02:10:32 +00:00

FB_CALLMONITOR: use mulitple-strict widget for reverse-search attribute; minor code make-up

git-svn-id: https://svn.fhem.de/fhem/trunk@6624 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
markusbloch 2014-09-27 13:47:52 +00:00
parent fe0b0307fe
commit a629decbea

View File

@ -31,7 +31,6 @@ package main;
use strict;
use warnings;
use Time::HiRes qw(gettimeofday);
use DevIo;
use Digest::MD5;
use HttpUtils;
use DevIo;
@ -75,15 +74,12 @@ my %connection_type = (
);
#####################################
sub
FB_CALLMONITOR_Initialize($)
{
my ($hash) = @_;
require "$attr{global}{modpath}/FHEM/DevIo.pm";
# Provider
$hash->{ReadFn} = "FB_CALLMONITOR_Read";
$hash->{ReadyFn} = "FB_CALLMONITOR_Ready";
@ -93,7 +89,7 @@ FB_CALLMONITOR_Initialize($)
$hash->{UndefFn} = "FB_CALLMONITOR_Undef";
$hash->{AttrFn} = "FB_CALLMONITOR_Attr";
$hash->{AttrList}= "do_not_notify:0,1 disable:0,1 unique-call-ids:0,1 local-area-code remove-leading-zero:0,1 reverse-search-cache-file reverse-search:multiple,phonebook,klicktel.de,dasoertliche.de,search.ch,dasschnelle.at reverse-search-cache:0,1 reverse-search-phonebook-file ".
$hash->{AttrList}= "do_not_notify:0,1 disable:0,1 unique-call-ids:0,1 local-area-code remove-leading-zero:0,1 reverse-search-cache-file reverse-search:multiple-strict,phonebook,klicktel.de,dasoertliche.de,search.ch,dasschnelle.at reverse-search-cache:0,1 reverse-search-phonebook-file ".
$readingFnAttributes;
}
@ -104,45 +100,41 @@ FB_CALLMONITOR_Define($$)
my ($hash, $def) = @_;
my @a = split("[ \t][ \t]*", $def);
if(@a != 3) {
if(@a != 3)
{
my $msg = "wrong syntax: define <name> FB_CALLMONITOR ip[:port]";
Log 2, $msg;
return $msg;
}
DevIo_CloseDev($hash);
my $name = $a[0];
my $dev = $a[2];
$dev .= ":1012" if($dev !~ m/:/ && $dev ne "none" && $dev !~ m/\@/);
$hash->{DeviceName} = $dev;
my $ret = DevIo_OpenDev($hash, 0, undef);
return $ret;
return DevIo_OpenDev($hash, 0, undef);
}
#####################################
# closing the connection on undefinition (shutdown/delete)
sub
FB_CALLMONITOR_Undef($$)
{
my ($hash, $arg) = @_;
my $name = $hash->{NAME};
DevIo_CloseDev($hash);
return undef;
}
#####################################
# No get commands possible, as we just receive the events from the FritzBox.
# Get function for returning a reverse search name
sub
FB_CALLMONITOR_Get($@)
{
@ -168,6 +160,8 @@ FB_CALLMONITOR_Get($@)
}
#####################################
# Set function for executing a reread of the internal phonebook
sub
FB_CALLMONITOR_Set($@)
{