From 544413f2d6de83e085d4489a1b9ccbaac3fa192d Mon Sep 17 00:00:00 2001 From: PliablePixels Date: Fri, 26 Jun 2015 13:43:17 -0400 Subject: I am now reading the PTZ DB to figure out the right "move" command for the cameras --- www/js/MontageCtrl.js | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'www/js/MontageCtrl.js') diff --git a/www/js/MontageCtrl.js b/www/js/MontageCtrl.js index 2a8dce2f..bd2ab1ef 100644 --- a/www/js/MontageCtrl.js +++ b/www/js/MontageCtrl.js @@ -121,14 +121,36 @@ angular.module('zmApp.controllers').controller('zmApp.MontageCtrl', ['$scope', ' //--------------------------------------------------------------------- // main monitor modal open //--------------------------------------------------------------------- - $scope.openModal = function (mid, controllable) { - console.log("Open Monitor Modal"); + $scope.openModal = function (mid, controllable, controlid) { + console.log("Open Monitor Modal with monitor Id=" + mid + " and Controllable:" + controllable + " with control ID:"+controlid); // Note: no need to setAwake(true) as its already awake // in montage view $scope.monitorId = mid; $scope.LoginData = ZMDataModel.getLogin(); $scope.rand = Math.floor(Math.random() * (999999 - 111111 + 1)) + 111111; + $scope.ptzMoveCommand = ""; + + // This is a modal to show the monitor footage + // We need to switch to always awake if set so the feed doesn't get interrupted + ZMDataModel.setAwake(ZMDataModel.getKeepAwake()); + + // if its controllable, lets get the control command + if (controllable == '1') + { + var apiurl = $scope.LoginData.apiurl; + var myurl = apiurl+"/controls/"+controlid+".json"; + console.log ("getting control details:"+myurl); + + $http.get(myurl) + .success(function(data) { + $scope.ptzMoveCommand = (data.control.Control.CanMoveCon == '1')? 'moveCon':'move'; + console.log("***moveCommand: " +$scope.ptzMoveCommand ); + }) + .error(function(data) { + console.log ("** Error retrieving move PTZ command"); + }); + } // This is a modal to show the monitor footage $ionicModal.fromTemplateUrl('templates/monitors-modal.html', { -- cgit v1.2.3