49_SSCAM: fixed a problem that a usersession won't be destroyed if
a function couldn't be executed successfully git-svn-id: svn://svn.code.sf.net/p/fhem/code/trunk@10805 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
|
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
|
||||||
# Do not insert empty lines here, update check depends on it.
|
# Do not insert empty lines here, update check depends on it.
|
||||||
|
- bugfix 49_SSCAM: fixed a problem that a usersession won't be destroyed
|
||||||
|
if a function couldn't be executed successfully
|
||||||
- bugfix: 95_Dashboard: fixed javascript error because of changes
|
- bugfix: 95_Dashboard: fixed javascript error because of changes
|
||||||
in fhemweb
|
in fhemweb
|
||||||
- feature: 49_SSCAM: feature for retrieval snapfilename added
|
- feature: 49_SSCAM: feature for retrieval snapfilename added
|
||||||
|
|||||||
@@ -27,6 +27,8 @@
|
|||||||
##########################################################################################################
|
##########################################################################################################
|
||||||
# Versions History:
|
# Versions History:
|
||||||
#
|
#
|
||||||
|
# 1.13.1 12.02.2016 fixed a problem that a usersession won't be destroyed if a
|
||||||
|
# function couldn't be executed successfully
|
||||||
# 1.13 feature for retrieval snapfilename added
|
# 1.13 feature for retrieval snapfilename added
|
||||||
# 1.12.1 09.02.2016 bugfix: "goAbsPTZ" may be unavailable on Windows-systems
|
# 1.12.1 09.02.2016 bugfix: "goAbsPTZ" may be unavailable on Windows-systems
|
||||||
# 1.12 08.02.2016 added function "move" for continuous PTZ action
|
# 1.12 08.02.2016 added function "move" for continuous PTZ action
|
||||||
@@ -155,10 +157,10 @@ sub SSCam_Define {
|
|||||||
RemoveInternalTimer($hash); # alle Timer löschen
|
RemoveInternalTimer($hash); # alle Timer löschen
|
||||||
|
|
||||||
# Subroutine Watchdog-Timer starten (sollen Cam-Infos regelmäßig abgerufen werden ?), verzögerter zufälliger Start 0-60s
|
# Subroutine Watchdog-Timer starten (sollen Cam-Infos regelmäßig abgerufen werden ?), verzögerter zufälliger Start 0-60s
|
||||||
InternalTimer(gettimeofday()+int(srand(60)), "watchdogpollcaminfo", $hash, 0);
|
InternalTimer(gettimeofday()+int(rand(60)), "watchdogpollcaminfo", $hash, 0);
|
||||||
|
|
||||||
# initiale Rotinen nach Restart ausführen , verzögerter zufälliger Start
|
# initiale Rotinen nach Restart ausführen , verzögerter zufälliger Start
|
||||||
InternalTimer(gettimeofday()+int(srand(10)), "initonboot", $hash, 0);
|
InternalTimer(gettimeofday()+int(rand(10)), "initonboot", $hash, 0);
|
||||||
|
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
@@ -1221,19 +1223,21 @@ sub getapisites_nonbl {
|
|||||||
my $httptimeout;
|
my $httptimeout;
|
||||||
|
|
||||||
#### API-Pfade und MaxVersions ermitteln #####
|
#### API-Pfade und MaxVersions ermitteln #####
|
||||||
# Logausgabe
|
|
||||||
$logstr = "--- Begin Function getapisites nonblocking ---";
|
$logstr = "--- Begin Function getapisites nonblocking ---";
|
||||||
&printlog($hash,$logstr,"4");
|
&printlog($hash,$logstr,"4");
|
||||||
|
|
||||||
$httptimeout = $attr{$name}{httptimeout} ? $attr{$name}{httptimeout} : "4";
|
$httptimeout = $attr{$name}{httptimeout} ? $attr{$name}{httptimeout} : "4";
|
||||||
# Logausgabe
|
|
||||||
$logstr = "HTTP-Call will be done with httptimeout-Value: $httptimeout s";
|
$logstr = "HTTP-Call will be done with httptimeout-Value: $httptimeout s";
|
||||||
&printlog($hash,$logstr,"5");
|
&printlog($hash,$logstr,"5");
|
||||||
|
|
||||||
|
|
||||||
# URL zur Abfrage der Eigenschaften der API's
|
# URL zur Abfrage der Eigenschaften der API's
|
||||||
$url = "http://$serveraddr:$serverport/webapi/query.cgi?api=$apiinfo&method=Query&version=1&query=$apiauth,$apiextrec,$apicam,$apitakesnap,$apiptz,$apisvsinfo";
|
$url = "http://$serveraddr:$serverport/webapi/query.cgi?api=$apiinfo&method=Query&version=1&query=$apiauth,$apiextrec,$apicam,$apitakesnap,$apiptz,$apisvsinfo";
|
||||||
|
|
||||||
|
$logstr = "Call-Out now: $url";
|
||||||
|
&printlog($hash,$logstr,"4");
|
||||||
|
|
||||||
$param = {
|
$param = {
|
||||||
url => $url,
|
url => $url,
|
||||||
timeout => $httptimeout,
|
timeout => $httptimeout,
|
||||||
@@ -1243,7 +1247,6 @@ sub getapisites_nonbl {
|
|||||||
callback => \&login_nonbl
|
callback => \&login_nonbl
|
||||||
};
|
};
|
||||||
|
|
||||||
# API-Sites werden abgefragt und mit Routine "login_nonbl" verarbeitet
|
|
||||||
HttpUtils_NonblockingGet ($param);
|
HttpUtils_NonblockingGet ($param);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1300,13 +1303,8 @@ sub login_nonbl ($) {
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
elsif ($myjson ne "") # wenn die Abfrage erfolgreich war ($data enthält die Ergebnisdaten des HTTP Aufrufes)
|
elsif ($myjson ne "") # wenn die Abfrage erfolgreich war ($data enthält die Ergebnisdaten des HTTP Aufrufes)
|
||||||
{
|
{
|
||||||
$logstr = "URL-Call: ".$param->{url};
|
|
||||||
&printlog($hash,$logstr,"4");
|
|
||||||
|
|
||||||
# An dieser Stelle die Antwort parsen / verarbeiten mit $myjson
|
|
||||||
|
|
||||||
# Evaluiere ob Daten im JSON-Format empfangen wurden
|
# Evaluiere ob Daten im JSON-Format empfangen wurden
|
||||||
($hash, $success) = &evaljson($hash,$myjson,$param->{url});
|
($hash, $success) = &evaljson($hash,$myjson,$param->{url});
|
||||||
@@ -1445,7 +1443,7 @@ sub login_nonbl ($) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Login und SID ermitteln
|
# Login und SID ermitteln
|
||||||
# Logausgabe
|
|
||||||
$logstr = "--- Begin Function serverlogin nonblocking ---";
|
$logstr = "--- Begin Function serverlogin nonblocking ---";
|
||||||
&printlog($hash,$logstr,"4");
|
&printlog($hash,$logstr,"4");
|
||||||
|
|
||||||
@@ -1455,11 +1453,10 @@ sub login_nonbl ($) {
|
|||||||
|
|
||||||
$httptimeout = $attr{$name}{httptimeout} ? $attr{$name}{httptimeout} : "4";
|
$httptimeout = $attr{$name}{httptimeout} ? $attr{$name}{httptimeout} : "4";
|
||||||
|
|
||||||
# Logausgabe
|
|
||||||
$logstr = "HTTP-Call will be done with httptimeout-Value: $httptimeout s";
|
$logstr = "HTTP-Call will be done with httptimeout-Value: $httptimeout s";
|
||||||
&printlog($hash,$logstr,"5");
|
&printlog($hash,$logstr,"5");
|
||||||
|
|
||||||
if (defined(AttrVal($name, "session", undef)) and AttrVal($name, "session", undef) eq "SurveillanceStation") {
|
if (defined($attr{$name}{session}) and $attr{$name}{session} eq "SurveillanceStation") {
|
||||||
$url = "http://$serveraddr:$serverport/webapi/$apiauthpath?api=$apiauth&version=$apiauthmaxver&method=Login&account=$username&passwd=$password&session=SurveillanceStation&format=\"sid\"";
|
$url = "http://$serveraddr:$serverport/webapi/$apiauthpath?api=$apiauth&version=$apiauthmaxver&method=Login&account=$username&passwd=$password&session=SurveillanceStation&format=\"sid\"";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1467,6 +1464,9 @@ sub login_nonbl ($) {
|
|||||||
$url = "http://$serveraddr:$serverport/webapi/$apiauthpath?api=$apiauth&version=$apiauthmaxver&method=Login&account=$username&passwd=$password&format=\"sid\"";
|
$url = "http://$serveraddr:$serverport/webapi/$apiauthpath?api=$apiauth&version=$apiauthmaxver&method=Login&account=$username&passwd=$password&format=\"sid\"";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$logstr = "Call-Out now: $url";
|
||||||
|
&printlog($hash,$logstr,"4");
|
||||||
|
|
||||||
$param = {
|
$param = {
|
||||||
url => $url,
|
url => $url,
|
||||||
timeout => $httptimeout,
|
timeout => $httptimeout,
|
||||||
@@ -1522,20 +1522,15 @@ sub getcamid_nonbl ($) {
|
|||||||
}
|
}
|
||||||
elsif ($myjson ne "") # wenn die Abfrage erfolgreich war ($data enthält die Ergebnisdaten des HTTP Aufrufes)
|
elsif ($myjson ne "") # wenn die Abfrage erfolgreich war ($data enthält die Ergebnisdaten des HTTP Aufrufes)
|
||||||
{
|
{
|
||||||
$logstr = "URL-Call: ".$param->{url}; # Eintrag fürs Log
|
|
||||||
&printlog($hash,$logstr,"4");
|
|
||||||
|
|
||||||
# An dieser Stelle die Antwort parsen / verarbeiten mit $myjson
|
|
||||||
|
|
||||||
# Evaluiere ob Daten im JSON-Format empfangen wurden
|
# Evaluiere ob Daten im JSON-Format empfangen wurden
|
||||||
($hash, $success) = &evaljson($hash,$myjson,$param->{url});
|
($hash, $success) = &evaljson($hash,$myjson,$param->{url});
|
||||||
unless ($success) {$logstr = "Data returned: ".$myjson; &printlog($hash,$logstr,"4"); $hash->{HELPER}{ACTIVE} = "off"; return($hash,$success)};
|
unless ($success) {$logstr = "Data returned: ".$myjson; &printlog($hash,$logstr,"4"); $hash->{HELPER}{ACTIVE} = "off"; return($hash,$success);}
|
||||||
|
|
||||||
$data = decode_json($myjson);
|
$data = decode_json($myjson);
|
||||||
|
|
||||||
$success = $data->{'success'};
|
$success = $data->{'success'};
|
||||||
|
|
||||||
# Fall login war erfolgreich
|
# login war erfolgreich
|
||||||
if ($success)
|
if ($success)
|
||||||
{
|
{
|
||||||
# Logausgabe decodierte JSON Daten
|
# Logausgabe decodierte JSON Daten
|
||||||
@@ -1589,18 +1584,21 @@ sub getcamid_nonbl ($) {
|
|||||||
|
|
||||||
|
|
||||||
# die Kamera-Id wird aus dem Kameranamen (Surveillance Station) ermittelt und mit Routine "camop_nonbl" verarbeitet
|
# die Kamera-Id wird aus dem Kameranamen (Surveillance Station) ermittelt und mit Routine "camop_nonbl" verarbeitet
|
||||||
# Logausgabe
|
|
||||||
$logstr = "--- Begin Function getcamid nonblocking ---";
|
$logstr = "--- Begin Function getcamid nonblocking ---";
|
||||||
&printlog($hash,$logstr,"4");
|
&printlog($hash,$logstr,"4");
|
||||||
|
|
||||||
$httptimeout = $attr{$name}{httptimeout} ? $attr{$name}{httptimeout} : "4";
|
$httptimeout = $attr{$name}{httptimeout} ? $attr{$name}{httptimeout} : "4";
|
||||||
# Logausgabe
|
|
||||||
$logstr = "HTTP-Call will be done with httptimeout-Value: $httptimeout s";
|
$logstr = "HTTP-Call will be done with httptimeout-Value: $httptimeout s";
|
||||||
&printlog($hash,$logstr,"5");
|
&printlog($hash,$logstr,"5");
|
||||||
|
|
||||||
# einlesen aller Kameras - Auswertung in Rückkehrfunktion "camop_nonbl"
|
# einlesen aller Kameras - Auswertung in Rückkehrfunktion "camop_nonbl"
|
||||||
$url = "http://$serveraddr:$serverport/webapi/$apicampath?api=$apicam&version=$apicammaxver&method=List&basic=true&streamInfo=true&camStm=true&_sid=\"$sid\"";
|
$url = "http://$serveraddr:$serverport/webapi/$apicampath?api=$apicam&version=$apicammaxver&method=List&basic=true&streamInfo=true&camStm=true&_sid=\"$sid\"";
|
||||||
|
|
||||||
|
$logstr = "Call-Out now: $url";
|
||||||
|
&printlog($hash,$logstr,"4");
|
||||||
|
|
||||||
$param = {
|
$param = {
|
||||||
url => $url,
|
url => $url,
|
||||||
timeout => $httptimeout,
|
timeout => $httptimeout,
|
||||||
@@ -1669,19 +1667,14 @@ sub camop_nonbl ($) {
|
|||||||
|
|
||||||
readingsSingleUpdate($hash, "Error", $err, 1); # Readings erzeugen
|
readingsSingleUpdate($hash, "Error", $err, 1); # Readings erzeugen
|
||||||
|
|
||||||
# ausgeführte Funktion ist abgebrochen, Freigabe Funktionstoken
|
return (logout_nonbl($hash));
|
||||||
$hash->{HELPER}{ACTIVE} = "off";
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
elsif ($myjson ne "") # wenn die Abfrage erfolgreich war ($data enthält die Ergebnisdaten des HTTP Aufrufes)
|
elsif ($myjson ne "") # wenn die Abfrage erfolgreich war ($data enthält die Ergebnisdaten des HTTP Aufrufes)
|
||||||
{
|
{
|
||||||
$logstr = "URL-Call: ".$param->{url};
|
|
||||||
&printlog($hash,$logstr,"4");
|
|
||||||
|
|
||||||
# Evaluiere ob Daten im JSON-Format empfangen wurden, Achtung: sehr viele Daten mit verbose=5
|
# Evaluiere ob Daten im JSON-Format empfangen wurden, Achtung: sehr viele Daten mit verbose=5
|
||||||
($hash, $success) = &evaljson($hash,$myjson,$param->{url});
|
($hash, $success) = &evaljson($hash,$myjson,$param->{url});
|
||||||
unless ($success) {$logstr = "Data returned: ".$myjson; &printlog($hash,$logstr,"4"); $hash->{HELPER}{ACTIVE} = "off"; return($hash,$success)};
|
unless ($success) {$logstr = "Data returned: ".$myjson; &printlog($hash,$logstr,"4"); $hash->{HELPER}{ACTIVE} = "off"; return (logout_nonbl($hash));}
|
||||||
|
|
||||||
$data = decode_json($myjson);
|
$data = decode_json($myjson);
|
||||||
|
|
||||||
@@ -1735,10 +1728,7 @@ sub camop_nonbl ($) {
|
|||||||
$logstr = "--- End Function getcamid nonblocking with error ---";
|
$logstr = "--- End Function getcamid nonblocking with error ---";
|
||||||
&printlog($hash,$logstr,"4");
|
&printlog($hash,$logstr,"4");
|
||||||
|
|
||||||
# ausgeführte Funktion ist abgebrochen, Freigabe Funktionstoken
|
return (logout_nonbl($hash));
|
||||||
$hash->{HELPER}{ACTIVE} = "off";
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1755,24 +1745,19 @@ sub camop_nonbl ($) {
|
|||||||
readingsBulkUpdate($hash,"Error",$error);
|
readingsBulkUpdate($hash,"Error",$error);
|
||||||
readingsEndUpdate($hash, 1);
|
readingsEndUpdate($hash, 1);
|
||||||
|
|
||||||
# Logausgabe
|
|
||||||
$logstr = "ERROR - ID of Camera $camname couldn't be selected. Errorcode: $errorcode - $error";
|
$logstr = "ERROR - ID of Camera $camname couldn't be selected. Errorcode: $errorcode - $error";
|
||||||
&printlog($hash,$logstr,"1");
|
&printlog($hash,$logstr,"1");
|
||||||
$logstr = "--- End Function getcamid nonblocking with error ---";
|
$logstr = "--- End Function getcamid nonblocking with error ---";
|
||||||
&printlog($hash,$logstr,"4");
|
&printlog($hash,$logstr,"4");
|
||||||
|
|
||||||
# ausgeführte Funktion ist abgebrochen, Freigabe Funktionstoken
|
return (logout_nonbl($hash));
|
||||||
$hash->{HELPER}{ACTIVE} = "off";
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Logausgabe
|
|
||||||
$logstr = "--- Begin Function cam: $OpMode nonblocking ---";
|
$logstr = "--- Begin Function cam: $OpMode nonblocking ---";
|
||||||
&printlog($hash,$logstr,"4");
|
&printlog($hash,$logstr,"4");
|
||||||
|
|
||||||
$httptimeout = $attr{$name}{httptimeout} ? $attr{$name}{httptimeout} : "4";
|
$httptimeout = $attr{$name}{httptimeout} ? $attr{$name}{httptimeout} : "4";
|
||||||
# Logausgabe
|
|
||||||
$logstr = "HTTP-Call will be done with httptimeout-Value: $httptimeout s";
|
$logstr = "HTTP-Call will be done with httptimeout-Value: $httptimeout s";
|
||||||
&printlog($hash,$logstr,"5");
|
&printlog($hash,$logstr,"5");
|
||||||
|
|
||||||
@@ -1859,6 +1844,9 @@ sub camop_nonbl ($) {
|
|||||||
$url = "http://$serveraddr:$serverport/webapi/$apicampath?api=\"$apicam\"&version=\"$apicammaxver\"&method=\"SaveOptimizeParam\"&cameraIds=\"$camid\"&expMode=2&camParamChkList=1&_sid=\"$sid\"";
|
$url = "http://$serveraddr:$serverport/webapi/$apicampath?api=\"$apicam\"&version=\"$apicammaxver\"&method=\"SaveOptimizeParam\"&cameraIds=\"$camid\"&expMode=2&camParamChkList=1&_sid=\"$sid\"";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$logstr = "Call-Out now: $url";
|
||||||
|
&printlog($hash,$logstr,"4");
|
||||||
|
|
||||||
$param = {
|
$param = {
|
||||||
url => $url,
|
url => $url,
|
||||||
timeout => $httptimeout,
|
timeout => $httptimeout,
|
||||||
@@ -1921,8 +1909,6 @@ sub camret_nonbl ($) {
|
|||||||
$rectime = AttrVal($name, "rectime",undef) ? AttrVal($name, "rectime",undef) : $hash->{HELPER}{RECTIME_DEF};
|
$rectime = AttrVal($name, "rectime",undef) ? AttrVal($name, "rectime",undef) : $hash->{HELPER}{RECTIME_DEF};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Verarbeitung der asynchronen Rückkehrdaten aus sub "camop_nonbl"
|
|
||||||
if ($err ne "") # wenn ein Fehler bei der HTTP Abfrage aufgetreten ist
|
if ($err ne "") # wenn ein Fehler bei der HTTP Abfrage aufgetreten ist
|
||||||
{
|
{
|
||||||
$logstr = "error while requesting ".$param->{url}." - $err";
|
$logstr = "error while requesting ".$param->{url}." - $err";
|
||||||
@@ -1932,21 +1918,13 @@ sub camret_nonbl ($) {
|
|||||||
|
|
||||||
readingsSingleUpdate($hash, "Error", $err, 1); # Readings erzeugen
|
readingsSingleUpdate($hash, "Error", $err, 1); # Readings erzeugen
|
||||||
|
|
||||||
# ausgeführte Funktion ist abgebrochen, Freigabe Funktionstoken
|
return (logout_nonbl($hash));
|
||||||
$hash->{HELPER}{ACTIVE} = "off";
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
elsif ($myjson ne "") # wenn die Abfrage erfolgreich war ($data enthält die Ergebnisdaten des HTTP Aufrufes)
|
elsif ($myjson ne "") # wenn die Abfrage erfolgreich war ($data enthält die Ergebnisdaten des HTTP Aufrufes)
|
||||||
{
|
{
|
||||||
$logstr = "URL-Call: ".$param->{url};
|
|
||||||
&printlog($hash,$logstr,"4");
|
|
||||||
|
|
||||||
# An dieser Stelle die Antwort parsen / verarbeiten mit $myjson
|
|
||||||
|
|
||||||
# Evaluiere ob Daten im JSON-Format empfangen wurden
|
# Evaluiere ob Daten im JSON-Format empfangen wurden
|
||||||
($hash, $success) = &evaljson($hash,$myjson,$param->{url});
|
($hash, $success) = &evaljson($hash,$myjson,$param->{url});
|
||||||
unless ($success) {$logstr = "Data returned: ".$myjson; &printlog($hash,$logstr,"4"); $hash->{HELPER}{ACTIVE} = "off"; return($hash,$success)};
|
unless ($success) {$logstr = "Data returned: ".$myjson; &printlog($hash,$logstr,"4"); $hash->{HELPER}{ACTIVE} = "off"; return (logout_nonbl($hash));}
|
||||||
|
|
||||||
$data = decode_json($myjson);
|
$data = decode_json($myjson);
|
||||||
|
|
||||||
@@ -2560,18 +2538,40 @@ sub camret_nonbl ($) {
|
|||||||
&printlog($hash,$logstr,"4");
|
&printlog($hash,$logstr,"4");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return (logout_nonbl($hash));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
###################################################################################
|
||||||
|
#### Funktion logout
|
||||||
|
|
||||||
|
sub logout_nonbl ($) {
|
||||||
|
my ($hash) = @_;
|
||||||
|
my $name = $hash->{NAME};
|
||||||
|
my $serveraddr = $hash->{SERVERADDR};
|
||||||
|
my $serverport = $hash->{SERVERPORT};
|
||||||
|
my $apiauth = $hash->{HELPER}{APIAUTH};
|
||||||
|
my $apiauthpath = $hash->{HELPER}{APIAUTHPATH};
|
||||||
|
my $apiauthmaxver = $hash->{HELPER}{APIAUTHMAXVER};
|
||||||
|
my $sid = $hash->{HELPER}{SID};
|
||||||
|
my $url;
|
||||||
|
my $param;
|
||||||
|
my $logstr;
|
||||||
|
my $httptimeout;
|
||||||
|
|
||||||
|
# logout wird ausgeführt, Rückkehr wird mit "logoutret_nonbl" verarbeitet
|
||||||
|
|
||||||
# logout wird ausgeführt, Rückkehr wird mit "logout_nonbl" verarbeitet
|
|
||||||
# Logausgabe
|
|
||||||
$logstr = "--- Begin Function logout nonblocking ---";
|
$logstr = "--- Begin Function logout nonblocking ---";
|
||||||
&printlog($hash,$logstr,"4");
|
&printlog($hash,$logstr,"4");
|
||||||
|
|
||||||
$httptimeout = $attr{$name}{httptimeout} ? $attr{$name}{httptimeout} : "4";
|
$httptimeout = $attr{$name}{httptimeout} ? $attr{$name}{httptimeout} : "4";
|
||||||
# Logausgabe
|
|
||||||
$logstr = "HTTP-Call will be done with httptimeout-Value: $httptimeout s";
|
$logstr = "HTTP-Call will be done with httptimeout-Value: $httptimeout s";
|
||||||
&printlog($hash,$logstr,"5");
|
&printlog($hash,$logstr,"5");
|
||||||
|
|
||||||
if (defined(AttrVal($name, "session", undef)) and AttrVal($name, "session", undef) eq "SurveillanceStation") {
|
if (defined($attr{$name}{session}) and $attr{$name}{session} eq "SurveillanceStation") {
|
||||||
$url = "http://$serveraddr:$serverport/webapi/$apiauthpath?api=$apiauth&version=$apiauthmaxver&method=Logout&session=SurveillanceStation&_sid=$sid";
|
$url = "http://$serveraddr:$serverport/webapi/$apiauthpath?api=$apiauth&version=$apiauthmaxver&method=Logout&session=SurveillanceStation&_sid=$sid";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -2585,19 +2585,18 @@ sub camret_nonbl ($) {
|
|||||||
hash => $hash,
|
hash => $hash,
|
||||||
method => "GET",
|
method => "GET",
|
||||||
header => "Accept: application/json",
|
header => "Accept: application/json",
|
||||||
callback => \&logout_nonbl
|
callback => \&logoutret_nonbl
|
||||||
};
|
};
|
||||||
|
|
||||||
HttpUtils_NonblockingGet ($param);
|
HttpUtils_NonblockingGet ($param);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
###################################################################################
|
###################################################################################
|
||||||
#### Rückkehr aus Funktion camret_nonbl,
|
#### Rückkehr aus Funktion logout_nonbl,
|
||||||
#### check Funktion logout
|
#### check Funktion logout
|
||||||
|
|
||||||
sub logout_nonbl ($) {
|
sub logoutret_nonbl ($) {
|
||||||
my ($param, $err, $myjson) = @_;
|
my ($param, $err, $myjson) = @_;
|
||||||
my $hash = $param->{hash};
|
my $hash = $param->{hash};
|
||||||
my $sid = $hash->{HELPER}{SID};
|
my $sid = $hash->{HELPER}{SID};
|
||||||
@@ -2669,13 +2668,13 @@ sub logout_nonbl ($) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# ausgeführte Funktion ist erledigt (auch wenn logout nicht erfolgreich), Freigabe Funktionstoken
|
# ausgeführte Funktion ist erledigt (auch wenn logout nicht erfolgreich), Freigabe Funktionstoken
|
||||||
$hash->{HELPER}{ACTIVE} = "off";
|
$hash->{HELPER}{ACTIVE} = "off";
|
||||||
|
|
||||||
# nach Snap Aufnahme Filename des Snaps ermitteln
|
# nach Snap Aufnahme Filename des Snaps ermitteln
|
||||||
if ($OpMode eq "Snap") {
|
if ($OpMode eq "Snap") {
|
||||||
return (getsnapfilename($hash));
|
return (getsnapfilename($hash));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user