Merge pull request #3406 from jp-bennett/master

Continued work on ONVIF
This commit is contained in:
Isaac Connor 2022-01-08 15:19:51 -05:00 committed by GitHub
commit af8964c043
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 0 deletions

View File

@ -421,6 +421,7 @@ Monitor::Monitor()
linked_monitors(nullptr),
#ifdef WITH_GSOAP
soap(nullptr),
ONVIF_Closes_Event(FALSE),
#endif
red_val(0),
green_val(0),
@ -1080,6 +1081,9 @@ bool Monitor::connect() {
if (onvif_event_listener) { //Temporarily using this option to enable the feature
Debug(1, "Starting ONVIF");
ONVIF_Healthy = FALSE;
if (onvif_options.find("closes_event") != std::string::npos) { //Option to indicate that ONVIF will send a close event message
ONVIF_Closes_Event = TRUE;
}
tev__PullMessages.Timeout = "PT600S";
tev__PullMessages.MessageLimit = 100;
soap = soap_new();
@ -1802,6 +1806,10 @@ bool Monitor::Poll() {
} else {
Debug(1, "Triggered off ONVIF");
ONVIF_Trigger_State = FALSE;
if (!ONVIF_Closes_Event) { //If we get a close event, then we know to expect them.
ONVIF_Closes_Event = TRUE;
Debug(1,"Setting ClosesEvent");
}
}
}
}
@ -1868,6 +1876,9 @@ bool Monitor::Analyse() {
Event::StringSet noteSet;
noteSet.insert("ONVIF2");
noteSetMap[MOTION_CAUSE] = noteSet;
//If the camera isn't going to send an event close, we need to close it here, but only after it has actually triggered an alarm.
if (!ONVIF_Closes_Event && state == ALARM)
ONVIF_Trigger_State = FALSE;
} // end ONVIF_Trigger
#endif
@ -2163,6 +2174,7 @@ bool Monitor::Analyse() {
snap->analysis_image->Overlay(*(zone.AlarmImage()));
} // end if zone is alarmed
} // end foreach zone
if (snap->analysis_image != nullptr)
alarm_image.Assign(*(snap->analysis_image));
} // end if image.
@ -2177,6 +2189,7 @@ bool Monitor::Analyse() {
snap->analysis_image->Overlay(*(zone.AlarmImage()));
} // end if zone is alarmed
} // end foreach zone
if (snap->analysis_image != nullptr)
alarm_image.Assign(*(snap->analysis_image));
}

View File

@ -436,6 +436,7 @@ protected:
struct soap *soap;
bool ONVIF_Trigger_State;
bool ONVIF_Healthy;
bool ONVIF_Closes_Event;
_tev__CreatePullPointSubscription request;
_tev__CreatePullPointSubscriptionResponse response;
_tev__PullMessages tev__PullMessages;