if (Event.SourceType=="TELEMETRY_EXT" && Event.Action=="KEY_PRESSED") { if (Event.GetParam("guid_pk")!="") { var key=Event.GetParam("param0"); key=parseInt(key); if (key<10) { Var_var(Event.SourceId+"cam")+=key; DoReactStr("TELEMETRY_EXT",Event.SourceId,"PRINT_TEXT","y<1>,x<1>,display<0>,text<"+Var_var(Event.SourceId+"cam")+">"); } /* d-alarm e-ack f-alm reset a-osd b-alm recall c-cam func X-seq pause Y-tour seq Q-mon lock U-miulti screen V-el-zoom Z-go to last R-aux1 on S-aux2 on W-mark O-wiper P-def on T-search g-adjust h-menu m-exit n-enter M-shift N-clear J-stop K-play/pause L-rec I-shuttle hold G- "-" H- "+" C-recorder/unit E-cam posi Joy: o - joy button A - t B - u */ DebugLogString("Key:"+Event.GetParam("param0")); switch(Event.GetParam("param0")) { case "K"://play if (Var_var("play")==1) { Var_var("play")=0; monitor(Itv_var(Event.SourceId+"mon"),"KEY_PRESSED","key"); } else { Var_var("play")=1; monitor(Itv_var(Event.SourceId+"mon"),"KEY_PRESSED","key"); } break; case "J"://stop monitor(Itv_var(Event.SourceId+"mon"),"KEY_PRESSED","key"); Var_var("play")=0; break; case "I": //shuttle - àðõèâ\æèâîå âèäåî if (Var_var("arch")==1) { Var_var("arch")=0; monitor(Itv_var(Event.SourceId+"mon"),"KEY_PRESSED","key"); DebugLogString("### æèâîå âèäåî"); Display("live"); } else { Var_var("arch")=1; monitor(Itv_var(Event.SourceId+"mon"),"KEY_PRESSED","key"); DebugLogString("### ðåæèì àðõèâà"); Display("arch"); } break; case "N": //Clear Var_var(Event.SourceId+"cam")=""; Display(""); break; case "n": //Alt - Ýìóëÿöèÿ êëàâèøè Enter var WshShell = new ActiveXObject("WScript.Shell"); WshShell.SendKeys("{ENTER}") break; case "A": //Mon - set monitor id if (parseInt(Var_var(Event.SourceId+"cam"))>0) Itv_var(Event.SourceId+"mon")=Var_var(Event.SourceId+"cam"); Var_var(Event.SourceId+"cam")=""; Display(""); break; case "B": //cam set - set camera id Itv_var(Event.SourceId+"cam")=Var_var(Event.SourceId+"cam"); Var_var(Event.SourceId+"cam")=""; monitor(Itv_var(Event.SourceId+"mon"),"ACTIVATE_CAM","cam<"+Itv_var(Event.SourceId+"cam")+">"); Display(""); break; case "D": //preset - go_preset DoReactStr("TELEMETRY",GetPTZdevice(Itv_var(Event.SourceId+"cam")),"GO_PRESET","preset<"+Var_var(Event.SourceId+"cam")+">,tel_prior<3>"); Display("Go preset:"+Var_var(Event.SourceId+"cam")); Itv_var("pre")=Var_var(Event.SourceId+"cam"); Var_var(Event.SourceId+"cam")=""; break; case "F": //history - çàïèñü ïðåñåòà DoReactStr("TELEMETRY",GetPTZdevice(Itv_var(Event.SourceId+"cam")),"SET_PRESET","preset<"+Var_var(Event.SourceId+"cam")+">,tel_prior<3>"); DebugLogString("PTZ:"+GetPTZdevice(Itv_var(Event.SourceId+"cam"))+" PRESET:"+Var_var(Event.SourceId+"cam")); Display("Save preset:"+Itv_var(Event.SourceId+"cam")); Itv_var("pre")=Var_var(Event.SourceId+"cam"); Var_var(Event.SourceId+"cam")=""; break; case "i": //F1 monitor(Itv_var(Event.SourceId+"mon"),"KEY_PRESSED","key"); break; case "j": //F2 monitor(Itv_var(Event.SourceId+"mon"),"KEY_PRESSED","key"); break; case "k": //F3 monitor(Itv_var(Event.SourceId+"mon"),"KEY_PRESSED","key"); break; case "l": //F4 monitor(Itv_var(Event.SourceId+"mon"),"KEY_PRESSED","key"); break; } }//end guid } if (Event.SourceType=="TELEMETRY_EXT" && Event.Action=="MOVED") { if (Event.GetParam("guid_pk")!="") { var key=Event.GetParam("param0"); key=parseInt(key); var type=Event.GetParam("device"); type=parseInt(type); } if (type==0) { if (key==-1) monitor(Itv_var(Event.SourceId+"mon"),"KEY_PRESSED","key"); else monitor(Itv_var(Event.SourceId+"mon"),"KEY_PRESSED","key"); } else { if (key>0) monitor(Itv_var(Event.SourceId+"mon"),"KEY_PRESSED","key"); if (key<0) monitor(Itv_var(Event.SourceId+"mon"),"KEY_PRESSED","key"); } } function monitor(id,action,param) { if (parseInt(id)>0) { DoReactStr("MONITOR",id,action,param); DebugLogString("### id:"+id+ " action:"+action+" param:"+param); } } function GetPTZdevice(camId) { if (Var_var("PTZ_" + camId) == "") { DebugLogString("PTZ device for camera " + camId + " is unknown!"); var re = /id\.[0-9]+<(.+?)>/g; var sObjId = GetObjectIds("TELEMETRY"); var Id; while (Id = re.exec(sObjId)) { if (GetObjectParam("TELEMETRY",Id[1],"cam") == camId) { Lock(); Var_var("PTZ_" + camId) = Id[1]; Unlock(); DebugLogString("PTZ device for camera " + camId + " -- " + Id[1]); return Id[1]; } } } else {return Var_var("PTZ_" + camId);} } function Display(line2) { DoReactStr("TELEMETRY_EXT",Event.SourceId,"PRINT_TEXT","y<0>,x<1>,display<0>,text"); DoReactStr("TELEMETRY_EXT",Event.SourceId,"PRINT_TEXT","y<1>,x<1>,display<0>,text"); //CLEAR_DISPLAY }