Merge branch 'master' of github.com:ZoneMinder/ZoneMinder
This commit is contained in:
commit
69e460c5cd
|
@ -39,7 +39,7 @@ env:
|
|||
- SMPFLAGS=-j4 OS=ubuntu DIST=xenial
|
||||
- SMPFLAGS=-j4 OS=ubuntu DIST=bionic
|
||||
- SMPFLAGS=-j4 OS=ubuntu DIST=disco
|
||||
- SMPFLAGS=-j4 OS=debian DIST=buster
|
||||
- SMPFLAGS=-j4 OS=debian DIST=buster DOCKER_REPO=zmicon/packpack
|
||||
- SMPFLAGS=-j4 OS=debian DIST=stretch
|
||||
- SMPFLAGS=-j4 OS=ubuntu DIST=trusty ARCH=i386
|
||||
- SMPFLAGS=-j4 OS=ubuntu DIST=xenial ARCH=i386
|
||||
|
|
|
@ -83,7 +83,7 @@ if ( $options{command} ) {
|
|||
my $tries = 10;
|
||||
my $server_up;
|
||||
while ( $tries and ! ( $server_up = connect(CLIENT, $saddr) ) ) {
|
||||
Debug("Failed to connect to $server_up at $sock_file");
|
||||
Debug("Failed to connect to zmcontrol server at $sock_file");
|
||||
runCommand("zmdc.pl start zmcontrol.pl --id=$id");
|
||||
sleep 1;
|
||||
$tries -= 1;
|
||||
|
|
|
@ -294,7 +294,7 @@ checksanity
|
|||
# We don't want to build packages for all supported distros after every commit
|
||||
# Only build all packages when executed via cron
|
||||
# See https://docs.travis-ci.com/user/cron-jobs/
|
||||
if [ "${TRAVIS_EVENT_TYPE}" == "cron" ] || [ "${TRAVIS}" != "true" ]; then
|
||||
if [ "${TRAVIS_EVENT_TYPE}" == "cron" ] || [ "${TRAVIS}" != "true" ] || [ "${DIST}" == "buster" ] ; then
|
||||
commonprep
|
||||
|
||||
# Steps common to Redhat distros
|
||||
|
|
|
@ -1,65 +1,56 @@
|
|||
<?php
|
||||
require_once( 'includes/control_functions.php' );
|
||||
require_once( 'includes/Monitor.php' );
|
||||
require_once('includes/control_functions.php');
|
||||
require_once('includes/Monitor.php');
|
||||
|
||||
// Monitor control actions, require a monitor id and control view permissions for that monitor
|
||||
if ( empty($_REQUEST['id']) )
|
||||
ajaxError( "No monitor id supplied" );
|
||||
ajaxError('No monitor id supplied');
|
||||
|
||||
if ( canView( 'Control', $_REQUEST['id'] ) )
|
||||
{
|
||||
$monitor = new ZM\Monitor( $_REQUEST['id'] );
|
||||
if ( canView('Control', $_REQUEST['id']) ) {
|
||||
$monitor = new ZM\Monitor($_REQUEST['id']);
|
||||
|
||||
$ctrlCommand = buildControlCommand( $monitor );
|
||||
$ctrlCommand = buildControlCommand($monitor);
|
||||
|
||||
if ( $ctrlCommand )
|
||||
{
|
||||
$socket = socket_create( AF_UNIX, SOCK_STREAM, 0 );
|
||||
if ( !$socket )
|
||||
ajaxError( "socket_create() failed: ".socket_strerror(socket_last_error()) );
|
||||
if ( !$ctrlCommand ) {
|
||||
ajaxError('No command received');
|
||||
return;
|
||||
}
|
||||
|
||||
$sock_file = ZM_PATH_SOCKS.'/zmcontrol-'.$monitor->Id().'.sock';
|
||||
if ( @socket_connect( $socket, $sock_file ) )
|
||||
{
|
||||
$options = array();
|
||||
foreach ( explode( " ", $ctrlCommand ) as $option )
|
||||
{
|
||||
if ( preg_match( '/--([^=]+)(?:=(.+))?/', $option, $matches ) )
|
||||
{
|
||||
$options[$matches[1]] = !empty($matches[2])?$matches[2]:1;
|
||||
}
|
||||
}
|
||||
$option_string = jsonEncode( $options );
|
||||
if ( !socket_write( $socket, $option_string ) )
|
||||
ajaxError( "socket_write() failed: ".socket_strerror(socket_last_error()) );
|
||||
ajaxResponse( 'Used socket' );
|
||||
//socket_close( $socket );
|
||||
}
|
||||
else
|
||||
{
|
||||
$ctrlCommand .= " --id=".$monitor->Id();
|
||||
$socket = socket_create(AF_UNIX, SOCK_STREAM, 0);
|
||||
if ( !$socket )
|
||||
ajaxError('socket_create() failed: '.socket_strerror(socket_last_error()));
|
||||
|
||||
// Can't connect so use script
|
||||
$ctrlStatus = '';
|
||||
$ctrlOutput = array();
|
||||
exec( escapeshellcmd( $ctrlCommand ), $ctrlOutput, $ctrlStatus );
|
||||
if ( $ctrlStatus )
|
||||
ajaxError( $ctrlCommand.'=>'.join( ' // ', $ctrlOutput ) );
|
||||
ajaxResponse( 'Used script' );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ajaxError( "No command received" );
|
||||
$sock_file = ZM_PATH_SOCKS.'/zmcontrol-'.$monitor->Id().'.sock';
|
||||
if ( @socket_connect($socket, $sock_file) ) {
|
||||
$options = array();
|
||||
foreach ( explode(' ', $ctrlCommand) as $option ) {
|
||||
if ( preg_match('/--([^=]+)(?:=(.+))?/', $option, $matches) ) {
|
||||
$options[$matches[1]] = !empty($matches[2])?$matches[2]:1;
|
||||
}
|
||||
}
|
||||
$option_string = jsonEncode($options);
|
||||
if ( !socket_write($socket, $option_string) )
|
||||
ajaxError("socket_write() failed: ".socket_strerror(socket_last_error()));
|
||||
ajaxResponse('Used socket');
|
||||
//socket_close( $socket );
|
||||
} else {
|
||||
$ctrlCommand .= ' --id='.$monitor->Id();
|
||||
|
||||
// Can't connect so use script
|
||||
$ctrlStatus = '';
|
||||
$ctrlOutput = array();
|
||||
exec( escapeshellcmd( $ctrlCommand ), $ctrlOutput, $ctrlStatus );
|
||||
if ( $ctrlStatus )
|
||||
ajaxError($ctrlCommand.'=>'.join(' // ', $ctrlOutput));
|
||||
ajaxResponse('Used script');
|
||||
}
|
||||
}
|
||||
|
||||
ajaxError( 'Unrecognised action or insufficient permissions' );
|
||||
ajaxError('Unrecognised action or insufficient permissions');
|
||||
|
||||
function ajaxCleanup()
|
||||
{
|
||||
global $socket;
|
||||
if ( !empty( $socket ) )
|
||||
@socket_close( $socket );
|
||||
function ajaxCleanup() {
|
||||
global $socket;
|
||||
if ( !empty( $socket ) )
|
||||
@socket_close($socket);
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -15,7 +15,7 @@ protected $defaults = array(
|
|||
'ServerId' => 0,
|
||||
'StorageId' => 0,
|
||||
'Type' => 'Ffmpeg',
|
||||
'Function' => 'None',
|
||||
'Function' => 'Mocord',
|
||||
'Enabled' => array('type'=>'boolean','default'=>1),
|
||||
'LinkedMonitors' => array('type'=>'set', 'default'=>null),
|
||||
'Triggers' => array('type'=>'set','default'=>''),
|
||||
|
@ -46,7 +46,7 @@ protected $defaults = array(
|
|||
'VideoWriter' => '0',
|
||||
'OutputCodec' => null,
|
||||
'OutputContainer' => null,
|
||||
'EncoderParameters' => null,
|
||||
'EncoderParameters' => "# Lines beginning with # are a comment \n# For changing quality, use the crf option\n# 1 is best, 51 is worst quality\n#crf=23\n",
|
||||
'RecordAudio' => array('type'=>'boolean', 'default'=>0),
|
||||
'RTSPDescribe' => array('type'=>'boolean','default'=>0),
|
||||
'Brightness' => -1,
|
||||
|
@ -54,7 +54,7 @@ protected $defaults = array(
|
|||
'Hue' => -1,
|
||||
'Colour' => -1,
|
||||
'EventPrefix' => 'Event-',
|
||||
'LabelFormat' => null,
|
||||
'LabelFormat' => '%N - %d/%m/%y %H:%M:%S',
|
||||
'LabelX' => 0,
|
||||
'LabelY' => 0,
|
||||
'LabelSize' => 1,
|
||||
|
@ -120,7 +120,7 @@ private $status_fields = array(
|
|||
if ( $this->ControlId() )
|
||||
$this->{'Control'} = Control::find_one(array('Id'=>$this->{'ControlId'}));
|
||||
else
|
||||
Error("No ControlId");
|
||||
Error("No ControlId".print_r($this,true));
|
||||
if ( !(array_key_exists('Control', $this) and $this->{'Control'} ) )
|
||||
$this->{'Control'} = new Control();
|
||||
}
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
<?php
|
||||
|
||||
function buildControlCommand( $monitor ) {
|
||||
function buildControlCommand($monitor) {
|
||||
$ctrlCommand = ZM_PATH_BIN.'/zmcontrol.pl';
|
||||
$control = $monitor->Control();
|
||||
|
||||
if ( isset($_REQUEST['xge']) || isset($_REQUEST['yge']) ) {
|
||||
$slow = 0.9; // Threshold for slow speed/timeouts
|
||||
$turbo = 0.9; // Threshold for turbo speed
|
||||
|
||||
if ( preg_match( '/^([a-z]+)([A-Z][a-z]+)([A-Za-z]+)+$/', $_REQUEST['control'], $matches ) ) {
|
||||
if ( preg_match('/^([a-z]+)([A-Z][a-z]+)([A-Za-z]+)+$/', $_REQUEST['control'], $matches) ) {
|
||||
$command = $matches[1];
|
||||
$mode = $matches[2];
|
||||
$dirn = $matches[3];
|
||||
|
@ -16,22 +17,22 @@ function buildControlCommand( $monitor ) {
|
|||
case 'focus' :
|
||||
{
|
||||
$factor = $_REQUEST['yge']/100;
|
||||
if ( $monitor->HasFocusSpeed() ) {
|
||||
$speed = intval(round($monitor->MinFocusSpeed()+(($monitor->MaxFocusSpeed()-$monitor->MinFocusSpeed())*$factor)));
|
||||
if ( $control->HasFocusSpeed() ) {
|
||||
$speed = intval(round($control->MinFocusSpeed()+(($control->MaxFocusSpeed()-$control->MinFocusSpeed())*$factor)));
|
||||
$ctrlCommand .= ' --speed='.$speed;
|
||||
}
|
||||
switch( $mode ) {
|
||||
case 'Abs' :
|
||||
case 'Rel' :
|
||||
{
|
||||
$step = intval(round($monitor->MinFocusStep()+(($monitor->MaxFocusStep()-$monitor->MinFocusStep())*$factor)));
|
||||
$step = intval(round($control->MinFocusStep()+(($control->MaxFocusStep()-$control->MinFocusStep())*$factor)));
|
||||
$ctrlCommand .= ' --step='.$step;
|
||||
break;
|
||||
}
|
||||
case 'Con' :
|
||||
{
|
||||
if ( $monitor->AutoStopTimeout() ) {
|
||||
$slowSpeed = intval(round($monitor->MinFocusSpeed()+(($monitor->MaxFocusSpeed()-$monitor->MinFocusSpeed())*$slow)));
|
||||
if ( $control->AutoStopTimeout() ) {
|
||||
$slowSpeed = intval(round($control->MinFocusSpeed()+(($control->MaxFocusSpeed()-$control->MinFocusSpeed())*$slow)));
|
||||
if ( $speed < $slowSpeed ) {
|
||||
$ctrlCommand .= ' --autostop';
|
||||
}
|
||||
|
@ -43,19 +44,19 @@ function buildControlCommand( $monitor ) {
|
|||
}
|
||||
case 'zoom' :
|
||||
$factor = $_REQUEST['yge']/100;
|
||||
if ( $monitor->HasZoomSpeed() ) {
|
||||
$speed = intval(round($monitor->MinZoomSpeed()+(($monitor->MaxZoomSpeed()-$monitor->MinZoomSpeed())*$factor)));
|
||||
if ( $control->HasZoomSpeed() ) {
|
||||
$speed = intval(round($control->MinZoomSpeed()+(($control->MaxZoomSpeed()-$control->MinZoomSpeed())*$factor)));
|
||||
$ctrlCommand .= ' --speed='.$speed;
|
||||
}
|
||||
switch( $mode ) {
|
||||
case 'Abs' :
|
||||
case 'Rel' :
|
||||
$step = intval(round($monitor->MinZoomStep()+(($monitor->MaxZoomStep()-$monitor->MinZoomStep())*$factor)));
|
||||
$step = intval(round($control->MinZoomStep()+(($control->MaxZoomStep()-$control->MinZoomStep())*$factor)));
|
||||
$ctrlCommand .= ' --step='.$step;
|
||||
break;
|
||||
case 'Con' :
|
||||
if ( $monitor->AutoStopTimeout() ) {
|
||||
$slowSpeed = intval(round($monitor->MinZoomSpeed()+(($monitor->MaxZoomSpeed()-$monitor->MinZoomSpeed())*$slow)));
|
||||
if ( $control->AutoStopTimeout() ) {
|
||||
$slowSpeed = intval(round($control->MinZoomSpeed()+(($control->MaxZoomSpeed()-$control->MinZoomSpeed())*$slow)));
|
||||
if ( $speed < $slowSpeed ) {
|
||||
$ctrlCommand .= ' --autostop';
|
||||
}
|
||||
|
@ -65,42 +66,42 @@ function buildControlCommand( $monitor ) {
|
|||
break;
|
||||
case 'iris' :
|
||||
$factor = $_REQUEST['yge']/100;
|
||||
if ( $monitor->HasIrisSpeed() ) {
|
||||
$speed = intval(round($monitor->MinIrisSpeed()+(($monitor->MaxIrisSpeed()-$monitor->MinIrisSpeed())*$factor)));
|
||||
if ( $control->HasIrisSpeed() ) {
|
||||
$speed = intval(round($control->MinIrisSpeed()+(($control->MaxIrisSpeed()-$control->MinIrisSpeed())*$factor)));
|
||||
$ctrlCommand .= ' --speed='.$speed;
|
||||
}
|
||||
switch( $mode ) {
|
||||
case 'Abs' :
|
||||
case 'Rel' :
|
||||
$step = intval(round($monitor->MinIrisStep()+(($monitor->MaxIrisStep()-$monitor->MinIrisStep())*$factor)));
|
||||
$step = intval(round($control->MinIrisStep()+(($control->MaxIrisStep()-$control->MinIrisStep())*$factor)));
|
||||
$ctrlCommand .= ' --step='.$step;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'white' :
|
||||
$factor = $_REQUEST['yge']/100;
|
||||
if ( $monitor->HasWhiteSpeed() ) {
|
||||
$speed = intval(round($monitor->MinWhiteSpeed()+(($monitor->MaxWhiteSpeed()-$monitor->MinWhiteSpeed())*$factor)));
|
||||
if ( $control->HasWhiteSpeed() ) {
|
||||
$speed = intval(round($control->MinWhiteSpeed()+(($control->MaxWhiteSpeed()-$control->MinWhiteSpeed())*$factor)));
|
||||
$ctrlCommand .= ' --speed='.$speed;
|
||||
}
|
||||
switch( $mode ) {
|
||||
case 'Abs' :
|
||||
case 'Rel' :
|
||||
$step = intval(round($monitor->MinWhiteStep()+(($monitor->MaxWhiteStep()-$monitor->MinWhiteStep())*$factor)));
|
||||
$step = intval(round($control->MinWhiteStep()+(($control->MaxWhiteStep()-$control->MinWhiteStep())*$factor)));
|
||||
$ctrlCommand .= ' --step='.$step;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'gain' :
|
||||
$factor = $_REQUEST['yge']/100;
|
||||
if ( $monitor->HasGainSpeed() ) {
|
||||
$speed = intval(round($monitor->MinGainSpeed()+(($monitor->MaxGainSpeed()-$monitor->MinGainSpeed())*$factor)));
|
||||
if ( $control->HasGainSpeed() ) {
|
||||
$speed = intval(round($control->MinGainSpeed()+(($control->MaxGainSpeed()-$control->MinGainSpeed())*$factor)));
|
||||
$ctrlCommand .= ' --speed='.$speed;
|
||||
}
|
||||
switch( $mode ) {
|
||||
case 'Abs' :
|
||||
case 'Rel' :
|
||||
$step = intval(round($monitor->MinGainStep()+(($monitor->MaxGainStep()-$monitor->MinGainStep())*$factor)));
|
||||
$step = intval(round($control->MinGainStep()+(($control->MaxGainStep()-$control->MinGainStep())*$factor)));
|
||||
$ctrlCommand .= ' --step='.$step;
|
||||
break;
|
||||
}
|
||||
|
@ -167,29 +168,29 @@ function buildControlCommand( $monitor ) {
|
|||
$dirn = $new_dirn;
|
||||
}
|
||||
|
||||
if ( $monitor->HasPanSpeed() && $xFactor ) {
|
||||
if ( $monitor->HasTurboPan() ) {
|
||||
if ( $control->HasPanSpeed() && $xFactor ) {
|
||||
if ( $control->HasTurboPan() ) {
|
||||
if ( $xFactor >= $turbo ) {
|
||||
$panSpeed = $monitor->TurboPanSpeed();
|
||||
$panSpeed = $control->TurboPanSpeed();
|
||||
} else {
|
||||
$xFactor = $xFactor/$turbo;
|
||||
$panSpeed = intval(round($monitor->MinPanSpeed()+(($monitor->MaxPanSpeed()-$monitor->MinPanSpeed())*$xFactor)));
|
||||
$panSpeed = intval(round($control->MinPanSpeed()+(($control->MaxPanSpeed()-$control->MinPanSpeed())*$xFactor)));
|
||||
}
|
||||
} else {
|
||||
$panSpeed = intval(round($monitor->MinPanSpeed()+(($monitor->MaxPanSpeed()-$monitor->MinPanSpeed())*$xFactor)));
|
||||
$panSpeed = intval(round($control->MinPanSpeed()+(($control->MaxPanSpeed()-$control->MinPanSpeed())*$xFactor)));
|
||||
}
|
||||
$ctrlCommand .= ' --panspeed='.$panSpeed;
|
||||
}
|
||||
if ( $monitor->HasTiltSpeed() && $yFactor ) {
|
||||
if ( $monitor->HasTurboTilt() ) {
|
||||
if ( $control->HasTiltSpeed() && $yFactor ) {
|
||||
if ( $control->HasTurboTilt() ) {
|
||||
if ( $yFactor >= $turbo ) {
|
||||
$tiltSpeed = $monitor->TurboTiltSpeed();
|
||||
$tiltSpeed = $control->TurboTiltSpeed();
|
||||
} else {
|
||||
$yFactor = $yFactor/$turbo;
|
||||
$tiltSpeed = intval(round($monitor->MinTiltSpeed()+(($monitor->MaxTiltSpeed()-$monitor->MinTiltSpeed())*$yFactor)));
|
||||
$tiltSpeed = intval(round($control->MinTiltSpeed()+(($control->MaxTiltSpeed()-$control->MinTiltSpeed())*$yFactor)));
|
||||
}
|
||||
} else {
|
||||
$tiltSpeed = intval(round($monitor->MinTiltSpeed()+(($monitor->MaxTiltSpeed()-$monitor->MinTiltSpeed())*$yFactor)));
|
||||
$tiltSpeed = intval(round($control->MinTiltSpeed()+(($control->MaxTiltSpeed()-$control->MinTiltSpeed())*$yFactor)));
|
||||
}
|
||||
$ctrlCommand .= ' --tiltspeed='.$tiltSpeed;
|
||||
}
|
||||
|
@ -197,18 +198,18 @@ function buildControlCommand( $monitor ) {
|
|||
case 'Rel' :
|
||||
case 'Abs' :
|
||||
if ( preg_match( '/(Left|Right)$/', $dirn ) ) {
|
||||
$panStep = intval(round($monitor->MinPanStep()+(($monitor->MaxPanStep()-$monitor->MinPanStep())*$xFactor)));
|
||||
$panStep = intval(round($control->MinPanStep()+(($control->MaxPanStep()-$control->MinPanStep())*$xFactor)));
|
||||
$ctrlCommand .= ' --panstep='.$panStep;
|
||||
}
|
||||
if ( preg_match( '/^(Up|Down)/', $dirn ) ) {
|
||||
$tiltStep = intval(round($monitor->MinTiltStep()+(($monitor->MaxTiltStep()-$monitor->MinTiltStep())*$yFactor)));
|
||||
$tiltStep = intval(round($control->MinTiltStep()+(($control->MaxTiltStep()-$control->MinTiltStep())*$yFactor)));
|
||||
$ctrlCommand .= ' --tiltstep='.$tiltStep;
|
||||
}
|
||||
break;
|
||||
case 'Con' :
|
||||
if ( $monitor->AutoStopTimeout() ) {
|
||||
$slowPanSpeed = intval(round($monitor->MinPanSpeed()+(($monitor->MaxPanSpeed()-$monitor->MinPanSpeed())*$slow)));
|
||||
$slowTiltSpeed = intval(round($monitor->MinTiltSpeed()+(($monitor->MaxTiltSpeed()-$monitor->MinTiltSpeed())*$slow)));
|
||||
if ( $control->AutoStopTimeout() ) {
|
||||
$slowPanSpeed = intval(round($control->MinPanSpeed()+(($control->MaxPanSpeed()-$control->MinPanSpeed())*$slow)));
|
||||
$slowTiltSpeed = intval(round($control->MinTiltSpeed()+(($control->MaxTiltSpeed()-$control->MinTiltSpeed())*$slow)));
|
||||
if ( (!isset($panSpeed) || ($panSpeed < $slowPanSpeed)) && (!isset($tiltSpeed) || ($tiltSpeed < $slowTiltSpeed)) ) {
|
||||
$ctrlCommand .= ' --autostop';
|
||||
}
|
||||
|
@ -319,36 +320,36 @@ function buildControlCommand( $monitor ) {
|
|||
$xFactor = abs($xFactor);
|
||||
$yFactor = abs($yFactor);
|
||||
|
||||
if ( $monitor->HasPanSpeed() && $xFactor ) {
|
||||
if ( $monitor->HasTurboPan() ) {
|
||||
if ( $control->HasPanSpeed() && $xFactor ) {
|
||||
if ( $control->HasTurboPan() ) {
|
||||
if ( $xFactor >= $turbo ) {
|
||||
$panSpeed = $monitor->TurboPanSpeed();
|
||||
$panSpeed = $control->TurboPanSpeed();
|
||||
} else {
|
||||
$xFactor = $xFactor/$turbo;
|
||||
$panSpeed = intval(round($monitor->MinPanSpeed()+(($monitor->MaxPanSpeed()-$monitor->MinPanSpeed())*$xFactor)));
|
||||
$panSpeed = intval(round($control->MinPanSpeed()+(($control->MaxPanSpeed()-$control->MinPanSpeed())*$xFactor)));
|
||||
}
|
||||
} else {
|
||||
$panSpeed = intval(round($monitor->MinPanSpeed()+(($monitor->MaxPanSpeed()-$monitor->MinPanSpeed())*$xFactor)));
|
||||
$panSpeed = intval(round($control->MinPanSpeed()+(($control->MaxPanSpeed()-$control->MinPanSpeed())*$xFactor)));
|
||||
}
|
||||
}
|
||||
if ( $monitor->HasTiltSpeed() && $yFactor ) {
|
||||
if ( $monitor->HasTurboTilt() ) {
|
||||
if ( $control->HasTiltSpeed() && $yFactor ) {
|
||||
if ( $control->HasTurboTilt() ) {
|
||||
if ( $yFactor >= $turbo ) {
|
||||
$tiltSpeed = $monitor->TurboTiltSpeed();
|
||||
$tiltSpeed = $control->TurboTiltSpeed();
|
||||
} else {
|
||||
$yFactor = $yFactor/$turbo;
|
||||
$tiltSpeed = intval(round($monitor->MinTiltSpeed()+(($monitor->MaxTiltSpeed()-$monitor->MinTiltSpeed())*$yFactor)));
|
||||
$tiltSpeed = intval(round($control->MinTiltSpeed()+(($control->MaxTiltSpeed()-$control->MinTiltSpeed())*$yFactor)));
|
||||
}
|
||||
} else {
|
||||
$tiltSpeed = intval(round($monitor->MinTiltSpeed()+(($monitor->MaxTiltSpeed()-$monitor->MinTiltSpeed())*$yFactor)));
|
||||
$tiltSpeed = intval(round($control->MinTiltSpeed()+(($control->MaxTiltSpeed()-$control->MinTiltSpeed())*$yFactor)));
|
||||
}
|
||||
}
|
||||
if ( preg_match( '/(Left|Right)$/', $dirn ) ) {
|
||||
$panStep = intval(round($monitor->MinPanStep()+(($monitor->MaxPanStep()-$monitor->MinPanStep())*$xFactor)));
|
||||
$panStep = intval(round($control->MinPanStep()+(($control->MaxPanStep()-$control->MinPanStep())*$xFactor)));
|
||||
$ctrlCommand .= ' --panstep='.$panStep.' --panspeed='.$panSpeed;
|
||||
}
|
||||
if ( preg_match( '/^(Up|Down)/', $dirn ) ) {
|
||||
$tiltStep = intval(round($monitor->MinTiltStep()+(($monitor->MaxTiltStep()-$monitor->MinTiltStep())*$yFactor)));
|
||||
$tiltStep = intval(round($control->MinTiltStep()+(($control->MaxTiltStep()-$control->MinTiltStep())*$yFactor)));
|
||||
$ctrlCommand .= ' --tiltstep='.$tiltStep.' --tiltspeed='.$tiltSpeed;
|
||||
}
|
||||
}
|
||||
|
@ -410,28 +411,28 @@ function buildControlCommand( $monitor ) {
|
|||
$xFactor = abs($xFactor);
|
||||
$yFactor = abs($yFactor);
|
||||
|
||||
if ( $monitor->HasPanSpeed() && $xFactor ) {
|
||||
if ( $monitor->HasTurboPan() ) {
|
||||
if ( $control->HasPanSpeed() && $xFactor ) {
|
||||
if ( $control->HasTurboPan() ) {
|
||||
if ( $xFactor >= $turbo ) {
|
||||
$panSpeed = $monitor->TurboPanSpeed();
|
||||
$panSpeed = $control->TurboPanSpeed();
|
||||
} else {
|
||||
$xFactor = $xFactor/$turbo;
|
||||
$panSpeed = intval(round($monitor->MinPanSpeed()+(($monitor->MaxPanSpeed()-$monitor->MinPanSpeed())*$xFactor)));
|
||||
$panSpeed = intval(round($control->MinPanSpeed()+(($control->MaxPanSpeed()-$control->MinPanSpeed())*$xFactor)));
|
||||
}
|
||||
} else {
|
||||
$panSpeed = intval(round($monitor->MinPanSpeed()+(($monitor->MaxPanSpeed()-$monitor->MinPanSpeed())*$xFactor)));
|
||||
$panSpeed = intval(round($control->MinPanSpeed()+(($control->MaxPanSpeed()-$control->MinPanSpeed())*$xFactor)));
|
||||
}
|
||||
}
|
||||
if ( $monitor->HasTiltSpeed() && $yFactor ) {
|
||||
if ( $monitor->HasTurboTilt() ) {
|
||||
if ( $control->HasTiltSpeed() && $yFactor ) {
|
||||
if ( $control->HasTurboTilt() ) {
|
||||
if ( $yFactor >= $turbo ) {
|
||||
$tiltSpeed = $monitor->TurboTiltSpeed();
|
||||
$tiltSpeed = $control->TurboTiltSpeed();
|
||||
} else {
|
||||
$yFactor = $yFactor/$turbo;
|
||||
$tiltSpeed = intval(round($monitor->MinTiltSpeed()+(($monitor->MaxTiltSpeed()-$monitor->MinTiltSpeed())*$yFactor)));
|
||||
$tiltSpeed = intval(round($control->MinTiltSpeed()+(($control->MaxTiltSpeed()-$control->MinTiltSpeed())*$yFactor)));
|
||||
}
|
||||
} else {
|
||||
$tiltSpeed = intval(round($monitor->MinTiltSpeed()+(($monitor->MaxTiltSpeed()-$monitor->MinTiltSpeed())*$yFactor)));
|
||||
$tiltSpeed = intval(round($control->MinTiltSpeed()+(($control->MaxTiltSpeed()-$control->MinTiltSpeed())*$yFactor)));
|
||||
}
|
||||
}
|
||||
if ( preg_match( '/(Left|Right)$/', $dirn ) ) {
|
||||
|
@ -440,9 +441,9 @@ function buildControlCommand( $monitor ) {
|
|||
if ( preg_match( '/^(Up|Down)/', $dirn ) ) {
|
||||
$ctrlCommand .= ' --tiltspeed='.$tiltSpeed;
|
||||
}
|
||||
if ( $monitor->AutoStopTimeout() ) {
|
||||
$slowPanSpeed = intval(round($monitor->MinPanSpeed()+(($monitor->MaxPanSpeed()-$monitor->MinPanSpeed())*$slow)));
|
||||
$slowTiltSpeed = intval(round($monitor->MinTiltSpeed()+(($monitor->MaxTiltSpeed()-$monitor->MinTiltSpeed())*$slow)));
|
||||
if ( $control->AutoStopTimeout() ) {
|
||||
$slowPanSpeed = intval(round($control->MinPanSpeed()+(($control->MaxPanSpeed()-$control->MinPanSpeed())*$slow)));
|
||||
$slowTiltSpeed = intval(round($control->MinTiltSpeed()+(($control->MaxTiltSpeed()-$control->MinTiltSpeed())*$slow)));
|
||||
if ( (!isset($panSpeed) || ($panSpeed < $slowPanSpeed)) && (!isset($tiltSpeed) || ($tiltSpeed < $slowTiltSpeed)) ) {
|
||||
$ctrlCommand .= ' --autostop';
|
||||
}
|
||||
|
@ -470,19 +471,19 @@ function buildControlCommand( $monitor ) {
|
|||
$factor = ($y+1)/$long_y;
|
||||
break;
|
||||
}
|
||||
if ( $monitor->HasFocusSpeed() ) {
|
||||
$speed = intval(round($monitor->MinFocusSpeed()+(($monitor->MaxFocusSpeed()-$monitor->MinFocusSpeed())*$factor)));
|
||||
if ( $control->HasFocusSpeed() ) {
|
||||
$speed = intval(round($control->MinFocusSpeed()+(($control->MaxFocusSpeed()-$control->MinFocusSpeed())*$factor)));
|
||||
$ctrlCommand .= ' --speed='.$speed;
|
||||
}
|
||||
switch( $mode ) {
|
||||
case 'Abs' :
|
||||
case 'Rel' :
|
||||
$step = intval(round($monitor->MinFocusStep()+(($monitor->MaxFocusStep()-$monitor->MinFocusStep())*$factor)));
|
||||
$step = intval(round($control->MinFocusStep()+(($control->MaxFocusStep()-$control->MinFocusStep())*$factor)));
|
||||
$ctrlCommand .= ' --step='.$step;
|
||||
break;
|
||||
case 'Con' :
|
||||
if ( $monitor->AutoStopTimeout() ) {
|
||||
$slowSpeed = intval(round($monitor->MinFocusSpeed()+(($monitor->MaxFocusSpeed()-$monitor->MinFocusSpeed())*$slow)));
|
||||
if ( $control->AutoStopTimeout() ) {
|
||||
$slowSpeed = intval(round($control->MinFocusSpeed()+(($control->MaxFocusSpeed()-$control->MinFocusSpeed())*$slow)));
|
||||
if ( $speed < $slowSpeed ) {
|
||||
$ctrlCommand .= ' --autostop';
|
||||
}
|
||||
|
@ -499,19 +500,19 @@ function buildControlCommand( $monitor ) {
|
|||
$factor = ($y+1)/$long_y;
|
||||
break;
|
||||
}
|
||||
if ( $monitor->HasZoomSpeed() ) {
|
||||
$speed = intval(round($monitor->MinZoomSpeed()+(($monitor->MaxZoomSpeed()-$monitor->MinZoomSpeed())*$factor)));
|
||||
if ( $control->HasZoomSpeed() ) {
|
||||
$speed = intval(round($control->MinZoomSpeed()+(($control->MaxZoomSpeed()-$control->MinZoomSpeed())*$factor)));
|
||||
$ctrlCommand .= ' --speed='.$speed;
|
||||
}
|
||||
switch( $mode ) {
|
||||
case 'Abs' :
|
||||
case 'Rel' :
|
||||
$step = intval(round($monitor->MinZoomStep()+(($monitor->MaxZoomStep()-$monitor->MinZoomStep())*$factor)));
|
||||
$step = intval(round($control->MinZoomStep()+(($control->MaxZoomStep()-$control->MinZoomStep())*$factor)));
|
||||
$ctrlCommand .= ' --step='.$step;
|
||||
break;
|
||||
case 'Con' :
|
||||
if ( $monitor->AutoStopTimeout() ) {
|
||||
$slowSpeed = intval(round($monitor->MinZoomSpeed()+(($monitor->MaxZoomSpeed()-$monitor->MinZoomSpeed())*$slow)));
|
||||
if ( $control->AutoStopTimeout() ) {
|
||||
$slowSpeed = intval(round($control->MinZoomSpeed()+(($control->MaxZoomSpeed()-$control->MinZoomSpeed())*$slow)));
|
||||
if ( $speed < $slowSpeed ) {
|
||||
$ctrlCommand .= ' --autostop';
|
||||
}
|
||||
|
@ -528,14 +529,14 @@ function buildControlCommand( $monitor ) {
|
|||
$factor = ($y+1)/$long_y;
|
||||
break;
|
||||
}
|
||||
if ( $monitor->HasIrisSpeed() ) {
|
||||
$speed = intval(round($monitor->MinIrisSpeed()+(($monitor->MaxIrisSpeed()-$monitor->MinIrisSpeed())*$factor)));
|
||||
if ( $control->HasIrisSpeed() ) {
|
||||
$speed = intval(round($control->MinIrisSpeed()+(($control->MaxIrisSpeed()-$control->MinIrisSpeed())*$factor)));
|
||||
$ctrlCommand .= ' --speed='.$speed;
|
||||
}
|
||||
switch( $mode ) {
|
||||
case 'Abs' :
|
||||
case 'Rel' :
|
||||
$step = intval(round($monitor->MinIrisStep()+(($monitor->MaxIrisStep()-$monitor->MinIrisStep())*$factor)));
|
||||
$step = intval(round($control->MinIrisStep()+(($control->MaxIrisStep()-$control->MinIrisStep())*$factor)));
|
||||
$ctrlCommand .= ' --step='.$step;
|
||||
break;
|
||||
}
|
||||
|
@ -549,14 +550,14 @@ function buildControlCommand( $monitor ) {
|
|||
$factor = ($y+1)/$long_y;
|
||||
break;
|
||||
}
|
||||
if ( $monitor->HasWhiteSpeed() ) {
|
||||
$speed = intval(round($monitor->MinWhiteSpeed()+(($monitor->MaxWhiteSpeed()-$monitor->MinWhiteSpeed())*$factor)));
|
||||
if ( $control->HasWhiteSpeed() ) {
|
||||
$speed = intval(round($control->MinWhiteSpeed()+(($control->MaxWhiteSpeed()-$control->MinWhiteSpeed())*$factor)));
|
||||
$ctrlCommand .= ' --speed='.$speed;
|
||||
}
|
||||
switch( $mode ) {
|
||||
case 'Abs' :
|
||||
case 'Rel' :
|
||||
$step = intval(round($monitor->MinWhiteStep()+(($monitor->MaxWhiteStep()-$monitor->MinWhiteStep())*$factor)));
|
||||
$step = intval(round($control->MinWhiteStep()+(($control->MaxWhiteStep()-$control->MinWhiteStep())*$factor)));
|
||||
$ctrlCommand .= ' --step='.$step;
|
||||
break;
|
||||
}
|
||||
|
@ -570,14 +571,14 @@ function buildControlCommand( $monitor ) {
|
|||
$factor = ($y+1)/$long_y;
|
||||
break;
|
||||
}
|
||||
if ( $monitor->HasGainSpeed() ) {
|
||||
$speed = intval(round($monitor->MinGainSpeed()+(($monitor->MaxGainSpeed()-$monitor->MinGainSpeed())*$factor)));
|
||||
if ( $control->HasGainSpeed() ) {
|
||||
$speed = intval(round($control->MinGainSpeed()+(($control->MaxGainSpeed()-$control->MinGainSpeed())*$factor)));
|
||||
$ctrlCommand .= ' --speed='.$speed;
|
||||
}
|
||||
switch( $mode ) {
|
||||
case 'Abs' :
|
||||
case 'Rel' :
|
||||
$step = intval(round($monitor->MinGainStep()+(($monitor->MaxGainStep()-$monitor->MinGainStep())*$factor)));
|
||||
$step = intval(round($control->MinGainStep()+(($control->MaxGainStep()-$control->MinGainStep())*$factor)));
|
||||
$ctrlCommand .= ' --step='.$step;
|
||||
break;
|
||||
}
|
||||
|
@ -655,29 +656,29 @@ function buildControlCommand( $monitor ) {
|
|||
$dirn = $new_dirn;
|
||||
}
|
||||
|
||||
if ( $monitor->HasPanSpeed() && $xFactor ) {
|
||||
if ( $monitor->HasTurboPan() ) {
|
||||
if ( $control->HasPanSpeed() && $xFactor ) {
|
||||
if ( $control->HasTurboPan() ) {
|
||||
if ( $xFactor >= $turbo ) {
|
||||
$panSpeed = $monitor->TurboPanSpeed();
|
||||
$panSpeed = $control->TurboPanSpeed();
|
||||
} else {
|
||||
$xFactor = $xFactor/$turbo;
|
||||
$panSpeed = intval(round($monitor->MinPanSpeed()+(($monitor->MaxPanSpeed()-$monitor->MinPanSpeed())*$xFactor)));
|
||||
$panSpeed = intval(round($control->MinPanSpeed()+(($control->MaxPanSpeed()-$control->MinPanSpeed())*$xFactor)));
|
||||
}
|
||||
} else {
|
||||
$panSpeed = intval(round($monitor->MinPanSpeed()+(($monitor->MaxPanSpeed()-$monitor->MinPanSpeed())*$xFactor)));
|
||||
$panSpeed = intval(round($control->MinPanSpeed()+(($control->MaxPanSpeed()-$control->MinPanSpeed())*$xFactor)));
|
||||
}
|
||||
$ctrlCommand .= ' --panspeed='.$panSpeed;
|
||||
}
|
||||
if ( $monitor->HasTiltSpeed() && $yFactor ) {
|
||||
if ( $monitor->HasTurboTilt() ) {
|
||||
if ( $control->HasTiltSpeed() && $yFactor ) {
|
||||
if ( $control->HasTurboTilt() ) {
|
||||
if ( $yFactor >= $turbo ) {
|
||||
$tiltSpeed = $monitor->TurboTiltSpeed();
|
||||
$tiltSpeed = $control->TurboTiltSpeed();
|
||||
} else {
|
||||
$yFactor = $yFactor/$turbo;
|
||||
$tiltSpeed = intval(round($monitor->MinTiltSpeed()+(($monitor->MaxTiltSpeed()-$monitor->MinTiltSpeed())*$yFactor)));
|
||||
$tiltSpeed = intval(round($control->MinTiltSpeed()+(($control->MaxTiltSpeed()-$control->MinTiltSpeed())*$yFactor)));
|
||||
}
|
||||
} else {
|
||||
$tiltSpeed = intval(round($monitor->MinTiltSpeed()+(($monitor->MaxTiltSpeed()-$monitor->MinTiltSpeed())*$yFactor)));
|
||||
$tiltSpeed = intval(round($control->MinTiltSpeed()+(($control->MaxTiltSpeed()-$control->MinTiltSpeed())*$yFactor)));
|
||||
}
|
||||
$ctrlCommand .= ' --tiltspeed='.$tiltSpeed;
|
||||
}
|
||||
|
@ -685,18 +686,18 @@ function buildControlCommand( $monitor ) {
|
|||
case 'Rel' :
|
||||
case 'Abs' :
|
||||
if ( preg_match( '/(Left|Right)$/', $dirn ) ) {
|
||||
$panStep = intval(round($monitor->MinPanStep()+(($monitor->MaxPanStep()-$monitor->MinPanStep())*$xFactor)));
|
||||
$panStep = intval(round($control->MinPanStep()+(($control->MaxPanStep()-$control->MinPanStep())*$xFactor)));
|
||||
$ctrlCommand .= ' --panstep='.$panStep;
|
||||
}
|
||||
if ( preg_match( '/^(Up|Down)/', $dirn ) ) {
|
||||
$tiltStep = intval(round($monitor->MinTiltStep()+(($monitor->MaxTiltStep()-$monitor->MinTiltStep())*$yFactor)));
|
||||
$tiltStep = intval(round($control->MinTiltStep()+(($control->MaxTiltStep()-$control->MinTiltStep())*$yFactor)));
|
||||
$ctrlCommand .= ' --tiltstep='.$tiltStep;
|
||||
}
|
||||
break;
|
||||
case 'Con' :
|
||||
if ( $monitor->AutoStopTimeout() ) {
|
||||
$slowPanSpeed = intval(round($monitor->MinPanSpeed()+(($monitor->MaxPanSpeed()-$monitor->MinPanSpeed())*$slow)));
|
||||
$slowTiltSpeed = intval(round($monitor->MinTiltSpeed()+(($monitor->MaxTiltSpeed()-$monitor->MinTiltSpeed())*$slow)));
|
||||
if ( $control->AutoStopTimeout() ) {
|
||||
$slowPanSpeed = intval(round($control->MinPanSpeed()+(($control->MaxPanSpeed()-$control->MinPanSpeed())*$slow)));
|
||||
$slowTiltSpeed = intval(round($control->MinTiltSpeed()+(($control->MaxTiltSpeed()-$control->MinTiltSpeed())*$slow)));
|
||||
if ( (!isset($panSpeed) || ($panSpeed < $slowPanSpeed)) && (!isset($tiltSpeed) || ($tiltSpeed < $slowTiltSpeed)) ) {
|
||||
$ctrlCommand .= ' --autostop';
|
||||
}
|
||||
|
@ -716,12 +717,16 @@ function buildControlCommand( $monitor ) {
|
|||
if ( canEdit( 'Control' ) ) {
|
||||
$preset = validInt($_REQUEST['preset']);
|
||||
$newLabel = validJsStr($_REQUEST['newLabel']);
|
||||
$row = dbFetchOne( 'SELECT * FROM ControlPresets WHERE MonitorId = ? AND Preset = ?', NULL, array( $monitor->Id(), $preset ) );
|
||||
$row = dbFetchOne(
|
||||
'SELECT * FROM `ControlPresets` WHERE `MonitorId` = ? AND `Preset`=?',
|
||||
NULL, array($monitor->Id(), $preset));
|
||||
if ( $newLabel != $row['Label'] ) {
|
||||
if ( $newLabel ) {
|
||||
dbQuery( 'REPLACE INTO ControlPresets ( MonitorId, Preset, Label ) VALUES ( ?, ?, ? )', array( $monitor->Id(), $preset, $newLabel ) );
|
||||
dbQuery('REPLACE INTO `ControlPresets` (`MonitorId`, `Preset`, `Label`) VALUES ( ?, ?, ? )',
|
||||
array($monitor->Id(), $preset, $newLabel));
|
||||
} else {
|
||||
dbQuery( 'DELETE FROM ControlPresets WHERE MonitorId = ? AND Preset = ?', array( $monitor->Id(), $preset ) );
|
||||
dbQuery('DELETE FROM `ControlPresets` WHERE `MonitorId`=? AND `Preset`=?',
|
||||
array($monitor->Id(), $preset));
|
||||
}
|
||||
}
|
||||
$ctrlCommand .= ' --preset='.$preset;
|
||||
|
|
|
@ -226,9 +226,9 @@ function controlPower($monitor, $cmds) {
|
|||
|
||||
function ptzControls($monitor) {
|
||||
$control = $monitor->Control();
|
||||
ZM\Error("Control: " . print_r($control,true));
|
||||
//ZM\Error("Control: " . print_r($control,true));
|
||||
$cmds = $control->commands();
|
||||
ZM\Error("Cmds: " . print_r($cmds, true));
|
||||
//ZM\Error("Cmds: " . print_r($cmds, true));
|
||||
ob_start();
|
||||
?>
|
||||
<div class="controlsPanel">
|
||||
|
|
|
@ -26,13 +26,13 @@ if ( !canView('Control') ) {
|
|||
$params = array();
|
||||
$groupSql = '';
|
||||
if ( !empty($_REQUEST['group']) ) {
|
||||
$groupSql = ' AND gm.GroupId = :groupid';
|
||||
$groupSql = ' AND (m.Id IN (SELECT MonitorID FROM Groups_Monitors WHERE GroupId = :groupid))';
|
||||
$params[':groupid'] = $_REQUEST['group'];
|
||||
}
|
||||
|
||||
$mid = !empty($_REQUEST['mid']) ? validInt($_REQUEST['mid']) : 0;
|
||||
|
||||
$sql = "SELECT m.* FROM Monitors m INNER JOIN Groups_Monitors AS gm ON m.Id = gm.MonitorId WHERE m.Function != 'None' AND m.Controllable = 1$groupSql ORDER BY Sequence";
|
||||
$sql = "SELECT m.* FROM Monitors m WHERE m.Function != 'None' AND m.Controllable = 1$groupSql ORDER BY Sequence";
|
||||
$mids = array();
|
||||
foreach ( dbFetchAll($sql, false, $params) as $row ) {
|
||||
if ( !visibleMonitor($row['Id']) ) {
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
function updateMonitorDimensions(element) {
|
||||
var form = element.form;
|
||||
if ( element.type == 'number' ) { // either width or height
|
||||
if ( element.type == 'number' ) {
|
||||
// either width or height
|
||||
|
||||
var widthFactor = parseInt( defaultAspectRatio.replace( /:.*$/, '' ) );
|
||||
var heightFactor = parseInt( defaultAspectRatio.replace( /^.*:/, '' ) );
|
||||
var widthFactor = parseInt(defaultAspectRatio.replace(/:.*$/, ''));
|
||||
var heightFactor = parseInt(defaultAspectRatio.replace(/^.*:/, ''));
|
||||
|
||||
var monitorWidth = parseInt(form.elements['newMonitor[Width]'].value);
|
||||
var monitorHeight = parseInt(form.elements['newMonitor[Height]'].value);
|
||||
|
|
|
@ -397,8 +397,9 @@ function save_layout(button) {
|
|||
var form = button.form;
|
||||
var name = form.elements['Name'].value;
|
||||
|
||||
if ( !name )
|
||||
if ( !name ) {
|
||||
name = form.elements['zmMontageLayout'].options[form.elements['zmMontageLayout'].selectedIndex].text;
|
||||
}
|
||||
|
||||
if ( name=='Freeform' || name=='2 Wide' || name=='3 Wide' || name=='4 Wide' || name=='5 Wide' ) {
|
||||
alert('You cannot edit the built in layouts. Please give the layout a new name.');
|
||||
|
|
|
@ -792,7 +792,7 @@ function initPage() {
|
|||
if ( window.history.length == 1 ) {
|
||||
$j('#closeControl').html('');
|
||||
}
|
||||
document.querySelectorAll('select[name="scale"]').forEach(function (el) {
|
||||
document.querySelectorAll('select[name="scale"]').forEach(function(el) {
|
||||
el.onchange = window['changeScale'];
|
||||
});
|
||||
} else if ( monitorRefresh > 0 ) {
|
||||
|
|
Loading…
Reference in New Issue