From 83400033a3b7a91ad072a5d306355c9cd5a80d82 Mon Sep 17 00:00:00 2001 From: PliablePixels Date: Fri, 24 Jul 2015 15:48:01 -0400 Subject: integrated event scrubbing with direct image access - need to clean up code --- www/js/DataModel.js | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'www/js/DataModel.js') diff --git a/www/js/DataModel.js b/www/js/DataModel.js index 5104e464..1954d997 100644 --- a/www/js/DataModel.js +++ b/www/js/DataModel.js @@ -26,6 +26,9 @@ angular.module('zmApp.controllers').service('ZMDataModel', ['$http', '$q', '$ion 'useSSL':false, // "1" if HTTPS 'keepAwake':true // don't dim/dim during live view }; + var configParams = { + 'ZM_EVENT_IMAGE_DIGITS':'-1' + }; //-------------------------------------------------------------------------- // uses fileLogger to write logs to file for later investigation @@ -234,6 +237,43 @@ angular.module('zmApp.controllers').service('ZMDataModel', ['$http', '$q', '$ion } }, + //----------------------------------------------------------------------------- + // This function returns the numdigits for padding capture images + //----------------------------------------------------------------------------- + + getKeyConfigParams: function (forceReload) { + + var d = $q.defer(); + + if (forceReload ==1 || configParams.ZM_EVENT_IMAGE_DIGITS == '-1') + { + var apiurl = loginData.apiurl; + var myurl = apiurl + '/configs/viewByName/ZM_EVENT_IMAGE_DIGITS.json'; + console.log ("CONFIG URL IS " + myurl); + $http.get(myurl) + .success(function(data) { + zmLog ("ZM_EVENT_IMAGE_DIGITS is " + data.config.Value); + configParams.ZM_EVENT_IMAGE_DIGITS = data.config.Value; + d.resolve(configParams.ZM_EVENT_IMAGE_DIGITS); + + }) + .error (function(err) { + zmLog ("Error retrieving ZM_EVENT_IMAGE_DIGITS" + JSON.stringify(err)); + zmLog ("Taking a guess, setting ZM_EVENT_IMAGE_DIGITS to 5"); + // FIXME: take a plunge and keep it at 5? + configParams.ZM_EVENT_IMAGE_DIGITS = 5; + d.resolve(configParams.ZM_EVENT_IMAGE_DIGITS); + }); + } + else + { + zmLog ("ZM_EVENT_IMAGE_DIGITS is already configured for " + configParams.ZM_EVENT_IMAGE_DIGITS); + d.resolve(configParams.ZM_EVENT_IMAGE_DIGITS); + } + return (d.promise); + + }, + //----------------------------------------------------------------------------- // This function returns a list of monitors // if forceReload == 1 then it will force an HTTP API request to get a list of monitors -- cgit v1.2.3