Introduce a method update the noteSetMap after event creation (addNote).

This commit is contained in:
Isaac Connor 2022-01-03 19:03:04 -05:00
parent 205ff6c033
commit 7215756fed
2 changed files with 17 additions and 12 deletions

View File

@ -291,6 +291,10 @@ void Event::createNotes(std::string &notes) {
}
} // void Event::createNotes(std::string &notes)
void Event::addNote(const char *cause, const std::string &note) {
noteSetMap[cause].insert(note);
}
bool Event::WriteFrameImage(Image *image, SystemTimePoint timestamp, const char *event_file, bool alarm_frame) const {
int thisquality =
(alarm_frame && (config.jpeg_alarm_file_quality > config.jpeg_file_quality)) ?

View File

@ -110,6 +110,7 @@ class Event {
uint64_t Id() const { return id; }
const std::string &Cause() const { return cause; }
void addNote(const char *cause, const std::string &note);
int Frames() const { return frames; }
int AlarmFrames() const { return alarm_frames; }
@ -123,7 +124,7 @@ class Event {
void updateNotes(const StringSetMap &stringSetMap);
void AddFrame(Image *image,
void AddFrame(Image *image,
SystemTimePoint timestamp,
const std::vector<ZoneStats> &stats,
int score = 0,
@ -134,17 +135,17 @@ class Event {
bool SetPath(Storage *storage);
public:
static std::string getSubPath(tm time) {
std::string subpath = stringtf("%02d/%02d/%02d/%02d/%02d/%02d",
time.tm_year - 100, time.tm_mon + 1, time.tm_mday,
time.tm_hour, time.tm_min, time.tm_sec);
return subpath;
}
static std::string getSubPath(time_t *time) {
tm time_tm = {};
localtime_r(time, &time_tm);
return Event::getSubPath(time_tm);
}
static std::string getSubPath(tm time) {
std::string subpath = stringtf("%02d/%02d/%02d/%02d/%02d/%02d",
time.tm_year - 100, time.tm_mon + 1, time.tm_mday,
time.tm_hour, time.tm_min, time.tm_sec);
return subpath;
}
static std::string getSubPath(time_t *time) {
tm time_tm = {};
localtime_r(time, &time_tm);
return Event::getSubPath(time_tm);
}
const char* getEventFile() const {
return video_file.c_str();