Updated for v.16
git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@637 e3e1d417-86f3-4887-817a-d78f3d33393f
This commit is contained in:
parent
347ca48ffd
commit
21c7c8b56f
|
@ -0,0 +1,48 @@
|
|||
--
|
||||
-- This updates a 0.9.15 database to 0.9.16
|
||||
--
|
||||
-- Make changes to Monitor table
|
||||
--
|
||||
alter table Monitors change column Function OldFunction enum('None','Passive','Active','X10') NOT NULL default 'Passive';
|
||||
alter table Monitors add column Function enum('None','Monitor','Modect','Record','Mocord') NOT NULL default 'Monitor';
|
||||
alter table Monitors add column RunMode enum('Continuous','Triggered') NOT NULL default 'Continuous' after Function;
|
||||
alter table Monitors add column Triggers set('X10') NOT NULL after RunMode;
|
||||
alter table Monitors add column SectionLength int(10) unsigned not null default 600 after PostEventCount;
|
||||
--
|
||||
-- Update to reflect existing setup
|
||||
--
|
||||
update Monitors set Function = 'Monitor' where OldFunction = 'Passive';
|
||||
update Monitors set Function = 'Modect' where OldFunction = 'Active';
|
||||
update Monitors set Function = 'Modect' where OldFunction = 'X10';
|
||||
update Monitors set RunMode = 'Triggered' where OldFunction = 'X10';
|
||||
update Monitors set Triggers = 'X10' where OldFunction = 'X10';
|
||||
--
|
||||
-- Create the X10 triggers table
|
||||
--
|
||||
CREATE TABLE TriggersX10 (
|
||||
MonitorId int(10) unsigned NOT NULL default '0',
|
||||
Activation varchar(32) default NULL,
|
||||
AlarmInput varchar(32) default NULL,
|
||||
AlarmOutput varchar(32) default NULL,
|
||||
PRIMARY KEY (MonitorId)
|
||||
) TYPE=MyISAM;
|
||||
--
|
||||
-- Update to reflect existing setup
|
||||
--
|
||||
insert into TriggersX10 select Id, X10Activation, X10AlarmInput, X10AlarmOutput from Monitors where Function = 'X10';
|
||||
--
|
||||
-- Clean up temporary and unused columns
|
||||
--
|
||||
alter table Monitors drop column OldFunction ;
|
||||
alter table Monitors drop column X10Activation ;
|
||||
alter table Monitors drop column X10AlarmInput ;
|
||||
alter table Monitors drop column X10AlarmOutput ;
|
||||
--
|
||||
-- These are optional, but we might as well
|
||||
--
|
||||
optimize table Frames;
|
||||
optimize table Events;
|
||||
optimize table Filters;
|
||||
optimize table Zones;
|
||||
optimize table Monitors;
|
||||
optimize table Stats;
|
|
@ -106,7 +106,9 @@ CREATE TABLE Monitors (
|
|||
Id int(10) unsigned NOT NULL auto_increment,
|
||||
Name tinytext NOT NULL,
|
||||
Type enum('Local','Remote') NOT NULL default 'Local',
|
||||
Function enum('None','Passive','Active','X10') NOT NULL default 'Passive',
|
||||
Function enum('None','Monitor','Modect','Record','Mocord') NOT NULL default 'Monitor',
|
||||
RunMode enum('Continuous','Triggered') NOT NULL default 'Continuous',
|
||||
Triggers set('X10') NOT NULL default '',
|
||||
Device tinyint(3) unsigned NOT NULL default '0',
|
||||
Channel tinyint(3) unsigned NOT NULL default '0',
|
||||
Format tinyint(3) unsigned NOT NULL default '0',
|
||||
|
@ -124,12 +126,10 @@ CREATE TABLE Monitors (
|
|||
WarmupCount smallint(5) unsigned NOT NULL default '25',
|
||||
PreEventCount smallint(5) unsigned NOT NULL default '10',
|
||||
PostEventCount smallint(5) unsigned NOT NULL default '10',
|
||||
SectionLength int(10) unsigned NOT NULL default '600',
|
||||
MaxFPS decimal(5,2) NOT NULL default '0.00',
|
||||
FPSReportInterval smallint(5) unsigned NOT NULL default '250',
|
||||
RefBlendPerc tinyint(3) unsigned NOT NULL default '10',
|
||||
X10Activation varchar(32) default NULL,
|
||||
X10AlarmInput varchar(32) default NULL,
|
||||
X10AlarmOutput varchar(32) default NULL,
|
||||
PRIMARY KEY (Id)
|
||||
) TYPE=MyISAM;
|
||||
|
||||
|
@ -158,6 +158,18 @@ CREATE TABLE Stats (
|
|||
KEY ZoneId (ZoneId)
|
||||
) TYPE=MyISAM;
|
||||
|
||||
--
|
||||
-- Table structure for table 'TriggersX10'
|
||||
--
|
||||
|
||||
CREATE TABLE TriggersX10 (
|
||||
MonitorId int(10) unsigned NOT NULL default '0',
|
||||
Activation varchar(32) default NULL,
|
||||
AlarmInput varchar(32) default NULL,
|
||||
AlarmOutput varchar(32) default NULL,
|
||||
PRIMARY KEY (MonitorId)
|
||||
) TYPE=MyISAM;
|
||||
|
||||
--
|
||||
-- Table structure for table 'Users'
|
||||
--
|
||||
|
@ -211,4 +223,3 @@ CREATE TABLE Zones (
|
|||
-- Create a default admin user.
|
||||
--
|
||||
insert into Users values ('','admin',password('admin'),1,'View','Edit','Edit','Edit',NULL);
|
||||
|
||||
|
|
|
@ -178,7 +178,9 @@ if ( $command =~ /^(?:start|restart)$/ )
|
|||
{
|
||||
execute( ZM_PATH_BIN."/zmdc.pl start zmc -H $monitor->{Host} -P $monitor->{Port} -p '$monitor->{Path}'" );
|
||||
}
|
||||
if ( $monitor->{Function} eq 'Active' )
|
||||
if (( $monitor->{Function} eq 'Modect' )
|
||||
|| ( $monitor->{Function} eq 'Record' )
|
||||
|| ( $monitor->{Function} eq 'Mocord' ))
|
||||
{
|
||||
if ( ZM_OPT_FRAME_SERVER )
|
||||
{
|
||||
|
|
|
@ -43,6 +43,7 @@ Event::Event( Monitor *p_monitor, struct timeval p_start_time ) : monitor( p_mon
|
|||
exit( mysql_errno( &dbconn ) );
|
||||
}
|
||||
id = mysql_insert_id( &dbconn );
|
||||
end_time.tv_sec = 0;
|
||||
frames = 0;
|
||||
alarm_frames = 0;
|
||||
tot_score = 0;
|
||||
|
@ -66,12 +67,16 @@ Event::~Event()
|
|||
static char sql[BUFSIZ];
|
||||
static char end_time_str[32];
|
||||
|
||||
if ( !end_time.tv_sec )
|
||||
{
|
||||
gettimeofday( &end_time, &dummy_tz );
|
||||
}
|
||||
struct DeltaTimeval delta_time;
|
||||
DELTA_TIMEVAL( delta_time, end_time, start_time, DT_PREC_2 );
|
||||
|
||||
strftime( end_time_str, sizeof(end_time_str), "%Y-%m-%d %H:%M:%S", localtime( &end_time.tv_sec ) );
|
||||
|
||||
sprintf( sql, "update Events set Name='Event-%d', EndTime = '%s', Length = %s%ld.%02ld, Frames = %d, AlarmFrames = %d, TotScore = %d, AvgScore = %d, MaxScore = %d where Id = %d", id, end_time_str, delta_time.positive?"":"-", delta_time.sec, delta_time.fsec, frames, alarm_frames, tot_score, (int)(tot_score/alarm_frames), max_score, id );
|
||||
sprintf( sql, "update Events set Name='Event-%d', EndTime = '%s', Length = %s%ld.%02ld, Frames = %d, AlarmFrames = %d, TotScore = %d, AvgScore = %d, MaxScore = %d where Id = %d", id, end_time_str, delta_time.positive?"":"-", delta_time.sec, delta_time.fsec, frames, alarm_frames, tot_score, (int)(alarm_frames?(tot_score/alarm_frames):0), max_score, id );
|
||||
if ( mysql_query( &dbconn, sql ) )
|
||||
{
|
||||
Error(( "Can't update event: %s", mysql_error( &dbconn ) ));
|
||||
|
|
|
@ -73,6 +73,9 @@ public:
|
|||
int Frames() const { return( frames ); }
|
||||
int AlarmFrames() const { return( alarm_frames ); }
|
||||
|
||||
const struct timeval &StartTime() const { return( start_time ); }
|
||||
const struct timeval &EndTime() const { return( end_time ); }
|
||||
|
||||
bool SendFrameImage( const Image *image, bool alarm_frame=false );
|
||||
bool WriteFrameImage( const Image *image, const char *event_file, bool alarm_frame=false );
|
||||
|
||||
|
|
|
@ -26,32 +26,117 @@
|
|||
#include "zm_local_camera.h"
|
||||
#include "zm_remote_camera.h"
|
||||
|
||||
Monitor::Monitor( int p_id, char *p_name, int p_function, int p_device, int p_channel, int p_format, int p_width, int p_height, int p_palette, int p_orientation, char *p_label_format, const Coord &p_label_coord, int p_image_buffer_count, int p_warmup_count, int p_pre_event_count, int p_post_event_count, int p_capture_delay, int p_fps_report_interval, int p_ref_blend_perc, Mode p_mode, int p_n_zones, Zone *p_zones[] ) : id( p_id ), function( (Function)p_function ), width( p_width ), height( p_height ), orientation( (Orientation)p_orientation ), label_coord( p_label_coord ), image_buffer_count( p_image_buffer_count ), warmup_count( p_warmup_count ), pre_event_count( p_pre_event_count ), post_event_count( p_post_event_count ), capture_delay( p_capture_delay ), fps_report_interval( p_fps_report_interval ), ref_blend_perc( p_ref_blend_perc ), image( width, height, (p_palette==VIDEO_PALETTE_GREY?1:3) ), ref_image( width, height, (p_palette==VIDEO_PALETTE_GREY?1:3) ), mode( p_mode ), n_zones( p_n_zones ), zones( p_zones )
|
||||
Monitor::Monitor(
|
||||
int p_id,
|
||||
char *p_name,
|
||||
int p_function,
|
||||
int p_device,
|
||||
int p_channel,
|
||||
int p_format,
|
||||
int p_width,
|
||||
int p_height,
|
||||
int p_palette,
|
||||
int p_orientation,
|
||||
char *p_label_format,
|
||||
const Coord &p_label_coord,
|
||||
int p_image_buffer_count,
|
||||
int p_warmup_count,
|
||||
int p_pre_event_count,
|
||||
int p_post_event_count,
|
||||
int p_section_length,
|
||||
int p_capture_delay,
|
||||
int p_fps_report_interval,
|
||||
int p_ref_blend_perc,
|
||||
Purpose p_purpose,
|
||||
int p_n_zones,
|
||||
Zone *p_zones[]
|
||||
) : id( p_id ),
|
||||
function( (Function)p_function ),
|
||||
width( p_width ),
|
||||
height( p_height ),
|
||||
orientation( (Orientation)p_orientation ),
|
||||
label_coord( p_label_coord ),
|
||||
image_buffer_count( p_image_buffer_count ),
|
||||
warmup_count( p_warmup_count ),
|
||||
pre_event_count( p_pre_event_count ),
|
||||
post_event_count( p_post_event_count ),
|
||||
section_length( p_section_length ),
|
||||
capture_delay( p_capture_delay ),
|
||||
fps_report_interval( p_fps_report_interval ),
|
||||
ref_blend_perc( p_ref_blend_perc ),
|
||||
image( width, height, (p_palette==VIDEO_PALETTE_GREY?1:3) ),
|
||||
ref_image( width, height, (p_palette==VIDEO_PALETTE_GREY?1:3) ),
|
||||
purpose( p_purpose ),
|
||||
n_zones( p_n_zones ),
|
||||
zones( p_zones )
|
||||
{
|
||||
name = new char[strlen(p_name)+1];
|
||||
strcpy( name, p_name );
|
||||
|
||||
strcpy( label_format, p_label_format );
|
||||
|
||||
camera = new LocalCamera( p_device, p_channel, p_format, (p_orientation%2)?width:height, (orientation%2)?height:width, p_palette, mode==CAPTURE );
|
||||
camera = new LocalCamera( p_device, p_channel, p_format, (p_orientation%2)?width:height, (orientation%2)?height:width, p_palette, purpose==CAPTURE );
|
||||
|
||||
Initialise();
|
||||
}
|
||||
|
||||
Monitor::Monitor( int p_id, char *p_name, int p_function, const char *p_host, const char *p_port, const char *p_path, int p_width, int p_height, int p_palette, int p_orientation, char *p_label_format, const Coord &p_label_coord, int p_image_buffer_count, int p_warmup_count, int p_pre_event_count, int p_post_event_count, int p_capture_delay, int p_fps_report_interval, int p_ref_blend_perc, Mode p_mode, int p_n_zones, Zone *p_zones[] ) : id( p_id ), function( (Function)p_function ), width( p_width ), height( p_height ), orientation( (Orientation)p_orientation ), label_coord( p_label_coord ), image_buffer_count( p_image_buffer_count ), warmup_count( p_warmup_count ), pre_event_count( p_pre_event_count ), post_event_count( p_post_event_count ), capture_delay( p_capture_delay ), fps_report_interval( p_fps_report_interval ), ref_blend_perc( p_ref_blend_perc ), image( width, height, (p_palette==VIDEO_PALETTE_GREY?1:3) ), ref_image( width, height, (p_palette==VIDEO_PALETTE_GREY?1:3) ), mode( p_mode ), n_zones( p_n_zones ), zones( p_zones )
|
||||
Monitor::Monitor(
|
||||
int p_id,
|
||||
char *p_name,
|
||||
int p_function,
|
||||
const char *p_host,
|
||||
const char *p_port,
|
||||
const char *p_path,
|
||||
int p_width,
|
||||
int p_height,
|
||||
int p_palette,
|
||||
int p_orientation,
|
||||
char *p_label_format,
|
||||
const Coord &p_label_coord,
|
||||
int p_image_buffer_count,
|
||||
int p_warmup_count,
|
||||
int p_pre_event_count,
|
||||
int p_post_event_count,
|
||||
int p_section_length,
|
||||
int p_capture_delay,
|
||||
int p_fps_report_interval,
|
||||
int p_ref_blend_perc,
|
||||
Purpose p_purpose,
|
||||
int p_n_zones,
|
||||
Zone *p_zones[]
|
||||
) : id( p_id ),
|
||||
function( (Function)p_function ),
|
||||
width( p_width ),
|
||||
height( p_height ),
|
||||
orientation( (Orientation)p_orientation ),
|
||||
label_coord( p_label_coord ),
|
||||
image_buffer_count( p_image_buffer_count ),
|
||||
warmup_count( p_warmup_count ),
|
||||
pre_event_count( p_pre_event_count ),
|
||||
post_event_count( p_post_event_count ),
|
||||
section_length( p_section_length ),
|
||||
capture_delay( p_capture_delay ),
|
||||
fps_report_interval( p_fps_report_interval ),
|
||||
ref_blend_perc( p_ref_blend_perc ),
|
||||
image( width, height, (p_palette==VIDEO_PALETTE_GREY?1:3) ),
|
||||
ref_image( width, height, (p_palette==VIDEO_PALETTE_GREY?1:3) ),
|
||||
purpose( p_purpose ),
|
||||
n_zones( p_n_zones ),
|
||||
zones( p_zones )
|
||||
{
|
||||
name = new char[strlen(p_name)+1];
|
||||
strcpy( name, p_name );
|
||||
|
||||
strcpy( label_format, p_label_format );
|
||||
|
||||
camera = new RemoteCamera( p_host, p_port, p_path, (p_orientation%2)?width:height, (orientation%2)?height:width, p_palette, mode==CAPTURE );
|
||||
camera = new RemoteCamera( p_host, p_port, p_path, (p_orientation%2)?width:height, (orientation%2)?height:width, p_palette, purpose==CAPTURE );
|
||||
|
||||
Initialise();
|
||||
}
|
||||
|
||||
Monitor::~Monitor()
|
||||
{
|
||||
delete event;
|
||||
delete[] image_buffer;
|
||||
|
||||
struct shmid_ds shm_data;
|
||||
|
@ -80,7 +165,7 @@ void Monitor::Initialise()
|
|||
last_alarm_count = 0;
|
||||
state = IDLE;
|
||||
|
||||
Info(( "monitor mode=%d", mode ));
|
||||
Info(( "monitor purpose=%d", purpose ));
|
||||
|
||||
int shared_data_size = sizeof(SharedData)+(image_buffer_count*sizeof(time_t))+(image_buffer_count*camera->ImageSize());
|
||||
Info(( "shm.size=%d", shared_data_size ));
|
||||
|
@ -98,7 +183,7 @@ void Monitor::Initialise()
|
|||
exit( -1 );
|
||||
}
|
||||
|
||||
if ( mode == CAPTURE )
|
||||
if ( purpose == CAPTURE )
|
||||
{
|
||||
memset( shared_data, 0, shared_data_size );
|
||||
shared_data->valid = true;
|
||||
|
@ -144,7 +229,7 @@ void Monitor::Initialise()
|
|||
|
||||
record_event_stats = (bool)config.Item( ZM_RECORD_EVENT_STATS );
|
||||
|
||||
if ( mode == ANALYSIS )
|
||||
if ( purpose == ANALYSIS )
|
||||
{
|
||||
static char path[PATH_MAX];
|
||||
|
||||
|
@ -271,7 +356,7 @@ void Monitor::CancelForced()
|
|||
|
||||
int Monitor::Brightness( int p_brightness )
|
||||
{
|
||||
if ( mode != CAPTURE )
|
||||
if ( purpose != CAPTURE )
|
||||
{
|
||||
if ( p_brightness >= 0 )
|
||||
{
|
||||
|
@ -305,7 +390,7 @@ int Monitor::Brightness( int p_brightness )
|
|||
|
||||
int Monitor::Contrast( int p_contrast )
|
||||
{
|
||||
if ( mode != CAPTURE )
|
||||
if ( purpose != CAPTURE )
|
||||
{
|
||||
if ( p_contrast >= 0 )
|
||||
{
|
||||
|
@ -339,7 +424,7 @@ int Monitor::Contrast( int p_contrast )
|
|||
|
||||
int Monitor::Hue( int p_hue )
|
||||
{
|
||||
if ( mode != CAPTURE )
|
||||
if ( purpose != CAPTURE )
|
||||
{
|
||||
if ( p_hue >= 0 )
|
||||
{
|
||||
|
@ -373,7 +458,7 @@ int Monitor::Hue( int p_hue )
|
|||
|
||||
int Monitor::Colour( int p_colour )
|
||||
{
|
||||
if ( mode != CAPTURE )
|
||||
if ( purpose != CAPTURE )
|
||||
{
|
||||
if ( p_colour >= 0 )
|
||||
{
|
||||
|
@ -514,30 +599,62 @@ bool Monitor::Analyse()
|
|||
unsigned int score = 0;
|
||||
if ( Ready() )
|
||||
{
|
||||
if ( shared_data->force_state != FORCE_OFF )
|
||||
if ( function != RECORD && shared_data->force_state != FORCE_OFF )
|
||||
score = Compare( *image );
|
||||
if ( shared_data->force_state == FORCE_ON )
|
||||
score = (int)config.Item( ZM_FORCED_ALARM_SCORE );
|
||||
|
||||
if ( function == RECORD || function == MOCORD )
|
||||
{
|
||||
if ( !event )
|
||||
{
|
||||
// Create event
|
||||
event = new Event( this, *timestamp );
|
||||
|
||||
Info(( "%s: %03d - Starting new event", name, image_count ));
|
||||
|
||||
//if ( (bool)config.Item( ZM_OVERLAP_TIMED_EVENTS ) )
|
||||
if ( 1 )
|
||||
{
|
||||
int pre_index = ((index+image_buffer_count)-pre_event_count)%image_buffer_count;
|
||||
struct timeval *timestamps[pre_event_count];
|
||||
const Image *images[pre_event_count];
|
||||
for ( int i = 0; i < pre_event_count; i++ )
|
||||
{
|
||||
timestamps[i] = image_buffer[pre_index].timestamp;
|
||||
images[i] = image_buffer[pre_index].image;
|
||||
|
||||
pre_index = (pre_index+1)%image_buffer_count;
|
||||
}
|
||||
event->AddFrames( pre_event_count, timestamps, images );
|
||||
//event->AddFrame( now, &image );
|
||||
}
|
||||
shared_data->state = state = TAPE;
|
||||
}
|
||||
//last_alarm_count = image_count;
|
||||
}
|
||||
if ( score )
|
||||
{
|
||||
if ( state == IDLE )
|
||||
{
|
||||
event = new Event( this, *timestamp );
|
||||
|
||||
Info(( "%s: %03d - Gone into alarm state", name, image_count ));
|
||||
int pre_index = ((index+image_buffer_count)-pre_event_count)%image_buffer_count;
|
||||
struct timeval *timestamps[pre_event_count];
|
||||
const Image *images[pre_event_count];
|
||||
for ( int i = 0; i < pre_event_count; i++ )
|
||||
if ( function != MOCORD )
|
||||
{
|
||||
timestamps[i] = image_buffer[pre_index].timestamp;
|
||||
images[i] = image_buffer[pre_index].image;
|
||||
event = new Event( this, *timestamp );
|
||||
|
||||
pre_index = (pre_index+1)%image_buffer_count;
|
||||
int pre_index = ((index+image_buffer_count)-pre_event_count)%image_buffer_count;
|
||||
struct timeval *timestamps[pre_event_count];
|
||||
const Image *images[pre_event_count];
|
||||
for ( int i = 0; i < pre_event_count; i++ )
|
||||
{
|
||||
timestamps[i] = image_buffer[pre_index].timestamp;
|
||||
images[i] = image_buffer[pre_index].image;
|
||||
|
||||
pre_index = (pre_index+1)%image_buffer_count;
|
||||
}
|
||||
event->AddFrames( pre_event_count, timestamps, images );
|
||||
//event->AddFrame( now, &image );
|
||||
}
|
||||
event->AddFrames( pre_event_count, timestamps, images );
|
||||
//event->AddFrame( now, &image );
|
||||
}
|
||||
shared_data->state = state = ALARM;
|
||||
last_alarm_count = image_count;
|
||||
|
@ -554,8 +671,16 @@ bool Monitor::Analyse()
|
|||
{
|
||||
Info(( "%s: %03d - Left alarm state (%d) - %d(%d) images", name, image_count, event->Id(), event->Frames(), event->AlarmFrames() ));
|
||||
shared_data->last_event = event->Id();
|
||||
delete event;
|
||||
shared_data->state = state = IDLE;
|
||||
if ( function != MOCORD )
|
||||
{
|
||||
shared_data->state = state = IDLE;
|
||||
delete event;
|
||||
event = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
shared_data->state = state = TAPE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -582,6 +707,18 @@ bool Monitor::Analyse()
|
|||
event->AddFrame( now, image );
|
||||
}
|
||||
}
|
||||
if ( function == RECORD || function == MOCORD )
|
||||
{
|
||||
if ( state == IDLE || state == TAPE )
|
||||
{
|
||||
if ( ((timestamp->tv_sec%section_length) == 0) && ((timestamp->tv_sec - event->StartTime().tv_sec) > (section_length/2)) )
|
||||
{
|
||||
Info(( "Ended event" ));
|
||||
delete event;
|
||||
event = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( (bool)config.Item( ZM_BLEND_ALARMED_IMAGES ) || state != ALARM )
|
||||
|
@ -608,16 +745,16 @@ void Monitor::ReloadZones()
|
|||
DumpZoneImage();
|
||||
}
|
||||
|
||||
int Monitor::Load( int device, Monitor **&monitors, Mode mode )
|
||||
int Monitor::Load( int device, Monitor **&monitors, Purpose purpose )
|
||||
{
|
||||
static char sql[BUFSIZ];
|
||||
if ( device == -1 )
|
||||
{
|
||||
strcpy( sql, "select Id, Name, Function+0, Device, Channel, Format, Width, Height, Palette, Orientation+0, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, MaxFPS, FPSReportInterval, RefBlendPerc from Monitors where Function != 'None' and Type = 'Local'" );
|
||||
strcpy( sql, "select Id, Name, Function+0, Device, Channel, Format, Width, Height, Palette, Orientation+0, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, SectionLength, MaxFPS, FPSReportInterval, RefBlendPerc from Monitors where Function != 'None' and Type = 'Local'" );
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf( sql, "select Id, Name, Function+0, Device, Channel, Format, Width, Height, Palette, Orientation+0, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, MaxFPS, FPSReportInterval, RefBlendPerc from Monitors where Function != 'None' and Type = 'Local' and Device = %d", device );
|
||||
sprintf( sql, "select Id, Name, Function+0, Device, Channel, Format, Width, Height, Palette, Orientation+0, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, SectionLength, MaxFPS, FPSReportInterval, RefBlendPerc from Monitors where Function != 'None' and Type = 'Local' and Device = %d", device );
|
||||
}
|
||||
if ( mysql_query( &dbconn, sql ) )
|
||||
{
|
||||
|
@ -637,7 +774,7 @@ int Monitor::Load( int device, Monitor **&monitors, Mode mode )
|
|||
monitors = new Monitor *[n_monitors];
|
||||
for( int i = 0; MYSQL_ROW dbrow = mysql_fetch_row( result ); i++ )
|
||||
{
|
||||
monitors[i] = new Monitor( atoi(dbrow[0]), dbrow[1], atoi(dbrow[2]), atoi(dbrow[3]), atoi(dbrow[4]), atoi(dbrow[5]), atoi(dbrow[6]), atoi(dbrow[7]), atoi(dbrow[8]), atoi(dbrow[9]), dbrow[10], Coord( atoi(dbrow[11]), atoi(dbrow[12]) ), atoi(dbrow[13]), atoi(dbrow[14]), atoi(dbrow[15]), atoi(dbrow[16]), atof(dbrow[17])>0.0?int(DT_PREC_3/atof(dbrow[17])):0, atoi(dbrow[18]), atoi(dbrow[19]), mode );
|
||||
monitors[i] = new Monitor( atoi(dbrow[0]), dbrow[1], atoi(dbrow[2]), atoi(dbrow[3]), atoi(dbrow[4]), atoi(dbrow[5]), atoi(dbrow[6]), atoi(dbrow[7]), atoi(dbrow[8]), atoi(dbrow[9]), dbrow[10], Coord( atoi(dbrow[11]), atoi(dbrow[12]) ), atoi(dbrow[13]), atoi(dbrow[14]), atoi(dbrow[15]), atoi(dbrow[16]), atoi(dbrow[17]), atof(dbrow[18])>0.0?int(DT_PREC_3/atof(dbrow[18])):0, atoi(dbrow[19]), atoi(dbrow[20]), purpose );
|
||||
Zone **zones = 0;
|
||||
int n_zones = Zone::Load( monitors[i], zones );
|
||||
monitors[i]->AddZones( n_zones, zones );
|
||||
|
@ -654,16 +791,16 @@ int Monitor::Load( int device, Monitor **&monitors, Mode mode )
|
|||
return( n_monitors );
|
||||
}
|
||||
|
||||
int Monitor::Load( const char *host, const char*port, const char *path, Monitor **&monitors, Mode mode )
|
||||
int Monitor::Load( const char *host, const char*port, const char *path, Monitor **&monitors, Purpose purpose )
|
||||
{
|
||||
static char sql[BUFSIZ];
|
||||
if ( !host )
|
||||
{
|
||||
strcpy( sql, "select Id, Name, Function+0, Host, Port, Path, Width, Height, Palette, Orientation+0, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, MaxFPS, FPSReportInterval, RefBlendPerc from Monitors where Function != 'None' and Type = 'Remote'" );
|
||||
strcpy( sql, "select Id, Name, Function+0, Host, Port, Path, Width, Height, Palette, Orientation+0, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, SectionLength, MaxFPS, FPSReportInterval, RefBlendPerc from Monitors where Function != 'None' and Type = 'Remote'" );
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf( sql, "select Id, Name, Function+0, Host, Port, Path, Width, Height, Palette, Orientation+0, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, MaxFPS, FPSReportInterval, RefBlendPerc from Monitors where Function != 'None' and Type = 'Remote' and Host = '%s' and Port = '%s' and Path = '%s'", host, port, path );
|
||||
sprintf( sql, "select Id, Name, Function+0, Host, Port, Path, Width, Height, Palette, Orientation+0, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, SectionLength, MaxFPS, FPSReportInterval, RefBlendPerc from Monitors where Function != 'None' and Type = 'Remote' and Host = '%s' and Port = '%s' and Path = '%s'", host, port, path );
|
||||
}
|
||||
if ( mysql_query( &dbconn, sql ) )
|
||||
{
|
||||
|
@ -683,7 +820,7 @@ int Monitor::Load( const char *host, const char*port, const char *path, Monitor
|
|||
monitors = new Monitor *[n_monitors];
|
||||
for( int i = 0; MYSQL_ROW dbrow = mysql_fetch_row( result ); i++ )
|
||||
{
|
||||
monitors[i] = new Monitor( atoi(dbrow[0]), dbrow[1], atoi(dbrow[2]), dbrow[3], dbrow[4], dbrow[5], atoi(dbrow[6]), atoi(dbrow[7]), atoi(dbrow[8]), atoi(dbrow[9]), dbrow[10], Coord( atoi(dbrow[11]), atoi(dbrow[12]) ), atoi(dbrow[13]), atoi(dbrow[14]), atoi(dbrow[15]), atoi(dbrow[16]), atof(dbrow[17])>0.0?int(DT_PREC_3/atof(dbrow[17])):0, atoi(dbrow[18]), atoi(dbrow[19]), mode );
|
||||
monitors[i] = new Monitor( atoi(dbrow[0]), dbrow[1], atoi(dbrow[2]), dbrow[3], dbrow[4], dbrow[5], atoi(dbrow[6]), atoi(dbrow[7]), atoi(dbrow[8]), atoi(dbrow[9]), dbrow[10], Coord( atoi(dbrow[11]), atoi(dbrow[12]) ), atoi(dbrow[13]), atoi(dbrow[14]), atoi(dbrow[15]), atoi(dbrow[16]), atoi(dbrow[17]), atof(dbrow[18])>0.0?int(DT_PREC_3/atof(dbrow[18])):0, atoi(dbrow[19]), atoi(dbrow[20]), purpose );
|
||||
Zone **zones = 0;
|
||||
int n_zones = Zone::Load( monitors[i], zones );
|
||||
monitors[i]->AddZones( n_zones, zones );
|
||||
|
@ -700,10 +837,10 @@ int Monitor::Load( const char *host, const char*port, const char *path, Monitor
|
|||
return( n_monitors );
|
||||
}
|
||||
|
||||
Monitor *Monitor::Load( int id, bool load_zones, Mode mode )
|
||||
Monitor *Monitor::Load( int id, bool load_zones, Purpose purpose )
|
||||
{
|
||||
static char sql[BUFSIZ];
|
||||
sprintf( sql, "select Id, Name, Type, Function+0, Device, Channel, Format, Host, Port, Path, Width, Height, Palette, Orientation+0, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, MaxFPS, FPSReportInterval, RefBlendPerc from Monitors where Id = %d", id );
|
||||
sprintf( sql, "select Id, Name, Type, Function+0, Device, Channel, Format, Host, Port, Path, Width, Height, Palette, Orientation+0, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, SectionLength, MaxFPS, FPSReportInterval, RefBlendPerc from Monitors where Id = %d", id );
|
||||
if ( mysql_query( &dbconn, sql ) )
|
||||
{
|
||||
Error(( "Can't run query: %s", mysql_error( &dbconn ) ));
|
||||
|
@ -723,11 +860,11 @@ Monitor *Monitor::Load( int id, bool load_zones, Mode mode )
|
|||
{
|
||||
if ( !strcmp( dbrow[2], "Local" ) )
|
||||
{
|
||||
monitor = new Monitor( atoi(dbrow[0]), dbrow[1], atoi(dbrow[3]), atoi(dbrow[4]), atoi(dbrow[5]), atoi(dbrow[6]), atoi(dbrow[10]), atoi(dbrow[11]), atoi(dbrow[12]), atoi(dbrow[13]), dbrow[14], Coord( atoi(dbrow[15]), atoi(dbrow[16]) ), atoi(dbrow[17]), atoi(dbrow[18]), atoi(dbrow[19]), atoi(dbrow[20]), atof(dbrow[21])>0.0?int(DT_PREC_3/atof(dbrow[21])):0, atoi(dbrow[22]), atoi(dbrow[23]), mode );
|
||||
monitor = new Monitor( atoi(dbrow[0]), dbrow[1], atoi(dbrow[3]), atoi(dbrow[4]), atoi(dbrow[5]), atoi(dbrow[6]), atoi(dbrow[10]), atoi(dbrow[11]), atoi(dbrow[12]), atoi(dbrow[13]), dbrow[14], Coord( atoi(dbrow[15]), atoi(dbrow[16]) ), atoi(dbrow[17]), atoi(dbrow[18]), atoi(dbrow[19]), atoi(dbrow[20]), atoi(dbrow[21]), atof(dbrow[22])>0.0?int(DT_PREC_3/atof(dbrow[22])):0, atoi(dbrow[23]), atoi(dbrow[24]), purpose );
|
||||
}
|
||||
else
|
||||
{
|
||||
monitor = new Monitor( atoi(dbrow[0]), dbrow[1], atoi(dbrow[3]), dbrow[7], dbrow[8], dbrow[9], atoi(dbrow[10]), atoi(dbrow[11]), atoi(dbrow[12]), atoi(dbrow[13]), dbrow[14], Coord( atoi(dbrow[15]), atoi(dbrow[16]) ), atoi(dbrow[17]), atoi(dbrow[18]), atoi(dbrow[19]), atoi(dbrow[20]), atof(dbrow[21])>0.0?int(DT_PREC_3/atof(dbrow[21])):0, atoi(dbrow[22]), atoi(dbrow[23]), mode );
|
||||
monitor = new Monitor( atoi(dbrow[0]), dbrow[1], atoi(dbrow[3]), dbrow[7], dbrow[8], dbrow[9], atoi(dbrow[10]), atoi(dbrow[11]), atoi(dbrow[12]), atoi(dbrow[13]), dbrow[14], Coord( atoi(dbrow[15]), atoi(dbrow[16]) ), atoi(dbrow[17]), atoi(dbrow[18]), atoi(dbrow[19]), atoi(dbrow[20]), atoi(dbrow[21]), atof(dbrow[22])>0.0?int(DT_PREC_3/atof(dbrow[22])):0, atoi(dbrow[23]), atoi(dbrow[24]), purpose );
|
||||
}
|
||||
int n_zones = 0;
|
||||
if ( load_zones )
|
||||
|
@ -830,14 +967,16 @@ bool Monitor::DumpSettings( char *output, bool verbose )
|
|||
sprintf( output+strlen(output), "Warmup Count : %d\n", warmup_count );
|
||||
sprintf( output+strlen(output), "Pre Event Count : %d\n", pre_event_count );
|
||||
sprintf( output+strlen(output), "Post Event Count : %d\n", post_event_count );
|
||||
sprintf( output+strlen(output), "Section Length : %d\n", section_length );
|
||||
sprintf( output+strlen(output), "Maximum FPS : %.2f\n", capture_delay?DT_PREC_3/capture_delay:0.0 );
|
||||
sprintf( output+strlen(output), "Reference Blend %%ge : %d\n", ref_blend_perc );
|
||||
sprintf( output+strlen(output), "Function: %d - %s\n", function,
|
||||
function==NONE?"None":(
|
||||
function==ACTIVE?"Active":(
|
||||
function==PASSIVE?"Passive":(
|
||||
function==X10?"X10":"Unknown"
|
||||
))));
|
||||
function==OFF?"None":(
|
||||
function==MONITOR?"Monitor":(
|
||||
function==MODECT?"Motion Detection":(
|
||||
function==RECORD?"Continuous Record":(
|
||||
function==MOCORD?"Continuous Record with Motion Detection":"Unknown"
|
||||
)))));
|
||||
sprintf( output+strlen(output), "Zones : %d\n", n_zones );
|
||||
for ( int i = 0; i < n_zones; i++ )
|
||||
{
|
||||
|
|
|
@ -41,19 +41,26 @@ public:
|
|||
QUERY=0,
|
||||
CAPTURE,
|
||||
ANALYSIS
|
||||
} Mode;
|
||||
} Purpose;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
NONE=1,
|
||||
PASSIVE,
|
||||
ACTIVE,
|
||||
X10
|
||||
CONTINUOUS=0,
|
||||
TRIGGERED,
|
||||
} RunMode;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
OFF=1,
|
||||
MONITOR,
|
||||
MODECT,
|
||||
RECORD,
|
||||
MOCORD
|
||||
} Function;
|
||||
|
||||
typedef enum { ROTATE_0=1, ROTATE_90, ROTATE_180, ROTATE_270 } Orientation;
|
||||
|
||||
typedef enum { IDLE, ALARM, ALERT } State;
|
||||
typedef enum { IDLE, ALARM, ALERT, TAPE } State;
|
||||
|
||||
protected:
|
||||
// These are read from the DB and thereafter remain unchanged
|
||||
|
@ -62,6 +69,7 @@ protected:
|
|||
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
|
||||
Function function; // What the monitor is doing
|
||||
RunMode run_mode; // Whether the monitor is running continuously or is triggered
|
||||
Orientation orientation; // Whether the image has to be rotated at all
|
||||
char label_format[64]; // The format of the timestamp on the images
|
||||
Coord label_coord; // The coordinates of the timestamp on the images
|
||||
|
@ -69,11 +77,12 @@ protected:
|
|||
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 section_length; // How long events should last in continuous modes
|
||||
int capture_delay; // How long we wait between capture frames
|
||||
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.
|
||||
|
||||
Mode mode; // What this monitor has been created to do
|
||||
Purpose purpose; // What this monitor has been created to do
|
||||
|
||||
double fps;
|
||||
Image image;
|
||||
|
@ -125,8 +134,8 @@ protected:
|
|||
Camera *camera;
|
||||
|
||||
public:
|
||||
Monitor( int p_id, char *p_name, int p_function, int p_device, int p_channel, int p_format, int p_width, int p_height, int p_palette, int p_orientation, char *p_label_format, const Coord &p_label_coord, int p_image_buffer_count, int p_warmup_count, int p_pre_event_count, int p_post_event_count, int p_capture_delay, int p_fps_report_interval, int p_ref_blend_perc, Mode p_mode=QUERY, int p_n_zones=0, Zone *p_zones[]=0 );
|
||||
Monitor( int p_id, char *p_name, int p_function, const char *p_host, const char *p_port, const char *p_path, int p_width, int p_height, int p_palette, int p_orientation, char *p_label_format, const Coord &p_label_coord, int p_image_buffer_count, int p_warmup_count, int p_pre_event_count, int p_post_event_count, int p_capture_delay, int p_fps_report_interval, int p_ref_blend_perc, Mode p_mode=QUERY, int p_n_zones=0, Zone *p_zones[]=0 );
|
||||
Monitor( int p_id, char *p_name, int p_function, int p_device, int p_channel, int p_format, int p_width, int p_height, int p_palette, int p_orientation, char *p_label_format, const Coord &p_label_coord, int p_image_buffer_count, int p_warmup_count, int p_pre_event_count, int p_post_event_count, int p_section_length, int p_capture_delay, int p_fps_report_interval, int p_ref_blend_perc, Purpose p_purpose=QUERY, int p_n_zones=0, Zone *p_zones[]=0 );
|
||||
Monitor( int p_id, char *p_name, int p_function, const char *p_host, const char *p_port, const char *p_path, int p_width, int p_height, int p_palette, int p_orientation, char *p_label_format, const Coord &p_label_coord, int p_image_buffer_count, int p_warmup_count, int p_pre_event_count, int p_post_event_count, int p_section_length, int p_capture_delay, int p_fps_report_interval, int p_ref_blend_perc, Purpose p_purpose=QUERY, int p_n_zones=0, Zone *p_zones[]=0 );
|
||||
~Monitor();
|
||||
|
||||
void Initialise();
|
||||
|
@ -195,7 +204,7 @@ public:
|
|||
|
||||
int index = image_count%image_buffer_count;
|
||||
|
||||
if ( index == shared_data->last_read_index && function == ACTIVE )
|
||||
if ( index == shared_data->last_read_index && function > MONITOR )
|
||||
{
|
||||
Warning(( "Buffer overrun at index %d\n", index ));
|
||||
}
|
||||
|
@ -237,7 +246,7 @@ public:
|
|||
|
||||
inline bool Ready()
|
||||
{
|
||||
return( function >= ACTIVE && image_count > warmup_count );
|
||||
return( function > MONITOR && image_count > warmup_count );
|
||||
}
|
||||
|
||||
void DumpImage( Image *image ) const;
|
||||
|
@ -250,9 +259,9 @@ public:
|
|||
|
||||
unsigned int Compare( const Image &image );
|
||||
void ReloadZones();
|
||||
static int Load( int device, Monitor **&monitors, Mode mode=QUERY );
|
||||
static int Load( const char *host, const char*port, const char*path, Monitor **&monitors, Mode mode=QUERY );
|
||||
static Monitor *Load( int id, bool load_zones=false, Mode mode=QUERY );
|
||||
static int Load( int device, Monitor **&monitors, Purpose purpose=QUERY );
|
||||
static int Load( const char *host, const char*port, const char*path, Monitor **&monitors, Purpose purpose=QUERY );
|
||||
static Monitor *Load( int id, bool load_zones=false, Purpose purpose=QUERY );
|
||||
void StreamImages( unsigned long idle=5000, unsigned long refresh=50, FILE *fd=stdout, time_t ttl=0 );
|
||||
};
|
||||
|
||||
|
|
|
@ -222,50 +222,94 @@ if ( $action )
|
|||
}
|
||||
|
||||
$changes = array();
|
||||
if ( $new_name != $monitor[Name] ) $changes[] = "Name = '$new_name'";
|
||||
if ( $new_function != $monitor['Function'] ) $changes[] = "Function = '$new_function'";
|
||||
if ( $new_type != $monitor['Type'] ) $changes[] = "Type = '$new_type'";
|
||||
if ( $new_type == "Local" )
|
||||
switch( $tab )
|
||||
{
|
||||
if ( $new_device != $monitor['Device'] ) $changes[] = "Device = '$new_device'";
|
||||
if ( $new_channel != $monitor['Channel'] ) $changes[] = "Channel = '$new_channel'";
|
||||
if ( $new_format != $monitor['Format'] ) $changes[] = "Format = '$new_format'";
|
||||
case 'monitor' :
|
||||
{
|
||||
if ( $new_name != $monitor[Name] ) $changes[] = "Name = '$new_name'";
|
||||
if ( $new_function != $monitor['Function'] ) $changes[] = "Function = '$new_function'";
|
||||
if ( $new_runmode != $monitor['RunMode'] ) $changes[] = "RunMode = '$new_runmode'";
|
||||
if ( join(',',$new_triggers) != $monitor['Triggers'] ) $changes[] = "Triggers = '".join(',',$new_triggers)."'";
|
||||
if ( $new_type != $monitor['Type'] ) $changes[] = "Type = '$new_type'";
|
||||
break;
|
||||
}
|
||||
case 'source' :
|
||||
{
|
||||
if ( $monitor['Type'] == "Local" )
|
||||
{
|
||||
if ( $new_device != $monitor['Device'] ) $changes[] = "Device = '$new_device'";
|
||||
if ( $new_channel != $monitor['Channel'] ) $changes[] = "Channel = '$new_channel'";
|
||||
if ( $new_format != $monitor['Format'] ) $changes[] = "Format = '$new_format'";
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( $new_host != $monitor['Device'] ) $changes[] = "Host = '$new_host'";
|
||||
if ( $new_port != $monitor['Channel'] ) $changes[] = "port = '$new_port'";
|
||||
if ( $new_path != $monitor['Format'] ) $changes[] = "Path = '$new_path'";
|
||||
}
|
||||
if ( $new_width != $monitor['Width'] ) $changes[] = "Width = '$new_width'";
|
||||
if ( $new_height != $monitor['Height'] ) $changes[] = "Height = '$new_height'";
|
||||
if ( $new_palette != $monitor['Palette'] ) $changes[] = "Palette = '$new_palette'";
|
||||
if ( $new_orientation != $monitor['Orientation'] ) $changes[] = "Orientation = '$new_orientation'";
|
||||
break;
|
||||
}
|
||||
case 'timestamp' :
|
||||
{
|
||||
if ( $new_label_format != $monitor['LabelFormat'] ) $changes[] = "LabelFormat = '$new_label_format'";
|
||||
if ( $new_label_x != $monitor['LabelX'] ) $changes[] = "LabelX = '$new_label_x'";
|
||||
if ( $new_label_y != $monitor['LabelY'] ) $changes[] = "LabelY = '$new_label_y'";
|
||||
break;
|
||||
}
|
||||
case 'buffers' :
|
||||
{
|
||||
if ( $new_image_buffer_count != $monitor['ImageBufferCount'] ) $changes[] = "ImageBufferCount = '$new_image_buffer_count'";
|
||||
if ( $new_warmup_count != $monitor['WarmupCount'] ) $changes[] = "WarmupCount = '$new_warmup_count'";
|
||||
if ( $new_pre_event_count != $monitor['PreEventCount'] ) $changes[] = "PreEventCount = '$new_pre_event_count'";
|
||||
if ( $new_post_event_count != $monitor['PostEventCount'] ) $changes[] = "PostEventCount = '$new_post_event_count'";
|
||||
break;
|
||||
}
|
||||
case 'misc' :
|
||||
{
|
||||
if ( $new_section_length != $monitor['SectionLength'] ) $changes[] = "SectionLength = '$new_section_length'";
|
||||
if ( $new_max_fps != $monitor['MaxFPS'] ) $changes[] = "MaxFPS = '$new_max_fps'";
|
||||
if ( $new_fps_report_interval != $monitor['FPSReportInterval'] ) $changes[] = "FPSReportInterval = '$new_fps_report_interval'";
|
||||
if ( $new_ref_blend_perc != $monitor['RefBlendPerc'] ) $changes[] = "RefBlendPerc = '$new_ref_blend_perc'";
|
||||
break;
|
||||
}
|
||||
case 'x10' :
|
||||
{
|
||||
if ( $new_activation != $monitor['Activation'] ) $changes[] = "Activation = '$new_activation'";
|
||||
if ( $new_alarm_input != $monitor['AlarmInput'] ) $changes[] = "AlarmInput = '$new_alarm_input'";
|
||||
if ( $new_alarm_output != $monitor['AlarmOutput'] ) $changes[] = "AlarmOutput = '$new_alarm_output'";
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( $new_host != $monitor['Device'] ) $changes[] = "Host = '$new_host'";
|
||||
if ( $new_port != $monitor['Channel'] ) $changes[] = "port = '$new_port'";
|
||||
if ( $new_path != $monitor['Format'] ) $changes[] = "Path = '$new_path'";
|
||||
}
|
||||
if ( $new_width != $monitor['Width'] ) $changes[] = "Width = '$new_width'";
|
||||
if ( $new_height != $monitor['Height'] ) $changes[] = "Height = '$new_height'";
|
||||
if ( $new_palette != $monitor['Palette'] ) $changes[] = "Palette = '$new_palette'";
|
||||
if ( $new_orientation != $monitor['Orientation'] ) $changes[] = "Orientation = '$new_orientation'";
|
||||
if ( $new_label_format != $monitor['LabelFormat'] ) $changes[] = "LabelFormat = '$new_label_format'";
|
||||
if ( $new_label_x != $monitor['LabelX'] ) $changes[] = "LabelX = '$new_label_x'";
|
||||
if ( $new_label_y != $monitor['LabelY'] ) $changes[] = "LabelY = '$new_label_y'";
|
||||
if ( $new_image_buffer_count != $monitor['ImageBufferCount'] ) $changes[] = "ImageBufferCount = '$new_image_buffer_count'";
|
||||
if ( $new_warmup_count != $monitor['WarmupCount'] ) $changes[] = "WarmupCount = '$new_warmup_count'";
|
||||
if ( $new_pre_event_count != $monitor['PreEventCount'] ) $changes[] = "PreEventCount = '$new_pre_event_count'";
|
||||
if ( $new_post_event_count != $monitor['PostEventCount'] ) $changes[] = "PostEventCount = '$new_post_event_count'";
|
||||
if ( $new_max_fps != $monitor['MaxFPS'] ) $changes[] = "MaxFPS = '$new_max_fps'";
|
||||
if ( $new_fps_report_interval != $monitor['FPSReportInterval'] ) $changes[] = "FPSReportInterval = '$new_fps_report_interval'";
|
||||
if ( $new_ref_blend_perc != $monitor['RefBlendPerc'] ) $changes[] = "RefBlendPerc = '$new_ref_blend_perc'";
|
||||
if ( $new_x10_activation != $monitor['X10Activation'] ) $changes[] = "X10Activation = '$new_x10_activation'";
|
||||
if ( $new_x10_alarm_input != $monitor['X10AlarmInput'] ) $changes[] = "X10AlarmInput = '$new_x10_alarm_input'";
|
||||
if ( $new_x10_alarm_output != $monitor['X10AlarmOutput'] ) $changes[] = "X10AlarmOutput = '$new_x10_alarm_output'";
|
||||
|
||||
if ( count( $changes ) )
|
||||
{
|
||||
if ( $mid > 0 )
|
||||
{
|
||||
$sql = "update Monitors set ".implode( ", ", $changes )." where Id = '$mid'";
|
||||
$result = mysql_query( $sql );
|
||||
if ( !$result )
|
||||
die( mysql_error() );
|
||||
if ( $new_name != $monitor[Name] )
|
||||
switch( $tab )
|
||||
{
|
||||
exec( escapeshellcmd( "mv ".EVENTS_PATH."/$monitor[Name] ".EVENTS_PATH."/$new_name" ) );
|
||||
case 'x10' :
|
||||
{
|
||||
$sql = "update TriggersX10 set ".implode( ", ", $changes )." where MonitorId = '$mid'";
|
||||
$result = mysql_query( $sql );
|
||||
if ( !$result )
|
||||
die( mysql_error() );
|
||||
break;
|
||||
}
|
||||
default :
|
||||
{
|
||||
$sql = "update Monitors set ".implode( ", ", $changes )." where Id = '$mid'";
|
||||
$result = mysql_query( $sql );
|
||||
if ( !$result )
|
||||
die( mysql_error() );
|
||||
if ( $new_name != $monitor[Name] )
|
||||
{
|
||||
exec( escapeshellcmd( "mv ".EVENTS_PATH."/$monitor[Name] ".EVENTS_PATH."/$new_name" ) );
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif ( !$user[MonitorIds] )
|
||||
|
@ -279,7 +323,7 @@ if ( $action )
|
|||
$result = mysql_query( $sql );
|
||||
if ( !$result )
|
||||
die( mysql_error() );
|
||||
$view = 'none';
|
||||
//$view = 'none';
|
||||
}
|
||||
$result = mysql_query( "select * from Monitors where Id = '$mid'" );
|
||||
if ( !$result )
|
||||
|
@ -488,6 +532,7 @@ if ( $action )
|
|||
{
|
||||
$HTTP_SESSION_VARS[event_reset_time] = strftime( "%Y-%m-%d %H:%M:%S" );
|
||||
setcookie( "event_reset_time", $HTTP_SESSION_VARS[event_reset_time], time()+3600*24*30*12*10 );
|
||||
session_write_close();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -127,7 +127,7 @@ $jws = array(
|
|||
'console' => array( 'w'=>720, 'h'=>400 ),
|
||||
'cycle' => array( 'w'=>46, 'h'=>80 ),
|
||||
'montage' => array( 'w'=>20, 'h'=>20 ),
|
||||
'monitor' => array( 'w'=>420, 'h'=>512 ),
|
||||
'monitor' => array( 'w'=>360, 'h'=>300 ),
|
||||
'watch' => array( 'w'=>72, 'h'=>315 ),
|
||||
'device' => array( 'w'=>196, 'h'=>164 ),
|
||||
'function' => array( 'w'=>248, 'h'=>92 ),
|
||||
|
|
|
@ -38,4 +38,9 @@ function getEnumValues( $table, $column )
|
|||
}
|
||||
return $enum_values;
|
||||
}
|
||||
|
||||
function getSetValues( $table, $column )
|
||||
{
|
||||
return( getEnumValues( $table, $column ) );
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -37,6 +37,7 @@ function userLogin( $username, $password )
|
|||
{
|
||||
$HTTP_SESSION_VARS[user] = array();
|
||||
}
|
||||
session_write_close();
|
||||
}
|
||||
|
||||
function userLogout()
|
||||
|
@ -195,12 +196,12 @@ function zmcControl( $monitor, $restart=false )
|
|||
{
|
||||
if ( $monitor[Type] == "Local" )
|
||||
{
|
||||
$sql = "select count(if(Function='Passive',1,NULL)) as PassiveCount, count(if(Function='Active',1,NULL)) as ActiveCount, count(if(Function='X10',1,NULL)) as X10Count from Monitors where Device = '$monitor[Device]'";
|
||||
$sql = "select count(if(Function='Monitor',1,NULL)) as PassiveCount, count(if(Function>'Monitor',1,NULL)) as ActiveCount, count(if(Function='X10',1,NULL)) as X10Count from Monitors where Device = '$monitor[Device]'";
|
||||
$zmc_args = "-d $monitor[Device]";
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = "select count(if(Function='Passive',1,NULL)) as PassiveCount, count(if(Function='Active',1,NULL)) as ActiveCount, count(if(Function='X10',1,NULL)) as X10Count from Monitors where Host = '$monitor[Host]' and Port = '$monitor[Port]' and Path = '$monitor[Path]'";
|
||||
$sql = "select count(if(Function='Monitor',1,NULL)) as PassiveCount, count(if(Function>'Monitor',1,NULL)) as ActiveCount, count(if(Function='X10',1,NULL)) as X10Count from Monitors where Host = '$monitor[Host]' and Port = '$monitor[Port]' and Path = '$monitor[Path]'";
|
||||
$zmc_args = "-H $monitor[Host] -P $monitor[Port] -p '$monitor[Path]'";
|
||||
}
|
||||
$result = mysql_query( $sql );
|
||||
|
@ -235,9 +236,30 @@ function zmaControl( $monitor, $restart=false )
|
|||
echo mysql_error();
|
||||
$monitor = mysql_fetch_assoc( $result );
|
||||
}
|
||||
if ( $monitor['Function'] == 'Active' )
|
||||
switch ( $monitor['Function'] )
|
||||
{
|
||||
if ( $restart )
|
||||
case 'Modect' :
|
||||
case 'Record' :
|
||||
case 'Mocord' :
|
||||
{
|
||||
if ( $restart )
|
||||
{
|
||||
daemonControl( "stop", "zmfilter.pl", "-m $monitor[Id] -e -1" );
|
||||
daemonControl( "stop", "zma", "-m $monitor[Id]" );
|
||||
if ( ZM_OPT_FRAME_SERVER )
|
||||
{
|
||||
daemonControl( "stop", "zmf", "-m $monitor[Id]" );
|
||||
}
|
||||
}
|
||||
if ( ZM_OPT_FRAME_SERVER )
|
||||
{
|
||||
daemonControl( "start", "zmf", "-m $monitor[Id]" );
|
||||
}
|
||||
daemonControl( "start", "zma", "-m $monitor[Id]" );
|
||||
daemonControl( "start", "zmfilter.pl", "-m $monitor[Id] -e -1" );
|
||||
break;
|
||||
}
|
||||
default :
|
||||
{
|
||||
daemonControl( "stop", "zmfilter.pl", "-m $monitor[Id] -e -1" );
|
||||
daemonControl( "stop", "zma", "-m $monitor[Id]" );
|
||||
|
@ -245,21 +267,7 @@ function zmaControl( $monitor, $restart=false )
|
|||
{
|
||||
daemonControl( "stop", "zmf", "-m $monitor[Id]" );
|
||||
}
|
||||
}
|
||||
if ( ZM_OPT_FRAME_SERVER )
|
||||
{
|
||||
daemonControl( "start", "zmf", "-m $monitor[Id]" );
|
||||
}
|
||||
daemonControl( "start", "zma", "-m $monitor[Id]" );
|
||||
daemonControl( "start", "zmfilter.pl", "-m $monitor[Id] -e -1" );
|
||||
}
|
||||
else
|
||||
{
|
||||
daemonControl( "stop", "zmfilter.pl", "-m $monitor[Id] -e -1" );
|
||||
daemonControl( "stop", "zma", "-m $monitor[Id]" );
|
||||
if ( ZM_OPT_FRAME_SERVER )
|
||||
{
|
||||
daemonControl( "stop", "zmf", "-m $monitor[Id]" );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ ini_set( "session.use_trans_sid", "0" );
|
|||
ini_set( "session.name", "ZMSESSID" );
|
||||
//ini_set( "magic_quotes_gpc", "Off" );
|
||||
|
||||
session_start();
|
||||
//session_start();
|
||||
|
||||
require_once( 'zm_config.php' );
|
||||
|
||||
|
|
|
@ -5,10 +5,12 @@
|
|||
|
||||
if ( $stop )
|
||||
{
|
||||
session_write_close();
|
||||
packageControl( 'stop' );
|
||||
}
|
||||
if ( $start )
|
||||
{
|
||||
session_write_close();
|
||||
packageControl( 'start' );
|
||||
}
|
||||
|
||||
|
@ -203,21 +205,21 @@ window.setTimeout( "window.location.replace('<?= $PHP_SELF ?>')", <?= ($start||$
|
|||
$dclass = "gretext";
|
||||
}
|
||||
}
|
||||
if ( $monitor['Function'] == 'Active' )
|
||||
if ( $monitor['Function'] == 'None' )
|
||||
{
|
||||
$fclass = "gretext";
|
||||
$fclass = "redtext";
|
||||
}
|
||||
elseif ( $monitor['Function'] == 'Passive' )
|
||||
{
|
||||
$fclass = "ambtext";
|
||||
}
|
||||
elseif ( $monitor['Function'] == 'X10' )
|
||||
elseif ( $monitor['RunMode'] == 'Triggered' )
|
||||
{
|
||||
$fclass = "blutext";
|
||||
}
|
||||
elseif ( $monitor['Function'] == 'Monitor' )
|
||||
{
|
||||
$fclass = "ambtext";
|
||||
}
|
||||
else
|
||||
{
|
||||
$fclass = "redtext";
|
||||
$fclass = "gretext";
|
||||
}
|
||||
?>
|
||||
<td align="left" class="text"><?= makeLink( "javascript: newWindow( '$PHP_SELF?view=watch&mid=$monitor[Id]', 'zmWatch$monitor[Name]', ".($monitor[Width]+$jws['watch']['w']).", ".($monitor[Height]+$jws['watch']['h'])." );", $monitor[Name], canView( 'Stream' ) ) ?></td>
|
||||
|
|
|
@ -136,14 +136,6 @@
|
|||
}
|
||||
$sql .= " order by $sort_column $sort_order";
|
||||
//echo $sql;
|
||||
$result = mysql_query( $sql );
|
||||
if ( !$result )
|
||||
{
|
||||
die( mysql_error() );
|
||||
}
|
||||
$n_rows = mysql_num_rows( $result );
|
||||
|
||||
//echo $filter_query;
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
|
@ -201,11 +193,21 @@ function configureButton(form,name)
|
|||
<?php } ?>
|
||||
}
|
||||
window.focus();
|
||||
<?php if ( $filter ) { ?>
|
||||
opener.location.reload(true);
|
||||
<?php
|
||||
if ( $filter )
|
||||
{
|
||||
?>
|
||||
//opener.location.reload(true);
|
||||
filterWindow( '<?= $PHP_SELF ?>?view=filter&mid=<?= $mid ?><?= $filter_query ?>', 'zmFilter<?= $monitor[Name] ?>' );
|
||||
location.href = '<?= $PHP_SELF ?>?view=events&mid=<?= $mid ?><?= $filter_query ?>';
|
||||
<?php } ?>
|
||||
location.replace( '<?= $PHP_SELF ?>?view=events&mid=<?= $mid ?><?= $filter_query ?>' );
|
||||
</script>
|
||||
</head>
|
||||
</html>
|
||||
<?php
|
||||
}
|
||||
else
|
||||
{
|
||||
?>
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
@ -231,11 +233,19 @@ location.href = '<?= $PHP_SELF ?>?view=events&mid=<?= $mid ?><?= $filter_query ?
|
|||
<tr><td colspan="3" class="text"> </td></tr>
|
||||
<tr><td colspan="3"><table border="0" cellspacing="1" cellpadding="0" width="100%" bgcolor="#7F7FB2">
|
||||
<?php
|
||||
$count = 0;
|
||||
while( $row = mysql_fetch_assoc( $result ) )
|
||||
{
|
||||
if ( ($count++%EVENT_HEADER_LINES) == 0 )
|
||||
$result = mysql_query( $sql );
|
||||
if ( !$result )
|
||||
{
|
||||
die( mysql_error() );
|
||||
}
|
||||
$n_rows = mysql_num_rows( $result );
|
||||
|
||||
//echo $filter_query;
|
||||
$count = 0;
|
||||
while( $row = mysql_fetch_assoc( $result ) )
|
||||
{
|
||||
if ( ($count++%EVENT_HEADER_LINES) == 0 )
|
||||
{
|
||||
?>
|
||||
<tr align="center" bgcolor="#FFFFFF">
|
||||
<td class="text"><a href="<?= $PHP_SELF ?>?view=events&mid=<?= $mid ?><?= $filter_query ?><?= $sort_parms ?>&sort_field=Id&sort_asc=<?= $sort_field == 'Id'?!$sort_asc:0 ?>">Id<?php if ( $sort_field == "Id" ) if ( $sort_asc ) echo "(^)"; else echo "(v)"; ?></a></td>
|
||||
|
@ -250,13 +260,13 @@ location.href = '<?= $PHP_SELF ?>?view=events&mid=<?= $mid ?><?= $filter_query ?
|
|||
<td class="text">Mark</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
if ( $row[LearnState] == '+' )
|
||||
$bgcolor = "#98FB98";
|
||||
elseif ( $row[LearnState] == '-' )
|
||||
$bgcolor = "#FFC0CB";
|
||||
else
|
||||
unset( $bgcolor );
|
||||
}
|
||||
if ( $row[LearnState] == '+' )
|
||||
$bgcolor = "#98FB98";
|
||||
elseif ( $row[LearnState] == '-' )
|
||||
$bgcolor = "#FFC0CB";
|
||||
else
|
||||
unset( $bgcolor );
|
||||
?>
|
||||
<tr<?= ' bgcolor="'.($bgcolor?$bgcolor:"#FFFFFF").'"' ?> >
|
||||
<td align="center" class="text"><a href="javascript: eventWindow( '<?= $PHP_SELF ?>?view=event&mid=<?= $mid ?>&eid=<?= $row[Id] ?>', 'zmEvent' );"><span class="<?= $textclass ?>"><?= "$row[Id]" ?><?php if ( $row[Archived] ) echo "*" ?></span></a></td>
|
||||
|
@ -271,7 +281,7 @@ location.href = '<?= $PHP_SELF ?>?view=events&mid=<?= $mid ?><?= $filter_query ?
|
|||
<td align="center" class="text"><input type="checkbox" name="mark_eids[]" value="<?= $row[Id] ?>" onClick="configureButton( document.event_form, 'mark_eids' );"<?php if ( !canEdit( 'Events' ) ) { ?> disabled<?php } ?>></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
</table></td></tr>
|
||||
</table></td>
|
||||
|
@ -281,3 +291,6 @@ location.href = '<?= $PHP_SELF ?>?view=events&mid=<?= $mid ?><?= $filter_query ?
|
|||
</form>
|
||||
</body>
|
||||
</html>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -112,7 +112,7 @@ function submitToEvents( form )
|
|||
var Height = <?= $jws['events']['h'] ?>;
|
||||
var Options = 'resizable,scrollbars,width='+Width+',height='+Height;
|
||||
|
||||
window.open( Url, Name, Options );
|
||||
//window.open( Url, Name, Options );
|
||||
form.target = Name;
|
||||
form.view.value = 'events';
|
||||
form.submit();
|
||||
|
|
|
@ -4,18 +4,45 @@
|
|||
$view = "error";
|
||||
return;
|
||||
}
|
||||
|
||||
$tabs = array();
|
||||
$tabs["monitor"] = "Monitor";
|
||||
$tabs["source"] = "Source";
|
||||
$tabs["timestamp"] = "Timestamp";
|
||||
$tabs["buffers"] = "Buffers";
|
||||
$tabs["misc"] = "Misc";
|
||||
if ( ZM_OPT_X10 )
|
||||
{
|
||||
$tabs["x10"] = "X10";
|
||||
}
|
||||
|
||||
if ( !$tab )
|
||||
$tab = "monitor";
|
||||
|
||||
if ( $mid > 0 )
|
||||
{
|
||||
$result = mysql_query( "select * from Monitors where Id = '$mid'" );
|
||||
if ( !$result )
|
||||
die( mysql_error() );
|
||||
$monitor = mysql_fetch_assoc( $result );
|
||||
if ( ZM_OPT_X10 )
|
||||
{
|
||||
$result = mysql_query( "select * from TriggersX10 where MonitorId = '$mid'" );
|
||||
if ( !$result )
|
||||
die( mysql_error() );
|
||||
$x10_monitor = mysql_fetch_assoc( $result );
|
||||
foreach( $x10_monitor as $key=>$value )
|
||||
{
|
||||
$monitor['X10'.$key] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$monitor = array();
|
||||
$monitor[Name] = "New";
|
||||
$monitor['Function'] = "None";
|
||||
$monitor['RunMode'] = "Continuous";
|
||||
$monitor[Type] = "Local";
|
||||
$monitor[Port] = "80";
|
||||
$monitor[Orientation] = "0";
|
||||
|
@ -26,6 +53,7 @@
|
|||
$monitor[WarmupCount] = 25;
|
||||
$monitor[PreEventCount] = 10;
|
||||
$monitor[PostEventCount] = 10;
|
||||
$monitor[SectionLength] = 600;
|
||||
$monitor[MaxFPS] = 0;
|
||||
$monitor[FPSReportInterval] = 1000;
|
||||
$monitor[RefBlendPerc] = 10;
|
||||
|
@ -62,76 +90,174 @@ function closeWindow()
|
|||
<body>
|
||||
<table border="0" cellspacing="0" cellpadding="0" width="100%">
|
||||
<tr>
|
||||
<td colspan="2" align="left" class="head">Monitor <?= $monitor[Name] ?></td>
|
||||
<td align="left" class="head">Monitor <?= $monitor[Name] ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
</tr>
|
||||
</table>
|
||||
<table border="0" cellspacing="0" cellpadding="4" width="100%">
|
||||
<tr>
|
||||
<?php
|
||||
foreach ( $tabs as $name=>$value )
|
||||
{
|
||||
if ( $tab == $name )
|
||||
{
|
||||
?>
|
||||
<td width="10" class="activetab"><?= $value ?></td>
|
||||
<?php
|
||||
}
|
||||
else
|
||||
{
|
||||
?>
|
||||
<td width="10" class="passivetab"><a href="<?= $PHP_SELF ?>?view=<?= $view ?>&tab=<?= $name ?>&mid=<?= $mid ?>"?><?= $value ?></a></td>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
<td class="nontab"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
<table border="0" cellspacing="0" cellpadding="2" width="100%">
|
||||
<form name="monitor_form" method="get" action="<?= $PHP_SELF ?>" onsubmit="return validateForm( document.monitor_form )">
|
||||
<input type="hidden" name="view" value="<?= $view ?>">
|
||||
<input type="hidden" name="action" value="">
|
||||
<input type="hidden" name="tab" value="<?= $tab ?>">
|
||||
<input type="hidden" name="action" value="monitor">
|
||||
<input type="hidden" name="mid" value="<?= $mid ?>">
|
||||
<tr>
|
||||
<td align="left" class="smallhead">Parameter</td><td align="left" class="smallhead">Value</td>
|
||||
<td align="left" class="smallhead" width="70%">Parameter</td><td align="left" class="smallhead" width="30%">Value</td>
|
||||
</tr>
|
||||
<?php
|
||||
switch ( $tab )
|
||||
{
|
||||
case 'monitor' :
|
||||
{
|
||||
?>
|
||||
<tr><td align="left" class="text">Name</td><td align="left" class="text"><input type="text" name="new_name" value="<?= $monitor[Name] ?>" size="12" class="form"></td></tr>
|
||||
<tr><td align="left" class="text">Function</td><td align="left" class="text"><select name="new_function" class="form">
|
||||
<?php
|
||||
foreach ( getEnumValues( 'Monitors', 'Function' ) as $opt_function )
|
||||
{
|
||||
if ( !ZM_OPT_X10 && $opt_function == 'X10' )
|
||||
continue;
|
||||
?>
|
||||
<option value="<?= $opt_function ?>"<?php if ( $opt_function == $monitor['Function'] ) { ?> selected<?php } ?>><?= $opt_function ?></option>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select></td></tr>
|
||||
<tr><td align="left" class="text">Run Mode</td><td align="left" class="text"><select name="new_runmode" class="form">
|
||||
<?php
|
||||
foreach ( getEnumValues( 'Monitors', 'RunMode' ) as $opt_runmode )
|
||||
{
|
||||
?>
|
||||
<option value="<?= $opt_runmode ?>"<?php if ( $opt_runmode == $monitor['RunMode'] ) { ?> selected<?php } ?>><?= $opt_runmode ?></option>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select></td></tr>
|
||||
<tr><td align="left" class="text">Triggers</td><td align="left" class="text">
|
||||
<?php
|
||||
$opt_triggers = getSetValues( 'Monitors', 'Triggers' );
|
||||
$break_count = (int)(ceil(count($opt_triggers)));
|
||||
$break_count = min( 3, $break_count );
|
||||
$opt_count = 0;
|
||||
foreach( $opt_triggers as $opt_trigger )
|
||||
{
|
||||
if ( !ZM_OPT_X10 && $opt_trigger == 'X10' )
|
||||
continue;
|
||||
if ( $opt_count && ($opt_count%$break_count == 0) )
|
||||
echo "</br>";
|
||||
?>
|
||||
<input type="checkbox" name="new_triggers[]" value="<?= $opt_trigger ?>" class="form-noborder"<?php if ( in_array( $opt_trigger, split( ",", $monitor['Triggers'] ) ) ) { ?> checked<?php } ?>><?= $opt_trigger ?>
|
||||
<?php
|
||||
$opt_count ++;
|
||||
}
|
||||
if ( !$opt_count )
|
||||
{
|
||||
?>
|
||||
<em>None available</em>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</td></tr>
|
||||
<?php
|
||||
$select_name = "new_type";
|
||||
$$select_name = $$select_name?$$select_name:$monitor[Type];
|
||||
$source_types = array( "Local"=>"Local", "Remote"=>"Remote" );
|
||||
?>
|
||||
<tr><td align="left" class="text">Source Type</td><td><?php buildSelect( $select_name, $source_types, "document.monitor_form.submit();" ); ?></td></tr>
|
||||
<tr><td align="left" class="text">Source Type</td><td><?php buildSelect( $select_name, $source_types ); ?></td></tr>
|
||||
<?php
|
||||
if ( $$select_name == "Local" )
|
||||
{
|
||||
break;
|
||||
}
|
||||
case 'source' :
|
||||
{
|
||||
if ( $monitor[Type] == "Local" )
|
||||
{
|
||||
?>
|
||||
<tr><td align="left" class="text">Device Number (/dev/video?)</td><td align="left" class="text"><input type="text" name="new_device" value="<?= $monitor[Device] ?>" size="4" class="form"></td></tr>
|
||||
<tr><td align="left" class="text">Device Channel</td><td align="left" class="text"><input type="text" name="new_channel" value="<?= $monitor[Channel] ?>" size="4" class="form"></td></tr>
|
||||
<tr><td align="left" class="text">Device Format (0=PAL,1=NTSC etc)</td><td align="left" class="text"><input type="text" name="new_format" value="<?= $monitor[Format] ?>" size="4" class="form"></td></tr>
|
||||
<tr><td align="left" class="text">Capture Palette</td><td align="left" class="text"><select name="new_palette" class="form"><?php foreach ( $local_palettes as $name => $value ) { ?><option value="<?= $value ?>"<?php if ( $value == $monitor[Palette] ) { ?> selected<?php } ?>><?= $name ?></option><?php } ?></select></td></tr>
|
||||
<?php
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
?>
|
||||
<tr><td align="left" class="text">Remote Host Name</td><td align="left" class="text"><input type="text" name="new_host" value="<?= $monitor[Host] ?>" size="16" class="form"></td></tr>
|
||||
<tr><td align="left" class="text">Remote Host Port</td><td align="left" class="text"><input type="text" name="new_port" value="<?= $monitor[Port] ?>" size="6" class="form"></td></tr>
|
||||
<tr><td align="left" class="text">Remote Host Path</td><td align="left" class="text"><input type="text" name="new_path" value="<?= $monitor[Path] ?>" size="36" class="form"></td></tr>
|
||||
<tr><td align="left" class="text">Remote Image Colours</td><td align="left" class="text"><select name="new_palette" class="form"><?php foreach ( $remote_palettes as $name => $value ) { ?><option value= <?= $value ?>"<?php if ( $value == $monitor[Palette] ) { ?> selected<?php } ?>><?= $name ?></option><?php } ?></select></td></tr>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
<tr><td align="left" class="text">Capture Width (pixels)</td><td align="left" class="text"><input type="text" name="new_width" value="<?= $monitor[Width] ?>" size="4" class="form"></td></tr>
|
||||
<tr><td align="left" class="text">Capture Height (pixels)</td><td align="left" class="text"><input type="text" name="new_height" value="<?= $monitor[Height] ?>" size="4" class="form"></td></tr>
|
||||
<tr><td align="left" class="text">Orientation</td><td align="left" class="text"><select name="new_orientation" class="form"><?php foreach ( $orientations as $name => $value ) { ?><option value="<?= $value ?>"<?php if ( $value == $monitor[Orientation] ) { ?> selected<?php } ?>><?= $name ?></option><?php } ?></select></td></tr>
|
||||
<?php
|
||||
break;
|
||||
}
|
||||
case 'timestamp' :
|
||||
{
|
||||
?>
|
||||
<tr><td align="left" class="text">Timestamp Label Format</td><td align="left" class="text"><input type="text" name="new_label_format" value="<?= $monitor[LabelFormat] ?>" size="20" class="form"></td></tr>
|
||||
<tr><td align="left" class="text">Timestamp Label X</td><td align="left" class="text"><input type="text" name="new_label_x" value="<?= $monitor[LabelX] ?>" size="4" class="form"></td></tr>
|
||||
<tr><td align="left" class="text">Timestamp Label Y</td><td align="left" class="text"><input type="text" name="new_label_y" value="<?= $monitor[LabelY] ?>" size="4" class="form"></td></tr>
|
||||
<?php
|
||||
break;
|
||||
}
|
||||
case 'buffers' :
|
||||
{
|
||||
?>
|
||||
<tr><td align="left" class="text">Image Buffer Size (frames)</td><td align="left" class="text"><input type="text" name="new_image_buffer_count" value="<?= $monitor[ImageBufferCount] ?>" size="4" class="form"></td></tr>
|
||||
<tr><td align="left" class="text">Warmup Frames</td><td align="left" class="text"><input type="text" name="new_warmup_count" value="<?= $monitor[WarmupCount] ?>" size="4" class="form"></td></tr>
|
||||
<tr><td align="left" class="text">Pre Event Image Buffer</td><td align="left" class="text"><input type="text" name="new_pre_event_count" value="<?= $monitor[PreEventCount] ?>" size="4" class="form"></td></tr>
|
||||
<tr><td align="left" class="text">Post Event Image Buffer</td><td align="left" class="text"><input type="text" name="new_post_event_count" value="<?= $monitor[PostEventCount] ?>" size="4" class="form"></td></tr>
|
||||
<?php
|
||||
break;
|
||||
}
|
||||
case 'misc' :
|
||||
{
|
||||
?>
|
||||
<tr><td align="left" class="text">Section Length</td><td align="left" class="text"><input type="text" name="new_section_length" value="<?= $monitor[SectionLength] ?>" size="6" class="form"></td></tr>
|
||||
<tr><td align="left" class="text">Maximum FPS</td><td align="left" class="text"><input type="text" name="new_max_fps" value="<?= $monitor[MaxFPS] ?>" size="4" class="form"></td></tr>
|
||||
<tr><td align="left" class="text">FPS Report Interval</td><td align="left" class="text"><input type="text" name="new_fps_report_interval" value="<?= $monitor[FPSReportInterval] ?>" size="4" class="form"></td></tr>
|
||||
<tr><td align="left" class="text">Reference Image Blend %ge</td><td align="left" class="text"><input type="text" name="new_ref_blend_perc" value="<?= $monitor[RefBlendPerc] ?>" size="4" class="form"></td></tr>
|
||||
<?php if ( ZM_OPT_X10 ) { ?>
|
||||
<tr><td align="left" class="text">X10 Activation String</td><td align="left" class="text"><input type="text" name="new_x10_activation" value="<?= $monitor[X10Activation] ?>" size="20" class="form"></td></tr>
|
||||
<tr><td align="left" class="text">X10 Input Alarm String</td><td align="left" class="text"><input type="text" name="new_x10_alarm_input" value="<?= $monitor[X10AlarmInput] ?>" size="20" class="form"></td></tr>
|
||||
<tr><td align="left" class="text">X10 Output Alarm String</td><td align="left" class="text"><input type="text" name="new_x10_alarm_output" value="<?= $monitor[X10AlarmOutput] ?>" size="20" class="form"></td></tr>
|
||||
<?php } ?>
|
||||
<?php
|
||||
break;
|
||||
}
|
||||
case 'x10' :
|
||||
{
|
||||
?>
|
||||
<tr><td align="left" class="text">X10 Activation String</td><td align="left" class="text"><input type="text" name="new_activation" value="<?= $monitor[X10Activation] ?>" size="20" class="form"></td></tr>
|
||||
<tr><td align="left" class="text">X10 Input Alarm String</td><td align="left" class="text"><input type="text" name="new_alarm_input" value="<?= $monitor[X10AlarmInput] ?>" size="20" class="form"></td></tr>
|
||||
<tr><td align="left" class="text">X10 Output Alarm String</td><td align="left" class="text"><input type="text" name="new_alarm_output" value="<?= $monitor[X10AlarmOutput] ?>" size="20" class="form"></td></tr>
|
||||
<?php
|
||||
break;
|
||||
}
|
||||
}
|
||||
?>
|
||||
<tr><td colspan="2" align="left" class="text"> </td></tr>
|
||||
<tr>
|
||||
<td align="left"> </td>
|
||||
<td align="left"><input type="submit" value="Save" class="form" onClick="document.monitor_form.view.value='none'; document.monitor_form.action.value='monitor';"<?php if ( !canEdit( 'Monitors' ) ) { ?> disabled<?php } ?>> <input type="button" value="Cancel" class="form" onClick="closeWindow()"></td>
|
||||
<td colspan="2" align="right"><input type="submit" value="Save" class="form"<?php if ( !canEdit( 'Monitors' ) ) { ?> disabled<?php } ?>> <input type="button" value="Cancel" class="form" onClick="closeWindow()"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
|
|
|
@ -24,6 +24,10 @@
|
|||
$status_string = "Alert";
|
||||
$class = "ambtext";
|
||||
}
|
||||
elseif ( $status == 3 )
|
||||
{
|
||||
$status_string = "Record";
|
||||
}
|
||||
$fps_string = sprintf( "%.2f", $fps );
|
||||
$new_alarm = ( $status > 0 && $last_status == 0 );
|
||||
$old_alarm = ( $status == 0 && $last_status > 0 );
|
||||
|
|
|
@ -29,6 +29,10 @@
|
|||
$status_string = "Alert";
|
||||
$class = "ambtext";
|
||||
}
|
||||
elseif ( $status == 3 )
|
||||
{
|
||||
$status_string = "Record";
|
||||
}
|
||||
$fps_string = sprintf( "%.2f", $fps );
|
||||
$new_alarm = ( $status > 0 && $last_status == 0 );
|
||||
$old_alarm = ( $status == 0 && $last_status > 0 );
|
||||
|
@ -70,27 +74,27 @@ window.setTimeout( "window.location.replace( '<?= $url ?>' )", <?= $refresh*1000
|
|||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<table width="90%" align="center" border="0" cellpadding="0" cellspacing="0">
|
||||
<table width="96%" align="center" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td width="30%" class="text" align="left"> </td>
|
||||
<td width="40%" class="<?= $class ?>" align="center" valign="middle">Status: <?= $status_string ?> - <?= $fps_string ?> fps</td>
|
||||
<td width="15%" class="text" align="left"> </td>
|
||||
<td width="70%" class="<?= $class ?>" align="center" valign="middle">Status: <?= $status_string ?> - <?= $fps_string ?> fps</td>
|
||||
<?php
|
||||
if ( canEdit( 'Monitors' ) && ($force || $forced) )
|
||||
{
|
||||
?>
|
||||
<td width="30%" align="right" class="text"><a href="<?= $PHP_SELF ?>?view=watchstatus&mid=<?= $mid ?>&last_status=$status&force=0">Cancel Forced Alarm</a></td>
|
||||
<td width="15%" align="right" class="text"><a href="<?= $PHP_SELF ?>?view=watchstatus&mid=<?= $mid ?>&last_status=$status&force=0">Cancel Forced Alarm</a></td>
|
||||
<?php
|
||||
}
|
||||
elseif ( canEdit( 'Monitors' ) && zmaCheck( $mid ) )
|
||||
{
|
||||
?>
|
||||
<td width="30%" align="right" class="text"><a href="<?= $PHP_SELF ?>?view=watchstatus&mid=<?= $mid ?>&last_status=$status&force=1">Force Alarm</a></td>
|
||||
<td width="15%" align="right" class="text"><a href="<?= $PHP_SELF ?>?view=watchstatus&mid=<?= $mid ?>&last_status=$status&force=1">Force Alarm</a></td>
|
||||
<?php
|
||||
}
|
||||
else
|
||||
{
|
||||
?>
|
||||
<td width="30%" align="right" class="text"> </td>
|
||||
<td width="15%" align="right" class="text"> </td>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -42,7 +42,21 @@ opener.location.reload(true);
|
|||
window.focus();
|
||||
function validateForm( Form )
|
||||
{
|
||||
var errors = new Array();
|
||||
Form.new_alarm_rgb.value = (Form.new_alarm_rgb_r.value<<16)|(Form.new_alarm_rgb_g.value<<8)|Form.new_alarm_rgb_b.value;
|
||||
if ( Form.new_min_alarm_pixels.value < Form.new_min_filter_pixels.value )
|
||||
{
|
||||
errors[errors.length] = "Minimum alarm pixels should be greater than or equal to minimum filter pixels";
|
||||
}
|
||||
if ( Form.new_min_filter_pixels.value < Form.new_min_blob_pixels.value )
|
||||
{
|
||||
errors[errors.length] = "Minimum filter pixels should be greater than or equal to minimum blob pixels";
|
||||
}
|
||||
if ( errors.length )
|
||||
{
|
||||
alert( errors.join( "\n" ) );
|
||||
return( false );
|
||||
}
|
||||
return( true );
|
||||
}
|
||||
|
||||
|
|
|
@ -84,6 +84,11 @@ a:hover {
|
|||
font-size: 10px;
|
||||
color: #333333
|
||||
}
|
||||
.form-noborder {
|
||||
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||
font-size: 10px;
|
||||
color: #333333
|
||||
}
|
||||
.textsmall {
|
||||
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||
font-size:9px;
|
||||
|
|
Loading…
Reference in New Issue