2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-13 03:05:34 +00:00

CUL shutdown procedure added

git-svn-id: https://svn.fhem.de/fhem/trunk@403 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2009-07-03 06:53:50 +00:00
parent 4b44680ecf
commit 0cabb36c04
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: USF1000S support for FHEM added (Boris 2009-06-20)
- 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 " .
"showtime:1,0 model:CUL,CUR loglevel:0,1,2,3,4,5,6 " .
"CUR_id_list";
$hash->{ShutdownFn} = "CUL_Shutdown";
}
#####################################
@ -155,10 +156,22 @@ CUL_Undef($$)
delete $defs{$d}{IODev};
}
}
CUL_SimpleWrite($hash, "X00"); # Switch reception off, it may hang up the CUL
$hash->{PortObj}->close() if($hash->{PortObj});
return undef;
}
#####################################
sub
CUL_Shutdown($)
{
my ($hash) = @_;
CUL_SimpleWrite($hash, "X00") if($hash->{VERSION} !~ m/CUR/);
return undef;
}
#####################################
sub
CUL_Set($@)

View File

@ -151,7 +151,7 @@ my %defaultattr; # Default attributes
my %intAt; # Internal at timer hash.
my $nextat; # Time when next timer will be triggered.
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 =
"where <name> is either:\n" .
"- a single device name\n" .
@ -908,6 +908,11 @@ CommandShutdown($$)
{
my ($cl, $param) = @_;
Log 0, "Server shutdown";
foreach my $d (sort keys %defs) {
CallFn($d, "ShutdownFn", $defs{$d});
}
WriteStatefile();
unlink($attr{global}{pidfilename}) if($attr{global}{pidfilename});
exit(0);