var model = { /* hasBinning : function() { return (this.name.substring(0, 5) >= "5105"); }, //=== "10005"); }, has1080 : function() { return (this.name.substring(0, 5) === "10005"); }, hasDN : function() { return (this.name.substr(this.name.length-2, 2) === "DN" || this.name.substr(this.name.length-2, 2) === "IR"); }, hasAI : function() { return (this.name.substr(this.name.length-2, 2) === "AI" || this.releasename.substring(1, 3)==="25"); }, hasH264 : function() { return (this.name.substring(1, 5)!=="110" && this.name.substring(1, 5)!=="100") ; }, hasFocus : function() { return (this.releasename.substring(1, 3)==="25" || this.releasename.substring(2, 4)==="25"); } */ //#define IS_DN_ENABLE 0x01 //#define IS_IR_ENABLE 0x02 //#define IS_AUTOIRIS_ENABLE 0x04 //#define IS_PMASK_ENABLE 0x08 //#define IS_EXTMD_ENABLE 0x10 //#define IS_BINNING_ENABLE 0x20 //#define IS_CROPPING_ENABLE 0x40 //#define IS_FOCUS_ENABLE 0x100 //#define IS_FOCUSAID_ENABLE 0x200 hasBinning : function() { return (this.feature & 0x20); }, has1080 : function() { return (this.name.substring(0, 5) === "10005"); }, hasDN : function() { return (this.feature & 0x01); }, hasAI : function() { return (this.feature & 0x04); }, hasH264 : function() { return true; }, hasFocus : function() { return (this.feature & 0x100); }, hasFocusAid : function() { return (this.feature & 0x200); }, hasWDR : function() { return (this.releasename.substring(3, 4) === "6"); }, hasCasinoMode : function() { return (this.name.substring(0, 4) === "2805"); }, hasAudio : function() { return (this.feature & 0x800); }, hasIR : function() { return (this.feature & 0x02); }, is2M : function() { return (this.name.substring(0, 4) === "2805"); }, hasPIris : function() { return (this.feature & 0x2000); }, isProduction : function() { return (this.production & 0x0002); }, isDualsensor : function() { return (this.enclosure == 5); } }; /* create all controls and image */ dojo.addOnLoad(function theAddOnLoad() { var leading = document.getElementById('leading_region'), div, liveValues = [], h264Values = [], multicastValues = [], ipValues = [], netMisc = [], ipOptions = [], md = [], // motion detection pm = [], // privacy mask pwdAdmin = [], pwdViewer = [], adv = [], fpsMaxVal = image.fpsMaxVal, isAdmin = accessFull(), qi = {}; function fps(action, value) { var tmp; if (action === 'get') { tmp = getCameraParam("fps") || 0; return (1<=tmp && tmp<=fpsMaxVal) ? tmp : fpsMaxVal+1; } else { setCameraParam("fps", (1<=value && value<=fpsMaxVal) ? value : 0); } }; function f1080p_mode(action, value) { if (action === 'get') { return getCameraParam("1080p_mode"); } else { setCameraParam("1080p_mode", value); $('#central_region')[0].f1080pChange(); } }; // thank firmware for this mess! var bitrate = (function () { var rate, cMinRate = 0, cMaxRate = 65535; return { maxrate : function() { return cMaxRate; }, bool : function(action, value) { if (action === 'get') { rate = rate || Number(getCameraParam("bitrate")) || 0; return rate > 0; } else if (action === 'set') { rate = value ? cMaxRate : 0; } }, number : function(action, value) { if (action === 'get') { rate = rate || Number(getCameraParam("bitrate")) || 0; return rate; } else if (action === 'set') { rate = Number(value); //Math.min(Number(value), rate); setCameraParam("bitrate", rate); if (rate==0 || rate>=cMinRate) { setCameraParam("bitrate", rate); } else { alert('Rates less than 100kbps are not allowed.'); } } } } }) (); // thank firmware for this mess! // netopt //bit 0: DHCP IP assignment //bit 1: BOOTP IP assignment //bit 2: RARP IP assignment //mask 11111000: manually IP assignment (static IP) //bit 3: IP lock //bit 4: NTP time requester //bit 5: PSIA discovery multicast server //bit 6: RTP multicast server //bit 7: MTU enabled/disabled //bit 8: PSIA discovery Zeroconfig server var netopt = (function () { var netoptValue; function common(cmask, action, value) { var v; // yes, bitwise operations in this function if (action === 'get') { netoptValue = netoptValue || getCameraParam("netopt") || 0; return (netoptValue & cmask) !== 0; } else if (action === 'set') { netoptValue = (value ? netoptValue | cmask : netoptValue & ~cmask); setCameraParam("netopt", netoptValue); // multicast enable needs to be sent immediately } } return { dhcp : function (action, value) { return common(1, action, value); }, lockIP : function(action, value) { return common(8, action, value); }, limitMTU : function(action, value) { return common(128, action, value); }, mcast : function(action, value) { return common(64, action, value); }, setter : function() { setCameraParam("netopt", netoptValue); } }; }) (); // TODO 1: add per camera limitation of size and >< checks var imgRect = { leftControl : null, topControl : null, width : function(action, value) { var width; if (action === 'get') { // return right width = getCameraParam("imgwidth"); return Number(width) + Number(this.leftControl.getValue()); } else if (action === 'set') { // set width width = Number(value) - Number(this.leftControl.getValue()); setCameraParam("imgwidth", width); } }, height : function(action, value) { var height; if (action === 'get') { // return height height = getCameraParam("imgheight"); return Number(height) + Number(this.topControl.getValue()); } else if (action === 'set') { // set height height = Number(value) - Number(this.topControl.getValue()); setCameraParam("imgheight", height); } } }; function wide(action, value) { return imgRect.width(action, value); } function high(action, value) { return imgRect.height(action, value); } function gop_register_3_21(action, value) { if (action === 'get') { return getCameraRegister(3, 21); } else if (action === 'set') { setCameraRegister(3, 21, value); } } var REVERSE_GAMMA_TBL = [ 1990, //Val = 1. 1970, //Val = 2. 1954, //Val = 3. 1935, //Val = 4. 1917, //Val = 5. 1901, //Val = 6. 1883, //Val = 7. 1866, //Val = 8. 1848, //Val = 9. 1833, //Val = 10. 1816, //Val = 11. 1801, //Val = 12. 1786, //Val = 13. 1769, //Val = 14. 1754, //Val = 15. 1739, //Val = 16. 1726, //Val = 17. 1711, //Val = 18. 1696, //Val = 19. 1683, //Val = 20. 1669, //Val = 21. 1654, //Val = 22. 1642, //Val = 23. 1627, //Val = 24. 1616, //Val = 25. 1604, //Val = 26. 1591, //Val = 27. 1578, //Val = 28. 1566, //Val = 29. 1554, //Val = 30. 1543, //Val = 31. 1530, //Val = 32. 1518, //Val = 33. 1507, //Val = 34. 1496, //Val = 35. 1487, //Val = 36. 1474, //Val = 37. 1465, //Val = 38. 1454, //Val = 39. 1444, //Val = 40. 1433, //Val = 41. 1422, //Val = 42. 1412, //Val = 43. 1403, //Val = 44. 1394, //Val = 45. 1385, //Val = 46. 1373, //Val = 47. 1364, //Val = 48. 1357, //Val = 49. 1347, //Val = 50. 1337, //Val = 51. 1328, //Val = 52. 1321, //Val = 53. 1313, //Val = 54. 1303, //Val = 55. 1295, //Val = 56. 1287, //Val = 57. 1278, //Val = 58. 1271, //Val = 59. 1263, //Val = 60. 1255, //Val = 61. 1246, //Val = 62. 1239, //Val = 63. 1232, //Val = 64. 1225, //Val = 65. 1218, //Val = 66. 1212, //Val = 67. 1203, //Val = 68. 1195, //Val = 69. 1190, //Val = 70. 1185, //Val = 71. 1175, //Val = 72. 1168, //Val = 73. 1162, //Val = 74. 1156, //Val = 75. 1149, //Val = 76. 1144, //Val = 77. 1138, //Val = 78. 1131, //Val = 79. 1125, //Val = 80. 1118, //Val = 81. 1112, //Val = 82. 1106, //Val = 83. 1101, //Val = 84. 1096, //Val = 85. 1091, //Val = 86. 1086, //Val = 87. 1079, //Val = 88. 1074, //Val = 89. 1068, //Val = 90. 1063, //Val = 91. 1058, //Val = 92. 1053, //Val = 93. 1046, //Val = 94. 1043, //Val = 95. 1038, //Val = 96. 1031, //Val = 97. 1028, //Val = 98. 1023, //Val = 99. 1016 //Val = 100. ]; function gamma(action, value) { var i, sum=0, tmp, diff, min=10000, min_pos; if (action === 'get') { // tmp = getCameraRegister(3, 164) || 0; // return (1<=tmp && tmp<=100) ? tmp : 60; for (i = 161; i <= 170; i++) sum += 1*getCameraRegister(3, i); for (tmp = 1; tmp <= 100; tmp++) { if (REVERSE_GAMMA_TBL[tmp-1] == sum) break; else { diff = sum - REVERSE_GAMMA_TBL[tmp-1]; if (diff < 0) diff = -diff; if (diff < min) {min = diff; min_pos = tmp;} } } if (tmp > 100) tmp = min_pos; if (tmp < 40) tmp = 40; // 40 is minimum value corresponding to 2.5 = 100/40 return tmp; } else { setGamma(antiGamma(value)); } } function motiondetect(action, value) { var tmp, val; if (action === 'get') { tmp = getCameraParam("motiondetect"); } else { setCameraParam("motiondetect", value); tmp = value; } image.mdEnable = (tmp === 'on') ? 1 : 0; if (image.mdEnable) { dijit.byId("checkBox"+"DisableMD").setValue(false); if (action === 'set') { val = getCameraParam("mdzonesize"); image.zoneSize = val; dijit.byId("textbox"+"Zone Size").setValue(val); dijit.byId("slider"+"Zone Size").setValue(val); } //dijit.byId("textbox"+"Zone Size").set('disabled', true); image.mdTableReady = 0; } else { //dijit.byId("textbox"+"Zone Size").set('disabled', false); dijit.byId("checkBox"+"DisableMD").setValue(true); } if (action === 'get') return tmp; } function mdsensitivity(action, value) { var tmp, val; var subz = calculateGrid(); var totalzones = subz.hor * subz.ver; if (action === 'get') { val = getCameraParam("mdsensitivity"); tmp = Math.round(val * 100 / totalzones); if (tmp > 100) tmp = 100; //document.title = "mdsensitity:" + val + " " + tmp + " " + totalzones; return tmp; } else { tmp = Math.round(value * totalzones / 100); setCameraParam("mdsensitivity", tmp); } } function extmotiondetect(action, value) { var tmp, val; if (action === 'get') { tmp = getCameraParam("mdtotalzones"); } else { setCameraParam("mdtotalzones", value); tmp = value; } if (action === 'set') { image.zbnum = (value == 1024) ? 32 : 8; val = getCameraParam("mdzonesize"); image.zoneSize = val; dijit.byId("textbox"+"Zone Size").setValue(val); dijit.byId("slider"+"Zone Size").setValue(val); val = getCameraParam("mddetail"); dijit.byId("textbox"+"Detail").setValue(val); dijit.byId("slider"+"Detail").setValue(val); val = getCameraParam("mdlevelthreshold"); dijit.byId("textbox"+"Level threshold").setValue(val); dijit.byId("slider"+"Level threshold").setValue(val); val = mdsensitivity("get", null); dijit.byId("textbox"+"Motion Sensitivity, %").setValue(val); dijit.byId("slider"+"Motion Sensitivity, %").setValue(val); } if (action === 'get') return tmp; } var pre_focus_score, cur_focus_score; function setFocusScore(val) { //var tmp = getCameraRegister(1, 34); dijit.byId("textbox"+"Focus Aid").setValue(val); //dijit.byId("slider"+"Focus Aid").setValue(val); } var focusTimeout1s, focusTimeout60s, autofocus=0; var focus_status, focus_status_text; function getFocusScore() { cur_focus_score = 1*getCameraParam("focus"); dijit.byId("textbox"+"Focus Aid").setValue(cur_focus_score); // if (cur_focus_score <= 1*pre_focus_score+10 && cur_focus_score >= 1*pre_focus_score-10 ) $('#bg-table').css('background-color', '#FFFF00'); // same focus: yellow // else if (cur_focus_score > pre_focus_score) $('#bg-table').css('background-color', '#00FF00'); // better focus: green // else if (cur_focus_score < pre_focus_score) $('#bg-table').css('background-color', '#FF0000'); // worse focus: red if (cur_focus_score <= 1*pre_focus_score+10 && cur_focus_score >= 1*pre_focus_score-10 ) { if (autofocus==0) $('#border-table').css('border-color', '#FFFF00');} // same focus: yellow else if (cur_focus_score > pre_focus_score) $('#border-table').css('border-color', '#00FF00'); // better focus: green else if (cur_focus_score < pre_focus_score) $('#border-table').css('border-color', '#FF0000'); // worse focus: red pre_focus_score = cur_focus_score; if (autofocus==1) { focus_status = getCameraParam("focus=status"); if ( focus_status != "on") { clearTimeout(focusTimeout60s); clearInterval(focusTimeout1s); $('#border-table').css('border-color', '#FFFFFF'); // finished: white autofocus = 0; if (focus_status == "toodark") focus_status_text.setValue("Stopped. Too Dark!"); else focus_status_text.setValue("DONE."); } else { focus_status_text.setValue("In process.."); } } } function focus60sTimeout() { clearInterval(focusTimeout1s); } function setFocusZoom(action, step) { pre_focus_score = setCameraParam(action, step); setFocusScore(pre_focus_score); if (action == "zoom" && dijit.byId("checkBox"+"Enable Auto Focus after zoom").getValue()) focusMonitor(); else { clearInterval(focusTimeout1s); autofocus=0; focusTimeout1s = setTimeout(getFocusScore, 1000); } } function focusMonitor() { clearInterval(focusTimeout1s); autofocus=1; focusTimeout1s = setInterval(getFocusScore, 1000); focus_status_text.setValue("In process.."); } function focusaid(action, value) { if (action === 'set') { if (value) { clearInterval(focusTimeout1s); autofocus = 2; focusTimeout1s = setInterval(getFocusScore, 1000); } else { clearInterval(focusTimeout1s); $('#border-table').css('border-color', '#FFFFFF'); // finished: white autofocus = 0; } } } function iris_status() { if (autoIris.getValue() == "on") { var status = 1*getCameraRegister(3, 80), state = 1*getCameraRegister(3, 98); if (state <= 1) { if (status & 0x100) dijit.byId("textbox"+"Iris Status").setValue("Zoomed In"); // too dark else if (status & 0x20) dijit.byId("textbox"+"Iris Status").setValue("Too Dark"); // too dark else dijit.byId("textbox"+"Iris Status").setValue("Evaluating"); // fully open } else if (state == 3 || state == 4) dijit.byId("textbox"+"Iris Status").setValue("Closing");// closing else if (state == 5) dijit.byId("textbox"+"Iris Status").setValue("Closed");// closed else if (state == 6 || state == 7 || state == 8) dijit.byId("textbox"+"Iris Status").setValue("Opening");// opening else dijit.byId("textbox"+"Iris Status").setValue("Unknown"); } else dijit.byId("textbox"+"Iris Status").setValue("Disabled");// disabled } var dt = new Date(); var tm0 = new String(); var tntp = new String(); var tm = new String(); function ntp_timestamp() { tm = getCameraParam("ntp_timestamp"); tntp = tm.split(","); tm0 = getCameraParam("sd_stampspan"); tm = tm0.split(","); if (tm[0] > 2208988800) { dt.setTime((tm[0] - 2208988800)*1000); start_timestamp.setValue(dt.toLocaleTimeString()); } else { //dt.setTime(1368837729000); if (tntp[0] < 2208988800) start_timestamp.setValue("NTP is not connected!"); else start_timestamp.setValue("N/A"); } if (tm[1] > 2208988800) { dt.setTime((tm[1] - 2208988800)*1000); end_timestamp.setValue(dt.toLocaleTimeString()); } else { if (tntp[0] < 2208988800) end_timestamp.setValue("NTP is not connected!"); else if (1*end_timestamp) end_timestamp.setValue("N/A"); else end_timestamp.setValue("No recording!!"); } tm0 = getCameraParam("sd_playbackstamp"); tm = tm0.split(","); if (tm[0] > 2208988800) { dt.setTime((tm[0] - 2208988800)*1000); curr_timestamp.setValue(dt.toLocaleTimeString()); } //document.title = tm[0] + " " + tm[1]; } function sd_recording(action, value) { var tmp, val; if (action === 'get') { tm = getCameraParam("ntp_timestamp"); tntp = tm.split(","); //var val = (curtime.getTime()/1000+2208988800); //document.title = "ntp=" + curtime.getTime()+ " " + val; if (tntp[0] < 2208988800) { var curtime = new Date(); setCameraParam("ntp_timestamp", (curtime.getTime()/1000+2208988800)); } tmp = getCameraParam("sd_recording"); if (tmp.substring(0, 2)==="of") { //sd_enable.setValue(false); tmp = tmp.substring(0, 3) } else { //sd_enable.setValue(true); tmp = tmp.substring(0, 2); } } else { setCameraParam("sd_recording", value); tmp = value; } if (action === 'get') return tmp; } leading.style.fontSize = "150%"; ////////////// start controls model.name = getCameraParam("model=fullname") || ""; model.releasename = getCameraParam("model=releasename") || ""; model.feature = 1*getCameraRegister(3, 221); model.production = 1*getCameraRegister(3, 0xDC); // get register IS_NEW_WEBPAGE: bit0: 1: new webpage; bit1: 1: production webpage model.enclosure = 1*getCameraRegister(3, 222); if (isAdmin) { /* // if (model.isProduction()) { createText("SD Card", true, "_sd", { noLeadBr : true }); image.sdPlayback = createCheckbox("Playback SDcard video", function(action, value) {if (action === 'set')applyVideo();}, true, false, null, true); var curr_timestamp = createTextBox("Play", null, null, null, function() {}, null, null, false); //var Sd_enable = createCheckbox("Enable continuous recording", sd_recording, "on", "off", null, true); //createText("OR Recording triggered by events:", false, null, {left: true}); createRadioSet("SD Card Recording:", sd_recording, [["on", "Continuous Recording"], ["off", "Stop Continuous Recording AND
Enable Event-triggered Recording"]], null, true, { noLeadBr : true}); createCheckbox("Network failure", "sd_networkfail", "on", "off", null, true, {pre: "    "}); createCheckbox("Motion alarm", "sd_motionalarm", "on", "off", null, true, {pre: "    "}); createCheckbox("I/O alarm", "sd_ioalarm", "on", "off", null, true, {pre: "    "}); var start_timestamp = createTextBox("Start", null, null, null, function() { setInterval(ntp_timestamp, 1000);}, null, null, false); var end_timestamp = createTextBox("End", null, null, null, function() {}, null, null, false); createButton("Delete All records", function() { if(confirm('Are you sure?')) {setCameraParam("sd", "format"); } }, null, { pre: 'br', suf: 'br' }); } */ // this section is available only to Admin avutil.createAppend(leading, 'hr'); createText("Image", true, "_picture", { noLeadBr : true }); createSlider("Brightness", -50, 50, "brightness", -50, 50, null, true); createSlider("Sharpness", 0, 4, "sharpness", 0, 4, null, true); createSlider("Saturation", 0, 6, "saturation", 0, 6, null, true); createSlider("Blue", -10, 10, "blue", -10, 10, null, true); createSlider("Red", -10, 10, "red", -10, 10, null, true); //createSlider("Gamma", -50, 50, gamma, 100, 28, null, true); if (model.hasWDR()) createSlider("Contrast", 1, 100, gamma, 1, 100, null, true); else createSlider("Gamma", 1, 100, gamma, 1, 100, null, true); image.flipped = createCheckbox("Flip Image", "rotate", 180, 0, null, true); createCheckbox("Flexible Cropping", "cropping", "on", "off", null, true); createCheckbox("Auto Exposure", "autoexp", "on", "off", null, true); if (model.hasCasinoMode()) createCheckbox("Casino Mode", "casino_mode", "on", "off", null, true); createCheckbox("Bandwidth Saving Mode", "bandwidthsaving", "on", "off", null, true); //if (model.hasWDR()) createRadioSet("Wide Dynamic Range", "wdr", [["adaptive", "Adaptive"], ["preset", "Preset"], ["disabled", "Disabled"]], null, true); if (model.hasWDR()) { createCheckbox("WDR Motion Compensation", "motion_compensation", "on", "off", null, true); createText("* disabling motion_compensation will improve rolling issue but causing image blur", false, null, {fontSmaller : true}); } createRadioSet("Lighting", "freq", [["50", "50Hz"], ["60", "60Hz"]], null, true); createRadioSet("Illumination", "illum", [["auto", "Automatic"], ["indoor", "Indoor"], ["outdoor", "Outdoor"], ["mix", "Mixed"]], null, true); var lowLight = createRadioSet("Exposure Mode", "lowlight", [["highspeed", "High Speed"], ["speed", "Speed"], ["balance", "Balanced"], ["quality", "Quality"], ["moonlight", "Moonlight (TM)"]], null, true); createSlider("Exposure (ms)", 1, 80, "shortexposures", 1, 80, lowLight[0], true); createSlider("Low light noise filter (%)", 0, 100, "spacialfilter", 0, 100, null, true); if (model.isDualsensor()) { // createRadioSet("View Color/Mono Channel", "dualmode", [["dual", "Dual"], ["coloronly", "Color-only"], ["monoonly", "Mono-only"], ["auto", "Auto"],], null, true, { noLeadBr : true}) // createCheckbox("Upscale Mono Channel", "upscaling", "on", "off", null, true); var dayNight = createRadioSet("Day/Night", "daynight", [["auto", "Automatic"], ["day", "Day"], ["night", "Night"], ["dual", "Dual Channel Streaming"]], null, true); createSlider("Switching Level", 1, 100, "nightgain", 64, 512, dayNight[0], true); createSlider("Toggle Guard", 1, 4, "daygain", 1, 4, dayNight[0], true, {sliderWidth : "200px"}); createCheckbox("Upscale 1.3M to 3M", "upscaling", "on", "off", null, true); } else if (model.hasDN()) { var dayNight = createRadioSet("Day/Night", "daynight", [["auto", "Automatic"], ["day", "Day"], ["night", "Night"]], null, true); model.hasDN() || (disableVisual(dayNight[0], true), disableVisual(dayNight[1], true), disableVisual(dayNight[2], true)); createSlider("Switching Level", 1, 100, "nightgain", 64, 512, dayNight[0], true); createSlider("Toggle Guard", 1, 4, "daygain", 1, 4, dayNight[0], true, {sliderWidth : "200px"}); if (model.hasFocus()) createCheckbox("Focus after D/N switching", "af_dn", "on", "off", null, true); if (model.hasIR()) createCheckbox("Enable IR light at night", "ir", "on", "off", null, true); } avutil.createAppend(leading, 'br'); if (model.hasAI()) { var autoIris = createCheckbox("Enable Auto Iris", "autoiris", "on", "off", null, true); model.hasAI() || disableVisual(autoIris, true); //createSlider("Iris Closing Level", 1, 32, "irisreposfstops", 1, 32, null, true); //createSlider("Iris Max Gain", 8, 255, "irisgain", 8, 255, null, true); createTextBox("Iris Status", null, null, null, function() { image.irisTimeout=setInterval(iris_status, 1000);}, null, null, false); //.set('disabled', true); avutil.createAppend(leading, 'br'); } else if (model.hasPIris()) { var autoIris = createCheckbox("Enable P-Iris", "piris", "on", "off", null, true); if (model.isProduction()) createSlider("P-Iris Closing Level", 0, 20, "pirispos", 0, 20, null, true); //createSlider("Iris Closing Level", 1, 32, "irisreposfstops", 1, 32, null, true); createTextBox("Iris Status", null, null, null, function() { image.irisTimeout=setInterval(iris_status, 1000);}, null, null, false); //.set('disabled', true); avutil.createAppend(leading, 'br'); } if (model.hasBinning() && !(model.hasWDR() && (model.is2M() || !model.hasDN()) )) { createText("Binning", false, null, { left : true }); if (!model.hasWDR()) createCheckbox("Binning in day mode", "day_binning", "on", "off", null, true); if (model.hasDN()) createCheckbox("Binning in night mode", "night_binning", "on", "off", null, true); if (model.has1080()) { createCheckbox("1080p mode", f1080p_mode, "on", "off", null, true); } } } avutil.createAppend(leading, 'hr'); createText("Video", true, "_video", { noLeadBr : true}); avutil.createAppend(leading, 'hr'); var imgType = createRadioSet("Show Video Type", imageTypeSelection, [[0, "Disable Video"], [1, "MJPEG over HTTP"], [2, "H.264 over RTP/UDP"]], null, true, { noLeadBr : true}); model.hasH264() || disableVisual(imgType[2], true); if (browser()==="MSIE") disableVisual(imgType[2], true); createCheckbox("Video to Screen", videoToScreen, true, false, null, true); var controlVideo; if (isAdmin) { controlVideo = [["view", "No Control"], ["ptz", "PTZ"], ["backlight", "ROI Reference"], /* ["ptzback", "Permanent PTZ + Backlight"],*/ ["motion", "Motion Detection Mask"], ["privacy", "Privacy Mask"], ["focus", "Focus Window"]]; } else { controlVideo = [["view", "No Control"], ["ptz", "PTZ"]]; } createRadioSet("Control Video with Mouse", mouseMode, controlVideo, null, true); //createText("Press Ctrl or Shift to select polygonal mask.
Double click to shake off current settings.", false, null, {fontSmaller : true}); createText("* Mouse-related control requires running MJPEG video
* Click and move to select window to set.
* Double click to reset to default settings.", false, null, {fontSmaller : true}); avutil.createAppend(leading, 'hr'); liveValues.push( image.resolution = createRadioSet("Resolution", "imgres", [["half", "Half"], ["full", "Full"]], null, false, { noLeadBr : true}) ); liveValues.push( image.jpegQuality = createSlider("JPEG Quality", 1, 21, "imgquality", 1, 21, imgType[1], false) ); /* liveValues.push( image.h264Quality = createSlider("H.264 Quality", 1, 21, "qp", 36, 16, imgType[0], false) ); liveValues.push( image.h264BitrateCheck = createCheckbox("H.264 Bitrate Control", bitrate.bool, true, false, imgType[0], false) ); liveValues.push( image.h264BitrateNumber = createTextBox("Bitrate (100-65,000 kbps)", 0, bitrate.maxrate(), null, bitrate.number, null, image.h264BitrateCheck, false) ); liveValues.push( image.fps = createSlider("Frames per second", 1, fpsMaxVal+1, fps, 1, fpsMaxVal+1, imgType[0], false, {rend : "Max"}) ); */ // TODO 2: set two controls per line var dim = getMaxSensorDims(); image.maxsensorwidth = dim.width; image.maxsensorheight = dim.height; liveValues.push( image.left = imgRect.leftControl = createTextBox("Left", 0, image.maxsensorwidth-64, null, "imgleft", null, null, false) ); liveValues.push( image.top = imgRect.topControl = createTextBox("Top", 0, image.maxsensorheight-64, null, "imgtop", null, null, false) ); liveValues.push( image.right = createTextBox("Right", 64, image.maxsensorwidth, null, wide, null, null, false) ); liveValues.push( image.bottom = createTextBox("Bottom", 64, image.maxsensorheight, null, high, null, null, false) ); createButton("Preview", applyVideoIfDims, liveValues, { pre: 'br'}); if (isAdmin) { createButton("Apply", "onSetVideo", liveValues, { suf: 'br'}); createText("* "Preview" will not apply changes to the camera
* "Apply" will apply changes to the camera; Click "Save all setting to flash" in administration section to save all changes
", false, null, {fontSmaller : true}); } avutil.createAppend(leading, 'hr'); createText("H.264", true, "_h264", { noLeadBr : true}); avutil.createAppend(leading, 'hr'); createText("H.264 RTSP/RTP/AVP stream", false, null); h264Values.push( createTextBox("RTSP Unicast port", 1, 65535, null, "rtspport", null, null, false) ); createRadioSet("vbr", vbr, [["vbr", "Variable Bitrate Control"]], null, true, { noLegend : true}); h264Values.push( image.h264Quality = createTextBox("H.264 Quality (36..16)", 16, 36, null, "qp", null, null, false, {pre: "    "}) ); h264Values.push( image.h264EnableRatelimit = createCheckbox("Enable Rate Limit", "ratelimit_mode", "on", "off", null, false, {pre: "    "}) ); h264Values.push( image.h264Ratelimit = createTextBox("Rate limit (0-65535 kbps)", 0, 65535, null, "ratelimit", null, null, false, {pre: "    "}) ); avutil.createAppend(leading, 'br'); createRadioSet("cbr", cbr, [["cbr", "Constant Bitrate Control"]], null, true, { noLegend : true}); h264Values.push( image.h264BitrateNumber = createTextBox("Bitrate (0-65535 kbps)", 0, bitrate.maxrate(), null, bitrate.number, null, null, false, {pre: "    "}) ); h264Values.push( image.fps = createSlider("Frames per second", 1, fpsMaxVal+1, fps, 1, fpsMaxVal+1, null, false, {rend : "Max"}) ); h264Values.push( image.audioEnable = createCheckbox("Enable Microphone", "mic", "on", "off", null, false, {noLegend : true}) ); if (!model.hasAudio()) image.audioEnable.set('disabled', true); createButton("Preview ", applyVideoIfDims, h264Values, { pre: 'br'}); if (isAdmin) { createButton("Apply ", "onSetVideo", h264Values, { suf: 'br'}); } image.rtspLink = createTextBox("Link for external media players", "", "", null, function() {}, null, null, false, {rtspLinkData: true}); if (isAdmin) { createText("* "Preview" will not apply changes to the camera
* "Apply" will apply changes to the camera; Click "Save all setting to flash" in administration section to save all changes
", false, null, {fontSmaller : true}); } avutil.createAppend(leading, 'hr'); // end of Video section createText("RTP/UDP multicast stream", false, null); //multicastValues.push( createCheckbox("Enable RTP Multicast", multicast, true, false, null, true, false) ); //multicastValues.push( createTextBox("Multicast IP", null, null, null, "streamip", null, null, false, false) ); //multicastValues.push( createTextBox("Multicast RTP port", null, null, null, "rtpport", null, null, false, false) ); //multicastValues.push( createTextBox("SAP destination IP", null, null, null, "sapip", null, null, false, false) ); var enableMcast; multicastValues.push( enableMcast = createCheckbox("Enable RTP Multicast", netopt.mcast, true, false, null, false) ); multicastValues.push( createTextBox("IP Address", "", "", avutil.ipValidator, "streamip", 2, null, false) ); multicastValues.push( createTextBox("RTP Port", 1, 65535, null, "rtpport", null, null, false) ); multicastValues.push( createTextBox("SAP Destination IP", "", "", avutil.ipValidator, "sapip", null, null, false) ); //multicastValues.push( netopt.setter ); if (isAdmin) { createButton(" Apply ", "onSet", multicastValues, { suf: 'br'}); } avutil.createAppend(leading, 'hr'); if (isAdmin) { if (model.hasFocus()) { createText("Zoom & Focus", true, "_focus", { noLeadBr : true}); avutil.createAppend(leading, 'hr'); //createText("Zoom ", true, null); avutil.insertText(leading, "Zoom:"); avutil.createAppend(leading, 'br'); var val; //createText("+", false, null, { noPostBr : true, left : true}); createButton("+20", function() { setFocusZoom("zoom",20); }, null, { pre: '' }); createButton("+5", function() { setFocusZoom("zoom",5); }, null, { pre: '' }); createButton("+1", function() { setFocusZoom("zoom",1); }, null, { pre: '' }); avutil.createAppend(leading, 'br'); //createText("-", false, null, { noPostBr : true, left : true}); createButton("-20 ", function() { setFocusZoom("zoom",-20); }, null, { pre: '' }); createButton("-5 ", function() { setFocusZoom("zoom",-5); }, null, { pre: '' }); createButton("-1 ", function() { setFocusZoom("zoom",-1); }, null, { pre: '' }); //createButton("Reset Zoom ", function() { setCameraParam('zoom', "reset"); }, null, { suf: 'br' }); createCheckbox("Enable Auto Focus after zoom", "af_zoom", "on", "off", null, true) avutil.createAppend(leading, 'br'); //avutil.insertText(leading, "Focus:"); //avutil.createAppend(leading, 'br'); focus_status_text = createTextBox("Focus", null, null, null, null, null, null, false); //.set('disabled', true); createButton("+20", function() { setFocusZoom("focus",20); }, null, { pre: '' }); createButton("+5", function() { setFocusZoom("focus",5); }, null, { pre: '' }); createButton("+1", function() { setFocusZoom("focus",1); }, null, { pre: '' }); avutil.createAppend(leading, 'br'); createButton("-20 ", function() { setFocusZoom("focus",-20); }, null, { pre: '' }); createButton("-5 ", function() { setFocusZoom("focus",-5); }, null, { pre: '' }); createButton("-1 ", function() { setFocusZoom("focus",-1); }, null, { suf: '' }); //createButton("1-Click Focus", function() { clearInterval(focusTimeout1s); clearTimeout(focusTimeout60s); pre_focus_score = setCameraParam('focus', "auto"); setFocusScore(pre_focus_score); autofocus=1; focusTimeout1s = setInterval(getFocusScore, 1000); focusTimeout60s = setTimeout(focus60sTimeout, 60000); }, null, { pre: 'br', suf: 'br' }); createButton("  Full-range Focus  ", function() {pre_focus_score = setCameraParam('focus', "fullrange"); setFocusScore(pre_focus_score); focusMonitor(); }, null, { pre: 'br'}); createButton("Short-range Focus", function() {pre_focus_score = setCameraParam('focus', "shortrange"); setFocusScore(pre_focus_score); focusMonitor(); }, null, { pre: 'br'}); createButton("    Stop    ", function() { setFocusZoom("focus",0); }, null, { pre: 'br', suf: 'br' }); createTextBox("Focus Aid", 0, 65535, null, "focus", null, null, false); //.set('disabled', true); createButton("Update Focus Aid", function() { setFocusZoom("focus",0); }, null, { pre: '' }); createText("* The larger focus aid value indicates better focusing
* Focus window turning GREEN indicates focusing better
* Focus window turning RED indicates focusing worse
* Focus window turning YELLOW indicates no change
* Focus window turning GREY indicates Focusing is done", false, null, {fontSmaller : true}); //dijit.byId("textbox"+"Focus Aid").set('disabled', true); //dijit.byId("slider"+"Focus Aid").set('disabled', true); avutil.createAppend(leading, 'br'); //avutil.insertText(leading, "Focus window:"); //createTextBox("F_Left", 0, 6000, null, 'focusleft', null, null, false); //createTextBox("F_Top", 0, 4000, null, 'focustop', null, null, false); //createTextBox("F_Right", 0, 6000, null, 'focusright', null, null, false); //createTextBox("F_Bottom", 0, 4000, null, 'focusbottom', null, null, false); avutil.createAppend(leading, 'hr'); } else if (model.hasFocusAid()) { createText("Focus", true, "_focus", { noLeadBr : true}); avutil.createAppend(leading, 'hr'); FocusAidEnable = createCheckbox("Enable Focus Aid", focusaid, true, false, null, true); createTextBox("Focus Aid", 0, 65535, null, "focus", null, null, false); //.set('disabled', true); avutil.createAppend(leading, 'hr'); } else avutil.remove('menu_focus'); createText("Network", true, "_network", { noLeadBr : true}); avutil.createAppend(leading, 'hr'); createText("IP Assignment", false, null); ipValues.push( createTextBox("Subnet Mask", "", "", avutil.ipValidator, "subnetmask", null, null, false) ); ipValues.push( createTextBox("Default Gateway", "", "", avutil.ipValidator, "gateway", null, null, false) ); ipValues.push( createTextBox("IP Address", "", "", avutil.ipValidator, "ip", 1, null, false) ); createButton("Apply & Save to Flash", "onSet", ipValues, { pre: 'br', suf: 'br'}); avutil.createAppend(leading, 'hr'); createText("IP Options", false, null); ipOptions.push( createRadioSet("DHCP/Fixed Selection", netopt.dhcp, [[false, "Fixed IP"], [true, "DHCP"]], null, false) ); ipOptions.push( createCheckbox("Lock IP", netopt.lockIP, true, false, null, false) ); var limMTU; ipOptions.push( limMTU = createCheckbox("Limit MTU Size", netopt.limitMTU, true, false, null, false) ); ipOptions.push( createTextBox("To", 256, 1500, null, "mtu", null, limMTU, false) ); //ipOptions.push( netopt.setter ); avutil.createAppend(leading, 'br'); createButton("Apply", "onSet", ipOptions, { suf: 'br'}); avutil.createAppend(leading, 'hr'); createText("Miscellaneous", false, null); avutil.createAppend(leading, 'br'); netMisc.push( createTextBox("Camera Name", "", "", null, "name", null, null, false, {maxLength: 32}) ); netMisc.push( createTextBox("Second HTTP port", 1, 65535, null, "webserverport", null, null, false) ); createButton("Apply", "onSet", netMisc, { pre: 'br', suf: 'br'}); avutil.createAppend(leading, 'hr'); createText("Motion Detection", true, "_motion", { noLeadBr : true}); var enableMD; var extendedMD; var disableMD; disableMD = createCheckbox("DisableMD", "motiondetect", "off", "on", null, true); var leading1 = document.getElementById('leading_region'); var len = leading1.childNodes.length; leading1.removeChild(leading1.childNodes[len-1]); leading1.removeChild(leading1.childNodes[len-2]); leading1.removeChild(leading1.childNodes[len-3]); disableMD.domNode.style.display = 'none'; enableMD = createCheckbox("Enable", motiondetect, "on", "off", null, true); extendedMD = createCheckbox("Extended", extmotiondetect, 1024, 64, disableMD, true); if (dijit.byId("checkBoxExtended").getValue() == 1024) image.zbnum = 32; else image.zbnum = 8; // TODO 0: why was it? //md.push( extendedMD = createCheckbox("Extended", "mdtotalzones", 1024, 64, disableMD, true) ); //extendedMD.set('disabled', true); //md.push( createCheckbox("Show motion frames only", "mdmode", "on", "off", disableMD, false) ); // TODO 3: there are more dependencies in these parameters; left for later md.push( image.zoneSize = createSlider("Zone Size", 2, 15, "mdzonesize", 2, 15, disableMD, true) ); md.push( createSlider("Detail", 1, 255, "mddetail", 1, 255, disableMD, true) ); md.push( createSlider("Level threshold", 2, 31, "mdlevelthreshold", 2, 31, disableMD, true) ); //md.push( createSlider("Global Sensitivity, %", 0, 100, "mdsensitivity", 1, Number(extendedMD.getValue()), disableMD, false) ); md.push( createSlider("Motion Sensitivity, %", 0, 100, mdsensitivity, 0, 100, disableMD, true) ); //createButton("Apply", "onSet", md, { pre: 'br', suf: 'br'}); createText("* Select 'Motion Detection Mask' mouse control.
* Left click and move to select window to set mask.
* Right click and move to select window to reset mask.", false, null, {fontSmaller : true}); avutil.createAppend(leading, 'hr'); createText("Privacy Mask", true, "_privacy", { noLeadBr : true}); pm.push( createCheckbox("Enable Privacy Mask", "pmask", "on", "off", null, true) ); //createButton("Apply", "onSet", pm, { pre: 'br', suf: 'br'}); createText("* Select 'Privacy Mask' mouse control.
* Left click and move to select window to set mask.
* Right click and move to select window to reset mask.", false, null, {fontSmaller : true}); avutil.createAppend(leading, 'hr'); createText("Administration", true, "_administration", {noLeadBr: true}); avutil.createAppend(leading, 'hr'); createText("Access Control", false, null); createText('(Up to 8 digits, letters and symbols, excluding # % & ` " < >)', false, null, {fontSmaller : true}); createText("Username: \t\tadmin", false, null, {left: true}); pwdAdmin.push( createTextBox("Admin Password", "", "", null, function() {}, null, null, false, { password: true, maxLength: 8 }) ); pwdAdmin.push( createTextBox("Confirmation", "", "", null, function() {}, 1, null, false, { password: true, maxLength: 8 }) ); createButton("Set", av.pwdStrAdmin, pwdAdmin, {pre: 'br'}); createButton("Erase", av.pwdStrAdmin, null, {suf: 'br'}); avutil.createAppend(leading, 'br'); createText("Username: \t\tviewer", false, null, {left: true}); pwdViewer.push( createTextBox("Viewer Password", "", "", null, function() {}, null, null, false, { password: true, maxLength: 8 }) ); pwdViewer.push( createTextBox("Confirmation", "", "", null, function() {}, 2, null, false, { password: true, maxLength: 8 }) ); createButton("Set", av.pwdStrViewer, pwdViewer, { pre: 'br'}); createButton("Erase", av.pwdStrViewer, null, { suf: 'br'}); avutil.createAppend(leading, 'hr'); createText("Save & Restore Settings", false, null, {left: true}); createButton("Save all settings to flash", function() { setCameraParam("params", "save"); }, null, { pre: 'br', suf: 'br' }); createButton("Restore to factory default", function() { if(confirm('Are you sure?')) {setTimeout("window.location.reload()",5000); setCameraParam("params", "factory"); } }, null, { pre: 'br', suf: 'br' }); avutil.createAppend(leading, 'hr'); createUpgradeForm(); //createSpeakerForm(); avutil.createAppend(leading, 'hr'); //createText("Advanced", true, "_advanced"); // adv.push( createTextBox("H.264 G.O.P.", 1, 100, null, gop_register_3_21, null, null, false) ); // createButton("Apply", "onSet", adv, { pre: 'br', suf: 'br'}); // avutil.createAppend(leading, 'hr'); createText("About", true, "_about"); // TODO 1: ensure numbers alignment // TODO 1: request test of name reporting, esp. on hard cropped cameras createText("Camera Type: \t\t" + (qi.model=model.releasename), false, null, {left: true}); createText("Firmware: \t\t" + (qi.firm=getCameraParam("fwversion")), false, null, {left: true}); createText("JPEG Engine: \t\t" + getCameraParam("procversion"), false, null, {left: true}); createText("Net Version: \t\t" + getCameraParam("netversion"), false, null, {left: true}); createText("MAC Address: \t\t" + (qi.mac=getCameraParam("mac")), false, null, {left: true}); //createText("Web GUI======: \t\t" + "8880", false, null, {left: true}); avutil.createAppend(leading, 'br'); } else { image.flipped = (getCameraParam("rotate") == 180); createText("About", true, "_about"); createText("Camera Type: \t\t" + (qi.model=model.releasename), false, null, {left: true}); createText("MAC Address: \t\t" + (qi.mac=getCameraParam("mac")), false, null, {left: true}); createTextBox("Camera Name", "", "", null, "name", null, null, false).set('disabled', true); avutil.createAppend(leading, 'br'); /*enableMcast = createCheckbox("Enable RTP Multicast", netopt.mcast, true, false, null, true); enableMcast.set('disabled', true); createTextBox("IP Address", "", "", avutil.ipValidator, "streamip", 2, enableMcast, false); createTextBox("RTP Port", 1, 65535, null, "rtpport", null, enableMcast, false); createTextBox("SAP Destination IP", "", "", avutil.ipValidator, "sapip", null, enableMcast, false); avutil.createAppend(leading, 'br'); createTextBox("Second HTTP port", 1, 65535, null, "webserverport", null, null, false).set('disabled', true); avutil.createAppend(leading, 'br'); //enableMD = createCheckbox("Enable Motion Detection", "motiondetect", "on", "off", null, false); //enableMD.set('disabled', true); // createCheckbox("Show motion frames only", "mdmode", "on", "off", enableMD, false); avutil.createAppend(leading, 'br'); */ // remove menu items avutil.remove('menu_picture'); avutil.remove('menu_focus'); avutil.remove('menu_network'); avutil.remove('menu_motion'); avutil.remove('menu_privacy'); avutil.remove('menu_administration'); } document.getElementById('navMenu').style.visibility = "visible"; var quick = document.getElementById('quick_info'); quick.innerHTML = "

" + "Model " + qi.model + "
" + (qi.firm ? "Firmware " + qi.firm : "") + "
" + "MAC  " + qi.mac + "

"; //document.title = av.documentTitle(); applyVideo(); eventsRegistration(); // TODO 0: temp here // var subz = calculateGrid(); // image.gridHor = subz.hor; // image.gridVer = subz.ver; // image.gridSize = subz.size; //drawGridScreen(15, 10, 75); //drawGrid(); // drawGridScreen(subz.hor, subz.ver, subz.size); });