NAME
ZoneMinder::Control::Dahua - Perl module for Dahua cameras
SYNOPSIS
use ZoneMinder::Control::Dahua; place this in /usr/share/perl5/ZoneMinder/Control
DESCRIPTION
This module is an implementation of the Dahua IP camera HTTP control API.
COPYRIGHT AND LICENSE
Copyright (C) 2018 ZoneMinder LLC
This library 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 library 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Private Methods
Methods intended for use internally but documented here for future developers.
_sendAbsolutePositionCommand( $arg1, $arg2, $arg3, $arg4 )
Where:$arg1 = Horizontal angle 0° to 360°$arg2 = Vertical angle 0° to -90°$arg3 = Zoom multiplier$arg4 = Speed 1 to 8This is an private method used to send an absolute position command to thecamera.
Public Methods
Methods made available to control.pl via ZoneMinder::Control
Notes:
Which methods are invoked depends on which types of movement are selected inthe camera control type. For example: if the 'Can Move Continuous' option ischecked, then methods including 'Con' in their names are invoked. Likewise ifthe 'Can Move Relative" option is checked, then methods including 'Rel' intheir names are invoked.At present, these types of movement are prioritized and exclusive. This appliesto all types of movement, not just PTZ, but focus, iris, etc. as well. The optionsare tested in the following order:1. Continuous2. Relative3. AbsoluteThese types are exclusive meaning that the first one that matches is the oneZoneMinder will use to control with. It would be nice to allow the user toselect the type used given that some cameras support all three types ofmovement.
new
This method instantiates a new control object based upon this control moduleand sets the 'id' attribute to the value passed in.
open
This method opens an HTTP connection to the camera. It handles authentication,etc. Upon success it sets the 'state' attribute to 'open.'
close
This method effectively closes the HTTP connection to the camera. It sets the'state' attribute to 'close.'
printMsg
This method appears to be used for debugging.
moveCon<direction>
This set of methods invoke continuous movement in the direction indicated bythe <direction> portion of their name. They accept no arguments and move thecamera at a speed of 1 for 0ms. The speed index of 1 is the lowest of theaccepted range of 1-8.NOTE:This is not true continuous movmement as currently implemented.
focusCon<range>
This set of methods invoke continuous focus in the range direction indicatedby the <range> portion of their name. They accept no arguments.NOTE:This is not true continuous movmement as currently implemented.
moveRel<direction>
This set of methods invoke relatvie movement in the direction indicated bythe <direction> portion of their name. They accept no arguments and move thecamera at a speed of 4 for 500ms. The speed index of 4 is half-way betweenthe accepted range of 1-8.
focusRel<range>
This set of methods invoke realtive focus in the range direction indicated bythe <range> portion of their name. They accept no arguments.NOTE:This only just does work. The Dahua API specifies "multiples" as the input.We pass in a 1 for that as it does not seem to matter what number (0-8) isprovided, the camera focus behaves the same.
irisRel<Large/Small>
This set of methods invoke realtive iris size in the direction indicated bythe <Large/Small> portion of their name. They accept no arguments.NOTE:This only just does work. The Dahua API specifies "multiples" as the input.We pass in a 1 for that as it does not seem to matter what number (0-8) isprovided, the camera iris behaves the same.
moveStop
This method attempts to stop the camera. The problem is that if continuousmotion is occurring in multiple directions, this will only stop the motionin the 'Up' direction. Dahua does not support an "all-stop" command.
presetHome
This method "homes" the camera to a preset position. It accepts no arguments.When either continuous or relative movement is enabled, pressing the centerbutton on the movement controls invokes this method.NOTE:The Dahua protocol does not appear to support a preset Home feature. We couldallow the user to assign a preset slot as the "home" slot. Dahua does appearto support naming presets which may lend itself to this sort of thing. Atthis point, we'll just send the camera back to center and zoom wide. (0°,0°,0)
reset
This method will reset the PTZ controls to their "default." It is not clearwhat that is.
reboot
This method performs a reboot of the camera. This will take the camera offlinefor the time it takes to reboot.