Skip to content

Commit

Permalink
no message
Browse files Browse the repository at this point in the history
  • Loading branch information
Nall-chan committed Aug 3, 2023
1 parent 4158999 commit 317c389
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
6 changes: 4 additions & 2 deletions ONVIF Discovery/module.php
Original file line number Diff line number Diff line change
Expand Up @@ -446,11 +446,13 @@ protected static function getProbeMatchXAddrs(DOMDocument $xmlDOMDoc, string $ip
$matches = array_merge($matches, explode(' ', $addrsNode->nodeValue));
}
}
$filtermatches = array_filter($matches, function (string $item) use ($ip) {
$filtermatches = array_filter($matches, function (string $item) use ($ip)
{
return strpos($item, $ip);
});
$filtermatches = array_values($filtermatches);
array_walk($filtermatches, function (string &$item) {
array_walk($filtermatches, function (string &$item)
{
$item = str_replace('/onvif/device_service', '', $item);
if (strpos($item, ':80', -3)) {
$item = substr($item, 0, -3);
Expand Down
11 changes: 9 additions & 2 deletions ONVIF IO/module.php
Original file line number Diff line number Diff line change
Expand Up @@ -2014,9 +2014,16 @@ private function SetRenewInterval(object $Result): void
$CurrentTime = DateTimeImmutable::createFromFormat(DATE_W3C, $Result->CurrentTime);
$TerminationTime = DateTimeImmutable::createFromFormat(DATE_W3C, $Result->TerminationTime);
$TimeDiff = $CurrentTime->diff($TerminationTime);
$this->TerminationTime = $TimeDiff->format('PT%iM%sS');
$this->SendDebug('TerminationTime', $this->TerminationTime, 0);
$Interval = $TerminationTime->getTimestamp() - $CurrentTime->getTimestamp() - 5;
if ($Interval < 5) { // Falls Gerät falsche Timestamps liefert ()
$this->TerminationTime = 'PT10S';
$Interval = 10;
} elseif ($Interval == 60) { // 1 Minute ist üblich, aber viele China Böller können kein XML-DateTime, sondern wollen immer PT60S.
$this->TerminationTime = 'PT60S';
} else {
$this->TerminationTime = $TimeDiff->format('PT%iM%sS');
}
$this->SendDebug('TerminationTime', $this->TerminationTime, 0);
$this->SendDebug('Renew Interval', $Interval, 0);
$this->SetTimerInterval('RenewSubscription', $Interval * 1000);
}
Expand Down

0 comments on commit 317c389

Please sign in to comment.