Add Latitude and Longitude to shmem and accessors to monitor

This commit is contained in:
Isaac Connor
2023-07-09 12:02:33 -04:00
parent 87fafa43a8
commit 3cefa4cde4
2 changed files with 16 additions and 2 deletions

View File

@@ -95,7 +95,8 @@ std::string load_monitor_sql =
"`EventPrefix`, `LabelFormat`, `LabelX`, `LabelY`, `LabelSize`,"
"`ImageBufferCount`, `MaxImageBufferCount`, `WarmupCount`, `PreEventCount`, `PostEventCount`, `StreamReplayBuffer`, `AlarmFrameCount`, "
"`SectionLength`, `SectionLengthWarn`, `MinSectionLength`, `FrameSkip`, `MotionFrameSkip`, "
"`FPSReportInterval`, `RefBlendPerc`, `AlarmRefBlendPerc`, `TrackMotion`, `Exif`,"
"`FPSReportInterval`, `RefBlendPerc`, `AlarmRefBlendPerc`, `TrackMotion`, `Exif`, "
"`Latitude`, `Longitude`, "
"`RTSPServer`, `RTSPStreamName`, `ONVIF_Alarm_Text`,"
"`ONVIF_URL`, `ONVIF_Username`, `ONVIF_Password`, `ONVIF_Options`, `ONVIF_Event_Listener`, `use_Amcrest_API`,"
"`SignalCheckPoints`, `SignalCheckColour`, `Importance`-1, ZoneCount "
@@ -237,6 +238,8 @@ Monitor::Monitor()
signal_check_points(0),
signal_check_colour(0),
embed_exif(false),
latitude(0.0),
longitude(0.0),
rtsp_server(false),
rtsp_streamname(""),
onvif_alarm_txt(""),
@@ -512,13 +515,16 @@ void Monitor::Load(MYSQL_ROW dbrow, bool load_zones=true, Purpose p = QUERY) {
track_motion = atoi(dbrow[col]); col++;
embed_exif = (*dbrow[col] != '0'); col++;
/* These will only be used to init shmem */
latitude = dbrow[col] ? atof(dbrow[col]) : 0.0; col++;
longitude = dbrow[col] ? atof(dbrow[col]) : 0.0; col++;
/* "`RTSPServer`,`RTSPStreamName`, */
rtsp_server = (*dbrow[col] != '0'); col++;
rtsp_streamname = dbrow[col]; col++;
// get alarm text from table.
onvif_alarm_txt = std::string(dbrow[col] ? dbrow[col] : ""); col++;
/* "`ONVIF_URL`, `ONVIF_Username`, `ONVIF_Password`, `ONVIF_Options`, `ONVIF_Event_Listener`, `use_Amcrest_API`, " */
onvif_url = std::string(dbrow[col] ? dbrow[col] : ""); col++;
onvif_username = std::string(dbrow[col] ? dbrow[col] : ""); col++;
@@ -970,6 +976,8 @@ bool Monitor::connect() {
shared_data->signal = false;
shared_data->capture_fps = 0.0;
shared_data->analysis_fps = 0.0;
shared_data->latitude = latitude;
shared_data->longitude = longitude;
shared_data->state = state = IDLE;
shared_data->last_write_index = image_buffer_count;
shared_data->last_read_index = image_buffer_count;

View File

@@ -176,6 +176,8 @@ protected:
uint32_t state; /* +12 */
double capture_fps; // Current capturing fps
double analysis_fps; // Current analysis fps
double latitude;
double longitude;
uint64_t last_event_id; /* +16 */
uint32_t action; /* +24 */
int32_t brightness; /* +28 */
@@ -468,6 +470,8 @@ protected:
int signal_check_points; // Number of points in the image to check for signal
Rgb signal_check_colour; // The colour that the camera will emit when no video signal detected
bool embed_exif; // Whether to embed Exif data into each image frame or not
double latitude;
double longitude;
bool rtsp_server; // Whether to include this monitor as an rtsp server stream
std::string rtsp_streamname; // path in the rtsp url for this monitor
std::string onvif_alarm_txt; // def onvif_alarm_txt
@@ -702,6 +706,8 @@ public:
return false;
}
inline bool Exif() const { return embed_exif; }
inline double Latitude() const { return shared_data ? shared_data->latitude : latitude; }
inline double Longitude() const { return shared_data ? shared_data->longitude : longitude; }
inline bool RTSPServer() const { return rtsp_server; }
inline bool RecordAudio() const { return record_audio; }