Update state to ALARM AFTER we have opened the event, so that we get the correct event Id. Fixes #2978 Fixes #2894
This commit is contained in:
parent
c2a025300f
commit
3658c3b589
|
@ -1404,9 +1404,6 @@ bool Monitor::Analyse() {
|
|||
score += trigger_data->trigger_score;
|
||||
Debug(1, "Triggered on score += %d => %d", trigger_data->trigger_score, score);
|
||||
if ( !event ) {
|
||||
// How could it have a length already?
|
||||
//if ( cause.length() )
|
||||
//cause += ", ";
|
||||
cause += trigger_data->trigger_cause;
|
||||
}
|
||||
Event::StringSet noteSet;
|
||||
|
@ -1514,7 +1511,6 @@ bool Monitor::Analyse() {
|
|||
} // end if event
|
||||
|
||||
if ( !event ) {
|
||||
|
||||
// Create event
|
||||
event = new Event(this, *timestamp, "Continuous", noteSetMap, videoRecording);
|
||||
shared_data->last_event = event->Id();
|
||||
|
@ -1528,7 +1524,6 @@ bool Monitor::Analyse() {
|
|||
if ( state == IDLE ) {
|
||||
shared_data->state = state = TAPE;
|
||||
}
|
||||
|
||||
} // end if ! event
|
||||
} // end if function == RECORD || function == MOCORD)
|
||||
} // end if !signal_change && signal
|
||||
|
@ -1552,7 +1547,6 @@ bool Monitor::Analyse() {
|
|||
);
|
||||
}
|
||||
if ( (!pre_event_count) || (Event::PreAlarmCount() >= alarm_frame_count-1) ) {
|
||||
shared_data->state = state = ALARM;
|
||||
// lets construct alarm cause. It will contain cause + names of zones alarmed
|
||||
std::string alarm_cause = "";
|
||||
for ( int i=0; i < n_zones; i++ ) {
|
||||
|
@ -1610,6 +1604,7 @@ bool Monitor::Analyse() {
|
|||
event = new Event(this, *(image_buffer[pre_index].timestamp), cause, noteSetMap);
|
||||
} // end if analysis_fps && pre_event_count
|
||||
|
||||
shared_data->state = state = ALARM;
|
||||
shared_data->last_event = event->Id();
|
||||
//set up video store data
|
||||
snprintf(video_store_data->event_file, sizeof(video_store_data->event_file), "%s", event->getEventFile());
|
||||
|
|
Loading…
Reference in New Issue