Skip to content

Commit

Permalink
no message
Browse files Browse the repository at this point in the history
  • Loading branch information
Nall-chan committed Jul 22, 2023
1 parent 65cb71f commit 6285202
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 13 deletions.
4 changes: 3 additions & 1 deletion ONVIF Discovery/module.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ protected function GetConfigurationValues()
$IO = IPS_GetInstance($InstanceIDConfigurator)['ConnectionID'];
if ($IO > 0) {
$DevicesAddress[$InstanceIDConfigurator] = str_replace('/onvif/device_service', '', IPS_GetProperty($IO, 'Address'));
$DevicesAddress[$InstanceIDConfigurator] = str_replace(':80', '', $DevicesAddress[$InstanceIDConfigurator]);
}
}
$Devices = $this->Devices;
Expand Down Expand Up @@ -447,8 +448,9 @@ protected static function getProbeMatchXAddrs($xmlDOMDoc, $ip)
array_walk($filtermatches, function (&$item)
{
$item = str_replace('/onvif/device_service', '', $item);
$item = str_replace(':80', '', $item);
});
return $filtermatches; //array_values($filtermatches);
return $filtermatches;
}

/**
Expand Down
2 changes: 2 additions & 0 deletions ONVIF IO/locale.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@
"Manufacturer: ": "Hersteller: ",
"Serial number: ": "Seriennummer: ",
"Supported ONVIF Profile: ": "Unterstützte ONVIF Profile: ",
"Used event handling: ": "Genutzte Ereignis Verarbeitung: ",
"none": "keins",
"supported": "unterstützt",
"not supported": "nicht unterstützt",
"Videosources: ": "Videoquellen: ",
Expand Down
31 changes: 19 additions & 12 deletions ONVIF IO/module.php
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,11 @@ public function RequestAction($Ident, $Value)
{
switch ($Ident) {
case 'Subscribe':
return $this->Subscribe();
if ($this->Subscribe()) {
return;
}
// WSSubscription failed, try PullPointSubscription
// No break. Add additional comment above this line if intentional
case 'CreatePullPointSubscription':
return $this->CreatePullPointSubscription();
case 'PullMessages':
Expand Down Expand Up @@ -626,7 +630,7 @@ protected function GetDeviceDataForForm()
if ($Device) {
$InfoItems = [
[
'width' => '400px',
'width' => '450px',
'type' => 'Label',
'caption' => 'Model: ' . $Device['Model']
],
Expand All @@ -645,12 +649,16 @@ protected function GetDeviceDataForForm()
];
}
$this->lock('Profile');
$InfoItems[] =
[
'width' => '400px',
'type' => 'Label',
'caption' => $this->Translate('Supported ONVIF Profile: ') . $this->Profile->toString()
];
$InfoItems[] = [
'width' => '450px',
'type' => 'Label',
'caption' => $this->Translate('Supported ONVIF Profile: ') . $this->Profile->toString()
];
$InfoItems[] = [
'type' => 'Label',
'caption' => $this->Translate('Used event handling: ') . ($this->GetTimerInterval('RenewSubscription') ? 'WS-BaseNotification' : ($this->GetTimerInterval('PullMessages') ? 'PullPoint' : $this->Translate('none')))
];

$this->unlock('Profile');
$DeviceItems = [
[
Expand Down Expand Up @@ -858,15 +866,16 @@ protected function Subscribe()
'ConsumerReference' => [
'Address' => $this->ReadAttributeString('ConsumerAddress')
],
'InitialTerminationTime' => 'PT1M'
'InitialTerminationTime' => 'PT60S'
];
$Response = '';
$this->WaitForFirstEvent = true;
$SubscribeResult = $this->SendData($XAddr[\ONVIF\NS::Event], \ONVIF\WSDL::Event, 'Subscribe', true, $Params, $Response);
if (is_a($SubscribeResult, 'SoapFault')) {
$this->SetStatus(IS_EBASE + 3);
/*$this->SetStatus(IS_EBASE + 3);
$this->LogMessage($this->Translate('Connection lost'), KL_ERROR);
$this->ShowLastError($SubscribeResult->getMessage());
*/
$this->WaitForFirstEvent = false;
return false;
}
Expand Down Expand Up @@ -1010,13 +1019,11 @@ protected function Unsubscribe()
$name = $xml->firstChild->nodeName;
$Header[] = new SoapHeader($ns, $name, new SoapVar($SubscriptionId, XSD_ANYXML));
}

$empty = '';
$UnsubscribeResult = $this->SendData($SubscriptionReference, \ONVIF\WSDL::Event, 'Unsubscribe', true, [], $empty, $Header);
if (is_a($UnsubscribeResult, 'SoapFault')) {
trigger_error($UnsubscribeResult->getMessage(), E_USER_NOTICE);
}

return true;
}
protected function GetEventProperties()
Expand Down

0 comments on commit 6285202

Please sign in to comment.