/*//1 is button 1 on numlock keyboard etc to 9 is button 9 0 is button 11 on numlock keyboard previous camera is button 10 next camera is button 12 (Alarm) First F1 matrix is button 21 (enter) Second F2 matrix is button 22 (clear) Third F3 matrix is button 23 (Info) Fourth F4 matrix is button 24 (/\) (||) all cameras matrix is button 40 (wiper) wiper on ptz camera is button 18 -- (near) near focus of camera is button 13 (far) far focus of camera is button 14 (a.focus) AUTOFOCUS of camera is button 15 (preset) preset of camera is button 16 (live) live mode of cameras is button 25 (audio) archive mode is button 26 */ tel_prior="3"; if (Event.GetParam("source_type")=="TELEMETRY" && Event.GetParam("param4_name")=="joystick") { // DoReactStr("TIMER","1","START","bound<2>"); var key=Event.GetParam("param7_val"); DebugLogString("Key:"+key); switch(key) { case "10": log("PREV CAM"); Var_var("cam")--; DoReactStr("MONITOR",Var_var("monitor"),"ACTIVATE_CAM","cam<"+Var_var("cam")+">"); Var_var("key")=""; break; case "12": log("NEXT CAM"); Var_var("cam")++; DoReactStr("MONITOR",Var_var("monitor"),"ACTIVATE_CAM","cam<"+Var_var("cam")+">"); Var_var("key")=""; break; case "13": log("FOCUS_IN"); DoReactStr("TELEMETRY",Var_var("telid"),"FOCUS_IN","tel_prior<"+tel_prior+">,speed<3>"); Var_var("key")=""; break; case "14": log("FOCUS_OUT"); DoReactStr("TELEMETRY",Var_var("telid"),"FOCUS_OUT","tel_prior<"+tel_prior+">,speed<3>"); Var_var("key")=""; break; case "15": log("FOCUS_AUTO"); DoReactStr("TELEMETRY",Var_var("telid"),"AUTOFOCUS_ON","tel_prior<"+tel_prior+">"); Var_var("key")=""; break; case "16": log("PRESET"); Var_var("preset")="1"; Var_var("key")=""; break; case "18": log("VIPER"); Var_var("key")=""; break; case "21": log("Screen.1"); DoReactStr("MONITOR",Var_var("monitor"),"KEY_PRESSED","key"); Var_var("key")=""; break; case "22": log("Screen.4"); DoReactStr("MONITOR",Var_var("monitor"),"KEY_PRESSED","key"); Var_var("key")=""; break; case "23": log("Screen.9"); DoReactStr("MONITOR",Var_var("monitor"),"KEY_PRESSED","key"); Var_var("key")=""; break; case "24": log("Screen.16"); DoReactStr("MONITOR",Var_var("monitor"),"KEY_PRESSED","key"); Var_var("key")=""; break; case "40": log("Screen.*"); DoReactStr("MONITOR",Var_var("monitor"),"KEY_PRESSED","key"); Var_var("key")=""; break; case "25": log("LIVE"); DoReactStr("MONITOR",Var_var("monitor"),"KEY_PRESSED","key"); Var_var("key")=""; break; case "26": log("ARCH"); DoReactStr("MONITOR",Var_var("monitor"),"KEY_PRESSED","key"); Var_var("key")=""; break; case "32": log("PATROL_START"); DoReactStr("TELEMETRY",Var_var("telid"),"PATROL_PLAY","tel_prior<"+tel_prior+">"); Var_var("key")=""; break; default: if (parseInt(key)<12) { if (parseInt(key)==11) {key="0";} Var_var("key")=Var_var("key")+key; DoReactStr("TIMER","1","START","bound<2>"); log("KEY="+Var_var("key")); } break; } } if (Event.SourceType=="TIMER" && Event.SourceId=="1" && Event.Action=="TRIGGER") { if (Var_var("preset")=="1" ) { log("GO PRESET"+Var_var("key")+" TelId="+ Var_var("telid")); Var_var("preset")="0"; DoReactStr("TELEMETRY",Var_var("telid"),"GO_PRESET","tel_prior<"+tel_prior+">,preset<"+Var_var("key")+">"); }; else { DoReactStr("MONITOR",Var_var("monitor"),"ACTIVATE_CAM","cam<"+Var_var("key")+">"); Var_var("cam")=Var_var("key"); } Var_var("key")=""; } if (Event.SourceType=="MONITOR" && Event.Action=="ACTIVATE_CAM") { Var_var("monitor")=Event.SourceId; Var_var("telid")=findcam(Event.GetParam("cam")); Var_var("cam")=Event.GetParam("cam"); log("CHOOSE Monitor="+Var_var("monitor")+ " cam= "+Var_var("cam") ); } function findcam(id) { var s="57-1.1|1-1.2|2-1.3"; var ss=s.split("|"); for(i = 0; i < ss.length; i++) { //DebugLogString(ss[i]); if (ss[i].indexOf(id+"-")==0) { var s1=ss[i].split("-"); return s1[1]; //DebugLogString(cam); } } return 0; } function log(s) {DebugLogString(s); }