whitespace/tabs

This commit is contained in:
Isaac Connor 2016-04-29 09:11:14 -04:00
parent b41a3b1b25
commit 819dad455e
4 changed files with 1977 additions and 1977 deletions

View File

@ -29,104 +29,104 @@ int zmDbConnected = false;
void zmDbConnect() void zmDbConnect()
{ {
if ( !mysql_init( &dbconn ) ) if ( !mysql_init( &dbconn ) )
{ {
Error( "Can't initialise database connection: %s", mysql_error( &dbconn ) ); Error( "Can't initialise database connection: %s", mysql_error( &dbconn ) );
exit( mysql_errno( &dbconn ) ); exit( mysql_errno( &dbconn ) );
} }
my_bool reconnect = 1; my_bool reconnect = 1;
if ( mysql_options( &dbconn, MYSQL_OPT_RECONNECT, &reconnect ) ) if ( mysql_options( &dbconn, MYSQL_OPT_RECONNECT, &reconnect ) )
Fatal( "Can't set database auto reconnect option: %s", mysql_error( &dbconn ) ); Fatal( "Can't set database auto reconnect option: %s", mysql_error( &dbconn ) );
std::string::size_type colonIndex = staticConfig.DB_HOST.find( ":/" ); std::string::size_type colonIndex = staticConfig.DB_HOST.find( ":/" );
if ( colonIndex != std::string::npos ) if ( colonIndex != std::string::npos )
{
std::string dbHost = staticConfig.DB_HOST.substr( 0, colonIndex );
std::string dbPort = staticConfig.DB_HOST.substr( colonIndex+1 );
if ( !mysql_real_connect( &dbconn, dbHost.c_str(), staticConfig.DB_USER.c_str(), staticConfig.DB_PASS.c_str(), 0, atoi(dbPort.c_str()), 0, 0 ) )
{ {
std::string dbHost = staticConfig.DB_HOST.substr( 0, colonIndex ); Error( "Can't connect to server: %s", mysql_error( &dbconn ) );
std::string dbPort = staticConfig.DB_HOST.substr( colonIndex+1 ); exit( mysql_errno( &dbconn ) );
if ( !mysql_real_connect( &dbconn, dbHost.c_str(), staticConfig.DB_USER.c_str(), staticConfig.DB_PASS.c_str(), 0, atoi(dbPort.c_str()), 0, 0 ) )
{
Error( "Can't connect to server: %s", mysql_error( &dbconn ) );
exit( mysql_errno( &dbconn ) );
}
} }
else }
else
{
if ( !mysql_real_connect( &dbconn, staticConfig.DB_HOST.c_str(), staticConfig.DB_USER.c_str(), staticConfig.DB_PASS.c_str(), 0, 0, 0, 0 ) )
{ {
if ( !mysql_real_connect( &dbconn, staticConfig.DB_HOST.c_str(), staticConfig.DB_USER.c_str(), staticConfig.DB_PASS.c_str(), 0, 0, 0, 0 ) ) Error( "Can't connect to server: %s", mysql_error( &dbconn ) );
{ exit( mysql_errno( &dbconn ) );
Error( "Can't connect to server: %s", mysql_error( &dbconn ) );
exit( mysql_errno( &dbconn ) );
}
} }
if ( mysql_select_db( &dbconn, staticConfig.DB_NAME.c_str() ) ) }
{ if ( mysql_select_db( &dbconn, staticConfig.DB_NAME.c_str() ) )
Error( "Can't select database: %s", mysql_error( &dbconn ) ); {
exit( mysql_errno( &dbconn ) ); Error( "Can't select database: %s", mysql_error( &dbconn ) );
} exit( mysql_errno( &dbconn ) );
zmDbConnected = true; }
zmDbConnected = true;
} }
void zmDbClose() void zmDbClose()
{ {
if ( zmDbConnected ) if ( zmDbConnected )
{ {
mysql_close( &dbconn ); mysql_close( &dbconn );
// mysql_init() call implicitly mysql_library_init() but // mysql_init() call implicitly mysql_library_init() but
// mysql_close() does not call mysql_library_end() // mysql_close() does not call mysql_library_end()
mysql_library_end(); mysql_library_end();
zmDbConnected = false; zmDbConnected = false;
} }
} }
MYSQL_RES * zmDbFetch( const char * query ) { MYSQL_RES * zmDbFetch( const char * query ) {
if ( ! zmDbConnected ) { if ( ! zmDbConnected ) {
Error( "Not connected." ); Error( "Not connected." );
return NULL; return NULL;
} }
if ( mysql_query( &dbconn, query ) ) { if ( mysql_query( &dbconn, query ) ) {
Error( "Can't run query: %s", mysql_error( &dbconn ) ); Error( "Can't run query: %s", mysql_error( &dbconn ) );
return NULL; return NULL;
} }
Debug( 4, "Success running query: %s", query ); Debug( 4, "Success running query: %s", query );
MYSQL_RES *result = mysql_store_result( &dbconn ); MYSQL_RES *result = mysql_store_result( &dbconn );
if ( !result ) { if ( !result ) {
Error( "Can't use query result: %s for query %s", mysql_error( &dbconn ), query ); Error( "Can't use query result: %s for query %s", mysql_error( &dbconn ), query );
return NULL; return NULL;
} }
return result; return result;
} // end MYSQL_RES * zmDbFetch( const char * query ); } // end MYSQL_RES * zmDbFetch( const char * query );
zmDbRow *zmDbFetchOne( const char *query ) { zmDbRow *zmDbFetchOne( const char *query ) {
zmDbRow *row = new zmDbRow(); zmDbRow *row = new zmDbRow();
if ( row->fetch( query ) ) { if ( row->fetch( query ) ) {
return row; return row;
} }
delete row; delete row;
return NULL; return NULL;
} }
MYSQL_RES *zmDbRow::fetch( const char *query ) { MYSQL_RES *zmDbRow::fetch( const char *query ) {
result_set = zmDbFetch( query ); result_set = zmDbFetch( query );
if ( ! result_set ) return result_set; if ( ! result_set ) return result_set;
int n_rows = mysql_num_rows( result_set ); int n_rows = mysql_num_rows( result_set );
if ( n_rows != 1 ) { if ( n_rows != 1 ) {
Error( "Bogus number of lines return from query, %d returned for query %s.", n_rows, query ); Error( "Bogus number of lines return from query, %d returned for query %s.", n_rows, query );
mysql_free_result( result_set ); mysql_free_result( result_set );
result_set = NULL; result_set = NULL;
return result_set;
}
row = mysql_fetch_row( result_set );
if ( ! row ) {
mysql_free_result( result_set );
result_set = NULL;
Error("Error getting row from query %s. Error is %s", query, mysql_error( &dbconn ) );
} else {
Debug(3, "Succes");
}
return result_set; return result_set;
}
row = mysql_fetch_row( result_set );
if ( ! row ) {
mysql_free_result( result_set );
result_set = NULL;
Error("Error getting row from query %s. Error is %s", query, mysql_error( &dbconn ) );
} else {
Debug(3, "Succes");
}
return result_set;
} }
zmDbRow::~zmDbRow() { zmDbRow::~zmDbRow() {
if ( result_set ) if ( result_set )
mysql_free_result( result_set ); mysql_free_result( result_set );
} }

File diff suppressed because it is too large Load Diff

View File

@ -42,210 +42,210 @@
class Zone; class Zone;
class Monitor; class Monitor;
#define MAX_PRE_ALARM_FRAMES 16 // Maximum number of prealarm frames that can be stored #define MAX_PRE_ALARM_FRAMES 16 // Maximum number of prealarm frames that can be stored
// //
// Class describing events, i.e. captured periods of activity. // Class describing events, i.e. captured periods of activity.
// //
class Event class Event
{ {
friend class EventStream; friend class EventStream;
protected: protected:
static bool initialised; static bool initialised;
static char capture_file_format[PATH_MAX]; static char capture_file_format[PATH_MAX];
static char analyse_file_format[PATH_MAX]; static char analyse_file_format[PATH_MAX];
static char general_file_format[PATH_MAX]; static char general_file_format[PATH_MAX];
static char video_file_format[PATH_MAX]; static char video_file_format[PATH_MAX];
protected: protected:
static int sd; static int sd;
public: public:
typedef std::set<std::string> StringSet; typedef std::set<std::string> StringSet;
typedef std::map<std::string,StringSet> StringSetMap; typedef std::map<std::string,StringSet> StringSetMap;
protected: protected:
typedef enum { NORMAL, BULK, ALARM } FrameType; typedef enum { NORMAL, BULK, ALARM } FrameType;
struct PreAlarmData struct PreAlarmData
{ {
Image *image; Image *image;
struct timeval timestamp; struct timeval timestamp;
unsigned int score; unsigned int score;
Image *alarm_frame; Image *alarm_frame;
}; };
static int pre_alarm_count; static int pre_alarm_count;
static PreAlarmData pre_alarm_data[MAX_PRE_ALARM_FRAMES]; static PreAlarmData pre_alarm_data[MAX_PRE_ALARM_FRAMES];
protected: protected:
unsigned int id; unsigned int id;
Monitor *monitor; Monitor *monitor;
struct timeval start_time; struct timeval start_time;
struct timeval end_time; struct timeval end_time;
std::string cause; std::string cause;
StringSetMap noteSetMap; StringSetMap noteSetMap;
bool videoEvent; bool videoEvent;
int frames; int frames;
int alarm_frames; int alarm_frames;
unsigned int tot_score; unsigned int tot_score;
unsigned int max_score; unsigned int max_score;
char path[PATH_MAX]; char path[PATH_MAX];
VideoWriter* videowriter; VideoWriter* videowriter;
FILE* timecodes_fd; FILE* timecodes_fd;
char video_name[PATH_MAX]; char video_name[PATH_MAX];
char video_file[PATH_MAX]; char video_file[PATH_MAX];
char timecodes_name[PATH_MAX]; char timecodes_name[PATH_MAX];
char timecodes_file[PATH_MAX]; char timecodes_file[PATH_MAX];
protected: protected:
int last_db_frame; int last_db_frame;
protected: protected:
static void Initialise() static void Initialise()
{ {
if ( initialised ) if ( initialised )
return; return;
snprintf( capture_file_format, sizeof(capture_file_format), "%%s/%%0%dd-capture.jpg", config.event_image_digits ); snprintf( capture_file_format, sizeof(capture_file_format), "%%s/%%0%dd-capture.jpg", config.event_image_digits );
snprintf( analyse_file_format, sizeof(analyse_file_format), "%%s/%%0%dd-analyse.jpg", config.event_image_digits ); snprintf( analyse_file_format, sizeof(analyse_file_format), "%%s/%%0%dd-analyse.jpg", config.event_image_digits );
snprintf( general_file_format, sizeof(general_file_format), "%%s/%%0%dd-%%s", config.event_image_digits ); snprintf( general_file_format, sizeof(general_file_format), "%%s/%%0%dd-%%s", config.event_image_digits );
snprintf( video_file_format, sizeof(video_file_format), "%%s/%%s"); snprintf( video_file_format, sizeof(video_file_format), "%%s/%%s");
initialised = true; initialised = true;
} }
void createNotes( std::string &notes ); void createNotes( std::string &notes );
public: public:
static bool OpenFrameSocket( int ); static bool OpenFrameSocket( int );
static bool ValidateFrameSocket( int ); static bool ValidateFrameSocket( int );
public: public:
Event( Monitor *p_monitor, struct timeval p_start_time, const std::string &p_cause, const StringSetMap &p_noteSetMap, bool p_videoEvent=false ); Event( Monitor *p_monitor, struct timeval p_start_time, const std::string &p_cause, const StringSetMap &p_noteSetMap, bool p_videoEvent=false );
~Event(); ~Event();
int Id() const { return( id ); } int Id() const { return( id ); }
const std::string &Cause() { return( cause ); } const std::string &Cause() { return( cause ); }
int Frames() const { return( frames ); } int Frames() const { return( frames ); }
int AlarmFrames() const { return( alarm_frames ); } int AlarmFrames() const { return( alarm_frames ); }
const struct timeval &StartTime() const { return( start_time ); } const struct timeval &StartTime() const { return( start_time ); }
const struct timeval &EndTime() const { return( end_time ); } const struct timeval &EndTime() const { return( end_time ); }
struct timeval &EndTime() { return( end_time ); } struct timeval &EndTime() { return( end_time ); }
bool SendFrameImage( const Image *image, bool alarm_frame=false ); bool SendFrameImage( const Image *image, bool alarm_frame=false );
bool WriteFrameImage( Image *image, struct timeval timestamp, const char *event_file, bool alarm_frame=false ); bool WriteFrameImage( Image *image, struct timeval timestamp, const char *event_file, bool alarm_frame=false );
bool WriteFrameVideo( const Image *image, const struct timeval timestamp, VideoWriter* videow ); bool WriteFrameVideo( const Image *image, const struct timeval timestamp, VideoWriter* videow );
void updateNotes( const StringSetMap &stringSetMap ); void updateNotes( const StringSetMap &stringSetMap );
void AddFrames( int n_frames, Image **images, struct timeval **timestamps ); void AddFrames( int n_frames, Image **images, struct timeval **timestamps );
void AddFrame( Image *image, struct timeval timestamp, int score=0, Image *alarm_frame=NULL ); void AddFrame( Image *image, struct timeval timestamp, int score=0, Image *alarm_frame=NULL );
private: private:
void AddFramesInternal( int n_frames, int start_frame, Image **images, struct timeval **timestamps ); void AddFramesInternal( int n_frames, int start_frame, Image **images, struct timeval **timestamps );
public: public:
static const char *getSubPath( struct tm *time ) static const char *getSubPath( struct tm *time )
{
static char subpath[PATH_MAX] = "";
snprintf( subpath, sizeof(subpath), "%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 const char *getSubPath( time_t *time )
{
return( Event::getSubPath( localtime( time ) ) );
}
char* getEventFile(void){
return video_file;
}
public:
static int PreAlarmCount()
{
return( pre_alarm_count );
}
static void EmptyPreAlarmFrames()
{
if ( pre_alarm_count > 0 )
{ {
static char subpath[PATH_MAX] = ""; for ( int i = 0; i < MAX_PRE_ALARM_FRAMES; i++ )
snprintf( subpath, sizeof(subpath), "%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 ); delete pre_alarm_data[i].image;
delete pre_alarm_data[i].alarm_frame;
}
memset( pre_alarm_data, 0, sizeof(pre_alarm_data) );
} }
static const char *getSubPath( time_t *time ) pre_alarm_count = 0;
}
static void AddPreAlarmFrame( Image *image, struct timeval timestamp, int score=0, Image *alarm_frame=NULL )
{
pre_alarm_data[pre_alarm_count].image = new Image( *image );
pre_alarm_data[pre_alarm_count].timestamp = timestamp;
pre_alarm_data[pre_alarm_count].score = score;
if ( alarm_frame )
{ {
return( Event::getSubPath( localtime( time ) ) ); pre_alarm_data[pre_alarm_count].alarm_frame = new Image( *alarm_frame );
} }
pre_alarm_count++;
char* getEventFile(void){ }
return video_file; void SavePreAlarmFrames()
{
for ( int i = 0; i < pre_alarm_count; i++ )
{
AddFrame( pre_alarm_data[i].image, pre_alarm_data[i].timestamp, pre_alarm_data[i].score, pre_alarm_data[i].alarm_frame );
} }
EmptyPreAlarmFrames();
public: }
static int PreAlarmCount()
{
return( pre_alarm_count );
}
static void EmptyPreAlarmFrames()
{
if ( pre_alarm_count > 0 )
{
for ( int i = 0; i < MAX_PRE_ALARM_FRAMES; i++ )
{
delete pre_alarm_data[i].image;
delete pre_alarm_data[i].alarm_frame;
}
memset( pre_alarm_data, 0, sizeof(pre_alarm_data) );
}
pre_alarm_count = 0;
}
static void AddPreAlarmFrame( Image *image, struct timeval timestamp, int score=0, Image *alarm_frame=NULL )
{
pre_alarm_data[pre_alarm_count].image = new Image( *image );
pre_alarm_data[pre_alarm_count].timestamp = timestamp;
pre_alarm_data[pre_alarm_count].score = score;
if ( alarm_frame )
{
pre_alarm_data[pre_alarm_count].alarm_frame = new Image( *alarm_frame );
}
pre_alarm_count++;
}
void SavePreAlarmFrames()
{
for ( int i = 0; i < pre_alarm_count; i++ )
{
AddFrame( pre_alarm_data[i].image, pre_alarm_data[i].timestamp, pre_alarm_data[i].score, pre_alarm_data[i].alarm_frame );
}
EmptyPreAlarmFrames();
}
}; };
class EventStream : public StreamBase class EventStream : public StreamBase
{ {
public: public:
typedef enum { MODE_SINGLE, MODE_ALL, MODE_ALL_GAPLESS } StreamMode; typedef enum { MODE_SINGLE, MODE_ALL, MODE_ALL_GAPLESS } StreamMode;
protected: protected:
struct FrameData { struct FrameData {
//unsigned long id; //unsigned long id;
time_t timestamp; time_t timestamp;
time_t offset; time_t offset;
double delta; double delta;
bool in_db; bool in_db;
}; };
struct EventData struct EventData
{ {
unsigned long event_id; unsigned long event_id;
unsigned long monitor_id; unsigned long monitor_id;
unsigned long storage_id; unsigned long storage_id;
unsigned long frame_count; unsigned long frame_count;
time_t start_time; time_t start_time;
double duration; double duration;
char path[PATH_MAX]; char path[PATH_MAX];
int n_frames; int n_frames;
FrameData *frames; FrameData *frames;
char video_file[PATH_MAX]; char video_file[PATH_MAX];
}; };
protected: protected:
static const int STREAM_PAUSE_WAIT = 250000; // Microseconds static const int STREAM_PAUSE_WAIT = 250000; // Microseconds
static const StreamMode DEFAULT_MODE = MODE_SINGLE; static const StreamMode DEFAULT_MODE = MODE_SINGLE;
protected: protected:
StreamMode mode; StreamMode mode;
bool forceEventChange; bool forceEventChange;
protected: protected:
int curr_frame_id; int curr_frame_id;
double curr_stream_time; double curr_stream_time;
EventData *event_data; EventData *event_data;
protected: protected:
bool loadEventData( int event_id ); bool loadEventData( int event_id );
bool loadInitialEventData( int init_event_id, unsigned int init_frame_id ); bool loadInitialEventData( int init_event_id, unsigned int init_frame_id );
bool loadInitialEventData( int monitor_id, time_t event_time ); bool loadInitialEventData( int monitor_id, time_t event_time );
@ -254,34 +254,34 @@ protected:
void processCommand( const CmdMsg *msg ); void processCommand( const CmdMsg *msg );
bool sendFrame( int delta_us ); bool sendFrame( int delta_us );
public: public:
EventStream() EventStream()
{ {
mode = DEFAULT_MODE; mode = DEFAULT_MODE;
forceEventChange = false; forceEventChange = false;
curr_frame_id = 0; curr_frame_id = 0;
curr_stream_time = 0.0; curr_stream_time = 0.0;
event_data = 0; event_data = 0;
} }
void setStreamStart( int init_event_id, unsigned int init_frame_id=0 ) void setStreamStart( int init_event_id, unsigned int init_frame_id=0 )
{ {
loadInitialEventData( init_event_id, init_frame_id ); loadInitialEventData( init_event_id, init_frame_id );
loadMonitor( event_data->monitor_id ); loadMonitor( event_data->monitor_id );
} }
void setStreamStart( int monitor_id, time_t event_time ) void setStreamStart( int monitor_id, time_t event_time )
{ {
loadInitialEventData( monitor_id, event_time ); loadInitialEventData( monitor_id, event_time );
loadMonitor( monitor_id ); loadMonitor( monitor_id );
} }
void setStreamMode( StreamMode p_mode ) void setStreamMode( StreamMode p_mode )
{ {
mode = p_mode; mode = p_mode;
} }
void runStream(); void runStream();
Image *getImage(); Image *getImage();
}; };
#endif // ZM_EVENT_H #endif // ZM_EVENT_H

View File

@ -48,505 +48,505 @@
// //
class Monitor class Monitor
{ {
friend class MonitorStream; friend class MonitorStream;
public: public:
typedef enum typedef enum
{ {
QUERY=0, QUERY=0,
CAPTURE, CAPTURE,
ANALYSIS ANALYSIS
} Purpose; } Purpose;
typedef enum typedef enum
{ {
NONE=1, NONE=1,
MONITOR, MONITOR,
MODECT, MODECT,
RECORD, RECORD,
MOCORD, MOCORD,
NODECT NODECT
} Function; } Function;
typedef enum typedef enum
{ {
ROTATE_0=1, ROTATE_0=1,
ROTATE_90, ROTATE_90,
ROTATE_180, ROTATE_180,
ROTATE_270, ROTATE_270,
FLIP_HORI, FLIP_HORI,
FLIP_VERT FLIP_VERT
} Orientation; } Orientation;
typedef enum typedef enum
{ {
IDLE, IDLE,
PREALARM, PREALARM,
ALARM, ALARM,
ALERT, ALERT,
TAPE TAPE
} State; } State;
protected: protected:
typedef std::set<Zone *> ZoneSet; typedef std::set<Zone *> ZoneSet;
typedef enum { GET_SETTINGS=0x1, SET_SETTINGS=0x2, RELOAD=0x4, SUSPEND=0x10, RESUME=0x20 } Action; typedef enum { GET_SETTINGS=0x1, SET_SETTINGS=0x2, RELOAD=0x4, SUSPEND=0x10, RESUME=0x20 } Action;
typedef enum { CLOSE_TIME, CLOSE_IDLE, CLOSE_ALARM } EventCloseMode; typedef enum { CLOSE_TIME, CLOSE_IDLE, CLOSE_ALARM } EventCloseMode;
/* sizeof(SharedData) expected to be 336 bytes on 32bit and 64bit */ /* sizeof(SharedData) expected to be 336 bytes on 32bit and 64bit */
typedef struct typedef struct
{ {
uint32_t size; /* +0 */ uint32_t size; /* +0 */
uint32_t last_write_index; /* +4 */ uint32_t last_write_index; /* +4 */
uint32_t last_read_index; /* +8 */ uint32_t last_read_index; /* +8 */
uint32_t state; /* +12 */ uint32_t state; /* +12 */
uint32_t last_event; /* +16 */ uint32_t last_event; /* +16 */
uint32_t action; /* +20 */ uint32_t action; /* +20 */
int32_t brightness; /* +24 */ int32_t brightness; /* +24 */
int32_t hue; /* +28 */ int32_t hue; /* +28 */
int32_t colour; /* +32 */ int32_t colour; /* +32 */
int32_t contrast; /* +36 */ int32_t contrast; /* +36 */
int32_t alarm_x; /* +40 */ int32_t alarm_x; /* +40 */
int32_t alarm_y; /* +44 */ int32_t alarm_y; /* +44 */
uint8_t valid; /* +48 */ uint8_t valid; /* +48 */
uint8_t active; /* +49 */ uint8_t active; /* +49 */
uint8_t signal; /* +50 */ uint8_t signal; /* +50 */
uint8_t format; /* +51 */ uint8_t format; /* +51 */
uint32_t imagesize; /* +52 */ uint32_t imagesize; /* +52 */
uint32_t epadding1; /* +56 */ uint32_t epadding1; /* +56 */
uint32_t epadding2; /* +60 */ uint32_t epadding2; /* +60 */
/* /*
** This keeps 32bit time_t and 64bit time_t identical and compatible as long as time is before 2038. ** 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. ** Shared memory layout should be identical for both 32bit and 64bit and is multiples of 16.
*/ */
union { /* +64 */ union { /* +64 */
time_t last_write_time; time_t last_write_time;
uint64_t extrapad1; uint64_t extrapad1;
}; };
union { /* +72 */ union { /* +72 */
time_t last_read_time; time_t last_read_time;
uint64_t extrapad2; uint64_t extrapad2;
}; };
uint8_t control_state[256]; /* +80 */ uint8_t control_state[256]; /* +80 */
} SharedData;
typedef enum { TRIGGER_CANCEL, TRIGGER_ON, TRIGGER_OFF } TriggerState; } SharedData;
/* sizeof(TriggerData) expected to be 560 on 32bit & and 64bit */
typedef struct
{
uint32_t size;
uint32_t trigger_state;
uint32_t trigger_score;
uint32_t padding;
char trigger_cause[32];
char trigger_text[256];
char trigger_showtext[256];
} TriggerData;
/* sizeof(Snapshot) expected to be 16 bytes on 32bit and 32 bytes on 64bit */ typedef enum { TRIGGER_CANCEL, TRIGGER_ON, TRIGGER_OFF } TriggerState;
struct Snapshot
{
struct timeval *timestamp;
Image *image;
void* padding;
};
//TODO: Technically we can't exclude this struct when people don't have avformat as the Memory.pm module doesn't know about avformat /* sizeof(TriggerData) expected to be 560 on 32bit & and 64bit */
typedef struct
{
uint32_t size;
uint32_t trigger_state;
uint32_t trigger_score;
uint32_t padding;
char trigger_cause[32];
char trigger_text[256];
char trigger_showtext[256];
} TriggerData;
/* sizeof(Snapshot) expected to be 16 bytes on 32bit and 32 bytes on 64bit */
struct Snapshot
{
struct timeval *timestamp;
Image *image;
void* padding;
};
//TODO: Technically we can't exclude this struct when people don't have avformat as the Memory.pm module doesn't know about avformat
#if 1 #if 1
//sizeOf(VideoStoreData) expected to be 4104 bytes on 32bit and 64bit //sizeOf(VideoStoreData) expected to be 4104 bytes on 32bit and 64bit
typedef struct typedef struct
{ {
uint32_t size; uint32_t size;
char event_file[4096]; char event_file[4096];
uint32_t recording; //bool arch dependent so use uint32 instead uint32_t recording; //bool arch dependent so use uint32 instead
//uint32_t frameNumber; //uint32_t frameNumber;
} VideoStoreData; } VideoStoreData;
#endif // HAVE_LIBAVFORMAT #endif // HAVE_LIBAVFORMAT
class MonitorLink { class MonitorLink {
protected: protected:
unsigned int id; unsigned int id;
char name[64]; char name[64];
bool connected; bool connected;
time_t last_connect_time; time_t last_connect_time;
#if ZM_MEM_MAPPED #if ZM_MEM_MAPPED
int map_fd; int map_fd;
char mem_file[PATH_MAX]; char mem_file[PATH_MAX];
#else // ZM_MEM_MAPPED #else // ZM_MEM_MAPPED
int shm_id; int shm_id;
#endif // ZM_MEM_MAPPED #endif // ZM_MEM_MAPPED
off_t mem_size; off_t mem_size;
unsigned char *mem_ptr; unsigned char *mem_ptr;
volatile SharedData *shared_data; volatile SharedData *shared_data;
volatile TriggerData *trigger_data; volatile TriggerData *trigger_data;
volatile VideoStoreData *video_store_data; volatile VideoStoreData *video_store_data;
int last_state; int last_state;
int last_event; int last_event;
public:
MonitorLink( int p_id, const char *p_name );
~MonitorLink();
inline int Id() const { public:
return( id ); MonitorLink( int p_id, const char *p_name );
} ~MonitorLink();
inline const char *Name() const {
return( name );
}
inline bool isConnected() const { inline int Id() const {
return( connected ); return( id );
} }
inline time_t getLastConnectTime() const { inline const char *Name() const {
return( last_connect_time ); return( name );
} }
bool connect(); inline bool isConnected() const {
bool disconnect(); return( connected );
}
inline time_t getLastConnectTime() const {
return( last_connect_time );
}
bool isAlarmed(); bool connect();
bool inAlarm(); bool disconnect();
bool hasAlarmed();
};
protected: bool isAlarmed();
// These are read from the DB and thereafter remain unchanged bool inAlarm();
unsigned int id; bool hasAlarmed();
char name[64]; };
unsigned int server_id; // Id of the Server object
unsigned int storage_id; // Id of the Storage Object, which currently will just provide a path, but in future may do more.
Function function; // What the monitor is doing
bool enabled; // Whether the monitor is enabled or asleep
unsigned int width; // Normally the same as the camera, but not if partly rotated
unsigned int height; // Normally the same as the camera, but not if partly rotated
bool v4l_multi_buffer;
unsigned int v4l_captures_per_frame;
Orientation orientation; // Whether the image has to be rotated at all
unsigned int deinterlacing;
int savejpegspref; protected:
int videowriterpref; // These are read from the DB and thereafter remain unchanged
std::string encoderparams; unsigned int id;
std::vector<EncoderParameter_t> encoderparamsvec; char name[64];
bool record_audio; // Whether to store the audio that we receive unsigned int server_id; // Id of the Server object
unsigned int storage_id; // Id of the Storage Object, which currently will just provide a path, but in future may do more.
Function function; // What the monitor is doing
bool enabled; // Whether the monitor is enabled or asleep
unsigned int width; // Normally the same as the camera, but not if partly rotated
unsigned int height; // Normally the same as the camera, but not if partly rotated
bool v4l_multi_buffer;
unsigned int v4l_captures_per_frame;
Orientation orientation; // Whether the image has to be rotated at all
unsigned int deinterlacing;
int brightness; // The statically saved brightness of the camera int savejpegspref;
int contrast; // The statically saved contrast of the camera int videowriterpref;
int hue; // The statically saved hue of the camera std::string encoderparams;
int colour; // The statically saved colour of the camera std::vector<EncoderParameter_t> encoderparamsvec;
char event_prefix[64]; // The prefix applied to event names as they are created bool record_audio; // Whether to store the audio that we receive
char label_format[64]; // The format of the timestamp on the images
Coord label_coord; // The coordinates of the timestamp on the images
int label_size; // Size of the timestamp on the images
int image_buffer_count; // Size of circular image buffer, at least twice the size of the pre_event_count
int pre_event_buffer_count; // Size of dedicated circular pre event buffer used when analysis is not performed at capturing framerate,
// value is pre_event_count + alarm_frame_count - 1
int warmup_count; // How many images to process before looking for events
int pre_event_count; // How many images to hold and prepend to an alarm event
int post_event_count; // How many unalarmed images must occur before the alarm state is reset
int stream_replay_buffer; // How many frames to store to support DVR functions, IGNORED from this object, passed directly into zms now
int section_length; // How long events should last in continuous modes
bool adaptive_skip; // Whether to use the newer adaptive algorithm for this monitor
int frame_skip; // How many frames to skip in continuous modes
int motion_frame_skip; // How many frames to skip in motion detection
double analysis_fps; // Target framerate for video analysis
unsigned int analysis_update_delay; // How long we wait before updating analysis parameters
int capture_delay; // How long we wait between capture frames
int alarm_capture_delay; // How long we wait between capture frames when in alarm state
int alarm_frame_count; // How many alarm frames are required before an event is triggered
int fps_report_interval; // How many images should be captured/processed between reporting the current FPS
int ref_blend_perc; // Percentage of new image going into reference image.
int alarm_ref_blend_perc; // Percentage of new image going into reference image during alarm.
bool track_motion; // Whether this monitor tries to track detected motion
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 fps; int brightness; // The statically saved brightness of the camera
Image delta_image; int contrast; // The statically saved contrast of the camera
Image ref_image; int hue; // The statically saved hue of the camera
Image alarm_image; // Used in creating analysis images, will be initialized in Analysis int colour; // The statically saved colour of the camera
Image write_image; // Used when creating snapshot images char event_prefix[64]; // The prefix applied to event names as they are created
char label_format[64]; // The format of the timestamp on the images
Coord label_coord; // The coordinates of the timestamp on the images
int label_size; // Size of the timestamp on the images
int image_buffer_count; // Size of circular image buffer, at least twice the size of the pre_event_count
int pre_event_buffer_count; // Size of dedicated circular pre event buffer used when analysis is not performed at capturing framerate,
// value is pre_event_count + alarm_frame_count - 1
int warmup_count; // How many images to process before looking for events
int pre_event_count; // How many images to hold and prepend to an alarm event
int post_event_count; // How many unalarmed images must occur before the alarm state is reset
int stream_replay_buffer; // How many frames to store to support DVR functions, IGNORED from this object, passed directly into zms now
int section_length; // How long events should last in continuous modes
bool adaptive_skip; // Whether to use the newer adaptive algorithm for this monitor
int frame_skip; // How many frames to skip in continuous modes
int motion_frame_skip; // How many frames to skip in motion detection
double analysis_fps; // Target framerate for video analysis
unsigned int analysis_update_delay; // How long we wait before updating analysis parameters
int capture_delay; // How long we wait between capture frames
int alarm_capture_delay; // How long we wait between capture frames when in alarm state
int alarm_frame_count; // How many alarm frames are required before an event is triggered
int fps_report_interval; // How many images should be captured/processed between reporting the current FPS
int ref_blend_perc; // Percentage of new image going into reference image.
int alarm_ref_blend_perc; // Percentage of new image going into reference image during alarm.
bool track_motion; // Whether this monitor tries to track detected motion
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
Purpose purpose; // What this monitor has been created to do double fps;
int event_count; Image delta_image;
int image_count; Image ref_image;
int ready_count; Image alarm_image; // Used in creating analysis images, will be initialized in Analysis
int first_alarm_count; Image write_image; // Used when creating snapshot images
int last_alarm_count;
int buffer_count;
int prealarm_count;
State state;
time_t start_time;
time_t last_fps_time;
time_t auto_resume_time;
unsigned int last_motion_score;
EventCloseMode event_close_mode; Purpose purpose; // What this monitor has been created to do
int event_count;
int image_count;
int ready_count;
int first_alarm_count;
int last_alarm_count;
int buffer_count;
int prealarm_count;
State state;
time_t start_time;
time_t last_fps_time;
time_t auto_resume_time;
unsigned int last_motion_score;
EventCloseMode event_close_mode;
#if ZM_MEM_MAPPED #if ZM_MEM_MAPPED
int map_fd; int map_fd;
char mem_file[PATH_MAX]; char mem_file[PATH_MAX];
#else // ZM_MEM_MAPPED #else // ZM_MEM_MAPPED
int shm_id; int shm_id;
#endif // ZM_MEM_MAPPED #endif // ZM_MEM_MAPPED
off_t mem_size; off_t mem_size;
unsigned char *mem_ptr; unsigned char *mem_ptr;
Storage *storage; Storage *storage;
SharedData *shared_data; SharedData *shared_data;
TriggerData *trigger_data; TriggerData *trigger_data;
VideoStoreData *video_store_data; VideoStoreData *video_store_data;
Snapshot *image_buffer; Snapshot *image_buffer;
Snapshot next_buffer; /* Used by four field deinterlacing */ Snapshot next_buffer; /* Used by four field deinterlacing */
Snapshot *pre_event_buffer; Snapshot *pre_event_buffer;
Camera *camera; Camera *camera;
Event *event; Event *event;
int n_zones; int n_zones;
Zone **zones; Zone **zones;
struct timeval **timestamps; struct timeval **timestamps;
Image **images; Image **images;
const unsigned char *privacy_bitmask; const unsigned char *privacy_bitmask;
int n_linked_monitors; int n_linked_monitors;
MonitorLink **linked_monitors; MonitorLink **linked_monitors;
public: public:
// OurCheckAlarms seems to be unused. Check it on zm_monitor.cpp for more info. // OurCheckAlarms seems to be unused. Check it on zm_monitor.cpp for more info.
//bool OurCheckAlarms( Zone *zone, const Image *pImage ); //bool OurCheckAlarms( Zone *zone, const Image *pImage );
Monitor( Monitor(
int p_id, int p_id,
const char *p_name, const char *p_name,
unsigned int p_server_id, unsigned int p_server_id,
unsigned int p_storage_id, unsigned int p_storage_id,
int p_function, int p_function,
bool p_enabled, bool p_enabled,
const char *p_linked_monitors, const char *p_linked_monitors,
Camera *p_camera, Camera *p_camera,
int p_orientation, int p_orientation,
unsigned int p_deinterlacing, unsigned int p_deinterlacing,
int p_savejpegs, int p_savejpegs,
int p_videowriter, int p_videowriter,
std::string p_encoderparams, std::string p_encoderparams,
bool p_record_audio, bool p_record_audio,
const char *p_event_prefix, const char *p_event_prefix,
const char *p_label_format, const char *p_label_format,
const Coord &p_label_coord, const Coord &p_label_coord,
int label_size, int label_size,
int p_image_buffer_count, int p_image_buffer_count,
int p_warmup_count, int p_warmup_count,
int p_pre_event_count, int p_pre_event_count,
int p_post_event_count, int p_post_event_count,
int p_stream_replay_buffer, int p_stream_replay_buffer,
int p_alarm_frame_count, int p_alarm_frame_count,
int p_section_length, int p_section_length,
int p_frame_skip, int p_frame_skip,
int p_motion_frame_skip, int p_motion_frame_skip,
double p_analysis_fps, double p_analysis_fps,
unsigned int p_analysis_update_delay, unsigned int p_analysis_update_delay,
int p_capture_delay, int p_capture_delay,
int p_alarm_capture_delay, int p_alarm_capture_delay,
int p_fps_report_interval, int p_fps_report_interval,
int p_ref_blend_perc, int p_ref_blend_perc,
int p_alarm_ref_blend_perc, int p_alarm_ref_blend_perc,
bool p_track_motion, bool p_track_motion,
Rgb p_signal_check_colour, Rgb p_signal_check_colour,
bool p_embed_exif, bool p_embed_exif,
Purpose p_purpose, Purpose p_purpose,
int p_n_zones=0, int p_n_zones=0,
Zone *p_zones[]=0 Zone *p_zones[]=0
); );
~Monitor(); ~Monitor();
void AddZones( int p_n_zones, Zone *p_zones[] ); void AddZones( int p_n_zones, Zone *p_zones[] );
void AddPrivacyBitmask( Zone *p_zones[] ); void AddPrivacyBitmask( Zone *p_zones[] );
bool connect(); bool connect();
inline int ShmValid() const { inline int ShmValid() const {
return( shared_data->valid ); return( shared_data->valid );
} }
inline int Id() const { inline int Id() const {
return( id ); return( id );
} }
inline const char *Name() const { inline const char *Name() const {
return( name ); return( name );
} }
inline Storage *getStorage() { inline Storage *getStorage() {
if ( ! storage ) { if ( ! storage ) {
storage = new Storage( storage_id ); storage = new Storage( storage_id );
} }
return( storage ); return( storage );
} }
inline Function GetFunction() const { inline Function GetFunction() const {
return( function ); return( function );
} }
inline bool Enabled() { inline bool Enabled() {
if ( function <= MONITOR ) if ( function <= MONITOR )
return( false ); return( false );
return( enabled ); return( enabled );
} }
inline const char *EventPrefix() const { inline const char *EventPrefix() const {
return( event_prefix ); return( event_prefix );
} }
inline bool Ready() { inline bool Ready() {
if ( function <= MONITOR ) if ( function <= MONITOR )
return( false ); return( false );
return( image_count > ready_count ); return( image_count > ready_count );
} }
inline bool Active() { inline bool Active() {
if ( function <= MONITOR ) if ( function <= MONITOR )
return( false ); return( false );
return( enabled && shared_data->active ); return( enabled && shared_data->active );
} }
inline bool Exif() { inline bool Exif() {
return( embed_exif ); return( embed_exif );
} }
unsigned int Width() const { return width; } unsigned int Width() const { return width; }
unsigned int Height() const { return height; } unsigned int Height() const { return height; }
unsigned int Colours() const { return( camera->Colours() ); } unsigned int Colours() const { return( camera->Colours() ); }
unsigned int SubpixelOrder() const { return( camera->SubpixelOrder() ); } unsigned int SubpixelOrder() const { return( camera->SubpixelOrder() ); }
int GetOptSaveJPEGs() const { return( savejpegspref ); } int GetOptSaveJPEGs() const { return( savejpegspref ); }
int GetOptVideoWriter() const { return( videowriterpref ); } int GetOptVideoWriter() const { return( videowriterpref ); }
const std::vector<EncoderParameter_t>* GetOptEncoderParams() const { return( &encoderparamsvec ); } const std::vector<EncoderParameter_t>* GetOptEncoderParams() const { return( &encoderparamsvec ); }
State GetState() const;
int GetImage( int index=-1, int scale=100 );
struct timeval GetTimestamp( int index=-1 ) const;
void UpdateAdaptiveSkip();
useconds_t GetAnalysisRate();
unsigned int GetAnalysisUpdateDelay() const { return( analysis_update_delay ); }
int GetCaptureDelay() const { return( capture_delay ); }
int GetAlarmCaptureDelay() const { return( alarm_capture_delay ); }
unsigned int GetLastReadIndex() const;
unsigned int GetLastWriteIndex() const;
unsigned int GetLastEvent() const;
double GetFPS() const;
void ForceAlarmOn( int force_score, const char *force_case, const char *force_text="" );
void ForceAlarmOff();
void CancelForced();
TriggerState GetTriggerState() const { return( (TriggerState)(trigger_data?trigger_data->trigger_state:TRIGGER_CANCEL )); }
void actionReload(); State GetState() const;
void actionEnable(); int GetImage( int index=-1, int scale=100 );
void actionDisable(); struct timeval GetTimestamp( int index=-1 ) const;
void actionSuspend(); void UpdateAdaptiveSkip();
void actionResume(); useconds_t GetAnalysisRate();
unsigned int GetAnalysisUpdateDelay() const { return( analysis_update_delay ); }
int GetCaptureDelay() const { return( capture_delay ); }
int GetAlarmCaptureDelay() const { return( alarm_capture_delay ); }
unsigned int GetLastReadIndex() const;
unsigned int GetLastWriteIndex() const;
unsigned int GetLastEvent() const;
double GetFPS() const;
void ForceAlarmOn( int force_score, const char *force_case, const char *force_text="" );
void ForceAlarmOff();
void CancelForced();
TriggerState GetTriggerState() const { return( (TriggerState)(trigger_data?trigger_data->trigger_state:TRIGGER_CANCEL )); }
int actionBrightness( int p_brightness=-1 ); void actionReload();
int actionHue( int p_hue=-1 ); void actionEnable();
int actionColour( int p_colour=-1 ); void actionDisable();
int actionContrast( int p_contrast=-1 ); void actionSuspend();
void actionResume();
inline int PrimeCapture() { int actionBrightness( int p_brightness=-1 );
return( camera->PrimeCapture() ); int actionHue( int p_hue=-1 );
} int actionColour( int p_colour=-1 );
inline int PreCapture() { int actionContrast( int p_contrast=-1 );
return( camera->PreCapture() );
}
int Capture();
int PostCapture() {
return( camera->PostCapture() );
}
unsigned int DetectMotion( const Image &comp_image, Event::StringSet &zoneSet ); inline int PrimeCapture() {
// DetectBlack seems to be unused. Check it on zm_monitor.cpp for more info. return( camera->PrimeCapture() );
//unsigned int DetectBlack( const Image &comp_image, Event::StringSet &zoneSet ); }
bool CheckSignal( const Image *image ); inline int PreCapture() {
bool Analyse(); return( camera->PreCapture() );
void DumpImage( Image *dump_image ) const; }
void TimestampImage( Image *ts_image, const struct timeval *ts_time ) const; int Capture();
bool closeEvent(); int PostCapture() {
return( camera->PostCapture() );
}
void Reload(); unsigned int DetectMotion( const Image &comp_image, Event::StringSet &zoneSet );
void ReloadZones(); // DetectBlack seems to be unused. Check it on zm_monitor.cpp for more info.
void ReloadLinkedMonitors( const char * ); //unsigned int DetectBlack( const Image &comp_image, Event::StringSet &zoneSet );
bool CheckSignal( const Image *image );
bool Analyse();
void DumpImage( Image *dump_image ) const;
void TimestampImage( Image *ts_image, const struct timeval *ts_time ) const;
bool closeEvent();
bool DumpSettings( char *output, bool verbose ); void Reload();
void DumpZoneImage( const char *zone_string=0 ); void ReloadZones();
void ReloadLinkedMonitors( const char * );
bool DumpSettings( char *output, bool verbose );
void DumpZoneImage( const char *zone_string=0 );
#if ZM_HAS_V4L #if ZM_HAS_V4L
static int LoadLocalMonitors( const char *device, Monitor **&monitors, Purpose purpose ); static int LoadLocalMonitors( const char *device, Monitor **&monitors, Purpose purpose );
#endif // ZM_HAS_V4L #endif // ZM_HAS_V4L
static int LoadRemoteMonitors( const char *protocol, const char *host, const char*port, const char*path, Monitor **&monitors, Purpose purpose ); static int LoadRemoteMonitors( const char *protocol, const char *host, const char*port, const char*path, Monitor **&monitors, Purpose purpose );
static int LoadFileMonitors( const char *file, Monitor **&monitors, Purpose purpose ); static int LoadFileMonitors( const char *file, Monitor **&monitors, Purpose purpose );
#if HAVE_LIBAVFORMAT #if HAVE_LIBAVFORMAT
static int LoadFfmpegMonitors( const char *file, Monitor **&monitors, Purpose purpose ); static int LoadFfmpegMonitors( const char *file, Monitor **&monitors, Purpose purpose );
#endif // HAVE_LIBAVFORMAT #endif // HAVE_LIBAVFORMAT
static Monitor *Load( unsigned int id, bool load_zones, Purpose purpose ); static Monitor *Load( unsigned int id, bool load_zones, Purpose purpose );
//void writeStreamImage( Image *image, struct timeval *timestamp, int scale, int mag, int x, int y ); //void writeStreamImage( Image *image, struct timeval *timestamp, int scale, int mag, int x, int y );
//void StreamImages( int scale=100, int maxfps=10, time_t ttl=0, int msq_id=0 ); //void StreamImages( int scale=100, int maxfps=10, time_t ttl=0, int msq_id=0 );
//void StreamImagesRaw( int scale=100, int maxfps=10, time_t ttl=0 ); //void StreamImagesRaw( int scale=100, int maxfps=10, time_t ttl=0 );
//void StreamImagesZip( int scale=100, int maxfps=10, time_t ttl=0 ); //void StreamImagesZip( int scale=100, int maxfps=10, time_t ttl=0 );
void SingleImage( int scale=100 ); void SingleImage( int scale=100 );
void SingleImageRaw( int scale=100 ); void SingleImageRaw( int scale=100 );
void SingleImageZip( int scale=100 ); void SingleImageZip( int scale=100 );
#if HAVE_LIBAVCODEC #if HAVE_LIBAVCODEC
//void StreamMpeg( const char *format, int scale=100, int maxfps=10, int bitrate=100000 ); //void StreamMpeg( const char *format, int scale=100, int maxfps=10, int bitrate=100000 );
#endif // HAVE_LIBAVCODEC #endif // HAVE_LIBAVCODEC
}; };
#define MOD_ADD( var, delta, limit ) (((var)+(limit)+(delta))%(limit)) #define MOD_ADD( var, delta, limit ) (((var)+(limit)+(delta))%(limit))
class MonitorStream : public StreamBase { class MonitorStream : public StreamBase {
protected: protected:
typedef struct SwapImage { typedef struct SwapImage {
bool valid; bool valid;
struct timeval timestamp; struct timeval timestamp;
char file_name[PATH_MAX]; char file_name[PATH_MAX];
} SwapImage; } SwapImage;
private: private:
SwapImage *temp_image_buffer; SwapImage *temp_image_buffer;
int temp_image_buffer_count; int temp_image_buffer_count;
int temp_read_index; int temp_read_index;
int temp_write_index; int temp_write_index;
protected: protected:
time_t ttl; time_t ttl;
protected: protected:
int playback_buffer; int playback_buffer;
bool delayed; bool delayed;
int frame_count; int frame_count;
protected: protected:
bool checkSwapPath( const char *path, bool create_path ); bool checkSwapPath( const char *path, bool create_path );
bool sendFrame( const char *filepath, struct timeval *timestamp ); bool sendFrame( const char *filepath, struct timeval *timestamp );
bool sendFrame( Image *image, struct timeval *timestamp ); bool sendFrame( Image *image, struct timeval *timestamp );
void processCommand( const CmdMsg *msg ); void processCommand( const CmdMsg *msg );
public: public:
MonitorStream() : playback_buffer( 0 ), delayed( false ), frame_count( 0 ) { MonitorStream() : playback_buffer( 0 ), delayed( false ), frame_count( 0 ) {
} }
void setStreamBuffer( int p_playback_buffer ) { void setStreamBuffer( int p_playback_buffer ) {
playback_buffer = p_playback_buffer; playback_buffer = p_playback_buffer;
} }
void setStreamTTL( time_t p_ttl ) { void setStreamTTL( time_t p_ttl ) {
ttl = p_ttl; ttl = p_ttl;
} }
bool setStreamStart( int monitor_id ) { bool setStreamStart( int monitor_id ) {
return loadMonitor( monitor_id ); return loadMonitor( monitor_id );
} }
void runStream(); void runStream();
}; };
#endif // ZM_MONITOR_H #endif // ZM_MONITOR_H