Difference between revisions of "7Links"

From ZoneMinder Wiki
Jump to navigationJump to search
(added control script for 7LINKS SPX3615)
 
(One intermediate revision by one other user not shown)
Line 30: Line 30:


Nice Video how to do this, for normal users (not linux specialists :-)
Nice Video how to do this, for normal users (not linux specialists :-)
Here: http://www.youtube.com/watch?v=o9PyV4wkFZM&feature=related
Here: http://www.youtube.com/watch?v=o9PyV4wkFZM&feature=related
For SPX-3615 you can enable pan-tilt:
+++
package ZoneMinder::Control::7LINKSPX3615;
 
use 5.006;
use strict;
use warnings;
require ZoneMinder::Base;
require ZoneMinder::Control;
our @ISA = qw(ZoneMinder::Control);
# ==========================================================================
#
# 7LINKS SPX3615
# Author: Bogdan Kecman <bogdan.kecman at gmail>
# Tested with SPX-3615 only
#
# /decoder_control.cgi?command=COMMAND
#
# COMMAND:
# 0: up
# 1: stop
# 2: down
# 4: left
# 6: right
# 92: down-left
# 93: down-right
# 91: up-right
# 90: up-left
#
# 25: patrol all around
# 26: vertical patrol
# 27: vertical patrol stop
# 28: horisontal patrol
# 29: horisontal patrol stop
#
# 94 led off
# 95 led on
#
# CALL PRESET
# 31: 1
# 33: 2
# 35: 3
# 37: 4
# 39: 5
# 41: 6
# 43: 7
# 45: 8
# 47: 9
# 49: 10
# 51: 11
# 53: 12
# 55: 13
# 57: 14
# 59: 15
#
# SAVE PRESET
# 30: 1
# 32: 2
# 34: 3
# 36: 4
# 38: 5
# 40: 6
# 42: 7
# 44: 8
# 46: 9
# 48: 10
# 50: 11
# 52: 12
# 54: 13
# 56: 14
# 58: 15
#
#
#
# 640x480
# /camera_control.cgi?param=0&value=32
#
# 320x240
# /camera_control.cgi?param=0&value=8
#
# 160x120
# /camera_control.cgi?param=0&value=2
#
# 50Hz
# /camera_control.cgi?param=3&value=0
#
# 60Hz
# /camera_control.cgi?param=3&value=1
#
# outdoor
# /camera_control.cgi?param=3&value=2
#
# brightness
# /camera_control.cgi?param=1&value=112  (value: 0-240)
#
# contrast
# /camera_control.cgi?param=2&value=0 (value 0-6)
#
# default all
# /camera_control.cgi?param=0&value=8
#
# ==========================================================================
use ZoneMinder::Logger qw(:all);
use ZoneMinder::Config qw(:all);
use Data::Dumper;
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);
        if ( $res->is_success )
        {
                $result = !undef;
        }
        else
        {
                Error( "Error check failed: '".$res->status_line()."' for URL ".$req->uri() );
        }
        return( $result );
}
sub reset
{
        my $self = shift;
        Debug( "Camera Reset" );
        $self->sendCmd( 'reboot.cgi?' );
}
#Up Arrow
sub moveConUp
{
        my $self = shift;
        Debug( "Move Up" );
        $self->sendCmd( 'decoder_control.cgi?command=0&' );
}
#Down Arrow
sub moveConDown
{
        my $self = shift;
        Debug( "Move Down" );
        $self->sendCmd( 'decoder_control.cgi?command=2&' );
}
#Left Arrow
sub moveConLeft
{
        my $self = shift;
        Debug( "Move Left" );
        $self->sendCmd( 'decoder_control.cgi?command=4&' );
}
#Right Arrow
sub moveConRight
{
        my $self = shift;
        Debug( "Move Right" );
        $self->sendCmd( 'decoder_control.cgi?command=6&' );
}
#Diagonally Up Right Arrow
sub moveConUpRight
{
        my $self = shift;
        Debug( "Move Diagonally Up Right" );
        $self->sendCmd( 'decoder_control.cgi?command=91&' );
}
#Diagonally Down Right Arrow
sub moveConDownRight
{
        my $self = shift;
        Debug( "Move Diagonally Down Right" );
        $self->sendCmd( 'decoder_control.cgi?command=93&' );
}
#Diagonally Up Left Arrow
sub moveConUpLeft
{
        my $self = shift;
        Debug( "Move Diagonally Up Left" );
        $self->sendCmd( 'decoder_control.cgi?command=90&' );
}
#Diagonally Down Left Arrow
sub moveConDownLeft
{
        my $self = shift;
        Debug( "Move Diagonally Down Left" );
        $self->sendCmd( 'decoder_control.cgi?command=92&' );
}
#Stop
sub moveStop
{
        my $self = shift;
        Debug( "Move Stop" );
        $self->sendCmd( 'decoder_control.cgi?command=1&' );
}
#Move Camera to Home Position
sub presetHome
{
        my $self = shift;
        Debug( "Home Preset" );
        $self->sendCmd( 'decoder_control.cgi?command=25&' );
}
sub presetGoto
{
        my $self = shift;
        my $params = shift;
        my $preset = $self->getParam( $params, 'preset' );
        Debug( "Goto Preset $preset" );
        my $cmd = "decoder_control.cgi?command=" . ($preset *2 + 29 );
        $self->sendCmd( $cmd );
}
sub presetSet
{
        my $self = shift;
        my $params = shift;
        my $preset = $self->getParam( $params, 'preset' );
        Debug( "Set Preset $preset" );
        my $cmd = "decoder_control.cgi?command=" . ($preset *2 + 28);
        $self->sendCmd( $cmd );
}
1;
__END__
=pod
=head1 DESCRIPTION
This module contains the implementation of the 7LINKS PX-3615 IP camera control protocol.
=cut
+++

Latest revision as of 09:43, 28 May 2014

7Links WLAN-IP-Camera with IR-nightview & motion dedection

I'm using this cheap model now for 3 weeks. Working fine so far, even at -8°C, no fault.

Picture here:http://ecx.images-amazon.com/images/I/41GZi-upRuL._SL500_AA300_.jpg

Working with following settings:

Remote Protocol -> HTTP

Remote Method -> Simple

Remote Host Name -> username:password@192.168.xxx.xxx

Remote Host Port -> 80

Remote Host Path -> /videostream.cgi

Remote Image Colors -> 24 bit color

Capture Width (pixels) -> 320

Capture Height (pixels) -> 240

Preserve Aspect Ratio ->

Orientation -> Normal

Also working with 640 x 480. I had to adjust the shared memory.

Nice Video how to do this, for normal users (not linux specialists :-)

Here: http://www.youtube.com/watch?v=o9PyV4wkFZM&feature=related


For SPX-3615 you can enable pan-tilt:

+++
package ZoneMinder::Control::7LINKSPX3615;
 
use 5.006;
use strict;
use warnings; 

require ZoneMinder::Base;
require ZoneMinder::Control;

our @ISA = qw(ZoneMinder::Control);

# ==========================================================================
#
# 7LINKS SPX3615
# Author: Bogdan Kecman <bogdan.kecman at gmail>
# Tested with SPX-3615 only
#
# /decoder_control.cgi?command=COMMAND
#
# COMMAND:
# 0: up
# 1: stop
# 2: down
# 4: left
# 6: right
# 92: down-left
# 93: down-right
# 91: up-right
# 90: up-left
#
# 25: patrol all around
# 26: vertical patrol
# 27: vertical patrol stop
# 28: horisontal patrol
# 29: horisontal patrol stop
#
# 94 led off
# 95 led on
#
# CALL PRESET
# 31: 1
# 33: 2
# 35: 3
# 37: 4
# 39: 5
# 41: 6
# 43: 7
# 45: 8
# 47: 9
# 49: 10
# 51: 11
# 53: 12
# 55: 13
# 57: 14
# 59: 15
#
# SAVE PRESET
# 30: 1
# 32: 2
# 34: 3
# 36: 4
# 38: 5
# 40: 6
# 42: 7
# 44: 8
# 46: 9
# 48: 10
# 50: 11
# 52: 12
# 54: 13
# 56: 14
# 58: 15
#
#
#
# 640x480
# /camera_control.cgi?param=0&value=32
#
# 320x240
# /camera_control.cgi?param=0&value=8
#
# 160x120
# /camera_control.cgi?param=0&value=2
#
# 50Hz
# /camera_control.cgi?param=3&value=0
#
# 60Hz
# /camera_control.cgi?param=3&value=1
#
# outdoor
# /camera_control.cgi?param=3&value=2
#
# brightness
# /camera_control.cgi?param=1&value=112  (value: 0-240)
#
# contrast
# /camera_control.cgi?param=2&value=0 (value 0-6)
#
# default all
# /camera_control.cgi?param=0&value=8
#
# ==========================================================================

use ZoneMinder::Logger qw(:all);
use ZoneMinder::Config qw(:all);
use Data::Dumper;
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);

        if ( $res->is_success )
        {
                $result = !undef;
        }
        else
        {
                Error( "Error check failed: '".$res->status_line()."' for URL ".$req->uri() );
        }

        return( $result );
}

sub reset
{
        my $self = shift;
        Debug( "Camera Reset" );
        $self->sendCmd( 'reboot.cgi?' );
}

#Up Arrow
sub moveConUp
{
        my $self = shift;
        Debug( "Move Up" );
        $self->sendCmd( 'decoder_control.cgi?command=0&' );
}

#Down Arrow
sub moveConDown
{
        my $self = shift;
        Debug( "Move Down" );
        $self->sendCmd( 'decoder_control.cgi?command=2&' );
}

#Left Arrow
sub moveConLeft
{
        my $self = shift;
        Debug( "Move Left" );
        $self->sendCmd( 'decoder_control.cgi?command=4&' );
}

#Right Arrow
sub moveConRight
{
        my $self = shift;
        Debug( "Move Right" );
        $self->sendCmd( 'decoder_control.cgi?command=6&' );
}

#Diagonally Up Right Arrow
sub moveConUpRight
{
        my $self = shift;
        Debug( "Move Diagonally Up Right" );
        $self->sendCmd( 'decoder_control.cgi?command=91&' );
}

#Diagonally Down Right Arrow
sub moveConDownRight
{
        my $self = shift;
        Debug( "Move Diagonally Down Right" );
        $self->sendCmd( 'decoder_control.cgi?command=93&' );
}

#Diagonally Up Left Arrow
sub moveConUpLeft
{
        my $self = shift;
        Debug( "Move Diagonally Up Left" );
        $self->sendCmd( 'decoder_control.cgi?command=90&' );
}

#Diagonally Down Left Arrow
sub moveConDownLeft
{
        my $self = shift;
        Debug( "Move Diagonally Down Left" );
        $self->sendCmd( 'decoder_control.cgi?command=92&' );
}

#Stop
sub moveStop
{
        my $self = shift;
        Debug( "Move Stop" );
        $self->sendCmd( 'decoder_control.cgi?command=1&' );
}

#Move Camera to Home Position
sub presetHome
{
        my $self = shift;
        Debug( "Home Preset" );
        $self->sendCmd( 'decoder_control.cgi?command=25&' );
}

sub presetGoto
{
        my $self = shift;
        my $params = shift;
        my $preset = $self->getParam( $params, 'preset' );
        Debug( "Goto Preset $preset" );
        my $cmd = "decoder_control.cgi?command=" . ($preset *2 + 29 );
        $self->sendCmd( $cmd );
}

sub presetSet
{
        my $self = shift;
        my $params = shift;
        my $preset = $self->getParam( $params, 'preset' );
        Debug( "Set Preset $preset" );
        my $cmd = "decoder_control.cgi?command=" . ($preset *2 + 28);
        $self->sendCmd( $cmd );
}







1;

__END__
=pod

=head1 DESCRIPTION

This module contains the implementation of the 7LINKS PX-3615 IP camera control protocol.

=cut

+++