summaryrefslogtreecommitdiff
path: root/www/js/DataModel.js
diff options
context:
space:
mode:
authorPliablePixels <pliablepixels@gmail.com>2015-09-11 16:26:13 +0100
committerPliablePixels <pliablepixels@gmail.com>2015-09-11 16:26:13 +0100
commitd6189d6f85897be4250ca4b87f21f6113a10b68c (patch)
tree6cc9800feee796ae11bacc0a7506b96b5a172709 /www/js/DataModel.js
parent6fa4b725624feba76031e7354a4d94aed5339957 (diff)
Enabled a run time debug mode so I can see more details when testers report quirky bugs. It's in developer options.
Diffstat (limited to 'www/js/DataModel.js')
-rw-r--r--www/js/DataModel.js36
1 files changed, 33 insertions, 3 deletions
diff --git a/www/js/DataModel.js b/www/js/DataModel.js
index 25fd0aed..ae4bee12 100644
--- a/www/js/DataModel.js
+++ b/www/js/DataModel.js
@@ -27,19 +27,27 @@ angular.module('zmApp.controllers').service('ZMDataModel', ['$http', '$q', '$ion
'keepAwake':true, // don't dim/dim during live view
'isUseAuth':true, // true if user wants ZM auth
'refreshSec':"1", // timer value for frame change in sec
+ 'enableDebug':false, // if enabled with log messages with "debug"
};
var configParams = {
'ZM_EVENT_IMAGE_DIGITS':'-1'
};
//--------------------------------------------------------------------------
- // uses fileLogger to write logs to file for later investigation
+ // uses fileLogger to write logs to file for later investigation
//--------------------------------------------------------------------------
function zmLog(val,logtype)
{
$fileLogger.log(logtype, val);
}
+ // separate out a debug so we don't do this if comparison for normal logs
+ function zmDebug(val)
+ {
+ if (loginData.enableDebug)
+ $fileLogger.debug(val);
+ }
+
//--------------------------------------------------------------------------
// Banner display of messages
@@ -74,6 +82,12 @@ angular.module('zmApp.controllers').service('ZMDataModel', ['$http', '$q', '$ion
zmLog(val,logtype);
},
+
+ zmDebug: function (val)
+ {
+
+ zmDebug(val);
+ },
// This function is called when the app is ready to run
// sets up various variables
@@ -87,10 +101,21 @@ angular.module('zmApp.controllers').service('ZMDataModel', ['$http', '$q', '$ion
console.log("****** DATAMODEL INIT SERVICE CALLED ********");
zmLog("ZMData init: checking for stored variables & setting up log file");
-
+
+ if (window.localStorage.getItem("enableDebug") != undefined) {
+ var dbgvalue = window.localStorage.getItem("enableDebug");
+ loginData.enableDebug = (dbgvalue == "1") ? true:false;
+ zmLog("enableDebug is ON");
+
+ }
+ else
+ {
+ zmLog ("enableDebug is OFF");
+ }
if (window.localStorage.getItem("isUseAuth") != undefined) {
loginData.isUseAuth =
window.localStorage.getItem("isUseAuth");
+
}
else
@@ -175,6 +200,8 @@ angular.module('zmApp.controllers').service('ZMDataModel', ['$http', '$q', '$ion
console.log("useSSL " + loginData.useSSL);
}
+
+
if (window.localStorage.getItem("keepAwake") != undefined) {
var awakevalue = window.localStorage.getItem("keepAwake");
@@ -185,6 +212,7 @@ angular.module('zmApp.controllers').service('ZMDataModel', ['$http', '$q', '$ion
monitorsLoaded = 0;
console.log("Getting out of ZMDataModel init");
+ zmDebug ( "loginData structure values: " + JSON.stringify(loginData));
},
@@ -256,6 +284,7 @@ angular.module('zmApp.controllers').service('ZMDataModel', ['$http', '$q', '$ion
setLogin: function (newLogin) {
loginData = newLogin;
zmLog("Saving all parameters to storage");
+ zmDebug ("DataModel/setLogin: writing " + JSON.stringify(newLogin));
window.localStorage.setItem("username", loginData.username);
window.localStorage.setItem("password", loginData.password);
@@ -263,6 +292,7 @@ angular.module('zmApp.controllers').service('ZMDataModel', ['$http', '$q', '$ion
window.localStorage.setItem("apiurl", loginData.apiurl);
window.localStorage.setItem("streamingurl", loginData.streamingurl);
window.localStorage.setItem("useSSL", loginData.useSSL?"1":"0");
+ window.localStorage.setItem("enableDebug", loginData.enableDebug?"1":"0");
window.localStorage.setItem("keepAwake", loginData.keepAwake?"1":"0");
window.localStorage.setItem("maxMontage", loginData.maxMontage);
window.localStorage.setItem("montageQuality", loginData.montageQuality);
@@ -335,7 +365,7 @@ angular.module('zmApp.controllers').service('ZMDataModel', ['$http', '$q', '$ion
// Skipping monitor number as I only need an auth key
// so no need to generate an image
var myurl =loginData.url+"/index.php?view=watch";
- console.log ("Getting auth from " + myurl);
+ zmDebug ("DataModel: Getting auth from " + myurl);
$http.get (myurl)
.then (function (success) {
// console.log ("**** RESULT IS " + JSON.stringify(success));