diff options
| author | Arjun Roychowdhury <pliablepixels@gmail.com> | 2016-01-08 14:59:58 +0530 |
|---|---|---|
| committer | Arjun Roychowdhury <pliablepixels@gmail.com> | 2016-01-08 14:59:58 +0530 |
| commit | cc9738b412d00436a7a16c6dbe853e55d97aec8a (patch) | |
| tree | 4f17b16288a3948fa91a36df098a61081abba4d8 /www | |
| parent | 468b14fa8f0c5ce33f9f4e6787d19be5dd2a5123 (diff) | |
#116 - presets seems to be working - needs more testing
Former-commit-id: 427b83929240d67fa5c26b9e49cbf0629ecf0f69
Diffstat (limited to 'www')
| -rw-r--r-- | www/css/style.css | 6 | ||||
| -rw-r--r-- | www/js/ModalCtrl.js | 55 | ||||
| -rw-r--r-- | www/js/MonitorCtrl.js | 18 | ||||
| -rw-r--r-- | www/js/MontageCtrl.js | 30 | ||||
| -rw-r--r-- | www/templates/monitors-modal.html | 17 |
5 files changed, 100 insertions, 26 deletions
diff --git a/www/css/style.css b/www/css/style.css index bf6d0228..9c3a01a9 100644 --- a/www/css/style.css +++ b/www/css/style.css @@ -232,8 +232,10 @@ http://www.cssportal.com/tryit/index.php?file=blog/css-notification-badge */ { position: absolute; top: 5%; - left: 50%; - transform: translate(-50%, -50%); + left: 10%; + width: 80%; + border-radius: 0px !important; + } diff --git a/www/js/ModalCtrl.js b/www/js/ModalCtrl.js index 185f71a4..b61fe300 100644 --- a/www/js/ModalCtrl.js +++ b/www/js/ModalCtrl.js @@ -4,7 +4,7 @@ /* global saveAs, cordova,StatusBar,angular,console,ionic, moment */ -angular.module('zmApp.controllers').controller('ModalCtrl', ['$scope', '$rootScope', 'zm', 'ZMDataModel', '$ionicSideMenuDelegate', '$timeout', '$interval', '$ionicModal', '$ionicLoading', '$http', '$state', '$stateParams', '$ionicHistory', '$ionicScrollDelegate', '$q', '$sce', 'carouselUtils', function ($scope, $rootScope, zm, ZMDataModel, $ionicSideMenuDelegate, $timeout, $interval, $ionicModal, $ionicLoading, $http, $state, $stateParams, $ionicHistory, $ionicScrollDelegate, $q, $sce, carouselUtils) { +angular.module('zmApp.controllers').controller('ModalCtrl', ['$scope', '$rootScope', 'zm', 'ZMDataModel', '$ionicSideMenuDelegate', '$timeout', '$interval', '$ionicModal', '$ionicLoading', '$http', '$state', '$stateParams', '$ionicHistory', '$ionicScrollDelegate', '$q', '$sce', 'carouselUtils', '$ionicPopup', function ($scope, $rootScope, zm, ZMDataModel, $ionicSideMenuDelegate, $timeout, $interval, $ionicModal, $ionicLoading, $http, $state, $stateParams, $ionicHistory, $ionicScrollDelegate, $q, $sce, carouselUtils, $ionicPopup) { // from parent scope @@ -272,18 +272,35 @@ $scope.togglePresets = function() { $scope.presetOn = !$scope.presetOn; console.log ("Changing preset to " + $scope.presetOn); + + var element = angular.element(document.getElementById("presetlist")); + + if (!$scope.presetOn) { + element.removeClass("animated fadeInDown"); + element.addClass("animated fadeOutUp"); + } else { + element.removeClass("animated fadeOutUp"); + element.addClass("animated fadeInDown"); + } + + + }; //------------------------------------------------------------- // Send PTZ command to ZM // Note: PTZ fails on desktop, don't bother about it //------------------------------------------------------------- + + $scope.controlPTZ = function (monitorId, cmd) { controlPTZ(monitorId, cmd); }; function controlPTZ(monitorId, cmd) { + //presetGotoX + //presetHome //curl -X POST "http://server.com/zm/index.php?view=request" -d //"request=control&user=admin&passwd=xx&id=4&control=moveConLeft" @@ -296,8 +313,35 @@ $scope.togglePresets = function() return; } + var ptzData = ""; + if (cmd.lastIndexOf("preset", 0) === 0) + { + ZMDataModel.zmDebug("PTZ command is a preset, so skipping xge/lge"); + ptzData = { + view: "request", + request: "control", + id: monitorId, + control: cmd, + // xge: "30", //wtf + // yge: "30", //wtf + }; + + } + else + { + + ptzData = { + view: "request", + request: "control", + id: monitorId, + control: cmd, + xge: "30", //wtf + yge: "30", //wtf + }; + } console.log("Command value " + cmd + " with MID=" + monitorId); + console.log ("PTZDATA is " + JSON.stringify(ptzData)); $ionicLoading.hide(); $ionicLoading.show({ template: "please wait...", @@ -337,14 +381,7 @@ $scope.togglePresets = function() // logic - /zm/api/monitors/X.json, read ControlId = Y // then zm/api/controls/Y.json - data: { - view: "request", - request: "control", - id: monitorId, - control: cmd, - xge: "30", //wtf - yge: "30", //wtf - } + data: ptzData }); diff --git a/www/js/MonitorCtrl.js b/www/js/MonitorCtrl.js index b5f5a47e..aaf10972 100644 --- a/www/js/MonitorCtrl.js +++ b/www/js/MonitorCtrl.js @@ -336,9 +336,23 @@ angular.module('zmApp.controllers') if (data.control.Control.HasPresets == '1') { $scope.ptzPresetCount = parseInt(data.control.Control.NumPresets); - $scope.ptzPresetCount = 13; + //$scope.ptzPresetCount = 33; ZMDataModel.zmDebug ("Number of presets is " + $scope.ptzPresetCount); - $scope.ptzPresets = new Array($scope.ptzPresetCount); + + $scope.ptzPresets = []; + for (var p=0; p<$scope.ptzPresetCount; p++) + { + $scope.ptzPresets.push ({name:(p+1).toString(), icon:'', cmd:"presetGoto"+(p+1).toString()}); + // $scope.ptzPresets[p].name = "Arjun " + p; + // console.log ("Name to " + $scope.ptzPresets[p].name); + } + + if (data.control.Control.HasHomePreset == '1') + { + $scope.ptzPresets.unshift({name:'', icon:"ion-ios-home", cmd:'presetHome'}); + + $scope.ptzPresetCount++; + } } diff --git a/www/js/MontageCtrl.js b/www/js/MontageCtrl.js index d3a0928a..e5f42a00 100644 --- a/www/js/MontageCtrl.js +++ b/www/js/MontageCtrl.js @@ -557,6 +557,7 @@ angular.module('zmApp.controllers').controller('zmApp.MontageCtrl', ['$scope', ' $rootScope.modalRand = Math.floor(Math.random() * (999999 - 111111 + 1)) + 111111; $scope.ptzMoveCommand = ""; $scope.ptzStopCommand = ""; + $scope.presetOn = false; // 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 @@ -575,6 +576,35 @@ angular.module('zmApp.controllers').controller('zmApp.MontageCtrl', ['$scope', ' $scope.ptzMoveCommand = (data.control.Control.CanMoveCon == '1') ? 'moveCon' : 'move'; $scope.ptzStopCommand = "moveStop"; console.log("***moveCommand: " + $scope.ptzMoveCommand); + + + // presets + ZMDataModel.zmDebug ("Preset value is " +data.control.Control.HasPresets); + + if (data.control.Control.HasPresets == '1') + { + $scope.ptzPresetCount = parseInt(data.control.Control.NumPresets); + + ZMDataModel.zmDebug ("Number of presets is " + $scope.ptzPresetCount); + + $scope.ptzPresets = []; + for (var p=0; p<$scope.ptzPresetCount; p++) + { + $scope.ptzPresets.push ({name:(p+1).toString(), icon:'', cmd:"presetGoto"+(p+1).toString()}); + // $scope.ptzPresets[p].name = "Arjun " + p; + // console.log ("Name to " + $scope.ptzPresets[p].name); + } + + if (data.control.Control.HasHomePreset == '1') + { + $scope.ptzPresets.unshift({name:'', icon:"ion-ios-home", cmd:'presetHome'}); + + $scope.ptzPresetCount++; + } + + } + + ZMDataModel.zmLog("ControlDB reports PTZ command to be " + $scope.ptzMoveCommand); }) .error(function (data) { diff --git a/www/templates/monitors-modal.html b/www/templates/monitors-modal.html index f2323282..9d4abec2 100644 --- a/www/templates/monitors-modal.html +++ b/www/templates/monitors-modal.html @@ -50,19 +50,10 @@ </circular> </div> - <div ng-if="presetOn" class="ptzpresetbuttons animated fadeInDown"> + <div ng-if="presetOn" class="ptzpresetbuttons animated fadeInDown" id="presetlist"> <div ng-repeat="preset in ptzPresets track by $index"> - <div ng-if="$index%4==0" class="row"> - <div class="col"> - <button class="button button-small button-dark">{{$index+1}}</button> - <button ng-if="$index+2<=ptzPresetCount" - class="button button-small button-dark">{{$index+2}}</button> - <button ng-if="$index+3<=ptzPresetCount" - class="button button-small button-dark">{{$index+3}}</button> - <button ng-if="$index+4<=ptzPresetCount" - class="button button-small button-dark">{{$index+4}}</button> - </div> - </div> + <button class="button {{preset.icon}} button-small button-royal" style="float:left;margin-right:10px;margin-bottom:10px;" ng-click="controlPTZ(monitorId, preset.cmd);">{{preset.name}}</button> + </div> </div> @@ -70,7 +61,7 @@ <div class="ptzcenteredbutton"> <a class="button button-small icon ion-stop button-assertive" href="" ng-click="controlPTZ(monitorId, ptzStopCommand);"></a> - <a class="button button-small button-stable" href="" ng-click="togglePresets();">presets</a> + <a class="button button-small button-royal" href="" ng-click="togglePresets();">presets</a> </div> </div> |
