Alarm Task Scrpt Language Verson 5.51 en Scrpt Language
Alarm Task Scrpt Language Table of Contents 3 Table of contents 1 Introducton 4 2 Defntons 5 2.1 Actons 5 2.2 Events and states 5 2.3 Alarm Task Engne 5 3 System ntegraton 6 4 Confguraton 7 5 Syntax 9 5.1 Acton types 9 5.1.1 AlarmMal 9 5.1.2 JpegPostng 11 5.1.3 Recordng 12 5.1.4 Connecton 12 5.1.5 ConnectonLst 15 5.1.6 RcpCommand 15 5.1.7 HttpCommand 17 5.1.8 VCAConfguraton 18 5.1.9 BcomCommand 18 5.1.10 ControlCode 19 5.1.11 MessageCheck 19 5.1.12 OperatonMode 21 5.1.13 Tmer 22 5.1.14 Stoppng an acton 23 5.2 State types 24 5.2.1 I/O states 24 5.2.2 Tamper states 25 5.2.3 Acton states 26 5.3 Condtons 27 5.3.1 Boolean composton of condtons 27 5.3.2 State condton 28 5.3.3 State operaton mode 28 5.3.4 Acton condton 28 5.4 Comments 29 6 Startng the Alarm Task Engne 31 Bosch Scherhetssysteme GmbH Scrpt Language 2012.05 V5.51 DOC
4 Introducton Alarm Task Scrpt Language 1 Introducton The Alarm Task Engne s an extenson of the alarm I/O (Input/Output) matrx. It supports the defnton of actons, acton tmers, temporary states and I/O states. Furthermore, the Alarm Task Engne supports condtons when actons shall be trggered or states shall be set. 2012.05 V5.51 DOC Scrpt Language Bosch Scherhetssysteme GmbH
Alarm Task Scrpt Language Defntons en 5 2 2.1 2.2 2.3 Defntons Actons Each devce provdes varous actons. Actons could be sendng of an alarm e mal, JPEG postng, sendng of RCP commands or connectng to another devce and so on. Wth the scrpt language t s possble to defne and to confgure the dfferent actons and the accordng parameters lke IP address or password and more. Events and states The scrpt language provdes the Boolean evaluaton of varous knds of states. Each devce has a dfferent number of I/O states. These could be relays, alarm nputs, connecton state and so on. Such states are ether enabled or dsabled. The number of I/O states depends on the partcular devce. Furthermore, there are states whch depend on the partcularly defned actons. Wth these states t s possble to query whether the executon of the acton was successful or not. Another possblty s to query whether a partcular connecton s even actve or not to a decoder or encoder. All I/O states and acton states are dstngushed between: Readable (R) Readable/Wrtable (R/W) Confgurable (C) R state means, you can just query ts current value. If you use R/W states, you can change the value. C states are used to set t to a dfferent knd of operaton mode lke bstable, monostable or perodc. An event s always created when the I/O state s changng. Consequently, the event has the temporal nformaton about whch state has changed from dsabled to enabled or vce versa. Alarm Task Engne The Alarm Task Engne parses all events of the I/O Manager module and evaluates changes of the I/O states. The Alarm Task Engne receves the events from the I/O Manager and trggers the accordngly defned actons. Bosch Scherhetssysteme GmbH Scrpt Language 2012.05 V5.51 DOC
6 en System ntegraton Alarm Task Scrpt Language 3 System ntegraton The followng fgure shows the archtecture whch s relevant for the Alarm Task Engne. The I/O Manager receves all types of events. Such events could be the changng of an alarm or an actvated vdeo nput and so on. Furthermore, f the IVA Task Engne s runnng, t can create events, too. All these created events are fed nto the I/O Manager. Consequently, the I/O Manager knows all I/O states and evaluates whether the state has been changed or not. Hence, t s guaranteed that the Alarm Task Engne s only runnng f a state has been changed. Fgure 3.1: Alarm Task Engne archtecture 2012.05 V5.51 DOC Scrpt Language Bosch Scherhetssysteme GmbH
Alarm Task Scrpt Language Confguraton en 7 4 Confguraton The Alarm Task Engne s confgured by a scrpt. There s the opton to create scrpts automatcally or you can enter the scrpt drectly. The scrpt s created automatcally based on the \Settngs.html browser page: Alarm > Alarm Connectons Alarm > Alarm E-Mal Network > FTP Postng Interfaces > Relay If you confgure these settngs, the scrpt s created and sent to the devce automatcally. The scrpt s shown n the edtor on the \Settngs.html browser page: Alarm > Alarm Task Edtor The followng fgure shows the user defned settngs for sendng an alarm e mal. Fgure 4.1: Alarm E-Mal dalog box The followng fgure dsplays the automatcally created scrpt. You see n the scrpt that an alarm e mal wll be sent to the entered mal server IP address f an alarm nput s actvated. Bosch Scherhetssysteme GmbH Scrpt Language 2012.05 V5.51 DOC
8 en Confguraton Alarm Task Scrpt Language Fgure 4.2: Alarm Task Engne scrpt It s also possble to edt the automatcally created actons and condtons manually. But after that, you cannot confgure the current settngs n the browser wthout loosng your manual changes because the new automatcally generated scrpt wll replace the current manually changed scrpt. If you edt the scrpt manually and the scrpt contans syntax errors, each error wll be lsted n the message box above the scrpt edtor, ndcatng the correspondng lne as shown n the followng fgure: Fgure 4.3: Alarm Task Engne error message Possble syntax errors are: password or URL too long mssng bracket, semcolon, and so on The message box could also dsplay other warnngs. If the scrpt s free of syntax errors, the message Scrpt successfully parsed. s dsplayed. The maxmum sze of the zpped scrpt fle s about 4 KB. If the scrpt gets too bg, the scrpt cannot be saved on the devce and a wrte error occurs. 2012.05 V5.51 DOC Scrpt Language Bosch Scherhetssysteme GmbH
Alarm Task Scrpt Language Syntax en 9 5 5.1 Syntax Acton types The scrpt language supports the confguraton of varous acton types. Each acton s confgured by standard and optonal parameters. The general syntax of actons s: <acton name> <dentfer>:={<standard parameters> [<optonal parameters>]}; There are two dfferent types of actons, asynchronous actons and synchronous actons. It can take several seconds before asynchronous actons are fnshed or started. In contrast, the synchronous actons are executed mmedately. The followng lst shows the <acton name> and whether the acton s asynchronous or synchronous: Asynchronous: AlarmMal JpegPostng Recordng Connecton ConnectonLst RcpCommand HttpCommand VCAConfguraton BcomCommand ControlCode MessageCheck Synchronous: OperatonMode Tmer An <dentfer> begns wth a lower-case phrase that can be followed by ether: A captalzed phrase A lower-case phrase A dgt An underscore Examples: alarmmal_1 con_23 The maxmum length of an dentfer s 31 characters. Each acton has at least one parameter. All parameters have the same syntax whch s as follows: <parameter name>(<parameter>) Note that numbered parameters have to be entered n the correct order. Ths s the case for almost all standard parameters and only few optonal parameters. Parameters that come wth bullet ponts may be entered n random order. 5.1.1 AlarmMal Alarms can be documented by e mal. Ths allows notfcaton of clents whch do not have a vdeo recever. Thus you can defne an acton that automatcally sends an e mal to a prevously defned e mal address. Standard parameters: 1. IP("192.168.0.1") Specfy the IP or URL address of an e mal server that operates on the SMTP standard here. The maxmum URL length s 127 characters. Bosch Scherhetssysteme GmbH Scrpt Language 2012.05 V5.51 DOC
10 en Syntax Alarm Task Scrpt Language 2. To("test@vcs.com") Enter the e mal address for alarm e mals here. The maxmum e mal length s 127 characters. Optonal parameters: Layout(<format>) You can select the data format of the alarm message. The <format> can be: Standard: wth one or more JPEG mage fles attached. SMS: E mal s sent n SMS format to an e mal-to SMS gateway (for example to send an alarm to a cell phone) wthout an mage attachment. Ths value s the default format. From("test@vcs.com") Enter the sender e mal address here. The default address s vdeoserver. Subject("Alarm Mal") Enter the e mal subject here. The default subject s alarm. Password("anonymous") If the e mal server s password protected, you can enter the password here. Logn("anonymous") Enter the logn for the e mal server here. Camera(1,2,3,...) In order to select mage fles, you must lst the partcular cameras. To select all cameras, you can also use the word All. The default value s empty. That means, no mage fle wll be sent. FleName("Alarm_JPEG") You can specfy the fle name for the JPEG attachment. The default name s lve_'camname'_'date'.jpg. The maxmum length of the fle name s 63 characters. If the name s too long, t s cut off at the maxmum length. The fle name can contan a number of optonal parameters whch are automatcally flled n by the devce. These are %b for date/tme %c for camera name %f for fle number %l for lne number Format(<formats>) Select the resoluton of the JPEG mages. You can choose between varous <formats>: Small: 176 144/120 pxels (QCIF) Medum: 352 288/240 pxels (CIF) Large: 704 567/480 pxels (4CIF). Ths s the default value. 720P: 1280 720 pxels (only avalable for HD cameras) 1080P: 1920 1080 pxels (only avalable for HD cameras) 5MP: 2592 1944 pxels (only avalable for 5MP cameras) Name("Acton Name") Enter a name for the acton here. Ths name s then recorded as metadata when the acton s processed. Thus, you can search for ths name n recordngs at a later date. Do not use any specal characters, for example &, n the name. Specal characters are not supported by the system s nternal management. 2012.05 V5.51 DOC Scrpt Language Bosch Scherhetssysteme GmbH
Alarm Task Scrpt Language Syntax en 11 Example: AlarmMal mal:={ip("192.168.0.1")to("to@vcs.com") Layout(Standard)From("from@vcs.com") Subject("test")Password("anonymous") Logn("anonymous")Camera(1,3)Name("alarm emal")}; 5.1.2 JpegPostng You can defne an acton for ndvdually postng one or more JPEG mages on an FTP server. If you change the scrpt, all open FTP connectons are closed. Standard parameters: 1. IP("192.168.0.1") Enter the IP or URL address of the FTP server on whch you wsh to save the JPEG mages here. The maxmum URL length s 127 characters. 2. Logn("anonymous") Enter the logn to the FTP server here; the maxmum length s 31 characters. 3. Password("anonymous") Enter the password of the FTP server here; the maxmum length s 31 characters. Optonal parameters: Format(<formats>) Select the resoluton of the JPEG mages. You can choose between varous <formats>: Small: 176 144/120 pxels (QCIF) Medum: 352 288/240 pxels (CIF) Large: 704 567/480 pxels (4CIF). Ths s the default value. 720P: 1280 720 pxels (only avalable for HD cameras) 1080P: 1920 1080 pxels (only avalable for HD cameras) 5MP: 2592 1944 pxels (only avalable for 5MP cameras) Path("root/") Enter the path on the FTP server here. The default path s an empty strng. FleName("jpegPostng") You can specfy the fle name for the fles whch are archved on the FTP server. The default name s snap. The maxmum length of the fle name s 31 characters mnus the suffx length and the extenson.jpg. If the name s too long, t s cut off at the maxmum length. The fle name can contan a number of optonal parameters whch are automatcally flled n by the devce. These are: %b for date/tme %c for camera name %f for fle number %l for lne number If one of these parameters s used, t s no longer possble to choose Date for the parameter <suffx>. Suffx(<suffx>) You can select how fle names wll be created for the ndvdual mages whch are transmtted. The <suffx> can be: Overwrte: The same fle name s always used. Some exstng fles wll be overwrtten wth the current fle name. Ths suffx s also the default value. Bosch Scherhetssysteme GmbH Scrpt Language 2012.05 V5.51 DOC
12 en Syntax Alarm Task Scrpt Language Increment: A number from 000 to 255 s added to the fle name, for nstance snap_001_c1.jpg, and automatcally ncremented by one. When t reaches 255, the countng process restarts from 000. After you have modfed the scrpt, the suffx wll also start from 000. In case the server s not avalable the number wll be ncreased nevertheless, though the generated fles wll be lost. Ths causes a gap n the fle numbers when the connecton s re-establshed. Date: The date and tme are automatcally added to the fle name. When settng ths parameter, ensure that the unt's date and tme are always set correctly. Example: the fle snap_c1_011005_114530.jpg of camera 1 was stored on October 1, 2005 at 11:45:30 a.m. Camera(1,2,...) For selectng the JPEG fles you must lst the partcular cameras. To select all cameras, you can also use the word All. The default camera s 1. Name("Acton Name") Enter a name for the acton here. Ths name s then recorded as metadata when the acton s processed. Thus, you can search for ths name n recordngs at a later date. Do not use any specal characters, for example &, n the name. Specal characters are not supported by the system s nternal management. Example: JpegPostng postng:={ip("192.168.0.1") Logn("anonymous")Password("anonymous") Format(Small)Path("test")FleName("alarm_%b_%c") Suffx(Increment)Camera(All)Name("Jpeg postng")}; 5.1.3 Recordng It s possble to defne an acton that sends a command for startng and stoppng the recordng. Ths acton has one standard parameter only. Precondtons for recordng are a storage medum and that the recordng scheduler s enabled. If you change the scrpt, the actvated recordng wll not be stopped because the recordng mght have been started from another clent. If you want to stop the recordng, you have to do t manually. Standard parameter: Camera(1,2,...) You can lst all cameras for whch the recordng should be started or stopped. To select all cameras, you can also use the word All. Example: Recordng recordng:={camera(1,2,3)}; See also Stoppng an acton, 23 5.1.4 Connecton You can defne a vdeo and an audo connecton from an encoder to a decoder or vce versa. The devce of the \Settngs.html browser page where you enter the scrpt s the local devce, the other one s the remote devce. It s possble to start and stop a connecton. 2012.05 V5.51 DOC Scrpt Language Bosch Scherhetssysteme GmbH
Alarm Task Scrpt Language Syntax en 13 If you change the scrpt, all open connectons wll be closed. Standard parameter: IP("www.bosch.com") Enter the IP or URL address of the devce you would lke to connect here. The maxmum URL length s 127 characters. If you use a decoder, the optonal parameter LocalDrecton (see below) must be set. Optonal parameters: Protocol(<protocol>) Select one of these protocols: UDP: UDP protocol, the default value. It s recommended to use the UDP protocol. TCP: TCP protocol LocalLne(<lne>) Enter the local lne as nteger that should be connected to a remote staton. The default lne s 0. That means, the frst lne wth an actve vdeo wll be chosen. LocalCoder(<coder>) A coder s a montor or vew where you can see the vdeo. The default coder s 0. That means, the frst montor on whch a vdeo can dsplayed wll be chosen. LocalDrecton(<drecton>) Choose from the followng optons: Out (outgong): Use ths opton f the local devce s an encoder. Ths opton s the default value. In (ncomng): Use ths opton f the local devce s a decoder. B (bdrectonal): For devces whch support both outgong and ncomng drecton. RemoteLne(<lne>) Enter the remote lne as nteger where the connecton should be establshed. The default lne s 0. That means, the frst free lne of the remote staton wll be chosen. RemoteCoder(<coder>) A coder s a montor or vew where you can see the vdeo. The default coder s 0. That means, the frst free montor of the remote staton wll be chosen. RemotePort(<port>) Dependng on the network confguraton, you can set a browser port: HTTP: Ths value desgnates port number 80 (default value). HTTPS: Ths value desgnates port number 443 and enables the encrypton mode automatcally. Enter a vald port number manually. If you use port number 443, the SSL encrypton mode wll be set to true automatcally. SSL(<boolean>) You can set the encrypton mode <boolean> to true or false. If you want to use an HTTPS connecton, you must enable SSL mode. The default value for SSL mode s false. Audo(<boolean>) For <boolean>, enter true to enable and false to dsable the audo connecton; false s the default value. Bosch Scherhetssysteme GmbH Scrpt Language 2012.05 V5.51 DOC
14 en Syntax Alarm Task Scrpt Language Password("anonymous") If the remote devce s password protected, enter the password here. The default password s an empty strng. The maxmum length s 31 characters. VdeoCodng(<codng>) Enter one of the codng types: MPEG2: MPEG-2 codng MPEG4: MPEG-4 codng H264: H.264 codng All: The best match wll be attempted for connecton. Ths s the default value. VdeoSubsttute(<boolean>) If a connecton already exsts, you dsconnect the old one wth the value true and replace t wth the new one. The default value s false. Name("Acton Name") Enter a name for the acton here. Ths name s then recorded as metadata when the acton s processed. Thus, you can search for ths name n recordngs at a later date. Do not use any specal characters, for example &, n the name. Specal characters are not supported by the system s nternal management. Example: Fgure 5.1: Encoder/Decoder connectons 2012.05 V5.51 DOC Scrpt Language Bosch Scherhetssysteme GmbH
Alarm Task Scrpt Language Syntax en 15 In the fgure above you see the connecton from an encoder to a hardware decoder. In ths fgure the encoder s the local staton and the decoder the remote. A decoder devce has one or four vews per lne. They are called sngle or quad vew. You can set the coder per lne where you want to see the vdeo. In the followng example, the vdeo from the encoder, Lne 1 and Coder 1, should be connected to the decoder, Lne 3 and Coder 4: Connecton con_1:={ip("192.168.0.2")locallne(1)localcoder(1) RemoteLne(3)RemoteCoder(4)}; See also Stoppng an acton, 23 5.1.5 ConnectonLst Wth ths acton t s possble to defne the order n whch connectons should be actvated untl a connecton has been establshed. It s also possble to stop ths acton. Standard parameter: Connecton(con_1,con_2,...) Lst the connectons here. Before you enter the connectons you must defne all of them. The acton wll try to connect the frst one after about ten seconds and proceed wth the next one untl a connecton has been establshed. Optonal parameters: AutoConnect(<boolean>) You enable the AutoConnect property wth true or dsable t wth false (default). If the property s actvated, the connecton lst s restarted after one second delay untl a connecton has been establshed. If AutoConnect s dsabled, the connecton lst wll not be restarted. Name("Acton Name") Enter a name for the acton here. Ths name s then recorded as metadata when the acton s processed. Thus, you can search for ths name n recordngs at a later date. Do not use any specal characters, for example &, n the name. Specal characters are not supported by the system s nternal management. Example: Connecton con_1:={ip("192.168.0.1")}; Connecton con_2:={ip("192.168.0.2")}; ConnectonLst autoconnect:={connecton(con_1,con_2)autoconnect(true) Name("Connecton Lst")}; See also Stoppng an acton, 23 Connecton, 12 5.1.6 RcpCommand Wth ths acton you send RCP commands to the devce tself (local host) or to another devce. Standard parameter: Command("<rcp command>") The <rcp command> has the same structure as the CGI command. It s composed as follows: rcp.xml?command= Bosch Scherhetssysteme GmbH Scrpt Language 2012.05 V5.51 DOC
16 en Syntax Alarm Task Scrpt Language plus an RCP+ tag code and separated by ampersands (&) correspondng parameters lke for example: type (datatype) drecton protocol payload num (numercal descrptor) sessond (sesson ID) For further nformaton about RCP+ commands, please see the respectve RCP Plus Reference documentaton. Examples: rcp.xml?command=0x061c&type=p_octet&drecton=write &protocol=tcp&payload=0x0101004001000000&num=1 rcp.xml?command=0x028f&type=t_dword&drecton=write &protocol=tcp&payload=12&num=1 Optonal parameters: SSL(<boolean>) You enable the encrypton mode for sendng the RCP command wth true or dsable t wth false (default value). Port(<port>) Enter the <port> for sendng the RCP command here: HTTP: Ths value desgnates port number 80 (default value). HTTPS: Ths value desgnates port number 443 and enables the encrypton mode automatcally. Enter a vald port number manually. If you use port number 443, the SSL encrypton mode wll be set to true automatcally. Password("anonymous") If the remote devce s password protected, enter the password here. The default password s an empty strng. The maxmum length s 31 characters. UserName(<username>) Enter the correspondng user name for the password here. The user name defnes the authorzaton level. Possble levels for <username> are: Servce: Ths s the hghest authorzaton level (default value). After enterng the correct password, ths authorzaton level allows you to use all the functons of the devce and change all confguraton settngs. User: Ths s the mddle authorzaton level. Wth ths authorzaton level, you can operate the devce, but you cannot change the confguraton. Lve: Ths s the lowest authorzaton level. Wth ths authorzaton level, you can vew lve vdeo, but you cannot operate the devce or change the confguraton. IP("192.168.0.1") Enter the IP or URL address here. The default IP address s 127.0.0.1 (local host). The maxmum URL length s 127 characters. Name("Acton Name") Enter a name for the acton here. Ths name s then recorded as metadata when the acton s processed. Thus, you can search for ths name n recordngs at a later date. 2012.05 V5.51 DOC Scrpt Language Bosch Scherhetssysteme GmbH
Alarm Task Scrpt Language Syntax en 17 Do not use any specal characters, for example &, n the name. Specal characters are not supported by the system s nternal management. Example: RcpCommand sendrcp:={ Command("rcp.xml?command=0x002f&type=P_STRING&drecton=WRITE&num=1") SSL(true)Port(HTTPS)IP("192.168.0.1")Password("anonymous")UserName(User) Name("Rcp Command 0x002")}; 5.1.7 HttpCommand Wth ths acton you send HTTP commands to the devce tself (local host) or to another devce. Standard parameter: Command("<http command>") The <http command> can be any knd of HTTP command whch shall be sent to an HTTP server usng GET/. Optonal parameters: SSL(<boolean>) You enable the encrypton mode for sendng the HTTP command wth true or dsable t wth false (default value). Port(<port>) Enter the <port> for sendng the HTTP command here: HTTP: Ths value desgnates port number 80 (default value). HTTPS: Ths value desgnates port number 443 and enables the encrypton mode automatcally. Enter a vald port number manually. If you use port number 443, the SSL encrypton mode wll be set to true automatcally. Password("anonymous") If the remote devce s password protected, enter the password here. The default password s an empty strng. The maxmum length s 31 characters. UserName(<username>) Enter the correspondng user name for the password here. The user name defnes the authorzaton level. Possble levels for <username> are: Servce: Ths s the hghest authorzaton level (default value). After enterng the correct password, ths authorzaton level allows you to use all the functons of the devce and change all confguraton settngs. User: Ths s the mddle authorzaton level. Wth ths authorzaton level, you can operate the devce, but you cannot change the confguraton. Lve: Ths s the lowest authorzaton level. Wth ths authorzaton level, you can vew lve vdeo, but you cannot operate the devce or change the confguraton. IP("192.168.0.1") Enter the IP or URL address here. The default IP address s 127.0.0.1 (local host). The maxmum URL length s 127 characters. Name("Acton Name") Enter a name for the acton here. Ths name s then recorded as metadata when the acton s processed. Thus, you can search for ths name n recordngs at a later date. Bosch Scherhetssysteme GmbH Scrpt Language 2012.05 V5.51 DOC
18 en Syntax Alarm Task Scrpt Language Do not use any specal characters, for example &, n the name. Specal characters are not supported by the system s nternal management. Example: HttpCommand sendhttp:={ Command("HttpSrv.aspx?command=httpCommand1")SSL(true) Port(HTTPS)IP("192.168.0.1") Password("anonymous")UserName(User)Name("Http Command 1")}; 5.1.8 VCAConfguraton Wth ths acton you apply a certan VCA confguraton profle to a vdeo lne. Standard parameters: 1. Lne(<lne>) Enter the vdeo lne (startng from 1) for whch you would lke to set the confguraton. 2. Confguraton(<confg>) Enter the number of the confguraton profle whch you would lke to set. 0 means no confguraton. Optonal parameter: Name("Acton Name") Enter a name for the acton here. Ths name s then recorded as metadata when the acton s processed. Thus, you can search for ths name n recordngs at a later date. Do not use any specal characters, for example &, n the name. Specal characters are not supported by the system s nternal management. Example: VCAConfguraton setvcaconfg:={ Lne(1)Confguraton(1)Name("SetConfg 1")}; 5.1.9 BcomCommand Wth ths acton you send BCom commands to the devce tself (local host). For further nformaton about BCom, please see the BCom-Blnx Command Interface documentaton. Standard parameters: 1. Server (<BcomServer>) Enter the <BcomServer> to whch the command should be sent here: DevceSrv: devce server CameraSrv: camera server PtzSrv: PTZ server CaSrv: content analyss server IoSrv: I/O server 2. ObjectId(<Id>) Enter the BCom object <Id> here. The ID can be ether decmal or hexadecmal. 3. Payload("0x1234") Enter the BCom command payload here. The payload must be hexadecmal and start wth 0x. The length of the payload must match the length specfed n the BCom documentaton for the correspondng object. 2012.05 V5.51 DOC Scrpt Language Bosch Scherhetssysteme GmbH
Alarm Task Scrpt Language Syntax en 19 Optonal parameter: Name("Acton Name") Enter a name for the acton here. Ths name s then recorded as metadata when the acton s processed. Thus, you can search for ths name n recordngs at a later date. Do not use any specal characters, for example &, n the name. Specal characters are not supported by the system s nternal management. Example: BcomCommand sendbcom:={ Server(CameraSrv)ObjectId(0x0140)Payload("0x0001") Name("Bcom Command 0x0140")}; 5.1.10 ControlCode Wth ths acton you send BCom control codes to the devce tself (local host). For further nformaton about BCom control codes please see the BCom-Blnx Command Interface documentaton. Standard parameters: 1. Operaton(<type>) Enter the <type> of operaton here: AuxOn AuxOff Shot Set 2. Number(<num>) Enter the control code number <num> here. Optonal parameter: Name("Acton Name") Enter a name for the acton here. Ths name s then recorded as metadata when the acton s processed. Thus, you can search for ths name n recordngs at a later date. Do not use any specal characters, for example &, n the name. Specal characters are not supported by the system s nternal management. Example: ControlCode commandlock:={ Operaton(AuxOn)Number(90)Name("ControlCode 90 on")}; 5.1.11 MessageCheck Wth ths acton you check for receved messages from the devce tself (local host) or from another devce. The message check needs to be performed regularly and wthn a tme perod shorter than 20 seconds. Otherwse messages can be lost. Addtonally, a maxmum of 32 messages can be receved between two consecutve checks. If the specfed message has been receved, the acton state s set to actvated whch can be checked va IsActvated(). After a short tme the state s automatcally dsabled agan. Standard parameter: Message("<message>") Here you specfy whch messages you want to check. Bosch Scherhetssysteme GmbH Scrpt Language 2012.05 V5.51 DOC
20 en Syntax Alarm Task Scrpt Language <message> has the same structure as the CGI command. It s composed as follows: rcp.xml?message= plus a message tag code or a lst of message tag codes Examples: rcp.xml?message=0x01c0 rcp.xml?message=0x01c0$01c1 Optonal parameters: Payload("0x1234") Here you specfy a certan payload. Ths s checked aganst the payload whch has been receved wthn the message. Only f the message has the same payload as specfed here, the MessageCheck acton state s actvated. Num(<ndex>) Here you specfy a certan numerc parameter. Ths s checked aganst the numerc parameter whch has been receved wthn the message. Only f the message has the same numerc parameter as specfed, the MessageCheck acton state s actvated. SSL (<boolean>) You enable the encrypton mode for sendng the message check wth true or dsable t wth false (default value). Port(<port>) Enter the <port> for sendng the message check here: HTTP: Ths value desgnates port number 80 (default value). HTTPS: Ths value desgnates port number 443 and enables the encrypton mode automatcally. Enter a vald port number manually. If you use port number 443, the SSL encrypton mode wll be set to true automatcally. Password("anonymous") If the remote devce s password protected, enter the password here. The default password s an empty strng. The maxmum length s 31 characters. UserName(<username>) Enter the correspondng user name for the password here. The user name defnes the authorzaton level. Possble levels for <username> are: Servce: Ths s the hghest authorzaton level (default value). After enterng the correct password, ths authorzaton level allows you to use all the functons of the devce and change all confguraton settngs. User: Ths s the mddle authorzaton level. Wth ths authorzaton level, you can operate the devce, but you cannot change the confguraton. Lve: Ths s the lowest authorzaton level. Wth ths authorzaton level, you can vew lve vdeo, but you cannot operate the devce or change the confguraton. IP("192.168.0.1") Enter the IP or URL address here. The default IP address s 127.0.0.1 (local host). The maxmum URL length s 127 characters. Name("Acton Name") Enter a name for the acton here. Ths name s then recorded as metadata when the acton s processed. Thus, you can search for ths name n recordngs at a later date. 2012.05 V5.51 DOC Scrpt Language Bosch Scherhetssysteme GmbH
Alarm Task Scrpt Language Syntax en 21 Do not use any specal characters, for example &, n the name. Specal characters are not supported by the system s nternal management. Example: MessageCheck msg1:={ Message("rcp.xml?message=0x0a8b")Num(1) Payload("0x00")IP("192.168.0.1")}; OperatonMode trgger5sec:={low(1)hgh(50)}; TempState(1):=trgger5sec; f(tempstate(1)) then msg1; f(isactvated(msg1)) then Relay(1):=true; See also Acton states, 26 5.1.12 OperatonMode You can confgure the operaton mode of C states. C states have a normal behavor, but you can change the mode wth ths acton. You can confgure the operaton mode of C states only. You can set a bstable, monostable or perodc mode. If you change the scrpt, all used C states wll be set to the dle state open. Further, the C states whch were used n the monostable or perodc mode wll be dsabled. Bstable Wth bstable mode, you specfy whether the C state should be open or closed. Standard parameter: Idle(<dle state>) Confgure the <dle state> here. It can be open or closed. The default value for all states s open. Monostable In monostable mode, the C state wll return to dsabled after a defned tme. Standard parameter: Hgh(<tme>) Enter the duraton of <tme> n tenths of a second. Hgh means, the C state s enabled and after the specfed tme t wll be dsabled. The <tme> value must not be 0. Optonal parameter: Idle(<dle state>) Confgure the <dle state> here. It can be open or closed. The default value for all states s open. Bosch Scherhetssysteme GmbH Scrpt Language 2012.05 V5.51 DOC
22 en Syntax Alarm Task Scrpt Language Perodc Wth perodc mode, you defne how long a C state should be enabled or dsabled. Standard parameters: 1. Low(<tme>) Enter the duraton of <tme> n tenths of a second. Low means, the C state s dsabled. The <tme> value must not be 0. 2. Hgh(<tme>) Enter the duraton of <tme> n tenths of a second. Hgh means, the C state s enabled. The <tme> value must not be 0. Optonal parameters: Idle(<dle state>) Confgure the <dle state> here. It can be open or closed. The default value for all states s open. Name("Acton Name") Enter a name for the acton here. Ths name s then recorded as metadata when the acton s processed. Thus, you can search for ths name n recordngs at a later date. Do not use any specal characters, for example &, n the name. Specal characters are not supported by the system s nternal management. Examples: OperatonMode bstable:={idle(closed)name("bstable mode")}; OperatonMode monostable:={hgh(20)}; OperatonMode perodc:={low(100)hgh(20)idle(closed)}; See also State operaton mode, 28 5.1.13 Tmer Ths acton s used for settng the daly or weekly tmer. Thus, you defne actons that are executed at a partcular tme. A day s subdvded nto 24 tme slces. The defned tme s evaluated every mnute. Thus the tme can be defned from 00:00 to 23:59. The current state of the acton s nterpreted by the dentfer of the acton. Standard parameters: 1. TmeBegn(<tme>) Enter the start <tme> of the tmer acton, for nstance 11:01. 2. TmeEnd(<tme>) Enter the end <tme> of the tmer acton, for nstance 23:01. If the end tme s set before the start tme, the tmer s dsabled from the end tme to the start tme. Example: TmeBegn(22:10)TmeEnd(10:10) The tmer s enabled from 00:00 to 10:10 and from 22:10 to 23:59 at the same day. From 10:11 to 22:09, the tmer s dsabled. If you use the optonal parameters, ths condton wll depend on the weekday. 2012.05 V5.51 DOC Scrpt Language Bosch Scherhetssysteme GmbH
Alarm Task Scrpt Language Syntax en 23 Optonal parameters: 1. DayBegn(<weekday>) Here you enter the <weekday> n a short form (Mo, Tu, We, Th, Fr, Sa and Su) on whch the tmer should start. 2. DayEnd(<weekday>) Here you enter the <weekday> n a short form (Mo, Tu, We, Th, Fr, Sa and Su) on whch the tmer should end. Name("Acton Name") Enter a name for the acton here. Ths name s then recorded as metadata when the acton s processed. Thus, you can search for ths name n recordngs at a later date. Do not use any specal characters, for example &, n the name. Specal characters are not supported by the system s nternal management. If you want to defne a weekly tmer, you must set both parameters DayBegn and DayEnd. Examples: Tmer daly:={tmebegn(01:13)tmeend(14:30)}; The tmer s enabled from 01:13 to 14:30 every day. Tmer weekly:={tmebegn(01:13)tmeend(14:30)daybegn(mo) DayEnd(Th)Name("weekly tmer")}; The tmer s enabled from Monday, 01:13 to Thursday, 14:30. Note that start tme and day are lnked together as well as end tme and day. See also Acton states, 26 5.1.14 Stoppng an acton Some actons have the partcular property of beng executed permanently once they have been actvated, for nstance the Recordng acton. The scrpt language enables you to defne a statement for stoppng such an acton, for example stoppng a recordng or dsconnectng an actvated connecton. The common syntax s: Stop(<dentfer>) The <dentfer> has to belong to a defned acton. In many cases, usng the Stop command s not obvous. The followng lst shows all actons where the Stop command can be used and explans the meanng: Recordng Stops the recordng. ConnectonLst If the AutoConnect parameter was set to true but no connecton could be establshed, ths acton wll keep runnng untl a connecton has been establshed. The acton can be termnated wth the Stop command at any tme. Connect Dsconnects the connecton. The operaton mode acton has a dfferent syntax. Here, you must allocate the Stop command to the C state as follows: Bosch Scherhetssysteme GmbH Scrpt Language 2012.05 V5.51 DOC
24 en Syntax Alarm Task Scrpt Language <C-state>:=Stop(<dentfer>) The <dentfer> has to belong to a defned acton operaton mode. If a C state s deactvated, the dle state s always set to open. Furthermore, the C states whch were used n the monostable and perodc mode wll be set to dsabled. Thus, after beng deactvated, C states always have a defned state. See also OperatonMode, 21 5.2 5.2.1 State types There are dfferent state types. The scrpt language enables you to request the value of a state whch s a Boolean. The general syntax of the dfferent state types s: <state name> <state name>(<nteger>) <state name>(<dentfer>) <state name>(<nteger>,<nteger>) I/O states I/O states are R states or C states, whch are as follows: R states: HddError Trggered by an HDD defect. Connect Trggered whenever a connecton has been establshed. EthernetLnk(<ndex>) There are nternal and external lnks. The nternal lnk always has the ndex 0. If a devce has only one lnk, the nternal lnk s coevally the external lnk. If a devce addtonally has a fber lnk, t always has the hghest ndex of the lnks. An actvated lnk status s always 1 or true. Input(<ndex>) Trggered by an external alarm nput. VdeoAlarm(<camera>) Trggered by an nterrupton of the vdeo sgnal. Moton(<camera>) Trggered by moton alarm. Remote(<ndex>) Trggered by a remote staton's swtchng contact (only f a connecton exsts). VCARule(<camera>,<rule>,<confguraton(opt)>) Trggered by a certan VCA alarm (<rule>) from a vdeo lne (<camera>). The <confguraton> parameter s optonal and addtonally checks f the alarm was generated by the specfed VCA confguraton profle. See also the IVA Task Scrpt Language documentaton. Key(<ndex>) Trggered by a softkey (1 to 8) or the alarm key (0) of a connected IntuKey keyboard. NghtMode Trggered when the nght mode of the devce s actvated (only for devces supportng nght mode). AudoAlarm(<audo lne>) Trggered by an audo alarm on the correspondng audo lne. 2012.05 V5.51 DOC Scrpt Language Bosch Scherhetssysteme GmbH
Alarm Task Scrpt Language Syntax en 25 VrtualAlarm(<ndex>) Trggered by a vrtual alarm nput. IsFrstPass Trggered once when the Alarm Task Engne s started and the scrpt s processed for the frst tme. For example, ths state s used to ntalze other states. VCATaskRunnng(<camera>) Trggered when the VCA task of a vdeo lne (<camera>) s runnng. For example, ths state s used to perform an acton or an alarm n case the VCA task s nterrupted. ManpulatonAlarm(<ndex>) C states: Trggered by an external manpulaton alarm (for example f the housng of the devce s opened). Only for devces whch support manpulaton alarms. Relay(<ndex>) The number of relays depends on the devce. TempState(<ndex>) There are 18 temporal states for savng. The number of cameras and ndces depends on the partcular devce except the temporal states. All numbers start wth 1 except the ndex of the Ethernet lnks whch starts wth 0. 5.2.2 Tamper states The MOTION+, IVMD (Intellgent Vdeo Moton Detecton) or IVA (Intellgent Vdeo Analyss) algorthms detect tamperng of a camera. The default algorthm s MOTION+. The dfferent knds of tamperng do not need to be enabled from the confguraton of the algorthms except the RefImageCheckFaled tamper state. Confgurng the tamper states s also possble on the browser page under SETTINGS > Advanced Mode > Alarm > VCA. You can dsable or enable all tamper states here. The output of possble tamper actons s accessble va Boolean states. For each state, the parameter s <camera>. Thus you have to enter the correspondng camera for the tamper state. The followng tamper states are avalable: SgnalTooNosy(<camera>) Ths state wll be enabled f the vdeo sgnal becomes too nosy, n such a way that automatc object detecton becomes mpossble. Ths can happen f an analog vdeo sgnal s transmtted over a large dstance. SgnalTooBrght(<camera>) Ths state wll be enabled f the vdeo sgnal becomes too brght, so that automatc object detecton becomes mpossble. Ths can happen f the camera s dazzled by a strong lght source. SgnalTooDark(<camera>) Ths state wll be enabled f the vdeo sgnal becomes too dark, so that automatc object detecton becomes mpossble. Ths can happen f the camera s covered by a sheet, n such a way that an almost black mage s recorded. SgnalLoss(<camera>) Ths state wll be enabled f the vdeo sgnal s lost. RefImageCheckFaled(<camera>) If a reference mage has been set durng the confguraton of the algorthms and the reference checkng of the algorthms has been enabled, manpulaton of the camera s detected by comparng the current vdeo sgnal wth the preset reference mage. Sgnfcant dfferences between the two mages are forwarded to the Alarm Task Engne. Bosch Scherhetssysteme GmbH Scrpt Language 2012.05 V5.51 DOC
26 en Syntax Alarm Task Scrpt Language GlobalChange(<camera>) Ths state wll be enabled f most of the mage content has been changed. Ths can happen f the camera s moved or f an object comes too close to the camera. 5.2.3 Acton states Some actons have R- or R/W states. Therewth, you verfy whether a defned acton was successful or not. For nstance, f you have defned an e mal but the SMTP server does not work or the logn s wrong, the e mal wll not be sent. Such errors are evaluated wth the followng syntax: Error(<dentfer>) Ths error state s an R/W state and the <dentfer> has to belong to a confgured acton, for nstance Error(mal). Here, mal s the dentfer of the acton AlarmMal. But the type of the errors cannot be nterpreted. That means, you cannot specfy the source of falure. The followng lst shows the actons whch have an error state and some hnts why an acton could not be executed successfully: RcpCommand Sendng an RCP command has not been successful. Maybe you have entered a wrong IP address. Connecton The connecton has not been establshed, e.g. because the IP address s ncorrect. AlarmMal The mal could not be sent to an SMTP server, e.g. because the server s password protected. JpegPostng Postng to an FTP server has not been successful because the server could not be reached. VCAConfguraton Settng the VCA confguraton has not been successful. BcomCommand Sendng a BCom command has not been successful. Maybe the object ID s wrong or the payload length s ncorrect. ControlCode Sendng a control code has not been successful. Maybe the control code number s ncorrect or out of range. MessageCheck The message check has not been successful. Maybe the tme nterval between two checks was too long or the remote devce s not avalable. HttpCommand Sendng an HTTP command has not been successful. Maybe you have entered a wrong IP address or the HTTP server dd not send back 200 OK. Error states are not set back to dsabled. That means, f the acton, for example JPEG postng, was not successful, the error state Error(postng) wll not be set back to dsabled. Thus, f you execute the acton once more and the postng was not successful agan, you cannot evaluate the error. Therefore, you must set back the error state. 2012.05 V5.51 DOC Scrpt Language Bosch Scherhetssysteme GmbH
Alarm Task Scrpt Language Syntax en 27 Example: JpegPostng postng:={ip("192.168.0.1") Logn("anonymous")Password("anonymous")}; f(error(postng))then Error(postng):=false; Furthermore, you can verfy whether a defned acton s actvated or not, for nstance, wth the Connecton acton. The syntax of ths state s: IsActvated(<dentfer>) The <dentfer> has to belong to a confgured acton as follows: Connecton If there s a connecton to the IP address entered, the state s enabled, otherwse t s dsabled. ConnectonLst When tryng to connect an encoder or decoder, the state s enabled, otherwse t s dsabled. Tmer If the confgured tmer s actve, the state s enabled, otherwse t s dsabled. Example: Tmer dalyrelay:={tmebegn(08:00)tmeend(18:00)}; f(isactvated(dalyrelay))then Relay(1):=true else Relay(1):= false; MessageCheck If the defned message has been receved and f specfed the payload and numerc parameters are correct, the state s enabled. After a short tme the state s automatcally dsabled agan. 5.3 5.3.1 Condtons Boolean composton of condtons A Boolean condton s a condton that returns a Boolean value, that s true or false. In ths Boolean composton you can use: constants negaton conjuncton dsjuncton There are two constants whch have a value wth a fxed meanng. These constants are true (1) and false (0). The syntax of negaton, conjuncton and dsjuncton s: Negaton of condtons: <condton>:=!<condton> <condton>:=not <condton> Conjuncton of condtons: <condton>:=<condton> && <condton> <condton>:=<condton> and <condton> Dsjuncton of condtons: <condton>:=<condton> <condton> <condton>:=<condton> or <condton> Ambgutes n the evaluaton of expressons are resolved by prortes. Negatons have the hghest prorty, followed by conjunctons, and dsjunctons have the lowest prorty. Furthermore, the prorty can be controlled by puttng sub-expressons n parentheses: <condton>:=(<condton>) Bosch Scherhetssysteme GmbH Scrpt Language 2012.05 V5.51 DOC
28 en Syntax Alarm Task Scrpt Language Wth the help of the Boolean condtons you can combne all R-, R/W- and C states wth each other. Examples: (Relay(1) Moton(2)) && VdeoAlarm(1) IsActvated(con_1) and VCARule(2,3)!Connect or Error(sendRcp) 5.3.2 State condton Wth a state condton t s possble to set an R/W state dependng on a Boolean condton. The general syntax s: <R/W-state>:=<condton>; Consequently, the <R/W-state> s defned by the <condton> on the rght. If the result of the condton s true, the R/W state s enabled. If the condton s false, the R/W state s dsabled. Note that the R/W state s only set f the condton has changed. Some examples for usng states: Examples: Relay(1):=Moton(2) && VdeoAlarm(1); TempState(2):=not Relay(2) and VCARule(2,3); Relay(2):=true; 5.3.3 State operaton mode The TempState(<ndex>) and Relay(<ndex>) C states have a specal property. It s possble to allocate them a specfc operaton mode lke bstable, monostable or perodc. Before an operaton mode s allocated, t must be defned. Such statements are executed once each tme the Alarm Task Engne s ntalzed. The syntax s: <C-state>:=<dentfer>; The <dentfer> must be an OperatonMode acton. The followng example shows how to confgure a C state. In ths example a relay s dsabled for ten seconds and enabled for two seconds: OperatonMode perodc:={low(100)hgh(20)}; Relay(1):=perodc; Ths way, you only can actvate the operaton mode of a C state. It s not possble to stop or to deactvate the C state ths way. See also Acton condton, 28 5.3.4 Acton condton Actons defned wth an acton condton are executed on a partcular condton. The syntax of an acton condton s: f(<condton>)then <statement lst> [else <statement lst>]; A <statement lst> s defned as: <statement lst>:= <statement> <statement>:= <dentfer> <state condton> <statement>,<statement lst> <state operaton mode> The <dentfer> must belong to a confgured acton. 2012.05 V5.51 DOC Scrpt Language Bosch Scherhetssysteme GmbH
Alarm Task Scrpt Language Syntax en 29 Examples: You have confgured an acton for recordng and the recordng should start f the relay s enabled. Therefore, you must defne an acton condton as follows: Recordng recordng:={camera(1)}; f(relay(1))then recordng; After a moton alarm, an alarm e mal should be sent and a JPEG-fle should be posted. Frst, you have to confgure both actons, then you have to defne the acton condton as follows: JpegPostng postng:={ip("192.168.0.1") Logn("anonymous")Password("anonymous")}; AlarmMal mal:={ip("192.168.0.1")to("to@vcs.com")}; f(moton(1))then mal,postng; A relay should be set to monostable mode from 8:00 a.m. to 10:00 p.m., the remanng tme the relay should be set to normal mode. Therefore, you have to confgure an operaton mode, a tmer and a condton acton: OperatonMode monostable:={hgh(50)}; Tmer daly:={tmebegn(8:00)tmeend(22:00)}; f(isactvated(daly))then Relay(1):=monostable else Relay(1):=Stop(monostable); The statements wll be evaluated f the Boolean condton alternates from dsabled to enabled or from enabled to dsabled. If for securty reasons you want to send an alarm e mal each tme one of the relays Relay(1) or Relay(2) s enabled, you must defne the acton condton as follows: f(relay(1))then sendmal;f(relay(2))then sendmal; You cannot defne the acton condton n the followng way: f(relay(1) or Relay(2))then sendmal; In ths acton condton the alarm mal s only sent once even f both relays are enabled. See also State condton, 28 State operaton mode, 28 5.4 Comments You can set comments wthn the scrpt so that you can descrbe your actons or states or comment these out. There are two types of comments. The frst one s the lne comment. It starts wth the characters // (double slash) followed by other characters and ends wth a new lne lke: //comment The other one s the multlne comment. Ths one begns wth /* (slash and astersk) and ends wth */ (astersk and slash): /*multlne comment*/ It s also possble to combne both types. Everythng wthn a comment s not evaluated. Snce the scrpt sze s restrcted, you should lmt the number of comments to the necessary extent. Bosch Scherhetssysteme GmbH Scrpt Language 2012.05 V5.51 DOC
30 en Syntax Alarm Task Scrpt Language See also Confguraton, 7 2012.05 V5.51 DOC Scrpt Language Bosch Scherhetssysteme GmbH
Alarm Task Scrpt Language Startng the Alarm Task Engne en 31 6 Startng the Alarm Task Engne If you have automatcally or manually created a scrpt, the scrpt wll be sent to the devce. It s recommended to send the scrpt va HTTPS. Otherwse, the passwords and logn nformaton are sent plan. Then the scrpt s parsed on the devce. If the scrpt s free of syntax errors, the message Scrpt successfully parsed. s dsplayed above the Alarm Task Edtor and a new Alarm Task Engne s created. The Alarm Task Engne wll run untl a new one s created. Before the new Alarm Task Engne starts to run, all prevously created events whch belong to an older Alarm Task Engne are deleted. Also, all actons are deleted except the one whch s beng executed at that moment and the temporal states wll be set to dsabled. Only after that the new Alarm Task Engne s ntalzed. For example, the operaton mode of a C state s actvated or actons are beng executed when the Boolean condton s true and so on. Example: For nstance, you have confgured the devce and t s gong to reset. After the restart, the devce can reconnect automatcally or mmedately send an alarm e mal: Connecton con_1:={ip("192.168.9.1")}; AlarmMal restart:={ip("www.malserver.de") To("test@vcs.com")Subject("restart")}; f(true)then restart,con_1; See also I/O states, 24 Bosch Scherhetssysteme GmbH Scrpt Language 2012.05 V5.51 DOC
32 en Glossary Alarm Task Scrpt Language Glossary 4CIF 5MP CGI CIF C-state FTP HD HDD HTTP HTTPS I/O 2*2 Common Intermedate Format 5 Megapxel Common Gateway Interface Common Intermedate Format Confgurable state Fle Transfer Protocol Hgh Defnton Hard Dsk Drve Hypertext Transfer Protocol Hypertext Transfer Protocol Secure Input/Output JPEG Jont Photographc Expert Group MPEG Movng Pcture Experts Group QCIF Quarter Common Intermedate Format R/W-state Readable/Wrtable state RCP Remote Control Protocol R-state Readable state SMS Short Message Servce SMTP Smple Mal Transfer Protocol SSL Secure Sockets Layer TCP Transmsson Control Protocol UDP User Datagram Protocol IP Internet Protocol URL Unform Resource Locator 2012.05 V5.51 DOC Scrpt Language Bosch Scherhetssysteme GmbH
Bosch Scherhetssysteme GmbH Robert-Bosch-Rng 5 85630 Grasbrunn Germany www.boschsecurty.com Bosch Scherhetssysteme GmbH, 2012