Go to documentation repository
Format of events procedure for the PTZ device object:
OnEvent("TELEMETRY","_id_","_event_")
Operator format to describe actions with the PTZ devices:
DoReact("TELEMETRY","_id_","_command_" [,"_parameters_"]);
Format of events procedure for the Keyboard object:
OnEvent("TELEMETRY_EXT","_id_","_event_")
Operator format to describe actions with the Keyboard:
DoReact("TELEMETRY_EXT","_id_","_command_" [,"_parameters_"]);
The format of events procedure for the Control device object:
OnEvent("JOYSTICK","_id_","_event_")
Examples of using reactions of the PTZ device object:
Set autofocus when camera 1 is armed.
OnEvent("CAM","1","ARM") { DoReact("TELEMETRY","1", "AUTOFOCUS_ON"); }
Rotate camera to the position specified in the first preset with the relay enabled.
OnEvent("GRELE","1","ON") { telemetry_id= GetObjectParam("CAM","1","parent_id"); DoReact("TELEMETRY","telemetry_id","SETUP","GO_preset<1>"); }
Record the patrol route for Camera 1 corresponding to the PTZ device 1.1. The route consists of two points, such that to go from point 1 to point 2, you need to rotate the camera to the left at speed of 6 for two seconds. Patrolling must be performed at speed of 10. The time at each point of the route is 25 seconds. It is supposed that when the program is started, the camera is set to the position corresponding to the first point of the route.
OnEvent("MACRO","1","RUN") { DoReact("TELEMETRY","1.1","PATROL_LEARN","cam<1>,preset<1>,tel_prior<1>,dwell<25>,speed<10>,flush_tour<0>"); Wait(2); DoReact("TELEMETRY","1.1","LEFT","speed<6>,tel_prior<1>"); Wait(2); DoReact("TELEMETRY","1.1","STOP","speed<6>,tel_prior<1>"); Wait(2); DoReact("TELEMETRY","1.1","PATROL_LEARN","cam<1>,preset<2>,tel_prior<1>,dwell<25>,speed<10>,flush_tour<1>"); }
OnTime(W,D,X,Y,H,M, "01") { if(strequal(M,"0")) { name=H+"_"+M+"_"+S+".jpg"; //Camera 1 PTZ device 1.1 name1="Camera1 "+name; DoReact("TELEMETRY","1.1","GO_PRESET","preset<1>,tel_prior<1>"); DoReact("MONITOR","1","EXPORT_FRAME","cam<1>,file<d:\"+name1); //Camera 2 PTZ device 1.2 name="Camera2 "+name; DoReact("TELEMETRY","1.2","GO_PRESET","preset<1>,tel_prior<1>"); DoReact("MONITOR","1","EXPORT_FRAME","cam<2>,file<d:\"+name); } if(strequal(M,"15")) { name=H+"_"+M+"_"+S+".jpg"; //Camera 1 PTZ device 1.1 name1="Camera1 "+name; DoReact("TELEMETRY","1.1","GO_PRESET","preset<1>,tel_prior<1>"); DoReact("MONITOR","1","EXPORT_FRAME","cam<1>,file<d:\"+name1); //Camera 2 PTZ device 1.2 name="Camera2 "+name; DoReact("TELEMETRY","1.2","GO_PRESET","preset<1>,tel_prior<1>"); DoReact("MONITOR","1","EXPORT_FRAME","cam<2>,file<d:\"+name); } if(strequal(M,"30")) { name=H+"_"+M+"_"+S+".jpg"; //Camera 1 PTZ device 1.1 name1="Camera1 "+name; DoReact("TELEMETRY","1.1","GO_PRESET","preset<1>,tel_prior<1>"); DoReact("MONITOR","1","EXPORT_FRAME","cam<1>,file<d:\"+name1); //Camera 2 PTZ device 1.2 name="Camera2 "+name; DoReact("TELEMETRY","1.2","GO_PRESET","preset<1>,tel_prior<1>"); DoReact("MONITOR","1","EXPORT_FRAME","cam<2>,file<d:\"+name); } if(strequal(M,"45")) { name=H+"_"+M+"_"+S+".jpg"; //Camera 1 PTZ device 1.1 name1="Camera1 "+name; DoReact("TELEMETRY","1.1","GO_PRESET","preset<1>,tel_prior<1>"); DoReact("MONITOR","1","EXPORT_FRAME","cam<1>,file<d:\"+name1); //Camera 2 PTZ device 1.2 name="Camera2 "+name; DoReact("TELEMETRY","1.2","GO_PRESET","preset<1>,tel_prior<1>"); DoReact("MONITOR","1","EXPORT_FRAME","cam<2>,file<d:\"+name); } }
OnEvent("MACRO","1","RUN") { flag=1; n=5; [ for(i=1;flag;i=str(i+1)) { DoReact("TELEMETRY","1.1","GO_PRESET","preset<"+i+">,tel_prior<3>"); Sleep(200); DoReact("CAM_ZONE","1"+i,"ARM"); Wait(5); DoReact("CAM_ZONE","1"+i,"DISARM"); if(strequal(i,n)) {i=0;} } ] } OnEvent("MACRO","2","RUN") { flag=0; }
Example of using events and reactions of the Keyboard object:
Turn on the light and arm camera 2 after pressing the key 15 on the AXIS T8312 keyboard.
OnEvent ("TELEMETRY_EXT","1","KEY_PRESSED") { if (strequal(param0, "15")){ DoReact("TELEMETRY_EXT","1","RELE_ON","rele<15>"); DoReact("CAM","2","ARM"); } }