From fe69261f102bab62dc149f745e92568767d318e8 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Sat, 19 Feb 2022 15:33:05 -0500 Subject: [PATCH] Include MonitorId as second argument of EventStartCommand and EventEndCOmmand at @baudneo's request. --- src/zm_event.cpp | 3 +++ src/zm_event.h | 1 + src/zm_monitor.cpp | 12 ++++++++++-- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/zm_event.cpp b/src/zm_event.cpp index 3ef7ea887..b9a3ccbf2 100644 --- a/src/zm_event.cpp +++ b/src/zm_event.cpp @@ -699,3 +699,6 @@ Debug(1, "wakeing"); } } } +int Event::MonitorId() { + return monitor->Id(); +} diff --git a/src/zm_event.h b/src/zm_event.h index 2029c062a..1cbf794ef 100644 --- a/src/zm_event.h +++ b/src/zm_event.h @@ -192,5 +192,6 @@ class Event { void SavePreAlarmFrames() { EmptyPreAlarmFrames(); } + int MonitorId(); }; #endif // ZM_EVENT_H diff --git a/src/zm_monitor.cpp b/src/zm_monitor.cpp index 71dc9d2d5..853504a31 100644 --- a/src/zm_monitor.cpp +++ b/src/zm_monitor.cpp @@ -2768,7 +2768,11 @@ Event * Monitor::openEvent( if (!event_start_command.empty()) { if (fork() == 0) { - execlp(event_start_command.c_str(), event_start_command.c_str(), std::to_string(event->Id()).c_str(), nullptr); + execlp(event_start_command.c_str(), + event_start_command.c_str(), + std::to_string(event->Id()).c_str(), + std::to_string(event->MonitorId()).c_str(), + nullptr); Error("Error execing %s", event_start_command.c_str()); } } @@ -2808,11 +2812,15 @@ void Monitor::closeEvent() { Debug(1, "Starting thread to close event"); close_event_thread = std::thread([](Event *e, const std::string &command){ int64_t event_id = e->Id(); + int monitor_id = e->MonitorId(); delete e; if (!command.empty()) { if (fork() == 0) { - execlp(command.c_str(), command.c_str(), std::to_string(event_id).c_str(), nullptr); + execlp(command.c_str(), command.c_str(), + std::to_string(event_id).c_str(), + std::to_string(monitor_id).c_str(), // monitor id + nullptr); Error("Error execing %s", command.c_str()); } }