Persistance and UI for ONVIF monitor options
This commit is contained in:
parent
99a4b0c86f
commit
5c6fe54265
|
@ -204,3 +204,54 @@ SET @s = (SELECT IF(
|
|||
|
||||
PREPARE stmt FROM @s;
|
||||
EXECUTE stmt;
|
||||
|
||||
--
|
||||
-- Add Config* fields; used for specifying ONVIF/PSIA options
|
||||
--
|
||||
SET @s = (SELECT IF(
|
||||
(SELECT COUNT(*)
|
||||
FROM INFORMATION_SCHEMA.COLUMNS
|
||||
WHERE table_name = 'Monitors'
|
||||
AND table_schema = DATABASE()
|
||||
AND column_name = 'ConfigType'
|
||||
) > 0,
|
||||
"SELECT 'Column ConfigType already exists in Monitors'",
|
||||
"ALTER TABLE `Monitors` ADD COLUMN `ConfigType` ENUM('None','ONVIF','PSIA') NOT NULL DEFAULT '' AFTER `Triggers`"
|
||||
));
|
||||
|
||||
PREPARE stmt FROM @s;
|
||||
EXECUTE stmt;
|
||||
|
||||
--
|
||||
-- Add Config* fields; used for specifying ONVIF/PSIA options
|
||||
--
|
||||
SET @s = (SELECT IF(
|
||||
(SELECT COUNT(*)
|
||||
FROM INFORMATION_SCHEMA.COLUMNS
|
||||
WHERE table_name = 'Monitors'
|
||||
AND table_schema = DATABASE()
|
||||
AND column_name = 'ConfigURL'
|
||||
) > 0,
|
||||
"SELECT 'Column ConfigURL already exists in Monitors'",
|
||||
"ALTER TABLE `Monitors` ADD COLUMN `ConfigURL` VARCHAR(255) NOT NULL DEFAULT 'None' AFTER `ConfigType`"
|
||||
));
|
||||
|
||||
PREPARE stmt FROM @s;
|
||||
EXECUTE stmt;
|
||||
|
||||
--
|
||||
-- Add Config* fields; used for specifying ONVIF/PSIA options
|
||||
--
|
||||
SET @s = (SELECT IF(
|
||||
(SELECT COUNT(*)
|
||||
FROM INFORMATION_SCHEMA.COLUMNS
|
||||
WHERE table_name = 'Monitors'
|
||||
AND table_schema = DATABASE()
|
||||
AND column_name = 'ConfigOptions'
|
||||
) > 0,
|
||||
"SELECT 'Column ConfigOptions already exists in Monitors'",
|
||||
"ALTER TABLE `Monitors` ADD COLUMN `ConfigOptions` VARCHAR(64) NOT NULL DEFAULT '' AFTER `ConfigURL`"
|
||||
));
|
||||
|
||||
PREPARE stmt FROM @s;
|
||||
EXECUTE stmt;
|
||||
|
|
|
@ -44,6 +44,10 @@ require ONVIF::Deserializer::XSD;
|
|||
require ONVIF::Device::Interfaces::Device::DevicePort;
|
||||
require ONVIF::Media::Interfaces::Media::MediaPort;
|
||||
require ONVIF::PTZ::Interfaces::PTZ::PTZPort;
|
||||
require ONVIF::Analytics::Interfaces::Analytics::AnalyticsEnginePort;
|
||||
require ONVIF::Analytics::Interfaces::Analytics::RuleEnginePort;
|
||||
|
||||
require WSNotification::Interfaces::WSBaseNotificationSender::NotificationProducerPort;
|
||||
|
||||
use Data::Dump qw(dump);
|
||||
|
||||
|
@ -252,6 +256,25 @@ sub create_services
|
|||
$self->set_service('ptz', 'ep', ONVIF::PTZ::Interfaces::PTZ::PTZPort->new({
|
||||
proxy => $self->service('ptz', 'url'),
|
||||
serializer => $self->serializer(),
|
||||
# transport => $transport
|
||||
}));
|
||||
}
|
||||
if(defined $self->service('events', 'url')) {
|
||||
$self->set_service('events', 'ep', WSNotification::Interfaces::WSBaseNotificationSender::NotificationProducerPort->new({
|
||||
proxy => $self->service('events', 'url'),
|
||||
serializer => $self->serializer(),
|
||||
# transport => $transport
|
||||
}));
|
||||
}
|
||||
if(defined $self->service('analytics', 'url')) {
|
||||
$self->set_service('analytics', 'ep', ONVIF::Analytics::Interfaces::Analytics::AnalyticsEnginePort->new({
|
||||
proxy => $self->service('analytics', 'url'),
|
||||
serializer => $self->serializer(),
|
||||
# transport => $transport
|
||||
}));
|
||||
$self->set_service('rules', 'ep', ONVIF::Analytics::Interfaces::Analytics::RuleEnginePort->new({
|
||||
proxy => $self->service('analytics', 'url'),
|
||||
serializer => $self->serializer(),
|
||||
# transport => $transport
|
||||
}));
|
||||
}
|
||||
|
|
|
@ -3,19 +3,34 @@ use strict;
|
|||
use warnings;
|
||||
|
||||
use base qw(SOAP::WSDL::Deserializer::XSD);
|
||||
use Data::Dump qw(dump);
|
||||
|
||||
use SOAP::WSDL::SOAP::Typelib::Fault11;
|
||||
use ONVIF::Deserializer::MessageParser;
|
||||
|
||||
use SOAP::WSDL::Factory::Deserializer;
|
||||
|
||||
### support for SOAP::Lite #####
|
||||
|
||||
=comment
|
||||
use overload '%{}' => \&myhash;
|
||||
|
||||
my %context_of;
|
||||
|
||||
sub myhash {
|
||||
my ($self, $other, $swap) = @_;
|
||||
return { '_context' => $context_of{ident $self} };
|
||||
}
|
||||
=cut
|
||||
|
||||
################################
|
||||
|
||||
SOAP::WSDL::Factory::Deserializer->register('1.1', __PACKAGE__ );
|
||||
SOAP::WSDL::Factory::Deserializer->register('1.2', __PACKAGE__ );
|
||||
|
||||
## we get the soap version from the message parser
|
||||
my %soap_version_of :ATTR( :default<()>);
|
||||
|
||||
|
||||
sub soap_version {
|
||||
my ($self) = @_;
|
||||
if($SOAP::WSDL::Deserializer::XSD::parser_of{ident $self}) {
|
||||
|
@ -35,6 +50,8 @@ sub deserialize {
|
|||
$SOAP::WSDL::Deserializer::XSD::parser_of{ ${ $self } } = $parser;
|
||||
}
|
||||
|
||||
#print "Deserializing:\n"; dump($content);
|
||||
|
||||
$parser->class_resolver(
|
||||
$self->SOAP::WSDL::Deserializer::XSD::get_class_resolver() );
|
||||
eval { $parser->parse_string( $content ) };
|
||||
|
|
|
@ -224,7 +224,10 @@ $SLANG = array(
|
|||
'Colour' => 'Colour',
|
||||
'Command' => 'Command',
|
||||
'Config' => 'Config',
|
||||
'ConfigOptions' => 'ConfigOptions',
|
||||
'ConfigType' => 'Config Type',
|
||||
'ConfiguredFor' => 'Configured for',
|
||||
'ConfigURL' => 'Config Base URL',
|
||||
'ConfirmDeleteEvents' => 'Are you sure you wish to delete the selected events?',
|
||||
'ConfirmPassword' => 'Confirm Password',
|
||||
'ConjAnd' => 'and',
|
||||
|
@ -433,6 +436,7 @@ $SLANG = array(
|
|||
'MaxZoomStep' => 'Max Zoom Step',
|
||||
'MediumBW' => 'Medium B/W',
|
||||
'Medium' => 'Medium',
|
||||
'MetaConfig' => 'Meta Config',
|
||||
'MinAlarmAreaLtMax' => 'Minimum alarm area should be less than maximum',
|
||||
'MinAlarmAreaUnset' => 'You must specify the minimum alarm pixel count',
|
||||
'MinBlobAreaLtMax' => 'Minimum blob area should be less than maximum',
|
||||
|
@ -706,9 +710,6 @@ $SLANG = array(
|
|||
'ViewEvent' => 'View Event',
|
||||
'ViewPaged' => 'View Paged',
|
||||
'View' => 'View',
|
||||
'V4L' => 'V4L',
|
||||
'V4LCapturesPerFrame' => 'Captures Per Frame',
|
||||
'V4LMultiBuffer' => 'Multi Buffering',
|
||||
'Wake' => 'Wake',
|
||||
'WarmupFrames' => 'Warmup Frames',
|
||||
'Watch' => 'Watch',
|
||||
|
|
|
@ -26,6 +26,7 @@ if ( !canView( 'Monitors' ) )
|
|||
|
||||
$tabs = array();
|
||||
$tabs["general"] = $SLANG['General'];
|
||||
$tabs["config"] = $SLANG['MetaConfig'];
|
||||
$tabs["source"] = $SLANG['Source'];
|
||||
$tabs["timestamp"] = $SLANG['Timestamp'];
|
||||
$tabs["buffers"] = $SLANG['Buffers'];
|
||||
|
@ -40,11 +41,14 @@ if ( isset($_REQUEST['tab']) )
|
|||
else
|
||||
$tab = "general";
|
||||
|
||||
if ( ! empty($_REQUEST['mid']) ) {
|
||||
if ( !empty($_REQUEST['mid']) )
|
||||
{
|
||||
$monitor = dbFetchMonitor( $_REQUEST['mid'] );
|
||||
if ( ZM_OPT_X10 )
|
||||
$x10Monitor = dbFetchOne( 'SELECT * FROM TriggersX10 WHERE MonitorId = ?', NULL, array($_REQUEST['mid']) );
|
||||
} else {
|
||||
$x10Monitor = dbFetchOne( 'SELECT * FROM TriggersX10 WHERE MonitorId = ?', NULL, array( $_REQUEST['mid']) );
|
||||
}
|
||||
else
|
||||
{
|
||||
$nextId = getTableAutoInc( 'Monitors' );
|
||||
$monitor = array(
|
||||
'Id' => 0,
|
||||
|
@ -104,8 +108,9 @@ if ( ! empty($_REQUEST['mid']) ) {
|
|||
'SignalCheckColour' => '#0000c0',
|
||||
'WebColour' => 'red',
|
||||
'Triggers' => "",
|
||||
'V4LMultiBuffer' => '',
|
||||
'V4LCapturesPerFrame' => 1,
|
||||
'ConfigType' => "None",
|
||||
'ConfigURL' => "",
|
||||
'ConfigOptions' => "",
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -142,8 +147,7 @@ if ( $newMonitor['MaxFPS'] == '0.00' )
|
|||
if ( $newMonitor['AlarmMaxFPS'] == '0.00' )
|
||||
$newMonitor['AlarmMaxFPS'] = '';
|
||||
|
||||
if ( !empty($_REQUEST['preset']) )
|
||||
{
|
||||
if ( !empty($_REQUEST['preset']) ) {
|
||||
$preset = dbFetchOne( 'SELECT Type, Device, Channel, Format, Protocol, Method, Host, Port, Path, Width, Height, Palette, MaxFPS, Controllable, ControlId, ControlDevice, ControlAddress, DefaultRate, DefaultScale FROM MonitorPresets WHERE Id = ?', NULL, array($_REQUEST['preset']) );
|
||||
foreach ( $preset as $name=>$value )
|
||||
{
|
||||
|
@ -215,6 +219,12 @@ if ( !ZM_PCRE )
|
|||
// Currently unsupported
|
||||
unset($httpMethods['jpegTags']);
|
||||
|
||||
$configTypes = array(
|
||||
'None' => $SLANG['None'],
|
||||
'ONVIF' => 'ONVIF',
|
||||
'PSIA' => 'PSIA',
|
||||
);
|
||||
|
||||
if ( ZM_HAS_V4L1 )
|
||||
{
|
||||
$v4l1DeviceFormats = array(
|
||||
|
@ -485,6 +495,16 @@ if ( $tab != 'general' )
|
|||
}
|
||||
}
|
||||
}
|
||||
if ( $tab != 'config' )
|
||||
{
|
||||
?>
|
||||
<input type="hidden" name="newMonitor[ConfigType]" value="<?= validHtmlStr($newMonitor['ConfigType']) ?>"/>
|
||||
<input type="hidden" name="newMonitor[ConfigURL]" value="<?= validHtmlStr($newMonitor['ConfigURL']) ?>"/>
|
||||
<input type="hidden" name="newMonitor[User]" value="<?= validHtmlStr($newMonitor['User']) ?>"/>
|
||||
<input type="hidden" name="newMonitor[Pass]" value="<?= validHtmlStr($newMonitor['Pass']) ?>"/>
|
||||
<input type="hidden" name="newMonitor[ConfigOptions]" value="<?= validHtmlStr($newMonitor['ConfigOptions']) ?>"/>
|
||||
<?php
|
||||
}
|
||||
if ( ZM_HAS_V4L && ($tab != 'source' || $newMonitor['Type'] != 'Local') )
|
||||
{
|
||||
?>
|
||||
|
@ -492,8 +512,6 @@ if ( ZM_HAS_V4L && ($tab != 'source' || $newMonitor['Type'] != 'Local') )
|
|||
<input type="hidden" name="newMonitor[Channel]" value="<?= validHtmlStr($newMonitor['Channel']) ?>"/>
|
||||
<input type="hidden" name="newMonitor[Format]" value="<?= validHtmlStr($newMonitor['Format']) ?>"/>
|
||||
<input type="hidden" name="newMonitor[Palette]" value="<?= validHtmlStr($newMonitor['Palette']) ?>"/>
|
||||
<input type="hidden" name="newMonitor[V4LMultiBuffer]" value="<?= validHtmlStr($newMonitor['V4LMultiBuffer']) ?>"/>
|
||||
<input type="hidden" name="newMonitor[V4LCapturesPerFrame]" value="<?= validHtmlStr($newMonitor['V4LCapturesPerFrame']) ?>"/>
|
||||
<?php
|
||||
}
|
||||
if ( $tab != 'source' || $newMonitor['Type'] != 'Remote' )
|
||||
|
@ -611,7 +629,7 @@ switch ( $tab )
|
|||
foreach ( getEnumValues( 'Monitors', 'Function' ) as $optFunction )
|
||||
{
|
||||
?>
|
||||
<option value="<?= $optFunction ?>"<?php if ( $optFunction == $newMonitor['Function'] ) { ?> selected="selected"<?php } ?>><?= $optFunction ?></option>
|
||||
<option value="<?= $optFunction ?>"<?php if ( $optFunction == $newMonitor['Function'] ) { ?> selected="selected"<?php } ?>><?= $SLANG['Fn'.$optFunction] ?></option>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
@ -681,6 +699,17 @@ switch ( $tab )
|
|||
}
|
||||
?>
|
||||
</td></tr>
|
||||
<?php
|
||||
break;
|
||||
}
|
||||
case 'config' :
|
||||
{
|
||||
?>
|
||||
<tr><td><?= $SLANG['ConfigType'] ?></td><td><?= buildSelect( "newMonitor[ConfigType]", $configTypes, "submitTab( '$tab' )" ); ?></td></tr>
|
||||
<tr><td><?= $SLANG['ConfigURL'] ?></td><td><input type="text" name="newMonitor[ConfigURL]" value="<?= validHtmlStr($newMonitor['ConfigURL']) ?>" size="24"/></td></tr>
|
||||
<tr><td><?= "Username" ?></td><td><input type="text" name="newMonitor[User]" value="<?= validHtmlStr($newMonitor['User']) ?>" size="12"/></td></tr>
|
||||
<tr><td><?= "Password" ?></td><td><input type="text" name="newMonitor[Pass]" value="<?= validHtmlStr($newMonitor['Pass']) ?>" size="12"/></td></tr>
|
||||
<tr><td><?= $SLANG['ConfigOptions'] ?></td><td><input type="text" name="newMonitor[ConfigOptions]" value="<?= validHtmlStr($newMonitor['ConfigOptions']) ?>" size="24"/></td></tr>
|
||||
<?php
|
||||
break;
|
||||
}
|
||||
|
@ -708,17 +737,6 @@ switch ( $tab )
|
|||
<tr><td><?= $SLANG['CapturePalette'] ?></td><td><select name="newMonitor[Palette]"><?php foreach ( $v4l2LocalPalettes as $name => $value ) { ?><option value="<?= $value ?>"<?php if ( $value == $newMonitor['Palette'] ) { ?> selected="selected"<?php } ?>><?= $name ?></option><?php } ?></select></td></tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<tr><td><?= $SLANG['V4LMultiBuffer'] ?></td><td>
|
||||
<input type="radio" name="newMonitor[V4LMultiBuffer]" id="newMonitor[V4LMultiBuffer]1" value="1" <?php echo ( $newMonitor['V4LMultiBuffer'] == 1 ? 'checked="checked"' : '' ) ?>/>
|
||||
<label for="newMonitor[V4LMultiBuffer]1">Yes</label>
|
||||
<input type="radio" name="newMonitor[V4LMultiBuffer]" id="newMonitor[V4LMultiBuffer]0" value="0" <?php echo ( $newMonitor['V4LMultiBuffer'] == 0 ? 'checked="checked"' : '' ) ?>/>
|
||||
<label for="newMonitor[V4LMultiBuffer]0">No</label>
|
||||
<input type="radio" name="newMonitor[V4LMultiBuffer]" id="newMonitor[V4LMultiBuffer]" value="" <?php echo ( empty($newMonitor['V4LMultiBuffer']) ? 'checked="checked"' : '' ) ?>/>
|
||||
<label for="newMonitor[V4LMultiBuffer]">Use Config Value</label>
|
||||
</td></tr>
|
||||
<tr><td><?= $SLANG['V4LCapturesPerFrame'] ?></td><td><input type="number" name="newMonitor[V4LCapturesPerFrame]" value="<?php echo $newMonitor['V4LCapturesPerFrame'] ?>"/></td></tr>
|
||||
<?php
|
||||
}
|
||||
elseif ( $newMonitor['Type'] == "Remote" )
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue