Help with GGI call, Problem passing cgi parameters |
Help with GGI call, Problem passing cgi parameters |
Pallama |
Jan 2 2021, 05:15 PM
Post
#1
|
Group: Members Posts: 5 Joined: 2-January 21 Member No.: 27,706 |
Hi. I am a senior citizen, complete noob writing some of my first html.
I have an IP PTZ security cam. I’m trying to create an HTML interface for my raspberry pi / touch screen monitor. The cam responds to the most common hi3510 cgi commands. However I think the cam doesn’t like Ajax. I am having a hard time passing the below “preset location “ and the param.cgi arguments to the cam. They work in a browser bar but not in a script. The touch screen shows the buttons but nothing happens when I push them. I have tried both the function call and the full url in the input statement. Neither works. function ptzloc1() {Uh form1.action="http://192.168.1.247/web/cgi-bin/hi3510/param.cgi?cmd=preset&-act=goto&-status=1&-number=0"; form1.submit(); } #And here is the input I’ve tried. <div style = "position:absolute; left:80px; top:31px;"> <p> <input type="button"; value="1" name="B4" onClick="http://192.168.1.247/web/cgi-bin/hi3510/param.cgi?cmd=preset&-act=goto&-status=1&-number=0"> <input type="button"; value="1" name="B4" onClick="ptzloc1()"> As I’ve said, it doesn’t seem to like Ajax since the cam has an “if (request == null) “ test in it but suggestions are welcome. |
Pallama |
Jan 3 2021, 01:31 PM
Post
#2
|
Group: Members Posts: 5 Joined: 2-January 21 Member No.: 27,706 |
Sorry, I am still struggling. Here is the entire script
I tried the ifr but the "foo" link takes me back to the cgi response: "[Succeed]set ok." Re: security, I could be doing better. I think the camera is not very secure (here). The cam is ethernet wired, wireless disabled, my router has wireless with WPA2/WPA mixed personal, but the cam broadcasts rtsp and has a built in access through CamHiPro (which I need when I travel.) Here is the starting code with PTZLOC buttons that don't work. CODE <html> <head> <title>Video Mobile</title> <meta content="text/html; charset=utf-8" http-equiv="content-type"> <script src="http://192.168.1.247/web/cgi-bin/hi3510/param.cgi?cmd=getlanguage" type="text/javascript"></script> <script type="text/javascript" src="http://192.168.1.247/web/js/language.js"></script> <script language="javascript"> <!-- var img = new Image(); var imgObj; function preload() { img.src='http://192.168.1.247/web/tmpfs/auto.jpg?'+new Date; } function changesrc() { img1.src=img.src; preload(); setTimeout(changesrc,3500); } function update() { imgObj = document.getElementById('img1'); imgObj.src = img.src; img.src = "http://192.168.1.247/web/tmpfs/auto.jpg?" + (new Date()).getTime(); } function takeError() { img.src = "http://192.168.1.247/web/tmpfs/auto.jpg?" + (new Date()).getTime(); } function startonload() { img.src = "http://192.168.1.247/web/tmpfs/auto.jpg?" + (new Date()).getTime(); img.onerror=takeError; img.onload=update; } function load() { if (navigator.appName.indexOf("Microsoft IE Mobile") != -1) { preload(); changesrc(); return; } startonload(); } function ptzUpSubmit() { form1.action="http://192.168.1.247/web/cgi-bin/hi3510/ytup.cgi"; form1.submit(); } function ptzDownSubmit() { form1.action="http://192.168.1.247/web/cgi-bin/hi3510/ytdown.cgi"; form1.submit(); } function ptzLeftSubmit() { form1.action="http://192.168.1.247/web/cgi-bin/hi3510/ytleft.cgi"; form1.submit(); } function ptzRightSubmit() { form1.action="http://192.168.1.247/web/cgi-bin/hi3510/ytright.cgi"; form1.submit(); } function ptzloc1() { form1.action="http://192.168.1.247/web/cgi-bin/hi3510/param.cgi?cmd=preset&-act=goto&-status=1&-number=0"; form1.submit(); } function ptzloc2() { form1.action="http://192.168.1.247/web/cgi-bin/hi3510/param.cgi?cmd=preset&-act=goto&-status=1&-number=1"; form1.submit(); } function ptzloc3() { form1.action="http://192.168.1.247/web/cgi-bin/hi3510/param.cgi?cmd=preset&-act=goto&-status=1&-number=2"; form1.submit(); } function ptzloc4() { form1.action="http://192.168.1.247/web/cgi-bin/hi3510/param.cgi?cmd=preset&-act=goto&-status=1&-number=3"; form1.submit(); } function ptzloc5() { form1.action="http://192.168.1.247/web/cgi-bin/hi3510/param.cgi?cmd=preset&-act=goto&-status=1&-number=4"; form1.submit(); } function ptzloc6() { form1.action="http://192.168.1.247/web/cgi-bin/hi3510/param.cgi?cmd=preset&-act=goto&-status=1&-number=5"; form1.submit(); } function ptzloc7() { form1.action="http://192.168.1.247/web/cgi-bin/hi3510/param.cgi?cmd=preset&-act=goto&-status=1&-number=6"; form1.submit(); } //--> </script> </head> <body onLoad="load()"> <form name="form1" method="get" target="test"> </form> <div style = "position:absolute; left:80px; top:20px;"> <p> <input type="button"; value="∧" name="B3" onClick="ptzUpSubmit()"> <input type="button"; value="∨" name="B2" onClick="ptzDownSubmit()"> <input type="button"; value="<" name="B1" onClick="ptzLeftSubmit()"> <input type="button"; value=">" name="B0" onClick="ptzRightSubmit()"> <button type="button"; name="B4" onClick="location.reload()"><script type="text/javascript">document.write("REFRESH");</script></button> </p> </div> <div style = "position:absolute; left:400px; top:20px;"> <p> <input type="button"; value="1" name="B4" onClick="ptzloc1()"> <input type="button"; value="2" name="B5" onClick="ptzloc2()"> <input type="button"; value="3" name="B6" onClick="ptzloc3()"> <input type="button"; value="4" name="B7" onClick="ptzloc4()"> <input type="button"; value="5" name="B8" onClick="ptzloc5()"> <input type="button"; value="6" name="B9" onClick="ptzloc6()"> <input type="button"; value="7" name="B10" onClick="ptzloc7()"> </p> </div> <p><img id="img1" border="0" src="tmpfs/auto.jpg"></p> <iframe name="test" style="none" width="0" height="0"></iframe> </body> </html> This post has been edited by Pallama: Jan 3 2021, 01:50 PM |
Christian J |
Jan 3 2021, 01:42 PM
Post
#3
|
. Group: WDG Moderators Posts: 9,684 Joined: 10-August 06 Member No.: 7 |
I tried the ifr but the "foo" link takes me back to the cgi response: "[Succeed]set ok." In my example you'd need separate links for every URL shown in your javascript code sample. But I don't know what some of the scripts in your code same is doing, like this part: QUOTE CODE <script src="http://192.168.1.247/web/cgi-bin/hi3510/param.cgi?cmd=getlanguage" type="text/javascript"></script> <script type="text/javascript" src="http://192.168.1.247/web/js/language.js"></script> --did you get your code sample from some documentation? Anyway, the code example your latest does show a FORM element, but with the buttons outside it (a strange solution that may or may not work). You could try placing the </form> end tag after the buttons instead, but I haven't tested myself. |
Pallama |
Jan 3 2021, 02:36 PM
Post
#4
|
Group: Members Posts: 5 Joined: 2-January 21 Member No.: 27,706 |
In my example you'd need separate links for every URL shown in your javascript code sample. But I don't know what some of the scripts in your code same is doing, like this part: CODE <script src="http://192.168.1.247/web/cgi-bin/hi3510/param.cgi?cmd=getlanguage" type="text/javascript"></script> <script type="text/javascript" src="http://192.168.1.247/web/js/language.js"></script> --did you get your code sample from some documentation? Anyway, the code example your latest does show a FORM element, but with the buttons outside it (a strange solution that may or may not work). You could try placing the </form> end tag after the buttons instead, but I haven't tested myself. The code is from the Jidetech cam "mobile" page "http://192.168.1.247/web/mobile.html" which I am trying to modify just to put ptzloc1-7 buttons on. There are several other pages on the cam server including a web/admin page which controls cam parameters and settings but don't seem relevant to what I am trying to do with the mobile page, which is to put an autostart on my touchscreen raspberry pi near my door in kiosk mode. I have not tested the Pi yet, debugging in windows and ubuntu first. The getlanguage is a line from the original script of the cam to set the interface language. Obviously I can delete it if I am the only user. The programming is apparently ancient and all over the web (search hi3510) but the one I have been relying in is shown HERE |
Lo-Fi Version | Time is now: 8th June 2024 - 06:38 PM |