diff --git a/db/zm_create.sql.in b/db/zm_create.sql.in index 38550abaf..6dc934c73 100644 --- a/db/zm_create.sql.in +++ b/db/zm_create.sql.in @@ -1,8 +1,8 @@ --- MySQL dump 10.13 Distrib 5.6.13, for Linux (i686) +-- MySQL dump 10.13 Distrib 5.6.13, for Linux (i686) -- --- Host: localhost Database: @ZM_DB_NAME@ +-- Host: localhost Database: @ZM_DB_NAME@ -- ------------------------------------------------------ --- Server version 5.6.13 +-- Server version 5.6.13 /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -40,7 +40,7 @@ CREATE TABLE `Config` ( `Category` varchar(32) NOT NULL default '', `Readonly` tinyint(3) unsigned NOT NULL default '0', `Requires` text, - PRIMARY KEY (`Name`) + PRIMARY KEY (`Name`) ) ENGINE=@ZM_MYSQL_ENGINE@; -- @@ -52,7 +52,7 @@ CREATE TABLE `ControlPresets` ( `MonitorId` int(10) unsigned NOT NULL default '0', `Preset` int(10) unsigned NOT NULL default '0', `Label` varchar(64) NOT NULL default '', - PRIMARY KEY (`MonitorId`,`Preset`) + PRIMARY KEY (`MonitorId`,`Preset`) ) ENGINE=@ZM_MYSQL_ENGINE@; -- @@ -160,7 +160,7 @@ CREATE TABLE `Controls` ( `TurboTiltSpeed` int(10) default NULL, `CanAutoScan` tinyint(3) unsigned NOT NULL default '0', `NumScanPaths` tinyint(3) unsigned NOT NULL default '0', - PRIMARY KEY (`Id`) + PRIMARY KEY (`Id`) ) ENGINE=@ZM_MYSQL_ENGINE@; -- @@ -173,7 +173,7 @@ CREATE TABLE `Devices` ( `Name` tinytext NOT NULL, `Type` enum('X10') NOT NULL default 'X10', `KeyString` varchar(32) NOT NULL default '', - PRIMARY KEY (`Id`) + PRIMARY KEY (`Id`) ) ENGINE=@ZM_MYSQL_ENGINE@; -- @@ -203,7 +203,7 @@ CREATE TABLE `Events` ( `Messaged` tinyint(3) unsigned NOT NULL default '0', `Executed` tinyint(3) unsigned NOT NULL default '0', `Notes` text, - PRIMARY KEY (`Id`,`MonitorId`), + PRIMARY KEY (`Id`,`MonitorId`), KEY `MonitorId` (`MonitorId`), KEY `StartTime` (`StartTime`), KEY `Frames` (`Frames`), @@ -227,7 +227,7 @@ CREATE TABLE `Filters` ( `AutoExecuteCmd` tinytext, `AutoDelete` tinyint(3) unsigned NOT NULL default '0', `Background` tinyint(1) unsigned NOT NULL default '0', - PRIMARY KEY (`Name`) + PRIMARY KEY (`Name`) ) ENGINE=@ZM_MYSQL_ENGINE@; -- @@ -256,7 +256,7 @@ CREATE TABLE `Groups` ( `Id` int(10) unsigned NOT NULL auto_increment, `Name` varchar(64) NOT NULL default '', `MonitorIds` tinytext NOT NULL, - PRIMARY KEY (`Id`) + PRIMARY KEY (`Id`) ) ENGINE=@ZM_MYSQL_ENGINE@; -- @@ -304,7 +304,7 @@ CREATE TABLE `MonitorPresets` ( `ControlAddress` varchar(255) default NULL, `DefaultRate` smallint(5) unsigned NOT NULL default '100', `DefaultScale` smallint(5) unsigned NOT NULL default '100', - PRIMARY KEY (`Id`) + PRIMARY KEY (`Id`) ) ENGINE=@ZM_MYSQL_ENGINE@; -- @@ -373,7 +373,7 @@ CREATE TABLE `Monitors` ( `SignalCheckColour` varchar(32) NOT NULL default '#0000BE', `WebColour` varchar(32) NOT NULL default 'red', `Sequence` smallint(5) unsigned default NULL, - PRIMARY KEY (`Id`) + PRIMARY KEY (`Id`) ) ENGINE=@ZM_MYSQL_ENGINE@; -- @@ -384,7 +384,7 @@ DROP TABLE IF EXISTS `States`; CREATE TABLE `States` ( `Name` varchar(64) NOT NULL default '', `Definition` text NOT NULL, - PRIMARY KEY (`Name`) + PRIMARY KEY (`Name`) ) ENGINE=@ZM_MYSQL_ENGINE@; -- @@ -424,7 +424,7 @@ CREATE TABLE `TriggersX10` ( `Activation` varchar(32) default NULL, `AlarmInput` varchar(32) default NULL, `AlarmOutput` varchar(32) default NULL, - PRIMARY KEY (`MonitorId`) + PRIMARY KEY (`MonitorId`) ) ENGINE=@ZM_MYSQL_ENGINE@; -- @@ -446,7 +446,7 @@ CREATE TABLE `Users` ( `System` enum('None','View','Edit') NOT NULL default 'None', `MaxBandwidth` varchar(16) NOT NULL default '', `MonitorIds` tinytext NOT NULL, - PRIMARY KEY (`Id`), + PRIMARY KEY (`Id`), UNIQUE KEY `UC_Username` (`Username`) ) ENGINE=@ZM_MYSQL_ENGINE@; @@ -474,7 +474,7 @@ CREATE TABLE `ZonePresets` ( `MinBlobs` smallint(5) unsigned default NULL, `MaxBlobs` smallint(5) unsigned default NULL, `OverloadFrames` smallint(5) unsigned NOT NULL default '0', - PRIMARY KEY (`Id`) + PRIMARY KEY (`Id`) ) ENGINE=@ZM_MYSQL_ENGINE@; -- @@ -506,7 +506,7 @@ CREATE TABLE `Zones` ( `MinBlobs` smallint(5) unsigned default NULL, `MaxBlobs` smallint(5) unsigned default NULL, `OverloadFrames` smallint(5) unsigned NOT NULL default '0', - PRIMARY KEY (`Id`), + PRIMARY KEY (`Id`), KEY `MonitorId` (`MonitorId`) ) ENGINE=@ZM_MYSQL_ENGINE@; @@ -549,6 +549,8 @@ INSERT INTO Controls VALUES (NULL,'Foscam FI8608W','Ffmpeg','FI8608W_Y2k',1,0,1, INSERT INTO Controls VALUES (NULL,'Foscam FI8908W','Remote','FI8908W',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,0,0,0,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0); INSERT INTO Controls VALUES (NULL,'Foscam FI9821W','Ffmpeg','FI9821W_Y2k',1,0,1,1,0,0,0,1,0,0,0,0,0,0,0,1,1,0,0,1,0,0,0,0,1,0,100,1,1,0,0,1,0,100,0,100,1,0,100,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,0,100,0,100,1,0,100,1,16,0,1,1,1,0,0,0,1,1,0,360,0,360,1,0,4,0,0,1,0,90,0,90,1,0,4,0,0,0,0); INSERT INTO Controls VALUES (NULL,'Loftek Sentinel','Remote','LoftekSentinel',0,0,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,255,16,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,6,1,1,0,0,0,1,10,0,1,1,1,0,0,0,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0); +INSERT INTO Controls VALUES (NULL,'Toshiba IK-WB11A','Remote','Toshiba_IK_WB11A',0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,10,0,1,1,0,1,0,1,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0); +>>>>>>> 05e395613bd5bd01230f8a6508f8c04fc0c66c90 -- -- Add some monitor preset values diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Control/Toshiba_IK_WB11A.pm b/scripts/ZoneMinder/lib/ZoneMinder/Control/Toshiba_IK_WB11A.pm new file mode 100644 index 000000000..e96b30c85 --- /dev/null +++ b/scripts/ZoneMinder/lib/ZoneMinder/Control/Toshiba_IK_WB11A.pm @@ -0,0 +1,257 @@ +# ========================================================================== +# +# ZoneMinder Toshiba IK WB11A IP Camera Control Protocol Module, +# Copyright (C) 2013 Tim Craig (timcraigNO@SPAMsonic.net) +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# ========================================================================== +# +# This module contains the implementation of the Airlink SkyIPCam +# AICN747/AICN747W, TrendNet TV-IP410/TV-IP410W and other OEM versions of the +# Fitivision CS-130A/CS-131A camera control protocol. +# +package ZoneMinder::Control::Toshiba_IK_WB11A; + +use 5.006; +use strict; +use warnings; + +require ZoneMinder::Base; +require ZoneMinder::Control; + +our @ISA = qw(ZoneMinder::Control); + +# ========================================================================== +# +# Toshiba IK-WB11A IP Camera Control Protocol +# +# ========================================================================== + +use ZoneMinder::Logger qw(:all); +use ZoneMinder::Config qw(:all); + +use Time::HiRes qw( usleep ); + +sub new +{ + my $class = shift; + my $id = shift; + my $self = ZoneMinder::Control->new( $id ); + bless( $self, $class ); + srand( time() ); + return $self; +} + +our $AUTOLOAD; + +sub AUTOLOAD +{ + my $self = shift; + my $class = ref($self) || croak( "$self not object" ); + my $name = $AUTOLOAD; + $name =~ s/.*://; + if ( exists($self->{$name}) ) + { + return( $self->{$name} ); + } + Fatal( "Can't access $name member of object of class $class" ); +} + +sub open +{ + my $self = shift; + + $self->loadMonitor(); + + use LWP::UserAgent; + $self->{ua} = LWP::UserAgent->new; + $self->{ua}->agent( "ZoneMinder Control Agent/".ZoneMinder::Base::ZM_VERSION ); + + $self->{state} = 'open'; +} + +sub close +{ + my $self = shift; + $self->{state} = 'closed'; +} + +sub printMsg +{ + my $self = shift; + my $msg = shift; + my $msg_len = length($msg); + + Debug( $msg."[".$msg_len."]" ); +} + +sub sendCmd +{ + my $self = shift; + my $cmd = shift; + + #my $result = undef; + + printMsg( $cmd, "Tx" ); + + my $req = HTTP::Request->new( GET=>"http://".$self->{Monitor}->{ControlAddress}."$cmd" ); + my $res = $self->{ua}->request($req); + return( !undef ); +} + +sub reset +{ + my $self = shift; + Debug( "Camera Reset" ); + my $cmd = "/control.cgi?cont_2=16"; + $self->sendCmd( $cmd ); +} + +sub moveMap +{ + Debug("MoveMap"); + my $self = shift; + my $params = shift; + my $xcoord = $self->getParam( $params, 'xcoord' ); + my $ycoord = $self->getParam( $params, 'ycoord' ); + + my $hor = $xcoord / $self->{Monitor}->{Width}; + my $ver = $ycoord / $self->{Monitor}->{Height}; + + my $maxver = 10; + my $maxhor = 10; + + my $horSteps = 0; + my $verSteps = 0; + + $horSteps = $hor * $maxhor; + $verSteps = $ver * $maxver; + + my $v = int($verSteps); + my $h = int($horSteps); + + Debug( "Move Map to $xcoord,$ycoord, hor=$h, ver=$v"); + my $cmd = "/cont.cgi?contptpoint_".$h."_".$v."=1"; + $self->sendCmd( $cmd ); +} + +sub moveRelUp +{ + my $self = shift; + Debug( "Step Up" ); + my $cmd = "/control.cgi?cont_2=4"; + $self->sendCmd( $cmd ); +} + +sub moveRelDown +{ + my $self = shift; + Debug( "Step Down" ); + my $cmd = "/control.cgi?cont_2=8"; + $self->sendCmd( $cmd ); +} + +sub moveRelLeft +{ + my $self = shift; + Debug( "Step Left" ); + my $cmd = "/control.cgi?cont_2=1"; + $self->sendCmd( $cmd ); +} + +sub moveRelRight +{ + my $self = shift; + Debug( "Step Right" ); + my $cmd = "/control.cgi?cont_2=2"; + $self->sendCmd( $cmd ); +} + +sub presetClear +{ + my $self = shift; + my $params = shift; + my $preset = $self->getParam( $params, 'preset' ); + Debug( "Clear Preset $preset" ); + my $cmdNum = 3 << 8 | $preset; + my $cmd = "/control.cgi?cont_4=$cmdNum"; + $self->sendCmd( $cmd ); +} + +sub presetSet +{ + my $self = shift; + my $params = shift; + my $preset = $self->getParam( $params, 'preset' ); + Debug( "Set Preset $preset" ); + my $cmdNum = 2 << 8 | $preset; + my $cmd = "/control.cgi?cont_4=$cmdNum"; + $self->sendCmd( $cmd ); +} + +sub presetGoto +{ + my $self = shift; + my $params = shift; + my $preset = $self->getParam( $params, 'preset' ); + Debug( "Goto Preset $preset" ); + my $cmdNum = 1 << 8 | $preset; + my $cmd = "/control.cgi?cont_4=$cmdNum"; + $self->sendCmd( $cmd ); +} + +1; +__END__ +# Below is stub documentation for your module. You'd better edit it! + +=head1 NAME + +ZoneMinder::Control::Toshiba_IK_WB11A - Zoneminder PTZ control module the Toshiba IK-WB11A IP Camera + +=head1 SYNOPSIS + + use ZoneMinder::Control::Toshiba_IK_WB11A; + blah blah blah + +=head1 DESCRIPTION + + This is for Zoneminder PTZ control module for the Toshib_IK_WB11A camera. + +=head2 EXPORT + +None by default. + + + +=head1 SEE ALSO + +www.zoneminder.com + +=head1 AUTHOR + +Philip Coombes, Ephilip.coombes@zoneminder.comE +Tim Craig, EtimcraigNO@SPAMsonic.netE + +=head1 COPYRIGHT AND LICENSE + +Copyright (C) 2013 by Tim Craig + +This library is free software; you can redistribute it and/or modify +it under the same terms as Perl itself, either Perl version 5.8.3 or, +at your option, any later version of Perl 5 you may have available. + + +=cut