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->stopbits(1);
$po->handshake('none'); $po->handshake('none');
$po->stty_icanon(0);
$po->stty_parmrk(0);
$po->stty_icrnl(0);
$hash->{PortObj} = $po; $hash->{PortObj} = $po;
$hash->{FD} = $po->FILENO; $hash->{FD} = $po->FILENO;
$hash->{DeviceName} = $dev; $hash->{DeviceName} = $dev;

View File

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