Skip to content

Commit

Permalink
Merge pull request #4167 from BHMSD-bdailey/ONVIFNotes
Browse files Browse the repository at this point in the history
Onvif notes from Alarms map
  • Loading branch information
connortechnology authored Oct 3, 2024
2 parents abd3097 + 6159a74 commit be946e9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/zm_monitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1952,7 +1952,7 @@ bool Monitor::Analyse() {
Debug(4, "Triggered on ONVIF");
Event::StringSet noteSet;
noteSet.insert("ONVIF");
noteSet.insert(onvif->noteText());
onvif->setNotes(noteSet);
noteSetMap[MOTION_CAUSE] = noteSet;
cause += "ONVIF";
// 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.
Expand Down
8 changes: 2 additions & 6 deletions src/zm_monitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -329,9 +329,7 @@ class Monitor : public std::enable_shared_from_this<Monitor> {
bool healthy;
std::string last_topic;
std::string last_value;
std::string last_active_topic;
std::string last_active_value;
std::string GetNoteText();
void SetNoteSet(Event::StringSet &noteSet);
#ifdef WITH_GSOAP
struct soap *soap = nullptr;
_tev__CreatePullPointSubscription request;
Expand All @@ -352,9 +350,7 @@ class Monitor : public std::enable_shared_from_this<Monitor> {
bool isAlarmed() const { return alarmed; };
void setAlarmed(bool p_alarmed) { alarmed = p_alarmed; };
bool isHealthy() const { return healthy; };
const std::string &lastTopic() const { return last_active_topic; };
const std::string &lastValue() const { return last_active_value; };
const std::string noteText() { return GetNoteText(); };
void setNotes(Event::StringSet &noteSet) { SetNoteSet(noteSet); };
};

class AmcrestAPI {
Expand Down
12 changes: 7 additions & 5 deletions src/zm_monitor_onvif.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,6 @@ void Monitor::ONVIF::WaitForMessage() {
if (alarms.count(last_topic) == 0 )
{
alarms[last_topic] = last_value;
last_active_topic = last_topic;
last_active_value = last_value;
if (!alarmed) {
Info("Triggered Start Event on ONVIF");
alarmed = true;
Expand Down Expand Up @@ -286,10 +284,14 @@ int SOAP_ENV__Fault(struct soap *soap, char *faultcode, char *faultstring, char
}
#endif

std::string Monitor::ONVIF::GetNoteText() {
void Monitor::ONVIF::SetNoteSet(Event::StringSet &noteSet) {
std::string note = "";
#ifdef WITH_GSOAP
note = last_active_topic + "/" + last_active_value;
for (auto it = alarms.begin(); it != alarms.end(); ++it) {
note = it->first + "/" + it->second;
noteSet.insert(note);
}
#endif
return note;
return ;
}

0 comments on commit be946e9

Please sign in to comment.