Page 1 of 1

wansview NCB541W

Posted: Fri Apr 27, 2012 12:37 pm
by tritron4
I got couple of wansview cameras NCB541W both cameras are configured to send video to zone minder now i want to configure control is ther place to download .pm file that will control til and pan it seem they are using java script

Code: Select all

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" href="style.css" type="text/css">
<title></title>
</head>
<script src="public.js"></script>
<script src="get_camera_params.cgi"></script>
<script>
var R320_240=8;
var R640_480=32;
var ptz_type=0;
if(top.client_minor==4) ptz_type=1;	

var PTZ_STOP	=1;
var TILT_UP		=2;
var TILT_UP_STOP=1;
var TILT_DOWN	=0;
var TILT_DOWN_STOP=3;
var PAN_LEFT	=6;
var PAN_LEFT_STOP=5;
var PAN_RIGHT	=4;
var PAN_RIGHT_STOP=7;
var PTZ_LEFT_UP	=93;
var PTZ_RIGHT_UP=92;
var PTZ_LEFT_DOWN=91;
var PTZ_RIGHT_DOWN=90;
var PTZ_CENTER	=25;
var PTZ_VPATROL	=26;
var PTZ_VPATROL_STOP=27;
var PTZ_HPATROL	=28;
var PTZ_HPATROL_STOP=29;
var PTZ_PELCO_D_HPATROL=20;
var PTZ_PELCO_D_HPATROL_STOP=21;

var IO_ON=94;
var IO_OFF=95;

function getcookie(name)
{
	var strCookie=document.cookie;
    var arrCookie=strCookie.split('; ');
    for (var i=0;i<arrCookie.length;i++)
    {
		var arr=arrCookie[i].split('=');
        if (arr[0]==name)
			return unescape(arr[1]);
    }
    return '';
}

function setcookie(name,value,expirehours)
{
	var cookieString=name+'='+escape(value);
    if (expirehours>0)
    {
		var date=new Date();
        date.setTime(date.getTime()+expirehours*3600*1000);
        cookieString=cookieString+'; expires='+date.toGMTString();
	}
    document.cookie=cookieString;
}

function decoder_control_onestep(command)
{
	action_zone.location='decoder_control.cgi?onestep=1&command='+command;
}

function decoder_control(command)
{
	action_zone.location='decoder_control.cgi?command='+command;
}
function camera_control(param,value)
{
	action_zone.location='camera_control.cgi?param='+param+'&value='+value;
}
function set_flip()
{
	if (image_reversal.checked)
		flip|=1;
	else
		flip&=2;
	if (image_mirror.checked)
		flip|=2;
	else
		flip&=1;	
	camera_control(5,flip);
}
function up_onmousedown() 
{
	(flip&0x01)?decoder_control(TILT_DOWN):decoder_control(TILT_UP);
}

function upclicked()
{
	(flip&0x01)?decoder_control_onestep(TILT_DOWN):decoder_control_onestep(TILT_UP);
}

function leftupclicked()
{
	/*if (ptz_type)
		return;
	if ((flip&0x03)==0x03)
		decoder_control_onestep(PTZ_RIGHT_DOWN);
	else if (flip&0x02)
		decoder_control_onestep(PTZ_RIGHT_UP);
	else if (flip&0x01)
		decoder_control_onestep(PTZ_LEFT_DOWN);
	else		
		decoder_control_onestep(PTZ_LEFT_UP);	*/

}

function rightupclicked()
{
	/*if (ptz_type)
		return;
	if ((flip&0x03)==0x03)
		decoder_control_onestep(PTZ_LEFT_DOWN);
	else if (flip&0x02)
		decoder_control_onestep(PTZ_LEFT_UP);
	else if (flip&0x01)
		decoder_control_onestep(PTZ_RIGHT_DOWN);
	else		
		decoder_control_onestep(PTZ_RIGHT_UP);	*/
}

function leftclicked()
{
	(flip&0x02)?decoder_control_onestep(PAN_RIGHT):decoder_control_onestep(PAN_LEFT);
}


function rightclicked()
{
	(flip&0x02)?decoder_control_onestep(PAN_LEFT):decoder_control_onestep(PAN_RIGHT);
}

function up_onmouseup() 
{
	if (!ptz_type)
		decoder_control(PTZ_STOP);
	else if (flip&0x01)
		decoder_control(TILT_DOWN_STOP);
	else	
		decoder_control(TILT_UP_STOP);
}
function down_onmousedown() 
{
	(flip&0x01)?decoder_control(TILT_UP):decoder_control(TILT_DOWN);
}
function down_onmouseup() 
{
	if (!ptz_type)
		decoder_control(PTZ_STOP);
	else if (flip&0x01)
		decoder_control(TILT_UP_STOP);
	else
		decoder_control(TILT_DOWN_STOP);	
}
function left_onmousedown() 
{
	(flip&0x02)?decoder_control(PAN_RIGHT):decoder_control(PAN_LEFT);
}
function left_onmouseup() 
{
	if (!ptz_type)
		decoder_control(PTZ_STOP);
	else if (flip&0x02)
		decoder_control(PAN_RIGHT_STOP);
	else	
		decoder_control(PAN_LEFT_STOP);	
}
function right_onmousedown() 
{
	(flip&0x02)?decoder_control(PAN_LEFT):decoder_control(PAN_RIGHT);
}
function right_onmouseup() 
{
	if (!ptz_type)
		decoder_control(PTZ_STOP);
	else if (flip&0x02)
		decoder_control(PAN_LEFT_STOP);
	else	
		decoder_control(PAN_RIGHT_STOP);
}
function leftup_onmousedown() 
{
	if (ptz_type)
		return;
	if ((flip&0x03)==0x03)
		decoder_control(PTZ_RIGHT_DOWN);
	else if (flip&0x02)
		decoder_control(PTZ_RIGHT_UP);
	else if (flip&0x01)
		decoder_control(PTZ_LEFT_DOWN);
	else		
		decoder_control(PTZ_LEFT_UP);
}

function leftup_onmouseup() 
{
	if (!ptz_type) decoder_control(PTZ_STOP);
}

function rightup_onmousedown() 
{
	if (ptz_type)
		return;
	if ((flip&0x03)==0x03)
		decoder_control(PTZ_LEFT_DOWN);
	else if (flip&0x02)
		decoder_control(PTZ_LEFT_UP);
	else if (flip&0x01)
		decoder_control(PTZ_RIGHT_DOWN);
	else		
		decoder_control(PTZ_RIGHT_UP);
}
function rightup_onmouseup() 
{
	if (!ptz_type) decoder_control(PTZ_STOP);
}
function leftdown_onmousedown() 
{
	if (ptz_type)
		return;
	if ((flip&0x03)==0x03)
		decoder_control(PTZ_RIGHT_UP);
	else if (flip&0x02)
		decoder_control(PTZ_RIGHT_DOWN);
	else if (flip&0x01)
		decoder_control(PTZ_LEFT_UP);
	else		
		decoder_control(PTZ_LEFT_DOWN);
}


function leftdownclicked()
{
	/*if (ptz_type)
		return;
	if ((flip&0x03)==0x03)
		decoder_control_onestep(PTZ_RIGHT_UP);
	else if (flip&0x02)
		decoder_control_onestep(PTZ_RIGHT_DOWN);
	else if (flip&0x01)
		decoder_control_onestep(PTZ_LEFT_UP);
	else		
		decoder_control_onestep(PTZ_LEFT_DOWN);	*/
}

function rightdownclicked()
{
	/*if (ptz_type)
		return;
	if ((flip&0x03)==0x03)
		decoder_control_onestep(PTZ_LEFT_UP);
	else if (flip&0x02)
		decoder_control_onestep(PTZ_LEFT_DOWN);
	else if (flip&0x01)
		decoder_control_onestep(PTZ_RIGHT_UP);
	else		
		decoder_control_onestep(PTZ_RIGHT_DOWN);*/	

}


function downclicked()
{
	(flip&0x01)?decoder_control_onestep(TILT_UP):decoder_control_onestep(TILT_DOWN);
}

function leftdown_onmouseup() 
{
	if (!ptz_type) decoder_control(PTZ_STOP);
}
function rightdown_onmousedown() 
{
	if (ptz_type)
		return;
	if ((flip&0x03)==0x03)
		decoder_control(PTZ_LEFT_UP);
	else if (flip&0x02)
		decoder_control(PTZ_LEFT_DOWN);
	else if (flip&0x01)
		decoder_control(PTZ_RIGHT_UP);
	else		
		decoder_control(PTZ_RIGHT_DOWN);
}
function rightdown_onmouseup() 
{
	if (!ptz_type) decoder_control(PTZ_STOP);
}
function center_onclick() 
{
	if (!ptz_type) decoder_control(PTZ_CENTER);
}
function vpatrol_onclick() 
{
	if (!ptz_type) decoder_control(PTZ_VPATROL);
}
function vpatrolstop_onclick() 
{
	if (!ptz_type) decoder_control(PTZ_VPATROL_STOP);
}
function hpatrol_onclick() 
{
	ptz_type?decoder_control(PTZ_PELCO_D_HPATROL):decoder_control(PTZ_HPATROL);
}
function hpatrolstop_onclick() 
{
	ptz_type?decoder_control(PTZ_PELCO_D_HPATROL_STOP):decoder_control(PTZ_HPATROL_STOP);
}
function set_resolution()
{
	camera_control(0,resolution_sel.value);
	setTimeout('parent.parent.main.location.reload()',2000);
}

function set_videorate()
{
	//parent.parent.main.set_videorate(videorate.value);
	parent.parent.videoframerate = videorate.value;
	setcookie("videoframerate", videorate.value,360);
	parent.parent.main.location.reload();
}

function plus_brightness()
{
	val=brightness_input.value;
	if (val++<15)
	{
		brightness_input.value=val;
		camera_control(1,val*16);
	}
}

function minus_brightness()
{
	val=brightness_input.value;
	if (val-->0)
	{
		brightness_input.value=val;
		camera_control(1,val*16);
	}	
}

function plus_contrast()
{
	val=contrast_input.value;
	if (val++<6)
	{
		contrast_input.value=val;
		camera_control(2,val);
	}
}

function minus_contrast()
{
	val=contrast_input.value;
	if (val-->0)
	{
		contrast_input.value=val;
		camera_control(2,val);
	}
}




function body_onload()
{
	gocenter.title=top.str_center;
	vpatrol.title=top.str_vertical_patrol;
	vpatrolstop.title=top.str_stop_vertical_patrol;
	hpatrol.title=top.str_horizon_patrol;
	hpatrolstop.title=top.str_stop_horizon_patrol;
	switchon.title=top.str_switchon;
	switchoff.title=top.str_switchoff;
	resolution_sel.value=resolution;
	mode_sel.value=mode;
	brightness_input.value=Math.round(brightness / 16);
	contrast_input.value=contrast;
	image_reversal.checked=(flip&0x01)?true:false;
	image_mirror.checked=(flip&0x02)?true:false;


	videorate.value = getcookie("videoframerate");
	if(videorate.value == '')
	{
		videorate.value = 0;
	}
}



</script>


<body onLoad="body_onload()" class="bkpadcol">
<iframe name="action_zone" style="display:none"></iframe>
<table width="170" class="h2 f12b bkpadcol v2" >
	<tr height="10"><td> </td></tr>
	<tr>
	<td colspan="2">
	<table width="170"><tr>
		<td>
		<table>
		<tr>
		<td height="18" width="18"></td>
		<td height="20" width="20"><a border ="0" href = "javascript:upclicked()"><img border ="0"  src="images/up.gif"></a></td>
		<td height="18" width="18"></td>
		</tr>
		
		<tr>
		<td height="18" width="18">
		<img border ="0"  style="margin-left:10px" src="./images/7.gif" height="20px" onMouseDown="leftup_onmousedown()" onMouseUp="leftup_onmouseup()">
		</td>
		<td height="20" width="20"></td>
		<td height="18" width="18">
		<img border ="0"  style="margin-right:10px" src="./images/8.gif" height="20px" onMouseDown="rightup_onmousedown()" onMouseUp="rightup_onmouseup()">
		</td>
		</tr>
		
		<tr>
		<td height="18" width="18">
		<a border ="0" href = "javascript:leftclicked()"><img border ="0"  src="images/left.gif"></a></td>
		<td height="20" width="20" align="center"><a border="0" href = "javascript:center_onclick()"><img border ="0" src="images/cen2.gif"></a></td>
		<td height="18" width="18"><a border="0" href = "javascript:rightclicked()"><img border ="0" src="images/right.gif"></a></td>
		</tr>
		
		<tr>
		<td height="18" width="18">
		<img border ="0" style="margin-left:10px" src="./images/6.gif" height="20px"  onMouseDown="leftdown_onmousedown()" onMouseUp="leftdown_onmouseup()"> 
		</td>
		<td height="20" width="20"></td>
		<td height="18" width="18">
		<img border ="0" style="margin-right:10px" src="./images/5.gif" height="20px"  onMouseDown="rightdown_onmousedown()" onMouseUp="rightdown_onmouseup()">
		</td>
		</tr>
		
		<tr>
		<td height="18" width="18"></td>
		<td height="20" width="20">
		<a border ="0" href = "javascript:downclicked()"><img border ="0" src="images/down.gif"></a></td>
		<td height="18" width="18"></td>
		</tr>						
		</table>
			<div ><img style="display:none" src="images/ptz1.gif">						  
			<img style="display:none" src="images/ptz2.gif"></div>
			<div style="display:none">
			<img style="display:none" src="images/leftup_up.gif" onMouseDown="leftup_onmousedown()" onMouseUp= "leftup_onmouseup()">
			<img style="display:none" src="images/ptz3.gif">
			<img style="display:none" src="images/rightup_up.gif" onMouseDown= "rightup_onmousedown()" onMouseUp="rightup_onmouseup()">
			</div>
			<div>
			
			
					
			<img style="display:none" id="gocenter" src="images/center.gif" onClick="center_onclick()">
			</div>
			<div>
			
			&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
			
			</div>
			<div >
			<img style="display:none" src="images/leftdown_up.gif" onMouseDown="leftdown_onmousedown()" onMouseUp="leftdown_onmouseup()">
			&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;	
			
			<img style="display:none" src="images/rightdown_up.gif" onMouseDown="rightdown_onmousedown()" onMouseUp="rightdown_onmouseup()">
			</div>
		</td>
		<td>
			<div><img id="vpatrol" src="images/vpatrol_up.gif" onClick="vpatrol_onclick()">&nbsp;<img id="vpatrolstop" src="images/stop_up.gif" onClick="vpatrolstop_onclick()"></div>
			<div><img id="hpatrol" src="images/hpatrol_up.gif" onClick="hpatrol_onclick()">&nbsp;<img id="hpatrolstop" src="images/stop_up.gif" onClick="hpatrolstop_onclick()"></div>
			<div style="display:none"><img id="switchon" src="images/switchon_up.gif" onClick="decoder_control(IO_ON)">&nbsp;<img id="switchoff" src="images/switchoff_up.gif" onClick="decoder_control(IO_OFF)"></div>
		</td>	
	</tr>
	</table>
	</td>
	</tr>
	<tr height="10"><td> </td></tr>
	<tr height="20"><td colspan="2"><input id="image_reversal" type="checkbox" onClick="set_flip()"><script>document.write(top.str_reversal);</script>&nbsp;&nbsp;<input id="image_mirror" type="checkbox" onClick="set_flip()"><script>document.write(top.str_mirror);</script></td></tr>
	<tr height="10"><td> </td></tr>



	<tr height="20">
	<td width="65" class="h1">&nbsp;<script>document.write(top.str_video_rate);</script></td>
	<td><select id="videorate" class="s4" onchange="set_videorate()">
	<option value="0"><script>document.write(top.str_full_speed);</script></option>
	<option value="1">20 fps</option>
	<option value="3">15 fps</option>
	<option value="6">10 fps</option>
	<option value="11">5 fps</option>
	<option value="12">4 fps</option>
	<option value="13">3 fps</option>
	<option value="14">2 fps</option>
	<option value="15">1 fps</option>
	<option value="17">1 fp/2s</option>
	<option value="19">1 fp/3s</option>
	<option value="21">1 fp/4s</option>
	<option value="23">1 fp/5s</option>
	</select></td>
	</tr>



	<tr height="20"><td width="65" class="h1">&nbsp;<script>document.write(top.str_resolution);</script></td><td><SELECT id="resolution_sel" class="s4" onChange="set_resolution()"><OPTION value="2">160*120</OPTION><OPTION value="8">320*240</OPTION><OPTION value="32">640*480</OPTION></SELECT></td></tr>
	<tr height="20"><td class="h1">&nbsp;<script>document.write(top.str_mode);</script></td><td><SELECT class="s4" id="mode_sel" onChange="camera_control(3,value)"><OPTION value="0">50 HZ</OPTION><OPTION value="1">60 HZ</OPTION><OPTION value="2"><script>document.write(top.str_outdoor);</script></OPTION></SELECT></td></tr>
	<tr height="25"><td class="h1">&nbsp;<script>document.write(top.str_brightness);</script></td><td><table class="h2"><tr><td><img src="images/in1.gif" onClick="plus_brightness()"></td><td><input id="brightness_input" readonly maxLength="2" class="s3" size="2"></td><td><img src="images/de1.gif" onClick="minus_brightness()"></td></tr></table></td></tr>
	<tr height="25"><td class="h1">&nbsp;<script>document.write(top.str_contrast);</script></td><td><table class="h2"><tr><td><img src="images/in1.gif" onClick="plus_contrast()"></td><td><input id="contrast_input" readonly maxLength="1" class="s3" size="2"></td><td><img src="images/de1.gif" onClick="minus_contrast()"></td></tr></table></td></tr>
	<tr height="10"><td> </td></tr>
</table>
</body>
</html>

Re: wansview NCB541W

Posted: Sat Apr 28, 2012 5:09 am
by tritron4
I had moded foscamcontrol file and when I type /srv/zoneminder/bin/zmcontrol.pl --id 2 --command=moveConUp camera moves but when i use web interface camera does not respond to clicks in controls.

Re: wansview NCB541W

Posted: Sat Apr 28, 2012 1:30 pm
by tritron4
Well I enabled socket in php.ini and one of my cameras is working just fine but the other one does not respond. It seems sockets issue for the other one Does anyone knows how to fix it ?

Re: wansview NCB541W

Posted: Fri Jun 08, 2012 2:37 pm
by Fabrizio
Hi,
tritron4 wrote:I had moded foscamcontrol file
I have ordered a Wansview 541 camera as well and am going to use it with Zoneminder. If you would share the control script you derived from the foscam one I could use it as a starting point and of course help to maintain and improve it.
Can you post it here?

Thanks,
Fabrizio