49_SSCam(STRM): avoid possible warnings during FHEM shutdown/restart

git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@22600 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
nasseeder1 2020-08-14 19:22:36 +00:00
parent 50e7441e5b
commit 63acb45bd7
2 changed files with 75 additions and 61 deletions

View File

@ -463,10 +463,11 @@ my %sdswfn = ( # Fun
); );
# Standardvariablen und Forward-Deklaration # Standardvariablen und Forward-Deklaration
my $defSlim = 3; # default Anzahl der abzurufenden Schnappschüsse mit snapGallery my $defSlim = 3; # default Anzahl der abzurufenden Schnappschüsse mit snapGallery
my $defSnum = "1,2,3,4,5,6,7,8,9,10"; # mögliche Anzahl der abzurufenden Schnappschüsse mit snapGallery my $defSnum = "1,2,3,4,5,6,7,8,9,10"; # mögliche Anzahl der abzurufenden Schnappschüsse mit snapGallery
my $compstat = "8.2.8"; # getestete SVS-Version my $compstat = "8.2.8"; # getestete SVS-Version
my $valZoom = ".++,+,stop,-,--."; # Inhalt des Setters "setZoom" my $valZoom = ".++,+,stop,-,--."; # Inhalt des Setters "setZoom"
my $shutdownInProcess = 0; # Statusbit shutdown
#use vars qw($FW_ME); # webname (default is fhem), used by 97_GROUP/weblink #use vars qw($FW_ME); # webname (default is fhem), used by 97_GROUP/weblink
#use vars qw($FW_subdir); # Sub-path in URL, used by FLOORPLAN/weblink #use vars qw($FW_subdir); # Sub-path in URL, used by FLOORPLAN/weblink
@ -794,6 +795,8 @@ sub delayedShutdown {
my $hash = shift; my $hash = shift;
my $name = $hash->{NAME}; my $name = $hash->{NAME};
$shutdownInProcess = 1; # Statusbit shutdown setzen -> getApiSites wird nicht mehr ausgeführt
Log3($name, 2, "$name - Quit session due to shutdown ..."); Log3($name, 2, "$name - Quit session due to shutdown ...");
sessionOff($hash); sessionOff($hash);
@ -4109,14 +4112,14 @@ sub sessionOff {
my $camname = $hash->{CAMNAME}; my $camname = $hash->{CAMNAME};
my $name = $hash->{NAME}; my $name = $hash->{NAME};
RemoveInternalTimer($hash, "FHEM::SSCam::sessionOff"); RemoveInternalTimer ($hash, "FHEM::SSCam::sessionOff");
return if(IsDisabled($name)); return if(IsDisabled($name));
if ($hash->{HELPER}{ACTIVE} eq "off") { if ($hash->{HELPER}{ACTIVE} eq "off") {
$hash->{OPMODE} = "logout"; $hash->{OPMODE} = "logout";
setActiveToken($hash); setActiveToken($hash);
logout($hash); logout ($hash);
} else { } else {
InternalTimer(gettimeofday()+1.1, "FHEM::SSCam::sessionOff", $hash, 0); InternalTimer(gettimeofday()+1.1, "FHEM::SSCam::sessionOff", $hash, 0);
@ -4355,29 +4358,29 @@ return;
####### Begin Kameraoperationen mit NonblockingGet (nicht blockierender HTTP-Call) ####### ####### Begin Kameraoperationen mit NonblockingGet (nicht blockierender HTTP-Call) #######
############################################################################################################################# #############################################################################################################################
sub getApiSites { sub getApiSites {
my ($hash) = @_; my $hash = shift;
my $serveraddr = $hash->{SERVERADDR}; my $serveraddr = $hash->{SERVERADDR};
my $serverport = $hash->{SERVERPORT}; my $serverport = $hash->{SERVERPORT};
my $name = $hash->{NAME}; my $name = $hash->{NAME};
my $apiinfo = $hash->{HELPER}{APIINFO}; # Info-Seite für alle API's, einzige statische Seite ! my $apiinfo = $hash->{HELPER}{APIINFO}; # Info-Seite für alle API's, einzige statische Seite !
my $apiauth = $hash->{HELPER}{APIAUTH}; my $apiauth = $hash->{HELPER}{APIAUTH};
my $apiextrec = $hash->{HELPER}{APIEXTREC}; my $apiextrec = $hash->{HELPER}{APIEXTREC};
my $apiextevt = $hash->{HELPER}{APIEXTEVT}; my $apiextevt = $hash->{HELPER}{APIEXTEVT};
my $apicam = $hash->{HELPER}{APICAM}; my $apicam = $hash->{HELPER}{APICAM};
my $apitakesnap = $hash->{HELPER}{APISNAPSHOT}; my $apitakesnap = $hash->{HELPER}{APISNAPSHOT};
my $apiptz = $hash->{HELPER}{APIPTZ}; my $apiptz = $hash->{HELPER}{APIPTZ};
my $apipreset = $hash->{HELPER}{APIPRESET}; my $apipreset = $hash->{HELPER}{APIPRESET};
my $apisvsinfo = $hash->{HELPER}{APISVSINFO}; my $apisvsinfo = $hash->{HELPER}{APISVSINFO};
my $apicamevent = $hash->{HELPER}{APICAMEVENT}; my $apicamevent = $hash->{HELPER}{APICAMEVENT};
my $apievent = $hash->{HELPER}{APIEVENT}; my $apievent = $hash->{HELPER}{APIEVENT};
my $apivideostm = $hash->{HELPER}{APIVIDEOSTM}; my $apivideostm = $hash->{HELPER}{APIVIDEOSTM};
my $apiaudiostm = $hash->{HELPER}{APIAUDIOSTM}; my $apiaudiostm = $hash->{HELPER}{APIAUDIOSTM};
my $apivideostms = $hash->{HELPER}{APIVIDEOSTMS}; my $apivideostms = $hash->{HELPER}{APIVIDEOSTMS};
my $apistm = $hash->{HELPER}{APISTM}; my $apistm = $hash->{HELPER}{APISTM};
my $apihm = $hash->{HELPER}{APIHM}; my $apihm = $hash->{HELPER}{APIHM};
my $apilog = $hash->{HELPER}{APILOG}; my $apilog = $hash->{HELPER}{APILOG};
my $apirec = $hash->{HELPER}{APIREC}; my $apirec = $hash->{HELPER}{APIREC};
my $proto = $hash->{PROTOCOL}; my $proto = $hash->{PROTOCOL};
my $url; my $url;
my $param; my $param;
@ -4387,8 +4390,12 @@ sub getApiSites {
Log3($name, 4, "$name - ####################################################"); Log3($name, 4, "$name - ####################################################");
Log3($name, 4, "$name - --- Begin Function getApiSites nonblocking ---"); Log3($name, 4, "$name - --- Begin Function getApiSites nonblocking ---");
if ($hash->{HELPER}{APIPARSET}) { if ($shutdownInProcess) { # shutdown in Proces -> keine weiteren Aktionen
# API-Hashwerte sind bereits gesetzt -> Abruf überspringen Log3($name, 3, "$name - Shutdown in process. No more activities allowed.");
return;
}
if ($hash->{HELPER}{APIPARSET}) { # API-Hashwerte sind bereits gesetzt -> Abruf überspringen
Log3($name, 4, "$name - API hashvalues already set - ignore get apisites"); Log3($name, 4, "$name - API hashvalues already set - ignore get apisites");
return checkSid($hash); return checkSid($hash);
} }

View File

@ -213,7 +213,7 @@ my %vNotesIntern = (
# Versions History extern # Versions History extern
my %vNotesExtern = ( my %vNotesExtern = (
"9.6.0" => "12.08.2020 The new attribute 'ptzNoCapPrePat' is available. It's helpfull if your PTZ camera doesn't have the capability ". "9.6.0" => "12.08.2020 The new attribute 'ptzNoCapPrePat' is available. It's helpful if your PTZ camera doesn't have the capability ".
"to deliver Presets and Patrols. Setting the attribute avoid error log messages in that case. ", "to deliver Presets and Patrols. Setting the attribute avoid error log messages in that case. ",
"9.5.0" => "15.07.2020 A new type 'master' supplements the possible createStreamDev command options. The streaming type ". "9.5.0" => "15.07.2020 A new type 'master' supplements the possible createStreamDev command options. The streaming type ".
"'master' cannot play back streams itself, but opens up new possibilities by flexibly accepting streams from ". "'master' cannot play back streams itself, but opens up new possibilities by flexibly accepting streams from ".
@ -463,10 +463,11 @@ my %sdswfn = ( # Fun
); );
# Standardvariablen und Forward-Deklaration # Standardvariablen und Forward-Deklaration
my $defSlim = 3; # default Anzahl der abzurufenden Schnappschüsse mit snapGallery my $defSlim = 3; # default Anzahl der abzurufenden Schnappschüsse mit snapGallery
my $defSnum = "1,2,3,4,5,6,7,8,9,10"; # mögliche Anzahl der abzurufenden Schnappschüsse mit snapGallery my $defSnum = "1,2,3,4,5,6,7,8,9,10"; # mögliche Anzahl der abzurufenden Schnappschüsse mit snapGallery
my $compstat = "8.2.8"; # getestete SVS-Version my $compstat = "8.2.8"; # getestete SVS-Version
my $valZoom = ".++,+,stop,-,--."; # Inhalt des Setters "setZoom" my $valZoom = ".++,+,stop,-,--."; # Inhalt des Setters "setZoom"
my $shutdownInProcess = 0; # Statusbit shutdown
#use vars qw($FW_ME); # webname (default is fhem), used by 97_GROUP/weblink #use vars qw($FW_ME); # webname (default is fhem), used by 97_GROUP/weblink
#use vars qw($FW_subdir); # Sub-path in URL, used by FLOORPLAN/weblink #use vars qw($FW_subdir); # Sub-path in URL, used by FLOORPLAN/weblink
@ -794,6 +795,8 @@ sub delayedShutdown {
my $hash = shift; my $hash = shift;
my $name = $hash->{NAME}; my $name = $hash->{NAME};
$shutdownInProcess = 1; # Statusbit shutdown setzen -> getApiSites wird nicht mehr ausgeführt
Log3($name, 2, "$name - Quit session due to shutdown ..."); Log3($name, 2, "$name - Quit session due to shutdown ...");
sessionOff($hash); sessionOff($hash);
@ -4109,14 +4112,14 @@ sub sessionOff {
my $camname = $hash->{CAMNAME}; my $camname = $hash->{CAMNAME};
my $name = $hash->{NAME}; my $name = $hash->{NAME};
RemoveInternalTimer($hash, "FHEM::SSCam::sessionOff"); RemoveInternalTimer ($hash, "FHEM::SSCam::sessionOff");
return if(IsDisabled($name)); return if(IsDisabled($name));
if ($hash->{HELPER}{ACTIVE} eq "off") { if ($hash->{HELPER}{ACTIVE} eq "off") {
$hash->{OPMODE} = "logout"; $hash->{OPMODE} = "logout";
setActiveToken($hash); setActiveToken($hash);
logout($hash); logout ($hash);
} else { } else {
InternalTimer(gettimeofday()+1.1, "FHEM::SSCam::sessionOff", $hash, 0); InternalTimer(gettimeofday()+1.1, "FHEM::SSCam::sessionOff", $hash, 0);
@ -4355,29 +4358,29 @@ return;
####### Begin Kameraoperationen mit NonblockingGet (nicht blockierender HTTP-Call) ####### ####### Begin Kameraoperationen mit NonblockingGet (nicht blockierender HTTP-Call) #######
############################################################################################################################# #############################################################################################################################
sub getApiSites { sub getApiSites {
my ($hash) = @_; my $hash = shift;
my $serveraddr = $hash->{SERVERADDR}; my $serveraddr = $hash->{SERVERADDR};
my $serverport = $hash->{SERVERPORT}; my $serverport = $hash->{SERVERPORT};
my $name = $hash->{NAME}; my $name = $hash->{NAME};
my $apiinfo = $hash->{HELPER}{APIINFO}; # Info-Seite für alle API's, einzige statische Seite ! my $apiinfo = $hash->{HELPER}{APIINFO}; # Info-Seite für alle API's, einzige statische Seite !
my $apiauth = $hash->{HELPER}{APIAUTH}; my $apiauth = $hash->{HELPER}{APIAUTH};
my $apiextrec = $hash->{HELPER}{APIEXTREC}; my $apiextrec = $hash->{HELPER}{APIEXTREC};
my $apiextevt = $hash->{HELPER}{APIEXTEVT}; my $apiextevt = $hash->{HELPER}{APIEXTEVT};
my $apicam = $hash->{HELPER}{APICAM}; my $apicam = $hash->{HELPER}{APICAM};
my $apitakesnap = $hash->{HELPER}{APISNAPSHOT}; my $apitakesnap = $hash->{HELPER}{APISNAPSHOT};
my $apiptz = $hash->{HELPER}{APIPTZ}; my $apiptz = $hash->{HELPER}{APIPTZ};
my $apipreset = $hash->{HELPER}{APIPRESET}; my $apipreset = $hash->{HELPER}{APIPRESET};
my $apisvsinfo = $hash->{HELPER}{APISVSINFO}; my $apisvsinfo = $hash->{HELPER}{APISVSINFO};
my $apicamevent = $hash->{HELPER}{APICAMEVENT}; my $apicamevent = $hash->{HELPER}{APICAMEVENT};
my $apievent = $hash->{HELPER}{APIEVENT}; my $apievent = $hash->{HELPER}{APIEVENT};
my $apivideostm = $hash->{HELPER}{APIVIDEOSTM}; my $apivideostm = $hash->{HELPER}{APIVIDEOSTM};
my $apiaudiostm = $hash->{HELPER}{APIAUDIOSTM}; my $apiaudiostm = $hash->{HELPER}{APIAUDIOSTM};
my $apivideostms = $hash->{HELPER}{APIVIDEOSTMS}; my $apivideostms = $hash->{HELPER}{APIVIDEOSTMS};
my $apistm = $hash->{HELPER}{APISTM}; my $apistm = $hash->{HELPER}{APISTM};
my $apihm = $hash->{HELPER}{APIHM}; my $apihm = $hash->{HELPER}{APIHM};
my $apilog = $hash->{HELPER}{APILOG}; my $apilog = $hash->{HELPER}{APILOG};
my $apirec = $hash->{HELPER}{APIREC}; my $apirec = $hash->{HELPER}{APIREC};
my $proto = $hash->{PROTOCOL}; my $proto = $hash->{PROTOCOL};
my $url; my $url;
my $param; my $param;
@ -4387,8 +4390,12 @@ sub getApiSites {
Log3($name, 4, "$name - ####################################################"); Log3($name, 4, "$name - ####################################################");
Log3($name, 4, "$name - --- Begin Function getApiSites nonblocking ---"); Log3($name, 4, "$name - --- Begin Function getApiSites nonblocking ---");
if ($hash->{HELPER}{APIPARSET}) { if ($shutdownInProcess) { # shutdown in Proces -> keine weiteren Aktionen
# API-Hashwerte sind bereits gesetzt -> Abruf überspringen Log3($name, 3, "$name - Shutdown in process. No more activities allowed.");
return;
}
if ($hash->{HELPER}{APIPARSET}) { # API-Hashwerte sind bereits gesetzt -> Abruf überspringen
Log3($name, 4, "$name - API hashvalues already set - ignore get apisites"); Log3($name, 4, "$name - API hashvalues already set - ignore get apisites");
return checkSid($hash); return checkSid($hash);
} }