Merge branch 'master' of github.com:ZoneMinder/zoneminder

pull/3805/head
Isaac Connor 2024-01-13 13:25:23 -05:00
commit a3ede8114c
6 changed files with 30 additions and 18 deletions

View File

@ -169,12 +169,14 @@ sub Sql {
$self->{Sql} .= 'T.Id';
$from .= ' LEFT JOIN Events_Tags AS ET ON E.Id = ET.EventId LEFT JOIN Tags AS T ON T.Id = ET.TagId';
} elsif ( $term->{attr} =~ /^Monitor/ ) {
$fields .= ', M.Name as MonitorName';
$from .= ' INNER JOIN Monitors as M on M.Id = E.MonitorId';
if (!($fields =~ /MonitorName/)) {
$fields .= ', M.Name as MonitorName';
$from .= ' INNER JOIN Monitors as M on M.Id = E.MonitorId';
}
my ( $temp_attr_name ) = $term->{attr} =~ /^Monitor(.+)$/;
$self->{Sql} .= 'M.'.($temp_attr_name ? $temp_attr_name : 'Id');
} elsif ( $term->{attr} eq 'ServerId' or $term->{attr} eq 'MonitorServerId' ) {
if (!($fields =~ /MonitorName/)) {
if (!($fields =~ /MonitorName/)) {
$fields .= ', M.Name as MonitorName';
$from .= ' INNER JOIN Monitors as M on M.Id = E.MonitorId';
}
@ -377,7 +379,7 @@ sub Sql {
} elsif ( $filter_expr->{sort_field} eq 'Tag' ) {
$sort_column = 'T.Name';
} elsif ( $filter_expr->{sort_field} eq 'MonitorName' ) {
if (!($fields =~ /MonitorName/)) {
if (!($fields =~ /MonitorName/)) {
$fields .= ', M.Name as MonitorName';
$from .= ' INNER JOIN Monitors as M on M.Id = E.MonitorId';
$sql = ' SELECT '.$fields. ' FROM ' . $from;

View File

@ -679,7 +679,7 @@ sub substituteTags {
}
$rows ++;
}
Debug("Frames: rows: $rows first alarm frame: $first_alarm_frame max_alarm_frame: $max_alarm_frame, score: $max_alarm_score");
Debug("Frames: rows: $rows first alarm frame: $$first_alarm_frame{FrameId} max_alarm_frame: $$max_alarm_frame{FrameId}, score: $max_alarm_score");
}
my $url = $Config{ZM_URL};
@ -771,6 +771,10 @@ sub substituteTags {
$text =~ s/%EPFM%//g; #Path to the frame view for the (first) event image with the highest score
$text =~ s/%EPI1%//g; #Path to the first alarmed event image, suitable for use in img tags
$text =~ s/%EPIM%//g; #Path to the (first) event image with the highest score, suitable for use in img tags
$text =~ s/%EI1%/There is no image for EI1/g;
$text =~ s/%EIM%/There is no image for EIM/g;
$text =~ s/%EI1A%/There is no image for EI1A/g;
$text =~ s/%EIMA%/There is no image for EIMA/g;
} else {
$text =~ s/%EPF1%/$url?view=frame&mid=$Event->{MonitorId}&eid=$Event->{Id}&fid=$first_alarm_frame->{FrameId}/g;
$text =~ s/%EPFM%/$url?view=frame&mid=$Event->{MonitorId}&eid=$Event->{Id}&fid=$max_alarm_frame->{FrameId}/g;

View File

@ -114,6 +114,7 @@ std::string CameraType_Strings[] = {
};
std::string State_Strings[] = {
"Unknown",
"IDLE",
"PREALARM",
"ALARM",
@ -2237,7 +2238,7 @@ bool Monitor::Analyse() {
// snap->score -1 means didn't do motion detection so don't do state transition
// In Nodect, we may still have a triggered event, so need this code to run to end the event.
} else if (!score and ((snap->score == 0) or (shared_data->analysing == ANALYSING_NONE))) {
Debug(1, "!score %s", State_Strings[state].c_str());
Debug(1, "!score state=%s", State_Strings[state].c_str());
alert_to_alarm_frame_count = alarm_frame_count; // load same value configured for alarm_frame_count
if (state == ALARM) {
@ -2263,6 +2264,8 @@ bool Monitor::Analyse() {
} else {
shared_data->state = state = TAPE;
}
} else {
shared_data->state = state = IDLE;
}
} else if (state == PREALARM) {
// Back to IDLE
@ -2282,6 +2285,8 @@ bool Monitor::Analyse() {
}
if (Event::PreAlarmCount())
Event::EmptyPreAlarmFrames();
} else {
Debug(1, "No state change because score=%d and snap->score=%d", score, snap->score);
} // end if score or not
// At this point, snap ONLY has motion score, so this adds other sources
@ -3424,7 +3429,6 @@ int Monitor::Play() {
}
return 1;
}
int Monitor::Close() {
Pause();
@ -3444,7 +3448,8 @@ int Monitor::Close() {
_wsnt__Unsubscribe wsnt__Unsubscribe;
_wsnt__UnsubscribeResponse wsnt__UnsubscribeResponse;
const char *RequestMessageID = soap_wsa_rand_uuid(soap);
if (soap_wsa_request(soap, RequestMessageID, response.SubscriptionReference.Address, "UnsubscribeRequest") == SOAP_OK) {
if (soap_wsa_request(soap, RequestMessageID, response.SubscriptionReference.Address, "UnsubscribeRequest") == SOAP_OK)
{
proxyEvent.Unsubscribe(response.SubscriptionReference.Address, NULL, &wsnt__Unsubscribe, wsnt__UnsubscribeResponse);
} else {
Error("Couldn't set wsa headers RequestMessageID=%s; TO= %s; Request=UnsubscribeRequest .... ! Error %i %s, %s",

View File

@ -154,6 +154,7 @@ public:
} Deinterlace;
typedef enum {
UNKNOWN = 0,
IDLE,
PREALARM,
ALARM,

View File

@ -43,8 +43,8 @@ problems.
General options:
-v, --verbose - Produce more verbose output
-l, --list - List the current status of active (or all with -v) monitors
-h, --help - Display usage information
-v, --version - Print the installed version of ZoneMinder
-h, --help - Display usage information
-v, --version - Print the installed version of ZoneMinder
Options for use with devices:
-d, --device [device_path] - Get the current video device settings for [device_path] or all devices
@ -54,8 +54,8 @@ Options for use with devices:
Options for use with monitors:
-m, --monitor <monitor_id> - Specify which monitor to address, default 1 if absent
-q, --query - Query the current settings for the monitor
-s, --state - Output the current monitor state, 0 = idle, 1 = prealarm, 2 = alarm,
3 = alert, 4 = tape
-s, --state - Output the current monitor state, 0 = unknown, 1 = idle, 2 = prealarm,
3 = alarm, 4 = alert, 5 = tape
-B, --brightness [value] - Output the current brightness, set to value if given
-C, --contrast [value] - Output the current contrast, set to value if given
-H, --hue [value] - Output the current hue, set to value if given

View File

@ -89,12 +89,12 @@ define('ZM_PCRE', '@ZM_PCRE@'); // PCRE support enabled
//
// Alarm states
//
define('STATE_UNKNOWN', -1);
define('STATE_IDLE', 0);
define('STATE_PREALARM', 1);
define('STATE_ALARM', 2);
define('STATE_ALERT', 3);
define('STATE_TAPE', 4);
define('STATE_UNKNOWN', 0);
define('STATE_IDLE', 1);
define('STATE_PREALARM', 2);
define('STATE_ALARM', 3);
define('STATE_ALERT', 4);
define('STATE_TAPE', 5);
//
// DVR Control Commands