Don't keep setting the event_file unnecessarily. Add some code comments

This commit is contained in:
Isaac Connor 2017-07-26 10:38:18 -04:00
parent cfbfc0dd44
commit 49319990fa
2 changed files with 12 additions and 9 deletions

View File

@ -1319,14 +1319,15 @@ bool Monitor::Analyse() {
score += motion_score; score += motion_score;
} }
noteSetMap[MOTION_CAUSE] = zoneSet; noteSetMap[MOTION_CAUSE] = zoneSet;
} // end if motion_score
}
shared_data->active = signal; shared_data->active = signal;
} } // end if signal change
if ( (!signal_change && signal) && n_linked_monitors > 0 ) { if ( (!signal_change && signal) && n_linked_monitors > 0 ) {
bool first_link = true; bool first_link = true;
Event::StringSet noteSet; Event::StringSet noteSet;
for ( int i = 0; i < n_linked_monitors; i++ ) { for ( int i = 0; i < n_linked_monitors; i++ ) {
// TODO: Shouldn't we try to connect?
if ( linked_monitors[i]->isConnected() ) { if ( linked_monitors[i]->isConnected() ) {
if ( linked_monitors[i]->hasAlarmed() ) { if ( linked_monitors[i]->hasAlarmed() ) {
if ( !event ) { if ( !event ) {
@ -1352,10 +1353,11 @@ bool Monitor::Analyse() {
if ( (!signal_change && signal) && (function == RECORD || function == MOCORD) ) { if ( (!signal_change && signal) && (function == RECORD || function == MOCORD) ) {
if ( event ) { if ( event ) {
//TODO: We shouldn't have to do this every time. Not sure why it clears itself if this isn't here?? //TODO: We shouldn't have to do this every time. Not sure why it clears itself if this isn't here??
snprintf(video_store_data->event_file, sizeof(video_store_data->event_file), "%s", event->getEventFile()); //snprintf(video_store_data->event_file, sizeof(video_store_data->event_file), "%s", event->getEventFile());
Debug( 3, "Detected new event at (%d.%d)", timestamp->tv_sec,timestamp->tv_usec ); Debug( 3, "Detected new event at (%d.%d)", timestamp->tv_sec,timestamp->tv_usec );
if ( section_length ) { if ( section_length ) {
// TODO: Wouldn't this be clearer if we just did something like if now - event->start > section_length ?
int section_mod = timestamp->tv_sec % section_length; int section_mod = timestamp->tv_sec % section_length;
Debug( 3, "Section length (%d) Last Section Mod(%d), new section mod(%d)", section_length, last_section_mod, section_mod ); Debug( 3, "Section length (%d) Last Section Mod(%d), new section mod(%d)", section_length, last_section_mod, section_mod );
if ( section_mod < last_section_mod ) { if ( section_mod < last_section_mod ) {
@ -1374,8 +1376,8 @@ bool Monitor::Analyse() {
} else { } else {
last_section_mod = section_mod; last_section_mod = section_mod;
} }
}
} // end if section_length } // end if section_length
} // end if event
if ( ! event ) { if ( ! event ) {

View File

@ -732,8 +732,9 @@ void MonitorStream::runStream() {
if ( rmdir( swap_path ) < 0 ) { if ( rmdir( swap_path ) < 0 ) {
Error( "Can't rmdir '%s': %s", swap_path, strerror(errno) ); Error( "Can't rmdir '%s': %s", swap_path, strerror(errno) );
} }
} } // end if checking for swap_path
} } // end if buffered_playback
if ( swap_path ) free( swap_path ); if ( swap_path ) free( swap_path );
closeComms(); closeComms();
} }