2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 06:39:11 +00:00

CommandSet change, make , and - work at the same time

git-svn-id: https://svn.fhem.de/fhem/trunk@42 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2007-03-31 06:28:08 +00:00
parent e10f9cb1e9
commit 6514f45881
2 changed files with 29 additions and 25 deletions

View File

@ -223,6 +223,10 @@ FHZ_Define($$)
$po->stopbits(1);
$po->handshake('none');
$po->stty_icanon(0);
$po->stty_parmrk(0);
$po->stty_icrnl(0);
$hash->{PortObj} = $po;
$hash->{FD} = $po->FILENO;
$hash->{DeviceName} = $dev;

View File

@ -60,6 +60,7 @@ sub TimeNow();
sub WriteStatefile();
sub XmlEscape($);
sub fhem($);
sub fhz($);
sub doGlobalDef($);
sub CommandAttr($$);
@ -781,39 +782,30 @@ CommandSet($$)
my $dev = $a[0];
my @rets;
if(defined($defs{$dev})) {
return DoSet(@a);
} elsif($dev =~ m/,/) { # Enumeration (separated by ,)
foreach my $sdev (split(",", $dev)) {
if($sdev =~ m/-/) { # Range (separated by -)
my @lim = split("-", $sdev);
foreach my $sd (sort keys %defs) {
next if($sd lt $lim[0] || $sd gt $lim[1]);
$a[0] = $sd;
my $ret = DoSet(@a);
push @rets, $ret if($ret);
}
next;
}
if(!defined($defs{$sdev})) {
push @rets, "Please define $sdev first";
next;
}
$a[0] = $sdev;
my $ret = DoSet(@a);
push @rets, $ret if($ret);
}
return join("\n", @rets);
} elsif($dev =~ m/-/) { # Range (separated by -)
my @lim = split("-", $dev);
foreach my $sdev (keys %defs) {
next if($sdev lt $lim[0] || $sdev gt $lim[1]);
$a[0] = $sdev;
my $ret = DoSet(@a);
push @rets, $ret if($ret);
}
return join("\n", @rets);
} else {
return "Please define $dev first ($param)";
}
}
@ -1593,6 +1585,14 @@ fhem($)
return AnalyzeCommandChain($global_cl, $param);
}
# the "old" name, kept to make upgrade process easier
sub
fhz($)
{
my $param = shift;
return AnalyzeCommandChain($global_cl, $param);
}
sub
doGlobalDef($)
{