Merge pull request #3100 from vertigeaux/share_frame_scores

save frame scores to SharedData for use with linked monitors
This commit is contained in:
Isaac Connor 2020-12-24 11:08:25 -05:00 committed by GitHub
commit ddf66bc9b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 3 deletions

View File

@ -494,6 +494,7 @@ Monitor::Monitor(
shared_data->format = camera->SubpixelOrder();
shared_data->imagesize = camera->ImageSize();
shared_data->alarm_cause[0] = 0;
shared_data->last_frame_score = 0;
trigger_data->size = sizeof(TriggerData);
trigger_data->trigger_state = TRIGGER_CANCEL;
trigger_data->trigger_score = 0;
@ -1538,7 +1539,7 @@ bool Monitor::Analyse() {
}
}
noteSet.insert(linked_monitors[i]->Name());
score += 50;
score += linked_monitors[i]->lastFrameScore(); // 50;
} else {
Debug(4, "Linked monitor %d %s is not alarmed",
linked_monitors[i]->Id(), linked_monitors[i]->Name());
@ -1829,6 +1830,7 @@ bool Monitor::Analyse() {
}
} // end if ! IDLE
}
shared_data->last_frame_score = score;
} else {
if ( event ) {
Info("%s: %03d - Closing event %" PRIu64 ", trigger off", name, image_count, event->Id());

View File

@ -128,7 +128,8 @@ protected:
uint8_t signal; /* +54 */
uint8_t format; /* +55 */
uint32_t imagesize; /* +56 */
uint32_t epadding1; /* +60 */
uint32_t last_frame_score; /* +60 */
// uint32_t epadding1; /* +60 */
/*
** This keeps 32bit time_t and 64bit time_t identical and compatible as long as time is before 2038.
** Shared memory layout should be identical for both 32bit and 64bit and is multiples of 16.
@ -158,7 +159,7 @@ protected:
uint8_t control_state[256]; /* +104 */
char alarm_cause[256];
} SharedData;
typedef enum { TRIGGER_CANCEL, TRIGGER_ON, TRIGGER_OFF } TriggerState;
@ -236,6 +237,10 @@ protected:
return last_connect_time;
}
inline uint32_t lastFrameScore() {
return shared_data->last_frame_score;
}
bool connect();
bool disconnect();