CUL shutdown procedure added

git-svn-id: svn://svn.code.sf.net/p/fhem/code/trunk@403 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig
2009-07-03 06:53:50 +00:00
parent 5d313d8422
commit 5e14bf08ba
3 changed files with 20 additions and 1 deletions

View File

@@ -508,3 +508,4 @@
- feature: CUL_EM generates an event for each of the READINGS - feature: CUL_EM generates an event for each of the READINGS
- feature: USF1000S support for FHEM added (Boris 2009-06-20) - feature: USF1000S support for FHEM added (Boris 2009-06-20)
- feature: CUL supports HMS (culfw >= 1.22 needed) - feature: CUL supports HMS (culfw >= 1.22 needed)
- feature: CUL shutdown procedure added

View File

@@ -70,6 +70,7 @@ CUL_Initialize($)
$hash->{AttrList}= "do_not_notify:1,0 dummy:1,0 filtertimeout repeater:1,0 " . $hash->{AttrList}= "do_not_notify:1,0 dummy:1,0 filtertimeout repeater:1,0 " .
"showtime:1,0 model:CUL,CUR loglevel:0,1,2,3,4,5,6 " . "showtime:1,0 model:CUL,CUR loglevel:0,1,2,3,4,5,6 " .
"CUR_id_list"; "CUR_id_list";
$hash->{ShutdownFn} = "CUL_Shutdown";
} }
##################################### #####################################
@@ -155,10 +156,22 @@ CUL_Undef($$)
delete $defs{$d}{IODev}; delete $defs{$d}{IODev};
} }
} }
CUL_SimpleWrite($hash, "X00"); # Switch reception off, it may hang up the CUL
$hash->{PortObj}->close() if($hash->{PortObj}); $hash->{PortObj}->close() if($hash->{PortObj});
return undef; return undef;
} }
#####################################
sub
CUL_Shutdown($)
{
my ($hash) = @_;
CUL_SimpleWrite($hash, "X00") if($hash->{VERSION} !~ m/CUR/);
return undef;
}
##################################### #####################################
sub sub
CUL_Set($@) CUL_Set($@)

View File

@@ -151,7 +151,7 @@ my %defaultattr; # Default attributes
my %intAt; # Internal at timer hash. my %intAt; # Internal at timer hash.
my $nextat; # Time when next timer will be triggered. my $nextat; # Time when next timer will be triggered.
my $intAtCnt=0; my $intAtCnt=0;
my $cvsid = '$Id: fhem.pl,v 1.73 2009-06-12 09:42:37 rudolfkoenig Exp $'; my $cvsid = '$Id: fhem.pl,v 1.74 2009-07-03 06:53:50 rudolfkoenig Exp $';
my $namedef = my $namedef =
"where <name> is either:\n" . "where <name> is either:\n" .
"- a single device name\n" . "- a single device name\n" .
@@ -908,6 +908,11 @@ CommandShutdown($$)
{ {
my ($cl, $param) = @_; my ($cl, $param) = @_;
Log 0, "Server shutdown"; Log 0, "Server shutdown";
foreach my $d (sort keys %defs) {
CallFn($d, "ShutdownFn", $defs{$d});
}
WriteStatefile(); WriteStatefile();
unlink($attr{global}{pidfilename}) if($attr{global}{pidfilename}); unlink($attr{global}{pidfilename}) if($attr{global}{pidfilename});
exit(0); exit(0);