diff --git a/src/zm_monitor.cpp b/src/zm_monitor.cpp index bc1827aeb..27ce1b0bd 100644 --- a/src/zm_monitor.cpp +++ b/src/zm_monitor.cpp @@ -91,6 +91,10 @@ std::string CameraType_Strings[] = { "CURL", }; +std::string TriggerState_Strings[] = { + "Cancel", "On", "Off" +}; + std::vector split(const std::string &s, char delim) { std::vector elems; @@ -1403,7 +1407,8 @@ bool Monitor::Analyse() { bool signal = shared_data->signal; bool signal_change = (signal != last_signal); - Debug(3, "Motion detection is enabled signal(%d) signal_change(%d)", signal, signal_change); + Debug(3, "Motion detection is enabled signal(%d) signal_change(%d) trigger_state %s", + signal, signal_change, TriggerState_Strings[trigger_data->trigger_state].c_str()); if ( trigger_data->trigger_state != TRIGGER_OFF ) { unsigned int score = 0; @@ -1801,7 +1806,7 @@ bool Monitor::Analyse() { closeEvent(); } shared_data->state = state = IDLE; - trigger_data->trigger_state = TRIGGER_CANCEL; + //trigger_data->trigger_state = TRIGGER_CANCEL; } // end if ( trigger_data->trigger_state != TRIGGER_OFF ) if ( (!signal_change && signal) && (function == MODECT || function == MOCORD) ) { @@ -2485,8 +2490,7 @@ int Monitor::Capture() { if ( captureResult < 0 ) { Info("Return from Capture (%d), signal loss", captureResult); - // Tell zma to end the event. zma will reset TRIGGER - trigger_data->trigger_state = TRIGGER_OFF; + shared_data->signal = false; // Unable to capture image for temporary reason // Fake a signal loss image Rgb signalcolor; @@ -2886,6 +2890,9 @@ bool Monitor::DumpSettings(char *output, bool verbose) { for ( int i = 0; i < n_zones; i++ ) { zones[i]->DumpSettings(output+strlen(output), verbose); } + sprintf(output+strlen(output), "Recording Enabled? %s\n", enabled ? "enabled" : "disabled"); + sprintf(output+strlen(output), "Events Enabled (!TRIGGER_OFF)? %s\n", trigger_data->trigger_state == TRIGGER_OFF ? "disabled" : "enabled"); + sprintf(output+strlen(output), "Motion Detection Enabled? %s\n", shared_data->active ? "enabled" : "disabled"); return true; } // bool Monitor::DumpSettings(char *output, bool verbose) diff --git a/web/skins/classic/views/js/montage.js b/web/skins/classic/views/js/montage.js index 0ebc328bd..6cbd97e23 100644 --- a/web/skins/classic/views/js/montage.js +++ b/web/skins/classic/views/js/montage.js @@ -11,11 +11,6 @@ function Monitor(monitorData) { this.alarmState = STATE_IDLE; this.lastAlarmState = STATE_IDLE; this.streamCmdParms = 'view=request&request=stream&connkey='+this.connKey; - if ( auth_hash ) { - this.streamCmdParms += '&auth='+auth_hash; - } else if ( auth_relay ) { - this.streamCmdParms += '&'+auth_relay; - } this.streamCmdTimer = null; this.type = monitorData.type; this.refresh = monitorData.refresh; @@ -186,7 +181,7 @@ function Monitor(monitorData) { } //console.log("Starting CmdQuery for " + this.connKey ); if ( this.type != 'WebSite' ) { - this.streamCmdReq.send(this.streamCmdParms+"&command="+CMD_QUERY); + this.streamCmdReq.send(this.streamCmdParms+"&command="+CMD_QUERY+(auth_hash?'&auth='+auth_hash:''); } }; diff --git a/web/skins/classic/views/js/watch.js b/web/skins/classic/views/js/watch.js index 820150457..6dec23151 100644 --- a/web/skins/classic/views/js/watch.js +++ b/web/skins/classic/views/js/watch.js @@ -442,9 +442,6 @@ function statusCmdQuery() { if ( monitorType != 'WebSite' ) { var alarmCmdParms = 'view=request&request=alarm&id='+monitorId; - if ( auth_hash ) { - alarmCmdParms += '&auth='+auth_hash; - } var alarmCmdReq = new Request.JSON( { url: monitorUrl, method: 'get', @@ -461,22 +458,22 @@ function getAlarmCmdResponse(respObj, respText) { } function cmdDisableAlarms() { - alarmCmdReq.send(alarmCmdParms+"&command=disableAlarms"); + alarmCmdReq.send(alarmCmdParms+auth_relay+"&command=disableAlarms"); } function cmdEnableAlarms() { - alarmCmdReq.send(alarmCmdParms+"&command=enableAlarms"); + alarmCmdReq.send(alarmCmdParms+auth_relay+"&command=enableAlarms"); } function cmdForceAlarm() { - alarmCmdReq.send(alarmCmdParms+"&command=forceAlarm"); + alarmCmdReq.send(alarmCmdParms+auth_relay+"&command=forceAlarm"); if ( window.event ) { window.event.preventDefault(); } } function cmdCancelForcedAlarm() { - alarmCmdReq.send(alarmCmdParms+"&command=cancelForcedAlarm"); + alarmCmdReq.send(alarmCmdParms+auth_relay+"&command=cancelForcedAlarm"); if ( window.event ) { window.event.preventDefault(); }