change define

This commit is contained in:
Marko Oldenburg 2017-12-19 11:52:19 +01:00
parent 7fc4a5d98c
commit f1b36d3322
2 changed files with 9 additions and 20 deletions

View File

@ -75,7 +75,7 @@ eval "use JSON;1" or $missingModul .= "JSON ";
my $modulversion = "4.0.7"; my $modulversion = "4.0.7";
my $flowsetversion = "4.0.11"; my $flowsetversion = "4.0.12";

View File

@ -59,7 +59,7 @@ eval "use JSON;1" or $missingModul .= "JSON ";
my $modulversion = "4.0.12"; my $modulversion = "4.0.12";
my $flowsetversion = "4.0.11"; my $flowsetversion = "4.0.12";
@ -120,6 +120,7 @@ sub AMADDevice_Initialize($) {
"setAPSSID ". "setAPSSID ".
"root:0,1 ". "root:0,1 ".
"disable:1 ". "disable:1 ".
"remoteServer:Automagic,Autoremote,TNES,other ".
$readingFnAttributes; $readingFnAttributes;
foreach my $d(sort keys %{$modules{AMADDevice}{defptr}}) { foreach my $d(sort keys %{$modules{AMADDevice}{defptr}}) {
@ -134,27 +135,15 @@ sub AMADDevice_Define($$) {
my ( $hash, $def ) = @_; my ( $hash, $def ) = @_;
my @a = split( "[ \t]+", $def ); my @a = split( "[ \t]+", $def );
splice( @a, 1, 1 );
my $iodev;
my $i = 0;
return "too few parameters: define <name> AMADDevice <HOST-IP> <amad_id> <remoteServer>" if( @a < 4 );
foreach my $param ( @a ) {
if( $param =~ m/IODev=([^\s]*)/ ) {
$iodev = $1;
splice( @a, $i, 3 );
last;
}
$i++;
}
return "too few parameters: define <name> AMADDevice <HOST-IP> <amad_id>" if( @a != 3 );
return "Cannot define a AMAD device. Perl modul $missingModul is missing." if ( $missingModul ); return "Cannot define a AMAD device. Perl modul $missingModul is missing." if ( $missingModul );
my ($name,$host,$amad_id) = @a; my $name = $a[0];
my $host = $a[2];
my $amad_id = $a[3];
my $$remoteServer = $a[4];
$hash->{HOST} = $host; $hash->{HOST} = $host;
$hash->{AMAD_ID} = $amad_id; $hash->{AMAD_ID} = $amad_id;