diff --git a/ONVIF IO/module.php b/ONVIF IO/module.php index dea31b7..4680c05 100644 --- a/ONVIF IO/module.php +++ b/ONVIF IO/module.php @@ -43,44 +43,44 @@ public function Create(): void { //Never delete this line! parent::Create(); - $this->RegisterPropertyBoolean('Open', false); - $this->RegisterPropertyString('Address', ''); - $this->RegisterPropertyString('Username', ''); - $this->RegisterPropertyString('Password', ''); - $this->RegisterPropertyInteger('EventHandler', \ONVIF\EventHandler::Automatic); - $this->RegisterPropertyString('WebHookIP', ''); - $this->RegisterPropertyBoolean('WebHookHTTPS', false); - $this->RegisterPropertyInteger('WebHookPort', 3777); - $this->RegisterPropertyInteger('SubscribeEventTimeout', 10); - $this->RegisterPropertyInteger('SubscribeInitialTerminationTime', 1); - $this->RegisterPropertyInteger('PullPointInitialTerminationTime', 1); - $this->RegisterPropertyInteger('PullPointTimeout', 10); - $this->RegisterPropertyInteger('MessageLimit', 32); - $this->RegisterAttributeArray('VideoSources', []); - $this->RegisterAttributeArray('AudioSources', []); - $this->RegisterAttributeArray('VideoSourcesJPEG', []); - $this->RegisterAttributeArray('AnalyticsTokens', []); - $this->RegisterAttributeArray('RelayOutputs', []); - $this->RegisterAttributeArray('DigitalInputs', []); - $this->RegisterAttributeInteger('Timestamp_Offset', 0); - $this->RegisterAttributeArray('XAddr', []); - $this->RegisterAttributeArray('EventProperties', []); - $this->RegisterAttributeInteger('NbrOfInputs', 0); - $this->RegisterAttributeInteger('NbrOfOutputs', 0); - $this->RegisterAttributeInteger('NbrOfVideoSources', 0); - $this->RegisterAttributeInteger('NbrOfAudioSources', 0); - $this->RegisterAttributeInteger('NbrOfSerialPorts', 0); - $this->RegisterAttributeBoolean('HasSnapshotUri', false); - $this->RegisterAttributeBoolean('HasRTSPStreaming', false); - $this->RegisterAttributeBoolean('RuleSupport', false); - $this->RegisterAttributeBoolean('AnalyticsModuleSupport', false); - $this->RegisterAttributeBoolean('WSSubscriptionPolicySupport', false); - $this->RegisterAttributeBoolean('WSPullPointSupport', false); - $this->RegisterAttributeString('ConsumerAddress', ''); - $this->RegisterAttributeString('SubscriptionReference', ''); - $this->RegisterAttributeString('SubscriptionId', ''); - $this->RegisterAttributeInteger('CapabilitiesVersion', 0); - $this->RegisterTimer('RenewSubscription', 0, 'IPS_RequestAction(' . $this->InstanceID . ',"Renew",true);'); + $this->RegisterPropertyBoolean(\ONVIF\IO\Property::Active, false); + $this->RegisterPropertyString(\ONVIF\IO\Property::Address, ''); + $this->RegisterPropertyString(\ONVIF\IO\Property::Username, ''); + $this->RegisterPropertyString(\ONVIF\IO\Property::Password, ''); + $this->RegisterPropertyInteger(\ONVIF\IO\Property::EventHandler, \ONVIF\EventHandler::Automatic); + $this->RegisterPropertyString(\ONVIF\IO\Property::WebHookIP, ''); + $this->RegisterPropertyBoolean(\ONVIF\IO\Property::WebHookHTTPS, false); + $this->RegisterPropertyInteger(\ONVIF\IO\Property::WebHookPort, 3777); + $this->RegisterPropertyInteger(\ONVIF\IO\Property::SubscribeEventTimeout, 10); + $this->RegisterPropertyInteger(\ONVIF\IO\Property::SubscribeInitialTerminationTime, 1); + $this->RegisterPropertyInteger(\ONVIF\IO\Property::PullPointInitialTerminationTime, 1); + $this->RegisterPropertyInteger(\ONVIF\IO\Property::PullPointTimeout, 10); + $this->RegisterPropertyInteger(\ONVIF\IO\Property::MessageLimit, 32); + $this->RegisterAttributeArray(\ONVIF\IO\Attribute::VideoSources, []); + $this->RegisterAttributeArray(\ONVIF\IO\Attribute::AudioSources, []); + $this->RegisterAttributeArray(\ONVIF\IO\Attribute::VideoSourcesJPEG, []); + $this->RegisterAttributeArray(\ONVIF\IO\Attribute::AnalyticsTokens, []); + $this->RegisterAttributeArray(\ONVIF\IO\Attribute::RelayOutputs, []); + $this->RegisterAttributeArray(\ONVIF\IO\Attribute::DigitalInputs, []); + $this->RegisterAttributeInteger(\ONVIF\IO\Attribute::Timestamp_Offset, 0); + $this->RegisterAttributeArray(\ONVIF\IO\Attribute::XAddr, []); + $this->RegisterAttributeArray(\ONVIF\IO\Attribute::EventProperties, []); + $this->RegisterAttributeInteger(\ONVIF\IO\Attribute::NbrOfInputs, 0); + $this->RegisterAttributeInteger(\ONVIF\IO\Attribute::NbrOfOutputs, 0); + $this->RegisterAttributeInteger(\ONVIF\IO\Attribute::NbrOfVideoSources, 0); + $this->RegisterAttributeInteger(\ONVIF\IO\Attribute::NbrOfAudioSources, 0); + $this->RegisterAttributeInteger(\ONVIF\IO\Attribute::NbrOfSerialPorts, 0); + $this->RegisterAttributeBoolean(\ONVIF\IO\Attribute::HasSnapshotUri, false); + $this->RegisterAttributeBoolean(\ONVIF\IO\Attribute::HasRTSPStreaming, false); + $this->RegisterAttributeBoolean(\ONVIF\IO\Attribute::RuleSupport, false); + $this->RegisterAttributeBoolean(\ONVIF\IO\Attribute::AnalyticsModuleSupport, false); + $this->RegisterAttributeBoolean(\ONVIF\IO\Attribute::WSSubscriptionPolicySupport, false); + $this->RegisterAttributeBoolean(\ONVIF\IO\Attribute::WSPullPointSupport, false); + $this->RegisterAttributeString(\ONVIF\IO\Attribute::ConsumerAddress, ''); + $this->RegisterAttributeString(\ONVIF\IO\Attribute::SubscriptionReference, ''); + $this->RegisterAttributeString(\ONVIF\IO\Attribute::SubscriptionId, ''); + $this->RegisterAttributeInteger(\ONVIF\IO\Attribute::CapabilitiesVersion, 0); + $this->RegisterTimer(\ONVIF\IO\Timer::RenewSubscription, 0, 'IPS_RequestAction(' . $this->InstanceID . ',"Renew",true);'); $this->Host = ''; $this->MyIP = ''; $this->MyPort = 3777; @@ -117,16 +117,16 @@ public function MessageSink(int $TimeStamp, int $SenderID, int $Message, array $ IPS_RequestAction($this->InstanceID, 'KernelReady', true); break; case FM_CHILDREMOVED: - $this->lock('EventProperties'); - $Events = $this->ReadAttributeArray('EventProperties'); + $this->lock(\ONVIF\IO\Attribute::EventProperties); + $Events = $this->ReadAttributeArray(\ONVIF\IO\Attribute::EventProperties); foreach ($Events as &$Event) { $Index = array_search($Data[0], $Event['Receivers']); if ($Index !== false) { unset($Event['Receivers'][$Index]); } } - $this->WriteAttributeArray('EventProperties', $Events); - $this->unlock('EventProperties'); + $this->WriteAttributeArray(\ONVIF\IO\Attribute::EventProperties, $Events); + $this->unlock(\ONVIF\IO\Attribute::EventProperties); $this->ReloadForm(); break; } @@ -134,7 +134,7 @@ public function MessageSink(int $TimeStamp, int $SenderID, int $Message, array $ public function ApplyChanges(): void { - $this->SetTimerInterval('RenewSubscription', 0); + $this->SetTimerInterval(\ONVIF\IO\Timer::RenewSubscription, 0); if ($this->GetStatus() == IS_ACTIVE) { // block childs $this->SetStatus(IS_INACTIVE); } @@ -146,32 +146,32 @@ public function ApplyChanges(): void if (IPS_GetKernelRunlevel() != KR_READY) { return; } - if (!$this->ReadPropertyBoolean('Open')) { + if (!$this->ReadPropertyBoolean(\ONVIF\IO\Property::Active)) { $this->SetStatus(IS_INACTIVE); - $this->LogMessage($this->Translate('Interface closed'), KL_MESSAGE); + $this->LogMessage($this->Translate(\ONVIF\IO\State::INACTIVE), KL_MESSAGE); return; } - $Url = parse_url($this->ReadPropertyString('Address')); + $Url = parse_url($this->ReadPropertyString(\ONVIF\IO\Property::Address)); $Url['port'] = (isset($Url['port']) ? ':' . $Url['port'] : ''); if (!isset($Url['scheme']) && !isset($Url['host'])) { $this->Host = ''; $this->SetStatus(IS_EBASE + 1); $this->SetSummary(''); - $this->WriteAttributeString('ConsumerAddress', ''); + $this->WriteAttributeString(\ONVIF\IO\Attribute::ConsumerAddress, ''); $this->LogMessage($this->Translate('Address is invalid'), KL_ERROR); return; } - $MyIP = $this->ReadPropertyString('WebHookIP'); - $MyPort = $this->ReadPropertyInteger('WebHookPort'); - $MyHTTPS = $this->ReadPropertyBoolean('WebHookHTTPS'); + $MyIP = $this->ReadPropertyString(\ONVIF\IO\Property::WebHookIP); + $MyPort = $this->ReadPropertyInteger(\ONVIF\IO\Property::WebHookPort); + $MyHTTPS = $this->ReadPropertyBoolean(\ONVIF\IO\Property::WebHookHTTPS); $Host = $Url['scheme'] . '://' . $Url['host'] . $Url['port']; $ReloadCapabilities = ($this->Host != $Host); $ReloadCapabilities = $ReloadCapabilities || ($this->MyIP != $MyIP); $ReloadCapabilities = $ReloadCapabilities || ($this->MyPort != $MyPort); $ReloadCapabilities = $ReloadCapabilities || ($this->MyHTTPS != $MyHTTPS); $ReloadCapabilities = $ReloadCapabilities || ($this->GetStatus() == 202); - $ReloadCapabilities = $ReloadCapabilities || ($this->ReadAttributeInteger('CapabilitiesVersion') == 0); //Force on initial update, Version 0 + $ReloadCapabilities = $ReloadCapabilities || ($this->ReadAttributeInteger(\ONVIF\IO\Attribute::CapabilitiesVersion) == 0); //Force on initial update, Version 0 $this->SendDebug('ReloadCapabilities', $ReloadCapabilities, 0); $this->SetSummary($Host); $this->Host = $Host; @@ -184,9 +184,9 @@ public function ApplyChanges(): void // 2.ONVIF Request GetScopes $Scopes = $this->GetScopes(); // die sagen aus ob G, S oder und T if (!$Scopes && !$Reachable) { // not reachable - $this->UpdateFormField('EventHook', 'caption', $this->ReadAttributeString('ConsumerAddress')); - $this->WriteAttributeString('SubscriptionReference', ''); - $this->WriteAttributeString('SubscriptionId', ''); + $this->UpdateFormField('EventHook', 'caption', $this->ReadAttributeString(\ONVIF\IO\Attribute::ConsumerAddress)); + $this->WriteAttributeString(\ONVIF\IO\Attribute::SubscriptionReference, ''); + $this->WriteAttributeString(\ONVIF\IO\Attribute::SubscriptionId, ''); $this->UpdateFormField('SubscriptionReferenceRow', 'visible', false); $this->UpdateFormField('EventHookRow', 'visible', false); $EventList = @$this->GetEventReceiverFormValues(); @@ -220,7 +220,7 @@ public function ApplyChanges(): void $this->Profile = $Profile; $this->unlock('Profile'); if ($ReloadCapabilities) { - $this->WriteAttributeInteger('CapabilitiesVersion', 1); // This is Version 1 + $this->WriteAttributeInteger(\ONVIF\IO\Attribute::CapabilitiesVersion, 1); // This is Version 1 // Variablen vorbelegen: $NbrOfVideoSources = 0; $NbrOfAudioSources = 0; @@ -236,24 +236,24 @@ public function ApplyChanges(): void $HasRTSPStreaming = false; $HasSnapshotUri = false; if ($this->GetCapabilities()) { // besorgt XAddr und einige Attribute Pflicht für Profil S. - $AnalyticsModuleSupport = $this->ReadAttributeBoolean('AnalyticsModuleSupport'); - $RuleSupport = $this->ReadAttributeBoolean('RuleSupport'); - $WSSubscriptionPolicySupport = $this->ReadAttributeBoolean('WSSubscriptionPolicySupport'); - $WSPullPointSupport = $this->ReadAttributeBoolean('WSPullPointSupport'); - $HasRTSPStreaming = $this->ReadAttributeBoolean('HasRTSPStreaming'); - $NbrOfVideoSources = $this->ReadAttributeInteger('NbrOfVideoSources'); - $NbrOfAudioSources = $this->ReadAttributeInteger('NbrOfAudioSources'); - $NbrOfInputs = $this->ReadAttributeInteger('NbrOfInputs'); - $NbrOfOutputs = $this->ReadAttributeInteger('NbrOfOutputs'); + $AnalyticsModuleSupport = $this->ReadAttributeBoolean(\ONVIF\IO\Attribute::AnalyticsModuleSupport); + $RuleSupport = $this->ReadAttributeBoolean(\ONVIF\IO\Attribute::RuleSupport); + $WSSubscriptionPolicySupport = $this->ReadAttributeBoolean(\ONVIF\IO\Attribute::WSSubscriptionPolicySupport); + $WSPullPointSupport = $this->ReadAttributeBoolean(\ONVIF\IO\Attribute::WSPullPointSupport); + $HasRTSPStreaming = $this->ReadAttributeBoolean(\ONVIF\IO\Attribute::HasRTSPStreaming); + $NbrOfVideoSources = $this->ReadAttributeInteger(\ONVIF\IO\Attribute::NbrOfVideoSources); + $NbrOfAudioSources = $this->ReadAttributeInteger(\ONVIF\IO\Attribute::NbrOfAudioSources); + $NbrOfInputs = $this->ReadAttributeInteger(\ONVIF\IO\Attribute::NbrOfInputs); + $NbrOfOutputs = $this->ReadAttributeInteger(\ONVIF\IO\Attribute::NbrOfOutputs); } - $XAddr = $this->ReadAttributeArray('XAddr'); + $XAddr = $this->ReadAttributeArray(\ONVIF\IO\Attribute::XAddr); // 3.ONVIF Request GetServices // GetServices besorgt XAddr, Pflicht bei T, selten bei S unterstützt. if (!$this->GetServices() && $this->Profile->HasProfile(\ONVIF\Profile::T)) { $this->Warnings = array_merge($this->Warnings, [$this->Translate('Failed to get services. Device reported ONVIF T scope, but is not compliant!')]); } - $XAddr = $this->ReadAttributeArray('XAddr'); + $XAddr = $this->ReadAttributeArray(\ONVIF\IO\Attribute::XAddr); // 4. ONVIF Request GetServiceCapabilities an \ONVIF\WSDL::Management //$this->GetServiceCapabilities($XAddr[\ONVIF\NS::Management], \ONVIF\WSDL::Management); // noch ohne Funktion.. @@ -304,7 +304,7 @@ public function ApplyChanges(): void $RelayOutputs = $this->GetRelayOutputs($XAddr[\ONVIF\NS::DeviceIO], \ONVIF\WSDL::DeviceIO); if (!$RelayOutputs) { $XAddr[\ONVIF\NS::DeviceIO] = ''; - $this->WriteAttributeArray('XAddr', $XAddr); + $this->WriteAttributeArray(\ONVIF\IO\Attribute::XAddr, $XAddr); $RelayOutputs = $this->GetRelayOutputs($XAddr[\ONVIF\NS::Management], \ONVIF\WSDL::Management); } if (!$RelayOutputs) { @@ -339,13 +339,13 @@ public function ApplyChanges(): void } } // Variablen in Attribute schreiben: - $this->WriteAttributeInteger('NbrOfVideoSources', $NbrOfVideoSources); - $this->WriteAttributeInteger('NbrOfAudioSources', $NbrOfAudioSources); - $this->WriteAttributeInteger('NbrOfOutputs', $NbrOfOutputs); - $this->WriteAttributeInteger('NbrOfInputs', $NbrOfInputs); - $this->WriteAttributeInteger('NbrOfSerialPorts', $NbrOfSerialPorts); - $this->WriteAttributeArray('RelayOutputs', $RelayOutputs); - $this->WriteAttributeArray('DigitalInputs', $DigitalInputs); + $this->WriteAttributeInteger(\ONVIF\IO\Attribute::NbrOfVideoSources, $NbrOfVideoSources); + $this->WriteAttributeInteger(\ONVIF\IO\Attribute::NbrOfAudioSources, $NbrOfAudioSources); + $this->WriteAttributeInteger(\ONVIF\IO\Attribute::NbrOfOutputs, $NbrOfOutputs); + $this->WriteAttributeInteger(\ONVIF\IO\Attribute::NbrOfInputs, $NbrOfInputs); + $this->WriteAttributeInteger(\ONVIF\IO\Attribute::NbrOfSerialPorts, $NbrOfSerialPorts); + $this->WriteAttributeArray(\ONVIF\IO\Attribute::RelayOutputs, $RelayOutputs); + $this->WriteAttributeArray(\ONVIF\IO\Attribute::DigitalInputs, $DigitalInputs); // Wenn \ONVIF\WSDL::Media2 unterstützt if ($XAddr[\ONVIF\NS::Media2]) { @@ -390,8 +390,8 @@ public function ApplyChanges(): void } } // Variablen in Attribute schreiben: - $this->WriteAttributeBoolean('HasRTSPStreaming', $HasRTSPStreaming); - $this->WriteAttributeBoolean('HasSnapshotUri', $HasSnapshotUri); + $this->WriteAttributeBoolean(\ONVIF\IO\Attribute::HasRTSPStreaming, $HasRTSPStreaming); + $this->WriteAttributeBoolean(\ONVIF\IO\Attribute::HasSnapshotUri, $HasSnapshotUri); // Wenn \ONVIF\WSDL::PTZ unterstützt // 4d.ONVIF Request GetNodes an \ONVIF\WSDL::PTZ if ($XAddr[\ONVIF\NS::PTZ]) { @@ -431,9 +431,9 @@ public function ApplyChanges(): void } } // Variablen in Attribute schreiben: - $this->WriteAttributeBoolean('WSSubscriptionPolicySupport', $WSSubscriptionPolicySupport); - $this->WriteAttributeBoolean('WSPullPointSupport', $WSPullPointSupport); - $AnalyticsTokens = $this->ReadAttributeArray('AnalyticsTokens'); + $this->WriteAttributeBoolean(\ONVIF\IO\Attribute::WSSubscriptionPolicySupport, $WSSubscriptionPolicySupport); + $this->WriteAttributeBoolean(\ONVIF\IO\Attribute::WSPullPointSupport, $WSPullPointSupport); + $AnalyticsTokens = $this->ReadAttributeArray(\ONVIF\IO\Attribute::AnalyticsTokens); if ($XAddr[\ONVIF\NS::Analytics]) { $AnalyticsCapabilities = $this->GetServiceCapabilities($XAddr[\ONVIF\NS::Analytics], \ONVIF\WSDL::Analytics); if (isset($AnalyticsCapabilities['Capabilities']['AnalyticsModuleSupport'])) { @@ -458,26 +458,26 @@ public function ApplyChanges(): void } } // Variablen in Attribute schreiben: - $this->WriteAttributeBoolean('AnalyticsModuleSupport', $AnalyticsModuleSupport); - $this->WriteAttributeBoolean('RuleSupport', $RuleSupport); - $this->lock('EventProperties'); - $this->WriteAttributeArray('EventProperties', $AllEventProperties); - $this->unlock('EventProperties'); - $this->SendDebug('EventProperties', $AllEventProperties, 0); + $this->WriteAttributeBoolean(\ONVIF\IO\Attribute::AnalyticsModuleSupport, $AnalyticsModuleSupport); + $this->WriteAttributeBoolean(\ONVIF\IO\Attribute::RuleSupport, $RuleSupport); + $this->lock(\ONVIF\IO\Attribute::EventProperties); + $this->WriteAttributeArray(\ONVIF\IO\Attribute::EventProperties, $AllEventProperties); + $this->unlock(\ONVIF\IO\Attribute::EventProperties); + $this->SendDebug(\ONVIF\IO\Attribute::EventProperties, $AllEventProperties, 0); $EventList = @$this->GetEventReceiverFormValues(); $this->SendDebug('Update form', json_encode($EventList), 0); $this->UpdateFormField('Events', 'values', json_encode($EventList)); $this->UpdateFormField('Events', 'visible', true); } else { - $this->SendDebug('VideoSources H.26x', $this->ReadAttributeArray('VideoSources'), 0); - $this->SendDebug('VideoSources JPEG', $this->ReadAttributeArray('VideoSourcesJPEG'), 0); - $XAddr = $this->ReadAttributeArray('XAddr'); + $this->SendDebug('VideoSources H.26x', $this->ReadAttributeArray(\ONVIF\IO\Attribute::VideoSources), 0); + $this->SendDebug('VideoSources JPEG', $this->ReadAttributeArray(\ONVIF\IO\Attribute::VideoSourcesJPEG), 0); + $XAddr = $this->ReadAttributeArray(\ONVIF\IO\Attribute::XAddr); } // Start Event Handler if ($XAddr[\ONVIF\NS::Event]) { - $AllowedEventHandler = $this->ReadPropertyInteger('EventHandler'); + $AllowedEventHandler = $this->ReadPropertyInteger(\ONVIF\IO\Property::EventHandler); if ($AllowedEventHandler == \ONVIF\EventHandler::None) { - $this->LogMessage($this->Translate('Interface connected'), KL_MESSAGE); + $this->LogMessage($this->Translate(\ONVIF\IO\State::ACTIVE), KL_MESSAGE); $this->SetStatus(IS_ACTIVE); } else { if ($this->Profile->Profile == \ONVIF\Profile::T) { // Wenn NUR Profile T unterstützt wird, dann PullPoint @@ -496,8 +496,8 @@ public function ApplyChanges(): void if ($this->GetConsumerAddress()) { // yeah, we can receive events IPS_RunScriptText('IPS_Sleep(1000);IPS_RequestAction(' . $this->InstanceID . ',"Subscribe",true);'); } else { // we cannot receive events :( - $this->WriteAttributeString('SubscriptionReference', ''); - $this->WriteAttributeString('SubscriptionId', ''); + $this->WriteAttributeString(\ONVIF\IO\Attribute::SubscriptionReference, ''); + $this->WriteAttributeString(\ONVIF\IO\Attribute::SubscriptionId, ''); $this->UpdateFormField('SubscriptionReference', 'caption', $this->Translate('This device not support events.')); $this->UpdateFormField('SubscriptionReferenceRow', 'visible', true); } @@ -506,7 +506,7 @@ public function ApplyChanges(): void } } else { $this->Warnings = array_merge($this->Warnings, [$this->Translate('This device does not support ONVIF events, but it is mandatory.')]); - $this->LogMessage($this->Translate('Interface connected'), KL_MESSAGE); + $this->LogMessage($this->Translate(\ONVIF\IO\State::ACTIVE), KL_MESSAGE); $this->SetStatus(IS_ACTIVE); } } @@ -516,21 +516,22 @@ public function ForwardData(string $JSONString): string $Data = json_decode($JSONString, true); unset($Data['DataID']); if ($Data['Function'] == 'GetCapabilities') { - $Capabilities['VideoSources'] = $this->ReadAttributeArray('VideoSources'); - $Capabilities['VideoSourcesJPEG'] = $this->ReadAttributeArray('VideoSourcesJPEG'); - $Capabilities['RelayOutputs'] = $this->ReadAttributeArray('RelayOutputs'); - $Capabilities['DigitalInputs'] = $this->ReadAttributeArray('DigitalInputs'); - $Capabilities['NbrOfVideoSources'] = $this->ReadAttributeInteger('NbrOfVideoSources'); - $Capabilities['NbrOfAudioSources'] = $this->ReadAttributeInteger('NbrOfAudioSources'); - $Capabilities['NbrOfOutputs'] = $this->ReadAttributeInteger('NbrOfOutputs'); - $Capabilities['NbrOfInputs'] = $this->ReadAttributeInteger('NbrOfInputs'); - $Capabilities['NbrOfSerialPorts'] = $this->ReadAttributeInteger('NbrOfSerialPorts'); - $Capabilities['HasSnapshotUri'] = $this->ReadAttributeBoolean('HasSnapshotUri'); - $Capabilities['HasRTSPStreaming'] = $this->ReadAttributeBoolean('HasRTSPStreaming'); - $Capabilities['AnalyticsModuleSupport'] = $this->ReadAttributeBoolean('AnalyticsModuleSupport'); - $Capabilities['AnalyticsTokens'] = $this->ReadAttributeArray('AnalyticsTokens'); - $Capabilities['RuleSupport'] = $this->ReadAttributeBoolean('RuleSupport'); - $Capabilities['XAddr'] = $this->ReadAttributeArray('XAddr'); + $Capabilities[\ONVIF\IO\Attribute::VideoSources] = $this->ReadAttributeArray(\ONVIF\IO\Attribute::VideoSources); + $Capabilities[\ONVIF\IO\Attribute::AudioSources] = $this->ReadAttributeArray(\ONVIF\IO\Attribute::AudioSources); + $Capabilities[\ONVIF\IO\Attribute::VideoSourcesJPEG] = $this->ReadAttributeArray(\ONVIF\IO\Attribute::VideoSourcesJPEG); + $Capabilities[\ONVIF\IO\Attribute::RelayOutputs] = $this->ReadAttributeArray(\ONVIF\IO\Attribute::RelayOutputs); + $Capabilities[\ONVIF\IO\Attribute::DigitalInputs] = $this->ReadAttributeArray(\ONVIF\IO\Attribute::DigitalInputs); + $Capabilities[\ONVIF\IO\Attribute::NbrOfVideoSources] = $this->ReadAttributeInteger(\ONVIF\IO\Attribute::NbrOfVideoSources); + $Capabilities[\ONVIF\IO\Attribute::NbrOfAudioSources] = $this->ReadAttributeInteger(\ONVIF\IO\Attribute::NbrOfAudioSources); + $Capabilities[\ONVIF\IO\Attribute::NbrOfOutputs] = $this->ReadAttributeInteger(\ONVIF\IO\Attribute::NbrOfOutputs); + $Capabilities[\ONVIF\IO\Attribute::NbrOfInputs] = $this->ReadAttributeInteger(\ONVIF\IO\Attribute::NbrOfInputs); + $Capabilities[\ONVIF\IO\Attribute::NbrOfSerialPorts] = $this->ReadAttributeInteger(\ONVIF\IO\Attribute::NbrOfSerialPorts); + $Capabilities[\ONVIF\IO\Attribute::HasSnapshotUri] = $this->ReadAttributeBoolean(\ONVIF\IO\Attribute::HasSnapshotUri); + $Capabilities[\ONVIF\IO\Attribute::HasRTSPStreaming] = $this->ReadAttributeBoolean(\ONVIF\IO\Attribute::HasRTSPStreaming); + $Capabilities[\ONVIF\IO\Attribute::AnalyticsModuleSupport] = $this->ReadAttributeBoolean(\ONVIF\IO\Attribute::AnalyticsModuleSupport); + $Capabilities[\ONVIF\IO\Attribute::AnalyticsTokens] = $this->ReadAttributeArray(\ONVIF\IO\Attribute::AnalyticsTokens); + $Capabilities[\ONVIF\IO\Attribute::RuleSupport] = $this->ReadAttributeBoolean(\ONVIF\IO\Attribute::RuleSupport); + $Capabilities[\ONVIF\IO\Attribute::XAddr] = $this->ReadAttributeArray(\ONVIF\IO\Attribute::XAddr); return serialize($Capabilities); } if ($Data['Function'] == 'SetSynchronizationPoint') { @@ -543,15 +544,15 @@ public function ForwardData(string $JSONString): string return serialize($this->Host); } if ($Data['Function'] == 'GetCredentials') { - $Credentials['Username'] = $this->ReadPropertyString('Username'); - $Credentials['Password'] = $this->ReadPropertyString('Password'); + $Credentials[\ONVIF\IO\Property::Username] = $this->ReadPropertyString(\ONVIF\IO\Property::Username); + $Credentials[\ONVIF\IO\Property::Password] = $this->ReadPropertyString(\ONVIF\IO\Property::Password); return serialize($Credentials); } if ($Data['Function'] == 'GetEvents') { if ($Data['Instance'] != 0) { - $this->lock('EventProperties'); + $this->lock(\ONVIF\IO\Attribute::EventProperties); } - $Events = $this->ReadAttributeArray('EventProperties'); + $Events = $this->ReadAttributeArray(\ONVIF\IO\Attribute::EventProperties); $SkippedTopics = $Data['SkippedTopics']; $FoundEvents = []; @@ -607,8 +608,8 @@ public function ForwardData(string $JSONString): string } } if ($Data['Instance'] != 0) { - $this->WriteAttributeArray('EventProperties', $Events); - $this->unlock('EventProperties'); + $this->WriteAttributeArray(\ONVIF\IO\Attribute::EventProperties, $Events); + $this->unlock(\ONVIF\IO\Attribute::EventProperties); $EventList = $this->GetEventReceiverFormValues(); $this->UpdateFormField('Events', 'values', json_encode($EventList)); } @@ -630,12 +631,12 @@ public function RequestAction(string $Ident, mixed $Value): void { switch ($Ident) { case 'Subscribe': - $AllowedEventHandler = $this->ReadPropertyInteger('EventHandler'); + $AllowedEventHandler = $this->ReadPropertyInteger(\ONVIF\IO\Property::EventHandler); if (($AllowedEventHandler & \ONVIF\EventHandler::Subscribe) == \ONVIF\EventHandler::Subscribe) { if ($this->Subscribe()) { return; } - $this->WriteAttributeString('ConsumerAddress', ''); + $this->WriteAttributeString(\ONVIF\IO\Attribute::ConsumerAddress, ''); $this->UpdateFormField('EventHookRow', 'visible', false); } if ($AllowedEventHandler != \ONVIF\EventHandler::Automatic) { @@ -662,14 +663,14 @@ public function RequestAction(string $Ident, mixed $Value): void case 'Reload': $this->Unsubscribe(); if ($this->GetStatus() == IS_INACTIVE) { - $this->WriteAttributeString('ConsumerAddress', ''); + $this->WriteAttributeString(\ONVIF\IO\Attribute::ConsumerAddress, ''); return; } $this->UpdateFormField('ErrorTitle', 'caption', $this->Translate('Please wait!')); $this->UpdateFormField('ErrorText', 'caption', $this->Translate('Determine abilities of this device')); $this->UpdateFormField('ErrorPopup', 'visible', true); - $this->WriteAttributeString('ConsumerAddress', ''); - $this->WriteAttributeInteger('CapabilitiesVersion', 0); + $this->WriteAttributeString(\ONVIF\IO\Attribute::ConsumerAddress, ''); + $this->WriteAttributeInteger(\ONVIF\IO\Attribute::CapabilitiesVersion, 0); $this->ApplyChanges(); $this->ReloadForm(); return; @@ -682,7 +683,7 @@ public function RequestAction(string $Ident, mixed $Value): void case'KernelReady': $this->KernelReady(); return; - case 'EventHandler': + case \ONVIF\IO\Property::EventHandler: switch ((int) $Value) { case \ONVIF\EventHandler::None: $this->UpdateFormField('SubscribeExpansionPanel', 'visible', false); @@ -710,7 +711,7 @@ public function GetConfigurationForm(): string if ($this->GetStatus() == IS_CREATING) { return json_encode($Form); } - $EventHandler = $this->ReadPropertyInteger('EventHandler'); + $EventHandler = $this->ReadPropertyInteger(\ONVIF\IO\Property::EventHandler); switch ($EventHandler) { case \ONVIF\EventHandler::None: $Form['elements'][4]['visible'] = false; @@ -731,7 +732,7 @@ public function GetConfigurationForm(): string } if ($this->GetStatus() == IS_ACTIVE) { $Form['actions'][1]['items'][0]['items'] = $this->GetDeviceDataForForm(); - $SubscriptionReference = $this->ReadAttributeString('SubscriptionReference'); + $SubscriptionReference = $this->ReadAttributeString(\ONVIF\IO\Attribute::SubscriptionReference); if ($SubscriptionReference == '') { $SubscriptionReference = $this->Translate('This device not support events or they are disabled.'); $Form['actions'][4]['visible'] = false; @@ -742,7 +743,7 @@ public function GetConfigurationForm(): string $Form['actions'][1]['visible'] = false; $Form['actions'][3]['visible'] = false; } - $ConsumerAddress = $this->ReadAttributeString('ConsumerAddress'); + $ConsumerAddress = $this->ReadAttributeString(\ONVIF\IO\Attribute::ConsumerAddress); if ($ConsumerAddress != '') { $Form['actions'][2]['visible'] = true; } @@ -753,7 +754,7 @@ public function GetConfigurationForm(): string $Form['actions'][4]['values'] = $EventList; } $Warnings = $this->Warnings; - if (count($Warnings) && $this->ReadPropertyBoolean('Open')) { + if (count($Warnings) && $this->ReadPropertyBoolean(\ONVIF\IO\Property::Active)) { $WarningText = implode("\r\n", $Warnings); $Form['actions'][5]['visible'] = true; $Form['actions'][5]['popup']['items'][0]['caption'] = $this->Translate('Some features will not work properly'); @@ -796,11 +797,11 @@ protected function GetDeviceDataForForm(): array $InfoItems[] = [ 'type' => 'Label', - 'caption' => $this->Translate('Event subscription: ') . ($this->ReadAttributeBoolean('WSSubscriptionPolicySupport') ? $this->Translate('supported') : $this->Translate('not supported')) + 'caption' => $this->Translate('Event subscription: ') . ($this->ReadAttributeBoolean(\ONVIF\IO\Attribute::WSSubscriptionPolicySupport) ? $this->Translate('supported') : $this->Translate('not supported')) ]; $InfoItems[] = [ 'type' => 'Label', - 'caption' => $this->Translate('Event PullPoint: ') . ($this->ReadAttributeBoolean('WSPullPointSupport') ? $this->Translate('supported') : $this->Translate('not supported')) + 'caption' => $this->Translate('Event PullPoint: ') . ($this->ReadAttributeBoolean(\ONVIF\IO\Attribute::WSPullPointSupport) ? $this->Translate('supported') : $this->Translate('not supported')) ]; $InfoItems[] = [ 'type' => 'Label', @@ -812,39 +813,39 @@ protected function GetDeviceDataForForm(): array [ 'width' => '200px', 'type' => 'Label', - 'caption' => $this->Translate('Videosources: ') . $this->ReadAttributeInteger('NbrOfVideoSources') + 'caption' => $this->Translate('Videosources: ') . $this->ReadAttributeInteger(\ONVIF\IO\Attribute::NbrOfVideoSources) ], [ 'type' => 'Label', - 'caption' => $this->Translate('Audiosources: ') . $this->ReadAttributeInteger('NbrOfAudioSources') + 'caption' => $this->Translate('Audiosources: ') . $this->ReadAttributeInteger(\ONVIF\IO\Attribute::NbrOfAudioSources) ], [ 'type' => 'Label', - 'caption' => $this->Translate('Inputs: ') . $this->ReadAttributeInteger('NbrOfInputs') + 'caption' => $this->Translate('Inputs: ') . $this->ReadAttributeInteger(\ONVIF\IO\Attribute::NbrOfInputs) ], [ 'type' => 'Label', - 'caption' => $this->Translate('Outputs: ') . $this->ReadAttributeInteger('NbrOfOutputs') + 'caption' => $this->Translate('Outputs: ') . $this->ReadAttributeInteger(\ONVIF\IO\Attribute::NbrOfOutputs) ], [ 'type' => 'Label', - 'caption' => $this->Translate('Serial ports: ') . $this->ReadAttributeInteger('NbrOfSerialPorts') + 'caption' => $this->Translate('Serial ports: ') . $this->ReadAttributeInteger(\ONVIF\IO\Attribute::NbrOfSerialPorts) ], [ 'type' => 'Label', - 'caption' => 'RTSP Streaming: ' . ($this->ReadAttributeBoolean('HasRTSPStreaming') ? $this->Translate('supported') : $this->Translate('not supported')) + 'caption' => 'RTSP Streaming: ' . ($this->ReadAttributeBoolean(\ONVIF\IO\Attribute::HasRTSPStreaming) ? $this->Translate('supported') : $this->Translate('not supported')) ], [ 'type' => 'Label', - 'caption' => 'Snapshots: ' . ($this->ReadAttributeBoolean('HasSnapshotUri') ? $this->Translate('supported') : $this->Translate('not supported')) + 'caption' => 'Snapshots: ' . ($this->ReadAttributeBoolean(\ONVIF\IO\Attribute::HasSnapshotUri) ? $this->Translate('supported') : $this->Translate('not supported')) ], [ 'type' => 'Label', - 'caption' => 'Analytics: ' . ($this->ReadAttributeBoolean('AnalyticsModuleSupport') ? $this->Translate('supported') : $this->Translate('not supported')) + 'caption' => 'Analytics: ' . ($this->ReadAttributeBoolean(\ONVIF\IO\Attribute::AnalyticsModuleSupport) ? $this->Translate('supported') : $this->Translate('not supported')) ], [ 'type' => 'Label', - 'caption' => 'Rules: ' . ($this->ReadAttributeBoolean('RuleSupport') ? $this->Translate('supported') : $this->Translate('not supported')) + 'caption' => 'Rules: ' . ($this->ReadAttributeBoolean(\ONVIF\IO\Attribute::RuleSupport) ? $this->Translate('supported') : $this->Translate('not supported')) ] ]; @@ -884,7 +885,7 @@ protected function GetConsumerAddress(): bool if ($ip == '') { $this->SendDebug('NAT enabled ConsumerAddress', 'Invalid', 0); $this->UpdateFormField('EventHook', 'caption', $this->Translate('NATPublicIP is missing in special switches!')); - $this->WriteAttributeString('ConsumerAddress', 'Invalid'); + $this->WriteAttributeString(\ONVIF\IO\Attribute::ConsumerAddress, 'Invalid'); $this->ShowLastError('Error', $this->Translate('NAT support is active, but no public address is set.')); return false; } @@ -905,7 +906,7 @@ protected function GetConsumerAddress(): bool $this->UpdateFormField('EventHookRow', 'visible', true); $this->SendDebug('ConsumerAddress', 'Invalid', 0); $this->UpdateFormField('EventHook', 'caption', $this->Translate('Invalid')); - $this->WriteAttributeString('ConsumerAddress', 'Invalid'); + $this->WriteAttributeString(\ONVIF\IO\Attribute::ConsumerAddress, 'Invalid'); return false; } } @@ -915,18 +916,18 @@ protected function GetConsumerAddress(): bool $this->SendDebug($Debug, $Url, 0); $this->UpdateFormField('EventHookRow', 'visible', true); $this->UpdateFormField('EventHook', 'caption', $Url); - $this->WriteAttributeString('ConsumerAddress', $Url); + $this->WriteAttributeString(\ONVIF\IO\Attribute::ConsumerAddress, $Url); return true; } protected function CreatePullPointSubscription(): bool { - $XAddr = $this->ReadAttributeArray('XAddr'); + $XAddr = $this->ReadAttributeArray(\ONVIF\IO\Attribute::XAddr); if ($XAddr[\ONVIF\NS::Event] == '') { return false; } - $PullPointInitialTerminationTime = $this->ReadPropertyInteger('PullPointInitialTerminationTime'); - $AllowedEventHandler = $this->ReadPropertyInteger('EventHandler'); - $this->lock('EventHandler'); + $PullPointInitialTerminationTime = $this->ReadPropertyInteger(\ONVIF\IO\Property::PullPointInitialTerminationTime); + $AllowedEventHandler = $this->ReadPropertyInteger(\ONVIF\IO\Property::EventHandler); + $this->lock(\ONVIF\IO\Property::EventHandler); $Action = 'http://www.onvif.org/ver10/events/wsdl/EventPortType/CreatePullPointSubscriptionRequest'; $Header = $this->GenerateSOAPHeader($Action, $this->Host . $XAddr[\ONVIF\NS::Event]); $empty = ''; @@ -935,25 +936,25 @@ protected function CreatePullPointSubscription(): bool ]; $CreatePullPointResult = $this->SendData($XAddr[\ONVIF\NS::Event], \ONVIF\WSDL::Event, 'CreatePullPointSubscription', true, $Params, $empty, $Header); if (is_a($CreatePullPointResult, 'SoapFault')) { - $this->unlock('EventHandler'); + $this->unlock(\ONVIF\IO\Property::EventHandler); if ($AllowedEventHandler == \ONVIF\EventHandler::Automatic) { $this->SetStatus(IS_EBASE + 4); } else { $this->SetStatus(IS_EBASE + 3); } - $this->LogMessage($this->Translate('Connection lost'), KL_ERROR); + $this->LogMessage($this->Translate(\ONVIF\IO\State::CONNECTION_LOST), KL_ERROR); /** @var SoapFault $CreatePullPointResult */ $this->ShowLastError($CreatePullPointResult->getMessage()); return false; } if (!is_object($CreatePullPointResult)) { - $this->unlock('EventHandler'); + $this->unlock(\ONVIF\IO\Property::EventHandler); if ($AllowedEventHandler == \ONVIF\EventHandler::Automatic) { $this->SetStatus(IS_EBASE + 4); } else { $this->SetStatus(IS_EBASE + 3); } - $this->LogMessage($this->Translate('Connection lost'), KL_ERROR); + $this->LogMessage($this->Translate(\ONVIF\IO\State::CONNECTION_LOST), KL_ERROR); $this->ShowLastError('No Response'); return false; } @@ -961,29 +962,29 @@ protected function CreatePullPointSubscription(): bool $this->SendDebug('SubscriptionReference', $SubscriptionReference, 0); $ReferenceUrl = parse_url($SubscriptionReference, PHP_URL_HOST); $ReferenceUrl = $ReferenceUrl !== null ? $ReferenceUrl : 'INVALID'; - if (strpos($this->ReadPropertyString('Address'), $ReferenceUrl) === false) { + if (strpos($this->ReadPropertyString(\ONVIF\IO\Property::Address), $ReferenceUrl) === false) { $this->SendDebug('Warning', 'invalid Subscription-Reference, try to fix it', 0); $Url = parse_url($SubscriptionReference); - $Url['host'] = parse_url($this->ReadPropertyString('Address'), PHP_URL_HOST); - $Url['port'] = parse_url($this->ReadPropertyString('Address'), PHP_URL_PORT); + $Url['host'] = parse_url($this->ReadPropertyString(\ONVIF\IO\Property::Address), PHP_URL_HOST); + $Url['port'] = parse_url($this->ReadPropertyString(\ONVIF\IO\Property::Address), PHP_URL_PORT); $SubscriptionReference = self::unparse_url($Url); } - $this->WriteAttributeString('SubscriptionReference', $SubscriptionReference); + $this->WriteAttributeString(\ONVIF\IO\Attribute::SubscriptionReference, $SubscriptionReference); $this->UpdateFormField('SubscriptionReference', 'caption', $SubscriptionReference); $this->UpdateFormField('SubscriptionReferenceRow', 'visible', true); if (property_exists($CreatePullPointResult->SubscriptionReference, 'ReferenceParameters')) { $SubscriptionId = property_exists($CreatePullPointResult->SubscriptionReference->ReferenceParameters, 'any') ? $CreatePullPointResult->SubscriptionReference->ReferenceParameters->any : ''; $this->SendDebug('SubscriptionId', $SubscriptionId, 0); - $this->WriteAttributeString('SubscriptionId', $SubscriptionId); + $this->WriteAttributeString(\ONVIF\IO\Attribute::SubscriptionId, $SubscriptionId); } else { - $this->WriteAttributeString('SubscriptionId', ''); + $this->WriteAttributeString(\ONVIF\IO\Attribute::SubscriptionId, ''); } $this->isSubscribed = true; $this->usedEventHandler = new \ONVIF\EventHandler(\ONVIF\EventHandler::PullPoint); $this->SetRenewInterval($CreatePullPointResult); $this->SetSynchronizationPoint(); - $this->unlock('EventHandler'); - $this->LogMessage($this->Translate('Interface connected'), KL_MESSAGE); + $this->unlock(\ONVIF\IO\Property::EventHandler); + $this->LogMessage($this->Translate(\ONVIF\IO\State::ACTIVE), KL_MESSAGE); $this->SetStatus(IS_ACTIVE); return true; } @@ -993,20 +994,20 @@ protected function PullMessages(): void // Exit PullMessages loop return; } - $SubscriptionReference = $this->ReadAttributeString('SubscriptionReference'); + $SubscriptionReference = $this->ReadAttributeString(\ONVIF\IO\Attribute::SubscriptionReference); if ($SubscriptionReference == '') { $this->SendDebug('ERROR PullMessages', 'No SubscriptionReference', 0); $this->LogMessage($this->Translate('Call PullMessages with no SubscriptionReference'), KL_ERROR); $this->SetStatus(IS_EBASE + 3); - $this->LogMessage($this->Translate('Connection lost'), KL_ERROR); + $this->LogMessage($this->Translate(\ONVIF\IO\State::CONNECTION_LOST), KL_ERROR); return; } - $Timeout = $this->ReadPropertyInteger('PullPointTimeout'); + $Timeout = $this->ReadPropertyInteger(\ONVIF\IO\Property::PullPointTimeout); $Action = 'http://www.onvif.org/ver10/events/wsdl/PullPointSubscription/PullMessagesRequest'; $Header = $this->GenerateSOAPHeader($Action, $SubscriptionReference); $Params = [ 'Timeout' => 'PT' . (string) $Timeout . 'S', - 'MessageLimit'=> $this->ReadPropertyInteger('MessageLimit') + 'MessageLimit'=> $this->ReadPropertyInteger(\ONVIF\IO\Property::MessageLimit) ]; $Response = ''; $ResponseTime = time() + $Timeout; @@ -1044,18 +1045,18 @@ protected function PullMessages(): void } protected function Subscribe(): bool { - $XAddr = $this->ReadAttributeArray('XAddr'); + $XAddr = $this->ReadAttributeArray(\ONVIF\IO\Attribute::XAddr); if ($XAddr[\ONVIF\NS::Event] == '') { return false; } - $SubscribeInitialTerminationTime = $this->ReadPropertyInteger('SubscribeInitialTerminationTime'); - $AllowedEventHandler = $this->ReadPropertyInteger('EventHandler'); - $this->lock('EventHandler'); + $SubscribeInitialTerminationTime = $this->ReadPropertyInteger(\ONVIF\IO\Property::SubscribeInitialTerminationTime); + $AllowedEventHandler = $this->ReadPropertyInteger(\ONVIF\IO\Property::EventHandler); + $this->lock(\ONVIF\IO\Property::EventHandler); $Action = 'http://docs.oasis-open.org/wsn/bw-2/NotificationProducer/SubscribeRequest'; $Header = $this->GenerateSOAPHeader($Action, $this->Host . $XAddr[\ONVIF\NS::Event]); $Params = [ 'ConsumerReference' => [ - 'Address' => $this->ReadAttributeString('ConsumerAddress') + 'Address' => $this->ReadAttributeString(\ONVIF\IO\Attribute::ConsumerAddress) ], 'InitialTerminationTime' => 'PT' . (string) $SubscribeInitialTerminationTime . 'M' ]; @@ -1064,10 +1065,10 @@ protected function Subscribe(): bool $SubscribeResult = $this->SendData($XAddr[\ONVIF\NS::Event], \ONVIF\WSDL::Event, 'Subscribe', true, $Params, $Response, $Header); if (is_a($SubscribeResult, 'SoapFault') || (!is_object($SubscribeResult))) { $this->WaitForFirstEvent = false; - $this->unlock('EventHandler'); + $this->unlock(\ONVIF\IO\Property::EventHandler); if ($AllowedEventHandler == \ONVIF\EventHandler::Subscribe) { // nur Subscribe erlaubt $this->SetStatus(IS_EBASE + 3); - $this->LogMessage($this->Translate('Connection lost'), KL_ERROR); + $this->LogMessage($this->Translate(\ONVIF\IO\State::CONNECTION_LOST), KL_ERROR); $this->ShowLastError($SubscribeResult->getMessage()); } return false; @@ -1077,29 +1078,29 @@ protected function Subscribe(): bool $ReferenceUrl = parse_url($SubscriptionReference, PHP_URL_HOST); $ReferenceUrl = $ReferenceUrl !== null ? $ReferenceUrl : 'INVALID'; - if (strpos($this->ReadPropertyString('Address'), $ReferenceUrl) === false) { + if (strpos($this->ReadPropertyString(\ONVIF\IO\Property::Address), $ReferenceUrl) === false) { $this->SendDebug('Warning', 'invalid Subscription-Reference, try to fix it', 0); $Url = parse_url($SubscriptionReference); - $Url['host'] = parse_url($this->ReadPropertyString('Address'), PHP_URL_HOST); - $Url['port'] = parse_url($this->ReadPropertyString('Address'), PHP_URL_PORT); + $Url['host'] = parse_url($this->ReadPropertyString(\ONVIF\IO\Property::Address), PHP_URL_HOST); + $Url['port'] = parse_url($this->ReadPropertyString(\ONVIF\IO\Property::Address), PHP_URL_PORT); $SubscriptionReference = self::unparse_url($Url); } - $this->WriteAttributeString('SubscriptionReference', $SubscriptionReference); + $this->WriteAttributeString(\ONVIF\IO\Attribute::SubscriptionReference, $SubscriptionReference); $this->UpdateFormField('SubscriptionReference', 'caption', $SubscriptionReference); $this->UpdateFormField('SubscriptionReferenceRow', 'visible', true); if (property_exists($SubscribeResult->SubscriptionReference, 'ReferenceParameters')) { $SubscriptionId = property_exists($SubscribeResult->SubscriptionReference->ReferenceParameters, 'any') ? $SubscribeResult->SubscriptionReference->ReferenceParameters->any : ''; $this->SendDebug('SubscriptionId', $SubscriptionId, 0); - $this->WriteAttributeString('SubscriptionId', $SubscriptionId); + $this->WriteAttributeString(\ONVIF\IO\Attribute::SubscriptionId, $SubscriptionId); } else { - $this->WriteAttributeString('SubscriptionId', ''); + $this->WriteAttributeString(\ONVIF\IO\Attribute::SubscriptionId, ''); } $this->isSubscribed = true; $this->usedEventHandler = new \ONVIF\EventHandler(\ONVIF\EventHandler::Subscribe); $this->SetRenewInterval($SubscribeResult); $this->SetSynchronizationPoint(); - $this->unlock('EventHandler'); - $EventTimeout = $this->ReadPropertyInteger('SubscribeEventTimeout') * 1000; + $this->unlock(\ONVIF\IO\Property::EventHandler); + $EventTimeout = $this->ReadPropertyInteger(\ONVIF\IO\Property::SubscribeEventTimeout) * 1000; if ($EventTimeout) { for ($i = 0; $i < $EventTimeout; $i = $i + 50) { if (!$this->WaitForFirstEvent) { @@ -1107,7 +1108,7 @@ protected function Subscribe(): bool $this->UpdateFormField('DeviceDataPanel', 'visible', true); $this->UpdateFormField('DeviceDataPanel', 'expanded', true); $this->UpdateFormField('Events', 'visible', true); - $this->LogMessage($this->Translate('Interface connected'), KL_MESSAGE); + $this->LogMessage($this->Translate(\ONVIF\IO\State::ACTIVE), KL_MESSAGE); $this->SetStatus(IS_ACTIVE); return true; } @@ -1119,7 +1120,7 @@ protected function Subscribe(): bool $this->UpdateFormField('DeviceDataPanel', 'visible', true); $this->UpdateFormField('DeviceDataPanel', 'expanded', true); $this->UpdateFormField('Events', 'visible', true); - $this->LogMessage($this->Translate('Interface connected'), KL_MESSAGE); + $this->LogMessage($this->Translate(\ONVIF\IO\State::ACTIVE), KL_MESSAGE); $this->SetStatus(IS_ACTIVE); return true; } @@ -1127,13 +1128,13 @@ protected function Subscribe(): bool $this->WaitForFirstEvent = false; if ($AllowedEventHandler == \ONVIF\EventHandler::Subscribe) { // nur Subscribe erlaubt $this->SetStatus(IS_EBASE + 4); - $this->LogMessage($this->Translate('Connection lost'), KL_ERROR); + $this->LogMessage($this->Translate(\ONVIF\IO\State::CONNECTION_LOST), KL_ERROR); } return false; } protected function SetSynchronizationPoint(): bool { - $SubscriptionReference = $this->ReadAttributeString('SubscriptionReference'); + $SubscriptionReference = $this->ReadAttributeString(\ONVIF\IO\Attribute::SubscriptionReference); if ($SubscriptionReference == '') { $this->SendDebug('ERROR SetSynchronizationPoint', 'No SubscriptionReference', 0); $this->LogMessage($this->Translate('Call SetSynchronizationPoint with no SubscriptionReference'), KL_ERROR); @@ -1141,7 +1142,7 @@ protected function SetSynchronizationPoint(): bool } $Action = 'http://www.onvif.org/ver10/events/wsdl/PullPointSubscription/SetSynchronizationPointRequest'; $Header = $this->GenerateSOAPHeader($Action, $SubscriptionReference); - $SubscriptionId = $this->ReadAttributeString('SubscriptionId'); + $SubscriptionId = $this->ReadAttributeString(\ONVIF\IO\Attribute::SubscriptionId); if ($SubscriptionId != '') { $xml = new DOMDocument(); $xml->loadXML($SubscriptionId); @@ -1160,21 +1161,21 @@ protected function SetSynchronizationPoint(): bool } protected function Renew(): bool { - $this->SetTimerInterval('RenewSubscription', 0); + $this->SetTimerInterval(\ONVIF\IO\Timer::RenewSubscription, 0); if (!$this->isSubscribed) { return true; } - $this->lock('EventHandler'); - $SubscriptionReference = $this->ReadAttributeString('SubscriptionReference'); + $this->lock(\ONVIF\IO\Property::EventHandler); + $SubscriptionReference = $this->ReadAttributeString(\ONVIF\IO\Attribute::SubscriptionReference); if ($SubscriptionReference == '') { $this->SendDebug('ERROR Renew', 'No SubscriptionReference', 0); $this->LogMessage($this->Translate('Call Renew with no SubscriptionReference'), KL_ERROR); - $this->unlock('EventHandler'); + $this->unlock(\ONVIF\IO\Property::EventHandler); return false; } $Action = 'http://docs.oasis-open.org/wsn/bw-2/SubscriptionManager/RenewRequest'; $Header = $this->GenerateSOAPHeader($Action, $SubscriptionReference); - $SubscriptionId = $this->ReadAttributeString('SubscriptionId'); + $SubscriptionId = $this->ReadAttributeString(\ONVIF\IO\Attribute::SubscriptionId); if ($SubscriptionId != '') { $xml = new DOMDocument(); $xml->loadXML($SubscriptionId); @@ -1192,7 +1193,7 @@ protected function Renew(): bool $this->LogMessage($this->Translate('Error Renew Subscription with:') . $RenewResult->getMessage(), KL_ERROR); $this->SetStatus(IS_EBASE + 3); $this->isSubscribed = false; - $this->unlock('EventHandler'); + $this->unlock(\ONVIF\IO\Property::EventHandler); return false; } if (!is_object($RenewResult)) { @@ -1200,11 +1201,11 @@ protected function Renew(): bool $this->LogMessage($this->Translate('Error Renew with no Response'), KL_ERROR); $this->SetStatus(IS_EBASE + 3); $this->isSubscribed = false; - $this->unlock('EventHandler'); + $this->unlock(\ONVIF\IO\Property::EventHandler); return false; } $this->SetRenewInterval($RenewResult); - $this->unlock('EventHandler'); + $this->unlock(\ONVIF\IO\Property::EventHandler); return true; } protected function Unsubscribe(): bool @@ -1213,19 +1214,19 @@ protected function Unsubscribe(): bool if (!$this->isSubscribed) { return true; } - $this->lock('EventHandler'); - $this->SetTimerInterval('RenewSubscription', 0); + $this->lock(\ONVIF\IO\Property::EventHandler); + $this->SetTimerInterval(\ONVIF\IO\Timer::RenewSubscription, 0); $this->isSubscribed = false; $this->UpdateFormField('SubscriptionReference', 'caption', ''); $this->UpdateFormField('SubscriptionReferenceRow', 'visible', false); - $SubscriptionReference = $this->ReadAttributeString('SubscriptionReference'); - $this->WriteAttributeString('SubscriptionReference', ''); - $SubscriptionId = $this->ReadAttributeString('SubscriptionId'); - $this->WriteAttributeString('SubscriptionId', ''); + $SubscriptionReference = $this->ReadAttributeString(\ONVIF\IO\Attribute::SubscriptionReference); + $this->WriteAttributeString(\ONVIF\IO\Attribute::SubscriptionReference, ''); + $SubscriptionId = $this->ReadAttributeString(\ONVIF\IO\Attribute::SubscriptionId); + $this->WriteAttributeString(\ONVIF\IO\Attribute::SubscriptionId, ''); if ($SubscriptionReference == '') { $this->SendDebug('ERROR Unsubscribe', 'No SubscriptionReference', 0); $this->LogMessage($this->Translate('Call Unsubscribe with no SubscriptionReference'), KL_ERROR); - $this->unlock('EventHandler'); + $this->unlock(\ONVIF\IO\Property::EventHandler); return false; } $Action = 'http://docs.oasis-open.org/wsn/bw-2/SubscriptionManager/UnsubscribeRequest'; @@ -1243,12 +1244,12 @@ protected function Unsubscribe(): bool /** @var SoapFault $UnsubscribeResult */ trigger_error($UnsubscribeResult->getMessage(), E_USER_NOTICE); } - $this->unlock('EventHandler'); + $this->unlock(\ONVIF\IO\Property::EventHandler); return true; } protected function GetEventProperties(): false|array { - $XAddr = $this->ReadAttributeArray('XAddr'); + $XAddr = $this->ReadAttributeArray(\ONVIF\IO\Attribute::XAddr); if ($XAddr[\ONVIF\NS::Event] == '') { return false; } @@ -1286,7 +1287,7 @@ protected function GetEventProperties(): false|array protected function GetProfiles2(string $Token = null, string $ConfigurationEnumeration = \ONVIF\Media2Conf::All): bool { - $XAddr = $this->ReadAttributeArray('XAddr'); + $XAddr = $this->ReadAttributeArray(\ONVIF\IO\Attribute::XAddr); $Params['Type'] = $ConfigurationEnumeration; if ($Token) { $Params['Token'] = $Token; @@ -1335,7 +1336,7 @@ protected function GetProfiles2(string $Token = null, string $ConfigurationEnume } $H264VideoSources = array_values($H264VideoSourcesItems); $this->SendDebug('VideoSources H.26x', $H264VideoSources, 0); - $this->WriteAttributeArray('VideoSources', $H264VideoSources); + $this->WriteAttributeArray(\ONVIF\IO\Attribute::VideoSources, $H264VideoSources); $JPEGProfiles = array_filter($Profiles, function (array $Profile) { if (isset($Profile['Configurations']['VideoEncoder']['Encoding'])) { @@ -1369,7 +1370,7 @@ protected function GetProfiles2(string $Token = null, string $ConfigurationEnume } $JPEGVideoSources = array_values($JPEGVideoSourcesItems); $this->SendDebug('VideoSources JPEG', $JPEGVideoSources, 0); - $this->WriteAttributeArray('VideoSourcesJPEG', $JPEGVideoSources); + $this->WriteAttributeArray(\ONVIF\IO\Attribute::VideoSourcesJPEG, $JPEGVideoSources); $AnalyticsTokens = []; $AnalyticsProfiles = array_filter($Profiles, function (array $Profile) { @@ -1383,12 +1384,12 @@ protected function GetProfiles2(string $Token = null, string $ConfigurationEnume $AnalyticsTokens[$Token] = $Name; } $this->SendDebug('AnalyticsTokens', $AnalyticsTokens, 0); - $this->WriteAttributeArray('AnalyticsTokens', $AnalyticsTokens); + $this->WriteAttributeArray(\ONVIF\IO\Attribute::AnalyticsTokens, $AnalyticsTokens); return true; } protected function GetProfiles(): bool { - $XAddr = $this->ReadAttributeArray('XAddr'); + $XAddr = $this->ReadAttributeArray(\ONVIF\IO\Attribute::XAddr); $ProfileResult = $this->SendData($XAddr[\ONVIF\NS::Media], \ONVIF\WSDL::Media, 'GetProfiles', true); if (is_a($ProfileResult, 'SoapFault')) { $this->LogMessage($this->lastSOAPError, KL_ERROR); @@ -1433,7 +1434,7 @@ protected function GetProfiles(): bool } $H264VideoSources = array_values($H264VideoSourcesItems); $this->SendDebug('VideoSources H.26x', $H264VideoSources, 0); - $this->WriteAttributeArray('VideoSources', $H264VideoSources); + $this->WriteAttributeArray(\ONVIF\IO\Attribute::VideoSources, $H264VideoSources); $JPEGProfiles = array_filter($Profiles, function (array $Profile) { @@ -1464,7 +1465,7 @@ protected function GetProfiles(): bool } $JPEGVideoSources = array_values($JPEGVideoSourcesItems); $this->SendDebug('VideoSources JPEG', $JPEGVideoSources, 0); - $this->WriteAttributeArray('VideoSourcesJPEG', $JPEGVideoSources); + $this->WriteAttributeArray(\ONVIF\IO\Attribute::VideoSourcesJPEG, $JPEGVideoSources); $AnalyticsTokens = []; $AnalyticsProfiles = array_filter($Profiles, function (array $Profile) { @@ -1478,7 +1479,7 @@ protected function GetProfiles(): bool $AnalyticsTokens[$Token] = $Name; } $this->SendDebug('AnalyticsTokens', $AnalyticsTokens, 0); - $this->WriteAttributeArray('AnalyticsTokens', $AnalyticsTokens); + $this->WriteAttributeArray(\ONVIF\IO\Attribute::AnalyticsTokens, $AnalyticsTokens); return true; } protected function GetCapabilities(): bool @@ -1567,17 +1568,17 @@ protected function GetCapabilities(): bool } } } - $this->WriteAttributeArray('XAddr', $XAddr); - $this->WriteAttributeBoolean('AnalyticsModuleSupport', $AnalyticsModuleSupport); - $this->WriteAttributeBoolean('RuleSupport', $RuleSupport); - $this->WriteAttributeBoolean('WSSubscriptionPolicySupport', $WSSubscriptionPolicySupport); - $this->WriteAttributeBoolean('WSPullPointSupport', $WSPullPointSupport); - $this->WriteAttributeBoolean('HasSnapshotUri', false); - $this->WriteAttributeBoolean('HasRTSPStreaming', $HasRTSPStreaming); - $this->WriteAttributeInteger('NbrOfVideoSources', $NbrOfVideoSources); - $this->WriteAttributeInteger('NbrOfAudioSources', $NbrOfAudioSources); - $this->WriteAttributeInteger('NbrOfInputs', $NbrOfInputs); - $this->WriteAttributeInteger('NbrOfOutputs', $NbrOfOutputs); + $this->WriteAttributeArray(\ONVIF\IO\Attribute::XAddr, $XAddr); + $this->WriteAttributeBoolean(\ONVIF\IO\Attribute::AnalyticsModuleSupport, $AnalyticsModuleSupport); + $this->WriteAttributeBoolean(\ONVIF\IO\Attribute::RuleSupport, $RuleSupport); + $this->WriteAttributeBoolean(\ONVIF\IO\Attribute::WSSubscriptionPolicySupport, $WSSubscriptionPolicySupport); + $this->WriteAttributeBoolean(\ONVIF\IO\Attribute::WSPullPointSupport, $WSPullPointSupport); + $this->WriteAttributeBoolean(\ONVIF\IO\Attribute::HasSnapshotUri, false); + $this->WriteAttributeBoolean(\ONVIF\IO\Attribute::HasRTSPStreaming, $HasRTSPStreaming); + $this->WriteAttributeInteger(\ONVIF\IO\Attribute::NbrOfVideoSources, $NbrOfVideoSources); + $this->WriteAttributeInteger(\ONVIF\IO\Attribute::NbrOfAudioSources, $NbrOfAudioSources); + $this->WriteAttributeInteger(\ONVIF\IO\Attribute::NbrOfInputs, $NbrOfInputs); + $this->WriteAttributeInteger(\ONVIF\IO\Attribute::NbrOfOutputs, $NbrOfOutputs); return !is_a($Result, 'SoapFault'); } protected function GetScopes(): false|array @@ -1598,7 +1599,7 @@ protected function GetScopes(): false|array } protected function GetNodes(): false|array { - $XAddr = $this->ReadAttributeArray('XAddr'); + $XAddr = $this->ReadAttributeArray(\ONVIF\IO\Attribute::XAddr); $Nodes = $this->SendData($XAddr[\ONVIF\NS::PTZ], \ONVIF\WSDL::PTZ, 'GetNodes', true); if (is_a($Nodes, 'SoapFault')) { return false; @@ -1627,7 +1628,7 @@ protected function GetAudioSources($Uri, $WSDL): false|array protected function GetSupportedAnalyticsModules(string $AnalyticsToken): false|array { - $XAddr = $this->ReadAttributeArray('XAddr'); + $XAddr = $this->ReadAttributeArray(\ONVIF\IO\Attribute::XAddr); $Params = [ 'ConfigurationToken' => $AnalyticsToken ]; @@ -1640,7 +1641,7 @@ protected function GetSupportedAnalyticsModules(string $AnalyticsToken): false|a } protected function GetSupportedRules(string $AnalyticsToken): false|array { - $XAddr = $this->ReadAttributeArray('XAddr'); + $XAddr = $this->ReadAttributeArray(\ONVIF\IO\Attribute::XAddr); $Params = [ 'ConfigurationToken' => $AnalyticsToken ]; @@ -1685,7 +1686,7 @@ protected function GetServices(): bool return false; } $ServicesResult = json_decode(json_encode($Services), true); - $XAddr = $this->ReadAttributeArray('XAddr'); + $XAddr = $this->ReadAttributeArray(\ONVIF\IO\Attribute::XAddr); /*$XAddr = [ \ONVIF\NS::Management => '/onvif/device_service', \ONVIF\NS::Event => '', @@ -1701,7 +1702,7 @@ protected function GetServices(): bool foreach ($ServicesResult['Service'] as $Service) { $XAddr[$Service['Namespace']] = parse_url($Service['XAddr'], PHP_URL_PATH); } - $this->WriteAttributeArray('XAddr', $XAddr); + $this->WriteAttributeArray(\ONVIF\IO\Attribute::XAddr, $XAddr); return true; } protected function GetServiceCapabilities($Uri, $WSDL): false|array @@ -1754,7 +1755,7 @@ protected function GetDigitalInputs($Uri, $WSDL): false|array } protected function GetDigitalInputConfigurationOptions(string $Token): array { - $XAddr = $this->ReadAttributeArray('XAddr'); + $XAddr = $this->ReadAttributeArray(\ONVIF\IO\Attribute::XAddr); $Params['Token'] = $Token; $DigitalInputConfigurationOptionsResponse = $this->SendData($XAddr[\ONVIF\NS::DeviceIO], \ONVIF\WSDL::DeviceIO, 'GetDigitalInputConfigurationOptions', true, $Params); if (is_a($DigitalInputConfigurationOptionsResponse, 'SoapFault')) { @@ -1803,7 +1804,7 @@ protected function GetSystemDateAndTime(): bool { $camera_datetime = $this->SendData('', \ONVIF\WSDL::Management, 'GetSystemDateAndTime'); if (is_a($camera_datetime, 'SoapFault')) { - $this->WriteAttributeInteger('Timestamp_Offset', 0); + $this->WriteAttributeInteger(\ONVIF\IO\Attribute::Timestamp_Offset, 0); return false; } if (property_exists($camera_datetime->SystemDateAndTime, 'UTCDateTime')) { @@ -1815,7 +1816,7 @@ protected function GetSystemDateAndTime(): bool $camera_datetime->SystemDateAndTime->UTCDateTime->Date->Day, $camera_datetime->SystemDateAndTime->UTCDateTime->Date->Year ); - $this->WriteAttributeInteger('Timestamp_Offset', time() - $camera_ts); + $this->WriteAttributeInteger(\ONVIF\IO\Attribute::Timestamp_Offset, time() - $camera_ts); $this->SendDebug('TimeDiff', time() - $camera_ts, 0); return true; } @@ -1828,7 +1829,7 @@ protected function GetSystemDateAndTime(): bool $camera_datetime->SystemDateAndTime->LocalDateTime->Date->Day, $camera_datetime->SystemDateAndTime->LocalDateTime->Date->Year ); - $this->WriteAttributeInteger('Timestamp_Offset', time() - $camera_ts); + $this->WriteAttributeInteger(\ONVIF\IO\Attribute::Timestamp_Offset, time() - $camera_ts); $this->SendDebug('TimeDiff', time() - $camera_ts, 0); return true; } @@ -1859,11 +1860,11 @@ protected function SendData(string $URI, string $wsdl, string $Function, bool $U $wsdl = dirname(__DIR__) . '/libs/WSDL/' . $wsdl; if ($UseLogin) { if ($this->Profile->HasProfile(\ONVIF\Profile::S) || ($Function == 'GetScopes')) { // Nur Profile S Geräte können WSSecurity - if ($this->ReadPropertyString('Password') != '') { - $Header[] = \ONVIF\ONVIF::soapClientWSSecurityHeader($this->ReadPropertyString('Username'), $this->ReadPropertyString('Password'), $this->ReadAttributeInteger('Timestamp_Offset')); + if ($this->ReadPropertyString(\ONVIF\IO\Property::Password) != '') { + $Header[] = \ONVIF\ONVIF::soapClientWSSecurityHeader($this->ReadPropertyString(\ONVIF\IO\Property::Username), $this->ReadPropertyString(\ONVIF\IO\Property::Password), $this->ReadAttributeInteger(\ONVIF\IO\Attribute::Timestamp_Offset)); } } - $ONVIFClient = new \ONVIF\ONVIF($wsdl, $URI, $this->ReadPropertyString('Username'), $this->ReadPropertyString('Password'), $Header, $Timeout); + $ONVIFClient = new \ONVIF\ONVIF($wsdl, $URI, $this->ReadPropertyString(\ONVIF\IO\Property::Username), $this->ReadPropertyString(\ONVIF\IO\Property::Password), $Header, $Timeout); } else { $ONVIFClient = new \ONVIF\ONVIF($wsdl, $URI, null, null, $Header, $Timeout); } @@ -1897,7 +1898,7 @@ protected function SendData(string $URI, string $wsdl, string $Function, bool $U protected function GetEventReceiverFormValues(): array { $EventList = []; - $Events = $this->ReadAttributeArray('EventProperties'); + $Events = $this->ReadAttributeArray(\ONVIF\IO\Attribute::EventProperties); foreach ($Events as $Topic => $MessageDescription) { $Receivers = []; foreach ($MessageDescription['Receivers'] as $Receiver) { @@ -1922,7 +1923,7 @@ protected function GetEventReceiverFormValues(): array } protected function ProcessHookData() { - if (($this->ReadPropertyBoolean('Open') == false) || ($this->GetTimerInterval('RenewSubscription') == 0)) { + if (($this->ReadPropertyBoolean(\ONVIF\IO\Property::Active) == false) || ($this->GetTimerInterval(\ONVIF\IO\Timer::RenewSubscription) == 0)) { http_response_code(404); header('Connection: close'); header('Server: Symcon ' . IPS_GetKernelVersion()); @@ -1997,7 +1998,7 @@ protected function SendEventDataArrayToChildren(array $EventDataArray): void protected function KernelReady(): void { $this->RegisterMessage($this->InstanceID, FM_CHILDREMOVED); - $Url = parse_url($this->ReadPropertyString('Address')); + $Url = parse_url($this->ReadPropertyString(\ONVIF\IO\Property::Address)); $Url['port'] = (isset($Url['port']) ? ':' . $Url['port'] : ''); if (isset($Url['scheme']) && isset($Url['host'])) { $this->Host = $Url['scheme'] . '://' . $Url['host'] . $Url['port']; @@ -2083,6 +2084,6 @@ private function SetRenewInterval(object $Result): void } $this->SendDebug('TerminationTime', $this->TerminationTime, 0); $this->SendDebug('Renew Interval', $Interval - 5, 0); - $this->SetTimerInterval('RenewSubscription', ($Interval - 5) * 1000); + $this->SetTimerInterval(\ONVIF\IO\Timer::RenewSubscription, ($Interval - 5) * 1000); } } diff --git a/libs/wsdl.php b/libs/wsdl.php index 8f5cd0c..af7e6f2 100644 --- a/libs/wsdl.php +++ b/libs/wsdl.php @@ -172,5 +172,106 @@ public function toString(): string class Property { public const Active = 'Open'; + public const Address = 'Address'; + public const Username = 'Username'; + public const Password = 'Password'; + public const EventHandler = 'EventHandler'; + public const WebHookIP = 'WebHookIP'; + public const WebHookHTTPS = 'WebHookHTTPS'; + public const WebHookPort = 'WebHookPort'; + public const SubscribeEventTimeout = 'SubscribeEventTimeout'; + public const SubscribeInitialTerminationTime = 'SubscribeInitialTerminationTime'; + public const PullPointInitialTerminationTime = 'PullPointInitialTerminationTime'; + public const PullPointTimeout = 'PullPointTimeout'; + public const MessageLimit = 'MessageLimit'; } -} \ No newline at end of file + class Attribute + { + public const VideoSources = 'VideoSources'; + public const AudioSources = 'AudioSources'; + public const VideoSourcesJPEG = 'VideoSourcesJPEG'; + public const AnalyticsTokens = 'AnalyticsTokens'; + public const RelayOutputs = 'RelayOutputs'; + public const DigitalInputs = 'DigitalInputs'; + public const Timestamp_Offset = 'Timestamp_Offset'; + public const XAddr = 'XAddr'; + public const EventProperties = 'EventProperties'; + public const NbrOfInputs = 'NbrOfInputs'; + public const NbrOfOutputs = 'NbrOfOutputs'; + public const NbrOfVideoSources = 'NbrOfVideoSources'; + public const NbrOfAudioSources = 'NbrOfAudioSources'; + public const NbrOfSerialPorts = 'NbrOfSerialPorts'; + public const HasSnapshotUri = 'HasSnapshotUri'; + public const HasRTSPStreaming = 'HasRTSPStreaming'; + public const RuleSupport = 'RuleSupport'; + public const AnalyticsModuleSupport = 'AnalyticsModuleSupport'; + public const WSSubscriptionPolicySupport = 'WSSubscriptionPolicySupport'; + public const WSPullPointSupport = 'WSPullPointSupport'; + public const ConsumerAddress = 'ConsumerAddress'; + public const SubscriptionReference = 'SubscriptionReference'; + public const SubscriptionId = 'SubscriptionId'; + public const CapabilitiesVersion = 'CapabilitiesVersion'; + } + class Timer + { + public const RenewSubscription = 'RenewSubscription'; + } + class State + { + public const INACTIVE = 'Interface closed'; + public const ACTIVE ='Interface connected'; + public const CONNECTION_LOST = 'Connection lost'; + } +} + +namespace ONVIF\Device +{ + class Property + { + public const EventTopic = 'EventTopic'; + /* public const Address = 'Address'; + public const Username = 'Username'; + public const Password = 'Password'; + public const EventHandler = 'EventHandler'; + public const WebHookIP = 'WebHookIP'; + public const WebHookHTTPS = 'WebHookHTTPS'; + public const WebHookPort = 'WebHookPort'; + public const SubscribeEventTimeout = 'SubscribeEventTimeout'; + public const SubscribeInitialTerminationTime = 'SubscribeInitialTerminationTime'; + public const PullPointInitialTerminationTime = 'PullPointInitialTerminationTime'; + public const PullPointTimeout = 'PullPointTimeout'; + public const MessageLimit = 'MessageLimit'; + */ + + } + class Attribute + { + public const EventProperties = 'EventProperties'; + /* public const NbrOfInputs = 'NbrOfInputs'; + public const NbrOfOutputs = 'NbrOfOutputs'; + public const NbrOfVideoSources = 'NbrOfVideoSources'; + public const NbrOfAudioSources = 'NbrOfAudioSources'; + public const NbrOfSerialPorts = 'NbrOfSerialPorts'; + public const HasSnapshotUri = 'HasSnapshotUri'; + public const HasRTSPStreaming = 'HasRTSPStreaming'; + public const RuleSupport = 'RuleSupport'; + public const AnalyticsModuleSupport = 'AnalyticsModuleSupport'; + public const WSSubscriptionPolicySupport = 'WSSubscriptionPolicySupport'; + public const WSPullPointSupport = 'WSPullPointSupport'; + public const ConsumerAddress = 'ConsumerAddress'; + public const SubscriptionReference = 'SubscriptionReference'; + public const SubscriptionId = 'SubscriptionId'; + public const CapabilitiesVersion = 'CapabilitiesVersion'; + */ + } + class Timer + { + public const RenewSubscription = 'RenewSubscription'; + } + class State + { + public const INACTIVE = 'Interface closed'; + public const ACTIVE ='Interface connected'; + public const CONNECTION_LOST = 'Connection lost'; + } +}